Skip to content
Commits on Source (39)
variables:
# note: GitLab cannot reference variables defined by users in the include ref:, we need to use a YAML anchor for this
# see https://docs.gitlab.com/ci/yaml/includes/#use-variables-with-include for more information
IVAS_CODEC_CI_REF: &IVAS_CODEC_CI_REF 4eb4c0dfbdc845280a9994b5f7540f69c737537b
IVAS_CODEC_CI_REF: &IVAS_CODEC_CI_REF f5e61349c22ededcdfe1cc54e533dea477f2d003
include:
- local: .gitlab-ci/variables.yml
- local: .gitlab-ci/rules-basis.yml
- project: ivas-codec-pc/ivas-codec-ci
ref: *IVAS_CODEC_CI_REF
file: main.yml
......@@ -326,10 +327,6 @@ workflow:
- rm -rf tests/dut tests/ref
variables:
USE_LTV: 0
DUT_ENCODER_PATH: ./IVAS_cod_ref
DUT_DECODER_PATH: ./IVAS_dec_ref
MERGE_TARGET_ENCODER_PATH: ./IVAS_cod_ref
MERGE_TARGET_DECODER_PATH: ./IVAS_dec_ref
.check-be-to-target-job:
extends:
......@@ -448,9 +445,6 @@ workflow:
extends:
- .check-be-job
stage: test
needs:
- job: "check-be-to-target-short-enc-0db"
artifacts: true
timeout: "300 minutes"
variables:
XML_REPORT_BRANCH: "report-junit-branch-$CI_JOB_NAME--sha-$CI_COMMIT_SHORT_SHA.xml"
......@@ -645,8 +639,6 @@ workflow:
- report-junit.xml
.ivas-pytest-compare-to-input-anchor: &ivas-pytest-compare-to-input-anchor
extends:
- .job-linux
stage: test
needs: ["build-codec-linux-make"]
timeout: "360 minutes"
......@@ -911,6 +903,9 @@ check-be-to-target-short-enc-0db:
TEST_SUITE: "$SHORT_TEST_SUITE_ENCODER"
# -/-0dB
LEVEL_SCALING: "1.0"
# overwrite decoder with float reference one
DUT_DECODER_PATH: "$REF_DECODER_PATH"
MERGE_TARGET_DECODER_PATH: "$REF_DECODER_PATH"
check-be-to-target-short-enc-+10db:
extends:
......@@ -919,6 +914,9 @@ check-be-to-target-short-enc-+10db:
TEST_SUITE: "$SHORT_TEST_SUITE_ENCODER"
# +10dB
LEVEL_SCALING: "3.162"
# overwrite decoder with float reference one
DUT_DECODER_PATH: "$REF_DECODER_PATH"
MERGE_TARGET_DECODER_PATH: "$REF_DECODER_PATH"
check-be-to-target-short-enc--10db:
extends:
......@@ -927,6 +925,9 @@ check-be-to-target-short-enc--10db:
TEST_SUITE: "$SHORT_TEST_SUITE_ENCODER"
# -10dB
LEVEL_SCALING: "0.3162"
# overwrite decoder with float reference one
DUT_DECODER_PATH: "$REF_DECODER_PATH"
MERGE_TARGET_DECODER_PATH: "$REF_DECODER_PATH"
check-be-to-target-short-dec-0db:
extends:
......@@ -935,6 +936,9 @@ check-be-to-target-short-dec-0db:
TEST_SUITE: "$SHORT_TEST_SUITE"
# +/-0dB
LEVEL_SCALING: "1.0"
# overwrite encoder with float reference one
DUT_ENCODER_PATH: "$REF_ENCODER_PATH"
MERGE_TARGET_ENCODER_PATH: "$REF_ENCODER_PATH"
check-be-to-target-short-dec-+10db:
extends:
......@@ -943,6 +947,9 @@ check-be-to-target-short-dec-+10db:
TEST_SUITE: "$SHORT_TEST_SUITE"
# +10dB
LEVEL_SCALING: "3.162"
# overwrite encoder with float reference one
DUT_ENCODER_PATH: "$REF_ENCODER_PATH"
MERGE_TARGET_ENCODER_PATH: "$REF_ENCODER_PATH"
check-be-to-target-short-dec--10db:
extends:
......@@ -951,55 +958,94 @@ check-be-to-target-short-dec--10db:
TEST_SUITE: "$SHORT_TEST_SUITE"
# -10dB
LEVEL_SCALING: "0.3162"
# overwrite encoder with float reference one
DUT_ENCODER_PATH: "$REF_ENCODER_PATH"
MERGE_TARGET_ENCODER_PATH: "$REF_ENCODER_PATH"
### jobs that check for regressions on non-BE testcases
check-regressions-short-enc-0db:
extends:
- .check-regressions-pytest-job
needs:
- job: "check-be-to-target-short-enc-0db"
artifacts: true
variables:
TEST_SUITE: "$SHORT_TEST_SUITE_ENCODER"
# +/-0dB
LEVEL_SCALING: "1.0"
# overwrite decoder with float reference one
DUT_DECODER_PATH: "$REF_DECODER_PATH"
MERGE_TARGET_DECODER_PATH: "$REF_DECODER_PATH"
check-regressions-short-enc-+10db:
extends:
- .check-regressions-pytest-job
needs:
- job: "check-be-to-target-short-enc-+10db"
artifacts: true
variables:
TEST_SUITE: "$SHORT_TEST_SUITE_ENCODER"
# +10dB
LEVEL_SCALING: "3.162"
# overwrite decoder with float reference one
DUT_DECODER_PATH: "$REF_DECODER_PATH"
MERGE_TARGET_DECODER_PATH: "$REF_DECODER_PATH"
check-regressions-short-enc--10db:
extends:
- .check-regressions-pytest-job
needs:
- job: "check-be-to-target-short-enc--10db"
artifacts: true
variables:
TEST_SUITE: "$SHORT_TEST_SUITE_ENCODER"
# -10dB
LEVEL_SCALING: "0.3162"
# overwrite decoder with float reference one
DUT_DECODER_PATH: "$REF_DECODER_PATH"
MERGE_TARGET_DECODER_PATH: "$REF_DECODER_PATH"
check-regressions-short-dec-0db:
extends:
- .check-regressions-pytest-job
needs:
- job: "check-be-to-target-short-dec-0db"
artifacts: true
variables:
TEST_SUITE: "$SHORT_TEST_SUITE"
# +/-0dB
LEVEL_SCALING: "1"
# overwrite encoder with float reference one
DUT_ENCODER_PATH: "$REF_ENCODER_PATH"
MERGE_TARGET_ENCODER_PATH: "$REF_ENCODER_PATH"
check-regressions-short-dec-+10db:
extends:
- .check-regressions-pytest-job
needs:
- job: "check-be-to-target-short-dec-+10db"
artifacts: true
variables:
TEST_SUITE: "$SHORT_TEST_SUITE"
# +10dB
LEVEL_SCALING: "3.162"
# overwrite encoder with float reference one
DUT_ENCODER_PATH: "$REF_ENCODER_PATH"
MERGE_TARGET_ENCODER_PATH: "$REF_ENCODER_PATH"
check-regressions-short-dec--10db:
extends:
- .check-regressions-pytest-job
needs:
- job: "check-be-to-target-short-dec--10db"
artifacts: true
variables:
TEST_SUITE: "$SHORT_TEST_SUITE"
# -10dB
LEVEL_SCALING: "0.3162"
# overwrite encoder with float reference one
DUT_ENCODER_PATH: "$REF_ENCODER_PATH"
MERGE_TARGET_ENCODER_PATH: "$REF_ENCODER_PATH"
# ---------------------------------------------------------------
# Short test jobs for running from web interface or schedule
......@@ -1549,6 +1595,7 @@ voip-be-on-merge-request:
GET_WMOPS_ARGS: "mem_only"
timeout: 3 hours 30 minutes
before_script:
- !reference [ .test-job-linux, before_script ]
- bash "${CI_PROJECT_DIR}"/ivas-codec-ci/snippets/print-common-info.sh
- bash "${CI_PROJECT_DIR}"/ivas-codec-ci/snippets/basop/update-scripts-repo.sh
- bash "${CI_PROJECT_DIR}"/ivas-codec-ci/snippets/update-ltv-repo.sh
......
# overwrites the default rules in the IVAS CI repository
# should be refactored and unified
.rules-basis:
rules:
# see https://docs.gitlab.com/ee/ci/yaml/workflow.html#switch-between-branch-pipelines-and-merge-request-pipelines
- if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS && $CI_PIPELINE_SOURCE == "push"
when: never
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
variables:
IVAS_PIPELINE_NAME: 'MR pipeline: $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME'
### disabled for now because pipeline cd is redundant with MR pipeline with current workflow
# - if: $CI_PIPELINE_SOURCE == 'push' && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH # Pushes to main
# variables:
# IVAS_PIPELINE_NAME: 'Push pipeline: $CI_COMMIT_BRANCH'
- if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'default' # for testing
variables:
IVAS_PIPELINE_NAME: 'Web run pipeline: $CI_COMMIT_BRANCH'
- if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'pytest-compare'
variables:
IVAS_PIPELINE_NAME: 'Run comparison tools against float ref: $CI_COMMIT_BRANCH'
- if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'pytest-compare-enc-dmx'
variables:
IVAS_PIPELINE_NAME: 'Run encoder dmx comparison against float ref: $CI_COMMIT_BRANCH'
- if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'pytest-compare-long'
variables:
IVAS_PIPELINE_NAME: 'Run comparison tools against float ref (long test vectors): $CI_COMMIT_BRANCH'
- if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'pytest-compare-to-input'
variables:
IVAS_PIPELINE_NAME: 'Run comparison tools against input (pass-through only): $CI_COMMIT_BRANCH'
- if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'pytest-saturation-smoke-test'
variables:
IVAS_PIPELINE_NAME: 'Run saturation smoke-test: $CI_COMMIT_BRANCH'
- if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'evs-26444'
variables:
IVAS_PIPELINE_NAME: 'EVS 26.444 test: $CI_COMMIT_BRANCH'
- if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'sanitizer'
variables:
IVAS_PIPELINE_NAME: 'Short testvectors sanitizers'
- if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'pytest-renderer'
variables:
IVAS_PIPELINE_NAME: 'Renderer test: $CI_COMMIT_BRANCH'
- if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'complexity'
variables:
IVAS_PIPELINE_NAME: 'Complexity Measurement on $CI_COMMIT_BRANCH'
- if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'voip-be-test'
variables:
IVAS_PIPELINE_NAME: 'Voip BE test on $CI_COMMIT_BRANCH'
- if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'peaq-enc-passthrough'
variables:
IVAS_PIPELINE_NAME: 'PEAQ encoder pass-through test: $CI_COMMIT_BRANCH'
- if: $CI_PIPELINE_SOURCE == 'schedule' # Scheduled in any branch
variables:
IVAS_PIPELINE_NAME: 'Scheduled pipeline: $CI_COMMIT_BRANCH'
......@@ -1409,15 +1409,6 @@ Word32 BASOP_Util_Divide3232_Scale_newton( Word32 x, Word32 y, Word16 *s )
*s = 0;
return ( (Word32) 0 );
}
#if 0
sign = L_xor( x, y ); /* check (sign < 0) for result negation */
if ( x < 0 )
{
x = L_negate( x );
}
#else
IF( EQ_32( y, 0x80000000 ) )
{
/* Division by -1.0: same as negation of numerator */
......@@ -1429,7 +1420,6 @@ Word32 BASOP_Util_Divide3232_Scale_newton( Word32 x, Word32 y, Word16 *s )
}
sign = y;
move32();
#endif
if ( y < 0 )
{
y = L_negate( y );
......
......@@ -52,7 +52,6 @@
int16_t FEC_seed = 12558; /* Seed for random FEC generator */
FILE *FEC_pattern = NULL; /* FEC pattern file (for simulation of FEC) */
#ifndef IVAS_CODE
float FEC_random = 0; /* FEC rate in percent (for simulation of FEC) */
/*-------------------------------------------------------------------*
* file_read_FECpattern()
......@@ -109,7 +108,6 @@ static int16_t file_read_FECpattern( void )
return bfi;
}
#endif
#endif
/*-------------------------------------------------------------------*
* pack_bit()
*
......
......@@ -981,10 +981,6 @@ ivas_error openCldfb(
const Word16 type, /*!< analysis or synthesis */
const Word16 maxCldfbBands, /*!< number of cldfb bands */
const Word16 frameSize /*!< FrameSize */
#ifdef ADD_IVAS_CLDFB
,
CLDFB_PROTOTYPE prototype /* i : CLDFB version (1.25ms/5ms delay) */
#endif
)
{
HANDLE_CLDFB_FILTER_BANK hs;
......@@ -996,9 +992,6 @@ ivas_error openCldfb(
}
hs->type = type;
#ifdef ADD_IVAS_CLDFB
hs->prototype = prototype;
#endif
move16();
IF( type == CLDFB_ANALYSIS )
......
......@@ -246,67 +246,18 @@ Word16 getTcxonly_ivas_fx(
}
Word16 getTcxonly(
#ifdef IVAS_CODE_SWITCHING
const Word16 element_mode, /* i : IVAS element mode */
#endif
const Word32 total_brate /* i : total bitrate */
#ifdef IVAS_CODE_SWITCHING
,
const Word16 MCT_flag, /* i : hMCT handle allocated (1) or not (0)*/
const int16_t is_ism_format /* i : flag indicating ISM format */
#endif
)
{
Word16 tcxonly;
tcxonly = 0;
move16();
#ifdef IVAS_CODE_SWITCHING
SWITCH( element_mode )
{
case EVS_MONO:
#endif
if ( GT_32( total_brate, 32000 ) )
{
tcxonly = 1;
move16();
}
#ifdef IVAS_CODE_SWITCHING
break;
case IVAS_SCE:
if ( is_ism_format )
{
if ( total_brate > MAX_ACELP_BRATE_ISM )
{
tcxonly = 1;
}
}
else
{
if ( total_brate > MAX_ACELP_BRATE )
{
tcxonly = 1;
}
}
break;
case IVAS_CPE_DFT:
case IVAS_CPE_TD:
if ( total_brate > MAX_ACELP_BRATE )
{
tcxonly = 1;
}
break;
case IVAS_CPE_MDCT:
if ( total_brate >= ( MCT_flag ? IVAS_32k : IVAS_48k ) )
{
tcxonly = 1;
}
break;
#endif
#ifdef IVAS_CODE_SWITCHING
}
#endif
return tcxonly; /*Q0*/
}
......
......@@ -303,11 +303,7 @@ void hq_configure_evs_fx(
*start_norm = 0;
move16();
#ifndef SOLVED_COMP_ENC_DEC
IF( EQ_16( length, L_FRAME48k ) ) /*tbv SOLVED_COMP_ENC_DEC*/
#else
IF( EQ_16( length, L_SPEC48k ) )
#endif
{
IF( EQ_16( hqswb_clas, HQ_GEN_FB ) )
{
......
......@@ -63,11 +63,7 @@ void interleave_spectrum_fx(
/* Common inits */
p1 = coefs; /*Q12*/
p_out = coefs_out;
#ifdef SOLVED_COMP_ENC_DEC
IF( EQ_16( length, L_SPEC48k ) )
#else
IF( EQ_16( length, L_FRAME48k ) )
#endif
{
bw = intl_bw_48; /*Q0*/
cnt = intl_cnt_48; /*Q0*/
......@@ -337,20 +333,12 @@ void de_interleave_spectrum_fx(
p1 = coefs_out;
l_frame = length;
move16();
#ifdef SOLVED_COMP_ENC_DEC
IF( EQ_16( length, L_SPEC48k ) )
#else
IF( EQ_16( length, L_FRAME48k ) )
#endif
{
bw = intl_bw_48; /*Q0*/
cnt = intl_cnt_48; /*Q0*/
grps = N_INTL_GRP_48;
move16();
#ifdef SOLVED_COMP_ENC_DEC
l_frame = L_FRAME48k;
move16();
#endif
p2 = coefs_out + sublen[2]; /* 240, length/4 */
p3 = coefs_out + sublen[4]; /* 480, 2*length/4 */
p4 = coefs_out + sublen[5]; /* 720, 3*length/4 */
......
......@@ -4746,7 +4746,7 @@ ivas_error stereo_memory_enc_fx(
void stereo_switching_enc_fx(
CPE_ENC_HANDLE hCPE, /* i : CPE encoder structure */
Word16 old_input_signal_pri[], /* i : old input signal of primary channel */
Word32 old_input_signal_pri[], /* i : old input signal of primary channel */
const Word16 input_frame, /* i : input frame length */
const Word16 q_inp );
......
......@@ -3061,22 +3061,7 @@ void GenShapedSHBExcitation_fx(
Word16 n_mem2, /* i : n_mem2 scale factor to adjust 24.4/32kbps memories */
Word16 prev_Q_bwe_syn, /* i : st_fx->prev_Q_bwe_syn */
const Word32 bitrate,
const Word16 prev_bfi
#ifdef ADD_IVAS_TBE_CODE
, /* i : previous frame was concealed */
const Word16 element_mode, /* i : element mode */
const Word16 flag_ACELP16k, /* i : ACELP@16kHz flag */
Word16 *nlExc16k, /* i/o: NL exc for IC-BWE */
Word16 *mixExc16k, /* i/o: exc spreading for IC-BWE */
const Word32 extl_brate, /* i : extension layer bitarte */
const Word16 MSFlag, /* i : Multi Source flag */
Word16 EnvSHBres_4k[], /* i/o: TD envelope of the SHB residual signal */
Word16 *prev_pow_exc16kWhtnd, /* i/o: power of the LB excitation signal in the previous frame */
Word16 *prev_mix_factor, /* i/o: mixing factor in the previous frame */
Word16 *Env_error, /* o : error in SHB residual envelope modelling*/
Word16 Env_error_part[] /* o : per-segment error in SHB residual envelope modelling */
#endif
);
const Word16 prev_bfi );
 
void GenShapedSHBExcitation_ivas_enc_fx(
Word16 *excSHB, /* o : synthesized shaped shb excitation Q_bwe_exc*/
......@@ -3151,9 +3136,7 @@ void GenShapedSHBExcitation_ivas_dec_fx(
Word16 n_mem2, /* i : n_mem2 scale factor to adjust 24.4/32kbps memories */
Word16 prev_Q_bwe_syn, /* i : st_fx->prev_Q_bwe_syn */
const Word32 bitrate,
const Word16 prev_bfi
#if 1 // def ADD_IVAS_TBE_CODE
, /* i : previous frame was concealed */
const Word16 prev_bfi, /* i : previous frame was concealed */
const Word16 element_mode, /* i : element mode */
const Word16 flag_ACELP16k, /* i : ACELP@16kHz flag */
Word16 *nlExc16k, /* i/o: NL exc for IC-BWE */
......@@ -3165,7 +3148,6 @@ void GenShapedSHBExcitation_ivas_dec_fx(
Word16 *prev_mix_factor, /* i/o: mixing factor in the previous frame */
Word16 *Env_error, /* o : error in SHB residual envelope modelling*/
Word16 Env_error_part[] /* o : per-segment error in SHB residual envelope modelling */
#endif
);
 
void GenSHBSynth_fx(
......@@ -3309,9 +3291,6 @@ void synthesise_fb_high_band_fx(
#ifndef REMOVE_EVS_DUPLICATES
void prep_tbe_exc_fx(
const Word16 L_frame_fx, /* i : length of the frame */
#ifdef ADD_IVAS_TBE_CODE
const Word16 L_subfr,
#endif
const Word16 i_subfr_fx, /* i : subframe index */
const Word16 gain_pit_fx, /* i : Pitch gain Q14*/
const Word32 gain_code_fx, /* i : algebraic codebook gain 16+Q_exc*/
......@@ -3326,21 +3305,12 @@ void prep_tbe_exc_fx(
Word16 T0_frac, /* i : Fractional pitch variables Q0*/
const Word16 coder_type, /* i : coding type */
Word32 core_brate /* i :core bitrate */
#ifdef ADD_IVAS_TBE_CODE
,
const Word16 element_mode, /* i : element mode */
const Word16 idchan, /* i : channel ID */
const Word16 flag_TD_BWE, /* i : flag indicating whether hTD_BWE exists */
const Word16 tdm_LRTD_flag /* i : LRTD stereo mode flag */
#endif
);
#endif
 
void prep_tbe_exc_ivas_fx(
const Word16 L_frame_fx, /* i : length of the frame */
#if 1 // def ADD_IVAS_TBE_CODE
const Word16 L_subfr,
#endif
const Word16 i_subfr_fx, /* i : subframe index */
const Word16 gain_pit_fx, /* i : Pitch gain Q14*/
const Word32 gain_code_fx, /* i : algebraic codebook gain 16+Q_exc*/
......@@ -3354,14 +3324,11 @@ void prep_tbe_exc_ivas_fx(
Word16 T0, /* i : integer pitch variables Q0 */
Word16 T0_frac, /* i : Fractional pitch variables Q0*/
const Word16 coder_type, /* i : coding type */
Word32 core_brate
#if 1 // def ADD_IVAS_TBE_CODE
, /* i : core bitrate */
Word32 core_brate, /* i : core bitrate */
const Word16 element_mode, /* i : element mode */
const Word16 idchan, /* i : channel ID */
const Word16 flag_TD_BWE, /* i : flag indicating whether hTD_BWE exists */
const Word16 tdm_LRTD_flag /* i : LRTD stereo mode flag */
#endif
);
 
Word16 swb_formant_fac_fx( /* o : Formant filter strength [0,1] */
......@@ -4180,15 +4147,7 @@ Word16 get_codec_mode(
);
 
Word16 getTcxonly(
#ifdef IVAS_CODE_SWITCHING
const Word16 element_mode, /* i : IVAS element mode */
#endif
const Word32 total_brate /* i : total bitrate */
#ifdef IVAS_CODE_SWITCHING
,
const Word16 MCT_flag, /* i : hMCT handle allocated (1) or not (0)*/
const int16_t is_ism_format /* i : flag indicating ISM format */
#endif
);
 
Word16 getTcxonly_fx(
......@@ -6577,12 +6536,7 @@ void TonalMDCTConceal_SaveFreqSignal(
Word16 nNewSamplesCore,
const Word16 *scaleFactors,
const Word16 *scaleFactors_exp,
const Word16 gain_tcx_exp
#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT
,
const Word16 infoIGFStartLine
#endif
);
const Word16 gain_tcx_exp );
 
void TonalMDCTConceal_SaveFreqSignal_ivas_fx(
TonalMDCTConcealPtr hTonalMDCTConc,
......@@ -6650,9 +6604,6 @@ void TonalMDCTConceal_InsertNoise(
Word16 *pSeed, /*IN/OUT*/
const Word16 tiltCompFactor,
Word16 crossfadeGain,
#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT
const Word16concealment_noise[L_FRAME48k],
#endif
const Word16 crossOverFreq );
 
void TonalMDCTConceal_SaveTimeSignal(
......@@ -7646,9 +7597,6 @@ void configureFdCngDec_fx(
Word16 ApplyFdCng_fx(
Word16 *timeDomainInput, /* i : pointer to time domain i */
Word16 Q,
#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT
Word16 *powerSpectrum,
#endif
Word32 **cldfbBufferReal, /* i/o: real part of the CLDFB buffer */
Word32 **cldfbBufferImag, /* i/o: imaginary part of the CLDFB buffer */
Word16 *cldfbBufferScale, /* o : pointer to the scalefactor for real and imaginary part of the CLDFB buffer */
......@@ -7672,9 +7620,6 @@ Word16 ApplyFdCng_ivas_fx(
void perform_noise_estimation_dec_fx(
const Word16 *timeDomainInput, /* i: pointer to time domain i */
const Word16 Q,
#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT
float *power_spectrum,
#endif
HANDLE_FD_CNG_DEC hFdCngDec /* i/o: FD_CNG structure containing all buffers and variables */
);
 
......@@ -8389,10 +8334,6 @@ void improv_amr_wb_gs_fx(
const Word16 Last_ener_fx, /* i : Last energy (Q8) Q0*/
const Word16 rate_switching_reset, /* i : rate switching reset flag Q0*/
const Word16 last_coder_type /* i : Last coder_type Q0*/
#ifdef ADD_IVAS_GS_DEC_IMPR
,
const Word16 VeryLowRateSTflag /* i : Enable the noise enhancement for very low rate stereo generic mode */
#endif
);
 
// dec_amr_wb_fx.c
......@@ -8444,18 +8385,7 @@ ivas_error ppp_quarter_decoder_fx(
void open_decoder_LPD_fx(
Decoder_State *st,
const Word32 total_brate, /* Q0 */
#ifdef NEW_IVAS_OPEN_DEC
const Word32 last_total_brate,
#endif
const Word16 bwidth /* Q0 */
#ifdef NEW_IVAS_OPEN_DEC
,
const Word16 is_mct, /* i : MCT mode flag */
#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT
const Word16 last_element_mode,
#endif
const Word16 is_init /* i : indicate call from init_decoder() to avoid double TC initialization */
#endif
);
void open_decoder_LPD_ivas_fx(
Decoder_State *st, /* i/o: decoder state structure */
......@@ -9010,28 +8940,18 @@ void tcx_hm_modify_envelope(
);
 
// tns_base_dec_fx.c
#ifdef IVAS_CODE
void
#else
Word16
#endif
ReadTnsData( STnsConfig const *pTnsConfig,
Decoder_State *st,
Word16 *pnBits,
Word16 *stream,
Word16 *pnSize );
#define IVAS_CODE
#ifdef IVAS_CODE
void
#else
Word16
#endif
ReadTnsData_ivas_fx( STnsConfig const *pTnsConfig,
void ReadTnsData_ivas_fx( STnsConfig const *pTnsConfig,
Decoder_State *st,
Word16 *pnBits,
Word16 *stream,
Word16 *pnSize );
#undef IVAS_CODE
 
Word16 DecodeTnsData( STnsConfig const *pTnsConfig,
Word16 const *stream,
......@@ -9454,10 +9374,6 @@ void con_tcx_fx(
const Word16 coh, /* i : coherence of stereo signal */
Word16 *noise_seed, /* i/o: noise seed for stereo */
const Word16 only_left /* i : TD-PLC only in left channel */
#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT
,
const float *A_cng /* i : CNG LP filter coefficients */
#endif
#endif
 
);
......
......@@ -2102,22 +2102,7 @@ void GenShapedSHBExcitation_fx(
Word16 n_mem2, /* i : n_mem2 scale factor to adjust 24.4/32kbps memories */
Word16 prev_Q_bwe_syn, /* i : st_fx->prev_Q_bwe_syn */
const Word32 bitrate,
const Word16 prev_bfi
#ifdef ADD_IVAS_TBE_CODE
, /* i : previous frame was concealed */
const Word16 element_mode, /* i : element mode */
const Word16 flag_ACELP16k, /* i : ACELP@16kHz flag */
Word16 *nlExc16k, /* i/o: NL exc for IC-BWE */
Word16 *mixExc16k, /* i/o: exc spreading for IC-BWE */
const Word32 extl_brate, /* i : extension layer bitarte */
const Word16 MSFlag, /* i : Multi Source flag */
Word16 EnvSHBres_4k[], /* i/o: TD envelope of the SHB residual signal */
Word16 *prev_pow_exc16kWhtnd, /* i/o: power of the LB excitation signal in the previous frame */
Word16 *prev_mix_factor, /* i/o: mixing factor in the previous frame */
Word16 *Env_error, /* o : error in SHB residual envelope modelling*/
Word16 Env_error_part[] /* o : per-segment error in SHB residual envelope modelling */
#endif
)
const Word16 prev_bfi )
{
Word16 i, j, k;
Word16 wht_fil_mem[LPC_WHTN_ORDER];
......@@ -2160,20 +2145,6 @@ void GenShapedSHBExcitation_fx(
Word16 Q_temp;
Word16 prev_Q_bwe_exc_fb;
#ifdef ADD_IVAS_TBE_CODE
Word32 tempD;
Word16 alpha, step, mem_csfilt_left, mem_csfilt_right, excNoisyEnvLeft[L_FRAME16k], excNoisyEnvRight[L_FRAME16k];
Word16 cbsize;
Word16 mix_factor, old_fact, new_fact, fact, old_scale, new_scale, step_scale;
Word16 c0, c1, c2, c3, c4, c5, g1, g2, g, den;
Word16 EnvWhiteExc16k[L_FRAME16k], EnvExc16kWhtnd[L_FRAME16k];
Word16 EnvWhiteExc16k_4k[L_FRAME4k] = { 0 }, EnvExc16kWhtnd_4k[L_FRAME4k] = { 0 };
Word16 flag_plosive;
Word16 delta;
Word16 c0_part[NUM_SHB_SUBGAINS], c1_part[NUM_SHB_SUBGAINS], c2_part[NUM_SHB_SUBGAINS], c3_part[NUM_SHB_SUBGAINS], c4_part[NUM_SHB_SUBGAINS], c5_part[NUM_SHB_SUBGAINS];
mix_factor = 0.0f;
#endif
set16_fx( zero_mem, 0, LPC_SHB_ORDER );
set16_fx( wht_fil_mem, 0, LPC_WHTN_ORDER );
......@@ -2205,12 +2176,7 @@ void GenShapedSHBExcitation_fx(
/* i: exc16k in Q_bwe_exc */
/* o: exc16kWhtnd in Q_bwe_exc */
#ifdef ADD_IVAS_TBE_CODE
IF( GE_32( extl_brate, SWB_TBE_2k8 ) )
#else
IF( GE_32( bitrate, ACELP_24k40 ) )
#endif
{
temp2 = 0;
move16();
......@@ -2244,11 +2210,7 @@ void GenShapedSHBExcitation_fx(
Q_pow1 = shl( *Q_bwe_exc, 1 );
test();
#ifdef ADD_IVAS_TBE_CODE
IF( EQ_16( flag_ACELP16k, 0 ) )
#else
IF( ( LE_32( bitrate, ACELP_13k20 ) ) && ( GE_32( bitrate, ACELP_7k20 ) ) )
#endif
{
/* varEnvShape = mean_fx(voice_factors, 4); */
/* unroll the loop */
......@@ -2294,11 +2256,7 @@ void GenShapedSHBExcitation_fx(
test();
test();
test();
#ifdef ADD_IVAS_TBE_CODE
IF( EQ_16( element_mode, EVS_MONO ) && *mem_csfilt == 0 && ( ( EQ_32( bitrate, ACELP_9k60 ) ) || ( EQ_32( bitrate, ACELP_16k40 ) ) || ( EQ_32( bitrate, ACELP_24k40 ) ) ) )
#else
IF( *mem_csfilt == 0 && ( ( EQ_32( bitrate, ACELP_9k60 ) ) || ( EQ_32( bitrate, ACELP_16k40 ) ) || ( EQ_32( bitrate, ACELP_24k40 ) ) ) )
#endif
{
/* pre-init smoothing filter to avoid energy drop outs */
L_tmp = L_mult( excTmp2[0], 1638 );
......@@ -2325,42 +2283,6 @@ void GenShapedSHBExcitation_fx(
*mem_csfilt = Mult_32_16( L_tmp, varEnvShape );
move32();
}
#ifdef ADD_IVAS_TBE_CODE
if ( MSFlag > 0 )
{
varEnvShape = 0.995f;
csfilt_num2[0] = 1.0f - varEnvShape;
csfilt_den2[1] = -varEnvShape;
}
White_exc16k = exc16k;
/* Track the low band envelope */
if ( element_mode == IVAS_CPE_TD || element_mode == IVAS_CPE_DFT )
{
if ( extl_brate != SWB_TBE_1k10 && extl_brate != SWB_TBE_1k75 )
{
mem_csfilt_left = 0.0f;
mem_csfilt_right = 0.0f;
for ( k = 0; k < L_FRAME16k; k++ )
{
excNoisyEnvLeft[k] = mem_csfilt_left + csfilt_num2[0] * excTmp2[k];
mem_csfilt_left = -csfilt_den2[1] * excNoisyEnvLeft[k];
excNoisyEnvRight[L_FRAME16k - k - 1] = mem_csfilt_right + csfilt_num2[0] * excTmp2[L_FRAME16k - k - 1];
mem_csfilt_right = -csfilt_den2[1] * excNoisyEnvRight[L_FRAME16k - k - 1];
}
alpha = 0.0f;
step = 1.0f / L_FRAME16k;
for ( k = 0; k < L_FRAME16k; k++ )
{
excNoisyEnv[k] = alpha * excNoisyEnvLeft[k] + ( 1 - alpha ) * excNoisyEnvRight[k];
alpha += step;
}
}
}
else
#endif
{
/* Track the low band envelope */
L_tmp = *mem_csfilt;
......@@ -2376,21 +2298,6 @@ void GenShapedSHBExcitation_fx(
*mem_csfilt = L_tmp;
move32();
}
#ifdef ADD_IVAS_TBE_CODE
if ( extl_brate == SWB_TBE_1k10 || extl_brate == SWB_TBE_1k75 )
{
/* generate gaussian (white) excitation */
for ( k = 0; k < L_FRAME16k; k++ )
{
White_exc16k[k] = (float) own_random( &bwe_seed[0] );
}
/* normalize the amplitude of the gaussian excitation to that of the LB exc. */
pow22 = POW_EXC16k_WHTND;
v_multc( White_exc16k, (float) sqrt( pow1 / pow22 ), White_exc16k, L_FRAME16k );
}
else
#endif
{
/* create a random excitation - Reuse exc16k memory */
White_exc16k = exc16k;
......@@ -2439,98 +2346,10 @@ void GenShapedSHBExcitation_fx(
Q_pow22 = shl( sub( *Q_bwe_exc, NOISE_QADJ ), 1 );
}
#ifdef ADD_IVAS_TBE_CODE
flag_plosive = 0;
move16();
test();
test();
test();
IF(GE_32(extl_brate, SWB_TBE_2k8) || EQ_32(extl_brate, SWB_TBE_1k10) || EQ_32(extl_brate, SWB_TBE_1k75)))
#else
IF( GE_32( bitrate, ACELP_24k40 ) )
#endif
{
IF( EQ_16( *vf_ind, 20 ) ) /* encoder side */
{
#ifdef ADD_IVAS_TBE_CODE
if ( extl_brate == SWB_TBE_1k10 || extl_brate == SWB_TBE_1k75 )
{
/* calculate TD envelopes of exc16kWhtnd and White_exc16k */
find_td_envelope( White_exc16k, L_FRAME16k, 20, NULL, EnvWhiteExc16k );
find_td_envelope( exc16kWhtnd, L_FRAME16k, 20, NULL, EnvExc16kWhtnd );
for ( k = 0; k < L_FRAME4k; k++ )
{
EnvWhiteExc16k_4k[k] = EnvWhiteExc16k[4 * k];
EnvExc16kWhtnd_4k[k] = EnvExc16kWhtnd[4 * k];
}
/* calculate the optimal mix factor */
c0 = c1 = c2 = c3 = c4 = c5 = 0.0f;
for ( i = 0; i < NUM_SHB_SUBGAINS; i++ )
{
c0_part[i] = sum2_f( &EnvExc16kWhtnd_4k[i * L_FRAME4k / NUM_SHB_SUBGAINS], L_FRAME4k / NUM_SHB_SUBGAINS );
c1_part[i] = -2.0f * dotp( &EnvSHBres_4k[i * L_FRAME4k / NUM_SHB_SUBGAINS], &EnvExc16kWhtnd_4k[i * L_FRAME4k / NUM_SHB_SUBGAINS], L_FRAME4k / NUM_SHB_SUBGAINS );
c2_part[i] = sum2_f( &EnvWhiteExc16k_4k[i * L_FRAME4k / NUM_SHB_SUBGAINS], L_FRAME4k / NUM_SHB_SUBGAINS );
c3_part[i] = -2.0f * dotp( &EnvSHBres_4k[i * L_FRAME4k / NUM_SHB_SUBGAINS], &EnvWhiteExc16k_4k[i * L_FRAME4k / NUM_SHB_SUBGAINS], L_FRAME4k / NUM_SHB_SUBGAINS );
c4_part[i] = 2.0f * dotp( &EnvExc16kWhtnd_4k[i * L_FRAME4k / NUM_SHB_SUBGAINS], &EnvWhiteExc16k_4k[i * L_FRAME4k / NUM_SHB_SUBGAINS], L_FRAME4k / NUM_SHB_SUBGAINS );
c5_part[i] = sum2_f( &EnvSHBres_4k[i * L_FRAME4k / NUM_SHB_SUBGAINS], L_FRAME4k / NUM_SHB_SUBGAINS );
c0 += c0_part[i];
c1 += c1_part[i];
c2 += c2_part[i];
c3 += c3_part[i];
c4 += c4_part[i];
c5 += c5_part[i];
}
den = 4.0f * c0 * c2 - c4 * c4;
g1 = ( c3 * c4 - 2 * c1 * c2 ) / den;
g2 = ( c1 * c4 - 2 * c0 * c3 ) / den;
*Env_error = 0.0f;
flag_plosive = 0;
for ( i = 0; i < NUM_SHB_SUBGAINS; i++ )
{
Env_error_part[i] = c5_part[i] + g1 * g1 * c0_part[i] + g1 * c1_part[i] + g2 * g2 * c2_part[i] + g2 * c3_part[i] + g1 * g2 * c4_part[i];
*Env_error += Env_error_part[i];
if ( Env_error_part[i] > THR_ENV_ERROR_PLOSIVE )
{
/* envelope error is too high -> likely a plosive */
flag_plosive = 1;
}
}
if ( flag_plosive )
{
/* plosive detected -> set the mixing factor to 0 */
*vf_ind = 0;
mix_factor = 0.0f;
}
else
{
/* normalize gain */
g = g2 / ( g1 + g2 );
/* quantization of the mixing factor */
cbsize = 1 << NUM_BITS_SHB_VF;
delta = 1.0f / ( cbsize - 1 );
if ( g > 1.0f )
{
g = 1.0f;
}
else if ( g < delta )
{
/* prevent low gains to be quantized to 0 as this is reserved for plosives */
g = delta;
}
*vf_ind = usquant( g, &mix_factor, 0.0f, 1.0f / ( cbsize - 1 ), cbsize );
}
}
else
#endif
{
Estimate_mix_factors_fx( shb_res, Q_shb, exc16kWhtnd, *Q_bwe_exc, White_exc16k,
( *Q_bwe_exc - NOISE_QADJ ), pow1, Q_pow1, pow22, Q_pow22, voiceFacEst, vf_ind );
......@@ -2547,23 +2366,7 @@ void GenShapedSHBExcitation_fx(
}
ELSE /* decoder side */
{
#ifdef ADD_IVAS_TBE_CODE
if ( extl_brate == SWB_TBE_1k10 || extl_brate == SWB_TBE_1k75 )
{
if ( *vf_ind == 0 )
{
mix_factor = 0.0f;
flag_plosive = 1;
}
else
{
mix_factor = usdequant( *vf_ind, 0.0f, 1.0f / ( ( 1 << NUM_BITS_SHB_VF ) - 1 ) );
}
}
else
#endif
{
/* *vf_ind is an integer scale by 0.125f*/
{ /* *vf_ind is an integer scale by 0.125f*/
tmp = shl( *vf_ind, ( 15 - 3 ) );
tmp2 = MAX_16;
move16();
......@@ -2574,9 +2377,6 @@ void GenShapedSHBExcitation_fx(
}
}
}
#ifdef ADD_IVAS_TBE_CODE
IF( NE_32( extl_brate, SWB_TBE_1k10 ) && NE_32( extl_brate, SWB_TBE_1k75 ) )
#endif
{
voice_factors[0] = mult_r( voice_factors[0], tmp2 );
move16();
......@@ -2590,14 +2390,6 @@ void GenShapedSHBExcitation_fx(
move16();
}
}
#ifdef ADD_IVAS_TBE_CODE
if ( element_mode >= IVAS_CPE_DFT && nlExc16k != NULL )
{
/* save buffers for IC-BWE */
mvr2r( exc16kWhtnd, nlExc16k, L_FRAME16k );
v_multc( White_exc16k, (float) sqrt( pow1 / pow22 ), mixExc16k, L_FRAME16k );
}
#endif
tmp = sub( Q_temp, 3 );
FOR( k = 0; k < L_FRAME16k; k++ )
......@@ -2611,47 +2403,8 @@ void GenShapedSHBExcitation_fx(
deemph_fx( White_exc16k, PREEMPH_FAC, L_FRAME16k, tbe_demph );
/* i/o: White_exc16k (Q_bwe_exc-NOISE_QADJ) */
/* i: tbe_demph (Q_bwe_exc-NOISE_QADJ) */
#ifdef ADD_IVAS_TBE_CODE
if ( extl_brate == SWB_TBE_1k10 || extl_brate == SWB_TBE_1k75 )
{
if ( !flag_plosive ) /* use only LB excitation in case of plosives */
{
/* re-scale gaussian excitation at the beginning to gradually move from old energy to new energy */
old_scale = (float) sqrt( *prev_pow_exc16kWhtnd / pow1 );
new_scale = 1.0f;
step_scale = ( new_scale - old_scale ) / ( L_FRAME16k / 2 );
scale = old_scale;
/* interpolate between the old and the new value of the mixing factor */
old_fact = *prev_mix_factor;
new_fact = mix_factor;
step = ( new_fact - old_fact ) / ( L_FRAME16k / 2 );
fact = old_fact;
/* mixing of LB and gaussian excitation in the first half of the frame */
for ( k = 0; k < L_FRAME16k / 2; k++ )
{
exc16kWhtnd[k] = (float) fact * ( White_exc16k[k] * scale ) + (float) ( 1 - fact ) * exc16kWhtnd[k];
fact += step;
scale += step_scale;
}
/* mixing of LB and gaussian excitation in the second half of the frame */
for ( ; k < L_FRAME16k; k++ )
{
exc16kWhtnd[k] = (float) new_fact * White_exc16k[k] + (float) ( 1 - new_fact ) * exc16kWhtnd[k];
}
}
preemph( exc16kWhtnd, PREEMPH_FAC, L_FRAME16k, tbe_premph );
}
else
#endif
{
#ifdef ADD_IVAS_TBE_CODE
if ( coder_type == UNVOICED || MSFlag == 1 )
#else
IF( EQ_16( coder_type, UNVOICED ) )
#endif
{
L_tmp = root_a_over_b_fx( pow1, Q_pow1, pow22, Q_pow22, &exp );
scale = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /*Q15 */
......@@ -2753,11 +2506,7 @@ void GenShapedSHBExcitation_fx(
}
}
#ifdef ADD_IVAS_TBE_CODE
IF( LT_32( extl_brate, SWB_TBE_2k8 ) )
#else
IF( LT_32( bitrate, ACELP_24k40 ) )
#endif
{
Syn_filt_s( 0, lpc_shb, LPC_SHB_ORDER, exc16kWhtnd, excSHB, L_FRAME16k, state_lpc_syn, 1 );
/* i: exc16kWhtnd in Q_bwe_exc */
......@@ -2866,10 +2615,6 @@ void GenShapedSHBExcitation_fx(
set16_fx( White_exc16k_FB, 0, L_FRAME16k );
}
#ifdef ADD_IVAS_TBE_CODE
*prev_pow_exc16kWhtnd = pow1;
*prev_mix_factor = mix_factor;
#endif
return;
}
......@@ -3288,7 +3033,6 @@ void GenShapedSHBExcitation_ivas_enc_fx(
{
IF( EQ_16( *vf_ind, 20 ) ) /* encoder side */
{
#ifndef ADD_IVAS_TBE_CODE // BELOW PART WILL NEED TO BE CONVERTED FOR ENCODER!!
test();
IF( EQ_32( extl_brate, SWB_TBE_1k10 ) || EQ_32( extl_brate, SWB_TBE_1k75 ) )
{
......@@ -3474,33 +3218,6 @@ void GenShapedSHBExcitation_ivas_enc_fx(
}
}
ELSE
#else
UNUSED_PARAM( Env_error_part );
UNUSED_PARAM( Env_error );
UNUSED_PARAM( EnvSHBres_4k );
UNUSED_PARAM( c5_part );
UNUSED_PARAM( c1 );
UNUSED_PARAM( den );
UNUSED_PARAM( c3_part );
UNUSED_PARAM( c0 );
UNUSED_PARAM( delta );
UNUSED_PARAM( c3 );
UNUSED_PARAM( c2_part );
UNUSED_PARAM( c1_part );
UNUSED_PARAM( EnvWhiteExc16k );
UNUSED_PARAM( g2 );
UNUSED_PARAM( c5 );
UNUSED_PARAM( c4_part );
UNUSED_PARAM( EnvWhiteExc16k_4k );
UNUSED_PARAM( c2 );
UNUSED_PARAM( g );
UNUSED_PARAM( cbsize );
UNUSED_PARAM( g1 );
UNUSED_PARAM( EnvExc16kWhtnd );
UNUSED_PARAM( c0_part );
UNUSED_PARAM( EnvExc16kWhtnd_4k );
UNUSED_PARAM( c4 );
#endif
{
Estimate_mix_factors_fx( shb_res, Q_shb, exc16kWhtnd, *Q_bwe_exc, White_exc16k,
Q_White_exc16k, pow1, Q_pow1, pow22, Q_pow22, voiceFacEst, vf_ind );
......@@ -4003,7 +3720,6 @@ void GenShapedSHBExcitation_ivas_dec_fx(
move16();
move32();
#if 1 // def ADD_IVAS_TBE_CODE
Word16 alpha, step, mem_csfilt_left, mem_csfilt_right, excNoisyEnvLeft[L_FRAME16k], excNoisyEnvRight[L_FRAME16k];
Word16 cbsize;
Word16 mix_factor, old_fact, new_fact, fact, old_scale, new_scale, step_scale;
......@@ -4018,7 +3734,7 @@ void GenShapedSHBExcitation_ivas_dec_fx(
mix_factor = 0; /* Q15 */
move16();
#endif
set16_fx( zero_mem, 0, LPC_SHB_ORDER );
set16_fx( wht_fil_mem, 0, LPC_WHTN_ORDER );
FOR( i = 0; i < L_FRAME32k; i = i + 2 )
......@@ -4050,11 +3766,7 @@ void GenShapedSHBExcitation_ivas_dec_fx(
/* i: exc16k in Q_bwe_exc */
/* o: exc16kWhtnd in Q_bwe_exc */
#if 1 // def ADD_IVAS_TBE_CODE
IF( GE_32( extl_brate, SWB_TBE_2k8 ) )
#else
IF( GE_32( bitrate, ACELP_24k40 ) )
#endif
{
temp2 = 0;
move16();
......@@ -4089,11 +3801,8 @@ void GenShapedSHBExcitation_ivas_dec_fx(
Q_pow1 = shl( *Q_bwe_exc, 1 );
test();
#if 1 // ADD_IVAS_TBE_CODE
IF( flag_ACELP16k == 0 )
#else
IF( ( LE_32( bitrate, ACELP_13k20 ) ) && ( GE_32( bitrate, ACELP_7k20 ) ) )
#endif
{
/* varEnvShape = mean_fx(voice_factors, 4); */
/* unroll the loop */
......@@ -4139,12 +3848,8 @@ void GenShapedSHBExcitation_ivas_dec_fx(
test();
test();
test();
#if 1 // def ADD_IVAS_TBE_CODE
test();
IF( EQ_16( element_mode, EVS_MONO ) && *mem_csfilt == 0 && ( ( EQ_32( bitrate, ACELP_9k60 ) ) || ( EQ_32( bitrate, ACELP_16k40 ) ) || ( EQ_32( bitrate, ACELP_24k40 ) ) ) )
#else
IF( *mem_csfilt == 0 && ( ( EQ_32( bitrate, ACELP_9k60 ) ) || ( EQ_32( bitrate, ACELP_16k40 ) ) || ( EQ_32( bitrate, ACELP_24k40 ) ) ) )
#endif
{
/* pre-init smoothing filter to avoid energy drop outs */
L_tmp = L_mult( excTmp2[0], 1638 );
......@@ -4171,7 +3876,7 @@ void GenShapedSHBExcitation_ivas_dec_fx(
*mem_csfilt = Mult_32_16( L_tmp, varEnvShape );
move32();
}
#if 1 // def ADD_IVAS_TBE_CODE
IF( MSFlag > 0 )
{
// varEnvShape = 0.995f;
......@@ -4231,7 +3936,7 @@ void GenShapedSHBExcitation_ivas_dec_fx(
}
}
ELSE
#endif
{
/* Track the low band envelope */
L_tmp = L_shl( *mem_csfilt, sub( Q_excTmp2, *Q_bwe_exc ) );
......@@ -4257,7 +3962,6 @@ void GenShapedSHBExcitation_ivas_dec_fx(
*mem_csfilt = L_shr( L_tmp, sub( Q_excTmp2, *Q_bwe_exc ) );
move32();
}
#if 1 // def ADD_IVAS_TBE_CODE
test();
IF( EQ_32( extl_brate, SWB_TBE_1k10 ) || EQ_32( extl_brate, SWB_TBE_1k75 ) )
{
......@@ -4303,7 +4007,6 @@ void GenShapedSHBExcitation_ivas_dec_fx(
}
}
ELSE
#endif
{
/* create a random excitation - Reuse exc16k memory */
White_exc16k = exc16k;
......@@ -4352,20 +4055,15 @@ void GenShapedSHBExcitation_ivas_dec_fx(
Q_White_exc16k = add( Q_White_exc16k, sub( Q_excTmp2, 10 ) );
}
#if 1 // def ADD_IVAS_TBE_CODE
flag_plosive = 0;
move16();
test();
test();
test();
IF( GE_32( extl_brate, SWB_TBE_2k8 ) || EQ_32( extl_brate, SWB_TBE_1k10 ) || EQ_32( extl_brate, SWB_TBE_1k75 ) )
#else
IF( GE_32( bitrate, ACELP_24k40 ) )
#endif
{
IF( EQ_16( *vf_ind, 20 ) ) /* encoder side */
{
#ifndef ADD_IVAS_TBE_CODE // BELOW PART WILL NEED TO BE CONVERTED FOR ENCODER!!
test();
IF( EQ_32( extl_brate, SWB_TBE_1k10 ) || EQ_32( extl_brate, SWB_TBE_1k75 ) )
{
......@@ -4544,33 +4242,6 @@ void GenShapedSHBExcitation_ivas_dec_fx(
}
}
ELSE
#else
UNUSED_PARAM( Env_error_part );
UNUSED_PARAM( Env_error );
UNUSED_PARAM( EnvSHBres_4k );
UNUSED_PARAM( c5_part );
UNUSED_PARAM( c1 );
UNUSED_PARAM( den );
UNUSED_PARAM( c3_part );
UNUSED_PARAM( c0 );
UNUSED_PARAM( delta );
UNUSED_PARAM( c3 );
UNUSED_PARAM( c2_part );
UNUSED_PARAM( c1_part );
UNUSED_PARAM( EnvWhiteExc16k );
UNUSED_PARAM( g2 );
UNUSED_PARAM( c5 );
UNUSED_PARAM( c4_part );
UNUSED_PARAM( EnvWhiteExc16k_4k );
UNUSED_PARAM( c2 );
UNUSED_PARAM( g );
UNUSED_PARAM( cbsize );
UNUSED_PARAM( g1 );
UNUSED_PARAM( EnvExc16kWhtnd );
UNUSED_PARAM( c0_part );
UNUSED_PARAM( EnvExc16kWhtnd_4k );
UNUSED_PARAM( c4 );
#endif
{
Estimate_mix_factors_fx( shb_res, Q_shb, exc16kWhtnd, *Q_bwe_exc, White_exc16k,
( *Q_bwe_exc - NOISE_QADJ ), pow1, Q_pow1, pow22, Q_pow22, voiceFacEst, vf_ind );
......@@ -4588,7 +4259,6 @@ void GenShapedSHBExcitation_ivas_dec_fx(
ELSE /* decoder side */
{
test();
#if 1 // def ADD_IVAS_TBE_CODE
IF( EQ_32( extl_brate, SWB_TBE_1k10 ) || EQ_32( extl_brate, SWB_TBE_1k75 ) )
{
IF( *vf_ind == 0 )
......@@ -4606,7 +4276,6 @@ void GenShapedSHBExcitation_ivas_dec_fx(
}
}
ELSE
#endif
{
/* *vf_ind is an integer scale by 0.125f*/
tmp = shl( *vf_ind, ( 15 - 3 ) );
......@@ -4619,10 +4288,8 @@ void GenShapedSHBExcitation_ivas_dec_fx(
}
}
}
#if 1 // def ADD_IVAS_TBE_CODE
test();
IF( NE_32( extl_brate, SWB_TBE_1k10 ) && NE_32( extl_brate, SWB_TBE_1k75 ) )
#endif
{
voice_factors[0] = mult_r( voice_factors[0], tmp2 );
move16();
......@@ -4979,10 +4646,8 @@ void GenShapedSHBExcitation_ivas_dec_fx(
set16_fx( White_exc16k_FB, 0, L_FRAME16k );
}
#if 1 // def ADD_IVAS_TBE_CODE
*prev_pow_exc16kWhtnd = L_shr_sat( pow1, Q_pow1 ); // power goes above MAX_32
*prev_mix_factor = mix_factor;
#endif
return;
}
......@@ -7566,56 +7231,7 @@ void Estimate_mix_factors_fx(
return;
}
#ifdef ADD_IVAS_TBE_CODE
/*-------------------------------------------------------------------*
* tbe_celp_exc() *
* *
* Prepare adaptive part of TBE excitation *
*-------------------------------------------------------------------*/
void tbe_celp_exc(
const int16_t element_mode, /* i : element mode */
const int16_t idchan, /* i : channel ID */
float *bwe_exc, /* i/o: BWE excitation */
const int16_t L_frame, /* i : frame length */
const int16_t L_subfr, /* i : subframe length */
const int16_t i_subfr, /* i : subframe index */
const int16_t T0, /* i : integer pitch lag */
const int16_t T0_frac, /* i : fraction of lag */
float *error, /* i/o: error */
const int16_t tdm_LRTD_flag /* i : LRTD stereo mode flag */
)
{
int16_t i, offset;
if ( element_mode == IVAS_CPE_TD && idchan == 1 && !tdm_LRTD_flag )
{
return;
}
if ( L_frame == L_FRAME )
{
offset = tbe_celp_exc_offset( T0, T0_frac );
for ( i = 0; i < L_subfr * HIBND_ACB_L_FAC; i++ )
{
bwe_exc[i + i_subfr * HIBND_ACB_L_FAC] = bwe_exc[i + i_subfr * HIBND_ACB_L_FAC - offset + (int16_t) *error];
}
*error += (float) offset - (float) T0 * HIBND_ACB_L_FAC - 0.25f * HIBND_ACB_L_FAC * (float) T0_frac;
}
else
{
offset = T0 * 2 + (int16_t) ( (float) T0_frac * 0.5f + 4 + 0.5f ) - 4;
for ( i = 0; i < L_subfr * 2; i++ )
{
bwe_exc[i + i_subfr * 2] = bwe_exc[i + i_subfr * 2 - offset + (int16_t) *error];
}
*error += (float) offset - (float) T0 * 2 - 0.5f * (float) T0_frac;
}
return;
}
#endif
/*======================================================================================*/
/* FUNCTION : prep_tbe_exc_fx() */
/*--------------------------------------------------------------------------------------*/
......@@ -7647,9 +7263,6 @@ void tbe_celp_exc(
#ifndef REMOVE_EVS_DUPLICATES
void prep_tbe_exc_fx(
const Word16 L_frame_fx, /* i : length of the frame */
#ifdef ADD_IVAS_TBE_CODE
const Word16 L_subfr,
#endif
const Word16 i_subfr_fx, /* i : subframe index */
const Word16 gain_pit_fx, /* i : Pitch gain Q14*/
const Word32 gain_code_fx, /* i : algebraic codebook gain 16+Q_exc*/
......@@ -7663,15 +7276,7 @@ void prep_tbe_exc_fx(
Word16 T0, /* i : integer pitch variables Q0 */
Word16 T0_frac, /* i : Fractional pitch variables Q0*/
const Word16 coder_type, /* i : coding type */
Word32 core_brate
#ifdef ADD_IVAS_TBE_CODE
, /* i : core bitrate */
const int16_t element_mode, /* i : element mode */
const int16_t idchan, /* i : channel ID */
const int16_t flag_TD_BWE, /* i : flag indicating whether hTD_BWE exists */
const int16_t tdm_LRTD_flag /* i : LRTD stereo mode flag */
#endif
)
Word32 core_brate )
{
Word16 i;
Word16 tmp_code_fx[2 * L_SUBFR * HIBND_ACB_L_FAC];
......@@ -7685,10 +7290,8 @@ void prep_tbe_exc_fx(
Word32 L_tmp, Ltemp1, Ltemp2;
Word32 tempQ31;
Word16 tempQ15;
#ifndef ADD_IVAS_TBE_CODE
Word16 L_subfr = L_SUBFR;
move16();
#endif
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
......@@ -7719,17 +7322,6 @@ void prep_tbe_exc_fx(
*voice_factors_fx = s_min( s_max( *voice_factors_fx, 0 ), MAX_16 );
move16();
#ifdef ADD_IVAS_TBE_CODE
IF( EQ_16( element_mode, IVAS_CPE_TD ) && EQ_16( idchan, 1 ) && !tdm_LRTD_flag )
{
IF( flag_TD_BWE && i_subfr == 0 )
{
set16_fx( bwe_exc, 0, L_FRAME32k );
}
return;
}
#endif
IF( EQ_16( L_frame_fx, L_FRAME ) )
{
interp_code_5over2_fx( code_fx, tmp_code_fx, L_subfr ); /* code: Q9, tmp_code: Q9 */
......@@ -7816,9 +7408,7 @@ void prep_tbe_exc_fx(
#endif
void prep_tbe_exc_ivas_fx(
const Word16 L_frame_fx, /* i : length of the frame */
#if 1 // def ADD_IVAS_TBE_CODE
const Word16 L_subfr,
#endif
const Word16 i_subfr_fx, /* i : subframe index */
const Word16 gain_pit_fx, /* i : Pitch gain Q14*/
const Word32 gain_code_fx, /* i : algebraic codebook gain 16+Q_exc*/
......@@ -7832,14 +7422,11 @@ void prep_tbe_exc_ivas_fx(
Word16 T0, /* i : integer pitch variables Q0 */
Word16 T0_frac, /* i : Fractional pitch variables Q0*/
const Word16 coder_type, /* i : coding type */
Word32 core_brate
#if 1 // def ADD_IVAS_TBE_CODE
, /* i : core bitrate */
Word32 core_brate, /* i : core bitrate */
const Word16 element_mode, /* i : element mode */
const Word16 idchan, /* i : channel ID */
const Word16 flag_TD_BWE, /* i : flag indicating whether hTD_BWE exists */
const Word16 tdm_LRTD_flag /* i : LRTD stereo mode flag */
#endif
)
{
Word16 i;
......@@ -7885,7 +7472,7 @@ void prep_tbe_exc_ivas_fx(
*voice_factors_fx = s_min( s_max( *voice_factors_fx, 0 ), MAX_16 );
move16();
#if 1 // def ADD_IVAS_TBE_CODE
test();
test();
IF( EQ_16( element_mode, IVAS_CPE_TD ) && EQ_16( idchan, 1 ) && !tdm_LRTD_flag )
......@@ -7898,7 +7485,6 @@ void prep_tbe_exc_ivas_fx(
return;
}
#endif
IF( EQ_16( L_frame_fx, L_FRAME ) )
{
interp_code_5over2_fx( code_fx, tmp_code_fx, L_subfr ); /* code: Q9, tmp_code: Q9 */
......
......@@ -123,9 +123,6 @@ void mdct_window_sine(
Word16 n /* Q0 */
)
{
#ifdef IVAS_CODE
if ( element_mode == EVS_MONO )
#endif
{
const PWord16 *table;
table = getSineWindowTable( n );
......@@ -138,42 +135,6 @@ void mdct_window_sine(
}
// PMT("getSineWindowTable needs to be updated for IVAS")
}
#ifdef IVAS_CODE
else
{
const float *window_table = 0;
Word16 buf_in_size = 0;
switch ( window_type )
{
case FULL_OVERLAP:
window_table = tcx_mdct_window_48;
buf_in_size = 420;
break;
case HALF_OVERLAP:
window_table = tcx_mdct_window_half_48;
buf_in_size = 180;
break;
case TRANSITION_OVERLAP:
case MIN_OVERLAP:
window_table = tcx_mdct_window_trans_48;
buf_in_size = 60;
break;
default:
assert( 0 && "Unsupported window type" );
break;
}
if ( Fs == 48000 )
{
mvr2r( window_table, window, n );
}
else
{
lerp( window_table, window, n, buf_in_size );
}
}
#endif
}
......
......@@ -96,10 +96,8 @@ void InitTnsConfiguration(
Word32 nSampleRate;
Word16 s1;
Word16 s2;
#ifndef ADD_IVAS_TNS
(void) ( element_mode );
(void) ( is_mct );
#endif
nSampleRate = bwMode2fs[bwidth];
move32();
startLineFilter = &pTnsConfig->iFilterBorders[1];
......@@ -138,21 +136,6 @@ void InitTnsConfiguration(
ELSE
IF( GT_32( nSampleRate, INT_FS_16k ) )
{
#ifdef ADD_IVAS_TNS
if ( ( element_mode > IVAS_SCE ) && ( total_brate >= ( is_mct ? IVAS_32k : IVAS_48k ) ) )
{
pTnsConfig->nMaxFilters = sizeof( tnsParameters32kHz_Stereo ) / sizeof( tnsParameters32kHz_Stereo[0] );
if ( nSampleRate == 100 * frameLength ) /* sub-frame length is <= 10 ms */
{
pTnsConfig->pTnsParameters = tnsParameters32kHz_grouped;
}
else
{
pTnsConfig->pTnsParameters = tnsParameters32kHz_Stereo;
}
}
else
#endif
{
move16();
......@@ -212,9 +195,6 @@ void InitTnsConfiguration(
move16();
pTnsConfig->iFilterBorders[0] = frameLength;
}
#ifdef ADD_IVAS_TNS
pTnsConfig->allowTnsOnWhite = 0;
#endif
return; /*TNS_NO_ERROR;*/
}
......
......@@ -64,26 +64,11 @@ static void windowing( const Word16 *, Word16 *, const Word16 *, const Word16, c
static void windowing_ROM_optimized( const Word16 *, Word16 *, const Word16, const Word16, const Word16 );
static void fft_spec2_fx( const Word16[], Word32[], const Word16 );
static void trans_ana_fx( const Word16 *, Word16 *, Word16 *, Word16 *, const Word16, const Word16, const Word16, const Word16, Word16 *, Word16 *, Word16 *, Word16 * );
static void peakfinder_fx( const Word16 *, const Word16, Word16 *, Word16 *, const Word16
#ifdef IVAS_FEC_ECU_TO_COMPLETE
,
const Word16 endpoints /* i : Flag to include endpoints in peak search */
#endif
);
static void peakfinder_fx( const Word16 *, const Word16, Word16 *, Word16 *, const Word16 );
static Word16 imax_fx( const Word16 *, const Word16 );
static void spec_ana_fx( const Word16 *prevsynth, Word16 *plocs, Word32 *plocsi, Word16 *num_plocs, Word16 *X_sav, const Word16 output_frame, const Word16 bwidth_fx, Word16 *Q
#ifdef IVAS_FEC_ECU_TO_COMPLETE
,
const Word16 element_mode,
Word16 *noise_fac,
const Word16 pcorr
#endif
);
static void spec_ana_fx( const Word16 *prevsynth, Word16 *plocs, Word32 *plocsi, Word16 *num_plocs, Word16 *X_sav, const Word16 output_frame, const Word16 bwidth_fx, Word16 *Q );
static void subst_spec_fx( const Word16 *, const Word32 *, Word16 *, const Word16, Word16 *, const Word16 *, const Word16, const Word16 *, const Word16, Word16 *, const Word16 *, const Word16 *, Word16, const Word16 * );
static Word16 rand_phase_fx( const Word16 seed, Word16 *sin_F, Word16 *cos_F );
#ifdef IVAS_FEC_ECU_TO_COMPLETE
static float imax2_jacobsen_mag( const float *y_re, const float *y_im );
#endif
/*------------------------------------------------------------------*
* rand_phase()
......@@ -666,9 +651,6 @@ static void ivas_peakfinder_fx(
move16();
}
len0Minus2 = sub( len0, 2 );
#ifdef IVAS_FEC_ECU_TO_COMPLETE
PMT( "\nlen0Minus2 = sub(len0, 2) is it still correct if IVAS_FEC_ECU_TO_COMPLETE is activated\n" )
#endif
FOR( i = 0; i < len0Minus2; i++ )
{
......@@ -912,10 +894,6 @@ static void peakfinder_fx(
Word16 *plocs, /* o : the indices of the identified peaks in x0 Q0 */
Word16 *cInd, /* o : number of identified peaks Q0 */
const Word16 sel /* i : The amount above surrounding data for a peak to be identified */
#ifdef IVAS_FEC_ECU_TO_COMPLETE
,
const Word16 endpoints /* i : Flag to include endpoints in peak search */
#endif
)
{
const Word16 *pX0;
......@@ -951,11 +929,6 @@ static void peakfinder_fx(
pInd = indarr;
pDx01 = dx0;
pDx0 = pDx01 + 1;
#ifdef IVAS_FEC_ECU_TO_COMPLETE
len = 0;
move16();
IF( endpoints )
#endif
{
*pX++ = *pX0++;
move16();
......@@ -965,9 +938,6 @@ static void peakfinder_fx(
move16();
}
len0Minus2 = sub( len0, 2 );
#ifdef IVAS_FEC_ECU_TO_COMPLETE
PMT( "\nlen0Minus2 = sub(len0, 2) is it still correct if IVAS_FEC_ECU_TO_COMPLETE is activated\n" )
#endif
FOR( i = 0; i < len0Minus2; i++ )
{
......@@ -981,9 +951,6 @@ static void peakfinder_fx(
}
pX0++;
}
#ifdef IVAS_FEC_ECU_TO_COMPLETE
IF( endpoints )
#endif
{
*pInd = len0Minus1;
move16();
......@@ -994,13 +961,7 @@ static void peakfinder_fx(
minimum_fx( x, len, &minMag );
pInd = indarr;
#ifdef IVAS_FEC_ECU_TO_COMPLETE
test();
test();
IF( GT_16( len, 2 ) || ( !endpoints && ( len > 0 ) ) )
#else
IF( GT_16( len, 2 ) )
#endif
{
/* Set initial parameters for loop */
tempMag = minMag;
......@@ -1011,9 +972,6 @@ static void peakfinder_fx(
move16();
threshold = add( leftMin, sel );
#ifdef IVAS_FEC_ECU_TO_COMPLETE
IF( len > 0 )
#endif
{
/* Deal with first point a little differently since tacked it on
Calculate the sign of the derivative since we took the first point
......@@ -1060,20 +1018,6 @@ static void peakfinder_fx(
}
pX--; /* After decrement, pX points to either x[-1] or x[0]. */
}
#ifdef IVAS_FEC_ECU_TO_COMPLETE
ELSE
{
PMTE()
ii = -1; /* First point is a peak */
if ( len >= 2 )
{
if ( x[1] >= x[0] )
{
ii = 0; /* First point is a valley, skip it */
}
}
}
#endif
*cInd = 0;
move16();
/*Loop through extrema which should be peaks and then valleys*/
......@@ -1179,9 +1123,6 @@ static void peakfinder_fx(
}
ELSE /* This is a monotone function where an endpoint is the only peak */
{
#ifdef IVAS_FEC_ECU_TO_COMPLETE
IF( endpoints )
#endif
{
xInd = 1;
move16();
......@@ -1206,13 +1147,6 @@ static void peakfinder_fx(
move16();
}
}
#ifdef IVAS_FEC_ECU_TO_COMPLETE
ELSE
{ /* Input constant or all zeros -- no peaks found */
*cInd = 0;
move16();
}
#endif
}
}
......@@ -1709,12 +1643,6 @@ static void spec_ana_fx(
const Word16 output_frame, /* i : Frame length Q0 */
const Word16 bwidth_fx, /* i : Encoded bandwidth index Q0 */
Word16 *Q /* o : Q value of the fft spectrum */
#ifdef IVAS_FEC_ECU_TO_COMPLETE
,
const Word16 element_mode, /* i : IVAS element mode */
Word16 *noise_fac, /* o : for few peaks zeroing valleys decision making */
const Word16 pcorr
#endif
)
{
Word16 Lprot, LprotLog2Minus1, hamm_len2, Lprot2, Lprot2_1, m, n;
......@@ -1782,52 +1710,18 @@ static void spec_ana_fx(
IF( EQ_16( output_frame, L_FRAME48k ) )
{
/* Apply hamming-rect window */
#ifdef IVAS_FEC_ECU_TO_COMPLETE
IF( EQ_16( element_mode, EVS_MONO ) )
#endif
{
windowing( xfp, xfp, w_hamm_sana48k_2_fx, rectLength, hamm_len2 );
}
#ifdef IVAS_FEC_ECU_TO_COMPLETE
ELSE
{
PMTE()
// window_corr = w_hamm[0];
// window_corr_step = w_hamm[0] / hamm_len2;
// for (i = 0; i < hamm_len2; i++)
//{
// xfp[i] = prevsynth[i] * (w_hamm[i] - window_corr);
// xfp[Lprot - i - 1] = prevsynth[Lprot - i - 1] * (w_hamm[i] - window_corr);
// window_corr -= window_corr_step;
// }
}
#endif
/* Spectrum */
fft3_fx( xfp, xfp, Lprot );
}
ELSE
{
#ifdef IVAS_FEC_ECU_TO_COMPLETE
IF( EQ_16( element_mode, EVS_MONO ) )
#endif
{
/* Apply hamming-rect window */
windowing_ROM_optimized( xfp, xfp, sinTblOffset, rectLength, hamm_len2 );
}
#ifdef IVAS_FEC_ECU_TO_COMPLETE
ELSE
{
PMTE()
// window_corr = w_hamm[0];
// window_corr_step = w_hamm[0] / hamm_len2;
// for (i = 0; i < hamm_len2; i++)
//{
// xfp[i] = prevsynth[i] * (w_hamm[i] - window_corr);
// xfp[Lprot - i - 1] = prevsynth[Lprot - i - 1] * (w_hamm[i] - window_corr);
// window_corr -= window_corr_step;
// }
}
#endif
/* Spectrum */
r_fft_fx_lc( pFftTbl, Lprot, Lprot2, LprotLog2Minus1, xfp, xfp, 1 );
}
......@@ -1880,35 +1774,12 @@ static void spec_ana_fx(
/* Find maximum and minimum. */
maximum_fx( xfp, Lprot2_1, &Xmax );
minimum_fx( xfp, Lprot2_1, &Xmin );
#ifdef IVAS_FEC_ECU_TO_COMPLETE
IF( EQ_16( element_mode, EVS_MONO ) )
#endif
{
sel = mult_r( sub( Xmax, Xmin ), CMPLMNT_PFIND_SENS_FX );
}
#ifdef IVAS_FEC_ECU_TO_COMPLETE
ELSE
{
sel = ( Xmax - Xmin ) * ( 1.0f - ST_PFIND_SENS );
}
#endif
peakfinder_fx( xfp, Lprot2_1, plocs, num_plocs, sel
#ifdef IVAS_FEC_ECU_TO_COMPLETE
,
endpoints
#endif
);
peakfinder_fx( xfp, Lprot2_1, plocs, num_plocs, sel );
#ifdef IVAS_FEC_ECU_TO_COMPLETE
/* Currently not the pitch correlation but some LF correlation */
if ( element_mode != EVS_MONO && *num_plocs > 50 && pcorr < 0.6f )
{
*num_plocs = 0;
}
IF( EQ_16( element_mode, EVS_MONO ) )
#endif
{
/* Refine peaks */
......@@ -1955,105 +1826,6 @@ static void spec_ana_fx(
move32(); /* in Q16. Append the fractional part to the integral part. */
}
}
#ifdef IVAS_FEC_ECU_TO_COMPLETE
ELSE
{
Lprot2p1 = Lprot / 2 + 1;
/* Refine peaks */
pPlocsi = plocsi;
pPlocs = plocs;
n = *num_plocs; /* number of peaks to process */
/* Special case-- The very 1st peak if it is at 0 index position (DC) */
/* With DELTA_CORR_F0_INT == 2 one needs to handle both *pPlocs==0 and *pPlocs==1 */
if ( n > 0 && *pPlocs == 0 ) /* Very 1st peak position possible to have a peak at 0/DC index position. */
{
*pPlocsi++ = *pPlocs + imax_pos( &xfp[*pPlocs] );
pPlocs++;
n = n - 1;
}
if ( n > 0 && *pPlocs == 1 ) /* Also 2nd peak position uses DC which makes jacobsen unsuitable. */
{
*pPlocsi++ = *pPlocs - 1 + imax_pos( &xfp[*pPlocs - 1] );
currPlocs = *pPlocs++;
n = n - 1;
}
/* All remaining peaks except the very last two possible integer positions */
currPlocs = *pPlocs++;
endPlocs = Lprot2p1 - DELTA_CORR_F0_INT; /* last *pPlocs position for Jacobsen */
/* precompute number of turns based on endpoint integer location and make into a proper for loop */
if ( n > 0 )
{
nJacob = n;
if ( sub( endPlocs, plocs[sub( *num_plocs, 1 )] ) <= 0 )
{
nJacob = sub( nJacob, 1 );
}
for ( k = 0; k < nJacob; k++ )
{
*pPlocsi++ = currPlocs + imax2_jacobsen_mag( &( X_sav[currPlocs - 1] ), &( X_sav[Lprot - 1 - currPlocs] ) );
currPlocs = *pPlocs++;
}
n = n - nJacob;
}
/* At this point there should at most two plocs left to process */
/* the position before fs/2 and fs/2 both use the same magnitude points */
if ( n > 0 )
{
/* [ . . . . . . . ] Lprot/2+1 positions */
/* | | | */
/* 0 (Lprot/2-2) (Lprot/2) */
if ( currPlocs == ( Lprot2p1 - DELTA_CORR_F0_INT ) ) /* Also 2nd last peak position uses fs/2 which makes jacobsen less suitable. */
{
*pPlocsi++ = currPlocs - 1 + imax_pos( &xfp[currPlocs - 1] );
currPlocs = *pPlocs++;
n = n - 1;
}
/* Here the only remaining point would be a fs/2 plocs */
/* pXfp = xfp + sub(Lprot2,1); already set just a reminder where it
* whould point */
if ( n > 0 ) /* fs/2 which makes special case . */
{
*pPlocsi++ = currPlocs - 2 + imax_pos( &xfp[currPlocs - 2] );
currPlocs = *pPlocs++;
n = n - 1;
}
}
/* For few peaks decide noise floor attenuation */
if ( *num_plocs < 3 && *num_plocs > 0 )
{
sig = sum_f( xfp, Lprot2_1 ) + EPSILON;
/*excluding peaks and neighboring bins*/
for ( i = 0; i < *num_plocs; i++ )
{
st_point = max( 0, plocs[i] - DELTA_CORR );
end_point = min( Lprot2_1 - 1, plocs[i] + DELTA_CORR );
set_f( &xfp[st_point], 0.0f, end_point - st_point + 1 );
}
noise = sum_f( xfp, Lprot2_1 ) + EPSILON;
nsr = noise / sig;
if ( nsr < 0.03f )
{
*noise_fac = 0.5f;
}
else
{
*noise_fac = 1.0f;
}
}
}
#endif
}
/*-------------------------------------------------------------------*
......@@ -2474,12 +2246,6 @@ static void subst_spec_fx(
const Word16 *beta, /* i : Magnitude modification factors for fade to average Q15 */
Word16 beta_mute, /* i : Factor for long-term mute Q15 */
const Word16 *Xavg /* i : Frequency group averages to fade to Q0 */
#ifdef IVAS_FEC_ECU_TO_COMPLETE
,
const Word16 element_mode, /* i : IVAS element mode */
const Word16 ph_ecu_lookahead, /* i : Phase ECU lookahead */
const Word16 noise_fac /* i : noise factor */
#endif
)
{
Word16 Xph_short;
......@@ -2500,11 +2266,6 @@ static void subst_spec_fx(
Word16 alpha_local;
Word16 beta_local;
Word16 expo;
#ifdef IVAS_FEC_ECU_TO_COMPLETE
Word16 one_peak_flag_mask;
Word16 alpha_local;
Word16 beta_local;
#endif
Word16 mag_chg_local; /*for peak attenuation in burst */
Lprot = 512;
......@@ -2560,21 +2321,6 @@ static void subst_spec_fx(
move32();
}
}
#ifdef IVAS_FEC_ECU_TO_COMPLETE
one_peak_flag_mask = 1; /* all ones mask -> keep */
IF( NE_16( element_mode, EVS_MONO ) )
{
if ( ( *num_plocs > 0 ) && sub( *num_plocs, 3 ) < 0 )
{
one_peak_flag_mask = noise_fac; /* all zeroes mask -> zero */
}
if ( *num_plocs == 0 )
{
X[0] = 0; /* reset DC if there are no peaks */
X[shr( Lprot, 1 )] = 0; /* also reset fs/2 if there are no peaks */
}
}
#endif
lprotBy2Minus1 = sub( shr( Lprot, 1 ), 1 );
i = 1;
move16();
......@@ -2635,21 +2381,10 @@ static void subst_spec_fx(
move16();
im = *pImX;
move16();
#ifdef IVAS_FEC_ECU_TO_COMPLETE
IF( EQ_16( element_mode, EVS_MONO ) )
#endif
{
tmp = sub( mult_r( re, cos_F ), mult_r( im, sin_F ) );
im = add( mult_r( re, sin_F ), mult_r( im, cos_F ) );
}
#ifdef IVAS_FEC_ECU_TO_COMPLETE
ELSE
{
PMTE()
// tmp = one_peak_flag_mask * (X[i] * cos_F - X[im_ind] * sin_F);
// X[im_ind] = one_peak_flag_mask * (X[i] * sin_F + X[im_ind] * cos_F);
}
#endif
IF( LT_16( alpha[k], 32766 ) )
{
*seed = rand_phase_fx( *seed, &sin_F, &cos_F );
......@@ -2766,21 +2501,10 @@ static void subst_spec_fx(
move16();
im = *pImX;
move16();
#ifdef IVAS_FEC_ECU_TO_COMPLETE
IF( EQ_16( element_mode, EVS_MONO ) )
#endif
{
tmp = sub_sat( mult_r( re, cos_F ), mult_r( im, sin_F ) );
im = add_sat( mult_r( re, sin_F ), mult_r( im, cos_F ) );
}
#ifdef IVAS_FEC_ECU_TO_COMPLETE
ELSE
{
PMTE()
// tmp = one_peak_flag_mask * (X[i] * cos_F - X[im_ind] * sin_F);
// X[im_ind] = one_peak_flag_mask * (X[i] * sin_F + X[im_ind] * cos_F);
}
#endif
IF( LT_16( alpha[k], 32766 ) )
{
alpha_local = mag_chg_local;
......@@ -3032,97 +2756,7 @@ static void rec_wtda_fx(
Word16 *p_ecu;
Word16 g;
Word16 tbl_delta;
#ifdef IVAS_FEC_ECU_TO_COMPLETE
float xsubst_[2 * L_FRAME48k];
const float *w_hamm;
float *pX_start, *pX_end;
float tmp;
int16_t hamm_len2;
float *pNew;
const float *pOldW, *pNewW;
float xfwin[NS2SA( L_FRAME48k * FRAMES_PER_SEC, N_ZERO_MDCT_NS - ( 2 * FRAME_SIZE_NS - L_PROT_NS ) / 2 )];
const float *pOld;
int16_t copy_len;
int16_t ola_len;
copy_len = NS2SA( output_frame * FRAMES_PER_SEC, ( 2 * FRAME_SIZE_NS - L_PROT_NS ) / 2 ); /* prototype fill on each side of xsubst to fill MDCT Frame */
ola_len = NS2SA( output_frame * FRAMES_PER_SEC, N_ZERO_MDCT_NS - ( 2 * FRAME_SIZE_NS - L_PROT_NS ) / 2 ); /* remaining lengt of LA_ZEROS to overlap add decoded with xsubst */
if ( output_frame == L_FRAME48k )
{
w_hamm = w_hamm_sana48k_2;
hamm_len2 = L_PROT_HAMM_LEN2_48k;
}
else if ( output_frame == L_FRAME32k )
{
w_hamm = w_hamm_sana32k_2;
hamm_len2 = L_PROT_HAMM_LEN2_32k;
}
else
{
w_hamm = w_hamm_sana16k_2;
hamm_len2 = L_PROT_HAMM_LEN2_16k;
}
if ( element_mode != EVS_MONO && *num_p > 0 && plocs[0] > 3 )
{
/* Perform inverse windowing of hammrect */
pX_start = X;
pX_end = X + Lprot - 1;
for ( i = 0; i < hamm_len2; i++ )
{
tmp = 1.0f / *w_hamm;
*pX_start *= tmp;
*pX_end *= tmp;
pX_start++;
pX_end--;
w_hamm++;
}
}
/* extract reconstructed frame with aldo window */
timesh = NS2SA( output_frame * FRAMES_PER_SEC, N_ZERO_MDCT_NS ) - ( 2 * output_frame - Lprot ) / 2;
set_f( xsubst_, 0.0f, 2 * output_frame - Lprot + timesh );
mvr2r( X, xsubst_ + 2 * output_frame - Lprot + timesh, Lprot - timesh );
/* Copy and OLA look ahead zero part of MDCT window from decoded signal */
if ( element_mode != EVS_MONO )
{
mvr2r( old_dec, xsubst_ + NS2SA( output_frame * FRAMES_PER_SEC, N_ZERO_MDCT_NS ), copy_len ); /* also need to scale to Q0 ?? */
pOld = old_dec + copy_len;
pNew = xsubst_ + copy_len + NS2SA( output_frame * FRAMES_PER_SEC, N_ZERO_MDCT_NS );
sinq( EVS_PI / ( ola_len * 2 ), 0.0f, ola_len, xfwin );
v_mult( xfwin, xfwin, xfwin, ola_len ); /* xfwin = sin^2 of 0..pi/4 */
pOldW = xfwin + ola_len - 1;
pNewW = xfwin;
for ( i = 0; i < ola_len; i++ )
{
*pNew = *pOld * *pOldW + *pNew * *pNewW;
pOld += 1;
pNew += 1;
pOldW -= 1;
pNewW += 1;
}
}
else
{
/* Smoothen onset of ECU frame */
xf_len = (int16_t) ( (float) output_frame * N_ZERO_MDCT_NS / FRAME_SIZE_NS ) - ( output_frame - Lprot / 2 );
p_ecu = xsubst_ + 2 * output_frame - Lprot + timesh;
tbl_delta = 64.f / xf_len; /* 64 samples = 1/4 cycle in sincos_t */
for ( i = 0; i < xf_len; i++, p_ecu++ )
{
g = sincos_t[( (int16_t) ( i * tbl_delta ) )];
g *= g;
*p_ecu = g * ( *p_ecu );
}
}
/* Apply TDA and windowing to ECU frame */
wtda( xsubst_ + output_frame, ecu_rec, NULL, ALDO_WINDOW, ALDO_WINDOW, output_frame );
#else
// PMTE()
xsubst_ = rec_buf + output_frame;
Lprot2 = shr( Lprot, 1 );
......@@ -3175,7 +2809,6 @@ static void rec_wtda_fx(
out_ptr = rec_buf + sub( shl( output_frame, 1 ), timesh );
wtda_fx( out_ptr, &Qin, ecu_rec, NULL, 0, ALDO_WINDOW, ALDO_WINDOW, /* window overlap of current frame (0: full, 2: none, or 3: half) */
output_frame );
#endif
return;
}
......@@ -3239,15 +2872,7 @@ static void rec_frame_fx(
Word16 *X, /* i : FFT spectrum */
Word32 *ecu_rec, /* o : Reconstructed frame in tda domain */
const Word16 output_frame, /* i : Frame length */
const Word16 Q
#ifdef IVAS_FEC_ECU_TO_COMPLETE
,
const float *old_dec, /* i : end of last decoded for OLA before tda and itda */
const int16_t element_mode, /* i : IVAS element mode */
const int16_t *num_p, /* i : Number of peaks */
const int16_t *plocs /* i : Peak locations */
#endif
)
const Word16 Q )
{
const Word16 *pFftTbl;
Word16 Lprot, lprotLog2Minus1;
......@@ -4034,28 +3659,11 @@ static void fec_ecu_dft_fx(
Word16 *Tf_abs, /*Qout */
Word16 *Nfft,
Word16 *exp /*Qout = Qin+exp */
#ifdef IVAS_FEC_ECU_TO_COMPLETE
,
const int16_t element_mode /* i : IVAS element mode */
#endif
)
{
Word32 L_tmp, Tmp, Tfr32[512], Tfi32[512], fac, *Pt1, *Pt2;
Word16 i, tmp, tmp_short, N_LP, target[2 * L_FRAME48k], Tfr16[FEC_FFT_MAX_SIZE], *pt1, *pt2, *pt3;
Word16 tmp_loop;
#ifdef IVAS_FEC_ECU_TO_COMPLETE
int16_t alignment_point;
Lon20 = (int16_t) 160 / 20;
if ( element_mode == EVS_MONO )
{
alignment_point = 2 * 160 - 3 * Lon20;
}
else
{
alignment_point = 2 * 160;
}
#endif
tmp = sub( 296, N );
Copy( &prevsynth_LP[tmp], target, N );
......@@ -4588,11 +4196,6 @@ static void fec_noise_filling_fx(
const Word16 N,
const Word16 HqVoicing,
Word16 *gapsynth_fx /*Qsynth */
#ifdef IVAS_FEC_ECU_TO_COMPLETE
,
const int16_t element_mode, /* i : IVAS element mode */
const float *old_out
#endif
)
{
......@@ -4607,22 +4210,6 @@ static void fec_noise_filling_fx(
Word32 L_tmp;
const Word16 *sinq_tab;
#ifdef IVAS_FEC_ECU_TO_COMPLETE
const float *p_mdct_ola;
int16_t alignment_point;
PMTE()
if ( element_mode == EVS_MONO )
{
alignment_point = 2 * L - 3 * L / 20;
}
else
{
alignment_point = 2 * L;
}
mvr2r( prevsynth + alignment_point - N, noisevect, N );
#endif
IF( EQ_16( L, L_FRAME32k ) )
{
sinq_tab = sinq_32k;
......@@ -4693,18 +4280,6 @@ static void fec_noise_filling_fx(
tmp_fx = div_s( 1, Rnd_N_noise ); /*Q15 */
tmp_fx = round_fx_sat( L_shl_sat( L_mult( tmp_fx, 25736 ), 2 ) ); /*Q15 */
#ifdef IVAS_FEC_ECU_TO_COMPLETE
if ( element_mode == EVS_MONO )
{
kk = 7 * L / 20;
p_mdct_ola = prevsynth + 37 * L / 20;
}
else
{
kk = NS2SA( L * FRAMES_PER_SEC, N_ZERO_MDCT_NS );
p_mdct_ola = old_out + kk;
}
#endif
sinq_fx( shr( tmp_fx, 1 ), shr( tmp_fx, 2 ), Rnd_N_noise, SS_fx );
......@@ -4812,11 +4387,6 @@ static void fec_alg_fx(
const Word16 decimatefactor,
const Word16 HqVoicing,
Word16 *gapsynth /*Qin */
#ifdef IVAS_FEC_ECU_TO_COMPLETE
,
const Word16 element_mode, /* i : IVAS element mode */
const Word16 *old_out
#endif
)
{
Word16 Nfft;
......@@ -4828,21 +4398,11 @@ static void fec_alg_fx(
Word16 exp;
Word16 n, Q;
fec_ecu_dft_fx( prevsynth_LP, N, Tfr, Tfi, &sum_Tf_abs, Tf_abs, &Nfft, &exp
#ifdef IVAS_FEC_ECU_TO_COMPLETE
,
element_mode
#endif
);
fec_ecu_dft_fx( prevsynth_LP, N, Tfr, Tfi, &sum_Tf_abs, Tf_abs, &Nfft, &exp );
sinusoidal_synthesis_fx( Tfr, Tfi, Tf_abs, N, output_frame, decimatefactor, Nfft, sum_Tf_abs, synthesis, HqVoicing, exp );
fec_noise_filling_fx( prevsynth, synthesis, ni_seed_forfec, output_frame, i_mult2( N, decimatefactor ), HqVoicing, gapsynth
#ifdef IVAS_FEC_ECU_TO_COMPLETE
,
element_mode, old_out
#endif
);
fec_noise_filling_fx( prevsynth, synthesis, ni_seed_forfec, output_frame, i_mult2( N, decimatefactor ), HqVoicing, gapsynth );
n = R1_48 - R2_48;
move16();
......@@ -5018,11 +4578,6 @@ static void hq_phase_ecu_fx(
Word16 *beta_mute, /* o : Factor for long-term mute Q15 */
const Word16 bwidth_fx, /* i : Encoded bandwidth */
const Word16 output_frame /* i : frame length */
#ifdef IVAS_FEC_ECU_TO_COMPLETE
,
const Word16 pcorr,
const Word16 element_mode /* i : IVAS element mode */
#endif
)
{
Word16 lprot, offset;
......@@ -5030,22 +4585,6 @@ static void hq_phase_ecu_fx(
Word16 seed;
Word16 alpha[LGW_MAX], beta[LGW_MAX];
#ifdef IVAS_FEC_ECU_TO_COMPLETE
const float *old_dec;
float noise_fac;
int16_t ph_ecu_lookahead;
noise_fac = 1.0f;
if ( element_mode == EVS_MONO )
{
ph_ecu_lookahead = NS2SA( output_frame * FRAMES_PER_SEC, PH_ECU_LOOKAHEAD_NS );
}
else
{
ph_ecu_lookahead = 0;
}
#endif
IF( EQ_16( output_frame, L_FRAME48k ) )
{
lprot = L_PROT48k; /* 1536 = (2*output_frame)*1024/1280 */
......@@ -5074,30 +4613,17 @@ static void hq_phase_ecu_fx(
{
test();
// PMT("verify condition compared to float")
#ifdef IVAS_FEC_ECU_TO_COMPLETE
IF( !( prev_bfi != 0 && *last_fec != 0 ) && EQ_16( element_mode == EVS_MONO ) )
#else
if ( !( prev_bfi != 0 && *last_fec != 0 ) )
#endif
{
*time_offs = 0;
move16();
}
#ifdef IVAS_FEC_ECU_TO_COMPLETE
offset = add( sub( sub( shl( output_frame, 1 ), lprot ), *time_offs ), ph_ecu_lookahead );
#else
offset = sub( sub( shl( output_frame, 1 ), lprot ), *time_offs );
#endif
trans_ana_fx( prevsynth + offset, mag_chg, &ph_dith, mag_chg_1st, output_frame, *time_offs, env_stab,
*last_fec, alpha, beta, beta_mute, Xavg );
spec_ana_fx( prevsynth + offset, plocs, plocsi, num_p, X_sav, output_frame, bwidth_fx, Q_spec
#ifdef IVAS_FEC_ECU_TO_COMPLETE
,
element_mode, noise_fac, pcorr
#endif
);
spec_ana_fx( prevsynth + offset, plocs, plocsi, num_p, X_sav, output_frame, bwidth_fx, Q_spec );
test();
IF( prev_bfi != 0 && *last_fec != 0 )
......@@ -5127,23 +4653,10 @@ static void hq_phase_ecu_fx(
}
subst_spec_fx( plocs, plocsi, num_p, *time_offs, X, mag_chg, ph_dith, old_is_transient, output_frame, &seed,
alpha, beta, *beta_mute, Xavg
#ifdef IVAS_FEC_ECU_TO_COMPLETE
,
element_mode, ph_ecu_lookahead, noise_fac
#endif
);
alpha, beta, *beta_mute, Xavg );
/* reconstructed frame in tda domain */
#ifdef IVAS_FEC_ECU_TO_COMPLETE
old_dec = prevsynth + 2 * output_frame - NS2SA( output_frame * FRAMES_PER_SEC, N_ZERO_MDCT_NS );
#endif
rec_frame_fx( X, ecu_rec, output_frame, *Q_spec
#ifdef IVAS_FEC_ECU_TO_COMPLETE
,
old_dec, element_mode, num_p, plocs
#endif
);
rec_frame_fx( X, ecu_rec, output_frame, *Q_spec );
*last_fec = 0;
move16();
......@@ -5297,22 +4810,6 @@ void hq_ecu_fx(
Word16 decimatefactor;
Word16 corr; /*Q15 */
Word16 prevsynth_LP[2 * L_FRAME8k];
#ifdef IVAS_FEC_ECU_TO_COMPLETE
HQ_DEC_HANDLE hHQ_core;
const float *fec_alg_input;
int16_t evs_mode_selection;
int16_t ivas_mode_selection;
hHQ_core = st->hHQ_core;
if ( st->element_mode == EVS_MONO )
{
fec_alg_input = prevsynth + NS2SA( output_frame * FRAMES_PER_SEC, ACELP_LOOK_NS / 2 - PH_ECU_LOOKAHEAD_NS );
}
else
{
fec_alg_input = prevsynth - NS2SA( output_frame * FRAMES_PER_SEC, PH_ECU_LOOKAHEAD_NS );
}
#endif
/* init (values ar changed after) */
decimatefactor = 4;
move16();
......@@ -5323,11 +4820,7 @@ void hq_ecu_fx(
IF( !( LT_16( output_frame, L_FRAME16k ) ) )
{
#ifdef IVAS_FEC_ECU_TO_COMPLETE
fec_ecu_pitch_fx( fec_alg_input, prevsynth_LP, output_frame, &N, &corr, &decimatefactor, ph_ecu_HqVoicing );
#else
fec_ecu_pitch_fx( prevsynth + NS2SA_FX2( L_mult0( output_frame, 50 ), ACELP_LOOK_NS / 2 - PH_ECU_LOOKAHEAD_NS ), prevsynth_LP, output_frame, &N, &corr, &decimatefactor, ph_ecu_HqVoicing );
#endif
}
ELSE
{
......@@ -5350,32 +4843,6 @@ void hq_ecu_fx(
test();
test();
test();
#if defined IVAS_FEC_ECU_TO_COMPLETE
evs_mode_selection = ( st->total_brate >= 48000 && ( output_frame >= L_FRAME16k && !prev_bfi && ( !old_is_transient[0] || old_is_transient[1] ) &&
( ph_ecu_HqVoicing || ( ( ( hHQ_core->env_stab_plc > 0.5 ) && ( corr < 0.6 ) ) || ( hHQ_core->env_stab_plc < 0.5 && ( corr > 0.85 ) ) ) ) ) ) ||
( st->total_brate < 48000 && ( ( ph_ecu_HqVoicing || corr > 0.85 ) && !prev_bfi && ( !old_is_transient[0] || old_is_transient[1] ) ) );
ivas_mode_selection = ( N < PH_ECU_N_LIMIT ) || ( corr < PH_ECU_CORR_LIMIT );
if ( ( ( st->element_mode == EVS_MONO ) && evs_mode_selection ) ||
( ( st->element_mode != EVS_MONO ) && evs_mode_selection && ivas_mode_selection ) )
{
fec_alg_fx( fec_alg_input, prevsynth_LP, ecu_rec, output_frame, N, decimatefactor, ph_ecu_HqVoicing, gapsynth, &hHQ_core->ni_seed_forfec, st->element_mode, st->hHQ_core->old_out );
*last_fec = 1;
*ph_ecu_active = 0;
move16();
*time_offs = output_frame;
move16();
;
}
else
{
hq_phase_ecu( prevsynth - NS2SA( output_frame * FRAMES_PER_SEC, PH_ECU_LOOKAHEAD_NS ), ecu_rec, time_offs, X_sav, num_p, plocs, plocsi, env_stab, last_fec, prev_bfi, old_is_transient, mag_chg_1st, Xavg, beta_mute, st->bwidth, output_frame, corr, st->element_mode );
*last_fec = 0;
*ph_ecu_active = 1;
}
#else
IF( ( GE_32( st_fx->total_brate, 48000 ) &&
( GE_16( output_frame, L_FRAME16k ) && !prev_bfi && ( !old_is_transient[0] || old_is_transient[1] ) && ( NE_16( ph_ecu_HqVoicing, 0 ) || ( ( ( NE_16( st_fx->hHQ_core->env_stab_plc_fx, 0 ) ) && ( LT_16( corr, 19661 ) ) ) || ( !( NE_16( st_fx->hHQ_core->env_stab_plc_fx, 0 ) ) && ( GT_16( corr, 27853 ) ) ) ) ) ) ) ||
( LT_32( st_fx->total_brate, 48000 ) && ( ( ph_ecu_HqVoicing || GT_16( corr, 27853 ) ) && !prev_bfi && ( !old_is_transient[0] || old_is_transient[1] ) ) ) )
......@@ -5395,7 +4862,6 @@ void hq_ecu_fx(
env_stab, last_fec, ph_ecu_active, prev_bfi, old_is_transient,
mag_chg_1st, Xavg, beta_mute, st_fx->bwidth, output_frame );
}
#endif
return;
}
......
......@@ -740,15 +740,6 @@ static void CorrectF0(
Word16 tmp;
#ifdef IVAS_CODE
FOR( i = 0; i < MAX_PEAKS_FROM_PITCH - 1; i++ )
{
diff[i] = 0;
sortedDiff[i] = 0;
move16));
move16));
}
#endif
F0 = *pF0; /*Q10*/
test();
......
......@@ -1287,12 +1287,7 @@ ivas_error acelp_core_dec_fx(
/*Noise estimate*/
IF( NE_16( st_fx->element_mode, IVAS_CPE_TD ) /* && !st->cng_ism_flag IVAS_CODE */ )
{
#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT
PMT( "Code for IVAS_CODE_CNG_FIX185_PLC_FADEOUT not done" )
ApplyFdCng_fx( syn, st_fx->Q_syn, NULL, realBuffer, imagBuffer, st, 0, ( st->coder_type == AUDIO && !st->GSC_noisy_speech ) );
#else
ApplyFdCng_fx( syn_fx, st_fx->Q_syn, realBuffer, imagBuffer, NULL, st_fx, 0, ( EQ_16( st_fx->coder_type, AUDIO ) && st_fx->GSC_noisy_speech == 0 ) );
#endif
}
/* CNA: Generate additional comfort noise to mask potential coding artefacts */
}
......
......@@ -813,15 +813,10 @@ ivas_error amr_wb_dec_fx(
st_fx->VAD = 0;
move16();
}
#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT
PMT( "Fixed point not done here " )
ApplyFdCng_fx( syn, NULL, NULL, NULL, st, 0, 0 );
#else
#ifdef REMOVE_EVS_DUPLICATES
ApplyFdCng_ivas_fx( syn_fx, st_fx->Q_syn, NULL, 0, NULL, NULL, NULL, st_fx, 0, 0 );
#else
ApplyFdCng_fx( syn_fx, st_fx->Q_syn, NULL, NULL, NULL, st_fx, 0, 0 );
#endif
#endif
st_fx->hFdCngDec->hFdCngCom->frame_type_previous = st_fx->m_frame_type;
move16();
......
......@@ -20,18 +20,7 @@
void open_decoder_LPD_fx(
Decoder_State *st,
const Word32 total_brate, /* Q0 */
#ifdef NEW_IVAS_OPEN_DEC
const Word32 last_total_brate,
#endif
const Word16 bwidth /* Q0 */
#ifdef NEW_IVAS_OPEN_DEC
,
const Word16 is_mct, /* i : MCT mode flag */
#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT
const Word16 last_element_mode,
#endif
const Word16 is_init /* i : indicate call from init_decoder() to avoid double TC initialization */
#endif
)
{
Word16 i;
......@@ -50,10 +39,8 @@ void open_decoder_LPD_fx(
hTcxLtpDec = st->hTcxLtpDec;
hTcxDec = st->hTcxDec;
#ifndef NEW_IVAS_OPEN_DEC
st->total_brate = total_brate;
move32();
#endif
if ( NE_16( st->codec_mode, MODE1 ) ) /*already updated in MODE1*/
{
......@@ -70,40 +57,18 @@ void open_decoder_LPD_fx(
/* initializing variables for frame lengths etc. right in the beginning */
st->L_frame = extract_l( Mult_32_16( st->sr_core, 0x0290 ) );
move16();
#ifndef NEW_IVAS_OPEN_DEC
hTcxDec->L_frameTCX = extract_l( Mult_32_16( st->output_Fs, 0x0290 ) );
move16();
#endif
IF( st->ini_frame == 0 )
{
st->last_L_frame = st->L_frame_past = st->L_frame;
move16();
move16();
#ifndef NEW_IVAS_OPEN_DEC
st->L_frameTCX_past = hTcxDec->L_frameTCX;
#endif
move16();
}
#ifdef NEW_IVAS_OPEN_DEC
IF( st->hTcxDec != NULL )
{
hTcxDec->L_frameTCX = extract_l( Mult_32_16( st->output_Fs, 0x0290 ) );
IF( st->ini_frame == 0 )
{
st->L_frameTCX_past = st->hTcxDec->L_frameTCX;
move16();
}
}
#endif
st->tcxonly = getTcxonly(
#ifdef IVAS_CODE_SWITCHING
st->element_mode,
#endif
st->total_brate
#ifdef IVAS_CODE_SWITCHING
,
is_mct
#endif
/*, st->is_ism_format Needed in the last version of float IVAS */
);
move16();
......@@ -155,9 +120,6 @@ void open_decoder_LPD_fx(
// st->pit_res_max = initPitchLagParameters(12800, &st->pit_min, &st->pit_fr1, &st->pit_fr1b, &st->pit_fr2, &st->pit_max);
// hTcxDec->pit_max_TCX = (int16_t)(st->pit_max * st->output_Fs / 12800);
// hTcxDec->pit_min_TCX = (int16_t)(st->pit_min * st->output_Fs / 12800);
#if 0
PMT("Fixed point to be verified here")
#endif
i = mult_r( hTcxDec->L_frameTCX, getInvFrameLen( L_FRAME ) ); /* Q6 */
hTcxDec->pit_max_TCX = extract_l( L_shr( L_mult( st->pit_max, i ), 7 ) ); /* Q0 */
move16();
......@@ -243,7 +205,6 @@ void open_decoder_LPD_fx(
}
/*TCX config*/
#ifndef NEW_IVAS_OPEN_DEC
st->hTcxCfg->preemph_fac = st->preemph_fac;
move16();
st->hTcxCfg->tcx_mdct_window_length_old = st->hTcxCfg->tcx_mdct_window_length;
......@@ -304,34 +265,6 @@ void open_decoder_LPD_fx(
}
resetTecDec_Fx( st->hTECDec );
#else
if ( st->hIGFDec != NULL )
{
PMT( "To be done" )
// 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, MCT_flag);
// }
// else
//{
// st->hTcxCfg->tcx_curr_overlap_mode = st->hTcxCfg->tcx_last_overlap_mode = ALDO_WINDOW;
// st->hTcxCfg->last_aldo = 1;
// }
}
/*Constraint for adaptive BPF, otherwise parameter estimation and post-processing not time aligned*/
IF( st->tcxonly == 0 )
{
assert( 0 == ( st->hTcxCfg->lfacNext > 0 ? st->hTcxCfg->lfacNext : 0 ) );
}
// IF (st->tecDec_fx != NULL)
{
resetTecDec_Fx( &( st->tecDec_fx ) );
}
#endif
/* Initialize decoder delay */
......@@ -447,7 +380,6 @@ void open_decoder_LPD_fx(
move16();
/*PLC*/
#ifndef NEW_IVAS_OPEN_DEC
IF( st->prev_bfi != 0 )
{
PWord16 const *w;
......@@ -498,10 +430,6 @@ void open_decoder_LPD_fx(
hTcxDec->Q_syn_Overl_TDAC = hHQ_core->Q_old_wtda_LB;
move16();
}
#else
PMT( "acelp_plc_mdct_transition is missing" )
// acelp_plc_mdct_transition(st);
#endif
}
test();
......@@ -545,9 +473,6 @@ void open_decoder_LPD_fx(
set16_fx( hTcxDec->syn_Overl_TDAC, 0, L_FRAME32k / 2 ); /*HQ-CORE(bfi)->TCX don't need it*/ /* Q_syn_Overl_TDAC */
set16_fx( hTcxDec->syn_Overl_TDACFB, 0, L_FRAME_MAX / 2 ); /*HQ-CORE(bfi)->TCX don't need it*/ /* Q_syn_Overl_TDACFB */
set16_fx( hTcxDec->syn_Overl, 0, L_FRAME32k / 2 ); /*HQ-CORE(bfi)->TCX don't need it*/ /* Q_syn_Overl */
#if 0
PMT("to be moved to reset_tcx_overl_buf")
#endif
}
IF( st->hTcxCfg != NULL )
{
......@@ -575,15 +500,6 @@ void open_decoder_LPD_fx(
cldfb_reset_memory( st->cldfbAna );
cldfb_reset_memory( st->cldfbBPF );
cldfb_reset_memory( st->cldfbSyn );
#ifndef NEW_IVAS_OPEN_DEC
#if 0
PMT("cldfbSynHB is missing ")
#endif
// IF (st->cldfbSynHB != NULL)
//{
// cldfb_reset_memory(st->cldfbSynHB);
// }
#endif
}
ELSE IF( ( NE_16( st->L_frame, st->last_L_frame ) ) && ( LE_16( st->L_frame, L_FRAME16k ) ) && ( LE_16( st->last_L_frame, L_FRAME16k ) ) ) /* Rate switching between 12.8 and 16 kHz*/
{
......@@ -817,10 +733,6 @@ void open_decoder_LPD_fx(
test();
IF( EQ_16( st->core, ACELP_CORE ) && EQ_16( st->last_core, HQ_CORE ) )
{
/*_DIFF_FLOAT_FIX_*/
#if 0
PMT("floating point is using L_frameTCX instead of output_frame, is it ok?")
#endif
frame_ener_fx( st->output_frame_fx, UNVOICED_CLAS, st->previoussynth_fx, -1, &st->enr_old_fx, 1, 0, 0, 0 );
}
}
......@@ -840,20 +752,6 @@ void open_decoder_LPD_fx(
move16();
if ( st->hTcxDec != NULL )
{
#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT
/* Todo: should be considered for other stereo modes as well */
IF( is_init || MCT_flag || !( st->element_mode == IVAS_CPE_MDCT && st->element_mode == last_element_mode ) )
{
PMT( "Fixed point to be done" )
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;
}
#else
hTcxDec->conCngLevelBackgroundTrace = PLC_MIN_CNG_LEV_Q21; /*Q21*/
move16();
hTcxDec->conNoiseLevelIndex = PLC_MIN_STAT_BUFF_SIZE - 1; /* Q0 */
......@@ -871,7 +769,6 @@ void open_decoder_LPD_fx(
hTcxDec->cummulative_damping_tcx = 32767 /*1.0f Q15*/;
move16();
#endif
}
st->cummulative_damping = 32767 /*1.0f Q15*/;
move16();
......@@ -891,10 +788,8 @@ void open_decoder_LPD_fx(
st->old_fpitch = L_deposit_h( st->pit_min );
move32();
#ifndef NEW_IVAS_OPEN_DEC
st->old_fpitchFB = L_deposit_h( hTcxDec->pit_min_TCX );
move32();
#endif
st->rate_switching_init = 1;
move16();
......@@ -924,9 +819,6 @@ void open_decoder_LPD_fx(
test();
IF( hTcxLtpDec != NULL && ( EQ_16( st->ini_frame, 0 ) || ( EQ_16( st->last_codec_mode, MODE1 ) && st->element_mode == EVS_MONO ) ) )
{
#if 0
PMT("TO be verify, update seems to differ from float")
#endif
hTcxLtpDec->tcxltp_pitch_int = st->pit_max; /* Q0 */
move16();
hTcxLtpDec->tcxltp_pitch_fr = 0; /* Q0 */
......@@ -1059,12 +951,6 @@ void open_decoder_LPD_fx(
move16();
st->second_last_core = -1;
move16();
#ifdef NEW_IVAS_OPEN_DEC
IF( st->hTcxCfg != NULL && st->element_mode != EVS_MONO )
{
st->hTcxCfg->fIsTNSAllowed = getTnsAllowed( is_init ? total_brate : st->bits_frame_nominal * FRAMES_PER_SEC, st->igf );
}
#endif
IF( hTcxDec != NULL )
{
hTcxDec->tcxltp_second_last_pitch = st->old_fpitch; /*15Q16*/
......@@ -1105,10 +991,8 @@ void open_decoder_LPD_fx(
hTcxDec->tcx_hm_LtpPitchLag = -1;
move16();
}
#ifndef NEW_IVAS_OPEN_DEC
st->hTcxCfg->na_scale = 32767 /*1.0f Q15*/;
move16();
#endif
if ( hTcxLtpDec != NULL )
{
hTcxLtpDec->tcxltp_gain = 0; /* Q15 */
......
......@@ -13,18 +13,7 @@ void mode_switch_decoder_LPD_fx(
Decoder_State *st, /* i/o: decoder state structure */
Word16 bwidth, /* i : audio bandwidth Q0*/
Word32 total_brate, /* i : total bitrate Q0*/
#ifdef IVAS_CODE_SWITCHING
const Word32 last_total_brate, /* i : last frame total bitrate */
#endif
Word16 frame_size_index /* i : index determining the frame size Q0*/
#ifdef IVAS_CODE_SWITCHING
,
const Word16 MCT_flag /* i : hMCT handle allocated (1) or not (0)*/
#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT
,
const Word16 last_element_mode
#endif
#endif
)
{
Word16 fscale, switchWB;
......@@ -100,15 +89,7 @@ void mode_switch_decoder_LPD_fx(
test();
IF( NE_16( fscale, st->fscale ) || ( switchWB != 0 ) || ( bSwitchFromAmrwbIO != 0 ) || EQ_16( st->last_codec_mode, MODE1 ) || st->force_lpd_reset )
{
#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT
open_decoder_LPD_fx( st, total_brate, last_total_brate, bwidth, MCT_flag, last_element_mode, 0 );
#else
#ifdef IVAS_CODE
open_decoder_LPD_fx( st, total_brate, last_total_brate, bwidth, is_mct, 0 );
#else
open_decoder_LPD_fx( st, total_brate, bwidth );
#endif
#endif
}
ELSE
{
......@@ -153,9 +134,6 @@ void mode_switch_decoder_LPD_fx(
IF( ( st->hTcxCfg->fIsTNSAllowed != 0 ) && st->hIGFDec != NULL )
{
InitTnsConfigs( bwidth, st->hTcxCfg->tcx_coded_lines, st->hTcxCfg->tnsConfig, st->hIGFDec->infoIGFStopFreq, total_brate, st->element_mode, 0 /* 0 should be replaced with MCT_flag*/ );
#ifdef IVAS_CODE
SetAllowTnsOnWhite( st->hTcxCfg->tnsConfig, st->element_mode == IVAS_CPE_MDCT );
#endif
}
}
}
......
......@@ -574,11 +574,7 @@ void decoder_LPD_fx(
IF( bfi != 0 && ( st->last_core != ACELP_CORE ) )
{
/* PLC: [TCX: TD PLC] */
#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT
con_tcx_fx( st, &synthFB[0], -1.f, NULL, 0, NULL );
#else
con_tcx_fx( st, &synthFB[0] );
#endif
lerp( synthFB, synth, st->L_frame, hTcxDec->L_frameTCX );
st->con_tcx = 1;
move16();
......@@ -778,11 +774,7 @@ void decoder_LPD_fx(
{
TonalMDCTConceal_SaveTimeSignal( st->hTonalMDCTConc, synthFB, L_frameTCX );
}
#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT
decoder_tcx_post_fx( st, synth, synthFB, Aq, bfi, 0 );
#else
decoder_tcx_post_fx( st, synth, synthFB, Aq, bfi );
#endif
IF( EQ_16( st->core, TCX_20_CORE ) )
{
/* LPC Interpolation for BWE/post-processing */
......