From 9e480850432c05e20bcb4c6d296bb08e5c757d18 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 9 May 2020 17:57:48 +0200 Subject: vo_gpu: fix green shit with float yuv input This was incorrect at least because the colorspace matrix attempted to center chroma at (conceptually) 0.5, instead of 0. Also, it tried to apply the fixed point shift logic for component sizes > 8 bit. There is no float yuv format in mpv/ffmpeg yet, but see next commit, which enables zimg to output it. I'm assuming zimg defines this format such that luma is in range [0,1] and chroma in range [-0.5,0.5], with the levels flag being ignored. This is consistent with H264/5 Annex E (I think...), and it sort of seems to look right, so that's it. --- video/out/gpu/video.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'video/out/gpu/video.c') diff --git a/video/out/gpu/video.c b/video/out/gpu/video.c index 41c021bd94..22ce0c3f3b 100644 --- a/video/out/gpu/video.c +++ b/video/out/gpu/video.c @@ -790,6 +790,8 @@ static void pass_get_images(struct gl_video *p, struct video_image *vimg, int csp = type == PLANE_ALPHA ? MP_CSP_RGB : p->image_params.color.space; float tex_mul = 1.0 / mp_get_csp_mul(csp, msb_valid_bits, p->ra_format.component_bits); + if (p->ra_format.component_type == RA_CTYPE_FLOAT) + tex_mul = 1.0; img[n] = (struct image){ .type = type, @@ -2296,6 +2298,7 @@ static void pass_convert_yuv(struct gl_video *p) struct mp_csp_params cparams = MP_CSP_PARAMS_DEFAULTS; cparams.gray = p->is_gray; + cparams.is_float = p->ra_format.component_type == RA_CTYPE_FLOAT; mp_csp_set_image_params(&cparams, &p->image_params); mp_csp_equalizer_state_get(p->video_eq, &cparams); p->user_gamma = 1.0 / (cparams.gamma * p->opts.gamma); -- cgit v1.2.3