Commit d57af493 authored by vaclav's avatar vaclav
Browse files
parents df375cee 84b13448
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2764,7 +2764,7 @@ static CmdlnArgs parseCmdlnArgs(
#ifdef FIX_1135_EXT_RENDERER_HANDLES
    if ( args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
    {
        args.Opt_Headrotation = TRUE;
        args.Opt_Headrotation = 1;
    }
#endif

+3 −1
Original line number Diff line number Diff line
@@ -174,6 +174,7 @@
#define FIX_1129_EXT_REND_OUTPUT_HIGH                   /* Philips: issue 1129: External renderer BINAURAL_ROOM_REVERB format output level too high compared to internal rendering output */
#define FIX_1152_UNINIT_VAL_IN_ITD_VAD_COMPUTATION      /* FhG: fix uninitialized value being used in ITD VAD mid signal computation that does not affect synthesis, but crashes BASOPs */
#define FIX_1157_OBSOLETE_DMX_TABLE                     /* FhG: remove obsolte ParamMC DMX table ivas_param_mc_dmx_fac_CICP19_4tc[] */
#define FIX_1135_EXT_RENDERER_HANDLES                   /* VA: issue 1135: Memory usage reduction in external renderer: Allocate only handles that are really needed. */

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

@@ -183,6 +184,7 @@

#define NONBE_FIX_1141_OSBA_ROOM_RENDERING                    /* FhG: Fix for issue 1141: render objects in OSBA decoder with room effect */
#define NONBE_FIX_981_PARAMBIN_DEFAULT_EARLY_PART             /* Nokia: Set default early part energy correction to unity for BINAURAL_ROOM_REVERB */
#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 NONE_BE_FIX_816_LFE_PLC_FLOAT                   /* DLB: issue 816: reduce required precision to float for LFE-PLC*/
+6 −1
Original line number Diff line number Diff line
@@ -1393,11 +1393,16 @@ ivas_error ivas_masa_dec_reconfigure(
        sts = st_ivas->hCPE[cpe_id]->hCoreCoder;
        sts[0]->bit_stream = bit_stream + num_bits;
        num_bits += (int16_t) ( st_ivas->hCPE[cpe_id]->element_brate / FRAMES_PER_SEC );
#ifdef NONBE_FIX_1143_MASA_BRSW
        if ( ( ivas_total_brate < MASA_STEREO_MIN_BITRATE && last_ivas_total_brate >= MASA_STEREO_MIN_BITRATE ) ||
             ( ivas_total_brate < MASA_STEREO_MIN_BITRATE && last_ivas_total_brate == FRAME_NO_DATA ) ||
             ( ivas_total_brate < MASA_STEREO_MIN_BITRATE && last_ivas_total_brate == IVAS_SID_5k2 ) )
#else
        if ( ( ivas_total_brate < MASA_STEREO_MIN_BITRATE && last_ivas_total_brate >= MASA_STEREO_MIN_BITRATE ) ||
             ( ivas_total_brate < MASA_STEREO_MIN_BITRATE && last_ivas_total_brate == FRAME_NO_DATA ) )
#endif
        {
            st_ivas->hCPE[cpe_id]->nchan_out = 1;

            if ( ( st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirACRend != NULL ) || ( ( st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) && st_ivas->hDiracDecBin[0] != NULL ) )
            {
                if ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_RECONFIGURE ) ) != IVAS_ERR_OK )
+109 −17
Original line number Diff line number Diff line
@@ -1113,7 +1113,11 @@ static ivas_error initHeadRotation(
static void closeHeadRotation(
    IVAS_REND_HANDLE hIvasRend )
{
#ifdef FIX_1135_EXT_RENDERER_HANDLES
    if ( hIvasRend != NULL && hIvasRend->headRotData.headRotEnabled && hIvasRend->headRotData.hOrientationTracker != NULL )
#else
    if ( ( hIvasRend != NULL ) && ( hIvasRend->headRotData.hOrientationTracker != NULL ) )
#endif
    {
        free( hIvasRend->headRotData.hOrientationTracker );
    }
@@ -1272,7 +1276,11 @@ static ivas_error initIsmMasaRendering(
        ivas_td_binaural_close( &inputIsm->tdRendWrapper.hBinRendererTd );
    }

#ifdef FIX_1135_EXT_RENDERER_HANDLES
    ivas_rend_closeCrend( &inputIsm->crendWrapper, inputIsm->base.ctx.pSplitRendWrapper != NULL ? inputIsm->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 );
#else
    ivas_rend_closeCrend( &inputIsm->crendWrapper, inputIsm->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses );
#endif

    ivas_reverb_close( &inputIsm->hReverb );

@@ -1376,7 +1384,11 @@ static ivas_error setRendInputActiveIsm(
        }
        else if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR )
        {
#ifdef FIX_1135_EXT_RENDERER_HANDLES
            if ( ( error = ivas_rend_openCrend( &inputIsm->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, hrtfs->hSetOfHRTF, hrtfs->hHrtfStatistics, *rendCtx.pOutSampleRate, rendCtx.pSplitRendWrapper != NULL ? rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 ) ) != IVAS_ERR_OK )
#else
            if ( ( error = ivas_rend_openCrend( &inputIsm->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, hrtfs->hSetOfHRTF, hrtfs->hHrtfStatistics, *rendCtx.pOutSampleRate, rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses ) ) != IVAS_ERR_OK )
#endif
            {
                return error;
            }
@@ -1399,7 +1411,11 @@ static void clearInputIsm(
    initRendInputBase( &inputIsm->base, IVAS_AUDIO_CONFIG_INVALID, 0, rendCtx, NULL, 0 );

    /* Free input's internal handles */
#ifdef FIX_1135_EXT_RENDERER_HANDLES
    ivas_rend_closeCrend( &inputIsm->crendWrapper, inputIsm->base.ctx.pSplitRendWrapper != NULL ? inputIsm->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 );
#else
    ivas_rend_closeCrend( &inputIsm->crendWrapper, inputIsm->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses );
#endif

    ivas_reverb_close( &inputIsm->hReverb );

@@ -2097,7 +2113,11 @@ static ivas_error initMcBinauralRendering(
    /* if we need to use TD renderer and CREND was open, close it */
    if ( useTDRend )
    {
#ifdef FIX_1135_EXT_RENDERER_HANDLES
        ivas_rend_closeCrend( &inputMc->crendWrapper, inputMc->base.ctx.pSplitRendWrapper != NULL ? inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 );
#else
        ivas_rend_closeCrend( &inputMc->crendWrapper, inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses );
#endif
    }

    if ( !reconfigureFlag || ( !useTDRend && outConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && inputMc->hReverb != NULL ) )
@@ -2189,7 +2209,11 @@ static ivas_error initMcMasaRendering(
        ivas_td_binaural_close( &inputMc->tdRendWrapper.hBinRendererTd );
    }

#ifdef FIX_1135_EXT_RENDERER_HANDLES
    ivas_rend_closeCrend( &inputMc->crendWrapper, inputMc->base.ctx.pSplitRendWrapper != NULL ? inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 );
#else
    ivas_rend_closeCrend( &inputMc->crendWrapper, inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses );
#endif

    ivas_reverb_close( &inputMc->hReverb );

@@ -2374,7 +2398,11 @@ static void clearInputMc(
        efap_free_data( &inputMc->efapInWrapper.hEfap );
    }

#ifdef FIX_1135_EXT_RENDERER_HANDLES
    ivas_rend_closeCrend( &inputMc->crendWrapper, inputMc->base.ctx.pSplitRendWrapper != NULL ? inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 );
#else
    ivas_rend_closeCrend( &inputMc->crendWrapper, inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses );
#endif

    ivas_reverb_close( &inputMc->hReverb );

@@ -2549,7 +2577,11 @@ static ivas_error updateSbaPanGains(
                    }
                    else
                    {
#ifdef FIX_1135_EXT_RENDERER_HANDLES
                        if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, inConfig, outConfig, hRendCfg, hMixconv, hHrtfStatistics, *rendCtx.pOutSampleRate, rendCtx.pSplitRendWrapper != NULL ? rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 ) ) != IVAS_ERR_OK )
#else
                        if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, inConfig, outConfig, hRendCfg, hMixconv, hHrtfStatistics, *rendCtx.pOutSampleRate, rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses ) ) != IVAS_ERR_OK )
#endif
                        {
                            return error;
                        }
@@ -2564,7 +2596,11 @@ static ivas_error updateSbaPanGains(
                        return error;
                    }

#ifdef FIX_1135_EXT_RENDERER_HANDLES
                    if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, hMixconv, hHrtfStatistics, *rendCtx.pOutSampleRate, rendCtx.pSplitRendWrapper != NULL ? rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 ) ) != IVAS_ERR_OK )
#else
                    if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, hMixconv, hHrtfStatistics, *rendCtx.pOutSampleRate, rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses ) ) != IVAS_ERR_OK )
#endif
                    {
                        return error;
                    }
@@ -2596,7 +2632,11 @@ static ivas_error initSbaMasaRendering(
{
    ivas_error error;

#ifdef FIX_1135_EXT_RENDERER_HANDLES
    ivas_rend_closeCrend( &inputSba->crendWrapper, inputSba->base.ctx.pSplitRendWrapper != NULL ? inputSba->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 );
#else
    ivas_rend_closeCrend( &inputSba->crendWrapper, inputSba->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses );
#endif

    if ( ( error = ivas_dirac_ana_open( &inputSba->hDirAC, inSampleRate ) ) != IVAS_ERR_OK )
    {
@@ -2674,7 +2714,11 @@ static void clearInputSba(
    initRendInputBase( &inputSba->base, IVAS_AUDIO_CONFIG_INVALID, 0, rendCtx, NULL, 0 );

    /* Free input's internal handles */
#ifdef FIX_1135_EXT_RENDERER_HANDLES
    ivas_rend_closeCrend( &inputSba->crendWrapper, rendCtx.pSplitRendWrapper != NULL ? rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 );
#else
    ivas_rend_closeCrend( &inputSba->crendWrapper, rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses );
#endif

    if ( inputSba->cldfbRendWrapper.hCldfbRend != NULL )
    {
@@ -2859,7 +2903,7 @@ ivas_error IVAS_REND_Open(
#endif

    /* Initilize combined orientation data */
#ifdef FIX_1135_EXT_RENDERER_HANDLESaa
#ifdef FIX_1135_EXT_RENDERER_HANDLES
    hIvasRend->hCombinedOrientationData = NULL;
    if ( Opt_Headrotation || Opt_ExternalOrientation )
    {
@@ -2868,7 +2912,7 @@ ivas_error IVAS_REND_Open(
        {
            return error;
        }
#ifdef FIX_1135_EXT_RENDERER_HANDLESaa
#ifdef FIX_1135_EXT_RENDERER_HANDLES
    }
#endif

@@ -2881,6 +2925,7 @@ ivas_error IVAS_REND_Open(
    /* Initialize inputs */

#ifdef FIX_1135_EXT_RENDERER_HANDLES
    hIvasRend->splitRendWrapper = NULL;
    if ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
    {
        if ( ( hIvasRend->splitRendWrapper = (SPLIT_REND_WRAPPER *) malloc( sizeof( SPLIT_REND_WRAPPER ) ) ) == NULL )
@@ -2889,17 +2934,11 @@ ivas_error IVAS_REND_Open(
        }

        isar_init_split_rend_handles( hIvasRend->splitRendWrapper );
        hIvasRend->splitRendEncBuffer.data = NULL;
    }
    else
    {
        hIvasRend->splitRendWrapper = NULL;
    }
#else
    isar_init_split_rend_handles( &hIvasRend->splitRendWrapper );
    hIvasRend->splitRendEncBuffer.data = NULL;

#endif
    hIvasRend->splitRendEncBuffer.data = NULL;

    for ( i = 0; i < RENDERER_MAX_ISM_INPUTS; ++i )
    {
@@ -2989,10 +3028,18 @@ ivas_error IVAS_REND_Open(
            return error;
        }
    }

#ifdef FIX_1135_EXT_RENDERER_HANDLES
    if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
    {
#endif
        if ( ( error = ivas_HRTF_statistics_init( &( hIvasRend->hHrtfs.hHrtfStatistics ), hIvasRend->sampleRateOut ) ) != IVAS_ERR_OK )
        {
            return error;
        }
#ifdef FIX_1135_EXT_RENDERER_HANDLES
    }
#endif

    return IVAS_ERR_OK;
}
@@ -4431,7 +4478,12 @@ ivas_error IVAS_REND_FeedRenderConfig(
        int16_t cldfb_in_flag;
        cldfb_in_flag = getCldfbRendFlag( hIvasRend, IVAS_REND_AUDIO_CONFIG_TYPE_UNKNOWN );
#ifdef FIX_1135_EXT_RENDERER_HANDLES
        if ( hIvasRend->splitRendWrapper != NULL )
        {
            ISAR_PRE_REND_close( hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer );
            free( hIvasRend->splitRendWrapper );
            hIvasRend->splitRendWrapper = NULL;
        }
#else
        ISAR_PRE_REND_close( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer );
#endif
@@ -4600,7 +4652,7 @@ ivas_error IVAS_REND_SetOrientationTrackingMode(
#ifdef FIX_1135_EXT_RENDERER_HANDLES
    if ( hIvasRend->headRotData.headRotEnabled == 0 )
    {
        return IVAS_HEAD_ORIENT_TRK_NONE;
        return IVAS_ERR_OK;
    }
#endif

@@ -5236,7 +5288,11 @@ static ivas_error renderIsmToBinauralRoom(

    hCombinedOrientationData = ismInput->base.ctx.pCombinedOrientationData;
    combinedOrientationEnabled = 0;
#ifdef FIX_1135_EXT_RENDERER_HANDLES
    if ( *hCombinedOrientationData != NULL )
#else
    if ( hCombinedOrientationData != NULL )
#endif
    {
        for ( subframe_idx = 0; subframe_idx < ( *hCombinedOrientationData )->num_subframes; subframe_idx++ )
        {
@@ -5850,7 +5906,11 @@ static ivas_error renderMcToBinaural(

    hCombinedOrientationData = mcInput->base.ctx.pCombinedOrientationData;
    combinedOrientationEnabled = 0;
#ifdef FIX_1135_EXT_RENDERER_HANDLES
    if ( *hCombinedOrientationData != NULL )
#else
    if ( hCombinedOrientationData != NULL )
#endif
    {
        for ( subframe_idx = 0; subframe_idx < ( *hCombinedOrientationData )->num_subframes; subframe_idx++ )
        {
@@ -5939,7 +5999,11 @@ static ivas_error renderMcToBinauralRoom(

    hCombinedOrientationData = mcInput->base.ctx.pCombinedOrientationData;
    combinedOrientationEnabled = 0;
#ifdef FIX_1135_EXT_RENDERER_HANDLES
    if ( *hCombinedOrientationData != NULL )
#else
    if ( hCombinedOrientationData != NULL )
#endif
    {
        for ( subframe_idx = 0; subframe_idx < ( *hCombinedOrientationData )->num_subframes; subframe_idx++ )
        {
@@ -6030,7 +6094,11 @@ static ivas_error renderMcCustomLsToBinauralRoom(

    hCombinedOrientationData = mcInput->base.ctx.pCombinedOrientationData;
    combinedOrientationEnabled = 0;
#ifdef FIX_1135_EXT_RENDERER_HANDLES
    if ( *hCombinedOrientationData != NULL )
#else
    if ( hCombinedOrientationData != NULL )
#endif
    {
        for ( subframe_idx = 0; subframe_idx < ( *hCombinedOrientationData )->num_subframes; subframe_idx++ )
        {
@@ -6636,7 +6704,11 @@ static ivas_error renderSbaToBinaural(

        hCombinedOrientationData = sbaInput->base.ctx.pCombinedOrientationData;
        combinedOrientationEnabled = 0;
#ifdef FIX_1135_EXT_RENDERER_HANDLES
        if ( *hCombinedOrientationData != NULL )
#else
        if ( hCombinedOrientationData != NULL )
#endif
        {
            for ( subframe_idx = 0; subframe_idx < ( *hCombinedOrientationData )->num_subframes; subframe_idx++ )
            {
@@ -6713,7 +6785,11 @@ static ivas_error renderSbaToBinauralRoom(

    hCombinedOrientationData = sbaInput->base.ctx.pCombinedOrientationData;
    combinedOrientationEnabled = 0;
#ifdef FIX_1135_EXT_RENDERER_HANDLES
    if ( *hCombinedOrientationData != NULL )
#else
    if ( hCombinedOrientationData != NULL )
#endif
    {
        for ( subframe_idx = 0; subframe_idx < ( *hCombinedOrientationData )->num_subframes; subframe_idx++ )
        {
@@ -7716,9 +7792,12 @@ void IVAS_REND_Close(

    /* Split binaural rendering */
#ifdef FIX_1135_EXT_RENDERER_HANDLES
    if ( hIvasRend->splitRendWrapper != NULL )
    {
        ISAR_PRE_REND_close( hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer );
        free( hIvasRend->splitRendWrapper );
        hIvasRend->splitRendWrapper = NULL;
    }
#else
    ISAR_PRE_REND_close( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer );
#endif
@@ -8369,6 +8448,9 @@ static ivas_error ivas_masa_ext_rend_parambin_init(
    int32_t output_Fs;
    RENDERER_TYPE renderer_type;
    int16_t j, k, bin;
#ifdef FIX_1135_EXT_RENDERER_HANDLES
    int16_t num_poses;
#endif
    float binCenterFreq, tmpFloat;
    ivas_error error;
    float frequency_axis[CLDFB_NO_CHANNELS_MAX];
@@ -8383,7 +8465,17 @@ static ivas_error ivas_masa_ext_rend_parambin_init(
    nBins = inputMasa->hMasaExtRend->hSpatParamRendCom->num_freq_bands;
    renderer_type = inputMasa->hMasaExtRend->renderer_type;

#ifdef FIX_1135_EXT_RENDERER_HANDLES
    num_poses = 1;
    if ( inputMasa->base.ctx.pSplitRendWrapper != NULL )
    {
        num_poses = inputMasa->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses;
    }

    for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ )
#else
    for ( pos_idx = 0; pos_idx < inputMasa->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses; pos_idx++ )
#endif
    {
        hDiracDecBin = inputMasa->hMasaExtRend->hDiracDecBin[pos_idx];