mirror of
https://github.com/mpv-player/mpv
synced 2024-12-25 08:12:17 +00:00
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.
This commit is contained in:
parent
4c7c8daf9c
commit
622610bad5
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user