If format is RGB but flagged as XYZ it should be used instead.
Unified · Split
| @@ -488,7 +488,12 @@ void mp_image_copy(struct mp_image *dst, struct mp_image *src) · 487 unmodified lines | |||
| 488 | static enum pl_color_system mp_image_params_get_forced_csp(struct mp_image_params *params) | 488 | static enum pl_color_system mp_image_params_get_forced_csp(struct mp_image_params *params) |
| 489 | { | 489 | { |
| 490 | int imgfmt = params->hw_subfmt ? params->hw_subfmt : params->imgfmt; | 490 | int imgfmt = params->hw_subfmt ? params->hw_subfmt : params->imgfmt; |
| 491 | return mp_imgfmt_get_forced_csp(imgfmt); | 491 | enum pl_color_system csp = mp_imgfmt_get_forced_csp(imgfmt); |
| 492 | |||
| 493 | if (csp == PL_COLOR_SYSTEM_RGB && params->repr.sys == PL_COLOR_SYSTEM_XYZ) | ||
| 494 | csp = PL_COLOR_SYSTEM_XYZ; | ||
| 495 | |||
| 496 | return csp; | ||
| 492 | } | 497 | } |
| 493 | 498 | ||
| 494 | static void assign_bufref(AVBufferRef **dst, AVBufferRef *new) | 499 | static void assign_bufref(AVBufferRef **dst, AVBufferRef *new) |
| @@ -955,8 +960,10 @@ void mp_image_params_guess_csp(struct mp_image_params *params) · 460 unmodified lines | |||
| 955 | if (params->color.transfer == PL_COLOR_TRC_UNKNOWN) | 960 | if (params->color.transfer == PL_COLOR_TRC_UNKNOWN) |
| 956 | params->color.transfer = PL_COLOR_TRC_BT_1886; | 961 | params->color.transfer = PL_COLOR_TRC_BT_1886; |
| 957 | } else if (forced_csp == PL_COLOR_SYSTEM_RGB) { | 962 | } else if (forced_csp == PL_COLOR_SYSTEM_RGB) { |
| 958 | params->repr.sys = PL_COLOR_SYSTEM_RGB; | 963 | if (params->repr.sys == PL_COLOR_SYSTEM_UNKNOWN) |
| 959 | params->repr.levels = PL_COLOR_LEVELS_FULL; | 964 | params->repr.sys = PL_COLOR_SYSTEM_RGB; |
| 965 | if (params->repr.levels == PL_COLOR_LEVELS_UNKNOWN) | ||
| 966 | params->repr.levels = PL_COLOR_LEVELS_FULL; | ||
| 960 | 967 | ||
| 961 | // The majority of RGB content is either sRGB or (rarely) some other | 968 | // The majority of RGB content is either sRGB or (rarely) some other |
| 962 | // color space which we don't even handle, like AdobeRGB or | 969 | // color space which we don't even handle, like AdobeRGB or |