History

video/mp_image: fix vf=format colorspace override for XYZ

If format is RGB but flagged as XYZ it should be used instead.

Kacper Michajłow committed 1 year ago

Commit 4e5cc9c1 parent 638ada11 file · +10 −3Browse files

Unified · Split

video/mp_image.c+10−3
@@ -488,7 +488,12 @@ void mp_image_copy(struct mp_image *dst, struct mp_image *src) · 487 unmodified lines
488488 static enum pl_color_system mp_image_params_get_forced_csp(struct mp_image_params *params)
489489 {
490490 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;
492497 }
493498
494499 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
955960 if (params->color.transfer == PL_COLOR_TRC_UNKNOWN)
956961 params->color.transfer = PL_COLOR_TRC_BT_1886;
957962 } 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;
960967
961968 // The majority of RGB content is either sRGB or (rarely) some other
962969 // color space which we don't even handle, like AdobeRGB or

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t