Commit c4140738 authored by TYAGIRIS's avatar TYAGIRIS
Browse files

fixing TODOs in the code

parent cc968c5b
Loading
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -38,7 +38,6 @@
#include "typedef.h"
#include "cnst.h"
#include "ivas_cnst.h"
#include "stat_com.h"


/*----------------------------------------------------------------------------------*
+30 −0
Original line number Diff line number Diff line
@@ -846,6 +846,36 @@ typedef struct ivas_binaural_rendering_struct
} BINAURAL_RENDERER, *BINAURAL_RENDERER_HANDLE;
#endif

#ifdef SPLIT_REND_WITH_HEAD_ROT
/*----------------------------------------------------------------------------------*
 * IVAS decoder specific ISAR wrapper structures
 *----------------------------------------------------------------------------------*/

typedef struct
{
    float Cldfb_RealBuffer_Binaural[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX];
    float Cldfb_ImagBuffer_Binaural[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX];

} ISAR_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA, *ISAR_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA_HANDLE;

typedef struct
{
    float Cldfb_RealBuffer[MAX_OUTPUT_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX];
    float Cldfb_ImagBuffer[MAX_OUTPUT_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX];
    IVAS_AUDIO_CONFIG config;

} ISAR_DEC_SPLIT_REND_CLDFB_OUT_DATA, *ISAR_DEC_SPLIT_REND_CLDFB_OUT_DATA_HANDLE;

typedef struct
{
    ISAR_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA_HANDLE hMultiBinCldfbData; /*scratch buffer for frame by frame processing*/
    ISAR_SPLIT_REND_BITS_HANDLE hSplitRendBits;                         /*scratch buffer for frame by frame processing*/
    SPLIT_REND_WRAPPER splitrend;
    ISAR_DEC_SPLIT_REND_CLDFB_OUT_DATA_HANDLE hCldfbDataOut; /*buffer to store cldfb data before binauralization*/
    int16_t numTdSamplesPerChannelCached;

} ISAR_DEC_SPLIT_REND_WRAPPER;
#endif

/*----------------------------------------------------------------------------------*
 * MASA decoder structures
+35 −1
Original line number Diff line number Diff line
@@ -127,6 +127,7 @@ static ivas_error IVAS_DEC_GetBufferedNumberOfSamples( IVAS_DEC_HANDLE hIvasDec,
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, ISAR_SPLIT_REND_CONFIG_DATA *hSplitBinConfig, COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, ISAR_SPLIT_REND_BITS_DATA *splitRendBits );
#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 );
@@ -250,6 +251,39 @@ ivas_error IVAS_DEC_Open(
    return IVAS_ERR_WRONG_PARAMS;
}

#ifdef SPLIT_REND_WITH_HEAD_ROT
/*-------------------------------------------------------------------------*
 * isar_set_split_rend_setup()
 *
 * Setup IVAS split rendering
 *-------------------------------------------------------------------------*/

static ivas_error isar_set_split_rend_setup(
    ISAR_DEC_SPLIT_REND_WRAPPER *hSplitBinRend,
    ISAR_SPLIT_REND_CONFIG_DATA *hSplitBinConfig,
    COMBINED_ORIENTATION_HANDLE hCombinedOrientationData,
    ISAR_SPLIT_REND_BITS_DATA *splitRendBits /* o  : output split rendering bits                                             */
)
{
    splitRendBits->bits_read = 0;
    splitRendBits->bits_written = 0;
    splitRendBits->buf_len = ISAR_MAX_SPLIT_REND_BITS_BUFFER_SIZE_IN_BYTES;
    splitRendBits->codec = ISAR_SPLIT_REND_CODEC_DEFAULT;
    splitRendBits->pose_correction = ISAR_SPLIT_REND_POSE_CORRECTION_MODE_NONE;
    splitRendBits->codec_frame_size_ms = 0;

    if ( ( hSplitBinRend->hMultiBinCldfbData = (ISAR_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA_HANDLE) malloc( sizeof( ISAR_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA ) ) ) == NULL )
    {
        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_set_split_rend_ht_setup( &hSplitBinRend->splitrend, hCombinedOrientationData );

    return IVAS_ERR_OK;
}
#endif

/*---------------------------------------------------------------------*
 * init_decoder_config()
@@ -896,7 +930,7 @@ ivas_error IVAS_DEC_GetSamples(

        if ( hIvasDec->st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || hIvasDec->st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
        {
            isar_set_split_rend_ht_setup( &hIvasDec->st_ivas->hSplitBinRend, hIvasDec->st_ivas->hCombinedOrientationData );
            isar_set_split_rend_ht_setup( &hIvasDec->st_ivas->hSplitBinRend.splitrend, hIvasDec->st_ivas->hCombinedOrientationData );
        }
#endif

+1 −8
Original line number Diff line number Diff line
@@ -247,16 +247,9 @@ void isar_init_split_post_rend_handles(
    ISAR_SPLIT_POST_REND_WRAPPER *hSplitRendWrapper );

void isar_set_split_rend_ht_setup(
    ISAR_DEC_SPLIT_REND_WRAPPER *hSplitBinRend,
    SPLIT_REND_WRAPPER *hSplitrend,
    COMBINED_ORIENTATION_HANDLE hCombinedOrientationData );

ivas_error isar_set_split_rend_setup(
    ISAR_DEC_SPLIT_REND_WRAPPER *hSplitBinRend,
    ISAR_SPLIT_REND_CONFIG_DATA *hSplitBinConfig,
    COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i/o: combined orientation handle    */
    ISAR_SPLIT_REND_BITS_DATA *splitRendBits              /* o  : output split rendering bits   */
);

int32_t isar_get_lc3plus_bitrate(
    const int32_t SplitRendBitRate,
    const ISAR_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode,
+9 −10
Original line number Diff line number Diff line
@@ -1347,7 +1347,7 @@ void isar_SplitRenderer_PostRenderer(
    const IVAS_QUATERNION Quaternion_act )
{
    int16_t pos_idx, b, brange[2], ch_idx1;
    int16_t num_md_bands, slot_idx, b2, index_slot, num_slots, sf_idx_md;
    int16_t num_md_bands, slot_idx, b2, num_slots, sf_idx_md;
    float pred_out_re[BINAURAL_CHANNELS], pred_out_im[BINAURAL_CHANNELS], tmp_re, tmp_im, gd_int;
#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG
    ISAR_BIN_HR_SPLIT_REND_MD rot_md_act[MAX_HEAD_ROT_POSES][MAX_SPLIT_REND_MD_BANDS];
@@ -1450,7 +1450,6 @@ void isar_SplitRenderer_PostRenderer(
    {
        for ( slot_idx = 0; slot_idx < num_slots; slot_idx++ )
        {
            index_slot = slot_idx; /* TODO: can be cleaned up  */
            fade = ( (float) slot_idx + 1.0f ) / MAX_PARAM_SPATIAL_SUBFRAMES;
            fade = min( fade, 1.0f );
            for ( b = 0; b < num_md_bands; b++ )
@@ -1487,8 +1486,8 @@ void isar_SplitRenderer_PostRenderer(
                    for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ )
                    {
                        /* Apply prediction matrix */
                        IVAS_CMULT_FLOAT( Cldfb_RealBuffer_Ref_Binaural[0][index_slot][b2],
                                          Cldfb_ImagBuffer_Ref_Binaural[0][index_slot][b2],
                        IVAS_CMULT_FLOAT( Cldfb_RealBuffer_Ref_Binaural[0][slot_idx][b2],
                                          Cldfb_ImagBuffer_Ref_Binaural[0][slot_idx][b2],
                                          mix_mat_re[0][ch_idx1],
                                          mix_mat_im[0][ch_idx1],
                                          tmp_re,
@@ -1496,8 +1495,8 @@ void isar_SplitRenderer_PostRenderer(
                        pred_out_re[ch_idx1] = tmp_re;
                        pred_out_im[ch_idx1] = tmp_im;

                        IVAS_CMULT_FLOAT( Cldfb_RealBuffer_Ref_Binaural[1][index_slot][b2],
                                          Cldfb_ImagBuffer_Ref_Binaural[1][index_slot][b2],
                        IVAS_CMULT_FLOAT( Cldfb_RealBuffer_Ref_Binaural[1][slot_idx][b2],
                                          Cldfb_ImagBuffer_Ref_Binaural[1][slot_idx][b2],
                                          mix_mat_re[1][ch_idx1],
                                          mix_mat_im[1][ch_idx1],
                                          tmp_re,
@@ -1510,11 +1509,11 @@ void isar_SplitRenderer_PostRenderer(
                    for ( ch_idx1 = 0; ch_idx1 < BINAURAL_CHANNELS; ch_idx1++ )
                    {
#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG
                        Cldfb_RealBuffer_Recons_Binaural[pos_idx][ch_idx1][index_slot][b2] = pred_out_re[ch_idx1];
                        Cldfb_ImagBuffer_Recons_Binaural[pos_idx][ch_idx1][index_slot][b2] = pred_out_im[ch_idx1];
                        Cldfb_RealBuffer_Recons_Binaural[pos_idx][ch_idx1][slot_idx][b2] = pred_out_re[ch_idx1];
                        Cldfb_ImagBuffer_Recons_Binaural[pos_idx][ch_idx1][slot_idx][b2] = pred_out_im[ch_idx1];
#else
                        Cldfb_RealBuffer_Ref_Binaural[ch_idx1][index_slot][b2] = pred_out_re[ch_idx1];
                        Cldfb_ImagBuffer_Ref_Binaural[ch_idx1][index_slot][b2] = pred_out_im[ch_idx1];
                        Cldfb_RealBuffer_Ref_Binaural[ch_idx1][slot_idx][b2] = pred_out_re[ch_idx1];
                        Cldfb_ImagBuffer_Ref_Binaural[ch_idx1][slot_idx][b2] = pred_out_im[ch_idx1];
#endif
                    }
                }
Loading