Commit ac4be594 authored by norvell's avatar norvell
Browse files

Fix for LFE channel in external renderer in FIX_198_TDREND_INTERFACE

parent efa70256
Loading
Loading
Loading
Loading
Loading
+11 −23
Original line number Diff line number Diff line
@@ -62,7 +62,7 @@ static void TDREND_Update_object_positions( BINAURAL_TD_OBJECT_RENDERER_HANDLE h
                                            float output[][L_FRAME48k] );
#ifdef FIX_198_TDREND_INTERFACE
static ivas_error ivas_td_binaural_open_unwrap( TDREND_HRFILT_FiltSet_t **hHrtfTD, const int32_t output_Fs, const int16_t nchan_transport, const IVAS_FORMAT ivas_format, const AUDIO_CONFIG transport_config, const IVAS_OUTPUT_SETUP hTransSetup, BINAURAL_TD_OBJECT_RENDERER_HANDLE *hBinRendererTd, int32_t *binaural_latency_ns );
static void ObjRenderIVASFrame_unwrap( RENDER_CONFIG_DATA *hRenderConfig, const int16_t ini_frame, CREND_WRAPPER_HANDLE hCrendWrapper, AUDIO_CONFIG transport_config, const int32_t output_Fs, BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, const int16_t nchan_transport, IVAS_FORMAT ivas_format, ISM_METADATA_HANDLE *hIsmMetaData, const int16_t Opt_Headrotation, const IVAS_QUATERNION *Quaternions, float output[][L_FRAME48k], const int16_t output_frame );
static void ObjRenderIVASFrame_unwrap( RENDER_CONFIG_DATA *hRenderConfig, const int16_t ini_frame, CREND_WRAPPER_HANDLE hCrendWrapper, AUDIO_CONFIG transport_config, const int32_t output_Fs, BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, const int16_t nchan_transport, const int16_t lfe_idx, IVAS_FORMAT ivas_format, ISM_METADATA_HANDLE *hIsmMetaData, const int16_t Opt_Headrotation, const IVAS_QUATERNION *Quaternions, float output[][L_FRAME48k], const int16_t output_frame );

/*---------------------------------------------------------------------*
 * ivas_td_binaural_open()
@@ -191,7 +191,7 @@ ivas_error ivas_td_binaural_open(

#ifdef FIX_198_TDREND_INTERFACE
    nchan_rend = nchan_transport;
    if ( ivas_format == MC_FORMAT )
    if ( ( ivas_format == MC_FORMAT ) && ( transport_config != AUDIO_CONFIG_LS_CUSTOM ) )
#else
    nchan_rend = st_ivas->nchan_transport;
    if ( st_ivas->ivas_format == MC_FORMAT )
@@ -354,7 +354,7 @@ void ObjRenderIVASFrame(
)
{
    ObjRenderIVASFrame_unwrap( st_ivas->hRenderConfig, st_ivas->ini_frame, st_ivas->hCrendWrapper, st_ivas->transport_config,
                               st_ivas->hDecoderConfig->output_Fs, st_ivas->hBinRendererTd, st_ivas->nchan_transport, st_ivas->ivas_format,
                               st_ivas->hDecoderConfig->output_Fs, 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 );
}

@@ -372,6 +372,7 @@ static void ObjRenderIVASFrame_unwrap(
    const int32_t output_Fs,                           /*i  : Output sampling rate               */
    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                  */
    IVAS_FORMAT ivas_format,                           /*i  : IVAS format                        */
    ISM_METADATA_HANDLE *hIsmMetaData,                 /*i  : ISM metadata handle                */
    const int16_t Opt_Headrotation,                    /*i  : Head rotation flag                 */
@@ -426,7 +427,7 @@ void ObjRenderIVASFrame(

    /* Update object position(s) */
#ifdef FIX_198_TDREND_INTERFACE
    TDREND_Update_object_positions( hBinRendererTd, nchan_transport, LFE_CHANNEL, ivas_format, hIsmMetaData, output );
    TDREND_Update_object_positions( hBinRendererTd, nchan_transport, lfe_idx, ivas_format, hIsmMetaData, output );
#else
    TDREND_Update_object_positions( st_ivas->hBinRendererTd, st_ivas->nchan_transport, LFE_CHANNEL, st_ivas->ivas_format, st_ivas->hIsmMetaData, output );
#endif
@@ -888,11 +889,11 @@ ivas_error ivas_rend_TDObjRenderFrame(
    int16_t subframe_length;
    int16_t subframe_idx;
    ISM_METADATA_HANDLE hIsmMetaData[1];
    int16_t lfe_idx;
#else
    ISM_METADATA_FRAME hIsmMetaDataFrame;
    ISM_METADATA_HANDLE hIsmMetaData[1];
#endif
    int16_t lfe_idx;
    int16_t num_src;
    /* TODO tmu : pass down renderer config struct */
    // float reverb_signal[BINAURAL_CHANNELS][L_FRAME48k];
@@ -906,11 +907,11 @@ ivas_error ivas_rend_TDObjRenderFrame(
    push_wmops( "ivas_rend_TDObjRenderFrame" );

    inConfigType = getAudioConfigType( inConfig );
#ifndef FIX_198_TDREND_INTERFACE
    lfe_idx = LFE_CHANNEL;
#else
#ifdef FIX_198_TDREND_INTERFACE
    hIsmMetaData[0] = NULL;
#endif

    if ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED )
    {
        ivas_format = MC_FORMAT;
@@ -920,9 +921,7 @@ ivas_error ivas_rend_TDObjRenderFrame(
        }
        else
        {
#ifndef FIX_198_TDREND_INTERFACE
            lfe_idx = ( customLsInput->num_lfe > 0 ) ? customLsInput->lfe_idx[0] : -1;
#endif
            num_src = customLsInput->num_spk + customLsInput->num_lfe;
        }
    }
@@ -947,20 +946,9 @@ ivas_error ivas_rend_TDObjRenderFrame(
    transport_config = getIvasAudioConfigFromRendAudioConfig( inConfig );
    output_Fs = output_frame * 50;


    ObjRenderIVASFrame_unwrap( NULL,
                               1,
                               NULL,
                               transport_config,
                               output_Fs,
                               pTDRend->hBinRendererTd,
                               num_src,
                               ivas_format,
                               hIsmMetaData,
                               headRotData->headRotEnabled,
                               ( headRotData != NULL ) ? headRotData->headPositions : NULL,
                               output,
                               output_frame );
    ObjRenderIVASFrame_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 );

#else