Loading lib_enc/ACcontextMapping_enc_fx.c +63 −59 Original line number Diff line number Diff line Loading @@ -16,6 +16,9 @@ #include "prot_fx_enc.h" #include "ivas_prot.h" /* Range coder header file */ #define MAKE_NUMBER_QX(number,QX) ((number)<<(QX)) #define MAKE_VARIABLE_QX(variable,QX) W_shl(W_deposit32_l(L_deposit_l(( variable) ) ), (QX)) /*-------------------------------------------------------------------* * ACcontextMapping_encode2_no_mem_s17_LC_fx() * Loading Loading @@ -1669,10 +1672,9 @@ Word16 RCcontextMapping_encode2_estimate_bandWise_start_fx( move16(); } hContextMem->bit_estimate_fx = 2; /* Q0 */ move32(); hContextMem->bit_estimate_e = Q31; move16(); hContextMem->bit_estimate_accu = MAKE_NUMBER_QX(2, Q23 ); move64(); /* Init */ Loading @@ -1682,18 +1684,21 @@ Word16 RCcontextMapping_encode2_estimate_bandWise_start_fx( /* bits to encode lastnz */ k = 1; move16(); i = 2; move16(); WHILE( LT_16( k, hContextMem->nt_half ) ) { hContextMem->bit_estimate_fx = L_add( hContextMem->bit_estimate_fx, 1 ); /* exp(bit_estimate_e) */ move32(); hContextMem->bit_estimate_accu = W_add( hContextMem->bit_estimate_accu, MAKE_NUMBER_QX(1, Q23 ) ); move64(); k = shl( k, 1 ); i = add( i, 1 ); /* check while condition */ } /* bits to encode lastnz */ hContextMem->nbits_old = extract_l( hContextMem->bit_estimate_fx ); /* Q0 */ hContextMem->nbits_old = i; move16(); hContextMem->ctx = 0; Loading @@ -1713,14 +1718,8 @@ Word16 RCcontextMapping_encode2_estimate_bandWise_start_fx( BREAK; } } Word16 tmp2 = extract_l( hContextMem->bit_estimate_fx ); Word16 tmp = norm_l( hContextMem->bit_estimate_fx ); hContextMem->bit_estimate_e = sub( Q31, tmp ); move16(); hContextMem->bit_estimate_fx = L_shl( hContextMem->bit_estimate_fx, tmp ); /* exp(bit_estimate_e) */ move32(); return tmp2; return hContextMem->nbits_old; } /*-------------------------------------------------------------------* Loading Loading @@ -1777,8 +1776,9 @@ Word16 RCcontextMapping_encode2_estimate_bandWise_fx( lev1 = -( 1 << ( NBITS_CONTEXT + NBITS_RATEQ ) ); /* Q0 */ /* Signs Bits */ hContextMem->bit_estimate_fx = BASOP_Util_Add_Mant32Exp( hContextMem->bit_estimate_fx, hContextMem->bit_estimate_e, imult3216( ONE_IN_Q30, s_min( a1, 1 ) ), Q1, &hContextMem->bit_estimate_e ); /* exp(hContextMem->bit_estimate_e) */ hContextMem->bit_estimate_fx = BASOP_Util_Add_Mant32Exp( hContextMem->bit_estimate_fx, hContextMem->bit_estimate_e, imult3216( ONE_IN_Q30, s_min( b1, 1 ) ), Q1, &hContextMem->bit_estimate_e ); /* exp(hContextMem->bit_estimate_e) */ hContextMem->bit_estimate_accu = W_add_nosat( hContextMem->bit_estimate_accu, MAKE_VARIABLE_QX( s_min( a1, 1 ), Q23 ) ); hContextMem->bit_estimate_accu = W_add_nosat( hContextMem->bit_estimate_accu, MAKE_VARIABLE_QX( s_min( b1, 1 ), Q23 ) ); move32(); move32(); Loading @@ -1792,11 +1792,13 @@ Word16 RCcontextMapping_encode2_estimate_bandWise_fx( pki = lookup[lev1]; /* Q0 */ move16(); hContextMem->bit_estimate_fx = BASOP_Util_Add_Mant32Exp( hContextMem->bit_estimate_fx, hContextMem->bit_estimate_e, ari_bit_estimate_s17_LC_fx[pki][VAL_ESC], Q8, &hContextMem->bit_estimate_e ); /* exp(hContextMem->bit_estimate_e) */ hContextMem->bit_estimate_fx = BASOP_Util_Add_Mant32Exp( hContextMem->bit_estimate_fx, hContextMem->bit_estimate_e, 2 * ONE_IN_Q29, Q2, &hContextMem->bit_estimate_e ); /* Add the 2 LSB bits that were shifted out exp(hContextMem->bit_estimate_e) */ hContextMem->bit_estimate_accu = W_add_nosat( hContextMem->bit_estimate_accu, ari_bit_estimate_s17_LC_fx[pki][VAL_ESC] ); hContextMem->bit_estimate_accu = W_add_nosat( hContextMem->bit_estimate_accu, MAKE_VARIABLE_QX(2, Q23 ) ); move32(); move32(); // hContextMem->bit_estimate = hContextMem->bit_estimate + ari_bit_estimate_s17_LC[pki][VAL_ESC]; // hContextMem->bit_estimate += 2; /* Add the 2 LSB bits that were shifted out */ Loading @@ -1810,7 +1812,8 @@ Word16 RCcontextMapping_encode2_estimate_bandWise_fx( pki = lookup[lev1]; /* Q0 */ move16(); symbol = add( a1, i_mult( A_THRES, b1 ) ); /* MSB symbol Q0*/ hContextMem->bit_estimate_fx = BASOP_Util_Add_Mant32Exp( hContextMem->bit_estimate_fx, hContextMem->bit_estimate_e, ari_bit_estimate_s17_LC_fx[pki][symbol], Q8, &hContextMem->bit_estimate_e ); /* exp(bit_estimate_e) */ hContextMem->bit_estimate_accu = W_add_nosat( hContextMem->bit_estimate_accu, ari_bit_estimate_s17_LC_fx[pki][symbol] ); move32(); // hContextMem->bit_estimate = hContextMem->bit_estimate + ari_bit_estimate_s17_LC[pki][symbol]; Loading @@ -1830,9 +1833,10 @@ Word16 RCcontextMapping_encode2_estimate_bandWise_fx( move16(); } /*end of the 2-tuples loop*/ total_output_bits = round_fx( L_shr( hContextMem->bit_estimate_fx, sub( Q15, hContextMem->bit_estimate_e ) ) ); /* Q0 */ total_output_bits = round_fx( W_shr( hContextMem->bit_estimate_accu, Q7 ) ); /* Q0 */ // total_output_bits = (Word16) ( hContextMem->bit_estimate + 0.5f ); bandBits = sub( total_output_bits, hContextMem->nbits_old ); /* Q0 */ hContextMem->nbits_old = total_output_bits; /* Q0 */ move16(); Loading lib_enc/stat_enc.h +1 −2 Original line number Diff line number Diff line Loading @@ -2348,8 +2348,7 @@ typedef struct context_rc_mem_struct { int16_t nbits_old; int16_t ctx; Word32 bit_estimate_fx; Word16 bit_estimate_e; Word64 bit_estimate_accu; int16_t rateFlag; int16_t lastnz; int16_t nt_half; Loading Loading
lib_enc/ACcontextMapping_enc_fx.c +63 −59 Original line number Diff line number Diff line Loading @@ -16,6 +16,9 @@ #include "prot_fx_enc.h" #include "ivas_prot.h" /* Range coder header file */ #define MAKE_NUMBER_QX(number,QX) ((number)<<(QX)) #define MAKE_VARIABLE_QX(variable,QX) W_shl(W_deposit32_l(L_deposit_l(( variable) ) ), (QX)) /*-------------------------------------------------------------------* * ACcontextMapping_encode2_no_mem_s17_LC_fx() * Loading Loading @@ -1669,10 +1672,9 @@ Word16 RCcontextMapping_encode2_estimate_bandWise_start_fx( move16(); } hContextMem->bit_estimate_fx = 2; /* Q0 */ move32(); hContextMem->bit_estimate_e = Q31; move16(); hContextMem->bit_estimate_accu = MAKE_NUMBER_QX(2, Q23 ); move64(); /* Init */ Loading @@ -1682,18 +1684,21 @@ Word16 RCcontextMapping_encode2_estimate_bandWise_start_fx( /* bits to encode lastnz */ k = 1; move16(); i = 2; move16(); WHILE( LT_16( k, hContextMem->nt_half ) ) { hContextMem->bit_estimate_fx = L_add( hContextMem->bit_estimate_fx, 1 ); /* exp(bit_estimate_e) */ move32(); hContextMem->bit_estimate_accu = W_add( hContextMem->bit_estimate_accu, MAKE_NUMBER_QX(1, Q23 ) ); move64(); k = shl( k, 1 ); i = add( i, 1 ); /* check while condition */ } /* bits to encode lastnz */ hContextMem->nbits_old = extract_l( hContextMem->bit_estimate_fx ); /* Q0 */ hContextMem->nbits_old = i; move16(); hContextMem->ctx = 0; Loading @@ -1713,14 +1718,8 @@ Word16 RCcontextMapping_encode2_estimate_bandWise_start_fx( BREAK; } } Word16 tmp2 = extract_l( hContextMem->bit_estimate_fx ); Word16 tmp = norm_l( hContextMem->bit_estimate_fx ); hContextMem->bit_estimate_e = sub( Q31, tmp ); move16(); hContextMem->bit_estimate_fx = L_shl( hContextMem->bit_estimate_fx, tmp ); /* exp(bit_estimate_e) */ move32(); return tmp2; return hContextMem->nbits_old; } /*-------------------------------------------------------------------* Loading Loading @@ -1777,8 +1776,9 @@ Word16 RCcontextMapping_encode2_estimate_bandWise_fx( lev1 = -( 1 << ( NBITS_CONTEXT + NBITS_RATEQ ) ); /* Q0 */ /* Signs Bits */ hContextMem->bit_estimate_fx = BASOP_Util_Add_Mant32Exp( hContextMem->bit_estimate_fx, hContextMem->bit_estimate_e, imult3216( ONE_IN_Q30, s_min( a1, 1 ) ), Q1, &hContextMem->bit_estimate_e ); /* exp(hContextMem->bit_estimate_e) */ hContextMem->bit_estimate_fx = BASOP_Util_Add_Mant32Exp( hContextMem->bit_estimate_fx, hContextMem->bit_estimate_e, imult3216( ONE_IN_Q30, s_min( b1, 1 ) ), Q1, &hContextMem->bit_estimate_e ); /* exp(hContextMem->bit_estimate_e) */ hContextMem->bit_estimate_accu = W_add_nosat( hContextMem->bit_estimate_accu, MAKE_VARIABLE_QX( s_min( a1, 1 ), Q23 ) ); hContextMem->bit_estimate_accu = W_add_nosat( hContextMem->bit_estimate_accu, MAKE_VARIABLE_QX( s_min( b1, 1 ), Q23 ) ); move32(); move32(); Loading @@ -1792,11 +1792,13 @@ Word16 RCcontextMapping_encode2_estimate_bandWise_fx( pki = lookup[lev1]; /* Q0 */ move16(); hContextMem->bit_estimate_fx = BASOP_Util_Add_Mant32Exp( hContextMem->bit_estimate_fx, hContextMem->bit_estimate_e, ari_bit_estimate_s17_LC_fx[pki][VAL_ESC], Q8, &hContextMem->bit_estimate_e ); /* exp(hContextMem->bit_estimate_e) */ hContextMem->bit_estimate_fx = BASOP_Util_Add_Mant32Exp( hContextMem->bit_estimate_fx, hContextMem->bit_estimate_e, 2 * ONE_IN_Q29, Q2, &hContextMem->bit_estimate_e ); /* Add the 2 LSB bits that were shifted out exp(hContextMem->bit_estimate_e) */ hContextMem->bit_estimate_accu = W_add_nosat( hContextMem->bit_estimate_accu, ari_bit_estimate_s17_LC_fx[pki][VAL_ESC] ); hContextMem->bit_estimate_accu = W_add_nosat( hContextMem->bit_estimate_accu, MAKE_VARIABLE_QX(2, Q23 ) ); move32(); move32(); // hContextMem->bit_estimate = hContextMem->bit_estimate + ari_bit_estimate_s17_LC[pki][VAL_ESC]; // hContextMem->bit_estimate += 2; /* Add the 2 LSB bits that were shifted out */ Loading @@ -1810,7 +1812,8 @@ Word16 RCcontextMapping_encode2_estimate_bandWise_fx( pki = lookup[lev1]; /* Q0 */ move16(); symbol = add( a1, i_mult( A_THRES, b1 ) ); /* MSB symbol Q0*/ hContextMem->bit_estimate_fx = BASOP_Util_Add_Mant32Exp( hContextMem->bit_estimate_fx, hContextMem->bit_estimate_e, ari_bit_estimate_s17_LC_fx[pki][symbol], Q8, &hContextMem->bit_estimate_e ); /* exp(bit_estimate_e) */ hContextMem->bit_estimate_accu = W_add_nosat( hContextMem->bit_estimate_accu, ari_bit_estimate_s17_LC_fx[pki][symbol] ); move32(); // hContextMem->bit_estimate = hContextMem->bit_estimate + ari_bit_estimate_s17_LC[pki][symbol]; Loading @@ -1830,9 +1833,10 @@ Word16 RCcontextMapping_encode2_estimate_bandWise_fx( move16(); } /*end of the 2-tuples loop*/ total_output_bits = round_fx( L_shr( hContextMem->bit_estimate_fx, sub( Q15, hContextMem->bit_estimate_e ) ) ); /* Q0 */ total_output_bits = round_fx( W_shr( hContextMem->bit_estimate_accu, Q7 ) ); /* Q0 */ // total_output_bits = (Word16) ( hContextMem->bit_estimate + 0.5f ); bandBits = sub( total_output_bits, hContextMem->nbits_old ); /* Q0 */ hContextMem->nbits_old = total_output_bits; /* Q0 */ move16(); Loading
lib_enc/stat_enc.h +1 −2 Original line number Diff line number Diff line Loading @@ -2348,8 +2348,7 @@ typedef struct context_rc_mem_struct { int16_t nbits_old; int16_t ctx; Word32 bit_estimate_fx; Word16 bit_estimate_e; Word64 bit_estimate_accu; int16_t rateFlag; int16_t lastnz; int16_t nt_half; Loading