Skip to content

Commit

Permalink
all: add missing repr assignments
Browse files Browse the repository at this point in the history
Fixes: 66e451f
  • Loading branch information
kasper93 authored and jeeb committed Jan 26, 2024
1 parent 7b67b1d commit e907689
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions sub/draw_bmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions sub/sd_ass.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions video/csputils.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
1 change: 1 addition & 0 deletions video/filter/vf_fingerprint.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 3 additions & 1 deletion video/mp_image.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit e907689

Please sign in to comment.