diff --git a/lib_com/cng_exc_fx.c b/lib_com/cng_exc_fx.c index b314357adee7954c8797853f405db0296b5df6ee..e335e943511d142b8a5a164981d00825edc9bb01 100644 --- a/lib_com/cng_exc_fx.c +++ b/lib_com/cng_exc_fx.c @@ -598,11 +598,6 @@ void cng_params_postupd_fx( const Word16 *const cng_Qexc_buf, /* i : Q_exc buffer Q0 */ const Word32 *const cng_brate_buf, /* i : bit rate buffer Q0 */ Word32 ho_env_circ[] /* i/o: Envelope buffer Q6 */ -#ifdef IVAS_CODE_CNG_COM - , - const Word16 element_mode, /* i : Element mode */ - const Word16 bwidth /* i : Audio bandwidth */ -#endif ) { Word16 i, j; @@ -662,15 +657,6 @@ void cng_params_postupd_fx( } Copy32( sp, env, NUM_ENV_CNG ); -#ifdef IVAS_CODE_CNG_COM - if ( element_mode == IVAS_SCE || element_mode == IVAS_CPE_DFT ) - { - att = 0.0f; - apply_scale( &att, bwidth, last_active_brate, scaleTableStereo, SIZE_SCALE_TABLE_STEREO ); - att = powf( 10, att / 10.0f ); - } - else -#endif { CNG_mode = get_cng_mode( last_active_brate ); @@ -860,11 +846,6 @@ void cng_params_upd_fx( Word16 cng_Qexc_buf[], /* i/o: Q_exc buffer Q0 */ Word32 cng_brate_buf[], /* i/o: last_active_brate buffer Q0 */ const Word32 last_active_brate /* i : Last active bit rate Q0 */ -#ifdef IVAS_CODE_CNG_COM - , - const Word16 element_mode, /* i : Element mode */ - const Word16 bwidth /* i : Audio bandwidth */ -#endif ) { Word32 L_ener, L_tmp; @@ -986,15 +967,6 @@ void cng_params_upd_fx( } Copy32( sp, env, NUM_ENV_CNG ); -#ifdef IVAS_CODE_CNG_COM - if ( element_mode == IVAS_SCE || element_mode == IVAS_CPE_DFT ) - { - att = 0.0f; - apply_scale( &att, bwidth, last_active_brate, scaleTableStereo, SIZE_SCALE_TABLE_STEREO ); - att = powf( 10, att / 10.0f ); - } - else -#endif { CNG_mode = get_cng_mode( last_active_brate ); /* att = 1/pow(2,ENR_ATT_fx[CNG_mode]); */ diff --git a/lib_com/codec_tcx_common.c b/lib_com/codec_tcx_common.c index 1ebc2829c15493506950bd608ca397162826847c..52c7d0614ec4d935e71187ad9967a14eea1b6017 100644 --- a/lib_com/codec_tcx_common.c +++ b/lib_com/codec_tcx_common.c @@ -469,140 +469,6 @@ void tcxInvertWindowGrouping( } } -#ifdef IVAS_CODE_TCX_COM - -/*-------------------------------------------------------------------* - * tcx5SpectrumInterleaving() - * - * - *-------------------------------------------------------------------*/ - -void tcx5SpectrumInterleaving( - const int16_t tcx5Size, - float *spectrum ) -{ - int16_t i; - float interleaveBuf[N_TCX10_MAX]; - - set_f( interleaveBuf, 0.0f, N_TCX10_MAX ); - - /* group sub-windows: interleave bins according to their frequencies */ - for ( i = 0; i < tcx5Size; i++ ) - { - interleaveBuf[2 * i] = spectrum[i]; - interleaveBuf[2 * i + 1] = spectrum[tcx5Size + i]; - } - - mvr2r( interleaveBuf, spectrum, 2 * tcx5Size ); - - return; -} - - -/*-------------------------------------------------------------------* - * tcx5SpectrumDeinterleaving() - * - * - *-------------------------------------------------------------------*/ - -void tcx5SpectrumDeinterleaving( - const int16_t tcx5Size, - float *spectrum ) -{ - int16_t i; - float interleaveBuf[N_TCX10_MAX]; - - set_f( interleaveBuf, 0.0f, N_TCX10_MAX ); - - /* ungroup sub-windows: interleave bins according to their frequencies */ - for ( i = 0; i < tcx5Size; i++ ) - { - interleaveBuf[i] = spectrum[2 * i]; - interleaveBuf[tcx5Size + i] = spectrum[2 * i + 1]; - } - - mvr2r( interleaveBuf, spectrum, 2 * tcx5Size ); - - return; -} - - -/*-------------------------------------------------------------------* - * tcx5TnsGrouping() - * - * - *-------------------------------------------------------------------*/ - -void tcx5TnsGrouping( - const int16_t L_frame, /* i : frame length (TCX5) */ - const int16_t L_spec, /* i : coded spec length (TCX5, derived from filter borders*/ - float *spectrum ) -{ - /* rearrange LF sub-window lines prior to TNS synthesis filtering */ - if ( L_spec < L_frame ) - { - mvr2r( spectrum + 8, spectrum + 16, L_spec - 8 ); - mvr2r( spectrum + L_frame, spectrum + 8, 8 ); - mvr2r( spectrum + L_frame + 8, spectrum + L_spec + 8, L_spec - 8 ); - } - else - { - float buff[8]; /* Buffer for the rearrangement of LF TCX5 */ - mvr2r( spectrum + L_spec, buff, 8 ); - mvr2r( spectrum + 8, spectrum + 16, L_spec - 8 ); - mvr2r( buff, spectrum + 8, 8 ); - } - - return; -} - - -/*-------------------------------------------------------------------* - * tcx5TnsUngrouping() - * - * - *-------------------------------------------------------------------*/ - -void tcx5TnsUngrouping( - const int16_t L_frame, /* i : frame length (TCX5) */ - const int16_t L_spec, /* i : coded spec length (TCX5, derived from filter borders*/ - float *spectrum, - const int16_t enc_dec /* i : 0: encoder, else decoder */ -) -{ - /* undo rearrangement of LF sub-window lines prior to TNS analysis */ - if ( L_spec < L_frame ) - { - mvr2r( spectrum + L_spec + 8, spectrum + L_frame + 8, L_spec - 8 ); - mvr2r( spectrum + 8, spectrum + L_frame, 8 ); - mvr2r( spectrum + 16, spectrum + 8, L_spec - 8 ); - set_zero( spectrum + L_spec, L_frame - L_spec ); - set_zero( spectrum + L_frame + L_spec, L_frame - L_spec ); - } - else - { - float buff[8]; /* Buffer for the rearrangement of LF TCX5 */ - - mvr2r( spectrum + 8, buff, 8 ); - - if ( enc_dec == ENC ) - { - mvr2r( spectrum + 16, spectrum + 8, L_frame - 8 ); - mvr2r( buff, spectrum + L_frame, 8 ); - } - else - { - mvr2r( spectrum + 16, spectrum + 8, L_spec - 8 ); - mvr2r( buff, spectrum + L_spec, 8 ); - } - } - - return; -} - -#endif - - /*-------------------------------------------------------------------* * tcx5SpectrumInterleaving() * diff --git a/lib_com/fd_cng_com_fx.c b/lib_com/fd_cng_com_fx.c index 78809ed2c6a0dd5a4ca9ba595896388b03106c75..872c180b56e4807da3521a9b68f021b01e256dc6 100644 --- a/lib_com/fd_cng_com_fx.c +++ b/lib_com/fd_cng_com_fx.c @@ -1109,12 +1109,6 @@ void minimum_statistics( move16(); } } -#ifdef IVAS_CODE_CNG_COM - if ( enc_dec == DEC && element_mode == IVAS_CPE_TD ) - { - v_multc( msNoiseEst, 1.4125f, msNoiseEst, NPART_SHAPING ); - } -#endif /* Collect buffers */ Copy( msPeriodog, msPeriodogBuf + len * ( *msPeriodogBufPtr ), len ); @@ -2624,18 +2618,6 @@ void SynthesisSTFT( move16(); } /* Generate excitation */ -#ifdef IVAS_CODE_CNG_COM - PME() - if ( ( element_mode == IVAS_CPE_TD || element_mode == IVAS_CPE_DFT ) && nchan_out == 2 ) - { - for ( i = 0; i < hFdCngCom->frameSize / 2; i++ ) - { - buf[i + ( M + 1 )] += olapBuffer[i + hFdCngCom->frameSize / 4]; - } - v_multc( buf, (float) ( hFdCngCom->fftlen / 2 ), buf, M + 1 + hFdCngCom->frameSize ); - } - else -#endif { FOR( i = 0; i < M + 1 + hFdCngCom->frameSize; i++ ) { @@ -2749,18 +2731,6 @@ void SynthesisSTFT_ivas_fx( move16(); } /* Generate excitation */ -#ifdef IVAS_CODE_CNG_COM - PME() - if ( ( element_mode == IVAS_CPE_TD || element_mode == IVAS_CPE_DFT ) && nchan_out == 2 ) - { - for ( i = 0; i < hFdCngCom->frameSize / 2; i++ ) - { - buf[i + ( M + 1 )] += olapBuffer[i + hFdCngCom->frameSize / 4]; - } - v_multc( buf, (float) ( hFdCngCom->fftlen / 2 ), buf, M + 1 + hFdCngCom->frameSize ); - } - else -#endif { FOR( i = 0; i < M + 1 + hFdCngCom->frameSize; i++ ) { @@ -2788,74 +2758,6 @@ void SynthesisSTFT_ivas_fx( } } -#ifdef IVAS_CODE_CNG_COM -/*------------------------------------------------------------------- - * SynthesisSTFT_dirac() - * - * STFT synthesis filterbank - *-------------------------------------------------------------------*/ - -void SynthesisSTFT_dirac( - float *fftBuffer, /* i : FFT bins */ - float *timeDomainOutput, - float *olapBuffer, - const float *olapWin, - const int16_t samples_out, - HANDLE_FD_CNG_COM hFdCngCom /* i/o: FD_CNG structure containing all buffers and variables */ -) -{ - int16_t i; - float buf[M + 1 + 320], tmp; - - /* Perform IFFT */ - RFFTN( fftBuffer, hFdCngCom->fftSineTab, hFdCngCom->fftlen, 1 ); - - /* Handle overlap in P/S domain for stereo */ - mvr2r( olapBuffer + hFdCngCom->frameSize, olapBuffer, hFdCngCom->frameSize ); - set_f( olapBuffer + hFdCngCom->frameSize, 0.0f, hFdCngCom->frameSize ); /*olapBuffer, fftBuffer, olapWin*/ - - for ( i = hFdCngCom->frameSize / 4; i < 3 * hFdCngCom->frameSize / 4; i++ ) - { - olapBuffer[i] += fftBuffer[i] * olapWin[i - hFdCngCom->frameSize / 4]; - } - for ( ; i < 5 * hFdCngCom->frameSize / 4; i++ ) - { - olapBuffer[i] = fftBuffer[i]; - } - - for ( ; i < 7 * hFdCngCom->frameSize / 4; i++ ) - { - olapBuffer[i] = fftBuffer[i]; - } - - for ( ; i < hFdCngCom->fftlen; i++ ) - { - olapBuffer[i] = 0; - } - - /* Get time-domain signal */ - v_multc( olapBuffer + hFdCngCom->frameSize / 4, (float) ( hFdCngCom->fftlen / 2 ), timeDomainOutput, samples_out ); - - /* Get excitation */ - v_multc( olapBuffer + hFdCngCom->frameSize / 4 - ( M + 1 ), (float) ( hFdCngCom->fftlen / 2 ), buf, M + 1 + hFdCngCom->frameSize ); - tmp = buf[0]; - preemph( buf + 1, PREEMPH_FAC, M + hFdCngCom->frameSize, &tmp ); - residu( hFdCngCom->A_cng, M, buf + 1 + M, hFdCngCom->exc_cng, hFdCngCom->frameSize ); - - /* update and window olapBuf if we have a output frame that is shorter than the default frame size...*/ - if ( samples_out < hFdCngCom->frameSize ) - { - mvr2r( olapBuffer + samples_out, olapBuffer + hFdCngCom->frameSize, 3 * hFdCngCom->frameSize / 4 ); - } - for ( i = 5 * hFdCngCom->frameSize / 4; i < 7 * hFdCngCom->frameSize / 4; i++ ) - { - olapBuffer[i] *= olapWin[i - 3 * hFdCngCom->frameSize / 4]; - } - - return; -} -#endif - /************************************************************************************** * Compute some values used in the bias correction of the minimum statistics algorithm * **************************************************************************************/ diff --git a/lib_com/lsf_tools_fx.c b/lib_com/lsf_tools_fx.c index 5f0b3b57b404d1ade2874fcc232fe4e9e245f9bd..d60d0e9992655631130a8b5557d4ea8b176377e4 100644 --- a/lib_com/lsf_tools_fx.c +++ b/lib_com/lsf_tools_fx.c @@ -3301,71 +3301,6 @@ Word16 tcxlpc_get_cdk( return cdk; } -#ifdef IVAS_MSVQ -/*--------------------------------------------------------------------------* - * dec_FDCNG_MSVQ_stage1() - * - * - *--------------------------------------------------------------------------*/ - -void dec_FDCNG_MSVQ_stage1( - int16_t j_full, /* i : index full range */ - int16_t n, /* i : dimension to generate */ - const float *invTrfMatrix, /* i : IDCT matrix for synthesis */ - const DCTTYPE idcttype, /* i : specify which IDCT */ - float *uq, /* o : synthesized stage1 vector */ - Word16 *uq_ind /* o : synthesized stage1 vector in BASOP */ -) -{ - int16_t col, segm_ind, j; - float dct_vec[FDCNG_VQ_MAX_LEN]; - float idct_vec[FDCNG_VQ_MAX_LEN]; - const Word8 *cbpW8; - const Word16 *dct_col_shift_tab; - - assert( n <= FDCNG_VQ_MAX_LEN ); - assert( n >= FDCNG_VQ_DCT_MINTRUNC ); - - segm_ind = 0; - for ( col = 1; col <= FDCNG_VQ_DCT_NSEGM; col++ ) - { - if ( j_full >= cdk1_ivas_cum_entries_per_segment[col] ) - { - segm_ind++; - } - } - - j = j_full - cdk1_ivas_cum_entries_per_segment[segm_ind]; /* j is the local segment index */ - - assert( j < cdk1_ivas_entries_per_segment[segm_ind] ); - - /* Word8 column variable Qx storage*/ - cbpW8 = cdk_37bits_ivas_stage1_W8Qx_dct_sections[segm_ind]; /* Word8 storage fixed ptr_init */ - cbpW8 += j * cdk1_ivas_cols_per_segment[segm_ind]; /* adaptive ptr init */ - dct_col_shift_tab = stage1_dct_col_syn_shift[segm_ind]; - - for ( col = 0; col < cdk1_ivas_cols_per_segment[segm_ind]; col++ ) - { - dct_vec[col] = (float) shl( (Word16) cbpW8[col], dct_col_shift_tab[col] ); - /* LOGIC( 1 ) , SHIFT( 1 ); - in BASOP: s_and(for W8->W16), shl() - */ - } - dctT2_N_apply_matrix( (const float *) dct_vec, idct_vec, cdk1_ivas_cols_per_segment[segm_ind], n, invTrfMatrix, FDCNG_VQ_DCT_MAXTRUNC, idcttype ); - - /*scale down to original fdcngvq domain and move to Q0 */ - v_multc( idct_vec, fdcng_dct_scaleF[1], idct_vec, n ); - /* fdcng_dct_scaleF[1] --> 0.0625-->scale down from search Q4 domain to Q0 , - not really relevant for BASOP loop */ - - /*add common mid fdcng vector, in fdcng bands domain */ - v_add( idct_vec, cdk1r_tr_midQ_truncQ, uq, n ); - assert( uq_ind == NULL ); - - return; -} - -#endif void msvq_dec( const Word16 *const *cb, /* i : Codebook (indexed cb[*stages][levels][p]) (14Q1*1.28)*/ const Word16 dims[], /* i : Dimension of each codebook stage (NULL: full dim.) */ @@ -3374,11 +3309,7 @@ void msvq_dec( const Word16 N, /* i : Vector dimension */ const Word16 maxN, /* i : Codebook dimension */ const Word16 Idx[], /* i : Indices */ -#ifdef IVAS_MSVQ - const int16_t applyIDCT_flag, /* i : applyIDCT flag */ - const float *invTrfMatrix, /* i : matrix for IDCT synthesis */ -#endif - Word16 *uq /* o : quantized vector (14Q1*1.28)*/ + Word16 *uq /* o : quantized vector (14Q1*1.28)*/ ) { Word16 i, j, offset; @@ -3414,15 +3345,6 @@ void msvq_dec( start = offs[i]; move16(); } -#ifdef IVAS_MSVQ - test(); - IF( i == 0 && applyIDCT_flag != 0 ) - { - assert( start == 0 ); - dec_FDCNG_MSVQ_stage1( Idx[0], N, invTrfMatrix, IDCT_T2_XX_24, uq, uq_ind ); /* IDCT_T2 N=24 used for all synthesis */ - } - ELSE -#endif { /*vr_add( uq+start, cb[i]+Idx[i]*maxn, uq+start, n );, where uq = a zero vector*/ offset = i_mult2( Idx[i], N34 ); @@ -4499,217 +4421,3 @@ void create_IDCT_N_Matrix_fx( return; } -#ifdef IVAS_MSVQ - -/*-------------------------------------------------------------------* - * dctT2_N_apply_matrix() - * - * dct/idct truncated matrix appl. for DCT basis vector lengths of N - *-------------------------------------------------------------------*/ - -void dctT2_N_apply_matrix( - const float *input, /* i : input in fdcng or DCT(fdcng) domain */ - float *output, /* o : output in DCT(fdcng) or fdcng ordomain */ - const int16_t dct_dim, /* i : dct processing dim possibly truncated */ - const int16_t fdcngvq_dim, /* i : fdcng domain length */ - const float *matrix, /* i : IDCT matrix */ - const int16_t matrix_row_dim, /* i : */ - const DCTTYPE dcttype /* i : matrix operation type */ -) -{ - int16_t i, j, dim_in, dim_out; - int16_t mat_step_col, mat_step_row, mat_step_col_flag; - const float *pt_x, *pt_A; - float tmp_y[FDCNG_VQ_MAX_LEN]; - float *pt_y; - - /* non-square DCT_N and IDCT_N matrix application, - using a stored format of an IDCT_Nx(FDCNG_VQ_DCT_MAXTRUNC) matrix */ - /* efficiently parallelized in SIMD */ - - assert( dct_dim <= FDCNG_VQ_DCT_MAXTRUNC ); - assert( fdcngvq_dim <= FDCNG_VQ_MAX_LEN ); - - if ( ( dcttype & 1 ) == 0 ) /* even entries are DCTs */ - { - /* DCT_typeII 24,21 -> XX in worst case */ - dim_in = fdcngvq_dim; - dim_out = dct_dim; - mat_step_col = matrix_row_dim; /* matrix maximum storage size dependent, width of first row in matrix */ - mat_step_row = 0; - mat_step_col_flag = 1; - assert( dcttype == DCT_T2_21_XX || dcttype == DCT_T2_24_XX ); - } - else - { - assert( ( dcttype & 1 ) != 0 ); /* idct */ - dim_in = dct_dim; - dim_out = fdcngvq_dim; - mat_step_col = 1; - mat_step_row = matrix_row_dim; - mat_step_col_flag = 0; - assert( dcttype == IDCT_T2_XX_24 ); - } - - pt_y = tmp_y; - for ( i = 0; i < dim_out; i++ ) - { - pt_x = input; - *pt_y = 0; - - /* +i(DCT) or +i*maxTrunc(IDCT) */ -#define WMC_TOOL_SKIP - pt_A = &( matrix[i * ( mat_step_row + mat_step_col_flag )] ); /* ptr indexing */ - PTR_INIT( 1 ); -#undef WMC_TOOL_SKIP - for ( j = 0; j < dim_in; j++ ) - { -#define WMC_TOOL_SKIP - *pt_y += ( *pt_x++ ) * ( *pt_A ); - pt_A += mat_step_col; /* step +maxtrunc or +1 */ /* ptr indexing*/ - MAC( 1 ); -#undef WMC_TOOL_SKIP - } - pt_y++; - } - - mvr2r( tmp_y, output, dim_out ); - - return; -} - - -/*-------------------------------------------------------------------* - * extend_dctN_input() - * - * (inputN, dctN) -> idct(N_ext) idct_N matrix application loop for - * extending, extrapolating a DCT basis vector length of N to N_ext - *-------------------------------------------------------------------*/ - -void extend_dctN_input( - const float *input, /* i : input in fdcng domain */ - const float *dct_input, /* i : input in dctN(fdcng) domain */ - const int16_t in_dim, /* i : in_dim == N */ - float *ext_sig, /* o : extended output in fdcng domain */ - const int16_t out_dim, /* i : output total dim */ - float *matrix, /* i : idct synthesis matrix N rows, n_cols columns */ - const int16_t n_cols, /* i : number of columns == DCT truncation length */ - const DCTTYPE dcttype /* i : matrix operation type */ -) -{ - int16_t i, j, i_rev; - const float( *ptr )[FDCNG_VQ_DCT_MAXTRUNC] = (void *) matrix; - - /* stored format is an IDCT_Nx(FDCNG_VQ_DCT_MAXTRUNC) matrix */ - assert( in_dim < FDCNG_VQ_MAX_LEN ); - assert( out_dim <= FDCNG_VQ_MAX_LEN ); - assert( out_dim > in_dim ); - assert( n_cols == FDCNG_VQ_DCT_MAXTRUNC ); /* for *ptr[MAX_TRUNC] adressing*/ - assert( ( dcttype & 1 ) != 0 ); /* idct tables always in use for this basis vector extension */ - - mvr2r( input, ext_sig, in_dim ); /* copy initial part, i.e. only last/tail parts are extended */ - set_f( &( ext_sig[in_dim] ), 0.0, out_dim - in_dim ); - - i_rev = in_dim; /*ptr init*/ - for ( i = in_dim; i < out_dim; i++ ) - { /* for each extension sample */ - /* i = 21 22 23; - i_rev = 20 19 18; for odd dctII reflect basis vector - */ - i_rev--; - - for ( j = 0; j < n_cols; j++ ) /* for each available DCT coeff */ - { - /* DCTcoeff * reflected basis vector */ -#define WMC_TOOL_SKIP - /* pure ptr MAC operations */ - ext_sig[i] += dct_input[j] * ptr[i_rev][j]; /* sum up scaled and extended basis vector */ - MAC( 1 ); -#undef WMC_TOOL_SKIP - } - } - - return; -} - - -/*-------------------------------------------------------------------* - * create_IDCT_N_Matrix() - * - * inititate idct24 FDCNG_VQ_DCT_MAXTRUNCx N matrix in - * RAM from a quantized compressed ROM format - *-------------------------------------------------------------------*/ - -void create_IDCT_N_Matrix( - float *inv_matrixFloatQ, /* i/o: RAM buffer */ - const int16_t N, /* i : DCT length, number of time samples */ - const int16_t n_cols, /* i : number of dct coeffs (as DCT may be truncated) */ - const int16_t alloc_size /* i : RAM buffer size in elements */ -) -{ - int16_t c, c1, r, r_flip, W16_val; - int16_t len; - int16_t mat_cpy_size; - const Word16 *absval_ptr; - const Word8 *idx_ptr; - Word16 idx; - float( *ptr )[FDCNG_VQ_DCT_MAXTRUNC] = (void *) inv_matrixFloatQ; /* fixed number of columns pointers, to simplifies adressing in ANSIC */ - - absval_ptr = unique_idctT2_24coeffsQ16; - idx_ptr = idctT2_24_compressed_idx; - len = FDCNG_VQ_MAX_LEN; - - if ( N == FDCNG_VQ_MAX_LEN_WB ) - { - absval_ptr = unique_idctT2_21coeffsQ16; - idx_ptr = idctT2_21_compressed_idx; - len = N; - } - - assert( alloc_size >= ( n_cols * len ) ); /* enough space for the full expanded IDCT matrix */ - assert( N <= len ); - - mat_cpy_size = ( n_cols ) * ( len >> 1 ); /* NB integer division of "len" */ - - if ( ( len & 1 ) != 0 ) - { /* odd sized DCT with a non-reflected center row */ - mat_cpy_size += n_cols; - } - - for ( c = 0; c < mat_cpy_size; c++ ) - { - idx = (Word16) ( idx_ptr[c] ); - W16_val = absval_ptr[abs( idx )]; - - if ( idx < 0 ) - { - W16_val = -( W16_val ); - } - inv_matrixFloatQ[c] = ( +1.52587890625e-05f ) * ( (float) W16_val ); /* 1.0/2.^16 scaling to a float-"Q0" , a scaling that is not done in BASOP */ - } - - /* for even number of coeffs DCT24, - flip symmetry for odd, even is used to save 50% IDCT Table ROM */ - /* for an odd DCT center is not flipped e.g for DCT21 */ - - assert( n_cols == FDCNG_VQ_DCT_MAXTRUNC ); - assert( ( n_cols & 1 ) == 0 ); - - for ( c = 0; c < ( n_cols ); c += 2 ) - { - c1 = c + 1; - r_flip = len - 1; - for ( r = 0; r < ( len / 2 ); r++, r_flip-- ) - { -#define WMC_TOOL_SKIP - ptr[r_flip][c] = ptr[r][c]; /* flipped */ - ptr[r_flip][c1] = -( ptr[r][c1] ); /* flipped and sign swapped */ - MOVE( 2 ); - MULT( 1 ); /* for negate */ -#undef WMC_TOOL_SKIP - } - } - - return; -} -#endif diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index bbd5416daa5002b78e36f0a3666d803dc3cf9cc3..ecd190f699cf5c2904906df6f2edb9d350c0a71c 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -916,11 +916,7 @@ void msvq_dec( const Word16 N, /* i : Vector dimension */ const Word16 maxN, /* i : Codebook dimension */ const Word16 Idx[], /* i : Indices */ -#ifdef IVAS_MSVQ - const int16_t applyIDCT_flag, /* i : applyIDCT flag */ - const float *invTrfMatrix, /* i : matrix for IDCT synthesis */ -#endif - Word16 *uq /* o : quantized vector (3Q12) */ + Word16 *uq /* o : quantized vector (3Q12) */ ); Word16 tcxlpc_get_cdk( @@ -6449,12 +6445,7 @@ void DetectTonalComponents( const Word16 nSamples, const Word16 nSamplesCore, Word16 floorPowerSpectrum, /* i: lower limit for power spectrum bins */ - Word16 element_mode -#ifdef IVAS_CODE_MDCT_GSHAPE - , - const PsychoacousticParameters *psychParamsCurrent -#endif -); + Word16 element_mode ); void RefineTonalComponents( Word16 indexOfTonalPeak[], @@ -6474,12 +6465,7 @@ void RefineTonalComponents( const Word16 nSamples, const Word16 nSamplesCore, const Word16 floorPowerSpectrum, /* i: lower limit for power spectrum bins */ - Word16 element_mode -#ifdef IVAS_CODE_MDCT_GSHAPE - , - const PsychoacousticParameters *psychParamsCurrent -#endif -); + Word16 element_mode ); void ivas_RefineTonalComponents_fx( Word16 indexOfTonalPeak[], @@ -6561,20 +6547,13 @@ void TonalMDCTConceal_Detect( const Word32 pitchLag, /*IN */ Word16 *umIndices, /*OUT*/ Word16 element_mode /* IN */ -#ifdef IVAS_CODE_MDCT_GSHAPE - , - const PsychoacousticParameters *psychParamsCurrent -#endif ); void TonalMDCTConceal_Apply( - const TonalMDCTConcealPtr hTonalMDCTConc, /*IN */ - Word32* mdctSpectrum, /*IN/OUT*/ - Word16* mdctSpectrum_exp /*IN */ -#ifdef IVAS_CODE_MDCT_GSHAPE - , const PsychoacousticParameters* psychParamsCurrent) -#endif - ); + const TonalMDCTConcealPtr hTonalMDCTConc, /*IN */ + Word32 *mdctSpectrum, /*IN/OUT*/ + Word16 *mdctSpectrum_exp /*IN */ +); void TonalMDCTConceal_Apply_ivas_fx( TonalMDCTConcealPtr hTonalMDCTConc, /*IN */ @@ -9137,15 +9116,8 @@ Word16 decode_lpc_avq_fx( Decoder_State *st, /* i/o: decoder state structure */ const Word16 numlpc, /* i : Number of sets of lpc */ Word16 *param_lpc /* o : lpc parameters */ -#ifdef IVAS_CODE_AVQ_LPC - , - const Word16 ch, /* i : channel */ - const Word16 element_mode, /* i : element mode */ - const Word16 sns_low_br_mode /* i : SNS low-bitrate mode */ -#endif ); -// decode_lpc_avq_ivas_fx declaration with IVAS_CODE_AVQ_LPC enabled Word16 decode_lpc_avq_ivas_fx( Decoder_State *st, /* i/o: decoder state structure */ const Word16 numlpc, /* i : Number of sets of lpc */ @@ -9369,13 +9341,6 @@ void modify_lsf( void con_tcx_fx( Decoder_State *st, /* i/o: coder memory state */ Word16 synth[] /* i/o: synth[] */ /*Q0 */ -#ifdef IVAS_CODE_CON_TCX - , - 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 */ -#endif - ); // er_scale_sync.c diff --git a/lib_dec/ACcontextMapping_dec_fx.c b/lib_dec/ACcontextMapping_dec_fx.c index 22e9fff0114f1f5c0d3b5057744a446f95a0a0bb..acf372565408b238d2a86c40b85a396f5660b5ae 100644 --- a/lib_dec/ACcontextMapping_dec_fx.c +++ b/lib_dec/ACcontextMapping_dec_fx.c @@ -328,9 +328,6 @@ Word16 ACcontextMapping_decode2_no_mem_s17_LC( return resQBits; } -#define IVAS_CONTEXT_MAPPING -#ifdef IVAS_CONTEXT_MAPPING - /*-------------------------------------------------------------------* * RCcontextMapping_decode2_no_mem_s17_LCS() * @@ -737,6 +734,3 @@ Word16 RCcontextMapping_decode2_no_mem_s17_LCS_fx( return resQBits; } - -#endif -#undef IVAS_CONTEXT_MAPPING diff --git a/lib_dec/TonalComponentDetection_fx.c b/lib_dec/TonalComponentDetection_fx.c index 4b2cf021315bf745b5c35e75c81444836320885b..409b975f5c18312785f64650e5bfda0631cb6d75 100644 --- a/lib_dec/TonalComponentDetection_fx.c +++ b/lib_dec/TonalComponentDetection_fx.c @@ -140,33 +140,13 @@ void DetectTonalComponents( const Word16 nSamples, const Word16 nSamplesCore, Word16 floorPowerSpectrum, /* i: lower limit for power spectrum bins Q0*/ - Word16 element_mode -#ifdef IVAS_CODE_MDCT_GSHAPE - , - const PsychoacousticParameters *psychParamsCurrent -#endif -) + Word16 element_mode ) { Word16 F0; Word16 thresholdModification[L_FRAME_MAX], lastMDCTSpect_exp; Word32 pScaledMdctSpectrum[L_FRAME_MAX]; -#ifdef IVAS_CODE_MDCT_GSHAPE - Word16 nBands; - IF( psychParamsCurrent == NULL ) - { - nBands = FDNS_NPTS; - PMT( "add nBands argument to mdct_shaping_16" ) -#endif - mdct_shaping_16( lastMDCTSpectrum, nSamplesCore, nSamples, scaleFactors, scaleFactors_exp, scaleFactors_max_e, pScaledMdctSpectrum ); -#ifdef IVAS_CODE_MDCT_GSHAPE - } - ELSE - { - sns_shape_spectrum( pScaledMdctSpectrum, psychParamsCurrent, scaleFactors, nSamplesCore ); - nBands = psychParamsCurrent->nBands; - } -#endif + mdct_shaping_16( lastMDCTSpectrum, nSamplesCore, nSamples, scaleFactors, scaleFactors_exp, scaleFactors_max_e, pScaledMdctSpectrum ); lastMDCTSpect_exp = add( lastMDCTSpectrum_exp, scaleFactors_max_e ); @@ -208,12 +188,7 @@ void RefineTonalComponents( const Word16 nSamples, const Word16 nSamplesCore, const Word16 floorPowerSpectrum, /* i: lower limit for power spectrum bins Q0*/ - Word16 element_mode -#ifdef IVAS_CODE_MDCT_GSHAPE - , - const PsychoacousticParameters *psychParamsCurrent -#endif -) + Word16 element_mode ) { Word16 newIndexOfTonalPeak[MAX_NUMBER_OF_IDX]; /*Q0*/ Word16 newLowerIndex[MAX_NUMBER_OF_IDX]; /*Q0*/ @@ -224,12 +199,7 @@ void RefineTonalComponents( DetectTonalComponents( newIndexOfTonalPeak, newLowerIndex, newUpperIndex, &newNumIndexes, lastPitchLag, currentPitchLag, lastMDCTSpectrum, - lastMDCTSpectrum_exp, scaleFactors, scaleFactors_exp, scaleFactors_max_e, secondLastPowerSpectrum, nSamples, nSamplesCore, floorPowerSpectrum, element_mode -#ifdef IVAS_CODE_MDCT_GSHAPE - , - psychParamsCurrent -#endif - ); + lastMDCTSpectrum_exp, scaleFactors, scaleFactors_exp, scaleFactors_max_e, secondLastPowerSpectrum, nSamples, nSamplesCore, floorPowerSpectrum, element_mode ); nPreservedPeaks = 0; move16(); diff --git a/lib_dec/bass_psfilter_fx.c b/lib_dec/bass_psfilter_fx.c index 45cf7feed026f9c1ef1b419d1f21e5fb08b2691a..4a5ef932892437f9d1ac7662c765c3aece88f343 100644 --- a/lib_dec/bass_psfilter_fx.c +++ b/lib_dec/bass_psfilter_fx.c @@ -1124,110 +1124,3 @@ void bpf_pitch_coherence_ivas_fx( return; } - - -#ifdef ADD_BPF_ADAPT -/*---------------------------------------------------------------------* - * res_bpf_adapt() - * - * Analyze BPF output and decide if it should be applied on DFT stereo - * residual signal - *---------------------------------------------------------------------*/ - -/*! r: Decision to enable or disable BPF on DFT stereo residual */ -int16_t res_bpf_adapt( - STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: DFT stereo decoder handle */ - const float *bpf_error_signal_8k, /* i : BPF modification signal */ - float res_buf[STEREO_DFT_BUF_MAX] /* i : residual buffer */ -) -{ - float error_nrg; - float tmp; - float res_hb_nrg; - float bpf_error_ratio; - int16_t res_bpf_flag; - int16_t i; - int16_t i_start; - int16_t i_end; - float bw_inv; - - if ( hStereoDft->res_cod_band_max == 6 ) - { - i_start = 39; - i_end = 64; - bw_inv = 0.04f; /* 1/(64 - 39) */ - } - else - { - i_start = 28; - i_end = 40; - bw_inv = 0.083f; /* 1/(40 - 28) */ - } - - /* Measure energy of high frequency band in MDCT domain */ - res_hb_nrg = EPSILON; - for ( i = i_start; i < i_end; i++ ) - { - res_hb_nrg += res_buf[i] * res_buf[i]; - } - res_hb_nrg *= bw_inv; - res_hb_nrg = STEREO_DFT_BPF_ADAPT_ALPHA * res_hb_nrg + ( 1 - STEREO_DFT_BPF_ADAPT_ALPHA ) * hStereoDft->res_hb_nrg_mem; - hStereoDft->res_hb_nrg_mem = res_hb_nrg; - - /* Measure energy of discontinuities at subframe boundaries */ - error_nrg = 0; - for ( i = 0; i < L_FRAME8k; i += STEREO_DFT_L_SUBFR_8k ) - { - tmp = bpf_error_signal_8k[i] - hStereoDft->bpf_error_signal_last; - error_nrg += tmp * tmp; - hStereoDft->bpf_error_signal_last = bpf_error_signal_8k[i + STEREO_DFT_L_SUBFR_8k - 1]; - } - error_nrg *= 0.2f; /* Division by 5 for average value */ - bpf_error_ratio = min( 2, error_nrg / res_hb_nrg ); /* Form decision variable and apply limit */ - bpf_error_ratio = STEREO_DFT_BPF_ADAPT_BETA * bpf_error_ratio + ( 1 - STEREO_DFT_BPF_ADAPT_BETA ) * hStereoDft->bpf_error_ratio_mem; - hStereoDft->bpf_error_ratio_mem = bpf_error_ratio; - - res_bpf_flag = bpf_error_ratio < 1; - - return res_bpf_flag; -} - -/*---------------------------------------------------------------------* - * bpf_pitch_coherence() - * - * Analyse pitch coherence - *---------------------------------------------------------------------*/ -void bpf_pitch_coherence( - Decoder_State *st, /* i/o: decoder state structure */ - const float pitch_buf[] /* i : pitch for every subfr [0,1,2,3] */ -) -{ - int16_t nb_subfr; - float pc, pcn1, pcn2, pcn3; - - nb_subfr = st->L_frame / L_SUBFR; - - if ( st->clas_dec > UNVOICED_CLAS && st->element_mode != EVS_MONO ) - { - pc = (float) fabs( st->old_pitch_buf[nb_subfr + 3] + st->old_pitch_buf[nb_subfr + 2] - st->old_pitch_buf[nb_subfr] - st->old_pitch_buf[nb_subfr + 1] ) * 256.0f / (float) st->L_frame; - pcn1 = K_PC_DEC * pc + C_PC_DEC; - pcn1 = max( min( pcn1, 1.0f ), 0.0f ); - - pc = (float) fabs( pitch_buf[nb_subfr - 1] + pitch_buf[nb_subfr - 2] - pitch_buf[1] - pitch_buf[0] ) * 256.0f / (float) st->L_frame; - pcn2 = K_PC_DEC * pc + C_PC_DEC; - pcn2 = max( min( pcn2, 1.0f ), 0.0f ); - - pc = (float) fabs( st->old_pitch_buf[nb_subfr + 3] + st->old_pitch_buf[nb_subfr + 2] - pitch_buf[1] - pitch_buf[0] ) * 256.0f / (float) st->L_frame; - pcn3 = K_PC_DEC * pc + C_PC_DEC; - pcn3 = max( min( pcn3, 1.0f ), 0.0f ); - - if ( pcn1 + pcn2 + pcn3 < 2.5f ) - { - st->hBPF->psf_att = 0.4f; - set_s( &st->hBPF->Track_on_hist[L_TRACK_HIST - nb_subfr], 1, nb_subfr ); - } - } - - return; -} -#endif diff --git a/lib_dec/dec_higher_acelp_fx.c b/lib_dec/dec_higher_acelp_fx.c index aff7e56564e134e0492ba56f92bed3e6882af87b..6144765a8707dec75df9f6ffd037cb64681ddb17 100644 --- a/lib_dec/dec_higher_acelp_fx.c +++ b/lib_dec/dec_higher_acelp_fx.c @@ -8,7 +8,6 @@ #include "prot_fx.h" /* Function prototypes */ #include "rom_com.h" /* Static table prototypes */ -#define IVAS_CODE_AVQ /*-----------------------------------------------------------------* * transf_cdbk_dec() * Transform domain contribution decoding @@ -129,7 +128,6 @@ void transf_cdbk_dec_fx( * Demultiplex and decode subvectors from bit-stream *--------------------------------------------------------------*/ -#ifdef IVAS_CODE_AVQ AVQ_demuxdec_fx( st_fx, code_preQ, &nBits, 8, nq, avq_bit_sFlag, trgtSvPos ); Word16 q_Code_preQ; IF( ( st_fx->element_mode == EVS_MONO ) ) @@ -142,9 +140,6 @@ void transf_cdbk_dec_fx( q_Code_preQ = Q_AVQ_OUT; move16(); } -#else - AVQ_demuxdec_fx( st_fx, code_preQ, &nBits, 8, nq ); -#endif FOR( i = 0; i < L_SUBFR; i++ ) { code_preQ[i] = shl_o( code_preQ[i], q_Code_preQ, &Overflow ); @@ -185,7 +180,6 @@ void transf_cdbk_dec_fx( st_fx->last_nq_preQ = nq[7]; move16(); -#ifdef IVAS_CODE_AVQ /* TD pre-quantizer: in extreme cases at subframe boundaries, lower the preemphasis memory to avoid a saturation */ test(); test(); @@ -209,7 +203,6 @@ void transf_cdbk_dec_fx( st_fx->last_code_preq = code_preQ[L_SUBFR - 1]; // q_Code_preQ move16(); -#endif PREEMPH_FX( code_preQ, FAC_PRE_AVQ_FX, L_SUBFR, &st_fx->mem_preemp_preQ_fx ); /*--------------------------------------------------------------* * Compute normalized prequantizer excitation gain for FEC diff --git a/lib_dec/dec_prm_fx.c b/lib_dec/dec_prm_fx.c index 3d277807d2fed95764ba8e3c4992662fd26eac4b..16e588396b547fb2f56c6e88a6f44d616bbed3bc 100644 --- a/lib_dec/dec_prm_fx.c +++ b/lib_dec/dec_prm_fx.c @@ -1003,12 +1003,7 @@ void dec_prm_fx( { IF( st->lpcQuantization == 0 ) { - decode_lpc_avq_fx( st, st->numlpc, param_lpc -#ifdef IVAS_CODE_AVQ_LPC - , - , , -#endif - ); + decode_lpc_avq_fx( st, st->numlpc, param_lpc ); move16(); } ELSE IF( EQ_16( st->lpcQuantization, 1 ) ) diff --git a/lib_dec/dlpc_avq_fx.c b/lib_dec/dlpc_avq_fx.c index 3d9a00b7f1bbbb7be3c76f639125fe0913d033f3..07f1ea6f21206fa6b7d77d2886afc525462e6f85 100644 --- a/lib_dec/dlpc_avq_fx.c +++ b/lib_dec/dlpc_avq_fx.c @@ -149,20 +149,11 @@ Word16 decode_lpc_avq_fx( Decoder_State *st, /* i/o: decoder state structure */ const Word16 numlpc, /* i : Number of sets of lpc */ Word16 *param_lpc /* o : lpc parameters */ -#ifdef IVAS_CODE_AVQ_LPC - , - const Word16 ch, /* i : channel */ - const Word16 element_mode, /* i : element mode */ - const Word16 sns_low_br_mode /* i : SNS low-bitrate mode */ -#endif ) { Word16 k, j; Word16 nb, qn1, qn2, avqBits, q_type; Word16 start_bit_pos; -#ifdef IVAS_CODE_AVQ_LPC - Word16 stereo_mode = 0; -#endif move16(); move16(); move16(); @@ -189,41 +180,11 @@ Word16 decode_lpc_avq_fx( param_lpc[j] = q_type; j = add( j, 1 ); } -#ifdef IVAS_CODE_AVQ_LPC - test(); - IF( EQ_16( element_mode, IVAS_CPE_MDCT ) && k == 0 ) - { - stereo_mode = ch; - move16(); - if ( ch == 0 ) - { - stereo_mode = param_lpc[j]; - move16(); - } - param_lpc[j++] = stereo_mode; - move16(); - } -#endif /* Decode quantization indices */ IF( q_type == 0 ) { /* Absolute quantizer with 1st stage stochastic codebook */ -#ifdef IVAS_CODE_AVQ_LPC - IF( EQ_16( element_mode, IVAS_CPE_MDCT ) ) - { - IF( NE_16( stereo_mode, 3 ) ) - { - param_lpc[j] = get_next_indice_fx( st, SNS_ABS_QUANT_BITS ); - } - ELSE - { - param_lpc[j] = sub( get_next_indice_fx( st, 1 ), 2 ); - } - move16(); - } - ELSE -#endif { move16(); param_lpc[j] = get_next_indice_fx( st, 8 ); @@ -235,9 +196,6 @@ Word16 decode_lpc_avq_fx( * - we are in low bitrate mode and no joint SNS coding is used * - OR the side-SNS-is-zero flag is set for joint SNS */ -#ifdef IVAS_CODE_AVQ_LPC - IF( NE_16( element_mode, IVAS_CPE_MDCT ) || ( !( sns_low_br_mode && ( EQ_16( stereo_mode, 0 ) || EQ_16( stereo_mode, 1 ) ) && !( EQ_16( q_type, 0 ) && EQ_16( param_lpc[j - 1], -2 ) ) ) ) ) -#endif { /* 2 bits to specify Q2,Q3,Q4,ext */ qn1 = add( 2, get_next_indice_fx( st, 2 ) ); @@ -321,21 +279,11 @@ Word16 decode_lpc_avq_fx( pack4bits_fx( avqBits, st, ¶m_lpc[j] ); j = add( j, qn2 ); } -#ifdef IVAS_CODE_AVQ_LPC - ELSE - { - param_lpc[j] = 0; - j = add( j, 1 ); - param_lpc[j] = 0; - j = add( j, 1 ); - move16(); - move16(); - } -#endif } return sub( st->next_bit_pos, start_bit_pos ); } + Word16 decode_lpc_avq_ivas_fx( Decoder_State *st, /* i/o: decoder state structure */ const Word16 numlpc, /* i : Number of sets of lpc */ diff --git a/lib_dec/er_dec_tcx_fx.c b/lib_dec/er_dec_tcx_fx.c index 161cefe769ce7443f20482359ab2fcdf0452f041..3d0eab8153845c06cda2e6562038b4da91a1b2c2 100644 --- a/lib_dec/er_dec_tcx_fx.c +++ b/lib_dec/er_dec_tcx_fx.c @@ -121,13 +121,6 @@ con_tcx void con_tcx_fx( Decoder_State *st, /* i/o: coder memory state */ Word16 synth[] /* i/o: synth[] Q0*/ -#ifdef IVAS_CODE_CON_TCX - , - const Word16 coh, /* i : coherence of stereo signal Q14*/ - Word16 *noise_seed, /* i/o: noise seed for stereo Q0*/ - const Word16 only_left /* i : TD-PLC only in left channel Q0*/ -#endif - ) { Word16 i, s, c, L_frame, L_subfr, fLowPassFilter, T0; @@ -558,43 +551,7 @@ void con_tcx_fx( /*-----------------------------------------------------------------* * Construct the random part of excitation *-----------------------------------------------------------------*/ -#ifdef IVAS_CODE_CON_TCX - if ( coh != -1.f ) - { - int16_t tmpSeed1; - float alpha_coh; - float random1, random2; - - tmpSeed1 = *noise_seed; - noise = buf; - - alpha_coh = sqrtf( ( 1 - coh ) / ( 1 + coh ) ); - if ( st->idchan == 1 ) - { - alpha_coh = -alpha_coh; - } - - for ( i = 0; i < L_frame + L_FIR_FER2 - 1; i++ ) - { - random1 = (float) own_random( &tmpSeed1 ); - random2 = (float) own_random( &tmpSeed1 ); - noise[i] = random1 + alpha_coh * random2; - } - - if ( st->idchan == 1 || only_left ) - { - *noise_seed = tmpSeed1; - } - for ( ; i < L_frame + ( L_frame / 2 ) + 2 * L_FIR_FER2; i++ ) - { - random1 = (float) own_random( &tmpSeed1 ); - random2 = (float) own_random( &tmpSeed1 ); - noise[i] = random1 + alpha_coh * random2; - } - } - else -#endif /*IVAS_CODE_CON_TCX*/ { tmpSeed = st->seed_acelp; move16(); @@ -1427,7 +1384,7 @@ void con_tcx_ivas_fx( /*-----------------------------------------------------------------* * Construct the random part of excitation *-----------------------------------------------------------------*/ -#ifndef IVAS_CODE_CON_TCX + IF( NE_16( coh, -16384 ) ) { Word16 tmpSeed1; @@ -1477,7 +1434,6 @@ void con_tcx_ivas_fx( } } ELSE -#endif /*IVAS_CODE_CON_TCX*/ { tmpSeed = st->seed_acelp; /*Q0*/ move16(); diff --git a/lib_dec/er_util_fx.c b/lib_dec/er_util_fx.c index 9735129ec14bc56a1aed50c894ac3cf27a087b6a..cecbad2943bb83dc1528388e365cec92fa40c75e 100644 --- a/lib_dec/er_util_fx.c +++ b/lib_dec/er_util_fx.c @@ -579,12 +579,7 @@ Word16 GetPLCModeDecision_fx( pitch = L_add( st->old_fpitch, 0 ); /*Q16*/ } - TonalMDCTConceal_Detect( st->hTonalMDCTConc, pitch, &numIndices, st->element_mode -#ifdef IVAS_CODE_MDCT_GSHAPE - , - ( st->element_mode == IVAS_CPE_MDCT ? &( st->hTcxCfg->psychParamsTCX20 ) : st->hTcxCfg->psychParamsCurrent ) -#endif - ); + TonalMDCTConceal_Detect( st->hTonalMDCTConc, pitch, &numIndices, st->element_mode ); test(); test(); diff --git a/lib_dec/hf_synth_fx.c b/lib_dec/hf_synth_fx.c index 94c7d4c6282edf47fa8278add6362ece82625d00..65c2e9290ab40cbdfd90c6883b33adaaac01d0ec 100644 --- a/lib_dec/hf_synth_fx.c +++ b/lib_dec/hf_synth_fx.c @@ -182,11 +182,7 @@ static void hf_synthesis_fx( * calculate energy scaling factor to respect tilt of synth12k8 * (tilt: 1=voiced, -1=unvoiced) *-----------------------------------------------------------------*/ -#ifdef EVS_MONO hp400_12k8_fx( synth, L_SUBFR, hBWE_zero->mem_hp400_fx ); -#else - hp400_12k8_ivas_fx( synth, L_SUBFR, hBWE_zero->mem_hp400_fx ); -#endif /* i: mem_hp400 in Q_syn */ /* i: synth in Q_syn */ /* o: synth in Q_syn-3 */ diff --git a/lib_dec/lsf_msvq_ma_dec_fx.c b/lib_dec/lsf_msvq_ma_dec_fx.c index 61e338c9c52451d70dec2d2a8f5656b29c664682..1b5d79c6824596fad3684066b2e2f67ebca9a257 100644 --- a/lib_dec/lsf_msvq_ma_dec_fx.c +++ b/lib_dec/lsf_msvq_ma_dec_fx.c @@ -185,9 +185,6 @@ Word16 D_lsf_tcxlpc( M, M, indices + NumIndices, -#ifdef IVAS_MSVQ - 0, NULL, -#endif lsf_q ); NumIndices = add( NumIndices, TCXLPC_NUMSTAGES ); /* Q0 */ @@ -208,9 +205,6 @@ Word16 D_lsf_tcxlpc( M, M, indices + NumIndices, -#ifdef IVAS_MSVQ - 0, NULL, -#endif lsf_rem_q_ind ); NumIndices = add( NumIndices, TCXLPC_IND_NUMSTAGES ); /* Q0 */ @@ -287,9 +281,6 @@ Word16 dec_lsf_tcxlpc( M, M, flag + 1, -#ifdef IVAS_MSVQ - 0, NULL, -#endif lsf_q_ind ); /* Update flag */ diff --git a/lib_dec/swb_bwe_dec_hr_fx.c b/lib_dec/swb_bwe_dec_hr_fx.c index 9fae1ded560681fb2420b3bc487adbb7ab23ece4..ff4d8bee65b694e9b56f26b48f8324857768f25f 100644 --- a/lib_dec/swb_bwe_dec_hr_fx.c +++ b/lib_dec/swb_bwe_dec_hr_fx.c @@ -11,7 +11,6 @@ #define Q_GUARD 1 #define Q_32_BITS 14 /* scaling of 't_audio32' */ #define MAKE_PSEUDO_FLT( v, e ) ( ( ( (Word32) ( v ) ) << 16 ) + ( e ) ) -#define AVQ_DEMUX /*-----------------------------------------------------------* * Gain_Dequant_HR() * @@ -595,11 +594,7 @@ Word16 swb_bwe_dec_hr_fx( /* o : Exponent of SHB Nsv = ( NUM_TRANS_END_FREQ_COEF - NUM_TRANS_START_FREQ_COEF ) / WIDTH_BAND; move16(); -#ifdef AVQ_DEMUX AVQ_demuxdec_fx( st_fx, x_norm, &nBits, Nsv, nq, 0, sub( Nsv, 1 ) ); -#else - AVQ_demuxdec_fx( st_fx, x_norm, &nBits, Nsv, nq ); -#endif temp = add( len, NUM_TRANS_START_FREQ_COEF ); /* 't_audio' in Q8 */ t_audio_exp = 8; @@ -848,11 +843,7 @@ Word16 swb_bwe_dec_hr_fx( /* o : Exponent of SHB /* Nsv = i / WIDTH_BAND */ Nsv = shr( i, 3 ); -#ifdef AVQ_DEMUX AVQ_demuxdec_fx( st_fx, x_norm, &nBits, Nsv, nq, 0, sub( Nsv, 1 ) ); -#else - AVQ_demuxdec_fx( st_fx, x_norm, &nBits, Nsv, nq ); -#endif /*---------------------------------------------------------------------* * second stage decoding *---------------------------------------------------------------------*/ @@ -889,11 +880,7 @@ Word16 swb_bwe_dec_hr_fx( /* o : Exponent of SHB } nBits = sub( nBits, NBITS_GLOB_GAIN_BWE_HR ); -#ifdef AVQ_DEMUX AVQ_demuxdec_fx( st_fx, x_norm1, &nBits, Nsv2, nq2, 0, sub( Nsv2, 1 ) ); -#else - AVQ_demuxdec_fx( st_fx, x_norm1, &nBits, Nsv2, nq2 ); -#endif } /*---------------------------------------------------------------------* diff --git a/lib_dec/tonalMDCTconcealment_fx.c b/lib_dec/tonalMDCTconcealment_fx.c index f33a6c84f1781e57dba5ee58f6bf553367aed4e5..fd6cf7835e410e763405e49170ac72cb81337ee2 100644 --- a/lib_dec/tonalMDCTconcealment_fx.c +++ b/lib_dec/tonalMDCTconcealment_fx.c @@ -873,12 +873,7 @@ static void CalcPowerSpecAndDetectTonalComponents( Word32 secondLastMDCT[], // Q31-secondLastMDCT_exp Word16 secondLastMDCT_exp, Word32 const pitchLag, /*15Q16*/ - Word16 element_mode -#ifdef IVAS_CODE_MDCT_GSHAPE - , - const PsychoacousticParameters *psychParamsCurrent -#endif -) + Word16 element_mode ) { Word16 nSamples; Word16 i; @@ -968,20 +963,9 @@ static void CalcPowerSpecAndDetectTonalComponents( /* here mdct_shaping() is intentionally used rather then mdct_shaping_16() */ -#ifdef IVAS_CODE_MDCT_GSHAPE - IF( psychParamsCurrent == NULL ) -#endif { mdct_shaping( powerSpectrum, hTonalMDCTConc->nSamplesCore, invScaleFactors, invScaleFactors_exp ); } -#ifdef IVAS_CODE_MDCT_GSHAPE - ELSE - { - PMTE() - sns_shape_spectrum( powerSpectrum, psychParamsCurrent, invScaleFactors, hTonalMDCTConc->nSamplesCore ); - nBands = psychParamsCurrent->nBands; - } -#endif FOR( i = hTonalMDCTConc->nSamplesCore; i < nSamples; i++ ) { powerSpectrum[i] = L_shl_sat( Mpy_32_16_1( powerSpectrum[i], invScaleFactors[FDNS_NPTS - 1] ), invScaleFactors_exp[FDNS_NPTS - 1] ); // powerSpectrum_exp+ 2*invScaleFactors_exp -15 @@ -1034,12 +1018,7 @@ void TonalMDCTConceal_Detect( const TonalMDCTConcealPtr hTonalMDCTConc, const Word32 pitchLag, /*15Q16*/ Word16 *numIndices, - Word16 element_mode -#ifdef IVAS_CODE_MDCT_GSHAPE - , - const PsychoacousticParameters *psychParamsCurrent -#endif -) + Word16 element_mode ) { Word32 secondLastMDST[L_FRAME_MAX]; Word32 secondLastMDCT[L_FRAME_MAX]; @@ -1111,9 +1090,6 @@ void TonalMDCTConceal_Detect( { /* If the second last frame was also lost, it is expected that pastTimeSignal could hold a bit different signal (e.g. including fade-out) from the one stored in TonalMDCTConceal_SaveTimeSignal. */ /* That is why we reuse the already stored information about the concealed spectrum in the second last frame */ -#ifdef IVAS_CODE_MDCT_GSHAPE - IF( psychParamsCurrent == NULL ) -#endif { nSamples = hTonalMDCTConc->nNonZeroSamples; move16(); @@ -1121,13 +1097,6 @@ void TonalMDCTConceal_Detect( hTonalMDCTConc->secondLastBlockData.scaleFactors, hTonalMDCTConc->secondLastBlockData.scaleFactors_exp, hTonalMDCTConc->secondLastBlockData.scaleFactors_max_e, powerSpectrum ); } -#ifdef IVAS_CODE_MDCT_GSHAPE - ELSE - { - sns_shape_spectrum( powerSpectrum, psychParamsCurrent, hTonalMDCTConc->secondLastBlockData.scaleFactors, hTonalMDCTConc->nSamplesCore ); - nBands = psychParamsCurrent->nBands; - } -#endif powerSpectrum_exp = getScaleFactor32( powerSpectrum, nSamples ); powerSpectrum_exp = sub( powerSpectrum_exp, 3 ); /*extra 3 bits of headroom for MA filter in getEnvelope*/ @@ -2532,10 +2501,6 @@ void TonalMDCTConceal_Apply( const TonalMDCTConcealPtr hTonalMDCTConc, /*IN */ Word32 *mdctSpectrum, // Q31-*mdctSpectrum_exp /*IN/OUT*/ Word16 *mdctSpectrum_exp /*IN */ -#ifdef IVAS_CODE_MDCT_GSHAPE - , - const PsychoacousticParameters *psychParamsCurrent -#endif ) { Word16 i, l, exp; @@ -2553,22 +2518,12 @@ void TonalMDCTConceal_Apply( move16(); assert( hTonalMDCTConc->pTCI->upperIndex[hTonalMDCTConc->pTCI->numIndexes - 1] < nSamples ); -#ifdef IVAS_CODE_MDCT_GSHAPE - IF( psychParamsCurrent == NULL ) -#endif { mdct_shaping_16( hTonalMDCTConc->secondLastPowerSpectrum, hTonalMDCTConc->nSamplesCore, nSamples, hTonalMDCTConc->secondLastBlockData.scaleFactors, hTonalMDCTConc->secondLastBlockData.scaleFactors_exp, hTonalMDCTConc->secondLastBlockData.scaleFactors_max_e, powerSpectrum ); } -#ifdef IVAS_CODE_MDCT_GSHAPE - ELSE - { - sns_shape_spectrum( powerSpectrum, psychParamsCurrent, hTonalMDCTConc->secondLastBlockData.scaleFactors, hTonalMDCTConc->nSamplesCore ); - nBands = psychParamsCurrent->nBands; - } -#endif phaseDiff = hTonalMDCTConc->pTCI->phaseDiff; /* if multiple frame loss occurs use the phase from the last frame and continue rotating */ pCurrentPhase = hTonalMDCTConc->pTCI->phase_currentFramePredicted; diff --git a/lib_enc/ACcontextMapping_enc_fx.c b/lib_enc/ACcontextMapping_enc_fx.c index 43bd30fd4a5a3d9514160fc45397991ee27fbfb9..5003712b7ceda9821bc022dd7e0275be48282386 100644 --- a/lib_enc/ACcontextMapping_enc_fx.c +++ b/lib_enc/ACcontextMapping_enc_fx.c @@ -1826,519 +1826,3 @@ Word16 RCcontextMapping_encode2_estimate_bandWise_fx( return bandBits; } - - -#ifdef IVAS_CODE_RANGE_CODER - -/*-------------------------------------------------------------------* - * RCcontextMapping_encode2_estimate_no_mem_s17_LCS() - * - * Range coder bit-estimation - *-------------------------------------------------------------------*/ - -int16_t RCcontextMapping_encode2_estimate_no_mem_s17_LCS( - int16_t *x, /* Spectral coefficients */ - const int16_t nt, /* L - size of spectrum (no. of spectral coefficients) */ - int16_t *lastnz_out, - int16_t *nEncoded, /* No. of spectral coefficients that can be coded without an overflow occuring */ - const int16_t target, /* Target bits */ - int16_t *stop, - int16_t mode, - CONTEXT_HM_CONFIG *hm_cfg /* context-based harmonic model configuration */ -) -{ - /* Common variables */ - int16_t a1, b1; - int16_t k, pki, lev1; - uint16_t t; - int16_t lastnz, lastnz2; - int16_t rateFlag; - float bit_estimate; - int16_t symbol; - const uint8_t *lookup; - float nbits2; - - /* Initialization */ - bit_estimate = 2.0f; - nbits2 = 0.f; - - /* bits to encode lastnz */ - k = 1; - - while ( k < nt / 2 ) - { - bit_estimate++; - k = k << 1; - /* check while condition */ - } - - nbits2 = bit_estimate; - - if ( hm_cfg ) - { - int16_t a1_i, b1_i; - int16_t stop2; - int16_t total_output_bits; - int16_t nt_half; - int32_t c[2], *ctx; - int32_t p1, p2; - int16_t ii[2]; - int16_t idx1, idx2, idx; - int16_t numPeakIndicesOrig = 0, numHoleIndices = 0; /* only to avoid compiler warning */ - - /* Rate flag */ - if ( target > 400 ) - { - rateFlag = 2 << NBITS_CONTEXT; /* Select context-A for higher bitrates */ - } - else - { - rateFlag = 0; /* Select context-B for lower bitrates */ - } - - nt_half = nt >> 1; - stop2 = 0; - c[0] = c[1] = 0; - - /* Find last non-zero tuple in the mapped domain signal */ - lastnz = find_last_nz_pair( x, nt, hm_cfg ); - - lastnz2 = 2; - - /* mapped domain */ - numPeakIndicesOrig = hm_cfg->numPeakIndices; - hm_cfg->numPeakIndices = min( hm_cfg->numPeakIndices, lastnz ); - numHoleIndices = lastnz - hm_cfg->numPeakIndices; - - /* Mark hole indices beyond lastnz as pruned */ - for ( k = numHoleIndices; k < hm_cfg->numHoleIndices; ++k ) - { - hm_cfg->holeIndices[k] = hm_cfg->holeIndices[k] + nt; - } - - ii[0] = numPeakIndicesOrig; - ii[1] = 0; - - p1 = p2 = 0; /* to avoid compilation warnings */ - - /* Main Loop through the 2-tuples */ - for ( k = 0; k < lastnz; k += 2 ) - { - a1_i = get_next_coeff_mapped( ii, &p1, &idx1, hm_cfg ); - b1_i = get_next_coeff_mapped( ii, &p2, &idx2, hm_cfg ); - - idx = min( idx1, idx2 ); - - /* Get context */ - ctx = &c[p1 | p2]; - - t = (uint16_t) ( *ctx + rateFlag ); - t += ( nt_half >= idx ) ? 0 : ( 1 << NBITS_CONTEXT ); - - /* Init current 2-tuple encoding */ - a1 = (int16_t) abs( x[a1_i] ); - b1 = (int16_t) abs( x[b1_i] ); - lev1 = -( 1 << ( NBITS_CONTEXT + NBITS_RATEQ ) ); - - /* Signs Bits */ - bit_estimate += min( a1, 1 ); - bit_estimate += min( b1, 1 ); - - /* pre-compute address of ari_pk_s17_LC_ext[0][Val_esc] to avoid doing it multiple times inside the loop */ - lookup = &ari_lookup_s17_LC[t] + ( 1 << ( NBITS_CONTEXT + NBITS_RATEQ ) ); - - /* check while condition */ - /* MSBs coding */ - while ( max( a1, b1 ) >= A_THRES ) - { - pki = lookup[lev1]; /* ESC symbol */ - - bit_estimate = bit_estimate + ari_bit_estimate_s17_LC[pki][VAL_ESC]; - bit_estimate += 2; /* Add 2 LSB bits corresponding to the bit-plane */ - - ( a1 ) >>= 1; - ( b1 ) >>= 1; - - lev1 = min( lev1 + ( 1 << ( NBITS_CONTEXT + NBITS_RATEQ ) ), 2 << ( NBITS_CONTEXT + NBITS_RATEQ ) ); - - /* check while condition */ - } - - pki = lookup[lev1]; - - symbol = a1 + A_THRES * b1; - bit_estimate = bit_estimate + ari_bit_estimate_s17_LC[pki][symbol]; - - /* Should we truncate? */ - if ( bit_estimate > target ) - { - stop2 = 1; - - if ( *stop ) - { - break; - } - } - else - { - lastnz2 = b1_i + 1; - nbits2 = bit_estimate; - } - - /* Update context for next 2-tuple */ - if ( p1 == p2 ) /* peak-peak or hole-hole context */ - { - lev1 >>= NBITS_CONTEXT + NBITS_RATEQ; - - if ( lev1 <= 0 ) - { - t = 1 + ( a1 + b1 ) * ( lev1 + 2 ); - } - else - { - t = 13 + lev1; - } - - *ctx = ( *ctx & 0xf ) * 16 + t; - } - else - { - /* mixed context */ - - if ( idx1 & 1 ) - { - /* update first context */ - c[p1] = update_mixed_context( c[p1], (int16_t) abs( x[a1_i] ) ); - } - - if ( idx2 & 1 ) - { - /* update second context */ - c[p2] = update_mixed_context( c[p2], (int16_t) abs( x[b1_i] ) ); - } - } - - } /*end of the 2-tuples loop*/ - - total_output_bits = (int16_t) ( bit_estimate + 0.5f ); - if ( *stop ) - { - total_output_bits = (int16_t) ( nbits2 + 0.5f ); - } - - if ( stop2 ) - { - stop2 = total_output_bits; - } - *nEncoded = lastnz2; - *stop = stop2; /* If zero, it means no overflow occured during bit-estimation */ - *lastnz_out = lastnz; - - /* Restore hole indices beyond lastnz */ - for ( k = numHoleIndices; k < hm_cfg->numHoleIndices; ++k ) - { - hm_cfg->holeIndices[k] = hm_cfg->holeIndices[k] - nt; - } - hm_cfg->numPeakIndices = numPeakIndicesOrig; - - return (int16_t) ( nbits2 + 0.5f ); - } - else /* if (!hm_cfg) */ - { - int16_t esc_nb, cp, rateQ; - uint16_t s; - int16_t tot_bits2; - int16_t overflow_flag = 0; - - /* Rate flag */ - if ( target > 400 ) - { - rateFlag = 2; - } - else - { - rateFlag = 0; /* Select context-B for lower bitrates */ - } - - t = 0; - s = 0; - cp = 0; - lastnz = 1; - lastnz2 = 0; - tot_bits2 = 0; - - /* Find last non-zero tuple in the mapped domain signal */ - for ( lastnz = ( nt - 2 ); lastnz >= 0; lastnz -= 2 ) - { - if ( ( x[lastnz] != 0 ) || ( x[lastnz + 1] != 0 ) ) - { - break; - } - } - lastnz += 2; - if ( lastnz < 2 ) - { - lastnz = 2; /* At least one tuple is coded */ - } - - lastnz2 = 2; - - /* Main Loop through the 2-tuples */ - for ( k = 0; k < lastnz; k += 2 ) - { - /* Init current 2-tuple encoding */ - a1 = (int16_t) abs( x[k] ); - b1 = (int16_t) abs( x[k + 1] ); - lev1 = 0; - esc_nb = 0; - rateQ = rateFlag + ( k > ( nt >> 1 ) ); - - /* Signs Bits */ - bit_estimate += min( a1, 1 ); - bit_estimate += min( b1, 1 ); - - /* pre-compute address of ari_pk_s17_LC_ext[0][Val_esc] to avoid doing it multiple times inside the loop */ - lookup = &ari_lookup_s17_LC[t + ( rateQ << NBITS_CONTEXT )]; - - /* check while condition */ - /* MSBs coding */ - while ( max( a1, b1 ) >= A_THRES ) - { - pki = lookup[( esc_nb << ( NBITS_CONTEXT + NBITS_RATEQ ) )]; - - bit_estimate = bit_estimate + ari_bit_estimate_s17_LC[pki][VAL_ESC]; - bit_estimate += 2; /* Add 2 LSB bits corresponding to the bit-plane */ - - ( a1 ) >>= 1; - ( b1 ) >>= 1; - - lev1++; - esc_nb = min( lev1, 3 ); - - /* check while condition */ - } - - pki = lookup[( esc_nb << ( NBITS_CONTEXT + NBITS_RATEQ ) )]; - - symbol = a1 + A_THRES * b1; - bit_estimate = bit_estimate + ari_bit_estimate_s17_LC[pki][symbol]; - - /* Should we truncate? */ - if ( bit_estimate > target ) /* Overflow occured */ - { - overflow_flag = 1; - } - else - { - if ( abs( x[k] ) || abs( x[k + 1] ) ) /* No overflow & non-zero tuple */ - { - nbits2 = bit_estimate; - lastnz2 = k + 2; - } - } - - /* Update context for next 2-tuple */ - if ( esc_nb < 2 ) - { - cp = 1 + ( a1 + b1 ) * ( esc_nb + 1 ); - } - else - { - cp = 12 + esc_nb; - } - /*shift old bits and replace last 4 bits*/ - s = ( s << 4 ) + cp; - t = s & 0xFF; - - } /*end of the 2-tuples loop*/ - - tot_bits2 = (int16_t) ( nbits2 + 0.5f ); - if ( lastnz2 < lastnz ) /* Overflow occured because unable to code all tuples */ - { - overflow_flag = 1; - } - if ( mode == -1 ) - { - tot_bits2 = (int16_t) ( bit_estimate + 0.5f ); - } - if ( overflow_flag == 0 ) /* No overflow */ - { - *stop = 0; - } - else /* Overflow */ - { - if ( *stop ) - { - *stop = tot_bits2; - } - else - { - *stop = (int16_t) ( bit_estimate + 0.5f ); - } - } - - *lastnz_out = lastnz; - *nEncoded = lastnz2; - /* Safety mechanism to avoid overflow */ - if ( lastnz2 == 2 && overflow_flag == 1 ) - { - for ( k = 0; k < lastnz2; k++ ) - { - x[k] = 0; - } - } - - return tot_bits2; - } -} - -/*-------------------------------------------------------------------* - * RCcontextMapping_encode2_estimate_bandWise_start() - * - * Range coder - start bandwise bit-estimation - *-------------------------------------------------------------------*/ - -int16_t RCcontextMapping_encode2_estimate_bandWise_start( - int16_t *x, - const int16_t nt, - const int16_t target, - HANDLE_RC_CONTEXT_MEM hContextMem ) -{ - int16_t i, k; - - /* Rate flag */ - if ( target > 400 ) - { - hContextMem->rateFlag = 2 << NBITS_CONTEXT; - } - else - { - hContextMem->rateFlag = 0; - } - - hContextMem->bit_estimate = 2.0f; - - /* Init */ - hContextMem->nt_half = nt >> 1; - - /* bits to encode lastnz */ - k = 1; - - while ( k < hContextMem->nt_half ) - { - hContextMem->bit_estimate++; - - k = k << 1; - /* check while condition */ - } - - /* bits to encode lastnz */ - hContextMem->nbits_old = (int16_t) hContextMem->bit_estimate; - - hContextMem->ctx = 0; - hContextMem->lastnz = 2; - - /* Find last non-zero tuple */ - - for ( i = nt; i >= 4; i -= 2 ) - { - - if ( x[i - 2] != 0 || x[i - 1] != 0 ) - { - hContextMem->lastnz = i; - break; - } - } - - return (int16_t) hContextMem->bit_estimate; -} - -/*-------------------------------------------------------------------* - * RCcontextMapping_encode2_estimate_bandWise() - * - * Range coder - bandwise bit-estimation - *-------------------------------------------------------------------*/ - -int16_t RCcontextMapping_encode2_estimate_bandWise( - int16_t *x, - const int16_t start_line, - const int16_t end_line, - HANDLE_RC_CONTEXT_MEM hContextMem ) -{ - int16_t a1, b1, a1_i, b1_i; - int16_t k, pki, lev1; - uint16_t t; - int16_t bandBits = 0; - int16_t total_output_bits; /* No. of bits after finalization */ - int16_t symbol; - const uint8_t *lookup; - int16_t idx; - - /* Main Loop through the 2-tuples */ - /*hContextMem->nt_half = end_line >> 1;*/ - for ( k = start_line; k < min( hContextMem->lastnz, end_line ); k += 2 ) - { - a1_i = k; - b1_i = k + 1; - - idx = k; - - /* Get context */ - t = hContextMem->ctx + hContextMem->rateFlag; - t += ( hContextMem->nt_half >= idx ) ? 0 : ( 1 << NBITS_CONTEXT ); - - /* Init current 2-tuple encoding */ - a1 = (int16_t) abs( x[a1_i] ); - b1 = (int16_t) abs( x[b1_i] ); - lev1 = -( 1 << ( NBITS_CONTEXT + NBITS_RATEQ ) ); - - /* Signs Bits */ - hContextMem->bit_estimate += min( a1, 1 ); - hContextMem->bit_estimate += min( b1, 1 ); - - /* pre-compute address of ari_pk_s17_LC_ext[0][Val_esc] to avoid doing it multiple times inside the loop */ - lookup = &ari_lookup_s17_LC[t] + ( 1 << ( NBITS_CONTEXT + NBITS_RATEQ ) ); - - /* check while condition */ - /* MSBs coding */ - while ( max( a1, b1 ) >= A_THRES ) - { - pki = lookup[lev1]; - hContextMem->bit_estimate = hContextMem->bit_estimate + ari_bit_estimate_s17_LC[pki][VAL_ESC]; - hContextMem->bit_estimate += 2; /* Add the 2 LSB bits that were shifted out */ - - ( a1 ) >>= 1; - ( b1 ) >>= 1; - - lev1 = min( lev1 + ( 1 << ( NBITS_CONTEXT + NBITS_RATEQ ) ), 2 << ( NBITS_CONTEXT + NBITS_RATEQ ) ); - /* check while condition */ - } - - pki = lookup[lev1]; - symbol = a1 + A_THRES * b1; /* MSB symbol */ - hContextMem->bit_estimate = hContextMem->bit_estimate + ari_bit_estimate_s17_LC[pki][symbol]; - - /* Update context */ - lev1 >>= NBITS_CONTEXT + NBITS_RATEQ; - - if ( lev1 <= 0 ) - { - t = 1 + ( a1 + b1 ) * ( lev1 + 2 ); - } - else - { - t = 13 + lev1; - } - - hContextMem->ctx = ( hContextMem->ctx & 0xf ) * 16 + t; - - } /*end of the 2-tuples loop*/ - total_output_bits = (int16_t) ( hContextMem->bit_estimate + 0.5f ); - - bandBits = total_output_bits - hContextMem->nbits_old; - hContextMem->nbits_old = total_output_bits; - - return bandBits; -} - -#endif diff --git a/lib_enc/gs_enc_fx.c b/lib_enc/gs_enc_fx.c index 77470c25546c948f20e5b3acb3de766be38742b8..7bf52970d7ff5f02edcaa6417a2b8b3d89cdf2c4 100644 --- a/lib_enc/gs_enc_fx.c +++ b/lib_enc/gs_enc_fx.c @@ -78,13 +78,7 @@ void encod_audio_fx( * Encode GSC attack flag (used to reduce possible pre-echo) * Encode GSC SWB speech flag *---------------------------------------------------------------*/ -#ifdef GSC_IVAS // TVB -->>>>>> - test(); - IF( ( st_fx->element_mode > EVS_MONO ) && st_fx->idchan == 0 ) - { - push_indice( hBstr, IND_GSC_IVAS_SP, st_fx->GSC_IVAS_mode, 2 ); - } -#endif + IF( attack_flag > 0 ) { push_indice( hBstr, IND_GSC_ATTACK, 1, 1 ); diff --git a/lib_enc/ivas_core_pre_proc_front_fx.c b/lib_enc/ivas_core_pre_proc_front_fx.c index d358f70991956fd0ceaa234c1ee9c89c662eb898..76640e7a7d61274ba3fd0c311fb97a09579ae337 100644 --- a/lib_enc/ivas_core_pre_proc_front_fx.c +++ b/lib_enc/ivas_core_pre_proc_front_fx.c @@ -58,10 +58,6 @@ static void calculate_energy_buffer_ivas_fx( CPE_ENC_HANDLE hCPE, Word32 enerBuffer_dft[], const Word16 no_channels, const Word32 input_Fs, Word16 enerBuffer_dft_e[] ); -#ifdef IVAS_FIXED_ENC -static void calculate_energy_buffer_fx( CPE_ENC_HANDLE hCPE, Word64 enerBuffer_dft_fx[], Word16 *enerBuffer_dft_q_fx, const Word16 no_channels, const Word32 input_Fs ); -#endif - /*-------------------------------------------------------------------* * pre_proc_front_ivas() * @@ -1684,69 +1680,6 @@ ivas_error pre_proc_front_ivas_fx( return error; } -#ifdef IVAS_FIXED_ENC -/*-------------------------------------------------------------------* - * calculate_energy_buffer_fx() - * - * calculate DFT-based energies - *--------------------------------------------------------------------*/ - -static void calculate_energy_buffer_fx( - CPE_ENC_HANDLE hCPE, /* i : CPE encoder structure */ - Word64 enerBuffer_dft_fx[], /* o : energy buffer */ - Word16 *enerBuffer_dft_q_fx, - const Word16 no_channels, /* i : no. of used CLDFB channels */ - const Word32 input_Fs /* i : input sampling rate */ -) -{ - Word16 i, j; - Word64 nrg_DMX_fx[CLDFB_NO_CHANNELS_MAX]; - Word64 *p_nrg_DMX_fx; - Word32 *pDFT_DMX_fx; - Word16 *pDFT_DMX_q_fx; - Word32 chan_width_bins_fx; - Word16 band_res_dft_fx, chan_width_f_fx, start, stop; - - Word16 temp_q1 = norm_l( input_Fs ) - 1; - Word16 temp_q2 = norm_s( hCPE->hStereoDft->NFFT ); - - band_res_dft_fx = div_l( L_shl( input_Fs, temp_q1 ), shl( hCPE->hStereoDft->NFFT, temp_q2 ) ); - chan_width_f_fx = 24000 / CLDFB_NO_CHANNELS_MAX; - chan_width_bins_fx = L_shl( (Word32) div_s( chan_width_f_fx, band_res_dft_fx ), ( sub( add( temp_q1, 1 ), temp_q2 ) ) ); // Q16 - - pDFT_DMX_fx = hCPE->hStereoDft->DFT_fx[0]; - pDFT_DMX_q_fx = hCPE->hStereoDft->DFT_q_fx; - start = 1; - p_nrg_DMX_fx = nrg_DMX_fx; - - *p_nrg_DMX_fx = Mpy_32_32( pDFT_DMX_fx[0], pDFT_DMX_fx[0] ); - - FOR( i = 0; i < no_channels; i++ ) - { - stop = (Word16) ( L_add( Mpy_32_16_1( chan_width_bins_fx, add( i, 1 ) ), 1 ) >> 1 ); - FOR( j = start; j < stop; j++ ) - { - *p_nrg_DMX_fx = W_add( *p_nrg_DMX_fx, Mpy_32_32( pDFT_DMX_fx[2 * j], pDFT_DMX_fx[2 * j] ) ); - *p_nrg_DMX_fx = W_add( *p_nrg_DMX_fx, Mpy_32_32( pDFT_DMX_fx[2 * j + 1], pDFT_DMX_fx[2 * j + 1] ) ); - } - enerBuffer_dft_q_fx[i] = 2 * pDFT_DMX_q_fx[i] - 31; - start = stop; - p_nrg_DMX_fx++; - } - - FOR( i = 0; i < no_channels; i++ ) /* Consider only used channels, dependent on Fs */ - { - enerBuffer_dft_fx[i] = nrg_DMX_fx[i] / 3; - } - - /* Set remaining entries of enerBuffer to zero */ - FOR( ; i < CLDFB_NO_CHANNELS_MAX; i++ ) - { - enerBuffer_dft_fx[i] = 0; - } - return; -} -#endif /*-------------------------------------------------------------------* * calculate_energy_buffer() * diff --git a/lib_enc/lsf_msvq_ma_enc_fx.c b/lib_enc/lsf_msvq_ma_enc_fx.c index 8f6a21d038271fa7643120e170965978c88fbeec..593efa7843675add6bd500da13c2265efb8c1414 100644 --- a/lib_enc/lsf_msvq_ma_enc_fx.c +++ b/lib_enc/lsf_msvq_ma_enc_fx.c @@ -570,9 +570,6 @@ Word16 Q_lsf_tcxlpc_fx( lpcorder, lpcorder, indices + NumIndices, -#ifdef IVAS_MSVQ - 0, NULL, -#endif lsf_q ); NumIndices = add( NumIndices, TCXLPC_NUMSTAGES ); @@ -617,9 +614,6 @@ Word16 Q_lsf_tcxlpc_fx( lpcorder, lpcorder, indices + NumIndices, -#ifdef IVAS_MSVQ - 0, NULL, -#endif lsf_rem_q_ind ); NumIndices = add( NumIndices, TCXLPC_IND_NUMSTAGES ); @@ -724,9 +718,6 @@ Word16 Q_lsf_tcxlpc_ivas_fx( lpcorder, lpcorder, indices + NumIndices, -#ifdef IVAS_MSVQ - 0, NULL, -#endif lsf_q ); NumIndices = add( NumIndices, TCXLPC_NUMSTAGES ); @@ -772,9 +763,6 @@ Word16 Q_lsf_tcxlpc_ivas_fx( lpcorder, lpcorder, indices + NumIndices, -#ifdef IVAS_MSVQ - 0, NULL, -#endif lsf_rem_q_ind ); NumIndices = add( NumIndices, TCXLPC_IND_NUMSTAGES );