Commit 0b045556 authored by Mohammadreza Naghibzadeh's avatar Mohammadreza Naghibzadeh
Browse files

Increased guard bits of DFT_fx, improved precision of past_dmx_nrg calculation...

Increased guard bits of DFT_fx, improved precision of past_dmx_nrg calculation in stereo_dft_generate_res_pred_fx().
parent 5d9d739f
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -112,6 +112,7 @@
#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_1946_CRASH_JBM_PROCESSING           /* FhG: Increased guard bits of DFT_fx */
/* #################### Start BASOP porting switches ############################ */

#define FIX_1372_ISAR_POST_REND
+4 −0
Original line number Diff line number Diff line
@@ -659,7 +659,11 @@ ivas_error ivas_cpe_dec_fx(

        IF( NE_16( shift, 31 ) )
        {
#ifdef FIX_1946_CRASH_JBM_PROCESSING
            shift = sub( add( hCPE->hStereoDft->q_dft, shift ), Q17 ); /* Q17 for guard bits */
#else
            shift = sub( add( hCPE->hStereoDft->q_dft, shift ), Q16 ); /* Q16 for guard bits */
#endif

            IF( GT_16( shift, hCPE->hStereoDft->q_dft ) )
            {
+20 −0
Original line number Diff line number Diff line
@@ -3171,15 +3171,35 @@ void stereo_dft_generate_res_pred_fx(
                    move32();
                    DFT_PRED_RES[2 * i + 1] = L_add( L_shl( Mpy_32_16_1( hStereoDft->DFT_past_DMX_fx[d_short_ind][2 * i + 1], g_short ), q_shift0 ), L_shl( Mpy_32_16_1( hStereoDft->DFT_past_DMX_fx[d_long_ind][2 * i + 1], g_long ), q_shift1 ) ); /* q_dft */
                    move32();
#ifndef FIX_1946_CRASH_JBM_PROCESSING
                    past_dmx_nrg = Madd_32_32( Madd_32_32( past_dmx_nrg, DFT_PRED_RES[2 * i], DFT_PRED_RES[2 * i] ), DFT_PRED_RES[2 * i + 1], DFT_PRED_RES[2 * i + 1] ); /* q_dft */
#endif
                }
                test();
                IF( !bfi || GE_16( b, hStereoDft->res_cod_band_max ) )
                {
#ifdef FIX_1946_CRASH_JBM_PROCESSING
                    Word16 q_div, scaleFactor;
#else
                    Word16 q_div;
#endif
                    Word16 op;
#ifdef FIX_1946_CRASH_JBM_PROCESSING
                    scaleFactor = getScaleFactor32( &DFT_PRED_RES[shl( hStereoDft->band_limits[b], 1 )], sub( shl( len, 1 ), 1 ) ); // calc it in the range [2*hStereoDft->band_limits[b] : 2*(len-1)+1]
                    scaleFactor = sub( scaleFactor, 4 );    // add headroom
                    FOR( i = hStereoDft->band_limits[b]; i < len; i++ )
                    {
                        Word32 x_2i = L_shl( DFT_PRED_RES[2 * i], scaleFactor );
                        Word32 x_2ip1 = L_shl( DFT_PRED_RES[2 * i + 1], scaleFactor );
                        past_dmx_nrg = Madd_32_32( Madd_32_32( past_dmx_nrg, x_2i, x_2i ), x_2ip1, x_2ip1 ); /* q_dft - 1 */
                    }
#endif
                    op = BASOP_Util_Divide3232_Scale( L_add( 1, dmx_nrg ), L_add( 1, past_dmx_nrg ), &q_div ); /* q_sqrt */
#ifdef FIX_1946_CRASH_JBM_PROCESSING
                    q_sqrt = sub( q_div, shl( scaleFactor, 1 ) );
#else
                    q_sqrt = q_div;
#endif
                    move16();
                    norm_fac = Sqrt16( op, &q_sqrt );
                    g2 = Mpy_32_16_1( pPredGain[b], norm_fac ); /* Q31 */