Commit 336b5b59 authored by Jan Kiene's avatar Jan Kiene
Browse files

Merge branch 'ivas-float-update' into ivas-float-update-cmplx

parents da4fb5a8 fbeb5ef8
Loading
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -201,6 +201,9 @@ ivas_error pre_proc_front_ivas(
    const IVAS_FORMAT ivas_format,                              /* i  : IVAS format                                */
    const int16_t MCT_flag, /* i  : hMCT handle allocated (1) or not (0)    */
    const int32_t ivas_total_brate                              /* i  : IVAS total bitrate                         */
#ifdef DEBUG_MODE_INFO
	, const int16_t ch_idx
#endif
);

ivas_error pre_proc_ivas(
+3 −1
Original line number Diff line number Diff line
@@ -170,7 +170,9 @@
#define NONBE_FIX_1205_TD_STEREO_MOD_CT                 /* VA: fix mismatch of coder_type (mod_ct) btw. TD stereo encoder and decoder */
#define NONBE_FIX_1213_SBA_DET_MAT_INV_3BY3             /*Dolby: issue 1213: fix for inverse of det < 0*/
#define NONBE_FIX_1204_MDCT_STEREO_NOISE_EST_SCALING    /* FhG: fixes for decoder-side noise level estimation in MDCT-Stereo to prevent noise bursts in stereo switching */
#define NONBE_1233_HQ_CLASSIFIER_DIV_BY_ZERO            /* Eri: issue 1233: Address possible division by zero in hf_spectrum_sparseness() */

#define NONE_BE_FIX_BASOP_1044_OSBA_PRERENDER_MIX_GAINS /* DLB: adjust prerendering and mixing gain in OSBA encoder. This is fix to float codes*/
/* #################### End FIXES switches ############################ */

#define BASOP_NOGLOB                                    /* Disable global symbols in BASOPs, Overflow/Carry in BASOPs disabled, additional BASOPs in case of Overflow */
+55 −0
Original line number Diff line number Diff line
@@ -573,6 +573,16 @@ static int16_t hf_spectrum_sparseness(
        inv_rms = 0.0f;
        crest_mod = 0.0f;
        maximum( A, L_SPEC_HB, &Amax );
#ifdef NONBE_1233_HQ_CLASSIFIER_DIV_BY_ZERO
        if ( Amax == 0 )
        {
            /* For all-zero input the crest is 1.0 */
            crest = 1.0f;
            crest_mod = 1.0f;
            low_count = 0;
        }
        else
        {
            thr = Amax * PEAK_THRESHOLD;
            movmean = 0.0f;                        /* avoid uninitialized warning */
            p_num = &inv_tbl[HALF_WIN_LENGTH + 1]; /* Table for division 1./(11:21) */
@@ -615,6 +625,51 @@ static int16_t hf_spectrum_sparseness(
            inv_rms = 1.0f / (float) sqrtf( inv_rms / L_SPEC_HB );
            crest = Amax * inv_rms;
            crest_mod = crest_mod * inv_rms;
        }
#else
        thr = Amax * PEAK_THRESHOLD;
        movmean = 0.0f;                        /* avoid uninitialized warning */
        p_num = &inv_tbl[HALF_WIN_LENGTH + 1]; /* Table for division 1./(11:21) */
        for ( i = 0; i < L_SPEC_HB; i++ )
        {
            inv_rms += A[i] * A[i];
            if ( A[i] < thr )
            {
                low_count += 1;
            }
            if ( i <= HALF_WIN_LENGTH )
            {
                if ( i == 0 )
                {
                    movmean = sum_f( &A[0], i + HALF_WIN_LENGTH + 1 ) * ( *p_num );
                }
                else
                {
                    p_num++;
                    movmean = movmean + ( A[i + HALF_WIN_LENGTH] - movmean ) * ( *p_num );
                }
            }
            else
            {
                if ( L_SPEC_HB <= i + HALF_WIN_LENGTH )
                {
                    p_num--;
                    movmean = movmean + ( movmean - A[i - HALF_WIN_LENGTH - 1] ) * ( *p_num );
                }
                else
                {
                    movmean = movmean + ( A[i + HALF_WIN_LENGTH] - A[i - HALF_WIN_LENGTH - 1] ) * ( *p_num );
                }
            }
            if ( crest_mod < movmean )
            {
                crest_mod = movmean;
            }
        }
        inv_rms = 1.0f / (float) sqrtf( inv_rms / L_SPEC_HB );
        crest = Amax * inv_rms;
        crest_mod = crest_mod * inv_rms;
#endif
        *crest_lp = HQ_CREST_FAC_SM * ( *crest_lp ) + ( 1.0f - HQ_CREST_FAC_SM ) * crest;
        *crest_mod_lp = HQ_CREST_FAC_SM * ( *crest_mod_lp ) + ( 1.0f - HQ_CREST_FAC_SM ) * crest_mod;

+18 −0
Original line number Diff line number Diff line
@@ -43,6 +43,9 @@
#include "ivas_prot.h"
#include "wmc_auto.h"
#include <math.h>
#ifdef DEBUG_MODE_INFO
#include "string.h"
#endif


/*---------------------------------------------------------------*
@@ -110,6 +113,10 @@ ivas_error pre_proc_front_ivas(
    const IVAS_FORMAT ivas_format,                             /* i  : IVAS format                              */
    const int16_t MCT_flag,                                    /* i  : hMCT handle allocated (1) or not (0)    */
    const int32_t ivas_total_brate                             /* i  : IVAS total bitrate - for setting the DTX */
#ifdef DEBUG_MODE_INFO
    ,
    const int16_t ch_idx
#endif
)
{
    float *inp_12k8, *new_inp_12k8;        /* pointers to current frame and new data       */
@@ -219,6 +226,17 @@ ivas_error pre_proc_front_ivas(
        }
    }

#ifdef DEBUG_MODE_INFO
    {
        int16_t tmp_dmx_in[L_FRAME48k];
        for ( int16_t isample = 0; isample < input_frame; isample++ )
        {
            tmp_dmx_in[isample] = (int16_t) signal_in[isample - NS2SA( st->input_Fs, ACELP_LOOK_NS )];
        }
        dbgwrite( tmp_dmx_in, sizeof( int16_t ), input_frame, 1, strcat( fname( debug_dir, "ivas_input_dmx", 0, ch_idx + 1, ENC ), ".pcm" ) );
    }
#endif

    lMemRecalc_12k8 = 0;
    lMemRecalc = 0;
    if ( element_mode == IVAS_CPE_TD || element_mode == IVAS_CPE_MDCT )
+21 −5
Original line number Diff line number Diff line
@@ -355,6 +355,21 @@ ivas_error ivas_cpe_enc(
        {
#ifdef DEBUGGING
            hCPE->hStereoMdct->mdct_stereo_mode_cmdl = hEncoderConfig->mdct_stereo_mode_cmdl;
#ifdef DEBUG_FORCE_MDCT_STEREO_MODE
            /*set all other members to defined states */
            hCPE->hStereoMdct->fDualMono = 0;
            hCPE->hStereoMdct->fMSstereo = 0;

            if (  hCPE->hStereoMdct->mdct_stereo_mode_cmdl == SMDCT_FORCE_LR )
            {
                hCPE->hStereoMdct->fDualMono = 1;
            }
             else if (  hCPE->hStereoMdct->mdct_stereo_mode_cmdl == SMDCT_FORCE_MS )
            {
                hCPE->hStereoMdct->fMSstereo = 1;
            }
#endif

#endif
            initMdctStereoEncData( hCPE->hStereoMdct, ivas_format, hCPE->element_mode, hCPE->element_brate, max_bwidth, 0, NULL, 0 );
            hCPE->hStereoMdct->isSBAStereoMode = ( ( ivas_format == SBA_FORMAT || ivas_format == SBA_ISM_FORMAT ) && ( st_ivas->nchan_transport == 2 ) );
@@ -458,10 +473,6 @@ ivas_error ivas_cpe_enc(
    }

#ifdef DEBUG_MODE_INFO
    for ( n = 0; n < n_CoreChannels; n++ )
    {
        dbgwrite( sts[0]->input - NS2SA( sts[0]->input_Fs, ACELP_LOOK_NS ), sizeof( float ), input_frame, 1, fname( debug_dir, "input_DMX", n, sts[n]->id_element, ENC ) );
    }
    dbgwrite( &hCPE->element_mode, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "element_mode", 0, sts[0]->id_element, ENC ) );
#endif

@@ -474,7 +485,12 @@ ivas_error ivas_cpe_enc(
        error = pre_proc_front_ivas( NULL, hCPE, hCPE->element_brate, nb_bits_metadata, input_frame, n, old_inp_12k8[n], old_inp_16k[n],
                                     &ener[n], &relE[n], A[n], Aw[n], epsP[n], lsp_new[n], lsp_mid[n], &vad_hover_flag[n], &attack_flag[n],
                                     realBuffer[n], imagBuffer[n], old_wsp[n], pitch_fr[n], voicing_fr[n], &loc_harm[n], &cor_map_sum[n], &vad_flag_dtx[n], enerBuffer[n],
                                     fft_buff[n], A[0], lsp_new[0], currFlatness[n], tdm_ratio_idx, fr_bands, Etot_LR, lf_E, localVAD_HE_SAD, band_energies_LR, 0, st_ivas->hSpar != NULL ? st_ivas->hSpar->front_vad_flag : 0, 0, 0, ivas_format, st_ivas->hMCT != NULL, ivas_total_brate );
                                     fft_buff[n], A[0], lsp_new[0], currFlatness[n], tdm_ratio_idx, fr_bands, Etot_LR, lf_E, localVAD_HE_SAD, band_energies_LR, 0, st_ivas->hSpar != NULL ? st_ivas->hSpar->front_vad_flag : 0, 0, 0, ivas_format, st_ivas->hMCT != NULL, ivas_total_brate
#ifdef DEBUG_MODE_INFO
                                     ,
                                     ( st_ivas->nSCE + ( cpe_id * CPE_CHANNELS ) + n )
#endif
        );
        if ( error != IVAS_ERR_OK )
        {
            return error;
Loading