Commit c2f6c6bd authored by sbsarac's avatar sbsarac
Browse files

Merge branch 'main' into 1053-reverb-reconfiguration-runtime-test

parents c2e56cbf 492192b1
Loading
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -166,7 +166,7 @@
#define FIX_1082_INSTRUM_FAILED_LC3PLUS                 /* VoiceAge: issue 1082: fix ambiguous syntax in LC3Plus code leading to fails of instrumented builds */
#define FIX_1052_EXT_OUTPUT                             /* VA: issue 1052: define EXT decoder output configuration for stereo and MC formats */ 


#define FIX_1068_ASAN_IN_MC_2_BINAURAL_ROOM_IR          /* issue 1068 : Memory leak in MC to BINAURAL_ROOM decoding with bitrate switching*/
/* #################### End BE switches ################################## */

/* #################### Start NON-BE switches ############################ */
@@ -177,7 +177,9 @@
#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 ########################### */

/* ################## End DEVELOPMENT switches ######################### */
+18 −0
Original line number Diff line number Diff line
@@ -399,12 +399,30 @@ ivas_error ivas_dec_setup(

            if ( st_ivas->nchan_ism > 0 )
            {
#ifdef NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR
                /* the input_ivas_format should be MASA_ISM_FORMAT, but we cannot initialize it now */
                /* info about the number of objects:
                          '00' - MASA format at the encoder
                          '01' - MASA_ISM_FORMAT at the encoder, with 4 objects
                          '10' - MASA_ISM_FORMAT at the encoder, with 3 objects
                          '11' - MASA_ISM_FORMAT at the encoder, with 1 or 2 objects
                          reading if 1 or 2 objects is performed later
                */
                st_ivas->nchan_ism = 5 - st_ivas->nchan_ism;
                if ( st_ivas->nchan_transport == 1 && st_ivas->nchan_ism == 2 )
                {
                    st_ivas->nchan_ism = 1;
                }
                /* for MASA_ISM_FORMAT at input the number of MASA transport channels is always 2 and the corresponding bit is not used here*/
#else
                /* the input_ivas_format should be MASA_ISM_FORMAT, but we cannot initialize it now */
                if ( st_ivas->nchan_transport == 2 && st_ivas->nchan_ism == 3 )
                {
                    st_ivas->nchan_ism = 4;
                }

                /* for MASA_ISM_FORMAT at input the number of MASA transport channels is always 2 */
#endif
                st_ivas->nchan_transport = 2;
                element_mode_flag = 1;
            }
+126 −76
Original line number Diff line number Diff line
@@ -151,6 +151,52 @@ ivas_error ivas_masa_decode(
    {
        if ( !( ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) )
        {
#ifdef NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR
            if ( ivas_format == MASA_FORMAT )
            {
                /* re-read the number of objects, needed in case of bad frame  */
                st_ivas->nchan_ism = 5 - ( st_ivas->bit_stream[( ivas_total_brate / FRAMES_PER_SEC ) - 3] + 2 * st_ivas->bit_stream[( ivas_total_brate / FRAMES_PER_SEC ) - 2] );
            }
            if ( ivas_format == MASA_FORMAT && st_ivas->nchan_ism != 5 )
            {
                /* there was OMASA in the input */
                hMasa->config.input_ivas_format = MASA_ISM_FORMAT;
                if ( st_ivas->nchan_ism < 3 )
                {
                    /* was read in ivas_init_dec() to distinguish between 1 and 2 objects */
                    if ( st_ivas->bit_stream[( ivas_total_brate / FRAMES_PER_SEC ) - 1] == 0 )
                    {
                        st_ivas->nchan_ism = 1;
                    }
                    st->next_bit_pos -= MASA_TRANSP_BITS;
                    *nb_bits_read += MASA_TRANSP_BITS;

                    /* the two reserved bits were already read in ivas_init_dec()*/
                    byteBuffer = st->bit_stream[( st->next_bit_pos )--];
                    byteBuffer = st->bit_stream[( st->next_bit_pos )--];
                    *nb_bits_read += MASA_HEADER_BITS;
                    /* read number of directions */
                    byteBuffer = st->bit_stream[( st->next_bit_pos )--];
                    ( *nb_bits_read )++;
                    hMasa->config.numberOfDirections = (uint8_t) ( byteBuffer + 1 );
                }
                else
                {
                    /* if there are 3 or 4 objects the number of transport channels bit is given to MASA format
                    and used to read number of directions*/
                    byteBuffer = st->bit_stream[( st->next_bit_pos )--];
                    ( *nb_bits_read )++;
                    hMasa->config.numberOfDirections = (uint8_t) ( byteBuffer + 1 );

                    /* the two reserved bits were already read in ivas_init_dec()*/
                    byteBuffer = st->bit_stream[( st->next_bit_pos )--];
                    byteBuffer = st->bit_stream[( st->next_bit_pos )--];
                    *nb_bits_read += MASA_HEADER_BITS;
                }
            }
            else
            {
#endif
                if ( ivas_format != MASA_ISM_FORMAT )
                {
                    /* number of transport channels is always 2 for MASA_ISM format */
@@ -249,13 +295,14 @@ ivas_error ivas_masa_decode(
                    }
                }

#ifndef NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR
                /* read 2 bits:
                          '00' - MASA format at the encoder
                          '01' - MASA_ISM_FORMAT at the encoder, with 1 object
                          '10' - MASA_ISM_FORMAT at the encoder, with 2 objects
                          '11' - MASA_ISM_FORMAT at the encoder, with 3 or 4 objects
                          reading if 3 or 4 object is performed later
                          '11' - MASA_ISM_FORMAT at the encoder, with 3 or 4 objects; reading if 3 or 4 object is performed later
                */
#endif
                byteBuffer = st->bit_stream[( st->next_bit_pos )--];
                byteBuffer = byteBuffer + 2 * st->bit_stream[( st->next_bit_pos )--];

@@ -273,6 +320,9 @@ ivas_error ivas_masa_decode(
                byteBuffer = st->bit_stream[( st->next_bit_pos )--];
                ( *nb_bits_read )++;
                hMasa->config.numberOfDirections = (uint8_t) ( byteBuffer + 1 );
#ifdef NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR
            }
#endif
        }
        else
        {
+32 −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 ) )
        {
@@ -1230,6 +1255,12 @@ static ivas_error ivas_mc_dec_reconfig(
            if ( st_ivas->hBinRenderer != NULL && ( st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV && st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV_ROOM ) )
            {
                ivas_binRenderer_close( &st_ivas->hBinRenderer );
#ifdef FIX_1068_ASAN_IN_MC_2_BINAURAL_ROOM_IR
                if ( ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation ) )
                {
                    efap_free_data( &st_ivas->hEFAPdata );
                }
#endif
            }

#ifdef SPLIT_REND_WITH_HEAD_ROT
+34 −4
Original line number Diff line number Diff line
@@ -420,6 +420,18 @@ ivas_error ivas_masa_encode(
        {
            if ( ivas_format == MASA_ISM_FORMAT && ism_mode == ISM_MODE_NONE )
            {
#ifdef NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR
                /* use the MASA number of transport channels bit to signal if there are 1 or 2 objects */
                if ( nchan_ism == 1 || nchan_ism == 2 )
                {
                    push_next_indice( hMetaData, nchan_ism - 1, MASA_TRANSP_BITS );
                }
                else
                {
                    /* for 3 or 4 objects write already the number of MASA directions */
                    push_next_indice( hMetaData, hQMetaData->no_directions - 1, MASA_TRANSP_BITS );
                }
#else
                /* use the MASA number of transport channels bit to signal if there are 3 or 4 objects */
                if ( nchan_ism == 4 )
                {
@@ -429,6 +441,7 @@ ivas_error ivas_masa_encode(
                {
                    push_next_indice( hMetaData, 0, MASA_TRANSP_BITS );
                }
#endif
            }
            else
            {
@@ -440,6 +453,16 @@ ivas_error ivas_masa_encode(

        if ( ivas_format == MASA_ISM_FORMAT && ism_mode == ISM_MODE_NONE )
        {
#ifdef NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR
            if ( nchan_ism >= 3 ) /* if 3 or 4 objects */
            {
                push_next_indice( hMetaData, 5 - nchan_ism, MASA_HEADER_BITS );
            }
            else
            {
                push_next_indice( hMetaData, 3, MASA_HEADER_BITS );
            }
#else
            if ( nchan_ism <= 3 )
            {
                push_next_indice( hMetaData, nchan_ism, MASA_HEADER_BITS );
@@ -448,6 +471,7 @@ ivas_error ivas_masa_encode(
            {
                push_next_indice( hMetaData, nchan_ism - 1, MASA_HEADER_BITS );
            }
#endif
            hQMetaData->metadata_max_bits -= MASA_HEADER_BITS;
        }
        else
@@ -457,10 +481,16 @@ ivas_error ivas_masa_encode(
            push_next_indice( hMetaData, 0, MASA_HEADER_BITS );
            hQMetaData->metadata_max_bits -= MASA_HEADER_BITS;
        }
#ifdef NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR
        if ( !( ivas_format == MASA_ISM_FORMAT && ism_mode == ISM_MODE_NONE && nchan_ism > 2 ) )
        {
#endif
            /* write number of directions */
            push_next_indice( hMetaData, hQMetaData->no_directions - 1, 1 );
            hQMetaData->metadata_max_bits -= 1;

#ifdef NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR
        }
#endif
        /* write subframe mode */
        push_next_indice( hMetaData, hQMetaData->q_direction[0].cfg.nblocks == 1 ? 1 : 0, MASA_SUBFRAME_BITS );
        hQMetaData->metadata_max_bits -= MASA_SUBFRAME_BITS;
Loading