Loading apps/decoder.c +0 −2 Original line number Diff line number Diff line Loading @@ -911,9 +911,7 @@ static bool parseCmdlIVAS_dec( arg->inputFormat = IVAS_DEC_INPUT_FORMAT_G192; arg->non_diegetic_pan_enabled = false; arg->non_diegetic_pan_gain = 0.f; #ifdef FIX_2318_CLANG_DECODER arg->non_diegetic_pan_gain_fx = 0; #endif arg->tsmEnabled = false; arg->render_num_subframes = IVAS_RENDER_NUM_SUBFR_20MS; arg->aeSequence.count = 0; Loading lib_com/cng_exc_fx.c +0 −283 Original line number Diff line number Diff line Loading @@ -602,112 +602,6 @@ return; *-------------------------------------------------------*/ void cng_params_postupd_fx( #ifndef HARM_NON_LINEARITY const Word16 ho_circ_ptr, /* i : pointer for CNG averaging buffers Q0 */ Word16 *cng_buf_cnt, /* i/o: counter for CNG store buffers Q0 */ const Word16 *const cng_exc2_buf, /* i : Excitation buffer Q_exc */ 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 */ ) { Word16 i, j; Word16 Q_exc; const Word16 *exc2; Word16 fft_io[L_FFT]; Word32 sp[129]; Word16 *ptR, *ptI; Word32 env[NUM_ENV_CNG]; Word32 L_tmp; Word16 tmp; Word16 temp_lo_fx, temp_hi_fx; Word16 exp_pow; Word16 exp1; Word16 CNG_mode; Word16 ptr; Word32 last_active_brate; ptr = add( sub( ho_circ_ptr, *cng_buf_cnt ), 1 ); IF( ptr < 0 ) { ptr = add( ptr, HO_HIST_SIZE ); } FOR( j = 0; j < *cng_buf_cnt; j++ ) { exc2 = &cng_exc2_buf[ptr * L_FFT]; Q_exc = cng_Qexc_buf[ptr]; move16(); last_active_brate = cng_brate_buf[ptr]; move32(); /* calculate the spectrum of residual signal */ Copy( exc2, fft_io, L_FFT ); fft_rel_fx( fft_io, L_FFT, LOG2_L_FFT ); ptR = &fft_io[1]; ptI = &fft_io[L_FFT - 1]; FOR( i = 0; i < NUM_ENV_CNG; i++ ) { /* sp[i] = 2.0f*(*ptR * *ptR + *ptI * *ptI)/L_FFT; */ L_tmp = L_mult_sat( *ptR, *ptR ); /* 2*Q_exc+1 */ L_tmp = L_add_sat( L_tmp, L_mult_sat( *ptI, *ptI ) ); /* 2*Q_exc+1 */ L_tmp = L_add_sat( L_tmp, L_tmp ); /* 2*Q_exc+1 */ L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_exc+1 */ tmp = add( add( Q_exc, Q_exc ), 1 ); sp[i] = L_shr( L_tmp, sub( tmp, 6 ) ); move32(); /* Q6 */ ptR++; ptI--; } Copy32( sp, env, NUM_ENV_CNG ); { CNG_mode = get_cng_mode( last_active_brate ); /* att = 1/pow(2,ENR_ATT_fx[CNG_mode]); */ L_tmp = L_shl( L_deposit_l( ENR_ATT_fx[CNG_mode] ), 8 ); /* 16 */ temp_lo_fx = L_Extract_lc( L_tmp, &temp_hi_fx ); exp_pow = sub( 14, temp_hi_fx ); L_tmp = Pow2( 14, temp_lo_fx ); /* Qexp_pow */ L_tmp = L_shl( L_tmp, sub( 13, exp_pow ) ); /* Q13 */ tmp = extract_l( L_tmp ); /* Q13 */ exp1 = norm_s( tmp ); tmp = shl( tmp, exp1 ); /*Q(exp1+13) */ tmp = div_s( 16384, tmp ); /*Q(15+14-exp1-13) */ tmp = shr( tmp, sub( 1, exp1 ) ); /* Q15 */ } FOR( i = 0; i < NUM_ENV_CNG; i++ ) { env[i] = Mult_32_16( env[i], tmp ); move32(); } /* update the circular buffer of old residual envelope */ Copy32( env, &( ho_env_circ[(ptr) *NUM_ENV_CNG] ), NUM_ENV_CNG ); ptr = add( ptr, 1 ); if ( EQ_16( ptr, HO_HIST_SIZE ) ) { ptr = 0; move16(); } } *cng_buf_cnt = 0; move16(); return; } void cng_params_postupd_ivas_fx( #endif const Word16 ho_circ_ptr, /* i : pointer for CNG averaging buffers Q0 */ Word16 *cng_buf_cnt, /* i/o: counter for CNG store buffers Q0 */ const Word16 *const cng_exc2_buf, /* i : Excitation buffer Q_exc */ Loading Loading @@ -833,183 +727,8 @@ void cng_params_postupd_ivas_fx( * * update CNG parameters *-------------------------------------------------------*/ #ifndef HARM_NON_LINEARITY void cng_params_upd_fx( const Word16 lsp_new[], /* i : LSP aprameters Q15 */ const Word16 exc2[], /* i : current enhanced excitation Q_exc */ const Word16 L_frame, /* i : frame length Q0 */ Word16 *ho_circ_ptr, /* i/o: pointer for CNG averaging buffers Q0 */ Word32 ho_ener_circ[], /* o : energy buffer for CNG averaging Q6 */ Word16 *ho_circ_size, /* i/o: size of DTX hangover history buffer for averaging Q0 */ Word16 ho_lsp_circ[], /* o : old LSP buffer for CNG averaging Q15 */ const Word16 Q_exc, /* i : Q value of excitation */ const Word16 enc_dec_flag, /* i : Flag indicating encoder or decoder (ENC,DEC) */ Word32 ho_env_circ[], /* i/o: Envelope buffer Q6 */ Word16 *cng_buf_cnt, /* i/o: Counter of postponed FFT-processing instances */ Word16 cng_exc2_buf[], /* i/o: Excitation buffer Q_exc */ 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 */ ) { Word32 L_ener, L_tmp; Word16 i, j; const Word16 *pt_exc2; Word16 tmpv, maxv, scale; Word16 fft_io[L_FRAME16k]; Word32 sp[129]; Word16 *ptR, *ptI; Word32 env[NUM_ENV_CNG]; Word16 exp1; Word16 CNG_mode; Word16 tmp; Word16 temp_lo_fx, temp_hi_fx; Word16 exp_pow; /* update the pointer to circular buffer of old LSP vectors */ *ho_circ_ptr = add( *ho_circ_ptr, 1 ); move16(); if ( EQ_16( *ho_circ_ptr, HO_HIST_SIZE ) ) { *ho_circ_ptr = 0; move16(); } /* update the circular buffer of old LSP vectors with the new LSP vector */ Copy( lsp_new, &( ho_lsp_circ[( *ho_circ_ptr ) * M] ), M ); /* calculate the residual signal energy */ /*enr = dotp( exc2, exc2, L_frame ) / L_frame; */ maxv = 0; move16(); FOR( i = 0; i < L_frame; i++ ) { maxv = s_max( maxv, abs_s( exc2[i] ) ); } scale = norm_s( maxv ); pt_exc2 = exc2; L_ener = 0; move32(); IF( EQ_16( L_frame, L_FRAME ) ) { FOR( j = 0; j < 128; j++ ) { tmpv = shl( *pt_exc2, scale ); L_tmp = L_mult0( tmpv, tmpv ); /* 2*(Q_exc+scale) */ pt_exc2++; tmpv = shl( *pt_exc2, scale ); L_tmp = L_mac0_sat( L_tmp, tmpv, tmpv ); pt_exc2++; L_ener = L_add_sat( L_ener, L_shr_sat( L_tmp, 7 ) ); /* Q(2*(Q_exc+scale)+1) ,division by L_frame done here */ } } ELSE /* L_FRAME16k */ { FOR( j = 0; j < 160; j++ ) { tmpv = shl( *pt_exc2, scale ); L_tmp = L_mult0( tmpv, tmpv ); /* 2*(Q_exc+scale) */ pt_exc2++; tmpv = shl( *pt_exc2, scale ); L_tmp = L_mac0_sat( L_tmp, tmpv, tmpv ); pt_exc2++; L_ener = L_add_sat( L_ener, L_shr_sat( Mult_32_16( L_tmp, 26214 /* 256/320, Q15 */ ), 7 ) ); /* Q(2*(Q_exc+scale)+15+1-16+1) ,division by L_frame done here */ } } L_ener = L_shr_sat( L_ener, sub( shl( add( Q_exc, scale ), 1 ), 5 ) ); /* Q6 (2*(Q_exc+scale)+1-2*(Q_exc+scale)+5) */ /* update the circular buffer of old energies */ ho_ener_circ[*ho_circ_ptr] = L_ener; move32(); IF( enc_dec_flag == ENC ) { /* Store residual signal for postponed FFT-processing*/ *cng_buf_cnt = add( *cng_buf_cnt, 1 ); move16(); if ( GT_16( *cng_buf_cnt, HO_HIST_SIZE ) ) { *cng_buf_cnt = HO_HIST_SIZE; move16(); } Copy( exc2, &( cng_exc2_buf[( *ho_circ_ptr ) * L_FFT] ), L_FFT ); cng_Qexc_buf[*ho_circ_ptr] = Q_exc; move16(); cng_brate_buf[*ho_circ_ptr] = last_active_brate; move32(); } ELSE { /* calculate the spectrum of residual signal */ Copy( exc2, fft_io, L_frame ); fft_rel_fx( fft_io, L_FFT, LOG2_L_FFT ); ptR = &fft_io[1]; ptI = &fft_io[L_FFT - 1]; FOR( i = 0; i < NUM_ENV_CNG; i++ ) { /* sp[i] = 2.0f*(*ptR * *ptR + *ptI * *ptI)/L_FFT; */ L_tmp = L_mult_sat( *ptR, *ptR ); /* 2*Q_exc+1 */ L_tmp = L_add_sat( L_tmp, L_mult_sat( *ptI, *ptI ) ); /* 2*Q_exc+1 */ L_tmp = L_add_sat( L_tmp, L_tmp ); /* 2*Q_exc+1 */ L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_exc+1 */ tmp = add( add( Q_exc, Q_exc ), 1 ); sp[i] = L_shr( L_tmp, sub( tmp, 6 ) ); move32(); /* Q6 */ ptR++; ptI--; } Copy32( sp, env, NUM_ENV_CNG ); { CNG_mode = get_cng_mode( last_active_brate ); /* att = 1/pow(2,ENR_ATT_fx[CNG_mode]); */ L_tmp = L_shl( L_deposit_l( ENR_ATT_fx[CNG_mode] ), 8 ); /* 16 */ temp_lo_fx = L_Extract_lc( L_tmp, &temp_hi_fx ); exp_pow = sub( 14, temp_hi_fx ); L_tmp = Pow2( 14, temp_lo_fx ); /* Qexp_pow */ L_tmp = L_shl( L_tmp, sub( 13, exp_pow ) ); /* Q13 */ tmp = extract_l( L_tmp ); /* Q13 */ exp1 = norm_s( tmp ); tmp = shl( tmp, exp1 ); /*Q(exp1+13) */ tmp = div_s( 16384, tmp ); /*Q(15+14-exp1-13) */ tmp = shr( tmp, sub( 1, exp1 ) ); /* Q15 */ } FOR( i = 0; i < NUM_ENV_CNG; i++ ) { env[i] = Mult_32_16( env[i], tmp ); move32(); } /* update the circular buffer of old residual envelope */ /* Copy32( env, &(ho_env_circ[add(shl(*ho_circ_ptr,4),shl(*ho_circ_ptr,2))]), NUM_ENV_CNG ); */ Copy32( env, &( ho_env_circ[( *ho_circ_ptr ) * NUM_ENV_CNG] ), NUM_ENV_CNG ); } *ho_circ_size = add( *ho_circ_size, 1 ); move16(); if ( GT_16( *ho_circ_size, HO_HIST_SIZE ) ) { *ho_circ_size = HO_HIST_SIZE; move16(); } return; } #endif #ifdef HARM_NON_LINEARITY void cng_params_upd_fx( #else void cng_params_upd_ivas_fx( #endif const Word16 lsp_new[], /* i : LSP aprameters Q15 */ const Word16 exc2[], /* i : current enhanced excitation Q_exc */ const Word16 L_frame, /* i : frame length Q0 */ Loading Loading @@ -1187,9 +906,7 @@ void cng_params_upd_ivas_fx( /* update the circular buffer of old residual envelope */ /* Copy32( env, &(ho_env_circ[add(shl(*ho_circ_ptr,4),shl(*ho_circ_ptr,2))]), NUM_ENV_CNG ); */ Copy32( env, &( ho_env_circ[( *ho_circ_ptr ) * NUM_ENV_CNG] ), NUM_ENV_CNG ); #ifdef HARM_NON_LINEARITY IF( NE_16( element_mode, EVS_MONO ) ) #endif { scale_sig32( &( ho_env_circ[( *ho_circ_ptr ) * NUM_ENV_CNG] ), NUM_ENV_CNG, shift ); // Q(6+shift) } Loading lib_com/ivas_prot_fx.h +0 −12 Original line number Diff line number Diff line Loading @@ -5827,11 +5827,7 @@ ivas_error ivas_mct_enc_fx( const Word16 nb_bits_metadata /* i : number of metadata bits */ ); #ifdef FIX_2344_ALIGN_PREPROC void ivas_compute_core_buffers_fx( #else ivas_error ivas_compute_core_buffers_fx( #endif Encoder_State *st, /* i/o: encoder state structure */ Word16 **inp16k_out_fx, /* o : ptr. to inp. signal in the current frame */ Word16 *old_inp_16k_fx, /* i/o: buffer of old input signal @ 16kHz */ Loading Loading @@ -5936,11 +5932,7 @@ void ivas_mct_enc_close_fx( MCT_ENC_HANDLE *hMCT /* i/o: MCT encoder structure */ ); #ifdef FIX_2344_ALIGN_PREPROC void pre_proc_front_ivas_fx( #else ivas_error pre_proc_front_ivas_fx( #endif SCE_ENC_HANDLE hSCE, /* i/o: SCE encoder structure */ CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ const Word32 element_brate, /* i : SCE/CPE element bitrate Q0*/ Loading Loading @@ -5996,11 +5988,7 @@ ivas_error pre_proc_front_ivas_fx( Word16 *Q_new /* i/o : Q factor of speech buffers */ ); #ifdef FIX_2344_ALIGN_PREPROC void pre_proc_ivas_fx( #else ivas_error pre_proc_ivas_fx( #endif Encoder_State *st, /* i/o: encoder state structure */ const Word16 last_element_mode, /* i : last element mode Q0*/ const Word32 element_brate, /* i : element bitrate Q0*/ Loading lib_com/options.h +0 −24 Original line number Diff line number Diff line Loading @@ -87,28 +87,8 @@ #define FIX_2255_ISAR_RENDER_POSES /* VA: issue 2255: fix missing check in isar_render_poses() */ #define FIX_1904_HARM_GSC_ENC /* VA: #1904 Harmonization of EVS and IVAS GSC code */ #define FIX_1478_UNINIT_ON_BFI /* VA: Fix issue 1478 where a vector is partly un-initialized during bfi */ #define FIX_2318_CLANG_DECODER /* VA: basop issue 2318: Initialize command-line parameter arg.non_diegetic_pan_gain_fx */ #define HARM_NON_LINEARITY /* VA: basop issue 2345: Remove duplicated code in core-coder: non_linearity_fx() and LP CNG */ #define FIX_2344_ALIGN_PREPROC /* VA: basop issue 2344: Align pre_proc_ivas() between FLP and BASOP */ #define FIX_2334_HARM_CODER_MODIF /* VA: basop issue 2334 : harmonizing coder_modif_function */ #define FIX_FLOAT_1501_UNIT_VALUE_IN_OMASA /* Nokia: Fix float issue 1501, uninitialized value in ivas_masa_combine_directions for OMASA */ #define FIX_BASOP_2323_DIRAC_ENC_WRONG_INIT /* Nokia/FhG: basop issue 2323: Use correct init size */ #define FIX_BASOP_2324_MISSING_SET_TO_ZERO /* Nokia: basop issue 2324: Fix issue by setting the exponent to zero where it should be */ #define FIX_BASOP_2326_WRONG_SIG_LENGTH /* Nokia: basop issue 2326: Fix issue by using correct signal length in multiple places */ #define FIX_BASOP_2327_WRONG_LOOP_END /* Nokia: basop inssue 2327: Correct loop end to solve MSAN error */ #define FIX_BASOP_2328_MSAN_WRONG_ASSIGNMENT /* Nokia: basop issue 2328: Fix MSAN error by correcting the variable assignment */ #define FIX_BASOP_2329_UNINIT_VALUE /* Nokia: basop issue 2329: Fix issue by checking for structure instead of length */ #define FIX_BASOP_2332_ASAN_OVERFLOW_IN_EXT_DIRAC_REND /* Nokia: basop issue 2332: Uses predefined memory sizes instead computing wrong */ #define FIX_BASOP_2333_MCMASA_ANA_MEMORY_LEAK /* Nokia: basop issue 2333: Add missing free for direction_vector_e to ivas_mcmasa_ana_fx.c */ #define HARM_COREDECODER_FUNCTIONS /* VA: basop issue 2347: Remove various duplicated code in core-decoder */ #define FIX_BASOP_2358_SCALING_OOB /* Eri: Basip issue 2358: Clang-18 reports OOB access where scaling is applied to L_FRAME48k instead of output_frame */ #define FIX_BASOP_2351_EXTREND_SCALE /* FhG: basop issue 2351: Only scale initialized samples in renderer, related to 2326 */ #define FIX_2331_CLANG18_MSAN_UNINIT_VARIABLE /* FhG: Fix issue 2331: Uninitialized variable */ #define FIX_2362_TOTAL_BRATE_CALCULATION /* FhG: basop issue 2362: fix calculation of st->total_brate in ivas_cpe_enc_fx() */ #define FIX_2330_CLANG_18_WARNINGS_REND /* FhG: Fix renderer warnings */ #define FIX_BASOP_2350_HARM_0B_BWE /* VA: basop issue 2350: harmonization of the 0b BWE */ #define FIX_BASOP_2350_HARM_0B_BWE_2 /* VA: basop issue 2350: Simplify calling of hf_synth_fx() */ #define FIX_2349_HARM_FIND_UV /* VA: basop issue 2349: harmonization of find_uv() function */ #define FIX_2364_HARM_MULT_HARM /* VA: basop issue 2364 : harmonizing multi_harm_fx function */ #define FIX_2363_FIND_WSP /* VA: basop issue 2363 : harmonizing find_wsp function */ #define FIX_2370_UNUSED_BUFFERS_CORE_ENC /* VA: basop issue 2370: remove temporary input buffers in core-encoder */ Loading @@ -129,10 +109,6 @@ /* any switch which is non-be wrt. TS 26.251 V3.0 */ #define FIX_2250_LARGE_DIFFERENCES_BETWEEN_BASOP_AND_FLOAT /* Dolby: Issue 2250: random vector generation in GenShapedSHBExcitation() */ #define FIX_2320_OOB_SCE_SWITCHING /* VA: basop issue 2320: Correct the length of the buffer to be scaled in SCE/CPE switching */ #define FIX_2302_LSF_CDBK_THRESHOLD /* VA: basop issue 2302: fix threshold for LSF Q codebook-type decision */ #define FIX_1500_ISM_MD_DTX /* VA: float issue 1500: fix ISM elevation metadata smoothing in DTX */ #define FIX_2348_REPLACE_FEC_ENC /* VA: basop issue 2348: replace FEC_encode_ivas_fx with FEC_encode_fx */ #define FIX_2338_HARM_GSC_GAIN_COMP /* VA: basop issue 2338: harmonization of band gain computation for both EVS and IVAS */ #define FIX_BASOP_2317_UNINIT_VALUE_IN_STEREO_CNG /* Eri: Basop issue 2317: Uninitialized value read in case of DTX and BW switching */ Loading lib_com/parameter_bitmaping_fx.c +0 −89 Original line number Diff line number Diff line Loading @@ -25,26 +25,6 @@ static Word16 PutIntoBitstream_fx( return value; } #ifndef HARM_COREDECODER_FUNCTIONS static Word16 PutIntoBitstream_ivas_fx( const Word16 **pStream, TEncodeValue EncodeValue, Word16 index, BSTR_ENC_HANDLE hBstr, const Word16 nBits ) { Word16 value; Word16 codedValue; move16(); value = *( *pStream )++; codedValue = EncodeValue( value, index ); push_next_indice( hBstr, codedValue, nBits ); return value; } #endif static Word16 FixedWidthEncoding( Word16 value, Word16 index ) { Loading Loading @@ -327,75 +307,6 @@ void WriteToBitstream_fx( return; } #ifndef HARM_COREDECODER_FUNCTIONS void WriteToBitstream_ivas_fx( ParamsBitMap const *paramsBitMap, const Word16 nArrayLength, const Word16 **pStream, Word16 *pnSize, BSTR_ENC_HANDLE hBstr, Word16 *pnBits ) { Word16 index; Word16 iParam, nParams; assert( ( paramsBitMap != NULL ) && ( nArrayLength > 0 ) && ( pStream != NULL ) && ( pnSize != NULL ) && ( hBstr != NULL ) && ( pnBits != NULL ) ); nParams = paramsBitMap->nParams; move16(); FOR( index = 0; index < nArrayLength; index++ ) { FOR( iParam = 0; iParam < nParams; iParam++ ) { ParamBitMap const *param; Word16 nBits; /* If a function for encoding/decoding value is defined than it should take care of 0 */ Word16 fShiftValue; TEncodeValue EncodeValue; Word16 value; move16(); param = ¶msBitMap->params[iParam]; move16(); nBits = param->nBits; IF( param->nBits == 0 ) { #define WMC_TOOL_SKIP nBits = param->GetNumberOfBits( **pStream, index ); #undef WMC_TOOL_SKIP } fShiftValue = s_and( param->fZeroAllowed == 0, param->EncodeValue == NULL ); EncodeValue = param->EncodeValue; if ( param->EncodeValue == NULL ) { move16(); EncodeValue = &FixedWidthEncoding; } value = PutIntoBitstream_ivas_fx( pStream, EncodeValue, index, hBstr, nBits ); IF( fShiftValue ) { value = add( value, 1 ); } move16(); *pnSize = add( *pnSize, 1 ); move16(); *pnBits = add( *pnBits, nBits ); test(); IF( ( param->pSubParamBitMap != NULL ) && ( value > 0 ) ) { WriteToBitstream_ivas_fx( param->pSubParamBitMap, value, pStream, pnSize, hBstr, pnBits ); } } } } #endif /** Get nBits long value from bitstream into *pStream. */ static Word16 GetFromBitstream( Loading Loading
apps/decoder.c +0 −2 Original line number Diff line number Diff line Loading @@ -911,9 +911,7 @@ static bool parseCmdlIVAS_dec( arg->inputFormat = IVAS_DEC_INPUT_FORMAT_G192; arg->non_diegetic_pan_enabled = false; arg->non_diegetic_pan_gain = 0.f; #ifdef FIX_2318_CLANG_DECODER arg->non_diegetic_pan_gain_fx = 0; #endif arg->tsmEnabled = false; arg->render_num_subframes = IVAS_RENDER_NUM_SUBFR_20MS; arg->aeSequence.count = 0; Loading
lib_com/cng_exc_fx.c +0 −283 Original line number Diff line number Diff line Loading @@ -602,112 +602,6 @@ return; *-------------------------------------------------------*/ void cng_params_postupd_fx( #ifndef HARM_NON_LINEARITY const Word16 ho_circ_ptr, /* i : pointer for CNG averaging buffers Q0 */ Word16 *cng_buf_cnt, /* i/o: counter for CNG store buffers Q0 */ const Word16 *const cng_exc2_buf, /* i : Excitation buffer Q_exc */ 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 */ ) { Word16 i, j; Word16 Q_exc; const Word16 *exc2; Word16 fft_io[L_FFT]; Word32 sp[129]; Word16 *ptR, *ptI; Word32 env[NUM_ENV_CNG]; Word32 L_tmp; Word16 tmp; Word16 temp_lo_fx, temp_hi_fx; Word16 exp_pow; Word16 exp1; Word16 CNG_mode; Word16 ptr; Word32 last_active_brate; ptr = add( sub( ho_circ_ptr, *cng_buf_cnt ), 1 ); IF( ptr < 0 ) { ptr = add( ptr, HO_HIST_SIZE ); } FOR( j = 0; j < *cng_buf_cnt; j++ ) { exc2 = &cng_exc2_buf[ptr * L_FFT]; Q_exc = cng_Qexc_buf[ptr]; move16(); last_active_brate = cng_brate_buf[ptr]; move32(); /* calculate the spectrum of residual signal */ Copy( exc2, fft_io, L_FFT ); fft_rel_fx( fft_io, L_FFT, LOG2_L_FFT ); ptR = &fft_io[1]; ptI = &fft_io[L_FFT - 1]; FOR( i = 0; i < NUM_ENV_CNG; i++ ) { /* sp[i] = 2.0f*(*ptR * *ptR + *ptI * *ptI)/L_FFT; */ L_tmp = L_mult_sat( *ptR, *ptR ); /* 2*Q_exc+1 */ L_tmp = L_add_sat( L_tmp, L_mult_sat( *ptI, *ptI ) ); /* 2*Q_exc+1 */ L_tmp = L_add_sat( L_tmp, L_tmp ); /* 2*Q_exc+1 */ L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_exc+1 */ tmp = add( add( Q_exc, Q_exc ), 1 ); sp[i] = L_shr( L_tmp, sub( tmp, 6 ) ); move32(); /* Q6 */ ptR++; ptI--; } Copy32( sp, env, NUM_ENV_CNG ); { CNG_mode = get_cng_mode( last_active_brate ); /* att = 1/pow(2,ENR_ATT_fx[CNG_mode]); */ L_tmp = L_shl( L_deposit_l( ENR_ATT_fx[CNG_mode] ), 8 ); /* 16 */ temp_lo_fx = L_Extract_lc( L_tmp, &temp_hi_fx ); exp_pow = sub( 14, temp_hi_fx ); L_tmp = Pow2( 14, temp_lo_fx ); /* Qexp_pow */ L_tmp = L_shl( L_tmp, sub( 13, exp_pow ) ); /* Q13 */ tmp = extract_l( L_tmp ); /* Q13 */ exp1 = norm_s( tmp ); tmp = shl( tmp, exp1 ); /*Q(exp1+13) */ tmp = div_s( 16384, tmp ); /*Q(15+14-exp1-13) */ tmp = shr( tmp, sub( 1, exp1 ) ); /* Q15 */ } FOR( i = 0; i < NUM_ENV_CNG; i++ ) { env[i] = Mult_32_16( env[i], tmp ); move32(); } /* update the circular buffer of old residual envelope */ Copy32( env, &( ho_env_circ[(ptr) *NUM_ENV_CNG] ), NUM_ENV_CNG ); ptr = add( ptr, 1 ); if ( EQ_16( ptr, HO_HIST_SIZE ) ) { ptr = 0; move16(); } } *cng_buf_cnt = 0; move16(); return; } void cng_params_postupd_ivas_fx( #endif const Word16 ho_circ_ptr, /* i : pointer for CNG averaging buffers Q0 */ Word16 *cng_buf_cnt, /* i/o: counter for CNG store buffers Q0 */ const Word16 *const cng_exc2_buf, /* i : Excitation buffer Q_exc */ Loading Loading @@ -833,183 +727,8 @@ void cng_params_postupd_ivas_fx( * * update CNG parameters *-------------------------------------------------------*/ #ifndef HARM_NON_LINEARITY void cng_params_upd_fx( const Word16 lsp_new[], /* i : LSP aprameters Q15 */ const Word16 exc2[], /* i : current enhanced excitation Q_exc */ const Word16 L_frame, /* i : frame length Q0 */ Word16 *ho_circ_ptr, /* i/o: pointer for CNG averaging buffers Q0 */ Word32 ho_ener_circ[], /* o : energy buffer for CNG averaging Q6 */ Word16 *ho_circ_size, /* i/o: size of DTX hangover history buffer for averaging Q0 */ Word16 ho_lsp_circ[], /* o : old LSP buffer for CNG averaging Q15 */ const Word16 Q_exc, /* i : Q value of excitation */ const Word16 enc_dec_flag, /* i : Flag indicating encoder or decoder (ENC,DEC) */ Word32 ho_env_circ[], /* i/o: Envelope buffer Q6 */ Word16 *cng_buf_cnt, /* i/o: Counter of postponed FFT-processing instances */ Word16 cng_exc2_buf[], /* i/o: Excitation buffer Q_exc */ 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 */ ) { Word32 L_ener, L_tmp; Word16 i, j; const Word16 *pt_exc2; Word16 tmpv, maxv, scale; Word16 fft_io[L_FRAME16k]; Word32 sp[129]; Word16 *ptR, *ptI; Word32 env[NUM_ENV_CNG]; Word16 exp1; Word16 CNG_mode; Word16 tmp; Word16 temp_lo_fx, temp_hi_fx; Word16 exp_pow; /* update the pointer to circular buffer of old LSP vectors */ *ho_circ_ptr = add( *ho_circ_ptr, 1 ); move16(); if ( EQ_16( *ho_circ_ptr, HO_HIST_SIZE ) ) { *ho_circ_ptr = 0; move16(); } /* update the circular buffer of old LSP vectors with the new LSP vector */ Copy( lsp_new, &( ho_lsp_circ[( *ho_circ_ptr ) * M] ), M ); /* calculate the residual signal energy */ /*enr = dotp( exc2, exc2, L_frame ) / L_frame; */ maxv = 0; move16(); FOR( i = 0; i < L_frame; i++ ) { maxv = s_max( maxv, abs_s( exc2[i] ) ); } scale = norm_s( maxv ); pt_exc2 = exc2; L_ener = 0; move32(); IF( EQ_16( L_frame, L_FRAME ) ) { FOR( j = 0; j < 128; j++ ) { tmpv = shl( *pt_exc2, scale ); L_tmp = L_mult0( tmpv, tmpv ); /* 2*(Q_exc+scale) */ pt_exc2++; tmpv = shl( *pt_exc2, scale ); L_tmp = L_mac0_sat( L_tmp, tmpv, tmpv ); pt_exc2++; L_ener = L_add_sat( L_ener, L_shr_sat( L_tmp, 7 ) ); /* Q(2*(Q_exc+scale)+1) ,division by L_frame done here */ } } ELSE /* L_FRAME16k */ { FOR( j = 0; j < 160; j++ ) { tmpv = shl( *pt_exc2, scale ); L_tmp = L_mult0( tmpv, tmpv ); /* 2*(Q_exc+scale) */ pt_exc2++; tmpv = shl( *pt_exc2, scale ); L_tmp = L_mac0_sat( L_tmp, tmpv, tmpv ); pt_exc2++; L_ener = L_add_sat( L_ener, L_shr_sat( Mult_32_16( L_tmp, 26214 /* 256/320, Q15 */ ), 7 ) ); /* Q(2*(Q_exc+scale)+15+1-16+1) ,division by L_frame done here */ } } L_ener = L_shr_sat( L_ener, sub( shl( add( Q_exc, scale ), 1 ), 5 ) ); /* Q6 (2*(Q_exc+scale)+1-2*(Q_exc+scale)+5) */ /* update the circular buffer of old energies */ ho_ener_circ[*ho_circ_ptr] = L_ener; move32(); IF( enc_dec_flag == ENC ) { /* Store residual signal for postponed FFT-processing*/ *cng_buf_cnt = add( *cng_buf_cnt, 1 ); move16(); if ( GT_16( *cng_buf_cnt, HO_HIST_SIZE ) ) { *cng_buf_cnt = HO_HIST_SIZE; move16(); } Copy( exc2, &( cng_exc2_buf[( *ho_circ_ptr ) * L_FFT] ), L_FFT ); cng_Qexc_buf[*ho_circ_ptr] = Q_exc; move16(); cng_brate_buf[*ho_circ_ptr] = last_active_brate; move32(); } ELSE { /* calculate the spectrum of residual signal */ Copy( exc2, fft_io, L_frame ); fft_rel_fx( fft_io, L_FFT, LOG2_L_FFT ); ptR = &fft_io[1]; ptI = &fft_io[L_FFT - 1]; FOR( i = 0; i < NUM_ENV_CNG; i++ ) { /* sp[i] = 2.0f*(*ptR * *ptR + *ptI * *ptI)/L_FFT; */ L_tmp = L_mult_sat( *ptR, *ptR ); /* 2*Q_exc+1 */ L_tmp = L_add_sat( L_tmp, L_mult_sat( *ptI, *ptI ) ); /* 2*Q_exc+1 */ L_tmp = L_add_sat( L_tmp, L_tmp ); /* 2*Q_exc+1 */ L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_exc+1 */ tmp = add( add( Q_exc, Q_exc ), 1 ); sp[i] = L_shr( L_tmp, sub( tmp, 6 ) ); move32(); /* Q6 */ ptR++; ptI--; } Copy32( sp, env, NUM_ENV_CNG ); { CNG_mode = get_cng_mode( last_active_brate ); /* att = 1/pow(2,ENR_ATT_fx[CNG_mode]); */ L_tmp = L_shl( L_deposit_l( ENR_ATT_fx[CNG_mode] ), 8 ); /* 16 */ temp_lo_fx = L_Extract_lc( L_tmp, &temp_hi_fx ); exp_pow = sub( 14, temp_hi_fx ); L_tmp = Pow2( 14, temp_lo_fx ); /* Qexp_pow */ L_tmp = L_shl( L_tmp, sub( 13, exp_pow ) ); /* Q13 */ tmp = extract_l( L_tmp ); /* Q13 */ exp1 = norm_s( tmp ); tmp = shl( tmp, exp1 ); /*Q(exp1+13) */ tmp = div_s( 16384, tmp ); /*Q(15+14-exp1-13) */ tmp = shr( tmp, sub( 1, exp1 ) ); /* Q15 */ } FOR( i = 0; i < NUM_ENV_CNG; i++ ) { env[i] = Mult_32_16( env[i], tmp ); move32(); } /* update the circular buffer of old residual envelope */ /* Copy32( env, &(ho_env_circ[add(shl(*ho_circ_ptr,4),shl(*ho_circ_ptr,2))]), NUM_ENV_CNG ); */ Copy32( env, &( ho_env_circ[( *ho_circ_ptr ) * NUM_ENV_CNG] ), NUM_ENV_CNG ); } *ho_circ_size = add( *ho_circ_size, 1 ); move16(); if ( GT_16( *ho_circ_size, HO_HIST_SIZE ) ) { *ho_circ_size = HO_HIST_SIZE; move16(); } return; } #endif #ifdef HARM_NON_LINEARITY void cng_params_upd_fx( #else void cng_params_upd_ivas_fx( #endif const Word16 lsp_new[], /* i : LSP aprameters Q15 */ const Word16 exc2[], /* i : current enhanced excitation Q_exc */ const Word16 L_frame, /* i : frame length Q0 */ Loading Loading @@ -1187,9 +906,7 @@ void cng_params_upd_ivas_fx( /* update the circular buffer of old residual envelope */ /* Copy32( env, &(ho_env_circ[add(shl(*ho_circ_ptr,4),shl(*ho_circ_ptr,2))]), NUM_ENV_CNG ); */ Copy32( env, &( ho_env_circ[( *ho_circ_ptr ) * NUM_ENV_CNG] ), NUM_ENV_CNG ); #ifdef HARM_NON_LINEARITY IF( NE_16( element_mode, EVS_MONO ) ) #endif { scale_sig32( &( ho_env_circ[( *ho_circ_ptr ) * NUM_ENV_CNG] ), NUM_ENV_CNG, shift ); // Q(6+shift) } Loading
lib_com/ivas_prot_fx.h +0 −12 Original line number Diff line number Diff line Loading @@ -5827,11 +5827,7 @@ ivas_error ivas_mct_enc_fx( const Word16 nb_bits_metadata /* i : number of metadata bits */ ); #ifdef FIX_2344_ALIGN_PREPROC void ivas_compute_core_buffers_fx( #else ivas_error ivas_compute_core_buffers_fx( #endif Encoder_State *st, /* i/o: encoder state structure */ Word16 **inp16k_out_fx, /* o : ptr. to inp. signal in the current frame */ Word16 *old_inp_16k_fx, /* i/o: buffer of old input signal @ 16kHz */ Loading Loading @@ -5936,11 +5932,7 @@ void ivas_mct_enc_close_fx( MCT_ENC_HANDLE *hMCT /* i/o: MCT encoder structure */ ); #ifdef FIX_2344_ALIGN_PREPROC void pre_proc_front_ivas_fx( #else ivas_error pre_proc_front_ivas_fx( #endif SCE_ENC_HANDLE hSCE, /* i/o: SCE encoder structure */ CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ const Word32 element_brate, /* i : SCE/CPE element bitrate Q0*/ Loading Loading @@ -5996,11 +5988,7 @@ ivas_error pre_proc_front_ivas_fx( Word16 *Q_new /* i/o : Q factor of speech buffers */ ); #ifdef FIX_2344_ALIGN_PREPROC void pre_proc_ivas_fx( #else ivas_error pre_proc_ivas_fx( #endif Encoder_State *st, /* i/o: encoder state structure */ const Word16 last_element_mode, /* i : last element mode Q0*/ const Word32 element_brate, /* i : element bitrate Q0*/ Loading
lib_com/options.h +0 −24 Original line number Diff line number Diff line Loading @@ -87,28 +87,8 @@ #define FIX_2255_ISAR_RENDER_POSES /* VA: issue 2255: fix missing check in isar_render_poses() */ #define FIX_1904_HARM_GSC_ENC /* VA: #1904 Harmonization of EVS and IVAS GSC code */ #define FIX_1478_UNINIT_ON_BFI /* VA: Fix issue 1478 where a vector is partly un-initialized during bfi */ #define FIX_2318_CLANG_DECODER /* VA: basop issue 2318: Initialize command-line parameter arg.non_diegetic_pan_gain_fx */ #define HARM_NON_LINEARITY /* VA: basop issue 2345: Remove duplicated code in core-coder: non_linearity_fx() and LP CNG */ #define FIX_2344_ALIGN_PREPROC /* VA: basop issue 2344: Align pre_proc_ivas() between FLP and BASOP */ #define FIX_2334_HARM_CODER_MODIF /* VA: basop issue 2334 : harmonizing coder_modif_function */ #define FIX_FLOAT_1501_UNIT_VALUE_IN_OMASA /* Nokia: Fix float issue 1501, uninitialized value in ivas_masa_combine_directions for OMASA */ #define FIX_BASOP_2323_DIRAC_ENC_WRONG_INIT /* Nokia/FhG: basop issue 2323: Use correct init size */ #define FIX_BASOP_2324_MISSING_SET_TO_ZERO /* Nokia: basop issue 2324: Fix issue by setting the exponent to zero where it should be */ #define FIX_BASOP_2326_WRONG_SIG_LENGTH /* Nokia: basop issue 2326: Fix issue by using correct signal length in multiple places */ #define FIX_BASOP_2327_WRONG_LOOP_END /* Nokia: basop inssue 2327: Correct loop end to solve MSAN error */ #define FIX_BASOP_2328_MSAN_WRONG_ASSIGNMENT /* Nokia: basop issue 2328: Fix MSAN error by correcting the variable assignment */ #define FIX_BASOP_2329_UNINIT_VALUE /* Nokia: basop issue 2329: Fix issue by checking for structure instead of length */ #define FIX_BASOP_2332_ASAN_OVERFLOW_IN_EXT_DIRAC_REND /* Nokia: basop issue 2332: Uses predefined memory sizes instead computing wrong */ #define FIX_BASOP_2333_MCMASA_ANA_MEMORY_LEAK /* Nokia: basop issue 2333: Add missing free for direction_vector_e to ivas_mcmasa_ana_fx.c */ #define HARM_COREDECODER_FUNCTIONS /* VA: basop issue 2347: Remove various duplicated code in core-decoder */ #define FIX_BASOP_2358_SCALING_OOB /* Eri: Basip issue 2358: Clang-18 reports OOB access where scaling is applied to L_FRAME48k instead of output_frame */ #define FIX_BASOP_2351_EXTREND_SCALE /* FhG: basop issue 2351: Only scale initialized samples in renderer, related to 2326 */ #define FIX_2331_CLANG18_MSAN_UNINIT_VARIABLE /* FhG: Fix issue 2331: Uninitialized variable */ #define FIX_2362_TOTAL_BRATE_CALCULATION /* FhG: basop issue 2362: fix calculation of st->total_brate in ivas_cpe_enc_fx() */ #define FIX_2330_CLANG_18_WARNINGS_REND /* FhG: Fix renderer warnings */ #define FIX_BASOP_2350_HARM_0B_BWE /* VA: basop issue 2350: harmonization of the 0b BWE */ #define FIX_BASOP_2350_HARM_0B_BWE_2 /* VA: basop issue 2350: Simplify calling of hf_synth_fx() */ #define FIX_2349_HARM_FIND_UV /* VA: basop issue 2349: harmonization of find_uv() function */ #define FIX_2364_HARM_MULT_HARM /* VA: basop issue 2364 : harmonizing multi_harm_fx function */ #define FIX_2363_FIND_WSP /* VA: basop issue 2363 : harmonizing find_wsp function */ #define FIX_2370_UNUSED_BUFFERS_CORE_ENC /* VA: basop issue 2370: remove temporary input buffers in core-encoder */ Loading @@ -129,10 +109,6 @@ /* any switch which is non-be wrt. TS 26.251 V3.0 */ #define FIX_2250_LARGE_DIFFERENCES_BETWEEN_BASOP_AND_FLOAT /* Dolby: Issue 2250: random vector generation in GenShapedSHBExcitation() */ #define FIX_2320_OOB_SCE_SWITCHING /* VA: basop issue 2320: Correct the length of the buffer to be scaled in SCE/CPE switching */ #define FIX_2302_LSF_CDBK_THRESHOLD /* VA: basop issue 2302: fix threshold for LSF Q codebook-type decision */ #define FIX_1500_ISM_MD_DTX /* VA: float issue 1500: fix ISM elevation metadata smoothing in DTX */ #define FIX_2348_REPLACE_FEC_ENC /* VA: basop issue 2348: replace FEC_encode_ivas_fx with FEC_encode_fx */ #define FIX_2338_HARM_GSC_GAIN_COMP /* VA: basop issue 2338: harmonization of band gain computation for both EVS and IVAS */ #define FIX_BASOP_2317_UNINIT_VALUE_IN_STEREO_CNG /* Eri: Basop issue 2317: Uninitialized value read in case of DTX and BW switching */ Loading
lib_com/parameter_bitmaping_fx.c +0 −89 Original line number Diff line number Diff line Loading @@ -25,26 +25,6 @@ static Word16 PutIntoBitstream_fx( return value; } #ifndef HARM_COREDECODER_FUNCTIONS static Word16 PutIntoBitstream_ivas_fx( const Word16 **pStream, TEncodeValue EncodeValue, Word16 index, BSTR_ENC_HANDLE hBstr, const Word16 nBits ) { Word16 value; Word16 codedValue; move16(); value = *( *pStream )++; codedValue = EncodeValue( value, index ); push_next_indice( hBstr, codedValue, nBits ); return value; } #endif static Word16 FixedWidthEncoding( Word16 value, Word16 index ) { Loading Loading @@ -327,75 +307,6 @@ void WriteToBitstream_fx( return; } #ifndef HARM_COREDECODER_FUNCTIONS void WriteToBitstream_ivas_fx( ParamsBitMap const *paramsBitMap, const Word16 nArrayLength, const Word16 **pStream, Word16 *pnSize, BSTR_ENC_HANDLE hBstr, Word16 *pnBits ) { Word16 index; Word16 iParam, nParams; assert( ( paramsBitMap != NULL ) && ( nArrayLength > 0 ) && ( pStream != NULL ) && ( pnSize != NULL ) && ( hBstr != NULL ) && ( pnBits != NULL ) ); nParams = paramsBitMap->nParams; move16(); FOR( index = 0; index < nArrayLength; index++ ) { FOR( iParam = 0; iParam < nParams; iParam++ ) { ParamBitMap const *param; Word16 nBits; /* If a function for encoding/decoding value is defined than it should take care of 0 */ Word16 fShiftValue; TEncodeValue EncodeValue; Word16 value; move16(); param = ¶msBitMap->params[iParam]; move16(); nBits = param->nBits; IF( param->nBits == 0 ) { #define WMC_TOOL_SKIP nBits = param->GetNumberOfBits( **pStream, index ); #undef WMC_TOOL_SKIP } fShiftValue = s_and( param->fZeroAllowed == 0, param->EncodeValue == NULL ); EncodeValue = param->EncodeValue; if ( param->EncodeValue == NULL ) { move16(); EncodeValue = &FixedWidthEncoding; } value = PutIntoBitstream_ivas_fx( pStream, EncodeValue, index, hBstr, nBits ); IF( fShiftValue ) { value = add( value, 1 ); } move16(); *pnSize = add( *pnSize, 1 ); move16(); *pnBits = add( *pnBits, nBits ); test(); IF( ( param->pSubParamBitMap != NULL ) && ( value > 0 ) ) { WriteToBitstream_ivas_fx( param->pSubParamBitMap, value, pStream, pnSize, hBstr, pnBits ); } } } } #endif /** Get nBits long value from bitstream into *pStream. */ static Word16 GetFromBitstream( Loading