Commit 28dae7e6 authored by michael's avatar michael

Add support for PIX_FMT_MONOWHITE as output format.


git-svn-id: file:///var/local/repositories/mplayer/trunk/libswscale@27586 b3059339-0415-0410-9bf9-f77b7e298cf2
parent fd5d2f1b
...@@ -598,7 +598,7 @@ static inline void yuv2nv12XinC(int16_t *lumFilter, int16_t **lumSrc, int lumFil ...@@ -598,7 +598,7 @@ static inline void yuv2nv12XinC(int16_t *lumFilter, int16_t **lumSrc, int lumFil
g = (type *)(c->table_gU[U] + c->table_gV[V]);\ g = (type *)(c->table_gU[U] + c->table_gV[V]);\
b = (type *)c->table_bU[U];\ b = (type *)c->table_bU[U];\
#define YSCALE_YUV_2_MONOBLACK2_C \ #define YSCALE_YUV_2_MONO2_C \
const uint8_t * const d128=dither_8x8_220[y&7];\ const uint8_t * const d128=dither_8x8_220[y&7];\
uint8_t *g= c->table_gU[128] + c->table_gV[128];\ uint8_t *g= c->table_gU[128] + c->table_gV[128];\
for (i=0; i<dstW-7; i+=8){\ for (i=0; i<dstW-7; i+=8){\
...@@ -611,12 +611,12 @@ static inline void yuv2nv12XinC(int16_t *lumFilter, int16_t **lumSrc, int lumFil ...@@ -611,12 +611,12 @@ static inline void yuv2nv12XinC(int16_t *lumFilter, int16_t **lumSrc, int lumFil
acc+= acc + g[((buf0[i+5]*yalpha1+buf1[i+5]*yalpha)>>19) + d128[5]];\ acc+= acc + g[((buf0[i+5]*yalpha1+buf1[i+5]*yalpha)>>19) + d128[5]];\
acc+= acc + g[((buf0[i+6]*yalpha1+buf1[i+6]*yalpha)>>19) + d128[6]];\ acc+= acc + g[((buf0[i+6]*yalpha1+buf1[i+6]*yalpha)>>19) + d128[6]];\
acc+= acc + g[((buf0[i+7]*yalpha1+buf1[i+7]*yalpha)>>19) + d128[7]];\ acc+= acc + g[((buf0[i+7]*yalpha1+buf1[i+7]*yalpha)>>19) + d128[7]];\
((uint8_t*)dest)[0]= acc;\ ((uint8_t*)dest)[0]= c->dstFormat == PIX_FMT_MONOBLACK ? acc : ~acc;\
dest++;\ dest++;\
}\ }\
#define YSCALE_YUV_2_MONOBLACKX_C \ #define YSCALE_YUV_2_MONOX_C \
const uint8_t * const d128=dither_8x8_220[y&7];\ const uint8_t * const d128=dither_8x8_220[y&7];\
uint8_t *g= c->table_gU[128] + c->table_gV[128];\ uint8_t *g= c->table_gU[128] + c->table_gV[128];\
int acc=0;\ int acc=0;\
...@@ -642,7 +642,7 @@ static inline void yuv2nv12XinC(int16_t *lumFilter, int16_t **lumSrc, int lumFil ...@@ -642,7 +642,7 @@ static inline void yuv2nv12XinC(int16_t *lumFilter, int16_t **lumSrc, int lumFil
acc+= acc + g[Y1+d128[(i+0)&7]];\ acc+= acc + g[Y1+d128[(i+0)&7]];\
acc+= acc + g[Y2+d128[(i+1)&7]];\ acc+= acc + g[Y2+d128[(i+1)&7]];\
if ((i&7)==6){\ if ((i&7)==6){\
((uint8_t*)dest)[0]= acc;\ ((uint8_t*)dest)[0]= c->dstFormat == PIX_FMT_MONOBLACK ? acc : ~acc;\
dest++;\ dest++;\
}\ }\
} }
...@@ -746,6 +746,7 @@ static inline void yuv2nv12XinC(int16_t *lumFilter, int16_t **lumSrc, int lumFil ...@@ -746,6 +746,7 @@ static inline void yuv2nv12XinC(int16_t *lumFilter, int16_t **lumSrc, int lumFil
}\ }\
break;\ break;\
case PIX_FMT_MONOBLACK:\ case PIX_FMT_MONOBLACK:\
case PIX_FMT_MONOWHITE:\
{\ {\
func_monoblack\ func_monoblack\
}\ }\
...@@ -790,7 +791,7 @@ static inline void yuv2packedXinC(SwsContext *c, int16_t *lumFilter, int16_t **l ...@@ -790,7 +791,7 @@ static inline void yuv2packedXinC(SwsContext *c, int16_t *lumFilter, int16_t **l
uint8_t *dest, int dstW, int y) uint8_t *dest, int dstW, int y)
{ {
int i; int i;
YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGBX_C, YSCALE_YUV_2_PACKEDX_C(void), YSCALE_YUV_2_GRAY16_C, YSCALE_YUV_2_MONOBLACKX_C) YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGBX_C, YSCALE_YUV_2_PACKEDX_C(void), YSCALE_YUV_2_GRAY16_C, YSCALE_YUV_2_MONOX_C)
} }
static inline void yuv2rgbXinC_full(SwsContext *c, int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize, static inline void yuv2rgbXinC_full(SwsContext *c, int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize,
...@@ -2186,6 +2187,7 @@ SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, int dstW, int dstH ...@@ -2186,6 +2187,7 @@ SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, int dstW, int dstH
&& srcFormat != PIX_FMT_BGR4_BYTE && dstFormat != PIX_FMT_BGR4_BYTE && srcFormat != PIX_FMT_BGR4_BYTE && dstFormat != PIX_FMT_BGR4_BYTE
&& srcFormat != PIX_FMT_RGB4_BYTE && dstFormat != PIX_FMT_RGB4_BYTE && srcFormat != PIX_FMT_RGB4_BYTE && dstFormat != PIX_FMT_RGB4_BYTE
&& srcFormat != PIX_FMT_MONOBLACK && dstFormat != PIX_FMT_MONOBLACK && srcFormat != PIX_FMT_MONOBLACK && dstFormat != PIX_FMT_MONOBLACK
&& srcFormat != PIX_FMT_MONOWHITE && dstFormat != PIX_FMT_MONOWHITE
&& dstFormat != PIX_FMT_RGB32_1 && dstFormat != PIX_FMT_RGB32_1
&& dstFormat != PIX_FMT_BGR32_1 && dstFormat != PIX_FMT_BGR32_1
&& (!needsDither || (c->flags&(SWS_FAST_BILINEAR|SWS_POINT)))) && (!needsDither || (c->flags&(SWS_FAST_BILINEAR|SWS_POINT))))
......
...@@ -249,6 +249,7 @@ const char *sws_format_name(int format); ...@@ -249,6 +249,7 @@ const char *sws_format_name(int format);
|| (x)==PIX_FMT_RGB4 \ || (x)==PIX_FMT_RGB4 \
|| (x)==PIX_FMT_RGB4_BYTE \ || (x)==PIX_FMT_RGB4_BYTE \
|| (x)==PIX_FMT_MONOBLACK \ || (x)==PIX_FMT_MONOBLACK \
|| (x)==PIX_FMT_MONOWHITE \
) )
#define isBGR(x) ( \ #define isBGR(x) ( \
(x)==PIX_FMT_BGR32 \ (x)==PIX_FMT_BGR32 \
...@@ -260,6 +261,7 @@ const char *sws_format_name(int format); ...@@ -260,6 +261,7 @@ const char *sws_format_name(int format);
|| (x)==PIX_FMT_BGR4 \ || (x)==PIX_FMT_BGR4 \
|| (x)==PIX_FMT_BGR4_BYTE \ || (x)==PIX_FMT_BGR4_BYTE \
|| (x)==PIX_FMT_MONOBLACK \ || (x)==PIX_FMT_MONOBLACK \
|| (x)==PIX_FMT_MONOWHITE \
) )
static inline int fmt_depth(int fmt) static inline int fmt_depth(int fmt)
...@@ -290,6 +292,7 @@ static inline int fmt_depth(int fmt) ...@@ -290,6 +292,7 @@ static inline int fmt_depth(int fmt)
case PIX_FMT_RGB4_BYTE: case PIX_FMT_RGB4_BYTE:
return 4; return 4;
case PIX_FMT_MONOBLACK: case PIX_FMT_MONOBLACK:
case PIX_FMT_MONOWHITE:
return 1; return 1;
default: default:
return 0; return 0;
......
...@@ -1511,7 +1511,7 @@ FULL_YSCALEYUV2RGB ...@@ -1511,7 +1511,7 @@ FULL_YSCALEYUV2RGB
default: break; default: break;
} }
#endif //HAVE_MMX #endif //HAVE_MMX
YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGB2_C, YSCALE_YUV_2_PACKED2_C, YSCALE_YUV_2_GRAY16_2_C, YSCALE_YUV_2_MONOBLACK2_C) YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGB2_C, YSCALE_YUV_2_PACKED2_C, YSCALE_YUV_2_GRAY16_2_C, YSCALE_YUV_2_MONO2_C)
} }
/** /**
...@@ -1714,9 +1714,9 @@ static inline void RENAME(yuv2packed1)(SwsContext *c, uint16_t *buf0, uint16_t * ...@@ -1714,9 +1714,9 @@ static inline void RENAME(yuv2packed1)(SwsContext *c, uint16_t *buf0, uint16_t *
#endif /* HAVE_MMX */ #endif /* HAVE_MMX */
if (uvalpha < 2048) if (uvalpha < 2048)
{ {
YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGB1_C, YSCALE_YUV_2_PACKED1_C, YSCALE_YUV_2_GRAY16_1_C, YSCALE_YUV_2_MONOBLACK2_C) YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGB1_C, YSCALE_YUV_2_PACKED1_C, YSCALE_YUV_2_GRAY16_1_C, YSCALE_YUV_2_MONO2_C)
}else{ }else{
YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGB1B_C, YSCALE_YUV_2_PACKED1B_C, YSCALE_YUV_2_GRAY16_1_C, YSCALE_YUV_2_MONOBLACK2_C) YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGB1B_C, YSCALE_YUV_2_PACKED1B_C, YSCALE_YUV_2_GRAY16_1_C, YSCALE_YUV_2_MONO2_C)
} }
} }
......
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