Commit 4f7bb9eb authored by multrus's avatar multrus
Browse files

[cleanup] accept FIX_330_ENABLE_TD_RENDERER_REVERB_REND

parent 4794fcd6
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -141,7 +141,6 @@
#define DISABLE_ADAP_RES_COD_TMP                        /* temporary fix for IVAS-403, disables adaptive residual coding */
/*#define ITD_WINNER_GAIN_MODIFY */                     /* ITD optimization - WORK IN PROGRESS */
/*#define FIX_I4_OL_PITCH*/                             /* fix open-loop pitch used for EVS core switching */
#define FIX_330_ENABLE_TD_RENDERER_REVERB_REND          /* Eri: Enable reverb for TD renderer for ISM, 5.1 and 7.1 with headtracking enabled for IVAS_rend */

#define FIX_347_DTX_CRASH                               /* FhG: Fix crash that can happen with DTX */
#define DISABLE_RES_CHANNELS_MCT                        /* decode only W and residual for Y when outputting to stereo */
+0 −11
Original line number Diff line number Diff line
@@ -1222,17 +1222,10 @@ ivas_error ivas_init_decoder(

        if ( st_ivas->hRenderConfig->roomAcoustics.late_reverb_on )
        {
#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND
            if ( ( error = ivas_reverb_open( &st_ivas->hReverb, st_ivas->hDecoderConfig->output_config, NULL, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK )
            {
                return error;
            }
#else
            if ( ( error = ivas_rend_initCrendWrapper( &st_ivas->hCrendWrapper ) ) != IVAS_ERR_OK )
            {
                return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend\n" );
            }
#endif
        }
    }
    else if ( st_ivas->renderer_type == RENDERER_MC )
@@ -1572,9 +1565,7 @@ void ivas_initialize_handles_dec(
    st_ivas->hBinRendererTd = NULL;
    st_ivas->hMonoDmxRenderer = NULL;
    st_ivas->hCrendWrapper = NULL;
#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND
    st_ivas->hReverb = NULL;
#endif
    st_ivas->hSetOfHRTF = NULL;
    st_ivas->hHrtfFastConv = NULL;
    st_ivas->hHrtfParambin = NULL;
@@ -1733,10 +1724,8 @@ void ivas_destroy_dec(

    /* Crend handle */
    ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ) );
#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND
    /* Reverb handle */
    ivas_reverb_close( &st_ivas->hReverb );
#endif

    /* LS config converter handle */
    ivas_ls_setup_conversion_close( &st_ivas->hLsSetUpConversion );
+0 −8
Original line number Diff line number Diff line
@@ -72,16 +72,8 @@ ivas_error ivas_td_binaural_renderer(
)
{
    return ivas_td_binaural_renderer_unwrap(
#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND
        st_ivas->hReverb,
#else
        st_ivas->hRenderConfig, st_ivas->ini_frame,
        st_ivas->hCrendWrapper,
#endif
        st_ivas->transport_config,
#ifndef FIX_330_ENABLE_TD_RENDERER_REVERB_REND
        st_ivas->hDecoderConfig->output_Fs,
#endif
        st_ivas->hBinRendererTd, st_ivas->nchan_transport, LFE_CHANNEL, st_ivas->ivas_format,
        st_ivas->hIsmMetaData, st_ivas->hDecoderConfig->Opt_Headrotation, ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->Quaternions : NULL, output, output_frame );
}
+0 −2
Original line number Diff line number Diff line
@@ -1239,9 +1239,7 @@ typedef struct Decoder_Struct
    VBAP_HANDLE hVBAPdata;                                     /* VBAP structure */
    MONO_DOWNMIX_RENDERER_HANDLE hMonoDmxRenderer;             /* Mono downmix structure */
    CREND_WRAPPER_HANDLE hCrendWrapper;
#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND
    REVERB_HANDLE hReverb; /* Reverb handle             */
#endif
	HRTFS_CREND_HANDLE hSetOfHRTF;                             /* Set of HRTFs handle (CRend) */
    HRTFS_FASTCONV_HANDLE hHrtfFastConv;                       /* FASTCONV HRTF tables for binaural rendering */
    HRTFS_PARAMBIN_HANDLE hHrtfParambin;                       /* HRTF tables for parametric binauralizer */
+0 −79
Original line number Diff line number Diff line
@@ -227,17 +227,8 @@ void ivas_td_binaural_close(
 *---------------------------------------------------------------------*/

ivas_error ivas_td_binaural_renderer_unwrap(
#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND
    REVERB_HANDLE hReverb, /* i  : reverb handle */
#else
    RENDER_CONFIG_DATA *hRenderConfig,  /* i  : Renderer configuration               */
    const int16_t ini_frame,            /* i  : Initialization frame counter         */
    CREND_WRAPPER_HANDLE hCrendWrapper, /* i  : Crend wrapper handle                 */
#endif
    AUDIO_CONFIG transport_config, /* i  : Transport configuration              */
#ifndef FIX_330_ENABLE_TD_RENDERER_REVERB_REND
    const int32_t output_Fs, /* i  : Output sampling rate                 */
#endif
    BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD binaural object renderer handle   */
    const int16_t nchan_transport,                     /* i  : Transport channels (ISms)            */
    const int16_t lfe_idx,                             /* i  : LFE channel index                    */
@@ -255,21 +246,6 @@ ivas_error ivas_td_binaural_renderer_unwrap(
    ivas_error error;

    subframe_length = output_frame / MAX_PARAM_SPATIAL_SUBFRAMES;
#ifndef FIX_330_ENABLE_TD_RENDERER_REVERB_REND
    if ( hRenderConfig != NULL )
    {

        if ( hRenderConfig->roomAcoustics.late_reverb_on && ( ini_frame == 0 ) )
        {
            ivas_reverb_open(
                &hCrendWrapper->hCrend->hReverb,
                transport_config,
                NULL,
                hRenderConfig,
                output_Fs );
        }
    }
#endif

    /* Update object position(s) */
    TDREND_Update_object_positions( hBinRendererTd, nchan_transport, lfe_idx, ivas_format, hIsmMetaData, output );
@@ -279,32 +255,15 @@ ivas_error ivas_td_binaural_renderer_unwrap(
        /* Update the listener's location/orientation */
        TDREND_Update_listener_orientation( hBinRendererTd, Opt_Headrotation, ( Quaternions != NULL ) ? &Quaternions[subframe_idx] : NULL );

#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND
        if ( ( hReverb != NULL ) && ( hReverb->pConfig.roomAcoustics.late_reverb_on ) )
#else
        if ( ( hRenderConfig != NULL ) && ( hRenderConfig->roomAcoustics.late_reverb_on ) )
#endif
        {
            if ( ( error = ivas_reverb_process(
#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND
                       hReverb,
#else
                       hCrendWrapper->hCrend->hReverb,
#endif
                       transport_config, 0, output, reverb_signal, subframe_idx ) ) != IVAS_ERR_OK )
            {
                return error;
            }

#ifndef FIX_330_ENABLE_TD_RENDERER_REVERB_REND
            ivas_reverb_process(
                hCrendWrapper->hCrend->hReverb,
                transport_config,
                0,
                output,
                reverb_signal,
                subframe_idx );
#endif
        }

        /* Render subframe */
@@ -315,24 +274,12 @@ ivas_error ivas_td_binaural_renderer_unwrap(
    }


#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND
    if ( ( hReverb != NULL ) && ( hReverb->pConfig.roomAcoustics.late_reverb_on ) )
    {
        /* add reverb to rendered signals */
        v_add( reverb_signal[0], output[0], output[0], output_frame );
        v_add( reverb_signal[1], output[1], output[1], output_frame );
    }
#else
    if ( hRenderConfig != NULL ) /* Renderer Configuration not enabled in TD standalone renderer */
    {
        if ( hRenderConfig->roomAcoustics.late_reverb_on )
        {
            /* add reverb to rendered signals */
            v_add( reverb_signal[0], output[0], output[0], output_frame );
            v_add( reverb_signal[1], output[1], output[1], output_frame );
        }
    }
#endif

    return IVAS_ERR_OK;
}
@@ -598,9 +545,7 @@ ivas_error ivas_td_binaural_renderer_ext(
    const LSSETUP_CUSTOM_STRUCT *customLsInput,      /* i  : Input custom loudspeaker layout   */
    const IVAS_REND_HeadRotData *headRotData,        /* i  : Input head positions              */
    const IVAS_REND_AudioObjectPosition *currentPos, /* i  : Object position                   */
#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND
    const REVERB_HANDLE reverb, /* i  : reverb handle */
#endif
    const int16_t output_frame, /* i  : output frame length               */
    float output[][L_FRAME48k]  /* i/o: SCE channels / Binaural synthesis */
)
@@ -609,17 +554,10 @@ ivas_error ivas_td_binaural_renderer_ext(
    ISM_METADATA_HANDLE hIsmMetaData[1];
    int16_t lfe_idx;
    int16_t num_src;
#ifndef FIX_330_ENABLE_TD_RENDERER_REVERB_REND
    /* TODO tmu : pass down renderer config struct */
    // float reverb_signal[BINAURAL_CHANNELS][L_FRAME48k];
#endif
    IVAS_FORMAT ivas_format;
    IVAS_REND_AudioConfigType inConfigType;
    AUDIO_CONFIG transport_config;
    ivas_error error;
#ifndef FIX_330_ENABLE_TD_RENDERER_REVERB_REND
    int32_t output_Fs;
#endif

    push_wmops( "ivas_td_binaural_renderer_ext" );

@@ -630,9 +568,7 @@ ivas_error ivas_td_binaural_renderer_ext(
    if ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED )
    {
        ivas_format = MC_FORMAT;
#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND
        transport_config = getIvasAudioConfigFromRendAudioConfig( inConfig );
#endif
        if ( inConfig != IVAS_REND_AUDIO_CONFIG_LS_CUSTOM )
        {
            if ( ( error = getAudioConfigNumChannels( inConfig, &num_src ) ) != IVAS_ERR_OK )
@@ -650,32 +586,17 @@ ivas_error ivas_td_binaural_renderer_ext(
    {
        ivas_format = ISM_FORMAT;
        num_src = 1;
#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND
        transport_config = AUDIO_CONFIG_ISM1;
#endif
        hIsmMetaData[0] = &hIsmMetaDataFrame;
        hIsmMetaData[0]->azimuth = currentPos->azimuth;
        hIsmMetaData[0]->elevation = currentPos->elevation;
    }

#ifndef FIX_330_ENABLE_TD_RENDERER_REVERB_REND
    transport_config = getIvasAudioConfigFromRendAudioConfig( inConfig );
    output_Fs = output_frame * 50;
#endif
#ifdef FIX_330_ENABLE_TD_RENDERER_REVERB_REND
    if ( ( error = ivas_td_binaural_renderer_unwrap( reverb, transport_config, pTDRend->hBinRendererTd, num_src, lfe_idx, ivas_format, hIsmMetaData, headRotData->headRotEnabled,
                                                     ( headRotData != NULL ) ? headRotData->headPositions : NULL, output, output_frame ) ) != IVAS_ERR_OK )
    {
        return error;
    }
#else
    if ( ( error = error = ivas_td_binaural_renderer_unwrap( NULL, 1, NULL, transport_config, output_Fs, pTDRend->hBinRendererTd, num_src, lfe_idx,
                                                             ivas_format, hIsmMetaData, headRotData->headRotEnabled, ( headRotData != NULL ) ? headRotData->headPositions : NULL,
                                                             output, output_frame ) ) != IVAS_ERR_OK )
    {
        return error;
    }
#endif

    pop_wmops();

Loading