all: add missing repr assignments

Fixes: 66e451f4
This commit is contained in:
Kacper Michajłow 2024-01-26 16:08:48 +01:00 committed by Jan Ekström
parent 7b67b1ddd3
commit e9076896cd
5 changed files with 10 additions and 1 deletions

View File

@ -662,7 +662,9 @@ static bool reinit_to_video(struct mp_draw_sub_cache *p)
mp_image_params_guess_csp(&p->rgba_overlay->params);
p->rgba_overlay->params.repr.alpha = PL_ALPHA_PREMULTIPLIED;
p->overlay_tmp->params.repr = params->repr;
p->overlay_tmp->params.color = params->color;
p->video_tmp->params.repr = params->repr;
p->video_tmp->params.color = params->color;
if (p->rgba_overlay->imgfmt == overlay_fmt) {
@ -675,6 +677,7 @@ static bool reinit_to_video(struct mp_draw_sub_cache *p)
if (!p->video_overlay)
return false;
p->video_overlay->params.repr = params->repr;
p->video_overlay->params.color = params->color;
p->video_overlay->params.chroma_location = params->chroma_location;
p->video_overlay->params.repr.alpha = PL_ALPHA_PREMULTIPLIED;
@ -731,6 +734,7 @@ static bool reinit_to_video(struct mp_draw_sub_cache *p)
talloc_steal(p, mp_image_alloc(calpha_fmt, w >> xs, h >> ys));
if (!p->calpha_overlay)
return false;
p->calpha_overlay->params.repr = p->alpha_overlay->params.repr;
p->calpha_overlay->params.color = p->alpha_overlay->params.color;
p->calpha_to_f32 = mp_repack_create_planar(calpha_fmt, false, rflags);

View File

@ -973,6 +973,7 @@ static void mangle_colors(struct sd *sd, struct sub_bitmaps *parts)
// Proper conversion to RGB
struct mp_csp_params rgb_params = MP_CSP_PARAMS_DEFAULTS;
rgb_params.repr = params.repr;
rgb_params.color = params.color;
struct pl_transform3x3 vs2rgb;
mp_get_csp_matrix(&rgb_params, &vs2rgb);

View File

@ -436,6 +436,7 @@ void mp_csp_set_image_params(struct mp_csp_params *params,
{
struct mp_image_params p = *imgparams;
mp_image_params_guess_csp(&p); // ensure consistency
params->repr = p.repr;
params->color = p.color;
}

View File

@ -102,6 +102,7 @@ static void f_process(struct mp_filter *f)
// Try to achieve minimum conversion, even if it makes the fingerprints less
// "portable" across source video.
p->scaled->params.repr = mpi->params.repr;
p->scaled->params.color = mpi->params.color;
// Make output always full range; no reason to lose precision.
p->scaled->params.repr.levels = PL_COLOR_LEVELS_FULL;

View File

@ -853,8 +853,10 @@ void mp_image_set_attributes(struct mp_image *image,
nparams.imgfmt = image->imgfmt;
nparams.w = image->w;
nparams.h = image->h;
if (nparams.imgfmt != params->imgfmt)
if (nparams.imgfmt != params->imgfmt) {
nparams.repr = (struct pl_color_repr){0};
nparams.color = (struct pl_color_space){0};
}
mp_image_set_params(image, &nparams);
}