22 #if (AC_representation_bitsize <= 15) 25 #define AC_PRI_I_t PRId16 26 #define AC_PRI_long_I_t PRId32 28 #elif (AC_representation_bitsize <= 31) 32 #define AC_PRI_I_t PRId32 33 #define AC_PRI_long_I_t PRId64 36 #elif (AC_representation_bitsize <= 63) 39 #define AC_PRI_I_t PRId64 40 #define AC_PRI_long_I_t PRId128 //this does not exist... 43 #error "ARITHMETIC CODEC says: too many bits" 49 #define AC_PRI_F_t AC_PRI_I_t 133 #ifdef AC_QUARTER_ZOOM 233 output_callback_t output_callback_ = NULL);
239 const F_t * cum_freq = NULL);
257 output_callback_t output_callback;
264 output_callback_t bit_callback;
267 input_callback_t read_bit_call;
276 const F_t * cum_freq,
284 const F_t * cum_freq,
290 int output_symbol_standard(
300 output_callback_t output_callback_ = NULL ,
304 input_callback_t read_bit_call_ = NULL ,
306 output_callback_t bit_callback_ = NULL
316 F_t
const * cum_freq = NULL,
331 void input_bit(
int bit);
348 void prepare_for_deflush();
359 void freq2cum_freq(F_t cum_freq[], F_t freq[],
int max_symb,
int assert_non_zero);
I_t Blow
B-interval left extreme.
Definition: arith_code.hh:172
std::function< void(int, void *)> output_callback_t
type for callbacks
Definition: arith_code.hh:57
unsigned int number_input_symbols()
number of symbols inserted in the state
Definition: arith_code.cc:160
int virtual_bit
Definition: arith_code.hh:137
I_t max_symbol
if the output callback is used in decoding, then the "cumulative_frequencies" and "max_symbol" must b...
Definition: arith_code.hh:110
void output_bits(output_callback_t out)
outputs multiple bits, returns them using a callback (if not null; else they are lost) ...
Definition: arith_code.cc:251
void push_bit(int bit)
put bit in B-interval
Definition: arith_code.cc:317
void doubleit()
Definition: arith_code.cc:139
I_t interval_left(int symb, const F_t *cum_freq)
left extreme of a S-sub-interval
Definition: arith_code.cc:290
interval_t S_interval()
return the S_interval
Definition: arith_code.cc:182
Definition: arith_code.hh:66
const I_t Top
representation of 1
Definition: arith_code.hh:142
unsigned int n_out_bits
number of bits extracted from the state
Definition: arith_code.hh:207
long_I_t Srange
S-interval width.
Definition: arith_code.hh:169
#define AC_representation_bitsize
the number of bits to represent the intervals
Definition: arith_code_config.hh:21
F_t const * cum_freq_flush
special cumulative table used for flushing
Definition: arith_code.hh:159
unsigned int n_in_symbs
number of symbols inserted in the state
Definition: arith_code.hh:207
void doublehi()
Definition: arith_code.cc:140
const I_t ThreeQtr
representation of 3/4
Definition: arith_code.hh:150
F_t * cumulative_frequencies
if the output callback is used in decoding, then the "cumulative_frequencies" and "max_symbol" must b...
Definition: arith_code.hh:105
unsigned int n_zooms
number of zooms
Definition: arith_code.hh:207
unsigned int number_input_bits()
number of bits inserted in the state
Definition: arith_code.cc:157
output_callback_t output_callback
callback when the encoder encodes a symbo
Definition: arith_code.hh:228
FILE * verbose_stream
Definition: arith_code.hh:74
unsigned int significant_bits
significant bits (used in the decoder)
Definition: arith_code.hh:204
F_t const cum_freq_uniform8[9]
cumulative tables of 8 equidistributed symbols
Definition: arith_code.hh:153
int resize_pull_one_bit()
returns 0 , 1 or -1 if no bit can be pulled at this moment ; resize S-interval and B-interval accordi...
Definition: arith_code.cc:190
const I_t One
Definition: arith_code.hh:140
F_t * frequencies
if the output callback is used in decoding, then the "cumulative_frequencies" and "max_symbol" must b...
Definition: arith_code.hh:116
void * callback_data
Definition: arith_code.hh:127
const I_t Qtr
representation of 1/4
Definition: arith_code.hh:144
I_t separ_low_high(int symb, const F_t *cum_freq)
divides Slow - Shigh in subintervals : returns the beginning of each interval; note that intervals ar...
Definition: arith_code.cc:277
I_t Bhigh
B-interval right extreme.
Definition: arith_code.hh:174
void frequencies2cumulative_frequencies()
if the output callback is used in decoding, then the "cumulative_frequencies" and "max_symbol" must b...
Definition: arith_code.cc:332
void freq2cum_freq(F_t cum_freq[], F_t freq[], int max_symb, int assert_non_zero=1)
computes the cumulative cum_freq given the frequencies of symbols
Definition: arith_code.cc:644
uint64_t long_I_t
Definition: arith_code.hh:30
const I_t MAX_FREQ
the sum of all frequencies of symbols cannot exceed this value
Definition: arith_code.hh:51
I_t Slow
S-interval left extreme.
Definition: arith_code.hh:165
uint32_t I_t
types for variables defining intervals
Definition: arith_code.hh:29
I_t Shigh
S-interval right extreme (included in the interval)
Definition: arith_code.hh:167
Definition: arith_code.hh:224
const I_t Half
Representation of 3/4.
Definition: arith_code.hh:148
Definition: arith_code.hh:250
std::pair< I_t, I_t > interval_t
struct to represent an interval
Definition: arith_code.hh:54
interval_t B_interval()
return the B_interval
Definition: arith_code.cc:186
void push_symbol(int symb, const F_t *cum_freq)
put symbol in S-interval by splitting it and choosing a subinterval, proportional to the frequencies ...
Definition: arith_code.cc:295
Base()
Definition: arith_code.cc:145
Definition: arith_code.cc:25
const I_t QtrMinus
representation of point preceding 1/4
Definition: arith_code.hh:146
void doublelow()
Definition: arith_code.cc:141
I_t F_t
types for variables defining frequencies
Definition: arith_code.hh:47
unsigned int n_out_symbs
number of symbols extracted from the state
Definition: arith_code.hh:207
unsigned int bitsToFollow
Definition: arith_code.hh:135
static const int n_symbols_flush
how many symbols in the special cumulative table used for flushing
Definition: arith_code.hh:156
int output_bit()
outputs one bit from the state, if available, else -1
Definition: arith_code.cc:222
void doublecen()
Definition: arith_code.cc:142
unsigned int n_in_bits
number of bits inserted in the state
Definition: arith_code.hh:207
unsigned int number_output_symbols()
number of symbols extracted from the state
Definition: arith_code.cc:166
unsigned int number_output_bits()
number of bits extracted from the state
Definition: arith_code.cc:163
void print_state()
print the internal state
Definition: arith_code.cc:169
std::function< int(void *)> input_callback_t
type for bit reader call
Definition: arith_code.hh:60
I_t interval_right(int symb, const F_t *cum_freq)
right extreme of a S-sub-interval ; note that symbols start from 0 here
Definition: arith_code.cc:286
const char * prefix
name of the class, for printing
Definition: arith_code.hh:70