Commit dc7ba37e authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Fix for 3GPP issue 1218: Assert in stereo_dft_generate_comfort_noise_fx of...

Fix for 3GPP issue 1218: Assert in stereo_dft_generate_comfort_noise_fx of BASOP decoder with BASOP MASA DTX bitstream at 32 kbps

Link #1218
parent a3ddf608
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -127,6 +127,7 @@
#define FIX_ISSUE_1165                          /* Ittiam: Fix for issue 1165: Assertion in lpc2lsp_fx for OMASA LTV input */
#define FIX_ISSUE_1185                          /* Ittiam: Fix for issue 1185: Assertion in ivas_dirac_dec_binaural_internal_fx() for crash in decoder in fft30_with_cmplx_data()*/
#define FIX_ISSUE_1209                          /* Ittiam: Fix for issue 1209: Assertion exit in BASOP encoder (stereo_dmx_evs)*/
#define FIX_ISSUE_1218                          /* Ittiam: Fix for issue 1218: Assert in stereo_dft_generate_comfort_noise_fx of BASOP decoder with BASOP MASA DTX bitstream at 32 kbps*/
#define IVAS_ISSUE_1188_EVS_CRASH               /* Ittiam: Fix for issue 1188: Issue due to ASAN */
#define FIX_ISSUE_1155                          /* Ittiam: Fix for issue 1155: Encoder crash for Stereo at 32kbps in PostShortTerm_ivas_enc_fx()*/
#define FIX_1010_OPT_DIV                        /* FhG: SVD complexity optimizations (non-be) */
+12 −0
Original line number Diff line number Diff line
@@ -180,7 +180,19 @@ ivas_error acelp_core_dec_ivas_fx(
            IF( EQ_32( st->core_brate, SID_2k40 ) )
            {
                FdCng_decodeSID_ivas_fx( st );
#ifdef FIX_ISSUE_1218
                Word16 n1, n2;
                n1 = L_norm_arr( st->hFdCngDec->hFdCngCom->sidNoiseEst, NPART );
                n2 = L_norm_arr( st->hFdCngDec->hFdCngCom->sidNoiseEstLp, NPART );

                Word16 common_e = s_max( sub( old_NoiseEstExp, n2 ), sub( st->hFdCngDec->hFdCngCom->sidNoiseEstExp, n1 ) );
                scale_sig32( st->hFdCngDec->hFdCngCom->sidNoiseEst, NPART, sub( st->hFdCngDec->hFdCngCom->sidNoiseEstExp, common_e ) );
                scale_sig32( st->hFdCngDec->hFdCngCom->sidNoiseEstLp, NPART, sub( old_NoiseEstExp, common_e ) );
                st->hFdCngDec->hFdCngCom->sidNoiseEstExp = common_e;
                move16();
#else
                rescale_fdCngDec( st->hFdCngDec, sub( old_NoiseEstExp, st->hFdCngDec->hFdCngCom->sidNoiseEstExp ) );
#endif
            }
            FOR( i = 0; i < NPART; i++ )
            {
+5 −0
Original line number Diff line number Diff line
@@ -1807,7 +1807,12 @@ Word16 ApplyFdCng_ivas_fx(
                    {
                        FOR( ; j <= hFdCngCom->part[k]; j++ )
                        {
#ifdef FIX_ISSUE_1218
                            /* NOTE: saturation is added here as part of issue 1218 fix. after rescaling the fdcng noise estimation buffers, due to slight precision loss, values may slightly overflow */
                            cngNoiseLevel[j] = L_shl_sat( cngNoiseLevel[j], s ); /*Q31 - hFdCngDec->bandNoiseShape_exp + s*/
#else
                            cngNoiseLevel[j] = L_shl( cngNoiseLevel[j], s ); /*Q31 - hFdCngDec->bandNoiseShape_exp + s*/
#endif
                            move32();
                        }
                    }
+5 −0
Original line number Diff line number Diff line
@@ -683,7 +683,12 @@ static void stereo_dft_generate_comfort_noise_fx(
                    factor = L_min( L_add( L_shl( hStereoDft->scale_fx, sub( 16, q_div ) ), W_extract_l( W_mult0_32_32( Mpy_32_16_1( L_sub( factor, L_shl( hStereoDft->scale_fx, sub( 16, q_div ) ) ), ONE_BY_MAX_K ), hStereoCng->xfade_frame_counter ) ) ), factor ); /* q_div */
                    FOR( ; j <= hFdCngCom->part[k]; j++ )
                    {
#ifdef FIX_ISSUE_1218
                        /* NOTE: saturation is added here as part of issue 1218 fix. After rescaling the fdcng noise estimation buffers, due to slight precision loss, values may slightly overflow */
                        hFdCngCom->cngNoiseLevel[j] = L_shl_sat( Mpy_32_32( st->hFdCngDec->bandNoiseShape[j], factor ), q_div ); /* exp(st->hFdCngDec->bandNoiseShape_exp)  */
#else
                        hFdCngCom->cngNoiseLevel[j] = L_shl( Mpy_32_32( st->hFdCngDec->bandNoiseShape[j], factor ), q_div ); /* exp(st->hFdCngDec->bandNoiseShape_exp)  */
#endif
                        move32();
                    }
                }