diff --git a/Workspace_msvc/lib_debug.vcxproj b/Workspace_msvc/lib_debug.vcxproj
index 5dc36d4633eb0aece3fd91393381e3d75c90a07e..59221f7427f81eef55b4fe1fee4bc150630dfdbe 100644
--- a/Workspace_msvc/lib_debug.vcxproj
+++ b/Workspace_msvc/lib_debug.vcxproj
@@ -145,7 +145,6 @@
-
@@ -166,4 +165,4 @@
-
+
\ No newline at end of file
diff --git a/apps/renderer.c b/apps/renderer.c
index 506830002c5b3a3a1b6b41814bb2dbf92b85008a..486ed4275728ab0bd99b5510e6c8497f5d92e6dc 100644
--- a/apps/renderer.c
+++ b/apps/renderer.c
@@ -62,25 +62,6 @@
#include
#include
-#ifndef count_malloc
-#ifdef RAM_COUNTING_TOOL
-#define count_malloc( n1 ) MALLOC_FCT_CALL( n1 )
-#define count_calloc( n1, n2 ) CALLOC_FCT_CALL( n1, n2 )
-#define count_free( ptr ) FREE_FCT_CALL( ptr )
-#else
-#define count_malloc( n1 ) malloc( n1 )
-#define count_calloc( n1, n2 ) calloc( n1, n2 )
-#define count_free( ptr ) free( ptr )
-#endif
-#endif
-
-#ifndef min
-#define min( x, y ) ( ( x ) < ( y ) ? ( x ) : ( y ) )
-#endif
-
-#ifndef max
-#define max( x, y ) ( ( x ) > ( y ) ? ( x ) : ( y ) )
-#endif
#define RENDERER_MAX_CLI_ARG_LENGTH ( FILENAME_MAX )
#define RENDERER_MAX_METADATA_LENGTH 8192
diff --git a/lib_com/bitstream.c b/lib_com/bitstream.c
index 0f32cf22bac9c2ac595b6d72df73ab3b61ab18b1..90f9b1f07ea2ef9aeeaf572100bc96ea9754b54d 100644
--- a/lib_com/bitstream.c
+++ b/lib_com/bitstream.c
@@ -2948,14 +2948,17 @@ void evs_dec_previewFrame(
void dtx_read_padding_bits(
DEC_CORE_HANDLE st,
- int16_t num_bits )
+ const int16_t num_bits )
{
/* TODO: temporary hack, need to decide what to do with core-coder bitrate */
int32_t tmp;
+
tmp = st->total_brate;
st->total_brate = st->total_brate + num_bits * FRAMES_PER_SEC;
get_next_indice( st, num_bits );
st->total_brate = tmp;
+
+ return;
}
#undef WMC_TOOL_MAN
diff --git a/lib_com/delay_comp.c b/lib_com/delay_comp.c
index 2801df4478f7e011a82dc963d311ba0625a96af3..6aa6a4d245219869622dd6b5f7a349f5e3c249b4 100644
--- a/lib_com/delay_comp.c
+++ b/lib_com/delay_comp.c
@@ -50,7 +50,6 @@
*--------------------------------------------------------------------------*/
/*! r: delay value in ns */
-
int32_t get_delay(
const int16_t enc_dec, /* i : encoder/decoder flag */
const int32_t io_fs, /* i : input/output sampling frequency */
@@ -116,12 +115,9 @@ int32_t get_delay(
}
/* compensate for Binaural renderer HRTF delay */
- {
- delay += binaural_latency_ns;
- }
+ delay += binaural_latency_ns;
#endif
}
}
-
return delay;
}
diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h
index 9b778c9f6cdfbc6113afac820c62f6ee984db168..fc3079c51f4c3faeef1b6311c67bc93a30bfd3c1 100644
--- a/lib_com/ivas_cnst.h
+++ b/lib_com/ivas_cnst.h
@@ -107,8 +107,8 @@ typedef enum
AUDIO_CONFIG_ISM2, /* ISM2 */
AUDIO_CONFIG_ISM3, /* ISM3 */
AUDIO_CONFIG_ISM4, /* ISM4 */
- AUDIO_CONFIG_MASA1, /* MASA1 */
- AUDIO_CONFIG_MASA2, /* MASA2 */
+ AUDIO_CONFIG_MASA1, /* MASA1 */ // TBV: seems not to be used
+ AUDIO_CONFIG_MASA2, /* MASA2 */ // TBV: seems not to be used
AUDIO_CONFIG_EXTERNAL /* external renderer */
} AUDIO_CONFIG;
@@ -191,8 +191,6 @@ typedef enum
#define IVAS_MAX_SBA_ORDER 3 /* Maximum supported Ambisonics order */
-#define IVAS_LIMITER_THRESHOLD 32729 /* -0.01 dBFS */
-#define IVAS_LIMITER_ATTACK_SECONDS 0.005f
#define IVAS_NUM_SUPPORTED_FS 3 /* number of supported sampling-rates in IVAS */
/*----------------------------------------------------------------------------------*
@@ -1378,7 +1376,7 @@ typedef enum
* TD Binaural Object renderer
*----------------------------------------------------------------------------------*/
-#define MAX_NUM_TDREND_CHANNELS 16 /* max. number of channels in TD renderer (objects or loudspeaker channels) */
+#define MAX_NUM_TDREND_CHANNELS MAX_CICP_CHANNELS /* max. number of channels in TD renderer (objects or loudspeaker channels) */
#define SFX_SPAT_BIN_MAX_NO_OF_OUTPUT_SAMPLES 288 /* 288 = 6 msec @ 48 kHz. */
#define HRTF_MODEL_N_SECTIONS 3 /* No. sections used in approximate evaluation of model */
@@ -1471,8 +1469,6 @@ typedef enum
#define RV_LENGTH_NR_FC ( RV_FILTER_MAX_FFT_SIZE / 2 ) + 1
#define IVAS_REVERB_DEFAULT_N_BANDS 31
-#define IVAS_REVERB_DEFAULT_PRE_DELAY 0.016f
-#define IVAS_REVERB_DEFAULT_INPUT_DELAY 0.1f
/*----------------------------------------------------------------------------------*
@@ -1593,6 +1589,15 @@ typedef enum
#define SPAR_DIRAC_DTX_BANDS ( SPAR_DTX_BANDS + DIRAC_DTX_BANDS )
#define CLDFB_PAR_WEIGHT_START_BAND 7
+
+/*----------------------------------------------------------------------------------*
+ * Limiter constants
+ *----------------------------------------------------------------------------------*/
+
+#define IVAS_LIMITER_THRESHOLD 32729 /* -0.01 dBFS */
+#define IVAS_LIMITER_ATTACK_SECONDS 0.005f
+
+
#endif
/* clang-format on */
/* IVAS_CNST_H */
diff --git a/lib_com/ivas_mdct_imdct.c b/lib_com/ivas_mdct_imdct.c
index 036f89201fb72f09a491a14b25aad764e6a4470a..06b393acb3913df17f16146129e639487baafb07 100644
--- a/lib_com/ivas_mdct_imdct.c
+++ b/lib_com/ivas_mdct_imdct.c
@@ -44,13 +44,14 @@
/*------------------------------------------------------------------------------------------*
* Local constants
*------------------------------------------------------------------------------------------*/
+
#define IVAS_IMDCT_SCALING_GAIN 2115.165304808f
/*-----------------------------------------------------------------------------------------*
* Function ivas_tda()
*
- * Time domain alias implementation
+ * Time domain aliasing
*-----------------------------------------------------------------------------------------*/
void ivas_tda(
@@ -67,6 +68,8 @@ void ivas_tda(
pOut[i] = -pIn[len_by_2 - i - 1] + pIn[len_by_2 + i];
pOut[len_by_2 + i] = pIn[length * 2 - i - 1] + pIn[length + i];
}
+
+ return;
}
diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h
index 59ada3de0eef59676f02eb0acf40704eefd52cf8..cc1a384e77deb764c91a0380349874fcca164937 100644
--- a/lib_com/ivas_prot.h
+++ b/lib_com/ivas_prot.h
@@ -105,28 +105,6 @@ ivas_error mct_enc_reconfigure(
Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */
const uint16_t b_nchan_change /* i : flag indicating different channel count */
);
-#ifdef SBA_BR_SWITCHING
-ivas_error ivas_sba_enc_reinit(
- Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */
-);
-#endif
-#ifdef SBA_BR_SWITCHING
-int16_t get_sba_reinit_flag(
- int32_t ivas_total_bitrate, /* i : Current bitrate */
- int32_t last_ivas_total_brate /* i : Previous bitrate */
-#ifdef SBA_BR_SWITCHING_2
- , int16_t sba_order
-#endif
-);
-#endif
-#ifdef SBA_BR_SWITCHING_2
-ivas_error ivas_spar_md_enc_init
-(
- ivas_spar_md_enc_state_t *hMdEnc, /* o : MD encoder handle */
- const ENCODER_CONFIG_HANDLE hEncoderConfig, /* i : configuration structure */
- const int16_t sba_order /* i : Ambisonic (SBA) order */
-);
-#endif
ivas_error ivas_sba_enc_reconfigure(
Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */
);
@@ -224,11 +202,11 @@ ivas_error pre_proc_front_ivas(
const int16_t force_front_vad, /* i : flag to force VAD decision */
#ifdef LOW_RATE_TRANS
const int16_t front_vad_dtx_flag, /* i : front-VAD DTX flag to overwrite VAD decision*/
- const int32_t ivas_total_brate, /* i : IVAS total bitrate */
- const int16_t ivas_format /* i : IVAS format */
+ const int32_t ivas_total_brate, /* i : IVAS total bitrate */
+ const int16_t ivas_format /* i : IVAS format */
#else
const int16_t front_vad_dtx_flag /* i : front-VAD DTX flag to overwrite VAD decision*/
- ,const int32_t ivas_total_brate /* i : IVAS total bitrate */
+ ,const int32_t ivas_total_brate /* i : IVAS total bitrate */
#endif
);
@@ -363,8 +341,8 @@ void ivas_mct_dec_close(
ivas_error ivas_corecoder_dec_reconfig(
#ifdef MC_BITRATE_SWITCHING
- Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
- const int16_t nSCE_old, /* i : number of SCEs in previous frame */
+ Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
+ const int16_t nSCE_old, /* i : number of SCEs in previous frame */
int16_t nCPE_old, /* i : number of CPEs in previous frame */
const int16_t nchan_transport_old, /* i : number of TCs in previous frame */
const int16_t sba_dirac_stereo_flag_old, /* i : signal stereo rendering using DFT upmix in previous frame */
@@ -766,6 +744,39 @@ void ivas_imdft(
const int16_t length /* i : signal length */
);
+void TonalMdctConceal_create_concealment_noise(
+ float concealment_noise[L_FRAME48k],
+ CPE_DEC_HANDLE hCPE,
+ const int16_t L_frameTCX,
+ const int16_t L_frame,
+ const int16_t idchan,
+ const int16_t subframe_idx,
+ const int16_t core,
+ const float crossfade_gain,
+ const TONALMDCTCONC_NOISE_GEN_MODE noise_gen_mode
+);
+
+void TonalMdctConceal_whiten_noise_shape(
+ Decoder_State *st,
+ const int16_t L_frame,
+ const TONALMDCTCONC_NOISE_SHAPE_WHITENING_MODE
+);
+
+/*! r: IGF start line */
+int16_t get_igf_startline(
+ Decoder_State *st, /* i : decoder state */
+ const int16_t L_frame, /* i : length of the frame */
+ const int16_t L_frameTCX /* i : full band frame length */
+);
+
+float rand_triangular_signed(
+ int16_t *seed );
+
+void dtx_read_padding_bits(
+ DEC_CORE_HANDLE st,
+ const int16_t num_bits
+);
+
/*----------------------------------------------------------------------------------*
* ISm prototypes
@@ -1167,8 +1178,7 @@ void stereo_dft_dec_read_BS(
void stereo_dft_dec_smooth_parameters(
STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: decoder DFT stereo handle */
- const int16_t prev_sid_nodata /* i : Previous SID/No data indicator */
- ,
+ const int16_t prev_sid_nodata, /* i : Previous SID/No data indicator */
const int16_t active_frame_counter, /* i : Active frame counter */
const int32_t element_brate /* i : Element bitrate */
);
@@ -2443,8 +2453,7 @@ void stereo_cng_upd_counters(
const int32_t element_mode, /* i : element mode */
const int16_t nbands, /* i : Number of bands in active */
const float sidSideGain[], /* i : SID side gains */
- const int16_t burst_ho_count /* i : Hang-over count */
- ,
+ const int16_t burst_ho_count, /* i : Hang-over count */
int16_t *coh_fade_counter /* i : Coherence fade counter */
);
@@ -2657,19 +2666,19 @@ int16_t read_GR0(
*----------------------------------------------------------------------------------*/
void ivas_mdct_core_whitening_enc(
- CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */
- float new_samples[CPE_CHANNELS][L_INP], /* i : new samples */
- float old_wsp[CPE_CHANNELS][L_WSP], /* i : 12.8kHz weighted speech (for LTP */
- float pitch_buf[CPE_CHANNELS][NB_SUBFR16k], /* o : floating pitch for each subframe */
- float *mdst_spectrum_long[CPE_CHANNELS], /* o : buffer for MDST spectrum */
- int16_t tnsBits[CPE_CHANNELS][NB_DIV], /* o : buffer TNS bits */
- float *orig_spectrum_long[CPE_CHANNELS], /* o : origingal spectrum w/o whitening */
- int16_t tnsSize[CPE_CHANNELS][NB_DIV], /* o : size of TNS */
- int16_t p_param[CPE_CHANNELS][NB_DIV], /* o : pointer to parameter array */
- BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
- int16_t *LFE_off, /* o : flag if LFE has content */
- const int16_t mct_on, /* i : flag mct block (1) or stereo (0) */
- const int16_t nChannels /* i : total number of coded channels */
+ CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */
+ float new_samples[CPE_CHANNELS][L_INP], /* i : new samples */
+ float old_wsp[CPE_CHANNELS][L_WSP], /* i : 12.8kHz weighted speech (for LTP */
+ float pitch_buf[CPE_CHANNELS][NB_SUBFR16k], /* o : floating pitch for each subframe */
+ float *mdst_spectrum_long[CPE_CHANNELS], /* o : buffer for MDST spectrum */
+ int16_t tnsBits[CPE_CHANNELS][NB_DIV], /* o : buffer TNS bits */
+ float *orig_spectrum_long[CPE_CHANNELS], /* o : origingal spectrum w/o whitening */
+ int16_t tnsSize[CPE_CHANNELS][NB_DIV], /* o : size of TNS */
+ int16_t p_param[CPE_CHANNELS][NB_DIV], /* o : pointer to parameter array */
+ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
+ int16_t *LFE_off, /* o : flag if LFE has content */
+ const int16_t mct_on, /* i : flag mct block (1) or stereo (0) */
+ const int16_t nChannels /* i : total number of coded channels */
);
void ivas_mct_core_enc(
@@ -2679,114 +2688,113 @@ void ivas_mct_core_enc(
const int16_t nChannels, /* i : number of channels to be coded */
const int32_t ivas_total_brate, /* i : IVAS total bitrate */
const int16_t switch_bw, /* i : flag bandwidth switch occurance */
- const int16_t lfe_bits /* i : bits spent for LFE */
- ,
+ const int16_t lfe_bits, /* i : bits spent for LFE */
const int16_t sba_order /* i : Ambisonic (SBA) order */
);
void ivas_mdct_quant_coder(
- CPE_ENC_HANDLE hCPE, /* i/o: Encoder CPE handle */
- const int16_t LFE_off, /* i : flag if LFE has content */
- int16_t tnsBits[CPE_CHANNELS][NB_DIV], /* i : bits needed for TNS parameters */
- int16_t tnsSize[CPE_CHANNELS][NB_DIV], /* i : size of TNS */
- int16_t p_param[CPE_CHANNELS][NB_DIV], /* i : pointer to parameter array */
+ CPE_ENC_HANDLE hCPE, /* i/o: Encoder CPE handle */
+ const int16_t LFE_off, /* i : flag if LFE has content */
+ int16_t tnsBits[CPE_CHANNELS][NB_DIV], /* i : bits needed for TNS parameters */
+ int16_t tnsSize[CPE_CHANNELS][NB_DIV], /* i : size of TNS */
+ int16_t p_param[CPE_CHANNELS][NB_DIV], /* i : pointer to parameter array */
const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0) */
);
void apply_MCT_enc(
- MCT_ENC_HANDLE hMCT, /* i/o: MCT encoder structure */
- Encoder_State **sts, /* i/o: encoder state structure */
- float *mdst_spectrum[MCT_MAX_CHANNELS][NB_DIV], /* i/o: MDST spectrum */
- float *inv_spectrum[MCT_MAX_CHANNELS][NB_DIV], /* i/o: inverse spectrum */
- float *inv_mdst_spectrum[MCT_MAX_CHANNELS][NB_DIV], /* i/o: inverse MDST spectrum */
- const int16_t nchan /* i : number of channels */
+ MCT_ENC_HANDLE hMCT, /* i/o: MCT encoder structure */
+ Encoder_State **sts, /* i/o: encoder state structure */
+ float *mdst_spectrum[MCT_MAX_CHANNELS][NB_DIV], /* i/o: MDST spectrum */
+ float *inv_spectrum[MCT_MAX_CHANNELS][NB_DIV], /* i/o: inverse spectrum */
+ float *inv_mdst_spectrum[MCT_MAX_CHANNELS][NB_DIV], /* i/o: inverse MDST spectrum */
+ const int16_t nchan /* i : number of channels */
);
void write_mct_bitstream(
- Encoder_State **sts, /* i/o: encoder state structure */
- MCT_ENC_HANDLE hMCT, /* i/o: MCT encoder structure */
- const int16_t nchan /* i : number of channels */
+ Encoder_State **sts, /* i/o: encoder state structure */
+ MCT_ENC_HANDLE hMCT, /* i/o: MCT encoder structure */
+ const int16_t nchan /* i : number of channels */
);
void splitAvailableBitsMCT(
- void **sts, /* i/o: encoder/decoder state structure */
- const int16_t total_bits, /* i : total number of available bits */
- const int16_t split_ratio[MCT_MAX_CHANNELS], /* i : ratio for splitting the bits */
- const int16_t enc_dec, /* i : encoder or decoder flag */
- const int16_t nchan /* i : number of channels */
+ void **sts, /* i/o: encoder/decoder state structure */
+ const int16_t total_bits, /* i : total number of available bits */
+ const int16_t split_ratio[MCT_MAX_CHANNELS], /* i : ratio for splitting the bits */
+ const int16_t enc_dec, /* i : encoder or decoder flag */
+ const int16_t nchan /* i : number of channels */
);
void getChannelEnergies(
- Encoder_State **sts, /* i : Encoder state structure */
- float nrg[MCT_MAX_CHANNELS], /* o : energies */
- const int16_t nchan /* i : number of channels */
+ Encoder_State **sts, /* i : Encoder state structure */
+ float nrg[MCT_MAX_CHANNELS], /* o : energies */
+ const int16_t nchan /* i : number of channels */
);
void mctStereoIGF_enc(
- MCT_ENC_HANDLE hMCT, /* i/o: MCT encoder structure */
- Encoder_State **sts, /* i/o: encoder state structure */
- float *orig_spectrum[MCT_MAX_CHANNELS][NB_DIV], /* i : MDCT spectrum for ITF */
+ MCT_ENC_HANDLE hMCT, /* i/o: MCT encoder structure */
+ Encoder_State **sts, /* i/o: encoder state structure */
+ float *orig_spectrum[MCT_MAX_CHANNELS][NB_DIV], /* i : MDCT spectrum for ITF */
float powerSpec[MCT_MAX_CHANNELS][L_FRAME48k], /* i/o: MDCT^2 + MDST^2 spectrum,or estimate */
float *powerSpecMsInv[MCT_MAX_CHANNELS][NB_DIV], /* i : same as above but for inverse spect. */
- float *inv_spectrum[MCT_MAX_CHANNELS][NB_DIV], /* i : inverse spectrum */
- const int16_t sp_aud_decision0[MCT_MAX_CHANNELS] /* i : speech audio decision */
+ float *inv_spectrum[MCT_MAX_CHANNELS][NB_DIV], /* i : inverse spectrum */
+ const int16_t sp_aud_decision0[MCT_MAX_CHANNELS] /* i : speech audio decision */
);
void ivas_mdct_dec_side_bits_frame_channel(
- CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */
- int16_t param_lpc[MCT_MAX_CHANNELS][NPRM_LPC_NEW], /* o : lpc_parameters */
- int16_t p_param[CPE_CHANNELS][NB_DIV], /* o : pointer to param buffer */
- Decoder_State *st0, /* i : pointer to bitstream handle */
- int16_t *LFE_off, /* o : flag if LFE has content */
- int16_t nTnsBitsTCX10[CPE_CHANNELS][NB_DIV], /* o : number of bits for TNS */
- int16_t param[CPE_CHANNELS][DEC_NPRM_DIV * NB_DIV], /* i/o: parameters buffer */
+ CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */
+ int16_t param_lpc[MCT_MAX_CHANNELS][NPRM_LPC_NEW], /* o : lpc_parameters */
+ int16_t p_param[CPE_CHANNELS][NB_DIV], /* o : pointer to param buffer */
+ Decoder_State *st0, /* i : pointer to bitstream handle */
+ int16_t *LFE_off, /* o : flag if LFE has content */
+ int16_t nTnsBitsTCX10[CPE_CHANNELS][NB_DIV], /* o : number of bits for TNS */
+ int16_t param[CPE_CHANNELS][DEC_NPRM_DIV * NB_DIV], /* i/o: parameters buffer */
const int16_t MCT_flag, /* i : hMCT handle allocated (1) or not (0) */
- const int16_t odd_channel_cpe /* i : flag cpe with odd nb of tc channels */
+ const int16_t odd_channel_cpe /* i : flag cpe with odd nb of tc channels */
);
void ivas_mct_side_bits(
- MCT_DEC_HANDLE hMCT, /* i/o: MCT decoder structure */
- CPE_DEC_HANDLE hCPE[MCT_MAX_BLOCKS], /* i/o: CPE decoder structure */
- const int16_t nCPE, /* i : number of CPEs */
- Decoder_State *st0, /* i : decoder handle for Bstr */
- const int16_t bfi, /* i : BFI flag */
- uint16_t *bitstream, /* o : bitstream indices */
- const int32_t ivas_total_brate, /* i : IVAS total bitrate */
- const int16_t nb_bits_metadata /* i : number of metadata bits */
+ MCT_DEC_HANDLE hMCT, /* i/o: MCT decoder structure */
+ CPE_DEC_HANDLE hCPE[MCT_MAX_BLOCKS], /* i/o: CPE decoder structure */
+ const int16_t nCPE, /* i : number of CPEs */
+ Decoder_State *st0, /* i : decoder handle for Bstr */
+ const int16_t bfi, /* i : BFI flag */
+ uint16_t *bitstream, /* o : bitstream indices */
+ const int32_t ivas_total_brate, /* i : IVAS total bitrate */
+ const int16_t nb_bits_metadata /* i : number of metadata bits */
);
void ivas_mdct_core_invQ(
- CPE_DEC_HANDLE hCPE, /* i/o: CPE handle */
- const int16_t LFE_off, /* i : flag if LFE content */
- int16_t nTnsBitsTCX10[CPE_CHANNELS][NB_DIV], /* i : number of TNS bits */
- int16_t p_param[CPE_CHANNELS][NB_DIV], /* i : pointer to param buffer */
- int16_t param_lpc[CPE_CHANNELS][NPRM_LPC_NEW], /* i : lpc parameters */
- int16_t param[CPE_CHANNELS][DEC_NPRM_DIV * NB_DIV], /* i : param buffer */
- int16_t fUseTns[CPE_CHANNELS][NB_DIV], /* i : flag TNS enabled */
- STnsData tnsData[CPE_CHANNELS][NB_DIV], /* i : TNS parameter */
- float *x_0[CPE_CHANNELS][NB_DIV], /* i/o: signal buffer */
- float *x[CPE_CHANNELS][NB_DIV], /* i/o: signal buffer */
- float Aq[CPE_CHANNELS][( NB_SUBFR16k + 1 ) * ( M + 1 )], /* i : LP coefficients */
- int16_t ms_mask[NB_DIV][MAX_SFB], /* i : M/S mask */
+ CPE_DEC_HANDLE hCPE, /* i/o: CPE handle */
+ const int16_t LFE_off, /* i : flag if LFE content */
+ int16_t nTnsBitsTCX10[CPE_CHANNELS][NB_DIV], /* i : number of TNS bits */
+ int16_t p_param[CPE_CHANNELS][NB_DIV], /* i : pointer to param buffer */
+ int16_t param_lpc[CPE_CHANNELS][NPRM_LPC_NEW], /* i : lpc parameters */
+ int16_t param[CPE_CHANNELS][DEC_NPRM_DIV * NB_DIV], /* i : param buffer */
+ int16_t fUseTns[CPE_CHANNELS][NB_DIV], /* i : flag TNS enabled */
+ STnsData tnsData[CPE_CHANNELS][NB_DIV], /* i : TNS parameter */
+ float *x_0[CPE_CHANNELS][NB_DIV], /* i/o: signal buffer */
+ float *x[CPE_CHANNELS][NB_DIV], /* i/o: signal buffer */
+ float Aq[CPE_CHANNELS][( NB_SUBFR16k + 1 ) * ( M + 1 )], /* i : LP coefficients */
+ int16_t ms_mask[NB_DIV][MAX_SFB], /* i : M/S mask */
const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0) */
);
void ivas_mdct_core_reconstruct(
- CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */
- float *x[][NB_DIV], /* i/o: pointers to synthesis @internal_FS */
- float signal_outFB[CPE_CHANNELS][L_FRAME_PLUS], /* o : synthesis @output_FS */
- const int16_t LFE_off, /* i : flag if LFE content */
- int16_t fUseTns[CPE_CHANNELS][NB_DIV], /* i : flage TNS enabled */
+ CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */
+ float *x[][NB_DIV], /* i/o: pointers to synthesis @internal_FS */
+ float signal_outFB[CPE_CHANNELS][L_FRAME_PLUS], /* o : synthesis @output_FS */
+ const int16_t LFE_off, /* i : flag if LFE content */
+ int16_t fUseTns[CPE_CHANNELS][NB_DIV], /* i : flage TNS enabled */
const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0) */
);
void ivas_mdct_core_tns_ns(
- CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */
- const int16_t LFE_off, /* i : flag if LFE has content */
+ CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */
+ const int16_t LFE_off, /* i : flag if LFE has content */
int16_t fUseTns[CPE_CHANNELS][NB_DIV], /* i : two entries for each channel in TCX10 */
- STnsData tnsData[CPE_CHANNELS][NB_DIV], /* o : TNS parameter */
- float *x[CPE_CHANNELS][NB_DIV], /* o : synthesis @internal_FS */
- float Aq[CPE_CHANNELS][( NB_SUBFR16k + 1 ) * ( M + 1 )], /* o : LP coefficients */
+ STnsData tnsData[CPE_CHANNELS][NB_DIV], /* o : TNS parameter */
+ float *x[CPE_CHANNELS][NB_DIV], /* o : synthesis @internal_FS */
+ float Aq[CPE_CHANNELS][( NB_SUBFR16k + 1 ) * ( M + 1 )], /* o : LP coefficients */
const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0) */
);
@@ -3079,13 +3087,12 @@ void ivas_dirac_param_est_enc(
float data_f[][L_FRAME48k],
float **pp_fr_real,
float **pp_fr_imag,
- const int16_t input_frame
- ,
+ const int16_t input_frame,
const SBA_MODE sba_mode
);
/*----------------------------------------------------------------------------------*
- * SBA mode prototypes
+ * SBA format prototypes
*----------------------------------------------------------------------------------*/
/*! r: SBA format mode */
@@ -3103,9 +3110,30 @@ void ivas_sba_config(
int16_t *nCPE, /* o : number of CPEs */
int16_t *element_mode /* o : element mode of the core coder */
);
+
+ivas_error ivas_sba_enc_reconfigure(
+ Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */
+);
+
#ifdef SBA_BR_SWITCHING
-ivas_error ivas_sba_dec_reinit(
- Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */
+ivas_error ivas_sba_enc_reinit(
+ Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */
+);
+
+int16_t get_sba_reinit_flag(
+ int32_t ivas_total_bitrate, /* i : Current bitrate */
+ int32_t last_ivas_total_brate /* i : Previous bitrate */
+#ifdef SBA_BR_SWITCHING_2
+ , const int16_t sba_order
+#endif
+);
+#endif
+#ifdef SBA_BR_SWITCHING_2
+ivas_error ivas_spar_md_enc_init
+(
+ ivas_spar_md_enc_state_t *hMdEnc, /* o : MD encoder handle */
+ const ENCODER_CONFIG_HANDLE hEncoderConfig, /* i : configuration structure */
+ const int16_t sba_order /* i : Ambisonic (SBA) order */
);
#endif
@@ -3113,6 +3141,13 @@ ivas_error ivas_sba_dec_reconfigure(
Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */
);
+#ifdef SBA_BR_SWITCHING
+ivas_error ivas_sba_dec_reinit(
+ Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */
+);
+#endif
+
+
void ivas_init_dec_get_num_cldfb_instances(
Decoder_Struct *st_ivas, /* i : IVAS decoder structure */
int16_t *numCldfbAnalyses, /* o : number of CLDFB analysis instances */
@@ -3235,14 +3270,14 @@ void ivas_dirac_enc_close(
);
void ivas_dirac_enc(
- DIRAC_ENC_HANDLE hDirAC, /* i/o: encoder DirAC handle */
- IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */
- BSTR_ENC_HANDLE hMetaData, /* i/o: Metadata bitstream handle */
- int16_t *nb_bits_metadata, /* o : number of metadata bits written */
- const int16_t Opt_DTX_ON, /* i : flag signaling DTX on */
+ DIRAC_ENC_HANDLE hDirAC, /* i/o: encoder DirAC handle */
+ IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */
+ BSTR_ENC_HANDLE hMetaData, /* i/o: Metadata bitstream handle */
+ int16_t *nb_bits_metadata, /* o : number of metadata bits written */
+ const int16_t Opt_DTX_ON, /* i : flag signaling DTX on */
float data_f[][L_FRAME48k], /* i/o: SBA channels */
- const int16_t input_frame, /* i : input frame length */
- const int16_t sba_planar /* i : SBA planar flag */
+ const int16_t input_frame, /* i : input frame length */
+ const int16_t sba_planar /* i : SBA planar flag */
);
ivas_error ivas_dirac_config(
@@ -4901,11 +4936,11 @@ void ivas_mcmasa_param_est_enc(
MCMASA_ENC_HANDLE hMcMasa, /* i/o: Encoder McMASA handle */
MASA_ENCODER_HANDLE hMasa, /* i/o: Encoder MASA handle */
float data_f[][L_FRAME48k], /* i : Input frame of audio */
- float elevation_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* o : Estimated elevation */
- float azimuth_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* o : Estimated azimuth */
+ float elevation_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* o : Estimated elevation */
+ float azimuth_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* o : Estimated azimuth */
float energyRatio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* o : Estimated direct-to-total ratio*/
- float spreadCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* o : Estimated spread coherence */
- float surroundingCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* o : Estimated surround coherence */
+ float spreadCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* o : Estimated spread coherence */
+ float surroundingCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* o : Estimated surround coherence */
const int16_t input_frame, /* i : Input frame size */
const int16_t nchan_inp /* i : Number of input channels */
);
@@ -4920,17 +4955,17 @@ void ivas_mcmasa_dmx_modify(
#endif
void v_multc_acc(
- const float x[], /* i : Input vector */
- const float c, /* i : Constant */
- float y[], /* o : Output vector that contains y + c*x */
- const int16_t N /* i : Vector length */
+ const float x[], /* i : Input vector */
+ const float c, /* i : Constant */
+ float y[], /* o : Output vector that contains y + c*x */
+ const int16_t N /* i : Vector length */
);
void lls_interp_n(
- float x[], /* i/o: input/output vector */
- const int16_t N, /* i : length of the input vector */
- float *a, /* o : calculated slope */
- float *b, /* o : calculated offset */
+ float x[], /* i/o: input/output vector */
+ const int16_t N, /* i : length of the input vector */
+ float *a, /* o : calculated slope */
+ float *b, /* o : calculated offset */
const int16_t upd /* i : use 1 to update x[] with the interpolated output*/
);
@@ -4940,14 +4975,13 @@ void computeReferencePower_enc(
float Cldfb_ImagBuffer[DIRAC_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX], /* i : Imag part of input signal */
float *reference_power, /* o : Estimated power */
const int16_t enc_param_start_band, /* i : first band to process */
- const int16_t num_freq_bands /* i : Number of frequency bands */
- ,
+ const int16_t num_freq_bands, /* i : Number of frequency bands */
const SBA_MODE sba_mode /* i : SBA mode */
);
ivas_error ivas_mono_dmx_renderer_open(
- Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */
+ Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */
);
void ivas_mono_downmix_render_passive(
@@ -5167,7 +5201,7 @@ ivas_error TDREND_SRC_Alloc(
);
void TDREND_SRC_Dealloc(
- TDREND_SRC_t *Src_p /* i/o: Source to deallocate */
+ TDREND_SRC_t *Src_p /* i/o: Source to deallocate */
);
void TDREND_SRC_Init(
@@ -5301,8 +5335,8 @@ void ivas_fb_mixer_pcm_ingest(
);
void ivas_dirac_enc_spar_delay_synchro(
- Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */
- const int16_t input_frame, /* i : input frame length */
+ Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */
+ const int16_t input_frame, /* i : input frame length */
float data_f[][L_FRAME48k] /* i/o: SBA channels (ACN / SN3D) */
);
@@ -5382,6 +5416,7 @@ ivas_error ivas_render_config_init_from_rom(
const int16_t room_flag_on /* i : room effect on/off flag */
);
+
/*----------------------------------------------------------------------------------*
* Reverberator
*----------------------------------------------------------------------------------*/
@@ -5580,7 +5615,10 @@ void ivas_reverb_get_hrtf_set_properties(
);
-/* Orientation tracking */
+/*----------------------------------------------------------------------------------*
+ * Orientation tracking
+ *----------------------------------------------------------------------------------*/
+
void ivas_orient_trk_Init(
ivas_orient_trk_state_t *pOTR
);
@@ -5608,37 +5646,7 @@ ivas_error ivas_orient_trk_GetTrackedOrientation(
float *roll
);
-void TonalMdctConceal_create_concealment_noise(
- float concealment_noise[L_FRAME48k],
- CPE_DEC_HANDLE hCPE,
- const int16_t L_frameTCX,
- const int16_t L_frame,
- const int16_t idchan,
- const int16_t subframe_idx,
- const int16_t core,
- const float crossfade_gain,
- const TONALMDCTCONC_NOISE_GEN_MODE noise_gen_mode
-);
-
-void TonalMdctConceal_whiten_noise_shape(
- Decoder_State *st,
- const int16_t L_frame,
- const TONALMDCTCONC_NOISE_SHAPE_WHITENING_MODE
-);
-
-int16_t get_igf_startline(
- Decoder_State *st,
- int16_t L_frame,
- int16_t L_frameTCX
-);
-
-float rand_triangular_signed(
- int16_t *seed );
/* clang-format on */
-void dtx_read_padding_bits(
- DEC_CORE_HANDLE st,
- int16_t num_bits );
-
#endif /* IVAS_PROT_H */
diff --git a/lib_com/ivas_sba_config.c b/lib_com/ivas_sba_config.c
index bf1c000acc5cf9fafa1ca24196dca89a56d0b3b7..6fff0e49ddf9f4f25acdbbe2ff7f510a3ef9657c 100644
--- a/lib_com/ivas_sba_config.c
+++ b/lib_com/ivas_sba_config.c
@@ -84,7 +84,7 @@ int16_t get_sba_reinit_flag(
int32_t last_ivas_total_brate /* i : Previous bitrate */
#ifdef SBA_BR_SWITCHING_2
,
- int16_t sba_order
+ const int16_t sba_order
#endif
)
{
diff --git a/lib_com/prot.h b/lib_com/prot.h
index c48cdcd912239ece419d6fc3ae28119186464e4e..d8508e5152882ee3e2178c9180bc58911e199130 100755
--- a/lib_com/prot.h
+++ b/lib_com/prot.h
@@ -3843,9 +3843,8 @@ int16_t dtx_hangover_addition(
const int16_t cldfb_subtraction, /* i : */
int16_t *vad_hover_flag, /* o : VAD hangover flag */
VAD_HANDLE hVAD, /* i/o: VAD handle for L or R channel */
- NOISE_EST_HANDLE hNoiseEst /* i : Noise estimation handle */
- ,
- int16_t *rem_dtx_ho /* o : Expected remaining hangover frames */
+ NOISE_EST_HANDLE hNoiseEst, /* i : Noise estimation handle */
+ int16_t *rem_dtx_ho /* o : Expected remaining hangover frames */
);
int16_t wb_vad(
@@ -7881,17 +7880,18 @@ void coder_tcx(
);
void coder_tcx_post(
- Encoder_State *st, /* i/o: decoder memory state */
- float *A,
- const float *Ai );
+ Encoder_State *st, /* i/o: encoder memory state */
+ float *A, /* o : Quantized LPC coefficients */
+ const float *Ai /* i : Unquantized (interpolated) LPC coefficients */
+);
void decoder_tcx(
- Decoder_State *st, /* i/o: coder memory state */
- int16_t prm[], /* i : parameters */
- float A[], /* i : coefficients NxAz[M+1] */
- Word16 Aind[], /* i : frame-independent coefficients Az[M+1]*/
- float synth[], /* i/o: synth[-M..lg] */
- float synthFB[],
+ Decoder_State *st, /* i/o: coder memory state */
+ int16_t prm[], /* i : parameters */
+ float A[], /* i : coefficients NxAz[M+1] */
+ Word16 Aind[], /* i : frame-independent coefficients Az[M+1]*/
+ float synth[], /* i/o: synth[-M..lg] */
+ float synthFB[], /* i/o: encoder memory state */
const int16_t bfi, /* i : Bad frame indicator */
const int16_t frame_cnt, /* i : frame counter in the super_frame */
const int16_t sba_dirac_stereo_flag /* i : signal stereo output for SBA DirAC */
@@ -7995,7 +7995,7 @@ void writeTCXparam(
const int16_t pre_past_flag );
void enc_prm_rf(
- Encoder_State *st, /* i/o: decoder memory state */
+ Encoder_State *st, /* i/o: encoder memory state */
const int16_t rf_frame_type,
const int16_t fec_offset );
diff --git a/lib_debug/segsnr.c b/lib_debug/segsnr.c
deleted file mode 100644
index 561a4e239d4987558e9c0346c44520ed35370466..0000000000000000000000000000000000000000
--- a/lib_debug/segsnr.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/******************************************************************************************************
-
- (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
- Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
- Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
- Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
- contributors to this repository. All Rights Reserved.
-
- This software is protected by copyright law and by international treaties.
- The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB,
- Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
- Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
- Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
- contributors to this repository retain full ownership rights in their respective contributions in
- the software. This notice grants no license of any kind, including but not limited to patent
- license, nor is any license granted by implication, estoppel or otherwise.
-
- Contributors are required to enter into the IVAS codec Public Collaboration agreement before making
- contributions.
-
- This software is provided "AS IS", without any express or implied warranties. The software is in the
- development stage. It is intended exclusively for experts who have experience with such software and
- solely for the purpose of inspection. All implied warranties of non-infringement, merchantability
- and fitness for a particular purpose are hereby disclaimed and excluded.
-
- Any dispute, controversy or claim arising under or in relation to providing this software shall be
- submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in
- accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and
- the United Nations Convention on Contracts on the International Sales of Goods.
-
-*******************************************************************************************************/
-
-#include
-#ifdef DEBUGGING
-#include "debug.h"
-#endif
-#include "wmops.h"
-#include
-#include "options.h"
-#include "prot.h"
-
-#define WMC_TOOL_MAN
-
-#ifdef OUTPUT_SNR
-/*_____________________________________________________________________
- | |
- | FUNCTION NAME segsnr |
- | Computes the segmential signal-to-noise ratio between the |
- | signal x and its estimate xe of length n samples. The segment |
- | length is nseg samples. |
- |
- | INPUT
- | x[0:n-1] Signal of n samples.
- | xe[0:n-1] Estimated signal of n samples.
- | n Signal length.
- | nseg Segment length, must be a submultiple of n.
- |
- | RETURN VALUE
- | snr Segmential signal to noise ratio in dB.
- |_____________________________________________________________________|
-*/
-
-float segsnr( float x[], float xe[], int16_t n, int16_t nseg )
-{
- float snr = 0.0f;
- float signal, noise, error, fac;
- int16_t i, j;
- LOOP( 1 );
- for ( i = 0; i < n; i += nseg )
- {
- signal = 1e-6f;
- MOVE( 2 );
- noise = 1e-6f;
- LOOP( 1 );
- for ( j = 0; j < nseg; j++ )
- {
- signal += ( *x ) * ( *x );
- MAC( 1 );
- error = *x++ - *xe++;
- ADD( 1 );
- noise += error * error;
- MAC( 1 );
- }
- snr += (float) log10( signal / noise );
- TRANS( 1 );
- DIV( 1 );
- ADD( 1 );
- }
- fac = ( (float) ( 10 * nseg ) ) / (float) n;
- DIV( 1 );
- MULT( 1 );
- snr = fac * snr;
- MULT( 1 );
- ADD( 1 );
- BRANCH( 1 );
- if ( snr < -99.0f )
- {
- snr = -99.0f;
- MOVE( 1 );
- }
- return ( snr );
-}
-#endif
diff --git a/lib_dec/igf_dec.c b/lib_dec/igf_dec.c
index 2cded759289c48a02e4c4c646508ea48e834d7a6..12c121d503fa1a58c45e11fc8e06bcab29a5a63e 100644
--- a/lib_dec/igf_dec.c
+++ b/lib_dec/igf_dec.c
@@ -1590,10 +1590,19 @@ void init_igf_dec(
return;
}
+
+/*-----------------------------------------------------------------------*
+ * get_igf_startline()
+ *
+ *
+ *-----------------------------------------------------------------------*/
+
+/*! r: IGF start line */
int16_t get_igf_startline(
- Decoder_State *st,
- int16_t L_frame,
- int16_t L_frameTCX )
+ Decoder_State *st, /* i : decoder state */
+ const int16_t L_frame, /* i : length of the frame */
+ const int16_t L_frameTCX /* i : full band frame length */
+)
{
int16_t igf_startline;
diff --git a/lib_dec/ivas_dirac_dec_binaural_functions.c b/lib_dec/ivas_dirac_dec_binaural_functions.c
index ee02a1bfe1c2f87b66515ce1451d2311811b3a62..1cbd6cdd8732bc81108c5959e17b69a076362a7f 100644
--- a/lib_dec/ivas_dirac_dec_binaural_functions.c
+++ b/lib_dec/ivas_dirac_dec_binaural_functions.c
@@ -599,7 +599,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric
{
uint8_t ch, slot, bin, subframe;
uint8_t separateCenterChannelRendering;
- int16_t nBins;
+ int16_t nBins, idx;
float frameMeanDiffusenessEneWeight[CLDFB_NO_CHANNELS_MAX];
DIRAC_DEC_HANDLE hDirAC;
DIRAC_DEC_BIN_HANDLE h;
@@ -609,7 +609,6 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric
uint8_t applyLowBitRateEQ;
int16_t dirac_read_idx;
-
hDirAC = st_ivas->hDirAC;
h = st_ivas->hDiracDecBin;
separateCenterChannelRendering = st_ivas->hOutSetup.separateChannelEnabled;
@@ -850,15 +849,16 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric
if ( ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) )
{
+ idx = min( bin, MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS - 1 );
+
/* Apply the target spectrum to the eneCorrectionFactor */
if ( separateCenterChannelRendering ) /* spreadCoh mostly originates from phantom sources in separate channel rendering mode */
{
- eneCorrectionFactor *= w1 * 1.0f + ( w2 + w3 ) * spreadCohEne1[min( bin, MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS - 1 )];
+ eneCorrectionFactor *= w1 * 1.0f + ( w2 + w3 ) * spreadCohEne1[idx];
}
else
{
- eneCorrectionFactor *= w1 * 1.0f + w2 * spreadCohEne05[min( bin, MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS - 1 )] +
- w3 * spreadCohEne1[min( bin, MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS - 1 )];
+ eneCorrectionFactor *= w1 * 1.0f + w2 * spreadCohEne05[idx] + w3 * spreadCohEne1[idx];
}
}
@@ -891,8 +891,9 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric
{
if ( !h->renderStereoOutputInsteadOfBinaural )
{
+ idx = min( bin, MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS - 1 );
/* Apply target spectrum that emphasizes low frequencies when the sound is surround coherent */
- diffEne *= ( 1.0f - surCoh ) + surCoh * surCohEne[min( bin, MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS - 1 )];
+ diffEne *= ( 1.0f - surCoh ) + surCoh * surCohEne[idx];
}
}
h->ChEneOut[0][bin] += diffEne; /* Diff ene part*/
diff --git a/lib_dec/ivas_qmetadata_dec.c b/lib_dec/ivas_qmetadata_dec.c
index 059ba752e7a019e9956ea3eee35b3e1ab20cf2e9..dbaca982b72c16323f916132bc6f7871234669f3 100644
--- a/lib_dec/ivas_qmetadata_dec.c
+++ b/lib_dec/ivas_qmetadata_dec.c
@@ -3114,7 +3114,7 @@ int16_t read_surround_coherence(
float error_ratio_surr;
int16_t idx_ER[MASA_MAXIMUM_CODING_SUBBANDS];
int16_t bits_sur_coherence, bits_GR;
- int16_t j, d, k;
+ int16_t j, d, k, idx;
uint16_t byteBuffer;
uint16_t idx_sur_coh[MASA_MAXIMUM_CODING_SUBBANDS];
IVAS_QDIRECTION *q_direction;
@@ -3133,7 +3133,8 @@ int16_t read_surround_coherence(
if ( hQMetaData->no_directions == 2 )
{
d += hQMetaData->twoDirBands[j];
- error_ratio_surr = 1.0f - q_direction[0].band_data[j].energy_ratio[0] - q_direction[1].band_data[max( d - 1, 0 )].energy_ratio[0] * hQMetaData->twoDirBands[j];
+ idx = max( d - 1, 0 );
+ error_ratio_surr = 1.0f - q_direction[0].band_data[j].energy_ratio[0] - q_direction[1].band_data[idx].energy_ratio[0] * hQMetaData->twoDirBands[j];
}
else
{
diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c
index 04e0217f8aee27e6f96673fa26e983a4800680a6..f7511fe356446774e20d9bdaccb5d5f0b0e33560 100644
--- a/lib_dec/ivas_sba_dec.c
+++ b/lib_dec/ivas_sba_dec.c
@@ -70,8 +70,8 @@ ivas_error ivas_sba_dec_reinit(
error = IVAS_ERR_OK;
- output_Fs = st_ivas->hDecoderConfig->output_Fs;
hDecoderConfig = st_ivas->hDecoderConfig;
+ output_Fs = hDecoderConfig->output_Fs;
output_config = hDecoderConfig->output_config;
ivas_total_brate = hDecoderConfig->ivas_total_brate;
@@ -90,7 +90,7 @@ ivas_error ivas_sba_dec_reinit(
{
if ( st_ivas->ivas_format == ISM_FORMAT )
{
- ivas_param_ism_dec_close( st_ivas->hDirAC, st_ivas->hDecoderConfig->output_config );
+ ivas_param_ism_dec_close( st_ivas->hDirAC, hDecoderConfig->output_config );
}
else
{
@@ -102,7 +102,7 @@ ivas_error ivas_sba_dec_reinit(
/* Spar handle */
if ( st_ivas->hSpar != NULL )
{
- ivas_spar_dec_close( st_ivas->hSpar, st_ivas->hDecoderConfig->output_Fs );
+ ivas_spar_dec_close( st_ivas->hSpar, hDecoderConfig->output_Fs );
st_ivas->hSpar = NULL;
}
@@ -247,7 +247,7 @@ ivas_error ivas_sba_dec_reinit(
*------------------------------------------------------------------------------------------*/
/* Allocate and initialize Custom loudspeaker layout handle */
- if ( st_ivas->hDecoderConfig->Opt_LsCustom )
+ if ( hDecoderConfig->Opt_LsCustom )
{
if ( ( error = ivas_ls_custom_open( &( st_ivas->hLsSetupCustom ) ) ) != IVAS_ERR_OK )
{
@@ -256,7 +256,7 @@ ivas_error ivas_sba_dec_reinit(
}
/* Allocate and initialize Head-Tracking handle */
- if ( st_ivas->hDecoderConfig->Opt_Headrotation )
+ if ( hDecoderConfig->Opt_Headrotation )
{
if ( ( error = ivas_headTrack_open( &( st_ivas->hHeadTrackData ) ) ) != IVAS_ERR_OK )
{
@@ -265,7 +265,7 @@ ivas_error ivas_sba_dec_reinit(
}
/* Allocate HRTF binary handle */
- if ( st_ivas->hDecoderConfig->Opt_HRTF_binary )
+ if ( hDecoderConfig->Opt_HRTF_binary )
{
if ( ( error = ivas_HRTF_binary_open( &( st_ivas->hHrtfTD ) ) ) != IVAS_ERR_OK )
{
@@ -321,7 +321,7 @@ ivas_error ivas_sba_dec_reinit(
st_ivas->hSpar->enc_param_start_band = min( IVAS_MAX_NUM_BANDS, SPAR_DIRAC_SPLIT_START_BAND );
- ivas_dirac_config_bands( band_grouping, IVAS_MAX_NUM_BANDS, (int16_t) ( st_ivas->hDecoderConfig->output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ),
+ ivas_dirac_config_bands( band_grouping, IVAS_MAX_NUM_BANDS, (int16_t) ( hDecoderConfig->output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ),
st_ivas->hSpar->dirac_to_spar_md_bands, st_ivas->hQMetaData->useLowerBandRes, st_ivas->hSpar->enc_param_start_band, 0 );
}
}
@@ -451,13 +451,13 @@ ivas_error ivas_sba_dec_reinit(
set_f( st_ivas->mem_hp20_out[i], 0.0f, L_HP20_MEM );
}
- if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_ROOM )
+ if ( hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL || hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_ROOM )
{
if ( ( error = ivas_render_config_open( &( st_ivas->hRenderConfig ) ) ) != IVAS_ERR_OK )
{
return error;
}
- if ( ivas_render_config_init_from_rom( &st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_ROOM ) != IVAS_ERR_OK )
+ if ( ivas_render_config_init_from_rom( &st_ivas->hRenderConfig, hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_ROOM ) != IVAS_ERR_OK )
{
return IVAS_ERR_INTERNAL_FATAL;
}
@@ -631,7 +631,7 @@ ivas_error ivas_sba_dec_reconfigure(
/* PCA handle */
if ( hSpar != NULL )
{
- if ( st_ivas->hDecoderConfig->ivas_total_brate == PCA_BRATE && sba_order_internal == 1 )
+ if ( hDecoderConfig->ivas_total_brate == PCA_BRATE && sba_order_internal == 1 )
{
if ( ( hSpar->hPCA = (PCA_DEC_STATE *) count_malloc( sizeof( PCA_DEC_STATE ) ) ) == NULL )
{
diff --git a/lib_dec/ivas_stereo_cng_dec.c b/lib_dec/ivas_stereo_cng_dec.c
index ac7f942b2a7bfcaa8a09624b7e0e1b4b74c64d18..6e375113800575c58259ed9db444a56bd926648e 100644
--- a/lib_dec/ivas_stereo_cng_dec.c
+++ b/lib_dec/ivas_stereo_cng_dec.c
@@ -175,6 +175,7 @@ void stereo_dft_dec_sid_coh(
}
dtx_read_padding_bits( st, ( IVAS_SID_5k2 - 4400 ) / FRAMES_PER_SEC );
+
return;
}
diff --git a/lib_dec/ivas_stereo_dft_dec.c b/lib_dec/ivas_stereo_dft_dec.c
index fbe01d15714bc938686ae70056fa8ff2fcfe1e0d..cf7783929c3db77ced091c8bebe3c7d4d02c9ec4 100644
--- a/lib_dec/ivas_stereo_dft_dec.c
+++ b/lib_dec/ivas_stereo_dft_dec.c
@@ -2760,10 +2760,9 @@ void stereo_dft_generate_res_pred(
void stereo_dft_dec_smooth_parameters(
STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: decoder DFT stereo handle */
- const int16_t prev_sid_nodata /* i : Previous SID/No data indicator */
- ,
- const int16_t active_frame_counter, /* i : Active frame counter */
- const int32_t element_brate /* i : Element bitrate */
+ const int16_t prev_sid_nodata, /* i : Previous SID/No data indicator */
+ const int16_t active_frame_counter, /* i : Active frame counter */
+ const int32_t element_brate /* i : Element bitrate */
)
{
int16_t k_offset, k, k2, b, N_div;
diff --git a/lib_dec/ivas_vbap.c b/lib_dec/ivas_vbap.c
index f0960bd1271a1472c20cb34721270416a359b7d7..f0da2623aad77f1f4ac550f224e1efeaa07c7f24 100644
--- a/lib_dec/ivas_vbap.c
+++ b/lib_dec/ivas_vbap.c
@@ -662,8 +662,7 @@ static void determine_virtual_speaker_node_division_gains(
are distributed to all neighboring real speaker nodes. An amplitude-division
instead of energy division is utilized just in case to avoid excessive emphasis
on the coherent distributed sound. */
- int16_t c;
- int16_t ch;
+ int16_t c, ch;
float sum_val;
if ( type == VIRTUAL_SPEAKER_NODE_DISTRIBUTE_ENERGY )
@@ -715,7 +714,7 @@ static void determine_virtual_speaker_node_division_gains(
/*! r: virtual speaker node type */
static enum VirtualSpeakerNodeType check_need_of_virtual_speaker_node(
VBAP_HANDLE hVBAPdata, /* i/o: VBAP structure */
- const float *speaker_node_azi_deg, /* i : vector of speaker node azimuths */
+ const float *speaker_node_azi_deg, /* i : vector of speaker node azimuths */
const float *speaker_node_ele_deg, /* i : vector of speaker node elevations */
enum SpeakerNodeGroup group /* i : group of speaker nodes where this belongs */
)
@@ -945,9 +944,9 @@ static void matrix_inverse_3x3(
*-------------------------------------------------------------------------*/
static int16_t check_and_store_triplet(
- int16_t chA, /* i : first channel index that forms the loudspeaker triplet */
- int16_t chB, /* i : second channel index that forms the loudspeaker triplet */
- int16_t chC, /* i : third channel index that forms the loudspeaker triplet */
+ const int16_t chA, /* i : first channel index that forms the loudspeaker triplet */
+ const int16_t chB, /* i : second channel index that forms the loudspeaker triplet */
+ const int16_t chC, /* i : third channel index that forms the loudspeaker triplet */
const int16_t num_speaker_nodes, /* i : number of speaker nodes */
const VBAP_SPEAKER_NODE *speaker_node_data, /* i : speaker node data structure */
VBAP_VS_TRIPLET *triplets, /* o : vector of virtual surface triplets */
diff --git a/lib_enc/cod_tcx.c b/lib_enc/cod_tcx.c
index f60ac1a3143e796a7c613cfc3a0e9c5e7b8d5fc9..5813ca413870da1e53229f4f26347d0c39ed8db2 100644
--- a/lib_enc/cod_tcx.c
+++ b/lib_enc/cod_tcx.c
@@ -2181,9 +2181,10 @@ void coder_tcx(
*-------------------------------------------------------------------*/
void coder_tcx_post(
- Encoder_State *st,
- float *A,
- const float *Ai )
+ Encoder_State *st, /* i/o: encoder memory state */
+ float *A, /* o : Quantized LPC coefficients */
+ const float *Ai /* i : Unquantized (interpolated) LPC coefficients */
+)
{
float xn_buf[L_FRAME_MAX];
diff --git a/lib_enc/enc_pit_exc.c b/lib_enc/enc_pit_exc.c
index 900d4021d0632090c71580301ac6ac157d76763a..d4e20f5cc531ba0871ae192d2651cbed5c004cd9 100644
--- a/lib_enc/enc_pit_exc.c
+++ b/lib_enc/enc_pit_exc.c
@@ -64,8 +64,8 @@ void enc_pit_exc(
float *pitch_buf, /* i/o: Fractionnal per subframe pitch */
const int16_t nb_subfr, /* i : Number of subframe considered */
float *gpit, /* o : pitch mean gpit */
- const int16_t tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag */
- const float tdm_Pri_pitch_buf[] /* i : primary channel pitch buffer */
+ const int16_t tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag */
+ const float tdm_Pri_pitch_buf[] /* i : primary channel pitch buffer */
)
{
float xn[PIT_EXC_L_SUBFR]; /* Target vector for pitch search */
diff --git a/lib_enc/ivas_agc_enc.c b/lib_enc/ivas_agc_enc.c
index d8d0f1f772761740e7c8077ffbd420b7cfe1c04e..9ebe2bb93859ced870d20a5a0b780a34fbe5944f 100644
--- a/lib_enc/ivas_agc_enc.c
+++ b/lib_enc/ivas_agc_enc.c
@@ -329,7 +329,8 @@ void ivas_agc_enc_process(
{
int16_t isCompensated = FALSE;
actualMaxAbsVal = pState->gain_state[i].lastMaxAbs * pState->gain_state[i].lastGain;
- pState->gain_state[i].gainExpVal = (int16_t) ceilf( -logf( actualMaxAbsVal * MDFT_NORM_SCALING ) / logf( pState->agc_com.winFunc[min( offset - 1, MaxAbsValIdx )] ) );
+ idx = min( offset - 1, MaxAbsValIdx );
+ pState->gain_state[i].gainExpVal = (int16_t) ceilf( -logf( actualMaxAbsVal * MDFT_NORM_SCALING ) / logf( pState->agc_com.winFunc[idx] ) );
while ( !isCompensated )
{
diff --git a/lib_enc/ivas_core_pre_proc_front.c b/lib_enc/ivas_core_pre_proc_front.c
index fffec70b0540443fe625c81393ba599b34705450..195ae482d3fbe8c808dbb55b2e9dbe85e9dc0f70 100644
--- a/lib_enc/ivas_core_pre_proc_front.c
+++ b/lib_enc/ivas_core_pre_proc_front.c
@@ -110,12 +110,11 @@ ivas_error pre_proc_front_ivas(
const int16_t force_front_vad, /* i : flag to force VAD decision */
#ifdef LOW_RATE_TRANS
const int16_t front_vad_dtx_flag, /* i : front-VAD DTX flag to overwrite VAD decision*/
- const int32_t ivas_total_brate, /* i : IVAS total bitrate - for setting the DTX */
- const int16_t ivas_format /* i : IVAS format */
+ const int32_t ivas_total_brate, /* i : IVAS total bitrate - for setting the DTX */
+ const int16_t ivas_format /* i : IVAS format */
#else
- const int16_t front_vad_dtx_flag /* i : front-VAD DTX flag to overwrite VAD decision*/
- ,
- const int32_t ivas_total_brate /* i : IVAS total bitrate - for setting the DTX */
+ const int16_t front_vad_dtx_flag, /* i : front-VAD DTX flag to overwrite VAD decision*/
+ const int32_t ivas_total_brate /* i : IVAS total bitrate - for setting the DTX */
#endif
)
{
diff --git a/lib_enc/ivas_mct_core_enc.c b/lib_enc/ivas_mct_core_enc.c
index 379a1c8358619330b8a92382a8472d500ea7bfc6..614059aa27b188c2e6c5ff1d96f998f57b2bb8db 100644
--- a/lib_enc/ivas_mct_core_enc.c
+++ b/lib_enc/ivas_mct_core_enc.c
@@ -114,11 +114,10 @@ static void FindChannelRatio(
static void AdjustChannelRatios(
int16_t chBitRatios[MCT_MAX_CHANNELS], /* o : bit-disctribution channel ratios */
- const int16_t nChannels /* i/o: number of channels */
- ,
- const int32_t ivas_total_brate, /* i : IVAS total bitrate */
- const int16_t nAvailBits, /* i : number of available bits */
- const int16_t sba_order /* i : Ambisonic (SBA) order */
+ const int16_t nChannels, /* i/o: number of channels */
+ const int32_t ivas_total_brate, /* i : IVAS total bitrate */
+ const int16_t nAvailBits, /* i : number of available bits */
+ const int16_t sba_order /* i : Ambisonic (SBA) order */
)
{
int16_t force_ch_bit_ratios[IVAS_SPAR_MAX_DMX_CHS];
@@ -196,9 +195,8 @@ void ivas_mct_core_enc(
const int16_t nChannels, /* i : number of channels to be coded */
const int32_t ivas_total_brate, /* i : IVAS total bitrate */
const int16_t switch_bw, /* i : flag bandwidth switch occurance */
- const int16_t lfe_bits /* i : bits spent for LFE */
- ,
- const int16_t sba_order /* i : Ambisonic (SBA) order */
+ const int16_t lfe_bits, /* i : bits spent for LFE */
+ const int16_t sba_order /* i : Ambisonic (SBA) order */
)
{
int16_t ch, ch_core, nSubframes, L_subframeTCX;
diff --git a/lib_enc/ivas_qmetadata_enc.c b/lib_enc/ivas_qmetadata_enc.c
index c9f0bd70ff6dab1a2287483a3b3ef2735d9443f7..7f79df39877b68e0e3e9e400ae565b584f901513 100644
--- a/lib_enc/ivas_qmetadata_enc.c
+++ b/lib_enc/ivas_qmetadata_enc.c
@@ -4056,27 +4056,24 @@ static int16_t encode_spread_coherence_1sf(
BSTR_ENC_HANDLE hMasaMetaData /* i/o: metadata bitstream handle */
)
{
- int16_t i, j;
+ int16_t i, j, k;
int16_t idx_ER;
int16_t nbits, nbits_fr;
uint16_t idx_sp_coh[MASA_MAXIMUM_CODING_SUBBANDS];
uint16_t mr_idx_sp_coh[MASA_MAXIMUM_CODING_SUBBANDS];
int16_t GR_ord, bits_GR;
- uint64_t idx;
+ uint64_t idx, idx1;
int16_t no_idx16;
- int16_t k;
int16_t no_cv[MASA_MAXIMUM_CODING_SUBBANDS];
IVAS_QDIRECTION *q_direction;
- int16_t half_coding_subbands, nbits_fr1;
- uint64_t idx1;
- uint8_t coding_subbands;
+ int16_t half_coding_subbands, nbits_fr1, coding_subbands;
uint16_t idx_sp_coh_shift[MASA_MAXIMUM_CODING_SUBBANDS];
uint8_t idx_shift;
int16_t max_val = 0, nbits_max;
int16_t extra_cv;
int16_t no_cv_shift[MASA_MAXIMUM_CODING_SUBBANDS], min_idx;
- coding_subbands = (uint8_t) ( q_metadata->q_direction[idx_d].cfg.nbands );
+ coding_subbands = q_metadata->q_direction[idx_d].cfg.nbands;
q_direction = &( q_metadata->q_direction[idx_d] );
nbits = 0;
GR_ord = 1;
@@ -4237,28 +4234,25 @@ static int16_t encode_surround_coherence(
BSTR_ENC_HANDLE hMetaData /* i/o: metadata bitstream handle */
)
{
- int16_t i, j;
- int16_t idx_ER;
+ int16_t i, j, k;
+ int16_t idx_ER, idx16;
int16_t nbits, nbits_fr;
uint16_t idx_sur_coh[MASA_MAXIMUM_CODING_SUBBANDS];
uint16_t mr_idx_sur_coh[MASA_MAXIMUM_CODING_SUBBANDS];
int16_t GR_ord, bits_GR;
- uint64_t idx;
+ uint64_t idx, idx1;
int16_t no_idx16;
- int16_t k;
int16_t no_cv[MASA_MAXIMUM_CODING_SUBBANDS];
float error_ratio_surr;
IVAS_QDIRECTION *q_direction;
- int16_t half_coding_subbands, nbits_fr1;
- uint64_t idx1;
- uint8_t coding_subbands;
+ int16_t half_coding_subbands, nbits_fr1, coding_subbands;
int16_t all_coherence_zero;
uint16_t idx_sur_coh_shift[MASA_MAXIMUM_CODING_SUBBANDS];
uint8_t idx_shift;
int16_t max_val = 0, nbits_max;
int16_t no_cv_shift[MASA_MAXIMUM_CODING_SUBBANDS], min_idx;
- coding_subbands = (uint8_t) ( hQMetaData->q_direction[0].cfg.nbands );
+ coding_subbands = hQMetaData->q_direction[0].cfg.nbands;
all_coherence_zero = hQMetaData->all_coherence_zero;
q_direction = &( hQMetaData->q_direction[0] );
nbits = 0;
@@ -4277,7 +4271,8 @@ static int16_t encode_surround_coherence(
if ( hQMetaData->no_directions == 2 )
{
k += hQMetaData->twoDirBands[j];
- error_ratio_surr = 1.0f - q_direction[0].band_data[j].energy_ratio[0] - q_direction[1].band_data[max( k - 1, 0 )].energy_ratio[0] * hQMetaData->twoDirBands[j];
+ idx16 = max( k - 1, 0 );
+ error_ratio_surr = 1.0f - q_direction[0].band_data[j].energy_ratio[0] - q_direction[1].band_data[idx16].energy_ratio[0] * hQMetaData->twoDirBands[j];
}
else
{
diff --git a/lib_enc/ivas_sba_enc.c b/lib_enc/ivas_sba_enc.c
index ca4d309c5e822ec814549d39e26c119c0bc545a9..fd37c67825004aa79fdbe1556995e1e7a7e10f1f 100644
--- a/lib_enc/ivas_sba_enc.c
+++ b/lib_enc/ivas_sba_enc.c
@@ -328,15 +328,14 @@ ivas_error ivas_sba_enc_reconfigure(
int16_t nSCE_old, nCPE_old, nchan_transport_old;
int32_t ivas_total_brate;
ivas_error error;
+ ENCODER_CONFIG_HANDLE hEncoderConfig;
error = IVAS_ERR_OK;
- ivas_total_brate = st_ivas->hEncoderConfig->ivas_total_brate;
-#ifdef SBA_BR_SWITCHING_2
- ENCODER_CONFIG_HANDLE hEncoderConfig;
hEncoderConfig = st_ivas->hEncoderConfig;
-#endif
- if ( ivas_total_brate != st_ivas->hEncoderConfig->last_ivas_total_brate )
+ ivas_total_brate = hEncoderConfig->ivas_total_brate;
+
+ if ( ivas_total_brate != hEncoderConfig->last_ivas_total_brate )
{
#ifdef SBA_BR_SWITCHING_2
DIRAC_ENC_HANDLE hDirAC = st_ivas->hDirAC;
@@ -346,7 +345,8 @@ ivas_error ivas_sba_enc_reconfigure(
nCPE_old = st_ivas->nCPE;
nSCE_old = st_ivas->nSCE;
- st_ivas->sba_analysis_order = ivas_sba_get_analysis_order( ivas_total_brate, st_ivas->hEncoderConfig->sba_order );
+ st_ivas->sba_analysis_order = ivas_sba_get_analysis_order( ivas_total_brate, hEncoderConfig->sba_order );
+
#ifdef SBA_BR_SWITCHING_2
st_ivas->sba_mode = ivas_sba_mode_select( ivas_total_brate );
diff --git a/lib_enc/ivas_stereo_cng_enc.c b/lib_enc/ivas_stereo_cng_enc.c
index ca15794cc05903b5e45eea6b3d501afb4cabe9a3..ea75419724f130c1131f140ca5aace5804f7a483 100644
--- a/lib_enc/ivas_stereo_cng_enc.c
+++ b/lib_enc/ivas_stereo_cng_enc.c
@@ -491,9 +491,8 @@ void stereo_cng_upd_counters(
const int32_t element_mode, /* i : element mode */
const int16_t nbands, /* i : Number of bands in active */
const float sidSideGain[], /* i : SID side gains */
- const int16_t burst_ho_count /* i : Hang-over count */
- ,
- int16_t *coh_fade_counter /* i : Coherence fade counter */
+ const int16_t burst_ho_count, /* i : Hang-over count */
+ int16_t *coh_fade_counter /* i : Coherence fade counter */
)
{
int16_t b;
diff --git a/lib_enc/nois_est.c b/lib_enc/nois_est.c
index b8d551a738cea3cb7eb59d1949dfcfe5bb3fd2e2..ad07d46945ce5c8a77b462a7f57113beb089cb8a 100644
--- a/lib_enc/nois_est.c
+++ b/lib_enc/nois_est.c
@@ -232,7 +232,7 @@ void noise_est_pre(
/*-----------------------------------------------------------------*
* noise_est_down()
*
- * Down-ward noise udatation routine
+ * Down-ward noise updatation routine
* Total Noise computation, relative frame Energy computation
* Noise energy update - here, the energy is updated only if it is
* decreasing to improve noise suppression. Otherwise, the noise
diff --git a/lib_enc/vad.c b/lib_enc/vad.c
index 5379f86dc0c10689760db6bff312919b88779230..1812085689ab45ae8462c8e0aeb17b11a56a93f3 100644
--- a/lib_enc/vad.c
+++ b/lib_enc/vad.c
@@ -155,15 +155,14 @@ static void sign_thr_snr_acc(
*-----------------------------------------------------------------*/
int16_t dtx_hangover_addition(
- Encoder_State *st, /* i/o: encoder state structure */
- const int16_t vad_flag, /* i : VAD flag */
- const float lp_snr, /* i : input single SNR estimate */
- const int16_t cldfb_subtraction, /* i : */
- int16_t *vad_hover_flag, /* o : VAD hangover flag */
- VAD_HANDLE hVAD, /* i/o: VAD handle for L or R channel */
- NOISE_EST_HANDLE hNoiseEst /* i : Noise estimation handle */
- ,
- int16_t *rem_dtx_ho /* o : Expected remaining hangover frames */
+ Encoder_State *st, /* i/o: encoder state structure */
+ const int16_t vad_flag, /* i : VAD flag */
+ const float lp_snr, /* i : input single SNR estimate */
+ const int16_t cldfb_subtraction, /* i : */
+ int16_t *vad_hover_flag, /* o : VAD hangover flag */
+ VAD_HANDLE hVAD, /* i/o: VAD handle for L or R channel */
+ NOISE_EST_HANDLE hNoiseEst, /* i : Noise estimation handle */
+ int16_t *rem_dtx_ho /* o : Expected remaining hangover frames */
)
{
int16_t hangover_short_dtx, flag_dtx;
diff --git a/lib_rend/ivas_render_config.c b/lib_rend/ivas_render_config.c
index 7e8caec0923edf621f999fddf75cc29a954c049c..73cf4d91407b7e538200ab4b0c542d70160fc754 100644
--- a/lib_rend/ivas_render_config.c
+++ b/lib_rend/ivas_render_config.c
@@ -42,6 +42,14 @@
#include "wmops.h"
+/*-----------------------------------------------------------------------*
+ * Local constants
+ *-----------------------------------------------------------------------*/
+
+#define IVAS_REVERB_DEFAULT_PRE_DELAY 0.016f
+#define IVAS_REVERB_DEFAULT_INPUT_DELAY 0.1f
+
+
/*-----------------------------------------------------------------------*
* ivas_render_config_open()
*
diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c
index 1a7cd8b830bbcf123b5d305bbed4fdf6956dcff2..60cbb5e9b834b3aad9bc20368eb814cca7974d3b 100644
--- a/lib_rend/ivas_rotation.c
+++ b/lib_rend/ivas_rotation.c
@@ -157,10 +157,10 @@ void QuatToRotMat(
*------------------------------------------------------------------------*/
void Quat2Euler(
- const IVAS_QUATERNION quat, /* i : quaternion describing the rotation */
- float *yaw, /* o : yaw */
- float *pitch, /* o : pitch */
- float *roll /* o : roll */
+ const IVAS_QUATERNION quat, /* i : quaternion describing the rotation */
+ float *yaw, /* o : yaw */
+ float *pitch, /* o : pitch */
+ float *roll /* o : roll */
)
{
if ( quat.w != -3.0 )
@@ -785,14 +785,13 @@ static float SHrot_v(
float R_lm1[HEADROT_SHMAT_DIM][HEADROT_SHMAT_DIM] )
{
- float d = 0.0f;
- float p0 = 0.0f, p1 = 0.0f;
+ float result, d, p0, p1;
if ( m == 0 )
{
p0 = SHrot_p( 1, l, 1, n, SHrotmat, R_lm1 );
p1 = SHrot_p( -1, l, -1, n, SHrotmat, R_lm1 );
- return p0 + p1;
+ result = p0 + p1;
}
else
{
@@ -801,16 +800,18 @@ static float SHrot_v(
d = ( m == 1 ) ? 1.0f : 0.0f;
p0 = SHrot_p( 1, l, m - 1, n, SHrotmat, R_lm1 );
p1 = SHrot_p( -1, l, -m + 1, n, SHrotmat, R_lm1 );
- return p0 * sqrtf( 1.0f + d ) - p1 * ( 1.0f - d );
+ result = p0 * sqrtf( 1.0f + d ) - p1 * ( 1.0f - d );
}
else
{
d = ( m == -1 ) ? 1.0f : 0.0f;
p0 = SHrot_p( 1, l, m + 1, n, SHrotmat, R_lm1 );
p1 = SHrot_p( -1, l, -m - 1, n, SHrotmat, R_lm1 );
- return p0 * ( 1.0f - d ) + p1 * sqrtf( 1.0f + d );
+ result = p0 * ( 1.0f - d ) + p1 * sqrtf( 1.0f + d );
}
}
+
+ return result;
}
static float SHrot_w(
@@ -820,13 +821,12 @@ static float SHrot_w(
float SHrotmat[HEADROT_SHMAT_DIM][HEADROT_SHMAT_DIM],
float R_lm1[HEADROT_SHMAT_DIM][HEADROT_SHMAT_DIM] )
{
- float p0 = 0.0f;
- float p1 = 0.0f;
+ float result, p0, p1;
if ( m == 0 )
{
printf( "ERROR should not be called\n" );
- return 0.0;
+ return 0.0f;
}
else
{
@@ -834,17 +834,26 @@ static float SHrot_w(
{
p0 = SHrot_p( 1, l, m + 1, n, SHrotmat, R_lm1 );
p1 = SHrot_p( -1, l, -m - 1, n, SHrotmat, R_lm1 );
- return p0 + p1;
+ result = p0 + p1;
}
else
{
p0 = SHrot_p( 1, l, m - 1, n, SHrotmat, R_lm1 );
p1 = SHrot_p( -1, l, -m + 1, n, SHrotmat, R_lm1 );
- return p0 - p1;
+ result = p0 - p1;
}
}
+
+ return result;
}
+
+/*-------------------------------------------------------------------------
+ * rotateFrame_sd_cldfb()
+ *
+ *
+ *------------------------------------------------------------------------*/
+
void SHrotmatgen(
float SHrotmat[HEADROT_SHMAT_DIM][HEADROT_SHMAT_DIM], /* o : rotation matrix in SHD */
float Rmat[3][3], /* i : real-space rotation matrix */
diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c
index f682a0731f2be910dd4601ce6a5d879f1b92049e..e62cf8c845b4092478227bdbf04a44fb9bf5de88 100644
--- a/lib_rend/lib_rend.c
+++ b/lib_rend/lib_rend.c
@@ -463,8 +463,10 @@ AUDIO_CONFIG getIvasAudioConfigFromRendAudioConfig(
case IVAS_REND_AUDIO_CONFIG_HOA3:
return AUDIO_CONFIG_HOA3;
default:
- return AUDIO_CONFIG_INVALID;
+ break;
}
+
+ return AUDIO_CONFIG_INVALID;
}
static ivas_error initLimiter(