X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Flagarithrac.h;h=3b30b15e12c7f5bd26ff57d20f4604c6f663c593;hb=81bffae368f331b6cd386a814f225a58e3f32f40;hp=6a8fa95a8e7220435eb9341f538cf4eac0cbaa86;hpb=f25a2ece76756214da7dcde4a52a0534d9503319;p=ffmpeg diff --git a/libavcodec/lagarithrac.h b/libavcodec/lagarithrac.h index 6a8fa95a8e7..3b30b15e12c 100644 --- a/libavcodec/lagarithrac.h +++ b/libavcodec/lagarithrac.h @@ -31,27 +31,29 @@ #define AVCODEC_LAGARITHRAC_H #include + #include "libavutil/common.h" #include "libavutil/intreadwrite.h" + #include "avcodec.h" -#include "get_bits.h" +#include "bitstream.h" typedef struct lag_rac { AVCodecContext *avctx; unsigned low; unsigned range; - unsigned scale; /*!< Number of bits of precision in range. */ - unsigned hash_shift; /*!< Number of bits to shift to calculate hash for radix search. */ + unsigned scale; /**< Number of bits of precision in range. */ + unsigned hash_shift; /**< Number of bits to shift to calculate hash for radix search. */ - const uint8_t *bytestream_start; /*!< Start of input bytestream. */ - const uint8_t *bytestream; /*!< Current position in input bytestream. */ - const uint8_t *bytestream_end; /*!< End position of input bytestream. */ + const uint8_t *bytestream_start; /**< Start of input bytestream. */ + const uint8_t *bytestream; /**< Current position in input bytestream. */ + const uint8_t *bytestream_end; /**< End position of input bytestream. */ - uint32_t prob[258]; /*!< Table of cumulative probability for each symbol. */ - uint8_t range_hash[256]; /*!< Hash table mapping upper byte to approximate symbol. */ + uint32_t prob[258]; /**< Table of cumulative probability for each symbol. */ + uint8_t range_hash[256]; /**< Hash table mapping upper byte to approximate symbol. */ } lag_rac; -void lag_rac_init(lag_rac *l, GetBitContext *gb, int length); +void ff_lag_rac_init(lag_rac *l, BitstreamContext *bc, int length); /* TODO: Optimize */ static inline void lag_rac_refill(lag_rac *l) @@ -107,6 +109,9 @@ static inline uint8_t lag_get_rac(lag_rac *l) l->range -= range_scaled * l->prob[255]; } + if (!l->range) + l->range = 0x80; + l->low -= range_scaled * l->prob[val]; return val;