Commit 293232a3 authored by vaillancour's avatar vaillancour
Browse files

Fix proposal for 2081

parent bef81052
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -113,6 +113,9 @@
#define FIX_2021_BANDWIDTH_EXTENSION_PROBLEM                 /* FhG: increase cldfb buffer precision*/

#define FIX_2085_FLOATING_POINT_LEFTOVERS                    /* FhG: convert floating-point leftovers in ivas_dirac_config_fx() */

#define FIX_2081_REVISE_H1_SCALING                          /* VA: accommodate for H1 overshoot that was causing assert in set_impule. Not BE with MASA on LTV with bitrate switching for only 2 instances */

/* #################### 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 */
+26 −2
Original line number Diff line number Diff line
@@ -460,7 +460,11 @@ Word16 encod_tran_ivas_fx(
    Word16 tc_subfr,          /* i/o: TC subframe classification                        Q0*/
    Word16 position,          /* i  : maximum of residual signal index                  Q0*/
    Word16 *unbits,           /* i/o: number of unused bits                             Q0*/
#ifdef FIX_2081_REVISE_H1_SCALING
    const Word16 shift_r,    /* i  : Scaling to get 12 bits                            */
#else
    const Word16 shift,      /* i  : Scaling to get 12 bits                            */
#endif
    const Word16 Q_new        /* i  : Input scaling                                     */
)
{
@@ -494,6 +498,9 @@ Word16 encod_tran_ivas_fx(
    Word16 shift_wsp;
    Word32 L_tmp;
    Word16 q_h1;
#ifdef FIX_2081_REVISE_H1_SCALING
    Word16 shift, tmp;
#endif    
#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
@@ -504,6 +511,11 @@ Word16 encod_tran_ivas_fx(
    SC_VBR_ENC_HANDLE hSC_VBR = st_fx->hSC_VBR;
    LPD_state_HANDLE hLPDmem = st_fx->hLPDmem;

#ifdef FIX_2081_REVISE_H1_SCALING
    shift = shift_r; /* for IVAS, shift_r is always 0 */
                     /* will be reusing the EVS shift strategy later on to allow of H1 overshoot */
    move16();
#endif
    L_frame_fx = st_fx->L_frame;
    move16();

@@ -572,9 +584,21 @@ Word16 encod_tran_ivas_fx(
                              res_fx, L_SUBFR, p_Aw, st_fx->preemph_fac, xn, cn, h1 );

        q_h1 = sub( 14, norm_s( h1[0] ) );
#ifdef FIX_2081_REVISE_H1_SCALING
        tmp = sub( 14, norm_arr( h1, L_SUBFR ) );
        shift = sub( q_h1, tmp );                  /* shift is initialized to shift_r ( to 0) at the beginning of the scope, re-compute shift_wsp in case it has changed */
        shift_wsp = add( Q_new, shift );
        if ( LT_32( st_fx->core_brate, MIN_BRATE_AVQ_EXC ) )
        {
            shift_wsp = sub( shift_wsp, 1 );
        }
#endif
        Copy_Scale_sig( h1, h2_fx, L_SUBFR, sub( 11, q_h1 ) ); /*Q11*/
#ifdef FIX_2081_REVISE_H1_SCALING
        Scale_sig( h1, L_SUBFR, add( sub( 14, q_h1 ), shift ) );
#else
        Scale_sig( h1, L_SUBFR, sub( 14, q_h1 ) );

#endif
        /* scaling of xn[] to limit dynamic at 12 bits */
        Scale_sig( xn, L_SUBFR, shift );