Commit 2849a179 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Merge branch 'crash_issue_fix_stereo_icBWE_dec' into 'main'

FIX : crash in ScaleShapedSHB_32 for stereo_icBWE_dec

See merge request !162
parents a386460b 1071047b
Loading
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -1554,7 +1554,7 @@ void ScaleShapedSHB_32(
    Word32 *synSHB_fx,          /* i/o: synthesized shb signal  Q_inp/Q_new */
    Word32 *overlap_fx,         /* i/o: buffer for overlap-add  Q_inp/Q_new */
    const Word16 *subgain_fx,   /* i  : subframe gain           Q15 */
    const Word32 frame_gain_fx, /* i  : frame gain              Ql*/
    const Word32 frame_gain_fx, /* i  : frame gain              Q18*/
    const Word16 *win_fx,       /* i  : window                  Q15 */
    const Word16 *subwin_fx,    /* i  : subframes window        Q15 */
    Word16 *Q_inp,
@@ -1648,9 +1648,10 @@ void ScaleShapedSHB_32(
        norm_shift = 31;
    }

    norm_shift = s_min( norm_shift, 14 );
    norm_shift = sub( norm_shift, 1 );

    *Q_new = add( *Q_inp, sub( norm_shift, 13 ) );
    *Q_new = add( *Q_inp, sub( norm_shift, 13 ) ); // Q_new = Q_inp + min(norm_shift,14) - 14;

    FOR( i = 0; i < L_SHB_LAHEAD; i++ )
    {
@@ -1659,20 +1660,20 @@ void ScaleShapedSHB_32(

    FOR( i = 0; i < l_shb_lahead; i++ )
    {
        synSHB_fx[i] = Mpy_32_32( mod_syn_fx[i], Mpy_32_16_1( L_shl( frame_gain_fx, norm_shift ), win_fx[i] ) ); // Qx + Qn + 18 - 1 - 31
        synSHB_fx[i] = Mpy_32_32( mod_syn_fx[i], Mpy_32_16_1( L_shl( frame_gain_fx, norm_shift ), win_fx[i] ) ); // Q_new
        synSHB_fx[i] = L_add( synSHB_fx[i], overlap_fx[i] );
        synSHB_fx[i + l_shb_lahead] = Mpy_32_32( mod_syn_fx[i], L_shl( frame_gain_fx, norm_shift ) ); // Qx + Qn + 18 - 1 - 31
        synSHB_fx[i + l_shb_lahead] = Mpy_32_32( mod_syn_fx[i], L_shl( frame_gain_fx, norm_shift ) ); // Q_new
    }

    FOR( ; i < l_frame; i++ )
    {
        synSHB_fx[i] = Mpy_32_32( mod_syn_fx[i], L_shl( frame_gain_fx, norm_shift ) ); // Qx + Qn + 18 - 1 - 31
        synSHB_fx[i] = Mpy_32_32( mod_syn_fx[i], L_shl( frame_gain_fx, norm_shift ) ); // Q_new
    }

    FOR( ; i < l_frame + l_shb_lahead; i++ )
    {
        synSHB_fx[i] = L_shl( synSHB_fx[i], *Q_new - *Q_inp );
        overlap_fx[i - l_frame] = Mpy_32_32( mod_syn_fx[i], Mpy_32_16_1( L_shl( frame_gain_fx, norm_shift ), win_fx[l_frame + l_shb_lahead - 1 - i] ) ); // Qx + Qn + 18 - 1 - 31
        overlap_fx[i - l_frame] = Mpy_32_32( mod_syn_fx[i], Mpy_32_16_1( L_shl( frame_gain_fx, norm_shift ), win_fx[l_frame + l_shb_lahead - 1 - i] ) ); // Q_new
    }

    *Q_inp = *Q_new;