aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-09-07 13:37:19 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-09-07 13:50:24 +0200
commitfa8511851090537f6898fc50d7e6cf56841cf6ab (patch)
treecc6e217fd99f5080a4726e1c74a6840962e1ff80 /libavcodec
parenta7fbc7d7b7eabc74ceb1970a995c56043315e433 (diff)
parent9afb7061f938831248942050cfdb449e014ed427 (diff)
downloadffmpeg-fa8511851090537f6898fc50d7e6cf56841cf6ab.tar.gz
Merge remote-tracking branch 'qatar/master'
* qatar/master: mov_chan: Pass a separate AVIOContext for reading af_asyncts: check return value from lavr when flushing. mss2: simplify loop in decode_rle() mss12: avoid unnecessary division in arith*_get_bit() mss2: do not try to read too many palette entries mpegvideo: set AVFrame fields to NULL after freeing the base memory configure: Set the right cc_e flags for msvc Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/mpegvideo.c3
-rw-r--r--libavcodec/mss12.h2
-rw-r--r--libavcodec/mss2.c5
3 files changed, 6 insertions, 4 deletions
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 6fe2303c03..6b3d4e7b16 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -393,13 +393,16 @@ static void free_picture(MpegEncContext *s, Picture *pic)
av_freep(&pic->mb_mean);
av_freep(&pic->f.mbskip_table);
av_freep(&pic->qscale_table_base);
+ pic->f.qscale_table = NULL;
av_freep(&pic->mb_type_base);
+ pic->f.mb_type = NULL;
av_freep(&pic->f.dct_coeff);
av_freep(&pic->f.pan_scan);
pic->f.mb_type = NULL;
for (i = 0; i < 2; i++) {
av_freep(&pic->motion_val_base[i]);
av_freep(&pic->f.ref_index[i]);
+ pic->f.motion_val[i] = NULL;
}
if (pic->f.type == FF_BUFFER_TYPE_SHARED) {
diff --git a/libavcodec/mss12.h b/libavcodec/mss12.h
index ba80030ee3..42ceab568f 100644
--- a/libavcodec/mss12.h
+++ b/libavcodec/mss12.h
@@ -103,7 +103,7 @@ av_cold int ff_mss12_decode_end(MSS12Context *ctx);
static int arith ## VERSION ## _get_bit(ArithCoder *c) \
{ \
int range = c->high - c->low + 1; \
- int bit = (((c->value - c->low) << 1) + 1) / range; \
+ int bit = 2 * c->value - c->low >= c->high; \
\
if (bit) \
c->low += range >> 1; \
diff --git a/libavcodec/mss2.c b/libavcodec/mss2.c
index fc9ebff4d7..ceb0a45fe5 100644
--- a/libavcodec/mss2.c
+++ b/libavcodec/mss2.c
@@ -161,7 +161,7 @@ static int decode_pal_v2(MSS12Context *ctx, const uint8_t *buf, int buf_size)
return 0;
ncol = *buf++;
- if (buf_size < 2 + ncol * 3)
+ if (ncol > ctx->free_colours || buf_size < 2 + ncol * 3)
return -1;
for (i = 0; i < ncol; i++)
*pal++ = AV_RB24(buf + 3 * i);
@@ -335,8 +335,7 @@ static int decode_rle(GetBitContext *gb, uint8_t *pal_dst, int pal_stride,
else
repeat = get_bits(gb, b);
- while (b--)
- repeat += 1 << b;
+ repeat += (1 << b) - 1;
if (last_symbol == -2) {
int skip = FFMIN(repeat, pal_dst + w - pp);