Loading lib_com/ivas_dirac_com_fx.c +0 −115 Original line number Diff line number Diff line Loading @@ -778,121 +778,6 @@ void computeDirectionVectors_fx( return; } /*------------------------------------------------------------------------- * computeDiffuseness() * * *------------------------------------------------------------------------*/ void computeDiffuseness_fx( Word32 *buffer_intensity[DIRAC_NUM_DIMS][DIRAC_NO_COL_AVG_DIFF], // i: Q(q_factor_intensity) const Word32 *buffer_energy, // i: Q(q_factor_energy) const Word16 num_freq_bands, Word32 *diffuseness, // o: exp(out_exp) Word16 q_factor_intensity, Word16 q_factor_energy, Word16 *out_exp /*Ouput Q*/ ) { Word32 intensity_slow[DIRAC_NUM_DIMS * CLDFB_NO_CHANNELS_MAX]; Word32 intensity_slow_abs[CLDFB_NO_CHANNELS_MAX]; Word32 energy_slow[CLDFB_NO_CHANNELS_MAX]; Word16 i, j, k; Word32 tmp = 0, tmp_1; move32(); Word32 *p_tmp; const Word32 *p_tmp_c; /* Compute Intensity slow and energy slow */ set32_fx( intensity_slow, 0, DIRAC_NUM_DIMS * CLDFB_NO_CHANNELS_MAX ); set32_fx( intensity_slow_abs, 0, CLDFB_NO_CHANNELS_MAX ); set32_fx( energy_slow, 0, CLDFB_NO_CHANNELS_MAX ); FOR( i = 0; i < DIRAC_NO_COL_AVG_DIFF; ++i ) { /* Energy slow */ p_tmp_c = buffer_energy + i * num_freq_bands; FOR( k = 0; k < num_freq_bands; k++ ) { energy_slow[k] = L_add( *( p_tmp_c++ ), energy_slow[k] ); // Q(q_factor_energy) move32(); } /* Intensity slow */ FOR( j = 0; j < DIRAC_NUM_DIMS; ++j ) { p_tmp = buffer_intensity[j][i]; FOR( k = 0; k < num_freq_bands; k++ ) { intensity_slow[j * num_freq_bands + k] = L_add( *( p_tmp++ ), intensity_slow[j * num_freq_bands + k] ); move32(); } } } /* intensity_slow.^2 + intensity_slow_abs*/ FOR( j = 0; j < DIRAC_NUM_DIMS; ++j ) { p_tmp = intensity_slow + j * num_freq_bands; FOR( k = 0; k < num_freq_bands; k++ ) { *( p_tmp ) = Mpy_32_32( *p_tmp, *( p_tmp ) ); // Q( 2*(q_factor_intensity + scale_fact - 1) -31 ) intensity_slow_abs[k] = L_add( *( p_tmp++ ), intensity_slow_abs[k] ); move32(); move32(); } } Word16 init_exp = sub( 62, shl( q_factor_intensity, 1 ) ); // 31 - ( 2 * q_factor_intensity - 31 ) Word16 exp; Word16 exp1 = 0, exp2; move16(); /* Compute Diffuseness */ p_tmp = intensity_slow_abs; FOR( i = 0; i < num_freq_bands; ++i ) { exp = init_exp; move16(); Word32 temp = *( p_tmp++ ); move32(); tmp_1 = Sqrt32( temp, &exp ); tmp = L_deposit_h( BASOP_Util_Divide3232_Scale( tmp_1, L_add( energy_slow[i], 1 ), &exp1 ) ); exp2 = add( sub( 31, exp1 ), sub( sub( 31, exp ), q_factor_energy ) ); IF( GT_32( exp2, 30 ) ) { tmp = L_shr( tmp, sub( exp2, 30 ) ); exp2 = sub( exp2, sub( exp2, 30 ) ); } tmp = L_sub( L_shl( 1, exp2 ), tmp ); // diffuseness[i] = ( ( tmp < L_shl( 1, exp2 ) ) ? ( ( tmp < 0 ) ? 0 : tmp ) : L_shl( 1, exp2 ) ); IF( LT_32( tmp, L_shl( 1, exp2 ) ) ) { IF( tmp < 0 ) { diffuseness[i] = 0; } ELSE { diffuseness[i] = tmp; } } ELSE { diffuseness[i] = L_shl( 1, exp2 ); } out_exp[i] = exp2; move32(); move16(); } return; } /*------------------------------------------------------------------------- * computeDiffuseness() * Loading lib_com/ivas_prot_fx.h +0 −12 Original line number Diff line number Diff line Loading @@ -4951,18 +4951,6 @@ void computeDirectionVectors_fx( Word32 *direction_vector_z, Word16 *q_factor ); void computeDiffuseness_fx( Word32 *buffer_intensity[DIRAC_NUM_DIMS][DIRAC_NO_COL_AVG_DIFF], const Word32 *buffer_energy, const Word16 num_freq_bands, Word32 *diffuseness, Word16 q_factor_intensity, Word16 q_factor_energy, Word16 *out_exp ); void computeDiffuseness_fixed( Word32 *buffer_intensity[DIRAC_NUM_DIMS][DIRAC_NO_COL_AVG_DIFF], const Word32 *buffer_energy, Loading lib_com/swb_tbe_com_fx.c +3 −0 Original line number Diff line number Diff line Loading @@ -3309,6 +3309,9 @@ void GenShapedSHBExcitation_ivas_enc_fx( move16(); move16(); scale_sig( White_exc16k, L_FRAME16k, -1 /* guard bit to prevent saturation in deemph*/ ); Q_White_exc16k = sub( Q_White_exc16k, 1 ); Word16 tbe_demph_fx = shl_sat( *tbe_demph, sub( Q_White_exc16k, *Q_bwe_exc ) ); // Q_White_exc16k deemph_fx( White_exc16k, PREEMPH_FAC, L_FRAME16k, &tbe_demph_fx ); Loading lib_dec/dec_tcx_fx.c +1 −1 Original line number Diff line number Diff line Loading @@ -2879,7 +2879,7 @@ void IMDCT_ivas_fx( { Word16 q_old_out = q_win; move16(); edct_fx( x_fx, xn_buf_fx_32 + add( shr( overlap, 1 ), nz ), L_frame, &q_xn_buf_fx_32 ); edct_ivas_fx( x_fx, xn_buf_fx_32 + add( shr( overlap, 1 ), nz ), L_frame, &q_xn_buf_fx_32 ); Word16 res_m, res_e; res_e = 0; move16(); Loading lib_enc/swb_tbe_enc_fx.c +31 −17 Original line number Diff line number Diff line Loading @@ -77,7 +77,8 @@ static void EstimateSHBGainShape_fx( const Word16 length, const Word16 Q_synSHB, Word16 *subgain, const Word16 *subwin, Word16 *n_subfr_saturation ); Word16 *n_subfr_saturation, const Flag limit_min_gain ); static Word32 pow_off_pk_fx( Word16 a[], Word16 len, Word16 step ); Loading Loading @@ -1072,7 +1073,7 @@ void wb_tbe_enc_fx( Copy( shaped_wb_excitation + L_FRAME16k / 4, hBWE_TD->state_syn_shbexc_fx, L_SHB_LAHEAD / 4 ); EstimateSHBGainShape_fx( SHB_OVERLAP_LEN / 2, hb_frame, Q_ns, shaped_wb_excitation, Q_bwe_exc_ext, GainShape, subwin_wb_fx, NULL ); shaped_wb_excitation, Q_bwe_exc_ext, GainShape, subwin_wb_fx, NULL, 1 ); /* Gain frame adjustment factor */ test(); Loading Loading @@ -1707,7 +1708,7 @@ void wb_tbe_enc_ivas_fx( Copy( shaped_wb_excitation + L_FRAME16k / 4, hBWE_TD->state_syn_shbexc_fx, L_SHB_LAHEAD / 4 ); EstimateSHBGainShape_fx( SHB_OVERLAP_LEN / 2, hb_frame, Q_ns, shaped_wb_excitation, Q_bwe_exc_ext, GainShape, subwin_wb_fx, NULL ); shaped_wb_excitation, Q_bwe_exc_ext, GainShape, subwin_wb_fx, NULL, 1 ); /* Gain frame adjustment factor */ test(); Loading Loading @@ -2552,7 +2553,7 @@ void swb_tbe_enc_fx( n_subfr_saturation = 0; move16(); EstimateSHBGainShape_fx( SHB_OVERLAP_LEN, shb_frame_fx, Q_shb, shaped_shb_excitation_fx, Q_bwe_exc, GainShape_fx, subwin_shb_fx, &n_subfr_saturation ); Q_bwe_exc, GainShape_fx, subwin_shb_fx, &n_subfr_saturation, 1 ); /* Gain shape BWS/high band low energy fix */ IF( LT_16( hBWE_TD->cldfbHBLT, 8192 /*1.0f Q13*/ ) ) /* cldfbHBLT in Q13 */ Loading Loading @@ -3857,7 +3858,7 @@ void swb_tbe_enc_ivas_fx( n_subfr_saturation = 0; move16(); EstimateSHBGainShape_fx( SHB_OVERLAP_LEN, shb_frame_fx, Q_shb, shaped_shb_excitation_fx, Q_bwe_exc, GainShape_fx, subwin_shb_fx, &n_subfr_saturation ); Q_bwe_exc, GainShape_fx, subwin_shb_fx, &n_subfr_saturation, 0 ); test(); IF( EQ_32( st_fx->extl_brate, SWB_TBE_1k10 ) || EQ_32( st_fx->extl_brate, SWB_TBE_1k75 ) ) Loading Loading @@ -4938,7 +4939,8 @@ static void EstimateSHBGainShape_fx( const Word16 Q_synSHB, /* i : Q of shaped SHB excitation */ Word16 *subgain, /* o : estimate of gain shape Q15 */ const Word16 *subwin, /* i : SHB subframe window Q15 */ Word16 *n_subfr_saturation /* o : Number of subframes which saturated while calculating oriNrg */ Word16 *n_subfr_saturation, /* o : Number of subframes which saturated while calculating oriNrg */ const Flag limit_min_gain /* i : gain shape limiting flag */ ) { const Word16 *skip; Loading Loading @@ -5152,12 +5154,24 @@ static void EstimateSHBGainShape_fx( n = sub( 31, add( n, ( sub( 28, shl( n_max, 1 ) ) ) ) ); normFact = Isqrt_lc( L_sum_gain, &n ); IF( limit_min_gain ) { FOR( i = 0; i < num_gains; i++ ) { L_tmp = Mpy_32_16_1( normFact, subgain[i] ); /*Q(31-n) * Q(31-norm[i]) */ /* Q(30-n-n_max) */ subgain[i] = s_max( round_fx_o( L_shl_o( L_tmp, add( n, n_max + 1 ), &Overflow ), &Overflow ), 3277 /*0.1f Q15*/ ); /* Q15 */ move16(); } } ELSE { FOR( i = 0; i < num_gains; i++ ) { L_tmp = Mpy_32_16_1( normFact, subgain[i] ); /*Q(31-n) * Q(31-norm[i]) */ /* Q(30-n-n_max) */ subgain[i] = round_fx_o( L_shl_o( L_tmp, add( n, n_max + 1 ), &Overflow ), &Overflow ); /* Q15 */ move16(); } } return; } Loading Loading
lib_com/ivas_dirac_com_fx.c +0 −115 Original line number Diff line number Diff line Loading @@ -778,121 +778,6 @@ void computeDirectionVectors_fx( return; } /*------------------------------------------------------------------------- * computeDiffuseness() * * *------------------------------------------------------------------------*/ void computeDiffuseness_fx( Word32 *buffer_intensity[DIRAC_NUM_DIMS][DIRAC_NO_COL_AVG_DIFF], // i: Q(q_factor_intensity) const Word32 *buffer_energy, // i: Q(q_factor_energy) const Word16 num_freq_bands, Word32 *diffuseness, // o: exp(out_exp) Word16 q_factor_intensity, Word16 q_factor_energy, Word16 *out_exp /*Ouput Q*/ ) { Word32 intensity_slow[DIRAC_NUM_DIMS * CLDFB_NO_CHANNELS_MAX]; Word32 intensity_slow_abs[CLDFB_NO_CHANNELS_MAX]; Word32 energy_slow[CLDFB_NO_CHANNELS_MAX]; Word16 i, j, k; Word32 tmp = 0, tmp_1; move32(); Word32 *p_tmp; const Word32 *p_tmp_c; /* Compute Intensity slow and energy slow */ set32_fx( intensity_slow, 0, DIRAC_NUM_DIMS * CLDFB_NO_CHANNELS_MAX ); set32_fx( intensity_slow_abs, 0, CLDFB_NO_CHANNELS_MAX ); set32_fx( energy_slow, 0, CLDFB_NO_CHANNELS_MAX ); FOR( i = 0; i < DIRAC_NO_COL_AVG_DIFF; ++i ) { /* Energy slow */ p_tmp_c = buffer_energy + i * num_freq_bands; FOR( k = 0; k < num_freq_bands; k++ ) { energy_slow[k] = L_add( *( p_tmp_c++ ), energy_slow[k] ); // Q(q_factor_energy) move32(); } /* Intensity slow */ FOR( j = 0; j < DIRAC_NUM_DIMS; ++j ) { p_tmp = buffer_intensity[j][i]; FOR( k = 0; k < num_freq_bands; k++ ) { intensity_slow[j * num_freq_bands + k] = L_add( *( p_tmp++ ), intensity_slow[j * num_freq_bands + k] ); move32(); } } } /* intensity_slow.^2 + intensity_slow_abs*/ FOR( j = 0; j < DIRAC_NUM_DIMS; ++j ) { p_tmp = intensity_slow + j * num_freq_bands; FOR( k = 0; k < num_freq_bands; k++ ) { *( p_tmp ) = Mpy_32_32( *p_tmp, *( p_tmp ) ); // Q( 2*(q_factor_intensity + scale_fact - 1) -31 ) intensity_slow_abs[k] = L_add( *( p_tmp++ ), intensity_slow_abs[k] ); move32(); move32(); } } Word16 init_exp = sub( 62, shl( q_factor_intensity, 1 ) ); // 31 - ( 2 * q_factor_intensity - 31 ) Word16 exp; Word16 exp1 = 0, exp2; move16(); /* Compute Diffuseness */ p_tmp = intensity_slow_abs; FOR( i = 0; i < num_freq_bands; ++i ) { exp = init_exp; move16(); Word32 temp = *( p_tmp++ ); move32(); tmp_1 = Sqrt32( temp, &exp ); tmp = L_deposit_h( BASOP_Util_Divide3232_Scale( tmp_1, L_add( energy_slow[i], 1 ), &exp1 ) ); exp2 = add( sub( 31, exp1 ), sub( sub( 31, exp ), q_factor_energy ) ); IF( GT_32( exp2, 30 ) ) { tmp = L_shr( tmp, sub( exp2, 30 ) ); exp2 = sub( exp2, sub( exp2, 30 ) ); } tmp = L_sub( L_shl( 1, exp2 ), tmp ); // diffuseness[i] = ( ( tmp < L_shl( 1, exp2 ) ) ? ( ( tmp < 0 ) ? 0 : tmp ) : L_shl( 1, exp2 ) ); IF( LT_32( tmp, L_shl( 1, exp2 ) ) ) { IF( tmp < 0 ) { diffuseness[i] = 0; } ELSE { diffuseness[i] = tmp; } } ELSE { diffuseness[i] = L_shl( 1, exp2 ); } out_exp[i] = exp2; move32(); move16(); } return; } /*------------------------------------------------------------------------- * computeDiffuseness() * Loading
lib_com/ivas_prot_fx.h +0 −12 Original line number Diff line number Diff line Loading @@ -4951,18 +4951,6 @@ void computeDirectionVectors_fx( Word32 *direction_vector_z, Word16 *q_factor ); void computeDiffuseness_fx( Word32 *buffer_intensity[DIRAC_NUM_DIMS][DIRAC_NO_COL_AVG_DIFF], const Word32 *buffer_energy, const Word16 num_freq_bands, Word32 *diffuseness, Word16 q_factor_intensity, Word16 q_factor_energy, Word16 *out_exp ); void computeDiffuseness_fixed( Word32 *buffer_intensity[DIRAC_NUM_DIMS][DIRAC_NO_COL_AVG_DIFF], const Word32 *buffer_energy, Loading
lib_com/swb_tbe_com_fx.c +3 −0 Original line number Diff line number Diff line Loading @@ -3309,6 +3309,9 @@ void GenShapedSHBExcitation_ivas_enc_fx( move16(); move16(); scale_sig( White_exc16k, L_FRAME16k, -1 /* guard bit to prevent saturation in deemph*/ ); Q_White_exc16k = sub( Q_White_exc16k, 1 ); Word16 tbe_demph_fx = shl_sat( *tbe_demph, sub( Q_White_exc16k, *Q_bwe_exc ) ); // Q_White_exc16k deemph_fx( White_exc16k, PREEMPH_FAC, L_FRAME16k, &tbe_demph_fx ); Loading
lib_dec/dec_tcx_fx.c +1 −1 Original line number Diff line number Diff line Loading @@ -2879,7 +2879,7 @@ void IMDCT_ivas_fx( { Word16 q_old_out = q_win; move16(); edct_fx( x_fx, xn_buf_fx_32 + add( shr( overlap, 1 ), nz ), L_frame, &q_xn_buf_fx_32 ); edct_ivas_fx( x_fx, xn_buf_fx_32 + add( shr( overlap, 1 ), nz ), L_frame, &q_xn_buf_fx_32 ); Word16 res_m, res_e; res_e = 0; move16(); Loading
lib_enc/swb_tbe_enc_fx.c +31 −17 Original line number Diff line number Diff line Loading @@ -77,7 +77,8 @@ static void EstimateSHBGainShape_fx( const Word16 length, const Word16 Q_synSHB, Word16 *subgain, const Word16 *subwin, Word16 *n_subfr_saturation ); Word16 *n_subfr_saturation, const Flag limit_min_gain ); static Word32 pow_off_pk_fx( Word16 a[], Word16 len, Word16 step ); Loading Loading @@ -1072,7 +1073,7 @@ void wb_tbe_enc_fx( Copy( shaped_wb_excitation + L_FRAME16k / 4, hBWE_TD->state_syn_shbexc_fx, L_SHB_LAHEAD / 4 ); EstimateSHBGainShape_fx( SHB_OVERLAP_LEN / 2, hb_frame, Q_ns, shaped_wb_excitation, Q_bwe_exc_ext, GainShape, subwin_wb_fx, NULL ); shaped_wb_excitation, Q_bwe_exc_ext, GainShape, subwin_wb_fx, NULL, 1 ); /* Gain frame adjustment factor */ test(); Loading Loading @@ -1707,7 +1708,7 @@ void wb_tbe_enc_ivas_fx( Copy( shaped_wb_excitation + L_FRAME16k / 4, hBWE_TD->state_syn_shbexc_fx, L_SHB_LAHEAD / 4 ); EstimateSHBGainShape_fx( SHB_OVERLAP_LEN / 2, hb_frame, Q_ns, shaped_wb_excitation, Q_bwe_exc_ext, GainShape, subwin_wb_fx, NULL ); shaped_wb_excitation, Q_bwe_exc_ext, GainShape, subwin_wb_fx, NULL, 1 ); /* Gain frame adjustment factor */ test(); Loading Loading @@ -2552,7 +2553,7 @@ void swb_tbe_enc_fx( n_subfr_saturation = 0; move16(); EstimateSHBGainShape_fx( SHB_OVERLAP_LEN, shb_frame_fx, Q_shb, shaped_shb_excitation_fx, Q_bwe_exc, GainShape_fx, subwin_shb_fx, &n_subfr_saturation ); Q_bwe_exc, GainShape_fx, subwin_shb_fx, &n_subfr_saturation, 1 ); /* Gain shape BWS/high band low energy fix */ IF( LT_16( hBWE_TD->cldfbHBLT, 8192 /*1.0f Q13*/ ) ) /* cldfbHBLT in Q13 */ Loading Loading @@ -3857,7 +3858,7 @@ void swb_tbe_enc_ivas_fx( n_subfr_saturation = 0; move16(); EstimateSHBGainShape_fx( SHB_OVERLAP_LEN, shb_frame_fx, Q_shb, shaped_shb_excitation_fx, Q_bwe_exc, GainShape_fx, subwin_shb_fx, &n_subfr_saturation ); Q_bwe_exc, GainShape_fx, subwin_shb_fx, &n_subfr_saturation, 0 ); test(); IF( EQ_32( st_fx->extl_brate, SWB_TBE_1k10 ) || EQ_32( st_fx->extl_brate, SWB_TBE_1k75 ) ) Loading Loading @@ -4938,7 +4939,8 @@ static void EstimateSHBGainShape_fx( const Word16 Q_synSHB, /* i : Q of shaped SHB excitation */ Word16 *subgain, /* o : estimate of gain shape Q15 */ const Word16 *subwin, /* i : SHB subframe window Q15 */ Word16 *n_subfr_saturation /* o : Number of subframes which saturated while calculating oriNrg */ Word16 *n_subfr_saturation, /* o : Number of subframes which saturated while calculating oriNrg */ const Flag limit_min_gain /* i : gain shape limiting flag */ ) { const Word16 *skip; Loading Loading @@ -5152,12 +5154,24 @@ static void EstimateSHBGainShape_fx( n = sub( 31, add( n, ( sub( 28, shl( n_max, 1 ) ) ) ) ); normFact = Isqrt_lc( L_sum_gain, &n ); IF( limit_min_gain ) { FOR( i = 0; i < num_gains; i++ ) { L_tmp = Mpy_32_16_1( normFact, subgain[i] ); /*Q(31-n) * Q(31-norm[i]) */ /* Q(30-n-n_max) */ subgain[i] = s_max( round_fx_o( L_shl_o( L_tmp, add( n, n_max + 1 ), &Overflow ), &Overflow ), 3277 /*0.1f Q15*/ ); /* Q15 */ move16(); } } ELSE { FOR( i = 0; i < num_gains; i++ ) { L_tmp = Mpy_32_16_1( normFact, subgain[i] ); /*Q(31-n) * Q(31-norm[i]) */ /* Q(30-n-n_max) */ subgain[i] = round_fx_o( L_shl_o( L_tmp, add( n, n_max + 1 ), &Overflow ), &Overflow ); /* Q15 */ move16(); } } return; } Loading