Mercurial > mplayer.hg
comparison libswscale/swscale_template.c @ 27555:bf2638aa89b4
Support mono as input format.
author | michael |
---|---|
date | Fri, 12 Sep 2008 16:46:38 +0000 |
parents | 021a1889cc26 |
children | ff8cabc7f18f |
comparison
equal
deleted
inserted
replaced
27554:021a1889cc26 | 27555:bf2638aa89b4 |
---|---|
2141 dstU[i]= p>>8; | 2141 dstU[i]= p>>8; |
2142 dstV[i]= p>>16; | 2142 dstV[i]= p>>16; |
2143 } | 2143 } |
2144 } | 2144 } |
2145 | 2145 |
2146 static inline void RENAME(mono2Y)(uint8_t *dst, uint8_t *src, long width, int format) | |
2147 { | |
2148 int i, j; | |
2149 for (i=0; i<width/8; i++){ | |
2150 int d= format == PIX_FMT_MONOBLACK ? src[i] : ~src[i]; | |
2151 for(j=7; j>=0; j--) | |
2152 dst[i]= ((d>>j)&1)*255; | |
2153 } | |
2154 } | |
2155 | |
2146 // bilinear / bicubic scaling | 2156 // bilinear / bicubic scaling |
2147 static inline void RENAME(hScale)(int16_t *dst, int dstW, uint8_t *src, int srcW, int xInc, | 2157 static inline void RENAME(hScale)(int16_t *dst, int dstW, uint8_t *src, int srcW, int xInc, |
2148 int16_t *filter, int16_t *filterPos, long filterSize) | 2158 int16_t *filter, int16_t *filterPos, long filterSize) |
2149 { | 2159 { |
2150 #ifdef HAVE_MMX | 2160 #ifdef HAVE_MMX |
2396 else if (srcFormat==PIX_FMT_RGB8 || srcFormat==PIX_FMT_BGR8 || srcFormat==PIX_FMT_PAL8 || srcFormat==PIX_FMT_BGR4_BYTE || srcFormat==PIX_FMT_RGB4_BYTE) | 2406 else if (srcFormat==PIX_FMT_RGB8 || srcFormat==PIX_FMT_BGR8 || srcFormat==PIX_FMT_PAL8 || srcFormat==PIX_FMT_BGR4_BYTE || srcFormat==PIX_FMT_RGB4_BYTE) |
2397 { | 2407 { |
2398 RENAME(palToY)(formatConvBuffer, src, srcW, (uint32_t*)pal); | 2408 RENAME(palToY)(formatConvBuffer, src, srcW, (uint32_t*)pal); |
2399 src= formatConvBuffer; | 2409 src= formatConvBuffer; |
2400 } | 2410 } |
2411 else if (srcFormat==PIX_FMT_MONOBLACK ||srcFormat==PIX_FMT_MONOWHITE) | |
2412 { | |
2413 RENAME(mono2Y)(formatConvBuffer, src, srcW, srcFormat); | |
2414 src= formatConvBuffer; | |
2415 } | |
2401 | 2416 |
2402 #ifdef HAVE_MMX | 2417 #ifdef HAVE_MMX |
2403 // Use the new MMX scaler if the MMX2 one can't be used (it is faster than the x86 ASM one). | 2418 // Use the new MMX scaler if the MMX2 one can't be used (it is faster than the x86 ASM one). |
2404 if (!(flags&SWS_FAST_BILINEAR) || (!canMMX2BeUsed)) | 2419 if (!(flags&SWS_FAST_BILINEAR) || (!canMMX2BeUsed)) |
2405 #else | 2420 #else |
2658 else | 2673 else |
2659 RENAME(rgb15ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); | 2674 RENAME(rgb15ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); |
2660 src1= formatConvBuffer; | 2675 src1= formatConvBuffer; |
2661 src2= formatConvBuffer+VOFW; | 2676 src2= formatConvBuffer+VOFW; |
2662 } | 2677 } |
2663 else if (isGray(srcFormat)) | 2678 else if (isGray(srcFormat) || srcFormat==PIX_FMT_MONOBLACK || PIX_FMT_MONOWHITE) |
2664 { | 2679 { |
2665 return; | 2680 return; |
2666 } | 2681 } |
2667 else if (srcFormat==PIX_FMT_RGB8 || srcFormat==PIX_FMT_BGR8 || srcFormat==PIX_FMT_PAL8 || srcFormat==PIX_FMT_BGR4_BYTE || srcFormat==PIX_FMT_RGB4_BYTE) | 2682 else if (srcFormat==PIX_FMT_RGB8 || srcFormat==PIX_FMT_BGR8 || srcFormat==PIX_FMT_PAL8 || srcFormat==PIX_FMT_BGR4_BYTE || srcFormat==PIX_FMT_RGB4_BYTE) |
2668 { | 2683 { |