Commit 9a1a7881 authored by fotopoulou's avatar fotopoulou
Browse files

proposed fix for FIX_MDCT_STEREO_BWD_TCX10

parent 0336bb8e
Loading
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -155,7 +155,9 @@
#ifdef FIX_I109_ORIENTATION_TRACKING
#define OTR_REFERENCE_VECTOR_TRACKING                   /* FhG: enables the reference position orientation tracking mode */
#endif
#define DISABLE_BWD_MCT                                 /* FhG: Disable bandwidth detection for MCT*/
//#define DISABLE_BWD_MCT                               /* FhG: Disable bandwidth detection for MCT*/
#define FIX_MDCT_STEREO_BWD_TCX10                       /* FhG: enables bw detection also for TCX10 frames */


/* ################## End DEVELOPMENT switches ######################### */
/* clang-format on */
+6 −0
Original line number Diff line number Diff line
@@ -173,8 +173,14 @@ void bw_detect(
            }
            else
            {
#ifndef FIX_MDCT_STEREO_BWD_TCX10
                bin_width *= (int16_t) ( ( st->input_Fs / FRAMES_PER_SEC ) / BWD_TOTAL_WIDTH );
                mvr2r( spectrum, spect, (int16_t) ( st->input_Fs / FRAMES_PER_SEC ) );
#else
                assert( st->core != ACELP_CORE );
                bin_width *= (int16_t) ( ( st->input_Fs / ( FRAMES_PER_SEC * st->core ) ) / BWD_TOTAL_WIDTH );
                mvr2r( spectrum, spect, (int16_t) ( st->input_Fs / ( FRAMES_PER_SEC * st->core ) ) );
#endif
            }
            /*---------------------------------------------------------------------*
             * compute energy per spectral bins
+12 −6
Original line number Diff line number Diff line
@@ -687,6 +687,7 @@ void ivas_mdct_core_whitening_enc(

/* BWD in MDCT domain */
#ifndef DISABLE_BWD_MCT
#ifndef FIX_MDCT_STEREO_BWD_TCX10
        if ( st->hTcxEnc->transform_type[0] == TCX_20 && st->hTcxCfg->tcx_last_overlap_mode != TRANSITION_OVERLAP )
        {
            if ( st->mct_chan_mode != MCT_CHAN_MODE_LFE )
@@ -695,15 +696,20 @@ void ivas_mdct_core_whitening_enc(
            }
        }
#else
        if ( ( st->hTcxEnc->transform_type[0] == TCX_20 && st->hTcxCfg->tcx_last_overlap_mode != TRANSITION_OVERLAP ) && !mct_on )
        if ( st->mct_chan_mode != MCT_CHAN_MODE_LFE && st->hTcxCfg->tcx_last_overlap_mode != TRANSITION_OVERLAP )
        {
            nSubframes = ( st->hTcxEnc->tcxMode == TCX_20 ) ? 1 : NB_DIV;

            bw_detect( st, NULL, st->hTcxEnc->spectrum[0], NULL );
        }
        else if ( mct_on )
            for ( n = 0; n < nSubframes; n++ )
            {
            st->bwidth = st->max_bwidth;
                bw_detect( st, NULL, st->hTcxEnc->spectrum[n], NULL );
                if ( nSubframes == NB_DIV && n == 0 )
                {
                    st->last_input_bwidth = st->input_bwidth;
                }
            }
        }
#endif
#endif

        if ( st->last_core == ACELP_CORE ) /* reset past kernel info */