From 622610bad50c48da106b58d458b3598aaf4a493b Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 9 Oct 2017 15:15:53 +0200 Subject: img_format: AV_PIX_FMT_PAL8 is RGB This partiular format is not marked as AV_PIX_FMT_FLAG_RGB in FFmpeg's pixdesc table, so mpv assumed it's a YUV format. This is a regression, since the old code in mp_imgfmt_get_desc() also treated this format specially to avoid this problem. Another format which was special-cased in the old code was AV_PIX_FMT_MONOBLACK, so make an exception for it as well. Maybe this problem could be avoided by mp_image_params_guess_csp() not forcing certain colorimetric parameters by the implied colorspace, but certainly that would cause other problems. At least there are mistagged files out there that would break. (Do we actually care?) Fixes #4965. --- video/img_format.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'video') diff --git a/video/img_format.c b/video/img_format.c index 39bb751ddb..52319104df 100644 --- a/video/img_format.c +++ b/video/img_format.c @@ -321,8 +321,8 @@ static bool validate_regular_imgfmt(const struct mp_regular_imgfmt *fmt) enum mp_csp mp_imgfmt_get_forced_csp(int imgfmt) { - const AVPixFmtDescriptor *pixdesc = - av_pix_fmt_desc_get(imgfmt2pixfmt(imgfmt)); + enum AVPixelFormat pixfmt = imgfmt2pixfmt(imgfmt); + const AVPixFmtDescriptor *pixdesc = av_pix_fmt_desc_get(pixfmt); // FFmpeg does not provide a flag for XYZ, so this is the best we can do. if (pixdesc && strncmp(pixdesc->name, "xyz", 3) == 0) @@ -331,6 +331,9 @@ enum mp_csp mp_imgfmt_get_forced_csp(int imgfmt) if (pixdesc && (pixdesc->flags & AV_PIX_FMT_FLAG_RGB)) return MP_CSP_RGB; + if (pixfmt == AV_PIX_FMT_PAL8 || pixfmt == AV_PIX_FMT_MONOBLACK) + return MP_CSP_RGB; + return MP_CSP_AUTO; } -- cgit v1.2.3