]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/commitdiff
Fix unaligned dsputil call.
authorvitor <vitor@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Sun, 24 May 2009 12:44:54 +0000 (12:44 +0000)
committervitor <vitor@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Sun, 24 May 2009 12:44:54 +0000 (12:44 +0000)
Should fix FATE corepng test on Solaris/Sparc.

git-svn-id: file:///var/local/repositories/ffmpeg/trunk@18930 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b

libavcodec/pngdec.c

index bf719b238229087b4456b0855d8cb75efd06634b..600953f599cc32caa230b748068d6068c1685f76 100644 (file)
@@ -387,6 +387,7 @@ static int decode_frame(AVCodecContext *avctx,
     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 @@ static int decode_frame(AVCodecContext *avctx,
                         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 @@ static int decode_frame(AVCodecContext *avctx,
     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;