Commit 531c14f2 authored by vaillancour's avatar vaillancour
Browse files

Complete fix for 843

parent fd1f8b5f
Loading
Loading
Loading
Loading
Loading
+21 −2
Original line number Diff line number Diff line
@@ -368,7 +368,9 @@ Word16 ivas_wb_bwe_dec_fx(
    Word16 scl, new_input_fx_exp;
    Word16 i;
    FD_BWE_DEC_HANDLE hBWE_FD;

#ifdef FIX_843_LOW_RATE_BWE
    Word16 ysynth_frame_size;
#endif
    Word16 coder_type = st_fx->coder_type;
    move16();

@@ -389,6 +391,9 @@ Word16 ivas_wb_bwe_dec_fx(
        *Qpost = sub( new_input_fx_exp, 15 );
        move16();
        direct_transform_fx( L_wtda_synth_fx, ysynth_32, 0, /*st->L_frame*/ L_FRAME16k, &new_input_fx_exp, st_fx->element_mode );
#ifdef FIX_843_LOW_RATE_BWE
        ysynth_frame_size = L_FRAME16k;
#endif
    }
    ELSE
    {
@@ -398,11 +403,17 @@ Word16 ivas_wb_bwe_dec_fx(
        *Qpost = sub( new_input_fx_exp, 15 );
        move16();
        /* DCT of the ACELP core synthesis */
#if defined MSAN_FIX && !defined FIX_843_LOW_RATE_BWE 
#ifdef FIX_843_LOW_RATE_BWE
        direct_transform_fx( L_wtda_synth_fx, ysynth_32, 0, output_frame, &new_input_fx_exp, st_fx->element_mode );
        ysynth_frame_size = output_frame;
#else
#ifdef  MSAN_FIX 
        direct_transform_fx( L_wtda_synth_fx, ysynth_32, 0, L_FRAME16k, &new_input_fx_exp, st_fx->element_mode );
#else
        direct_transform_fx( L_wtda_synth_fx, ysynth_32, 0, output_frame, &new_input_fx_exp, st_fx->element_mode );
#endif
#endif

    }
    /* Convert to 16 Bits (Calc Shift Required to Stay within MAX_Q_NEW_INPUT) */
    scl = sub( 16 + MAX_Q_NEW_INPUT, new_input_fx_exp );
@@ -411,18 +422,26 @@ Word16 ivas_wb_bwe_dec_fx(
    {
        /* Yes */
        /* Calc Room to Upscale */
#ifdef FIX_843_LOW_RATE_BWE
        Q_syn = Find_Max_Norm32( ysynth_32, ysynth_frame_size );
#else
#ifdef MSAN_FIX
        Q_syn = Find_Max_Norm32( ysynth_32, L_FRAME16k );
#else
        Q_syn = Find_Max_Norm32( ysynth_32, output_frame );
#endif
#endif
        /* Stay within MAX_Q_NEW_INPUT */
        scl = s_min( Q_syn, scl );
    }
#ifdef FIX_843_LOW_RATE_BWE
    Copy_Scale_sig32_16( ysynth_32, ysynth_fx, ysynth_frame_size, scl );
#else
#ifdef MSAN_FIX
    Copy_Scale_sig32_16( ysynth_32, ysynth_fx, L_FRAME16k, scl );
#else
    Copy_Scale_sig32_16( ysynth_32, ysynth_fx, output_frame, scl );
#endif
#endif
    Q_syn = add( sub( new_input_fx_exp, 16 ), scl );
    IF( !st_fx->bfi )