Commit 8d7c809d authored by TYAGIRIS's avatar TYAGIRIS
Browse files

update to latest main

parents bd946cdd 4e669c50
Loading
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -668,6 +668,9 @@ enum
#define ACELP_TCX_TRANS_NS                  1250000                             /* Duration of the ACELP->TCX overlap - 1.25 ms */
#define L_FRAME_MAX                         L_FRAME48k                          /* Max 20ms frame size @48kHz              */
#define L_FRAME_PLUS                        1200                                /* Max frame size (long TCX frame)            */
#ifdef FIX_1320_STACK_CPE_DECODER
#define L_FRAME_PLUS_INTERNAL               800                                 /* Max frame size (long TCX frame) at maximum internal sampling rate */
#endif
#define L_MDCT_OVLP_MAX                     NS2SA( 48000, ACELP_LOOK_NS )       /* = Max mdct overlap */
#define N_TCX10_MAX                         480                                 /* Max size of TCX10 MDCT spectrum */
#define BITS_TEC                            1                                   /* number of bits for TEC */
+10 −1
Original line number Diff line number Diff line
@@ -77,15 +77,24 @@
#define FIX_1942_ASSERTION_LOWSHELF                          /* FhG: Modified the target_gains_db_fx calculation in compute_t60_coeffs_fx() */
#define FIX_1944_CRASH_FOR_STEREO                            /* FhG: improve TonalMDCTConceal_InsertNoise calculation precision */
#define FIX_1970_SBA_CRASH                                   /* Dlb: Fix for issue 1970, SBA crash */

#define FIX_1978_SAT_MISSING_IN_GAIN_ENC                     /* VA:  Fix add saturation missing that lead to a crash in P800-10 */

#define FIX_1979_SAT_MISSING_IN_LSF_ENC                      /* VA: Proposal to fix 1979, saturation in lsf_enc, NOkia to review */
#define FIX_1946_CRASH_JBM_PROCESSING                        /* FhG: Increased guard bits of DFT_fx */
#define FIX_1980_CRASH_FDCNG_ENCODESID                       /* FhG: Add one bit of headroom in e_fx calculation in FdCng_encodeSID_ivas_fx() */
#define FIX_1985_SBA_714_HF_LOSS                             /* Dlb: Fix for issue 1985, improved dirac ref pow precision*/

/* #################### Start BASOP porting switches ############################ */

#define NONBE_1244_FIX_SWB_BWE_MEMORY                   /* VA: issue 1244: fix to SWB BWE memory in case of switching from FB coding - pending a review by Huawei */
#define FIX_1129_EXT_REND_OUTPUT_HIGH                   /* Philips: issue 1129: External renderer BINAURAL_ROOM_REVERB format output level too high compared to internal rendering output */
#define NONBE_1302_FIX_OMASA_JBM_FLUSH                  /* VA: issue 1302: fix OMASA JBM bitrate switching flush in binaural output */
#define NONBE_1328_FIX_NON_LINEARITY                    /* VA: Fix possible issue when computing bwe_exc_extended and previous frame were almost 0, float issue 1328  */
#define FIX_1319_STACK_SBA_DECODER                      /* VA: issue 1319: Optimize the definition of buffer lengths in the SBA decoder */
//de-activate FIX_1320_STACK_CPE_DECODER due to sanitizer issues in #1986; also review needed for patch within FIX_1946_CRASH_JBM_PROCESSING, which gets partially disabled
//#define FIX_1320_STACK_CPE_DECODER                      /* VA: issue 1320: Optimize the stack memory consumption in the CPE decoder */

#define FIX_1984_SAT_IN_PSYCHAD                         /* VA: Issue 1984: proposal to fix an assert */

/* #################### End BASOP porting switches ############################ */

+9 −5
Original line number Diff line number Diff line
@@ -1446,7 +1446,11 @@ void PsychAdaptLowFreqDeemph(
        tmp_e = min_e;
        move16();
        tmp = Inv16( min, &tmp_e ); /*Q15 - tmp_e*/
#ifdef FIX_1984_SAT_IN_PSYCHAD
        L_tmp = L_shl_sat( L_mult_sat( tmp, max_val ), add( tmp_e, max_e ) ); /* Q31 */
#else
        L_tmp = L_shl( L_mult( tmp, max_val ), add( tmp_e, max_e ) );                     /* Q31 */
#endif
        L_tmp = BASOP_Util_Log2( L_tmp );    /* Q25 */
        L_tmp = L_shr( L_tmp, 7 );           /* 0.0078125f = 1.f/(1<<7) */
        L_tmp = BASOP_Util_InvLog2( L_tmp ); /* Q31 */
+8 −0
Original line number Diff line number Diff line
@@ -36,7 +36,11 @@ void decoder_LPD_fx(
)
{
    Word16 *param_lpc;
#ifdef FIX_1320_STACK_CPE_DECODER
    Word16 synth_buf[OLD_SYNTH_INTERNAL_DEC + L_FRAME_PLUS_INTERNAL + M];
#else
    Word16 synth_buf[OLD_SYNTH_SIZE_DEC + L_FRAME_PLUS + M];
#endif
    Word16 *synth;
    Word16 synth_bufFB[OLD_SYNTH_SIZE_DEC + L_FRAME_PLUS + M];
    Word16 *synthFB;
@@ -114,7 +118,11 @@ void decoder_LPD_fx(
    synth = synth_buf + hTcxDec->old_synth_len;
    /*st->old_synth: Q_0*/
    Copy( hTcxDec->old_synth, synth_buf, hTcxDec->old_synth_len );
#ifdef FIX_1320_STACK_CPE_DECODER
    set16_fx( synth, 0, L_FRAME_PLUS_INTERNAL + M );
#else
    set16_fx( synth, 0, L_FRAME_PLUS + M );
#endif

    synthFB = synth_bufFB + hTcxDec->old_synth_lenFB;
    Copy( hTcxDec->old_synthFB_fx, synth_bufFB, hTcxDec->old_synth_lenFB );
+59 −12
Original line number Diff line number Diff line
@@ -76,7 +76,12 @@ ivas_error ivas_core_dec_fx(
    set16_fx( tmp_buffer_fx, 0, L_FRAME48k );

    Word16 tmps, incr;
#ifdef FIX_1320_STACK_CPE_DECODER
    Word32 *bwe_exc_extended_fx[CPE_CHANNELS] = { NULL, NULL };
    Word16 flag_bwe_bws;
#else
    Word32 bwe_exc_extended_fx[CPE_CHANNELS][L_FRAME32k + NL_BUFF_OFFSET];
#endif

    Word16 voice_factors_fx[CPE_CHANNELS][NB_SUBFR16k]; // Q15
    Word16 core_switching_flag[CPE_CHANNELS];
@@ -291,6 +296,9 @@ ivas_error ivas_core_dec_fx(
        set16_fx( voice_factors_fx[n], 0, NB_SUBFR16k );
        set32_fx( hb_synth_32_fx[n], 0, L_FRAME48k );
        set16_fx( hb_synth_16_fx[n], 0, L_FRAME48k );
#ifdef FIX_1320_STACK_CPE_DECODER
        bwe_exc_extended_fx[n] = hb_synth_32_fx[n]; /* note: reuse the buffer */
#endif

        /*------------------------------------------------------------------*
         * Decision matrix (selection of technologies)
@@ -1011,7 +1019,16 @@ ivas_error ivas_core_dec_fx(
        }

        /* Memories  Re-Scaling */
#ifdef FIX_1320_STACK_CPE_DECODER
        test();
        test();
        IF( EQ_16( st->extl, WB_TBE ) || ( EQ_16( st->extl, WB_BWE ) && st->bws_cnt == 0 ) )
        {
#endif
            Copy_Scale_sig_16_32_no_sat( hb_synth_16_fx[n], hb_synth_32_fx[n], L_FRAME48k, sub( Q11, Q_hb_synth_fx ) ); // Q11
#ifdef FIX_1320_STACK_CPE_DECODER
        }
#endif
        Copy_Scale_sig_16_32_no_sat( output_16_fx[n], output_32_fx[n], L_FRAME48k, sub( Q11, Q_input ) );    // Q11    // Q_input can get value <= -5
        Copy_Scale_sig_16_32_no_sat( synth_16_fx[n], synth_32_fx[n], output_frame, sub( Q11, Q_synth_fx ) ); // Q11

@@ -1029,9 +1046,18 @@ ivas_error ivas_core_dec_fx(
         * SWB(FB) BWE decoding
         *---------------------------------------------------------------------*/

#ifdef FIX_1320_STACK_CPE_DECODER
        test();
        test();
        test();
        flag_bwe_bws = ( GE_32( output_Fs, 32000 ) && st->core == ACELP_CORE && st->bwidth > NB && st->bws_cnt > 0 && st->bfi == 0 );
        move16();
#endif

        Q_white_exc = 0;
        move16();

#ifndef FIX_1320_STACK_CPE_DECODER
        test();
        test();
        test();
@@ -1039,6 +1065,7 @@ ivas_error ivas_core_dec_fx(
        test();
        test();
        test();
#endif
        test();
        test();
        test();
@@ -1070,7 +1097,11 @@ ivas_error ivas_core_dec_fx(
                fb_tbe_dec_ivas_fx( st, tmp_buffer_fx /*fb_exc*/, Q_white_exc, hb_synth_32_fx[n], 0, tmp_buffer_fx /*fb_synth_ref*/, Q_white_exc, output_frame );
            }
        }
#ifdef FIX_1320_STACK_CPE_DECODER
        ELSE IF( st->extl == SWB_BWE || st->extl == FB_BWE || flag_bwe_bws )
#else
        ELSE IF( EQ_16( st->extl, SWB_BWE ) || EQ_16( st->extl, FB_BWE ) || ( GE_32( output_Fs, 32000 ) && st->core == ACELP_CORE && st->bwidth > NB && st->bws_cnt > 0 && !st->ppp_mode_dec && !( EQ_16( st->nelp_mode_dec, 1 ) && EQ_16( st->bfi, 1 ) ) ) )
#endif
        {
            /* SWB BWE decoder */
            Q_syn_hb = swb_bwe_dec_fx32( st, output_32_fx[n], synth_32_fx[n], hb_synth_32_fx[n], use_cldfb_for_dft, output_frame );
@@ -1080,6 +1111,17 @@ ivas_error ivas_core_dec_fx(
            Copy_Scale_sig_32_16( hBWE_FD->L_old_wtda_swb_fx32, hBWE_FD->L_old_wtda_swb_fx, output_frame, sub( hBWE_FD->old_wtda_swb_fx_exp, Q11 ) ); // old_wtda_swb_fx_exp
        }

#ifdef FIX_1320_STACK_CPE_DECODER
        test();
        test();
        test();
        IF( ( st->core == ACELP_CORE && ( st->extl == -1 || st->extl == SWB_CNG ) ) && flag_bwe_bws == 0 )
        {
            set32_fx( hb_synth_32_fx[n], 0, L_FRAME48k );
        }

#endif

        /*---------------------------------------------------------------------*
         * FEC - recovery after lost HQ core (smoothing of the BWE component)
         *---------------------------------------------------------------------*/
@@ -1170,6 +1212,7 @@ ivas_error ivas_core_dec_fx(
            }
        }

#ifndef FIX_1320_STACK_CPE_DECODER
        IF( EQ_16( st->element_mode, EVS_MONO ) )
        {
            /*----------------------------------------------------------------*
@@ -1200,7 +1243,7 @@ ivas_error ivas_core_dec_fx(
                move16();
            }
        }

#endif
        /*----------------------------------------------------------------*
         * Transition and synchronization of BWE components
         *----------------------------------------------------------------*/
@@ -1219,6 +1262,7 @@ ivas_error ivas_core_dec_fx(
            }
            ELSE
            {
#ifndef FIX_1320_STACK_CPE_DECODER
                test();
                IF( EQ_16( st->extl, SWB_BWE_HIGHRATE ) || EQ_16( st->extl, FB_BWE_HIGHRATE ) )
                {
@@ -1227,9 +1271,12 @@ ivas_error ivas_core_dec_fx(
                }
                ELSE
                {
#endif
                    /* TBE on top of ACELP@16kHz */
                    tmps = NS2SA_FX2( output_Fs, MAX_DELAY_TBE_NS - DELAY_SWB_TBE_16k_NS );
#ifndef FIX_1320_STACK_CPE_DECODER
                }
#endif
            }

            /* Smooth transitions when switching between different technologies */
@@ -1454,8 +1501,12 @@ ivas_error ivas_core_dec_fx(
        test();
        test();
        test();
#ifdef FIX_1320_STACK_CPE_DECODER
        IF( st->hTcxDec != NULL && ( ( ( st->core == ACELP_CORE ) && !( EQ_16( st->bfi, 1 ) && EQ_16( st->con_tcx, 1 ) ) ) || EQ_16( st->core, HQ_CORE ) ) )
#else
        test();
        IF( ( EQ_16( st->codec_mode, MODE1 ) && st->hTcxDec != NULL ) && ( ( ( st->core == ACELP_CORE ) && !( EQ_16( st->bfi, 1 ) && EQ_16( st->con_tcx, 1 ) ) ) || EQ_16( st->core, HQ_CORE ) ) )
#endif
        {
            Word16 exp_prev_synth_buffer = 0, exp_old_out = 0, exp_delay_buf_out = 0, exp_ouput = 0, exp_synth_history = 0;
            move16();
@@ -1500,24 +1551,20 @@ ivas_error ivas_core_dec_fx(

        Scale_sig( st->delay_buf_out_fx, NS2SA_FX2( st->output_Fs, DELAY_CLDFB_NS ), negate( exp_max ) ); // Q0

    } /* n_channels loop */

    FOR( n = 0; n < n_channels; n++ )
    {
        st = sts[n];
        IF( st->cldfbAna )
        IF( st->cldfbAna != NULL )
        {
            scale_sig32( st->cldfbAna->cldfb_state_fx, st->cldfbAna->cldfb_size, ( Q11 - Q10 ) ); // Q11
            st->cldfbAna->Q_cldfb_state = Q11;
            move16();
        }
        IF( st->cldfbSynHB )
        IF( st->cldfbSynHB != NULL )
        {
            scale_sig32( st->cldfbSynHB->cldfb_state_fx, st->cldfbSynHB->cldfb_size, ( Q11 - Q10 ) ); // Q11
            st->cldfbSynHB->Q_cldfb_state = Q11;
            move16();
        }
    }

    } /* n_channels loop */

    pop_wmops();
    return error;
Loading