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

Merge branch '810-issue-in-decoding-transition-mode-at-32-kbps' into 'main'

Proposed fix for 810

See merge request !458
parents 1299c05d 43223550
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -156,6 +156,7 @@

#define FIX_802__NON_BE_DECODING                    /* Fix possible difference float and fixed point when computing the GSC bit allocation */
#define FIX_802_1137_1137_GSC_IVAS_FXFLT_DECODING   /* VA: ISSUES 802 and 1137 Made sure that float and fixed point GCS bit allocation is the same during IVAS modes  */
#define FIX_810_PREVENT_UNECESSARY_SAT_IN_TC        /* VA : Prevent an unnecessary saturation that can happen in TC, have a minimal impact on most cases. Significant improvement for the last segment of LTV when TC is triggered */
/* ################## End DEVELOPMENT switches ######################### */

/* clang-format on */
+29 −2
Original line number Diff line number Diff line
@@ -6,6 +6,14 @@
#include "cnst.h"    /* Common constants                       */
#include "prot_fx.h" /* Function prototypes                    */
#ifdef IVAS_FLOAT_FIXED

#ifdef FIX_810_PREVENT_UNECESSARY_SAT_IN_TC
#define Q3_4   ( 4 << Q3 )
#define Q3_17  ( 17 << Q3 )
#define Q16_8  ( 8 << Q16 )
#define Q16_30 ( 30 << Q16 )
#endif

/*======================================================================*/
/* FUNCTION : decod_tran_fx()										    */
/*----------------------------------------------------------------------*/
@@ -177,10 +185,29 @@ void decod_tran_fx(
        /*----------------------------------------------------------------------*
         * Find the total excitation
         *----------------------------------------------------------------------*/

#ifdef FIX_810_PREVENT_UNECESSARY_SAT_IN_TC
        test();
        test();
        test();
        IF( GT_16( st_fx->element_mode, EVS_MONO ) && ( GE_16( add( i_subfr, L_SUBFR ), tc_subfr_fx ) && LT_16( i_subfr, tc_subfr_fx ) && GT_16( st_fx->Q_subfr[0], 4 ) ) )
        {
            test();
            test();
            test();
            IF( GE_16( st_fx->Q_subfr[0], 7 ) && LE_32( st_fx->lp_gainc_fx, Q3_4 ) && LE_32( norm_gain_code_fx, Q16_8 ) )
            {
                st_fx->Q_subfr[0] = s_min( st_fx->Q_subfr[0], 4 );
                move16();
            }
            ELSE IF( LE_32( st_fx->lp_gainc_fx, Q3_17 ) && LE_32( L_sub( gain_code_fx, norm_gain_code_fx ), Q16_30 ) )
            {
                st_fx->Q_subfr[0] = s_min( 4, sub( st_fx->Q_subfr[0], 2 ) );
                move16();
            }
        }
#endif
        IF( EQ_16( L_frame_fx, L_FRAME ) ) /* Rescaling for 12.8k core */
        {

            Rescale_exc( hMusicPF->dct_post_old_exc_fx, &exc_fx[i_subfr], &bwe_exc_fx[shr( imult1616( i_subfr, 2 * HIBND_ACB_L_FAC ), 1 )], hGSCDec->last_exc_dct_in_fx,
                         L_SUBFR, L_SUBFR * HIBND_ACB_L_FAC, gain_code_fx, &( st_fx->Q_exc ), st_fx->Q_subfr, exc2_fx, i_subfr, st_fx->coder_type );
        }