|
|
|
@@ -62,31 +62,6 @@ void ff_init_cabac_decoder(CABACContext *c, const uint8_t *buf, int buf_size); |
|
|
|
void ff_init_cabac_states(CABACContext *c); |
|
|
|
|
|
|
|
|
|
|
|
static inline void put_cabac_bit(CABACContext *c, int b){ |
|
|
|
put_bits(&c->pb, 1, b); |
|
|
|
for(;c->outstanding_count; c->outstanding_count--){ |
|
|
|
put_bits(&c->pb, 1, 1-b); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
static inline void renorm_cabac_encoder(CABACContext *c){ |
|
|
|
while(c->range < 0x100){ |
|
|
|
//FIXME optimize |
|
|
|
if(c->low<0x100){ |
|
|
|
put_cabac_bit(c, 0); |
|
|
|
}else if(c->low<0x200){ |
|
|
|
c->outstanding_count++; |
|
|
|
c->low -= 0x100; |
|
|
|
}else{ |
|
|
|
put_cabac_bit(c, 1); |
|
|
|
c->low -= 0x200; |
|
|
|
} |
|
|
|
|
|
|
|
c->range+= c->range; |
|
|
|
c->low += c->low; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
static void refill(CABACContext *c){ |
|
|
|
#if CABAC_BITS == 16 |
|
|
|
c->low+= (c->bytestream[0]<<9) + (c->bytestream[1]<<1); |
|
|
|
|