71 static int initialized = 0;
94 static inline void renorm_cabac_encoder(
CABACContext *c){
95 while(c->
range < 0x100){
99 }
else if(c->
low<0x200){
115 if(bit == ((*state)&1)){
116 c->
range -= RangeLPS;
124 renorm_cabac_encoder(c);
139 }
else if(c->
low<0x400){
152 static int put_cabac_terminate(
CABACContext *c,
int bit){
156 renorm_cabac_encoder(c);
161 renorm_cabac_encoder(c);
164 put_cabac_bit(c, c->
low>>9);
185 for(i=0; i<
SIZE; i++){
187 else r[i] = (i>>8)&1;
190 for(i=0; i<
SIZE; i++){
191 put_cabac_bypass(&c, r[i]&1);
194 for(i=0; i<
SIZE; i++){
195 put_cabac(&c, state, r[i]&1);
198 put_cabac_terminate(&c, 1);
202 memset(state, 0,
sizeof(state));
204 for(i=0; i<
SIZE; i++){
211 for(i=0; i<
SIZE; i++){
static void put_bits(Jpeg2000EncoderContext *s, int val, int n)
put n times val bit
const uint8_t * bytestream_end
static CABAC_TABLE_CONST uint8_t *const ff_h264_mlps_state
static int av_noinline av_unused get_cabac_noinline(CABACContext *c, uint8_t *const state)
#define av_assert0(cond)
assert() equivalent, that is always enabled.
const uint8_t * bytestream
bitstream reader API header.
high precision timer, useful to profile code
static CABAC_TABLE_CONST uint8_t *const ff_h264_lps_range
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
void ff_init_cabac_states(void)
static int put_bits_count(PutBitContext *s)
const uint8_t * bytestream_start
Context Adaptive Binary Arithmetic Coder inline functions.
void ff_init_cabac_encoder(CABACContext *c, uint8_t *buf, int buf_size)
static int av_unused get_cabac_terminate(CABACContext *c)
static av_cold void cabac_tableinit(void)
static unsigned int av_lfg_get(AVLFG *c)
Get the next random unsigned 32-bit number using an ALFG.
av_cold void av_lfg_init(AVLFG *c, unsigned int seed)
static int av_unused get_cabac_bypass(CABACContext *c)
static void flush_put_bits(PutBitContext *s)
Pad the end of the output stream with zeros.
common internal and external API header
static void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size)
Initialize the PutBitContext s.
void ff_init_cabac_decoder(CABACContext *c, const uint8_t *buf, int buf_size)
int main(int argc, char **argv)
Context Adaptive Binary Arithmetic Coder.