Commit 49b57e88 authored by vaclav's avatar vaclav
Browse files

FIX_1563_FIX_STEREO_SW

parent 7897b35e
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -6116,7 +6116,7 @@ void mvc2c(
    const Word16 n                                              /* i  : vector size                             */
);

void stereo_switching_dec(
void stereo_switching_dec_fx(
    CPE_DEC_HANDLE hCPE,                                        /* i/o: CPE decoder structure                   */
    const Word32 ivas_total_brate                               /* i  : IVAS total bitrate                    Q0*/
);
+1 −0
Original line number Diff line number Diff line
@@ -103,6 +103,7 @@
#define FIX_1547_ISMDTX_HANDLE                          /* VA: float issue 1547: fix use of 'hISMDTX' handle */
#define FIX_1540_EXPOSE_PT_IN_RTP_HEADER_API            /* Expose Payload Type setting in RTP Header */
#define FIX_BASOP_2491_MDCT_JBM_CLICK                   /* FhG: BASOP #2491: Fix Q_synth after TCX concealment (using ACELP concealment) */
#define FIX_1563_FIX_STEREO_SW                          /* VA: float issue 1563: fix clicks in stereo switching */

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

+1 −1
Original line number Diff line number Diff line
@@ -202,7 +202,7 @@ ivas_error ivas_cpe_dec_fx(
     * Resets/updates in case of stereo switching
     *----------------------------------------------------------------*/

    stereo_switching_dec( hCPE, ivas_total_brate );
    stereo_switching_dec_fx( hCPE, ivas_total_brate );

    /*----------------------------------------------------------------*
     * Configuration of stereo decoder
+17 −16
Original line number Diff line number Diff line
@@ -46,6 +46,15 @@

#define DFT2TD_CORR_THRESH_FX 1932735283

static Word32 side_gain_table[32 + 1] = {
    -ONE_IN_Q31, -2040109440, -1932735232, -1825361152, -1717986944,
    -1610612736, -1503238528, -1395864320, -1288490240, -1181115904, -1073741824,
    -966367616, -858993408, -751619200, -644245120, -536870912, -429496704,
    -322122496, -214748288, -107374208, 0, 107374336, 214748416,
    322122496, 429496832, 536870912, 644245248, 751619328, 858993408,
    966367744, 1073741824, 1181116160, 1288490240
};


/*-------------------------------------------------------------------*
 * Function allocate_CoreCoder_TCX()
@@ -1689,16 +1698,7 @@ void synchro_synthesis_fx(
 * Handling of memories in case of CPE modes switching
 *-------------------------------------------------------------------*/

static Word32 side_gain_table[32 + 1] = {
    -ONE_IN_Q31, -2040109440, -1932735232, -1825361152, -1717986944,
    -1610612736, -1503238528, -1395864320, -1288490240, -1181115904, -1073741824,
    -966367616, -858993408, -751619200, -644245120, -536870912, -429496704,
    -322122496, -214748288, -107374208, 0, 107374336, 214748416,
    322122496, 429496832, 536870912, 644245248, 751619328, 858993408,
    966367744, 1073741824, 1181116160, 1288490240
};

void stereo_switching_dec(
void stereo_switching_dec_fx(
    CPE_DEC_HANDLE hCPE,          /* i/o: CPE decoder structure         */
    const Word32 ivas_total_brate /* i  : IVAS total bitrate          Q0*/
)
@@ -1891,13 +1891,11 @@ void stereo_switching_dec(
            sts[0]->mem_deemph_fx = 0;
            move16();


            sts[0]->tilt_code_fx = 0;
            move16();
            sts[0]->gc_threshold_fx = 0;
            move16();


            set16_fx( sts[0]->mem_syn1_fx, 0, M );
            set16_fx( sts[0]->mem_syn2_fx, 0, M );
            set16_fx( sts[0]->mem_syn3_fx, 0, M );
@@ -1906,7 +1904,6 @@ void stereo_switching_dec(
            sts[1]->last_L_frame = sts[0]->last_L_frame; /* Q0 */
            move16();


            set16_fx( sts[0]->old_exc_fx, 0, L_EXC_MEM_DEC );
            set16_fx( sts[0]->lsf_old_fx, 0, M );
            set16_fx( sts[0]->lsp_old_fx, 0, M );
@@ -1917,14 +1914,12 @@ void stereo_switching_dec(
        sts[1]->prev_bfi = sts[0]->prev_bfi; /* Q0 */
        move16();


        // fix need to do correctly
        set32_fx( sts[1]->old_pitch_buf_fx, L_deposit_h( L_SUBFR ), 2 * NB_SUBFR16k );
        sts[1]->old_fpitchFB = L_deposit_h( 2 * L_SUBFR ); /* 15Q16 */
        move32();

        /* reset CLDFB memories */

        cldfb_reset_memory_fx( sts[1]->cldfbAna );
        cldfb_reset_memory_fx( sts[1]->cldfbBPF );
        cldfb_reset_memory_fx( sts[1]->cldfbSyn );
@@ -1937,7 +1932,6 @@ void stereo_switching_dec(
        sts[1]->gc_threshold_fx = 0;
        move16();


        set16_fx( sts[1]->mem_syn1_fx, 0, M );
        set16_fx( sts[1]->mem_syn2_fx, 0, M );
        set16_fx( sts[1]->mem_syn3_fx, 0, M );
@@ -2015,6 +2009,13 @@ void stereo_switching_dec(
            Copy( sts[0]->hTcxDec->old_syn_Overl, sts[1]->hTcxDec->old_syn_Overl, 256 );              /* Q_old_syn_Overl*/
            sts[1]->hTcxDec->Q_old_syn_Overl = sts[0]->hTcxDec->Q_old_syn_Overl;
        }
#ifdef FIX_1563_FIX_STEREO_SW
        ELSE IF ( hCPE->element_mode == IVAS_CPE_TD )
        {
            sts[1]->last_core = ACELP_CORE;
            move16();
        }
#endif
    }
    ELSE IF( EQ_16( hCPE->element_mode, IVAS_CPE_TD ) && EQ_16( hCPE->last_element_mode, IVAS_CPE_MDCT ) )
    {