Commit ffc9e26c authored by fotopoulou's avatar fotopoulou
Browse files

Merge branch...

Merge branch '13-sba-cpe-mct-artefacts-in-drums-vector-at-48khz-encode-16khz-decode-64-160-256kbps-189' into 'main'

[non-BE] fix bug reported in Issue 13 with TCX5 ungrouping when TNS is active

See merge request !169
parents ce3c4d6d ff8a96c6
Loading
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -2000,6 +2000,10 @@ void decoder_tcx_tns(
    const int16_t bfi,                                          /* i  : Bad frame indicator                     */
    const int16_t frame_cnt,                                    /* i  : frame counter in the super frame        */
    const int16_t whitenedDomain 
#ifdef FIX_I13_TCX_TNS_ISSUE
    ,
    const int16_t isEvsMono /*i: EVS mono flag */
#endif
);

void decoder_tcx_imdct(
+1 −0
Original line number Diff line number Diff line
@@ -154,6 +154,7 @@
#define FIX_CREND_CHANNELS                              /* Issue 71: fix number of Crend channels */
#define HARMONIZE_SBA_NCHAN_TRANSPORT                   /* harmonize setting of number of transport channels in SBA */
#define DRAM_REDUCTION_MCT_IGF                          /* Issue 121: reduce dynamic RAM consumption in MCT IGF */
#define FIX_I13_TCX_TNS_ISSUE                           /* Issue 13: Fix reported artifacts. Bug in TNS with TCX5 */


/* ################## End DEVELOPMENT switches ######################### */
+4 −0
Original line number Diff line number Diff line
@@ -7889,6 +7889,10 @@ void decoder_tcx(
    const int16_t bfi,                  /* i  : Bad frame indicator                   */
    const int16_t frame_cnt,            /* i  : frame counter in the super_frame      */
    const int16_t sba_dirac_stereo_flag /* i  : signal stereo output for SBA DirAC    */
#ifdef FIX_I13_TCX_TNS_ISSUE
    ,
    const int16_t isEvsMono /*i: EVS mono flag */
#endif
);

void decoder_tcx_post(
+12 −2
Original line number Diff line number Diff line
@@ -595,7 +595,12 @@ void decoder_LPD(
        }

        /* TCX decoder */
        decoder_tcx( st, prm, Aq, Aind, &synth[0], &synthFB[0], bfi, 0, 0 );
        decoder_tcx( st, prm, Aq, Aind, &synth[0], &synthFB[0], bfi, 0, 0
#ifdef FIX_I13_TCX_TNS_ISSUE
                     ,
                     1
#endif
        );
    }

    /*--------------------------------------------------------------------------------*
@@ -621,7 +626,12 @@ void decoder_LPD(
            IGFDecRestoreTCX10SubFrameData( st->hIGFDec, k );

            /* TCX decoder */
            decoder_tcx( st, prm, Aq, Aind, &synth[k * L_frame / 2], &synthFB[k * L_frameTCX / 2], bfi, k, 0 );
            decoder_tcx( st, prm, Aq, Aind, &synth[k * L_frame / 2], &synthFB[k * L_frameTCX / 2], bfi, k, 0
#ifdef FIX_I13_TCX_TNS_ISSUE
                         ,
                         1
#endif
            );
        }
    }

+36 −3
Original line number Diff line number Diff line
@@ -68,6 +68,10 @@ void decoder_tcx(
    const int16_t bfi,                  /* i  : Bad frame indicator                    */
    const int16_t frame_cnt,            /* i  : frame counter in the super frame       */
    const int16_t sba_dirac_stereo_flag /* i  : signal stereo output for SBA DirAC     */
#ifdef FIX_I13_TCX_TNS_ISSUE
    ,
    const int16_t isEvsMono /*i: EVS mono flag */
#endif
)
{
    float x[N_MAX];
@@ -108,7 +112,12 @@ void decoder_tcx(

    decoder_tcx_noiseshaping_igf( st, L_spec, L_frame, L_frameTCX, left_rect, &x[0], &gainlpc2[0], &tmp_concealment_method, bfi );

    decoder_tcx_tns( st, L_frame_glob, L_spec, L_frame, L_frameTCX, &x[0], fUseTns, &tnsData, bfi, frame_cnt, 0 );
    decoder_tcx_tns( st, L_frame_glob, L_spec, L_frame, L_frameTCX, &x[0], fUseTns, &tnsData, bfi, frame_cnt, 0
#ifdef FIX_I13_TCX_TNS_ISSUE
                     ,
                     isEvsMono
#endif
    );

    decoder_tcx_imdct( st, L_frame_glob, L_frameTCX_glob, L_spec, tcx_offset, tcx_offsetFB, L_frame, L_frameTCX, left_rect, &x[0], &xn_buf[0], MDCT_IV,
                       fUseTns, &synth[0], &synthFB[0], bfi, frame_cnt, 0, sba_dirac_stereo_flag );
@@ -1488,7 +1497,12 @@ void decoder_tcx_tns(
    STnsData *tnsData,
    const int16_t bfi,       /* i  : Bad frame indicator                     */
    const int16_t frame_cnt, /* i  : frame counter in the super frame        */
    const int16_t whitenedDomain )
    const int16_t whitenedDomain
#ifdef FIX_I13_TCX_TNS_ISSUE
    ,
    const int16_t isEvsMono /*i: EVS mono flag */
#endif
)
{
    int16_t index, isTCX5, L;
    TCX_CONFIG_HANDLE hTcxCfg = st->hTcxCfg;
@@ -1519,11 +1533,12 @@ void decoder_tcx_tns(
            isTCX5 = 1;

            tcx5SpectrumDeinterleaving( L >> 1, x );

#ifndef FIX_I13_TCX_TNS_ISSUE
            if ( hTcxCfg->fIsTNSAllowed && fUseTns != 0 && bfi != 1 && tnsData->tnsOnWhitenedSpectra == whitenedDomain )
            {
                tcx5TnsGrouping( L >> 1, hTcxCfg->tnsConfig[0][0].iFilterBorders[0] >> 1, x );
            }
#endif
        }
    }

@@ -1541,6 +1556,13 @@ void decoder_tcx_tns(
        /* Apply TNS to get the reconstructed signal */
        SetTnsConfig( hTcxCfg, L_frame_glob == st->L_frame, ( st->last_core == ACELP_CORE ) && ( frame_cnt == 0 ) );

#ifdef FIX_I13_TCX_TNS_ISSUE
        if ( ( L_frame == st->L_frame >> 1 ) && st->tcxonly && isTCX5 )
        {
            tcx5TnsGrouping( L >> 1, hTcxCfg->tnsConfig[0][0].iFilterBorders[0] >> 1, x );
        }
#endif

        ApplyTnsFilter( hTcxCfg->pCurrentTnsConfig, tnsData, x, 0 );
#ifdef DEBUG_PLOT
        sendDebout( "tnsSpec2", L_frameTCX, 1, "aftTNS", MTV_FLOAT, x );
@@ -1548,8 +1570,19 @@ void decoder_tcx_tns(

        if ( ( L_frame == st->L_frame >> 1 ) && st->tcxonly && isTCX5 )
        {
#ifndef FIX_I13_TCX_TNS_ISSUE
            tcx5TnsUngrouping( L_frameTCX >> 1, hTcxCfg->tnsConfig[0][0].iFilterBorders[0] >> 1, x, DEC );
#else
            if ( isEvsMono ) /*tbc: this is temporary to maintain EVS BE, this is a bug and should be fixed also for EVS (see issue 13) */
            {
                tcx5TnsUngrouping( L_frameTCX >> 1, hTcxCfg->tnsConfig[0][0].iFilterBorders[0] >> 1, x, DEC );
            }
            else
            {
                tcx5TnsUngrouping( L >> 1, hTcxCfg->tnsConfig[0][0].iFilterBorders[0] >> 1, x, DEC );
            }
#endif
        }
    }

    if ( whitenedDomain && isTCX5 )
Loading