summaryrefslogtreecommitdiff
path: root/libavcodec/mss2.c
diff options
context:
space:
mode:
authorAlberto Delmás <adelmas@gmail.com>2012-09-02 12:42:01 +0200
committerKostya Shishkov <kostya.shishkov@gmail.com>2012-09-03 14:39:19 +0200
commita97ee41bee60b2075c84e2ce6bb441304698744c (patch)
tree4b615750c961e97d1f959e82e248ecb09bf67fda /libavcodec/mss2.c
parenteb239a577fcf1f19cdaa7aeb6e6586a172ee59c1 (diff)
mss12: move SliceContexts out of the common context into the codec contexts
Signed-off-by: Kostya Shishkov <kostya.shishkov@gmail.com>
Diffstat (limited to 'libavcodec/mss2.c')
-rw-r--r--libavcodec/mss2.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/libavcodec/mss2.c b/libavcodec/mss2.c
index 2a0bf47cde..e4c854a01e 100644
--- a/libavcodec/mss2.c
+++ b/libavcodec/mss2.c
@@ -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);