summaryrefslogtreecommitdiffstats
path: root/video/mp_image.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-09-19 18:59:01 +0200
committerwm4 <wm4@nowhere>2017-09-19 18:59:01 +0200
commit810990a7465f31ee5ff5e29ebea1fb783e5ed502 (patch)
tree7c0b9bc25434d78fe4c278faaddc420cd7a4a3bc /video/mp_image.c
parent0169da86df2602b80e3bdfc1964817835c0ce844 (diff)
downloadmpv-810990a7465f31ee5ff5e29ebea1fb783e5ed502.tar.bz2
mpv-810990a7465f31ee5ff5e29ebea1fb783e5ed502.tar.xz
mp_image: always copy color attributes on hw download
It was noticed that -copy hwdec modes typically dropped the chroma_location field. This happened because the attributes on hw download are copied with mp_image_copy_attributes(), which tries to copy these parameters only if src and dst were both YUV (in an attempt to copy parameters only if it makes sense). But hardware formats did not have the YUV flag set (anymore?), and code shouldn't attempt to check the flag in this way anyway. Drop the check, and always copy the whole color metadata struct. There is a call to mp_image_params_guess_csp() below, which tries to unset nonsense metadata if it was copied from a YUV format to RGB. This function would also do the right thing for hw formats (although for the cited bug only the software case matters). Fixes #4804.
Diffstat (limited to 'video/mp_image.c')
-rw-r--r--video/mp_image.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/video/mp_image.c b/video/mp_image.c
index 7180e2be50..5aa5647759 100644
--- a/video/mp_image.c
+++ b/video/mp_image.c
@@ -525,15 +525,8 @@ void mp_image_copy_attributes(struct mp_image *dst, struct mp_image *src)
dst->params.p_w = src->params.p_w;
dst->params.p_h = src->params.p_h;
}
- dst->params.color.primaries = src->params.color.primaries;
- dst->params.color.gamma = src->params.color.gamma;
- dst->params.color.sig_peak = src->params.color.sig_peak;
- dst->params.color.light = src->params.color.light;
- if ((dst->fmt.flags & MP_IMGFLAG_YUV) == (src->fmt.flags & MP_IMGFLAG_YUV)) {
- dst->params.color.space = src->params.color.space;
- dst->params.color.levels = src->params.color.levels;
- dst->params.chroma_location = src->params.chroma_location;
- }
+ dst->params.color = src->params.color;
+ dst->params.chroma_location = src->params.chroma_location;
dst->params.spherical = src->params.spherical;
mp_image_params_guess_csp(&dst->params); // ensure colorspace consistency
if ((dst->fmt.flags & MP_IMGFLAG_PAL) && (src->fmt.flags & MP_IMGFLAG_PAL)) {