Commit 290cc649 authored by multrus's avatar multrus
Browse files

correct blending in blend_subfr2()

parent 6efbc98f
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -108,6 +108,7 @@
#define FIX_2283_ISM_MD_DELAY                           /* Dolby: Fix ISM metadata delay round-off */
#define FIX_2283_Q_CLDFB                                /* FhG: Fix Q format issue in CLDFB */
#define FIX_2283_ACCU_CLDFB                             /* FhG: Fix to consider Q-format differences in accumulateCLDFBArrayToBuffer_fx() */
#define FIX_FLOAT_1533_BLEND_SUBFR2                     /* FhG: float issue 1533: correct blending in blend_subfr2() */

/* ##################### End NON-BE switches ########################### */

+4 −1
Original line number Diff line number Diff line
@@ -6171,6 +6171,9 @@ void scale_st_fx(
void blend_subfr2_fx(
    Word16 *sigIn1, /* i  : i   signal for fade-out */
    Word16 *sigIn2, /* i  : i   signal for fade-in  */
#ifdef FIX_FLOAT_1533_BLEND_SUBFR2
    Word16 L_subfr, /* i  : subframe length           */
#endif
    Word16 *sigOut /* o  : output signal             */
);

+4 −0
Original line number Diff line number Diff line
@@ -1529,7 +1529,11 @@ ivas_error acelp_core_dec_fx(
            E_UTIL_synthesis( 1, Aq_fx, temp_buf_fx + M + L_SUBFR, temp_buf_fx, L_SUBFR, st->hPFstat->mem_stp + L_SYN_MEM - M, 0, M );
            scale_st_fx( psyn_fx, temp_buf_fx, &st->hPFstat->gain_prec, L_SUBFR );
            Copy( temp_buf_fx, psyn_fx, ( L_SUBFR >> 1 ) );
#ifdef FIX_FLOAT_1533_BLEND_SUBFR2
            blend_subfr2_fx( temp_buf_fx + L_SUBFR / 2, psyn_fx + L_SUBFR / 2, L_SUBFR, psyn_fx + L_SUBFR / 2 );
#else
            blend_subfr2_fx( temp_buf_fx + L_SUBFR / 2, psyn_fx + L_SUBFR / 2, psyn_fx + L_SUBFR / 2 );
#endif
        }
        st->hPFstat->on = 0;
        move16();
+4 −0
Original line number Diff line number Diff line
@@ -177,7 +177,11 @@ ivas_error acelp_core_switch_dec_fx(
            E_UTIL_synthesis( 1, Aq, exc, bpf_error_signal, L_SUBFR, st_fx->hPFstat->mem_stp + L_SYN_MEM - M, 0, M );
            scale_st_fx( synth_intFreq, bpf_error_signal, &st_fx->hPFstat->gain_prec, L_SUBFR );
            Copy( bpf_error_signal, synth_intFreq, L_SUBFR / 2 );
#ifdef FIX_FLOAT_1533_BLEND_SUBFR2
            blend_subfr2_fx( bpf_error_signal + L_SUBFR / 2, synth_intFreq + L_SUBFR / 2, L_SUBFR, synth_intFreq + L_SUBFR / 2 );
#else
            blend_subfr2_fx( bpf_error_signal + L_SUBFR / 2, synth_intFreq + L_SUBFR / 2, synth_intFreq + L_SUBFR / 2 );
#endif
        }
        st_fx->hPFstat->on = 0;
        move16();
+25 −2
Original line number Diff line number Diff line
@@ -1513,18 +1513,41 @@ void scale_st_fx(
void blend_subfr2_fx(
    Word16 *sigIn1, // Qx
    Word16 *sigIn2, // Qx
#ifdef FIX_FLOAT_1533_BLEND_SUBFR2
    Word16 L_subfr, // Q0
#endif
    Word16 *sigOut // Qx
)
{
    Word16 fac1 = 32768 - 512; // 1.Q15 - ( 1.Q15 / L_SUBFR );
    Word16 fac2 = 0 + 512;     // 0.Q15 + ( 1.Q15 / L_SUBFR );
    Word16 step = 1024;        // 1.Q15 / ( L_SUBFR / 2 );
    Word16 i;
    Word16 i, L_subfr_half;
    move16();
    move16();
    move16();

#ifdef FIX_FLOAT_1533_BLEND_SUBFR2
    assert( ( L_subfr == L_SUBFR ) || ( L_subfr == 2 * L_SUBFR ) );

    IF( EQ_16( L_subfr, 2 * L_SUBFR ) )
    {
        fac1 = 32768 - 256; // 1.Q15 - ( 1.Q15 / L_SUBFR );
        fac2 = 0 + 256;     // 0.Q15 + ( 1.Q15 / L_SUBFR );
        step = 512;         // 1.Q15 / ( L_SUBFR / 2 );
        move16();
        move16();
        move16();
    }
#endif

#ifdef FIX_FLOAT_1533_BLEND_SUBFR2
    L_subfr_half = shr( L_subfr, 1 );

    FOR( i = 0; i < L_subfr_half; i++ )
#else
    FOR( i = 0; i < L_SUBFR / 2; i++ )
#endif
    {
        sigOut[i] = mac_r_sat( L_mult_sat( fac1, sigIn1[i] ), fac2, sigIn2[i] ); // Qx
        fac1 = sub_sat( fac1, step );
Loading