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 | 488 | static enum pl_color_system mp_image_params_get_forced_csp(struct mp_image_params *params) |
| 489 | 489 | { |
| 490 | 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 | 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 | 960 | if (params->color.transfer == PL_COLOR_TRC_UNKNOWN) |
| 956 | 961 | params->color.transfer = PL_COLOR_TRC_BT_1886; |
| 957 | 962 | } else if (forced_csp == PL_COLOR_SYSTEM_RGB) { |
| 958 | − params->repr.sys = PL_COLOR_SYSTEM_RGB; | |
| 959 | − params->repr.levels = PL_COLOR_LEVELS_FULL; | |
| 963 | + if (params->repr.sys == PL_COLOR_SYSTEM_UNKNOWN) | |
| 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 | 968 | // The majority of RGB content is either sRGB or (rarely) some other |
| 962 | 969 | // color space which we don't even handle, like AdobeRGB or |