summaryrefslogtreecommitdiff
path: root/libavcodec/mss12.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/mss12.c
parenteb239a577fcf1f19cdaa7aeb6e6586a172ee59c1 (diff)
downloadffmpeg-a97ee41bee60b2075c84e2ce6bb441304698744c.tar.gz
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/mss12.c')
-rw-r--r--libavcodec/mss12.c60
1 files changed, 29 insertions, 31 deletions
diff --git a/libavcodec/mss12.c b/libavcodec/mss12.c
index 18f2f2808f..ea127696fc 100644
--- a/libavcodec/mss12.c
+++ b/libavcodec/mss12.c
@@ -435,39 +435,30 @@ static int decode_region_masked(MSS12Context const *c, ArithCoder *acoder,
return 0;
}
-static av_cold void codec_init(MSS12Context *c, int version)
+static av_cold void slicecontext_init(SliceContext *sc,
+ int version, int full_model_syms)
{
- int i;
- for (i = 0; i < (c->slice_split ? 2 : 1); i++) {
- c->sc[i].c = c;
- model_init(&c->sc[i].intra_region, 2, THRESH_ADAPTIVE);
- model_init(&c->sc[i].inter_region, 2, THRESH_ADAPTIVE);
- model_init(&c->sc[i].split_mode, 3, THRESH_HIGH);
- model_init(&c->sc[i].edge_mode, 2, THRESH_HIGH);
- model_init(&c->sc[i].pivot, 3, THRESH_LOW);
-
- pixctx_init(&c->sc[i].intra_pix_ctx, 8, c->full_model_syms, 0);
-
- pixctx_init(&c->sc[i].inter_pix_ctx, version ? 3 : 2,
- c->full_model_syms, version ? 1 : 0);
- }
- c->corrupted = 1;
+ model_init(&sc->intra_region, 2, THRESH_ADAPTIVE);
+ model_init(&sc->inter_region, 2, THRESH_ADAPTIVE);
+ model_init(&sc->split_mode, 3, THRESH_HIGH);
+ model_init(&sc->edge_mode, 2, THRESH_HIGH);
+ model_init(&sc->pivot, 3, THRESH_LOW);
+
+ pixctx_init(&sc->intra_pix_ctx, 8, full_model_syms, 0);
+
+ pixctx_init(&sc->inter_pix_ctx, version ? 3 : 2,
+ full_model_syms, version ? 1 : 0);
}
-void ff_mss12_codec_reset(MSS12Context *c)
+void ff_mss12_slicecontext_reset(SliceContext *sc)
{
- int i;
- for (i = 0; i < (c->slice_split ? 2 : 1); i++) {
- model_reset(&c->sc[i].intra_region);
- model_reset(&c->sc[i].inter_region);
- model_reset(&c->sc[i].split_mode);
- model_reset(&c->sc[i].edge_mode);
- model_reset(&c->sc[i].pivot);
- pixctx_reset(&c->sc[i].intra_pix_ctx);
- pixctx_reset(&c->sc[i].inter_pix_ctx);
- }
-
- c->corrupted = 0;
+ model_reset(&sc->intra_region);
+ model_reset(&sc->inter_region);
+ model_reset(&sc->split_mode);
+ model_reset(&sc->edge_mode);
+ model_reset(&sc->pivot);
+ pixctx_reset(&sc->intra_pix_ctx);
+ pixctx_reset(&sc->inter_pix_ctx);
}
static int decode_pivot(SliceContext *sc, ArithCoder *acoder, int base)
@@ -595,7 +586,8 @@ int ff_mss12_decode_rect(SliceContext *sc, ArithCoder *acoder,
return 0;
}
-av_cold int ff_mss12_decode_init(MSS12Context *c, int version)
+av_cold int ff_mss12_decode_init(MSS12Context *c, int version,
+ SliceContext* sc1, SliceContext *sc2)
{
AVCodecContext *avctx = c->avctx;
int i;
@@ -690,7 +682,13 @@ av_cold int ff_mss12_decode_init(MSS12Context *c, int version)
return AVERROR(ENOMEM);
}
- codec_init(c, version);
+ sc1->c = c;
+ slicecontext_init(sc1, version, c->full_model_syms);
+ if (c->slice_split) {
+ sc2->c = c;
+ slicecontext_init(sc2, version, c->full_model_syms);
+ }
+ c->corrupted = 1;
return 0;
}