Loading lib_enc/tcx_utils_enc_fx.c +65 −11 Original line number Diff line number Diff line Loading @@ -1394,7 +1394,18 @@ void tcx_scalar_quantization_fx( /* common exponent for x and gain for comparison */ tmp16 = sub( gain_e, x_e ); #ifndef FIX_BASOP_2551_HARM_SCALAR_QUAN #else if(EQ_16(element_mode, EVS_MONO)){ tmp32 = L_shl(L_deposit_h(gain), s_max(-31, s_min(tmp16, 0))); } else { tmp32 = L_shl_sat(L_deposit_h(gain), tmp16); // exp:x_e } #endif // !FIX_BASOP_2551_HARM_SCALAR_QUAN #ifdef FIX_BASOP_2551_HARM_SCALAR_QUAN IF( EQ_16( element_mode, EVS_MONO ) ) { Loading Loading @@ -1430,8 +1441,15 @@ void tcx_scalar_quantization_fx( s = sub( add( x_e, gain_e ), 15 ); } #ifdef FIX_BASOP_2551_HARM_SCALAR_QUAN if (EQ_16(element_mode, EVS_MONO)) { offset = sub(offset, 0x4000); } #endif // FIX_BASOP_2551_HARM_SCALAR_QUAN FOR( ; i >= 0; i-- ) { #ifndef FIX_BASOP_2551_HARM_SCALAR_QUAN offs32 = Mpy_32_16_1(x[i], gain); offs32 = L_shl_sat(offs32, s); /* convert to 15Q16 */ Loading @@ -1448,6 +1466,42 @@ void tcx_scalar_quantization_fx( } xq[i] = tmp16; move16(); #else if (EQ_16(element_mode, EVS_MONO)) { offs32 = Mpy_32_16_1(L_abs(x[i]), gain); /* multiply */ offs32 = L_shl_sat(offs32, s); /* convert to 15Q16 */ tmp16 = mac_r_sat(offs32, offset, 1); /* add offset and truncate */ IF(x[i] < 0) { tmp16 = negate(tmp16); /* restore sign */ } xq[i] = tmp16; move16(); } else { 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); } } xq[i] = tmp16; move16(); } #endif // !FIX_BASOP_2551_HARM_SCALAR_QUAN } IF( alfe_flag == 0 ) Loading Loading
lib_enc/tcx_utils_enc_fx.c +65 −11 Original line number Diff line number Diff line Loading @@ -1394,7 +1394,18 @@ void tcx_scalar_quantization_fx( /* common exponent for x and gain for comparison */ tmp16 = sub( gain_e, x_e ); #ifndef FIX_BASOP_2551_HARM_SCALAR_QUAN #else if(EQ_16(element_mode, EVS_MONO)){ tmp32 = L_shl(L_deposit_h(gain), s_max(-31, s_min(tmp16, 0))); } else { tmp32 = L_shl_sat(L_deposit_h(gain), tmp16); // exp:x_e } #endif // !FIX_BASOP_2551_HARM_SCALAR_QUAN #ifdef FIX_BASOP_2551_HARM_SCALAR_QUAN IF( EQ_16( element_mode, EVS_MONO ) ) { Loading Loading @@ -1430,8 +1441,15 @@ void tcx_scalar_quantization_fx( s = sub( add( x_e, gain_e ), 15 ); } #ifdef FIX_BASOP_2551_HARM_SCALAR_QUAN if (EQ_16(element_mode, EVS_MONO)) { offset = sub(offset, 0x4000); } #endif // FIX_BASOP_2551_HARM_SCALAR_QUAN FOR( ; i >= 0; i-- ) { #ifndef FIX_BASOP_2551_HARM_SCALAR_QUAN offs32 = Mpy_32_16_1(x[i], gain); offs32 = L_shl_sat(offs32, s); /* convert to 15Q16 */ Loading @@ -1448,6 +1466,42 @@ void tcx_scalar_quantization_fx( } xq[i] = tmp16; move16(); #else if (EQ_16(element_mode, EVS_MONO)) { offs32 = Mpy_32_16_1(L_abs(x[i]), gain); /* multiply */ offs32 = L_shl_sat(offs32, s); /* convert to 15Q16 */ tmp16 = mac_r_sat(offs32, offset, 1); /* add offset and truncate */ IF(x[i] < 0) { tmp16 = negate(tmp16); /* restore sign */ } xq[i] = tmp16; move16(); } else { 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); } } xq[i] = tmp16; move16(); } #endif // !FIX_BASOP_2551_HARM_SCALAR_QUAN } IF( alfe_flag == 0 ) Loading