Commit 45ee94db authored by multrus's avatar multrus
Browse files

[cleanup] accept HARMONIZE_2499_CONFIGUREFDCNGDEC

parent e06d098a
Loading
Loading
Loading
Loading
+0 −10
Original line number Diff line number Diff line
@@ -1624,16 +1624,6 @@ void ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot_fx(
    const Word16 nchan_in                                                           /* i  : number of input channels                              */
);

#ifndef HARMONIZE_2499_CONFIGUREFDCNGDEC
void configureFdCngDec_ivas_fx(
    HANDLE_FD_CNG_DEC hFdCngDec,                                /* i/o: Contains the variables related to the FD-based CNG process */
    const Word16 bwidth,
    const Word32 total_brate,
    const Word16 L_frame,
    const Word16 last_L_frame,
    const Word16 element_mode 
);
#endif

void synchonize_channels_mdct_sid_fx(
    Decoder_State *sts[CPE_CHANNELS],                           /* i/o: decoder state structure                 */
+0 −1
Original line number Diff line number Diff line
@@ -92,7 +92,6 @@
#define NONBE_FIX_ISSUE_2206_AVOID_OVERFLOW_MSVQ_Interpol_Tran_fx /* FhG: Fix saturation crash in MSVQ_Interpol_Tran_fx() */
#define NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT_FIX_2527    /* Fix crash from issue #2527 */
#define FIX_FLOAT_1539_G192_FORMAT_SWITCH               /* VA/Nokia: reintroduce format switching for g192 bitstreams */
#define HARMONIZE_2499_CONFIGUREFDCNGDEC                /* FhG: basop issue 2499: harmonoize configureFdCngDec */
#define FIX_BASOP_2530_IVAS_DECISION_MAT                /* VA: Fix ambiguous usage of extract_l() */
#define SIMPLIFY_CORE_ENC                               /* VA: basop issue 2430: Simplify ivas_core_enc_fx() */
#define FIX_2402_SIMPLIFY_ARI_CODEC                     /* FhG: basop issue 2402: simplified arithmetic in TCX arithmetic coder */
+0 −20
Original line number Diff line number Diff line
@@ -6483,16 +6483,6 @@ void initFdCngDec_fx(
void deleteFdCngDec_fx(
    HANDLE_FD_CNG_DEC *hFdCngDec );

#ifndef HARMONIZE_2499_CONFIGUREFDCNGDEC
/* Configure CLDFB-CNG */
void configureFdCngDec_fx(
    HANDLE_FD_CNG_DEC hFdCngDec, /* i/o: Contains the variables related to the CLDFB-based CNG process */
    Word16 bandwidth,
    Word32 bitrate,
    Word16 L_frame,
    const Word16 Last_L_frame,
    const Word16 element_mode );
#else
void configureFdCngDec_fx(
    HANDLE_FD_CNG_DEC hFdCngDec, /* i/o: Contains the variables related to the FD-based CNG process */
    const Word16 bwidth,
@@ -6500,7 +6490,6 @@ void configureFdCngDec_fx(
    const Word16 L_frame,
    const Word16 last_L_frame,
    const Word16 element_mode );
#endif

Word16 ApplyFdCng_fx(
    Word16 *timeDomainInput, /* i  : pointer to time domain input */
@@ -8477,15 +8466,6 @@ void v_mult16_fx(
    const Word16 N     /* i  : Vector length                                    */
);

#ifndef HARMONIZE_2499_CONFIGUREFDCNGDEC
void configureFdCngDec_fx(
    HANDLE_FD_CNG_DEC hFdCngDec, /* i/o: Contains the variables related to the FD-based CNG process */
    const Word16 bwidth,
    const Word32 total_brate,
    const Word16 L_frame,
    const Word16 last_L_frame,
    const Word16 element_mode );
#endif

Word32 sum2_f_16_fx(
    const Word16 *vec, /* i  : input vector                          */
+0 −4
Original line number Diff line number Diff line
@@ -1928,11 +1928,7 @@ ivas_error core_switching_pre_dec_fx(
            }
            ELSE
            {
#ifdef HARMONIZE_2499_CONFIGUREFDCNGDEC
                configureFdCngDec_fx( st->hFdCngDec, st->bwidth, st->total_brate, st->L_frame, st->last_L_frame, st->element_mode );
#else
                configureFdCngDec_ivas_fx( st->hFdCngDec, st->bwidth, st->total_brate, st->L_frame, st->last_L_frame, st->element_mode );
#endif
            }
        }
        ELSE
+0 −235
Original line number Diff line number Diff line
@@ -199,233 +199,6 @@ void initFdCngDec_fx(
    return;
}

#ifndef HARMONIZE_2499_CONFIGUREFDCNGDEC
/*
   configureFdCngDec_fx

    Parameters:

    hs                      i/o: Contains the variables related to the FD-based CNG process
    numSlots                i  : Number of time slots in CLDFB matrix
    numCoreBands            i  : Number of core bands
    regularStopBand         i  : Number of CLDFB bands to be considered
    CLDFBscale                i  : cldfb scale factor

    Function:
    configure FD_CNG

    Returns:
    void
*/
void configureFdCngDec_fx(
    HANDLE_FD_CNG_DEC hFdCngDec, /* i/o: Contains the variables related to the CLDFB-based CNG process */
    Word16 bwidth,               /*Q0*/
    Word32 total_brate,          /*Q0*/
    Word16 L_frame,              /*Q0*/
    const Word16 Last_L_frame,   /*Q0*/
    const Word16 element_mode /*Q0*/ )
{
    Word16 j, stopBandFR;
    HANDLE_FD_CNG_COM hsCom = hFdCngDec->hFdCngCom;


    hsCom->CngBandwidth = bwidth; /*Q0*/
    move16();
    if ( EQ_16( hsCom->CngBandwidth, FB ) )
    {
        hsCom->CngBandwidth = SWB;
        move16();
    }
    test();
    IF( total_brate != FRAME_NO_DATA && NE_32( total_brate, SID_2k40 ) )
    {
        hsCom->CngBitrate = total_brate; /*Q0*/
        move32();
    }
    ELSE IF( EQ_32( hsCom->CngBitrate, -1 ) )
    {
        /* set minimum active CBR bitrate if CngBitrate is uninitialized */
        hsCom->CngBitrate = ACELP_7k20;
        move32();
        if ( element_mode > EVS_MONO )
        {
            hsCom->CngBitrate = IVAS_13k2;
            move32();
        }
    }

    /* FD-CNG config for MDCT-Stereo is always the same (since for > 48 kbps only) */
    /* This may need adjustment in the future if 2TC DTX for some mode uses MDCT-Stereo DTX for lower bitrates too */
    if ( EQ_16( element_mode, IVAS_CPE_MDCT ) )
    {
        hsCom->CngBitrate = IVAS_48k;
        move32();
    }

    hsCom->numSlots = 16;
    move16();

    /* NB configuration */
    IF( bwidth == NB )
    {
        hsCom->FdCngSetup = FdCngSetup_nb;
        hsCom->numCoreBands = 16;
        move16();
        hsCom->regularStopBand = 16;
        move16();
    }

    /* WB configuration */
    ELSE IF( EQ_16( bwidth, WB ) )
    {
        /* FFT 6.4kHz, no CLDFB */
        test();
        test();
        IF( LE_32( hsCom->CngBitrate, ACELP_8k00 ) && EQ_16( L_frame, L_FRAME ) )
        {
            hsCom->FdCngSetup = FdCngSetup_wb1;
            hsCom->numCoreBands = 16;
            move16();
            hsCom->regularStopBand = 16;
            move16();
        }
        /* FFT 6.4kHz, CLDFB 8.0kHz */
        ELSE IF( LE_32( hsCom->CngBitrate, ACELP_13k20 ) || EQ_16( L_frame, L_FRAME ) )
        {
            hsCom->FdCngSetup = FdCngSetup_wb2;
            hsCom->numCoreBands = 16;
            move16();
            hsCom->regularStopBand = 20;
            move16();
            IF(
                EQ_16( L_frame, L_FRAME16k ) )
            {
                hsCom->FdCngSetup = FdCngSetup_wb2;
                hsCom->numCoreBands = 20;
                move16();
                hsCom->regularStopBand = 20;
                move16();
                hsCom->FdCngSetup.fftlen = 640;
                move16();
                hsCom->FdCngSetup.stopFFTbin = 256;
                move16();
            }
        }
        /* FFT 8.0kHz, no CLDFB */
        ELSE
        {
            hsCom->FdCngSetup = FdCngSetup_wb3;
            hsCom->numCoreBands = 20;
            move16();
            hsCom->regularStopBand = 20;
            move16();
        }
    }

    /* SWB/FB configuration */
    ELSE
    {
        /* FFT 6.4kHz, CLDFB 14kHz */
        IF(
            EQ_16( L_frame, L_FRAME ) )
        {
            hsCom->FdCngSetup = FdCngSetup_swb1;
            hsCom->numCoreBands = 16;
            move16();
            hsCom->regularStopBand = 35;
            move16();
        }
        /* FFT 8.0kHz, CLDFB 16kHz */
        ELSE
        {
            hsCom->FdCngSetup = FdCngSetup_swb2;
            hsCom->numCoreBands = 20;
            move16();
            hsCom->regularStopBand = 40;
            move16();
            test();
            if ( EQ_16( Last_L_frame, L_FRAME ) && EQ_16( element_mode, IVAS_CPE_DFT ) )
            {
                hsCom->regularStopBand = 35;
                move16();
            }
        }
    }
    hsCom->fftlen = hsCom->FdCngSetup.fftlen; /*Q0*/
    move16();
    hsCom->stopFFTbin = hsCom->FdCngSetup.stopFFTbin; /*Q0*/
    move16();

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

    hsCom->startBand = 2;
    move16();
    hsCom->stopBand = add( hsCom->FdCngSetup.sidPartitions[( hsCom->FdCngSetup.numPartitions - 1 )], 1 ); /*Q0*/
    move16();
    initPartitions( hsCom->FdCngSetup.sidPartitions, hsCom->FdCngSetup.numPartitions, hsCom->startBand, hsCom->stopBand, hsCom->part,
                    &hsCom->npart, hsCom->midband, hsCom->psize, hsCom->psize_norm, &hsCom->psize_norm_exp, hsCom->psize_inv, 0 );

    hsCom->nFFTpart = 21;
    move16();
    if ( EQ_16( hsCom->stopFFTbin, 256 ) )
    {
        hsCom->nFFTpart = 20;
        move16();
    }
    if ( EQ_16( hsCom->stopFFTbin, 160 ) )
    {
        hsCom->nFFTpart = 17;
        move16();
    }

    hsCom->nCLDFBpart = sub( hsCom->npart, hsCom->nFFTpart );
    move16();
    FOR( j = 0; j < hsCom->nCLDFBpart; j++ )
    {
        hsCom->CLDFBpart[j] = sub( hsCom->part[( j + hsCom->nFFTpart )], sub( hsCom->stopFFTbin, hsCom->startBand ) ); /*Q0*/
        move16();
        hsCom->CLDFBpsize_inv[j] = hsCom->psize_inv[( j + hsCom->nFFTpart )]; /*Q15*/
        move16();
    }

    stopBandFR = 1000 / 25;
    move16();
    if ( GT_16( stopBandFR, hsCom->stopFFTbin ) )
    {
        stopBandFR = hsCom->stopFFTbin; /*Q0*/
        move16();
    }
    initPartitions( hsCom->FdCngSetup.shapingPartitions, hsCom->FdCngSetup.numShapingPartitions,
                    hsCom->startBand, hsCom->stopFFTbin, hFdCngDec->part_shaping, &hFdCngDec->npart_shaping, hFdCngDec->midband_shaping,
                    hFdCngDec->psize_shaping, hFdCngDec->psize_shaping_norm, &hFdCngDec->psize_shaping_norm_exp, hFdCngDec->psize_inv_shaping,
                    stopBandFR );
    hFdCngDec->nFFTpart_shaping = hFdCngDec->npart_shaping; /*Q0*/
    move16();

    SWITCH( hsCom->fftlen )
    {
        case 512:
            hsCom->fftlenShift = 8;
            move16();
            hsCom->fftlenFac = 32767 /*1.0 Q15*/;
            move16();
            BREAK;
        case 640:
            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();
}
#endif


/*
@@ -4141,11 +3914,7 @@ void generate_masking_noise_mdct_ivas_fx(
 *
 * Initialize an instance of type FD_CNG
 *-------------------------------------------------------------------*/
#ifdef HARMONIZE_2499_CONFIGUREFDCNGDEC
void configureFdCngDec_fx(
#else
void configureFdCngDec_ivas_fx(
#endif
    HANDLE_FD_CNG_DEC hFdCngDec, /* i/o: Contains the variables related to the FD-based CNG process */
    const Word16 bwidth,         /*Q0*/
    const Word32 total_brate,    /*Q0*/
@@ -4352,28 +4121,24 @@ void configureFdCngDec_ivas_fx(
    SWITCH( hsCom->fftlen )
    {
        case 512:
#ifdef HARMONIZE_2499_CONFIGUREFDCNGDEC
            IF( GT_16( element_mode, EVS_MONO ) )
            {
                hsCom->olapWinAna_fx = olapWinAna512_fx; /*Q30*/
                hsCom->fftSineTab_fx = NULL;
                hsCom->olapWinSyn_fx = olapWinSyn256_fx; /*Q15*/
            }
#endif
            hsCom->fftlenShift = 8;
            move16();
            hsCom->fftlenFac = 32767 /*1.0 Q15*/;
            move16();
            BREAK;
        case 640:
#ifdef HARMONIZE_2499_CONFIGUREFDCNGDEC
            IF( GT_16( element_mode, EVS_MONO ) )
            {
                hsCom->olapWinAna_fx = olapWinAna640_fx; /*Q30*/
                hsCom->fftSineTab_fx = fftSineTab640_fx; /*Q15*/
                hsCom->olapWinSyn_fx = olapWinSyn320_fx; /*Q15*/
            }
#endif
            hsCom->fftlenShift = 9;
            move16();
            hsCom->fftlenFac = 20480 /*0.625 Q15*/;
Loading