Commit 65ff022e authored by multrus's avatar multrus
Browse files

Merge branch '2041-fix-spectral-gaps-for-inactive-frames' into 'main'

[non-BE] Resolve "Spectral gaps for inactive frames for 24.4kbps stereo with DTX on with characterization item"

Closes #2041

See merge request !2580
parents e941147f a4ca9a1f
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -99,6 +99,7 @@
#define FIX_2253_CORRECT_GSC_MINIMUM_PIT_SEARCH         /* VA: Fix Issue 2253 where the encoder and decoder could get out of sync */
#define FIX_2253_CORRECT_GSC_MINIMUM_PIT_SEARCH         /* VA: Fix Issue 2253 where the encoder and decoder could get out of sync */
#define NONBE_FIX_1967_SBA_DECODER_MONO_OUT_BIG_DIFFERENCES /* Dolby: Fix basop issue 1967 */
#define NONBE_FIX_1967_SBA_DECODER_MONO_OUT_BIG_DIFFERENCES /* Dolby: Fix basop issue 1967 */
#define FIX_1461_CNG_BW_SWITCHING                       /* Eri: float issue 1461: Stereo parameters are not updated when SID/NODATA forces BW to stay the same */
#define FIX_1461_CNG_BW_SWITCHING                       /* Eri: float issue 1461: Stereo parameters are not updated when SID/NODATA forces BW to stay the same */
#define FIX_2041_SPECTRAL_GAPS_FOR_INACTIVE_FRAMES      /* FhG: Using rounding in multiplication to improve precision in cngNoiseLevel[] */


/* ##################### End NON-BE switches ########################### */
/* ##################### End NON-BE switches ########################### */


+19 −3
Original line number Original line Diff line number Diff line
@@ -1200,7 +1200,11 @@ Word16 ApplyFdCng_fx(
                        s = s_max( s_min( s, sub( WORD32_BITS, 1 ) ), negate( sub( WORD32_BITS, 1 ) ) );
                        s = s_max( s_min( s, sub( WORD32_BITS, 1 ) ), negate( sub( WORD32_BITS, 1 ) ) );
                        FOR( ; j <= hFdCngCom->part[k]; j++ )
                        FOR( ; j <= hFdCngCom->part[k]; j++ )
                        {
                        {
#ifdef FIX_2041_SPECTRAL_GAPS_FOR_INACTIVE_FRAMES
                            cngNoiseLevel[j] = L_shl_r( Mpy_32_16_r( hFdCngDec->bandNoiseShape[j], facTab[k] ), s ); /*Q31 - hFdCngDec->bandNoiseShape_exp*/
#else
                            cngNoiseLevel[j] = L_shl( Mpy_32_16_1( hFdCngDec->bandNoiseShape[j], facTab[k] ), s );                                            /*Q31 - hFdCngDec->bandNoiseShape_exp*/
                            cngNoiseLevel[j] = L_shl( Mpy_32_16_1( hFdCngDec->bandNoiseShape[j], facTab[k] ), s );                                            /*Q31 - hFdCngDec->bandNoiseShape_exp*/
#endif
                            move32();
                            move32();
                        }
                        }
                    }
                    }
@@ -1811,7 +1815,11 @@ void perform_noise_estimation_dec_ivas_fx(
                    FOR( p = 0; p < npart; p++ )
                    FOR( p = 0; p < npart; p++ )
                    {
                    {
                        temp = L_shl( msPeriodog[p], q_shift );
                        temp = L_shl( msPeriodog[p], q_shift );
#ifdef FIX_2041_SPECTRAL_GAPS_FOR_INACTIVE_FRAMES
                        msNoiseEst[p] = Madd_32_16( Mpy_32_16_r( msNoiseEst[p], sub( MAX_16, alpha ) ), temp, alpha ); /*Q31 - hFdCngDec->msNoiseEst_exp*/
#else
                        msNoiseEst[p] = Madd_32_16( Mpy_32_16_1( msNoiseEst[p], sub( MAX_16, alpha ) ), temp, alpha );                                        /*Q31 - hFdCngDec->msNoiseEst_exp*/
                        msNoiseEst[p] = Madd_32_16( Mpy_32_16_1( msNoiseEst[p], sub( MAX_16, alpha ) ), temp, alpha );                                        /*Q31 - hFdCngDec->msNoiseEst_exp*/
#endif
                        move32();
                        move32();
                    }
                    }
                }
                }
@@ -1889,7 +1897,11 @@ void perform_noise_estimation_dec_ivas_fx(
                        L_tmp = L_shr( msPeriodog[p], sub( sub( 31, hFdCngDec->hFdCngCom->periodog_exp ), 4 ) );
                        L_tmp = L_shr( msPeriodog[p], sub( sub( 31, hFdCngDec->hFdCngCom->periodog_exp ), 4 ) );
                        IF( LT_32( L_tmp, msNoiseEst[p] ) )
                        IF( LT_32( L_tmp, msNoiseEst[p] ) )
                        {
                        {
#ifdef FIX_2041_SPECTRAL_GAPS_FOR_INACTIVE_FRAMES
                            msNoiseEst[p] = Madd_32_16( Mpy_32_16_r( msNoiseEst[p], wght ), L_tmp, (Word16) L_sub( shr( MAX_16, sub( 15, scale ) ), wght ) ); /*temp_q_msNoiseEst[p]*/
#else
                            msNoiseEst[p] = Madd_32_16( Mpy_32_16_1( msNoiseEst[p], wght ), L_tmp, (Word16) L_sub( shr( MAX_16, sub( 15, scale ) ), wght ) ); /*temp_q_msNoiseEst[p]*/
                            msNoiseEst[p] = Madd_32_16( Mpy_32_16_1( msNoiseEst[p], wght ), L_tmp, (Word16) L_sub( shr( MAX_16, sub( 15, scale ) ), wght ) ); /*temp_q_msNoiseEst[p]*/
#endif
                            move32();
                            move32();
                            temp_q_msNoiseEst[p] = sub( add( hFdCngDec->msNoiseEst_exp, scale ), 15 );
                            temp_q_msNoiseEst[p] = sub( add( hFdCngDec->msNoiseEst_exp, scale ), 15 );
                            move16();
                            move16();
@@ -1912,7 +1924,11 @@ void perform_noise_estimation_dec_ivas_fx(
                        L_tmp = L_shr_sat( hFdCngDec->msPeriodog_ST_fx[p], sub( hFdCngDec->msNoiseEst_exp, hFdCngDec->msPeriodog_ST_exp ) ); /*Q31 - hFdCngDec->msPeriodog_ST_exp*/
                        L_tmp = L_shr_sat( hFdCngDec->msPeriodog_ST_fx[p], sub( hFdCngDec->msNoiseEst_exp, hFdCngDec->msPeriodog_ST_exp ) ); /*Q31 - hFdCngDec->msPeriodog_ST_exp*/
                        IF( LT_32( L_tmp, msNoiseEst[p] ) )
                        IF( LT_32( L_tmp, msNoiseEst[p] ) )
                        {
                        {
#ifdef FIX_2041_SPECTRAL_GAPS_FOR_INACTIVE_FRAMES
                            msNoiseEst[p] = Madd_32_16( Mpy_32_16_r( msNoiseEst[p], CNA_ACT_DN_FACT_Q15 ), L_tmp, ONE_IN_Q15 - CNA_ACT_DN_FACT_Q15 ); /*Q31 - hFdCngDec->msNoiseEst_exp*/
#else
                            msNoiseEst[p] = Madd_32_16( Mpy_32_16_1( msNoiseEst[p], CNA_ACT_DN_FACT_Q15 ), L_tmp, ONE_IN_Q15 - CNA_ACT_DN_FACT_Q15 );         /*Q31 - hFdCngDec->msNoiseEst_exp*/
                            msNoiseEst[p] = Madd_32_16( Mpy_32_16_1( msNoiseEst[p], CNA_ACT_DN_FACT_Q15 ), L_tmp, ONE_IN_Q15 - CNA_ACT_DN_FACT_Q15 );         /*Q31 - hFdCngDec->msNoiseEst_exp*/
#endif
                            move32();
                            move32();
                        }
                        }
                    }
                    }