diff --git a/lib_com/options.h b/lib_com/options.h index 1a9f8ab847a27f442e9b32b4fd478212fd036b42..dd32167b9169ff4864904770b674463b566e938b 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -77,6 +77,7 @@ /* Note: each compile switch (FIX_1101_...) is independent from the other ones */ +#define OPT_MCT_ENC_V2_NBE #define OPT_MCT_ENC_V1_NBE #define OPT_MCT_ENC_V1_BE #define OPT_SBA_REND_V1_BE diff --git a/lib_enc/tcx_utils_enc_fx.c b/lib_enc/tcx_utils_enc_fx.c index 9a15cec2803abd5a3783ef6ecbceda75f5bd72e0..9ca9eb82a3e656cac093bf48026bca1b3615631c 100644 --- a/lib_enc/tcx_utils_enc_fx.c +++ b/lib_enc/tcx_utils_enc_fx.c @@ -1355,23 +1355,37 @@ void tcx_scalar_quantization_ivas_fx( { Word16 i, tmp16, s; Word32 tmp32, offs32; +#ifdef OPT_MCT_ENC_V2_NBE + Word32 offs32_1; + Word32 offset_Q16 = L_shl( offset, 1 ); // Q16 +#endif /* common exponent for x and gain for comparison */ tmp16 = sub( gain_e, x_e ); +#ifdef OPT_MCT_ENC_V2_NBE + tmp32 = L_shl_sat( L_deposit_h( gain ), tmp16 ); // exp:x_e +#else tmp32 = L_shl( L_deposit_h( gain ), s_max( -31, s_min( tmp16, 0 ) ) ); tmp16 = negate( s_max( tmp16, 0 ) ); +#endif i = sub( L_frame, 1 ); IF( memQuantZeros_fx != NULL ) { test(); +#ifdef OPT_MCT_ENC_V2_NBE + FOR( ; ( ( memQuantZeros_fx[i] != 0 ) && ( L_abs( x[i] ) < tmp32 ) ); i-- ) +#else WHILE( ( memQuantZeros_fx[i] != 0 ) && ( LT_32( L_abs( L_shl( x[i], tmp16 ) ), tmp32 ) ) ) +#endif { test(); xq[i] = 0; move16(); +#ifndef OPT_MCT_ENC_V2_NBE i = sub( i, 1 ); +#endif } } @@ -1394,6 +1408,22 @@ void tcx_scalar_quantization_ivas_fx( FOR( ; i >= 0; i-- ) { +#ifdef OPT_MCT_ENC_V2_NBE + offs32 = Mpy_32_16_1( x[i], gain ); + offs32 = L_shl_sat( offs32, s ); /* convert to 15Q16 */ + + offs32_1 = L_add_sat( offs32, offset_Q16 ); /*15Q16 */ + tmp16 = extract_h( offs32_1 ); + IF( x[i] < 0 ) + { + offs32 = L_sub_sat( offs32, offset_Q16 ); /*15Q16 */ + tmp16 = extract_h( offs32 ); + if ( L_mac_sat( offs32, tmp16, -ONE_IN_Q15 ) > 0 ) + { + tmp16 = add( tmp16, 1 ); + } + } +#else offs32 = Mpy_32_16_1( x[i], gain ); /* multiply */ offs32 = L_shl_sat( offs32, s ); /* convert to 15Q16 */ IF( x[i] > 0 ) @@ -1414,6 +1444,7 @@ void tcx_scalar_quantization_ivas_fx( tmp16 = add( tmp16, 1 ); } } +#endif xq[i] = tmp16; move16(); }