Commit 6d224bb5 authored by Devansh Kandpal's avatar Devansh Kandpal
Browse files

Activated new hrtf format compiler switch + changes in lib_rend.c

parent 5f546048
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -187,7 +187,7 @@
#endif


//#define USE_NEW_HRTF_BINARY_FILE_FORMAT                 /* Orange: to activate when decided to change the hrtf binary file format */
#define USE_NEW_HRTF_BINARY_FILE_FORMAT                 /* Orange: to activate when decided to change the hrtf binary file format */
#ifdef USE_NEW_HRTF_BINARY_FILE_FORMAT
#define NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES         /* Philips: Use pre-computed HRTF average L/R energies and IAC in all renderers	*/
#ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES
+8 −6
Original line number Diff line number Diff line
@@ -105,9 +105,11 @@ typedef struct ivas_reverb_params_t
    float *pFc;                                                                                          /* Center frequencies for FFT filter design                                             */
    float *pRt60;                                                                                        /* RT60 values at these frequencies                                                     */
    float *pDsr;                                                                                         /* DSR values at these frequencies                                                      */
#ifndef FIX_1053_REVERB_RECONFIGURATION
    float *pHrtf_avg_pwr_response_l;    /* The HRTF set's average left  ear power response                                      */
    float *pHrtf_avg_pwr_response_r;    /* The HRTF set's average right ear power response                                      */
    float *pHrtf_inter_aural_coherence; /* The HRTF set's inter-aural coherence for diffuse sound                               */
#endif
    const float *pHrtf_avg_pwr_response_l_const;    /* The HRTF set's average left  ear power response                                      */
    const float *pHrtf_avg_pwr_response_r_const;    /* The HRTF set's average right ear power response                                      */
    const float *pHrtf_inter_aural_coherence_const; /* The HRTF set's inter-aural coherence for diffuse sound                               */
+134 −1
Original line number Diff line number Diff line
@@ -4547,6 +4547,139 @@ int16_t IVAS_REND_FeedRenderConfig(
    }

#ifdef FIX_1053_REVERB_RECONFIGURATION
    /* Re-initialise reverb instance if already available */
    /* ISM inputs */
    for ( i = 0, pIsmInput = hIvasRend->inputsIsm; i < RENDERER_MAX_BIN_INPUTS; ++i, ++pIsmInput )

    {
        if ( pIsmInput->base.inConfig == IVAS_AUDIO_CONFIG_INVALID )
        {
            /* Skip inactive inputs */
            continue;
        }
        if ( pIsmInput->hReverb != NULL )
        {
            if ( ( error = ivas_reverb_open( &pIsmInput->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pIsmInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK )
            {
                return error;
            }
        }
        if ( pIsmInput->crendWrapper != NULL && pIsmInput->crendWrapper->hCrend != NULL )
        {
#ifdef SPLIT_REND_WITH_HEAD_ROT
            if ( ( error = ivas_reverb_open( &pIsmInput->crendWrapper->hCrend[0]->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pIsmInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK )
#else
            if ( ( error = ivas_reverb_open( &pIsmInput->crendWrapper->hCrend->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pIsmInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK )
#endif
            {
                return error;
            }
        }
    }

    /*MASA inputs */
    for ( i = 0, pMasaInput = hIvasRend->inputsMasa; i < RENDERER_MAX_MASA_INPUTS; ++i, ++pMasaInput )
    {
        if ( pMasaInput->base.inConfig == IVAS_AUDIO_CONFIG_INVALID )
        {
            /* Skip inactive inputs */
            continue;
        }

        if ( pMasaInput->hMasaExtRend != NULL )
        {
#ifdef SPLIT_REND_WITH_HEAD_ROT
            if ( pMasaInput->hMasaExtRend->hDiracDecBin != NULL && pMasaInput->hMasaExtRend->hDiracDecBin[0]->hReverb != NULL )
            {
                ivas_binaural_reverb_close( &pMasaInput->hMasaExtRend->hDiracDecBin[0]->hReverb );
                if ( ( error = ivas_binaural_reverb_init( &pMasaInput->hMasaExtRend->hDiracDecBin[0]->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, pMasaInput->hMasaExtRend->hSpatParamRendCom->num_freq_bands, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, &( hRenderConfig->roomAcoustics ), *pMasaInput->base.ctx.pOutSampleRate, NULL, NULL ) ) != IVAS_ERR_OK )
                {
                    return error;
                }
            }
#else
            if ( pMasaInput->hMasaExtRend->hDiracDecBin != NULL && pMasaInput->hMasaExtRend->hDiracDecBin->hReverb != NULL )
            {
                ivas_binaural_reverb_close( &pMasaInput->hMasaExtRend->hDiracDecBin->hReverb );
                if ( ( error = ivas_binaural_reverb_init( &pMasaInput->hMasaExtRend->hDiracDecBin->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, pMasaInput->hMasaExtRend->hSpatParamRendCom->num_freq_bands, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, &( hRenderConfig->roomAcoustics ), *pMasaInput->base.ctx.pOutSampleRate, NULL, NULL ) ) != IVAS_ERR_OK )
                {
                    return error;
                }
            }
#endif
            if ( pMasaInput->hMasaExtRend->hReverb != NULL )
            {
                ivas_binaural_reverb_close( &pMasaInput->hMasaExtRend->hReverb );
                if ( ( error = ivas_binaural_reverb_init( &pMasaInput->hMasaExtRend->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, pMasaInput->hMasaExtRend->hSpatParamRendCom->num_freq_bands, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, &( hRenderConfig->roomAcoustics ), *pMasaInput->base.ctx.pOutSampleRate, NULL, NULL ) ) != IVAS_ERR_OK )
                {
                    return error;
                }
            }
        }
    }

    /* Multi-channel inputs */
    for ( i = 0, pMcInput = hIvasRend->inputsMc; i < RENDERER_MAX_MC_INPUTS; ++i, ++pMcInput )
    {
        if ( pMcInput->base.inConfig == IVAS_AUDIO_CONFIG_INVALID )
        {
            /* Skip inactive inputs */
            continue;
        }

        if ( pMcInput->hReverb != NULL )
        {
            if ( ( error = ivas_reverb_open( &pMcInput->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pMcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK )
            {
                return error;
            }
        }
#ifdef SPLIT_REND_WITH_HEAD_ROT
        if ( pMcInput->crendWrapper != NULL && pMcInput->crendWrapper->hCrend && pMcInput->crendWrapper->hCrend[0]->hReverb != NULL )
        {
            if ( ( error = ivas_reverb_open( &pMcInput->crendWrapper->hCrend[0]->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pMcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK )
            {
                return error;
            }
        }
#else
        if ( pMcInput->crendWrapper != NULL && pMcInput->crendWrapper->hCrend && pMcInput->crendWrapper->hCrend->hReverb != NULL )
        {
            if ( ( error = ivas_reverb_open( &pMcInput->crendWrapper->hCrend->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pMcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK )
            {
                return error;
            }
        }
#endif
    }

    /* SBA inputs */
    for ( i = 0, pSbaInput = hIvasRend->inputsSba; i < RENDERER_MAX_SBA_INPUTS; ++i, ++pSbaInput )
    {
        if ( pSbaInput->base.inConfig == IVAS_AUDIO_CONFIG_INVALID )
        {
            /* Skip inactive inputs */
            continue;
        }

#ifdef SPLIT_REND_WITH_HEAD_ROT
        if ( pSbaInput->crendWrapper != NULL && pSbaInput->crendWrapper->hCrend != NULL && pSbaInput->crendWrapper->hCrend[0]->hReverb != NULL )
        {
            if ( ( error = ivas_reverb_open( &pSbaInput->crendWrapper->hCrend[0]->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pSbaInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK )
            {
                return error;
            }
        }
#else
        if ( pSbaInput->crendWrapper != NULL && pSbaInput->crendWrapper->hCrend != NULL && pSbaInput->crendWrapper->hCrend->hReverb != NULL )
        {
            if ( ( error = ivas_reverb_open( &pSbaInput->crendWrapper->hCrend->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pSbaInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK )
            {
                return error;
            }
        }
#endif
    }
#endif

#ifdef SPLIT_REND_WITH_HEAD_ROT