summaryrefslogtreecommitdiffstats
path: root/macosx/HBImageUtilities.m
diff options
context:
space:
mode:
Diffstat (limited to 'macosx/HBImageUtilities.m')
-rw-r--r--macosx/HBImageUtilities.m59
1 files changed, 6 insertions, 53 deletions
diff --git a/macosx/HBImageUtilities.m b/macosx/HBImageUtilities.m
index f0c296a78..0d3d580c4 100644
--- a/macosx/HBImageUtilities.m
+++ b/macosx/HBImageUtilities.m
@@ -111,59 +111,8 @@ CGImageRef CGImageRotated(CGImageRef imgRef, CGFloat angle, BOOL flipped) CF_RET
return rotatedImage;
}
-static CGColorSpaceRef copyColorSpaceOld(int colorPrimaries)
-{
- const CGFloat whitePoint[] = {0.95047, 1.0, 1.08883};
- const CGFloat blackPoint[] = {0, 0, 0};
-
- // See https://developer.apple.com/library/content/technotes/tn2257/_index.html
- const CGFloat gamma[] = {1.961, 1.961, 1.961};
-
- // RGB/XYZ Matrices (D65 white point)
- switch (colorPrimaries) {
- case HB_COLR_PRI_EBUTECH:
- {
- // Rec. 601, 625 line
- const CGFloat matrix[] = {0.4305538, 0.2220043, 0.0201822,
- 0.3415498, 0.7066548, 0.1295534,
- 0.1783523, 0.0713409, 0.9393222};
- return CGColorSpaceCreateCalibratedRGB(whitePoint, blackPoint, gamma, matrix);
- }
- case HB_COLR_PRI_SMPTEC:
- {
- // Rec. 601, 525 line
- const CGFloat matrix[] = {0.3935209, 0.2123764, 0.0187391,
- 0.3652581, 0.7010599, 0.1119339,
- 0.1916769, 0.0865638, 0.9583847};
- return CGColorSpaceCreateCalibratedRGB(whitePoint, blackPoint, gamma, matrix);
- }
- case HB_COLR_PRI_BT2020:
- {
- // Rec. 2020
- const CGFloat matrix[] = {0.6369580, 0.2627002, 0.0000000,
- 0.1446169, 0.6779981, 0.0280727,
- 0.1688810, 0.0593017, 1.0609851};
- return CGColorSpaceCreateCalibratedRGB(whitePoint, blackPoint, gamma, matrix);
- }
- case HB_COLR_PRI_BT709:
- default:
- {
- // Rec. 709
- const CGFloat matrix[] = {0.4124564, 0.2126729, 0.0193339,
- 0.3575761, 0.7151522, 0.1191920,
- 0.1804375, 0.0721750, 0.9503041};
- return CGColorSpaceCreateCalibratedRGB(whitePoint, blackPoint, gamma, matrix);
- }
- }
-}
-
CGColorSpaceRef copyColorSpace(int primaries, int transfer, int matrix)
{
- if (NSAppKitVersionNumber < NSAppKitVersionNumber10_11)
- {
- return copyColorSpaceOld(primaries);
- }
-
CFStringRef primariesKey = NULL;
switch (primaries)
{
@@ -197,12 +146,16 @@ CGColorSpaceRef copyColorSpace(int primaries, int transfer, int matrix)
break;
case HB_COLR_TRA_SMPTEST2084:
- transferKey = CFSTR("SMPTE_ST_2084_PQ"); //kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ;
+ if (@available(macOS 10.13, *)) {
+ transferKey = kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ;
break;
+ }
case HB_COLR_TRA_ARIB_STD_B67:
- transferKey = CFSTR("ITU_R_2100_HLG"); //kCVImageBufferTransferFunction_ITU_R_2100_HLG;
+ if (@available(macOS 10.13, *)) {
+ transferKey = kCVImageBufferTransferFunction_ITU_R_2100_HLG;
break;
+ }
case HB_COLR_TRA_BT709:
default: