30 #ifndef AVCODEC_LAGARITHRAC_H 31 #define AVCODEC_LAGARITHRAC_H 35 #include "libavutil/intreadwrite.h" 51 #define MAX_OVERREAD 4 60 static inline void lag_rac_refill(
lag_rac *l)
62 while (l->range <= 0x800000) {
65 l->low |= 0xff & (AV_RB16(l->
bytestream) >> 1);
78 static inline uint8_t lag_get_rac(
lag_rac *l)
80 unsigned range_scaled, low_scaled;
85 range_scaled = l->range >> l->
scale;
87 if (l->low < range_scaled * l->
prob[255]) {
89 if (l->low < range_scaled * l->
prob[1]) {
92 low_scaled = l->low / (range_scaled<<(l->
hash_shift));
95 while (l->low >= range_scaled * l->
prob[val + 1])
99 l->range = range_scaled * (l->
prob[val + 1] - l->
prob[val]);
102 l->range -= range_scaled * l->
prob[255];
108 l->low -= range_scaled * l->
prob[val];
const uint8_t * bytestream_end
End position of input bytestream.
Definition: lagarithrac.h:48
const uint8_t * bytestream_start
Start of input bytestream.
Definition: lagarithrac.h:46
unsigned scale
Number of bits of precision in range.
Definition: lagarithrac.h:43
bitstream reader API header.
Definition: lagarithrac.h:39
Libavcodec external API header.
uint32_t prob[258]
Table of cumulative probability for each symbol.
Definition: lagarithrac.h:53
main external API structure.
Definition: avcodec.h:1518
uint8_t range_hash[1024]
Hash table mapping upper byte to approximate symbol.
Definition: lagarithrac.h:54
Definition: get_bits.h:56
common internal and external API header
unsigned hash_shift
Number of bits to shift to calculate hash for radix search.
Definition: lagarithrac.h:44
const uint8_t * bytestream
Current position in input bytestream.
Definition: lagarithrac.h:47