aboutsummaryrefslogtreecommitdiffstats
path: root/src/util
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2017-01-13 05:03:19 +0100
committerMattias Andrée <maandree@kth.se>2017-01-13 05:03:31 +0100
commit2640635b7d0f049ae15872ab9e7b5ef254233ccc (patch)
tree14dceb4727e3d46c3e0b3c747ff0134b24654fff /src/util
parentAdd vu-from-video (diff)
downloadblind-2640635b7d0f049ae15872ab9e7b5ef254233ccc.tar.gz
blind-2640635b7d0f049ae15872ab9e7b5ef254233ccc.tar.bz2
blind-2640635b7d0f049ae15872ab9e7b5ef254233ccc.tar.xz
vu-from-video: add -d
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'src/util')
-rw-r--r--src/util/colour.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/util/colour.h b/src/util/colour.h
index 854705a..84c543c 100644
--- a/src/util/colour.h
+++ b/src/util/colour.h
@@ -71,3 +71,35 @@ srgb_to_ciexyz(double r, double g, double b, double *x, double *y, double *z)
*z = MULTIPLY(0.019333942761673460208893260415, 0.119191955081838593666354597644, 0.950302838552371742508739771438);
#undef MULTIPLY
}
+
+static inline void
+scaled_yuv_to_ciexyz(double y, double u, double v, double *xp, double *yp, double *zp)
+{
+#define MULTIPLY(CY, CU, CV) ((CY) * y + (CU) * u + (CV) * v)
+ *xp = MULTIPLY( 0.00001450325106667098632156481796684488472237717360,
+ 0.00000345586790639342739093228633329157872822179343,
+ 0.00000400923398630552893485111398685916128670214675);
+ *yp = MULTIPLY( 0.00001525902189669641837040624243737596543724066578,
+ -0.00000207722814409390653614547427030512238843584782,
+ -0.00000263898607692305410302407824019166326934282552);
+ *zp = MULTIPLY( 0.00001661446153041708825425643025752719950105529279,
+ 0.00002885925752619118069149627137104374696718878113,
+ -0.00000071781086875769179526501342566979779746816348);
+#undef MULTIPLY
+}
+
+static inline void
+ciexyz_to_scaled_yuv(double x, double y, double z, double *yp, double *up, double *vp)
+{
+#define MULTIPLY(CX, CY, CZ) ((CX) * x + (CY) * y + (CZ) * z)
+ *yp = MULTIPLY( 26625.38231027395886485464870929718017578125,
+ 40524.0090949436053051613271236419677734375,
+ -271.5313105642117079696618020534515380859375);
+ *up = MULTIPLY( -11278.3751445417292416095733642578125,
+ -26409.91773157499847002327442169189453125,
+ 34100.5706543184860493056476116180419921875);
+ *vp = MULTIPLY( 162829.60100012840121053159236907958984375,
+ -123829.313212639070115983486175537109375,
+ -28411.65702312920984695665538311004638671875);
+#undef MULTIPLY
+}