typedef struct MSS1Context {
MSS12Context ctx;
AVFrame pic;
- SliceContext sc[2];
+ SliceContext sc;
} MSS1Context;
static void arith_normalise(ArithCoder *c)
return val;
}
-static int arith_get_prob(ArithCoder *c, int *probs)
+static int arith_get_prob(ArithCoder *c, int16_t *probs)
{
int range = c->high - c->low + 1;
int val = ((c->value - c->low + 1) * probs[0] - 1) / range;
return !!ncol;
}
-static int mss1_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
+static int mss1_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
c->pal_stride = -ctx->pic.linesize[0];
c->keyframe = !arith_get_bit(&acoder);
if (c->keyframe) {
- ff_mss12_codec_reset(c);
+ c->corrupted = 0;
+ ff_mss12_slicecontext_reset(&ctx->sc);
pal_changed = decode_pal(c, &acoder);
ctx->pic.key_frame = 1;
ctx->pic.pict_type = AV_PICTURE_TYPE_I;
ctx->pic.key_frame = 0;
ctx->pic.pict_type = AV_PICTURE_TYPE_P;
}
- c->corrupted = ff_mss12_decode_rect(&c->sc[0], &acoder, 0, 0,
+ c->corrupted = ff_mss12_decode_rect(&ctx->sc, &acoder, 0, 0,
avctx->width, avctx->height);
if (c->corrupted)
return AVERROR_INVALIDDATA;
memcpy(ctx->pic.data[1], c->pal, AVPALETTE_SIZE);
ctx->pic.palette_has_changed = pal_changed;
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame*)data = ctx->pic;
/* always report that the buffer was completely consumed */
c->ctx.avctx = avctx;
avctx->coded_frame = &c->pic;
- ret = ff_mss12_decode_init(&c->ctx, 0);
+ ret = ff_mss12_decode_init(&c->ctx, 0, &c->sc, NULL);
- avctx->pix_fmt = PIX_FMT_PAL8;
+ avctx->pix_fmt = AV_PIX_FMT_PAL8;
return ret;
}