[vlc-commits] vout-macosx: use color primaries provided by decoder or demuxer
Felix Paul Kühne
git at videolan.org
Sat Apr 16 17:23:12 CEST 2016
vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Sat Apr 16 18:23:02 2016 +0300| [f880a0c90cdc0027f0962858772d8d4f79fc8805] | committer: Felix Paul Kühne
vout-macosx: use color primaries provided by decoder or demuxer
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f880a0c90cdc0027f0962858772d8d4f79fc8805
---
modules/video_output/macosx.m | 48 +++++++++++++++++++++++++++++++----------
1 file changed, 37 insertions(+), 11 deletions(-)
diff --git a/modules/video_output/macosx.m b/modules/video_output/macosx.m
index 6ba8ebb..51e0c39 100644
--- a/modules/video_output/macosx.m
+++ b/modules/video_output/macosx.m
@@ -167,17 +167,43 @@ static int Open (vlc_object_t *this)
/* support for BT.709 and BT.2020 color spaces was introduced with OS X 10.11
* on older OS versions, we can't show correct colors, so we fallback on linear RGB */
if (OSX_EL_CAPITAN) {
- msg_Warn(vd, "Guessing color space based on video dimensions (height: %i", vd->fmt.i_height);
-
- if (vd->fmt.i_height >= 2000 || vd->fmt.i_width >= 3800) {
- msg_Dbg(vd, "Should use BT.2020 color space, but in reality it's BT.709");
- sys->cgColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceITUR_709);
- } else if (vd->fmt.i_height > 576) {
- msg_Dbg(vd, "Using BT.709 color space");
- sys->cgColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceITUR_709);
- } else {
- msg_Dbg(vd, "SD content, using linear RGB color space");
- sys->cgColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);
+ switch (vd->fmt.primaries) {
+ case COLOR_PRIMARIES_BT601_525:
+ case COLOR_PRIMARIES_BT601_625:
+ {
+ sys->cgColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);
+ break;
+ }
+ case COLOR_PRIMARIES_BT709:
+ {
+ sys->cgColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceITUR_709);
+ break;
+ }
+ case COLOR_PRIMARIES_BT2020:
+ {
+ sys->cgColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceITUR_709);
+ break;
+ }
+ case COLOR_PRIMARIES_DCI_P3:
+ {
+ sys->cgColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceDCIP3);
+ break;
+ }
+ default:
+ {
+ msg_Dbg(vd, "Guessing color space based on video dimensions (%ix%i)", vd->fmt.i_visible_width, vd->fmt.i_visible_height);
+ if (vd->fmt.i_visible_height >= 2000 || vd->fmt.i_visible_width >= 3800) {
+ msg_Dbg(vd, "Using BT.2020 color space");
+ sys->cgColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceITUR_2020);
+ } else if (vd->fmt.i_height > 576) {
+ msg_Dbg(vd, "Using BT.709 color space");
+ sys->cgColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceITUR_709);
+ } else {
+ msg_Dbg(vd, "SD content, using linear RGB color space");
+ sys->cgColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);
+ }
+ break;
+ }
}
} else {
msg_Dbg(vd, "OS does not support BT.709 or BT.2020 color spaces, output may vary");
More information about the vlc-commits
mailing list