Commit 7be1b682 authored by fotopoulou's avatar fotopoulou
Browse files

Merge branch 'main' into 752-osba-mct-misconfiguration-causes-crashes-at-256kbps

parents 186ced20 1a7ad7a6
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
@@ -145,8 +145,8 @@
#define BASOP_NOGLOB                                    /* Disable global symbols in BASOPs, Overflow/Carry in BASOPs disabled, additional BASOPs in case of Overflow */


/* ################# Start BE DEVELOPMENT switches ######################## */
/* only BE switches wrt operation points tested in selection */
/* ################### Start BE switches ################################# */
/* only BE switches wrt selection floating point code */

/*#define FIX_I4_OL_PITCH*/                             /* fix open-loop pitch used for EVS core switching */

@@ -158,18 +158,19 @@
#define OSBA_SPLIT_RENDERING
#endif

/* #################### End BE switches ################################## */


/* ################## End BE DEVELOPMENT switches ######################### */

/* #################### Start NON-BE CR switches ########################## */
/* any switch which is non-be wrt operation points tested in selection */
/* all switches in this category should start with "CR_" */
/* #################### Start NON-BE switches ############################ */
/* any switch which is non-be wrt selection floating point code */
/* all switches in this category should start with "NONBE_" */

#define NONBE_FIX_736_FOA_BR_SWITCH                           /* FhG/Dlb : Issue 736: FOA bitrate switching decoding crashes in in ivas_spar_to_dirac */
#define NONBE_FIX_746_NONDIEGETIC_MD                          /* Eri: Issue 746: The non-diegetic panning flag affects the encoder bitstream even if extended metadata is not enabled. Crashes the decoder.*/


#define CR_FIX_752_OSBA_MISCONFIG_MCT                    /* FhG: issue 752: misconfiguration of MCT causes crashes for coding with sampling rate under 48kHz at 256kbps*/
/* ##################### End NON-BE CR switches ########################### */
/* ##################### End NON-BE switches ############################# */

/* ################## End DEVELOPMENT switches ######################### */

+50 −5
Original line number Diff line number Diff line
@@ -183,7 +183,11 @@ ivas_error ivas_sba_dec_reconfigure(

    if ( hSpar != NULL )
    {
#ifdef NONBE_FIX_736_FOA_BR_SWITCH
        if ( ( hSpar->hPCA != NULL ) && ( ( hDecoderConfig->ivas_total_brate != PCA_BRATE ) || ( st_ivas->sba_order != 1 ) ) )
#else
        if ( ( hSpar->hPCA != NULL ) && ( ( hDecoderConfig->ivas_total_brate != PCA_BRATE ) || ( sba_order_internal != 1 ) ) )
#endif
        {
            free( st_ivas->hSpar->hPCA );
            hSpar->hPCA = NULL;
@@ -214,6 +218,18 @@ ivas_error ivas_sba_dec_reconfigure(
                return error;
            }
        }
#ifdef NONBE_FIX_736_FOA_BR_SWITCH
        if ( ( hSpar->hPCA == NULL ) &&
             ( st_ivas->hDecoderConfig->ivas_total_brate == PCA_BRATE && st_ivas->sba_order == 1 ) && ( st_ivas->ivas_format == SBA_FORMAT ) )
        {
            if ( ( hSpar->hPCA = (PCA_DEC_STATE *) malloc( sizeof( PCA_DEC_STATE ) ) ) == NULL )
            {
                return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for PCA decoder" );
            }

            ivas_pca_dec_init( hSpar->hPCA );
        }
#endif
        ivas_spar_config( ivas_total_brate, sba_order_internal, &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &hSpar->core_nominal_brate, st_ivas->sid_format );
    }
    else
@@ -273,8 +289,17 @@ ivas_error ivas_sba_dec_reconfigure(
    {
        ivas_binRenderer_close( &st_ivas->hBinRenderer );
    }

#ifdef NONBE_FIX_736_FOA_BR_SWITCH
    if ( ( error = ivas_dirac_sba_config( st_ivas->hQMetaData, &st_ivas->element_mode_init, ivas_total_brate, st_ivas->sba_analysis_order, ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order ) ? IVAS_MAX_NUM_BANDS : ( IVAS_MAX_NUM_BANDS - SPAR_DIRAC_SPLIT_START_BAND ) ) ) != IVAS_ERR_OK )
    {
        return error;
    }
#endif
#ifndef NONBE_FIX_736_FOA_BR_SWITCH
    if ( ( ( st_ivas->renderer_type != RENDERER_DISABLE ) && ( st_ivas->renderer_type != RENDERER_SBA_LINEAR_DEC ) ) || ( ( hDecoderConfig->output_config != AUDIO_CONFIG_FOA ) && ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_STEREO ) && ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_MONO ) ) || ( last_ivas_total_brate > IVAS_256k && ivas_total_brate <= IVAS_256k ) || ( last_ivas_total_brate <= IVAS_256k && ivas_total_brate > IVAS_256k ) )
#else
    if ( ( ( st_ivas->renderer_type != RENDERER_DISABLE ) && ( st_ivas->renderer_type != RENDERER_SBA_LINEAR_DEC ) ) || ( ( hDecoderConfig->output_config != AUDIO_CONFIG_FOA ) && ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_STEREO ) && ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_MONO ) ) )
#endif
    {
        DIRAC_CONFIG_FLAG flag_config;

@@ -299,12 +324,32 @@ ivas_error ivas_sba_dec_reconfigure(
            mvs2s( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hSpatParamRendCom->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS );
        }
    }

#ifdef NONBE_FIX_736_FOA_BR_SWITCH
    else
    {
#endif
#ifndef NONBE_FIX_736_FOA_BR_SWITCH
        if ( ( error = ivas_dirac_sba_config( st_ivas->hQMetaData, &st_ivas->element_mode_init, ivas_total_brate, st_ivas->sba_analysis_order, ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order ) ? IVAS_MAX_NUM_BANDS : ( IVAS_MAX_NUM_BANDS - SPAR_DIRAC_SPLIT_START_BAND ) ) ) != IVAS_ERR_OK )
        {
            return error;
        }
#endif
#ifdef NONBE_FIX_736_FOA_BR_SWITCH
        int16_t band_grouping[IVAS_MAX_NUM_BANDS + 1];

        st_ivas->hSpar->enc_param_start_band = min( IVAS_MAX_NUM_BANDS, SPAR_DIRAC_SPLIT_START_BAND );
        if ( ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order ) )
        {
            st_ivas->hSpar->enc_param_start_band = 0;

            set_c( (int8_t *) st_ivas->hQMetaData->twoDirBands, (int8_t) 1, st_ivas->hQMetaData->q_direction[0].cfg.nbands );
            st_ivas->hQMetaData->numTwoDirBands = (uint8_t) st_ivas->hQMetaData->q_direction[0].cfg.nbands;
        }

        ivas_dirac_config_bands( band_grouping, IVAS_MAX_NUM_BANDS, (int16_t) ( st_ivas->hDecoderConfig->output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ),
                                 st_ivas->hSpar->dirac_to_spar_md_bands, st_ivas->hQMetaData->useLowerBandRes, st_ivas->hSpar->enc_param_start_band, 0 );
    }
#endif
    if ( st_ivas->renderer_type == RENDERER_DISABLE )
    {
        ivas_dirac_rend_close( &( st_ivas->hDirACRend ) );
+4 −0
Original line number Diff line number Diff line
@@ -415,7 +415,11 @@ ivas_error ivas_ism_metadata_enc(
                    push_indice( hBstr, IND_ISM_NDP_FLAG, hIsmMeta[ch]->non_diegetic_flag, ISM_METADATA_IS_NDP_BITS );
                }

#ifdef NONBE_FIX_746_NONDIEGETIC_MD
                if ( hIsmMeta[ch]->non_diegetic_flag && ism_extended_metadata_flag )
#else
                if ( hIsmMeta[ch]->non_diegetic_flag )
#endif
                {
                    /* Map azimuth to panning range [-90:90] */
                    if ( hIsmMetaData->azimuth > 90.0f )
+2 −2
Original line number Diff line number Diff line
@@ -4752,7 +4752,7 @@ ivas_error IVAS_REND_FeedInputAudio(
         ( inputAudio.config.numSamplesPerChannel * 1000 / cldfb2tdSampleFact ) != ( BINAURAL_RENDERING_FRAME_SIZE_MS * hIvasRend->num_subframes ) * hIvasRend->sampleRateOut )
#else
    if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL &&
         inputAudio.config.numSamplesPerChannel * 1000 != BINAURAL_RENDERING_FRAME_SIZE_MS * hIvasRend->sampleRateOut )
         inputAudio.config.numSamplesPerChannel * 1000 != ( BINAURAL_RENDERING_FRAME_SIZE_MS * hIvasRend->num_subframes ) * hIvasRend->sampleRateOut )
#endif
    {
        return IVAS_ERROR( IVAS_ERR_INVALID_BUFFER_SIZE, "Binaural rendering requires specific frame size" );
@@ -8707,7 +8707,7 @@ static ivas_error getSamplesInternal(
         ( outAudio.config.numSamplesPerChannel * 1000 / cldfb2tdSampleFact ) != ( hIvasRend->num_subframes * BINAURAL_RENDERING_FRAME_SIZE_MS ) * hIvasRend->sampleRateOut )
#else
    if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL &&
         outAudio.config.numSamplesPerChannel * 1000 != BINAURAL_RENDERING_FRAME_SIZE_MS * hIvasRend->sampleRateOut )
         outAudio.config.numSamplesPerChannel * 1000 != ( hIvasRend->num_subframes * BINAURAL_RENDERING_FRAME_SIZE_MS ) * hIvasRend->sampleRateOut )
#endif
    {
        return IVAS_ERROR( IVAS_ERR_INVALID_BUFFER_SIZE, "Binaural rendering requires specific frame size" );
+0 −1608

File deleted.

Preview size limit exceeded, changes collapsed.

Loading