diff options
author | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2009-03-14 23:52:45 +0200 |
---|---|---|
committer | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2009-03-14 23:52:45 +0200 |
commit | ae2faad6669c313b7a5dd318baeee0bffdd47031 (patch) | |
tree | 0b383b5dde56d54be4b144e7e23e96bd8bdd43cf /libswscale | |
parent | b93f4b7bba0e31d157b74685d3166f74a6c244d7 (diff) | |
parent | 642162c07460e439d1d81cda4643dc028ed238e0 (diff) | |
download | mpv-ae2faad6669c313b7a5dd318baeee0bffdd47031.tar.bz2 mpv-ae2faad6669c313b7a5dd318baeee0bffdd47031.tar.xz |
Merge svn changes up to r28951
Diffstat (limited to 'libswscale')
-rw-r--r-- | libswscale/swscale.c | 16 | ||||
-rw-r--r-- | libswscale/swscale_internal.h | 1 | ||||
-rw-r--r-- | libswscale/swscale_template.c | 38 |
3 files changed, 29 insertions, 26 deletions
diff --git a/libswscale/swscale.c b/libswscale/swscale.c index c0f4b97684..c6012c15b7 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -1622,7 +1622,7 @@ static void initMMX2HScaler(int dstW, int xInc, uint8_t *funnyCode, int16_t *fil } xpos+=xInc; } - filterPos[i/2]= xpos>>16; // needed to jump to the next part + filterPos[((i/2)+1)&(~1)]= xpos>>16; // needed to jump to the next part } #endif /* COMPILE_MMX2 */ @@ -2726,7 +2726,7 @@ SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat, int d int sws_scale(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t* dst[], int dstStride[]){ int i; - uint8_t* src2[4]= {src[0], src[1], src[2]}; + uint8_t* src2[4]= {src[0], src[1], src[2], src[3]}; if (c->sliceDir == 0 && srcSliceY != 0 && srcSliceY + srcSliceH != c->srcH) { av_log(c, AV_LOG_ERROR, "Slices start in the middle!\n"); @@ -2800,21 +2800,23 @@ int sws_scale(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, // copy strides, so they can safely be modified if (c->sliceDir == 1) { // slices go from top to bottom - int srcStride2[4]= {srcStride[0], srcStride[1], srcStride[2]}; - int dstStride2[4]= {dstStride[0], dstStride[1], dstStride[2]}; + int srcStride2[4]= {srcStride[0], srcStride[1], srcStride[2], srcStride[3]}; + int dstStride2[4]= {dstStride[0], dstStride[1], dstStride[2], dstStride[3]}; return c->swScale(c, src2, srcStride2, srcSliceY, srcSliceH, dst, dstStride2); } else { // slices go from bottom to top => we flip the image internally uint8_t* dst2[4]= {dst[0] + (c->dstH-1)*dstStride[0], dst[1] + ((c->dstH>>c->chrDstVSubSample)-1)*dstStride[1], - dst[2] + ((c->dstH>>c->chrDstVSubSample)-1)*dstStride[2]}; - int srcStride2[4]= {-srcStride[0], -srcStride[1], -srcStride[2]}; - int dstStride2[4]= {-dstStride[0], -dstStride[1], -dstStride[2]}; + dst[2] + ((c->dstH>>c->chrDstVSubSample)-1)*dstStride[2], + dst[3] + (c->dstH-1)*dstStride[3]}; + int srcStride2[4]= {-srcStride[0], -srcStride[1], -srcStride[2], -srcStride[3]}; + int dstStride2[4]= {-dstStride[0], -dstStride[1], -dstStride[2], -dstStride[3]}; src2[0] += (srcSliceH-1)*srcStride[0]; if (!usePal(c->srcFormat)) src2[1] += ((srcSliceH>>c->chrSrcVSubSample)-1)*srcStride[1]; src2[2] += ((srcSliceH>>c->chrSrcVSubSample)-1)*srcStride[2]; + src2[3] += (srcSliceH-1)*srcStride[3]; return c->swScale(c, src2, srcStride2, c->srcH-srcSliceY-srcSliceH, srcSliceH, dst2, dstStride2); } diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h index cdf3754d14..13b9609060 100644 --- a/libswscale/swscale_internal.h +++ b/libswscale/swscale_internal.h @@ -228,6 +228,7 @@ const char *sws_format_name(int format); #define isPlanarYUV(x) ( \ (x)==PIX_FMT_YUV410P \ || (x)==PIX_FMT_YUV420P \ + || (x)==PIX_FMT_YUVA420P \ || (x)==PIX_FMT_YUV411P \ || (x)==PIX_FMT_YUV422P \ || (x)==PIX_FMT_YUV444P \ diff --git a/libswscale/swscale_template.c b/libswscale/swscale_template.c index 6f2e243052..80704f6eb6 100644 --- a/libswscale/swscale_template.c +++ b/libswscale/swscale_template.c @@ -230,28 +230,28 @@ "test %%"REG_S", %%"REG_S" \n\t"\ " jnz 2b \n\t"\ -#define YSCALEYUV2PACKEDX_YA(offset) \ +#define YSCALEYUV2PACKEDX_YA(offset,coeff,src1,src2,dst1,dst2) \ "lea "offset"(%0), %%"REG_d" \n\t"\ "mov (%%"REG_d"), %%"REG_S" \n\t"\ - "movq "VROUNDER_OFFSET"(%0), %%mm1 \n\t"\ - "movq %%mm1, %%mm7 \n\t"\ + "movq "VROUNDER_OFFSET"(%0), "#dst1" \n\t"\ + "movq "#dst1", "#dst2" \n\t"\ ASMALIGN(4)\ "2: \n\t"\ - "movq 8(%%"REG_d"), %%mm0 \n\t" /* filterCoeff */\ - "movq (%%"REG_S", %%"REG_a", 2), %%mm2 \n\t" /* Y1srcData */\ - "movq 8(%%"REG_S", %%"REG_a", 2), %%mm5 \n\t" /* Y2srcData */\ + "movq 8(%%"REG_d"), "#coeff" \n\t" /* filterCoeff */\ + "movq (%%"REG_S", %%"REG_a", 2), "#src1" \n\t" /* Y1srcData */\ + "movq 8(%%"REG_S", %%"REG_a", 2), "#src2" \n\t" /* Y2srcData */\ "add $16, %%"REG_d" \n\t"\ "mov (%%"REG_d"), %%"REG_S" \n\t"\ - "pmulhw %%mm0, %%mm2 \n\t"\ - "pmulhw %%mm0, %%mm5 \n\t"\ - "paddw %%mm2, %%mm1 \n\t"\ - "paddw %%mm5, %%mm7 \n\t"\ + "pmulhw "#coeff", "#src1" \n\t"\ + "pmulhw "#coeff", "#src2" \n\t"\ + "paddw "#src1", "#dst1" \n\t"\ + "paddw "#src2", "#dst2" \n\t"\ "test %%"REG_S", %%"REG_S" \n\t"\ " jnz 2b \n\t"\ #define YSCALEYUV2PACKEDX \ YSCALEYUV2PACKEDX_UV \ - YSCALEYUV2PACKEDX_YA(LUM_MMX_FILTER_OFFSET) \ + YSCALEYUV2PACKEDX_YA(LUM_MMX_FILTER_OFFSET,%%mm0,%%mm2,%%mm5,%%mm1,%%mm7) \ #define YSCALEYUV2PACKEDX_END \ :: "r" (&c->redDither), \ @@ -458,11 +458,11 @@ "pmulhw "VG_COEFF"("#c"), %%mm4 \n\t"\ /* mm2=(U-128)8, mm3=ug, mm4=vg mm5=(V-128)8 */\ -#define REAL_YSCALEYUV2RGB_YA(index, c) \ - "movq (%0, "#index", 2), %%mm0 \n\t" /*buf0[eax]*/\ - "movq (%1, "#index", 2), %%mm1 \n\t" /*buf1[eax]*/\ - "movq 8(%0, "#index", 2), %%mm6 \n\t" /*buf0[eax]*/\ - "movq 8(%1, "#index", 2), %%mm7 \n\t" /*buf1[eax]*/\ +#define REAL_YSCALEYUV2RGB_YA(index, c, b1, b2) \ + "movq ("#b1", "#index", 2), %%mm0 \n\t" /*buf0[eax]*/\ + "movq ("#b2", "#index", 2), %%mm1 \n\t" /*buf1[eax]*/\ + "movq 8("#b1", "#index", 2), %%mm6 \n\t" /*buf0[eax]*/\ + "movq 8("#b2", "#index", 2), %%mm7 \n\t" /*buf1[eax]*/\ "psubw %%mm1, %%mm0 \n\t" /* buf0[eax] - buf1[eax]*/\ "psubw %%mm7, %%mm6 \n\t" /* buf0[eax] - buf1[eax]*/\ "pmulhw "LUM_MMX_FILTER_OFFSET"+8("#c"), %%mm0 \n\t" /* (buf0[eax] - buf1[eax])yalpha1>>16*/\ @@ -501,11 +501,11 @@ "packuswb %%mm6, %%mm5 \n\t"\ "packuswb %%mm3, %%mm4 \n\t"\ -#define YSCALEYUV2RGB_YA(index, c) REAL_YSCALEYUV2RGB_YA(index, c) +#define YSCALEYUV2RGB_YA(index, c, b1, b2) REAL_YSCALEYUV2RGB_YA(index, c, b1, b2) #define YSCALEYUV2RGB(index, c) \ REAL_YSCALEYUV2RGB_UV(index, c) \ - REAL_YSCALEYUV2RGB_YA(index, c) \ + REAL_YSCALEYUV2RGB_YA(index, c, %0, %1) \ REAL_YSCALEYUV2RGB_COEFF(c) #define REAL_YSCALEYUV2PACKED1(index, c) \ @@ -1663,7 +1663,7 @@ static inline void RENAME(name ## _half)(uint8_t *dstU, uint8_t *dstV, uint8_t * {\ int pix0= ((type*)src)[2*i+0];\ int pix1= ((type*)src)[2*i+1];\ - int g= (pix0&(maskg|maska))+(pix1&(maskg|maska));\ + int g= (pix0&~(maskr|maskb))+(pix1&~(maskr|maskb));\ int b= ((pix0+pix1-g)&(maskb|(2*maskb)))>>shb;\ int r= ((pix0+pix1-g)&(maskr|(2*maskr)))>>shr;\ g&= maskg|(2*maskg);\ |