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

Merge branch '3gpp_issue_825_fix' into 'main'

Fix for 3GPP issue 825: Missing synthesis when switching to CNG (24.4kbps)

See merge request !512
parents 6cb36c8e bcf07dca
Loading
Loading
Loading
Loading
+0 −65
Original line number Diff line number Diff line
@@ -194,13 +194,6 @@ ivas_error acelp_core_dec_ivas_fx(
            }
#endif
            ApplyFdCng_ivas_fx( NULL, 0, NULL, 0, NULL, NULL, NULL, st, 0, 0 );

            IF( st->hFdCngDec->hFdCngCom->cngNoiseLevelExp < 0 )
            {
                Scale_sig32( st->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN, st->hFdCngDec->hFdCngCom->cngNoiseLevelExp );
                st->hFdCngDec->hFdCngCom->cngNoiseLevelExp = 0;
                move16();
            }
        }
        ELSE
        {
@@ -698,26 +691,7 @@ ivas_error acelp_core_dec_ivas_fx(
                        move32();
                    }
#endif
                    Word16 new_sidNoiseEstExp = 31 - Q4;
                    move16();
                    Scale_sig32( st->hFdCngDec->hFdCngCom->sidNoiseEstLp, NPART, sub( st->hFdCngDec->hFdCngCom->sidNoiseEstExp, new_sidNoiseEstExp ) );
                    Scale_sig32( st->hFdCngDec->hFdCngCom->sidNoiseEst, NPART, sub( st->hFdCngDec->hFdCngCom->sidNoiseEstExp, new_sidNoiseEstExp ) );
                    st->hFdCngDec->hFdCngCom->sidNoiseEstExp = new_sidNoiseEstExp;
                    move16();
                    Word16 new_cngNoiseLevelExp = 31 - Q4;
                    move16();
                    Scale_sig32( st->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN, st->hFdCngDec->hFdCngCom->cngNoiseLevelExp - new_cngNoiseLevelExp );
                    st->hFdCngDec->hFdCngCom->cngNoiseLevelExp = new_cngNoiseLevelExp;
                    move16();

                    ApplyFdCng_ivas_fx( psyn_fx, st->Q_syn, NULL, 0, realBuffer_fx, imagBuffer_fx, NULL, st, 0, ( st->coder_type == AUDIO && !st->GSC_noisy_speech ) );

                    IF( st->hFdCngDec->hFdCngCom->cngNoiseLevelExp < 0 )
                    {
                        Scale_sig32( st->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN, st->hFdCngDec->hFdCngCom->cngNoiseLevelExp );
                        st->hFdCngDec->hFdCngCom->cngNoiseLevelExp = 0;
                        move16();
                    }
                }

                IF( !read_sid_info )
@@ -1547,30 +1521,9 @@ ivas_error acelp_core_dec_ivas_fx(
            IF( NE_16( st->element_mode, IVAS_CPE_TD ) && !st->cng_ism_flag )
            {
                /*Noise estimate*/

                Scale_sig32( st->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN, sub( st->hFdCngDec->hFdCngCom->cngNoiseLevelExp, Q27 ) );
                st->hFdCngDec->hFdCngCom->cngNoiseLevelExp = 31 - Q4; // Q4
                move16();

                Scale_sig32( st->hFdCngDec->hFdCngCom->sidNoiseEst, NPART, sub( st->hFdCngDec->hFdCngCom->sidNoiseEstExp, Q27 ) );
                Scale_sig32( st->hFdCngDec->hFdCngCom->sidNoiseEstLp, NPART, sub( st->hFdCngDec->hFdCngCom->sidNoiseEstExp, Q27 ) );
                st->hFdCngDec->hFdCngCom->sidNoiseEstExp = 31 - Q4; // Q4
                move16();
                /*==========================================================*/
                ApplyFdCng_ivas_fx( psyn_fx, st->Q_syn, NULL, 0, realBuffer_fx, imagBuffer_fx, NULL, st, 0, ( st->coder_type == AUDIO && !st->GSC_noisy_speech ) );
                /*==========================================================*/
                IF( st->hFdCngDec->partNoiseShape_exp < 0 )
                {
                    Scale_sig32( st->hFdCngDec->partNoiseShape, NPART, st->hFdCngDec->partNoiseShape_exp );
                    st->hFdCngDec->partNoiseShape_exp = 0;
                    move16();
                }
                IF( st->hFdCngDec->hFdCngCom->cngNoiseLevelExp < 0 )
                {
                    Scale_sig32( st->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN, st->hFdCngDec->hFdCngCom->cngNoiseLevelExp );
                    st->hFdCngDec->hFdCngCom->cngNoiseLevelExp = 0;
                    move16();
                }
            }

            IF( !st->cna_dirac_flag )
@@ -1656,24 +1609,6 @@ ivas_error acelp_core_dec_ivas_fx(
                    IF( ( st->idchan == 0 ) && ( EQ_16( nchan_out, 2 ) || ( st->core_brate != FRAME_NO_DATA && NE_32( st->core_brate, SID_2k40 ) ) ) )
                    {
                        ApplyFdCng_ivas_fx( psyn_fx, st->Q_syn, NULL, 0, realBuffer_fx, imagBuffer_fx, NULL, st, 0, ( st->coder_type == AUDIO && !st->GSC_noisy_speech ) );
                        IF( st->hFdCngDec->partNoiseShape_exp < 0 )
                        {
                            Scale_sig32( st->hFdCngDec->partNoiseShape, NPART, -st->hFdCngDec->partNoiseShape_exp );
                            st->hFdCngDec->partNoiseShape_exp = 0;
                            move16();
                        }
                        IF( st->hFdCngDec->partNoiseShape_exp < 0 )
                        {
                            Scale_sig32( st->hFdCngDec->partNoiseShape, NPART, st->hFdCngDec->partNoiseShape_exp );
                            st->hFdCngDec->partNoiseShape_exp = 0;
                            move16();
                        }
                        IF( st->hFdCngDec->hFdCngCom->cngNoiseLevelExp < 0 )
                        {
                            Scale_sig32( st->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN, st->hFdCngDec->hFdCngCom->cngNoiseLevelExp );
                            st->hFdCngDec->hFdCngCom->cngNoiseLevelExp = 0;
                            move16();
                        }
                    }
                }
            }
+100 −58
Original line number Diff line number Diff line
@@ -1383,16 +1383,26 @@ Word16 ApplyFdCng_ivas_fx(
                    IF( NE_16( s2, -( WORD32_BITS - 1 ) ) )
                    {
                        s = sub( *cngNoiseLevel_exp, add( hFdCngDec->bandNoiseShape_exp, s2 ) );
                        Word16 e_shift = 0;
                        IF( s > 0 )
                        {
                            Word16 q_norm = L_norm_arr( &cngNoiseLevel[j], sub( FFTCLDFBLEN, j ) );
                            IF( GT_16( s, q_norm ) )
                            {
                                scale_sig32( cngNoiseLevel, j, sub( q_norm, s ) );
                                e_shift = sub( s, q_norm );
                            }
                        }
                        FOR( ; k < hFdCngCom->npart; k++ )
                        {
                            FOR( ; j <= hFdCngCom->part[k]; j++ )
                            {
                                cngNoiseLevel[j] = L_shl( cngNoiseLevel[j], s );
                                cngNoiseLevel[j] = L_shl( cngNoiseLevel[j], sub( s, e_shift ) );
                                move32();
                            }
                        }

                        *cngNoiseLevel_exp = add( hFdCngDec->bandNoiseShape_exp, s2 );
                        *cngNoiseLevel_exp = add( add( hFdCngDec->bandNoiseShape_exp, s2 ), e_shift );
                        move16();
                    }
                }
@@ -2410,14 +2420,16 @@ void perform_noise_estimation_dec_ivas_fx(
    Word32 temp, ftemp, delta, L_tmp;
    Word16 e_temp, wght, periodog_exp;
    Word32 enr, enr_tot, enr_tot0;
    Word16 enr_ratio, alpha;
    Word16 enr_e, enr_ratio, alpha;
    Word32 *msPeriodog;
    Word32 *msNoiseEst;
    Word32 *reIter;
    Word32 rescale_fac = 0;
    Word64 W_tmp;
    Word16 tmp_s, tmp_q, min_q = 31;
    Word16 exp_flag = 0;
    Word16 q_shift;
    Word32 max_l;
    Word16 norm_shift;
#ifdef IVAS_CODE_CNG
    PMT( "lots of code related to IVAS needs to be done " )
#endif
@@ -2639,63 +2651,48 @@ void perform_noise_estimation_dec_ivas_fx(
            enr_tot0 = L_add_sat( L_shr( sum32_fx( msNoiseEst, npart ), sub( hFdCngDec->msPeriodog_exp, hFdCngDec->msNoiseEst_exp ) ), 1 );
        }

        /* update short-term periodogram on larger partitions */
        maximum_32_fx( &msPeriodog[CNA_ACT_DN_LARGE_PARTITION], sub( npart, CNA_ACT_DN_LARGE_PARTITION ), &max_l );
        q_shift = sub( hFdCngDec->hFdCngCom->periodog_exp, hFdCngDec->msPeriodog_ST_exp );
        norm_shift = norm_l( max_l );
        test();
        IF( !( NE_16( L_frame, last_L_frame ) || LE_32( last_core_brate, SID_2k40 ) ) )
        IF( max_l && GT_16( q_shift, norm_shift ) )
        {
            IF( GT_16( hFdCngDec->hFdCngCom->periodog_exp, hFdCngDec->msPeriodog_ST_exp ) )
            {
                exp_flag = 1;
            scale_sig32( hFdCngDec->msPeriodog_ST_fx, NPART_SHAPING, sub( norm_shift, q_shift ) );
            hFdCngDec->msPeriodog_ST_exp = sub( hFdCngDec->msPeriodog_ST_exp, sub( norm_shift, q_shift ) );
            move16();
            }
            ELSE
            {
                exp_flag = 0;
            q_shift = norm_shift;
            move16();
        }
        }

        /* update short-term periodogram on larger partitions */
        FOR( p = CNA_ACT_DN_LARGE_PARTITION; p < npart; p++ )
        {
            test();
            q_shift = sub( hFdCngDec->hFdCngCom->periodog_exp, hFdCngDec->msPeriodog_ST_exp );
            IF( NE_16( L_frame, last_L_frame ) || LE_32( last_core_brate, SID_2k40 ) )
            {
                /* core Fs has changed or last frame was SID/NO_DATA -> re-initialize short-term periodogram */
                hFdCngDec->msPeriodog_ST_fx[p] = msPeriodog[p];
                move32();
                hFdCngDec->msPeriodog_ST_exp = hFdCngDec->hFdCngCom->periodog_exp;
                move16();
            }
            ELSE
            {
                temp = msPeriodog[p];
                move32();
                IF( exp_flag )
                {
                    hFdCngDec->msPeriodog_ST_fx[p] = L_shr( hFdCngDec->msPeriodog_ST_fx[p], sub( hFdCngDec->hFdCngCom->periodog_exp, hFdCngDec->msPeriodog_ST_exp ) );
                hFdCngDec->msPeriodog_ST_fx[p] = L_shl( msPeriodog[p], q_shift );
                move32();
            }
            ELSE
            {
                    temp = L_shr( temp, sub( hFdCngDec->msPeriodog_ST_exp, hFdCngDec->hFdCngCom->periodog_exp ) );
                }
#ifdef IVAS_ENH32_CADENCE_CHANGES
                hFdCngDec->msPeriodog_ST_fx[p] = Madd_32_16( Mpy_32_16_1( hFdCngDec->msPeriodog_ST_fx[p], ST_PERIODOG_FACT_Q15 ), temp, sub( MAX_16, ST_PERIODOG_FACT_Q15 ) );
                temp = L_shl( msPeriodog[p], q_shift );
                hFdCngDec->msPeriodog_ST_fx[p] = Madd_32_16( Mpy_32_16_1( hFdCngDec->msPeriodog_ST_fx[p], ST_PERIODOG_FACT_Q15 ), temp, MAX_16 - ST_PERIODOG_FACT_Q15 );
#else
                hFdCngDec->msPeriodog_ST_fx[p] = L_add( Mpy_32_16_1( hFdCngDec->msPeriodog_ST_fx[p], ST_PERIODOG_FACT_Q15 ), Mpy_32_16_1( temp, sub( MAX_16, ST_PERIODOG_FACT_Q15 ) ) );
#endif
                move32();
            }
        }
        test();
        IF( !( NE_16( L_frame, last_L_frame ) || LE_32( last_core_brate, SID_2k40 ) ) )
        {
            IF( exp_flag )
        maximum_32_fx( hFdCngDec->msPeriodog_ST_fx, NPART_SHAPING, &max_l );
        IF( max_l )
        {
                hFdCngDec->msPeriodog_ST_exp = hFdCngDec->hFdCngCom->periodog_exp;
            q_shift = sub( norm_l( max_l ), 2 );
            scale_sig32( hFdCngDec->msPeriodog_ST_fx, NPART_SHAPING, q_shift );
            hFdCngDec->msPeriodog_ST_exp = sub( hFdCngDec->msPeriodog_ST_exp, q_shift );
            move16();
        }
        }

        /* core Fs has changed -> partitions have changed -> re-calculate long-term periodogram */
        /* part L_FRAME16k L_FRAME */
@@ -2755,30 +2752,35 @@ void perform_noise_estimation_dec_ivas_fx(
                IF( NE_16( hFdCngDec->first_cna_noise_update_cnt, 0 ) )
                {
                    alpha = Inv16( add( hFdCngDec->first_cna_noise_update_cnt, 1 ), &e );
                    IF( LT_16( e, 0 ) )
                    alpha = shl_sat( alpha, e ); // Q15
                    maximum_32_fx( msPeriodog, npart, &max_l );
                    q_shift = sub( hFdCngDec->hFdCngCom->periodog_exp, hFdCngDec->msNoiseEst_exp );
                    norm_shift = norm_l( max_l );
                    test();
                    IF( max_l && GT_16( q_shift, norm_shift ) )
                    {
                        alpha = shr( alpha, negate( e ) ); // Q15
                        scale_sig32( msNoiseEst, NPART_SHAPING, sub( norm_shift, q_shift ) );
                        hFdCngDec->msNoiseEst_exp = sub( hFdCngDec->msNoiseEst_exp, sub( norm_shift, q_shift ) );
                        move16();
                        q_shift = norm_shift;
                        move16();
                    }
                    FOR( p = 0; p < npart; p++ )
                    {
                        temp = msPeriodog[p];
                        move32();
                        temp = L_shr( temp, sub( hFdCngDec->msNoiseEst_exp, hFdCngDec->msPeriodog_exp ) );
                        temp = L_shl( msPeriodog[p], q_shift );
#ifdef IVAS_ENH32_CADENCE_CHANGES
                        msNoiseEst[p] = Madd_32_16( Mpy_32_16_1( msNoiseEst[p], sub( shl_sat( 1, sub( 15, e ) ), alpha ) ), temp, alpha );
                        msNoiseEst[p] = Madd_32_16( Mpy_32_16_1( msNoiseEst[p], sub( MAX_16, alpha ) ), temp, alpha );
#else
                        msNoiseEst[p] = L_add( Mpy_32_16_1( msNoiseEst[p], sub( shl_sat( 1, sub( 15, e ) ), alpha ) ), Mpy_32_16_1( temp, alpha ) );
                        msNoiseEst[p] = L_add( Mpy_32_16_1( msNoiseEst[p], sub( MAX_16, alpha ) ), Mpy_32_16_1( temp, alpha ) );
#endif
                        move32();
                    }
                }
                ELSE
                {
                    FOR( p = 0; p < npart; p++ )
                    {
                        msNoiseEst[p] = L_shr( msPeriodog[p], sub( hFdCngDec->msNoiseEst_exp, hFdCngDec->msPeriodog_exp ) );
                        move32();
                    }
                    Copy32( msPeriodog, msNoiseEst, npart );
                    scale_sig32( &msNoiseEst[npart], sub( NPART_SHAPING, npart ), sub( hFdCngDec->msNoiseEst_exp, hFdCngDec->msPeriodog_exp ) );
                    hFdCngDec->msNoiseEst_exp = hFdCngDec->msPeriodog_exp;
                }

                /* check, if we reached the required number of first CNA noise update frames */
@@ -2863,7 +2865,7 @@ void perform_noise_estimation_dec_ivas_fx(
                    /* energy significantly decreases in one of the larger partitions during active frames -> downward update */
                    FOR( p = CNA_ACT_DN_LARGE_PARTITION; p < npart; p++ )
                    {
                        L_tmp = L_shr( hFdCngDec->msPeriodog_ST_fx[p], sub( hFdCngDec->msNoiseEst_exp, hFdCngDec->msPeriodog_ST_exp ) );
                        L_tmp = L_shr_sat( hFdCngDec->msPeriodog_ST_fx[p], sub( hFdCngDec->msNoiseEst_exp, hFdCngDec->msPeriodog_ST_exp ) );
                        IF( LT_32( L_tmp, msNoiseEst[p] ) )
                        {
#ifdef IVAS_ENH32_CADENCE_CHANGES
@@ -2895,7 +2897,8 @@ void perform_noise_estimation_dec_ivas_fx(
                    move16();
                    enr = msPeriodog[p];
                    move32();
                    temp = L_shr( enr, sub( hFdCngDec->msNoiseEst_exp, hFdCngDec->msPeriodog_exp ) );
                    enr_e = hFdCngDec->msPeriodog_exp;
                    move16();
                    alpha = 31130; // 0.95f in Q15
                    move16();
                    /* bandwidth increased -> do fast re-initilization  */
@@ -2908,16 +2911,29 @@ void perform_noise_estimation_dec_ivas_fx(
                            alpha = shr( alpha, negate( i_e ) ); // Q15
                        }
                    }
                    ELSE IF( LT_32( temp, *ptr_per ) && EQ_16( part[p], 1 ) )
                    ELSE IF( ( BASOP_Util_Cmp_Mant32Exp( enr, enr_e, *ptr_per, hFdCngDec->msNoiseEst_exp ) < 0 ) && EQ_16( part[p], 1 ) )
                    {
                        /* faster downward update for single-bin partitions */
                        alpha = 26214; // 0.8f in Q15
                        move16();
                    }
                    ELSE IF( GT_32( temp, L_shl( ( *ptr_per ), 1 ) ) )
                    ELSE IF( BASOP_Util_Cmp_Mant32Exp( enr, enr_e, *ptr_per, add( hFdCngDec->msNoiseEst_exp, 1 ) ) > 0 )
                    {
                        /* prevent abrupt upward updates */
                        temp = L_shl( ( *ptr_per ), 1 );
                        test();
                        IF( ( norm_l( *ptr_per ) == 0 ) && *ptr_per )
                        {
                            enr = *ptr_per;
                            scale_sig32( msNoiseEst, NPART_SHAPING, -1 );
                            hFdCngDec->msNoiseEst_exp = add( hFdCngDec->msNoiseEst_exp, 1 );
                            move16();
                        }
                        ELSE
                        {
                            enr = L_shl( *ptr_per, 1 );
                        }
                        enr_e = hFdCngDec->msNoiseEst_exp;
                        move16();
                    }

                    /* IIR smoothing */
@@ -2938,9 +2954,27 @@ void perform_noise_estimation_dec_ivas_fx(
                        move32();
                    }
#ifdef IVAS_ENH32_CADENCE_CHANGES
                    *ptr_per = Madd_32_16( ( *ptr_per ), temp, sub( MAX_16, alpha ) );
                    if ( enr )
                    {
                        q_shift = sub( enr_e, hFdCngDec->msNoiseEst_exp );
                        norm_shift = norm_l( enr );
                        if ( LE_16( q_shift, norm_shift ) )
                        {
                            enr = L_shl( enr, q_shift );
                            move32();
                        }
                        else
                        {
                            enr_e = sub( enr_e, norm_shift );
                            enr = L_shl( enr, norm_shift );
                            scale_sig32( msNoiseEst, NPART_SHAPING, sub( norm_shift, q_shift ) );
                            hFdCngDec->msNoiseEst_exp = sub( hFdCngDec->msNoiseEst_exp, sub( norm_shift, q_shift ) );
                            move16();
                        }
                    }
                    *ptr_per = Madd_32_16( ( *ptr_per ), enr, sub( MAX_16, alpha ) );
#else
                    *ptr_per = L_add( ( *ptr_per ), Mpy_32_16_1( temp, sub( MAX_16, alpha ) ) );
                    *ptr_per = L_add( ( *ptr_per ), Mpy_32_16_1( enr, sub( MAX_16, alpha ) ) );
#endif
                    ptr_per++;
                }
@@ -2951,6 +2985,14 @@ void perform_noise_estimation_dec_ivas_fx(
                }
            }
        }
        maximum_32_fx( msNoiseEst, NPART_SHAPING, &max_l );
        if ( max_l )
        {
            q_shift = sub( norm_l( max_l ), 2 );
            scale_sig32( msNoiseEst, NPART_SHAPING, q_shift );
            hFdCngDec->msNoiseEst_exp = sub( hFdCngDec->msNoiseEst_exp, q_shift );
            move16();
        }

        Copy32( msNoiseEst, hFdCngDec->msPsd_fx, npart );
        hFdCngDec->msPsd_exp_fft = hFdCngDec->msNoiseEst_exp;
+0 −11
Original line number Diff line number Diff line
@@ -531,10 +531,6 @@ ivas_error ivas_core_dec_fx(

            IF( st->hFdCngDec != NULL )
            {
                Scale_sig32( st->hFdCngDec->msNoiseEst, NPART_SHAPING, sub( st->hFdCngDec->msNoiseEst_exp, 27 ) );
                st->hFdCngDec->msNoiseEst_exp = 27;
                move16();

                Scale_sig( st->hFdCngDec->hFdCngCom->A_cng, add( M, 1 ), sub( norm_s( sub( st->hFdCngDec->hFdCngCom->A_cng[0], 1 ) ), 3 ) );
            }

@@ -613,9 +609,6 @@ ivas_error ivas_core_dec_fx(
            /* TCX decoder */
            Scale_sig( st->hPFstat->mem_stp, L_SUBFR, -Qsyn_temp );
            Scale_sig( st->hPFstat->mem_pf_in, L_SUBFR, -Qsyn_temp );
            Scale_sig32( st->hFdCngDec->msNoiseEst, NPART_SHAPING, sub( st->hFdCngDec->msNoiseEst_exp, 27 ) );
            st->hFdCngDec->msNoiseEst_exp = 27;
            move16();
            Scale_sig( st->hHQ_core->old_out_LB_fx, L_FRAME32k, -st->hHQ_core->Q_old_wtda_LB );
            Scale_sig( st->hHQ_core->old_out_fx, L_FRAME48k, -st->hHQ_core->Q_old_wtda );

@@ -822,10 +815,6 @@ ivas_error ivas_core_dec_fx(
            {
                IF( NE_16( sts[n]->last_core_bfi, ACELP_CORE ) )
                {
                    Scale_sig32( sts[n]->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN, sub( sts[n]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, 27 ) );
                    sts[n]->hFdCngDec->hFdCngCom->cngNoiseLevelExp = 27;
                    move16();

                    TonalMdctConceal_whiten_noise_shape_ivas_fx( sts[n], L_FRAME16k, ON_FIRST_GOOD_FRAME );
                }
            }
+80 −42

File changed.

Preview size limit exceeded, changes collapsed.

+0 −11
Original line number Diff line number Diff line
@@ -1053,17 +1053,6 @@ static void run_min_stats_fx(
        test();
        IF( will_estimate_noise_on_channel[0] || will_estimate_noise_on_channel[1] || st->bfi )
        {
            // for ( int p = 0; p < FFTCLDFBLEN; p++ )
            {
                // st->hFdCngDec->hFdCngCom->cngNoiseLevel[p] = L_shr ( st->hFdCngDec->hFdCngCom->cngNoiseLevel[p], sub( 28, st->hFdCngDec->hFdCngCom->cngNoiseLevelExp ) );
            }
            Scale_sig32( st->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN, sub( st->hFdCngDec->hFdCngCom->cngNoiseLevelExp, 28 ) );
            st->hFdCngDec->hFdCngCom->cngNoiseLevelExp = 31 - Q3; // Q3
            Scale_sig32( st->hFdCngDec->msNoiseEst, NPART_SHAPING, sub( st->hFdCngDec->msNoiseEst_exp, 27 ) );
            st->hFdCngDec->msNoiseEst_exp = 27;
            // Scale_sig32(power_spec, L_FRAME16k, sub(power_spec_e, 31));
            // power_spec_e = 31;
            /*=================================================*/
            Word32 *arr_tmp;
            IF( st->bfi )
            {