avcodec/ffv1: Support >8bit rice golomb

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2024-10-16 18:49:31 +02:00
parent 967e5e8f6f
commit a5c0ed2122
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64
2 changed files with 4 additions and 4 deletions

View File

@ -54,8 +54,8 @@
#define AC_RANGE_DEFAULT_TAB_FORCE -2
typedef struct VlcState {
uint32_t error_sum;
int16_t drift;
uint16_t error_sum;
int8_t bias;
uint8_t count;
} VlcState;

View File

@ -248,7 +248,7 @@ static inline void put_vlc_symbol(PutBitContext *pb, VlcState *const state,
i += i;
}
av_assert2(k <= 13);
av_assert2(k <= 16);
code = v ^ ((2 * state->drift + state->count) >> 31);
@ -707,10 +707,10 @@ static av_cold int encode_init(AVCodecContext *avctx)
}
av_assert0(s->bits_per_raw_sample >= 8);
if (s->bits_per_raw_sample > 8) {
if (s->bits_per_raw_sample > (s->version > 3 ? 16 : 8)) {
if (s->ac == AC_GOLOMB_RICE) {
av_log(avctx, AV_LOG_INFO,
"bits_per_raw_sample > 8, forcing range coder\n");
"high bits_per_raw_sample, forcing range coder\n");
s->ac = AC_RANGE_CUSTOM_TAB;
}
}