diff options
author | Diego Biurrun <diego@biurrun.de> | 2007-04-26 23:07:11 +0000 |
---|---|---|
committer | Diego Biurrun <diego@biurrun.de> | 2007-04-26 23:07:11 +0000 |
commit | 6a4970abd15ddf45e0f8c0bed0ca00950707d83e (patch) | |
tree | 9c2fc6e31ce964c6c3e29fd3ef564dd8e0ad64fc | |
parent | 5ad751471c985b8d9da83bcf1efe11c1fe1f971d (diff) | |
download | ffmpeg-streaming-6a4970abd15ddf45e0f8c0bed0ca00950707d83e.zip ffmpeg-streaming-6a4970abd15ddf45e0f8c0bed0ca00950707d83e.tar.gz |
cosmetics: Remove trailing whitespace.
Originally committed as revision 23147 to svn://svn.mplayerhq.hu/mplayer/trunk/libswscale
-rw-r--r-- | libswscale/cs_test.c | 14 | ||||
-rw-r--r-- | libswscale/rgb2rgb.c | 12 | ||||
-rw-r--r-- | libswscale/rgb2rgb.h | 2 | ||||
-rw-r--r-- | libswscale/rgb2rgb_template.c | 36 | ||||
-rw-r--r-- | libswscale/swscale-example.c | 30 | ||||
-rw-r--r-- | libswscale/swscale.c | 102 | ||||
-rw-r--r-- | libswscale/swscale.h | 4 | ||||
-rw-r--r-- | libswscale/swscale_altivec_template.c | 72 | ||||
-rw-r--r-- | libswscale/swscale_template.c | 64 | ||||
-rw-r--r-- | libswscale/yuv2rgb.c | 12 | ||||
-rw-r--r-- | libswscale/yuv2rgb_altivec.c | 226 | ||||
-rw-r--r-- | libswscale/yuv2rgb_init.c | 8 | ||||
-rw-r--r-- | libswscale/yuv2rgb_mlib.c | 22 | ||||
-rw-r--r-- | libswscale/yuv2rgb_template.c | 23 |
14 files changed, 313 insertions, 314 deletions
diff --git a/libswscale/cs_test.c b/libswscale/cs_test.c index 90c8099..552fafa 100644 --- a/libswscale/cs_test.c +++ b/libswscale/cs_test.c @@ -65,12 +65,12 @@ int main(int argc, char **argv) uint8_t *dstBuffer= (uint8_t*)av_malloc(SIZE); int failedNum=0; int passedNum=0; - + av_log(NULL, AV_LOG_INFO, "memory corruption test ...\n"); args_parse(argc, argv); av_log(NULL, AV_LOG_INFO, "CPU capabilities forced to %x\n", cpu_caps); sws_rgb2rgb_init(cpu_caps); - + for(funcNum=0; ; funcNum++){ struct func_info_s { int src_bpp; @@ -128,7 +128,7 @@ int main(int argc, char **argv) uint8_t *src= srcBuffer+srcOffset; uint8_t *dst= dstBuffer+dstOffset; char *name=NULL; - + if(failed) break; //don't fill the screen with shit ... srcBpp = func_info[funcNum].src_bpp; @@ -141,7 +141,7 @@ int main(int argc, char **argv) for(i=0; i<SIZE; i++){ if(srcBuffer[i]!=srcByte){ - av_log(NULL, AV_LOG_INFO, "src damaged at %d w:%d src:%d dst:%d %s\n", + av_log(NULL, AV_LOG_INFO, "src damaged at %d w:%d src:%d dst:%d %s\n", i, width, srcOffset, dstOffset, name); failed=1; break; @@ -149,7 +149,7 @@ int main(int argc, char **argv) } for(i=0; i<dstOffset; i++){ if(dstBuffer[i]!=dstByte){ - av_log(NULL, AV_LOG_INFO, "dst damaged at %d w:%d src:%d dst:%d %s\n", + av_log(NULL, AV_LOG_INFO, "dst damaged at %d w:%d src:%d dst:%d %s\n", i, width, srcOffset, dstOffset, name); failed=1; break; @@ -157,7 +157,7 @@ int main(int argc, char **argv) } for(i=dstOffset + width*dstBpp; i<SIZE; i++){ if(dstBuffer[i]!=dstByte){ - av_log(NULL, AV_LOG_INFO, "dst damaged at %d w:%d src:%d dst:%d %s\n", + av_log(NULL, AV_LOG_INFO, "dst damaged at %d w:%d src:%d dst:%d %s\n", i, width, srcOffset, dstOffset, name); failed=1; break; @@ -169,7 +169,7 @@ int main(int argc, char **argv) if(failed) failedNum++; else if(srcBpp) passedNum++; } - + av_log(NULL, AV_LOG_INFO, "\n%d converters passed, %d converters randomly overwrote memory\n", passedNum, failedNum); return failedNum; } diff --git a/libswscale/rgb2rgb.c b/libswscale/rgb2rgb.c index 89dd397..9eadbe0 100644 --- a/libswscale/rgb2rgb.c +++ b/libswscale/rgb2rgb.c @@ -22,7 +22,7 @@ * You should have received a copy of the GNU General Public License * along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * + * * the C code (not assembly, mmx, ...) of this file can be used * under the LGPL license too */ @@ -271,7 +271,7 @@ void palette8tobgr32(const uint8_t *src, uint8_t *dst, long num_pixels, const ui dst[2]= palette[ src[i]*4+2 ]; //dst[3]= 0; /* do we need this cleansing? */ #endif - + dst+= 4; } } @@ -430,7 +430,7 @@ void rgb16tobgr16(const uint8_t *src, uint8_t *dst, long src_size) { long i; long num_pixels = src_size >> 1; - + for(i=0; i<num_pixels; i++) { unsigned b,g,r; @@ -447,7 +447,7 @@ void rgb16tobgr15(const uint8_t *src, uint8_t *dst, long src_size) { long i; long num_pixels = src_size >> 1; - + for(i=0; i<num_pixels; i++) { unsigned b,g,r; @@ -504,7 +504,7 @@ void rgb15tobgr16(const uint8_t *src, uint8_t *dst, long src_size) { long i; long num_pixels = src_size >> 1; - + for(i=0; i<num_pixels; i++) { unsigned b,g,r; @@ -521,7 +521,7 @@ void rgb15tobgr15(const uint8_t *src, uint8_t *dst, long src_size) { long i; long num_pixels = src_size >> 1; - + for(i=0; i<num_pixels; i++) { unsigned b,g,r; diff --git a/libswscale/rgb2rgb.h b/libswscale/rgb2rgb.h index 4b5cc0a..769811f 100644 --- a/libswscale/rgb2rgb.h +++ b/libswscale/rgb2rgb.h @@ -141,7 +141,7 @@ extern void (*yvu9_to_yuy2)(const uint8_t *src1, const uint8_t *src2, const uint long width, long height, long srcStride1, long srcStride2, long srcStride3, long dstStride); - + void sws_rgb2rgb_init(int flags); #endif diff --git a/libswscale/rgb2rgb_template.c b/libswscale/rgb2rgb_template.c index 989b5bb..0eb8620 100644 --- a/libswscale/rgb2rgb_template.c +++ b/libswscale/rgb2rgb_template.c @@ -23,7 +23,7 @@ * You should have received a copy of the GNU General Public License * along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * + * * the C code (not assembly, mmx, ...) of this file can be used * under the LGPL license too */ @@ -372,7 +372,7 @@ static inline void RENAME(rgb32to16)(const uint8_t *src, uint8_t *dst, long src_ "pmaddwd %%mm7, %%mm3 \n\t" "pand %%mm5, %%mm1 \n\t" "pand %%mm5, %%mm4 \n\t" - "por %%mm1, %%mm0 \n\t" + "por %%mm1, %%mm0 \n\t" "por %%mm4, %%mm3 \n\t" "psrld $5, %%mm0 \n\t" "pslld $11, %%mm3 \n\t" @@ -531,7 +531,7 @@ static inline void RENAME(rgb32to15)(const uint8_t *src, uint8_t *dst, long src_ "pmaddwd %%mm7, %%mm3 \n\t" "pand %%mm5, %%mm1 \n\t" "pand %%mm5, %%mm4 \n\t" - "por %%mm1, %%mm0 \n\t" + "por %%mm1, %%mm0 \n\t" "por %%mm4, %%mm3 \n\t" "psrld $6, %%mm0 \n\t" "pslld $10, %%mm3 \n\t" @@ -978,7 +978,7 @@ static inline void RENAME(rgb15to24)(const uint8_t *src, uint8_t *dst, long src_ "movq %%mm0, %%mm6\n\t" "movq %%mm3, %%mm7\n\t" - + "movq 8%1, %%mm0\n\t" "movq 8%1, %%mm1\n\t" "movq 8%1, %%mm2\n\t" @@ -1015,7 +1015,7 @@ static inline void RENAME(rgb15to24)(const uint8_t *src, uint8_t *dst, long src_ "movq %%mm3, %%mm5\n\t" "movq %%mm6, %%mm0\n\t" "movq %%mm7, %%mm1\n\t" - + "movq %%mm4, %%mm6\n\t" "movq %%mm5, %%mm7\n\t" "movq %%mm0, %%mm2\n\t" @@ -1117,7 +1117,7 @@ static inline void RENAME(rgb16to24)(const uint8_t *src, uint8_t *dst, long src_ "psllq $16, %%mm5\n\t" "por %%mm4, %%mm3\n\t" "por %%mm5, %%mm3\n\t" - + "movq %%mm0, %%mm6\n\t" "movq %%mm3, %%mm7\n\t" @@ -1148,7 +1148,7 @@ static inline void RENAME(rgb16to24)(const uint8_t *src, uint8_t *dst, long src_ "por %%mm4, %%mm3\n\t" "por %%mm5, %%mm3\n\t" :"=m"(*d) - :"m"(*s),"m"(mask16b),"m"(mask16g),"m"(mask16r),"m"(mmx_null) + :"m"(*s),"m"(mask16b),"m"(mask16g),"m"(mask16r),"m"(mmx_null) :"memory"); /* Borrowed 32 to 24 */ __asm __volatile( @@ -1156,7 +1156,7 @@ static inline void RENAME(rgb16to24)(const uint8_t *src, uint8_t *dst, long src_ "movq %%mm3, %%mm5\n\t" "movq %%mm6, %%mm0\n\t" "movq %%mm7, %%mm1\n\t" - + "movq %%mm4, %%mm6\n\t" "movq %%mm5, %%mm7\n\t" "movq %%mm0, %%mm2\n\t" @@ -1451,7 +1451,7 @@ static inline void RENAME(rgb24tobgr24)(const uint8_t *src, uint8_t *dst, long s "pand %%mm6, %%mm1 \n\t" "pand %%mm7, %%mm2 \n\t" "por %%mm0, %%mm1 \n\t" - "por %%mm2, %%mm1 \n\t" + "por %%mm2, %%mm1 \n\t" "movq 6(%1, %%"REG_a"), %%mm0 \n\t" // BGR BGR BG MOVNTQ" %%mm1, (%2, %%"REG_a")\n\t" // RGB RGB RG "movq 8(%1, %%"REG_a"), %%mm1 \n\t" // R BGR BGR B @@ -1460,7 +1460,7 @@ static inline void RENAME(rgb24tobgr24)(const uint8_t *src, uint8_t *dst, long s "pand %%mm5, %%mm1 \n\t" "pand %%mm6, %%mm2 \n\t" "por %%mm0, %%mm1 \n\t" - "por %%mm2, %%mm1 \n\t" + "por %%mm2, %%mm1 \n\t" "movq 14(%1, %%"REG_a"), %%mm0 \n\t" // R BGR BGR B MOVNTQ" %%mm1, 8(%2, %%"REG_a")\n\t" // B RGB RGB R "movq 16(%1, %%"REG_a"), %%mm1 \n\t" // GR BGR BGR @@ -1469,7 +1469,7 @@ static inline void RENAME(rgb24tobgr24)(const uint8_t *src, uint8_t *dst, long s "pand %%mm7, %%mm1 \n\t" "pand %%mm5, %%mm2 \n\t" "por %%mm0, %%mm1 \n\t" - "por %%mm2, %%mm1 \n\t" + "por %%mm2, %%mm1 \n\t" MOVNTQ" %%mm1, 16(%2, %%"REG_a")\n\t" "add $24, %%"REG_a" \n\t" " js 1b \n\t" @@ -1908,16 +1908,16 @@ static inline void RENAME(yvu9toyv12)(const uint8_t *ysrc, const uint8_t *usrc, static inline void RENAME(planar2x)(const uint8_t *src, uint8_t *dst, long srcWidth, long srcHeight, long srcStride, long dstStride) { long x,y; - + dst[0]= src[0]; - + // first line for(x=0; x<srcWidth-1; x++){ dst[2*x+1]= (3*src[x] + src[x+1])>>2; dst[2*x+2]= ( src[x] + 3*src[x+1])>>2; } dst[2*srcWidth-1]= src[srcWidth-1]; - + dst+= dstStride; for(y=1; y<srcHeight; y++){ @@ -1983,11 +1983,11 @@ static inline void RENAME(planar2x)(const uint8_t *src, uint8_t *dst, long srcWi dst+=dstStride*2; src+=srcStride; } - + // last line #if 1 dst[0]= src[0]; - + for(x=0; x<srcWidth-1; x++){ dst[2*x+1]= (3*src[x] + src[x+1])>>2; dst[2*x+2]= ( src[x] + 3*src[x+1])>>2; @@ -2657,7 +2657,7 @@ static inline void RENAME(yvu9_to_yuy2)(const uint8_t *src1, const uint8_t *src2 "punpckhbw %%mm1, %%mm3\n\t" /* Y4U1 Y5V1 Y6U1 Y7V1*/ MOVNTQ" %%mm0, (%4, %0, 8)\n\t" MOVNTQ" %%mm3, 8(%4, %0, 8)\n\t" - + "punpckhbw %%mm2, %%mm6\n\t" /* U2V2 U2V2 U3V3 U3V3*/ "movq 8(%1, %0, 4), %%mm0\n\t" "movq %%mm0, %%mm3\n\t" @@ -2674,7 +2674,7 @@ static inline void RENAME(yvu9_to_yuy2)(const uint8_t *src1, const uint8_t *src2 "punpckhbw %%mm4, %%mm3\n\t" /* Y U5 Y V5 Y U5 Y V5*/ MOVNTQ" %%mm0, 32(%4, %0, 8)\n\t" MOVNTQ" %%mm3, 40(%4, %0, 8)\n\t" - + "punpckhbw %%mm5, %%mm6\n\t" "movq 24(%1, %0, 4), %%mm0\n\t" "movq %%mm0, %%mm3\n\t" diff --git a/libswscale/swscale-example.c b/libswscale/swscale-example.c index 1c71ba7..803ffa0 100644 --- a/libswscale/swscale-example.c +++ b/libswscale/swscale-example.c @@ -35,7 +35,7 @@ static uint64_t getSSD(uint8_t *src1, uint8_t *src2, int stride1, int stride2, i uint64_t ssd=0; //printf("%d %d\n", w, h); - + for(y=0; y<h; y++){ for(x=0; x<w; x++){ int d= src1[x + y*stride1] - src2[x + y*stride2]; @@ -49,7 +49,7 @@ static uint64_t getSSD(uint8_t *src1, uint8_t *src2, int stride1, int stride2, i // test by ref -> src -> dst -> out & compare out against ref // ref & out are YV12 -static int doTest(uint8_t *ref[3], int refStride[3], int w, int h, int srcFormat, int dstFormat, +static int doTest(uint8_t *ref[3], int refStride[3], int w, int h, int srcFormat, int dstFormat, int srcW, int srcH, int dstW, int dstH, int flags){ uint8_t *src[3]; uint8_t *dst[3]; @@ -59,7 +59,7 @@ static int doTest(uint8_t *ref[3], int refStride[3], int w, int h, int srcFormat uint64_t ssdY, ssdU, ssdV; struct SwsContext *srcContext, *dstContext, *outContext; int res; - + res = 0; for(i=0; i<3; i++){ // avoid stride % bpp != 0 @@ -67,12 +67,12 @@ static int doTest(uint8_t *ref[3], int refStride[3], int w, int h, int srcFormat srcStride[i]= srcW*3; else srcStride[i]= srcW*4; - + if(dstFormat==PIX_FMT_RGB24 || dstFormat==PIX_FMT_BGR24) dstStride[i]= dstW*3; else dstStride[i]= dstW*4; - + src[i]= (uint8_t*) malloc(srcStride[i]*srcH); dst[i]= (uint8_t*) malloc(dstStride[i]*dstH); out[i]= (uint8_t*) malloc(refStride[i]*h); @@ -122,27 +122,27 @@ static int doTest(uint8_t *ref[3], int refStride[3], int w, int h, int srcFormat #if defined(ARCH_X86) asm volatile ("emms\n\t"); #endif - + ssdY= getSSD(ref[0], out[0], refStride[0], refStride[0], w, h); ssdU= getSSD(ref[1], out[1], refStride[1], refStride[1], (w+1)>>1, (h+1)>>1); ssdV= getSSD(ref[2], out[2], refStride[2], refStride[2], (w+1)>>1, (h+1)>>1); - + if(srcFormat == PIX_FMT_GRAY8 || dstFormat==PIX_FMT_GRAY8) ssdU=ssdV=0; //FIXME check that output is really gray - + ssdY/= w*h; ssdU/= w*h/4; ssdV/= w*h/4; - + if(ssdY>100 || ssdU>100 || ssdV>100){ - printf(" %s %dx%d -> %s %4dx%4d flags=%2d SSD=%5lld,%5lld,%5lld\n", - sws_format_name(srcFormat), srcW, srcH, + printf(" %s %dx%d -> %s %4dx%4d flags=%2d SSD=%5lld,%5lld,%5lld\n", + sws_format_name(srcFormat), srcW, srcH, sws_format_name(dstFormat), dstW, dstH, flags, ssdY, ssdU, ssdV); } end: - + sws_freeContext(srcContext); sws_freeContext(dstContext); sws_freeContext(outContext); @@ -170,14 +170,14 @@ static void selfTest(uint8_t *src[3], int stride[3], int w, int h){ printf("%s -> %s\n", sws_format_name(srcFormat), sws_format_name(dstFormat)); - + srcW= w; srcH= h; for(dstW=w - w/3; dstW<= 4*w/3; dstW+= w/3){ for(dstH=h - h/3; dstH<= 4*h/3; dstH+= h/3){ for(flags=1; flags<33; flags*=2) { int res; - + res = doTest(src, stride, w, h, srcFormat, dstFormat, srcW, srcH, dstW, dstH, flags); if (res < 0) { @@ -206,7 +206,7 @@ int main(int argc, char **argv){ struct SwsContext *sws; sws= sws_getContext(W/12, H/12, PIX_FMT_RGB32, W, H, PIX_FMT_YUV420P, 2, NULL, NULL, NULL); - + for(y=0; y<H; y++){ for(x=0; x<W*4; x++){ rgb_data[ x + y*4*W]= random(); diff --git a/libswscale/swscale.c b/libswscale/swscale.c index 0dec5e5..af690e9 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -25,7 +25,7 @@ supported Input formats: YV12, I420/IYUV, YUY2, UYVY, BGR32, BGR24, BGR16, BGR15, RGB32, RGB24, Y8/Y800, YVU9/IF09, PAL8 supported output formats: YV12, I420/IYUV, YUY2, UYVY, {BGR,RGB}{1,4,8,15,16,24,32}, Y8/Y800, YVU9/IF09 {BGR,RGB}{1,4,8,15,16} support dithering - + unscaled special converters (YV12=I420=IYUV, Y800=Y8) YV12 -> {BGR,RGB}{1,4,8,15,16,24,32} x -> x @@ -37,7 +37,7 @@ BGR15 -> BGR16 */ -/* +/* tested special converters (most are tested actually but i didnt write it down ...) YV12 -> BGR16 YV12 -> YV12 @@ -199,7 +199,7 @@ static const uint64_t w1111 attribute_used __attribute__((aligned(8))) = 0 static unsigned char clip_table[768]; static SwsVector *sws_getConvVec(SwsVector *a, SwsVector *b); - + extern const uint8_t dither_2x2_4[2][8]; extern const uint8_t dither_2x2_8[2][8]; extern const uint8_t dither_8x8_32[8][8]; @@ -423,7 +423,7 @@ static inline void yuv2nv12XinC(int16_t *lumFilter, int16_t **lumSrc, int lumFil if(V>255) V=255;\ else if(V<0) V=0;\ } - + #define YSCALE_YUV_2_RGBX_C(type) \ YSCALE_YUV_2_PACKEDX_C(type)\ r = (type *)c->table_rV[V];\ @@ -904,7 +904,7 @@ static double getSplineCoeff(double a, double b, double c, double d, double dist { // printf("%f %f %f %f %f\n", a,b,c,d,dist); if(dist<=1.0) return ((d*dist + c)*dist + b)*dist +a; - else return getSplineCoeff( 0.0, + else return getSplineCoeff( 0.0, b+ 2.0*c + 3.0*d, c + 3.0*d, -b- 3.0*c - 6.0*d, @@ -949,7 +949,7 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF int xDstInSrc; filterSize= 1; filter= av_malloc(dstW*sizeof(double)*filterSize); - + xDstInSrc= xInc/2 - 0x8000; for(i=0; i<dstW; i++) { @@ -966,7 +966,7 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF int xDstInSrc; if (flags&SWS_BICUBIC) filterSize= 4; else if(flags&SWS_X ) filterSize= 4; - else filterSize= 2; // SWS_BILINEAR / SWS_AREA + else filterSize= 2; // SWS_BILINEAR / SWS_AREA filter= av_malloc(dstW*sizeof(double)*filterSize); xDstInSrc= xInc/2 - 0x8000; @@ -1006,7 +1006,7 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF sizeFactor= 0.0; //GCC warning killer ASSERT(0) } - + if(xInc1 <= 1.0) filterSizeInSrc= sizeFactor; // upscale else filterSizeInSrc= sizeFactor*srcW / (double)dstW; @@ -1030,7 +1030,7 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF double B= param[0] != SWS_PARAM_DEFAULT ? param[0] : 0.0; double C= param[1] != SWS_PARAM_DEFAULT ? param[1] : 0.6; - if(d<1.0) + if(d<1.0) coeff = (12-9*B-6*C)*d*d*d + (-18+12*B+6*C)*d*d + 6-2*B; else if(d<2.0) coeff = (-B-6*C)*d*d*d + (6*B+30*C)*d*d + (-12*B-48*C)*d +8*B+24*C; @@ -1046,7 +1046,7 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF else if(flags & SWS_X) { double A= param[0] != SWS_PARAM_DEFAULT ? param[0] : 1.0; - + if(d<1.0) coeff = cos(d*PI); else @@ -1073,7 +1073,7 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF } else if(flags & SWS_LANCZOS) { - double p= param[0] != SWS_PARAM_DEFAULT ? param[0] : 3.0; + double p= param[0] != SWS_PARAM_DEFAULT ? param[0] : 3.0; coeff = d ? sin(d*PI)*sin(d*PI/p)/(d*d*PI*PI/p) : 1.0; if(d>p) coeff=0; } @@ -1218,7 +1218,7 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF } } av_free(filter2); filter2=NULL; - + //FIXME try to align filterpos if possible @@ -1277,7 +1277,7 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF error = v - intV; } } - + (*filterPos)[dstW]= (*filterPos)[dstW-1]; // the MMX scaler will read over the end for(i=0; i<*outFilterSize; i++) { @@ -1312,8 +1312,8 @@ static void initMMX2HScaler(int dstW, int xInc, uint8_t *funnyCode, int16_t *fil "jmp 9f \n\t" // Begin "0: \n\t" - "movq (%%"REG_d", %%"REG_a"), %%mm3\n\t" - "movd (%%"REG_c", %%"REG_S"), %%mm0\n\t" + "movq (%%"REG_d", %%"REG_a"), %%mm3\n\t" + "movd (%%"REG_c", %%"REG_S"), %%mm0\n\t" "movd 1(%%"REG_c", %%"REG_S"), %%mm1\n\t" "punpcklbw %%mm7, %%mm1 \n\t" "punpcklbw %%mm7, %%mm0 \n\t" @@ -1352,8 +1352,8 @@ static void initMMX2HScaler(int dstW, int xInc, uint8_t *funnyCode, int16_t *fil "jmp 9f \n\t" // Begin "0: \n\t" - "movq (%%"REG_d", %%"REG_a"), %%mm3\n\t" - "movd (%%"REG_c", %%"REG_S"), %%mm0\n\t" + "movq (%%"REG_d", %%"REG_a"), %%mm3\n\t" + "movd (%%"REG_c", %%"REG_S"), %%mm0\n\t" "punpcklbw %%mm7, %%mm0 \n\t" "pshufw $0xFF, %%mm0, %%mm1 \n\t" "1: \n\t" @@ -1388,7 +1388,7 @@ static void initMMX2HScaler(int dstW, int xInc, uint8_t *funnyCode, int16_t *fil xpos= 0; //lumXInc/2 - 0x8000; // difference between pixel centers fragmentPos=0; - + for(i=0; i<dstW/numSplits; i++) { int xx=xpos>>16; @@ -1472,7 +1472,7 @@ static void globalInit(void){ } static SwsFunc getSwsFunc(int flags){ - + #if defined(RUNTIME_CPUDETECT) && defined (CONFIG_GPL) #if defined(ARCH_X86) // ordered per speed fasterst first @@ -1581,7 +1581,7 @@ static int rgb2rgbWrapper(SwsContext *c, uint8_t* src[], int srcStride[], int sr case 0x83: conv= rgb15to32; break; case 0x84: conv= rgb16to32; break; case 0x86: conv= rgb24to32; break; - default: av_log(c, AV_LOG_ERROR, "swScaler: internal error %s -> %s converter\n", + default: av_log(c, AV_LOG_ERROR, "swScaler: internal error %s -> %s converter\n", sws_format_name(srcFormat), sws_format_name(dstFormat)); break; } }else if( (isBGR(srcFormat) && isRGB(dstFormat)) @@ -1603,11 +1603,11 @@ static int rgb2rgbWrapper(SwsContext *c, uint8_t* src[], int srcStride[], int sr case 0x84: conv= rgb16tobgr32; break; case 0x86: conv= rgb24tobgr32; break; case 0x88: conv= rgb32tobgr32; break; - default: av_log(c, AV_LOG_ERROR, "swScaler: internal error %s -> %s converter\n", + default: av_log(c, AV_LOG_ERROR, "swScaler: internal error %s -> %s converter\n", sws_format_name(srcFormat), sws_format_name(dstFormat)); break; } }else{ - av_log(c, AV_LOG_ERROR, "swScaler: internal error %s -> %s converter\n", + av_log(c, AV_LOG_ERROR, "swScaler: internal error %s -> %s converter\n", sws_format_name(srcFormat), sws_format_name(dstFormat)); } @@ -1625,7 +1625,7 @@ static int rgb2rgbWrapper(SwsContext *c, uint8_t* src[], int srcStride[], int sr srcPtr+= srcStride[0]; dstPtr+= dstStride[0]; } - } + } return srcSliceH; } @@ -1633,11 +1633,11 @@ static int bgr24toyv12Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], in int srcSliceH, uint8_t* dst[], int dstStride[]){ rgb24toyv12( - src[0], - dst[0]+ srcSliceY *dstStride[0], - dst[1]+(srcSliceY>>1)*dstStride[1], + src[0], + dst[0]+ srcSliceY *dstStride[0], + dst[1]+(srcSliceY>>1)*dstStride[1], dst[2]+(srcSliceY>>1)*dstStride[2], - c->srcW, srcSliceH, + c->srcW, srcSliceH, dstStride[0], dstStride[1], srcStride[0]); return srcSliceH; } @@ -1647,7 +1647,7 @@ static int yvu9toyv12Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], int int i; /* copy Y */ - if(srcStride[0]==dstStride[0] && srcStride[0] > 0) + if(srcStride[0]==dstStride[0] && srcStride[0] > 0) memcpy(dst[0]+ srcSliceY*dstStride[0], src[0], srcStride[0]*srcSliceH); else{ uint8_t *srcPtr= src[0]; @@ -1687,7 +1687,7 @@ static int simpleCopy(SwsContext *c, uint8_t* src[], int srcStride[], int srcSli int length=0; /* universal length finder */ - while(length+c->srcW <= FFABS(dstStride[0]) + while(length+c->srcW <= FFABS(dstStride[0]) && length+c->srcW <= FFABS(srcStride[0])) length+= c->srcW; ASSERT(length!=0); @@ -1699,7 +1699,7 @@ static int simpleCopy(SwsContext *c, uint8_t* src[], int srcStride[], int srcSli } } } - else + else { /* Planar YUV or gray */ int plane; for(plane=0; plane<3; plane++) @@ -1904,7 +1904,7 @@ int sws_setColorspaceDetails(SwsContext *c, const int inv_table[4], int srcRange #ifdef COMPILE_ALTIVEC if (c->flags & SWS_CPU_CAPS_ALTIVEC) yuv2rgb_altivec_init_tables (c, inv_table, brightness, contrast, saturation); -#endif +#endif return 0; } @@ -1921,8 +1921,8 @@ int sws_getColorspaceDetails(SwsContext *c, int **inv_table, int *srcRange, int *brightness= c->brightness; *contrast = c->contrast; *saturation= c->saturation; - - return 0; + + return 0; } static int handle_jpeg(int *format) @@ -1972,14 +1972,14 @@ SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, int dstW, int dstH if(rgb15to16 == NULL) sws_rgb2rgb_init(flags); unscaled = (srcW == dstW && srcH == dstH); - needsDither= (isBGR(dstFormat) || isRGB(dstFormat)) + needsDither= (isBGR(dstFormat) || isRGB(dstFormat)) && (fmt_depth(dstFormat))<24 && ((fmt_depth(dstFormat))<(fmt_depth(srcFormat)) || (!(isRGB(srcFormat) || isBGR(srcFormat)))); srcRange = handle_jpeg(&srcFormat); dstRange = handle_jpeg(&dstFormat); - if(!isSupportedIn(srcFormat)) + if(!isSupportedIn(srcFormat)) { av_log(NULL, AV_LOG_ERROR, "swScaler: %s is not supported as input format\n", sws_format_name(srcFormat)); return NULL; @@ -1993,7 +1993,7 @@ SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, int dstW, int dstH /* sanity check */ if(srcW<4 || srcH<1 || dstW<8 || dstH<1) //FIXME check if these are enough and try to lowwer them after fixing the relevant parts of the code { - av_log(NULL, AV_LOG_ERROR, "swScaler: %dx%d -> %dx%d is invalid scaling dimension\n", + av_log(NULL, AV_LOG_ERROR, "swScaler: %dx%d -> %dx%d is invalid scaling dimension\n", srcW, srcH, dstW, dstH); return NULL; } @@ -2059,7 +2059,7 @@ SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, int dstW, int dstH c->chrDstW= -((-dstW) >> c->chrDstHSubSample); c->chrDstH= -((-dstH) >> c->chrDstVSubSample); - sws_setColorspaceDetails(c, Inverse_Table_6_9[SWS_CS_DEFAULT], srcRange, Inverse_Table_6_9[SWS_CS_DEFAULT] /* FIXME*/, dstRange, 0, 1<<16, 1<<16); + sws_setColorspaceDetails(c, Inverse_Table_6_9[SWS_CS_DEFAULT], srcRange, Inverse_Table_6_9[SWS_CS_DEFAULT] /* FIXME*/, dstRange, 0, 1<<16, 1<<16); /* unscaled special Cases */ if(unscaled && !usesHFilter && !usesVFilter) @@ -2076,7 +2076,7 @@ SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, int dstW, int dstH c->swScale= yuv2rgb_get_func_ptr(c); } #endif - + if( srcFormat==PIX_FMT_YUV410P && dstFormat==PIX_FMT_YUV420P ) { c->swScale= yvu9toyv12Wrapper; @@ -2085,10 +2085,10 @@ SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, int dstW, int dstH /* bgr24toYV12 */ if(srcFormat==PIX_FMT_BGR24 && dstFormat==PIX_FMT_YUV420P) c->swScale= bgr24toyv12Wrapper; - + /* rgb/bgr -> rgb/bgr (no dither needed forms) */ if( (isBGR(srcFormat) || isRGB(srcFormat)) - && (isBGR(dstFormat) || isRGB(dstFormat)) + && (isBGR(dstFormat) || isRGB(dstFormat)) && srcFormat != PIX_FMT_BGR8 && dstFormat != PIX_FMT_BGR8 && srcFormat != PIX_FMT_RGB8 && dstFormat != PIX_FMT_RGB8 && srcFormat != PIX_FMT_BGR4 && dstFormat != PIX_FMT_BGR4 @@ -2103,12 +2103,12 @@ SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, int dstW, int dstH if(c->flags&(SWS_FAST_BILINEAR|SWS_POINT)){ /* rgb/bgr -> rgb/bgr (dither needed forms) */ if( (isBGR(srcFormat) || isRGB(srcFormat)) - && (isBGR(dstFormat) || isRGB(dstFormat)) + && (isBGR(dstFormat) || isRGB(dstFormat)) && needsDither) c->swScale= rgb2rgbWrapper; /* yv12_to_yuy2 */ - if(srcFormat == PIX_FMT_YUV420P && + if(srcFormat == PIX_FMT_YUV420P && (dstFormat == PIX_FMT_YUYV422 || dstFormat == PIX_FMT_UYVY422)) { if (dstFormat == PIX_FMT_YUYV422) @@ -2120,7 +2120,7 @@ SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, int dstW, int dstH #ifdef COMPILE_ALTIVEC if ((c->flags & SWS_CPU_CAPS_ALTIVEC) && - ((srcFormat == PIX_FMT_YUV420P && + ((srcFormat == PIX_FMT_YUV420P && (dstFormat == PIX_FMT_YUYV422 || dstFormat == PIX_FMT_UYVY422)))) { // unscaled YV12 -> packed YUV, we want speed if (dstFormat == PIX_FMT_YUYV422) @@ -2151,11 +2151,11 @@ SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, int dstW, int dstH if(srcFormat != dstFormat && isGray16(srcFormat) && isGray16(dstFormat)) { c->swScale= gray16swap; - } + } if(c->swScale){ if(flags&SWS_PRINT_INFO) - av_log(c, AV_LOG_INFO, "SwScaler: using unscaled %s -> %s special converter\n", + av_log(c, AV_LOG_INFO, "SwScaler: using unscaled %s -> %s special converter\n", sws_format_name(srcFormat), sws_format_name(dstFormat)); return c; } @@ -2341,10 +2341,10 @@ SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, int dstW, int dstH av_log(c, AV_LOG_INFO, "SwScaler: ehh flags invalid?! "); if(dstFormat==PIX_FMT_BGR555 || dstFormat==PIX_FMT_BGR565) - av_log(c, AV_LOG_INFO, "from %s to%s %s ", + av_log(c, AV_LOG_INFO, "from %s to%s %s ", sws_format_name(srcFormat), dither, sws_format_name(dstFormat)); else - av_log(c, AV_LOG_INFO, "from %s to %s ", + av_log(c, AV_LOG_INFO, "from %s to %s ", sws_format_name(srcFormat), sws_format_name(dstFormat)); if(flags & SWS_CPU_CAPS_MMX2) @@ -2355,7 +2355,7 @@ SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, int dstW, int dstH av_log(c, AV_LOG_INFO, "using MMX\n"); else if(flags & SWS_CPU_CAPS_ALTIVEC) av_log(c, AV_LOG_INFO, "using AltiVec\n"); - else + else av_log(c, AV_LOG_INFO, "using C\n"); } @@ -2484,7 +2484,7 @@ int sws_scale(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, if(c->srcFormat != PIX_FMT_PAL8) src2[1] += ((srcSliceH>>c->chrSrcVSubSample)-1)*srcStride[1]; src2[2] += ((srcSliceH>>c->chrSrcVSubSample)-1)*srcStride[2]; - + return c->swScale(c, src2, srcStride2, c->srcH-srcSliceY-srcSliceH, srcSliceH, dst2, dstStride2); } } @@ -2497,7 +2497,7 @@ int sws_scale_ordered(SwsContext *c, uint8_t* src[], int srcStride[], int srcSli return sws_scale(c, src, srcStride, srcSliceY, srcSliceH, dst, dstStride); } -SwsFilter *sws_getDefaultFilter(float lumaGBlur, float chromaGBlur, +SwsFilter *sws_getDefaultFilter(float lumaGBlur, float chromaGBlur, float lumaSharpen, float chromaSharpen, float chromaHShift, float chromaVShift, int verbose) @@ -2722,7 +2722,7 @@ void sws_subVec(SwsVector *a, SwsVector *b){ void sws_convVec(SwsVector *a, SwsVector *b){ SwsVector *conv= sws_getConvVec(a, b); - av_free(a->coeff); + av_free(a->coeff); a->coeff= conv->coeff; a->length= conv->length; av_free(conv); diff --git a/libswscale/swscale.h b/libswscale/swscale.h index 27d1aa3..cf8006d 100644 --- a/libswscale/swscale.h +++ b/libswscale/swscale.h @@ -23,7 +23,7 @@ /** * @file swscale.h - * @brief + * @brief * external api for the swscale stuff */ @@ -130,7 +130,7 @@ SwsVector *sws_cloneVec(SwsVector *a); void sws_printVec(SwsVector *a); void sws_freeVec(SwsVector *a); -SwsFilter *sws_getDefaultFilter(float lumaGBlur, float chromaGBlur, +SwsFilter *sws_getDefaultFilter(float lumaGBlur, float chromaGBlur, float lumaSarpen, float chromaSharpen, float chromaHShift, float chromaVShift, int verbose); diff --git a/libswscale/swscale_altivec_template.c b/libswscale/swscale_altivec_template.c index 251b38c..d5c0e1f 100644 --- a/libswscale/swscale_altivec_template.c +++ b/libswscale/swscale_altivec_template.c @@ -56,7 +56,7 @@ altivec_packIntArrayToCharArray(int *val, uint8_t* dest, int dstW) { vector signed int v23 = vec_perm(v2,v3,perm1); vector signed int v34 = vec_perm(v3,v4,perm1); vector signed int v45 = vec_perm(v4,v5,perm1); - + vector signed int vA = vec_sra(v12, altivec_vectorShiftInt19); vector signed int vB = vec_sra(v23, altivec_vectorShiftInt19); vector signed int vC = vec_sra(v34, altivec_vectorShiftInt19); @@ -99,44 +99,44 @@ yuv2yuvX_altivec_real(int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize, register int i, j; { int __attribute__ ((aligned (16))) val[dstW]; - + for (i = 0; i < (dstW -7); i+=4) { vec_st(vini, i << 2, val); } for (; i < dstW; i++) { val[i] = (1 << 18); } - + for (j = 0; j < lumFilterSize; j++) { vector signed short l1, vLumFilter = vec_ld(j << 1, lumFilter); vector unsigned char perm, perm0 = vec_lvsl(j << 1, lumFilter); vLumFilter = vec_perm(vLumFilter, vLumFilter, perm0); vLumFilter = vec_splat(vLumFilter, 0); // lumFilter[j] is loaded 8 times in vLumFilter - + perm = vec_lvsl(0, lumSrc[j]); l1 = vec_ld(0, lumSrc[j]); - + for (i = 0; i < (dstW - 7); i+=8) { int offset = i << 2; vector signed short l2 = vec_ld((i << 1) + 16, lumSrc[j]); - + vector signed int v1 = vec_ld(offset, val); vector signed int v2 = vec_ld(offset + 16, val); - + vector signed short ls = vec_perm(l1, l2, perm); // lumSrc[j][i] ... lumSrc[j][i+7] - + vector signed int i1 = vec_mule(vLumFilter, ls); vector signed int i2 = vec_mulo(vLumFilter, ls); - + vector signed int vf1 = vec_mergeh(i1, i2); vector signed int vf2 = vec_mergel(i1, i2); // lumSrc[j][i] * lumFilter[j] ... lumSrc[j][i+7] * lumFilter[j] - + vector signed int vo1 = vec_add(v1, vf1); vector signed int vo2 = vec_add(v2, vf2); - + vec_st(vo1, offset, val); vec_st(vo2, offset + 16, val); - + l1 = l2; } for ( ; i < dstW; i++) { @@ -157,57 +157,57 @@ yuv2yuvX_altivec_real(int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize, u[i] = (1 << 18); v[i] = (1 << 18); } - + for (j = 0; j < chrFilterSize; j++) { vector signed short l1, l1_V, vChrFilter = vec_ld(j << 1, chrFilter); vector unsigned char perm, perm0 = vec_lvsl(j << 1, chrFilter); vChrFilter = vec_perm(vChrFilter, vChrFilter, perm0); vChrFilter = vec_splat(vChrFilter, 0); // chrFilter[j] is loaded 8 times in vChrFilter - + perm = vec_lvsl(0, chrSrc[j]); l1 = vec_ld(0, chrSrc[j]); l1_V = vec_ld(2048 << 1, chrSrc[j]); - + for (i = 0; i < (chrDstW - 7); i+=8) { int offset = i << 2; vector signed short l2 = vec_ld((i << 1) + 16, chrSrc[j]); vector signed short l2_V = vec_ld(((i + 2048) << 1) + 16, chrSrc[j]); - + vector signed int v1 = vec_ld(offset, u); vector signed int v2 = vec_ld(offset + 16, u); vector signed int v1_V = vec_ld(offset, v); vector signed int v2_V = vec_ld(offset + 16, v); - + vector signed short ls = vec_perm(l1, l2, perm); // chrSrc[j][i] ... chrSrc[j][i+7] vector signed short ls_V = vec_perm(l1_V, l2_V, perm); // chrSrc[j][i+2048] ... chrSrc[j][i+2055] - + vector signed int i1 = vec_mule(vChrFilter, ls); vector signed int i2 = vec_mulo(vChrFilter, ls); vector signed int i1_V = vec_mule(vChrFilter, ls_V); vector signed int i2_V = vec_mulo(vChrFilter, ls_V); - + vector signed int vf1 = vec_mergeh(i1, i2); vector signed int vf2 = vec_mergel(i1, i2); // chrSrc[j][i] * chrFilter[j] ... chrSrc[j][i+7] * chrFilter[j] vector signed int vf1_V = vec_mergeh(i1_V, i2_V); vector signed int vf2_V = vec_mergel(i1_V, i2_V); // chrSrc[j][i] * chrFilter[j] ... chrSrc[j][i+7] * chrFilter[j] - + vector signed int vo1 = vec_add(v1, vf1); vector signed int vo2 = vec_add(v2, vf2); vector signed int vo1_V = vec_add(v1_V, vf1_V); vector signed int vo2_V = vec_add(v2_V, vf2_V); - + vec_st(vo1, offset, u); vec_st(vo2, offset + 16, u); vec_st(vo1_V, offset, v); vec_st(vo2_V, offset + 16, v); - + l1 = l2; l1_V = l2_V; } for ( ; i < chrDstW; i++) { u[i] += chrSrc[j][i] * chrFilter[j]; v[i] += chrSrc[j][i + 2048] * chrFilter[j]; - } + } } altivec_packIntArrayToCharArray(u,uDest,chrDstW); altivec_packIntArrayToCharArray(v,vDest,chrDstW); @@ -325,7 +325,7 @@ static inline void hScale_altivec_real(int16_t *dst, int dstW, uint8_t *src, int } } break; - + default: { for(i=0; i<dstW; i++) { @@ -342,17 +342,17 @@ static inline void hScale_altivec_real(int16_t *dst, int dstW, uint8_t *src, int for (j = 0 ; j < filterSize - 15; j += 16) { vector unsigned char src_v1 = vec_ld(srcPos + j + 16, src); vector unsigned char src_vF = vec_perm(src_v0, src_v1, permS); - + vector signed short src_vA = // vec_unpackh sign-extends... (vector signed short)(vec_mergeh((vector unsigned char)vzero, src_vF)); vector signed short src_vB = // vec_unpackh sign-extends... (vector signed short)(vec_mergel((vector unsigned char)vzero, src_vF)); - + vector signed short filter_v1R = vec_ld((i * 2 * filterSize) + (j * 2) + 16, filter); vector signed short filter_v2R = vec_ld((i * 2 * filterSize) + (j * 2) + 32, filter); vector signed short filter_v0 = vec_perm(filter_v0R, filter_v1R, permF); vector signed short filter_v1 = vec_perm(filter_v1R, filter_v2R, permF); - + vector signed int val_acc = vec_msums(src_vA, filter_v0, val_v); val_v = vec_msums(src_vB, filter_v1, val_acc); @@ -369,23 +369,23 @@ static inline void hScale_altivec_real(int16_t *dst, int dstW, uint8_t *src, int src_v1 = vec_ld(srcPos + j + 16, src); } src_vF = vec_perm(src_v0, src_v1, permS); - + src_v = // vec_unpackh sign-extends... (vector signed short)(vec_mergeh((vector unsigned char)vzero, src_vF)); // loading filter_v0R is useless, it's already done above //vector signed short filter_v0R = vec_ld((i * 2 * filterSize) + j, filter); filter_v1R = vec_ld((i * 2 * filterSize) + (j * 2) + 16, filter); filter_v = vec_perm(filter_v0R, filter_v1R, permF); - + val_v = vec_msums(src_v, filter_v, val_v); } val_s = vec_sums(val_v, vzero); - + vec_st(val_s, 0, tempo); - dst[i] = av_clip(tempo[3]>>7, 0, (1<<15)-1); + dst[i] = av_clip(tempo[3]>>7, 0, (1<<15)-1); } - + } } } @@ -403,7 +403,7 @@ static inline int yv12toyuy2_unscaled_altivec(SwsContext *c, uint8_t* src[], int const int chromStride = srcStride[1]; const int dstStride = dstStride_a[0]; const vector unsigned char yperm = vec_lvsl(0, ysrc); - const int vertLumPerChroma = 2; + const int vertLumPerChroma = 2; register unsigned int y; if(width&15){ @@ -418,7 +418,7 @@ static inline int yv12toyuy2_unscaled_altivec(SwsContext *c, uint8_t* src[], int 3) width is a multiple of 16 4) lum&chrom stride are multiple of 8 */ - + for(y=0; y<height; y++) { int i; @@ -465,7 +465,7 @@ static inline int yv12toyuy2_unscaled_altivec(SwsContext *c, uint8_t* src[], int ysrc += lumStride; dst += dstStride; } - + return srcSliceH; } @@ -497,7 +497,7 @@ static inline int yv12touyvy_unscaled_altivec(SwsContext *c, uint8_t* src[], int 3) width is a multiple of 16 4) lum&chrom stride are multiple of 8 */ - + for(y=0; y<height; y++) { int i; diff --git a/libswscale/swscale_template.c b/libswscale/swscale_template.c index 61f8705a..9b96754 100644 --- a/libswscale/swscale_template.c +++ b/libswscale/swscale_template.c @@ -457,9 +457,9 @@ "psraw $7, %%mm7 \n\t" /* buf0[eax] - buf1[eax] >>4*/\ "paddw %%mm0, %%mm1 \n\t" /* buf0[eax]yalpha1 + buf1[eax](1-yalpha1) >>16*/\ "paddw %%mm6, %%mm7 \n\t" /* buf0[eax]yalpha1 + buf1[eax](1-yalpha1) >>16*/\ - + #define YSCALEYUV2PACKED(index, c) REAL_YSCALEYUV2PACKED(index, c) - + #define REAL_YSCALEYUV2RGB(index, c) \ "xor "#index", "#index" \n\t"\ ASMALIGN(4)\ @@ -525,7 +525,7 @@ "packuswb %%mm3, %%mm4 \n\t"\ "pxor %%mm7, %%mm7 \n\t" #define YSCALEYUV2RGB(index, c) REAL_YSCALEYUV2RGB(index, c) - + #define REAL_YSCALEYUV2PACKED1(index, c) \ "xor "#index", "#index" \n\t"\ ASMALIGN(4)\ @@ -538,9 +538,9 @@ "movq 8(%0, "#index", 2), %%mm7 \n\t" /*buf0[eax]*/\ "psraw $7, %%mm1 \n\t" \ "psraw $7, %%mm7 \n\t" \ - + #define YSCALEYUV2PACKED1(index, c) REAL_YSCALEYUV2PACKED1(index, c) - + #define REAL_YSCALEYUV2RGB1(index, c) \ "xor "#index", "#index" \n\t"\ ASMALIGN(4)\ @@ -605,9 +605,9 @@ "movq (%0, "#index", 2), %%mm1 \n\t" /*buf0[eax]*/\ "movq 8(%0, "#index", 2), %%mm7 \n\t" /*buf0[eax]*/\ "psraw $7, %%mm1 \n\t" \ - "psraw $7, %%mm7 \n\t" + "psraw $7, %%mm7 \n\t" #define YSCALEYUV2PACKED1b(index, c) REAL_YSCALEYUV2PACKED1b(index, c) - + // do vertical chrominance interpolation #define REAL_YSCALEYUV2RGB1b(index, c) \ "xor "#index", "#index" \n\t"\ @@ -1001,7 +1001,7 @@ static inline void RENAME(yuv2yuv1)(int16_t *lumSrc, int16_t *chrSrc, for(i=0; i<dstW; i++) { int val= lumSrc[i]>>7; - + if(val&256){ if(val<0) val=0; else val=255; @@ -1056,7 +1056,7 @@ static inline void RENAME(yuv2packedX)(SwsContext *c, int16_t *lumFilter, int16_ WRITEBGR24(%%REGc, %5, %%REGa) - :: "r" (&c->redDither), + :: "r" (&c->redDither), "m" (dummy), "m" (dummy), "m" (dummy), "r" (dest), "m" (dstW) : "%"REG_a, "%"REG_c, "%"REG_d, "%"REG_S @@ -1116,7 +1116,7 @@ static inline void RENAME(yuv2packedX)(SwsContext *c, int16_t *lumFilter, int16_ "add %4, %%"REG_c" \n\t" WRITEBGR24(%%REGc, %5, %%REGa) - :: "r" (&c->redDither), + :: "r" (&c->redDither), "m" (dummy), "m" (dummy), "m" (dummy), "r" (dest), "m" (dstW) : "%"REG_a, "%"REG_c, "%"REG_d, "%"REG_S @@ -1503,7 +1503,7 @@ static inline void RENAME(yuv2packed1)(SwsContext *c, uint16_t *buf0, uint16_t * { const int yalpha1=0; int i; - + uint16_t *buf1= buf0; //FIXME needed for the rgb1/bgr1 const int yalpha= 4096; //FIXME ... @@ -1980,7 +1980,7 @@ static inline void RENAME(bgr24ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1 #endif "movq "MANGLE(bgr2VCoeff)", %%mm1 \n\t" "movq "MANGLE(bgr2VCoeff)", %%mm3 \n\t" - + "pmaddwd %%mm0, %%mm1 \n\t" "pmaddwd %%mm2, %%mm3 \n\t" "pmaddwd %%mm6, %%mm0 \n\t" @@ -2026,7 +2026,7 @@ static inline void RENAME(bgr24ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1 #endif "movq "MANGLE(bgr2VCoeff)", %%mm1 \n\t" "movq "MANGLE(bgr2VCoeff)", %%mm3 \n\t" - + "pmaddwd %%mm4, %%mm1 \n\t" "pmaddwd %%mm2, %%mm3 \n\t" "pmaddwd %%mm6, %%mm4 \n\t" @@ -2044,7 +2044,7 @@ static inline void RENAME(bgr24ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1 "add $24, %%"REG_d" \n\t" "packssdw %%mm1, %%mm4 \n\t" // V3 V2 U3 U2 "psraw $7, %%mm4 \n\t" - + "movq %%mm0, %%mm1 \n\t" "punpckldq %%mm4, %%mm0 \n\t" "punpckhdq %%mm4, %%mm1 \n\t" @@ -2095,7 +2095,7 @@ static inline void RENAME(bgr16ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1 for(i=0; i<width; i++) { int d0= ((uint32_t*)src1)[i]; - + int dl= (d0&0x07E0F81F); int dh= ((d0>>5)&0x07C0F83F); @@ -2131,7 +2131,7 @@ static inline void RENAME(bgr15ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1 for(i=0; i<width; i++) { int d0= ((uint32_t*)src1)[i]; - + int dl= (d0&0x03E07C1F); int dh= ((d0>>5)&0x03E0F81F); @@ -2228,7 +2228,7 @@ static inline void RENAME(rgb16ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1 for(i=0; i<width; i++) { int d0= ((uint32_t*)src1)[i]; - + int dl= (d0&0x07E0F81F); int dh= ((d0>>5)&0x07C0F83F); @@ -2264,7 +2264,7 @@ static inline void RENAME(rgb15ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1 for(i=0; i<width; i++) { int d0= ((uint32_t*)src1)[i]; - + int dl= (d0&0x03E07C1F); int dh= ((d0>>5)&0x03E0F81F); @@ -2392,7 +2392,7 @@ static inline void RENAME(hScale)(int16_t *dst, int dstW, uint8_t *src, int srcW "pmaddwd %%mm2, %%mm5 \n\t" "paddd %%mm4, %%mm0 \n\t" "paddd %%mm5, %%mm3 \n\t" - + "psrad $8, %%mm0 \n\t" "psrad $8, %%mm3 \n\t" "packssdw %%mm3, %%mm0 \n\t" @@ -2489,7 +2489,7 @@ static inline void RENAME(hScale)(int16_t *dst, int dstW, uint8_t *src, int srcW // *** horizontal scale Y line to temp buffer static inline void RENAME(hyscale)(uint16_t *dst, long dstWidth, uint8_t *src, int srcW, int xInc, int flags, int canMMX2BeUsed, int16_t *hLumFilter, - int16_t *hLumFilterPos, int hLumFilterSize, void *funnyYCode, + int16_t *hLumFilterPos, int hLumFilterSize, void *funnyYCode, int srcFormat, uint8_t *formatConvBuffer, int16_t *mmx2Filter, int32_t *mmx2FilterPos, uint8_t *pal) { @@ -2862,7 +2862,7 @@ FUNNY_UV_CODE { #endif long xInc_shr16 = (long) (xInc >> 16); - uint16_t xInc_mask = xInc & 0xffff; + uint16_t xInc_mask = xInc & 0xffff; asm volatile( "xor %%"REG_a", %%"REG_a" \n\t" // i "xor %%"REG_d", %%"REG_d" \n\t" // xx @@ -2975,7 +2975,7 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s int chrBufIndex= c->chrBufIndex; int lastInLumBuf= c->lastInLumBuf; int lastInChrBuf= c->lastInChrBuf; - + if(isPacked(c->srcFormat)){ pal= src[1]; src[0]= @@ -3020,7 +3020,7 @@ i--; if(srcSliceY ==0){ lumBufIndex=0; chrBufIndex=0; - dstY=0; + dstY=0; lastInLumBuf= -1; lastInChrBuf= -1; } @@ -3062,7 +3062,7 @@ i--; // printf("%d %d\n", lumBufIndex, vLumBufSize); RENAME(hyscale)(lumPixBuf[ lumBufIndex ], dstW, s, srcW, lumXInc, flags, canMMX2BeUsed, hLumFilter, hLumFilterPos, hLumFilterSize, - funnyYCode, c->srcFormat, formatConvBuffer, + funnyYCode, c->srcFormat, formatConvBuffer, c->lumMmx2Filter, c->lumMmx2FilterPos, pal); lastInLumBuf++; } @@ -3079,7 +3079,7 @@ i--; if(!(isGray(srcFormat) || isGray(dstFormat))) RENAME(hcscale)(chrPixBuf[ chrBufIndex ], chrDstW, src1, src2, chrSrcW, chrXInc, flags, canMMX2BeUsed, hChrFilter, hChrFilterPos, hChrFilterSize, - funnyUVCode, c->srcFormat, formatConvBuffer, + funnyUVCode, c->srcFormat, formatConvBuffer, c->chrMmx2Filter, c->chrMmx2FilterPos, pal); lastInChrBuf++; } @@ -3104,7 +3104,7 @@ i--; ASSERT(lastInLumBuf + 1 - srcSliceY >= 0) RENAME(hyscale)(lumPixBuf[ lumBufIndex ], dstW, s, srcW, lumXInc, flags, canMMX2BeUsed, hLumFilter, hLumFilterPos, hLumFilterSize, - funnyYCode, c->srcFormat, formatConvBuffer, + funnyYCode, c->srcFormat, formatConvBuffer, c->lumMmx2Filter, c->lumMmx2FilterPos, pal); lastInLumBuf++; } @@ -3120,7 +3120,7 @@ i--; if(!(isGray(srcFormat) || isGray(dstFormat))) RENAME(hcscale)(chrPixBuf[ chrBufIndex ], chrDstW, src1, src2, chrSrcW, chrXInc, flags, canMMX2BeUsed, hChrFilter, hChrFilterPos, hChrFilterSize, - funnyUVCode, c->srcFormat, formatConvBuffer, + funnyUVCode, c->srcFormat, formatConvBuffer, c->chrMmx2Filter, c->chrMmx2FilterPos, pal); lastInChrBuf++; } @@ -3162,16 +3162,16 @@ i--; { lumMmxFilter[4*i+0]= (int32_t)lumSrcPtr[i]; lumMmxFilter[4*i+1]= (uint64_t)lumSrcPtr[i] >> 32; - lumMmxFilter[4*i+2]= - lumMmxFilter[4*i+3]= + lumMmxFilter[4*i+2]= + lumMmxFilter[4*i+3]= ((uint16_t)vLumFilter[dstY*vLumFilterSize + i])*0x10001; } for(i=0; i<vChrFilterSize; i++) { chrMmxFilter[4*i+0]= (int32_t)chrSrcPtr[i]; chrMmxFilter[4*i+1]= (uint64_t)chrSrcPtr[i] >> 32; - chrMmxFilter[4*i+2]= - chrMmxFilter[4*i+3]= + chrMmxFilter[4*i+2]= + chrMmxFilter[4*i+3]= ((uint16_t)vChrFilter[chrDstY*vChrFilterSize + i])*0x10001; } } @@ -3257,7 +3257,7 @@ i--; { ASSERT(lumSrcPtr + vLumFilterSize - 1 < lumPixBuf + vLumBufSize*2); ASSERT(chrSrcPtr + vChrFilterSize - 1 < chrPixBuf + vChrBufSize*2); - yuv2packedXinC(c, + yuv2packedXinC(c, vLumFilter+dstY*vLumFilterSize, lumSrcPtr, vLumFilterSize, vChrFilter+dstY*vChrFilterSize, chrSrcPtr, vChrFilterSize, dest, dstW, dstY); diff --git a/libswscale/yuv2rgb.c b/libswscale/yuv2rgb.c index af7f86f..db65342 100644 --- a/libswscale/yuv2rgb.c +++ b/libswscale/yuv2rgb.c @@ -427,15 +427,15 @@ PROLOG(yuv2rgb_c_4, uint8_t) acc = r[Y] + g[Y] + b[Y]; \ Y = py_1[2*i+1]; \ acc |= (r[Y] + g[Y] + b[Y])<<4;\ - dst_1[i] = acc; + dst_1[i] = acc; #define DST2_4(i) \ Y = py_2[2*i]; \ acc = r[Y] + g[Y] + b[Y]; \ Y = py_2[2*i+1]; \ acc |= (r[Y] + g[Y] + b[Y])<<4;\ - dst_2[i] = acc; - + dst_2[i] = acc; + RGB(0); DST1_4(0); DST2_4(0); @@ -572,7 +572,7 @@ PROLOG(yuv2rgb_c_1_ordered_dither, uint8_t) DST2bpp1(3,6); DST1bpp1(3,6); - + dst_1[0]= out_1; dst_2[0]= out_2; EPILOG(1) @@ -644,7 +644,7 @@ static int div_round (int dividend, int divisor) } int yuv2rgb_c_init_tables (SwsContext *c, const int inv_table[4], int fullRange, int brightness, int contrast, int saturation) -{ +{ const int isRgb = isBGR(c->dstFormat); const int bpp = fmt_depth(c->dstFormat); int i; @@ -676,7 +676,7 @@ int yuv2rgb_c_init_tables (SwsContext *c, const int inv_table[4], int fullRange, cgu= (cgu*224) / 255; cgv= (cgv*224) / 255; } - + cy = (cy *contrast )>>16; crv= (crv*contrast * saturation)>>32; cbu= (cbu*contrast * saturation)>>32; diff --git a/libswscale/yuv2rgb_altivec.c b/libswscale/yuv2rgb_altivec.c index 72e418e..60cc0a4 100644 --- a/libswscale/yuv2rgb_altivec.c +++ b/libswscale/yuv2rgb_altivec.c @@ -59,7 +59,7 @@ NOTE quartz vo driver ARGB32_to_RGB24 consumes 30% of the processor - Integrated luma prescaling adjustment for saturation/contrast/brightness adjustment. + Integrated luma prescaling adjustment for saturation/contrast/brightness adjustment. */ /* @@ -443,105 +443,105 @@ DEFCSP420_CVT (yuv2_abgr, out_abgr) #if 1 DEFCSP420_CVT (yuv2_bgra, out_bgra) #else -static int altivec_yuv2_bgra32 (SwsContext *c, - unsigned char **in, int *instrides, - int srcSliceY, int srcSliceH, - unsigned char **oplanes, int *outstrides) -{ - int w = c->srcW; - int h = srcSliceH; - int i,j; - int instrides_scl[3]; - vector unsigned char y0,y1; - - vector signed char u,v; - - vector signed short Y0,Y1,Y2,Y3; - vector signed short U,V; - vector signed short vx,ux,uvx; - vector signed short vx0,ux0,uvx0; - vector signed short vx1,ux1,uvx1; - vector signed short R0,G0,B0; - vector signed short R1,G1,B1; - vector unsigned char R,G,B; - - vector unsigned char *uivP, *vivP; - vector unsigned char align_perm; - - vector signed short - lCY = c->CY, - lOY = c->OY, - lCRV = c->CRV, - lCBU = c->CBU, - lCGU = c->CGU, - lCGV = c->CGV; - - vector unsigned short lCSHIFT = c->CSHIFT; - - ubyte *y1i = in[0]; - ubyte *y2i = in[0]+w; - ubyte *ui = in[1]; - ubyte *vi = in[2]; - - vector unsigned char *oute - = (vector unsigned char *) - (oplanes[0]+srcSliceY*outstrides[0]); - vector unsigned char *outo - = (vector unsigned char *) - (oplanes[0]+srcSliceY*outstrides[0]+outstrides[0]); - - - instrides_scl[0] = instrides[0]; - instrides_scl[1] = instrides[1]-w/2; /* the loop moves ui by w/2 */ - instrides_scl[2] = instrides[2]-w/2; /* the loop moves vi by w/2 */ - - - for (i=0;i<h/2;i++) { - vec_dstst (outo, (0x02000002|(((w*3+32)/32)<<16)), 0); - vec_dstst (oute, (0x02000002|(((w*3+32)/32)<<16)), 1); - - for (j=0;j<w/16;j++) { - - y0 = vec_ldl (0,y1i); - y1 = vec_ldl (0,y2i); - uivP = (vector unsigned char *)ui; - vivP = (vector unsigned char *)vi; - - align_perm = vec_lvsl (0, ui); - u = (vector signed char)vec_perm (uivP[0], uivP[1], align_perm); - - align_perm = vec_lvsl (0, vi); +static int altivec_yuv2_bgra32 (SwsContext *c, + unsigned char **in, int *instrides, + int srcSliceY, int srcSliceH, + unsigned char **oplanes, int *outstrides) +{ + int w = c->srcW; + int h = srcSliceH; + int i,j; + int instrides_scl[3]; + vector unsigned char y0,y1; + + vector signed char u,v; + + vector signed short Y0,Y1,Y2,Y3; + vector signed short U,V; + vector signed short vx,ux,uvx; + vector signed short vx0,ux0,uvx0; + vector signed short vx1,ux1,uvx1; + vector signed short R0,G0,B0; + vector signed short R1,G1,B1; + vector unsigned char R,G,B; + + vector unsigned char *uivP, *vivP; + vector unsigned char align_perm; + + vector signed short + lCY = c->CY, + lOY = c->OY, + lCRV = c->CRV, + lCBU = c->CBU, + lCGU = c->CGU, + lCGV = c->CGV; + + vector unsigned short lCSHIFT = c->CSHIFT; + + ubyte *y1i = in[0]; + ubyte *y2i = in[0]+w; + ubyte *ui = in[1]; + ubyte *vi = in[2]; + + vector unsigned char *oute + = (vector unsigned char *) + (oplanes[0]+srcSliceY*outstrides[0]); + vector unsigned char *outo + = (vector unsigned char *) + (oplanes[0]+srcSliceY*outstrides[0]+outstrides[0]); + + + instrides_scl[0] = instrides[0]; + instrides_scl[1] = instrides[1]-w/2; /* the loop moves ui by w/2 */ + instrides_scl[2] = instrides[2]-w/2; /* the loop moves vi by w/2 */ + + + for (i=0;i<h/2;i++) { + vec_dstst (outo, (0x02000002|(((w*3+32)/32)<<16)), 0); + vec_dstst (oute, (0x02000002|(((w*3+32)/32)<<16)), 1); + + for (j=0;j<w/16;j++) { + + y0 = vec_ldl (0,y1i); + y1 = vec_ldl (0,y2i); + uivP = (vector unsigned char *)ui; + vivP = (vector unsigned char *)vi; + + align_perm = vec_lvsl (0, ui); + u = (vector signed char)vec_perm (uivP[0], uivP[1], align_perm); + + align_perm = vec_lvsl (0, vi); v = (vector signed char)vec_perm (vivP[0], vivP[1], align_perm); u = (vector signed char) vec_sub (u,(vector signed char) vec_splat((vector signed char)AVV(128),0)); - + v = (vector signed char) vec_sub (v, (vector signed char) vec_splat((vector signed char)AVV(128),0)); - - U = vec_unpackh (u); - V = vec_unpackh (v); - - - Y0 = vec_unh (y0); - Y1 = vec_unl (y0); - Y2 = vec_unh (y1); - Y3 = vec_unl (y1); - - Y0 = vec_mradds (Y0, lCY, lOY); - Y1 = vec_mradds (Y1, lCY, lOY); - Y2 = vec_mradds (Y2, lCY, lOY); - Y3 = vec_mradds (Y3, lCY, lOY); - - /* ux = (CBU*(u<<CSHIFT)+0x4000)>>15 */ - ux = vec_sl (U, lCSHIFT); + + U = vec_unpackh (u); + V = vec_unpackh (v); + + + Y0 = vec_unh (y0); + Y1 = vec_unl (y0); + Y2 = vec_unh (y1); + Y3 = vec_unl (y1); + + Y0 = vec_mradds (Y0, lCY, lOY); + Y1 = vec_mradds (Y1, lCY, lOY); + Y2 = vec_mradds (Y2, lCY, lOY); + Y3 = vec_mradds (Y3, lCY, lOY); + + /* ux = (CBU*(u<<CSHIFT)+0x4000)>>15 */ + ux = vec_sl (U, lCSHIFT); ux = vec_mradds (ux, lCBU, (vector signed short)AVV(0)); - ux0 = vec_mergeh (ux,ux); - ux1 = vec_mergel (ux,ux); - - /* vx = (CRV*(v<<CSHIFT)+0x4000)>>15; */ - vx = vec_sl (V, lCSHIFT); + ux0 = vec_mergeh (ux,ux); + ux1 = vec_mergel (ux,ux); + + /* vx = (CRV*(v<<CSHIFT)+0x4000)>>15; */ + vx = vec_sl (V, lCSHIFT); vx = vec_mradds (vx, lCRV, (vector signed short)AVV(0)); vx0 = vec_mergeh (vx,vx); vx1 = vec_mergel (vx,vx); @@ -559,7 +559,7 @@ static int altivec_yuv2_bgra32 (SwsContext *c, R = vec_packclp (R0,R1); G = vec_packclp (G0,G1); B = vec_packclp (B0,B1); - + out_argb(R,G,B,oute); R0 = vec_add (Y2,vx0); G0 = vec_add (Y2,uvx0); @@ -570,24 +570,24 @@ static int altivec_yuv2_bgra32 (SwsContext *c, R = vec_packclp (R0,R1); G = vec_packclp (G0,G1); B = vec_packclp (B0,B1); - + out_argb(R,G,B,outo); - y1i += 16; - y2i += 16; + y1i += 16; + y2i += 16; ui += 8; - vi += 8; - - } - - outo += (outstrides[0])>>4; - oute += (outstrides[0])>>4; - - ui += instrides_scl[1]; - vi += instrides_scl[2]; - y1i += instrides_scl[0]; - y2i += instrides_scl[0]; - } - return srcSliceH; + vi += 8; + + } + + outo += (outstrides[0])>>4; + oute += (outstrides[0])>>4; + + ui += instrides_scl[1]; + vi += instrides_scl[2]; + y1i += instrides_scl[0]; + y2i += instrides_scl[0]; + } + return srcSliceH; } #endif @@ -686,15 +686,15 @@ static int altivec_uyvy_rgb32 (SwsContext *c, */ SwsFunc yuv2rgb_init_altivec (SwsContext *c) { - if (!(c->flags & SWS_CPU_CAPS_ALTIVEC)) + if (!(c->flags & SWS_CPU_CAPS_ALTIVEC)) return NULL; /* - and this seems not to matter too much I tried a bunch of + and this seems not to matter too much I tried a bunch of videos with abnormal widths and mplayer crashes else where. - mplayer -vo x11 -rawvideo on:w=350:h=240 raw-350x240.eyuv + mplayer -vo x11 -rawvideo on:w=350:h=240 raw-350x240.eyuv boom with X11 bad match. - + */ if ((c->srcW & 0xf) != 0) return NULL; diff --git a/libswscale/yuv2rgb_init.c b/libswscale/yuv2rgb_init.c index 371dce5..4987223 100644 --- a/libswscale/yuv2rgb_init.c +++ b/libswscale/yuv2rgb_init.c @@ -16,7 +16,7 @@ * \arg Maximum Rv value: 117570 * \arg Maximum Bu value: 138420 * \arg Maximum Gv + Gu value: 25642 + 53281 = 78923 - * + * * These values are needed to allocate table_{r, g, b}. If you modify * this table, please update allocate_tables() accordingly */ @@ -168,7 +168,7 @@ static int get_entry_size(int bpp) * together, so that they are contiguous in memory * * table_r is indexed in the range - * [-128 * 117570 / 76309, 255 + 127 * 117570 / 76309] = + * [-128 * 117570 / 76309, 255 + 127 * 117570 / 76309] = * [-197.21, 451.67] ---> [-198, 452] * table_b is indexed in the range * [-128 * 138420 / 76309, 255 + 127 * 138420 / 76309] = @@ -210,7 +210,7 @@ static void *allocate_tables(uint8_t **table_r, uint8_t **table_g, uint8_t **tab return NULL; } - + /* ...and then, assign the table_* value */ switch (bpp) { case 32: @@ -242,7 +242,7 @@ static void *allocate_tables(uint8_t **table_r, uint8_t **table_g, uint8_t **tab * @param fullRange 0->MPEG YUV space 1->JPEG YUV space */ int yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4], int fullRange, int brightness, int contrast, int saturation) -{ +{ int i; static uint8_t ytable[1024]; int64_t cy, oy; diff --git a/libswscale/yuv2rgb_mlib.c b/libswscale/yuv2rgb_mlib.c index c99e019..6d540a3 100644 --- a/libswscale/yuv2rgb_mlib.c +++ b/libswscale/yuv2rgb_mlib.c @@ -1,4 +1,4 @@ -/* +/* * yuv2rgb_mlib.c, Software YUV to RGB coverter using mediaLib * * Copyright (C) 2000, Håkan Hjort <d95hjort@dtek.chalmers.se> @@ -31,50 +31,50 @@ #include "swscale.h" -static int mlib_YUV2ARGB420_32(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, +static int mlib_YUV2ARGB420_32(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t* dst[], int dstStride[]){ if(c->srcFormat == PIX_FMT_YUV422P){ srcStride[1] *= 2; srcStride[2] *= 2; } - + assert(srcStride[1] == srcStride[2]); - + mlib_VideoColorYUV2ARGB420(dst[0]+srcSliceY*dstStride[0], src[0], src[1], src[2], c->dstW, srcSliceH, dstStride[0], srcStride[0], srcStride[1]); return srcSliceH; } -static int mlib_YUV2ABGR420_32(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, +static int mlib_YUV2ABGR420_32(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t* dst[], int dstStride[]){ if(c->srcFormat == PIX_FMT_YUV422P){ srcStride[1] *= 2; srcStride[2] *= 2; } - + assert(srcStride[1] == srcStride[2]); - + mlib_VideoColorYUV2ABGR420(dst[0]+srcSliceY*dstStride[0], src[0], src[1], src[2], c->dstW, srcSliceH, dstStride[0], srcStride[0], srcStride[1]); return srcSliceH; } -static int mlib_YUV2RGB420_24(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, +static int mlib_YUV2RGB420_24(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t* dst[], int dstStride[]){ if(c->srcFormat == PIX_FMT_YUV422P){ srcStride[1] *= 2; srcStride[2] *= 2; } - + assert(srcStride[1] == srcStride[2]); - + mlib_VideoColorYUV2RGB420(dst[0]+srcSliceY*dstStride[0], src[0], src[1], src[2], c->dstW, srcSliceH, dstStride[0], srcStride[0], srcStride[1]); return srcSliceH; } -SwsFunc yuv2rgb_init_mlib(SwsContext *c) +SwsFunc yuv2rgb_init_mlib(SwsContext *c) { switch(c->dstFormat){ case PIX_FMT_RGB24: return mlib_YUV2RGB420_24; diff --git a/libswscale/yuv2rgb_template.c b/libswscale/yuv2rgb_template.c index 28ee24a..2a725ee 100644 --- a/libswscale/yuv2rgb_template.c +++ b/libswscale/yuv2rgb_template.c @@ -1,4 +1,3 @@ - /* * yuv2rgb_mmx.c, Software YUV to RGB coverter with Intel MMX "technology" * @@ -134,7 +133,7 @@ static inline int RENAME(yuv420_rgb16)(SwsContext *c, uint8_t* src[], int srcStr h_size= (c->dstW+7)&~7; if(h_size*2 > FFABS(dstStride[0])) h_size-=8; - + __asm__ __volatile__ ("pxor %mm4, %mm4;" /* zero mm4 */ ); //printf("%X %X %X %X %X %X %X %X %X %X\n", (int)&c->redDither, (int)&b5Dither, (int)src[0], (int)src[1], (int)src[2], (int)dst[0], //srcStride[0],srcStride[1],srcStride[2],dstStride[0]); @@ -203,18 +202,18 @@ YUV2RGB "movd 4 (%3, %0), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */ MOVNTQ " %%mm5, 8 (%1);" /* store pixel 4-7 */ - + "add $16, %1 \n\t" "add $4, %0 \n\t" " js 1b \n\t" - + : "+r" (index), "+r" (_image) : "r" (_pu - index), "r" (_pv - index), "r"(&c->redDither), "r" (_py - 2*index) ); } __asm__ __volatile__ (EMMS); - + return srcSliceH; } @@ -229,7 +228,7 @@ static inline int RENAME(yuv420_rgb15)(SwsContext *c, uint8_t* src[], int srcStr h_size= (c->dstW+7)&~7; if(h_size*2 > FFABS(dstStride[0])) h_size-=8; - + __asm__ __volatile__ ("pxor %mm4, %mm4;" /* zero mm4 */ ); //printf("%X %X %X %X %X %X %X %X %X %X\n", (int)&c->redDither, (int)&b5Dither, (int)src[0], (int)src[1], (int)src[2], (int)dst[0], //srcStride[0],srcStride[1],srcStride[2],dstStride[0]); @@ -294,7 +293,7 @@ YUV2RGB "movd 4 (%3, %0), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */ MOVNTQ " %%mm5, 8 (%1);" /* store pixel 4-7 */ - + "add $16, %1 \n\t" "add $4, %0 \n\t" " js 1b \n\t" @@ -318,7 +317,7 @@ static inline int RENAME(yuv420_rgb24)(SwsContext *c, uint8_t* src[], int srcStr h_size= (c->dstW+7)&~7; if(h_size*3 > FFABS(dstStride[0])) h_size-=8; - + __asm__ __volatile__ ("pxor %mm4, %mm4;" /* zero mm4 */ ); for (y= 0; y<srcSliceH; y++ ) { @@ -439,11 +438,11 @@ YUV2RGB "movd 4 (%3, %0), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */ "pxor %%mm4, %%mm4 \n\t" #endif - + "add $24, %1 \n\t" "add $4, %0 \n\t" " js 1b \n\t" - + : "+r" (index), "+r" (_image) : "r" (_pu - index), "r" (_pv - index), "r"(&c->redDither), "r" (_py - 2*index) ); @@ -464,7 +463,7 @@ static inline int RENAME(yuv420_rgb32)(SwsContext *c, uint8_t* src[], int srcStr h_size= (c->dstW+7)&~7; if(h_size*4 > FFABS(dstStride[0])) h_size-=8; - + __asm__ __volatile__ ("pxor %mm4, %mm4;" /* zero mm4 */ ); for (y= 0; y<srcSliceH; y++ ) { @@ -529,7 +528,7 @@ YUV2RGB "add $32, %1 \n\t" "add $4, %0 \n\t" " js 1b \n\t" - + : "+r" (index), "+r" (_image) : "r" (_pu - index), "r" (_pv - index), "r"(&c->redDither), "r" (_py - 2*index) ); |