Commit c90af971 authored by Devansh Kandpal's avatar Devansh Kandpal
Browse files

midway commit - changes in lib_rend.c

parent 066472b9
Loading
Loading
Loading
Loading
+73 −5
Original line number Diff line number Diff line
@@ -200,6 +200,9 @@ typedef struct hrtf_handles
    IVAS_DEC_HRTF_FASTCONV_HANDLE hHrtfFastConv;
    IVAS_DEC_HRTF_PARAMBIN_HANDLE hHrtfParambin;
    IVAS_DEC_HRTF_HANDLE hHrtfTD;
#ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES
    IVAS_DEC_HRTF_STATISTICS_HANDLE hHrtfStatistics;
#endif
} hrtf_handles;

struct IVAS_REND
@@ -245,8 +248,11 @@ struct IVAS_REND
 * Local function prototypes
 *-------------------------------------------------------------------*/

#ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES
static ivas_error initMasaExtRenderer( input_masa *inputMasa, const AUDIO_CONFIG outConfig, const RENDER_CONFIG_DATA *hRendCfg, hrtf_handles *hHrtfs );
#else
static ivas_error initMasaExtRenderer( input_masa *inputMasa, const AUDIO_CONFIG outConfig, hrtf_handles *hHrtfs );

#endif
static void freeMasaExtRenderer( MASA_EXT_REND_HANDLE *hMasaExtRendOut );

#ifdef SPLIT_REND_WITH_HEAD_ROT
@@ -1391,7 +1397,11 @@ static ivas_error setRendInputActiveIsm(
#endif
    {
#ifndef SPLIT_REND_WITH_HEAD_ROT
#ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES
        if ( ( error = ivas_rend_openCrend( &inputIsm->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, hrtfs->hSetOfHRTF, hrtfs->hHrtfStatistics, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK )
#else
        if ( ( error = ivas_rend_openCrend( &inputIsm->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, hrtfs->hSetOfHRTF, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK )
#endif
        {
            return error;
        }
@@ -1431,7 +1441,11 @@ static ivas_error setRendInputActiveIsm(

        if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
        {
#ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES
            if ( ( error = ivas_reverb_open( &( inputIsm->hReverb ), hrtfs->hHrtfStatistics, hRendCfg, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK )
#else
            if ( ( error = ivas_reverb_open( &( inputIsm->hReverb ), outConfig, NULL, inputIsm->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac, hRendCfg, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK )
#endif
            {
                return error;
            }
@@ -1444,14 +1458,22 @@ static ivas_error setRendInputActiveIsm(

        if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
        {
#ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES
            if ( ( error = ivas_reverb_open( &( inputIsm->hReverb ), hrtfs->hHrtfStatistics, hRendCfg, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK )
#else
            if ( ( error = ivas_reverb_open( &( inputIsm->hReverb ), outConfig, NULL, inputIsm->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac, hRendCfg, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK )
#endif
            {
                return error;
            }
        }
        else if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR )
        {
#ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES
            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 )
#else
            if ( ( error = ivas_rend_openCrend( &inputIsm->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, hrtfs->hSetOfHRTF, *rendCtx.pOutSampleRate, rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses ) ) != IVAS_ERR_OK )
#endif
            {
                return error;
            }
@@ -2138,6 +2160,9 @@ static ivas_error initMcBinauralRendering(
    const AUDIO_CONFIG outConfig,
    RENDER_CONFIG_DATA *hRendCfg,
    IVAS_DEC_HRTF_CREND_HANDLE hMixconv,
#ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES
    HRTFS_STATISTICS_HANDLE hHrtfStatistics,
#endif
    uint8_t reconfigureFlag )
{
    ivas_error error;
@@ -2234,7 +2259,11 @@ static ivas_error initMcBinauralRendering(
#endif
        if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && inputMc->hReverb == NULL )
        {
#ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES
            if ( ( error = ivas_reverb_open( &( inputMc->hReverb ), hHrtfStatistics, hRendCfg, outSampleRate ) ) != IVAS_ERR_OK )
#else
            if ( ( error = ivas_reverb_open( &( inputMc->hReverb ), outConfig, NULL, inputMc->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac, hRendCfg, outSampleRate ) ) != IVAS_ERR_OK )
#endif
            {
                return error;
            }
@@ -2244,13 +2273,22 @@ static ivas_error initMcBinauralRendering(
    {
        /* open CREND */
#ifdef SPLIT_REND_WITH_HEAD_ROT
#ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES
        if ( ( error = ivas_rend_openCrend( &inputMc->crendWrapper, ( inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) ? IVAS_AUDIO_CONFIG_7_1_4 : inConfig, outConfig, hRendCfg, hMixconv, hHrtfStatistics,
                                            outSampleRate, ( ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) || ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ) ? inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 ) ) != IVAS_ERR_OK )
#else
        if ( ( error = ivas_rend_openCrend( &inputMc->crendWrapper, ( inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) ? IVAS_AUDIO_CONFIG_7_1_4 : inConfig, outConfig, hRendCfg,
                                            hMixconv,
                                            outSampleRate, ( ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) || ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ) ? inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 ) ) != IVAS_ERR_OK )
#endif
#else
#ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES
        if ( ( error = ivas_rend_openCrend( &inputMc->crendWrapper, ( inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) ? IVAS_AUDIO_CONFIG_7_1_4 : inConfig, outConfig, hRendCfg, hMixconv, hHrtfStatistics, outSampleRate ) ) != IVAS_ERR_OK )
#else
        if ( ( error = ivas_rend_openCrend( &inputMc->crendWrapper, ( inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) ? IVAS_AUDIO_CONFIG_7_1_4 : inConfig, outConfig, hRendCfg,
                                            hMixconv,
                                            outSampleRate ) ) != IVAS_ERR_OK )
#endif
#endif
        {
            return error;
@@ -2448,9 +2486,14 @@ static ivas_error setRendInputActiveMc(
    if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
#endif
    {
#ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES
        if ( ( error = initMcBinauralRendering( inputMc, inConfig, outConfig, hRendCfg, hrtfs->hSetOfHRTF, hrtfs->hHrtfStatistics, FALSE ) ) != IVAS_ERR_OK )
#else
        if ( ( error = initMcBinauralRendering( inputMc, inConfig, outConfig, hRendCfg,
                                                hrtfs->hSetOfHRTF,
                                                FALSE ) ) != IVAS_ERR_OK )
#endif

		{
            return error;
        }
@@ -2616,7 +2659,11 @@ static ivas_error updateSbaPanGains(
    input_sba *inputSba,
    const AUDIO_CONFIG outConfig,
    RENDER_CONFIG_DATA *hRendCfg,
    IVAS_DEC_HRTF_CREND_HANDLE hMixconv )
    IVAS_DEC_HRTF_CREND_HANDLE hMixconv,
#ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES
    IVAS_DEC_HRTF_STATISTICS_HANDLE hHrtfStatistics
#endif 
)
{
    ivas_error error;
    AUDIO_CONFIG inConfig;
@@ -2666,9 +2713,17 @@ static ivas_error updateSbaPanGains(
                case IVAS_AUDIO_CONFIG_BINAURAL:
                {
#ifdef SPLIT_REND_WITH_HEAD_ROT
#ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES
                    if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, inConfig, outConfig, hRendCfg, hMixconv, hHrtfStatistics, *rendCtx.pOutSampleRate, rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses ) ) != IVAS_ERR_OK )
#else
                    if ( hRendCfg->split_rend_config.rendererSelection == ISAR_SPLIT_REND_RENDERER_SELECTION_FASTCONV )
                    {
                        if ( ( error = ivas_rend_openCldfbRend( &inputSba->cldfbRendWrapper, inConfig, outConfig, &rendCtx.pSplitRendWrapper->multiBinPoseData, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK )
#endif
#else
#ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES
                    if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, inConfig, outConfig, hRendCfg, hMixconv, hHrtfStatistics, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK )                        
#endif
					{
                            return error;
                        }
@@ -2694,9 +2749,18 @@ static ivas_error updateSbaPanGains(
                        return error;
                    }
#ifdef SPLIT_REND_WITH_HEAD_ROT
#ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES
                    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 )
#else
                    if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, hMixconv, *rendCtx.pOutSampleRate, rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses ) ) != IVAS_ERR_OK )

#endif
#else
#ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES
                    if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, hMixconv, hHrtfStatistics, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK )
#else
                    if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, hMixconv, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK )
#endif
#endif
                    {
                        return error;
@@ -2808,7 +2872,11 @@ static ivas_error setRendInputActiveSba(
        }
    }

#ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES
    if ( ( error = updateSbaPanGains( inputSba, outConfig, hRendCfg, hrtfs->hSetOfHRTF, hrtfs->hHrtfStatistics ) ) != IVAS_ERR_OK )
#else
    if ( ( error = updateSbaPanGains( inputSba, outConfig, hRendCfg, hrtfs->hSetOfHRTF ) ) != IVAS_ERR_OK )
#endif    
	{
        return error;
    }