Commit 9255c126 authored by sagnowski's avatar sagnowski
Browse files

Fix incorrectly merged changes from 3bdd36d2

parent 6b196ffc
Loading
Loading
Loading
Loading
Loading
+18 −33
Original line number Original line Diff line number Diff line
@@ -1909,7 +1909,6 @@ static int16_t isar_get_frame_size(
static ivas_error isar_render_poses(
static ivas_error isar_render_poses(
    IVAS_DEC_HANDLE hIvasDec,    /* i/o: IVAS decoder handle                                        */
    IVAS_DEC_HANDLE hIvasDec,    /* i/o: IVAS decoder handle                                        */
    const int16_t nSamplesAsked, /* i  : number of samples wanted by the caller                     */
    const int16_t nSamplesAsked, /* i  : number of samples wanted by the caller                     */
    float **p_head_pose_buf,     /* o  : PCM buffer with head-pose data                             */
    int16_t *nOutSamples,        /* o  : number of samples per channel written to output buffer     */
    int16_t *nOutSamples,        /* o  : number of samples per channel written to output buffer     */
    bool *needNewFrame           /* o  : indication that the decoder needs a new frame              */
    bool *needNewFrame           /* o  : indication that the decoder needs a new frame              */
)
)
@@ -1917,7 +1916,7 @@ static ivas_error isar_render_poses(
    float pcmBuf[BINAURAL_CHANNELS * MAX_HEAD_ROT_POSES * L_FRAME48k];
    float pcmBuf[BINAURAL_CHANNELS * MAX_HEAD_ROT_POSES * L_FRAME48k];
    Decoder_Struct *st_ivas;
    Decoder_Struct *st_ivas;
    ivas_error error;
    ivas_error error;
    int16_t i, j, numPoses;
    int16_t numPoses;


    if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL )
    if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL )
    {
    {
@@ -1958,15 +1957,6 @@ static ivas_error isar_render_poses(
        ivas_TD_RINGBUF_PushInterleaved( st_ivas->hSplitBinRend->hMultiBinTdData, pcmBuf, *nOutSamples );
        ivas_TD_RINGBUF_PushInterleaved( st_ivas->hSplitBinRend->hMultiBinTdData, pcmBuf, *nOutSamples );
    }
    }


    /* change buffer layout */
    for ( i = 0; i < *nOutSamples; ++i )
    {
        for ( j = 0; j < BINAURAL_CHANNELS * numPoses; ++j )
        {
            p_head_pose_buf[j][i] = pcmBuf[i * BINAURAL_CHANNELS * numPoses + j];
        }
    }

    return error;
    return error;
}
}


@@ -2100,12 +2090,7 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream(
    pcm_out_flag = ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0;
    pcm_out_flag = ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0;
    numSamplesPerChannelToOutput = isar_get_frame_size( st_ivas );
    numSamplesPerChannelToOutput = isar_get_frame_size( st_ivas );


    for ( i = 0; i < BINAURAL_CHANNELS * MAX_HEAD_ROT_POSES; ++i )
    if ( ( error = isar_render_poses( hIvasDec, numSamplesPerChannelToOutput, nOutSamples, needNewFrame ) ) != IVAS_ERR_OK )
    {
        p_head_pose_buf[i] = head_pose_buf[i];
    }

    if ( ( error = isar_render_poses( hIvasDec, numSamplesPerChannelToOutput, p_head_pose_buf, nOutSamples, needNewFrame ) ) != IVAS_ERR_OK )
    {
    {
        return error;
        return error;
    }
    }
@@ -2115,6 +2100,16 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream(
        return IVAS_ERR_OK;
        return IVAS_ERR_OK;
    }
    }


    for ( i = 0; i < BINAURAL_CHANNELS * MAX_HEAD_ROT_POSES; ++i )
    {
        p_head_pose_buf[i] = head_pose_buf[i];
    }

    if ( !ivas_dec_split_rend_cldfb_in( st_ivas->renderer_type ) )
    {
        ivas_TD_RINGBUF_PopChannels( st_ivas->hSplitBinRend->hMultiBinTdData, p_head_pose_buf, *nOutSamples );
    }

    if ( ( error = isar_generate_metadata_and_bitstream( st_ivas, p_head_pose_buf, splitRendBits ) ) != IVAS_ERR_OK )
    if ( ( error = isar_generate_metadata_and_bitstream( st_ivas, p_head_pose_buf, splitRendBits ) ) != IVAS_ERR_OK )
    {
    {
        return error;
        return error;
@@ -3771,9 +3766,6 @@ ivas_error IVAS_DEC_VoIP_GetSamples
    int16_t result;
    int16_t result;
    ivas_error error;
    ivas_error error;
    uint8_t nOutChannels;
    uint8_t nOutChannels;
#ifdef FIX_1119_SPLIT_RENDERING_VOIP
    int16_t i;
#endif


    if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL || hIvasDec->hVoIP == NULL )
    if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL || hIvasDec->hVoIP == NULL )
    {
    {
@@ -3980,23 +3972,11 @@ ivas_error IVAS_DEC_VoIP_GetSamples
#ifdef FIX_1119_SPLIT_RENDERING_VOIP
#ifdef FIX_1119_SPLIT_RENDERING_VOIP
            if ( splitRendBits != NULL )
            if ( splitRendBits != NULL )
            {
            {
                /* Move output pointers forward */
                for ( i = 0; i < BINAURAL_CHANNELS * MAX_HEAD_ROT_POSES; ++i )
                {
                    p_head_pose_buf[i] += *nSamplesRendered;
                }

                /* Render head poses from time-scaled transport channels */
                /* Render head poses from time-scaled transport channels */
                if ( ( error = isar_render_poses( hIvasDec, nSamplesToRender, p_head_pose_buf, &nSamplesRendered_loop, &tmp ) ) != IVAS_ERR_OK )
                if ( ( error = isar_render_poses( hIvasDec, nSamplesToRender, &nSamplesRendered_loop, &tmp ) ) != IVAS_ERR_OK )
                {
                {
                    return error;
                    return error;
                }
                }

                /* Set pointers back to the beginning of head pose buffers */
                for ( i = 0; i < BINAURAL_CHANNELS * MAX_HEAD_ROT_POSES; ++i )
                {
                    p_head_pose_buf[i] -= *nSamplesRendered;
                }
            }
            }
            else
            else
            {
            {
@@ -5254,6 +5234,7 @@ static ivas_error ivas_create_handle_isar(
    isar_init_split_rend_handles( &hSplitBinRend->splitrend );
    isar_init_split_rend_handles( &hSplitBinRend->splitrend );


#ifdef FIX_1119_SPLIT_RENDERING_VOIP
#ifdef FIX_1119_SPLIT_RENDERING_VOIP
    hSplitBinRend->hMultiBinTdData = NULL;
    for ( i = 0; i < MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS; ++i )
    for ( i = 0; i < MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS; ++i )
    {
    {
        hSplitBinRend->hMultiBinCldfbData[i] = NULL;
        hSplitBinRend->hMultiBinCldfbData[i] = NULL;
@@ -5287,6 +5268,10 @@ static void ivas_destroy_handle_isar(
    if ( *hSplitBinRend != NULL )
    if ( *hSplitBinRend != NULL )
    {
    {
#ifdef FIX_1119_SPLIT_RENDERING_VOIP
#ifdef FIX_1119_SPLIT_RENDERING_VOIP
        if ( ( *hSplitBinRend )->hMultiBinTdData != NULL )
        {
            ivas_TD_RINGBUF_Close( &( *hSplitBinRend )->hMultiBinTdData );
        }
        for ( i = 0; i < MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS; ++i )
        for ( i = 0; i < MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS; ++i )
        {
        {
            if ( ( *hSplitBinRend )->hMultiBinCldfbData[i] != NULL )
            if ( ( *hSplitBinRend )->hMultiBinCldfbData[i] != NULL )