Commit 492192b1 authored by vaclav's avatar vaclav
Browse files

Merge branch '1087-asan-sba-dtx-bitrate-switching-decoding' into 'main'

[non-BE] Resolve "ASAN: SBA DTX bitrate switching decoding"

See merge request !1558
parents b62698e9 2cb5f2e7
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -177,6 +177,7 @@
#define NONBE_FIX_1070_USAN_SEGFAULT_MC_TO_BIN_BTSW_HEADROT   /* fix 1070 USAN: nullptr-with-offset and Segfaults in 7_1_4 to BINAURAL and BINAURAL_ROOM_REVERB decoding with bitrate switching and head rotation*/ 
#define NONBE_FIX_MC_LFE_LPF                            /* Dlb: Adding the LFE LPF filter back for MC content. */
#define NONBE_FIX_1052_SBA_EXT                          /* Dlb: SBA external output support */
#define NONBE_FIX_1087_OOB_SBA_DTX_RS                   /* VA: issue 1087: Extend the length of the buffer for MCT decoding to avoid out-of-bound writing in SBA SID bitrate switching decoding */

#define NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR            /* Nok: issue 1074 fixing number of objects signaling in OMASA low rate */
/* ##################### End NON-BE switches ########################### */
+26 −1
Original line number Diff line number Diff line
@@ -87,6 +87,9 @@ ivas_error ivas_mct_dec(
    STnsData tnsData[MCT_MAX_BLOCKS][CPE_CHANNELS][NB_DIV];
    Decoder_State **sts;
    float synth[CPE_CHANNELS][L_FRAME_PLUS];
#ifdef NONBE_FIX_1087_OOB_SBA_DTX_RS
    float *p_output_orig[2];
#endif
    float output_lfe_ch[L_FRAME48k];
    int32_t ivas_total_brate;
    ivas_error error;
@@ -148,6 +151,18 @@ ivas_error ivas_mct_dec(
    /* MCT side bits decoder */
    ivas_mct_side_bits( hMCT, st_ivas->hCPE, nCPE, st_ivas->hCPE[0]->hCoreCoder[0], st_ivas->bfi, st_ivas->hCPE[0]->hCoreCoder[0]->bit_stream, ivas_total_brate, nb_bits_metadata );

#ifdef NONBE_FIX_1087_OOB_SBA_DTX_RS
    /* in case of switching from an SID frame (with ACELP core) to MCT, buffer of L_FRAME_PLUS samples is needed -> use synth[] as a temporary buffer */
    if ( st_ivas->hCPE[0]->hCoreCoder[0]->last_core == ACELP_CORE )
    {
        for ( n = 0; n < CPE_CHANNELS; n++ )
        {
            p_output_orig[n] = output[n];
            output[n] = synth[n];
        }
    }
#endif

    for ( cpe_id = 0; cpe_id < nCPE; cpe_id++ )
    {
        st_ivas->hCPE[cpe_id]->hCoreCoder[0]->BER_detect |= st_ivas->BER_detect;
@@ -232,6 +247,17 @@ ivas_error ivas_mct_dec(

        ivas_mdct_core_reconstruct( hCPE, x, synth, fUseTns[cpe_id], 1 );

#ifdef NONBE_FIX_1087_OOB_SBA_DTX_RS
        /* set pointers back */
        if ( cpe_id == 0 && st_ivas->hCPE[0]->hCoreCoder[0]->last_core == ACELP_CORE )
        {
            for ( n = 0; n < CPE_CHANNELS; n++ )
            {
                output[n] = p_output_orig[n];
            }
        }

#endif
        /*----------------------------------------------------------------*
         * CoreCoder Post-processing and updates
         *----------------------------------------------------------------*/
@@ -263,7 +289,6 @@ ivas_error ivas_mct_dec(
#endif
        } /* n_channels loop */


        /* synthesis synchronization between stereo modes */
        if ( !st_ivas->sba_dirac_stereo_flag || ( st_ivas->ivas_format == SBA_ISM_FORMAT && cpe_id < nCPE - 2 ) )
        {