Commit 298b323a authored by emerit's avatar emerit
Browse files

Merge branch 'main' into 744_step2_tables_and_bin_update_nonBE

parents 39c38eaa 8b7e5309
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -176,6 +176,8 @@
#define NONBE_FIX_878_RS_FEC_STEREO_CNG                       /* Eri: Frame loss and Unified Stereo CNG may cause false BER detection which results in corrupt bitstream decoding */
#define NONBE_FIX_904_JBM_SBA_RS_FOA                          /* FhG: issue #904: fix JBM SBA RS to FOA decoding */
#define NONBE_FIX_898_ISM_BRATE_CRASH                         /* VA: issue 898: fix decoder crash in ISM bitrate switching with DTX and binaural output */
#define NONBE_FIX_862_UBSAN_SPAR_DEC_BR_SW_PLC                /* DLB: issue 862 : UBSAN: out-of-bound error in SPAR for OSBA bitrate switching with PLC*/
#define NONBE_FIX_DISCRETE_ISM_NOISE_SEED_HANDLING            /* FhG: fix handling of common and differing noise seeds in SCEs for ISM DTX */

/* ##################### End NON-BE switches ########################### */

+12 −0
Original line number Diff line number Diff line
@@ -1104,10 +1104,17 @@ void generate_comfort_noise_dec(
    c2 = (float) sqrt( 1 - hFdCngCom->coherence );

    seed2 = &( hFdCngCom->seed2 );
#ifdef NONBE_FIX_DISCRETE_ISM_NOISE_SEED_HANDLING
    if ( st->element_mode == IVAS_CPE_MDCT && st->idchan == 1 )
    {
        seed2 = &( hFdCngCom->seed3 );
    }
#else
    if ( ( st->element_mode == IVAS_CPE_MDCT && st->idchan == 1 ) || ( st->element_mode == IVAS_SCE && st->cng_ism_flag ) )
    {
        seed2 = &( hFdCngCom->seed3 );
    }
#endif

    /* Generate Gaussian random noise in real and imaginary parts of the FFT bins
      Amplitudes are adjusted to the estimated noise level cngNoiseLevel in each bin */
@@ -1354,11 +1361,16 @@ void generate_comfort_noise_dec_hf(
    float scale = CLDFB_SCALING / hFdCngCom->scalingFactor;

    int16_t *seed2 = &( hFdCngCom->seed );

    float tmp1, tmp2, c1 = 0.f, c2 = 0.f;

    if ( cng_coh_flag )
    {
#ifdef NONBE_FIX_DISCRETE_ISM_NOISE_SEED_HANDLING
        seed2 = &( hFdCngCom->seed2 );
#else
        seed2 = &( hFdCngCom->seed3 );
#endif

        c1 = (float) sqrt( hFdCngCom->coherence );
        c2 = (float) sqrt( 1 - hFdCngCom->coherence );
+15 −0
Original line number Diff line number Diff line
@@ -64,6 +64,10 @@ ivas_error ivas_corecoder_dec_reconfig(
    MC_MODE last_mc_mode;
    DECODER_CONFIG_HANDLE hDecoderConfig;
    ivas_error error;
#ifdef NONBE_FIX_862_UBSAN_SPAR_DEC_BR_SW_PLC
    int16_t prev_bfi;
    Decoder_State *st0;
#endif

    /*-----------------------------------------------------------------*
     * Initialization
@@ -141,6 +145,10 @@ ivas_error ivas_corecoder_dec_reconfig(
    }
    else
    {
#ifdef NONBE_FIX_862_UBSAN_SPAR_DEC_BR_SW_PLC
        st0 = ( nSCE_old > 0 ) ? st_ivas->hSCE[0]->hCoreCoder[0] : st_ivas->hCPE[0]->hCoreCoder[0];
        prev_bfi = st0->prev_bfi;
#endif
        nSCE_existing = min( nSCE_old, st_ivas->nSCE );
        nCPE_existing = min( nCPE_old, st_ivas->nCPE );

@@ -213,6 +221,9 @@ ivas_error ivas_corecoder_dec_reconfig(
            {
                return error;
            }
#ifdef NONBE_FIX_862_UBSAN_SPAR_DEC_BR_SW_PLC
            st_ivas->hSCE[sce_id]->hCoreCoder[0]->prev_bfi = prev_bfi;
#endif
        }
        if ( st_ivas->sba_dirac_stereo_flag && sba_dirac_stereo_flag_old && st_ivas->nchan_transport == 1 && nSCE_old == 0 )
        {
@@ -241,6 +252,10 @@ ivas_error ivas_corecoder_dec_reconfig(
            {
                return error;
            }
#ifdef NONBE_FIX_862_UBSAN_SPAR_DEC_BR_SW_PLC
            st_ivas->hCPE[cpe_id]->hCoreCoder[0]->prev_bfi = prev_bfi;
            st_ivas->hCPE[cpe_id]->hCoreCoder[1]->prev_bfi = prev_bfi;
#endif
        }

        if ( st_ivas->nCPE > 1 && nCPE_old <= 1 )
+14 −7
Original line number Diff line number Diff line
@@ -937,13 +937,6 @@ int16_t getNumChanSynthesis(
    if ( st_ivas->sba_dirac_stereo_flag )
    {
        n = CPE_CHANNELS;
#if 0 
        /* TODO wkr: this is actually a correct bugfix for OSBA, it is disabled for now to pass the pipelines in the OSBA JBM branch */
        if ( st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->ism_mode == ISM_SBA_MODE_DISC )
        {
            n += st_ivas->nchan_ism;
        }
#endif
    }
    else if ( ( st_ivas->hMCT != NULL || st_ivas->ivas_format == SBA_FORMAT ) && st_ivas->ivas_format != SBA_ISM_FORMAT )
    {
@@ -1368,10 +1361,24 @@ ivas_error ivas_init_decoder(

        st_ivas->hISMDTX.sce_id_dtx = 0;

#ifdef NONBE_FIX_DISCRETE_ISM_NOISE_SEED_HANDLING
        if ( st_ivas->ism_mode == ISM_MODE_PARAM )
        {
            st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->seed2 = st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->seed3;
        }
        else if ( st_ivas->ism_mode == ISM_MODE_DISC )
        {
            for ( sce_id = 0; sce_id < st_ivas->nSCE; ++sce_id )
            {
                st_ivas->hSCE[sce_id]->hCoreCoder[0]->hFdCngDec->hFdCngCom->seed2 = 2 + sce_id;
            }
        }
#else
        if ( st_ivas->ism_mode == ISM_MODE_PARAM )
        {
            st_ivas->hSCE[1]->hCoreCoder[0]->hFdCngDec->hFdCngCom->seed3 = st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->seed2;
        }
#endif
    }
    else if ( st_ivas->ivas_format == SBA_FORMAT )
    {
+11 −0
Original line number Diff line number Diff line
@@ -154,6 +154,17 @@ ivas_error ivas_ism_dtx_dec(
        }
    }

#ifdef NONBE_FIX_DISCRETE_ISM_NOISE_SEED_HANDLING
    /* synch common seed between SCEs */
    if ( st_ivas->ism_mode == ISM_MODE_DISC )
    {
        for ( ch = 0; ch < nchan_ism; ++ch )
        {
            st_ivas->hSCE[ch]->hCoreCoder[0]->hFdCngDec->hFdCngCom->seed = st_ivas->hSCE[st_ivas->hISMDTX.sce_id_dtx]->hCoreCoder[0]->hFdCngDec->hFdCngCom->seed;
        }
    }
#endif

    update_last_metadata( nchan_ism, st_ivas->hIsmMetaData, md_diff_flag );

    st_ivas->hISMDTX.ism_dtx_hangover_cnt = 0;
Loading