diff options
author | David Conrad <lessen42@gmail.com> | 2010-02-05 16:09:03 +0000 |
---|---|---|
committer | David Conrad <lessen42@gmail.com> | 2010-02-05 16:09:03 +0000 |
commit | 3f3dc76cb1fbf9b14536b993a6f435e8ab806585 (patch) | |
tree | 8e0512f224d5032bfa1a7b1b823da9cf4f89a3dd | |
parent | bf8ae197b618be06e0fb74d17fbf5010c0be63d8 (diff) | |
download | ffmpeg-streaming-3f3dc76cb1fbf9b14536b993a6f435e8ab806585.zip ffmpeg-streaming-3f3dc76cb1fbf9b14536b993a6f435e8ab806585.tar.gz |
Add function to translate SWS_CS_* to coefficient array
Originally committed as revision 30513 to svn://svn.mplayerhq.hu/mplayer/trunk/libswscale
-rw-r--r-- | libswscale/swscale.h | 8 | ||||
-rw-r--r-- | libswscale/yuv2rgb.c | 7 |
2 files changed, 14 insertions, 1 deletions
diff --git a/libswscale/swscale.h b/libswscale/swscale.h index 9e14262..ba198aa 100644 --- a/libswscale/swscale.h +++ b/libswscale/swscale.h @@ -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 @@ const char *swscale_license(void); #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 diff --git a/libswscale/yuv2rgb.c b/libswscale/yuv2rgb.c index 3c7bb3f..a019bf7 100644 --- a/libswscale/yuv2rgb.c +++ b/libswscale/yuv2rgb.c @@ -49,6 +49,13 @@ const int32_t ff_yuv2rgb_coeffs[8][4] = { {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]; \ |