From c4b2ca83d6afc783b343a4b30d507234c224df40 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 12 May 2020 22:43:29 +0200 Subject: draw_bmp: don't make strange decisions on broken iknput csp params This checked params->color.space for being RGB. If the colorspace is unset, this did dumb things because even if the imgfmt was a RGB one, the colorspace was not set to RGB. This actually also happened to the tests. (Short-cutting RGB like this is actually wrong, since RGB could still have strange gamma or primaries, which would warrant a full conversion. So you'd need to check for these other parameters as well. To be fixed later.) --- sub/draw_bmp.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sub') diff --git a/sub/draw_bmp.c b/sub/draw_bmp.c index 9566582428..7ef0a9f3ff 100644 --- a/sub/draw_bmp.c +++ b/sub/draw_bmp.c @@ -495,6 +495,7 @@ static void init_general(struct mp_draw_sub_cache *p) static bool reinit_to_video(struct mp_draw_sub_cache *p) { struct mp_image_params *params = &p->params; + mp_image_params_guess_csp(params); bool need_premul = params->alpha != MP_ALPHA_PREMUL && (mp_imgfmt_get_desc(params->imgfmt).flags & MP_IMGFLAG_ALPHA); @@ -616,6 +617,7 @@ static bool reinit_to_video(struct mp_draw_sub_cache *p) 0, p->rgba_overlay, NULL)) return false; } else { + // Generally non-RGB. p->video_overlay = talloc_steal(p, mp_image_alloc(overlay_fmt, w, h)); if (!p->video_overlay) return false; -- cgit v1.2.3