Commit 706e5e12 authored by vaclav's avatar vaclav
Browse files

- move structures to appropriate libraries

- revisit VE2AT comments
parent 4a1d2261
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -4498,7 +4498,7 @@ void ivas_spar_param_to_masa_param_mapping(


// VE2AT: this function is used in lib_rend at one place - the function ivas_rend_initEfap() is however not used; where is its best place?
// VE2AT: rename it
// VE2AT: possibly rename it
IVAS_REND_AudioConfig getRendAudioConfigFromIvasAudioConfig(
    AUDIO_CONFIG config 
);  
+122 −7
Original line number Diff line number Diff line
@@ -41,7 +41,7 @@
#include "ivas_stat_com.h"
#include "ivas_stat_rend.h"
#ifndef FIX_197_CREND_INTERFACE
#include "common_api_types.h" // VE2AT: don't we want to avoid this include in the library? I admit that the rules hefre are not 100% clear to me but introducing it just for IVAS_QUATERNION is not necessry I think
#include "common_api_types.h"
#endif

#ifndef FIX_197_CREND_INTERFACE
@@ -820,6 +820,22 @@ typedef struct ivas_spar_md_dec_state_t
    int16_t spar_hoa_md_flag;
} ivas_spar_md_dec_state_t;

/* AGC structure */
typedef struct ivas_agc_dec_chan_state_t
{
    float lastGain;
    int16_t gainExpVal;

} ivas_agc_dec_chan_state_t;

typedef struct ivas_agc_dec_state_t
{
    ivas_agc_com_state_t agc_com;
    ivas_agc_dec_chan_state_t *gain_state;
    ivas_agc_chan_data_t *gain_data;

} ivas_agc_dec_state_t;

#ifndef FIX_197_CREND_INTERFACE

/* AGC structure */
@@ -993,12 +1009,111 @@ typedef struct mct_dec_data_structure

} MCT_DEC_DATA, *MCT_DEC_HANDLE;


/*----------------------------------------------------------------------------------*
 * LFE decoder structure
 *----------------------------------------------------------------------------------*/

typedef struct ivas_lfe_dec_data_structure
{
    ivas_filters_process_state_t filter_state;
    LFE_WINDOW_HANDLE pWindow_state;
    const uint16_t *cum_freq_models[IVAS_MAX_NUM_QUANT_STRATS][IVAS_MAX_NUM_DCT_COEF_GROUPS];
    int16_t lfe_dec_indices_coeffs_tbl[IVAS_MAX_NUM_QUANT_STRATS][IVAS_MAX_NUM_DCT_COEF_GROUPS];
    float lfe_block_delay_s;
    int16_t lfe_prior_buf_len;
    float *prior_out_buffer;

    float *prevsynth_buf;
    float *lfe_delay_buf;
    int16_t lfe_addl_delay;
    int16_t bfi_count;

} LFE_DEC_DATA, *LFE_DEC_HANDLE;


// VE2AT: the following structures are used only in lib_dec; is it expected?
/*----------------------------------------------------------------------------------*
 * VBAP structures
 *----------------------------------------------------------------------------------*/

/* Defines a single virtual surface triplet of loudspeakers
 * with a precalculated inverse matrix */
typedef struct vbap_vs_triplet_structure
{
    uint8_t speaker_node[3];
    float inverse_matrix[3][3];

} VBAP_VS_TRIPLET;

/* Storage structure for fast runtime triplet search */
typedef struct triplet_search_structure
{
    VBAP_VS_TRIPLET *triplets;
    int16_t num_triplets;
    int16_t initial_search_indices[VBAP_NUM_SEARCH_SECTORS];

} VBAP_SEARCH_STRUCT;

/* VBAP data structure. Contains the formed virtual surface arrangement * and supporting data. */
typedef struct vbap_data_structure
{
    VBAP_SEARCH_STRUCT search_struct[2]; /* Default to max two groups in this implementation */
    int16_t num_search_structs;
    int16_t num_speaker_nodes;
    int16_t num_speaker_nodes_internal;
    int16_t top_virtual_speaker_node_index; /* These indices can be negative */
    int16_t bottom_virtual_speaker_node_index;
    int16_t back_virtual_speaker_node_index;
    float *bottom_virtual_speaker_node_division_gains;
    float *top_virtual_speaker_node_division_gains;
    float *back_virtual_speaker_node_division_gains;

} VBAP_DATA, *VBAP_HANDLE;


/*----------------------------------------------------------------------------------*
 * renderer structures
 *----------------------------------------------------------------------------------*/

typedef struct renderer_struct
{
    float prev_gains[MAX_CICP_CHANNELS - 1][MAX_OUTPUT_CHANNELS];
    float interpolator[L_FRAME48k];

} ISM_RENDERER_DATA, *ISM_RENDERER_HANDLE;

/* Fastconv binaural data structure */
typedef struct ivas_binaural_rendering_struct
{
    /* Common variables for all modules */
    IVAS_OUTPUT_SETUP_HANDLE hInputSetup; /* pointer to input spatial format for binaural renderer*/
    EFAP_HANDLE hEFAPdata;                /* EFAP structure*/
    float *hoa_dec_mtx;                   /* pointer to HOA decoder mtx */
    int8_t rotInCldfb;                    /* Flag to enable rotation within bin Renderer in CLDFB*/
    int16_t max_band;                     /* band upto which rendering is performed */
    int16_t conv_band;                    /* band upto which convolution in cldfb domain is performed */
    int16_t timeSlots;                    /* number of time slots of binaural renderer */
    int16_t nInChannels;                  /* number input channels */
    int8_t render_lfe;                    /* Flag to render LFE in binaural rendering*/
    IVAS_FORMAT ivas_format;              /* format; corresponds to st_ivas->ivas_format, unless the signal gets transormed to a different domain for rendering */

    /* Convolution module structure */
    BINRENDERER_CONV_MODULE_HANDLE hBinRenConvModule;

    /* Variables related to reverb module */
    float earlyPartEneCorrection[CLDFB_NO_CHANNELS_MAX];
    REVERB_STRUCT_HANDLE hReverb;

} BINAURAL_RENDERER, *BINAURAL_RENDERER_HANDLE;


#ifndef FIX_197_CREND_INTERFACE

/*----------------------------------------------------------------------------------*
 * EFAP structures
 *----------------------------------------------------------------------------------*/
// VE2AT: move to ivas_rom_rend.h ?
//
typedef struct EFAP_VERTEX
{
    float azi;                 /* azimuth of the loudspeaker */
@@ -1061,7 +1176,7 @@ typedef struct EFAP
/*----------------------------------------------------------------------------------*
 * VBAP structures
 *----------------------------------------------------------------------------------*/
// VE2AT: move to ivas_rom_rend.h ?
//
enum SpeakerNodeGroup
{
    SPEAKER_NODE_BOTTOM_HALF,
@@ -1119,7 +1234,7 @@ typedef struct vbap_data_structure
/*----------------------------------------------------------------------------------*
 * renderer structures
 *----------------------------------------------------------------------------------*/
// VE2AT: move to ivas_rom_rend.h ?

typedef struct renderer_struct
{
    float prev_gains[MAX_CICP_CHANNELS - 1][MAX_OUTPUT_CHANNELS];
@@ -1187,7 +1302,7 @@ typedef struct ivas_masa_decoder_struct
/*----------------------------------------------------------------------------------*
 * Binaural Rendering structure
 *----------------------------------------------------------------------------------*/
// VE2AT: move to ivas_rom_rend.h ?

/* Binaural reverberator structure */
typedef struct ivas_binaural_reverb_struct
{
@@ -1347,7 +1462,7 @@ typedef struct ivas_binaural_rendering_struct
/*----------------------------------------------------------------------------------*
 * Head tracking data structure
 *----------------------------------------------------------------------------------*/
// VE2AT: move to ivas_rom_rend.h ?


typedef struct ivas_binaural_head_track_struct
{
@@ -1614,7 +1729,7 @@ typedef struct ivas_binaural_td_rendering_struct
/*------------------------------------------------------------------------------------------*
 * Crend structures
 *------------------------------------------------------------------------------------------*/
// VE2AT: move to ivas_rom_rend.h ?

typedef struct ivas_hrtfs_structure
{
    float *pOut_to_bin_re[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS];
+20 −0
Original line number Diff line number Diff line
@@ -95,6 +95,26 @@ typedef struct connection_option
    float arc_weighted;
} ConnectionOption;

enum SpeakerNodeGroup
{
    SPEAKER_NODE_BOTTOM_HALF,
    SPEAKER_NODE_HORIZONTAL,
    SPEAKER_NODE_TOP_HALF,
    SPEAKER_NODE_BACK,
    SPEAKER_NODE_ALL
};

/* Defines a single speaker node */
typedef struct vbap_speaker_node_structure
{
    float azi_deg;
    float ele_deg;
    float unit_vec[3];
    enum SpeakerNodeGroup group;

} VBAP_SPEAKER_NODE;


/*-----------------------------------------------------------------------*
 * Local function prototypes
 *-----------------------------------------------------------------------*/
+1 −1
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@
   the United Nations Convention on Contracts on the International Sales of Goods.

*******************************************************************************************************/
// VE2AT: move these low-level fucntions to lib_com?
// VE2AT: move these low-level functions to lib_com?
#include <stdint.h>
#include "options.h"
#include "ivas_cnst.h"
+4 −136
Original line number Diff line number Diff line
@@ -186,24 +186,7 @@ typedef struct ivas_binaural_reverb_struct

} REVERB_STRUCT, *REVERB_STRUCT_HANDLE;

// VE2AT: this should be ivas_stat_dec.h
/* AGC structure */
typedef struct ivas_agc_dec_chan_state_t
{
    float lastGain;
    int16_t gainExpVal;

} ivas_agc_dec_chan_state_t;

typedef struct ivas_agc_dec_state_t
{
    ivas_agc_com_state_t agc_com;
    ivas_agc_dec_chan_state_t *gain_state;
    ivas_agc_chan_data_t *gain_data;

} ivas_agc_dec_state_t;

// VE2AT: this should be ivas_stat_dec.h
/* TD decorr */
typedef struct ivas_td_decorr_APD_filt_state_t
{
@@ -226,7 +209,7 @@ typedef struct ivas_td_decorr_state_t

} ivas_td_decorr_state_t;

// VE2AT: this should be ivas_stat_dec.h

/* Parametric binaural data structure */
typedef struct ivas_dirac_dec_binaural_data_structure
{
@@ -282,6 +265,7 @@ typedef struct ivas_binaural_rendering_conv_module_struct
/*----------------------------------------------------------------------------------*
 * Output configuration for renderer (e.g. DirAC, MASA, Binaural Renderer...)
 *----------------------------------------------------------------------------------*/

typedef struct ivas_output_setup_structure
{
    AUDIO_CONFIG output_config;
@@ -304,7 +288,7 @@ typedef struct ivas_output_setup_structure
/*----------------------------------------------------------------------------------*
 * EFAP structures
 *----------------------------------------------------------------------------------*/
// VE2AT: move to ivas_rom_rend.h ?

typedef struct EFAP_VERTEX
{
    float azi;                 /* azimuth of the loudspeaker */
@@ -364,104 +348,9 @@ typedef struct EFAP
} EFAP, *EFAP_HANDLE;


/*----------------------------------------------------------------------------------*
 * VBAP structures
 *----------------------------------------------------------------------------------*/
// VE2AT: move to ivas_rom_rend.h ?
enum SpeakerNodeGroup
{
    SPEAKER_NODE_BOTTOM_HALF,
    SPEAKER_NODE_HORIZONTAL,
    SPEAKER_NODE_TOP_HALF,
    SPEAKER_NODE_BACK,
    SPEAKER_NODE_ALL
};

/* Defines a single virtual surface triplet of loudspeakers
 * with a precalculated inverse matrix */
typedef struct vbap_vs_triplet_structure
{
    uint8_t speaker_node[3];
    float inverse_matrix[3][3];

} VBAP_VS_TRIPLET;

/* Defines a single speaker node */
typedef struct vbap_speaker_node_structure
{
    float azi_deg;
    float ele_deg;
    float unit_vec[3];
    enum SpeakerNodeGroup group;

} VBAP_SPEAKER_NODE;

/* Storage structure for fast runtime triplet search */
typedef struct triplet_search_structure
{
    VBAP_VS_TRIPLET *triplets;
    int16_t num_triplets;
    int16_t initial_search_indices[VBAP_NUM_SEARCH_SECTORS];

} VBAP_SEARCH_STRUCT;

/* VBAP data structure. Contains the formed virtual surface arrangement * and supporting data. */
typedef struct vbap_data_structure
{
    VBAP_SEARCH_STRUCT search_struct[2]; /* Default to max two groups in this implementation */
    int16_t num_search_structs;
    int16_t num_speaker_nodes;
    int16_t num_speaker_nodes_internal;
    int16_t top_virtual_speaker_node_index; /* These indices can be negative */
    int16_t bottom_virtual_speaker_node_index;
    int16_t back_virtual_speaker_node_index;
    float *bottom_virtual_speaker_node_division_gains;
    float *top_virtual_speaker_node_division_gains;
    float *back_virtual_speaker_node_division_gains;

} VBAP_DATA, *VBAP_HANDLE;


/*----------------------------------------------------------------------------------*
 * renderer structures
 *----------------------------------------------------------------------------------*/
// VE2AT: move to ivas_rom_rend.h ?
typedef struct renderer_struct
{
    float prev_gains[MAX_CICP_CHANNELS - 1][MAX_OUTPUT_CHANNELS];
    float interpolator[L_FRAME48k];

} ISM_RENDERER_DATA, *ISM_RENDERER_HANDLE;

/* Fastconv binaural data structure */
typedef struct ivas_binaural_rendering_struct
{
    /* Common variables for all modules */
    IVAS_OUTPUT_SETUP_HANDLE hInputSetup; /* pointer to input spatial format for binaural renderer*/
    EFAP_HANDLE hEFAPdata;                /* EFAP structure*/
    float *hoa_dec_mtx;                   /* pointer to HOA decoder mtx */
    int8_t rotInCldfb;                    /* Flag to enable rotation within bin Renderer in CLDFB*/
    int16_t max_band;                     /* band upto which rendering is performed */
    int16_t conv_band;                    /* band upto which convolution in cldfb domain is performed */
    int16_t timeSlots;                    /* number of time slots of binaural renderer */
    int16_t nInChannels;                  /* number input channels */
    int8_t render_lfe;                    /* Flag to render LFE in binaural rendering*/
    IVAS_FORMAT ivas_format;              /* format; corresponds to st_ivas->ivas_format, unless the signal gets transormed to a different domain for rendering */

    /* Convolution module structure */
    BINRENDERER_CONV_MODULE_HANDLE hBinRenConvModule;

    /* Variables related to reverb module */
    float earlyPartEneCorrection[CLDFB_NO_CHANNELS_MAX];
    REVERB_STRUCT_HANDLE hReverb;

} BINAURAL_RENDERER, *BINAURAL_RENDERER_HANDLE;


/*----------------------------------------------------------------------------------*
 * Head tracking data structure
 *----------------------------------------------------------------------------------*/
// VE2AT: move to ivas_rom_rend.h ?

typedef struct ivas_binaural_head_track_struct
{
@@ -861,7 +750,7 @@ typedef struct ivas_binaural_td_rendering_struct
/*------------------------------------------------------------------------------------------*
 * Crend structures
 *------------------------------------------------------------------------------------------*/
// VE2AT: move to ivas_rom_rend.h ?

typedef struct ivas_hrtfs_structure
{
    float *pOut_to_bin_re[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS];
@@ -982,27 +871,6 @@ typedef struct ivas_hrtfs_parambin_struct

#endif

/*----------------------------------------------------------------------------------*
 * LFE decoder structure
 *----------------------------------------------------------------------------------*/
// VE2AT: this should be ivas_stat_dec.h
typedef struct ivas_lfe_dec_data_structure
{
    ivas_filters_process_state_t filter_state;
    LFE_WINDOW_HANDLE pWindow_state;
    const uint16_t *cum_freq_models[IVAS_MAX_NUM_QUANT_STRATS][IVAS_MAX_NUM_DCT_COEF_GROUPS];
    int16_t lfe_dec_indices_coeffs_tbl[IVAS_MAX_NUM_QUANT_STRATS][IVAS_MAX_NUM_DCT_COEF_GROUPS];
    float lfe_block_delay_s;
    int16_t lfe_prior_buf_len;
    float *prior_out_buffer;

    float *prevsynth_buf;
    float *lfe_delay_buf;
    int16_t lfe_addl_delay;
    int16_t bfi_count;

} LFE_DEC_DATA, *LFE_DEC_HANDLE;


/*----------------------------------------------------------------------------------*
 * Limiter structure