[FFmpeg-cvslog] Fix destination row striding in altivec_yuv2_bgr24.

Pavel Koshevoy git at videolan.org
Fri Jul 6 17:44:40 CEST 2012


ffmpeg | branch: master | Pavel Koshevoy <pkoshevoy at gmail.com> | Thu Jul  5 17:00:59 2012 -0600| [665100c2f1b72d6b3dd89a448b69fab73d344f5d] | committer: Michael Niedermayer

Fix destination row striding in altivec_yuv2_bgr24.

Misaligned row artifacts showed up when a 624x352 frame was converted
to BGR24 format.  When advancing to the next row the destination linesize
was added to the last output pointer position which was not linesize aligned,
resulting in a distorted picture.

Signed-off-by: Pavel Koshevoy <pavel at apple.aragog.com>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libswscale/ppc/yuv2rgb_altivec.c |   13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/libswscale/ppc/yuv2rgb_altivec.c b/libswscale/ppc/yuv2rgb_altivec.c
index 5c2e2c8..fba4162 100644
--- a/libswscale/ppc/yuv2rgb_altivec.c
+++ b/libswscale/ppc/yuv2rgb_altivec.c
@@ -317,12 +317,7 @@ static int altivec_ ## name(SwsContext *c, const unsigned char **in,          \
     const ubyte *ui  = in[1];                                                 \
     const 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]);         \
+    vector unsigned char *oute, *outo;                                        \
                                                                               \
     /* loop moves y{1, 2}i by w */                                            \
     instrides_scl[0] = instrides[0] * 2 - w;                                  \
@@ -332,6 +327,9 @@ static int altivec_ ## name(SwsContext *c, const unsigned char **in,          \
     instrides_scl[2] = instrides[2] - w / 2;                                  \
                                                                               \
     for (i = 0; i < h / 2; i++) {                                             \
+        oute = (vector unsigned char *)(oplanes[0] + outstrides[0] *          \
+                                        (srcSliceY + i * 2));                 \
+        outo = oute + (outstrides[0] >> 4);                                   \
         vec_dstst(outo, (0x02000002 | (((w * 3 + 32) / 32) << 16)), 0);       \
         vec_dstst(oute, (0x02000002 | (((w * 3 + 32) / 32) << 16)), 1);       \
                                                                               \
@@ -429,9 +427,6 @@ static int altivec_ ## name(SwsContext *c, const unsigned char **in,          \
             vi  += 8;                                                         \
         }                                                                     \
                                                                               \
-        outo += (outstrides[0]) >> 4;                                         \
-        oute += (outstrides[0]) >> 4;                                         \
-                                                                              \
         ui  += instrides_scl[1];                                              \
         vi  += instrides_scl[2];                                              \
         y1i += instrides_scl[0];                                              \



More information about the ffmpeg-cvslog mailing list