87 #define OFFSET(x) offsetof(TestSourceContext, x)
88 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
89 #define FLAGSR AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
91 #define SIZE_OPTIONS \
92 { "size", "set video size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str = "320x240"}, 0, 0, FLAGS },\
93 { "s", "set video size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str = "320x240"}, 0, 0, FLAGS },\
95 #define COMMON_OPTIONS_NOSIZE \
96 { "rate", "set video rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, INT_MAX, FLAGS },\
97 { "r", "set video rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, INT_MAX, FLAGS },\
98 { "duration", "set video duration", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64 = -1}, -1, INT64_MAX, FLAGS },\
99 { "d", "set video duration", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64 = -1}, -1, INT64_MAX, FLAGS },\
100 { "sar", "set video sample aspect ratio", OFFSET(sar), AV_OPT_TYPE_RATIONAL, {.dbl= 1}, 0, INT_MAX, FLAGS },
102 #define COMMON_OPTIONS SIZE_OPTIONS COMMON_OPTIONS_NOSIZE
104 #define NOSIZE_OPTIONS_OFFSET 2
122 test->duration < 0 ? -1 : (
double)
test->duration/1000000,
138 outlink->
w =
test->w;
139 outlink->
h =
test->h;
155 if (
test->duration >= 0 &&
161 if (
test->draw_once) {
162 if (
test->draw_once_reset) {
164 test->draw_once_reset = 0;
184 if (!
test->draw_once)
193 #if CONFIG_COLOR_FILTER
195 static const AVOption color_options[] = {
215 test->fill_picture_fn = color_fill_picture;
250 static int color_process_command(
AVFilterContext *
ctx,
const char *cmd,
const char *args,
251 char *res,
int res_len,
int flags)
261 test->draw_once_reset = 1;
269 .config_props = color_config_props,
277 .priv_class = &color_class,
290 #if CONFIG_HALDCLUTSRC_FILTER
292 static const AVOption haldclutsrc_options[] = {
302 int i, j, k, x = 0, y = 0, is16bit = 0, step;
335 scale = ((float)(1 << (8*(is16bit+1))) - 1) / (
level*
level - 1);
337 #define LOAD_CLUT(nbits) do { \
338 uint##nbits##_t *dst = ((uint##nbits##_t *)(data + y*linesize)) + x*step; \
339 dst[rgba_map[0]] = av_clip_uint##nbits(i * scale); \
340 dst[rgba_map[1]] = av_clip_uint##nbits(j * scale); \
341 dst[rgba_map[2]] = av_clip_uint##nbits(k * scale); \
343 dst[rgba_map[3]] = alpha; \
347 for (k = 0; k <
level; k++) {
348 for (j = 0; j <
level; j++) {
390 static int haldclutsrc_config_props(
AVFilterLink *outlink)
403 .config_props = haldclutsrc_config_props,
409 .
name =
"haldclutsrc",
411 .priv_class = &haldclutsrc_class,
413 .
init = haldclutsrc_init,
418 .
outputs = haldclutsrc_outputs,
422 #if CONFIG_NULLSRC_FILTER
424 #define nullsrc_options options
433 test->fill_picture_fn = nullsrc_fill_picture;
449 .init = nullsrc_init,
453 .priv_class = &nullsrc_class,
460 #if CONFIG_TESTSRC_FILTER
462 static const AVOption testsrc_options[] = {
484 int x,
int y,
int w,
int h)
489 dst += segment_width * (step * x + y * dst_linesize);
490 w *= segment_width * step;
492 for (
i = 0;
i <
h;
i++) {
498 static void draw_digit(
int digit,
uint8_t *dst,
int dst_linesize,
504 #define LEFT_TOP_VBAR 8
505 #define LEFT_BOT_VBAR 16
506 #define RIGHT_TOP_VBAR 32
507 #define RIGHT_BOT_VBAR 64
519 static const unsigned char masks[10] = {
520 TOP_HBAR |BOT_HBAR|LEFT_TOP_VBAR|LEFT_BOT_VBAR|RIGHT_TOP_VBAR|RIGHT_BOT_VBAR,
521 RIGHT_TOP_VBAR|RIGHT_BOT_VBAR,
522 TOP_HBAR|MID_HBAR|BOT_HBAR|LEFT_BOT_VBAR |RIGHT_TOP_VBAR,
523 TOP_HBAR|MID_HBAR|BOT_HBAR |RIGHT_TOP_VBAR|RIGHT_BOT_VBAR,
524 MID_HBAR |LEFT_TOP_VBAR |RIGHT_TOP_VBAR|RIGHT_BOT_VBAR,
525 TOP_HBAR|BOT_HBAR|MID_HBAR|LEFT_TOP_VBAR |RIGHT_BOT_VBAR,
526 TOP_HBAR|BOT_HBAR|MID_HBAR|LEFT_TOP_VBAR|LEFT_BOT_VBAR |RIGHT_BOT_VBAR,
527 TOP_HBAR |RIGHT_TOP_VBAR|RIGHT_BOT_VBAR,
528 TOP_HBAR|BOT_HBAR|MID_HBAR|LEFT_TOP_VBAR|LEFT_BOT_VBAR|RIGHT_TOP_VBAR|RIGHT_BOT_VBAR,
529 TOP_HBAR|BOT_HBAR|MID_HBAR|LEFT_TOP_VBAR |RIGHT_TOP_VBAR|RIGHT_BOT_VBAR,
531 unsigned mask = masks[digit];
538 segments[
i].x, segments[
i].y, segments[
i].
w, segments[
i].
h);
541 #define GRADIENT_SIZE (6 * 256)
548 int color, color_rest;
552 int dquad_x, dquad_y;
553 int grad, dgrad, rgrad, drgrad;
566 for (y = 0; y <
height; y++) {
572 for (x = 0; x <
width; x++) {
578 *(p++) = icolor & 1 ? 255 : 0;
579 *(p++) = icolor & 2 ? 255 : 0;
580 *(p++) = icolor & 4 ? 255 : 0;
582 if (color_rest >=
width) {
594 grad = (256 *
test->nb_frame *
test->time_base.num /
test->time_base.den) %
597 dgrad = GRADIENT_SIZE /
width;
598 drgrad = GRADIENT_SIZE %
width;
599 for (x = 0; x <
width; x++) {
601 grad < 256 || grad >= 5 * 256 ? 255 :
602 grad >= 2 * 256 && grad < 4 * 256 ? 0 :
603 grad < 2 * 256 ? 2 * 256 - 1 - grad : grad - 4 * 256;
605 grad >= 4 * 256 ? 0 :
606 grad >= 1 * 256 && grad < 3 * 256 ? 255 :
607 grad < 1 * 256 ? grad : 4 * 256 - 1 - grad;
610 grad >= 3 * 256 && grad < 5 * 256 ? 255 :
611 grad < 3 * 256 ? grad - 2 * 256 : 6 * 256 - 1 - grad;
614 if (rgrad >= GRADIENT_SIZE) {
616 rgrad -= GRADIENT_SIZE;
618 if (grad >= GRADIENT_SIZE)
619 grad -= GRADIENT_SIZE;
622 for (y =
height / 8; y > 0; y--) {
628 seg_size =
width / 80;
629 if (seg_size >= 1 &&
height >= 13 * seg_size) {
636 for (x = 0; x <
test->nb_decimals; x++)
641 y = (
height - seg_size * 13) / 2;
643 for (
i = 0;
i < 8;
i++) {
644 p -= 3 * 8 * seg_size;
657 test->fill_picture_fn = test_fill_picture;
673 static const AVFilterPad avfilter_vsrc_testsrc_outputs[] = {
686 .priv_class = &testsrc_class,
692 .
outputs = avfilter_vsrc_testsrc_outputs,
699 uint8_t rgba[4] = { (argb >> 16) & 0xFF,
702 (argb >> 24) & 0xFF, };
706 #if CONFIG_TESTSRC2_FILTER
708 static const AVOption testsrc2_options[] = {
716 static uint32_t color_gradient(
unsigned index)
718 unsigned si =
index & 0xFF, sd = 0xFF - si;
719 switch (
index >> 8) {
720 case 0:
return 0xFF0000 + (si << 8);
721 case 1:
return 0x00FF00 + (sd << 16);
722 case 2:
return 0x00FF00 + (si << 0);
723 case 3:
return 0x0000FF + (sd << 8);
724 case 4:
return 0x0000FF + (si << 16);
725 case 5:
return 0xFF0000 + (sd << 0);
731 int x0,
int y0,
const uint8_t *text)
735 for (; *text; text++) {
752 unsigned alpha = (uint32_t)
s->alpha << 24;
756 unsigned i, x = 0, x2;
763 ((
i & 2) ? 0x00FF00 : 0) |
764 ((
i & 4) ? 0x0000FF : 0) |
775 unsigned x, dx, y0, y, g0,
g;
780 for (x = 0; x <
s->w; x += dx) {
784 y %= 2 * (
s->h - 16);
786 y = 2 * (
s->h - 16) - y;
794 if (
s->w >= 64 &&
s->h >= 64) {
795 int l = (
FFMIN(
s->w,
s->h) - 32) >> 1;
796 int steps =
FFMAX(4, l >> 5);
797 int xc = (
s->w >> 2) + (
s->w >> 1);
798 int yc = (
s->h >> 2);
803 for (
c = 0;
c < 3;
c++) {
808 pos < 3 * l ? 3 * l -
pos : 0;
809 yh =
pos < 1 * l ? 0 :
815 for (
i = 1;
i <= steps;
i++) {
827 if (
s->w >= 64 &&
s->h >= 64) {
828 int l = (
FFMIN(
s->w,
s->h) - 16) >> 2;
830 int xc = (
s->w >> 2);
831 int yc = (
s->h >> 2) + (
s->h >> 1);
836 int size, step, x1, x2, y1, y2;
843 step = (step >> 1) & 3;
849 if (step == 0 || step == 2)
851 x1, ym1, x2 - x1, ym2 - ym1);
852 if (step == 1 || step == 2)
854 xm1, y1, xm2 - xm1, y2 - y1);
857 x1, y1, x2 - x1, y2 - y1);
870 for (y = ymin; y + 15 < ymax; y += 16) {
871 for (x = xmin; x + 15 < xmax; x += 16) {
874 for (
i = 0;
i < 256;
i++) {
875 r =
r * 1664525 + 1013904223;
881 alpha, 16, 16, 16, 3, 0, x, y);
887 if (
s->w >= 16 &&
s->h >= 16) {
888 unsigned w =
s->w - 8;
889 unsigned h =
s->h - 8;
914 snprintf(buf,
sizeof(buf),
"%02d:%02d:%02d.%03d\n%12"PRIi64,
915 time / 3600000, (time / 60000) % 60, (time / 1000) % 60,
916 time % 1000,
s->pts);
924 s->fill_picture_fn = test2_fill_picture;
946 static const AVFilterPad avfilter_vsrc_testsrc2_outputs[] = {
950 .config_props = test2_config_props,
959 .priv_class = &testsrc2_class,
965 .
outputs = avfilter_vsrc_testsrc2_outputs,
970 #if CONFIG_RGBTESTSRC_FILTER
972 static const AVOption rgbtestsrc_options[] = {
986 static void rgbtest_put_pixel(
uint8_t *dstp[4],
int dst_linesizep[4],
991 int dst_linesize = dst_linesizep[0];
997 case AV_PIX_FMT_BGR444: ((uint16_t*)(dst + y*dst_linesize))[x] = ((
r >> 4) << 8) | ((
g >> 4) << 4) | (
b >> 4);
break;
998 case AV_PIX_FMT_RGB444: ((uint16_t*)(dst + y*dst_linesize))[x] = ((
b >> 4) << 8) | ((
g >> 4) << 4) | (
r >> 4);
break;
999 case AV_PIX_FMT_BGR555: ((uint16_t*)(dst + y*dst_linesize))[x] = ((
r>>3)<<10) | ((
g>>3)<<5) | (
b>>3);
break;
1000 case AV_PIX_FMT_RGB555: ((uint16_t*)(dst + y*dst_linesize))[x] = ((
b>>3)<<10) | ((
g>>3)<<5) | (
r>>3);
break;
1001 case AV_PIX_FMT_BGR565: ((uint16_t*)(dst + y*dst_linesize))[x] = ((
r>>3)<<11) | ((
g>>2)<<5) | (
b>>3);
break;
1002 case AV_PIX_FMT_RGB565: ((uint16_t*)(dst + y*dst_linesize))[x] = ((
b>>3)<<11) | ((
g>>2)<<5) | (
r>>3);
break;
1005 v = (
r << (rgba_map[
R]*8)) + (
g << (rgba_map[
G]*8)) + (
b << (rgba_map[
B]*8));
1006 p = dst + 3*x + y*dst_linesize;
1013 v = (
r << (rgba_map[
R]*8)) + (
g << (rgba_map[
G]*8)) + (
b << (rgba_map[
B]*8)) + (255U << (rgba_map[
A]*8));
1014 p = dst + 4*x + y*dst_linesize;
1018 p = dstp[0] + x + y * dst_linesizep[0];
1020 p = dstp[1] + x + y * dst_linesizep[1];
1022 p = dstp[2] + x + y * dst_linesizep[2];
1030 p16 = (uint16_t *)(dstp[0] + x*2 + y * dst_linesizep[0]);
1032 p16 = (uint16_t *)(dstp[1] + x*2 + y * dst_linesizep[1]);
1034 p16 = (uint16_t *)(dstp[2] + x*2 + y * dst_linesizep[2]);
1045 for (y = 0; y <
h; y++) {
1046 for (x = 0; x <
w; x++) {
1048 int r = 0,
g = 0,
b = 0;
1050 if (6*y <
h )
r =
c;
1051 else if (6*y < 2*
h)
g =
c,
b =
c;
1052 else if (6*y < 3*
h)
g =
c;
1053 else if (6*y < 4*
h)
r =
c,
b =
c;
1054 else if (6*y < 5*
h)
b =
c;
1058 ctx->outputs[0]->format,
test->rgba_map);
1068 for (y = 0; y <
h; y++) {
1069 for (x = 0; x <
w; x++) {
1071 int r = 0,
g = 0,
b = 0;
1073 if (3*y <
h )
r =
c;
1074 else if (3*y < 2*
h)
g =
c;
1078 ctx->outputs[0]->format,
test->rgba_map);
1087 test->draw_once = 1;
1088 test->fill_picture_fn =
test->complement ? rgbtest_fill_picture_complement : rgbtest_fill_picture;
1121 static const AVFilterPad avfilter_vsrc_rgbtestsrc_outputs[] = {
1125 .config_props = rgbtest_config_props,
1131 .
name =
"rgbtestsrc",
1134 .priv_class = &rgbtestsrc_class,
1135 .
init = rgbtest_init,
1140 .
outputs = avfilter_vsrc_rgbtestsrc_outputs,
1145 #if CONFIG_YUVTESTSRC_FILTER
1147 #define yuvtestsrc_options options
1155 const int mid = 1 << (
desc->comp[0].depth - 1);
1163 for (y = 0; y <
h; y++) {
1164 for (x = 0; x <
w; x++) {
1178 for (; y <
h; y++) {
1179 for (x = 0; x <
w; x++) {
1193 for (x = 0; x <
w; x++) {
1212 const int mid = 1 << (
desc->comp[0].depth - 1);
1213 uint16_t *ydst = (uint16_t *)
frame->
data[0];
1214 uint16_t *udst = (uint16_t *)
frame->
data[1];
1215 uint16_t *vdst = (uint16_t *)
frame->
data[2];
1220 for (y = 0; y <
h; y++) {
1221 for (x = 0; x <
w; x++) {
1235 for (; y <
h; y++) {
1236 for (x = 0; x <
w; x++) {
1250 for (x = 0; x <
w; x++) {
1268 test->draw_once = 1;
1293 test->fill_picture_fn =
desc->comp[0].depth > 8 ? yuvtest_fill_picture16 : yuvtest_fill_picture8;
1297 static const AVFilterPad avfilter_vsrc_yuvtestsrc_outputs[] = {
1301 .config_props = yuvtest_config_props,
1307 .
name =
"yuvtestsrc",
1310 .priv_class = &yuvtestsrc_class,
1311 .
init = yuvtest_init,
1316 .
outputs = avfilter_vsrc_yuvtestsrc_outputs,
1321 #if CONFIG_PAL75BARS_FILTER || CONFIG_PAL100BARS_FILTER || CONFIG_SMPTEBARS_FILTER || CONFIG_SMPTEHDBARS_FILTER
1323 static const uint8_t rainbow[7][4] = {
1324 { 180, 128, 128, 255 },
1325 { 162, 44, 142, 255 },
1326 { 131, 156, 44, 255 },
1327 { 112, 72, 58, 255 },
1328 { 84, 184, 198, 255 },
1329 { 65, 100, 212, 255 },
1330 { 35, 212, 114, 255 },
1333 static const uint8_t rainbow100[7][4] = {
1334 { 235, 128, 128, 255 },
1335 { 210, 16, 146, 255 },
1336 { 170, 166, 16, 255 },
1337 { 145, 54, 34, 255 },
1338 { 106, 202, 222, 255 },
1339 { 81, 90, 240, 255 },
1340 { 41, 240, 110, 255 },
1343 static const uint8_t rainbowhd[7][4] = {
1344 { 180, 128, 128, 255 },
1345 { 168, 44, 136, 255 },
1346 { 145, 147, 44, 255 },
1347 { 133, 63, 52, 255 },
1348 { 63, 193, 204, 255 },
1349 { 51, 109, 212, 255 },
1350 { 28, 212, 120, 255 },
1353 static const uint8_t wobnair[7][4] = {
1354 { 35, 212, 114, 255 },
1355 { 19, 128, 128, 255 },
1356 { 84, 184, 198, 255 },
1357 { 19, 128, 128, 255 },
1358 { 131, 156, 44, 255 },
1359 { 19, 128, 128, 255 },
1360 { 180, 128, 128, 255 },
1363 static const uint8_t white[4] = { 235, 128, 128, 255 };
1366 static const uint8_t neg4ire[4] = { 7, 128, 128, 255 };
1367 static const uint8_t pos4ire[4] = { 24, 128, 128, 255 };
1370 static const uint8_t i_pixel[4] = { 57, 156, 97, 255 };
1371 static const uint8_t q_pixel[4] = { 44, 171, 147, 255 };
1373 static const uint8_t gray40[4] = { 104, 128, 128, 255 };
1374 static const uint8_t gray15[4] = { 49, 128, 128, 255 };
1375 static const uint8_t cyan[4] = { 188, 154, 16, 255 };
1376 static const uint8_t yellow[4] = { 219, 16, 138, 255 };
1377 static const uint8_t blue[4] = { 32, 240, 118, 255 };
1378 static const uint8_t red[4] = { 63, 102, 240, 255 };
1379 static const uint8_t black0[4] = { 16, 128, 128, 255 };
1380 static const uint8_t black2[4] = { 20, 128, 128, 255 };
1381 static const uint8_t black4[4] = { 25, 128, 128, 255 };
1382 static const uint8_t neg2[4] = { 12, 128, 128, 255 };
1385 int x,
int y,
int w,
int h,
1400 for (plane = 0;
frame->
data[plane]; plane++) {
1401 const int c =
color[plane];
1403 int i, px, py, pw, ph;
1405 if (plane == 1 || plane == 2) {
1406 px = x >>
desc->log2_chroma_w;
1408 py = y >>
desc->log2_chroma_h;
1417 p0 = p =
frame->
data[plane] + py * linesize + px;
1420 for (
i = 1;
i < ph;
i++, p += linesize)
1449 #if CONFIG_PAL75BARS_FILTER
1451 #define pal75bars_options options
1465 draw_bar(
test, white, x, 0, r_w,
test->h, picref);
1467 for (
i = 1;
i < 7;
i++) {
1468 draw_bar(
test, rainbow[
i], x, 0, r_w,
test->h, picref);
1471 draw_bar(
test, black0, x, 0, r_w,
test->h, picref);
1478 test->fill_picture_fn = pal75bars_fill_picture;
1479 test->draw_once = 1;
1484 .
name =
"pal75bars",
1487 .priv_class = &pal75bars_class,
1488 .
init = pal75bars_init,
1498 #if CONFIG_PAL100BARS_FILTER
1500 #define pal100bars_options options
1514 for (
i = 0;
i < 7;
i++) {
1515 draw_bar(
test, rainbow100[
i], x, 0, r_w,
test->h, picref);
1518 draw_bar(
test, black0, x, 0, r_w,
test->h, picref);
1525 test->fill_picture_fn = pal100bars_fill_picture;
1526 test->draw_once = 1;
1531 .
name =
"pal100bars",
1534 .priv_class = &pal100bars_class,
1535 .
init = pal100bars_init,
1545 #if CONFIG_SMPTEBARS_FILTER
1547 #define smptebars_options options
1553 int r_w, r_h, w_h, p_w, p_h,
i,
tmp, x = 0;
1562 p_h =
test->h - w_h - r_h;
1564 for (
i = 0;
i < 7;
i++) {
1565 draw_bar(
test, rainbow[
i], x, 0, r_w, r_h, picref);
1566 draw_bar(
test, wobnair[
i], x, r_h, r_w, w_h, picref);
1570 draw_bar(
test, i_pixel, x, r_h + w_h, p_w, p_h, picref);
1572 draw_bar(
test, white, x, r_h + w_h, p_w, p_h, picref);
1574 draw_bar(
test, q_pixel, x, r_h + w_h, p_w, p_h, picref);
1577 draw_bar(
test, black0, x, r_h + w_h,
tmp, p_h, picref);
1580 draw_bar(
test, neg4ire, x, r_h + w_h,
tmp, p_h, picref);
1582 draw_bar(
test, black0, x, r_h + w_h,
tmp, p_h, picref);
1584 draw_bar(
test, pos4ire, x, r_h + w_h,
tmp, p_h, picref);
1586 draw_bar(
test, black0, x, r_h + w_h,
test->w - x, p_h, picref);
1593 test->fill_picture_fn = smptebars_fill_picture;
1594 test->draw_once = 1;
1599 .
name =
"smptebars",
1602 .priv_class = &smptebars_class,
1603 .
init = smptebars_init,
1613 #if CONFIG_SMPTEHDBARS_FILTER
1615 #define smptehdbars_options options
1621 int d_w, r_w, r_h, l_w,
i,
tmp, x = 0, y = 0;
1628 draw_bar(
test, gray40, x, 0, d_w, r_h, picref);
1632 for (
i = 0;
i < 7;
i++) {
1633 draw_bar(
test, rainbowhd[
i], x, 0, r_w, r_h, picref);
1636 draw_bar(
test, gray40, x, 0,
test->w - x, r_h, picref);
1639 draw_bar(
test, cyan, 0, y, d_w, r_h, picref);
1641 draw_bar(
test, i_pixel, x, y, r_w, r_h, picref);
1644 draw_bar(
test, rainbowhd[0], x, y,
tmp, r_h, picref);
1647 draw_bar(
test, blue, x, y,
test->w - x, r_h, picref);
1649 draw_bar(
test, yellow, 0, y, d_w, r_h, picref);
1651 draw_bar(
test, q_pixel, x, y, r_w, r_h, picref);
1657 yramp[0] =
i * 255 /
tmp;
1665 draw_bar(
test, red, x, y,
test->w - x, r_h, picref);
1667 draw_bar(
test, gray15, 0, y, d_w,
test->h - y, picref);
1670 draw_bar(
test, black0, x, y,
tmp,
test->h - y, picref);
1673 draw_bar(
test, white, x, y,
tmp,
test->h - y, picref);
1676 draw_bar(
test, black0, x, y,
tmp,
test->h - y, picref);
1679 draw_bar(
test, neg2, x, y,
tmp,
test->h - y, picref);
1681 draw_bar(
test, black0, x, y,
tmp,
test->h - y, picref);
1683 draw_bar(
test, black2, x, y,
tmp,
test->h - y, picref);
1685 draw_bar(
test, black0, x, y,
tmp,
test->h - y, picref);
1687 draw_bar(
test, black4, x, y,
tmp,
test->h - y, picref);
1690 draw_bar(
test, black0, x, y, r_w,
test->h - y, picref);
1692 draw_bar(
test, gray15, x, y,
test->w - x,
test->h - y, picref);
1699 test->fill_picture_fn = smptehdbars_fill_picture;
1700 test->draw_once = 1;
1705 .
name =
"smptehdbars",
1708 .priv_class = &smptehdbars_class,
1709 .
init = smptehdbars_init,
1720 #if CONFIG_ALLYUV_FILTER
1722 #define allyuv_options &options[NOSIZE_OPTIONS_OFFSET]
1732 for (y = 0; y < 4096; y++) {
1733 for (x = 0; x < 2048; x++) {
1734 frame->
data[0][y * ys + x] = ((x / 8) % 256);
1735 frame->
data[0][y * ys + 4095 - x] = ((x / 8) % 256);
1738 for (x = 0; x < 2048; x+=8) {
1739 for (j = 0; j < 8; j++) {
1740 frame->
data[1][vs * y + x + j] = (y%16 + (j % 8) * 16);
1741 frame->
data[1][vs * y + 4095 - x - j] = (128 + y%16 + (j % 8) * 16);
1745 for (x = 0; x < 4096; x++)
1755 test->draw_once = 1;
1756 test->fill_picture_fn = allyuv_fill_picture;
1773 static const AVFilterPad avfilter_vsrc_allyuv_outputs[] = {
1786 .priv_class = &allyuv_class,
1787 .
init = allyuv_init,
1792 .
outputs = avfilter_vsrc_allyuv_outputs,
1797 #if CONFIG_ALLRGB_FILTER
1799 #define allrgb_options &options[NOSIZE_OPTIONS_OFFSET]
1808 for (y = 0; y < 4096; y++) {
1811 for (x = 0; x < 4096; x++) {
1814 *dst++ = (x >> 8) | ((y >> 8) << 4);
1825 test->draw_once = 1;
1826 test->fill_picture_fn = allrgb_fill_picture;
1850 static const AVFilterPad avfilter_vsrc_allrgb_outputs[] = {
1854 .config_props = allrgb_config_props,
1863 .priv_class = &allrgb_class,
1864 .
init = allrgb_init,
1869 .
outputs = avfilter_vsrc_allrgb_outputs,
static double val(void *priv, double ch)
static int query_formats(AVFilterContext *ctx)
static const AVFilterPad inputs[]
static const AVFilterPad outputs[]
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
AVFilter ff_vsrc_smptebars
AVFilter ff_vsrc_rgbtestsrc
AVFilter ff_vsrc_testsrc2
AVFilter ff_vsrc_pal100bars
AVFilter ff_vsrc_haldclutsrc
AVFilter ff_vsrc_smptehdbars
AVFilter ff_vsrc_pal75bars
AVFilter ff_vsrc_yuvtestsrc
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert0(cond)
assert() equivalent, that is always enabled.
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next 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.
Main libavfilter public API header.
#define flags(name, subs,...)
#define us(width, name, range_min, range_max, subs,...)
common internal and external API header
#define AV_CEIL_RSHIFT(a, b)
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.
int ff_draw_round_to_sub(FFDrawContext *draw, int sub_dir, int round_dir, int value)
Round a dimension according to subsampling.
int ff_draw_init(FFDrawContext *draw, enum AVPixelFormat format, unsigned flags)
Init a draw context.
void ff_draw_color(FFDrawContext *draw, FFDrawColor *color, const uint8_t rgba[4])
Prepare a color.
int ff_fill_rgba_map(uint8_t *rgba_map, enum AVPixelFormat pix_fmt)
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.
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.
AVFilterFormats * ff_draw_supported_pixel_formats(unsigned flags)
Return the list of pixel formats supported by the draw functions.
internal math functions header
static av_always_inline double ff_exp10(double x)
Compute 10^x for floating point values.
static void ff_outlink_set_status(AVFilterLink *link, int status, int64_t pts)
Set the status field of a link from the source filter.
#define FFERROR_NOT_READY
Filters implementation helper functions.
static int ff_outlink_frame_wanted(AVFilterLink *link)
Test if a frame is wanted on an output link.
#define AVERROR_EOF
End of file.
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
#define AV_LOG_VERBOSE
Detailed information.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static AVRational av_make_q(int num, int den)
Create an AVRational.
static double av_q2d(AVRational a)
Convert an AVRational to a double.
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
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_ROUND_ZERO
Round toward zero.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
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...
@ AV_PICTURE_TYPE_I
Intra.
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
static const int16_t alpha[]
#define AVFILTER_DEFINE_CLASS(fname)
common internal API header
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static enum AVPixelFormat pix_fmts[]
static const uint32_t color[16+AV_CLASS_CATEGORY_NB]
static const uint16_t mask[17]
static void test(const char *pattern, const char *host)
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 ...
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
#define AV_PIX_FMT_YUV444P12
#define AV_PIX_FMT_YUV444P9
@ AVCOL_RANGE_MPEG
Narrow or limited range content.
#define AV_PIX_FMT_BGR444
#define AV_PIX_FMT_BGR555
#define AV_PIX_FMT_GBRP10
#define AV_PIX_FMT_RGBA64
#define AV_PIX_FMT_GBRP12
AVPixelFormat
Pixel format.
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
@ AV_PIX_FMT_BGR0
packed BGR 8:8:8, 32bpp, BGRXBGRX... X=unused/undefined
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
@ AV_PIX_FMT_ARGB
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
@ AV_PIX_FMT_BGRA
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
@ AV_PIX_FMT_ABGR
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
@ AV_PIX_FMT_0BGR
packed BGR 8:8:8, 32bpp, XBGRXBGR... X=unused/undefined
@ AV_PIX_FMT_YUV411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
@ AV_PIX_FMT_RGBA
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
@ AV_PIX_FMT_RGB0
packed RGB 8:8:8, 32bpp, RGBXRGBX... X=unused/undefined
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
@ AV_PIX_FMT_0RGB
packed RGB 8:8:8, 32bpp, XRGBXRGB... X=unused/undefined
@ AV_PIX_FMT_YUVJ444P
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
#define AV_PIX_FMT_BGR565
#define AV_PIX_FMT_RGB565
#define AV_PIX_FMT_BGRA64
#define AV_PIX_FMT_RGB444
#define AV_PIX_FMT_GBRP16
#define AV_PIX_FMT_YUV444P14
#define AV_PIX_FMT_GBRP14
#define AV_PIX_FMT_YUV444P16
#define AV_PIX_FMT_RGB555
#define AV_PIX_FMT_YUV444P10
@ AVCOL_SPC_BT709
also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B
@ AVCOL_SPC_BT470BG
also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601
typedef void(RENAME(mix_any_func_type))
#define FF_ARRAY_ELEMS(a)
Describe the class of an AVClass context structure.
void * priv
private data for use by the filter
A link between two filters.
int w
agreed upon image width
int h
agreed upon image height
AVFilterContext * src
source filter
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link.
AVRational sample_aspect_ratio
agreed upon sample aspect ratio
AVRational frame_rate
Frame rate of the stream on the link, or 1/0 if unknown or variable; if left to 0/0,...
int format
agreed upon media format
A filter pad used for either input or output.
const char * name
Pad name.
const char * name
Filter name.
This structure describes decoded (raw) audio or video data.
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
int key_frame
1 -> keyframe, 0-> not
AVRational sample_aspect_ratio
Sample aspect ratio for the video frame, 0/1 if unknown/unspecified.
int interlaced_frame
The content of the picture is interlaced.
enum AVColorRange color_range
MPEG vs JPEG YUV range.
enum AVColorSpace colorspace
YUV colorspace type.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames,...
enum AVPictureType pict_type
Picture type of the frame.
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
Rational number (pair of numerator and denominator).
AVRational sar
sample aspect ratio
int64_t duration
duration expressed in microseconds
int draw_once
draw only the first frame, always put out the same picture
int draw_once_reset
draw only the first frame or in case of reset
AVFrame * picref
cached reference containing the painted picture
void(* fill_picture_fn)(AVFilterContext *ctx, AVFrame *frame)
static void draw_text(FFDrawContext *draw, AVFrame *frame, FFDrawColor *color, int x0, int y0, const uint8_t *text, int vertical)
static const int factor[16]
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
static int config_props(AVFilterLink *outlink)
static const AVOption options[]
static void av_unused set_color(TestSourceContext *s, FFDrawColor *color, uint32_t argb)
static int activate(AVFilterContext *ctx)
static av_cold int init(AVFilterContext *ctx)
static av_cold void uninit(AVFilterContext *ctx)
#define COMMON_OPTIONS_NOSIZE
static void draw_rectangle(AVFormatContext *s)
const uint8_t avpriv_vga16_font[4096]
CGA/EGA/VGA ROM font data.