changeset 30471:ef00ce26e9b5

Add function to translate SWS_CS_* to coefficient array
author conrad
date Fri, 05 Feb 2010 16:09:03 +0000
parents 9ccf3bea4cf1
children ddce1a6f3c59
files libswscale/swscale.h libswscale/yuv2rgb.c
diffstat 2 files changed, 14 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libswscale/swscale.h	Fri Feb 05 11:00:59 2010 +0000
+++ b/libswscale/swscale.h	Fri Feb 05 16:09:03 2010 +0000
@@ -30,7 +30,7 @@
 #include "libavutil/avutil.h"
 
 #define LIBSWSCALE_VERSION_MAJOR 0
-#define LIBSWSCALE_VERSION_MINOR 9
+#define LIBSWSCALE_VERSION_MINOR 10
 #define LIBSWSCALE_VERSION_MICRO 0
 
 #define LIBSWSCALE_VERSION_INT  AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \
@@ -103,6 +103,12 @@
 #define SWS_CS_SMPTE240M      7
 #define SWS_CS_DEFAULT        5
 
+/**
+ * Returns a pointer to yuv<->rgb coefficients for the given colorspace
+ * suitable for sws_setColorspaceDetails()
+ * @colorspace one of SWS_CS_*  If invalid, SWS_CS_DEFAULT is used.
+ */
+const int * sws_getCoefficients(int colorspace);
 
 
 // when used for filters they must have an odd number of elements
--- a/libswscale/yuv2rgb.c	Fri Feb 05 11:00:59 2010 +0000
+++ b/libswscale/yuv2rgb.c	Fri Feb 05 16:09:03 2010 +0000
@@ -49,6 +49,13 @@
     {117579, 136230, 16907, 35559}  /* SMPTE 240M (1987) */
 };
 
+const int * sws_getCoefficients(int colorspace)
+{
+    if (colorspace > 7 || colorspace < 0)
+        colorspace = SWS_CS_DEFAULT;
+    return ff_yuv2rgb_coeffs[colorspace];
+}
+
 #define LOADCHROMA(i)                               \
     U = pu[i];                                      \
     V = pv[i];                                      \