changeset 9703:05cf2547e0f0 libavcodec

Fix unaligned dsputil call. Should fix FATE corepng test on Solaris/Sparc.
author vitor
date Sun, 24 May 2009 12:44:54 +0000
parents 3dcbde0de577
children dc3c984a1c1a
files pngdec.c
diffstat 1 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/pngdec.c	Sun May 24 09:14:19 2009 +0000
+++ b/pngdec.c	Sun May 24 12:44:54 2009 +0000
@@ -387,6 +387,7 @@
     PNGDecContext * const s = avctx->priv_data;
     AVFrame *picture = data;
     AVFrame *p;
+    uint8_t *crow_buf_base = NULL;
     uint32_t tag, length;
     int ret, crc;
 
@@ -527,9 +528,12 @@
                         goto fail;
                 }
                 /* compressed row */
-                s->crow_buf = av_malloc(s->row_size + 1);
-                if (!s->crow_buf)
+                crow_buf_base = av_malloc(s->row_size + 16);
+                if (!crow_buf_base)
                     goto fail;
+
+                /* we want crow_buf+1 to be 16-byte aligned */
+                s->crow_buf = crow_buf_base + 15;
                 s->zstream.avail_out = s->crow_size;
                 s->zstream.next_out = s->crow_buf;
             }
@@ -612,7 +616,8 @@
     ret = s->bytestream - s->bytestream_start;
  the_end:
     inflateEnd(&s->zstream);
-    av_freep(&s->crow_buf);
+    av_free(crow_buf_base);
+    s->crow_buf = NULL;
     av_freep(&s->last_row);
     av_freep(&s->tmp_row);
     return ret;