Originally committed as revision 25777 to svn://svn.mplayerhq.hu/mplayer/trunk/libswscaletags/v0.5
| @@ -53,7 +53,7 @@ | |||||
| #define PREFETCH "prefetch" | #define PREFETCH "prefetch" | ||||
| #define PREFETCHW "prefetchw" | #define PREFETCHW "prefetchw" | ||||
| #define PAVGB "pavgusb" | #define PAVGB "pavgusb" | ||||
| #elif defined ( HAVE_MMX2 ) | |||||
| #elif defined (HAVE_MMX2) | |||||
| #define PREFETCH "prefetchnta" | #define PREFETCH "prefetchnta" | ||||
| #define PREFETCHW "prefetcht0" | #define PREFETCHW "prefetcht0" | ||||
| #define PAVGB "pavgb" | #define PAVGB "pavgb" | ||||
| @@ -1727,7 +1727,7 @@ static inline void RENAME(yuvPlanartouyvy)(const uint8_t *ysrc, const uint8_t *u | |||||
| } | } | ||||
| #endif | #endif | ||||
| #endif | #endif | ||||
| if ((y&(vertLumPerChroma-1))==(vertLumPerChroma-1) ) | |||||
| if ((y&(vertLumPerChroma-1))==(vertLumPerChroma-1)) | |||||
| { | { | ||||
| usrc += chromStride; | usrc += chromStride; | ||||
| vsrc += chromStride; | vsrc += chromStride; | ||||
| @@ -217,13 +217,13 @@ int main(int argc, char **argv){ | |||||
| #else | #else | ||||
| sws_rgb2rgb_init(0); | sws_rgb2rgb_init(0); | ||||
| #endif | #endif | ||||
| sws_scale(sws, rgb_src, rgb_stride, 0, H , src, stride); | |||||
| sws_scale(sws, rgb_src, rgb_stride, 0, H, src, stride); | |||||
| #if defined(ARCH_X86) | #if defined(ARCH_X86) | ||||
| asm volatile ("emms\n\t"); | asm volatile ("emms\n\t"); | ||||
| #endif | #endif | ||||
| selfTest(src, stride, W, H); | |||||
| selfTest(src, stride, W, H); | |||||
| return 123; | return 123; | ||||
| } | } | ||||
| @@ -1597,9 +1597,9 @@ static int PlanarToNV12Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], i | |||||
| } | } | ||||
| dst = dstParam[1] + dstStride[1]*srcSliceY/2; | dst = dstParam[1] + dstStride[1]*srcSliceY/2; | ||||
| if (c->dstFormat == PIX_FMT_NV12) | if (c->dstFormat == PIX_FMT_NV12) | ||||
| interleaveBytes( src[1],src[2],dst,c->srcW/2,srcSliceH/2,srcStride[1],srcStride[2],dstStride[0] ); | |||||
| interleaveBytes(src[1],src[2],dst,c->srcW/2,srcSliceH/2,srcStride[1],srcStride[2],dstStride[0]); | |||||
| else | else | ||||
| interleaveBytes( src[2],src[1],dst,c->srcW/2,srcSliceH/2,srcStride[2],srcStride[1],dstStride[0] ); | |||||
| interleaveBytes(src[2],src[1],dst,c->srcW/2,srcSliceH/2,srcStride[2],srcStride[1],dstStride[0]); | |||||
| return srcSliceH; | return srcSliceH; | ||||
| } | } | ||||
| @@ -1608,7 +1608,7 @@ static int PlanarToYuy2Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], i | |||||
| int srcSliceH, uint8_t* dstParam[], int dstStride[]){ | int srcSliceH, uint8_t* dstParam[], int dstStride[]){ | ||||
| uint8_t *dst=dstParam[0] + dstStride[0]*srcSliceY; | uint8_t *dst=dstParam[0] + dstStride[0]*srcSliceY; | ||||
| yv12toyuy2( src[0],src[1],src[2],dst,c->srcW,srcSliceH,srcStride[0],srcStride[1],dstStride[0] ); | |||||
| yv12toyuy2(src[0],src[1],src[2],dst,c->srcW,srcSliceH,srcStride[0],srcStride[1],dstStride[0]); | |||||
| return srcSliceH; | return srcSliceH; | ||||
| } | } | ||||
| @@ -1617,7 +1617,7 @@ static int PlanarToUyvyWrapper(SwsContext *c, uint8_t* src[], int srcStride[], i | |||||
| int srcSliceH, uint8_t* dstParam[], int dstStride[]){ | int srcSliceH, uint8_t* dstParam[], int dstStride[]){ | ||||
| uint8_t *dst=dstParam[0] + dstStride[0]*srcSliceY; | uint8_t *dst=dstParam[0] + dstStride[0]*srcSliceY; | ||||
| yv12touyvy( src[0],src[1],src[2],dst,c->srcW,srcSliceH,srcStride[0],srcStride[1],dstStride[0] ); | |||||
| yv12touyvy(src[0],src[1],src[2],dst,c->srcW,srcSliceH,srcStride[0],srcStride[1],dstStride[0]); | |||||
| return srcSliceH; | return srcSliceH; | ||||
| } | } | ||||
| @@ -2158,7 +2158,7 @@ SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, int dstW, int dstH | |||||
| } | } | ||||
| #endif | #endif | ||||
| if ( srcFormat==PIX_FMT_YUV410P && dstFormat==PIX_FMT_YUV420P ) | |||||
| if (srcFormat==PIX_FMT_YUV410P && dstFormat==PIX_FMT_YUV420P) | |||||
| { | { | ||||
| c->swScale= yvu9toyv12Wrapper; | c->swScale= yvu9toyv12Wrapper; | ||||
| } | } | ||||
| @@ -2214,7 +2214,7 @@ SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, int dstW, int dstH | |||||
| /* simple copy */ | /* simple copy */ | ||||
| if ( srcFormat == dstFormat | if ( srcFormat == dstFormat | ||||
| || (isPlanarYUV(srcFormat) && isGray(dstFormat)) | || (isPlanarYUV(srcFormat) && isGray(dstFormat)) | ||||
| || (isPlanarYUV(dstFormat) && isGray(srcFormat)) ) | |||||
| || (isPlanarYUV(dstFormat) && isGray(srcFormat))) | |||||
| { | { | ||||
| c->swScale= simpleCopy; | c->swScale= simpleCopy; | ||||
| } | } | ||||
| @@ -2373,7 +2373,7 @@ SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, int dstW, int dstH | |||||
| nextSlice>>= c->chrSrcVSubSample; | nextSlice>>= c->chrSrcVSubSample; | ||||
| nextSlice<<= c->chrSrcVSubSample; | nextSlice<<= c->chrSrcVSubSample; | ||||
| if (c->vLumFilterPos[i ] + c->vLumBufSize < nextSlice) | if (c->vLumFilterPos[i ] + c->vLumBufSize < nextSlice) | ||||
| c->vLumBufSize= nextSlice - c->vLumFilterPos[i ]; | |||||
| c->vLumBufSize= nextSlice - c->vLumFilterPos[i]; | |||||
| if (c->vChrFilterPos[chrI] + c->vChrBufSize < (nextSlice>>c->chrSrcVSubSample)) | if (c->vChrFilterPos[chrI] + c->vChrBufSize < (nextSlice>>c->chrSrcVSubSample)) | ||||
| c->vChrBufSize= (nextSlice>>c->chrSrcVSubSample) - c->vChrFilterPos[chrI]; | c->vChrBufSize= (nextSlice>>c->chrSrcVSubSample) - c->vChrFilterPos[chrI]; | ||||
| } | } | ||||
| @@ -2657,7 +2657,7 @@ SwsVector *sws_getGaussianVec(double variance, double quality){ | |||||
| for (i=0; i<length; i++) | for (i=0; i<length; i++) | ||||
| { | { | ||||
| double dist= i-middle; | double dist= i-middle; | ||||
| coeff[i]= exp( -dist*dist/(2*variance*variance) ) / sqrt(2*variance*PI); | |||||
| coeff[i]= exp(-dist*dist/(2*variance*variance)) / sqrt(2*variance*PI); | |||||
| } | } | ||||
| sws_normalizeVec(vec, 1.0); | sws_normalizeVec(vec, 1.0); | ||||
| @@ -387,7 +387,7 @@ static inline void hScale_altivec_real(int16_t *dst, int dstW, uint8_t *src, int | |||||
| static inline int yv12toyuy2_unscaled_altivec(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, | static inline int yv12toyuy2_unscaled_altivec(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, | ||||
| int srcSliceH, uint8_t* dstParam[], int dstStride_a[]) { | int srcSliceH, uint8_t* dstParam[], int dstStride_a[]) { | ||||
| uint8_t *dst=dstParam[0] + dstStride_a[0]*srcSliceY; | uint8_t *dst=dstParam[0] + dstStride_a[0]*srcSliceY; | ||||
| // yv12toyuy2( src[0],src[1],src[2],dst,c->srcW,srcSliceH,srcStride[0],srcStride[1],dstStride[0] ); | |||||
| // yv12toyuy2(src[0],src[1],src[2],dst,c->srcW,srcSliceH,srcStride[0],srcStride[1],dstStride[0]); | |||||
| uint8_t *ysrc = src[0]; | uint8_t *ysrc = src[0]; | ||||
| uint8_t *usrc = src[1]; | uint8_t *usrc = src[1]; | ||||
| uint8_t *vsrc = src[2]; | uint8_t *vsrc = src[2]; | ||||
| @@ -401,7 +401,7 @@ static inline int yv12toyuy2_unscaled_altivec(SwsContext *c, uint8_t* src[], int | |||||
| register unsigned int y; | register unsigned int y; | ||||
| if (width&15) { | if (width&15) { | ||||
| yv12toyuy2( ysrc, usrc, vsrc, dst,c->srcW,srcSliceH, lumStride, chromStride, dstStride); | |||||
| yv12toyuy2(ysrc, usrc, vsrc, dst,c->srcW,srcSliceH, lumStride, chromStride, dstStride); | |||||
| return srcSliceH; | return srcSliceH; | ||||
| } | } | ||||
| @@ -450,7 +450,7 @@ static inline int yv12toyuy2_unscaled_altivec(SwsContext *c, uint8_t* src[], int | |||||
| vec_st(v_yuy2_0, (i << 1), dst); | vec_st(v_yuy2_0, (i << 1), dst); | ||||
| vec_st(v_yuy2_1, (i << 1) + 16, dst); | vec_st(v_yuy2_1, (i << 1) + 16, dst); | ||||
| } | } | ||||
| if ( (y&(vertLumPerChroma-1))==(vertLumPerChroma-1) ) { | |||||
| if ((y&(vertLumPerChroma-1))==(vertLumPerChroma-1)) { | |||||
| usrc += chromStride; | usrc += chromStride; | ||||
| vsrc += chromStride; | vsrc += chromStride; | ||||
| } | } | ||||
| @@ -464,7 +464,7 @@ static inline int yv12toyuy2_unscaled_altivec(SwsContext *c, uint8_t* src[], int | |||||
| static inline int yv12touyvy_unscaled_altivec(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, | static inline int yv12touyvy_unscaled_altivec(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, | ||||
| int srcSliceH, uint8_t* dstParam[], int dstStride_a[]) { | int srcSliceH, uint8_t* dstParam[], int dstStride_a[]) { | ||||
| uint8_t *dst=dstParam[0] + dstStride_a[0]*srcSliceY; | uint8_t *dst=dstParam[0] + dstStride_a[0]*srcSliceY; | ||||
| // yv12toyuy2( src[0],src[1],src[2],dst,c->srcW,srcSliceH,srcStride[0],srcStride[1],dstStride[0] ); | |||||
| // yv12toyuy2(src[0],src[1],src[2],dst,c->srcW,srcSliceH,srcStride[0],srcStride[1],dstStride[0]); | |||||
| uint8_t *ysrc = src[0]; | uint8_t *ysrc = src[0]; | ||||
| uint8_t *usrc = src[1]; | uint8_t *usrc = src[1]; | ||||
| uint8_t *vsrc = src[2]; | uint8_t *vsrc = src[2]; | ||||
| @@ -478,7 +478,7 @@ static inline int yv12touyvy_unscaled_altivec(SwsContext *c, uint8_t* src[], int | |||||
| register unsigned int y; | register unsigned int y; | ||||
| if (width&15) { | if (width&15) { | ||||
| yv12touyvy( ysrc, usrc, vsrc, dst,c->srcW,srcSliceH, lumStride, chromStride, dstStride); | |||||
| yv12touyvy(ysrc, usrc, vsrc, dst,c->srcW,srcSliceH, lumStride, chromStride, dstStride); | |||||
| return srcSliceH; | return srcSliceH; | ||||
| } | } | ||||
| @@ -527,7 +527,7 @@ static inline int yv12touyvy_unscaled_altivec(SwsContext *c, uint8_t* src[], int | |||||
| vec_st(v_uyvy_0, (i << 1), dst); | vec_st(v_uyvy_0, (i << 1), dst); | ||||
| vec_st(v_uyvy_1, (i << 1) + 16, dst); | vec_st(v_uyvy_1, (i << 1) + 16, dst); | ||||
| } | } | ||||
| if ( (y&(vertLumPerChroma-1))==(vertLumPerChroma-1) ) { | |||||
| if ((y&(vertLumPerChroma-1))==(vertLumPerChroma-1)) { | |||||
| usrc += chromStride; | usrc += chromStride; | ||||
| vsrc += chromStride; | vsrc += chromStride; | ||||
| } | } | ||||
| @@ -39,7 +39,7 @@ | |||||
| #ifdef HAVE_3DNOW | #ifdef HAVE_3DNOW | ||||
| #define PREFETCH "prefetch" | #define PREFETCH "prefetch" | ||||
| #define PREFETCHW "prefetchw" | #define PREFETCHW "prefetchw" | ||||
| #elif defined ( HAVE_MMX2 ) | |||||
| #elif defined (HAVE_MMX2) | |||||
| #define PREFETCH "prefetchnta" | #define PREFETCH "prefetchnta" | ||||
| #define PREFETCHW "prefetcht0" | #define PREFETCHW "prefetcht0" | ||||
| #else | #else | ||||
| @@ -1513,7 +1513,7 @@ static inline void RENAME(yuv2packed1)(SwsContext *c, uint16_t *buf0, uint16_t * | |||||
| } | } | ||||
| #ifdef HAVE_MMX | #ifdef HAVE_MMX | ||||
| if ( uvalpha < 2048 ) // note this is not correct (shifts chrominance by 0.5 pixels) but it is a bit faster | |||||
| if (uvalpha < 2048) // note this is not correct (shifts chrominance by 0.5 pixels) but it is a bit faster | |||||
| { | { | ||||
| switch(dstFormat) | switch(dstFormat) | ||||
| { | { | ||||
| @@ -1692,7 +1692,7 @@ static inline void RENAME(yuv2packed1)(SwsContext *c, uint16_t *buf0, uint16_t * | |||||
| } | } | ||||
| } | } | ||||
| #endif /* HAVE_MMX */ | #endif /* HAVE_MMX */ | ||||
| if ( uvalpha < 2048 ) | |||||
| if (uvalpha < 2048) | |||||
| { | { | ||||
| YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGB1_C, YSCALE_YUV_2_PACKED1_C) | YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGB1_C, YSCALE_YUV_2_PACKED1_C) | ||||
| }else{ | }else{ | ||||
| @@ -1831,7 +1831,7 @@ static inline void RENAME(bgr32ToY)(uint8_t *dst, uint8_t *src, int width) | |||||
| int g= (((uint32_t*)src)[i]>>8)&0xFF; | int g= (((uint32_t*)src)[i]>>8)&0xFF; | ||||
| int r= (((uint32_t*)src)[i]>>16)&0xFF; | int r= (((uint32_t*)src)[i]>>16)&0xFF; | ||||
| dst[i]= ((RY*r + GY*g + BY*b + (33<<(RGB2YUV_SHIFT-1)) )>>RGB2YUV_SHIFT); | |||||
| dst[i]= ((RY*r + GY*g + BY*b + (33<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT); | |||||
| } | } | ||||
| } | } | ||||
| @@ -1934,7 +1934,7 @@ static inline void RENAME(bgr24ToY)(uint8_t *dst, uint8_t *src, long width) | |||||
| int g= src[i*3+1]; | int g= src[i*3+1]; | ||||
| int r= src[i*3+2]; | int r= src[i*3+2]; | ||||
| dst[i]= ((RY*r + GY*g + BY*b + (33<<(RGB2YUV_SHIFT-1)) )>>RGB2YUV_SHIFT); | |||||
| dst[i]= ((RY*r + GY*g + BY*b + (33<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT); | |||||
| } | } | ||||
| #endif /* HAVE_MMX */ | #endif /* HAVE_MMX */ | ||||
| } | } | ||||
| @@ -2155,7 +2155,7 @@ static inline void RENAME(rgb32ToY)(uint8_t *dst, uint8_t *src, int width) | |||||
| int g= (((uint32_t*)src)[i]>>8)&0xFF; | int g= (((uint32_t*)src)[i]>>8)&0xFF; | ||||
| int b= (((uint32_t*)src)[i]>>16)&0xFF; | int b= (((uint32_t*)src)[i]>>16)&0xFF; | ||||
| dst[i]= ((RY*r + GY*g + BY*b + (33<<(RGB2YUV_SHIFT-1)) )>>RGB2YUV_SHIFT); | |||||
| dst[i]= ((RY*r + GY*g + BY*b + (33<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT); | |||||
| } | } | ||||
| } | } | ||||
| @@ -2187,7 +2187,7 @@ static inline void RENAME(rgb24ToY)(uint8_t *dst, uint8_t *src, int width) | |||||
| int g= src[i*3+1]; | int g= src[i*3+1]; | ||||
| int b= src[i*3+2]; | int b= src[i*3+2]; | ||||
| dst[i]= ((RY*r + GY*g + BY*b + (33<<(RGB2YUV_SHIFT-1)) )>>RGB2YUV_SHIFT); | |||||
| dst[i]= ((RY*r + GY*g + BY*b + (33<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT); | |||||
| } | } | ||||
| } | } | ||||
| @@ -2891,7 +2891,7 @@ FUNNY_UV_CODE | |||||
| /* GCC-3.3 makes MPlayer crash on IA-32 machines when using "g" operand here, | /* GCC-3.3 makes MPlayer crash on IA-32 machines when using "g" operand here, | ||||
| which is needed to support GCC-4.0 */ | which is needed to support GCC-4.0 */ | ||||
| #if defined(ARCH_X86_64) && ((__GNUC__ > 3) || ( __GNUC__ == 3 && __GNUC_MINOR__ >= 4)) | |||||
| #if defined(ARCH_X86_64) && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) | |||||
| :: "m" (src1), "m" (dst), "g" ((long)dstWidth), "m" (xInc_shr16), "m" (xInc_mask), | :: "m" (src1), "m" (dst), "g" ((long)dstWidth), "m" (xInc_shr16), "m" (xInc_mask), | ||||
| #else | #else | ||||
| :: "m" (src1), "m" (dst), "m" ((long)dstWidth), "m" (xInc_shr16), "m" (xInc_mask), | :: "m" (src1), "m" (dst), "m" ((long)dstWidth), "m" (xInc_shr16), "m" (xInc_mask), | ||||
| @@ -3077,8 +3077,8 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s | |||||
| lastInChrBuf++; | lastInChrBuf++; | ||||
| } | } | ||||
| //wrap buf index around to stay inside the ring buffer | //wrap buf index around to stay inside the ring buffer | ||||
| if (lumBufIndex >= vLumBufSize ) lumBufIndex-= vLumBufSize; | |||||
| if (chrBufIndex >= vChrBufSize ) chrBufIndex-= vChrBufSize; | |||||
| if (lumBufIndex >= vLumBufSize) lumBufIndex-= vLumBufSize; | |||||
| if (chrBufIndex >= vChrBufSize) chrBufIndex-= vChrBufSize; | |||||
| } | } | ||||
| else // not enough lines left in this slice -> load the rest in the buffer | else // not enough lines left in this slice -> load the rest in the buffer | ||||
| { | { | ||||
| @@ -3118,8 +3118,8 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s | |||||
| lastInChrBuf++; | lastInChrBuf++; | ||||
| } | } | ||||
| //wrap buf index around to stay inside the ring buffer | //wrap buf index around to stay inside the ring buffer | ||||
| if (lumBufIndex >= vLumBufSize ) lumBufIndex-= vLumBufSize; | |||||
| if (chrBufIndex >= vChrBufSize ) chrBufIndex-= vChrBufSize; | |||||
| if (lumBufIndex >= vLumBufSize) lumBufIndex-= vLumBufSize; | |||||
| if (chrBufIndex >= vChrBufSize) chrBufIndex-= vChrBufSize; | |||||
| break; //we can't output a dstY line so let's try with the next slice | break; //we can't output a dstY line so let's try with the next slice | ||||
| } | } | ||||
| @@ -762,7 +762,7 @@ void yuv2rgb_altivec_init_tables (SwsContext *c, const int inv_table[4],int brig | |||||
| vector signed short vec; | vector signed short vec; | ||||
| } buf; | } buf; | ||||
| buf.tmp[0] = ( (0xffffLL) * contrast>>8 )>>9; //cy | |||||
| buf.tmp[0] = ((0xffffLL) * contrast>>8)>>9; //cy | |||||
| buf.tmp[1] = -256*brightness; //oy | buf.tmp[1] = -256*brightness; //oy | ||||
| buf.tmp[2] = (inv_table[0]>>3) *(contrast>>16)*(saturation>>16); //crv | buf.tmp[2] = (inv_table[0]>>3) *(contrast>>16)*(saturation>>16); //crv | ||||
| buf.tmp[3] = (inv_table[1]>>3) *(contrast>>16)*(saturation>>16); //cbu | buf.tmp[3] = (inv_table[1]>>3) *(contrast>>16)*(saturation>>16); //cbu | ||||