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

Fix for 3gpp issue 866

parent 2978a304
Loading
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -118,9 +118,6 @@ void initFdCngCom_flt(
    hFdCngCom->frame_type_previous = ACTIVE_FRAME;
    hFdCngCom->flag_noisy_speech = 0;
    hFdCngCom->likelihood_noisy_speech_flt = 0.f;
#ifdef IVAS_FLOAT_FIXED
    hFdCngCom->likelihood_noisy_speech_32fx = 0;
#endif
    hFdCngCom->numCoreBands = 0;
    hFdCngCom->stopBand = 0;
    hFdCngCom->startBand = 0;
+0 −2
Original line number Diff line number Diff line
@@ -163,8 +163,6 @@ void ivas_initFdCngCom_fx( HANDLE_FD_CNG_COM hFdCngCom, Word16 scale )
    set32_fx( hFdCngCom->olapBufferSynth2_fx, 0, FFTLEN );
    set32_fx( hFdCngCom->exc_cng_32fx, 0, L_FRAME16k );
    set16_fx( hFdCngCom->exc_cng, 0, L_FRAME16k );
    hFdCngCom->likelihood_noisy_speech_32fx = 0;
    move32();

    return;
}
+1 −4
Original line number Diff line number Diff line
@@ -532,10 +532,7 @@ typedef struct

    int16_t flag_noisy_speech;
    float likelihood_noisy_speech_flt;
#ifdef IVAS_FLOAT_FIXED
    Word32 likelihood_noisy_speech_32fx;
#endif
    Word16 likelihood_noisy_speech;
    Word16 likelihood_noisy_speech; // Q15

#ifndef IVAS_FLOAT_FIXED
    float coherence_flt; /* inter-channel coherence of noise */
+0 −1
Original line number Diff line number Diff line
@@ -1552,7 +1552,6 @@ ivas_error acelp_core_dec_ivas_fx(
                    st->hFdCngDec->hFdCngCom->likelihood_noisy_speech = add( st->hFdCngDec->hFdCngCom->likelihood_noisy_speech, 328 /*0.01 Q15*/ );
                    move16();
                }
                st->hFdCngDec->hFdCngCom->likelihood_noisy_speech_32fx = L_deposit_h( st->hFdCngDec->hFdCngCom->likelihood_noisy_speech );
                move32();
            }

+11 −10
Original line number Diff line number Diff line
@@ -59,7 +59,7 @@
#define CNA_ACT_DN_FACT     0.7 /* downward updating factor for CNA during active frames */
#endif                          // IVAS_FLOAT_FIXED

#define DELTA_MASKING_NOISE_Q31    0
#define DELTA_MASKING_NOISE_Q15    0
#define CNA_ACT_DN_LARGE_PARTITION 50         /* index of the first larger partition */
#define FIRST_CNA_NOISE_UPD_FRAMES 5          /* minimum number of CN initialization frames */
#define LOG_10_BASE_2              1783446566 /* Q29 */
@@ -1955,7 +1955,7 @@ void generate_masking_noise_ivas_fx(
    /* skip noise generating if level is very low, to avoid problems with possibly running into denormals */
    *exp_out = Q15;
    move16();
    IF( GT_32( hFdCngCom->likelihood_noisy_speech_32fx, DELTA_MASKING_NOISE_Q31 ) )
    IF( GT_16( hFdCngCom->likelihood_noisy_speech, DELTA_MASKING_NOISE_Q15 ) )
    {
        IF( NE_16( core, AMR_WB_CORE ) )
        {
@@ -1997,7 +1997,7 @@ void generate_masking_noise_ivas_fx(
        }

        /* Exclude clean speech */
        scale_fx = Mpy_32_32( scale_fx, hFdCngCom->likelihood_noisy_speech_32fx ); // Q30
        scale_fx = Mpy_32_16_1( scale_fx, hFdCngCom->likelihood_noisy_speech ); // Q30

        /* Generate Gaussian random noise in real and imaginary parts of the FFT bins
          Amplitudes are adjusted to the estimated noise level cngNoiseLevel_flt in each bin */
@@ -2680,7 +2680,7 @@ void generate_masking_noise_lb_dirac_fx(
    IF( cna_flag )
    {
        /* skip noise generating if level is very low, to avoid problems with possibly running into denormals */
        IF( GT_32( hFdCngCom->likelihood_noisy_speech_32fx, DELTA_MASKING_NOISE_Q31 ) )
        IF( GT_16( hFdCngCom->likelihood_noisy_speech, DELTA_MASKING_NOISE_Q15 ) )
        {
            /* Compute additional CN level */
            FOR( i = 0; i < 15; i++ )
@@ -2696,7 +2696,7 @@ void generate_masking_noise_lb_dirac_fx(
            }

            scale = L_deposit_h( scaleTable_cn_dirac[i].scale_ivas );         /* Q30 */
            scale = Mpy_32_32( scale, hFdCngCom->likelihood_noisy_speech_32fx ); /* Q30 */
            scale = Mpy_32_16_1( scale, hFdCngCom->likelihood_noisy_speech ); /* Q30 */
        }
    }

@@ -2738,7 +2738,7 @@ void generate_masking_noise_lb_dirac_fx(
                FOR( ; ptr_level < cngNoiseLevel + sub( hFdCngCom->stopFFTbin, hFdCngCom->startBand ); ptr_level++ )
                {
                    rand_gauss_fx( ptr_r, seed, exp_out );
                    Word16 exp2 = sub( 31, hFdCngCom->cngNoiseLevelExp );
                    Word16 exp2 = hFdCngCom->cngNoiseLevelExp;
                    Word32 mpy2 = Sqrt32( Mpy_32_32( scale, *ptr_level ), &exp2 );
                    ( *ptr_r ) = L_shl( Mpy_32_32( *ptr_r, mpy2 ), exp2 ); // hFdCngCom->fftBuffer_exp + exp2 - 31
                    move32();
@@ -2758,6 +2758,7 @@ void generate_masking_noise_lb_dirac_fx(

                /* Perform STFT synthesis */
                SynthesisSTFT_dirac_fx( fftBuffer, tdBuffer + n_samples_start, hFdCngCom->olapBufferSynth2_fx, hFdCngCom->olapWinSyn_fx, n_samples_out_loop, hFdCngCom );
                scale_sig32( tdBuffer + n_samples_start, n_samples_out_loop, Q9 ); // Q2 -> Q11
            }

            ELSE
@@ -2935,7 +2936,7 @@ void generate_masking_noise_dirac_ivas_fx(
                }
            }

            scale_fx = L_shr( scaleTable_cn_dirac[i].scale_ivas, Q3 ); /* Q11 */
            scale_fx = L_shr( L_deposit_h( scaleTable_cn_dirac[i].scale_ivas ), Q3 ); /* Q27 */
            scale_fx = Mpy_32_16_1( scale_fx, hFdCngCom->likelihood_noisy_speech );
        }
    }
@@ -2959,11 +2960,11 @@ void generate_masking_noise_dirac_ivas_fx(
    /*HF CLDFB - CNA and/or FD-CNG*/
    if ( fd_cng_flag )
    {
        scale_fx = L_add( scale_fx, 2048 ); // 1 in Q11
        scale_fx = L_add( scale_fx, ONE_IN_Q27 ); // 1 in Q27
    }
    IF( scale_fx != 0 )
    {
        q_scale = 11;
        q_scale = 27;
        move16();
        q_shift = norm_l( scale_fx );
        scale_fx = L_shl( scale_fx, q_shift );
Loading