Commit 26c58ab6 authored by TYAGIRIS's avatar TYAGIRIS
Browse files

adding a separate pre rend API source file

parent 7788d9ca
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -158,6 +158,7 @@
    <ClCompile Include="..\lib_isar\isar_splitRendererPLC.c" />
    <ClCompile Include="..\lib_isar\isar_rom_post_rend.c" />
    <ClCompile Include="..\lib_isar\lib_isar_post_rend.c" />
    <ClCompile Include="..\lib_isar\lib_isar_pre_rend.c" />
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="..\lib_isar\isar_lcld_prot.h" />
+2 −2
Original line number Diff line number Diff line
@@ -90,7 +90,7 @@ static ivas_error ivas_dec_reconfig_split_rend(
        cldfb_in_flag = 1;
    }

    isar_renderSplitGetMultiBinPoseData( &st_ivas->hRenderConfig->split_rend_config, &hSplitRendWrapper->multiBinPoseData, ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->sr_pose_pred_axis : DEFAULT_AXIS );
    isar_pre_rend_GetMultiBinPoseData( &st_ivas->hRenderConfig->split_rend_config, &hSplitRendWrapper->multiBinPoseData, ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->sr_pose_pred_axis : DEFAULT_AXIS );

    isCldfbNeeded = 0;

@@ -219,7 +219,7 @@ static ivas_error ivas_dec_init_split_rend(
        cldfb_in_flag = 1;
    }

    isar_renderSplitGetMultiBinPoseData( &st_ivas->hRenderConfig->split_rend_config, &st_ivas->hSplitBinRend.splitrend.multiBinPoseData, ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->sr_pose_pred_axis : DEFAULT_AXIS );
    isar_pre_rend_GetMultiBinPoseData( &st_ivas->hRenderConfig->split_rend_config, &st_ivas->hSplitBinRend.splitrend.multiBinPoseData, ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->sr_pose_pred_axis : DEFAULT_AXIS );

    if ( cldfb_in_flag == 1 && ( st_ivas->hSplitBinRend.splitrend.multiBinPoseData.poseCorrectionMode == ISAR_SPLIT_REND_POSE_CORRECTION_MODE_NONE ) )
    {
+1 −1
Original line number Diff line number Diff line
@@ -277,7 +277,7 @@ static ivas_error isar_set_split_rend_setup(
        return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for split rendering structure" );
    }

    isar_renderSplitGetMultiBinPoseData( hSplitBinConfig, &hSplitBinRend->splitrend.multiBinPoseData, ( hCombinedOrientationData != NULL ) ? hCombinedOrientationData->sr_pose_pred_axis : DEFAULT_AXIS );
    isar_pre_rend_GetMultiBinPoseData( hSplitBinConfig, &hSplitBinRend->splitrend.multiBinPoseData, ( hCombinedOrientationData != NULL ) ? hCombinedOrientationData->sr_pose_pred_axis : DEFAULT_AXIS );

    isar_set_split_rend_ht_setup( &hSplitBinRend->splitrend, hCombinedOrientationData );

+52 −0
Original line number Diff line number Diff line
@@ -43,6 +43,35 @@
#include "ivas_error.h"
#include "lib_isar_post_rend.h"

ivas_error isar_splitBinPreRendOpen(
    ISAR_BIN_HR_SPLIT_PRE_REND_HANDLE *hBinHrSplitPreRend,
    MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData
#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG
    ,
    const int32_t output_Fs
#endif
);

ivas_error split_renderer_open_lc3plus(
    SPLIT_REND_WRAPPER *hSplitRendWrapper,
    const ISAR_SPLIT_REND_CONFIG_DATA *pSplitRendConfig,
    const int32_t OutSampleRate,
    const int16_t num_subframes );

void ivas_splitBinPreRendClose(
    ISAR_BIN_HR_SPLIT_PRE_REND_HANDLE *hBinHrSplitPreRend );

void lc3plusTimeAlignCldfbPoseCorr(
    SPLIT_REND_WRAPPER *hSplitBin,
    float Cldfb_In_BinReal[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX],
    float Cldfb_In_BinImag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX] );

ivas_error splitRendLc3plusEncodeAndWrite(
    SPLIT_REND_WRAPPER *hSplitBin,
    ISAR_SPLIT_REND_BITS_HANDLE pBits,
    const int32_t SplitRendBitRate,
    float *in[] );

int32_t ISAR_SPLIT_REND_BITStream_read_int32(
    ISAR_SPLIT_REND_BITS_HANDLE pBits,
    const int32_t bits );
@@ -209,6 +238,29 @@ void isar_rend_CldfbSplitPostRendProcess(
    float output[][L_FRAME48k],
    const int16_t cldfb_in_flag );

void isar_rend_CldfbSplitPreRendProcess(
    const ISAR_BIN_HR_SPLIT_PRE_REND_HANDLE hBinHrSplitPreRend,
    const IVAS_QUATERNION headPosition,
    MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData,
    float Cldfb_In_BinReal[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX],
    float Cldfb_In_BinImag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX],
    ISAR_SPLIT_REND_BITS_HANDLE pBits,
    const int32_t target_md_bits,
    const int16_t low_res_pre_rend_rot,
    const int16_t ro_md_flag );

ivas_error ivas_renderMultiTDBinToSplitBinaural(
    SPLIT_REND_WRAPPER *hSplitBin,
    const IVAS_QUATERNION headPosition,
    const int32_t SplitRendBitRate,
    const int16_t codec_frame_size_ms,
    ISAR_SPLIT_REND_BITS_HANDLE pBits,
    const int16_t max_bands,
    float *in[],
    const int16_t low_res_pre_rend_rot,
    const int16_t pcm_out_flag,
    const int16_t ro_md_flag );

void isar_init_multi_bin_pose_data(
    MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData );

+7 −386
Original line number Diff line number Diff line
@@ -58,17 +58,6 @@
 * Local function declarations
 *---------------------------------------------------------------------*/

static void isar_rend_CldfbSplitPreRendProcess(
    const ISAR_BIN_HR_SPLIT_PRE_REND_HANDLE hBinHrSplitPreRend,
    const IVAS_QUATERNION headPosition,
    MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData,
    float Cldfb_In_BinReal[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX],
    float Cldfb_In_BinImag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX],
    ISAR_SPLIT_REND_BITS_HANDLE pBits,
    const int32_t target_md_bits,
    const int16_t low_res_pre_rend_rot,
    const int16_t ro_md_flag );

static void isar_SplitRenderer_GetRotMd(
    ISAR_BIN_HR_SPLIT_PRE_REND_HANDLE hBinHrSplitPreRend, /* i/o: binaural renderer handle        */
    MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData,
@@ -1393,7 +1382,7 @@ static void isar_SplitRenderer_GetRotMd(
 *
 *------------------------------------------------------------------------*/

static void isar_rend_CldfbSplitPreRendProcess(
void isar_rend_CldfbSplitPreRendProcess(
    const ISAR_BIN_HR_SPLIT_PRE_REND_HANDLE hBinHrSplitPreRend,
    const IVAS_QUATERNION headPosition,
    MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData,
@@ -1512,7 +1501,7 @@ static void isar_rend_CldfbSplitPreRendProcess(
 *
 *------------------------------------------------------------------------*/

static ivas_error isar_splitBinPreRendOpen(
ivas_error isar_splitBinPreRendOpen(
    ISAR_BIN_HR_SPLIT_PRE_REND_HANDLE *hBinHrSplitPreRend,
    MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData
#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG
@@ -1591,7 +1580,7 @@ static ivas_error isar_splitBinPreRendOpen(
 *
 *------------------------------------------------------------------------*/

static void ivas_splitBinPreRendClose(
void ivas_splitBinPreRendClose(
    ISAR_BIN_HR_SPLIT_PRE_REND_HANDLE *hBinHrSplitPreRend )
{
    if ( ( *hBinHrSplitPreRend ) != NULL )
@@ -1654,20 +1643,6 @@ void isar_set_split_rend_ht_setup(
    return;
}

/*-------------------------------------------------------------------------*
 * isar_pre_rend_GetMultiBinPoseData()
 *
 *
 *-------------------------------------------------------------------------*/

void isar_pre_rend_GetMultiBinPoseData(
    const ISAR_SPLIT_REND_CONFIG_DATA *pSplit_rend_config,
    MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData,
    const ISAR_SPLIT_REND_ROT_AXIS rot_axis )
{
    isar_renderSplitGetMultiBinPoseData( pSplit_rend_config, pMultiBinPoseData, rot_axis );
}


/*-------------------------------------------------------------------------
 * Function isar_init_split_rend_handles()
@@ -1702,7 +1677,7 @@ void isar_init_split_rend_handles(
 *
 *------------------------------------------------------------------------*/

static ivas_error split_renderer_open_lc3plus(
ivas_error split_renderer_open_lc3plus(
    SPLIT_REND_WRAPPER *hSplitRendWrapper,
    const ISAR_SPLIT_REND_CONFIG_DATA *pSplitRendConfig,
    const int32_t OutSampleRate,
@@ -1765,217 +1740,13 @@ static ivas_error split_renderer_open_lc3plus(
}


/*-------------------------------------------------------------------------
 * Function isar_pre_rend_open()
 *
 *
 *------------------------------------------------------------------------*/

ivas_error isar_pre_rend_open(
    SPLIT_REND_WRAPPER *hSplitRendWrapper,
    ISAR_SPLIT_REND_CONFIG_DATA *pSplitRendConfig,
    const int32_t OutSampleRate,
    const int16_t cldfb_in_flag,
    const int16_t pcm_out_flag,
    const int16_t num_subframes,
    const int16_t mixed_td_cldfb_flag )
{
    ivas_error error, ch, num_ch;
    uint8_t isCldfbNeeded = 0;

    int16_t cldfb_in_flag_local = cldfb_in_flag;

    if ( ( error = isar_split_rend_choose_default_codec( &( pSplitRendConfig->codec ), &pSplitRendConfig->codec_frame_size_ms, cldfb_in_flag_local, pcm_out_flag, (int16_t) num_subframes ) ) != IVAS_ERR_OK )
    {
        return error;
    }

    if ( mixed_td_cldfb_flag )
    {
        cldfb_in_flag_local = 0;
    }

    if ( ( error = isar_split_rend_validate_config( pSplitRendConfig, pcm_out_flag ) ) != IVAS_ERR_OK )
    {
        return error;
    }

    if ( cldfb_in_flag_local == 0 )
    {
        isCldfbNeeded = 1;
    }
    else if ( pSplitRendConfig->codec == ISAR_SPLIT_REND_CODEC_LC3PLUS && cldfb_in_flag_local )
    {
        isCldfbNeeded = 1;
    }
    else if ( pcm_out_flag && cldfb_in_flag_local )
    {
        isCldfbNeeded = 1;
    }

    hSplitRendWrapper->hCldfbHandles = NULL;

    if ( isCldfbNeeded )
    {
        if ( ( hSplitRendWrapper->hCldfbHandles = (CLDFB_HANDLES_WRAPPER_HANDLE) malloc( sizeof( CLDFB_HANDLES_WRAPPER ) ) ) == NULL )
        {
            return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for CLDFB handles\n" ) );
        }
        num_ch = MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS;
        for ( ch = 0; ch < num_ch; ch++ )
        {
            hSplitRendWrapper->hCldfbHandles->cldfbAna[ch] = NULL;
        }

        for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ )
        {
            hSplitRendWrapper->hCldfbHandles->cldfbSyn[ch] = NULL;
        }

        num_ch = hSplitRendWrapper->multiBinPoseData.num_poses * BINAURAL_CHANNELS;

        for ( ch = 0; ch < num_ch; ch++ )
        {
            if ( ( error = openCldfb( &( hSplitRendWrapper->hCldfbHandles->cldfbAna[ch] ),
                                      CLDFB_ANALYSIS,
                                      OutSampleRate, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK )
            {
                return error;
            }
        }

        for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ )
        {
            if ( ( error = openCldfb( &( hSplitRendWrapper->hCldfbHandles->cldfbSyn[ch] ), CLDFB_SYNTHESIS, OutSampleRate, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK )
            {
                return error;
            }
        }
    }

    if ( pSplitRendConfig->poseCorrectionMode == ISAR_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB )
    {
        if ( ( error = isar_splitBinPreRendOpen( &hSplitRendWrapper->hBinHrSplitPreRend, &hSplitRendWrapper->multiBinPoseData
#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG
                                                 ,
                                                 OutSampleRate
#endif
                                                 ) ) != IVAS_ERR_OK )
        {
            return error;
        }
    }

    if ( pcm_out_flag == 0 )
    {
        if ( pSplitRendConfig->codec == ISAR_SPLIT_REND_CODEC_LC3PLUS )
        {
            if ( ( error = split_renderer_open_lc3plus( hSplitRendWrapper, pSplitRendConfig, OutSampleRate, num_subframes ) ) != IVAS_ERR_OK )
            {
                return error;
            }
        }
        else
        {
            int16_t iNumBlocksPerFrame;
            iNumBlocksPerFrame = ( CLDFB_NO_COL_MAX * pSplitRendConfig->codec_frame_size_ms ) / 20;

            if ( ( error = isar_splitBinLCLDEncOpen( &hSplitRendWrapper->hSplitBinLCLDEnc, OutSampleRate, BINAURAL_CHANNELS, isar_get_lcld_bitrate( pSplitRendConfig->splitRendBitRate, hSplitRendWrapper->multiBinPoseData.poseCorrectionMode ), iNumBlocksPerFrame, 1 ) ) != IVAS_ERR_OK )
            {
                return error;
            }
        }
    }

    return IVAS_ERR_OK;
}

/*-------------------------------------------------------------------------
 * Function isar_pre_rend_close()
 *
 *
 *------------------------------------------------------------------------*/

void isar_pre_rend_close(
    SPLIT_REND_WRAPPER *hSplitBinRend,
    IVAS_REND_AudioBuffer *pSplitRendEncBuffer )
{
    int16_t i;

    if ( hSplitBinRend->hBinHrSplitPreRend != NULL )
    {
        ivas_splitBinPreRendClose( &hSplitBinRend->hBinHrSplitPreRend );
    }

    if ( hSplitBinRend->hSplitBinLCLDEnc != NULL )
    {
        isar_splitBinLCLDEncClose( &hSplitBinRend->hSplitBinLCLDEnc );
    }

    if ( hSplitBinRend->hCldfbHandles != NULL )
    {
        int16_t num_ch, ch;
        num_ch = MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS;
        for ( ch = 0; ch < num_ch; ch++ )
        {
            if ( hSplitBinRend->hCldfbHandles->cldfbAna[ch] != NULL )
            {
                deleteCldfb( &hSplitBinRend->hCldfbHandles->cldfbAna[ch] );
                hSplitBinRend->hCldfbHandles->cldfbAna[ch] = NULL;
            }
        }

        for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ )
        {
            if ( hSplitBinRend->hCldfbHandles->cldfbSyn[ch] != NULL )
            {
                deleteCldfb( &hSplitBinRend->hCldfbHandles->cldfbSyn[ch] );
                hSplitBinRend->hCldfbHandles->cldfbSyn[ch] = NULL;
            }
        }

        free( hSplitBinRend->hCldfbHandles );
        hSplitBinRend->hCldfbHandles = NULL;
    }

    if ( hSplitBinRend->hLc3plusEnc != NULL )
    {
        IVAS_LC3PLUS_ENC_Close( &hSplitBinRend->hLc3plusEnc );
    }

    for ( i = 0; i < MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS; ++i )
    {
        if ( hSplitBinRend->lc3plusDelayBuffers[i] != NULL )
        {
            free( hSplitBinRend->lc3plusDelayBuffers[i] );
            hSplitBinRend->lc3plusDelayBuffers[i] = NULL;
        }
    }

    if ( pSplitRendEncBuffer != NULL )
    {

        if ( pSplitRendEncBuffer->data != NULL )
        {
            free( pSplitRendEncBuffer->data );
            pSplitRendEncBuffer->data = NULL;
        }

        pSplitRendEncBuffer->config.numChannels = 0;
        pSplitRendEncBuffer->config.numSamplesPerChannel = 0;
    }

    return;
}


/*-------------------------------------------------------------------------
 * Function splitRendLc3plusEncodeAndWrite()
 *
 *
 *------------------------------------------------------------------------*/

static ivas_error splitRendLc3plusEncodeAndWrite(
ivas_error splitRendLc3plusEncodeAndWrite(
    SPLIT_REND_WRAPPER *hSplitBin,
    ISAR_SPLIT_REND_BITS_HANDLE pBits,
    const int32_t SplitRendBitRate,
@@ -2025,7 +1796,7 @@ static ivas_error splitRendLc3plusEncodeAndWrite(
 *
 *------------------------------------------------------------------------*/

static ivas_error ivas_renderMultiTDBinToSplitBinaural(
ivas_error ivas_renderMultiTDBinToSplitBinaural(
    SPLIT_REND_WRAPPER *hSplitBin,
    const IVAS_QUATERNION headPosition,
    const int32_t SplitRendBitRate,
@@ -2184,7 +1955,7 @@ static ivas_error ivas_renderMultiTDBinToSplitBinaural(
 *
 *------------------------------------------------------------------------*/

static void lc3plusTimeAlignCldfbPoseCorr(
void lc3plusTimeAlignCldfbPoseCorr(
    SPLIT_REND_WRAPPER *hSplitBin,
    float Cldfb_In_BinReal[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX],
    float Cldfb_In_BinImag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX] )
@@ -2238,154 +2009,4 @@ static void lc3plusTimeAlignCldfbPoseCorr(

    return;
}


/*-------------------------------------------------------------------------
 * Function isar_pre_rend_MultiBinToSplitBinaural()
 *
 *
 *------------------------------------------------------------------------*/

ivas_error isar_pre_rend_MultiBinToSplitBinaural(
    SPLIT_REND_WRAPPER *hSplitBin,
    const IVAS_QUATERNION headPosition,
    const int32_t SplitRendBitRate,
    ISAR_SPLIT_REND_CODEC splitCodec,
    int16_t codec_frame_size_ms,
    ISAR_SPLIT_REND_BITS_HANDLE pBits,
    float Cldfb_In_BinReal[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX],
    float Cldfb_In_BinImag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX],
    const int16_t max_bands,
    float *output[],
    const int16_t low_res_pre_rend_rot,
    const int16_t cldfb_in_flag,
    const int16_t pcm_out_flag,
    const int16_t ro_md_flag )
{
    ivas_error error;
    int32_t bit_len, target_md_bits, actual_md_bits, available_bits;

    error = IVAS_ERR_OK;
    push_wmops( "isar_pre_rend_MultiBinToSplitBinaural" );

    if ( hSplitBin->multiBinPoseData.poseCorrectionMode == ISAR_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB )
    {
        set_fix_rotation_mat( hSplitBin->hBinHrSplitPreRend->fix_pos_rot_mat, &hSplitBin->multiBinPoseData );
        set_pose_types( hSplitBin->hBinHrSplitPreRend->pose_type, &hSplitBin->multiBinPoseData );
    }

    if ( cldfb_in_flag == 0 )
    {
        /*TD input*/
        /*if CLDFB handles have been allocated then assume valid multi binaural input in out[][] buffer and perform CLDFB analysis*/
        error = ivas_renderMultiTDBinToSplitBinaural( hSplitBin, headPosition, SplitRendBitRate, codec_frame_size_ms, pBits, max_bands, output, low_res_pre_rend_rot, pcm_out_flag, ro_md_flag );

        pop_wmops();
        return error;
    }

    if ( splitCodec == ISAR_SPLIT_REND_CODEC_LC3PLUS && hSplitBin->multiBinPoseData.poseCorrectionMode == ISAR_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB )
    {
        /* Time-align pose correction to delay of LC3plus */
        lc3plusTimeAlignCldfbPoseCorr( hSplitBin, Cldfb_In_BinReal, Cldfb_In_BinImag );
    }

    actual_md_bits = pBits->bits_written;
    if ( hSplitBin->multiBinPoseData.poseCorrectionMode == ISAR_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB )
    {
        target_md_bits = isar_get_split_rend_md_target_brate( SplitRendBitRate, pcm_out_flag ) * L_FRAME48k / 48000;

        actual_md_bits = pBits->bits_written;

        isar_rend_CldfbSplitPreRendProcess( hSplitBin->hBinHrSplitPreRend, headPosition, &hSplitBin->multiBinPoseData, Cldfb_In_BinReal, Cldfb_In_BinImag, pBits, target_md_bits, low_res_pre_rend_rot, ro_md_flag );
    }

    if ( pcm_out_flag == 0 )
    {
        pBits->codec = splitCodec;
        pBits->pose_correction = hSplitBin->multiBinPoseData.poseCorrectionMode;

        if ( splitCodec == ISAR_SPLIT_REND_CODEC_LCLD )
        {
            available_bits = ( SplitRendBitRate * hSplitBin->hSplitBinLCLDEnc->iNumBlocks * hSplitBin->hSplitBinLCLDEnc->iNumIterations ) / ( 16 * FRAMES_PER_SEC );
            actual_md_bits = pBits->bits_written - actual_md_bits;
            available_bits -= actual_md_bits;
            pBits->codec_frame_size_ms = codec_frame_size_ms;
            isar_splitBinLCLDEncProcess( hSplitBin->hSplitBinLCLDEnc, Cldfb_In_BinReal, Cldfb_In_BinImag, available_bits, pBits );
        }
        else
        {
            int16_t ch, slot_idx, num_slots, ivas_fs;
            ivas_fs = (int16_t) hSplitBin->hLc3plusEnc->config.ivas_frame_duration_us / 1000;
            num_slots = (int16_t) ( CLDFB_NO_COL_MAX * ivas_fs ) / 20;
            /* CLDFB synthesis of main pose */
            for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ )
            {
                float *Cldfb_In_BinReal_p[CLDFB_NO_COL_MAX];
                float *Cldfb_In_BinImag_p[CLDFB_NO_COL_MAX];

                for ( slot_idx = 0; slot_idx < num_slots; slot_idx++ )
                {
                    Cldfb_In_BinReal_p[slot_idx] = Cldfb_In_BinReal[ch][slot_idx];
                    Cldfb_In_BinImag_p[slot_idx] = Cldfb_In_BinImag[ch][slot_idx];
                }

                cldfbSynthesis( Cldfb_In_BinReal_p, Cldfb_In_BinImag_p, output[ch], hSplitBin->hCldfbHandles->cldfbSyn[0]->no_channels * num_slots, hSplitBin->hCldfbHandles->cldfbSyn[ch] );
            }

            if ( ( error = splitRendLc3plusEncodeAndWrite( hSplitBin, pBits, SplitRendBitRate, output ) ) != IVAS_ERR_OK )
            {
                return error;
            }
        }
    }
    else
    {
        int16_t ch, slot_idx;
        /* CLDFB synthesis of main pose */
        for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ )
        {
            float *Cldfb_In_BinReal_p[CLDFB_NO_COL_MAX];
            float *Cldfb_In_BinImag_p[CLDFB_NO_COL_MAX];

            for ( slot_idx = 0; slot_idx < CLDFB_NO_COL_MAX; slot_idx++ )
            {
                Cldfb_In_BinReal_p[slot_idx] = Cldfb_In_BinReal[ch][slot_idx];
                Cldfb_In_BinImag_p[slot_idx] = Cldfb_In_BinImag[ch][slot_idx];
            }

            cldfbSynthesis( Cldfb_In_BinReal_p, Cldfb_In_BinImag_p, output[ch], hSplitBin->hCldfbHandles->cldfbSyn[0]->no_channels * CLDFB_NO_COL_MAX, hSplitBin->hCldfbHandles->cldfbSyn[ch] );
        }

        pBits->pose_correction = hSplitBin->multiBinPoseData.poseCorrectionMode;
        pBits->codec = ISAR_SPLIT_REND_CODEC_NONE;
    }

    /*zero pad*/
    if ( pcm_out_flag )
    {
        bit_len = SplitRendBitRate / FRAMES_PER_SEC;
    }
    else
    {
        if ( splitCodec == ISAR_SPLIT_REND_CODEC_LCLD )
        {
            bit_len = ( SplitRendBitRate * hSplitBin->hSplitBinLCLDEnc->iNumBlocks * hSplitBin->hSplitBinLCLDEnc->iNumIterations ) / ( 16 * FRAMES_PER_SEC );
        }
        else
        {
            bit_len = hSplitBin->hLc3plusEnc->config.ivas_frame_duration_us / 1000;
            bit_len = SplitRendBitRate * bit_len / 1000;
        }
    }

    while ( pBits->bits_written < bit_len )
    {
        ISAR_SPLIT_REND_BITStream_write_int32( pBits, 0L, 1 );
    }

    pop_wmops();

    return error;
}
#endif
Loading