[FFmpeg-cvslog] swscale: Commits that could not be pulled earlier due to bugs #2

Michael Niedermayer git at videolan.org
Sun May 29 03:46:47 CEST 2011


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Fri May 27 23:50:06 2011 +0200| [39d607e5bbc25ad9629683702b510e865434ef21] | committer: Michael Niedermayer

swscale: Commits that could not be pulled earlier due to bugs #2

commit 5a5a0f161359ca6c3fd03eac88a57bd026b8bc1d
Author: Diego Biurrun <diego at biurrun.de>
Date:   Fri May 27 19:46:39 2011 +0200

    swscale: Remove unused variables in x86 code.

    libswscale/x86/swscale_template.c:2072: warning: unused variable ‘canMMX2BeUsed’
    libswscale/x86/swscale_template.c:2145: warning: unused variable ‘canMMX2BeUsed’
    libswscale/x86/swscale_template.c:2209: warning: unused variable ‘chrVPixBuf’
    libswscale/x86/swscale_template.c:2237: warning: unused variable ‘chrVSrcPtr’

commit 389e2000ebc299b9da24f7e5faf9a68a88f9ee7c
Author: Ronald S. Bultje <rsbultje at gmail.com>
Date:   Fri May 27 12:23:32 2011 -0400

    swscale: delay allocation of formatConvBuffer().

    That means it won't be allocated when not needed. Alongside
    this, it fixes valgrind/fate-detected memory leaks.

commit f327bfa6dcdbce4593213c30a328d8aaf7a4b86b
Author: Ronald S. Bultje <rsbultje at gmail.com>
Date:   Fri May 27 11:36:43 2011 -0400

    swscale: fix build with --disable-swscale-alpha.

commit 9f5d45025e8df9d5f39832caad16b94cb6ac11c5
Author: Ronald S. Bultje <rsbultje at gmail.com>
Date:   Fri May 27 09:28:38 2011 -0400

    swscale: fix non-bitexact yuv2yuv[X2]() MMX/MMX2 functions.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=39d607e5bbc25ad9629683702b510e865434ef21
---

 libswscale/utils.c                |    2 +-
 libswscale/x86/swscale_template.c |   14 ++++++--------
 libswscale/x86/yuv2rgb_mmx.c      |    8 ++++----
 3 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/libswscale/utils.c b/libswscale/utils.c
index 20cc3f1..96d6efb 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -795,7 +795,6 @@ int sws_init_context(SwsContext *c, SwsFilter *srcFilter, SwsFilter *dstFilter)
                srcW, srcH, dstW, dstH);
         return AVERROR(EINVAL);
     }
-    FF_ALLOC_OR_GOTO(c, c->formatConvBuffer, FFALIGN(srcW*2+78, 16) * 2, fail);
 
     if (!dstFilter) dstFilter= &dummyFilter;
     if (!srcFilter) srcFilter= &dummyFilter;
@@ -851,6 +850,7 @@ int sws_init_context(SwsContext *c, SwsFilter *srcFilter, SwsFilter *dstFilter)
         }
     }
 
+    FF_ALLOC_OR_GOTO(c, c->formatConvBuffer, FFALIGN(srcW*2+78, 16) * 2, fail);
     if (HAVE_MMX2 && cpu_flags & AV_CPU_FLAG_MMX2) {
         c->canMMX2BeUsed= (dstW >=srcW && (dstW&31)==0 && (srcW&15)==0) ? 1 : 0;
         if (!c->canMMX2BeUsed && dstW >=srcW && (srcW&15)==0 && (flags&SWS_FAST_BILINEAR)) {
diff --git a/libswscale/x86/swscale_template.c b/libswscale/x86/swscale_template.c
index 0e8c381..bb35693 100644
--- a/libswscale/x86/swscale_template.c
+++ b/libswscale/x86/swscale_template.c
@@ -59,7 +59,7 @@
         "psraw                               $3, %%mm3      \n\t"\
         "psraw                               $3, %%mm4      \n\t"\
         "packuswb                         %%mm4, %%mm3      \n\t"\
-        MOVNTQ(%%mm3, (%1, %%REGa))\
+        MOVNTQ(%%mm3, (%1, %3))\
         "add                                 $8, %3         \n\t"\
         "cmp                                 %2, %3         \n\t"\
         "movq             "VROUNDER_OFFSET"(%0), %%mm3      \n\t"\
@@ -81,8 +81,9 @@ static inline void RENAME(yuv2yuvX)(SwsContext *c, const int16_t *lumFilter,
                                     uint8_t *aDest, long dstW, long chrDstW)
 {
     if (uDest) {
+        x86_reg uv_off = c->uv_off;
         YSCALEYUV2YV12X(CHR_MMX_FILTER_OFFSET, uDest, chrDstW, 0)
-        YSCALEYUV2YV12X(CHR_MMX_FILTER_OFFSET, vDest, chrDstW + c->uv_off, c->uv_off)
+        YSCALEYUV2YV12X(CHR_MMX_FILTER_OFFSET, vDest - uv_off, chrDstW + uv_off, uv_off)
     }
     if (CONFIG_SWSCALE_ALPHA && aDest) {
         YSCALEYUV2YV12X(ALP_MMX_FILTER_OFFSET, aDest, dstW, 0)
@@ -137,7 +138,7 @@ static inline void RENAME(yuv2yuvX)(SwsContext *c, const int16_t *lumFilter,
         "psraw                               $3, %%mm4      \n\t"\
         "psraw                               $3, %%mm6      \n\t"\
         "packuswb                         %%mm6, %%mm4      \n\t"\
-        MOVNTQ(%%mm4, (%1, %%REGa))\
+        MOVNTQ(%%mm4, (%1, %3))\
         "add                                 $8, %3         \n\t"\
         "cmp                                 %2, %3         \n\t"\
         "lea                     " offset "(%0), %%"REG_d"  \n\t"\
@@ -161,8 +162,9 @@ static inline void RENAME(yuv2yuvX_ar)(SwsContext *c, const int16_t *lumFilter,
                                        uint8_t *aDest, long dstW, long chrDstW)
 {
     if (uDest) {
+        x86_reg uv_off = c->uv_off;
         YSCALEYUV2YV12X_ACCURATE(CHR_MMX_FILTER_OFFSET, uDest, chrDstW, 0)
-        YSCALEYUV2YV12X_ACCURATE(CHR_MMX_FILTER_OFFSET, vDest, chrDstW + c->uv_off, c->uv_off)
+        YSCALEYUV2YV12X_ACCURATE(CHR_MMX_FILTER_OFFSET, vDest - uv_off, chrDstW + uv_off, uv_off)
     }
     if (CONFIG_SWSCALE_ALPHA && aDest) {
         YSCALEYUV2YV12X_ACCURATE(ALP_MMX_FILTER_OFFSET, aDest, dstW, 0)
@@ -2223,7 +2225,6 @@ static inline void RENAME(hyscale_fast)(SwsContext *c, int16_t *dst,
 {
     int32_t *filterPos = c->hLumFilterPos;
     int16_t *filter    = c->hLumFilter;
-    int     canMMX2BeUsed  = c->canMMX2BeUsed;
     void    *mmx2FilterCode= c->lumMmx2FilterCode;
     int i;
 #if defined(PIC)
@@ -2296,7 +2297,6 @@ static inline void RENAME(hcscale_fast)(SwsContext *c, int16_t *dst1, int16_t *d
 {
     int32_t *filterPos = c->hChrFilterPos;
     int16_t *filter    = c->hChrFilter;
-    int     canMMX2BeUsed  = c->canMMX2BeUsed;
     void    *mmx2FilterCode= c->chrMmx2FilterCode;
     int i;
 #if defined(PIC)
@@ -2362,7 +2362,6 @@ static void updateMMXDitherTables(SwsContext *c, int dstY, int lumBufIndex, int
     const int flags= c->flags;
     int16_t **lumPixBuf= c->lumPixBuf;
     int16_t **chrUPixBuf= c->chrUPixBuf;
-    int16_t **chrVPixBuf= c->chrVPixBuf;
     int16_t **alpPixBuf= c->alpPixBuf;
     const int vLumBufSize= c->vLumBufSize;
     const int vChrBufSize= c->vChrBufSize;
@@ -2388,7 +2387,6 @@ static void updateMMXDitherTables(SwsContext *c, int dstY, int lumBufIndex, int
     if (dstY < dstH - 2) {
         const int16_t **lumSrcPtr= (const int16_t **) lumPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize;
         const int16_t **chrUSrcPtr= (const int16_t **) chrUPixBuf + chrBufIndex + firstChrSrcY - lastInChrBuf + vChrBufSize;
-        const int16_t **chrVSrcPtr= (const int16_t **) chrVPixBuf + chrBufIndex + firstChrSrcY - lastInChrBuf + vChrBufSize;
         const int16_t **alpSrcPtr= (CONFIG_SWSCALE_ALPHA && alpPixBuf) ? (const int16_t **) alpPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize : NULL;
         int i;
         if (flags & SWS_ACCURATE_RND) {
diff --git a/libswscale/x86/yuv2rgb_mmx.c b/libswscale/x86/yuv2rgb_mmx.c
index 855a825..d46d512 100644
--- a/libswscale/x86/yuv2rgb_mmx.c
+++ b/libswscale/x86/yuv2rgb_mmx.c
@@ -82,15 +82,15 @@ SwsFunc ff_yuv2rgb_init_mmx(SwsContext *c)
     if (HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) {
         switch (c->dstFormat) {
             case PIX_FMT_RGB32:
-                if (CONFIG_SWSCALE_ALPHA && c->srcFormat == PIX_FMT_YUVA420P) {
-#if HAVE_7REGS
+                if (c->srcFormat == PIX_FMT_YUVA420P) {
+#if HAVE_7REGS && CONFIG_SWSCALE_ALPHA
                     return yuva420_rgb32_MMX;
 #endif
                     break;
                 } else return yuv420_rgb32_MMX;
             case PIX_FMT_BGR32:
-                if (CONFIG_SWSCALE_ALPHA && c->srcFormat == PIX_FMT_YUVA420P) {
-#if HAVE_7REGS
+                if (c->srcFormat == PIX_FMT_YUVA420P) {
+#if HAVE_7REGS && CONFIG_SWSCALE_ALPHA
                     return yuva420_bgr32_MMX;
 #endif
                     break;



More information about the ffmpeg-cvslog mailing list