summaryrefslogtreecommitdiff
path: root/src/xine-utils/xineutils.h
diff options
context:
space:
mode:
authorDarren Salt <linux@youmustbejoking.demon.co.uk>2012-02-15 00:47:40 +0000
committerDarren Salt <linux@youmustbejoking.demon.co.uk>2012-02-15 00:47:40 +0000
commit061c58a5d30290c29f25044cbe9bdcf00364f333 (patch)
treeb7776008ddd1c42dc910b2433f1a669e1808181a /src/xine-utils/xineutils.h
parent9622af14dfe4a43f45084b560624aa44e611d8f8 (diff)
downloadxine-lib-061c58a5d30290c29f25044cbe9bdcf00364f333.tar.gz
xine-lib-061c58a5d30290c29f25044cbe9bdcf00364f333.tar.bz2
Improved RGB→YUV conversion v2 (use MPEG range instead of full range)
Video-out plugins expect MPEG range Y'CbCr data (Y'=16..235, Cb,Cr=16..240). RGB sources (still images and audio visualisation effects) need to be converted first. This patch fixes up the range calculations and corrects an off-by-one in the range for Cb and Cr over commit 68fcd69fb3b6 (which was reverted due to API change). It should also provide a little more accuracy: I've gone back to the source (http://www.itu.int/rec/R-REC-BT.601/) for the conversion information. (We should use float or double here, but that would be an ABI change.)
Diffstat (limited to 'src/xine-utils/xineutils.h')
-rw-r--r--src/xine-utils/xineutils.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/xine-utils/xineutils.h b/src/xine-utils/xineutils.h
index 5b16e6e3c..cbf88aeaf 100644
--- a/src/xine-utils/xineutils.h
+++ b/src/xine-utils/xineutils.h
@@ -291,6 +291,9 @@ extern void (*yuy2_to_yv12)
#define SCALEFACTOR 65536
#define CENTERSAMPLE 128
+/* These conversions are normalised for the MPEG Y'CbCr colourspace.
+ * (Yes, we know that we call it YUV elsewhere.)
+ */
#define COMPUTE_Y(r, g, b) \
(unsigned char) \
((y_r_table[r] + y_g_table[g] + y_b_table[b]) / SCALEFACTOR)