annotate ffmpeg/libavfilter/vsrc_testsrc.c @ 13:844d341cf643 tip

Back up before ISMIR
author Yading Song <yading.song@eecs.qmul.ac.uk>
date Thu, 31 Oct 2013 13:17:06 +0000
parents f445c3017523
children
rev   line source
yading@11 1 /*
yading@11 2 * Copyright (c) 2007 Nicolas George <nicolas.george@normalesup.org>
yading@11 3 * Copyright (c) 2011 Stefano Sabatini
yading@11 4 * Copyright (c) 2012 Paul B Mahol
yading@11 5 *
yading@11 6 * This file is part of FFmpeg.
yading@11 7 *
yading@11 8 * FFmpeg is free software; you can redistribute it and/or
yading@11 9 * modify it under the terms of the GNU Lesser General Public
yading@11 10 * License as published by the Free Software Foundation; either
yading@11 11 * version 2.1 of the License, or (at your option) any later version.
yading@11 12 *
yading@11 13 * FFmpeg is distributed in the hope that it will be useful,
yading@11 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
yading@11 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
yading@11 16 * Lesser General Public License for more details.
yading@11 17 *
yading@11 18 * You should have received a copy of the GNU Lesser General Public
yading@11 19 * License along with FFmpeg; if not, write to the Free Software
yading@11 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
yading@11 21 */
yading@11 22
yading@11 23 /**
yading@11 24 * @file
yading@11 25 * Misc test sources.
yading@11 26 *
yading@11 27 * testsrc is based on the test pattern generator demuxer by Nicolas George:
yading@11 28 * http://lists.ffmpeg.org/pipermail/ffmpeg-devel/2007-October/037845.html
yading@11 29 *
yading@11 30 * rgbtestsrc is ported from MPlayer libmpcodecs/vf_rgbtest.c by
yading@11 31 * Michael Niedermayer.
yading@11 32 *
yading@11 33 * smptebars and smptehdbars are by Paul B Mahol.
yading@11 34 */
yading@11 35
yading@11 36 #include <float.h>
yading@11 37
yading@11 38 #include "libavutil/avassert.h"
yading@11 39 #include "libavutil/common.h"
yading@11 40 #include "libavutil/opt.h"
yading@11 41 #include "libavutil/imgutils.h"
yading@11 42 #include "libavutil/intreadwrite.h"
yading@11 43 #include "libavutil/parseutils.h"
yading@11 44 #include "avfilter.h"
yading@11 45 #include "drawutils.h"
yading@11 46 #include "formats.h"
yading@11 47 #include "internal.h"
yading@11 48 #include "video.h"
yading@11 49
yading@11 50 typedef struct {
yading@11 51 const AVClass *class;
yading@11 52 int w, h;
yading@11 53 unsigned int nb_frame;
yading@11 54 AVRational time_base, frame_rate;
yading@11 55 int64_t pts;
yading@11 56 int64_t duration; ///< duration expressed in microseconds
yading@11 57 AVRational sar; ///< sample aspect ratio
yading@11 58 int nb_decimals;
yading@11 59 int draw_once; ///< draw only the first frame, always put out the same picture
yading@11 60 AVFrame *picref; ///< cached reference containing the painted picture
yading@11 61
yading@11 62 void (* fill_picture_fn)(AVFilterContext *ctx, AVFrame *frame);
yading@11 63
yading@11 64 /* only used by color */
yading@11 65 char *color_str;
yading@11 66 FFDrawContext draw;
yading@11 67 FFDrawColor color;
yading@11 68 uint8_t color_rgba[4];
yading@11 69
yading@11 70 /* only used by rgbtest */
yading@11 71 uint8_t rgba_map[4];
yading@11 72 } TestSourceContext;
yading@11 73
yading@11 74 #define OFFSET(x) offsetof(TestSourceContext, x)
yading@11 75 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
yading@11 76
yading@11 77 #define COMMON_OPTIONS \
yading@11 78 { "size", "set video size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str = "320x240"}, 0, 0, FLAGS },\
yading@11 79 { "s", "set video size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str = "320x240"}, 0, 0, FLAGS },\
yading@11 80 { "rate", "set video rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, 0, FLAGS },\
yading@11 81 { "r", "set video rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, 0, FLAGS },\
yading@11 82 { "duration", "set video duration", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64 = -1}, -1, INT64_MAX, FLAGS },\
yading@11 83 { "d", "set video duration", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64 = -1}, -1, INT64_MAX, FLAGS },\
yading@11 84 { "sar", "set video sample aspect ratio", OFFSET(sar), AV_OPT_TYPE_RATIONAL, {.dbl= 1}, 0, INT_MAX, FLAGS },
yading@11 85
yading@11 86
yading@11 87 static const AVOption color_options[] = {
yading@11 88 /* only used by color */
yading@11 89 { "color", "set color", OFFSET(color_str), AV_OPT_TYPE_STRING, {.str = "black"}, CHAR_MIN, CHAR_MAX, FLAGS },
yading@11 90 { "c", "set color", OFFSET(color_str), AV_OPT_TYPE_STRING, {.str = "black"}, CHAR_MIN, CHAR_MAX, FLAGS },
yading@11 91
yading@11 92 COMMON_OPTIONS
yading@11 93 { NULL },
yading@11 94 };
yading@11 95
yading@11 96 static const AVOption options[] = {
yading@11 97 COMMON_OPTIONS
yading@11 98 /* only used by testsrc */
yading@11 99 { "decimals", "set number of decimals to show", OFFSET(nb_decimals), AV_OPT_TYPE_INT, {.i64=0}, 0, 17, FLAGS },
yading@11 100 { "n", "set number of decimals to show", OFFSET(nb_decimals), AV_OPT_TYPE_INT, {.i64=0}, 0, 17, FLAGS },
yading@11 101
yading@11 102 { NULL },
yading@11 103 };
yading@11 104
yading@11 105 static av_cold int init(AVFilterContext *ctx)
yading@11 106 {
yading@11 107 TestSourceContext *test = ctx->priv;
yading@11 108 int ret = 0;
yading@11 109
yading@11 110 if (test->nb_decimals && strcmp(ctx->filter->name, "testsrc")) {
yading@11 111 av_log(ctx, AV_LOG_WARNING,
yading@11 112 "Option 'decimals' is ignored with source '%s'\n",
yading@11 113 ctx->filter->name);
yading@11 114 }
yading@11 115
yading@11 116 if (test->color_str) {
yading@11 117 if (!strcmp(ctx->filter->name, "color")) {
yading@11 118 ret = av_parse_color(test->color_rgba, test->color_str, -1, ctx);
yading@11 119 if (ret < 0)
yading@11 120 return ret;
yading@11 121 } else {
yading@11 122 av_log(ctx, AV_LOG_WARNING,
yading@11 123 "Option 'color' is ignored with source '%s'\n",
yading@11 124 ctx->filter->name);
yading@11 125 }
yading@11 126 }
yading@11 127
yading@11 128 test->time_base = av_inv_q(test->frame_rate);
yading@11 129 test->nb_frame = 0;
yading@11 130 test->pts = 0;
yading@11 131
yading@11 132 av_log(ctx, AV_LOG_VERBOSE, "size:%dx%d rate:%d/%d duration:%f sar:%d/%d\n",
yading@11 133 test->w, test->h, test->frame_rate.num, test->frame_rate.den,
yading@11 134 test->duration < 0 ? -1 : (double)test->duration/1000000,
yading@11 135 test->sar.num, test->sar.den);
yading@11 136 return 0;
yading@11 137 }
yading@11 138
yading@11 139 static av_cold void uninit(AVFilterContext *ctx)
yading@11 140 {
yading@11 141 TestSourceContext *test = ctx->priv;
yading@11 142
yading@11 143 av_frame_free(&test->picref);
yading@11 144 }
yading@11 145
yading@11 146 static int config_props(AVFilterLink *outlink)
yading@11 147 {
yading@11 148 TestSourceContext *test = outlink->src->priv;
yading@11 149
yading@11 150 outlink->w = test->w;
yading@11 151 outlink->h = test->h;
yading@11 152 outlink->sample_aspect_ratio = test->sar;
yading@11 153 outlink->frame_rate = test->frame_rate;
yading@11 154 outlink->time_base = test->time_base;
yading@11 155
yading@11 156 return 0;
yading@11 157 }
yading@11 158
yading@11 159 static int request_frame(AVFilterLink *outlink)
yading@11 160 {
yading@11 161 TestSourceContext *test = outlink->src->priv;
yading@11 162 AVFrame *frame;
yading@11 163
yading@11 164 if (test->duration >= 0 &&
yading@11 165 av_rescale_q(test->pts, test->time_base, AV_TIME_BASE_Q) >= test->duration)
yading@11 166 return AVERROR_EOF;
yading@11 167
yading@11 168 if (test->draw_once) {
yading@11 169 if (!test->picref) {
yading@11 170 test->picref =
yading@11 171 ff_get_video_buffer(outlink, test->w, test->h);
yading@11 172 if (!test->picref)
yading@11 173 return AVERROR(ENOMEM);
yading@11 174 test->fill_picture_fn(outlink->src, test->picref);
yading@11 175 }
yading@11 176 frame = av_frame_clone(test->picref);
yading@11 177 } else
yading@11 178 frame = ff_get_video_buffer(outlink, test->w, test->h);
yading@11 179
yading@11 180 if (!frame)
yading@11 181 return AVERROR(ENOMEM);
yading@11 182 frame->pts = test->pts;
yading@11 183 frame->key_frame = 1;
yading@11 184 frame->interlaced_frame = 0;
yading@11 185 frame->pict_type = AV_PICTURE_TYPE_I;
yading@11 186 frame->sample_aspect_ratio = test->sar;
yading@11 187 if (!test->draw_once)
yading@11 188 test->fill_picture_fn(outlink->src, frame);
yading@11 189
yading@11 190 test->pts++;
yading@11 191 test->nb_frame++;
yading@11 192
yading@11 193 return ff_filter_frame(outlink, frame);
yading@11 194 }
yading@11 195
yading@11 196 #if CONFIG_COLOR_FILTER
yading@11 197
yading@11 198 AVFILTER_DEFINE_CLASS(color);
yading@11 199
yading@11 200 static void color_fill_picture(AVFilterContext *ctx, AVFrame *picref)
yading@11 201 {
yading@11 202 TestSourceContext *test = ctx->priv;
yading@11 203 ff_fill_rectangle(&test->draw, &test->color,
yading@11 204 picref->data, picref->linesize,
yading@11 205 0, 0, test->w, test->h);
yading@11 206 }
yading@11 207
yading@11 208 static av_cold int color_init(AVFilterContext *ctx)
yading@11 209 {
yading@11 210 TestSourceContext *test = ctx->priv;
yading@11 211 test->fill_picture_fn = color_fill_picture;
yading@11 212 test->draw_once = 1;
yading@11 213 return init(ctx);
yading@11 214 }
yading@11 215
yading@11 216 static int color_query_formats(AVFilterContext *ctx)
yading@11 217 {
yading@11 218 ff_set_common_formats(ctx, ff_draw_supported_pixel_formats(0));
yading@11 219 return 0;
yading@11 220 }
yading@11 221
yading@11 222 static int color_config_props(AVFilterLink *inlink)
yading@11 223 {
yading@11 224 AVFilterContext *ctx = inlink->src;
yading@11 225 TestSourceContext *test = ctx->priv;
yading@11 226 int ret;
yading@11 227
yading@11 228 ff_draw_init(&test->draw, inlink->format, 0);
yading@11 229 ff_draw_color(&test->draw, &test->color, test->color_rgba);
yading@11 230
yading@11 231 test->w = ff_draw_round_to_sub(&test->draw, 0, -1, test->w);
yading@11 232 test->h = ff_draw_round_to_sub(&test->draw, 1, -1, test->h);
yading@11 233 if (av_image_check_size(test->w, test->h, 0, ctx) < 0)
yading@11 234 return AVERROR(EINVAL);
yading@11 235
yading@11 236 if ((ret = config_props(inlink)) < 0)
yading@11 237 return ret;
yading@11 238
yading@11 239 av_log(ctx, AV_LOG_VERBOSE, "color:0x%02x%02x%02x%02x\n",
yading@11 240 test->color_rgba[0], test->color_rgba[1], test->color_rgba[2], test->color_rgba[3]);
yading@11 241 return 0;
yading@11 242 }
yading@11 243
yading@11 244 static const AVFilterPad color_outputs[] = {
yading@11 245 {
yading@11 246 .name = "default",
yading@11 247 .type = AVMEDIA_TYPE_VIDEO,
yading@11 248 .request_frame = request_frame,
yading@11 249 .config_props = color_config_props,
yading@11 250 },
yading@11 251 { NULL }
yading@11 252 };
yading@11 253
yading@11 254 AVFilter avfilter_vsrc_color = {
yading@11 255 .name = "color",
yading@11 256 .description = NULL_IF_CONFIG_SMALL("Provide an uniformly colored input."),
yading@11 257
yading@11 258 .priv_class = &color_class,
yading@11 259 .priv_size = sizeof(TestSourceContext),
yading@11 260 .init = color_init,
yading@11 261 .uninit = uninit,
yading@11 262
yading@11 263 .query_formats = color_query_formats,
yading@11 264 .inputs = NULL,
yading@11 265 .outputs = color_outputs,
yading@11 266 };
yading@11 267
yading@11 268 #endif /* CONFIG_COLOR_FILTER */
yading@11 269
yading@11 270 #if CONFIG_NULLSRC_FILTER
yading@11 271
yading@11 272 #define nullsrc_options options
yading@11 273 AVFILTER_DEFINE_CLASS(nullsrc);
yading@11 274
yading@11 275 static void nullsrc_fill_picture(AVFilterContext *ctx, AVFrame *picref) { }
yading@11 276
yading@11 277 static av_cold int nullsrc_init(AVFilterContext *ctx)
yading@11 278 {
yading@11 279 TestSourceContext *test = ctx->priv;
yading@11 280
yading@11 281 test->fill_picture_fn = nullsrc_fill_picture;
yading@11 282 return init(ctx);
yading@11 283 }
yading@11 284
yading@11 285 static const AVFilterPad nullsrc_outputs[] = {
yading@11 286 {
yading@11 287 .name = "default",
yading@11 288 .type = AVMEDIA_TYPE_VIDEO,
yading@11 289 .request_frame = request_frame,
yading@11 290 .config_props = config_props,
yading@11 291 },
yading@11 292 { NULL },
yading@11 293 };
yading@11 294
yading@11 295 AVFilter avfilter_vsrc_nullsrc = {
yading@11 296 .name = "nullsrc",
yading@11 297 .description = NULL_IF_CONFIG_SMALL("Null video source, return unprocessed video frames."),
yading@11 298 .init = nullsrc_init,
yading@11 299 .uninit = uninit,
yading@11 300 .priv_size = sizeof(TestSourceContext),
yading@11 301 .priv_class = &nullsrc_class,
yading@11 302 .inputs = NULL,
yading@11 303 .outputs = nullsrc_outputs,
yading@11 304 };
yading@11 305
yading@11 306 #endif /* CONFIG_NULLSRC_FILTER */
yading@11 307
yading@11 308 #if CONFIG_TESTSRC_FILTER
yading@11 309
yading@11 310 #define testsrc_options options
yading@11 311 AVFILTER_DEFINE_CLASS(testsrc);
yading@11 312
yading@11 313 /**
yading@11 314 * Fill a rectangle with value val.
yading@11 315 *
yading@11 316 * @param val the RGB value to set
yading@11 317 * @param dst pointer to the destination buffer to fill
yading@11 318 * @param dst_linesize linesize of destination
yading@11 319 * @param segment_width width of the segment
yading@11 320 * @param x horizontal coordinate where to draw the rectangle in the destination buffer
yading@11 321 * @param y horizontal coordinate where to draw the rectangle in the destination buffer
yading@11 322 * @param w width of the rectangle to draw, expressed as a number of segment_width units
yading@11 323 * @param h height of the rectangle to draw, expressed as a number of segment_width units
yading@11 324 */
yading@11 325 static void draw_rectangle(unsigned val, uint8_t *dst, int dst_linesize, int segment_width,
yading@11 326 int x, int y, int w, int h)
yading@11 327 {
yading@11 328 int i;
yading@11 329 int step = 3;
yading@11 330
yading@11 331 dst += segment_width * (step * x + y * dst_linesize);
yading@11 332 w *= segment_width * step;
yading@11 333 h *= segment_width;
yading@11 334 for (i = 0; i < h; i++) {
yading@11 335 memset(dst, val, w);
yading@11 336 dst += dst_linesize;
yading@11 337 }
yading@11 338 }
yading@11 339
yading@11 340 static void draw_digit(int digit, uint8_t *dst, int dst_linesize,
yading@11 341 int segment_width)
yading@11 342 {
yading@11 343 #define TOP_HBAR 1
yading@11 344 #define MID_HBAR 2
yading@11 345 #define BOT_HBAR 4
yading@11 346 #define LEFT_TOP_VBAR 8
yading@11 347 #define LEFT_BOT_VBAR 16
yading@11 348 #define RIGHT_TOP_VBAR 32
yading@11 349 #define RIGHT_BOT_VBAR 64
yading@11 350 struct {
yading@11 351 int x, y, w, h;
yading@11 352 } segments[] = {
yading@11 353 { 1, 0, 5, 1 }, /* TOP_HBAR */
yading@11 354 { 1, 6, 5, 1 }, /* MID_HBAR */
yading@11 355 { 1, 12, 5, 1 }, /* BOT_HBAR */
yading@11 356 { 0, 1, 1, 5 }, /* LEFT_TOP_VBAR */
yading@11 357 { 0, 7, 1, 5 }, /* LEFT_BOT_VBAR */
yading@11 358 { 6, 1, 1, 5 }, /* RIGHT_TOP_VBAR */
yading@11 359 { 6, 7, 1, 5 } /* RIGHT_BOT_VBAR */
yading@11 360 };
yading@11 361 static const unsigned char masks[10] = {
yading@11 362 /* 0 */ TOP_HBAR |BOT_HBAR|LEFT_TOP_VBAR|LEFT_BOT_VBAR|RIGHT_TOP_VBAR|RIGHT_BOT_VBAR,
yading@11 363 /* 1 */ RIGHT_TOP_VBAR|RIGHT_BOT_VBAR,
yading@11 364 /* 2 */ TOP_HBAR|MID_HBAR|BOT_HBAR|LEFT_BOT_VBAR |RIGHT_TOP_VBAR,
yading@11 365 /* 3 */ TOP_HBAR|MID_HBAR|BOT_HBAR |RIGHT_TOP_VBAR|RIGHT_BOT_VBAR,
yading@11 366 /* 4 */ MID_HBAR |LEFT_TOP_VBAR |RIGHT_TOP_VBAR|RIGHT_BOT_VBAR,
yading@11 367 /* 5 */ TOP_HBAR|BOT_HBAR|MID_HBAR|LEFT_TOP_VBAR |RIGHT_BOT_VBAR,
yading@11 368 /* 6 */ TOP_HBAR|BOT_HBAR|MID_HBAR|LEFT_TOP_VBAR|LEFT_BOT_VBAR |RIGHT_BOT_VBAR,
yading@11 369 /* 7 */ TOP_HBAR |RIGHT_TOP_VBAR|RIGHT_BOT_VBAR,
yading@11 370 /* 8 */ TOP_HBAR|BOT_HBAR|MID_HBAR|LEFT_TOP_VBAR|LEFT_BOT_VBAR|RIGHT_TOP_VBAR|RIGHT_BOT_VBAR,
yading@11 371 /* 9 */ TOP_HBAR|BOT_HBAR|MID_HBAR|LEFT_TOP_VBAR |RIGHT_TOP_VBAR|RIGHT_BOT_VBAR,
yading@11 372 };
yading@11 373 unsigned mask = masks[digit];
yading@11 374 int i;
yading@11 375
yading@11 376 draw_rectangle(0, dst, dst_linesize, segment_width, 0, 0, 8, 13);
yading@11 377 for (i = 0; i < FF_ARRAY_ELEMS(segments); i++)
yading@11 378 if (mask & (1<<i))
yading@11 379 draw_rectangle(255, dst, dst_linesize, segment_width,
yading@11 380 segments[i].x, segments[i].y, segments[i].w, segments[i].h);
yading@11 381 }
yading@11 382
yading@11 383 #define GRADIENT_SIZE (6 * 256)
yading@11 384
yading@11 385 static void test_fill_picture(AVFilterContext *ctx, AVFrame *frame)
yading@11 386 {
yading@11 387 TestSourceContext *test = ctx->priv;
yading@11 388 uint8_t *p, *p0;
yading@11 389 int x, y;
yading@11 390 int color, color_rest;
yading@11 391 int icolor;
yading@11 392 int radius;
yading@11 393 int quad0, quad;
yading@11 394 int dquad_x, dquad_y;
yading@11 395 int grad, dgrad, rgrad, drgrad;
yading@11 396 int seg_size;
yading@11 397 int second;
yading@11 398 int i;
yading@11 399 uint8_t *data = frame->data[0];
yading@11 400 int width = frame->width;
yading@11 401 int height = frame->height;
yading@11 402
yading@11 403 /* draw colored bars and circle */
yading@11 404 radius = (width + height) / 4;
yading@11 405 quad0 = width * width / 4 + height * height / 4 - radius * radius;
yading@11 406 dquad_y = 1 - height;
yading@11 407 p0 = data;
yading@11 408 for (y = 0; y < height; y++) {
yading@11 409 p = p0;
yading@11 410 color = 0;
yading@11 411 color_rest = 0;
yading@11 412 quad = quad0;
yading@11 413 dquad_x = 1 - width;
yading@11 414 for (x = 0; x < width; x++) {
yading@11 415 icolor = color;
yading@11 416 if (quad < 0)
yading@11 417 icolor ^= 7;
yading@11 418 quad += dquad_x;
yading@11 419 dquad_x += 2;
yading@11 420 *(p++) = icolor & 1 ? 255 : 0;
yading@11 421 *(p++) = icolor & 2 ? 255 : 0;
yading@11 422 *(p++) = icolor & 4 ? 255 : 0;
yading@11 423 color_rest += 8;
yading@11 424 if (color_rest >= width) {
yading@11 425 color_rest -= width;
yading@11 426 color++;
yading@11 427 }
yading@11 428 }
yading@11 429 quad0 += dquad_y;
yading@11 430 dquad_y += 2;
yading@11 431 p0 += frame->linesize[0];
yading@11 432 }
yading@11 433
yading@11 434 /* draw sliding color line */
yading@11 435 p0 = p = data + frame->linesize[0] * height * 3/4;
yading@11 436 grad = (256 * test->nb_frame * test->time_base.num / test->time_base.den) %
yading@11 437 GRADIENT_SIZE;
yading@11 438 rgrad = 0;
yading@11 439 dgrad = GRADIENT_SIZE / width;
yading@11 440 drgrad = GRADIENT_SIZE % width;
yading@11 441 for (x = 0; x < width; x++) {
yading@11 442 *(p++) =
yading@11 443 grad < 256 || grad >= 5 * 256 ? 255 :
yading@11 444 grad >= 2 * 256 && grad < 4 * 256 ? 0 :
yading@11 445 grad < 2 * 256 ? 2 * 256 - 1 - grad : grad - 4 * 256;
yading@11 446 *(p++) =
yading@11 447 grad >= 4 * 256 ? 0 :
yading@11 448 grad >= 1 * 256 && grad < 3 * 256 ? 255 :
yading@11 449 grad < 1 * 256 ? grad : 4 * 256 - 1 - grad;
yading@11 450 *(p++) =
yading@11 451 grad < 2 * 256 ? 0 :
yading@11 452 grad >= 3 * 256 && grad < 5 * 256 ? 255 :
yading@11 453 grad < 3 * 256 ? grad - 2 * 256 : 6 * 256 - 1 - grad;
yading@11 454 grad += dgrad;
yading@11 455 rgrad += drgrad;
yading@11 456 if (rgrad >= GRADIENT_SIZE) {
yading@11 457 grad++;
yading@11 458 rgrad -= GRADIENT_SIZE;
yading@11 459 }
yading@11 460 if (grad >= GRADIENT_SIZE)
yading@11 461 grad -= GRADIENT_SIZE;
yading@11 462 }
yading@11 463 p = p0;
yading@11 464 for (y = height / 8; y > 0; y--) {
yading@11 465 memcpy(p+frame->linesize[0], p, 3 * width);
yading@11 466 p += frame->linesize[0];
yading@11 467 }
yading@11 468
yading@11 469 /* draw digits */
yading@11 470 seg_size = width / 80;
yading@11 471 if (seg_size >= 1 && height >= 13 * seg_size) {
yading@11 472 int64_t p10decimals = 1;
yading@11 473 double time = av_q2d(test->time_base) * test->nb_frame *
yading@11 474 pow(10, test->nb_decimals);
yading@11 475 if (time >= INT_MAX)
yading@11 476 return;
yading@11 477
yading@11 478 for (x = 0; x < test->nb_decimals; x++)
yading@11 479 p10decimals *= 10;
yading@11 480
yading@11 481 second = av_rescale_rnd(test->nb_frame * test->time_base.num, p10decimals, test->time_base.den, AV_ROUND_ZERO);
yading@11 482 x = width - (width - seg_size * 64) / 2;
yading@11 483 y = (height - seg_size * 13) / 2;
yading@11 484 p = data + (x*3 + y * frame->linesize[0]);
yading@11 485 for (i = 0; i < 8; i++) {
yading@11 486 p -= 3 * 8 * seg_size;
yading@11 487 draw_digit(second % 10, p, frame->linesize[0], seg_size);
yading@11 488 second /= 10;
yading@11 489 if (second == 0)
yading@11 490 break;
yading@11 491 }
yading@11 492 }
yading@11 493 }
yading@11 494
yading@11 495 static av_cold int test_init(AVFilterContext *ctx)
yading@11 496 {
yading@11 497 TestSourceContext *test = ctx->priv;
yading@11 498
yading@11 499 test->fill_picture_fn = test_fill_picture;
yading@11 500 return init(ctx);
yading@11 501 }
yading@11 502
yading@11 503 static int test_query_formats(AVFilterContext *ctx)
yading@11 504 {
yading@11 505 static const enum AVPixelFormat pix_fmts[] = {
yading@11 506 AV_PIX_FMT_RGB24, AV_PIX_FMT_NONE
yading@11 507 };
yading@11 508 ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
yading@11 509 return 0;
yading@11 510 }
yading@11 511
yading@11 512 static const AVFilterPad avfilter_vsrc_testsrc_outputs[] = {
yading@11 513 {
yading@11 514 .name = "default",
yading@11 515 .type = AVMEDIA_TYPE_VIDEO,
yading@11 516 .request_frame = request_frame,
yading@11 517 .config_props = config_props,
yading@11 518 },
yading@11 519 { NULL }
yading@11 520 };
yading@11 521
yading@11 522 AVFilter avfilter_vsrc_testsrc = {
yading@11 523 .name = "testsrc",
yading@11 524 .description = NULL_IF_CONFIG_SMALL("Generate test pattern."),
yading@11 525 .priv_size = sizeof(TestSourceContext),
yading@11 526 .priv_class = &testsrc_class,
yading@11 527 .init = test_init,
yading@11 528 .uninit = uninit,
yading@11 529
yading@11 530 .query_formats = test_query_formats,
yading@11 531
yading@11 532 .inputs = NULL,
yading@11 533 .outputs = avfilter_vsrc_testsrc_outputs,
yading@11 534 };
yading@11 535
yading@11 536 #endif /* CONFIG_TESTSRC_FILTER */
yading@11 537
yading@11 538 #if CONFIG_RGBTESTSRC_FILTER
yading@11 539
yading@11 540 #define rgbtestsrc_options options
yading@11 541 AVFILTER_DEFINE_CLASS(rgbtestsrc);
yading@11 542
yading@11 543 #define R 0
yading@11 544 #define G 1
yading@11 545 #define B 2
yading@11 546 #define A 3
yading@11 547
yading@11 548 static void rgbtest_put_pixel(uint8_t *dst, int dst_linesize,
yading@11 549 int x, int y, int r, int g, int b, enum AVPixelFormat fmt,
yading@11 550 uint8_t rgba_map[4])
yading@11 551 {
yading@11 552 int32_t v;
yading@11 553 uint8_t *p;
yading@11 554
yading@11 555 switch (fmt) {
yading@11 556 case AV_PIX_FMT_BGR444: ((uint16_t*)(dst + y*dst_linesize))[x] = ((r >> 4) << 8) | ((g >> 4) << 4) | (b >> 4); break;
yading@11 557 case AV_PIX_FMT_RGB444: ((uint16_t*)(dst + y*dst_linesize))[x] = ((b >> 4) << 8) | ((g >> 4) << 4) | (r >> 4); break;
yading@11 558 case AV_PIX_FMT_BGR555: ((uint16_t*)(dst + y*dst_linesize))[x] = ((r>>3)<<10) | ((g>>3)<<5) | (b>>3); break;
yading@11 559 case AV_PIX_FMT_RGB555: ((uint16_t*)(dst + y*dst_linesize))[x] = ((b>>3)<<10) | ((g>>3)<<5) | (r>>3); break;
yading@11 560 case AV_PIX_FMT_BGR565: ((uint16_t*)(dst + y*dst_linesize))[x] = ((r>>3)<<11) | ((g>>2)<<5) | (b>>3); break;
yading@11 561 case AV_PIX_FMT_RGB565: ((uint16_t*)(dst + y*dst_linesize))[x] = ((b>>3)<<11) | ((g>>2)<<5) | (r>>3); break;
yading@11 562 case AV_PIX_FMT_RGB24:
yading@11 563 case AV_PIX_FMT_BGR24:
yading@11 564 v = (r << (rgba_map[R]*8)) + (g << (rgba_map[G]*8)) + (b << (rgba_map[B]*8));
yading@11 565 p = dst + 3*x + y*dst_linesize;
yading@11 566 AV_WL24(p, v);
yading@11 567 break;
yading@11 568 case AV_PIX_FMT_RGBA:
yading@11 569 case AV_PIX_FMT_BGRA:
yading@11 570 case AV_PIX_FMT_ARGB:
yading@11 571 case AV_PIX_FMT_ABGR:
yading@11 572 v = (r << (rgba_map[R]*8)) + (g << (rgba_map[G]*8)) + (b << (rgba_map[B]*8)) + (255 << (rgba_map[A]*8));
yading@11 573 p = dst + 4*x + y*dst_linesize;
yading@11 574 AV_WL32(p, v);
yading@11 575 break;
yading@11 576 }
yading@11 577 }
yading@11 578
yading@11 579 static void rgbtest_fill_picture(AVFilterContext *ctx, AVFrame *frame)
yading@11 580 {
yading@11 581 TestSourceContext *test = ctx->priv;
yading@11 582 int x, y, w = frame->width, h = frame->height;
yading@11 583
yading@11 584 for (y = 0; y < h; y++) {
yading@11 585 for (x = 0; x < w; x++) {
yading@11 586 int c = 256*x/w;
yading@11 587 int r = 0, g = 0, b = 0;
yading@11 588
yading@11 589 if (3*y < h ) r = c;
yading@11 590 else if (3*y < 2*h) g = c;
yading@11 591 else b = c;
yading@11 592
yading@11 593 rgbtest_put_pixel(frame->data[0], frame->linesize[0], x, y, r, g, b,
yading@11 594 ctx->outputs[0]->format, test->rgba_map);
yading@11 595 }
yading@11 596 }
yading@11 597 }
yading@11 598
yading@11 599 static av_cold int rgbtest_init(AVFilterContext *ctx)
yading@11 600 {
yading@11 601 TestSourceContext *test = ctx->priv;
yading@11 602
yading@11 603 test->draw_once = 1;
yading@11 604 test->fill_picture_fn = rgbtest_fill_picture;
yading@11 605 return init(ctx);
yading@11 606 }
yading@11 607
yading@11 608 static int rgbtest_query_formats(AVFilterContext *ctx)
yading@11 609 {
yading@11 610 static const enum AVPixelFormat pix_fmts[] = {
yading@11 611 AV_PIX_FMT_RGBA, AV_PIX_FMT_ARGB, AV_PIX_FMT_BGRA, AV_PIX_FMT_ABGR,
yading@11 612 AV_PIX_FMT_BGR24, AV_PIX_FMT_RGB24,
yading@11 613 AV_PIX_FMT_RGB444, AV_PIX_FMT_BGR444,
yading@11 614 AV_PIX_FMT_RGB565, AV_PIX_FMT_BGR565,
yading@11 615 AV_PIX_FMT_RGB555, AV_PIX_FMT_BGR555,
yading@11 616 AV_PIX_FMT_NONE
yading@11 617 };
yading@11 618 ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
yading@11 619 return 0;
yading@11 620 }
yading@11 621
yading@11 622 static int rgbtest_config_props(AVFilterLink *outlink)
yading@11 623 {
yading@11 624 TestSourceContext *test = outlink->src->priv;
yading@11 625
yading@11 626 ff_fill_rgba_map(test->rgba_map, outlink->format);
yading@11 627 return config_props(outlink);
yading@11 628 }
yading@11 629
yading@11 630 static const AVFilterPad avfilter_vsrc_rgbtestsrc_outputs[] = {
yading@11 631 {
yading@11 632 .name = "default",
yading@11 633 .type = AVMEDIA_TYPE_VIDEO,
yading@11 634 .request_frame = request_frame,
yading@11 635 .config_props = rgbtest_config_props,
yading@11 636 },
yading@11 637 { NULL }
yading@11 638 };
yading@11 639
yading@11 640 AVFilter avfilter_vsrc_rgbtestsrc = {
yading@11 641 .name = "rgbtestsrc",
yading@11 642 .description = NULL_IF_CONFIG_SMALL("Generate RGB test pattern."),
yading@11 643 .priv_size = sizeof(TestSourceContext),
yading@11 644 .priv_class = &rgbtestsrc_class,
yading@11 645 .init = rgbtest_init,
yading@11 646 .uninit = uninit,
yading@11 647
yading@11 648 .query_formats = rgbtest_query_formats,
yading@11 649
yading@11 650 .inputs = NULL,
yading@11 651
yading@11 652 .outputs = avfilter_vsrc_rgbtestsrc_outputs,
yading@11 653 };
yading@11 654
yading@11 655 #endif /* CONFIG_RGBTESTSRC_FILTER */
yading@11 656
yading@11 657 #if CONFIG_SMPTEBARS_FILTER || CONFIG_SMPTEHDBARS_FILTER
yading@11 658
yading@11 659 static const uint8_t rainbow[7][4] = {
yading@11 660 { 191, 191, 191, 255 }, /* gray */
yading@11 661 { 191, 191, 0, 255 }, /* yellow */
yading@11 662 { 0, 191, 191, 255 }, /* cyan */
yading@11 663 { 0, 191, 0, 255 }, /* green */
yading@11 664 { 191, 0, 191, 255 }, /* magenta */
yading@11 665 { 191, 0, 0, 255 }, /* red */
yading@11 666 { 0, 0, 191, 255 }, /* blue */
yading@11 667 };
yading@11 668
yading@11 669 static const uint8_t wobnair[7][4] = {
yading@11 670 { 0, 0, 191, 255 }, /* blue */
yading@11 671 { 19, 19, 19, 255 }, /* 7.5% intensity black */
yading@11 672 { 191, 0, 191, 255 }, /* magenta */
yading@11 673 { 19, 19, 19, 255 }, /* 7.5% intensity black */
yading@11 674 { 0, 191, 191, 255 }, /* cyan */
yading@11 675 { 19, 19, 19, 255 }, /* 7.5% intensity black */
yading@11 676 { 191, 191, 191, 255 }, /* gray */
yading@11 677 };
yading@11 678
yading@11 679 static const uint8_t white[4] = { 255, 255, 255, 255 };
yading@11 680 static const uint8_t black[4] = { 19, 19, 19, 255 }; /* 7.5% intensity black */
yading@11 681
yading@11 682 /* pluge pulses */
yading@11 683 static const uint8_t neg4ire[4] = { 9, 9, 9, 255 }; /* 3.5% intensity black */
yading@11 684 static const uint8_t pos4ire[4] = { 29, 29, 29, 255 }; /* 11.5% intensity black */
yading@11 685
yading@11 686 /* fudged Q/-I */
yading@11 687 static const uint8_t i_pixel[4] = { 0, 68, 130, 255 };
yading@11 688 static const uint8_t q_pixel[4] = { 67, 0, 130, 255 };
yading@11 689
yading@11 690 static const uint8_t gray40[4] = { 102, 102, 102, 255 };
yading@11 691 static const uint8_t gray15[4] = { 38, 38, 38, 255 };
yading@11 692 static const uint8_t cyan[4] = { 0, 255, 255, 255 };
yading@11 693 static const uint8_t yellow[4] = { 255, 255, 0, 255 };
yading@11 694 static const uint8_t blue[4] = { 0, 0, 255, 255 };
yading@11 695 static const uint8_t red[4] = { 255, 0, 0, 255 };
yading@11 696 static const uint8_t black0[4] = { 5, 5, 5, 255 };
yading@11 697 static const uint8_t black2[4] = { 10, 10, 10, 255 };
yading@11 698 static const uint8_t black4[4] = { 15, 15, 15, 255 };
yading@11 699 static const uint8_t neg2[4] = { 0, 0, 0, 255 };
yading@11 700
yading@11 701 static void inline draw_bar(TestSourceContext *test, const uint8_t *color,
yading@11 702 unsigned x, unsigned y, unsigned w, unsigned h,
yading@11 703 AVFrame *frame)
yading@11 704 {
yading@11 705 FFDrawColor draw_color;
yading@11 706
yading@11 707 x = FFMIN(x, test->w - 1);
yading@11 708 y = FFMIN(y, test->h - 1);
yading@11 709 w = FFMIN(w, test->w - x);
yading@11 710 h = FFMIN(h, test->h - y);
yading@11 711
yading@11 712 av_assert0(x + w <= test->w);
yading@11 713 av_assert0(y + h <= test->h);
yading@11 714
yading@11 715 ff_draw_color(&test->draw, &draw_color, color);
yading@11 716 ff_fill_rectangle(&test->draw, &draw_color,
yading@11 717 frame->data, frame->linesize, x, y, w, h);
yading@11 718 }
yading@11 719
yading@11 720 static int smptebars_query_formats(AVFilterContext *ctx)
yading@11 721 {
yading@11 722 ff_set_common_formats(ctx, ff_draw_supported_pixel_formats(0));
yading@11 723 return 0;
yading@11 724 }
yading@11 725
yading@11 726 static int smptebars_config_props(AVFilterLink *outlink)
yading@11 727 {
yading@11 728 AVFilterContext *ctx = outlink->src;
yading@11 729 TestSourceContext *test = ctx->priv;
yading@11 730
yading@11 731 ff_draw_init(&test->draw, outlink->format, 0);
yading@11 732
yading@11 733 return config_props(outlink);
yading@11 734 }
yading@11 735
yading@11 736 static const AVFilterPad smptebars_outputs[] = {
yading@11 737 {
yading@11 738 .name = "default",
yading@11 739 .type = AVMEDIA_TYPE_VIDEO,
yading@11 740 .request_frame = request_frame,
yading@11 741 .config_props = smptebars_config_props,
yading@11 742 },
yading@11 743 { NULL }
yading@11 744 };
yading@11 745
yading@11 746 #if CONFIG_SMPTEBARS_FILTER
yading@11 747
yading@11 748 #define smptebars_options options
yading@11 749 AVFILTER_DEFINE_CLASS(smptebars);
yading@11 750
yading@11 751 static void smptebars_fill_picture(AVFilterContext *ctx, AVFrame *picref)
yading@11 752 {
yading@11 753 TestSourceContext *test = ctx->priv;
yading@11 754 int r_w, r_h, w_h, p_w, p_h, i, tmp, x = 0;
yading@11 755 const AVPixFmtDescriptor *pixdesc = av_pix_fmt_desc_get(picref->format);
yading@11 756
yading@11 757 r_w = FFALIGN((test->w + 6) / 7, 1 << pixdesc->log2_chroma_w);
yading@11 758 r_h = FFALIGN(test->h * 2 / 3, 1 << pixdesc->log2_chroma_h);
yading@11 759 w_h = FFALIGN(test->h * 3 / 4 - r_h, 1 << pixdesc->log2_chroma_h);
yading@11 760 p_w = FFALIGN(r_w * 5 / 4, 1 << pixdesc->log2_chroma_w);
yading@11 761 p_h = test->h - w_h - r_h;
yading@11 762
yading@11 763 for (i = 0; i < 7; i++) {
yading@11 764 draw_bar(test, rainbow[i], x, 0, r_w, r_h, picref);
yading@11 765 draw_bar(test, wobnair[i], x, r_h, r_w, w_h, picref);
yading@11 766 x += r_w;
yading@11 767 }
yading@11 768 x = 0;
yading@11 769 draw_bar(test, i_pixel, x, r_h + w_h, p_w, p_h, picref);
yading@11 770 x += p_w;
yading@11 771 draw_bar(test, white, x, r_h + w_h, p_w, p_h, picref);
yading@11 772 x += p_w;
yading@11 773 draw_bar(test, q_pixel, x, r_h + w_h, p_w, p_h, picref);
yading@11 774 x += p_w;
yading@11 775 tmp = FFALIGN(5 * r_w - x, 1 << pixdesc->log2_chroma_w);
yading@11 776 draw_bar(test, black, x, r_h + w_h, tmp, p_h, picref);
yading@11 777 x += tmp;
yading@11 778 tmp = FFALIGN(r_w / 3, 1 << pixdesc->log2_chroma_w);
yading@11 779 draw_bar(test, neg4ire, x, r_h + w_h, tmp, p_h, picref);
yading@11 780 x += tmp;
yading@11 781 draw_bar(test, black, x, r_h + w_h, tmp, p_h, picref);
yading@11 782 x += tmp;
yading@11 783 draw_bar(test, pos4ire, x, r_h + w_h, tmp, p_h, picref);
yading@11 784 x += tmp;
yading@11 785 draw_bar(test, black, x, r_h + w_h, test->w - x, p_h, picref);
yading@11 786 }
yading@11 787
yading@11 788 static av_cold int smptebars_init(AVFilterContext *ctx)
yading@11 789 {
yading@11 790 TestSourceContext *test = ctx->priv;
yading@11 791
yading@11 792 test->fill_picture_fn = smptebars_fill_picture;
yading@11 793 test->draw_once = 1;
yading@11 794 return init(ctx);
yading@11 795 }
yading@11 796
yading@11 797 AVFilter avfilter_vsrc_smptebars = {
yading@11 798 .name = "smptebars",
yading@11 799 .description = NULL_IF_CONFIG_SMALL("Generate SMPTE color bars."),
yading@11 800 .priv_size = sizeof(TestSourceContext),
yading@11 801 .init = smptebars_init,
yading@11 802 .uninit = uninit,
yading@11 803
yading@11 804 .query_formats = smptebars_query_formats,
yading@11 805 .inputs = NULL,
yading@11 806 .outputs = smptebars_outputs,
yading@11 807 .priv_class = &smptebars_class,
yading@11 808 };
yading@11 809
yading@11 810 #endif /* CONFIG_SMPTEBARS_FILTER */
yading@11 811
yading@11 812 #if CONFIG_SMPTEHDBARS_FILTER
yading@11 813
yading@11 814 #define smptehdbars_options options
yading@11 815 AVFILTER_DEFINE_CLASS(smptehdbars);
yading@11 816
yading@11 817 static void smptehdbars_fill_picture(AVFilterContext *ctx, AVFrame *picref)
yading@11 818 {
yading@11 819 TestSourceContext *test = ctx->priv;
yading@11 820 int d_w, r_w, r_h, l_w, i, tmp, x = 0, y = 0;
yading@11 821 const AVPixFmtDescriptor *pixdesc = av_pix_fmt_desc_get(picref->format);
yading@11 822
yading@11 823 d_w = FFALIGN(test->w / 8, 1 << pixdesc->log2_chroma_w);
yading@11 824 r_h = FFALIGN(test->h * 7 / 12, 1 << pixdesc->log2_chroma_h);
yading@11 825 draw_bar(test, gray40, x, 0, d_w, r_h, picref);
yading@11 826 x += d_w;
yading@11 827
yading@11 828 r_w = FFALIGN((((test->w + 3) / 4) * 3) / 7, 1 << pixdesc->log2_chroma_w);
yading@11 829 for (i = 0; i < 7; i++) {
yading@11 830 draw_bar(test, rainbow[i], x, 0, r_w, r_h, picref);
yading@11 831 x += r_w;
yading@11 832 }
yading@11 833 draw_bar(test, gray40, x, 0, test->w - x, r_h, picref);
yading@11 834 y = r_h;
yading@11 835 r_h = FFALIGN(test->h / 12, 1 << pixdesc->log2_chroma_h);
yading@11 836 draw_bar(test, cyan, 0, y, d_w, r_h, picref);
yading@11 837 x = d_w;
yading@11 838 draw_bar(test, i_pixel, x, y, r_w, r_h, picref);
yading@11 839 x += r_w;
yading@11 840 tmp = r_w * 6;
yading@11 841 draw_bar(test, rainbow[0], x, y, tmp, r_h, picref);
yading@11 842 x += tmp;
yading@11 843 l_w = x;
yading@11 844 draw_bar(test, blue, x, y, test->w - x, r_h, picref);
yading@11 845 y += r_h;
yading@11 846 draw_bar(test, yellow, 0, y, d_w, r_h, picref);
yading@11 847 x = d_w;
yading@11 848 draw_bar(test, q_pixel, x, y, r_w, r_h, picref);
yading@11 849 x += r_w;
yading@11 850
yading@11 851 for (i = 0; i < tmp; i += 1 << pixdesc->log2_chroma_w) {
yading@11 852 uint8_t yramp[4] = {0};
yading@11 853
yading@11 854 yramp[0] =
yading@11 855 yramp[1] =
yading@11 856 yramp[2] = i * 255 / tmp;
yading@11 857 yramp[3] = 255;
yading@11 858
yading@11 859 draw_bar(test, yramp, x, y, 1 << pixdesc->log2_chroma_w, r_h, picref);
yading@11 860 x += 1 << pixdesc->log2_chroma_w;
yading@11 861 }
yading@11 862 draw_bar(test, red, x, y, test->w - x, r_h, picref);
yading@11 863 y += r_h;
yading@11 864 draw_bar(test, gray15, 0, y, d_w, test->h - y, picref);
yading@11 865 x = d_w;
yading@11 866 tmp = FFALIGN(r_w * 3 / 2, 1 << pixdesc->log2_chroma_w);
yading@11 867 draw_bar(test, black0, x, y, tmp, test->h - y, picref);
yading@11 868 x += tmp;
yading@11 869 tmp = FFALIGN(r_w * 2, 1 << pixdesc->log2_chroma_w);
yading@11 870 draw_bar(test, white, x, y, tmp, test->h - y, picref);
yading@11 871 x += tmp;
yading@11 872 tmp = FFALIGN(r_w * 5 / 6, 1 << pixdesc->log2_chroma_w);
yading@11 873 draw_bar(test, black0, x, y, tmp, test->h - y, picref);
yading@11 874 x += tmp;
yading@11 875 tmp = FFALIGN(r_w / 3, 1 << pixdesc->log2_chroma_w);
yading@11 876 draw_bar(test, neg2, x, y, tmp, test->h - y, picref);
yading@11 877 x += tmp;
yading@11 878 draw_bar(test, black0, x, y, tmp, test->h - y, picref);
yading@11 879 x += tmp;
yading@11 880 draw_bar(test, black2, x, y, tmp, test->h - y, picref);
yading@11 881 x += tmp;
yading@11 882 draw_bar(test, black0, x, y, tmp, test->h - y, picref);
yading@11 883 x += tmp;
yading@11 884 draw_bar(test, black4, x, y, tmp, test->h - y, picref);
yading@11 885 x += tmp;
yading@11 886 r_w = l_w - x;
yading@11 887 draw_bar(test, black0, x, y, r_w, test->h - y, picref);
yading@11 888 x += r_w;
yading@11 889 draw_bar(test, gray15, x, y, test->w - x, test->h - y, picref);
yading@11 890 }
yading@11 891
yading@11 892 static av_cold int smptehdbars_init(AVFilterContext *ctx)
yading@11 893 {
yading@11 894 TestSourceContext *test = ctx->priv;
yading@11 895
yading@11 896 test->fill_picture_fn = smptehdbars_fill_picture;
yading@11 897 test->draw_once = 1;
yading@11 898 return init(ctx);
yading@11 899 }
yading@11 900
yading@11 901 AVFilter avfilter_vsrc_smptehdbars = {
yading@11 902 .name = "smptehdbars",
yading@11 903 .description = NULL_IF_CONFIG_SMALL("Generate SMPTE HD color bars."),
yading@11 904 .priv_size = sizeof(TestSourceContext),
yading@11 905 .init = smptehdbars_init,
yading@11 906 .uninit = uninit,
yading@11 907
yading@11 908 .query_formats = smptebars_query_formats,
yading@11 909 .inputs = NULL,
yading@11 910 .outputs = smptebars_outputs,
yading@11 911 .priv_class = &smptehdbars_class,
yading@11 912 };
yading@11 913
yading@11 914 #endif /* CONFIG_SMPTEHDBARS_FILTER */
yading@11 915 #endif /* CONFIG_SMPTEBARS_FILTER || CONFIG_SMPTEHDBARS_FILTER */