84 #define OFFSET(x) offsetof(TestSourceContext, x)
85 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
87 #define SIZE_OPTIONS \
88 { "size", "set video size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str = "320x240"}, 0, 0, FLAGS },\
89 { "s", "set video size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str = "320x240"}, 0, 0, FLAGS },\
91 #define COMMON_OPTIONS_NOSIZE \
92 { "rate", "set video rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, INT_MAX, FLAGS },\
93 { "r", "set video rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, INT_MAX, FLAGS },\
94 { "duration", "set video duration", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64 = -1}, -1, INT64_MAX, FLAGS },\
95 { "d", "set video duration", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64 = -1}, -1, INT64_MAX, FLAGS },\
96 { "sar", "set video sample aspect ratio", OFFSET(sar), AV_OPT_TYPE_RATIONAL, {.dbl= 1}, 0, INT_MAX, FLAGS },
98 #define COMMON_OPTIONS SIZE_OPTIONS COMMON_OPTIONS_NOSIZE
131 outlink->
w = test->
w;
132 outlink->
h = test->
h;
181 #if CONFIG_COLOR_FILTER
183 static const AVOption color_options[] = {
197 0, 0, test->
w, test->
h);
234 char *res,
int res_len,
int flags)
239 if (!strcmp(cmd,
"color") || !strcmp(cmd,
"c")) {
246 memcpy(test->
color_rgba, color_rgba,
sizeof(color_rgba));
260 .config_props = color_config_props,
268 .priv_class = &color_class,
280 #if CONFIG_HALDCLUTSRC_FILTER
282 static const AVOption haldclutsrc_options[] = {
292 int i, j, k, x = 0, y = 0, is16bit = 0, step;
297 const int w = frame->
width;
300 const int linesize = frame->
linesize[0];
325 scale = ((float)(1 << (8*(is16bit+1))) - 1) / (level*level - 1);
327 #define LOAD_CLUT(nbits) do { \
328 uint##nbits##_t *dst = ((uint##nbits##_t *)(data + y*linesize)) + x*step; \
329 dst[rgba_map[0]] = av_clip_uint##nbits(i * scale); \
330 dst[rgba_map[1]] = av_clip_uint##nbits(j * scale); \
331 dst[rgba_map[2]] = av_clip_uint##nbits(k * scale); \
333 dst[rgba_map[3]] = alpha; \
337 for (k = 0; k <
level; k++) {
338 for (j = 0; j <
level; j++) {
339 for (i = 0; i <
level; i++) {
380 static int haldclutsrc_config_props(
AVFilterLink *outlink)
394 .config_props = haldclutsrc_config_props,
400 .
name =
"haldclutsrc",
402 .priv_class = &haldclutsrc_class,
404 .
init = haldclutsrc_init,
408 .
outputs = haldclutsrc_outputs,
412 #if CONFIG_NULLSRC_FILTER
414 #define nullsrc_options options
440 .init = nullsrc_init,
443 .priv_class = &nullsrc_class,
450 #if CONFIG_TESTSRC_FILTER
452 static const AVOption testsrc_options[] = {
474 int x,
int y,
int w,
int h)
479 dst += segment_width * (step * x + y * dst_linesize);
480 w *= segment_width * step;
482 for (i = 0; i <
h; i++) {
488 static void draw_digit(
int digit,
uint8_t *dst,
int dst_linesize,
494 #define LEFT_TOP_VBAR 8
495 #define LEFT_BOT_VBAR 16
496 #define RIGHT_TOP_VBAR 32
497 #define RIGHT_BOT_VBAR 64
509 static const unsigned char masks[10] = {
510 TOP_HBAR |BOT_HBAR|LEFT_TOP_VBAR|LEFT_BOT_VBAR|RIGHT_TOP_VBAR|RIGHT_BOT_VBAR,
511 RIGHT_TOP_VBAR|RIGHT_BOT_VBAR,
512 TOP_HBAR|MID_HBAR|BOT_HBAR|LEFT_BOT_VBAR |RIGHT_TOP_VBAR,
513 TOP_HBAR|MID_HBAR|BOT_HBAR |RIGHT_TOP_VBAR|RIGHT_BOT_VBAR,
514 MID_HBAR |LEFT_TOP_VBAR |RIGHT_TOP_VBAR|RIGHT_BOT_VBAR,
515 TOP_HBAR|BOT_HBAR|MID_HBAR|LEFT_TOP_VBAR |RIGHT_BOT_VBAR,
516 TOP_HBAR|BOT_HBAR|MID_HBAR|LEFT_TOP_VBAR|LEFT_BOT_VBAR |RIGHT_BOT_VBAR,
517 TOP_HBAR |RIGHT_TOP_VBAR|RIGHT_BOT_VBAR,
518 TOP_HBAR|BOT_HBAR|MID_HBAR|LEFT_TOP_VBAR|LEFT_BOT_VBAR|RIGHT_TOP_VBAR|RIGHT_BOT_VBAR,
519 TOP_HBAR|BOT_HBAR|MID_HBAR|LEFT_TOP_VBAR |RIGHT_TOP_VBAR|RIGHT_BOT_VBAR,
521 unsigned mask = masks[digit];
528 segments[i].x, segments[i].y, segments[i].w, segments[i].h);
531 #define GRADIENT_SIZE (6 * 256)
538 int color, color_rest;
542 int dquad_x, dquad_y;
543 int grad, dgrad, rgrad, drgrad;
552 radius = (width +
height) / 4;
553 quad0 = width * width / 4 + height * height / 4 - radius * radius;
556 for (y = 0; y <
height; y++) {
562 for (x = 0; x <
width; x++) {
568 *(p++) = icolor & 1 ? 255 : 0;
569 *(p++) = icolor & 2 ? 255 : 0;
570 *(p++) = icolor & 4 ? 255 : 0;
572 if (color_rest >= width) {
583 p0 = p = data + frame->
linesize[0] * (height * 3/4);
587 dgrad = GRADIENT_SIZE /
width;
588 drgrad = GRADIENT_SIZE %
width;
589 for (x = 0; x <
width; x++) {
591 grad < 256 || grad >= 5 * 256 ? 255 :
592 grad >= 2 * 256 && grad < 4 * 256 ? 0 :
593 grad < 2 * 256 ? 2 * 256 - 1 - grad : grad - 4 * 256;
595 grad >= 4 * 256 ? 0 :
596 grad >= 1 * 256 && grad < 3 * 256 ? 255 :
597 grad < 1 * 256 ? grad : 4 * 256 - 1 - grad;
600 grad >= 3 * 256 && grad < 5 * 256 ? 255 :
601 grad < 3 * 256 ? grad - 2 * 256 : 6 * 256 - 1 - grad;
604 if (rgrad >= GRADIENT_SIZE) {
606 rgrad -= GRADIENT_SIZE;
608 if (grad >= GRADIENT_SIZE)
609 grad -= GRADIENT_SIZE;
612 for (y = height / 8; y > 0; y--) {
613 memcpy(p+frame->
linesize[0], p, 3 * width);
618 seg_size = width / 80;
619 if (seg_size >= 1 && height >= 13 * seg_size) {
620 int64_t p10decimals = 1;
630 x = width - (width - seg_size * 64) / 2;
631 y = (height - seg_size * 13) / 2;
632 p = data + (x*3 + y * frame->
linesize[0]);
633 for (i = 0; i < 8; i++) {
634 p -= 3 * 8 * seg_size;
635 draw_digit(second % 10, p, frame->
linesize[0], seg_size);
663 static const AVFilterPad avfilter_vsrc_testsrc_outputs[] = {
677 .priv_class = &testsrc_class,
682 .
outputs = avfilter_vsrc_testsrc_outputs,
687 #if CONFIG_TESTSRC2_FILTER
689 static const AVOption testsrc2_options[] = {
699 uint8_t rgba[4] = { (argb >> 16) & 0xFF,
702 (argb >> 24) & 0xFF, };
706 static uint32_t color_gradient(
unsigned index)
708 unsigned si = index & 0xFF, sd = 0xFF - si;
709 switch (index >> 8) {
710 case 0:
return 0xFF0000 + (si << 8);
711 case 1:
return 0x00FF00 + (sd << 16);
712 case 2:
return 0x00FF00 + (si << 0);
713 case 3:
return 0x0000FF + (sd << 8);
714 case 4:
return 0x0000FF + (si << 16);
715 case 5:
return 0xFF0000 + (sd << 0);
721 int x0,
int y0,
const uint8_t *text)
725 for (; *text; text++) {
742 unsigned alpha = (uint32_t)s->
alpha << 24;
746 unsigned i, x = 0, x2;
749 for (i = 1; i < 7; i++) {
752 set_color(s, &color, ((i & 1) ? 0xFF0000 : 0) |
753 ((i & 2) ? 0x00FF00 : 0) |
754 ((i & 4) ? 0x0000FF : 0) |
757 x, 0, x2 - x, frame->
height);
765 unsigned x, dx, y0, y, g0,
g;
770 for (x = 0; x < s->
w; x += dx) {
771 g = (
av_rescale(x, 6 * 256, s->
w) + g0) % (6 * 256);
772 set_color(s, &color, color_gradient(g) | alpha);
774 y %= 2 * (s->
h - 16);
776 y = 2 * (s->
h - 16) - y;
784 if (s->
w >= 64 && s->
h >= 64) {
785 int l = (
FFMIN(s->
w, s->
h) - 32) >> 1;
786 int steps =
FFMAX(4, l >> 5);
787 int xc = (s->
w >> 2) + (s->
w >> 1);
788 int yc = (s->
h >> 2);
793 for (c = 0; c < 3; c++) {
794 set_color(s, &color, (0xBBBBBB ^ (0xFF << (c << 3))) | alpha);
796 xh = pos < 1 * l ? pos :
798 pos < 3 * l ? 3 * l - pos : 0;
799 yh = pos < 1 * l ? 0 :
800 pos < 2 * l ? pos - l :
805 for (i = 1; i <= steps; i++) {
817 if (s->
w >= 64 && s->
h >= 64) {
818 int l = (
FFMIN(s->
w, s->
h) - 16) >> 2;
820 int xc = (s->
w >> 2);
821 int yc = (s->
h >> 2) + (s->
h >> 1);
826 int size, step, x1, x2, y1, y2;
833 step = (step >> 1) & 3;
834 set_color(s, &color, 0xFF808080);
839 if (step == 0 || step == 2)
841 x1, ym1, x2 - x1, ym2 - ym1);
842 if (step == 1 || step == 2)
844 xm1, y1, xm2 - xm1, y2 - y1);
847 x1, y1, x2 - x1, y2 - y1);
860 for (y = ymin; y + 15 < ymax; y += 16) {
861 for (x = xmin; x + 15 < xmax; x += 16) {
864 for (i = 0; i < 256; i++) {
865 r = r * 1664525 + 1013904223;
868 set_color(s, &color, 0xFF00FF80);
871 alpha, 16, 16, 16, 3, 0, x, y);
877 if (s->
w >= 16 && s->
h >= 16) {
878 unsigned w = s->
w - 8;
879 unsigned h = s->
h - 8;
888 set_color(s, &color, 0xFF8000FF);
899 set_color(s, &color, 0xC0000000);
903 set_color(s, &color, 0xFFFF8000);
904 snprintf(buf,
sizeof(buf),
"%02d:%02d:%02d.%03d\n%12"PRIi64,
905 time / 3600000, (time / 60000) % 60, (time / 1000) % 60,
906 time % 1000, s->
pts);
936 static const AVFilterPad avfilter_vsrc_testsrc2_outputs[] = {
941 .config_props = test2_config_props,
950 .priv_class = &testsrc2_class,
955 .
outputs = avfilter_vsrc_testsrc2_outputs,
960 #if CONFIG_RGBTESTSRC_FILTER
962 #define rgbtestsrc_options options
970 static void rgbtest_put_pixel(
uint8_t *dst,
int dst_linesize,
978 case AV_PIX_FMT_BGR444: ((uint16_t*)(dst + y*dst_linesize))[x] = ((r >> 4) << 8) | ((g >> 4) << 4) | (b >> 4);
break;
979 case AV_PIX_FMT_RGB444: ((uint16_t*)(dst + y*dst_linesize))[x] = ((b >> 4) << 8) | ((g >> 4) << 4) | (r >> 4);
break;
980 case AV_PIX_FMT_BGR555: ((uint16_t*)(dst + y*dst_linesize))[x] = ((r>>3)<<10) | ((g>>3)<<5) | (b>>3);
break;
981 case AV_PIX_FMT_RGB555: ((uint16_t*)(dst + y*dst_linesize))[x] = ((b>>3)<<10) | ((g>>3)<<5) | (r>>3);
break;
982 case AV_PIX_FMT_BGR565: ((uint16_t*)(dst + y*dst_linesize))[x] = ((r>>3)<<11) | ((g>>2)<<5) | (b>>3);
break;
983 case AV_PIX_FMT_RGB565: ((uint16_t*)(dst + y*dst_linesize))[x] = ((b>>3)<<11) | ((g>>2)<<5) | (r>>3);
break;
986 v = (r << (rgba_map[
R]*8)) + (g << (rgba_map[
G]*8)) + (b << (rgba_map[
B]*8));
987 p = dst + 3*x + y*dst_linesize;
994 v = (r << (rgba_map[
R]*8)) + (g << (rgba_map[
G]*8)) + (b << (rgba_map[
B]*8)) + (255 << (rgba_map[
A]*8));
995 p = dst + 4*x + y*dst_linesize;
1006 for (y = 0; y <
h; y++) {
1007 for (x = 0; x <
w; x++) {
1009 int r = 0, g = 0, b = 0;
1011 if (3*y < h ) r =
c;
1012 else if (3*y < 2*h) g =
c;
1015 rgbtest_put_pixel(frame->
data[0], frame->
linesize[0], x, y, r, g, b,
1055 static const AVFilterPad avfilter_vsrc_rgbtestsrc_outputs[] = {
1060 .config_props = rgbtest_config_props,
1066 .
name =
"rgbtestsrc",
1069 .priv_class = &rgbtestsrc_class,
1070 .
init = rgbtest_init,
1074 .
outputs = avfilter_vsrc_rgbtestsrc_outputs,
1079 #if CONFIG_YUVTESTSRC_FILTER
1081 #define yuvtestsrc_options options
1086 int x, y, w = frame->
width, h = frame->
height / 3;
1089 const int mid = 1 << (desc->
comp[0].
depth - 1);
1093 int ylinesize = frame->
linesize[0];
1094 int ulinesize = frame->
linesize[1];
1095 int vlinesize = frame->
linesize[2];
1097 for (y = 0; y <
h; y++) {
1098 for (x = 0; x <
w; x++) {
1099 int c = factor * x /
w;
1112 for (; y <
h; y++) {
1113 for (x = 0; x <
w; x++) {
1114 int c = factor * x /
w;
1126 for (; y < frame->
height; y++) {
1127 for (x = 0; x <
w; x++) {
1128 int c = factor * x /
w;
1143 int x, y, w = frame->
width, h = frame->
height / 3;
1145 const int factor = 1 << desc->
comp[0].
depth;
1146 const int mid = 1 << (desc->
comp[0].
depth - 1);
1147 uint16_t *ydst = (uint16_t *)frame->
data[0];
1148 uint16_t *udst = (uint16_t *)frame->
data[1];
1149 uint16_t *vdst = (uint16_t *)frame->
data[2];
1150 int ylinesize = frame->
linesize[0] / 2;
1151 int ulinesize = frame->
linesize[1] / 2;
1152 int vlinesize = frame->
linesize[2] / 2;
1154 for (y = 0; y <
h; y++) {
1155 for (x = 0; x <
w; x++) {
1156 int c = factor * x /
w;
1169 for (; y <
h; y++) {
1170 for (x = 0; x <
w; x++) {
1171 int c = factor * x /
w;
1183 for (; y < frame->
height; y++) {
1184 for (x = 0; x <
w; x++) {
1185 int c = factor * x /
w;
1231 static const AVFilterPad avfilter_vsrc_yuvtestsrc_outputs[] = {
1236 .config_props = yuvtest_config_props,
1242 .
name =
"yuvtestsrc",
1245 .priv_class = &yuvtestsrc_class,
1246 .
init = yuvtest_init,
1250 .
outputs = avfilter_vsrc_yuvtestsrc_outputs,
1255 #if CONFIG_SMPTEBARS_FILTER || CONFIG_SMPTEHDBARS_FILTER
1257 static const uint8_t rainbow[7][4] = {
1258 { 180, 128, 128, 255 },
1259 { 162, 44, 142, 255 },
1260 { 131, 156, 44, 255 },
1261 { 112, 72, 58, 255 },
1262 { 84, 184, 198, 255 },
1263 { 65, 100, 212, 255 },
1264 { 35, 212, 114, 255 },
1267 static const uint8_t rainbowhd[7][4] = {
1268 { 180, 128, 128, 255 },
1269 { 168, 44, 136, 255 },
1270 { 145, 147, 44, 255 },
1271 { 133, 63, 52, 255 },
1272 { 63, 193, 204, 255 },
1273 { 51, 109, 212, 255 },
1274 { 28, 212, 120, 255 },
1277 static const uint8_t wobnair[7][4] = {
1278 { 35, 212, 114, 255 },
1279 { 19, 128, 128, 255 },
1280 { 84, 184, 198, 255 },
1281 { 19, 128, 128, 255 },
1282 { 131, 156, 44, 255 },
1283 { 19, 128, 128, 255 },
1284 { 180, 128, 128, 255 },
1287 static const uint8_t white[4] = { 235, 128, 128, 255 };
1290 static const uint8_t neg4ire[4] = { 7, 128, 128, 255 };
1291 static const uint8_t pos4ire[4] = { 24, 128, 128, 255 };
1294 static const uint8_t i_pixel[4] = { 57, 156, 97, 255 };
1295 static const uint8_t q_pixel[4] = { 44, 171, 147, 255 };
1297 static const uint8_t gray40[4] = { 104, 128, 128, 255 };
1298 static const uint8_t gray15[4] = { 49, 128, 128, 255 };
1299 static const uint8_t cyan[4] = { 188, 154, 16, 255 };
1300 static const uint8_t yellow[4] = { 219, 16, 138, 255 };
1301 static const uint8_t blue[4] = { 32, 240, 118, 255 };
1302 static const uint8_t red[4] = { 63, 102, 240, 255 };
1303 static const uint8_t black0[4] = { 16, 128, 128, 255 };
1304 static const uint8_t black2[4] = { 20, 128, 128, 255 };
1305 static const uint8_t black4[4] = { 25, 128, 128, 255 };
1306 static const uint8_t neg2[4] = { 12, 128, 128, 255 };
1309 int x,
int y,
int w,
int h,
1316 x =
FFMIN(x, test->
w - 1);
1317 y =
FFMIN(y, test->
h - 1);
1324 for (plane = 0; frame->
data[
plane]; plane++) {
1325 const int c = color[
plane];
1327 int i, px, py, pw, ph;
1329 if (plane == 1 || plane == 2) {
1341 p0 = p = frame->
data[
plane] + py * linesize + px;
1344 for (i = 1; i < ph; i++, p += linesize)
1374 #if CONFIG_SMPTEBARS_FILTER
1376 #define smptebars_options options
1382 int r_w, r_h, w_h, p_w, p_h, i,
tmp, x = 0;
1391 p_h = test->
h - w_h - r_h;
1393 for (i = 0; i < 7; i++) {
1394 draw_bar(test, rainbow[i], x, 0, r_w, r_h, picref);
1395 draw_bar(test, wobnair[i], x, r_h, r_w, w_h, picref);
1399 draw_bar(test, i_pixel, x, r_h + w_h, p_w, p_h, picref);
1401 draw_bar(test, white, x, r_h + w_h, p_w, p_h, picref);
1403 draw_bar(test, q_pixel, x, r_h + w_h, p_w, p_h, picref);
1406 draw_bar(test, black0, x, r_h + w_h, tmp, p_h, picref);
1409 draw_bar(test, neg4ire, x, r_h + w_h, tmp, p_h, picref);
1411 draw_bar(test, black0, x, r_h + w_h, tmp, p_h, picref);
1413 draw_bar(test, pos4ire, x, r_h + w_h, tmp, p_h, picref);
1415 draw_bar(test, black0, x, r_h + w_h, test->
w - x, p_h, picref);
1428 .
name =
"smptebars",
1431 .priv_class = &smptebars_class,
1432 .
init = smptebars_init,
1441 #if CONFIG_SMPTEHDBARS_FILTER
1443 #define smptehdbars_options options
1449 int d_w, r_w, r_h, l_w, i,
tmp, x = 0, y = 0;
1456 draw_bar(test, gray40, x, 0, d_w, r_h, picref);
1460 for (i = 0; i < 7; i++) {
1461 draw_bar(test, rainbowhd[i], x, 0, r_w, r_h, picref);
1464 draw_bar(test, gray40, x, 0, test->
w - x, r_h, picref);
1467 draw_bar(test, cyan, 0, y, d_w, r_h, picref);
1469 draw_bar(test, i_pixel, x, y, r_w, r_h, picref);
1472 draw_bar(test, rainbowhd[0], x, y, tmp, r_h, picref);
1475 draw_bar(test, blue, x, y, test->
w - x, r_h, picref);
1477 draw_bar(test, yellow, 0, y, d_w, r_h, picref);
1479 draw_bar(test, q_pixel, x, y, r_w, r_h, picref);
1485 yramp[0] = i * 255 /
tmp;
1490 draw_bar(test, yramp, x, y, 1 << pixdesc->
log2_chroma_w, r_h, picref);
1493 draw_bar(test, red, x, y, test->
w - x, r_h, picref);
1495 draw_bar(test, gray15, 0, y, d_w, test->
h - y, picref);
1498 draw_bar(test, black0, x, y, tmp, test->
h - y, picref);
1501 draw_bar(test, white, x, y, tmp, test->
h - y, picref);
1504 draw_bar(test, black0, x, y, tmp, test->
h - y, picref);
1507 draw_bar(test, neg2, x, y, tmp, test->
h - y, picref);
1509 draw_bar(test, black0, x, y, tmp, test->
h - y, picref);
1511 draw_bar(test, black2, x, y, tmp, test->
h - y, picref);
1513 draw_bar(test, black0, x, y, tmp, test->
h - y, picref);
1515 draw_bar(test, black4, x, y, tmp, test->
h - y, picref);
1518 draw_bar(test, black0, x, y, r_w, test->
h - y, picref);
1520 draw_bar(test, gray15, x, y, test->
w - x, test->
h - y, picref);
1533 .
name =
"smptehdbars",
1536 .priv_class = &smptehdbars_class,
1537 .
init = smptehdbars_init,
1547 #if CONFIG_ALLYUV_FILTER
1549 static const AVOption allyuv_options[] = {
1563 for (y = 0; y < 4096; y++) {
1564 for (x = 0; x < 2048; x++) {
1565 frame->
data[0][y * ys + x] = ((x / 8) % 256);
1566 frame->
data[0][y * ys + 4095 - x] = ((x / 8) % 256);
1569 for (x = 0; x < 2048; x+=8) {
1570 for (j = 0; j < 8; j++) {
1571 frame->
data[1][vs * y + x + j] = (y%16 + (j % 8) * 16);
1572 frame->
data[1][vs * y + 4095 - x - j] = (128 + y%16 + (j % 8) * 16);
1576 for (x = 0; x < 4096; x++)
1577 frame->
data[2][y * us + x] = 256 * y / 4096;
1585 test->
w = test->
h = 4096;
1604 static const AVFilterPad avfilter_vsrc_allyuv_outputs[] = {
1618 .priv_class = &allyuv_class,
1619 .
init = allyuv_init,
1623 .
outputs = avfilter_vsrc_allyuv_outputs,
1628 #if CONFIG_ALLRGB_FILTER
1630 static const AVOption allrgb_options[] = {
1640 const int linesize = frame->
linesize[0];
1643 for (y = 0; y < 4096; y++) {
1646 for (x = 0; x < 4096; x++) {
1649 *dst++ = (x >> 8) | ((y >> 8) << 4);
1659 test->
w = test->
h = 4096;
1685 static const AVFilterPad avfilter_vsrc_allrgb_outputs[] = {
1690 .config_props = allrgb_config_props,
1699 .priv_class = &allrgb_class,
1700 .
init = allrgb_init,
1704 .
outputs = avfilter_vsrc_allrgb_outputs,
also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B
AVFilterFormats * ff_draw_supported_pixel_formats(unsigned flags)
Return the list of pixel formats supported by the draw functions.
const char const char void * val
static float alpha(float a)
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
This structure describes decoded (raw) audio or video data.
AVFilter ff_vsrc_smptehdbars
ptrdiff_t const GLvoid * data
#define AV_PIX_FMT_YUV444P14
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Main libavfilter public API header.
packed RGB 8:8:8, 24bpp, RGBRGB...
#define AV_PIX_FMT_RGBA64
also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601 ...
int h
agreed upon image height
static void draw_rectangle(AVFormatContext *s)
static av_cold void uninit(AVFilterContext *ctx)
#define AV_PIX_FMT_BGRA64
#define COMMON_OPTIONS_NOSIZE
const uint8_t avpriv_vga16_font[4096]
packed BGR 8:8:8, 32bpp, XBGRXBGR... X=unused/undefined
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
int draw_once
draw only the first frame, always put out the same picture
#define AV_PIX_FMT_RGB444
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
static av_cold int init(AVFilterContext *ctx)
int ff_draw_round_to_sub(FFDrawContext *draw, int sub_dir, int round_dir, int value)
Round a dimension according to subsampling.
const char * name
Pad name.
#define av_assert0(cond)
assert() equivalent, that is always enabled.
int draw_once_reset
draw only the first frame or in case of reset
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
packed RGB 8:8:8, 32bpp, RGBXRGBX... X=unused/undefined
static const uint32_t color[16+AV_CLASS_CATEGORY_NB]
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
static double av_q2d(AVRational a)
Convert an AVRational to a double.
static int request_frame(AVFilterLink *outlink)
#define AVERROR_EOF
End of file.
#define AV_LOG_VERBOSE
Detailed information.
#define AV_PIX_FMT_YUV444P16
int interlaced_frame
The content of the picture is interlaced.
int av_parse_color(uint8_t *rgba_color, const char *color_string, int slen, void *log_ctx)
Put the RGBA values that correspond to color_string in rgba_color.
A filter pad used for either input or output.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
A link between two filters.
static av_always_inline double ff_exp10(double x)
Compute 10^x for floating point values.
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
AVRational frame_rate
Frame rate of the stream on the link, or 1/0 if unknown or variable; if left to 0/0, will be automatically copied from the first input of the source filter if it exists.
static const uint16_t mask[17]
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
void * priv
private data for use by the filter
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_draw_color(FFDrawContext *draw, FFDrawColor *color, const uint8_t rgba[4])
Prepare a color.
enum AVColorSpace colorspace
YUV colorspace type.
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link...
simple assert() macros that are a bit more flexible than ISO C assert().
#define AV_PIX_FMT_YUV444P10
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
int w
agreed upon image width
AVRational sar
sample aspect ratio
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...
enum AVPictureType pict_type
Picture type of the frame.
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
int64_t duration
duration expressed in microseconds
typedef void(APIENTRY *FF_PFNGLACTIVETEXTUREPROC)(GLenum texture)
static int config_props(AVFilterLink *outlink)
packed RGB 8:8:8, 24bpp, BGRBGR...
AVFilterContext * src
source filter
static const AVFilterPad inputs[]
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.
#define AV_PIX_FMT_YUV444P9
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
static const AVFilterPad outputs[]
int format
agreed upon media format
#define FF_ARRAY_ELEMS(a)
int ff_fill_rgba_map(uint8_t *rgba_map, enum AVPixelFormat pix_fmt)
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.
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames...
#define AV_PIX_FMT_BGR555
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
static void draw_text(FFDrawContext *draw, AVFrame *frame, FFDrawColor *color, int x0, int y0, const uint8_t *text, int vertical)
static void test(const char *pattern, const char *host)
static AVRational av_make_q(int num, int den)
Create an AVRational.
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
AVFilter ff_vsrc_haldclutsrc
AVRational sample_aspect_ratio
Sample aspect ratio for the video frame, 0/1 if unknown/unspecified.
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Describe the class of an AVClass context structure.
Rational number (pair of numerator and denominator).
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.
packed BGR 8:8:8, 32bpp, BGRXBGRX... X=unused/undefined
static const int factor[16]
const char * name
Filter name.
int ff_draw_init(FFDrawContext *draw, enum AVPixelFormat format, unsigned flags)
Init a draw context.
AVRational sample_aspect_ratio
agreed upon sample aspect ratio
AVFilter ff_vsrc_smptebars
AVFilterLink ** outputs
array of pointers to output links
static enum AVPixelFormat pix_fmts[]
#define AV_PIX_FMT_BGR565
AVFilter ff_vsrc_yuvtestsrc
#define AV_PIX_FMT_YUV444P12
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
internal math functions header
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
static int query_formats(AVFilterContext *ctx)
common internal and external API header
#define AV_PIX_FMT_BGR444
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
static const AVOption options[]
#define AV_PIX_FMT_RGB555
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
#define AVFILTER_DEFINE_CLASS(fname)
int key_frame
1 -> keyframe, 0-> not
void(* fill_picture_fn)(AVFilterContext *ctx, AVFrame *frame)
#define AV_PIX_FMT_RGB565
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.
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
int depth
Number of bits in the component.
packed RGB 8:8:8, 32bpp, XRGBXRGB... X=unused/undefined
AVFrame * picref
cached reference containing the painted picture
AVPixelFormat
Pixel format.
AVFilter ff_vsrc_rgbtestsrc
CGA/EGA/VGA ROM font data.
#define AV_CEIL_RSHIFT(a, b)