diff options
author | Kostya Shishkov <kostya.shishkov@gmail.com> | 2009-06-02 12:28:49 +0000 |
---|---|---|
committer | Kostya Shishkov <kostya.shishkov@gmail.com> | 2009-06-02 12:28:49 +0000 |
commit | e8417235d0e0a70d8a932edb68ab90f360aefc1a (patch) | |
tree | 2cf020909b1a72fbd6183df3c14a52623d1da9fc /libswscale/swscale.c | |
parent | b2984add8077ecc9d3cdf0d9294fb323f2001511 (diff) | |
download | ffmpeg-e8417235d0e0a70d8a932edb68ab90f360aefc1a.tar.gz |
Partial (low bits ignored, no direct transcoding into other RGB formats) support
for inputting RGB48BE/LE.
Originally committed as revision 29341 to svn://svn.mplayerhq.hu/mplayer/trunk/libswscale
Diffstat (limited to 'libswscale/swscale.c')
-rw-r--r-- | libswscale/swscale.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/libswscale/swscale.c b/libswscale/swscale.c index b9adc83e55..921eb2db3a 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -108,6 +108,8 @@ unsigned swscale_version(void) || (x)==PIX_FMT_YUVA420P \ || (x)==PIX_FMT_YUYV422 \ || (x)==PIX_FMT_UYVY422 \ + || (x)==PIX_FMT_RGB48BE \ + || (x)==PIX_FMT_RGB48LE \ || (x)==PIX_FMT_RGB32 \ || (x)==PIX_FMT_RGB32_1 \ || (x)==PIX_FMT_BGR24 \ @@ -1122,6 +1124,48 @@ static void fillPlane(uint8_t* plane, int stride, int width, int height, int y, } } +static inline void rgb48ToY(uint8_t *dst, const uint8_t *src, int width) +{ + int i; + for (i = 0; i < width; i++) { + int r = src[i*6+0]; + int g = src[i*6+2]; + int b = src[i*6+4]; + + dst[i] = (RY*r + GY*g + BY*b + (33<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT; + } +} + +static inline void rgb48ToUV(uint8_t *dstU, uint8_t *dstV, + uint8_t *src1, uint8_t *src2, int width) +{ + int i; + assert(src1==src2); + for (i = 0; i < width; i++) { + int r = src1[6*i + 0]; + int g = src1[6*i + 2]; + int b = src1[6*i + 4]; + + dstU[i] = (RU*r + GU*g + BU*b + (257<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT; + dstV[i] = (RV*r + GV*g + BV*b + (257<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT; + } +} + +static inline void rgb48ToUV_half(uint8_t *dstU, uint8_t *dstV, + uint8_t *src1, uint8_t *src2, int width) +{ + int i; + assert(src1==src2); + for (i = 0; i < width; i++) { + int r= src1[12*i + 0] + src1[12*i + 6]; + int g= src1[12*i + 2] + src1[12*i + 8]; + int b= src1[12*i + 4] + src1[12*i + 10]; + + dstU[i]= (RU*r + GU*g + BU*b + (257<<RGB2YUV_SHIFT)) >> (RGB2YUV_SHIFT+1); + dstV[i]= (RV*r + GV*g + BV*b + (257<<RGB2YUV_SHIFT)) >> (RGB2YUV_SHIFT+1); + } +} + #define BGR2Y(type, name, shr, shg, shb, maskr, maskg, maskb, RY, GY, BY, S)\ static inline void name(uint8_t *dst, const uint8_t *src, long width, uint32_t *unused)\ {\ |