diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2008-09-12 16:46:38 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2008-09-12 16:46:38 +0000 |
commit | 3d05e078ee40074a205118f9e48033cfaf390fe7 (patch) | |
tree | 2c5364331d1e52cfe092d6871f4c7daa869a979e /libswscale/swscale_template.c | |
parent | ec1bca2a0f66b12c8a4a527b99447209188eb313 (diff) | |
download | ffmpeg-3d05e078ee40074a205118f9e48033cfaf390fe7.tar.gz |
Support mono as input format.
Originally committed as revision 27587 to svn://svn.mplayerhq.hu/mplayer/trunk/libswscale
Diffstat (limited to 'libswscale/swscale_template.c')
-rw-r--r-- | libswscale/swscale_template.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/libswscale/swscale_template.c b/libswscale/swscale_template.c index 9b3a4dccfa..3ff9c2bbe2 100644 --- a/libswscale/swscale_template.c +++ b/libswscale/swscale_template.c @@ -2143,6 +2143,16 @@ static inline void RENAME(palToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, } } +static inline void RENAME(mono2Y)(uint8_t *dst, uint8_t *src, long width, int format) +{ + int i, j; + for (i=0; i<width/8; i++){ + int d= format == PIX_FMT_MONOBLACK ? src[i] : ~src[i]; + for(j=7; j>=0; j--) + dst[i]= ((d>>j)&1)*255; + } +} + // bilinear / bicubic scaling static inline void RENAME(hScale)(int16_t *dst, int dstW, uint8_t *src, int srcW, int xInc, int16_t *filter, int16_t *filterPos, long filterSize) @@ -2398,6 +2408,11 @@ static inline void RENAME(hyscale)(SwsContext *c, uint16_t *dst, long dstWidth, RENAME(palToY)(formatConvBuffer, src, srcW, (uint32_t*)pal); src= formatConvBuffer; } + else if (srcFormat==PIX_FMT_MONOBLACK ||srcFormat==PIX_FMT_MONOWHITE) + { + RENAME(mono2Y)(formatConvBuffer, src, srcW, srcFormat); + src= formatConvBuffer; + } #ifdef HAVE_MMX // Use the new MMX scaler if the MMX2 one can't be used (it is faster than the x86 ASM one). @@ -2660,7 +2675,7 @@ inline static void RENAME(hcscale)(SwsContext *c, uint16_t *dst, long dstWidth, src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } - else if (isGray(srcFormat)) + else if (isGray(srcFormat) || srcFormat==PIX_FMT_MONOBLACK || PIX_FMT_MONOWHITE) { return; } |