avfilter: pass link YUV colorspace to ff_draw_init2

This makes all ff_draw_* based filters aware of YUV colorspaces and
ranges. Needed for YUVJ removal. Also fixes a bug where e.g. vf_pad
would generate a limited range background even after conversion to
full-scale grayscale.

The FATE changes were a consequence of the aforementioned bugfix - the
gray scale files are output as full range (due to conversion by
libswscale, which hard-codes gray = full), and appropriately tagged as
such, but before this change the padded version incorrectly used
a limited range (16) black background for these formats.
This commit is contained in:
Niklas Haas
2024-01-31 11:47:30 +01:00
parent 8264f3612c
commit ce81237d63
14 changed files with 32 additions and 25 deletions
+5 -3
View File
@@ -638,7 +638,7 @@ static int qrencodesrc_config_props(AVFilterLink *outlink)
ff_draw_color(&qr->draw, &qr->draw_foreground_color, (const uint8_t *)&qr->foreground_color);
ff_draw_color(&qr->draw, &qr->draw_background_color, (const uint8_t *)&qr->background_color);
ff_draw_init(&qr->draw0, outlink->format, FF_DRAW_PROCESS_ALPHA);
ff_draw_init2(&qr->draw0, outlink->format, outlink->colorspace, outlink->color_range, FF_DRAW_PROCESS_ALPHA);
ff_draw_color(&qr->draw0, &qr->draw0_background_color, (const uint8_t *)&qr->background_color);
outlink->w = qr->rendered_padded_qrcode_width;
@@ -730,7 +730,8 @@ static int qrencode_config_input(AVFilterLink *inlink)
qr->is_source = 0;
ff_draw_init(&qr->draw, inlink->format, FF_DRAW_PROCESS_ALPHA);
ff_draw_init2(&qr->draw, inlink->format, inlink->colorspace, inlink->color_range,
FF_DRAW_PROCESS_ALPHA);
V(W) = V(main_w) = inlink->w;
V(H) = V(main_h) = inlink->h;
@@ -759,7 +760,8 @@ static int qrencode_config_input(AVFilterLink *inlink)
PARSE_EXPR(rendered_qrcode_width);
PARSE_EXPR(rendered_padded_qrcode_width);
ff_draw_init(&qr->draw, inlink->format, FF_DRAW_PROCESS_ALPHA);
ff_draw_init2(&qr->draw, inlink->format, inlink->colorspace, inlink->color_range,
FF_DRAW_PROCESS_ALPHA);
ff_draw_color(&qr->draw, &qr->draw_foreground_color, (const uint8_t *)&qr->foreground_color);
ff_draw_color(&qr->draw, &qr->draw_background_color, (const uint8_t *)&qr->background_color);