summaryrefslogtreecommitdiff
path: root/libavcodec/pngdec.c
diff options
context:
space:
mode:
authorVitor Sessak <vitor1001@gmail.com>2009-05-24 12:44:54 +0000
committerVitor Sessak <vitor1001@gmail.com>2009-05-24 12:44:54 +0000
commit09d1208cdbdf651d6f69c04e6a395f7c12c19710 (patch)
treeddb948355f09fe0e059f52a8abb621249879d1e8 /libavcodec/pngdec.c
parent46b4019bfa4294e0c7aa473ea177046e4a5b40ef (diff)
Fix unaligned dsputil call.
Should fix FATE corepng test on Solaris/Sparc. Originally committed as revision 18930 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/pngdec.c')
-rw-r--r--libavcodec/pngdec.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index bf719b2382..600953f599 100644
--- a/libavcodec/pngdec.c
+++ b/libavcodec/pngdec.c
@@ -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;