Commit fa2c7664 authored by vaclav's avatar vaclav
Browse files

revert move of init functions

parent 02849fc5
Loading
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -2690,6 +2690,9 @@ void ivas_destroy_dec(
    ivas_binRenderer_close( &st_ivas->hBinRenderer );

#ifdef SPLIT_REND_WITH_HEAD_ROT
    /* Split binaural renderer handle */
    ISAR_PRE_REND_close( &st_ivas->hSplitBinRend->splitrend, NULL );

    /* TD binaural renderer handles */
    for ( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i )
    {
@@ -2699,6 +2702,12 @@ void ivas_destroy_dec(
            ivas_td_binaural_close( &st_ivas->hTdRendHandles[i] );
        }
    }

    if ( st_ivas->hSplitBinRend->hCldfbDataOut != NULL )
    {
        free( st_ivas->hSplitBinRend->hCldfbDataOut );
        st_ivas->hSplitBinRend->hCldfbDataOut = NULL;
    }
#endif

    /* Parametric binaural renderer handle */
+0 −72
Original line number Diff line number Diff line
@@ -128,8 +128,6 @@ static PCM_RESOLUTION pcm_type_API_to_internal( const IVAS_DEC_PCM_TYPE pcmType
static void *pcm_buffer_offset( void *buffer, const IVAS_DEC_PCM_TYPE pcmType, const int32_t offset );
static ivas_error set_pcm_buffer_to_zero( void *buffer, const IVAS_DEC_PCM_TYPE pcmType, const int16_t nZeroSamples );
static ivas_error isar_set_split_rend_setup( ISAR_DEC_SPLIT_REND_WRAPPER *hSplitBinRend, const ISAR_SPLIT_REND_CONFIG_DATA *hSplitBinConfig, const COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, ISAR_SPLIT_REND_BITS_DATA *splitRendBits );
static ivas_error ivas_create_handle_isar( ISAR_DEC_SPLIT_REND_WRAPPER_HANDLE *hSplitBinRend_out );
static void ivas_destroy_handle_isar( ISAR_DEC_SPLIT_REND_WRAPPER_HANDLE *hSplitBinRend_out );
#endif
static int16_t get_render_frame_size_ms( IVAS_RENDER_FRAMESIZE render_framesize );
static void update_voip_rendered20ms( IVAS_DEC_HANDLE hIvasDec, const int16_t nSamplesRendered );
@@ -345,11 +343,6 @@ void IVAS_DEC_Close(
        ( *phIvasDec )->hVoIP = NULL;
    }

#ifdef SPLIT_REND_WITH_HEAD_ROT
    /* destroy Split binaural renderer (ISAR) handle */
    ivas_destroy_handle_isar( &( *phIvasDec )->st_ivas->hSplitBinRend );
#endif

    if ( ( *phIvasDec )->st_ivas )
    {
        ivas_destroy_dec( ( *phIvasDec )->st_ivas );
@@ -514,17 +507,6 @@ ivas_error IVAS_DEC_Configure(
        return error;
    }

#ifdef SPLIT_REND_WITH_HEAD_ROT
    /* create ISAR handle */
    if ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
    {
        if ( ( error = ivas_create_handle_isar( &st_ivas->hSplitBinRend ) ) != IVAS_ERR_OK )
        {
            return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for ISAR handle" );
        }
    }
#endif

    if ( hIvasDec->mode == IVAS_DEC_MODE_EVS )
    {
        hIvasDec->st_ivas->ivas_format = MONO_FORMAT;
@@ -3988,60 +3970,6 @@ PCM_RESOLUTION pcm_type_API_to_internal(
}


/*-------------------------------------------------------------------*
 * ivas_create_handle_isar()
 *
 * Initialize IVAS decoder split rend handle
 *-------------------------------------------------------------------*/

static ivas_error ivas_create_handle_isar(
    ISAR_DEC_SPLIT_REND_WRAPPER_HANDLE *hSplitBinRend_out /* o  : ISAR split binaural rendering handle */
)
{
    ISAR_DEC_SPLIT_REND_WRAPPER_HANDLE hSplitBinRend;

    if ( ( hSplitBinRend = (ISAR_DEC_SPLIT_REND_WRAPPER_HANDLE) malloc( sizeof( ISAR_DEC_SPLIT_REND_WRAPPER ) ) ) == NULL )
    {
        return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for IVAS decoder handle" );
    }

    isar_init_split_rend_handles( &hSplitBinRend->splitrend );

    hSplitBinRend->hMultiBinCldfbData = NULL;
    hSplitBinRend->hCldfbDataOut = NULL;
    hSplitBinRend->numTdSamplesPerChannelCached = 0;

    *hSplitBinRend_out = hSplitBinRend;

    return IVAS_ERR_OK;
}


/*-------------------------------------------------------------------*
 * ivas_destroy_handle_isar()
 *
 * destroy IVAS decoder split rend handle
 *-------------------------------------------------------------------*/

static void ivas_destroy_handle_isar(
    ISAR_DEC_SPLIT_REND_WRAPPER_HANDLE *hSplitBinRend /* i/o: ISAR split binaural rendering handle */
)
{
    if ( *hSplitBinRend != NULL )
    {
        ISAR_PRE_REND_close( &( *hSplitBinRend )->splitrend, NULL );

        if ( ( *hSplitBinRend )->hCldfbDataOut != NULL )
        {
            free( ( *hSplitBinRend )->hCldfbDataOut );
            ( *hSplitBinRend )->hCldfbDataOut = NULL;
        }
    }

    return;
}


/*---------------------------------------------------------------------*
 * IVAS_DEC_is_split_rendering_enabled()
 *