@ -248,67 +248,6 @@ static int put_cabac_terminate(CABACContext *c, int bit){
return ( put_bits_count ( & c - > pb ) + 7 ) > > 3 ;
}
/**
* put ( truncated ) unary binarization .
*/
static void put_cabac_u ( CABACContext * c , uint8_t * state , int v , int max , int max_index , int truncated ) {
int i ;
assert ( v < = max ) ;
for ( i = 0 ; i < v ; i + + ) {
put_cabac ( c , state , 1 ) ;
if ( i < max_index ) state + + ;
}
if ( truncated = = 0 | | v < max )
put_cabac ( c , state , 0 ) ;
}
/**
* put unary exp golomb k - th order binarization .
*/
static void put_cabac_ueg ( CABACContext * c , uint8_t * state , int v , int max , int is_signed , int k , int max_index ) {
int i ;
if ( v = = 0 )
put_cabac ( c , state , 0 ) ;
else {
const int sign = v < 0 ;
if ( is_signed ) v = FFABS ( v ) ;
if ( v < max ) {
for ( i = 0 ; i < v ; i + + ) {
put_cabac ( c , state , 1 ) ;
if ( i < max_index ) state + + ;
}
put_cabac ( c , state , 0 ) ;
} else {
int m = 1 < < k ;
for ( i = 0 ; i < max ; i + + ) {
put_cabac ( c , state , 1 ) ;
if ( i < max_index ) state + + ;
}
v - = max ;
while ( v > = m ) { //FIXME optimize
put_cabac_bypass ( c , 1 ) ;
v - = m ;
m + = m ;
}
put_cabac_bypass ( c , 0 ) ;
while ( m > > = 1 ) {
put_cabac_bypass ( c , v & m ) ;
}
}
if ( is_signed )
put_cabac_bypass ( c , sign ) ;
}
}
int main ( void ) {
CABACContext c ;
uint8_t b [ 9 * SIZE ] ;
@ -337,18 +276,6 @@ START_TIMER
STOP_TIMER ( " put_cabac " )
}
for ( i = 0 ; i < SIZE ; i + + ) {
START_TIMER
put_cabac_u ( & c , state , r [ i ] , 6 , 3 , i & 1 ) ;
STOP_TIMER ( " put_cabac_u " )
}
for ( i = 0 ; i < SIZE ; i + + ) {
START_TIMER
put_cabac_ueg ( & c , state , r [ i ] , 3 , 0 , 1 , 2 ) ;
STOP_TIMER ( " put_cabac_ueg " )
}
put_cabac_terminate ( & c , 1 ) ;
ff_init_cabac_decoder ( & c , b , SIZE ) ;