From 6a4970abd15ddf45e0f8c0bed0ca00950707d83e Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Thu, 26 Apr 2007 23:07:11 +0000 Subject: [PATCH] cosmetics: Remove trailing whitespace. Originally committed as revision 23147 to svn://svn.mplayerhq.hu/mplayer/trunk/libswscale --- libswscale/cs_test.c | 14 +- libswscale/rgb2rgb.c | 12 +- libswscale/rgb2rgb.h | 2 +- libswscale/rgb2rgb_template.c | 36 ++-- libswscale/swscale-example.c | 30 ++-- libswscale/swscale.c | 102 ++++++------ libswscale/swscale.h | 4 +- libswscale/swscale_altivec_template.c | 72 ++++---- libswscale/swscale_template.c | 64 ++++---- libswscale/yuv2rgb.c | 12 +- libswscale/yuv2rgb_altivec.c | 226 +++++++++++++------------- libswscale/yuv2rgb_init.c | 8 +- libswscale/yuv2rgb_mlib.c | 22 +-- 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 90c8099c30..552fafaf6a 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> 1; - + for(i=0; i> 1; - + for(i=0; i> 1; - + for(i=0; i> 1; - + for(i=0; i>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>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 1c71ba7e16..803ffa0459 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 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 {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; ip) 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>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 27d1aa3efa..cf8006d629 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 251b38ca14..d5c0e1f34e 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>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>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>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>5)&0x07C0F83F); @@ -2131,7 +2131,7 @@ static inline void RENAME(bgr15ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1 for(i=0; i>5)&0x03E0F81F); @@ -2228,7 +2228,7 @@ static inline void RENAME(rgb16ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1 for(i=0; i>5)&0x07C0F83F); @@ -2264,7 +2264,7 @@ static inline void RENAME(rgb15ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1 for(i=0; i>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> 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 af7f86f401..db6534287e 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 72e418e8da..60cc0a4ac1 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;isrcW; + 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>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<>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<>15; */ - vx = vec_sl (V, lCSHIFT); + ux0 = vec_mergeh (ux,ux); + ux1 = vec_mergel (ux,ux); + + /* vx = (CRV*(v<>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 371dce5da2..49872234db 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 c99e019cd8..6d540a38b4 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 @@ -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 28ee24add2..2a725eee7a 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; yredDither), "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; yredDither), "r" (_py - 2*index) );