Loading lib_com/options.h +1 −0 Original line number Diff line number Diff line Loading @@ -176,6 +176,7 @@ #define NONBE_FIX_1196_TD_HEADTRACKING_INTERPOLATION /* Ericsson: Issue 1196, Always apply filter interpolation for each subframe */ #define NONBE_1220_OMASA_JBM_BRATE_SW_FLUSH /* VA: issue 1220: fix bug in renderer flush in OMASA 1ISM JBM bitrate switching */ #define NONBE_1229_FIX_ISM1_DPID /* Eri: issue 1229: fix bug causing ISM 1 to use default -dpid instead of the specified one */ #define NONBE_1233_HQ_CLASSIFIER_DIV_BY_ZERO /* Eri: issue 1233: Address possible division by zero in hf_spectrum_sparseness() */ /* ##################### End NON-BE switches ########################### */ Loading lib_enc/hq_classifier_enc.c +55 −0 Original line number Diff line number Diff line Loading @@ -573,6 +573,16 @@ static int16_t hf_spectrum_sparseness( inv_rms = 0.0f; crest_mod = 0.0f; maximum( A, L_SPEC_HB, &Amax ); #ifdef NONBE_1233_HQ_CLASSIFIER_DIV_BY_ZERO if ( Amax == 0 ) { /* For all-zero input the crest is 1.0 */ crest = 1.0f; crest_mod = 1.0f; low_count = 0; } else { thr = Amax * PEAK_THRESHOLD; movmean = 0.0f; /* avoid uninitialized warning */ p_num = &inv_tbl[HALF_WIN_LENGTH + 1]; /* Table for division 1./(11:21) */ Loading Loading @@ -615,6 +625,51 @@ static int16_t hf_spectrum_sparseness( inv_rms = 1.0f / (float) sqrtf( inv_rms / L_SPEC_HB ); crest = Amax * inv_rms; crest_mod = crest_mod * inv_rms; } #else thr = Amax * PEAK_THRESHOLD; movmean = 0.0f; /* avoid uninitialized warning */ p_num = &inv_tbl[HALF_WIN_LENGTH + 1]; /* Table for division 1./(11:21) */ for ( i = 0; i < L_SPEC_HB; i++ ) { inv_rms += A[i] * A[i]; if ( A[i] < thr ) { low_count += 1; } if ( i <= HALF_WIN_LENGTH ) { if ( i == 0 ) { movmean = sum_f( &A[0], i + HALF_WIN_LENGTH + 1 ) * ( *p_num ); } else { p_num++; movmean = movmean + ( A[i + HALF_WIN_LENGTH] - movmean ) * ( *p_num ); } } else { if ( L_SPEC_HB <= i + HALF_WIN_LENGTH ) { p_num--; movmean = movmean + ( movmean - A[i - HALF_WIN_LENGTH - 1] ) * ( *p_num ); } else { movmean = movmean + ( A[i + HALF_WIN_LENGTH] - A[i - HALF_WIN_LENGTH - 1] ) * ( *p_num ); } } if ( crest_mod < movmean ) { crest_mod = movmean; } } inv_rms = 1.0f / (float) sqrtf( inv_rms / L_SPEC_HB ); crest = Amax * inv_rms; crest_mod = crest_mod * inv_rms; #endif *crest_lp = HQ_CREST_FAC_SM * ( *crest_lp ) + ( 1.0f - HQ_CREST_FAC_SM ) * crest; *crest_mod_lp = HQ_CREST_FAC_SM * ( *crest_mod_lp ) + ( 1.0f - HQ_CREST_FAC_SM ) * crest_mod; Loading Loading
lib_com/options.h +1 −0 Original line number Diff line number Diff line Loading @@ -176,6 +176,7 @@ #define NONBE_FIX_1196_TD_HEADTRACKING_INTERPOLATION /* Ericsson: Issue 1196, Always apply filter interpolation for each subframe */ #define NONBE_1220_OMASA_JBM_BRATE_SW_FLUSH /* VA: issue 1220: fix bug in renderer flush in OMASA 1ISM JBM bitrate switching */ #define NONBE_1229_FIX_ISM1_DPID /* Eri: issue 1229: fix bug causing ISM 1 to use default -dpid instead of the specified one */ #define NONBE_1233_HQ_CLASSIFIER_DIV_BY_ZERO /* Eri: issue 1233: Address possible division by zero in hf_spectrum_sparseness() */ /* ##################### End NON-BE switches ########################### */ Loading
lib_enc/hq_classifier_enc.c +55 −0 Original line number Diff line number Diff line Loading @@ -573,6 +573,16 @@ static int16_t hf_spectrum_sparseness( inv_rms = 0.0f; crest_mod = 0.0f; maximum( A, L_SPEC_HB, &Amax ); #ifdef NONBE_1233_HQ_CLASSIFIER_DIV_BY_ZERO if ( Amax == 0 ) { /* For all-zero input the crest is 1.0 */ crest = 1.0f; crest_mod = 1.0f; low_count = 0; } else { thr = Amax * PEAK_THRESHOLD; movmean = 0.0f; /* avoid uninitialized warning */ p_num = &inv_tbl[HALF_WIN_LENGTH + 1]; /* Table for division 1./(11:21) */ Loading Loading @@ -615,6 +625,51 @@ static int16_t hf_spectrum_sparseness( inv_rms = 1.0f / (float) sqrtf( inv_rms / L_SPEC_HB ); crest = Amax * inv_rms; crest_mod = crest_mod * inv_rms; } #else thr = Amax * PEAK_THRESHOLD; movmean = 0.0f; /* avoid uninitialized warning */ p_num = &inv_tbl[HALF_WIN_LENGTH + 1]; /* Table for division 1./(11:21) */ for ( i = 0; i < L_SPEC_HB; i++ ) { inv_rms += A[i] * A[i]; if ( A[i] < thr ) { low_count += 1; } if ( i <= HALF_WIN_LENGTH ) { if ( i == 0 ) { movmean = sum_f( &A[0], i + HALF_WIN_LENGTH + 1 ) * ( *p_num ); } else { p_num++; movmean = movmean + ( A[i + HALF_WIN_LENGTH] - movmean ) * ( *p_num ); } } else { if ( L_SPEC_HB <= i + HALF_WIN_LENGTH ) { p_num--; movmean = movmean + ( movmean - A[i - HALF_WIN_LENGTH - 1] ) * ( *p_num ); } else { movmean = movmean + ( A[i + HALF_WIN_LENGTH] - A[i - HALF_WIN_LENGTH - 1] ) * ( *p_num ); } } if ( crest_mod < movmean ) { crest_mod = movmean; } } inv_rms = 1.0f / (float) sqrtf( inv_rms / L_SPEC_HB ); crest = Amax * inv_rms; crest_mod = crest_mod * inv_rms; #endif *crest_lp = HQ_CREST_FAC_SM * ( *crest_lp ) + ( 1.0f - HQ_CREST_FAC_SM ) * crest; *crest_mod_lp = HQ_CREST_FAC_SM * ( *crest_mod_lp ) + ( 1.0f - HQ_CREST_FAC_SM ) * crest_mod; Loading