aboutsummaryrefslogtreecommitdiffhomepage
path: root/third_party/skcms/skcms.h
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/skcms/skcms.h')
-rw-r--r--third_party/skcms/skcms.h20
1 files changed, 14 insertions, 6 deletions
diff --git a/third_party/skcms/skcms.h b/third_party/skcms/skcms.h
index 08779a40e6..9c25b1d538 100644
--- a/third_party/skcms/skcms.h
+++ b/third_party/skcms/skcms.h
@@ -73,6 +73,12 @@ typedef struct skcms_A2B {
skcms_Curve output_curves[3];
} skcms_A2B;
+// A specialized approximation for transfer functions with gamma between 1 and 3.
+// f(x) = sign(x) * (A|x|^3 + B|x|^2 + (1-A-B)|x|)
+typedef struct skcms_TF13 {
+ float A,B;
+} skcms_TF13;
+
typedef struct skcms_ICCProfile {
const uint8_t* buffer;
@@ -97,6 +103,10 @@ typedef struct skcms_ICCProfile {
// and has_A2B to true.
bool has_A2B;
skcms_A2B A2B;
+
+ // If has_trc, we may be able to approximate the curves more efficiently.
+ bool has_tf13[3];
+ skcms_TF13 tf13[3];
} skcms_ICCProfile;
// The sRGB color profile is so commonly used that we offer a canonical skcms_ICCProfile for it.
@@ -114,15 +124,13 @@ bool skcms_ApproximatelyEqualProfiles(const skcms_ICCProfile* A, const skcms_ICC
// will be used.
bool skcms_Parse(const void*, size_t, skcms_ICCProfile*);
+// skcms_Parse() creates a profile that directs skcms_Transform() to favor accuracy.
+// If you want to trade a little accuracy for a big speedup, call skcms_OptimizeForSpeed().
+void skcms_OptimizeForSpeed(skcms_ICCProfile*);
+
bool skcms_ApproximateCurve(const skcms_Curve* curve, skcms_TransferFunction* approx,
float* max_error);
-// A specialized approximation for transfer functions with gamma between 1 and 3.
-// f(x) = Ax^3 + Bx^2 + (1-A-B)x
-typedef struct skcms_TF13 {
- float A,B;
-} skcms_TF13;
-
bool skcms_ApproximateCurve13(const skcms_Curve* curve, skcms_TF13* approx, float* max_error);
// What is the best single transfer function to use for the given profile? Note that there is