Loading lib_com/options.h +2 −0 Original line number Diff line number Diff line Loading @@ -80,4 +80,6 @@ #define CR_2109_to_2112_cd0_ce0 /* This is related to the CRs include in the 26.444 package of 21-12. Concerns lead_deindexing and */ #define FIX_QMETADATA_PENALTY /* Nokia: transform penalty calculation in qmetadata into integer operations */ #define FIX_1013_CRASH_HQ_CORE_DEC /* Ittiam: Saturation added on the lines of EVS */ #define NONE_BE_FIX_BASOP_1044_OSBA_PRERENDER_MIX_GAINS /* DLB: adjust prerendering and mixing gain in OSBA encoder. This is fix to float codes*/ #define NONBE_1233_HQ_CLASSIFIER_DIV_BY_ZERO /* Eri: issue 1233: Address possible division by zero in hf_spectrum_sparseness() */ #endif lib_enc/hq_classifier_enc_fx.c +77 −55 Original line number Diff line number Diff line Loading @@ -57,9 +57,12 @@ static Word16 hf_spectrum_sparseness_fx( Word32 crest_mod_fx; const Word16 *p_num_fx; Word32 A_fx[960]; int16_t result; Word16 result; Word32 *crest_lp_fx; Word32 *crest_mod_lp_fx; Word32 hq_crest_threshold, hq_crest_mod_threshold; Word16 inv_rms32_e = 0; move16(); crest_lp_fx = &st->hHQ_core->crest_lp_fx; crest_mod_lp_fx = &st->hHQ_core->crest_mod_lp_fx; Loading @@ -81,6 +84,18 @@ static Word16 hf_spectrum_sparseness_fx( crest_mod_fx = 0; move32(); maximum_l( A_fx, L_SPEC_HB, &Amax_fx ); #ifdef NONBE_1233_HQ_CLASSIFIER_DIV_BY_ZERO IF( Amax_fx == 0 ) { /* For all-zero input the crest is 1.0 */ crest_fx = L_shl( 1, st->hHQ_core->crest_lp_q ); crest_mod_fx = L_shl( 1, st->hHQ_core->crest_mod_lp_q ); low_count_fx = 0; move16(); } ELSE { #endif thr_fx = Mpy_32_32( Amax_fx, PEAK_THRESHOLD_FX ); movmean_fx = 0; /* avoid uninitialized warning */ // p_num = &inv_tbl[HALF_WIN_LENGTH + 1]; /* Table for division 1./(11:21) */ Loading Loading @@ -130,8 +145,6 @@ static Word16 hf_spectrum_sparseness_fx( Word16 l_shift = W_norm( inv_rms_fx ); inv_rms32_fx = W_extract_h( W_shl( inv_rms_fx, l_shift ) ); // Q15+l_shift-32 Word16 q_rms = sub( add( Q15, l_shift ), 32 ); // q_rms Word16 inv_rms32_e = 0; move16(); inv_rms32_div_fx = BASOP_Util_Divide3232_Scale_cadence( inv_rms32_fx, L_SPEC_HB, &inv_rms32_e ); inv_rms32_e = sub( 31, add( sub( Q31, inv_rms32_e ), q_rms ) ); // inv_rms = 1.0f / (float) sqrtf( inv_rms / L_SPEC_HB ); Loading @@ -142,12 +155,21 @@ static Word16 hf_spectrum_sparseness_fx( *crest_lp_fx = L_shr( *crest_lp_fx, sub( st->hHQ_core->crest_lp_q, sub( Q12, inv_rms32_e ) ) ); move32(); st->hHQ_core->crest_lp_q = sub( Q12, inv_rms32_e ); *crest_lp_fx = L_add( Mpy_32_32( HQ_CREST_FAC_SM_FX, ( *crest_lp_fx ) ), Mpy_32_32( ONE_IN_Q31 - HQ_CREST_FAC_SM_FX, crest_fx ) ); // Q12 - inv_rms32_e move16(); *crest_mod_lp_fx = L_shr( *crest_mod_lp_fx, sub( st->hHQ_core->crest_mod_lp_q, sub( Q12, inv_rms32_e ) ) ); move32(); st->hHQ_core->crest_mod_lp_q = sub( Q12, inv_rms32_e ); *crest_mod_lp_fx = L_add( Mpy_32_32( HQ_CREST_FAC_SM_FX, ( *crest_mod_lp_fx ) ), Mpy_32_32( L_sub( ONE_IN_Q31, HQ_CREST_FAC_SM_FX ), crest_mod_fx ) ); // Q12 - inv_rms32_e Word32 hq_crest_threshold = L_shr( HQ_CREST_THRESHOLD_FX, sub( Q28, sub( Q12, inv_rms32_e ) ) ); Word32 hq_crest_mod_threshold = L_shr( HQ_CREST_MOD_THRESHOLD_FX, sub( Q29, sub( Q12, inv_rms32_e ) ) ); move16(); #ifdef NONBE_1233_HQ_CLASSIFIER_DIV_BY_ZERO } #endif *crest_lp_fx = L_add( Mpy_32_32( HQ_CREST_FAC_SM_FX, ( *crest_lp_fx ) ), Mpy_32_32( ONE_IN_Q31 - HQ_CREST_FAC_SM_FX, crest_fx ) ); /* Q(st->hHQ_core->crest_lp_q) */ move32(); *crest_mod_lp_fx = L_add( Mpy_32_32( HQ_CREST_FAC_SM_FX, ( *crest_mod_lp_fx ) ), Mpy_32_32( L_sub( ONE_IN_Q31, HQ_CREST_FAC_SM_FX ), crest_mod_fx ) ); /* Q(st->hHQ_core->crest_mod_lp_q) */ move32(); hq_crest_threshold = L_shr( HQ_CREST_THRESHOLD_FX, sub( Q28, st->hHQ_core->crest_lp_q ) ); /* Q(st->hHQ_core->crest_lp_q) */ hq_crest_mod_threshold = L_shr( HQ_CREST_MOD_THRESHOLD_FX, sub( Q29, st->hHQ_core->crest_mod_lp_q ) ); /* Q(st->hHQ_core->crest_mod_lp_q) */ test(); test(); if ( GT_32( ( *crest_lp_fx ), hq_crest_threshold ) && GT_32( ( *crest_mod_lp_fx ), hq_crest_mod_threshold ) && GT_16( low_count_fx, LOW_COUNT_THRESHOLD ) ) Loading lib_enc/ivas_osba_enc.c +9 −0 Original line number Diff line number Diff line Loading @@ -79,7 +79,11 @@ static void ivas_merge_sba_transports_fx( { FOR( j = 0; j < input_frame; j++ ) { #ifdef NONE_BE_FIX_BASOP_1044_OSBA_PRERENDER_MIX_GAINS data_out_f[i][j] = L_shr( L_add( L_shr( data_in_f1[i][j], 1 ), L_shr( data_in_f2[i][j], sub( Q_f2, sub( Q_f1, 1 ) ) ) ), Q1 ); #else data_out_f[i][j] = L_add( L_shr( data_in_f1[i][j], 1 ), L_shr( data_in_f2[i][j], sub( Q_f2, sub( Q_f1, 1 ) ) ) ); #endif move32(); } } Loading Loading @@ -477,7 +481,9 @@ static void ivas_osba_render_ism_to_sba_fx( Word16 azimuth_fx, elevation_fx; Word32 gains_fx[MAX_INPUT_CHANNELS]; Word32 g1_fx, g2_fx; #ifndef NONE_BE_FIX_BASOP_1044_OSBA_PRERENDER_MIX_GAINS Word32 output_gain_fx; #endif Word16 nchan_sba; nchan_sba = imult1616( add( sba_analysis_order, 1 ), add( sba_analysis_order, 1 ) ); Loading Loading @@ -518,6 +524,8 @@ static void ivas_osba_render_ism_to_sba_fx( } } *Q_data = sub( *Q_data, 2 ); #ifndef NONE_BE_FIX_BASOP_1044_OSBA_PRERENDER_MIX_GAINS /* Gain with loudness-matching gains */ // output_gain = 0.7499f; output_gain_fx = 1610397988; // 0.7499f in Q31 Loading @@ -531,6 +539,7 @@ static void ivas_osba_render_ism_to_sba_fx( move32(); } } #endif return; } lib_enc/ivas_stereo_classifier.c +7 −6 Original line number Diff line number Diff line Loading @@ -1192,6 +1192,7 @@ void xtalk_classifier_dft_fx( Word16 edge_0_1, wedge; Word32 ratio_m1_m2, m2_m2, d_itd2, itd1_flip; Word32 scr_min, scr_max; Word64 W_tmp; hStereoClassif = hCPE->hStereoClassif; hItd = ( hCPE->hStereoDft != NULL ) ? hCPE->hStereoDft->hItd : hCPE->hStereoMdct->hItd; Loading Loading @@ -1271,8 +1272,8 @@ void xtalk_classifier_dft_fx( set32_fx( fvn, -ONE_IN_Q29, SSC_MAX_NFEA ); /* calcualte raw score based on LR */ score = XTALK_INTERCEPT_DFT_Q27; move32(); W_tmp = XTALK_INTERCEPT_DFT_Q27; move64(); FOR( i = 0; i < SIZE_XTALK_ISEL_DFT; i++ ) { ind = xtalk_isel_dft[i]; Loading @@ -1287,16 +1288,16 @@ void xtalk_classifier_dft_fx( /* LR */ // score += fvn[i] * xtalk_coef_dft[i]; score = L_add( score, L_shr( Mpy_32_32( fvn[i], xtalk_coef_dft_q30[i] ), 1 ) ); // Q27 W_tmp = W_add( W_tmp, L_shr( Mpy_32_32( fvn[i], xtalk_coef_dft_q30[i] ), 1 ) ); // Q27 } /* normalize score to -1:+1 */ IF( GT_32( score, XTALK_SCORE_THR_DFT_Q27 ) ) IF( GT_64( W_tmp, XTALK_SCORE_THR_DFT_Q27 ) ) { score = MAX_32; // Q31 move32(); } ELSE IF( LT_32( score, -XTALK_SCORE_THR_DFT_Q27 ) ) ELSE IF( LT_64( W_tmp, -XTALK_SCORE_THR_DFT_Q27 ) ) { score = MIN_32; // Q31 move32(); Loading @@ -1304,7 +1305,7 @@ void xtalk_classifier_dft_fx( ELSE { // score /= XTALK_SCORE_THR_DFT; score = L_shl_sat( score, 2 ); // Q27->Q31/XTALK_SCORE_THR_DFT score = L_shl_sat( W_extract_l( W_tmp ), 2 ); // Q27->Q31/XTALK_SCORE_THR_DFT } /* raw score */ Loading Loading
lib_com/options.h +2 −0 Original line number Diff line number Diff line Loading @@ -80,4 +80,6 @@ #define CR_2109_to_2112_cd0_ce0 /* This is related to the CRs include in the 26.444 package of 21-12. Concerns lead_deindexing and */ #define FIX_QMETADATA_PENALTY /* Nokia: transform penalty calculation in qmetadata into integer operations */ #define FIX_1013_CRASH_HQ_CORE_DEC /* Ittiam: Saturation added on the lines of EVS */ #define NONE_BE_FIX_BASOP_1044_OSBA_PRERENDER_MIX_GAINS /* DLB: adjust prerendering and mixing gain in OSBA encoder. This is fix to float codes*/ #define NONBE_1233_HQ_CLASSIFIER_DIV_BY_ZERO /* Eri: issue 1233: Address possible division by zero in hf_spectrum_sparseness() */ #endif
lib_enc/hq_classifier_enc_fx.c +77 −55 Original line number Diff line number Diff line Loading @@ -57,9 +57,12 @@ static Word16 hf_spectrum_sparseness_fx( Word32 crest_mod_fx; const Word16 *p_num_fx; Word32 A_fx[960]; int16_t result; Word16 result; Word32 *crest_lp_fx; Word32 *crest_mod_lp_fx; Word32 hq_crest_threshold, hq_crest_mod_threshold; Word16 inv_rms32_e = 0; move16(); crest_lp_fx = &st->hHQ_core->crest_lp_fx; crest_mod_lp_fx = &st->hHQ_core->crest_mod_lp_fx; Loading @@ -81,6 +84,18 @@ static Word16 hf_spectrum_sparseness_fx( crest_mod_fx = 0; move32(); maximum_l( A_fx, L_SPEC_HB, &Amax_fx ); #ifdef NONBE_1233_HQ_CLASSIFIER_DIV_BY_ZERO IF( Amax_fx == 0 ) { /* For all-zero input the crest is 1.0 */ crest_fx = L_shl( 1, st->hHQ_core->crest_lp_q ); crest_mod_fx = L_shl( 1, st->hHQ_core->crest_mod_lp_q ); low_count_fx = 0; move16(); } ELSE { #endif thr_fx = Mpy_32_32( Amax_fx, PEAK_THRESHOLD_FX ); movmean_fx = 0; /* avoid uninitialized warning */ // p_num = &inv_tbl[HALF_WIN_LENGTH + 1]; /* Table for division 1./(11:21) */ Loading Loading @@ -130,8 +145,6 @@ static Word16 hf_spectrum_sparseness_fx( Word16 l_shift = W_norm( inv_rms_fx ); inv_rms32_fx = W_extract_h( W_shl( inv_rms_fx, l_shift ) ); // Q15+l_shift-32 Word16 q_rms = sub( add( Q15, l_shift ), 32 ); // q_rms Word16 inv_rms32_e = 0; move16(); inv_rms32_div_fx = BASOP_Util_Divide3232_Scale_cadence( inv_rms32_fx, L_SPEC_HB, &inv_rms32_e ); inv_rms32_e = sub( 31, add( sub( Q31, inv_rms32_e ), q_rms ) ); // inv_rms = 1.0f / (float) sqrtf( inv_rms / L_SPEC_HB ); Loading @@ -142,12 +155,21 @@ static Word16 hf_spectrum_sparseness_fx( *crest_lp_fx = L_shr( *crest_lp_fx, sub( st->hHQ_core->crest_lp_q, sub( Q12, inv_rms32_e ) ) ); move32(); st->hHQ_core->crest_lp_q = sub( Q12, inv_rms32_e ); *crest_lp_fx = L_add( Mpy_32_32( HQ_CREST_FAC_SM_FX, ( *crest_lp_fx ) ), Mpy_32_32( ONE_IN_Q31 - HQ_CREST_FAC_SM_FX, crest_fx ) ); // Q12 - inv_rms32_e move16(); *crest_mod_lp_fx = L_shr( *crest_mod_lp_fx, sub( st->hHQ_core->crest_mod_lp_q, sub( Q12, inv_rms32_e ) ) ); move32(); st->hHQ_core->crest_mod_lp_q = sub( Q12, inv_rms32_e ); *crest_mod_lp_fx = L_add( Mpy_32_32( HQ_CREST_FAC_SM_FX, ( *crest_mod_lp_fx ) ), Mpy_32_32( L_sub( ONE_IN_Q31, HQ_CREST_FAC_SM_FX ), crest_mod_fx ) ); // Q12 - inv_rms32_e Word32 hq_crest_threshold = L_shr( HQ_CREST_THRESHOLD_FX, sub( Q28, sub( Q12, inv_rms32_e ) ) ); Word32 hq_crest_mod_threshold = L_shr( HQ_CREST_MOD_THRESHOLD_FX, sub( Q29, sub( Q12, inv_rms32_e ) ) ); move16(); #ifdef NONBE_1233_HQ_CLASSIFIER_DIV_BY_ZERO } #endif *crest_lp_fx = L_add( Mpy_32_32( HQ_CREST_FAC_SM_FX, ( *crest_lp_fx ) ), Mpy_32_32( ONE_IN_Q31 - HQ_CREST_FAC_SM_FX, crest_fx ) ); /* Q(st->hHQ_core->crest_lp_q) */ move32(); *crest_mod_lp_fx = L_add( Mpy_32_32( HQ_CREST_FAC_SM_FX, ( *crest_mod_lp_fx ) ), Mpy_32_32( L_sub( ONE_IN_Q31, HQ_CREST_FAC_SM_FX ), crest_mod_fx ) ); /* Q(st->hHQ_core->crest_mod_lp_q) */ move32(); hq_crest_threshold = L_shr( HQ_CREST_THRESHOLD_FX, sub( Q28, st->hHQ_core->crest_lp_q ) ); /* Q(st->hHQ_core->crest_lp_q) */ hq_crest_mod_threshold = L_shr( HQ_CREST_MOD_THRESHOLD_FX, sub( Q29, st->hHQ_core->crest_mod_lp_q ) ); /* Q(st->hHQ_core->crest_mod_lp_q) */ test(); test(); if ( GT_32( ( *crest_lp_fx ), hq_crest_threshold ) && GT_32( ( *crest_mod_lp_fx ), hq_crest_mod_threshold ) && GT_16( low_count_fx, LOW_COUNT_THRESHOLD ) ) Loading
lib_enc/ivas_osba_enc.c +9 −0 Original line number Diff line number Diff line Loading @@ -79,7 +79,11 @@ static void ivas_merge_sba_transports_fx( { FOR( j = 0; j < input_frame; j++ ) { #ifdef NONE_BE_FIX_BASOP_1044_OSBA_PRERENDER_MIX_GAINS data_out_f[i][j] = L_shr( L_add( L_shr( data_in_f1[i][j], 1 ), L_shr( data_in_f2[i][j], sub( Q_f2, sub( Q_f1, 1 ) ) ) ), Q1 ); #else data_out_f[i][j] = L_add( L_shr( data_in_f1[i][j], 1 ), L_shr( data_in_f2[i][j], sub( Q_f2, sub( Q_f1, 1 ) ) ) ); #endif move32(); } } Loading Loading @@ -477,7 +481,9 @@ static void ivas_osba_render_ism_to_sba_fx( Word16 azimuth_fx, elevation_fx; Word32 gains_fx[MAX_INPUT_CHANNELS]; Word32 g1_fx, g2_fx; #ifndef NONE_BE_FIX_BASOP_1044_OSBA_PRERENDER_MIX_GAINS Word32 output_gain_fx; #endif Word16 nchan_sba; nchan_sba = imult1616( add( sba_analysis_order, 1 ), add( sba_analysis_order, 1 ) ); Loading Loading @@ -518,6 +524,8 @@ static void ivas_osba_render_ism_to_sba_fx( } } *Q_data = sub( *Q_data, 2 ); #ifndef NONE_BE_FIX_BASOP_1044_OSBA_PRERENDER_MIX_GAINS /* Gain with loudness-matching gains */ // output_gain = 0.7499f; output_gain_fx = 1610397988; // 0.7499f in Q31 Loading @@ -531,6 +539,7 @@ static void ivas_osba_render_ism_to_sba_fx( move32(); } } #endif return; }
lib_enc/ivas_stereo_classifier.c +7 −6 Original line number Diff line number Diff line Loading @@ -1192,6 +1192,7 @@ void xtalk_classifier_dft_fx( Word16 edge_0_1, wedge; Word32 ratio_m1_m2, m2_m2, d_itd2, itd1_flip; Word32 scr_min, scr_max; Word64 W_tmp; hStereoClassif = hCPE->hStereoClassif; hItd = ( hCPE->hStereoDft != NULL ) ? hCPE->hStereoDft->hItd : hCPE->hStereoMdct->hItd; Loading Loading @@ -1271,8 +1272,8 @@ void xtalk_classifier_dft_fx( set32_fx( fvn, -ONE_IN_Q29, SSC_MAX_NFEA ); /* calcualte raw score based on LR */ score = XTALK_INTERCEPT_DFT_Q27; move32(); W_tmp = XTALK_INTERCEPT_DFT_Q27; move64(); FOR( i = 0; i < SIZE_XTALK_ISEL_DFT; i++ ) { ind = xtalk_isel_dft[i]; Loading @@ -1287,16 +1288,16 @@ void xtalk_classifier_dft_fx( /* LR */ // score += fvn[i] * xtalk_coef_dft[i]; score = L_add( score, L_shr( Mpy_32_32( fvn[i], xtalk_coef_dft_q30[i] ), 1 ) ); // Q27 W_tmp = W_add( W_tmp, L_shr( Mpy_32_32( fvn[i], xtalk_coef_dft_q30[i] ), 1 ) ); // Q27 } /* normalize score to -1:+1 */ IF( GT_32( score, XTALK_SCORE_THR_DFT_Q27 ) ) IF( GT_64( W_tmp, XTALK_SCORE_THR_DFT_Q27 ) ) { score = MAX_32; // Q31 move32(); } ELSE IF( LT_32( score, -XTALK_SCORE_THR_DFT_Q27 ) ) ELSE IF( LT_64( W_tmp, -XTALK_SCORE_THR_DFT_Q27 ) ) { score = MIN_32; // Q31 move32(); Loading @@ -1304,7 +1305,7 @@ void xtalk_classifier_dft_fx( ELSE { // score /= XTALK_SCORE_THR_DFT; score = L_shl_sat( score, 2 ); // Q27->Q31/XTALK_SCORE_THR_DFT score = L_shl_sat( W_extract_l( W_tmp ), 2 ); // Q27->Q31/XTALK_SCORE_THR_DFT } /* raw score */ Loading