Commit 029abf5e authored by Tapani Pihlajakuja's avatar Tapani Pihlajakuja
Browse files

Merge remote-tracking branch 'origin/main' into...

Merge remote-tracking branch 'origin/main' into basop-2442-masa-2tc-rendering-to-mono-large-diff-signal-12-khz
parents 438e11d8 b490a193
Loading
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -321,7 +321,6 @@
    <ClInclude Include="..\lib_dec\jbm_jb4_inputbuffer.h" />
    <ClInclude Include="..\lib_dec\jbm_jb4_jmf.h" />
    <ClInclude Include="..\lib_dec\jbm_pcmdsp_apa.h" />
    <ClInclude Include="..\lib_dec\jbm_pcmdsp_fifo.h" />
    <ClInclude Include="..\lib_dec\jbm_pcmdsp_similarityestimation.h" />
    <ClInclude Include="..\lib_dec\jbm_pcmdsp_window.h" />
    <ClInclude Include="..\lib_dec\lib_dec.h" />
+0 −3
Original line number Diff line number Diff line
@@ -515,9 +515,6 @@
    <ClInclude Include="..\lib_dec\jbm_pcmdsp_apa.h">
      <Filter>decoder_h</Filter>
    </ClInclude>
    <ClInclude Include="..\lib_dec\jbm_pcmdsp_fifo.h">
      <Filter>decoder_h</Filter>
    </ClInclude>
    <ClInclude Include="..\lib_dec\jbm_pcmdsp_similarityestimation.h">
      <Filter>decoder_h</Filter>
    </ClInclude>
+2 −0
Original line number Diff line number Diff line
@@ -133,6 +133,8 @@
#define FIX_FLOAT_1578_OMASA_REND_SPIKES                /* Nokia: Float issue 1578: Fix spikes and collapsed perception in OMASA/MASA rendering to FOA/HOA */
#define FIX_1521_SBA_LOUDNESS_STEREO                    /* FhG: issue 1521: Fix loudness for SBA to stereo rendering */
#define FIX_1559                                        /* Eri/FhG: fix for Issue 1559 in FD CNG with bitrate/bw switching */
#define FIX_BASOP_2571_MASA_EXT_RENDER_FIXES            /* Nokia: BASOP issue 2571: Fix MASA EXT DirAC renderer by unifying it with decoder */
#define NONBE_FIX_2575                                  /* Fhg: Fix issue 2575, precision loss in FD CNG */
#define FIX_BASOP_2442_MASA2TC_TO_MONO_AND_AMBI         /* Nokia: BASOP issue 2442: Aligns float with identical diffuse gain limitation to minimize diff */

/* ##################### End NON-BE switches ########################### */
+2 −1
Original line number Diff line number Diff line
@@ -686,6 +686,7 @@ ivas_error acelp_core_dec_fx(
                        move32();
                    }

#ifndef NONBE_FIX_2575
                    ApplyFdCng_fx( psyn_fx, st->Q_syn, NULL, 0, realBuffer_fx, imagBuffer_fx, NULL, st, 0, ( st->coder_type == AUDIO && !st->GSC_noisy_speech ) );

                    Word16 new_sidNoiseEstExp = 31 - Q4;
@@ -699,7 +700,7 @@ ivas_error acelp_core_dec_fx(
                    Scale_sig32( st->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN, sub( st->hFdCngDec->hFdCngCom->cngNoiseLevelExp, new_cngNoiseLevelExp ) ); // Q(31-cngNoiseLevelExp)
                    st->hFdCngDec->hFdCngCom->cngNoiseLevelExp = new_cngNoiseLevelExp;
                    move16();

#endif
                    test();
                    ApplyFdCng_fx( psyn_fx, st->Q_syn, NULL, 0, realBuffer_fx, imagBuffer_fx, NULL, st, 0, ( EQ_16( st->coder_type, AUDIO ) && !st->GSC_noisy_speech ) );

+50 −0
Original line number Diff line number Diff line
@@ -118,7 +118,11 @@ static void stereo_dft_generate_comfort_noise_fx(
    Word16 trigo_step;
    Word32 tmp32_1, tmp32_2;
    Word16 q_div, q_sqrt1, q_sqrt2, q_sqrt, sqrt_res;
#ifdef NONBE_FIX_2575
    Word16 q_shift;
#else
    Word16 q_shift, q_shift_1, q_shift_2, min_q;
#endif
    Word16 tmp16, tmp_p, tmp_s;
    hFdCngCom = st->hFdCngDec->hFdCngCom;

@@ -794,6 +798,11 @@ static void stereo_dft_generate_comfort_noise_fx(
    IF( ( chan == 0 ) && LE_32( st->core_brate, SID_2k40 ) )
    {
        /* update smoothed periodogram used by stereo CNA in SID and NO_DATA frames from cngNoiseLevel_flt */
#ifdef NONBE_FIX_2575
        Word16 smoothed_psd_exp[L_FRAME16k], smoothed_psd_exp_max = MIN_16;
        move16();

#else
        q_shift_1 = L_norm_arr( st->hFdCngDec->smoothed_psd_fx, L_FRAME16k );
        q_shift_2 = L_norm_arr( hFdCngCom->cngNoiseLevel, FFTCLDFBLEN );

@@ -805,11 +814,21 @@ static void stereo_dft_generate_comfort_noise_fx(
        scale_sig32( hFdCngCom->cngNoiseLevel, FFTCLDFBLEN, sub( min_q, sub( Q31, hFdCngCom->cngNoiseLevelExp ) ) ); /* Q31 - hFdCngCom->cngNoiseLevelExp */
        hFdCngCom->cngNoiseLevelExp = st->hFdCngDec->smoothed_psd_exp;
        move16();
#endif

        FOR( i = hFdCngCom->startBand; i < hFdCngCom->stopFFTbin; i++ )
        {
#ifdef NONBE_FIX_2575
            Word16 ftmp_exp;

            ftmp = hFdCngCom->cngNoiseLevel[i - hFdCngCom->startBand];
            move32();
            ftmp_exp = hFdCngCom->cngNoiseLevelExp;
            move16();
#else
            ftmp = hFdCngCom->cngNoiseLevel[i - hFdCngCom->startBand];
            move32();
#endif
            IF( !st->hFdCngDec->first_cna_noise_updated )
            {
                /* very first update */
@@ -820,14 +839,30 @@ static void stereo_dft_generate_comfort_noise_fx(
            {
                alpha = (Word16) ( 0x799A );
                move16();

                test();
#ifdef NONBE_FIX_2575
                IF( ( st->hFdCngDec->smoothed_psd_fx[i] > 0 ) && EQ_16( BASOP_Util_Cmp_Mant32Exp( Mpy_32_16_1( ftmp, (Word16) 0x3333 ), ftmp_exp, st->hFdCngDec->smoothed_psd_fx[i], st->hFdCngDec->smoothed_psd_exp ), 1 ) )
#else
                IF( ( st->hFdCngDec->smoothed_psd_fx[i] > 0 ) && GT_32( Mpy_32_16_1( ftmp, (Word16) 0x3333 ), st->hFdCngDec->smoothed_psd_fx[i] ) )
#endif
                {
                    /* prevent abrupt upward update steps */
#ifdef NONBE_FIX_2575
                    ftmp = L_add( L_shr( st->hFdCngDec->smoothed_psd_fx[i], 2 - 1 ), L_shr( st->hFdCngDec->smoothed_psd_fx[i], 2 + 1 ) ); /* ftmp_exp */
                    move16();
                    ftmp_exp = add( st->hFdCngDec->smoothed_psd_exp, 2 );
                    move16();
#else
                    ftmp = L_add( L_shl( st->hFdCngDec->smoothed_psd_fx[i], 1 ), L_shr( st->hFdCngDec->smoothed_psd_fx[i], 1 ) ); /* st->hFdCngDec->smoothed_psd_exp */
                    move16();
#endif
                }
#ifdef NONBE_FIX_2575
                ELSE IF( EQ_16( BASOP_Util_Cmp_Mant32Exp( ftmp, ftmp_exp, st->hFdCngDec->smoothed_psd_fx[i], st->hFdCngDec->smoothed_psd_exp ), -1 ) )
#else
                ELSE IF( LT_32( ftmp, st->hFdCngDec->smoothed_psd_fx[i] ) )
#endif
                {
                    /* faster downward updates */
                    alpha = (Word16) ( 0x599A );
@@ -836,10 +871,25 @@ static void stereo_dft_generate_comfort_noise_fx(
            }

            /* smoothing */
#ifdef NONBE_FIX_2575
            st->hFdCngDec->smoothed_psd_fx[i] = BASOP_Util_Add_Mant32Exp( Mpy_32_16_1( st->hFdCngDec->smoothed_psd_fx[i], alpha ), st->hFdCngDec->smoothed_psd_exp, Mpy_32_16_1( ftmp, sub( MAX_16, alpha ) ), ftmp_exp, &smoothed_psd_exp[i] ); /* smoothed_psd_exp[i] */
            smoothed_psd_exp_max = s_max( smoothed_psd_exp_max, smoothed_psd_exp[i] );
#else
            st->hFdCngDec->smoothed_psd_fx[i] = L_add( Mpy_32_16_1( st->hFdCngDec->smoothed_psd_fx[i], alpha ), Mpy_32_16_1( ftmp, sub( MAX_16, alpha ) ) ); /* st->hFdCngDec->smoothed_psd_exp */
#endif
            move32();
        }

#ifdef NONBE_FIX_2575
        /* Find common exponent for smoothed_psd_fx[] */
        FOR( i = hFdCngCom->startBand; i < hFdCngCom->stopFFTbin; i++ )
        {
            st->hFdCngDec->smoothed_psd_fx[i] = L_shr( st->hFdCngDec->smoothed_psd_fx[i], sub( smoothed_psd_exp_max, smoothed_psd_exp[i] ) );
        }
        st->hFdCngDec->smoothed_psd_exp = smoothed_psd_exp_max;
        move16();
#endif

        /* update msNoiseEst in SID and NO_DATA frames */
        bandcombinepow( &st->hFdCngDec->smoothed_psd_fx[hFdCngCom->startBand], st->hFdCngDec->smoothed_psd_exp, sub( hFdCngCom->stopFFTbin, hFdCngCom->startBand ), st->hFdCngDec->part_shaping, st->hFdCngDec->nFFTpart_shaping, st->hFdCngDec->psize_inv_shaping, st->hFdCngDec->msNoiseEst, &st->hFdCngDec->msNoiseEst_exp );

Loading