diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-09-04 17:04:51 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-09-04 17:04:51 +0200 |
commit | 9dcc4c30f9d8ef70d3c07b4a77fdc507e8766107 (patch) | |
tree | ae6bb70dcf614bfbf032b5fe4ac4f712777cd0c3 /libavcodec/mss2.c | |
parent | 9de7622927b1b0ec6f8045b17b3116f046f44b87 (diff) | |
parent | b36f87ff90d87687f574d51385f47bb98d14600a (diff) | |
download | ffmpeg-9dcc4c30f9d8ef70d3c07b4a77fdc507e8766107.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
configure: add support for bdver1 and bdver2 CPU types.
avio: make avio_close NULL the freed buffer
pixdesc: cosmetics
proresenc: Don't free a buffer not owned by the codec
proresenc: Write the full value in one put_bits call
adpcmenc: Calculate the IMA_QT predictor without overflow
x86: Add convenience macros to check for CPU extensions and flags
x86: h264dsp: drop some unnecessary ifdefs around prototype declarations
mss12: merge decode_pixel() and decode_top_left_pixel()
mss12: reduce SliceContext size from 1067 to 164 KB
mss12: move SliceContexts out of the common context into the codec contexts
Conflicts:
libavformat/aviobuf.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/mss2.c')
-rw-r--r-- | libavcodec/mss2.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/libavcodec/mss2.c b/libavcodec/mss2.c index 886da05540..fc9ebff4d7 100644 --- a/libavcodec/mss2.c +++ b/libavcodec/mss2.c @@ -106,7 +106,7 @@ static int arith2_get_number(ArithCoder *c, int n) return val; } -static int arith2_get_prob(ArithCoder *c, int *probs) +static int arith2_get_prob(ArithCoder *c, int16_t *probs) { int range = c->high - c->low + 1, n = *probs; int scale = av_log2(range) - av_log2(n); @@ -671,14 +671,18 @@ static int mss2_decode_frame(AVCodecContext *avctx, void *data, int *data_size, buf += get_bits_count(&gb) >> 3; buf_size -= get_bits_count(&gb) >> 3; } else { - if (keyframe) - ff_mss12_codec_reset(c); + if (keyframe) { + c->corrupted = 0; + ff_mss12_slicecontext_reset(&ctx->sc[0]); + if (c->slice_split) + ff_mss12_slicecontext_reset(&ctx->sc[1]); + } else if (c->corrupted) return AVERROR_INVALIDDATA; bytestream2_init(&gB, buf, buf_size + ARITH2_PADDING); arith2_init(&acoder, &gB); c->keyframe = keyframe; - if (c->corrupted = ff_mss12_decode_rect(&c->sc[0], &acoder, 0, 0, + if (c->corrupted = ff_mss12_decode_rect(&ctx->sc[0], &acoder, 0, 0, avctx->width, ctx->split_position)) return AVERROR_INVALIDDATA; @@ -690,7 +694,7 @@ static int mss2_decode_frame(AVCodecContext *avctx, void *data, int *data_size, return AVERROR_INVALIDDATA; bytestream2_init(&gB, buf, buf_size + ARITH2_PADDING); arith2_init(&acoder, &gB); - if (c->corrupted = ff_mss12_decode_rect(&c->sc[1], &acoder, 0, + if (c->corrupted = ff_mss12_decode_rect(&ctx->sc[1], &acoder, 0, ctx->split_position, avctx->width, avctx->height - ctx->split_position)) @@ -830,7 +834,7 @@ static av_cold int mss2_decode_init(AVCodecContext *avctx) int ret; c->avctx = avctx; avctx->coded_frame = &ctx->pic; - if (ret = ff_mss12_decode_init(c, 1)) + if (ret = ff_mss12_decode_init(c, 1, &ctx->sc[0], &ctx->sc[1])) return ret; c->pal_stride = c->mask_stride; c->pal_pic = av_malloc(c->pal_stride * avctx->height); |