Commit 05858452 authored by michael's avatar michael

Support mono as input format.


git-svn-id: file:///var/local/repositories/mplayer/trunk/libswscale@27587 b3059339-0415-0410-9bf9-f77b7e298cf2
parent 28dae7e6
...@@ -127,6 +127,8 @@ unsigned swscale_version(void) ...@@ -127,6 +127,8 @@ unsigned swscale_version(void)
|| (x)==PIX_FMT_BGR4_BYTE \ || (x)==PIX_FMT_BGR4_BYTE \
|| (x)==PIX_FMT_RGB4_BYTE \ || (x)==PIX_FMT_RGB4_BYTE \
|| (x)==PIX_FMT_YUV440P \ || (x)==PIX_FMT_YUV440P \
|| (x)==PIX_FMT_MONOWHITE \
|| (x)==PIX_FMT_MONOBLACK \
) )
#define isSupportedOut(x) ( \ #define isSupportedOut(x) ( \
(x)==PIX_FMT_YUV420P \ (x)==PIX_FMT_YUV420P \
......
...@@ -2143,6 +2143,16 @@ static inline void RENAME(palToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, ...@@ -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 // bilinear / bicubic scaling
static inline void RENAME(hScale)(int16_t *dst, int dstW, uint8_t *src, int srcW, int xInc, 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) int16_t *filter, int16_t *filterPos, long filterSize)
...@@ -2398,6 +2408,11 @@ static inline void RENAME(hyscale)(SwsContext *c, uint16_t *dst, long dstWidth, ...@@ -2398,6 +2408,11 @@ static inline void RENAME(hyscale)(SwsContext *c, uint16_t *dst, long dstWidth,
RENAME(palToY)(formatConvBuffer, src, srcW, (uint32_t*)pal); RENAME(palToY)(formatConvBuffer, src, srcW, (uint32_t*)pal);
src= formatConvBuffer; src= formatConvBuffer;
} }
else if (srcFormat==PIX_FMT_MONOBLACK ||srcFormat==PIX_FMT_MONOWHITE)
{
RENAME(mono2Y)(formatConvBuffer, src, srcW, srcFormat);
src= formatConvBuffer;
}
#ifdef HAVE_MMX #ifdef HAVE_MMX
// Use the new MMX scaler if the MMX2 one can't be used (it is faster than the x86 ASM one). // 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, ...@@ -2660,7 +2675,7 @@ inline static void RENAME(hcscale)(SwsContext *c, uint16_t *dst, long dstWidth,
src1= formatConvBuffer; src1= formatConvBuffer;
src2= formatConvBuffer+VOFW; src2= formatConvBuffer+VOFW;
} }
else if (isGray(srcFormat)) else if (isGray(srcFormat) || srcFormat==PIX_FMT_MONOBLACK || PIX_FMT_MONOWHITE)
{ {
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment