vsrc_testsrc.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2007 Nicolas George <nicolas.george@normalesup.org>
3  * Copyright (c) 2011 Stefano Sabatini
4  * Copyright (c) 2012 Paul B Mahol
5  *
6  * This file is part of FFmpeg.
7  *
8  * FFmpeg is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * FFmpeg is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with FFmpeg; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 
23 /**
24  * @file
25  * Misc test sources.
26  *
27  * testsrc is based on the test pattern generator demuxer by Nicolas George:
28  * http://lists.ffmpeg.org/pipermail/ffmpeg-devel/2007-October/037845.html
29  *
30  * rgbtestsrc is ported from MPlayer libmpcodecs/vf_rgbtest.c by
31  * Michael Niedermayer.
32  *
33  * smptebars and smptehdbars are by Paul B Mahol.
34  */
35 
36 #include <float.h>
37 
38 #include "libavutil/avassert.h"
39 #include "libavutil/common.h"
40 #include "libavutil/opt.h"
41 #include "libavutil/imgutils.h"
42 #include "libavutil/intreadwrite.h"
43 #include "libavutil/parseutils.h"
44 #include "avfilter.h"
45 #include "drawutils.h"
46 #include "formats.h"
47 #include "internal.h"
48 #include "video.h"
49 
50 typedef struct {
51  const AVClass *class;
52  int w, h;
53  unsigned int nb_frame;
54  AVRational time_base, frame_rate;
55  int64_t pts;
56  int64_t duration; ///< duration expressed in microseconds
57  AVRational sar; ///< sample aspect ratio
59  int draw_once; ///< draw only the first frame, always put out the same picture
60  AVFrame *picref; ///< cached reference containing the painted picture
61 
62  void (* fill_picture_fn)(AVFilterContext *ctx, AVFrame *frame);
63 
64  /* only used by color */
65  char *color_str;
68  uint8_t color_rgba[4];
69 
70  /* only used by rgbtest */
71  uint8_t rgba_map[4];
73 
74 #define OFFSET(x) offsetof(TestSourceContext, x)
75 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
76 
77 #define COMMON_OPTIONS \
78  { "size", "set video size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str = "320x240"}, 0, 0, FLAGS },\
79  { "s", "set video size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str = "320x240"}, 0, 0, FLAGS },\
80  { "rate", "set video rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, 0, FLAGS },\
81  { "r", "set video rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, 0, FLAGS },\
82  { "duration", "set video duration", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64 = -1}, -1, INT64_MAX, FLAGS },\
83  { "d", "set video duration", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64 = -1}, -1, INT64_MAX, FLAGS },\
84  { "sar", "set video sample aspect ratio", OFFSET(sar), AV_OPT_TYPE_RATIONAL, {.dbl= 1}, 0, INT_MAX, FLAGS },
85 
86 
87 static const AVOption color_options[] = {
88  /* only used by color */
89  { "color", "set color", OFFSET(color_str), AV_OPT_TYPE_STRING, {.str = "black"}, CHAR_MIN, CHAR_MAX, FLAGS },
90  { "c", "set color", OFFSET(color_str), AV_OPT_TYPE_STRING, {.str = "black"}, CHAR_MIN, CHAR_MAX, FLAGS },
91 
93  { NULL },
94 };
95 
96 static const AVOption options[] = {
98  /* only used by testsrc */
99  { "decimals", "set number of decimals to show", OFFSET(nb_decimals), AV_OPT_TYPE_INT, {.i64=0}, 0, 17, FLAGS },
100  { "n", "set number of decimals to show", OFFSET(nb_decimals), AV_OPT_TYPE_INT, {.i64=0}, 0, 17, FLAGS },
101 
102  { NULL },
103 };
104 
105 static av_cold int init(AVFilterContext *ctx)
106 {
107  TestSourceContext *test = ctx->priv;
108  int ret = 0;
109 
110  if (test->nb_decimals && strcmp(ctx->filter->name, "testsrc")) {
111  av_log(ctx, AV_LOG_WARNING,
112  "Option 'decimals' is ignored with source '%s'\n",
113  ctx->filter->name);
114  }
115 
116  if (test->color_str) {
117  if (!strcmp(ctx->filter->name, "color")) {
118  ret = av_parse_color(test->color_rgba, test->color_str, -1, ctx);
119  if (ret < 0)
120  return ret;
121  } else {
122  av_log(ctx, AV_LOG_WARNING,
123  "Option 'color' is ignored with source '%s'\n",
124  ctx->filter->name);
125  }
126  }
127 
128  test->time_base = av_inv_q(test->frame_rate);
129  test->nb_frame = 0;
130  test->pts = 0;
131 
132  av_log(ctx, AV_LOG_VERBOSE, "size:%dx%d rate:%d/%d duration:%f sar:%d/%d\n",
133  test->w, test->h, test->frame_rate.num, test->frame_rate.den,
134  test->duration < 0 ? -1 : (double)test->duration/1000000,
135  test->sar.num, test->sar.den);
136  return 0;
137 }
138 
139 static av_cold void uninit(AVFilterContext *ctx)
140 {
141  TestSourceContext *test = ctx->priv;
142 
143  av_frame_free(&test->picref);
144 }
145 
146 static int config_props(AVFilterLink *outlink)
147 {
148  TestSourceContext *test = outlink->src->priv;
149 
150  outlink->w = test->w;
151  outlink->h = test->h;
152  outlink->sample_aspect_ratio = test->sar;
153  outlink->frame_rate = test->frame_rate;
154  outlink->time_base = test->time_base;
155 
156  return 0;
157 }
158 
159 static int request_frame(AVFilterLink *outlink)
160 {
161  TestSourceContext *test = outlink->src->priv;
162  AVFrame *frame;
163 
164  if (test->duration >= 0 &&
165  av_rescale_q(test->pts, test->time_base, AV_TIME_BASE_Q) >= test->duration)
166  return AVERROR_EOF;
167 
168  if (test->draw_once) {
169  if (!test->picref) {
170  test->picref =
171  ff_get_video_buffer(outlink, test->w, test->h);
172  if (!test->picref)
173  return AVERROR(ENOMEM);
174  test->fill_picture_fn(outlink->src, test->picref);
175  }
176  frame = av_frame_clone(test->picref);
177  } else
178  frame = ff_get_video_buffer(outlink, test->w, test->h);
179 
180  if (!frame)
181  return AVERROR(ENOMEM);
182  frame->pts = test->pts;
183  frame->key_frame = 1;
184  frame->interlaced_frame = 0;
185  frame->pict_type = AV_PICTURE_TYPE_I;
186  frame->sample_aspect_ratio = test->sar;
187  if (!test->draw_once)
188  test->fill_picture_fn(outlink->src, frame);
189 
190  test->pts++;
191  test->nb_frame++;
192 
193  return ff_filter_frame(outlink, frame);
194 }
195 
196 #if CONFIG_COLOR_FILTER
197 
199 
200 static void color_fill_picture(AVFilterContext *ctx, AVFrame *picref)
201 {
202  TestSourceContext *test = ctx->priv;
203  ff_fill_rectangle(&test->draw, &test->color,
204  picref->data, picref->linesize,
205  0, 0, test->w, test->h);
206 }
207 
208 static av_cold int color_init(AVFilterContext *ctx)
209 {
210  TestSourceContext *test = ctx->priv;
211  test->fill_picture_fn = color_fill_picture;
212  test->draw_once = 1;
213  return init(ctx);
214 }
215 
216 static int color_query_formats(AVFilterContext *ctx)
217 {
219  return 0;
220 }
221 
222 static int color_config_props(AVFilterLink *inlink)
223 {
224  AVFilterContext *ctx = inlink->src;
225  TestSourceContext *test = ctx->priv;
226  int ret;
227 
228  ff_draw_init(&test->draw, inlink->format, 0);
229  ff_draw_color(&test->draw, &test->color, test->color_rgba);
230 
231  test->w = ff_draw_round_to_sub(&test->draw, 0, -1, test->w);
232  test->h = ff_draw_round_to_sub(&test->draw, 1, -1, test->h);
233  if (av_image_check_size(test->w, test->h, 0, ctx) < 0)
234  return AVERROR(EINVAL);
235 
236  if ((ret = config_props(inlink)) < 0)
237  return ret;
238 
239  av_log(ctx, AV_LOG_VERBOSE, "color:0x%02x%02x%02x%02x\n",
240  test->color_rgba[0], test->color_rgba[1], test->color_rgba[2], test->color_rgba[3]);
241  return 0;
242 }
243 
244 static const AVFilterPad color_outputs[] = {
245  {
246  .name = "default",
247  .type = AVMEDIA_TYPE_VIDEO,
248  .request_frame = request_frame,
249  .config_props = color_config_props,
250  },
251  { NULL }
252 };
253 
254 AVFilter avfilter_vsrc_color = {
255  .name = "color",
256  .description = NULL_IF_CONFIG_SMALL("Provide an uniformly colored input."),
257 
258  .priv_class = &color_class,
259  .priv_size = sizeof(TestSourceContext),
260  .init = color_init,
261  .uninit = uninit,
262 
263  .query_formats = color_query_formats,
264  .inputs = NULL,
265  .outputs = color_outputs,
266 };
267 
268 #endif /* CONFIG_COLOR_FILTER */
269 
270 #if CONFIG_NULLSRC_FILTER
271 
272 #define nullsrc_options options
273 AVFILTER_DEFINE_CLASS(nullsrc);
274 
275 static void nullsrc_fill_picture(AVFilterContext *ctx, AVFrame *picref) { }
276 
277 static av_cold int nullsrc_init(AVFilterContext *ctx)
278 {
279  TestSourceContext *test = ctx->priv;
280 
281  test->fill_picture_fn = nullsrc_fill_picture;
282  return init(ctx);
283 }
284 
285 static const AVFilterPad nullsrc_outputs[] = {
286  {
287  .name = "default",
288  .type = AVMEDIA_TYPE_VIDEO,
289  .request_frame = request_frame,
290  .config_props = config_props,
291  },
292  { NULL },
293 };
294 
295 AVFilter avfilter_vsrc_nullsrc = {
296  .name = "nullsrc",
297  .description = NULL_IF_CONFIG_SMALL("Null video source, return unprocessed video frames."),
298  .init = nullsrc_init,
299  .uninit = uninit,
300  .priv_size = sizeof(TestSourceContext),
301  .priv_class = &nullsrc_class,
302  .inputs = NULL,
303  .outputs = nullsrc_outputs,
304 };
305 
306 #endif /* CONFIG_NULLSRC_FILTER */
307 
308 #if CONFIG_TESTSRC_FILTER
309 
310 #define testsrc_options options
311 AVFILTER_DEFINE_CLASS(testsrc);
312 
313 /**
314  * Fill a rectangle with value val.
315  *
316  * @param val the RGB value to set
317  * @param dst pointer to the destination buffer to fill
318  * @param dst_linesize linesize of destination
319  * @param segment_width width of the segment
320  * @param x horizontal coordinate where to draw the rectangle in the destination buffer
321  * @param y horizontal coordinate where to draw the rectangle in the destination buffer
322  * @param w width of the rectangle to draw, expressed as a number of segment_width units
323  * @param h height of the rectangle to draw, expressed as a number of segment_width units
324  */
325 static void draw_rectangle(unsigned val, uint8_t *dst, int dst_linesize, int segment_width,
326  int x, int y, int w, int h)
327 {
328  int i;
329  int step = 3;
330 
331  dst += segment_width * (step * x + y * dst_linesize);
332  w *= segment_width * step;
333  h *= segment_width;
334  for (i = 0; i < h; i++) {
335  memset(dst, val, w);
336  dst += dst_linesize;
337  }
338 }
339 
340 static void draw_digit(int digit, uint8_t *dst, int dst_linesize,
341  int segment_width)
342 {
343 #define TOP_HBAR 1
344 #define MID_HBAR 2
345 #define BOT_HBAR 4
346 #define LEFT_TOP_VBAR 8
347 #define LEFT_BOT_VBAR 16
348 #define RIGHT_TOP_VBAR 32
349 #define RIGHT_BOT_VBAR 64
350  struct {
351  int x, y, w, h;
352  } segments[] = {
353  { 1, 0, 5, 1 }, /* TOP_HBAR */
354  { 1, 6, 5, 1 }, /* MID_HBAR */
355  { 1, 12, 5, 1 }, /* BOT_HBAR */
356  { 0, 1, 1, 5 }, /* LEFT_TOP_VBAR */
357  { 0, 7, 1, 5 }, /* LEFT_BOT_VBAR */
358  { 6, 1, 1, 5 }, /* RIGHT_TOP_VBAR */
359  { 6, 7, 1, 5 } /* RIGHT_BOT_VBAR */
360  };
361  static const unsigned char masks[10] = {
362  /* 0 */ TOP_HBAR |BOT_HBAR|LEFT_TOP_VBAR|LEFT_BOT_VBAR|RIGHT_TOP_VBAR|RIGHT_BOT_VBAR,
363  /* 1 */ RIGHT_TOP_VBAR|RIGHT_BOT_VBAR,
364  /* 2 */ TOP_HBAR|MID_HBAR|BOT_HBAR|LEFT_BOT_VBAR |RIGHT_TOP_VBAR,
365  /* 3 */ TOP_HBAR|MID_HBAR|BOT_HBAR |RIGHT_TOP_VBAR|RIGHT_BOT_VBAR,
366  /* 4 */ MID_HBAR |LEFT_TOP_VBAR |RIGHT_TOP_VBAR|RIGHT_BOT_VBAR,
367  /* 5 */ TOP_HBAR|BOT_HBAR|MID_HBAR|LEFT_TOP_VBAR |RIGHT_BOT_VBAR,
368  /* 6 */ TOP_HBAR|BOT_HBAR|MID_HBAR|LEFT_TOP_VBAR|LEFT_BOT_VBAR |RIGHT_BOT_VBAR,
369  /* 7 */ TOP_HBAR |RIGHT_TOP_VBAR|RIGHT_BOT_VBAR,
370  /* 8 */ TOP_HBAR|BOT_HBAR|MID_HBAR|LEFT_TOP_VBAR|LEFT_BOT_VBAR|RIGHT_TOP_VBAR|RIGHT_BOT_VBAR,
371  /* 9 */ TOP_HBAR|BOT_HBAR|MID_HBAR|LEFT_TOP_VBAR |RIGHT_TOP_VBAR|RIGHT_BOT_VBAR,
372  };
373  unsigned mask = masks[digit];
374  int i;
375 
376  draw_rectangle(0, dst, dst_linesize, segment_width, 0, 0, 8, 13);
377  for (i = 0; i < FF_ARRAY_ELEMS(segments); i++)
378  if (mask & (1<<i))
379  draw_rectangle(255, dst, dst_linesize, segment_width,
380  segments[i].x, segments[i].y, segments[i].w, segments[i].h);
381 }
382 
383 #define GRADIENT_SIZE (6 * 256)
384 
385 static void test_fill_picture(AVFilterContext *ctx, AVFrame *frame)
386 {
387  TestSourceContext *test = ctx->priv;
388  uint8_t *p, *p0;
389  int x, y;
390  int color, color_rest;
391  int icolor;
392  int radius;
393  int quad0, quad;
394  int dquad_x, dquad_y;
395  int grad, dgrad, rgrad, drgrad;
396  int seg_size;
397  int second;
398  int i;
399  uint8_t *data = frame->data[0];
400  int width = frame->width;
401  int height = frame->height;
402 
403  /* draw colored bars and circle */
404  radius = (width + height) / 4;
405  quad0 = width * width / 4 + height * height / 4 - radius * radius;
406  dquad_y = 1 - height;
407  p0 = data;
408  for (y = 0; y < height; y++) {
409  p = p0;
410  color = 0;
411  color_rest = 0;
412  quad = quad0;
413  dquad_x = 1 - width;
414  for (x = 0; x < width; x++) {
415  icolor = color;
416  if (quad < 0)
417  icolor ^= 7;
418  quad += dquad_x;
419  dquad_x += 2;
420  *(p++) = icolor & 1 ? 255 : 0;
421  *(p++) = icolor & 2 ? 255 : 0;
422  *(p++) = icolor & 4 ? 255 : 0;
423  color_rest += 8;
424  if (color_rest >= width) {
425  color_rest -= width;
426  color++;
427  }
428  }
429  quad0 += dquad_y;
430  dquad_y += 2;
431  p0 += frame->linesize[0];
432  }
433 
434  /* draw sliding color line */
435  p0 = p = data + frame->linesize[0] * height * 3/4;
436  grad = (256 * test->nb_frame * test->time_base.num / test->time_base.den) %
437  GRADIENT_SIZE;
438  rgrad = 0;
439  dgrad = GRADIENT_SIZE / width;
440  drgrad = GRADIENT_SIZE % width;
441  for (x = 0; x < width; x++) {
442  *(p++) =
443  grad < 256 || grad >= 5 * 256 ? 255 :
444  grad >= 2 * 256 && grad < 4 * 256 ? 0 :
445  grad < 2 * 256 ? 2 * 256 - 1 - grad : grad - 4 * 256;
446  *(p++) =
447  grad >= 4 * 256 ? 0 :
448  grad >= 1 * 256 && grad < 3 * 256 ? 255 :
449  grad < 1 * 256 ? grad : 4 * 256 - 1 - grad;
450  *(p++) =
451  grad < 2 * 256 ? 0 :
452  grad >= 3 * 256 && grad < 5 * 256 ? 255 :
453  grad < 3 * 256 ? grad - 2 * 256 : 6 * 256 - 1 - grad;
454  grad += dgrad;
455  rgrad += drgrad;
456  if (rgrad >= GRADIENT_SIZE) {
457  grad++;
458  rgrad -= GRADIENT_SIZE;
459  }
460  if (grad >= GRADIENT_SIZE)
461  grad -= GRADIENT_SIZE;
462  }
463  p = p0;
464  for (y = height / 8; y > 0; y--) {
465  memcpy(p+frame->linesize[0], p, 3 * width);
466  p += frame->linesize[0];
467  }
468 
469  /* draw digits */
470  seg_size = width / 80;
471  if (seg_size >= 1 && height >= 13 * seg_size) {
472  int64_t p10decimals = 1;
473  double time = av_q2d(test->time_base) * test->nb_frame *
474  pow(10, test->nb_decimals);
475  if (time >= INT_MAX)
476  return;
477 
478  for (x = 0; x < test->nb_decimals; x++)
479  p10decimals *= 10;
480 
481  second = av_rescale_rnd(test->nb_frame * test->time_base.num, p10decimals, test->time_base.den, AV_ROUND_ZERO);
482  x = width - (width - seg_size * 64) / 2;
483  y = (height - seg_size * 13) / 2;
484  p = data + (x*3 + y * frame->linesize[0]);
485  for (i = 0; i < 8; i++) {
486  p -= 3 * 8 * seg_size;
487  draw_digit(second % 10, p, frame->linesize[0], seg_size);
488  second /= 10;
489  if (second == 0)
490  break;
491  }
492  }
493 }
494 
495 static av_cold int test_init(AVFilterContext *ctx)
496 {
497  TestSourceContext *test = ctx->priv;
498 
499  test->fill_picture_fn = test_fill_picture;
500  return init(ctx);
501 }
502 
503 static int test_query_formats(AVFilterContext *ctx)
504 {
505  static const enum AVPixelFormat pix_fmts[] = {
507  };
509  return 0;
510 }
511 
512 static const AVFilterPad avfilter_vsrc_testsrc_outputs[] = {
513  {
514  .name = "default",
515  .type = AVMEDIA_TYPE_VIDEO,
516  .request_frame = request_frame,
517  .config_props = config_props,
518  },
519  { NULL }
520 };
521 
522 AVFilter avfilter_vsrc_testsrc = {
523  .name = "testsrc",
524  .description = NULL_IF_CONFIG_SMALL("Generate test pattern."),
525  .priv_size = sizeof(TestSourceContext),
526  .priv_class = &testsrc_class,
527  .init = test_init,
528  .uninit = uninit,
529 
530  .query_formats = test_query_formats,
531 
532  .inputs = NULL,
533  .outputs = avfilter_vsrc_testsrc_outputs,
534 };
535 
536 #endif /* CONFIG_TESTSRC_FILTER */
537 
538 #if CONFIG_RGBTESTSRC_FILTER
539 
540 #define rgbtestsrc_options options
541 AVFILTER_DEFINE_CLASS(rgbtestsrc);
542 
543 #define R 0
544 #define G 1
545 #define B 2
546 #define A 3
547 
548 static void rgbtest_put_pixel(uint8_t *dst, int dst_linesize,
549  int x, int y, int r, int g, int b, enum AVPixelFormat fmt,
550  uint8_t rgba_map[4])
551 {
552  int32_t v;
553  uint8_t *p;
554 
555  switch (fmt) {
556  case AV_PIX_FMT_BGR444: ((uint16_t*)(dst + y*dst_linesize))[x] = ((r >> 4) << 8) | ((g >> 4) << 4) | (b >> 4); break;
557  case AV_PIX_FMT_RGB444: ((uint16_t*)(dst + y*dst_linesize))[x] = ((b >> 4) << 8) | ((g >> 4) << 4) | (r >> 4); break;
558  case AV_PIX_FMT_BGR555: ((uint16_t*)(dst + y*dst_linesize))[x] = ((r>>3)<<10) | ((g>>3)<<5) | (b>>3); break;
559  case AV_PIX_FMT_RGB555: ((uint16_t*)(dst + y*dst_linesize))[x] = ((b>>3)<<10) | ((g>>3)<<5) | (r>>3); break;
560  case AV_PIX_FMT_BGR565: ((uint16_t*)(dst + y*dst_linesize))[x] = ((r>>3)<<11) | ((g>>2)<<5) | (b>>3); break;
561  case AV_PIX_FMT_RGB565: ((uint16_t*)(dst + y*dst_linesize))[x] = ((b>>3)<<11) | ((g>>2)<<5) | (r>>3); break;
562  case AV_PIX_FMT_RGB24:
563  case AV_PIX_FMT_BGR24:
564  v = (r << (rgba_map[R]*8)) + (g << (rgba_map[G]*8)) + (b << (rgba_map[B]*8));
565  p = dst + 3*x + y*dst_linesize;
566  AV_WL24(p, v);
567  break;
568  case AV_PIX_FMT_RGBA:
569  case AV_PIX_FMT_BGRA:
570  case AV_PIX_FMT_ARGB:
571  case AV_PIX_FMT_ABGR:
572  v = (r << (rgba_map[R]*8)) + (g << (rgba_map[G]*8)) + (b << (rgba_map[B]*8)) + (255 << (rgba_map[A]*8));
573  p = dst + 4*x + y*dst_linesize;
574  AV_WL32(p, v);
575  break;
576  }
577 }
578 
579 static void rgbtest_fill_picture(AVFilterContext *ctx, AVFrame *frame)
580 {
581  TestSourceContext *test = ctx->priv;
582  int x, y, w = frame->width, h = frame->height;
583 
584  for (y = 0; y < h; y++) {
585  for (x = 0; x < w; x++) {
586  int c = 256*x/w;
587  int r = 0, g = 0, b = 0;
588 
589  if (3*y < h ) r = c;
590  else if (3*y < 2*h) g = c;
591  else b = c;
592 
593  rgbtest_put_pixel(frame->data[0], frame->linesize[0], x, y, r, g, b,
594  ctx->outputs[0]->format, test->rgba_map);
595  }
596  }
597 }
598 
599 static av_cold int rgbtest_init(AVFilterContext *ctx)
600 {
601  TestSourceContext *test = ctx->priv;
602 
603  test->draw_once = 1;
604  test->fill_picture_fn = rgbtest_fill_picture;
605  return init(ctx);
606 }
607 
608 static int rgbtest_query_formats(AVFilterContext *ctx)
609 {
610  static const enum AVPixelFormat pix_fmts[] = {
617  };
619  return 0;
620 }
621 
622 static int rgbtest_config_props(AVFilterLink *outlink)
623 {
624  TestSourceContext *test = outlink->src->priv;
625 
626  ff_fill_rgba_map(test->rgba_map, outlink->format);
627  return config_props(outlink);
628 }
629 
630 static const AVFilterPad avfilter_vsrc_rgbtestsrc_outputs[] = {
631  {
632  .name = "default",
633  .type = AVMEDIA_TYPE_VIDEO,
634  .request_frame = request_frame,
635  .config_props = rgbtest_config_props,
636  },
637  { NULL }
638 };
639 
640 AVFilter avfilter_vsrc_rgbtestsrc = {
641  .name = "rgbtestsrc",
642  .description = NULL_IF_CONFIG_SMALL("Generate RGB test pattern."),
643  .priv_size = sizeof(TestSourceContext),
644  .priv_class = &rgbtestsrc_class,
645  .init = rgbtest_init,
646  .uninit = uninit,
647 
648  .query_formats = rgbtest_query_formats,
649 
650  .inputs = NULL,
651 
652  .outputs = avfilter_vsrc_rgbtestsrc_outputs,
653 };
654 
655 #endif /* CONFIG_RGBTESTSRC_FILTER */
656 
657 #if CONFIG_SMPTEBARS_FILTER || CONFIG_SMPTEHDBARS_FILTER
658 
659 static const uint8_t rainbow[7][4] = {
660  { 191, 191, 191, 255 }, /* gray */
661  { 191, 191, 0, 255 }, /* yellow */
662  { 0, 191, 191, 255 }, /* cyan */
663  { 0, 191, 0, 255 }, /* green */
664  { 191, 0, 191, 255 }, /* magenta */
665  { 191, 0, 0, 255 }, /* red */
666  { 0, 0, 191, 255 }, /* blue */
667 };
668 
669 static const uint8_t wobnair[7][4] = {
670  { 0, 0, 191, 255 }, /* blue */
671  { 19, 19, 19, 255 }, /* 7.5% intensity black */
672  { 191, 0, 191, 255 }, /* magenta */
673  { 19, 19, 19, 255 }, /* 7.5% intensity black */
674  { 0, 191, 191, 255 }, /* cyan */
675  { 19, 19, 19, 255 }, /* 7.5% intensity black */
676  { 191, 191, 191, 255 }, /* gray */
677 };
678 
679 static const uint8_t white[4] = { 255, 255, 255, 255 };
680 static const uint8_t black[4] = { 19, 19, 19, 255 }; /* 7.5% intensity black */
681 
682 /* pluge pulses */
683 static const uint8_t neg4ire[4] = { 9, 9, 9, 255 }; /* 3.5% intensity black */
684 static const uint8_t pos4ire[4] = { 29, 29, 29, 255 }; /* 11.5% intensity black */
685 
686 /* fudged Q/-I */
687 static const uint8_t i_pixel[4] = { 0, 68, 130, 255 };
688 static const uint8_t q_pixel[4] = { 67, 0, 130, 255 };
689 
690 static const uint8_t gray40[4] = { 102, 102, 102, 255 };
691 static const uint8_t gray15[4] = { 38, 38, 38, 255 };
692 static const uint8_t cyan[4] = { 0, 255, 255, 255 };
693 static const uint8_t yellow[4] = { 255, 255, 0, 255 };
694 static const uint8_t blue[4] = { 0, 0, 255, 255 };
695 static const uint8_t red[4] = { 255, 0, 0, 255 };
696 static const uint8_t black0[4] = { 5, 5, 5, 255 };
697 static const uint8_t black2[4] = { 10, 10, 10, 255 };
698 static const uint8_t black4[4] = { 15, 15, 15, 255 };
699 static const uint8_t neg2[4] = { 0, 0, 0, 255 };
700 
701 static void inline draw_bar(TestSourceContext *test, const uint8_t *color,
702  unsigned x, unsigned y, unsigned w, unsigned h,
703  AVFrame *frame)
704 {
705  FFDrawColor draw_color;
706 
707  x = FFMIN(x, test->w - 1);
708  y = FFMIN(y, test->h - 1);
709  w = FFMIN(w, test->w - x);
710  h = FFMIN(h, test->h - y);
711 
712  av_assert0(x + w <= test->w);
713  av_assert0(y + h <= test->h);
714 
715  ff_draw_color(&test->draw, &draw_color, color);
716  ff_fill_rectangle(&test->draw, &draw_color,
717  frame->data, frame->linesize, x, y, w, h);
718 }
719 
720 static int smptebars_query_formats(AVFilterContext *ctx)
721 {
723  return 0;
724 }
725 
726 static int smptebars_config_props(AVFilterLink *outlink)
727 {
728  AVFilterContext *ctx = outlink->src;
729  TestSourceContext *test = ctx->priv;
730 
731  ff_draw_init(&test->draw, outlink->format, 0);
732 
733  return config_props(outlink);
734 }
735 
736 static const AVFilterPad smptebars_outputs[] = {
737  {
738  .name = "default",
739  .type = AVMEDIA_TYPE_VIDEO,
740  .request_frame = request_frame,
741  .config_props = smptebars_config_props,
742  },
743  { NULL }
744 };
745 
746 #if CONFIG_SMPTEBARS_FILTER
747 
748 #define smptebars_options options
749 AVFILTER_DEFINE_CLASS(smptebars);
750 
751 static void smptebars_fill_picture(AVFilterContext *ctx, AVFrame *picref)
752 {
753  TestSourceContext *test = ctx->priv;
754  int r_w, r_h, w_h, p_w, p_h, i, tmp, x = 0;
755  const AVPixFmtDescriptor *pixdesc = av_pix_fmt_desc_get(picref->format);
756 
757  r_w = FFALIGN((test->w + 6) / 7, 1 << pixdesc->log2_chroma_w);
758  r_h = FFALIGN(test->h * 2 / 3, 1 << pixdesc->log2_chroma_h);
759  w_h = FFALIGN(test->h * 3 / 4 - r_h, 1 << pixdesc->log2_chroma_h);
760  p_w = FFALIGN(r_w * 5 / 4, 1 << pixdesc->log2_chroma_w);
761  p_h = test->h - w_h - r_h;
762 
763  for (i = 0; i < 7; i++) {
764  draw_bar(test, rainbow[i], x, 0, r_w, r_h, picref);
765  draw_bar(test, wobnair[i], x, r_h, r_w, w_h, picref);
766  x += r_w;
767  }
768  x = 0;
769  draw_bar(test, i_pixel, x, r_h + w_h, p_w, p_h, picref);
770  x += p_w;
771  draw_bar(test, white, x, r_h + w_h, p_w, p_h, picref);
772  x += p_w;
773  draw_bar(test, q_pixel, x, r_h + w_h, p_w, p_h, picref);
774  x += p_w;
775  tmp = FFALIGN(5 * r_w - x, 1 << pixdesc->log2_chroma_w);
776  draw_bar(test, black, x, r_h + w_h, tmp, p_h, picref);
777  x += tmp;
778  tmp = FFALIGN(r_w / 3, 1 << pixdesc->log2_chroma_w);
779  draw_bar(test, neg4ire, x, r_h + w_h, tmp, p_h, picref);
780  x += tmp;
781  draw_bar(test, black, x, r_h + w_h, tmp, p_h, picref);
782  x += tmp;
783  draw_bar(test, pos4ire, x, r_h + w_h, tmp, p_h, picref);
784  x += tmp;
785  draw_bar(test, black, x, r_h + w_h, test->w - x, p_h, picref);
786 }
787 
788 static av_cold int smptebars_init(AVFilterContext *ctx)
789 {
790  TestSourceContext *test = ctx->priv;
791 
792  test->fill_picture_fn = smptebars_fill_picture;
793  test->draw_once = 1;
794  return init(ctx);
795 }
796 
797 AVFilter avfilter_vsrc_smptebars = {
798  .name = "smptebars",
799  .description = NULL_IF_CONFIG_SMALL("Generate SMPTE color bars."),
800  .priv_size = sizeof(TestSourceContext),
801  .init = smptebars_init,
802  .uninit = uninit,
803 
804  .query_formats = smptebars_query_formats,
805  .inputs = NULL,
806  .outputs = smptebars_outputs,
807  .priv_class = &smptebars_class,
808 };
809 
810 #endif /* CONFIG_SMPTEBARS_FILTER */
811 
812 #if CONFIG_SMPTEHDBARS_FILTER
813 
814 #define smptehdbars_options options
815 AVFILTER_DEFINE_CLASS(smptehdbars);
816 
817 static void smptehdbars_fill_picture(AVFilterContext *ctx, AVFrame *picref)
818 {
819  TestSourceContext *test = ctx->priv;
820  int d_w, r_w, r_h, l_w, i, tmp, x = 0, y = 0;
821  const AVPixFmtDescriptor *pixdesc = av_pix_fmt_desc_get(picref->format);
822 
823  d_w = FFALIGN(test->w / 8, 1 << pixdesc->log2_chroma_w);
824  r_h = FFALIGN(test->h * 7 / 12, 1 << pixdesc->log2_chroma_h);
825  draw_bar(test, gray40, x, 0, d_w, r_h, picref);
826  x += d_w;
827 
828  r_w = FFALIGN((((test->w + 3) / 4) * 3) / 7, 1 << pixdesc->log2_chroma_w);
829  for (i = 0; i < 7; i++) {
830  draw_bar(test, rainbow[i], x, 0, r_w, r_h, picref);
831  x += r_w;
832  }
833  draw_bar(test, gray40, x, 0, test->w - x, r_h, picref);
834  y = r_h;
835  r_h = FFALIGN(test->h / 12, 1 << pixdesc->log2_chroma_h);
836  draw_bar(test, cyan, 0, y, d_w, r_h, picref);
837  x = d_w;
838  draw_bar(test, i_pixel, x, y, r_w, r_h, picref);
839  x += r_w;
840  tmp = r_w * 6;
841  draw_bar(test, rainbow[0], x, y, tmp, r_h, picref);
842  x += tmp;
843  l_w = x;
844  draw_bar(test, blue, x, y, test->w - x, r_h, picref);
845  y += r_h;
846  draw_bar(test, yellow, 0, y, d_w, r_h, picref);
847  x = d_w;
848  draw_bar(test, q_pixel, x, y, r_w, r_h, picref);
849  x += r_w;
850 
851  for (i = 0; i < tmp; i += 1 << pixdesc->log2_chroma_w) {
852  uint8_t yramp[4] = {0};
853 
854  yramp[0] =
855  yramp[1] =
856  yramp[2] = i * 255 / tmp;
857  yramp[3] = 255;
858 
859  draw_bar(test, yramp, x, y, 1 << pixdesc->log2_chroma_w, r_h, picref);
860  x += 1 << pixdesc->log2_chroma_w;
861  }
862  draw_bar(test, red, x, y, test->w - x, r_h, picref);
863  y += r_h;
864  draw_bar(test, gray15, 0, y, d_w, test->h - y, picref);
865  x = d_w;
866  tmp = FFALIGN(r_w * 3 / 2, 1 << pixdesc->log2_chroma_w);
867  draw_bar(test, black0, x, y, tmp, test->h - y, picref);
868  x += tmp;
869  tmp = FFALIGN(r_w * 2, 1 << pixdesc->log2_chroma_w);
870  draw_bar(test, white, x, y, tmp, test->h - y, picref);
871  x += tmp;
872  tmp = FFALIGN(r_w * 5 / 6, 1 << pixdesc->log2_chroma_w);
873  draw_bar(test, black0, x, y, tmp, test->h - y, picref);
874  x += tmp;
875  tmp = FFALIGN(r_w / 3, 1 << pixdesc->log2_chroma_w);
876  draw_bar(test, neg2, x, y, tmp, test->h - y, picref);
877  x += tmp;
878  draw_bar(test, black0, x, y, tmp, test->h - y, picref);
879  x += tmp;
880  draw_bar(test, black2, x, y, tmp, test->h - y, picref);
881  x += tmp;
882  draw_bar(test, black0, x, y, tmp, test->h - y, picref);
883  x += tmp;
884  draw_bar(test, black4, x, y, tmp, test->h - y, picref);
885  x += tmp;
886  r_w = l_w - x;
887  draw_bar(test, black0, x, y, r_w, test->h - y, picref);
888  x += r_w;
889  draw_bar(test, gray15, x, y, test->w - x, test->h - y, picref);
890 }
891 
892 static av_cold int smptehdbars_init(AVFilterContext *ctx)
893 {
894  TestSourceContext *test = ctx->priv;
895 
896  test->fill_picture_fn = smptehdbars_fill_picture;
897  test->draw_once = 1;
898  return init(ctx);
899 }
900 
901 AVFilter avfilter_vsrc_smptehdbars = {
902  .name = "smptehdbars",
903  .description = NULL_IF_CONFIG_SMALL("Generate SMPTE HD color bars."),
904  .priv_size = sizeof(TestSourceContext),
905  .init = smptehdbars_init,
906  .uninit = uninit,
907 
908  .query_formats = smptebars_query_formats,
909  .inputs = NULL,
910  .outputs = smptebars_outputs,
911  .priv_class = &smptehdbars_class,
912 };
913 
914 #endif /* CONFIG_SMPTEHDBARS_FILTER */
915 #endif /* CONFIG_SMPTEBARS_FILTER || CONFIG_SMPTEHDBARS_FILTER */
AVFilterFormats * ff_draw_supported_pixel_formats(unsigned flags)
Return the list of pixel formats supported by the draw functions.
Definition: drawutils.c:501
float v
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:1778
This structure describes decoded (raw) audio or video data.
Definition: frame.h:76
AVOption.
Definition: opt.h:251
const char * fmt
Definition: avisynth_c.h:669
int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding rnd)
Rescale a 64-bit integer with specified rounding.
Definition: mathematics.c:60
#define B
Definition: dsputil.c:2025
misc image utilities
static const AVFilterPad outputs[]
Definition: af_ashowinfo.c:117
external API header
packed RGB 8:8:8, 24bpp, RGBRGB...
Definition: pixfmt.h:70
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:154
int num
numerator
Definition: rational.h:44
static av_cold void uninit(AVFilterContext *ctx)
Definition: vsrc_testsrc.c:139
#define FF_ARRAY_ELEMS(a)
static int query_formats(AVFilterContext *ctx)
Definition: af_aconvert.c:73
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
Definition: video.c:143
int draw_once
draw only the first frame, always put out the same picture
Definition: vsrc_testsrc.c:59
#define AV_PIX_FMT_RGB444
Definition: pixfmt.h:270
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
Definition: pixdesc.h:66
output residual component w
#define FFALIGN(x, a)
Definition: common.h:63
Definition: test.py:1
AVFilterFormats * ff_make_format_list(const int *fmts)
Create a list of supported formats.
Definition: formats.c:308
static av_cold int init(AVFilterContext *ctx)
Definition: vsrc_testsrc.c:105
int ff_draw_round_to_sub(FFDrawContext *draw, int sub_dir, int round_dir, int value)
Round a dimension according to subsampling.
Definition: drawutils.c:489
const char * name
Pad name.
#define AV_WL32(p, darg)
Definition: intreadwrite.h:282
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:37
#define AV_WL24(p, d)
Definition: intreadwrite.h:456
uint8_t
it can be given away to ff_start_frame *A reference passed to ff_filter_frame(or the deprecated ff_start_frame) is given away and must no longer be used.*A reference created with avfilter_ref_buffer belongs to the code that created it.*A reference obtained with ff_get_video_buffer or ff_get_audio_buffer belongs to the code that requested it.*A reference given as return value by the get_video_buffer or get_audio_buffer method is given away and must no longer be used.Link reference fields---------------------The AVFilterLink structure has a few AVFilterBufferRef fields.The cur_buf and out_buf were used with the deprecated start_frame/draw_slice/end_frame API and should no longer be used.src_buf
#define av_cold
Definition: attributes.h:78
AVOptions.
static const uint32_t color[16+AV_CLASS_CATEGORY_NB]
Definition: log.c:77
#define b
Definition: input.c:42
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
Definition: frame.h:159
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
Definition: pixfmt.h:98
static double av_q2d(AVRational a)
Convert rational to double.
Definition: rational.h:69
#define R
Definition: dsputil.c:2027
static int request_frame(AVFilterLink *outlink)
Definition: vsrc_testsrc.c:159
#define AVERROR_EOF
End of file.
Definition: error.h:55
int interlaced_frame
The content of the picture is interlaced.
Definition: frame.h:270
void ff_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats)
A helper for query_formats() which sets all links to the same list of formats.
Definition: formats.c:545
#define A(x)
int av_parse_color(uint8_t *rgba_color, const char *color_string, int slen, void *log_ctx)
Put the RGBA values that correspond to color_string in rgba_color.
Definition: parseutils.c:337
frame
Definition: stft.m:14
A filter pad used for either input or output.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
Definition: mathematics.c:130
Discrete Time axis x
int width
width and height of the video frame
Definition: frame.h:122
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
Definition: pixdesc.h:75
static const uint16_t mask[17]
Definition: lzw.c:37
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
Definition: pixfmt.h:99
Spectrum Plot time data
const char * r
Definition: vf_curves.c:94
void * priv
private data for use by the filter
Definition: avfilter.h:545
void ff_draw_color(FFDrawContext *draw, FFDrawColor *color, const uint8_t rgba[4])
Prepare a color.
Definition: drawutils.c:179
simple assert() macros that are a bit more flexible than ISO C assert().
void av_log(void *avcl, int level, const char *fmt,...)
Definition: log.c:246
#define COMMON_OPTIONS
Definition: vsrc_testsrc.c:77
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
Definition: pixfmt.h:96
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
Definition: pixfmt.h:97
#define AV_LOG_VERBOSE
Definition: log.h:157
AVRational sar
sample aspect ratio
Definition: vsrc_testsrc.c:57
int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx)
Check if the given dimension of an image is valid, meaning that all bytes of the image can be address...
Definition: imgutils.c:231
FFT buffer for g
Definition: stft_peak.m:17
enum AVPictureType pict_type
Picture type of the frame.
Definition: frame.h:144
#define FFMIN(a, b)
Definition: common.h:58
Round toward zero.
Definition: mathematics.h:68
ret
Definition: avfilter.c:821
int64_t duration
duration expressed in microseconds
Definition: vsrc_testsrc.c:56
static const AVOption color_options[]
Definition: vsrc_testsrc.c:87
static int config_props(AVFilterLink *outlink)
Definition: vsrc_testsrc.c:146
int32_t
packed RGB 8:8:8, 24bpp, BGRBGR...
Definition: pixfmt.h:71
#define FLAGS
Definition: vsrc_testsrc.c:75
int ff_fill_rgba_map(uint8_t *rgba_map, enum AVPixelFormat pix_fmt)
Definition: drawutils.c:33
AVFrame * av_frame_clone(AVFrame *src)
Create a new frame that references the same data as src.
Definition: frame.c:317
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames...
Definition: frame.h:134
#define AV_PIX_FMT_BGR555
Definition: pixfmt.h:273
NULL
Definition: eval.c:55
static int width
Definition: tests/utils.c:158
void(* fill_picture_fn)(AVFilterContext *ctx, AVFrame *frame)
Definition: vsrc_testsrc.c:62
uint8_t color_rgba[4]
Definition: vsrc_testsrc.c:68
misc drawing utilities
typedef void(RENAME(mix_any_func_type))
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
Definition: avutil.h:202
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
Definition: frame.h:101
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition: pixdesc.h:55
uint8_t rgba_map[4]
Definition: vsrc_testsrc.c:71
AVRational sample_aspect_ratio
Sample aspect ratio for the video frame, 0/1 if unknown/unspecified.
Definition: frame.h:154
BYTE int const BYTE int int int height
Definition: avisynth_c.h:713
AVRational frame_rate
Definition: vsrc_testsrc.c:54
Describe the class of an AVClass context structure.
Definition: log.h:50
Filter definition.
Definition: avfilter.h:436
synthesis window for stochastic i
rational number numerator/denominator
Definition: rational.h:43
const char * name
filter name
Definition: avfilter.h:437
int ff_draw_init(FFDrawContext *draw, enum AVPixelFormat format, unsigned flags)
Init a draw context.
Definition: drawutils.c:135
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFilterBuffer structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later.That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another.Buffer references ownership and permissions
misc parsing utilities
AVFilterLink ** outputs
array of pointers to output links
Definition: avfilter.h:539
FFDrawColor color
Definition: vsrc_testsrc.c:67
#define AV_PIX_FMT_BGR565
Definition: pixfmt.h:272
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
Definition: rational.h:122
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:87
AVRational time_base
Definition: vsrc_testsrc.c:54
common internal and external API header
unsigned int nb_frame
Definition: vsrc_testsrc.c:53
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:108
static double c[64]
#define AV_PIX_FMT_BGR444
Definition: pixfmt.h:274
static const AVOption options[]
Definition: vsrc_testsrc.c:96
#define AV_PIX_FMT_RGB555
Definition: pixfmt.h:269
int den
denominator
Definition: rational.h:45
function y
Definition: D.m:1
#define AVFILTER_DEFINE_CLASS(fname)
else dst[i][x+y *dst_stride[i]]
Definition: vf_mcdeint.c:160
int key_frame
1 -> keyframe, 0-> not
Definition: frame.h:139
#define G
Definition: dsputil.c:2026
#define OFFSET(x)
Definition: vsrc_testsrc.c:74
#define AV_PIX_FMT_RGB565
Definition: pixfmt.h:268
void ff_fill_rectangle(FFDrawContext *draw, FFDrawColor *color, uint8_t *dst[], int dst_linesize[], int dst_x, int dst_y, int w, int h)
Fill a rectangle with an uniform color.
Definition: drawutils.c:236
An instance of a filter.
Definition: avfilter.h:524
int height
Definition: frame.h:122
FFDrawContext draw
Definition: vsrc_testsrc.c:66
internal API functions
AVFrame * picref
cached reference containing the painted picture
Definition: vsrc_testsrc.c:60
AVPixelFormat
Pixel format.
Definition: pixfmt.h:66
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several inputs
const AVFilter * filter
the AVFilter of which this is an instance
Definition: avfilter.h:527
trying all byte sequences megabyte in length and selecting the best looking sequence will yield cases to try But a word about which is also called distortion Distortion can be quantified by almost any quality measurement one chooses the sum of squared differences is used but more complex methods that consider psychovisual effects can be used as well It makes no difference in this discussion First step