Commit 0ef4ad3e authored by TYAGIRIS's avatar TYAGIRIS
Browse files

Merge branch 'main' into fix_1996_masking_noise

parents 52d85464 df97ba07
Loading
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -81,6 +81,8 @@ variables:
  RUNNER_TAG: "ivas-basop-linux"
  LOGS_BACKUP_SOURCE_DIR: ""
  LOGS_BACKUP_TARGET_DIR: ""
  # set this to true to skip the external HRTF testcases in pytest calls
  DISABLE_HRTF: "false"
  MANUAL_PIPELINE_TYPE:
    description: "Type for the manual pipeline run. Use 'pytest-compare' to run comparison test against reference float codec."
    value: 'default'
+17 −0
Original line number Diff line number Diff line
@@ -1789,7 +1789,22 @@ static ivas_error initOnFirstGoodFrame(
            if ( numInitialBadFrames > 0 )
            {
                /* Duplicate good first frame metadata to fill the beginning of stream. */
#ifdef NONBE_FIX_1261_MASA_EXT_META_JBM
                int16_t fullDelayNumSamplesLocal[3];
                int32_t delayTimeScaleLocal;
                float delayMs;
                IVAS_MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta;
                hMasaExtOutMeta = NULL;

                /* fullDelayNumSamples is zeroed so need to re-fetch delay info */
                if ( ( error = IVAS_DEC_GetDelay( hIvasDec, fullDelayNumSamplesLocal, &delayTimeScaleLocal ) ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "\nUnable to get delay of decoder: %s\n", ivas_error_to_string( error ) );
                }
                delayMs = (float) ( fullDelayNumSamplesLocal[0] ) / (float) ( delayTimeScaleLocal );
#else
                IVAS_MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta = NULL;
#endif

                if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta, 0 ) ) != IVAS_ERR_OK )
                {
@@ -1799,7 +1814,9 @@ static ivas_error initOnFirstGoodFrame(

                for ( int16_t j = 0; j < numInitialBadFrames; ++j )
                {
#ifndef NONBE_FIX_1261_MASA_EXT_META_JBM
                    float delayMs = (float) ( pFullDelayNumSamples[0] ) / (float) ( *delayTimeScale );
#endif
                    if ( ( error = MasaFileWriter_writeFrame( *ppMasaWriter, hMasaExtOutMeta, &delayMs ) ) != IVAS_ERR_OK )
                    {
                        fprintf( stderr, "\nError writing MASA metadata to file: %s\n", MasaFileWriter_getFilePath( *ppMasaWriter ) );
+3 −0
Original line number Diff line number Diff line
@@ -101,6 +101,9 @@
#define FIX_1319_STACK_SBA_DECODER                      /* VA: issue 1319: Optimize the definition of buffer lengths in the SBA decoder */
#define FIX_1320_STACK_CPE_DECODER                      /* VA: issue 1320: Optimize the stack memory consumption in the CPE decoder */
#define FIX_1984_SAT_IN_PSYCHAD                         /* VA: Issue 1984: proposal to fix an assert */
#define NONBE_FIX_1261_MASA_EXT_META_JBM                /* Nokia: issue #1261: MASA metadata EXT output delay buffer init in JBM */
#define NONBE_FIX_1143_MASA_BRSW                        /* Nok: Fix for issue 1143: MSAN use of uninitialized value in masa decoding to binaural with dtx bitrate switching and 5 % FER */
#define NONBE_FIX_1220_OMASA_JBM_EXT_USAN               /* Nokia: fix issue 1220 OMASA EXT JBM USAN, also fix similar cases of free to avoid future problems */

/* #################### End BASOP porting switches ############################ */

+28 −0
Original line number Diff line number Diff line
@@ -1693,7 +1693,13 @@ ivas_error ivas_masa_dec_reconfigure_fx(
    move32();

    test();
#ifdef NONBE_FIX_1220_OMASA_JBM_EXT_USAN
    test();
    /* Copy state to TC buffer if granularity matches and we are not in OMASA EXT rendering mode */
    IF( st_ivas->hSpatParamRendCom != NULL && EQ_16( st_ivas->hSpatParamRendCom->slot_size, st_ivas->hTcBuffer->n_samples_granularity ) && NE_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) )
#else
    IF( st_ivas->hSpatParamRendCom != NULL && EQ_16( st_ivas->hSpatParamRendCom->slot_size, st_ivas->hTcBuffer->n_samples_granularity ) )
#endif
    {
        Copy( st_ivas->hSpatParamRendCom->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS );
        st_ivas->hTcBuffer->nb_subframes = st_ivas->hSpatParamRendCom->nb_subframes;
@@ -1713,6 +1719,9 @@ ivas_error ivas_masa_dec_reconfigure_fx(
    test();
    test();
    test();
#ifdef NONBE_FIX_1220_OMASA_JBM_EXT_USAN
    test();
#endif
    IF( ( EQ_32( st_ivas->renderer_type, RENDERER_DIRAC ) && st_ivas->hDirACRend == NULL ) ||
        ( ( EQ_32( st_ivas->renderer_type, RENDERER_STEREO_PARAMETRIC ) || EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) && st_ivas->hDiracDecBin[0] == NULL ) )
    {
@@ -1722,6 +1731,16 @@ ivas_error ivas_masa_dec_reconfigure_fx(
            return error;
        }
    }
#ifdef NONBE_FIX_1220_OMASA_JBM_EXT_USAN
    ELSE IF( EQ_32( st_ivas->renderer_type, RENDERER_DISABLE ) || EQ_32( st_ivas->renderer_type, RENDERER_MONO_DOWNMIX ) || EQ_32( st_ivas->renderer_type, RENDERER_OMASA_MIX_EXT ) )
    {
        /* close all unnecessary parametric decoding and rendering */
        ivas_dirac_dec_close_binaural_data( st_ivas->hDiracDecBin );
        ivas_dirac_rend_close_fx( &( st_ivas->hDirACRend ) );
        ivas_spat_hSpatParamRendCom_close_fx( &( st_ivas->hSpatParamRendCom ) );
        ivas_dirac_dec_close_fx( &( st_ivas->hDirAC ) );
    }
#else
    ELSE IF( EQ_32( st_ivas->renderer_type, RENDERER_DISABLE ) || EQ_32( st_ivas->renderer_type, RENDERER_MONO_DOWNMIX ) )
    {
        IF( st_ivas->hDirAC != NULL )
@@ -1733,6 +1752,7 @@ ivas_error ivas_masa_dec_reconfigure_fx(
            ivas_dirac_dec_close_fx( &( st_ivas->hDirAC ) );
        }
    }
#endif
    /* possible reconfigure is done later */

    /*-----------------------------------------------------------------*
@@ -1823,8 +1843,16 @@ ivas_error ivas_masa_dec_reconfigure_fx(
        test();
        test();
        test();
#ifdef NONBE_FIX_1143_MASA_BRSW
        test();
        test();
        IF( ( LT_32( ivas_total_brate, MASA_STEREO_MIN_BITRATE ) && GE_32( last_ivas_total_brate, MASA_STEREO_MIN_BITRATE ) ) ||
            ( LT_32( ivas_total_brate, MASA_STEREO_MIN_BITRATE ) && EQ_32( last_ivas_total_brate, FRAME_NO_DATA ) ) ||
            ( LT_32( ivas_total_brate, MASA_STEREO_MIN_BITRATE ) && EQ_32( last_ivas_total_brate, IVAS_SID_5k2 ) ) )
#else
        IF( ( LT_32( ivas_total_brate, MASA_STEREO_MIN_BITRATE ) && GE_32( last_ivas_total_brate, MASA_STEREO_MIN_BITRATE ) ) ||
            ( LT_32( ivas_total_brate, MASA_STEREO_MIN_BITRATE ) && EQ_32( last_ivas_total_brate, FRAME_NO_DATA ) ) )
#endif
        {
            st_ivas->hCPE[cpe_id]->nchan_out = 1;
            move16();
+14 −0
Original line number Diff line number Diff line
@@ -1044,13 +1044,17 @@ static ivas_error ivas_mc_dec_reconfig_fx(
            ivas_masa_dec_close_fx( &( st_ivas->hMasa ) );

            ivas_qmetadata_close_fx( &st_ivas->hQMetaData );
#ifndef NONBE_FIX_1220_OMASA_JBM_EXT_USAN
            IF( st_ivas->hDirAC != NULL )
            {
#endif
                ivas_dirac_rend_close_fx( &( st_ivas->hDirACRend ) );
                ivas_spat_hSpatParamRendCom_close_fx( &( st_ivas->hSpatParamRendCom ) );
                ivas_dirac_dec_close_fx( &( st_ivas->hDirAC ) );
                vbap_free_data_fx( &( st_ivas->hVBAPdata ) );
#ifndef NONBE_FIX_1220_OMASA_JBM_EXT_USAN
            }
#endif

            /* init LS conversion if the renderer type asks for it */
            test();
@@ -1130,13 +1134,17 @@ static ivas_error ivas_mc_dec_reconfig_fx(
        ivas_masa_dec_close_fx( &( st_ivas->hMasa ) );
        ivas_qmetadata_close_fx( &st_ivas->hQMetaData );

#ifndef NONBE_FIX_1220_OMASA_JBM_EXT_USAN
        IF( st_ivas->hDirAC != NULL )
        {
#endif
            ivas_dirac_rend_close_fx( &( st_ivas->hDirACRend ) );
            ivas_spat_hSpatParamRendCom_close_fx( &( st_ivas->hSpatParamRendCom ) );
            ivas_dirac_dec_close_fx( &( st_ivas->hDirAC ) );
            vbap_free_data_fx( &( st_ivas->hVBAPdata ) );
#ifndef NONBE_FIX_1220_OMASA_JBM_EXT_USAN
        }
#endif

        IF( EQ_16( last_mc_mode, MC_MODE_MCT ) )
        {
@@ -1337,7 +1345,9 @@ static ivas_error ivas_mc_dec_reconfig_fx(
    IF( EQ_16( st_ivas->mc_mode, MC_MODE_MCMASA ) )
    {
        test();
#ifndef NONBE_FIX_1220_OMASA_JBM_EXT_USAN
        test();
#endif
        IF( ( NE_16( st_ivas->renderer_type, RENDERER_DISABLE ) ) && ( NE_16( st_ivas->renderer_type, RENDERER_MCMASA_MONO_STEREO ) ) )
        {
            IF( st_ivas->hDirAC != NULL )
@@ -1357,7 +1367,11 @@ static ivas_error ivas_mc_dec_reconfig_fx(
                }
            }
        }
#ifdef NONBE_FIX_1220_OMASA_JBM_EXT_USAN
        ELSE IF( EQ_16( st_ivas->renderer_type, RENDERER_DISABLE ) )
#else
        ELSE IF( EQ_16( st_ivas->renderer_type, RENDERER_DISABLE ) && st_ivas->hDirAC != NULL )
#endif
        {
            ivas_dirac_rend_close_fx( &( st_ivas->hDirACRend ) );
            ivas_spat_hSpatParamRendCom_close_fx( &( st_ivas->hSpatParamRendCom ) );