diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-10-16 05:44:00 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-10-16 06:02:09 +0400 |
commit | 2822361ed1fe18b03a35dfdbda811de6bd919e0a (patch) | |
tree | 353c0ad65fd1a4c151e2c7cb02c415f56b8e75eb /libavcodec/vp8.c | |
parent | 647ec6fc0308ccfc86ad48b1d7d20d85ddf6825c (diff) | |
parent | 91038cdbd160310174aad6833d1d08c65d850e78 (diff) |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
prores: get correct size for coded V plane if alpha is present
prores: do not set pixel format on codec init
pthread: prevent updating AVCodecContext from itself in frame_thread_free
pthread: copy coded frame dimensions in update_context_from_thread
vp8: prevent read from uninitialized memory in decode_mvs
vp8: force reallocation in update_thread_context after frame size change
vp8: fix return value if update_dimensions fails
matroskadec: fix out of bounds write
adpcmdec: calculate actual number of output samples for each decoder.
adpcmdec: check remaining buffer size before decoding next block in the ADPCM IMA WAV decoder.
adpcmdec: do not terminate early in ADPCM IMA Duck DK3 decoder.
adpcmdec: remove unneeded buf_size==0 check.
adpcmdec: remove unneeded zeroing of *data_size
dnxhdenc: fixed signed multiplication overflow
Conflicts:
tests/ref/fate/prores-alpha
tests/ref/fate/truemotion1-24
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/vp8.c')
-rw-r--r-- | libavcodec/vp8.c | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c index cea2bd7d82..2643b34d67 100644 --- a/libavcodec/vp8.c +++ b/libavcodec/vp8.c @@ -33,6 +33,19 @@ # include "arm/vp8.h" #endif +static void free_buffers(VP8Context *s) +{ + av_freep(&s->macroblocks_base); + av_freep(&s->filter_strength); + av_freep(&s->intra4x4_pred_mode_top); + av_freep(&s->top_nnz); + av_freep(&s->edge_emu_buffer); + av_freep(&s->top_border); + av_freep(&s->segmentation_map); + + s->macroblocks = NULL; +} + static void vp8_decode_flush(AVCodecContext *avctx) { VP8Context *s = avctx->priv_data; @@ -45,15 +58,7 @@ static void vp8_decode_flush(AVCodecContext *avctx) } memset(s->framep, 0, sizeof(s->framep)); - av_freep(&s->macroblocks_base); - av_freep(&s->filter_strength); - av_freep(&s->intra4x4_pred_mode_top); - av_freep(&s->top_nnz); - av_freep(&s->edge_emu_buffer); - av_freep(&s->top_border); - av_freep(&s->segmentation_map); - - s->macroblocks = NULL; + free_buffers(s); } static int update_dimensions(VP8Context *s, int width, int height) @@ -273,7 +278,7 @@ static int decode_frame_header(VP8Context *s, const uint8_t *buf, int buf_size) if (!s->macroblocks_base || /* first frame */ width != s->avctx->width || height != s->avctx->height) { - if ((ret = update_dimensions(s, width, height) < 0)) + if ((ret = update_dimensions(s, width, height)) < 0) return ret; } @@ -487,6 +492,7 @@ void decode_mvs(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y) AV_ZERO32(&near_mv[0]); AV_ZERO32(&near_mv[1]); + AV_ZERO32(&near_mv[2]); /* Process MB on top, left and top-left */ #define MV_EDGE_CHECK(n)\ @@ -1750,6 +1756,11 @@ static int vp8_decode_update_thread_context(AVCodecContext *dst, const AVCodecCo { VP8Context *s = dst->priv_data, *s_src = src->priv_data; + if (s->macroblocks_base && + (s_src->mb_width != s->mb_width || s_src->mb_height != s->mb_height)) { + free_buffers(s); + } + s->prob[0] = s_src->prob[!s_src->update_probabilities]; s->segmentation = s_src->segmentation; s->lf_delta = s_src->lf_delta; |