Go to the documentation of this file.
84 #define OFFSET(x) offsetof(TestSourceContext, x)
85 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
86 #define FLAGSR AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
88 #define SIZE_OPTIONS \
89 { "size", "set video size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str = "320x240"}, 0, 0, FLAGS },\
90 { "s", "set video size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str = "320x240"}, 0, 0, FLAGS },\
92 #define COMMON_OPTIONS_NOSIZE \
93 { "rate", "set video rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, INT_MAX, FLAGS },\
94 { "r", "set video rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, INT_MAX, FLAGS },\
95 { "duration", "set video duration", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64 = -1}, -1, INT64_MAX, FLAGS },\
96 { "d", "set video duration", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64 = -1}, -1, INT64_MAX, FLAGS },\
97 { "sar", "set video sample aspect ratio", OFFSET(sar), AV_OPT_TYPE_RATIONAL, {.dbl= 1}, 0, INT_MAX, FLAGS },
99 #define COMMON_OPTIONS SIZE_OPTIONS COMMON_OPTIONS_NOSIZE
116 test->duration < 0 ? -1 : (
double)
test->duration/1000000,
132 outlink->
w =
test->w;
133 outlink->
h =
test->h;
146 if (
test->duration >= 0 &&
150 if (
test->draw_once) {
151 if (
test->draw_once_reset) {
153 test->draw_once_reset = 0;
169 frame->key_frame = 1;
170 frame->interlaced_frame = 0;
173 if (!
test->draw_once)
182 #if CONFIG_COLOR_FILTER
184 static const AVOption color_options[] = {
204 test->fill_picture_fn = color_fill_picture;
234 static int color_process_command(
AVFilterContext *
ctx,
const char *cmd,
const char *args,
235 char *res,
int res_len,
int flags)
245 test->draw_once_reset = 1;
254 .config_props = color_config_props,
262 .priv_class = &color_class,
274 #if CONFIG_HALDCLUTSRC_FILTER
276 static const AVOption haldclutsrc_options[] = {
286 int i, j, k,
x = 0, y = 0, is16bit = 0,
step;
291 const int w =
frame->width;
292 const int h =
frame->height;
294 const int linesize =
frame->linesize[0];
302 switch (
frame->format) {
319 scale = ((float)(1 << (8*(is16bit+1))) - 1) / (
level*
level - 1);
321 #define LOAD_CLUT(nbits) do { \
322 uint##nbits##_t *dst = ((uint##nbits##_t *)(data + y*linesize)) + x*step; \
323 dst[rgba_map[0]] = av_clip_uint##nbits(i * scale); \
324 dst[rgba_map[1]] = av_clip_uint##nbits(j * scale); \
325 dst[rgba_map[2]] = av_clip_uint##nbits(k * scale); \
327 dst[rgba_map[3]] = alpha; \
331 for (k = 0; k <
level; k++) {
332 for (j = 0; j <
level; j++) {
374 static int haldclutsrc_config_props(
AVFilterLink *outlink)
388 .config_props = haldclutsrc_config_props,
394 .
name =
"haldclutsrc",
396 .priv_class = &haldclutsrc_class,
398 .
init = haldclutsrc_init,
402 .
outputs = haldclutsrc_outputs,
406 #if CONFIG_NULLSRC_FILTER
408 #define nullsrc_options options
417 test->fill_picture_fn = nullsrc_fill_picture;
434 .init = nullsrc_init,
437 .priv_class = &nullsrc_class,
444 #if CONFIG_TESTSRC_FILTER
446 static const AVOption testsrc_options[] = {
468 int x,
int y,
int w,
int h)
473 dst += segment_width * (
step *
x + y * dst_linesize);
474 w *= segment_width *
step;
476 for (
i = 0;
i <
h;
i++) {
482 static void draw_digit(
int digit,
uint8_t *dst,
int dst_linesize,
488 #define LEFT_TOP_VBAR 8
489 #define LEFT_BOT_VBAR 16
490 #define RIGHT_TOP_VBAR 32
491 #define RIGHT_BOT_VBAR 64
503 static const unsigned char masks[10] = {
504 TOP_HBAR |BOT_HBAR|LEFT_TOP_VBAR|LEFT_BOT_VBAR|RIGHT_TOP_VBAR|RIGHT_BOT_VBAR,
505 RIGHT_TOP_VBAR|RIGHT_BOT_VBAR,
506 TOP_HBAR|MID_HBAR|BOT_HBAR|LEFT_BOT_VBAR |RIGHT_TOP_VBAR,
507 TOP_HBAR|MID_HBAR|BOT_HBAR |RIGHT_TOP_VBAR|RIGHT_BOT_VBAR,
508 MID_HBAR |LEFT_TOP_VBAR |RIGHT_TOP_VBAR|RIGHT_BOT_VBAR,
509 TOP_HBAR|BOT_HBAR|MID_HBAR|LEFT_TOP_VBAR |RIGHT_BOT_VBAR,
510 TOP_HBAR|BOT_HBAR|MID_HBAR|LEFT_TOP_VBAR|LEFT_BOT_VBAR |RIGHT_BOT_VBAR,
511 TOP_HBAR |RIGHT_TOP_VBAR|RIGHT_BOT_VBAR,
512 TOP_HBAR|BOT_HBAR|MID_HBAR|LEFT_TOP_VBAR|LEFT_BOT_VBAR|RIGHT_TOP_VBAR|RIGHT_BOT_VBAR,
513 TOP_HBAR|BOT_HBAR|MID_HBAR|LEFT_TOP_VBAR |RIGHT_TOP_VBAR|RIGHT_BOT_VBAR,
515 unsigned mask = masks[digit];
522 segments[
i].
x, segments[
i].y, segments[
i].
w, segments[
i].
h);
525 #define GRADIENT_SIZE (6 * 256)
532 int color, color_rest;
536 int dquad_x, dquad_y;
537 int grad, dgrad, rgrad, drgrad;
550 for (y = 0; y <
height; y++) {
562 *(p++) = icolor & 1 ? 255 : 0;
563 *(p++) = icolor & 2 ? 255 : 0;
564 *(p++) = icolor & 4 ? 255 : 0;
566 if (color_rest >=
width) {
573 p0 +=
frame->linesize[0];
578 grad = (256 *
test->nb_frame *
test->time_base.num /
test->time_base.den) %
581 dgrad = GRADIENT_SIZE /
width;
582 drgrad = GRADIENT_SIZE %
width;
585 grad < 256 || grad >= 5 * 256 ? 255 :
586 grad >= 2 * 256 && grad < 4 * 256 ? 0 :
587 grad < 2 * 256 ? 2 * 256 - 1 - grad : grad - 4 * 256;
589 grad >= 4 * 256 ? 0 :
590 grad >= 1 * 256 && grad < 3 * 256 ? 255 :
591 grad < 1 * 256 ? grad : 4 * 256 - 1 - grad;
594 grad >= 3 * 256 && grad < 5 * 256 ? 255 :
595 grad < 3 * 256 ? grad - 2 * 256 : 6 * 256 - 1 - grad;
598 if (rgrad >= GRADIENT_SIZE) {
600 rgrad -= GRADIENT_SIZE;
602 if (grad >= GRADIENT_SIZE)
603 grad -= GRADIENT_SIZE;
606 for (y =
height / 8; y > 0; y--) {
608 p +=
frame->linesize[0];
612 seg_size =
width / 80;
613 if (seg_size >= 1 &&
height >= 13 * seg_size) {
614 int64_t p10decimals = 1;
620 for (
x = 0;
x <
test->nb_decimals;
x++)
625 y = (
height - seg_size * 13) / 2;
627 for (
i = 0;
i < 8;
i++) {
628 p -= 3 * 8 * seg_size;
629 draw_digit(second % 10, p,
frame->linesize[0], seg_size);
641 test->fill_picture_fn = test_fill_picture;
657 static const AVFilterPad avfilter_vsrc_testsrc_outputs[] = {
671 .priv_class = &testsrc_class,
676 .
outputs = avfilter_vsrc_testsrc_outputs,
681 #if CONFIG_TESTSRC2_FILTER
683 static const AVOption testsrc2_options[] = {
693 uint8_t rgba[4] = { (argb >> 16) & 0xFF,
696 (argb >> 24) & 0xFF, };
700 static uint32_t color_gradient(
unsigned index)
702 unsigned si =
index & 0xFF, sd = 0xFF - si;
703 switch (
index >> 8) {
704 case 0:
return 0xFF0000 + (si << 8);
705 case 1:
return 0x00FF00 + (sd << 16);
706 case 2:
return 0x00FF00 + (si << 0);
707 case 3:
return 0x0000FF + (sd << 8);
708 case 4:
return 0x0000FF + (si << 16);
709 case 5:
return 0xFF0000 + (sd << 0);
715 int x0,
int y0,
const uint8_t *text)
719 for (; *text; text++) {
736 unsigned alpha = (uint32_t)
s->alpha << 24;
740 unsigned i,
x = 0, x2;
746 set_color(
s, &
color, ((
i & 1) ? 0xFF0000 : 0) |
747 ((
i & 2) ? 0x00FF00 : 0) |
748 ((
i & 4) ? 0x0000FF : 0) |
759 unsigned x, dx, y0, y, g0,
g;
764 for (
x = 0;
x <
s->w;
x += dx) {
768 y %= 2 * (
s->h - 16);
770 y = 2 * (
s->h - 16) - y;
778 if (
s->w >= 64 &&
s->h >= 64) {
779 int l = (
FFMIN(
s->w,
s->h) - 32) >> 1;
780 int steps =
FFMAX(4, l >> 5);
781 int xc = (
s->w >> 2) + (
s->w >> 1);
782 int yc = (
s->h >> 2);
787 for (
c = 0;
c < 3;
c++) {
788 set_color(
s, &
color, (0xBBBBBB ^ (0xFF << (
c << 3))) |
alpha);
792 pos < 3 * l ? 3 * l -
pos : 0;
793 yh =
pos < 1 * l ? 0 :
799 for (
i = 1;
i <= steps;
i++) {
811 if (
s->w >= 64 &&
s->h >= 64) {
812 int l = (
FFMIN(
s->w,
s->h) - 16) >> 2;
814 int xc = (
s->w >> 2);
815 int yc = (
s->h >> 2) + (
s->h >> 1);
828 set_color(
s, &
color, 0xFF808080);
835 x1, ym1, x2 - x1, ym2 - ym1);
838 xm1, y1, xm2 - xm1, y2 - y1);
841 x1, y1, x2 - x1, y2 - y1);
854 for (y = ymin; y + 15 < ymax; y += 16) {
855 for (
x = xmin;
x + 15 < xmax;
x += 16) {
858 for (
i = 0;
i < 256;
i++) {
859 r =
r * 1664525 + 1013904223;
862 set_color(
s, &
color, 0xFF00FF80);
865 alpha, 16, 16, 16, 3, 0,
x, y);
871 if (
s->w >= 16 &&
s->h >= 16) {
872 unsigned w =
s->w - 8;
873 unsigned h =
s->h - 8;
882 set_color(
s, &
color, 0xFF8000FF);
893 set_color(
s, &
color, 0xC0000000);
897 set_color(
s, &
color, 0xFFFF8000);
898 snprintf(buf,
sizeof(buf),
"%02d:%02d:%02d.%03d\n%12"PRIi64,
899 time / 3600000, (time / 60000) % 60, (time / 1000) % 60,
900 time % 1000,
s->pts);
908 s->fill_picture_fn = test2_fill_picture;
930 static const AVFilterPad avfilter_vsrc_testsrc2_outputs[] = {
935 .config_props = test2_config_props,
944 .priv_class = &testsrc2_class,
949 .
outputs = avfilter_vsrc_testsrc2_outputs,
954 #if CONFIG_RGBTESTSRC_FILTER
956 #define rgbtestsrc_options options
964 static void rgbtest_put_pixel(
uint8_t *dst,
int dst_linesize,
972 case AV_PIX_FMT_BGR444: ((uint16_t*)(dst + y*dst_linesize))[
x] = ((
r >> 4) << 8) | ((
g >> 4) << 4) | (
b >> 4);
break;
973 case AV_PIX_FMT_RGB444: ((uint16_t*)(dst + y*dst_linesize))[
x] = ((
b >> 4) << 8) | ((
g >> 4) << 4) | (
r >> 4);
break;
974 case AV_PIX_FMT_BGR555: ((uint16_t*)(dst + y*dst_linesize))[
x] = ((
r>>3)<<10) | ((
g>>3)<<5) | (
b>>3);
break;
975 case AV_PIX_FMT_RGB555: ((uint16_t*)(dst + y*dst_linesize))[
x] = ((
b>>3)<<10) | ((
g>>3)<<5) | (
r>>3);
break;
976 case AV_PIX_FMT_BGR565: ((uint16_t*)(dst + y*dst_linesize))[
x] = ((
r>>3)<<11) | ((
g>>2)<<5) | (
b>>3);
break;
977 case AV_PIX_FMT_RGB565: ((uint16_t*)(dst + y*dst_linesize))[
x] = ((
b>>3)<<11) | ((
g>>2)<<5) | (
r>>3);
break;
980 v = (
r << (rgba_map[
R]*8)) + (
g << (rgba_map[
G]*8)) + (
b << (rgba_map[
B]*8));
981 p = dst + 3*
x + y*dst_linesize;
988 v = (
r << (rgba_map[
R]*8)) + (
g << (rgba_map[
G]*8)) + (
b << (rgba_map[
B]*8)) + (255
U << (rgba_map[
A]*8));
989 p = dst + 4*
x + y*dst_linesize;
1000 for (y = 0; y <
h; y++) {
1001 for (
x = 0;
x <
w;
x++) {
1003 int r = 0,
g = 0,
b = 0;
1005 if (3*y <
h )
r =
c;
1006 else if (3*y < 2*
h)
g =
c;
1009 rgbtest_put_pixel(
frame->data[0],
frame->linesize[0],
x, y,
r,
g,
b,
1010 ctx->outputs[0]->format,
test->rgba_map);
1019 test->draw_once = 1;
1020 test->fill_picture_fn = rgbtest_fill_picture;
1049 static const AVFilterPad avfilter_vsrc_rgbtestsrc_outputs[] = {
1054 .config_props = rgbtest_config_props,
1060 .
name =
"rgbtestsrc",
1063 .priv_class = &rgbtestsrc_class,
1064 .
init = rgbtest_init,
1068 .
outputs = avfilter_vsrc_rgbtestsrc_outputs,
1073 #if CONFIG_YUVTESTSRC_FILTER
1075 #define yuvtestsrc_options options
1083 const int mid = 1 << (
desc->comp[0].depth - 1);
1087 int ylinesize =
frame->linesize[0];
1088 int ulinesize =
frame->linesize[1];
1089 int vlinesize =
frame->linesize[2];
1091 for (y = 0; y <
h; y++) {
1092 for (
x = 0;
x <
w;
x++) {
1106 for (; y <
h; y++) {
1107 for (
x = 0;
x <
w;
x++) {
1120 for (; y <
frame->height; y++) {
1121 for (
x = 0;
x <
w;
x++) {
1140 const int mid = 1 << (
desc->comp[0].depth - 1);
1141 uint16_t *ydst = (uint16_t *)
frame->data[0];
1142 uint16_t *udst = (uint16_t *)
frame->data[1];
1143 uint16_t *vdst = (uint16_t *)
frame->data[2];
1144 int ylinesize =
frame->linesize[0] / 2;
1145 int ulinesize =
frame->linesize[1] / 2;
1146 int vlinesize =
frame->linesize[2] / 2;
1148 for (y = 0; y <
h; y++) {
1149 for (
x = 0;
x <
w;
x++) {
1163 for (; y <
h; y++) {
1164 for (
x = 0;
x <
w;
x++) {
1177 for (; y <
frame->height; y++) {
1178 for (
x = 0;
x <
w;
x++) {
1196 test->draw_once = 1;
1221 test->fill_picture_fn =
desc->comp[0].depth > 8 ? yuvtest_fill_picture16 : yuvtest_fill_picture8;
1225 static const AVFilterPad avfilter_vsrc_yuvtestsrc_outputs[] = {
1230 .config_props = yuvtest_config_props,
1236 .
name =
"yuvtestsrc",
1239 .priv_class = &yuvtestsrc_class,
1240 .
init = yuvtest_init,
1244 .
outputs = avfilter_vsrc_yuvtestsrc_outputs,
1249 #if CONFIG_PAL75BARS_FILTER || CONFIG_PAL100BARS_FILTER || CONFIG_SMPTEBARS_FILTER || CONFIG_SMPTEHDBARS_FILTER
1251 static const uint8_t rainbow[7][4] = {
1252 { 180, 128, 128, 255 },
1253 { 162, 44, 142, 255 },
1254 { 131, 156, 44, 255 },
1255 { 112, 72, 58, 255 },
1256 { 84, 184, 198, 255 },
1257 { 65, 100, 212, 255 },
1258 { 35, 212, 114, 255 },
1261 static const uint8_t rainbow100[7][4] = {
1262 { 235, 128, 128, 255 },
1263 { 210, 16, 146, 255 },
1264 { 170, 166, 16, 255 },
1265 { 145, 54, 34, 255 },
1266 { 106, 202, 222, 255 },
1267 { 81, 90, 240, 255 },
1268 { 41, 240, 110, 255 },
1271 static const uint8_t rainbowhd[7][4] = {
1272 { 180, 128, 128, 255 },
1273 { 168, 44, 136, 255 },
1274 { 145, 147, 44, 255 },
1275 { 133, 63, 52, 255 },
1276 { 63, 193, 204, 255 },
1277 { 51, 109, 212, 255 },
1278 { 28, 212, 120, 255 },
1281 static const uint8_t wobnair[7][4] = {
1282 { 35, 212, 114, 255 },
1283 { 19, 128, 128, 255 },
1284 { 84, 184, 198, 255 },
1285 { 19, 128, 128, 255 },
1286 { 131, 156, 44, 255 },
1287 { 19, 128, 128, 255 },
1288 { 180, 128, 128, 255 },
1291 static const uint8_t white[4] = { 235, 128, 128, 255 };
1294 static const uint8_t neg4ire[4] = { 7, 128, 128, 255 };
1295 static const uint8_t pos4ire[4] = { 24, 128, 128, 255 };
1298 static const uint8_t i_pixel[4] = { 57, 156, 97, 255 };
1299 static const uint8_t q_pixel[4] = { 44, 171, 147, 255 };
1301 static const uint8_t gray40[4] = { 104, 128, 128, 255 };
1302 static const uint8_t gray15[4] = { 49, 128, 128, 255 };
1303 static const uint8_t cyan[4] = { 188, 154, 16, 255 };
1304 static const uint8_t yellow[4] = { 219, 16, 138, 255 };
1305 static const uint8_t blue[4] = { 32, 240, 118, 255 };
1306 static const uint8_t red[4] = { 63, 102, 240, 255 };
1307 static const uint8_t black0[4] = { 16, 128, 128, 255 };
1308 static const uint8_t black2[4] = { 20, 128, 128, 255 };
1309 static const uint8_t black4[4] = { 25, 128, 128, 255 };
1310 static const uint8_t neg2[4] = { 12, 128, 128, 255 };
1313 int x,
int y,
int w,
int h,
1328 for (plane = 0;
frame->data[plane]; plane++) {
1329 const int c =
color[plane];
1330 const int linesize =
frame->linesize[plane];
1331 int i, px, py, pw, ph;
1333 if (plane == 1 || plane == 2) {
1334 px =
x >>
desc->log2_chroma_w;
1336 py = y >>
desc->log2_chroma_h;
1345 p0 = p =
frame->data[plane] + py * linesize + px;
1348 for (
i = 1;
i < ph;
i++, p += linesize)
1378 #if CONFIG_PAL75BARS_FILTER
1380 #define pal75bars_options options
1394 draw_bar(
test, white,
x, 0, r_w,
test->h, picref);
1396 for (
i = 1;
i < 7;
i++) {
1397 draw_bar(
test, rainbow[
i],
x, 0, r_w,
test->h, picref);
1400 draw_bar(
test, black0,
x, 0, r_w,
test->h, picref);
1407 test->fill_picture_fn = pal75bars_fill_picture;
1408 test->draw_once = 1;
1413 .
name =
"pal75bars",
1416 .priv_class = &pal75bars_class,
1417 .
init = pal75bars_init,
1426 #if CONFIG_PAL100BARS_FILTER
1428 #define pal100bars_options options
1442 for (
i = 0;
i < 7;
i++) {
1443 draw_bar(
test, rainbow100[
i],
x, 0, r_w,
test->h, picref);
1446 draw_bar(
test, black0,
x, 0, r_w,
test->h, picref);
1453 test->fill_picture_fn = pal100bars_fill_picture;
1454 test->draw_once = 1;
1459 .
name =
"pal100bars",
1462 .priv_class = &pal100bars_class,
1463 .
init = pal100bars_init,
1472 #if CONFIG_SMPTEBARS_FILTER
1474 #define smptebars_options options
1480 int r_w, r_h, w_h, p_w, p_h,
i,
tmp,
x = 0;
1489 p_h =
test->h - w_h - r_h;
1491 for (
i = 0;
i < 7;
i++) {
1492 draw_bar(
test, rainbow[
i],
x, 0, r_w, r_h, picref);
1493 draw_bar(
test, wobnair[
i],
x, r_h, r_w, w_h, picref);
1497 draw_bar(
test, i_pixel,
x, r_h + w_h, p_w, p_h, picref);
1499 draw_bar(
test, white,
x, r_h + w_h, p_w, p_h, picref);
1501 draw_bar(
test, q_pixel,
x, r_h + w_h, p_w, p_h, picref);
1504 draw_bar(
test, black0,
x, r_h + w_h,
tmp, p_h, picref);
1507 draw_bar(
test, neg4ire,
x, r_h + w_h,
tmp, p_h, picref);
1509 draw_bar(
test, black0,
x, r_h + w_h,
tmp, p_h, picref);
1511 draw_bar(
test, pos4ire,
x, r_h + w_h,
tmp, p_h, picref);
1513 draw_bar(
test, black0,
x, r_h + w_h,
test->w -
x, p_h, picref);
1520 test->fill_picture_fn = smptebars_fill_picture;
1521 test->draw_once = 1;
1526 .
name =
"smptebars",
1529 .priv_class = &smptebars_class,
1530 .
init = smptebars_init,
1539 #if CONFIG_SMPTEHDBARS_FILTER
1541 #define smptehdbars_options options
1547 int d_w, r_w, r_h, l_w,
i,
tmp,
x = 0, y = 0;
1554 draw_bar(
test, gray40,
x, 0, d_w, r_h, picref);
1558 for (
i = 0;
i < 7;
i++) {
1559 draw_bar(
test, rainbowhd[
i],
x, 0, r_w, r_h, picref);
1562 draw_bar(
test, gray40,
x, 0,
test->w -
x, r_h, picref);
1565 draw_bar(
test, cyan, 0, y, d_w, r_h, picref);
1567 draw_bar(
test, i_pixel,
x, y, r_w, r_h, picref);
1570 draw_bar(
test, rainbowhd[0],
x, y,
tmp, r_h, picref);
1573 draw_bar(
test, blue,
x, y,
test->w -
x, r_h, picref);
1575 draw_bar(
test, yellow, 0, y, d_w, r_h, picref);
1577 draw_bar(
test, q_pixel,
x, y, r_w, r_h, picref);
1583 yramp[0] =
i * 255 /
tmp;
1591 draw_bar(
test, red,
x, y,
test->w -
x, r_h, picref);
1593 draw_bar(
test, gray15, 0, y, d_w,
test->h - y, picref);
1596 draw_bar(
test, black0,
x, y,
tmp,
test->h - y, picref);
1602 draw_bar(
test, black0,
x, y,
tmp,
test->h - y, picref);
1607 draw_bar(
test, black0,
x, y,
tmp,
test->h - y, picref);
1609 draw_bar(
test, black2,
x, y,
tmp,
test->h - y, picref);
1611 draw_bar(
test, black0,
x, y,
tmp,
test->h - y, picref);
1613 draw_bar(
test, black4,
x, y,
tmp,
test->h - y, picref);
1616 draw_bar(
test, black0,
x, y, r_w,
test->h - y, picref);
1625 test->fill_picture_fn = smptehdbars_fill_picture;
1626 test->draw_once = 1;
1631 .
name =
"smptehdbars",
1634 .priv_class = &smptehdbars_class,
1635 .
init = smptehdbars_init,
1645 #if CONFIG_ALLYUV_FILTER
1647 static const AVOption allyuv_options[] = {
1656 const int ys =
frame->linesize[0];
1657 const int us =
frame->linesize[1];
1658 const int vs =
frame->linesize[2];
1661 for (y = 0; y < 4096; y++) {
1662 for (
x = 0;
x < 2048;
x++) {
1663 frame->data[0][y * ys +
x] = ((
x / 8) % 256);
1664 frame->data[0][y * ys + 4095 -
x] = ((
x / 8) % 256);
1667 for (
x = 0;
x < 2048;
x+=8) {
1668 for (j = 0; j < 8; j++) {
1669 frame->data[1][vs * y +
x + j] = (y%16 + (j % 8) * 16);
1670 frame->data[1][vs * y + 4095 -
x - j] = (128 + y%16 + (j % 8) * 16);
1674 for (
x = 0;
x < 4096;
x++)
1675 frame->data[2][y *
us +
x] = 256 * y / 4096;
1684 test->draw_once = 1;
1685 test->fill_picture_fn = allyuv_fill_picture;
1702 static const AVFilterPad avfilter_vsrc_allyuv_outputs[] = {
1716 .priv_class = &allyuv_class,
1717 .
init = allyuv_init,
1721 .
outputs = avfilter_vsrc_allyuv_outputs,
1726 #if CONFIG_ALLRGB_FILTER
1728 static const AVOption allrgb_options[] = {
1738 const int linesize =
frame->linesize[0];
1741 for (y = 0; y < 4096; y++) {
1744 for (
x = 0;
x < 4096;
x++) {
1747 *dst++ = (
x >> 8) | ((y >> 8) << 4);
1758 test->draw_once = 1;
1759 test->fill_picture_fn = allrgb_fill_picture;
1783 static const AVFilterPad avfilter_vsrc_allrgb_outputs[] = {
1788 .config_props = allrgb_config_props,
1797 .priv_class = &allrgb_class,
1798 .
init = allrgb_init,
1802 .
outputs = avfilter_vsrc_allrgb_outputs,
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
enum AVColorRange color_range
MPEG vs JPEG YUV range.
AVPixelFormat
Pixel format.
static av_always_inline double ff_exp10(double x)
Compute 10^x for floating point values.
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame 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. Frame references ownership and permissions
AVFilter ff_vsrc_yuvtestsrc
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
#define AVERROR_EOF
End of file.
static av_cold void uninit(AVFilterContext *ctx)
AVFilter ff_vsrc_pal100bars
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
The exact code depends on how similar the blocks are and how related they are to the and needs to apply these operations to the correct inlink or outlink if there are several Macros are available to factor that when no extra processing is inlink
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
enum AVColorSpace colorspace
YUV colorspace type.
This structure describes decoded (raw) audio or video data.
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
#define AV_LOG_VERBOSE
Detailed information.
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
@ AV_PIX_FMT_BGRA
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
static av_cold int init(AVFilterContext *ctx)
const char * name
Filter name.
A link between two filters.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
@ AVCOL_SPC_BT470BG
also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601
void * priv
private data for use by the filter
FFmpeg Automated Testing Environment ************************************Introduction Using FATE from your FFmpeg source directory Submitting the results to the FFmpeg result aggregation server Uploading new samples to the fate suite FATE makefile targets and variables Makefile targets Makefile variables Examples Introduction **************FATE is an extended regression suite on the client side and a means for results aggregation and presentation on the server side The first part of this document explains how you can use FATE from your FFmpeg source directory to test your ffmpeg binary The second part describes how you can run FATE to submit the results to FFmpeg’s FATE server In any way you can have a look at the publicly viewable FATE results by visiting this as it can be seen if some test on some platform broke with their recent contribution This usually happens on the platforms the developers could not test on The second part of this document describes how you can run FATE to submit your results to FFmpeg’s FATE server If you want to submit your results be sure to check that your combination of OS and compiler is not already listed on the above mentioned website In the third part you can find a comprehensive listing of FATE makefile targets and variables Using FATE from your FFmpeg source directory **********************************************If you want to run FATE on your machine you need to have the samples in place You can get the samples via the build target fate rsync Use this command from the top level source this will cause FATE to fail NOTE To use a custom wrapper to run the pass ‘ target exec’ to ‘configure’ or set the TARGET_EXEC Make variable Submitting the results to the FFmpeg result aggregation server ****************************************************************To submit your results to the server you should run fate through the shell script ‘tests fate sh’ from the FFmpeg sources This script needs to be invoked with a configuration file as its first argument tests fate sh path to fate_config A configuration file template with comments describing the individual configuration variables can be found at ‘doc fate_config sh template’ Create a configuration that suits your based on the configuration template The ‘slot’ configuration variable can be any string that is not yet but it is suggested that you name it adhering to the following pattern ‘ARCH OS COMPILER COMPILER VERSION’ The configuration file itself will be sourced in a shell therefore all shell features may be used This enables you to setup the environment as you need it for your build For your first test runs the ‘fate_recv’ variable should be empty or commented out This will run everything as normal except that it will omit the submission of the results to the server The following files should be present in $workdir as specified in the configuration it may help to try out the ‘ssh’ command with one or more ‘ v’ options You should get detailed output concerning your SSH configuration and the authentication process The only thing left is to automate the execution of the fate sh script and the synchronisation of the samples directory Uploading new samples to the fate suite *****************************************If you need a sample uploaded send a mail to samples request This is for developers who have an account on the fate suite server If you upload new please make sure they are as small as space on each network bandwidth and so on benefit from smaller test cases Also keep in mind older checkouts use existing sample that means in practice generally do not remove or overwrite files as it likely would break older checkouts or releases Also all needed samples for a commit should be ideally before the push If you need an account for frequently uploading samples or you wish to help others by doing that send a mail to ffmpeg devel rsync vauL Duo x
static void draw_rectangle(AVFormatContext *s)
static int request_frame(AVFilterLink *outlink)
static double val(void *priv, double ch)
#define us(width, name, range_min, range_max, subs,...)
void ff_blend_mask(FFDrawContext *draw, FFDrawColor *color, uint8_t *dst[], int dst_linesize[], int dst_w, int dst_h, const uint8_t *mask, int mask_linesize, int mask_w, int mask_h, int l2depth, unsigned endianness, int x0, int y0)
Blend an alpha mask with an uniform color.
A filter pad used for either input or output.
#define AV_PIX_FMT_YUV444P10
int64_t duration
duration expressed in microseconds
static const uint16_t mask[17]
#define AV_PIX_FMT_YUV444P16
#define AV_CEIL_RSHIFT(a, b)
static double av_q2d(AVRational a)
Convert an AVRational to a double.
AVRational sample_aspect_ratio
agreed upon sample aspect ratio
#define av_assert0(cond)
assert() equivalent, that is always enabled.
static const AVFilterPad outputs[]
AVRational frame_rate
Frame rate of the stream on the link, or 1/0 if unknown or variable; if left to 0/0,...
static enum AVPixelFormat pix_fmts[]
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
int ff_draw_init(FFDrawContext *draw, enum AVPixelFormat format, unsigned flags)
Init a draw context.
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
@ AV_PIX_FMT_YUVJ444P
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
@ AV_PIX_FMT_RGBA
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
AVRational sar
sample aspect ratio
#define AV_PIX_FMT_RGBA64
Describe the class of an AVClass context structure.
Rational number (pair of numerator and denominator).
AVFilter ff_vsrc_haldclutsrc
@ AV_PICTURE_TYPE_I
Intra.
AVFilter ff_vsrc_rgbtestsrc
@ AV_PIX_FMT_BGR0
packed BGR 8:8:8, 32bpp, BGRXBGRX... X=unused/undefined
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
@ AV_PIX_FMT_ABGR
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
AVFrame * picref
cached reference containing the painted picture
AVFilter ff_vsrc_testsrc2
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.
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static int config_props(AVFilterLink *outlink)
int av_get_padded_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
Return the number of bits per pixel for the pixel format described by pixdesc, including any padding ...
void ff_blend_rectangle(FFDrawContext *draw, FFDrawColor *color, uint8_t *dst[], int dst_linesize[], int dst_w, int dst_h, int x0, int y0, int w, int h)
Blend a rectangle with an uniform color.
@ AV_ROUND_ZERO
Round toward zero.
int format
agreed upon media format
static const uint32_t color[16+AV_CLASS_CATEGORY_NB]
static AVRational av_make_q(int num, int den)
Create an AVRational.
static void draw_text(FFDrawContext *draw, AVFrame *frame, FFDrawColor *color, int x0, int y0, const uint8_t *text, int vertical)
#define AV_PIX_FMT_BGR555
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.
#define AV_PIX_FMT_YUV444P12
FFmpeg Automated Testing Environment ************************************Introduction Using FATE from your FFmpeg source directory Submitting the results to the FFmpeg result aggregation server Uploading new samples to the fate suite FATE makefile targets and variables Makefile targets Makefile variables Examples Introduction **************FATE is an extended regression suite on the client side and a means for results aggregation and presentation on the server side The first part of this document explains how you can use FATE from your FFmpeg source directory to test your ffmpeg binary The second part describes how you can run FATE to submit the results to FFmpeg’s FATE server In any way you can have a look at the publicly viewable FATE results by visiting this as it can be seen if some test on some platform broke with their recent contribution This usually happens on the platforms the developers could not test on The second part of this document describes how you can run FATE to submit your results to FFmpeg’s FATE server If you want to submit your results be sure to check that your combination of OS and compiler is not already listed on the above mentioned website In the third part you can find a comprehensive listing of FATE makefile targets and variables Using FATE from your FFmpeg source directory **********************************************If you want to run FATE on your machine you need to have the samples in place You can get the samples via the build target fate rsync Use this command from the top level source this will cause FATE to fail NOTE To use a custom wrapper to run the test
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames,...
AVFilterContext * src
source filter
int ff_filter_process_command(AVFilterContext *ctx, const char *cmd, const char *arg, char *res, int res_len, int flags)
Generic processing of user supplied commands that are set in the same way as the filter options.
AVFilter ff_vsrc_smptebars
@ AV_PIX_FMT_RGB0
packed RGB 8:8:8, 32bpp, RGBXRGBX... X=unused/undefined
AVFilter ff_vsrc_smptehdbars
#define AVFILTER_DEFINE_CLASS(fname)
@ AV_PIX_FMT_ARGB
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
int draw_once
draw only the first frame, always put out the same picture
#define AV_PIX_FMT_BGRA64
const uint8_t avpriv_vga16_font[4096]
#define i(width, name, range_min, range_max)
int w
agreed upon image width
AVFilterFormats * ff_draw_supported_pixel_formats(unsigned flags)
Return the list of pixel formats supported by the draw functions.
#define AV_PIX_FMT_BGR444
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
#define AV_PIX_FMT_RGB555
int ff_draw_round_to_sub(FFDrawContext *draw, int sub_dir, int round_dir, int value)
Round a dimension according to subsampling.
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
#define AV_PIX_FMT_BGR565
const char * name
Pad name.
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
@ AVCOL_RANGE_MPEG
the normal 219*2^(n-8) "MPEG" YUV ranges
#define AV_PIX_FMT_YUV444P9
#define AV_PIX_FMT_RGB565
void ff_draw_color(FFDrawContext *draw, FFDrawColor *color, const uint8_t rgba[4])
Prepare a color.
@ AV_PIX_FMT_0BGR
packed BGR 8:8:8, 32bpp, XBGRXBGR... X=unused/undefined
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 the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
FFmpeg Automated Testing Environment ************************************Introduction Using FATE from your FFmpeg source directory Submitting the results to the FFmpeg result aggregation server Uploading new samples to the fate suite FATE makefile targets and variables Makefile targets Makefile variables Examples Introduction **************FATE is an extended regression suite on the client side and a means for results aggregation and presentation on the server side The first part of this document explains how you can use FATE from your FFmpeg source directory to test your ffmpeg binary The second part describes how you can run FATE to submit the results to FFmpeg’s FATE server In any way you can have a look at the publicly viewable FATE results by visiting this as it can be seen if some test on some platform broke with their recent contribution This usually happens on the platforms the developers could not test on The second part of this document describes how you can run FATE to submit your results to FFmpeg’s FATE server If you want to submit your results be sure to check that your combination of OS and compiler is not already listed on the above mentioned website In the third part you can find a comprehensive listing of FATE makefile targets and variables Using FATE from your FFmpeg source directory **********************************************If you want to run FATE on your machine you need to have the samples in place You can get the samples via the build target fate rsync Use this command from the top level source this will cause FATE to fail NOTE To use a custom wrapper to run the pass ‘ target exec’ to ‘configure’ or set the TARGET_EXEC Make variable Submitting the results to the FFmpeg result aggregation server ****************************************************************To submit your results to the server you should run fate through the shell script ‘tests fate sh’ from the FFmpeg sources This script needs to be invoked with a configuration file as its first argument tests fate sh path to fate_config A configuration file template with comments describing the individual configuration variables can be found at ‘doc fate_config sh template’ Create a configuration that suits your based on the configuration template The ‘slot’ configuration variable can be any string that is not yet but it is suggested that you name it adhering to the following pattern ‘ARCH OS COMPILER COMPILER VERSION’ The configuration file itself will be sourced in a shell therefore all shell features may be used This enables you to setup the environment as you need it for your build For your first test runs the ‘fate_recv’ variable should be empty or commented out This will run everything as normal except that it will omit the submission of the results to the server The following files should be present in $workdir as specified in the configuration it may help to try out the ‘ssh’ command with one or more ‘ v’ options You should get detailed output concerning your SSH configuration and the authentication process The only thing left is to automate the execution of the fate sh script and the synchronisation of the samples directory Uploading new samples to the fate suite *****************************************If you need a sample uploaded send a mail to samples request This is for developers who have an account on the fate suite server If you upload new please make sure they are as small as space on each network bandwidth and so on benefit from smaller test cases Also keep in mind older checkouts use existing sample that means in practice generally do not remove or overwrite files as it likely would break older checkouts or releases Also all needed samples for a commit should be ideally before the push If you need an account for frequently uploading samples or you wish to help others by doing that send a mail to ffmpeg devel rsync vauL Duo ug o o w
#define FF_ARRAY_ELEMS(a)
typedef void(RENAME(mix_any_func_type))
int h
agreed upon image height
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link.
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
static const int factor[16]
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
static const int16_t alpha[]
@ AV_PIX_FMT_YUV411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
int ff_fill_rgba_map(uint8_t *rgba_map, enum AVPixelFormat pix_fmt)
int draw_once_reset
draw only the first frame or in case of reset
static int query_formats(AVFilterContext *ctx)
#define flags(name, subs,...)
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
@ AV_PIX_FMT_0RGB
packed RGB 8:8:8, 32bpp, XRGBXRGB... X=unused/undefined
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
#define AV_PIX_FMT_YUV444P14
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...
@ AVCOL_SPC_BT709
also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B
void(* fill_picture_fn)(AVFilterContext *ctx, AVFrame *frame)
AVFilter ff_vsrc_pal75bars
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
The official guide to swscale for confused that consecutive non overlapping rectangles of slice_bottom special converter These generally are unscaled converters of common like for each output line the vertical scaler pulls lines from a ring buffer When the ring buffer does not contain the wanted line
#define COMMON_OPTIONS_NOSIZE
static const AVOption options[]
#define AV_PIX_FMT_RGB444