Loading lib_dec/FEC_HQ_phase_ecu_fx.c +223 −4 Original line number Diff line number Diff line Loading @@ -3527,6 +3527,223 @@ static void fir_dwn_fx( * Pitch/correlation analysis and adaptive analysis frame length calculation *--------------------------------------------------------------------------*/ #ifdef IVAS_FLOAT_FIXED static void fec_ecu_pitch_ivas_fx( const Word16 *prevsynth_fx, /*Q15 16 */ Word16 *prevsynth_LP_fx, /* Q15 16 */ const Word16 L, Word16 *N, Word16 *min_corr_fx, /* Q15 16 */ Word16 *decimatefator, const Word16 HqVoicing ) { Word16 i, filt_size; Word16 QAsr, Ryy, cb_start, tmpQLP; Word32 Ryytmp; Word32 accA, accB, accBisqrt, accC, accCisqrt; Word16 delay_ind, k; const Word16 *Asr_LP_fx; Word16 *ptr_LP, *ptr_LP2, *ptr_LP3, *ptr_LP4; Word16 cb_end; Word16 Lmul2, Lon20mul6, Lon20mul28, Lon20mul33, Lon20mul34; SWITCH( L ) { case L_FRAME48k: *decimatefator = 6; move16(); filt_size = 60; move16(); Asr_LP_fx = Asr_LP48_fx; QAsr = 17; move16(); Lon20mul6 = 48; move16(); Lon20mul28 = 224; move16(); Lon20mul33 = 264; move16(); Lon20mul34 = 272; move16(); Lmul2 = 1920; move16(); BREAK; case L_FRAME32k: *decimatefator = 4; move16(); filt_size = 40; move16(); Asr_LP_fx = Asr_LP32_fx; QAsr = 15; move16(); Lon20mul6 = 48; move16(); Lon20mul28 = 224; move16(); Lon20mul33 = 264; move16(); Lon20mul34 = 272; move16(); Lmul2 = 1280; move16(); BREAK; case L_FRAME16k: *decimatefator = 2; move16(); filt_size = 20; move16(); Asr_LP_fx = Asr_LP16_fx; QAsr = 15; move16(); Lon20mul6 = 48; move16(); Lon20mul28 = 224; move16(); Lon20mul33 = 264; move16(); Lon20mul34 = 272; move16(); Lmul2 = 640; move16(); BREAK; default: *decimatefator = 2; move16(); filt_size = 40; move16(); Asr_LP_fx = Asr_LP16_fx; QAsr = 15; move16(); Lon20mul6 = 48; move16(); Lon20mul28 = 224; move16(); Lon20mul33 = 264; move16(); Lon20mul34 = 272; move16(); Lmul2 = 320; move16(); BREAK; } /* Resampling to work at 8Khz */ fir_dwn_fx( prevsynth_fx, Asr_LP_fx, QAsr, prevsynth_LP_fx, Lmul2, filt_size, *decimatefator ); /* resampling without delay */ tmpQLP = Find_Max_Norm16( prevsynth_LP_fx, 320 ); Scale_sig( prevsynth_LP_fx, 320, sub( tmpQLP, 3 ) ); /* to avoid over scaling */ /* Correlation analysis */ *min_corr_fx = 0; move16(); accC = L_deposit_l( 0 ); ptr_LP = prevsynth_LP_fx + Lon20mul34; FOR( k = 0; k < Lon20mul6; k++ ) { accC = L_mac0( accC, *ptr_LP, *ptr_LP ); ptr_LP++; } IF( EQ_16( HqVoicing, 1 ) ) { cb_start = 0; move16(); cb_end = Lon20mul33; move16(); } ELSE { cb_start = 0; move16(); cb_end = Lon20mul28; move16(); } accB = 0; move16(); delay_ind = cb_start; move16(); FOR( i = cb_start; i < cb_end; i++ ) /* cb_end = 35 let 6 ms min of loop size */ { accA = 0; move16(); IF( EQ_16( i, cb_start ) ) { accB = 0; move16(); ptr_LP = prevsynth_LP_fx; ptr_LP2 = prevsynth_LP_fx + Lon20mul34; FOR( k = 0; k < Lon20mul6; k++ ) { accA = L_mac0( accA, *ptr_LP, *ptr_LP2 ); accB = L_mac0( accB, *ptr_LP, *ptr_LP ); ptr_LP++; ptr_LP2++; } } ELSE { accB = L_mac0( L_msu0( accB, prevsynth_LP_fx[i - 1], prevsynth_LP_fx[i - 1] ), prevsynth_LP_fx[i + Lon20mul6 - 1], prevsynth_LP_fx[i + Lon20mul6 - 1] ); /* tmpQLP-5 */ ptr_LP3 = prevsynth_LP_fx + i; ptr_LP4 = prevsynth_LP_fx + Lon20mul34; FOR( k = 0; k < Lon20mul6; k++ ) { accA = L_mac0( accA, *ptr_LP3, *ptr_LP4 ); /*2* tmpQLP-5 */ ptr_LP3++; ptr_LP4++; } } /*accB*/ /*accC*/ /*accA Q 6-2*tmpQLP*/ accBisqrt = Isqrt( accB ); /* Q31 - 3 + tmpQLP */ accCisqrt = Isqrt( accC ); /* Q31 - 3 + tmpQLP*/ Ryytmp = L_shl( Mult_32_32( accA, accCisqrt ), Q15 ); /*Q 6 -2*tmpQLP + Q31 - 3 + tmpQLP -16 -3 +tmpQLP = Q15*/ Ryy = extract_h( L_shl( Mult_32_32( Ryytmp, accBisqrt ), 16 ) ); /*Q15 + Q31 - 3 + tmpQLP -15 + 3- tmpQLP = Q31*/ IF( GT_16( Ryy, *min_corr_fx ) ) { *min_corr_fx = Ryy; move16(); delay_ind = i; move16(); } test(); IF( HqVoicing == 0 && GT_16( *min_corr_fx, 31130 ) ) { BREAK; } } *N = sub( Lon20mul34, delay_ind ); move16(); Scale_sig( prevsynth_LP_fx, 320, negate( sub( tmpQLP, 3 ) ) ); return; } #endif static void fec_ecu_pitch_fx( const Word16 *prevsynth_fx, /*Q15 16 */ Word16 *prevsynth_LP_fx, /* Q15 16 */ Loading Loading @@ -5182,6 +5399,8 @@ void ivas_hq_ecu_fx( Word16 ivas_mode_selection; hHQ_core = st_fx->hHQ_core; corr = 0; move16(); IF( EQ_16( st_fx->element_mode, EVS_MONO ) ) { fec_alg_input = prevsynth + NS2SA( output_frame * FRAMES_PER_SEC, ACELP_LOOK_NS / 2 - PH_ECU_LOOKAHEAD_NS ); Loading @@ -5191,20 +5410,20 @@ void ivas_hq_ecu_fx( fec_alg_input = prevsynth - NS2SA( output_frame * FRAMES_PER_SEC, PH_ECU_LOOKAHEAD_NS ); } /* init (values ar changed after) */ decimatefactor = 4; move16(); N = shr( output_frame, 2 ); /* find pitch and R value */ IF( !( LT_16( output_frame, L_FRAME16k ) ) ) { fec_ecu_pitch_fx( fec_alg_input, prevsynth_LP, output_frame, &N, &corr, &decimatefactor, ph_ecu_HqVoicing ); fec_ecu_pitch_ivas_fx( fec_alg_input, prevsynth_LP, output_frame, &N, &corr, &decimatefactor, ph_ecu_HqVoicing ); } ELSE { corr = 0; decimatefactor = 4; move16(); N = shr( output_frame, 2 ); move16(); /* just to avoid using uninitialized value in if statement below */ } Loading lib_dec/ivas_jbm_dec.c +6 −4 Original line number Diff line number Diff line Loading @@ -4574,19 +4574,21 @@ void ivas_jbm_dec_get_adapted_linear_interpolator_fx( jbm_segment_len = shr( default_interp_length, 1 ); dec_fx = divide1616( 1, default_interp_length ); /*32767 / default_interp_length*/ move16(); interpolator_fx[interp_length - 1] = 32767; FOR( idx = interp_length - 2; idx >= jbm_segment_len; idx-- ) move16(); interpolator_fx[interp_length - 2] = add( sub( 32767, dec_fx ), 1 ); // Use 32768 to maintain precision move16(); FOR( idx = interp_length - 3; idx >= jbm_segment_len; idx-- ) { interpolator_fx[idx] = s_max( 0, sub( interpolator_fx[idx + 1], dec_fx ) ); move16(); } IF( GT_16( interpolator_fx[idx + 1], 0 ) ) IF( interpolator_fx[idx + 1] > 0 ) { dec_fx = BASOP_Util_Divide1616_Scale( interpolator_fx[idx + 1], add( jbm_segment_len, 1 ), &dec_e ); dec_fx = shr( dec_fx, sub( 15, dec_e ) ); move16(); FOR( ; idx >= 0; idx-- ) { interpolator_fx[idx] = sub( interpolator_fx[idx + 1], dec_fx ); Loading lib_dec/ivas_stereo_icbwe_dec.c +1 −1 Original line number Diff line number Diff line Loading @@ -1836,7 +1836,7 @@ void stereo_icBWE_decproc_fx( FOR( i = 0; i < output_frame; i++ ) { #ifdef FIX_826_PRECISION_LOST_AND_COMPL outputHB[0][i] = W_extract_h( W_mac_32_16( W_mult_32_16( outputHB[0][i], 16384 ), outputHB[1][i], 16384 ) ); outputHB[0][i] = W_shr( W_mac_32_16( W_mult_32_16( outputHB[0][i], 16384 ), outputHB[1][i], 16384 ), Q16 ); #else outputHB[0][i] = L_shr( ( outputHB[0][i] + outputHB[1][i] ), 1 ); #endif Loading Loading
lib_dec/FEC_HQ_phase_ecu_fx.c +223 −4 Original line number Diff line number Diff line Loading @@ -3527,6 +3527,223 @@ static void fir_dwn_fx( * Pitch/correlation analysis and adaptive analysis frame length calculation *--------------------------------------------------------------------------*/ #ifdef IVAS_FLOAT_FIXED static void fec_ecu_pitch_ivas_fx( const Word16 *prevsynth_fx, /*Q15 16 */ Word16 *prevsynth_LP_fx, /* Q15 16 */ const Word16 L, Word16 *N, Word16 *min_corr_fx, /* Q15 16 */ Word16 *decimatefator, const Word16 HqVoicing ) { Word16 i, filt_size; Word16 QAsr, Ryy, cb_start, tmpQLP; Word32 Ryytmp; Word32 accA, accB, accBisqrt, accC, accCisqrt; Word16 delay_ind, k; const Word16 *Asr_LP_fx; Word16 *ptr_LP, *ptr_LP2, *ptr_LP3, *ptr_LP4; Word16 cb_end; Word16 Lmul2, Lon20mul6, Lon20mul28, Lon20mul33, Lon20mul34; SWITCH( L ) { case L_FRAME48k: *decimatefator = 6; move16(); filt_size = 60; move16(); Asr_LP_fx = Asr_LP48_fx; QAsr = 17; move16(); Lon20mul6 = 48; move16(); Lon20mul28 = 224; move16(); Lon20mul33 = 264; move16(); Lon20mul34 = 272; move16(); Lmul2 = 1920; move16(); BREAK; case L_FRAME32k: *decimatefator = 4; move16(); filt_size = 40; move16(); Asr_LP_fx = Asr_LP32_fx; QAsr = 15; move16(); Lon20mul6 = 48; move16(); Lon20mul28 = 224; move16(); Lon20mul33 = 264; move16(); Lon20mul34 = 272; move16(); Lmul2 = 1280; move16(); BREAK; case L_FRAME16k: *decimatefator = 2; move16(); filt_size = 20; move16(); Asr_LP_fx = Asr_LP16_fx; QAsr = 15; move16(); Lon20mul6 = 48; move16(); Lon20mul28 = 224; move16(); Lon20mul33 = 264; move16(); Lon20mul34 = 272; move16(); Lmul2 = 640; move16(); BREAK; default: *decimatefator = 2; move16(); filt_size = 40; move16(); Asr_LP_fx = Asr_LP16_fx; QAsr = 15; move16(); Lon20mul6 = 48; move16(); Lon20mul28 = 224; move16(); Lon20mul33 = 264; move16(); Lon20mul34 = 272; move16(); Lmul2 = 320; move16(); BREAK; } /* Resampling to work at 8Khz */ fir_dwn_fx( prevsynth_fx, Asr_LP_fx, QAsr, prevsynth_LP_fx, Lmul2, filt_size, *decimatefator ); /* resampling without delay */ tmpQLP = Find_Max_Norm16( prevsynth_LP_fx, 320 ); Scale_sig( prevsynth_LP_fx, 320, sub( tmpQLP, 3 ) ); /* to avoid over scaling */ /* Correlation analysis */ *min_corr_fx = 0; move16(); accC = L_deposit_l( 0 ); ptr_LP = prevsynth_LP_fx + Lon20mul34; FOR( k = 0; k < Lon20mul6; k++ ) { accC = L_mac0( accC, *ptr_LP, *ptr_LP ); ptr_LP++; } IF( EQ_16( HqVoicing, 1 ) ) { cb_start = 0; move16(); cb_end = Lon20mul33; move16(); } ELSE { cb_start = 0; move16(); cb_end = Lon20mul28; move16(); } accB = 0; move16(); delay_ind = cb_start; move16(); FOR( i = cb_start; i < cb_end; i++ ) /* cb_end = 35 let 6 ms min of loop size */ { accA = 0; move16(); IF( EQ_16( i, cb_start ) ) { accB = 0; move16(); ptr_LP = prevsynth_LP_fx; ptr_LP2 = prevsynth_LP_fx + Lon20mul34; FOR( k = 0; k < Lon20mul6; k++ ) { accA = L_mac0( accA, *ptr_LP, *ptr_LP2 ); accB = L_mac0( accB, *ptr_LP, *ptr_LP ); ptr_LP++; ptr_LP2++; } } ELSE { accB = L_mac0( L_msu0( accB, prevsynth_LP_fx[i - 1], prevsynth_LP_fx[i - 1] ), prevsynth_LP_fx[i + Lon20mul6 - 1], prevsynth_LP_fx[i + Lon20mul6 - 1] ); /* tmpQLP-5 */ ptr_LP3 = prevsynth_LP_fx + i; ptr_LP4 = prevsynth_LP_fx + Lon20mul34; FOR( k = 0; k < Lon20mul6; k++ ) { accA = L_mac0( accA, *ptr_LP3, *ptr_LP4 ); /*2* tmpQLP-5 */ ptr_LP3++; ptr_LP4++; } } /*accB*/ /*accC*/ /*accA Q 6-2*tmpQLP*/ accBisqrt = Isqrt( accB ); /* Q31 - 3 + tmpQLP */ accCisqrt = Isqrt( accC ); /* Q31 - 3 + tmpQLP*/ Ryytmp = L_shl( Mult_32_32( accA, accCisqrt ), Q15 ); /*Q 6 -2*tmpQLP + Q31 - 3 + tmpQLP -16 -3 +tmpQLP = Q15*/ Ryy = extract_h( L_shl( Mult_32_32( Ryytmp, accBisqrt ), 16 ) ); /*Q15 + Q31 - 3 + tmpQLP -15 + 3- tmpQLP = Q31*/ IF( GT_16( Ryy, *min_corr_fx ) ) { *min_corr_fx = Ryy; move16(); delay_ind = i; move16(); } test(); IF( HqVoicing == 0 && GT_16( *min_corr_fx, 31130 ) ) { BREAK; } } *N = sub( Lon20mul34, delay_ind ); move16(); Scale_sig( prevsynth_LP_fx, 320, negate( sub( tmpQLP, 3 ) ) ); return; } #endif static void fec_ecu_pitch_fx( const Word16 *prevsynth_fx, /*Q15 16 */ Word16 *prevsynth_LP_fx, /* Q15 16 */ Loading Loading @@ -5182,6 +5399,8 @@ void ivas_hq_ecu_fx( Word16 ivas_mode_selection; hHQ_core = st_fx->hHQ_core; corr = 0; move16(); IF( EQ_16( st_fx->element_mode, EVS_MONO ) ) { fec_alg_input = prevsynth + NS2SA( output_frame * FRAMES_PER_SEC, ACELP_LOOK_NS / 2 - PH_ECU_LOOKAHEAD_NS ); Loading @@ -5191,20 +5410,20 @@ void ivas_hq_ecu_fx( fec_alg_input = prevsynth - NS2SA( output_frame * FRAMES_PER_SEC, PH_ECU_LOOKAHEAD_NS ); } /* init (values ar changed after) */ decimatefactor = 4; move16(); N = shr( output_frame, 2 ); /* find pitch and R value */ IF( !( LT_16( output_frame, L_FRAME16k ) ) ) { fec_ecu_pitch_fx( fec_alg_input, prevsynth_LP, output_frame, &N, &corr, &decimatefactor, ph_ecu_HqVoicing ); fec_ecu_pitch_ivas_fx( fec_alg_input, prevsynth_LP, output_frame, &N, &corr, &decimatefactor, ph_ecu_HqVoicing ); } ELSE { corr = 0; decimatefactor = 4; move16(); N = shr( output_frame, 2 ); move16(); /* just to avoid using uninitialized value in if statement below */ } Loading
lib_dec/ivas_jbm_dec.c +6 −4 Original line number Diff line number Diff line Loading @@ -4574,19 +4574,21 @@ void ivas_jbm_dec_get_adapted_linear_interpolator_fx( jbm_segment_len = shr( default_interp_length, 1 ); dec_fx = divide1616( 1, default_interp_length ); /*32767 / default_interp_length*/ move16(); interpolator_fx[interp_length - 1] = 32767; FOR( idx = interp_length - 2; idx >= jbm_segment_len; idx-- ) move16(); interpolator_fx[interp_length - 2] = add( sub( 32767, dec_fx ), 1 ); // Use 32768 to maintain precision move16(); FOR( idx = interp_length - 3; idx >= jbm_segment_len; idx-- ) { interpolator_fx[idx] = s_max( 0, sub( interpolator_fx[idx + 1], dec_fx ) ); move16(); } IF( GT_16( interpolator_fx[idx + 1], 0 ) ) IF( interpolator_fx[idx + 1] > 0 ) { dec_fx = BASOP_Util_Divide1616_Scale( interpolator_fx[idx + 1], add( jbm_segment_len, 1 ), &dec_e ); dec_fx = shr( dec_fx, sub( 15, dec_e ) ); move16(); FOR( ; idx >= 0; idx-- ) { interpolator_fx[idx] = sub( interpolator_fx[idx + 1], dec_fx ); Loading
lib_dec/ivas_stereo_icbwe_dec.c +1 −1 Original line number Diff line number Diff line Loading @@ -1836,7 +1836,7 @@ void stereo_icBWE_decproc_fx( FOR( i = 0; i < output_frame; i++ ) { #ifdef FIX_826_PRECISION_LOST_AND_COMPL outputHB[0][i] = W_extract_h( W_mac_32_16( W_mult_32_16( outputHB[0][i], 16384 ), outputHB[1][i], 16384 ) ); outputHB[0][i] = W_shr( W_mac_32_16( W_mult_32_16( outputHB[0][i], 16384 ), outputHB[1][i], 16384 ), Q16 ); #else outputHB[0][i] = L_shr( ( outputHB[0][i] + outputHB[1][i] ), 1 ); #endif Loading