Skip to content
......@@ -124,6 +124,7 @@ typedef struct
/*----------------------------------------------------------------------------------*
* PARAMETRIC ISM encoder/decoder (common) structure
*----------------------------------------------------------------------------------*/
typedef struct ivas_param_ism_data_structure
{
int16_t nbands;
......@@ -238,7 +239,6 @@ typedef struct ivas_spar_md_com_cfg
int16_t active_w;
int16_t remix_unmix_order;
ivas_quant_strat_t quant_strat[MAX_QUANT_STRATS];
int16_t gen_bs;
int16_t quant_strat_bits;
int16_t nchan_transport;
int16_t num_quant_strats;
......@@ -361,13 +361,6 @@ typedef struct ivas_cov_smooth_cfg_t
} ivas_cov_smooth_cfg_t;
typedef struct ivas_cov_smooth_in_buf_t
{
float *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH];
int16_t num_ch;
int16_t reset_cov;
} ivas_cov_smooth_in_buf_t;
/* SPAR bitrate constant table structure */
typedef struct ivas_spar_br_table_t
......@@ -381,11 +374,12 @@ typedef struct ivas_spar_br_table_t
ivas_spar_pmx_strings_t dmx_str;
int16_t active_w;
int16_t tmode;
int32_t evs_brs[FOA_CHANNELS][3];
int32_t core_brs[FOA_CHANNELS][3];
int16_t q_lvls[MAX_QUANT_STRATS][NUM_MD_Q_COEFS_SET];
int16_t td_ducking;
int16_t agc_bits_ch_idx; /* 0-3, Indicates core-coder channel index from which AGC bits have been taken from*/
int16_t usePlanarCoeff;
} ivas_spar_br_table_t;
......@@ -487,6 +481,7 @@ typedef struct ivas_qdirection_band_data_struct
uint16_t elevation_index[MAX_PARAM_SPATIAL_SUBFRAMES];
float q_azimuth[MAX_PARAM_SPATIAL_SUBFRAMES];
float q_elevation[MAX_PARAM_SPATIAL_SUBFRAMES];
} IVAS_QDIRECTION_BAND_DATA;
typedef struct ivas_qdirection_band_coherence_data_struct
......@@ -539,6 +534,7 @@ typedef struct ivas_masa_qmetadata_frame_struct
int16_t ec_flag;
float dir_comp_ratio;
uint8_t is_masa_ivas_format;
} IVAS_QMETADATA, *IVAS_QMETADATA_HANDLE;
......@@ -746,7 +742,6 @@ typedef struct ivas_fb_mixer_state_structure
float cldfb_cross_fade[CLDFB_NO_COL_MAX];
int16_t cldfb_cross_fade_start;
int16_t cldfb_cross_fade_end;
int16_t cldfb_latency;
int16_t first_frame[IVAS_SPAR_MAX_CH];
......
......@@ -82,7 +82,7 @@ void stereo_dft_config(
hConfig->res_cod_mode = STEREO_DFT_RES_COD_OFF;
}
}
else if ( brate == IVAS_SID_4k4 )
else if ( brate == IVAS_SID_5k2 )
{
*bits_frame_nominal = SID_2k40 / FRAMES_PER_SEC;
if ( hConfig != NULL )
......
......@@ -68,9 +68,6 @@ static void SpectrumWeighting_Init(
* initialize a PsychoacousticParameters structure
*-------------------------------------------------------------------*/
#ifndef FIX_IVAS_185_MDCT_ST_PLC_FADEOUT
static
#endif
ivas_error
PsychoacousticParameters_Init(
const int32_t sr_core, /* i : sampling rate of core-coder */
......
......@@ -144,6 +144,16 @@ uint32_t ivas_syn_output(
}
}
#ifdef DEC_TO_REND_FLOAT_DUMP
for ( i = 0; i < output_frame; ++i )
{
for ( n = 0; n < n_channels; ++n )
{
dbgwrite( &synth[n][i], sizeof( float ), 1, 1, "./float_out.raw" );
}
}
#endif
return noClipping;
}
......@@ -958,7 +968,7 @@ void lls_interp_n(
const int16_t N, /* i : length of the input vector */
float *a, /* o : calculated slope */
float *b, /* o : calculated offset */
int16_t upd /* i : use 1 to update x[] with the interpolated output */
const int16_t upd /* i : use 1 to update x[] with the interpolated output */
)
{
int16_t i;
......@@ -1172,8 +1182,7 @@ int16_t is_SIDrate(
if ( ( ivas_total_brate == SID_1k75 ) ||
( ivas_total_brate == SID_2k40 ) ||
( ivas_total_brate == IVAS_SID_4k4 ) ||
( ivas_total_brate == IVAS_SID_5k ) )
( ivas_total_brate == IVAS_SID_5k2 ) )
{
sid_rate_flag = 1;
}
......
......@@ -126,6 +126,7 @@
#endif
/*#define SPAR_HOA_DBG*/ /* SPAR HOA debug statements */
/*#define DEBUG_BINAURAL_FILTER_DESIGN*/ /* debugging of Crend binaural filter design */
#define DEBUG_AGC_ENCODER_CMD_OPTION /* Ability to force enable or disable AGC behaviour in DIRAC/SPAR via command line option */
#endif
/* #################### End DEBUGGING switches ############################ */
......@@ -141,14 +142,16 @@
#endif
#define DISABLE_ADAP_RES_COD_TMP /* temporary fix for IVAS-403, disables adaptive residual coding */
/*#define ITD_WINNER_GAIN_MODIFY */ /* ITD optimization - WORK IN PROGRESS */
/*#define FIX_I4_OL_PITCH*/ /* fix open-loop pitch used for EVS core switching */
/*#define FIX_IVAS_185_MDCT_ST_PLC_FADEOUT*/ /* IVAS-185 fix bug in TCX-PLC fadeout for MDCT-Stereo and improve fadeout by fading to background noise instead of white noise */
/*#define FIX_I1_113*/ /* under review : MCT bit distribution optimization for SBA high bitrates*/
#define SPAR_SCALING_HARMONIZATION /* Issue 80: Changes to harmonize scaling in spar */
#define SBA_INTERN_CONFIG_FIX_HOA2 /* Issue 99 : Fix for incorrect internal_config when output format is HOA2 or FOA*/
#define FIX_I98_HANDLES_TO_NULL /* Issue 98: do the setting of all handles to NULL in one place */
#define FIX_I1_113 /* under review : MCT bit distribution optimization for SBA high bitrates*/
#define PRINT_SBA_ORDER /* Issue 179: print-out also the SBA order of IVAS SBA format to stdout */
#define EXT_RENDERER /* FhG: external renderer library and standalone application */
#define FIX_EFAP_MATH /* fix for EFAP: remove angle quantization and a bug in polygon lookup causing incorrect gains. minor tweak for ALLRAD. non-BE for modes using EFAP */
#define FIX_124_DONT_ALLOC_PLCINFO_IN_IVAS /* Issue 124: do not allocate unused plc struct in IVAS modes which is only used in EVS mono */
#define FIX_MCT_PLC_RECOVERY /* Issue 184: scale the old synthesis part correctly in the first good frame after lost frames in MCT modes - to be activated after previous switch is merged */
#define SBA_BR_SWITCHING /* Issue 114: Changes for sba bit rate switching*/
#define FIX_AGC_WINFUNC_MEMORY /* Issue 62: lower agc_com.winFunc memory consumption */
#define REMOVE_SID_HARM_LEFTOVERS /* Issue 192: remove leftovers from the SID bitrate harmonization */
#define PARAM_ISM_DTX_CNG /* Support of DTX/CNG for Param-ISM */
......
......@@ -5147,11 +5147,8 @@ void decod_amr_wb(
ivas_error init_decoder(
Decoder_State *st, /* o : Decoder static variables structure */
const int16_t idchan /* i : channel ID */
#ifdef FIX_IVAS_185_MDCT_ST_PLC_FADEOUT
,
const int16_t idchan, /* i : channel ID */
const MC_MODE mc_mode /* i : MC mode */
#endif
);
void destroy_decoder(
......@@ -6750,7 +6747,7 @@ float correlation_shift(
void init_coder_ace_plus(
Encoder_State *st, /* i : Encoder state handle */
const int32_t last_total_brate, /* i : last total bitrate */
const int16_t is_mct /* i : MCT mode flag */
const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0)*/
);
void core_coder_reconfig(
......@@ -6761,7 +6758,7 @@ void core_coder_reconfig(
void core_coder_mode_switch(
Encoder_State *st, /* i/o: encoder state structure */
const int32_t last_total_brate, /* i : last bitrate */
const int16_t is_mct /* i : MCT mode flag */
const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0)*/
);
void enc_acelp_tcx_main(
......@@ -6778,17 +6775,14 @@ void enc_acelp_tcx_main(
void getTCXMode(
Decoder_State *st, /* i/o: decoder memory state */
Decoder_State *st0 /* i : bitstream */
#ifdef FIX_IVAS_185_MDCT_ST_PLC_FADEOUT
,
const int16_t MCT_flag
#endif
Decoder_State *st0, /* i : bitstream */
const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0)*/
);
void getTCXWindowing(
const int16_t core, /* i : current frame mode */
const int16_t last_core, /* i : last frame mode */
const int16_t element_mode,
const int16_t element_mode, /* i : element mode */
TCX_CONFIG_HANDLE hTcxCfg, /* i/o: TCX configuration handle */
Decoder_State *st0 /* i : bitstream */
);
......@@ -7399,7 +7393,7 @@ void ProcessStereoIGF(
Encoder_State *sts[CPE_CHANNELS], /* i : Encoder state */
int16_t ms_mask[2][MAX_SFB], /* i : bandwise MS mask */
float *pITFMDCTSpectrum[CPE_CHANNELS][2], /* i : MDCT spectrum fir ITF */
float pPowerSpectrum[CPE_CHANNELS][N_MAX], /* i : MDCT^2 + MDST^2 spectrum, or estimate */
float *pPowerSpectrum[CPE_CHANNELS], /* i/o: MDCT^2 + MDST^2 spectrum, or estimate */
float *pPowerSpectrumMsInv[CPE_CHANNELS][2], /* i : inverse power spectrum */
float *inv_spectrum[CPE_CHANNELS][2], /* i : inverse spectrum */
const int16_t frameno, /* i : flag indicating index of current subframe*/
......@@ -7613,8 +7607,7 @@ void InitTnsConfigs(
const int16_t igfStopFreq,
const int32_t total_brate,
const int16_t element_mode,
const int16_t is_mct /* i : MCT mode flag */
);
const int16_t MCT_flag );
void SetAllowTnsOnWhite(
STnsConfig tnsConfig[2][2],
......@@ -7894,13 +7887,9 @@ void decoder_tcx_post(
Decoder_State *st, /* i/o: decoder memory state */
float *synth,
float *synthFB,
float *A,
const int16_t bfi
#ifdef FIX_IVAS_185_MDCT_ST_PLC_FADEOUT
,
const int16_t isMCT
#endif
);
float *A, /* i : A(z) filter coefficients */
const int16_t bfi,
const int16_t isMCT );
void coder_acelp(
Encoder_State *st, /* i/o: coder memory state */
......@@ -7952,9 +7941,7 @@ void decoder_acelp(
void writeTCXMode(
Encoder_State *st, /* i/o: encoder state structure */
BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */
#ifdef FIX_IVAS_185_MDCT_ST_PLC_FADEOUT
const int16_t is_mct,
#endif
const int16_t MCT_flag, /* i : hMCT handle allocated (1) or not (0)*/
int16_t *nbits_start /* o : nbits start */
);
......@@ -8142,11 +8129,8 @@ void con_tcx(
float synth[], /* i/o: synth[] */
const float coh, /* i : coherence of stereo signal */
int16_t *noise_seed, /* i/o: noise seed for stereo */
const int16_t only_left /* i : TD-PLC only in left channel */
#ifdef FIX_IVAS_185_MDCT_ST_PLC_FADEOUT
,
const float *A_cng
#endif
const int16_t only_left, /* i : TD-PLC only in left channel */
const float A_cng[] /* i : CNG LP filter coefficients */
);
/*! r: codebook index */
......@@ -8695,9 +8679,7 @@ void configureFdCngDec(
void ApplyFdCng(
float *timeDomainInput,
#ifdef FIX_IVAS_185_MDCT_ST_PLC_FADEOUT
float *powerSpectrum,
#endif
float **realBuffer, /* i/o: Real part of the buffer */
float **imagBuffer, /* i/o: Imaginary part of the buffer */
Decoder_State *st,
......@@ -8706,9 +8688,7 @@ void ApplyFdCng(
void perform_noise_estimation_dec(
const float *timeDomainInput,
#ifdef FIX_IVAS_185_MDCT_ST_PLC_FADEOUT
float *power_spectrum,
#endif
HANDLE_FD_CNG_DEC hFdCngDec, /* i/o: FD_CNG structure */
const int16_t element_mode, /* i : element mode type */
const int16_t bwidth, /* i : audio bandwidth */
......@@ -8868,8 +8848,7 @@ void InitTnsConfiguration(
const int16_t igfStopFreq,
const int32_t total_brate,
const int16_t element_mode,
const int16_t is_mct /* i : MCT mode flag */
);
const int16_t MCT_flag );
int16_t DetectTnsFilt(
const STnsConfig *pTnsConfig, /* i : TNS Configuration struct */
......@@ -9207,10 +9186,8 @@ void open_decoder_LPD(
const int32_t total_brate, /* i : total bitrate */
const int32_t last_total_brate, /* i : last total bitrate */
const int16_t bwidth, /* i : audio bandwidth */
const int16_t is_mct, /* i : MCT mode flag */
#ifdef FIX_IVAS_185_MDCT_ST_PLC_FADEOUT
const int16_t last_element_mode,
#endif
const int16_t MCT_flag, /* i : hMCT handle allocated (1) or not (0) */
const int16_t last_element_mode, /* i : last element mode */
const int16_t is_init /* i : indicate call during initialization */
);
......@@ -9250,11 +9227,8 @@ void mode_switch_decoder_LPD(
const int32_t total_brate, /* i : total bitrate */
const int32_t last_total_brate, /* i : last frame total bitrate */
const int16_t frame_size_index, /* i : index determining the frame size */
const int16_t is_mct /* i : MCT mode flag */
#ifdef FIX_IVAS_185_MDCT_ST_PLC_FADEOUT
,
const int16_t MCT_flag, /* i : hMCT handle allocated (1) or not (0)*/
const int16_t last_element_mode /* i : last element mode */
#endif
);
void dec_acelp_tcx_frame(
......@@ -9534,12 +9508,8 @@ void TonalMDCTConceal_SaveFreqSignal(
const float *mdctSpectrum,
const uint16_t numSamples,
const uint16_t nNewSamplesCore,
const float *scaleFactors
#ifdef FIX_IVAS_185_MDCT_ST_PLC_FADEOUT
,
const int16_t infoIGFStartLine
#endif
);
const float *scaleFactors,
const int16_t infoIGFStartLine );
void TonalMDCTConceal_UpdateState(
TonalMDCTConcealPtr hTonalMDCTConc,
......@@ -9573,9 +9543,8 @@ void TonalMDCTConceal_InsertNoise(
int16_t *pSeed, /*IN/OUT*/
const float tiltCompFactor,
const float crossfadeGain,
#ifdef FIX_IVAS_185_MDCT_ST_PLC_FADEOUT
const float concealment_noise[L_FRAME48k],
#endif
const float cngLevelBackgroundTrace_bfi,
const int16_t crossOverFreq );
void DetectTonalComponents(
......@@ -9610,7 +9579,6 @@ void RefineTonalComponents(
float floorPowerSpectrum,
const PsychoacousticParameters *psychParamsCurrent );
#ifdef FIX_IVAS_185_MDCT_ST_PLC_FADEOUT
ivas_error PsychoacousticParameters_Init(
const int32_t sr_core, /* i : sampling rate of core-coder */
const int16_t nBins, /* i : Number of bins (spectral lines) */
......@@ -9618,7 +9586,6 @@ ivas_error PsychoacousticParameters_Init(
const int16_t isTCX20, /* i : Flag indicating if the subband division is for TCX20 or TCX10 */
const int16_t isWarped, /* i : Flag indicating if the scale is linear or warped */
PsychoacousticParameters *pPsychParams );
#endif
void concealment_init(
const int16_t L_frameTCX,
......@@ -9689,7 +9656,7 @@ int16_t get_codec_mode(
int16_t getTcxonly(
const int16_t element_mode, /* i : IVAS element mode */
const int32_t total_brate, /* i : total bitrate */
const int16_t is_mct /* i : MCT mode flag */
const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0)*/
);
int16_t getTnsAllowed(
......@@ -9769,7 +9736,7 @@ void SetModeIndex(
Encoder_State *st, /* i : Encoder state */
const int32_t last_total_brate, /* i : last total bitrate */
const int16_t last_element_mode, /* i : last IVAS element mode */
const int16_t is_mct /* i : MCT mode flag */
const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0) */
);
int16_t getNumTcxCodedLines(
......@@ -9799,7 +9766,7 @@ void IGFEncApplyStereo(
const IGF_ENC_INSTANCE_HANDLE hIGFEnc[CPE_CHANNELS], /* i : instance handle of IGF Encoder */
const int16_t igfGridIdx, /* i : IGF grid index */
Encoder_State *sts[CPE_CHANNELS], /* i : Encoder state */
float pPowerSpectrum[CPE_CHANNELS][N_MAX], /* i/o: MDCT^2 + MDST^2 spectrum, or estimate */
float *pPowerSpectrum[CPE_CHANNELS], /* i/o: MDCT^2 + MDST^2 spectrum, or estimate */
float *pPowerSpectrumMsInv[CPE_CHANNELS][2], /* i/o: inverse power spectrum */
float *inv_spectrum[CPE_CHANNELS][2], /* i : inverse spectrum */
const int16_t frameno, /* i : flag indicating index of current subframe */
......@@ -9993,6 +9960,7 @@ void IGFSCFDecoderDecode(
if 0 on input the decoder will be forced to encode without a reset */
);
/*! r: offset value */
int16_t tbe_celp_exc_offset(
const int16_t T0, /* i : Integer pitch */
const int16_t T0_frac /* i : Fractional part of the pitch */
......@@ -10035,6 +10003,6 @@ void init_tcx_cfg(
const int16_t infoIGFStopFreq,
const int16_t element_mode,
const int16_t ini_frame,
const int16_t is_mct, /* i : MCT mode flag */
const int16_t MCT_flag, /* i : hMCT handle allocated (1) or not (0) */
const MCT_CHAN_MODE mct_chan_mode /* i : MCT channel mode */
);
......@@ -395,7 +395,7 @@ typedef struct
int16_t frame_type_previous;
float A_cng[17];
float A_cng[M + 1];
float exc_cng[L_FRAME16k];
int32_t CngBitrate;
......
......@@ -89,6 +89,7 @@ void swb_tbe_reset(
return;
}
/*-------------------------------------------------------------------*
* swb_tbe_reset_synth()
*
......@@ -105,11 +106,14 @@ void swb_tbe_reset_synth(
return;
}
/*-------------------------------------------------------------------*
* tbe_celp_exc_offset()
*
* Compute tbe bwe celp excitation offset
*-------------------------------------------------------------------*/
/*! r: offset value */
int16_t tbe_celp_exc_offset(
const int16_t T0, /* i : Integer pitch */
const int16_t T0_frac /* i : Fractional part of the pitch */
......@@ -120,6 +124,8 @@ int16_t tbe_celp_exc_offset(
return offset;
}
/*-------------------------------------------------------------------*
* flip_and_downmix_generic()
*
......
......@@ -995,16 +995,16 @@ void InitTnsConfigs(
const int16_t igfStopFreq,
const int32_t total_brate,
const int16_t element_mode,
const int16_t is_mct )
const int16_t MCT_flag )
{
if ( total_brate > ACELP_32k )
{
InitTnsConfiguration( bwidth, L_frame / 2, &tnsConfig[0][0], igfStopFreq, total_brate, element_mode, is_mct );
InitTnsConfiguration( bwidth, L_frame / 2, &tnsConfig[0][0], igfStopFreq, total_brate, element_mode, MCT_flag );
}
InitTnsConfiguration( bwidth, L_frame, &tnsConfig[1][0], igfStopFreq, total_brate, element_mode, is_mct );
InitTnsConfiguration( bwidth, L_frame, &tnsConfig[1][0], igfStopFreq, total_brate, element_mode, MCT_flag );
InitTnsConfiguration( bwidth, L_frame + L_frame / 4, &tnsConfig[1][1], igfStopFreq, total_brate, element_mode, is_mct );
InitTnsConfiguration( bwidth, L_frame + L_frame / 4, &tnsConfig[1][1], igfStopFreq, total_brate, element_mode, MCT_flag );
return;
}
......
......@@ -78,7 +78,7 @@ void InitTnsConfiguration(
const int16_t igfStopFreq,
const int32_t total_brate,
const int16_t element_mode,
const int16_t is_mct )
const int16_t MCT_flag )
{
int32_t nSampleRate;
int16_t iFilter;
......@@ -111,8 +111,7 @@ void InitTnsConfiguration(
}
else if ( nSampleRate > 16000 )
{
if ( ( element_mode > IVAS_SCE ) && ( total_brate >= ( is_mct ? IVAS_32k : IVAS_48k ) ) )
if ( ( element_mode > IVAS_SCE ) && ( total_brate >= ( MCT_flag ? IVAS_32k : IVAS_48k ) ) )
{
pTnsConfig->nMaxFilters = sizeof( tnsParameters32kHz_Stereo ) / sizeof( tnsParameters32kHz_Stereo[0] );
if ( nSampleRate == 100 * frameLength ) /* sub-frame length is <= 10 ms */
......
......@@ -1313,7 +1313,7 @@ float var(
float v;
int16_t i;
m = mean( x, (const int16_t) len );
m = mean( x, len );
v = 0.0f;
for ( i = 0; i < len; i++ )
......
......@@ -93,8 +93,11 @@ typedef INT64 int64_t;
/* This is the maximum number of allocations for which to keep information.
It can be increased if required. */
#ifdef SBA_BR_SWITCHING
#define MAX_INFO_RECORDS 8000
#else
#define MAX_INFO_RECORDS 3000
#endif
/* This is the length after which the function name
will be truncated when the summary is printed. */
#define MAX_FUNCTION_NAME_LENGTH 18
......
......@@ -185,7 +185,7 @@ static void UpdateWave(
void ivas_spar_dump_signal_wav(
const int16_t input_frame,
float **ppPcm,
float pcm_array[IVAS_MAX_NUM_CH][L_FRAME48k],
float pcm_array[IVAS_SPAR_MAX_CH][L_FRAME48k],
const int16_t no_channel,
WAVEFILEOUT *wave_file,
char *location )
......
......@@ -50,7 +50,7 @@ extern WAVEFILEOUT *spar_foa_dec_wav[4];
void ivas_close_agc_debug_files( void );
void ivas_open_agc_debug_files( int16_t agc );
#endif
void ivas_spar_dump_signal_wav( const int16_t input_frame, float **ppPcm, float pcm_array[IVAS_MAX_NUM_CH][L_FRAME48k], const int16_t no_channel, WAVEFILEOUT *wave_file, char *location );
void ivas_spar_dump_signal_wav( const int16_t input_frame, float **ppPcm, float pcm_array[IVAS_SPAR_MAX_CH][L_FRAME48k], const int16_t no_channel, WAVEFILEOUT *wave_file, char *location );
void ivas_close_sba_encoder_debug_files( void );
void ivas_open_sba_encoder_debug_files( const int32_t fs, const int16_t n_transport, const char *file_tag, const int32_t ivas_total_brate, const int16_t dtx_on );
void ivas_close_sba_decoder_debug_files( const int32_t fs, const int16_t n_ch, const int16_t n_transport, const int16_t pca_ingest_channels );
......
......@@ -125,7 +125,7 @@ ivas_error acelp_core_dec(
error = IVAS_ERR_OK;
if ( st->element_mode == IVAS_CPE_MDCT && nchan_out == 1 && st->idchan == 1 && last_element_brate <= IVAS_SID_4k4 )
if ( st->element_mode == IVAS_CPE_MDCT && nchan_out == 1 && st->idchan == 1 && last_element_brate <= IVAS_SID_5k2 )
{
/* In MDCT-Stereo DTX with mono output, we can skip CNG for the second channel, except for the first inactive frame following an active period */
return error;
......@@ -156,11 +156,7 @@ ivas_error acelp_core_dec(
st->hFdCngDec->hFdCngCom->sidNoiseEstLp[i] = STEREO_DFT_FD_FILT * st->hFdCngDec->hFdCngCom->sidNoiseEstLp[i] + ( 1 - STEREO_DFT_FD_FILT ) * st->hFdCngDec->hFdCngCom->sidNoiseEst[i];
}
#ifdef FIX_IVAS_185_MDCT_ST_PLC_FADEOUT
ApplyFdCng( NULL, NULL, NULL, NULL, st, 0, 0 );
#else
ApplyFdCng( NULL, NULL, NULL, st, 0, 0 );
#endif
}
else
{
......@@ -530,11 +526,7 @@ ivas_error acelp_core_dec(
{
st->hFdCngDec->hFdCngCom->sidNoiseEstLp[i] = STEREO_DFT_FD_FILT * st->hFdCngDec->hFdCngCom->sidNoiseEstLp[i] + ( 1 - STEREO_DFT_FD_FILT ) * st->hFdCngDec->hFdCngCom->sidNoiseEst[i];
}
#ifdef FIX_IVAS_185_MDCT_ST_PLC_FADEOUT
ApplyFdCng( syn, NULL, realBuffer, imagBuffer, st, 0, ( st->coder_type == AUDIO && !st->GSC_noisy_speech ) );
#else
ApplyFdCng( syn, realBuffer, imagBuffer, st, 0, ( st->coder_type == AUDIO && !st->GSC_noisy_speech ) );
#endif
}
generate_comfort_noise_dec( NULL, NULL, st, nchan_out );
......@@ -702,6 +694,12 @@ ivas_error acelp_core_dec(
residu( Aq, M, old_exc_s, old_exc + L_EXC_MEM_DEC - st->L_frame, st->L_frame );
}
if ( st->last_core != ACELP_CORE && st->element_mode > EVS_MONO )
{
/* Prepare ACB memory of old_bwe_exc */
lerp( old_exc, old_bwe_exc, L_EXC_MEM_DEC * HIBND_ACB_L_FAC, L_EXC_MEM_DEC );
}
/*-----------------------------------------------------------------*
* FEC - first good frame after lost frame(s) (possibility to correct the ACB)
*-----------------------------------------------------------------*/
......@@ -1119,11 +1117,7 @@ ivas_error acelp_core_dec(
if ( st->element_mode != IVAS_CPE_TD )
{
/*Noise estimate*/
#ifdef FIX_IVAS_185_MDCT_ST_PLC_FADEOUT
ApplyFdCng( syn, NULL, realBuffer, imagBuffer, st, 0, ( st->coder_type == AUDIO && !st->GSC_noisy_speech ) );
#else
ApplyFdCng( syn, realBuffer, imagBuffer, st, 0, ( st->coder_type == AUDIO && !st->GSC_noisy_speech ) );
#endif
}
if ( !st->cna_dirac_flag )
......@@ -1188,11 +1182,7 @@ ivas_error acelp_core_dec(
/*Noise estimate*/
if ( st->idchan == 0 && ( nchan_out == 2 || ( st->core_brate != FRAME_NO_DATA && st->core_brate != SID_2k40 ) ) )
{
#ifdef FIX_IVAS_185_MDCT_ST_PLC_FADEOUT
ApplyFdCng( syn, NULL, realBuffer, imagBuffer, st, 0, ( st->coder_type == AUDIO && !st->GSC_noisy_speech ) );
#else
ApplyFdCng( syn, realBuffer, imagBuffer, st, 0, ( st->coder_type == AUDIO && !st->GSC_noisy_speech ) );
#endif
}
}
}
......
......@@ -158,8 +158,7 @@ ivas_error acelp_core_switch_dec(
* Excitation decoding
*----------------------------------------------------------------*/
config_acelp1( DEC, st->total_brate, cbrate, st->core, -1, -1, st->last_L_frame, -1, &( st->acelp_cfg ), st->next_bit_pos, GENERIC, -1, -1, &decode_bwe /* dummy */, &i, st->element_mode, &i /*dummy*/, 0, 0, st->idchan, 0, 0, 0 /*st->GSC_IVAS_mode*/
);
config_acelp1( DEC, st->total_brate, cbrate, st->core, -1, -1, st->last_L_frame, -1, &( st->acelp_cfg ), st->next_bit_pos, GENERIC, -1, -1, &decode_bwe /* dummy */, &i, st->element_mode, &i /*dummy*/, 0, 0, st->idchan, 0, 0, 0 /*st->GSC_IVAS_mode*/ );
decod_gen_voic_core_switch( st, L_frame_for_cs, 0, Aq, exc, cbrate );
......
......@@ -621,11 +621,7 @@ ivas_error amr_wb_dec(
/*VAD only for non inactive frame*/
st->VAD = ( st->VAD && ( st->coder_type != INACTIVE ) );
#ifdef FIX_IVAS_185_MDCT_ST_PLC_FADEOUT
ApplyFdCng( syn, NULL, NULL, NULL, st, 0, 0 );
#else
ApplyFdCng( syn, NULL, NULL, st, 0, 0 );
#endif
st->hFdCngDec->hFdCngCom->frame_type_previous = st->m_frame_type;
......
......@@ -52,15 +52,13 @@
*-----------------------------------------------------------------------*/
void open_decoder_LPD(
Decoder_State *st,
const int32_t total_brate,
const int32_t last_total_brate,
const int16_t bwidth,
const int16_t is_mct, /* i : MCT mode flag */
#ifdef FIX_IVAS_185_MDCT_ST_PLC_FADEOUT
const int16_t last_element_mode,
#endif
const int16_t is_init /* i : indicate call from init_decoder() to avoid double TC initialization */
Decoder_State *st, /* i/o: decoder state structure */
const int32_t total_brate, /* i : total bitrate */
const int32_t last_total_brate, /* i : last total bitrate */
const int16_t bwidth, /* i : audio bandwidth */
const int16_t MCT_flag, /* i : hMCT handle allocated (1) or not (0) */
const int16_t last_element_mode, /* i : last element mode */
const int16_t is_init /* i : indicate call during initialization */
)
{
int16_t i;
......@@ -94,7 +92,7 @@ void open_decoder_LPD(
}
}
st->tcxonly = getTcxonly( st->element_mode, total_brate, is_mct );
st->tcxonly = getTcxonly( st->element_mode, total_brate, MCT_flag );
/* the TD TCX PLC in MODE1 still runs with 80ms subframes */
if ( ( st->element_mode == EVS_MONO && st->L_frame == L_FRAME16k && total_brate <= ACELP_32k ) || ( st->element_mode > EVS_MONO && st->L_frame == L_FRAME16k && total_brate <= MAX_ACELP_BRATE ) || ( st->tcxonly && ( st->sr_core == 32000 || st->sr_core == 16000 ) ) )
......@@ -192,7 +190,7 @@ void open_decoder_LPD(
{
if ( !is_init || st->element_mode != IVAS_CPE_MDCT )
{
init_tcx_cfg( st->hTcxCfg, total_brate, st->sr_core, st->output_Fs, st->L_frame, st->bwidth, st->hTcxDec->L_frameTCX, st->fscale, encoderLookahead, encoderLookaheadFB, st->preemph_fac, st->tcxonly, st->rf_flag, st->igf, st->hIGFDec->infoIGFStopFreq, st->element_mode, st->ini_frame, is_mct, st->mct_chan_mode );
init_tcx_cfg( st->hTcxCfg, total_brate, st->sr_core, st->output_Fs, st->L_frame, st->bwidth, st->hTcxDec->L_frameTCX, st->fscale, encoderLookahead, encoderLookaheadFB, st->preemph_fac, st->tcxonly, st->rf_flag, st->igf, st->hIGFDec->infoIGFStopFreq, st->element_mode, st->ini_frame, MCT_flag, st->mct_chan_mode );
}
else
{
......@@ -552,9 +550,7 @@ void open_decoder_LPD(
{
st->hTcxDec->prev_widow_left_rect = 0;
#ifdef FIX_IVAS_185_MDCT_ST_PLC_FADEOUT
/* Todo: should be considered for other stereo modes as well */
if ( is_init || !( st->element_mode == IVAS_CPE_MDCT && st->element_mode == last_element_mode ) )
if ( is_init || MCT_flag || !( st->element_mode == IVAS_CPE_MDCT && st->element_mode == last_element_mode ) )
{
st->hTcxDec->CngLevelBackgroundTrace_bfi = PLC_MIN_CNG_LEV;
st->hTcxDec->NoiseLevelIndex_bfi = PLC_MIN_STAT_BUFF_SIZE - 1;
......@@ -564,15 +560,6 @@ void open_decoder_LPD(
st->hTcxDec->cummulative_damping_tcx = 1.0f;
}
#else
st->hTcxDec->CngLevelBackgroundTrace_bfi = PLC_MIN_CNG_LEV;
st->hTcxDec->NoiseLevelIndex_bfi = PLC_MIN_STAT_BUFF_SIZE - 1;
st->hTcxDec->CurrLevelIndex_bfi = 0;
st->hTcxDec->LastFrameLevel_bfi = PLC_MIN_CNG_LEV;
set_f( st->hTcxDec->NoiseLevelMemory_bfi, PLC_MIN_CNG_LEV, PLC_MIN_STAT_BUFF_SIZE );
st->hTcxDec->cummulative_damping_tcx = 1.0f;
#endif
}
st->cummulative_damping = 1.0f;
......
......@@ -56,11 +56,8 @@ void mode_switch_decoder_LPD(
const int32_t total_brate, /* i : total bitrate */
const int32_t last_total_brate, /* i : last frame total bitrate */
const int16_t frame_size_index, /* i : index determining the frame size */
const int16_t is_mct /* i : MCT mode flag */
#ifdef FIX_IVAS_185_MDCT_ST_PLC_FADEOUT
,
const int16_t MCT_flag, /* i : hMCT handle allocated (1) or not (0)*/
const int16_t last_element_mode /* i : last element mode */
#endif
)
{
int16_t fscale, switchWB;
......@@ -109,11 +106,7 @@ void mode_switch_decoder_LPD(
if ( fscale != st->fscale || switchWB || bSwitchFromAmrwbIO || st->last_codec_mode == MODE1 || st->force_lpd_reset )
{
#ifdef FIX_IVAS_185_MDCT_ST_PLC_FADEOUT
open_decoder_LPD( st, total_brate, last_total_brate, bwidth, is_mct, last_element_mode, 0 );
#else
open_decoder_LPD( st, total_brate, last_total_brate, bwidth, is_mct, 0 );
#endif
open_decoder_LPD( st, total_brate, last_total_brate, bwidth, MCT_flag, last_element_mode, 0 );
}
else
{
......@@ -152,7 +145,7 @@ void mode_switch_decoder_LPD(
if ( st->hTcxCfg->fIsTNSAllowed && st->hIGFDec != NULL && st->hTcxCfg != NULL )
{
InitTnsConfigs( bwidth, st->hTcxCfg->tcx_coded_lines, st->hTcxCfg->tnsConfig, st->hIGFDec->infoIGFStopFreq, total_brate, st->element_mode, is_mct );
InitTnsConfigs( bwidth, st->hTcxCfg->tcx_coded_lines, st->hTcxCfg->tnsConfig, st->hIGFDec->infoIGFStopFreq, total_brate, st->element_mode, MCT_flag );
SetAllowTnsOnWhite( st->hTcxCfg->tnsConfig, st->element_mode == IVAS_CPE_MDCT );
}
......
......@@ -1048,7 +1048,7 @@ void bw_switching_pre_proc(
if ( st->element_mode > EVS_MONO )
{
if ( st->core == ACELP_CORE && !( st->bfi == 1 && st->con_tcx == 1 ) && st->hBWE_FD != NULL && !( st->core_brate <= SID_2k40 && st->element_mode == IVAS_CPE_DFT && nchan_out == 2 ) && !( st->element_mode == IVAS_CPE_MDCT && nchan_out == 1 && st->idchan == 1 && last_element_brate <= IVAS_SID_4k4 ) )
if ( st->core == ACELP_CORE && !( st->bfi == 1 && st->con_tcx == 1 ) && st->hBWE_FD != NULL && !( st->core_brate <= SID_2k40 && st->element_mode == IVAS_CPE_DFT && nchan_out == 2 ) && !( st->element_mode == IVAS_CPE_MDCT && nchan_out == 1 && st->idchan == 1 && last_element_brate <= IVAS_SID_5k2 ) )
{
/* Calculate tilt of the ACELP core synthesis - needed in SWB BWE decoding */
calc_tilt_bwe( old_syn_12k8_16k, &st->tilt_wb, st->L_frame );
......