@ -296,10 +296,6 @@ static inline void mpeg4_encode_block(MpegEncContext * s, DCTELEM * block, int n
uint8_t * scan_table , PutBitContext * dc_pb , PutBitContext * ac_pb )
{
int i , last_non_zero ;
#if 0 //variables for the outcommented version
int code , sign , last ;
# endif
const RLTable * rl ;
uint32_t * bits_tab ;
uint8_t * len_tab ;
const int last_index = s - > block_last_index [ n ] ;
@ -309,20 +305,17 @@ static inline void mpeg4_encode_block(MpegEncContext * s, DCTELEM * block, int n
mpeg4_encode_dc ( dc_pb , intra_dc , n ) ;
if ( last_index < 1 ) return ;
i = 1 ;
rl = & ff_mpeg4_rl_intra ;
bits_tab = uni_mpeg4_intra_rl_bits ;
len_tab = uni_mpeg4_intra_rl_len ;
} else {
if ( last_index < 0 ) return ;
i = 0 ;
rl = & ff_h263_rl_inter ;
bits_tab = uni_mpeg4_inter_rl_bits ;
len_tab = uni_mpeg4_inter_rl_len ;
}
/* AC coefs */
last_non_zero = i - 1 ;
# if 1
for ( ; i < last_index ; i + + ) {
int level = block [ scan_table [ i ] ] ;
if ( level ) {
@ -348,64 +341,6 @@ static inline void mpeg4_encode_block(MpegEncContext * s, DCTELEM * block, int n
put_bits ( ac_pb , 7 + 2 + 1 + 6 + 1 + 12 + 1 , ( 3 < < 23 ) + ( 3 < < 21 ) + ( 1 < < 20 ) + ( run < < 14 ) + ( 1 < < 13 ) + ( ( ( level - 64 ) & 0xfff ) < < 1 ) + 1 ) ;
}
}
# else
for ( ; i < = last_index ; i + + ) {
const int slevel = block [ scan_table [ i ] ] ;
if ( slevel ) {
int level ;
int run = i - last_non_zero - 1 ;
last = ( i = = last_index ) ;
sign = 0 ;
level = slevel ;
if ( level < 0 ) {
sign = 1 ;
level = - level ;
}
code = get_rl_index ( rl , last , run , level ) ;
put_bits ( ac_pb , rl - > table_vlc [ code ] [ 1 ] , rl - > table_vlc [ code ] [ 0 ] ) ;
if ( code = = rl - > n ) {
int level1 , run1 ;
level1 = level - rl - > max_level [ last ] [ run ] ;
if ( level1 < 1 )
goto esc2 ;
code = get_rl_index ( rl , last , run , level1 ) ;
if ( code = = rl - > n ) {
esc2 :
put_bits ( ac_pb , 1 , 1 ) ;
if ( level > MAX_LEVEL )
goto esc3 ;
run1 = run - rl - > max_run [ last ] [ level ] - 1 ;
if ( run1 < 0 )
goto esc3 ;
code = get_rl_index ( rl , last , run1 , level ) ;
if ( code = = rl - > n ) {
esc3 :
/* third escape */
put_bits ( ac_pb , 1 , 1 ) ;
put_bits ( ac_pb , 1 , last ) ;
put_bits ( ac_pb , 6 , run ) ;
put_bits ( ac_pb , 1 , 1 ) ;
put_sbits ( ac_pb , 12 , slevel ) ;
put_bits ( ac_pb , 1 , 1 ) ;
} else {
/* second escape */
put_bits ( ac_pb , 1 , 0 ) ;
put_bits ( ac_pb , rl - > table_vlc [ code ] [ 1 ] , rl - > table_vlc [ code ] [ 0 ] ) ;
put_bits ( ac_pb , 1 , sign ) ;
}
} else {
/* first escape */
put_bits ( ac_pb , 1 , 0 ) ;
put_bits ( ac_pb , rl - > table_vlc [ code ] [ 1 ] , rl - > table_vlc [ code ] [ 0 ] ) ;
put_bits ( ac_pb , 1 , sign ) ;
}
} else {
put_bits ( ac_pb , 1 , sign ) ;
}
last_non_zero = i ;
}
}
# endif
}
static int mpeg4_get_block_length ( MpegEncContext * s , DCTELEM * block , int n , int intra_dc ,