From 4bb1070c154e49d35805fbcdac9c9e92f702ef96 Mon Sep 17 00:00:00 2001 From: Vittorio Giovara Date: Sun, 15 Nov 2015 23:26:07 +0100 Subject: ffv1: Explicitly name the coder type FFv1 uses two types of coders, golomb and range with two different tables. This is exposed this in a rather convoluted way, for example mentioning to set coder type 1 while initializing the variable 'ac' to 2, because encoder does not use range coder with default table. Appropriate internal coder type values have been added and used in any check rather than using raw numbers. Initialization of avctx.coder_type in ffv1dec is removed because this field is encoder only. An unneeded validation check in the encoder is dropped too. Signed-off-by: Vittorio Giovara --- libavcodec/ffv1.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'libavcodec/ffv1.c') diff --git a/libavcodec/ffv1.c b/libavcodec/ffv1.c index 0836d42012..3a6c7fac16 100644 --- a/libavcodec/ffv1.c +++ b/libavcodec/ffv1.c @@ -160,7 +160,7 @@ int ffv1_init_slice_state(FFV1Context *f, FFV1Context *fs) for (j = 0; j < f->plane_count; j++) { PlaneContext *const p = &fs->plane[j]; - if (fs->ac) { + if (fs->ac != AC_GOLOMB_RICE) { if (!p->state) p->state = av_malloc(CONTEXT_SIZE * p->context_count * sizeof(uint8_t)); @@ -174,7 +174,7 @@ int ffv1_init_slice_state(FFV1Context *f, FFV1Context *fs) } } - if (fs->ac > 1) { + if (fs->ac == AC_RANGE_CUSTOM_TAB) { //FIXME only redo if state_transition changed for (j = 1; j < 256; j++) { fs->c.one_state[j] = f->state_transition[j]; @@ -257,7 +257,7 @@ void ffv1_clear_slice_state(FFV1Context *f, FFV1Context *fs) p->interlace_bit_state[0] = 128; p->interlace_bit_state[1] = 128; - if (fs->ac) { + if (fs->ac != AC_GOLOMB_RICE) { if (f->initial_states[p->quant_table_index]) { memcpy(p->state, f->initial_states[p->quant_table_index], CONTEXT_SIZE * p->context_count); -- cgit v1.2.3