Commit 6cf87ab2 authored by multrus's avatar multrus
Browse files

Merge branch '1946_fix_crash_jbm_processing' into 'main'

[non-BE] [rend non-BE] [allow-regression] Resolve #1946: "Decoder crash for stereo at 32kbps JBM processing decoding to mono/stereo at all fs"

Closes #1946

See merge request !2179
parents 1c1ac790 4f4597f8
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -78,6 +78,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 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 */
+4 −0
Original line number Diff line number Diff line
@@ -652,7 +652,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 ) )
            {
+9 −0
Original line number Diff line number Diff line
@@ -3171,16 +3171,25 @@ 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 ) )
                {
                    Word16 q_div;
                    Word16 op;
#ifdef FIX_1946_CRASH_JBM_PROCESSING
                    FOR( i = hStereoDft->band_limits[b]; i < len; i++ )
                    {
                        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
                    op = BASOP_Util_Divide3232_Scale( L_add( 1, dmx_nrg ), L_add( 1, past_dmx_nrg ), &q_div ); /* q_sqrt */
                    q_sqrt = q_div;
                    move16();

                    norm_fac = Sqrt16( op, &q_sqrt );
                    g2 = Mpy_32_16_1( pPredGain[b], norm_fac ); /* Q31 */
                    IF( LE_32( q_sqrt, norm_l( g2 ) ) )