Commit 9d74986d authored by multrus's avatar multrus
Browse files

[cleanup] accept FIX_TODO_FD_CNG_SBA_CLEANUP

parent 6d9e75ba
Loading
Loading
Loading
Loading
+0 −1
Original line number Original line Diff line number Diff line
@@ -152,7 +152,6 @@
#endif
#endif




#define FIX_TODO_FD_CNG_SBA_CLEANUP                     /* FhG: BE, address TODO comment in fd_cng_enc */
#define ENHANCED_STEREO_DMX                             /* Orange : Contribution 48 - Enhanced stereo downmix. */
#define ENHANCED_STEREO_DMX                             /* Orange : Contribution 48 - Enhanced stereo downmix. */


#define BINAURAL_AUDIO_CMDLINE                          /* issue 491: Implement Commandline-Option for Binaural Audio */
#define BINAURAL_AUDIO_CMDLINE                          /* issue 491: Implement Commandline-Option for Binaural Audio */
+0 −24
Original line number Original line Diff line number Diff line
@@ -1277,21 +1277,15 @@ void FdCngEncodeDiracMDCTStereoSID(
        lr_out_ptr[ch] = &sts[ch]->hFdCngEnc->hFdCngCom->sidNoiseEst[0];
        lr_out_ptr[ch] = &sts[ch]->hFdCngEnc->hFdCngCom->sidNoiseEst[0];
    }
    }
    set_f( weights, 1.f, NPART );
    set_f( weights, 1.f, NPART );
#ifdef FIX_TODO_FD_CNG_SBA_CLEANUP
#ifdef DEBUGGING
#ifdef DEBUGGING
    assert( N[0] == N[1] );
    assert( N[0] == N[1] );
#endif
#endif
#endif


    /* apply log and save energy of original left and right channels */
    /* apply log and save energy of original left and right channels */
    for ( ch = 0; ch < CPE_CHANNELS; ch++ )
    for ( ch = 0; ch < CPE_CHANNELS; ch++ )
    {
    {
        E[ch] = 0.0f;
        E[ch] = 0.0f;
#ifdef FIX_TODO_FD_CNG_SBA_CLEANUP
        for ( p = 0; p < N[ch]; p++ )
        for ( p = 0; p < N[ch]; p++ )
#else
        for ( p = 0; p < NPART; p++ )
#endif
        {
        {
            ms_ptr[ch][p] = 10.f * log10f( lr_in_ptr[ch][p] + EPSILON );
            ms_ptr[ch][p] = 10.f * log10f( lr_in_ptr[ch][p] + EPSILON );
            E[ch] += ms_ptr[ch][p];
            E[ch] += ms_ptr[ch][p];
@@ -1299,15 +1293,9 @@ void FdCngEncodeDiracMDCTStereoSID(
    }
    }


    /* M/S transform on log envelopes */
    /* M/S transform on log envelopes */
#ifdef FIX_TODO_FD_CNG_SBA_CLEANUP
    convertToMS( N[0], ms_ptr[0], ms_ptr[1], 0.5f );
    convertToMS( N[0], ms_ptr[0], ms_ptr[1], 0.5f );


    E[0] = sum_f( ms_ptr[0], N[0] );
    E[0] = sum_f( ms_ptr[0], N[0] );
#else
    convertToMS( NPART, ms_ptr[0], ms_ptr[1], 0.5f );

    E[0] = sum_f( ms_ptr[0], NPART );
#endif


    /* Quantize M noise shape */
    /* Quantize M noise shape */
    /* Normalize MSVQ input */
    /* Normalize MSVQ input */
@@ -1342,11 +1330,7 @@ void FdCngEncodeDiracMDCTStereoSID(
    set_zero( ms_ptr[1], NPART );
    set_zero( ms_ptr[1], NPART );


    /* compute M gain */
    /* compute M gain */
#ifdef FIX_TODO_FD_CNG_SBA_CLEANUP
    gain[0] = sum_f( ms_ptr[0], N[0] );
    gain[0] = sum_f( ms_ptr[0], N[0] );
#else
    gain[0] = sum_f( ms_ptr[0], NPART );
#endif
    gain[0] = ( E[0] - gain[0] ) / (float) N[0];
    gain[0] = ( E[0] - gain[0] ) / (float) N[0];
    apply_scale( &gain[0], sts[0]->hFdCngEnc->hFdCngCom->CngBandwidth, sts[0]->hDtxEnc->last_active_brate, scaleTableStereo, SIZE_SCALE_TABLE_STEREO );
    apply_scale( &gain[0], sts[0]->hFdCngEnc->hFdCngCom->CngBandwidth, sts[0]->hDtxEnc->last_active_brate, scaleTableStereo, SIZE_SCALE_TABLE_STEREO );


@@ -1358,11 +1342,7 @@ void FdCngEncodeDiracMDCTStereoSID(
    gain[1] = gain[0];
    gain[1] = gain[0];


    /* undo M/S */
    /* undo M/S */
#ifdef FIX_TODO_FD_CNG_SBA_CLEANUP
    convertToMS( NPART, ms_ptr[0], ms_ptr[1], 1.0f );
    convertToMS( NPART, ms_ptr[0], ms_ptr[1], 1.0f );
#else
    convertToMS( N[0], ms_ptr[0], ms_ptr[1], 1.0f );
#endif


    /* restore channel noise envelopes */
    /* restore channel noise envelopes */
    for ( ch = 0; ch < CPE_CHANNELS; ch++ )
    for ( ch = 0; ch < CPE_CHANNELS; ch++ )
@@ -1370,11 +1350,7 @@ void FdCngEncodeDiracMDCTStereoSID(
        HANDLE_FD_CNG_ENC hFdCngEnc = sts[ch]->hFdCngEnc;
        HANDLE_FD_CNG_ENC hFdCngEnc = sts[ch]->hFdCngEnc;
        HANDLE_FD_CNG_COM hFdCngCom = hFdCngEnc->hFdCngCom;
        HANDLE_FD_CNG_COM hFdCngCom = hFdCngEnc->hFdCngCom;


#ifdef FIX_TODO_FD_CNG_SBA_CLEANUP
        for ( p = 0; p < N[0]; p++ )
        for ( p = 0; p < N[0]; p++ )
#else
        for ( p = 0; p < NPART; p++ )
#endif
        {
        {
            lr_out_ptr[ch][p] = powf( 10.f, ( ms_ptr[ch][p] + gain[ch] ) / 10.f );
            lr_out_ptr[ch][p] = powf( 10.f, ( ms_ptr[ch][p] + gain[ch] ) / 10.f );
        }
        }