[vlc-commits] caopengllayer: don't handle color primaries

Victorien Le Couviour--Tuffet git at videolan.org
Thu Jul 27 19:14:06 CEST 2017


vlc | branch: master | Victorien Le Couviour--Tuffet <victorien.lecouviour.tuffet at gmail.com> | Thu Jul 27 12:06:32 2017 +0200| [74ea8d15863478196e5676545a84a9933fba339e] | committer: Jean-Baptiste Kempf

caopengllayer: don't handle color primaries

The GL shader already does this job.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=74ea8d15863478196e5676545a84a9933fba339e
---

 modules/video_output/caopengllayer.m | 70 ------------------------------------
 1 file changed, 70 deletions(-)

diff --git a/modules/video_output/caopengllayer.m b/modules/video_output/caopengllayer.m
index 067831e618..a9777c6af9 100644
--- a/modules/video_output/caopengllayer.m
+++ b/modules/video_output/caopengllayer.m
@@ -43,15 +43,8 @@
 
 #include "opengl/vout_helper.h"
 
-#define OSX_EL_CAPITAN_AND_HIGHER (NSAppKitVersionNumber >= 1404)
 #define OSX_SIERRA_AND_HIGHER (NSAppKitVersionNumber >= 1485)
 
-#if MAC_OS_X_VERSION_MIN_ALLOWED <= MAC_OS_X_VERSION_10_11
-const CFStringRef kCGColorSpaceDCIP3 = CFSTR("kCGColorSpaceDCIP3");
-const CFStringRef kCGColorSpaceITUR_709 = CFSTR("kCGColorSpaceITUR_709");
-const CFStringRef kCGColorSpaceITUR_2020 = CFSTR("kCGColorSpaceITUR_2020");
-#endif
-
 /*****************************************************************************
  * Vout interface
  *****************************************************************************/
@@ -99,8 +92,6 @@ struct vout_display_sys_t {
     vout_window_t *embed;
     VLCCAOpenGLLayer *cgLayer;
 
-    CGColorSpaceRef cgColorSpace;
-
     vlc_gl_t *gl;
     vout_display_opengl_t *vgl;
 
@@ -215,64 +206,6 @@ static int Open (vlc_object_t *p_this)
         vd->display = PictureDisplay;
         vd->control = Control;
 
-        /* handle color space if supported by the OS */
-        if ([sys->cgLayer respondsToSelector:@selector(setColorspace:)]) {
-
-            /* 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_AND_HIGHER) {
-                switch (fmt.primaries) {
-                    case COLOR_PRIMARIES_BT601_525:
-                    case COLOR_PRIMARIES_BT601_625:
-                    {
-                        msg_Dbg(vd, "Using BT.601 color space");
-                        sys->cgColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);
-                        break;
-                    }
-                    case COLOR_PRIMARIES_BT709:
-                    {
-                        msg_Dbg(vd, "Using BT.709 color space");
-                        sys->cgColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceITUR_709);
-                        break;
-                    }
-                    case COLOR_PRIMARIES_BT2020:
-                    {
-                        msg_Dbg(vd, "Using BT.2020 color space");
-                        sys->cgColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceITUR_2020);
-                        break;
-                    }
-                    case COLOR_PRIMARIES_DCI_P3:
-                    {
-                        msg_Dbg(vd, "Using DCI P3 color space");
-                        sys->cgColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceDCIP3);
-                        break;
-                    }
-                    default:
-                    {
-                        msg_Dbg(vd, "Guessing color space based on video dimensions (%ix%i)", fmt.i_visible_width, fmt.i_visible_height);
-                        if (fmt.i_visible_height >= 2000 || fmt.i_visible_width >= 3800) {
-                            msg_Dbg(vd, "Using BT.2020 color space");
-                            sys->cgColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceITUR_2020);
-                        } else if (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");
-                sys->cgColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGBLinear);
-            }
-
-            [sys->cgLayer setColorspace: sys->cgColorSpace];
-        } else {
-            msg_Dbg(vd, "OS does not support custom color spaces, output may be undefined");
-        }
-
         if (OSX_SIERRA_AND_HIGHER) {
             /* request our screen's HDR mode (introduced in OS X 10.11, but correctly supported in 10.12 only) */
             if ([sys->cgLayer respondsToSelector:@selector(setWantsExtendedDynamicRangeContent:)]) {
@@ -333,9 +266,6 @@ static void Close (vlc_object_t *p_this)
     if ([sys->cgLayer glContext])
         CGLReleaseContext([sys->cgLayer glContext]);
 
-    if (sys->cgColorSpace != nil)
-        CGColorSpaceRelease(sys->cgColorSpace);
-
     free(sys);
 }
 



More information about the vlc-commits mailing list