Commit cad786c1 authored by multrus's avatar multrus
Browse files

[cleanup] accept FIX_2388_INITTNSCONFIGURATION

parent 1dda7b9e
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -997,11 +997,7 @@ void init_tcx_cfg_ivas_fx(

    IF( hTcxCfg->fIsTNSAllowed )
    {
#ifdef FIX_2388_INITTNSCONFIGURATION
        InitTnsConfigs_fx( bwidth, hTcxCfg->tcx_coded_lines, hTcxCfg->tnsConfig, infoIGFStopFreq, total_brate, element_mode, MCT_flag );
#else
        InitTnsConfigs_ivas_fx( bwidth, hTcxCfg->tcx_coded_lines, hTcxCfg->tnsConfig, infoIGFStopFreq, total_brate, element_mode, MCT_flag );
#endif
        SetAllowTnsOnWhite( hTcxCfg->tnsConfig, (Word8) EQ_16( element_mode, IVAS_CPE_MDCT ) );
    }

@@ -1256,11 +1252,7 @@ void init_tcx_cfg_fx(

    IF( hTcxCfg->fIsTNSAllowed )
    {
#ifdef FIX_2388_INITTNSCONFIGURATION
        InitTnsConfigs_fx( bwidth, hTcxCfg->tcx_coded_lines, hTcxCfg->tnsConfig, infoIGFStopFreq, total_brate, element_mode, MCT_flag );
#else
        InitTnsConfigs( bwidth, hTcxCfg->tcx_coded_lines, hTcxCfg->tnsConfig, infoIGFStopFreq, total_brate, element_mode, MCT_flag );
#endif

        SetAllowTnsOnWhite( hTcxCfg->tnsConfig, (Word8) EQ_16( element_mode, IVAS_CPE_MDCT ) );
    }
+0 −1
Original line number Diff line number Diff line
@@ -83,7 +83,6 @@
#define FIX_1990_SANITIZER_IN_REVERB_LOAD               /* Nokia: Fix issue part of issue 1990 by introducing missing free of structure - keep until #2059 is addressed */
#define TMP_1342_WORKAROUND_DEC_FLUSH_BROKEN_IN_SR      /* FhG: Temporary workaround for incorrect implementation of decoder flush with split rendering */
#define NONBE_1122_KEEP_EVS_MODE_UNCHANGED              /* FhG: Disables fix for issue 1122 in EVS mode to keep BE tests green. This switch should be removed once the 1122 fix is added to EVS via a CR.  */
#define FIX_2388_INITTNSCONFIGURATION                   /* FhG: issue 2388 : harmonizing InitTnsConfiguration() function */
#define FIX_2397_COPY_AQ_MDCT_CORE_BFI                  /* FhG: prevent copying of uninit memory in MDCT stereo core if bfi is set */
#define HARMONIZE_TBE                                   /* VA: harmonize core-coder TBE function duplications */
#define FIX_2405_HARM_SMC_INIT                          /* VA, basop 2405, harmonisation of SMC init */
+0 −28
Original line number Diff line number Diff line
@@ -3436,22 +3436,8 @@ Word32 DTFS_getEngy_band_wb_fx(
    Word16 lband,
    Word16 hband );
#ifndef FIX_2388_INITTNSCONFIGURATION
void InitTnsConfiguration(
    const Word16 bwidth,
    const Word16 frameLength,
    STnsConfig *pTnsConfig,
    const Word16 igfStopFreq,
    const Word32 total_brate,
    const Word16 element_mode,
    const Word16 is_mct );
#endif
#ifdef FIX_2388_INITTNSCONFIGURATION
void InitTnsConfiguration_fx(
#else
void InitTnsConfiguration_ivas_fx(
#endif
    const Word16 bwidth,
    const Word16 frameLength,
    STnsConfig *pTnsConfig,
@@ -4096,22 +4082,8 @@ void tcx_noise_filling_with_shift(
    const Word16 element_mode /* i  : IVAS element mode   */
);
#ifndef FIX_2388_INITTNSCONFIGURATION
void InitTnsConfigs(
    const Word16 bwidth,
    const Word16 L_frame,
    STnsConfig tnsConfig[2][2],
    const Word16 igfStopFreq,
    const Word32 total_brate,
    const Word16 element_mode,
    const Word16 is_mct );
#endif
#ifdef FIX_2388_INITTNSCONFIGURATION
void InitTnsConfigs_fx
#else
void InitTnsConfigs_ivas_fx
#endif
    (
        const Word16 bwidth,
        const Word16 L_frame,
+0 −31
Original line number Diff line number Diff line
@@ -1973,30 +1973,8 @@ void tcx_noise_filling_with_shift(
 *--------------------------------------------------------------*/


#ifndef FIX_2388_INITTNSCONFIGURATION
void InitTnsConfigs(
    const Word16 bwidth,  /*Q0*/
    const Word16 L_frame, /*Q0*/
    STnsConfig tnsConfig[2][2],
    const Word16 igfStopFreq,  /*Q0*/
    const Word32 total_brate,  /*Q0*/
    const Word16 element_mode, /*Q0*/
    const Word16 MCT_flag /*Q0*/ )
{
    IF( GT_32( total_brate, ACELP_32k ) )
    {
        InitTnsConfiguration( bwidth, shr( L_frame, 1 ), &tnsConfig[0][0], igfStopFreq, total_brate, element_mode, MCT_flag );
    }
    InitTnsConfiguration( bwidth, L_frame, &tnsConfig[1][0], igfStopFreq, total_brate, element_mode, MCT_flag );
    InitTnsConfiguration( bwidth, add( L_frame, shr( L_frame, 2 ) ), &tnsConfig[1][1], igfStopFreq, total_brate, element_mode, MCT_flag );
}
#endif

#ifdef FIX_2388_INITTNSCONFIGURATION
void InitTnsConfigs_fx
#else
void InitTnsConfigs_ivas_fx
#endif
    (
        const Word16 bwidth,  /*Q0*/
        const Word16 L_frame, /*Q0*/
@@ -2008,19 +1986,10 @@ void InitTnsConfigs_ivas_fx
{
    IF( GT_32( total_brate, ACELP_32k ) )
    {
#ifdef FIX_2388_INITTNSCONFIGURATION
        InitTnsConfiguration_fx( bwidth, shr( L_frame, 1 ), &tnsConfig[0][0], igfStopFreq, total_brate, element_mode, MCT_flag );
#else
        InitTnsConfiguration_ivas_fx( bwidth, shr( L_frame, 1 ), &tnsConfig[0][0], igfStopFreq, total_brate, element_mode, MCT_flag );
#endif
    }
#ifdef FIX_2388_INITTNSCONFIGURATION
    InitTnsConfiguration_fx( bwidth, L_frame, &tnsConfig[1][0], igfStopFreq, total_brate, element_mode, MCT_flag );
    InitTnsConfiguration_fx( bwidth, add( L_frame, shr( L_frame, 2 ) ), &tnsConfig[1][1], igfStopFreq, total_brate, element_mode, MCT_flag );
#else
    InitTnsConfiguration_ivas_fx( bwidth, L_frame, &tnsConfig[1][0], igfStopFreq, total_brate, element_mode, MCT_flag );
    InitTnsConfiguration_ivas_fx( bwidth, add( L_frame, shr( L_frame, 2 ) ), &tnsConfig[1][1], igfStopFreq, total_brate, element_mode, MCT_flag );
#endif
}

void SetTnsConfig(
+0 −154
Original line number Diff line number Diff line
@@ -72,138 +72,8 @@ static void ITF_GetFilterParameters_fx( Word32 rxx[], const Word16 maxOrder, Wor
/*      Interface functions     */
/********************************/

#ifndef FIX_2388_INITTNSCONFIGURATION
/** Init TNS configuration.
 * Fills STnsConfig structure with sensible content.
 * @param nSampleRate Sampling rate of the input.
 * @param nFrameLength Frame length.
 * @param pTnsConfig TNS configuration to be initialized.
 * @return 0 on success, otherwise 1.
 */
void InitTnsConfiguration(
    const Word16 bwidth,
    const Word16 frameLength,
    STnsConfig *pTnsConfig,
    const Word16 igfStopFreq,
    const Word32 total_brate,
    const Word16 element_mode,
    const Word16 is_mct )
{
    Word16 iFilter = 0;
    move16();
    Word16 *startLineFilter;
    Word32 L_tmp;
    Word32 nSampleRate;
    Word16 s1;
    Word16 s2;
    (void) ( element_mode );
    (void) ( is_mct );
    nSampleRate = bwMode2fs[bwidth];
    move32();
    startLineFilter = &pTnsConfig->iFilterBorders[1];

    /* Sanity checks */
    assert( ( nSampleRate > 0 ) && ( frameLength > 0 ) && ( pTnsConfig != NULL ) );
    test();
    test();
    IF( ( nSampleRate <= 0 ) || ( frameLength <= 0 ) || ( pTnsConfig == NULL ) )
    {
        return /*TNS_FATAL_ERROR*/;
    }


    /* Initialize TNS filter flag and maximum order */
    move16();
    pTnsConfig->maxOrder = TNS_MAX_FILTER_ORDER;

    IF( LE_32( total_brate, ACELP_32k ) )
    {
        move16();
        move16();
        pTnsConfig->nMaxFilters = sizeof( tnsParametersIGF32kHz_LowBR ) / sizeof( tnsParametersIGF32kHz_LowBR[0] );
        pTnsConfig->pTnsParameters = tnsParametersIGF32kHz_LowBR;
    }
    ELSE
    {
        test();
        IF( GT_32( nSampleRate, 32000 ) && EQ_32( nSampleRate, L_mult0( 100, frameLength ) ) )
        {
            move16();
            pTnsConfig->nMaxFilters = sizeof( tnsParameters48kHz_grouped ) / sizeof( tnsParameters48kHz_grouped[0] );
            move16();
            pTnsConfig->pTnsParameters = tnsParameters48kHz_grouped;
        }
        ELSE
        IF( GT_32( nSampleRate, INT_FS_16k ) )
        {
            {

                move16();
                pTnsConfig->nMaxFilters = sizeof( tnsParameters32kHz ) / sizeof( tnsParameters32kHz[0] );

                move16();
                pTnsConfig->pTnsParameters = tnsParameters32kHz;

                if ( EQ_32( nSampleRate, L_mult0( 100, frameLength ) ) ) /* sub-frame length is <= 10 ms */
                {
                    move16();
                    pTnsConfig->pTnsParameters = tnsParameters32kHz_grouped;
                }
            }
        }
        ELSE
        {
            IF( EQ_32( nSampleRate, L_mult0( 100, frameLength ) ) ) /* sub-frame length is <= 10 ms */
            {
                move16();
                pTnsConfig->nMaxFilters = sizeof( tnsParameters16kHz_grouped ) / sizeof( tnsParameters16kHz_grouped[0] );
                pTnsConfig->pTnsParameters = tnsParameters16kHz_grouped;
            }
            ELSE
            {
                move16();
                move16();
                pTnsConfig->nMaxFilters = sizeof( tnsParameters16kHz ) / sizeof( tnsParameters16kHz[0] );
                pTnsConfig->pTnsParameters = tnsParameters16kHz;
            }
        }
    }

    assert( pTnsConfig->nMaxFilters <= TNS_MAX_NUM_OF_FILTERS );

    /* Set starting MDCT line for each filter based on the starting frequencies from the TNS table */

    FOR( iFilter = 0; iFilter < pTnsConfig->nMaxFilters; iFilter++ )
    {
        assert( pTnsConfig->pTnsParameters[iFilter].startLineFrequency < nSampleRate / 2 );
        assert( nSampleRate <= 96000 );
        move16();
        startLineFilter[iFilter] = divide3232( L_mult0( frameLength, pTnsConfig->pTnsParameters[iFilter].startLineFrequency ), L_shl( nSampleRate, 14 ) );
    }

    IF( igfStopFreq > 0 )
    {
        L_tmp = L_mult( frameLength, igfStopFreq );
        s1 = sub( norm_l( L_tmp ), 1 );
        s2 = norm_l( nSampleRate );

        move16();
        pTnsConfig->iFilterBorders[0] = shr( div_l( L_shl( L_tmp, s1 ), extract_h( L_shl( nSampleRate, s2 ) ) ), sub( WORD16_BITS - 1, sub( s2, s1 ) ) );
    }
    ELSE
    {
        move16();
        pTnsConfig->iFilterBorders[0] = frameLength;
    }
    return; /*TNS_NO_ERROR;*/
}
#endif /* FIX_2388_INITTNSCONFIGURATION */

#ifdef FIX_2388_INITTNSCONFIGURATION
void InitTnsConfiguration_fx
#else
void InitTnsConfiguration_ivas_fx
#endif /* FIX_2388_INITTNSCONFIGURATION */
    (
        const Word16 bwidth,      /*Q0*/
        const Word16 frameLength, /*Q0*/
@@ -242,11 +112,7 @@ void InitTnsConfiguration_ivas_fx
    IF( LE_32( total_brate, ACELP_32k ) )
    {
        move16();
#ifdef FIX_2388_INITTNSCONFIGURATION
        pTnsConfig->nMaxFilters = (UWord8) ( sizeof( tnsParametersIGF32kHz_LowBR ) / sizeof( tnsParametersIGF32kHz_LowBR[0] ) ); /*Q0*/
#else
        pTnsConfig->nMaxFilters = (UWord8) idiv1616( sizeof( tnsParametersIGF32kHz_LowBR ), sizeof( tnsParametersIGF32kHz_LowBR[0] ) );       /*Q0*/
#endif
        pTnsConfig->pTnsParameters = tnsParametersIGF32kHz_LowBR;
    }
    ELSE
@@ -254,11 +120,7 @@ void InitTnsConfiguration_ivas_fx
        test();
        IF( GT_32( nSampleRate, 32000 ) && EQ_32( nSampleRate, L_mult0( 100, frameLength ) ) )
        {
#ifdef FIX_2388_INITTNSCONFIGURATION
            pTnsConfig->nMaxFilters = (UWord8) ( sizeof( tnsParameters48kHz_grouped ) / sizeof( tnsParameters48kHz_grouped[0] ) ); /*Q0*/
#else
            pTnsConfig->nMaxFilters = (UWord8) idiv1616( sizeof( tnsParameters48kHz_grouped ), sizeof( tnsParameters48kHz_grouped[0] ) );     /*Q0*/
#endif
            move16();
            pTnsConfig->pTnsParameters = tnsParameters48kHz_grouped;
        }
@@ -274,11 +136,7 @@ void InitTnsConfiguration_ivas_fx
            test();
            IF( GT_16( element_mode, IVAS_SCE ) && GE_32( total_brate, L_tmp ) )
            {
#ifdef FIX_2388_INITTNSCONFIGURATION
                pTnsConfig->nMaxFilters = (UWord8) ( sizeof( tnsParameters32kHz_Stereo ) / sizeof( tnsParameters32kHz_Stereo[0] ) ); /*Q0*/
#else
                pTnsConfig->nMaxFilters = (UWord8) idiv1616( sizeof( tnsParameters32kHz_Stereo ), sizeof( tnsParameters32kHz_Stereo[0] ) );   /*Q0*/
#endif
                move16();
                IF( EQ_32( nSampleRate, L_mult0( 100, frameLength ) ) ) /* sub-frame length is <= 10 ms */
                {
@@ -293,11 +151,7 @@ void InitTnsConfiguration_ivas_fx
            {

                move16();
#ifdef FIX_2388_INITTNSCONFIGURATION
                pTnsConfig->nMaxFilters = (UWord8) ( sizeof( tnsParameters32kHz ) / sizeof( tnsParameters32kHz[0] ) ); /*Q0*/
#else
                pTnsConfig->nMaxFilters = (UWord8) idiv1616( sizeof( tnsParameters32kHz ), sizeof( tnsParameters32kHz[0] ) );                 /*Q0*/
#endif

                pTnsConfig->pTnsParameters = tnsParameters32kHz;

@@ -312,21 +166,13 @@ void InitTnsConfiguration_ivas_fx
            IF( EQ_32( nSampleRate, L_mult0( 100, frameLength ) ) ) /* sub-frame length is <= 10 ms */
            {
                move16();
#ifdef FIX_2388_INITTNSCONFIGURATION
                pTnsConfig->nMaxFilters = (UWord8) ( sizeof( tnsParameters16kHz_grouped ) / sizeof( tnsParameters16kHz_grouped[0] ) ); /*Q0*/
#else
                pTnsConfig->nMaxFilters = (UWord8) idiv1616( sizeof( tnsParameters16kHz_grouped ), sizeof( tnsParameters16kHz_grouped[0] ) ); /*Q0*/
#endif
                pTnsConfig->pTnsParameters = tnsParameters16kHz_grouped;
            }
            ELSE
            {
                move16();
#ifdef FIX_2388_INITTNSCONFIGURATION
                pTnsConfig->nMaxFilters = (UWord8) ( sizeof( tnsParameters16kHz ) / sizeof( tnsParameters16kHz[0] ) ); /*Q0*/
#else
                pTnsConfig->nMaxFilters = (UWord8) idiv1616( sizeof( tnsParameters16kHz ), sizeof( tnsParameters16kHz[0] ) );                 /*Q0*/
#endif
                pTnsConfig->pTnsParameters = tnsParameters16kHz;
            }
        }
Loading