Commit f918e677 authored by multrus's avatar multrus
Browse files

[cleanup] accept FIX_2455_HARMONIZE_generate_comfort_noise_enc

parent 8ae2c103
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -84,7 +84,6 @@
#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 HARM_HQ_CORE_KEEP_BE                            /* hack to keep all BE after HQ core functions harmonization; pending resolving issues #2450, #2451, #2452 */
#define FIX_2455_HARMONIZE_configureFdCngEnc            /* FhG: harmonize generate_comfort_noise_enc and generate_comfort_noise_enc_ivas */
#define FIX_2463_EVS_BWE_LSF                            /* VA: basop issue 2463: harmonize calling of Quant_BWE_LSF_fx() */
#define FIX_2452_HQ_CORE_PEAQ_AVR_RATIO_HARM            /* Eri: Basop issue 2453: Fix alignment of peak_avrg_ratio_fx */
#define FIX_2480_HARM_TONALMDCT                         /* FhG: basop issue 2480: Harmonize TonalMDCTConceal_Detect_fx() and TonalMDCTConceal_Detect_ivas_fx() */
+0 −7
Original line number Diff line number Diff line
@@ -9782,13 +9782,6 @@ void core_coder_mode_switch_ivas_fx(
    const Word16 MCT_flag          /* i  : hMCT handle allocated (1) or not (0)*/
);

#ifndef FIX_2455_HARMONIZE_configureFdCngEnc
void configureFdCngEnc_ivas_fx(
    HANDLE_FD_CNG_ENC hFdCngEnc, /* i/o: Contains the variables related to the FD-based CNG process */
    const Word16 bwidth,         /* Q0 */
    const Word32 total_brate     /* Q0 */
);
#endif

void SetModeIndex_ivas_fx(
    Encoder_State *st,              /* i  : Encoder state                          */
+0 −148
Original line number Diff line number Diff line
@@ -159,20 +159,12 @@ void initFdCngEnc_fx(
 * Configure FD_CNG                 *
 ************************************/

#ifdef FIX_2455_HARMONIZE_configureFdCngEnc
void configureFdCngEnc_fx(
    HANDLE_FD_CNG_ENC hsEnc,  /* i/o: Contains the variables related to the FD-based CNG process */
    const Word16 bandwidth,   /* i  : bandwidth    Q0 */
    const Word32 bitrate,     /* i  : bitrate Q0 */
    const Word16 element_mode /* i  : element mode Q0 */
)
#else
void configureFdCngEnc_fx(
    HANDLE_FD_CNG_ENC hsEnc, /* i/o: Contains the variables related to the FD-based CNG process */
    const Word16 bandwidth,  /* i  :   bandwidth    Q0*/
    const Word32 bitrate     /* Q0 */
)
#endif
{
    HANDLE_FD_CNG_COM hsCom = hsEnc->hFdCngCom;
    Word16 psizeDec[NPART];
@@ -274,28 +266,24 @@ void configureFdCngEnc_fx(
    SWITCH( hsCom->fftlen )
    {
        case 512:
#ifdef FIX_2455_HARMONIZE_configureFdCngEnc
            if ( GT_16( element_mode, EVS_MONO ) )
            {
                hsCom->fftSineTab_fx = NULL;
                hsCom->olapWinAna_fx = olapWinAna512_fx; /* Q30 */
                hsCom->olapWinSyn_fx = olapWinSyn256_fx; /* Q15 */
            }
#endif
            hsCom->fftlenShift = 8;
            move16();
            hsCom->fftlenFac = 32767 /*1.0 Q15*/;
            move16();
            BREAK;
        case 640:
#ifdef FIX_2455_HARMONIZE_configureFdCngEnc
            if ( GT_16( element_mode, EVS_MONO ) )
            {
                hsCom->fftSineTab_fx = fftSineTab640_fx; /* Q15 */
                hsCom->olapWinAna_fx = olapWinAna640_fx; /* Q30 */
                hsCom->olapWinSyn_fx = olapWinSyn320_fx; /* Q15 */
            }
#endif
            hsCom->fftlenShift = 9;
            move16();
            hsCom->fftlenFac = 20480 /*0.625 Q15*/;
@@ -313,142 +301,6 @@ void configureFdCngEnc_fx(
    return;
}

#ifndef FIX_2455_HARMONIZE_configureFdCngEnc
void configureFdCngEnc_ivas_fx(
    HANDLE_FD_CNG_ENC hFdCngEnc, /* i/o: Contains the variables related to the FD-based CNG process */
    const Word16 bwidth,         /* Q0 */
    const Word32 total_brate     /* Q0 */
)
{
    HANDLE_FD_CNG_COM hsCom = hFdCngEnc->hFdCngCom;
    Word16 psizeDec[NPART];
    Word16 psizeDec_norm[NPART];
    Word16 psizeDec_norm_exp;
    Word16 psize_invDec[NPART];

    set16_fx( psizeDec, 0, NPART );

    hsCom->CngBandwidth = bwidth; /* Q0 */
    move16();
    IF( EQ_16( hsCom->CngBandwidth, FB ) )
    {
        hsCom->CngBandwidth = SWB;
        move16();
    }
    hsCom->CngBitrate = total_brate; /* Q0 */
    move32();

    /* NB configuration */
    IF( EQ_16( bwidth, NB ) )
    {
        hsCom->FdCngSetup = FdCngSetup_nb; /* PTR assignation -> no move needed*/
    }

    /* WB configuration */
    ELSE IF( EQ_16( bwidth, WB ) )
    {
        /* FFT 6.4kHz, no CLDFB */
        IF( LE_32( total_brate, ACELP_8k00 ) )
        {
            hsCom->FdCngSetup = FdCngSetup_wb1;
        }
        /* FFT 6.4kHz, CLDFB 8.0kHz */
        ELSE IF( LE_32( total_brate, ACELP_13k20 ) )
        {
            hsCom->FdCngSetup = FdCngSetup_wb2;
        }
        /* FFT 8.0kHz, no CLDFB */
        ELSE
        {
            hsCom->FdCngSetup = FdCngSetup_wb3;
        }
    }

    /* SWB/FB configuration */
    ELSE
    {
        /* FFT 6.4kHz, CLDFB 14kHz */
        IF( LE_32( total_brate, ACELP_13k20 ) )
        {
            hsCom->FdCngSetup = FdCngSetup_swb1;
        }
        /* FFT 8.0kHz, CLDFB 16kHz */
        ELSE
        {
            hsCom->FdCngSetup = FdCngSetup_swb2;
        }
    }
    hsCom->fftlen = hsCom->FdCngSetup.fftlen; /* Q0 */
    move16();
    hFdCngEnc->stopFFTbinDec = hsCom->FdCngSetup.stopFFTbin; /* Q0 */
    move16();

    /* Configure the SID quantizer and the Confort Noise Generator */

    hFdCngEnc->startBandDec = hsCom->startBand; /* Q0 */
    move16();
    hFdCngEnc->stopBandDec = add( hsCom->FdCngSetup.sidPartitions[hsCom->FdCngSetup.numPartitions - 1], 1 ); /* Q0 */
    move16();
    initPartitions( hsCom->FdCngSetup.sidPartitions,
                    hsCom->FdCngSetup.numPartitions,
                    hFdCngEnc->startBandDec,
                    hFdCngEnc->stopBandDec,
                    hFdCngEnc->partDec,
                    &hFdCngEnc->npartDec,
                    hFdCngEnc->midbandDec,
                    psizeDec,
                    psizeDec_norm,
                    &psizeDec_norm_exp,
                    psize_invDec,
                    0 );
    IF( EQ_16( hFdCngEnc->stopFFTbinDec, 160 ) )
    {
        hFdCngEnc->nFFTpartDec = 17;
        move16();
    }
    ELSE IF( EQ_16( hFdCngEnc->stopFFTbinDec, 256 ) )
    {
        hFdCngEnc->nFFTpartDec = 20;
        move16();
    }
    ELSE
    {
        hFdCngEnc->nFFTpartDec = 21;
        move16();
    }

    SWITCH( hsCom->fftlen )
    {
        case 512:
            hsCom->fftSineTab_fx = NULL;
            hsCom->olapWinAna_fx = olapWinAna512_fx; /* Q30 */
            hsCom->olapWinSyn_fx = olapWinSyn256_fx; /* Q15 */
            hsCom->fftlenShift = 8;
            move16();
            hsCom->fftlenFac = 32767 /*1.0 Q15*/;
            move16();
            BREAK;
        case 640:
            hsCom->fftSineTab_fx = fftSineTab640_fx; /* Q15 */
            hsCom->olapWinAna_fx = olapWinAna640_fx; /* Q30 */
            hsCom->olapWinSyn_fx = olapWinSyn320_fx; /* Q15 */
            hsCom->fftlenShift = 9;
            move16();
            hsCom->fftlenFac = 20480 /*0.625 Q15*/;
            move16();
            BREAK;
        default:
            assert( !"Unsupported FFT length for FD-based CNG" );
            BREAK;
    }
    BASOP_getTables( &hsCom->olapWinAna, NULL, NULL, shr( hsCom->fftlen, 1 ) );
    BASOP_getTables( &hsCom->olapWinSyn, NULL, NULL, shr( hsCom->fftlen, 2 ) );
    hsCom->frameSize = shr( hsCom->fftlen, 1 );
    move16();

    return;
}
#endif /*FIX_2455_HARMONIZE_configureFdCngEnc*/

/**************************************
 * Delete the instance of type FD_CNG *
+0 −4
Original line number Diff line number Diff line
@@ -1177,11 +1177,7 @@ ivas_error init_encoder_fx(
                total_brate = st->total_brate;
                move32();
            }
#ifdef FIX_2455_HARMONIZE_configureFdCngEnc
            configureFdCngEnc_fx( st->hFdCngEnc, st->bwidth, total_brate, st->element_mode );
#else
            configureFdCngEnc_fx( st->hFdCngEnc, st->bwidth, total_brate );
#endif
        }
    }
    ELSE
+0 −11
Original line number Diff line number Diff line
@@ -567,7 +567,6 @@ ivas_error ivas_core_enc_fx(
                test();
                IF( ( NE_16( st->hFdCngEnc->hFdCngCom->frameSize, st->L_frame ) ) || ( NE_16( st->hFdCngEnc->hFdCngCom->CngBandwidth, st->bwidth ) ) )
                {
#ifdef FIX_2455_HARMONIZE_configureFdCngEnc
                    IF( EQ_16( st->L_frame, L_FRAME16k ) )
                    {
                        configureFdCngEnc_fx( st->hFdCngEnc, s_max( st->bwidth, WB ), ACELP_16k40, st->element_mode );
@@ -576,16 +575,6 @@ ivas_error ivas_core_enc_fx(
                    {
                        configureFdCngEnc_fx( st->hFdCngEnc, s_max( st->bwidth, WB ), ACELP_9k60, st->element_mode );
                    }
#else
                    IF( EQ_16( st->L_frame, L_FRAME16k ) )
                    {
                        configureFdCngEnc_ivas_fx( st->hFdCngEnc, s_max( st->bwidth, WB ), ACELP_16k40 );
                    }
                    ELSE
                    {
                        configureFdCngEnc_ivas_fx( st->hFdCngEnc, s_max( st->bwidth, WB ), ACELP_9k60 );
                    }
#endif
                }
            }

Loading