Loading .gitlab-ci.yml +60 −2 Original line number Diff line number Diff line variables: TESTV_DIR: "/usr/local/testv" LTV_DIR: "/usr/local/ltv" EVS_BE_TEST_DIR_BASOP: "/usr/local/be_2_evs_basop" REFERENCE_TAG: "20231128_Update_Ittiam" Loading @@ -23,6 +24,7 @@ variables: - 'pytest-mld' - 'pytest-mld-interop' - 'pytest-mld-long' - 'pytest-saturation-smoke-test' - 'evs-26444' - 'sanitizer-stv' Loading Loading @@ -54,6 +56,9 @@ workflow: - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'pytest-mld-long' variables: IVAS_PIPELINE_NAME: 'Run MLD tool against float ref (long test vectors): $CI_COMMIT_BRANCH' - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'pytest-saturation-smoke-test' variables: IVAS_PIPELINE_NAME: 'Run saturation smoke-test: $CI_COMMIT_BRANCH' - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'evs-26444' variables: IVAS_PIPELINE_NAME: 'EVS 26.444 test: $CI_COMMIT_BRANCH' Loading Loading @@ -158,6 +163,7 @@ stages: - if: $CI_PIPELINE_SOURCE == 'merge_request_event' when: never .rules-pytest-mld-interop: rules: - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == "pytest-mld-interop" Loading @@ -166,6 +172,15 @@ stages: - if: $CI_PIPELINE_SOURCE == 'merge_request_event' when: never .rules-pytest-saturation-smoke-test: rules: - if: $PYTEST_SMOKE_TEST # Set by scheduled pipeline - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == "pytest-saturation-smoke-test" - if: $CI_PIPELINE_SOURCE == 'push' when: never - if: $CI_PIPELINE_SOURCE == 'merge_request_event' when: never # --------------------------------------------------------------- # Job templates # --------------------------------------------------------------- Loading @@ -186,6 +201,7 @@ stages: .test-job-linux-needs-testv-dir: extends: .test-job-linux before_script: - *update-scripts-repo - if [ ! -d "$TESTV_DIR" ]; then mkdir -p $TESTV_DIR; fi - cp -r scripts/testv/* $TESTV_DIR/ Loading Loading @@ -223,7 +239,7 @@ stages: exit_codes: - 123 artifacts: name: "mld--sha-$CI_COMMIT_SHORT_SHA--stage-$CI_JOB_STAGE--results" name: "mld--sha-$CI_COMMIT_SHORT_SHA--results" expire_in: 1 week when: always paths: Loading Loading @@ -491,6 +507,48 @@ ivas-pytest-mld-long-dec-lev+10: - LEVEL_SCALING=3.162 <<: *ivas-pytest-mld-anchor ivas-smoke-test-saturation: extends: - .rules-pytest-saturation-smoke-test - .test-job-linux-needs-testv-dir script: - USE_LTV=1 - LEVEL_SCALING=32768 - *print-common-info - *update-scripts-repo - if [ $USE_LTV -eq 1 ]; then - *update-ltv-repo - *copy-ltv-files-to-testv-dir - fi - if [ $LEVEL_SCALING != "1.0" ];then - *apply-testv-scaling - fi - cp -r scripts/testv/* $TESTV_DIR/ # skip prepare_mem_dryrun.py script in smoke_test.sh - sed -i 's/python3 .\/scripts\/prepare_mem_dryrun.py/#python3 .\/scripts\/prepare_mem_dryrun.py/g' ci/smoke_test.sh - bash ci/smoke_test.sh ### analyze for failures - if ! [ -s smoke_test_output.txt ] || ! [ -s smoke_test_output_plc.txt ] || ! [ -s smoke_test_output_jbm_noEXT.txt ] || ! [ -s smoke_test_output_hrtf.txt ]; then echo "Error in smoke test"; exit 1; fi - ret_val=0 - if cat smoke_test_output.txt | grep -c "failed" ; then echo "Smoke test without PLC failed"; ret_val=1; fi - if cat smoke_test_output_plc.txt | grep -c "failed"; then echo "Smoke test with PLC failed"; ret_val=1; fi - if cat smoke_test_output_jbm_noEXT.txt | grep -c "failed"; then echo "Smoke test JBM part failed"; ret_val=1; fi - if cat smoke_test_output_hrtf.txt | grep -c "failed"; then echo "Smoke test with external hrtf files failed"; ret_val=1; fi - exit $ret_val artifacts: name: "ivas-smoke-test-saturation--sha-$CI_COMMIT_SHORT_SHA--results" expire_in: 1 week when: always paths: - smoke_test_output.txt - smoke_test_output_plc.txt - smoke_test_output_jbm_noEXT.txt - smoke_test_output_hrtf.txt expose_as: "saturation smoke test results" # --------------------------------------------------------------- # EVS 26.444 test job # --------------------------------------------------------------- Loading Loading @@ -520,7 +578,7 @@ be-2-evs-26444: - exit 0 artifacts: name: "evs-26444--sha-$CI_COMMIT_SHORT_SHA--stage-$CI_JOB_STAGE--results" name: "evs-26444--sha-$CI_COMMIT_SHORT_SHA--results" expire_in: 1 week when: always paths: Loading lib_com/bits_alloc_fx.c +67 −0 Original line number Diff line number Diff line Loading @@ -1575,6 +1575,72 @@ static Word16 allocate_unused( *--------------------------------------------------------------------*/ /*! r: ACELP16k flag */ #ifdef IVAS_FLOAT_FIXED Word16 set_ACELP_flag( const Word16 element_mode, /* i : element mode */ const Word32 element_brate, /* i : element bitrate */ const Word32 total_brate, /* i : total bitrate per channel */ const Word16 idchan, /* i : Channel id */ const Word16 tdm_LRTD_flag, /* i : LRTD stereo mode flag */ const Word16 bwidth, /* i : audio bandwidth */ const Word16 cng_type /* i : CNG type */ ) { // PMT("Not floating point computation, but fixed point operator are still missing ") test(); test(); test(); test(); IF( EQ_16( element_mode, IVAS_CPE_DFT ) && EQ_16( idchan, 0 ) && LE_32( total_brate, SID_2k40 ) && EQ_16( bwidth, WB ) && EQ_16( cng_type, LP_CNG ) ) { return 1; } ELSE IF( EQ_16( element_mode, IVAS_CPE_TD ) ) { test(); test(); test(); IF( GE_32( element_brate, IVAS_24k4 ) && EQ_16( idchan, 0 ) && ( EQ_16( tdm_LRTD_flag, 0 ) || GT_32( element_brate, IVAS_24k4 ) ) ) { return 1; } ELSE { return 0; } } ELSE IF( EQ_16( element_mode, IVAS_CPE_DFT ) ) { IF( GE_32( element_brate, IVAS_24k4 ) ) { return 1; } ELSE { return 0; } } ELSE IF( EQ_16( element_mode, IVAS_SCE ) ) { IF( GE_32( element_brate, SCE_CORE_16k_LOW_LIMIT ) ) { return 1; } ELSE { return 0; } } ELSE IF( GE_32( total_brate, ACELP_16k_LOW_LIMIT ) ) /* EVS_MONO */ { return 1; } ELSE { return 0; } } #else Word16 set_ACELP_flag( const Word16 element_mode, /* i : element mode */ const Word32 element_brate, /* i : element bitrate */ Loading Loading @@ -1633,4 +1699,5 @@ Word16 set_ACELP_flag( return 0; } } #endif /*#endif IVAS_CODE*/ No newline at end of file lib_com/cldfb.c +61 −2 Original line number Diff line number Diff line Loading @@ -1598,7 +1598,7 @@ void configureCldfb_ivas_fx( // h_cldfb->no_channels = (int16_t) ( sampling_rate * INV_CLDFB_BANDWIDTH + 0.5f ); Word32 n_sampling_rate = sampling_rate * 2; Word32 val = L_add( Mpy_32_16_1( n_sampling_rate, 41 ), 1 ); Word32 val = L_add( Mpy_32_16_1( n_sampling_rate, 41 /* INV_CLDFB_BANDWIDTH in Q15 */), 1 ); val = L_shr( val, 1 ); h_cldfb->no_channels = extract_l( val ); Loading Loading @@ -1687,7 +1687,8 @@ ivas_error openCldfb_ivas_fx( hs->prototype = prototype; move16(); configureCldfb_ivas( hs, sampling_rate ); //configureCldfb_ivas( hs, sampling_rate ); configureCldfb_ivas_fx( hs, sampling_rate ); hs->memory_flt = NULL; hs->memory_length = 0; move16(); Loading Loading @@ -1914,6 +1915,36 @@ void deleteCldfb_ivas( return; } #ifdef IVAS_FLOAT_FIXED void deleteCldfb_ivas_fx( HANDLE_CLDFB_FILTER_BANK *h_cldfb /* i/o: filter bank handle */ ) { HANDLE_CLDFB_FILTER_BANK hs = *h_cldfb; IF ( h_cldfb == NULL || *h_cldfb == NULL ) { return; } IF ( hs->cldfb_state_fx ) { free( hs->cldfb_state_fx ); } #ifdef IVAS_FLOAT_FIXED // TODO : Will be removed later IF ( hs->cldfb_state ) { free( hs->cldfb_state ); } #endif free( hs ); *h_cldfb = NULL; return; } #endif /*-------------------------------------------------------------------* * cldfb_init_proto_and_twiddles() Loading Loading @@ -1956,6 +1987,8 @@ static void cldfb_init_proto_and_twiddles( hs->rot_vec_syn_delay_re_fx = NULL; hs->p_filter_sf = (Word16) 17036; hs->p_filter = CLDFB80_10_fx; hs->q_scale = norm_s((Word16)CLDFB80_10_SCALE); hs->scale = (Word16)(CLDFB80_10_SCALE*(1<<hs->q_scale)); #endif } else if ( hs->prototype == CLDFB_PROTOTYPE_5_00MS ) Loading @@ -1975,6 +2008,8 @@ static void cldfb_init_proto_and_twiddles( hs->rot_vec_syn_delay_re_fx = rot_vec_delay_im_LDQMF_fx; hs->p_filter_sf = (Word16) 15388; hs->p_filter = LDQMF_10_fx; hs->q_scale = norm_s((Word16)LDQMF_10_SCALE); hs->scale = (Word16)(LDQMF_10_SCALE*(1 << hs->q_scale)); #endif } break; Loading Loading @@ -2007,6 +2042,8 @@ static void cldfb_init_proto_and_twiddles( hs->rot_vec_syn_delay_re_fx = NULL; hs->p_filter_sf = (Word16) 17051; hs->p_filter = CLDFB80_16_fx; hs->q_scale = norm_s((Word16)CLDFB80_16_SCALE); hs->scale = (Word16)(CLDFB80_16_SCALE*(1 << hs->q_scale)); #endif } else if ( hs->prototype == CLDFB_PROTOTYPE_5_00MS ) Loading @@ -2026,6 +2063,8 @@ static void cldfb_init_proto_and_twiddles( hs->rot_vec_syn_delay_re_fx = rot_vec_delay_im_LDQMF_fx; hs->p_filter_sf = (Word16) 15388; hs->p_filter = LDQMF_16_fx; hs->q_scale = norm_s((Word16)LDQMF_16_SCALE); hs->scale = (Word16)(LDQMF_16_SCALE*(1 << hs->q_scale)); #endif } break; Loading Loading @@ -2058,6 +2097,8 @@ static void cldfb_init_proto_and_twiddles( hs->rot_vec_syn_delay_re_fx = NULL; hs->p_filter_sf = (Word16) 17050; hs->p_filter = CLDFB80_20_fx; hs->q_scale = norm_s((Word16)CLDFB80_20_SCALE); hs->scale = (Word16)(CLDFB80_20_SCALE*(1 << hs->q_scale)); #endif } else if ( hs->prototype == CLDFB_PROTOTYPE_5_00MS ) Loading @@ -2077,6 +2118,8 @@ static void cldfb_init_proto_and_twiddles( hs->rot_vec_syn_delay_re_fx = rot_vec_delay_im_LDQMF_fx; hs->p_filter_sf = (Word16) 15390; hs->p_filter = LDQMF_20_fx; hs->q_scale = norm_s((Word16)LDQMF_20_SCALE); hs->scale = (Word16)(LDQMF_20_SCALE*(1 << hs->q_scale)); #endif } break; Loading Loading @@ -2109,6 +2152,8 @@ static void cldfb_init_proto_and_twiddles( hs->rot_vec_syn_delay_re_fx = NULL; hs->p_filter_sf = (Word16) 17051; hs->p_filter = CLDFB80_30_fx; hs->q_scale = norm_s((Word16)CLDFB80_30_SCALE); hs->scale = (Word16)(CLDFB80_30_SCALE*(1 << hs->q_scale)); #endif } else if ( hs->prototype == CLDFB_PROTOTYPE_5_00MS ) Loading @@ -2128,6 +2173,8 @@ static void cldfb_init_proto_and_twiddles( hs->rot_vec_syn_delay_re_fx = rot_vec_delay_im_LDQMF_fx; hs->p_filter_sf = (Word16) 15388; hs->p_filter = LDQMF_30_fx; hs->q_scale = norm_s((Word16)LDQMF_30_SCALE); hs->scale = (Word16)(LDQMF_30_SCALE*(1 << hs->q_scale)); #endif } break; Loading Loading @@ -2160,6 +2207,8 @@ static void cldfb_init_proto_and_twiddles( hs->rot_vec_syn_delay_re_fx = NULL; hs->p_filter_sf = (Word16) 17050; hs->p_filter = CLDFB80_32_fx; hs->q_scale = norm_s((Word16)CLDFB80_32_SCALE); hs->scale = (Word16)(CLDFB80_32_SCALE*(1 << hs->q_scale)); #endif } else if ( hs->prototype == CLDFB_PROTOTYPE_5_00MS ) Loading @@ -2179,6 +2228,8 @@ static void cldfb_init_proto_and_twiddles( hs->rot_vec_syn_delay_re_fx = rot_vec_delay_im_LDQMF_fx; hs->p_filter_sf = (Word16) 15392; hs->p_filter = LDQMF_32_fx; hs->q_scale = norm_s((Word16)LDQMF_32_SCALE); hs->scale = (Word16)(LDQMF_32_SCALE*(1 << hs->q_scale)); #endif } break; Loading Loading @@ -2211,6 +2262,8 @@ static void cldfb_init_proto_and_twiddles( hs->rot_vec_syn_delay_re_fx = NULL; hs->p_filter_sf = (Word16) 17051; hs->p_filter = CLDFB80_40_fx; hs->q_scale = norm_s((Word16)CLDFB80_40_SCALE); hs->scale = (Word16)(CLDFB80_40_SCALE*(1 << hs->q_scale)); #endif } else if ( hs->prototype == CLDFB_PROTOTYPE_5_00MS ) Loading @@ -2230,6 +2283,8 @@ static void cldfb_init_proto_and_twiddles( hs->rot_vec_syn_delay_re_fx = rot_vec_delay_im_LDQMF_fx; hs->p_filter_sf = (Word16) 15391; hs->p_filter = LDQMF_40_fx; hs->q_scale = norm_s((Word16)LDQMF_40_SCALE); hs->scale = (Word16)(LDQMF_40_SCALE*(1 << hs->q_scale)); #endif } break; Loading Loading @@ -2262,6 +2317,8 @@ static void cldfb_init_proto_and_twiddles( hs->rot_vec_syn_delay_re_fx = NULL; hs->p_filter_sf = (Word16) 17051; hs->p_filter = CLDFB80_60_fx; hs->q_scale = norm_s((Word16)CLDFB80_60_SCALE); hs->scale = (Word16)(CLDFB80_60_SCALE*(1 << hs->q_scale)); #endif } else if ( hs->prototype == CLDFB_PROTOTYPE_5_00MS ) Loading @@ -2281,6 +2338,8 @@ static void cldfb_init_proto_and_twiddles( hs->rot_vec_syn_delay_re_fx = rot_vec_delay_im_LDQMF_fx; hs->p_filter_sf = (Word16) 15391; hs->p_filter = LDQMF_60_fx; hs->q_scale = norm_s((Word16)LDQMF_60_SCALE); hs->scale = (Word16)(LDQMF_60_SCALE*(1 << hs->q_scale)); #endif } break; Loading lib_com/cng_exc_fx.c +215 −1 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ #include "prot_fx1.h" /* Function prototypes */ #include "prot_fx2.h" /* Function prototypes */ #include "rom_com.h" #include "ivas_rom_com_fx.h" /*---------------------------------------------------------------------* * Local constants Loading @@ -14,7 +15,7 @@ #define A2 6554 #define OmA2 (32768-A2) #define GAIN_VAR 11811 /* in Q31 divided by 2 (Q30) */ const Word16 att_pow_tbl[SIZE_SCALE_TABLE_STEREO + 1] = { 9234, 10361, 13044, 16422, 22669, 31292, 32767, 26634, 28212, 20674, 16422, 27254, 30934, 32767 }; /*-------------------------------------------------------* * CNG_exc() * Loading Loading @@ -962,6 +963,219 @@ void cng_params_upd_fx( return; } #ifdef IVAS_FLOAT_FIXED void cng_params_upd_ivas_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 */ 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 */ , const Word16 element_mode, /* i : Element mode */ const Word16 bwidth /* i : Audio bandwidth */ ) { 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 = 0; Word16 temp_lo_fx, temp_hi_fx; Word16 exp_pow; #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif /* update the pointer to circular buffer of old LSP vectors */ *ho_circ_ptr = add( *ho_circ_ptr, 1 ); 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; move16(); L_ener = L_deposit_l( 0 ); 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 ); #ifdef BASOP_NOGLOB L_tmp = L_mac0_o( L_tmp, tmpv, tmpv, &Overflow ); #else L_tmp = L_mac0( L_tmp, tmpv, tmpv ); #endif pt_exc2++; #ifdef BASOP_NOGLOB L_ener = L_add_o( L_ener, L_shr_o( L_tmp, 7, &Overflow ), &Overflow ); /* Q(2*(Q_exc+scale)+1) ,division by L_frame done here */ #else L_ener = L_add( L_ener, L_shr( L_tmp, 7 ) ); /* Q(2*(Q_exc+scale)+1) ,division by L_frame done here */ #endif } } 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 ); #ifdef BASOP_NOGLOB L_tmp = L_mac0_o( L_tmp, tmpv, tmpv, &Overflow ); #else L_tmp = L_mac0( L_tmp, tmpv, tmpv ); #endif pt_exc2++; #ifdef BASOP_NOGLOB L_ener = L_add_o( L_ener, L_shr_o( Mult_32_16( L_tmp, 26214 /* 256/320, Q15 */ ), 7, &Overflow ), &Overflow ); /* Q(2*(Q_exc+scale)+15+1-16+1) ,division by L_frame done here */ #else L_ener = L_add( L_ener, L_shr( 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 */ #endif } } #ifdef BASOP_NOGLOB L_ener = L_shr_o( L_ener, sub( shl( add( Q_exc, scale ), 1 ), 5 ), &Overflow ); /* Q6 (2*(Q_exc+scale)+1-2*(Q_exc+scale)+5) */ #else /* BASOP_NOGLOB */ L_ener = L_shr( L_ener, sub( shl( add( Q_exc, scale ), 1 ), 5 ) ); /* Q6 (2*(Q_exc+scale)+1-2*(Q_exc+scale)+5) */ #endif /* update the circular buffer of old energies */ ho_ener_circ[*ho_circ_ptr] = L_ener; move32(); IF( EQ_16( enc_dec_flag, ENC ) ) { /* Store residual signal for postponed FFT-processing*/ *cng_buf_cnt = add( *cng_buf_cnt, 1 ); 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; move16(); } 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; */ #ifdef BASOP_NOGLOB L_tmp = L_mult_o( *ptR, *ptR, &Overflow ); /* 2*Q_exc+1 */ L_tmp = L_add_o( L_tmp, L_mult_o( *ptI, *ptI, &Overflow ), &Overflow ); /* 2*Q_exc+1 */ L_tmp = L_add_o( L_tmp, L_tmp, &Overflow ); /* 2*Q_exc+1 */ #else L_tmp = L_mult( *ptR, *ptR ); /* 2*Q_exc+1 */ L_tmp = L_add( L_tmp, L_mult( *ptI, *ptI ) ); /* 2*Q_exc+1 */ L_tmp = L_add( L_tmp, L_tmp ); /* 2*Q_exc+1 */ #endif 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); Word16 shift = 0; if (element_mode == IVAS_SCE || element_mode == IVAS_CPE_DFT) { Word32 att_fx = 0; Word16 index = 0; apply_scale_ivas_fx(&att_fx, bwidth, last_active_brate, scaleTableStereo, SIZE_SCALE_TABLE_STEREO, &index); att_fx = pow_10_q23[index];//Q23 tmp = extract_h(att_fx);//Q7 shift = 8; } else { 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 ); scale_sig32(&(ho_env_circ[(*ho_circ_ptr)*NUM_ENV_CNG]), NUM_ENV_CNG, shift); } *ho_circ_size = add( *ho_circ_size, 1 ); if ( GT_16( *ho_circ_size, HO_HIST_SIZE ) ) { *ho_circ_size = HO_HIST_SIZE; move16(); } return; } #endif // IVAS_FLOAT_FIXED /*---------------------------------------------------------------------* * get_cng_mode() * Loading lib_com/cnst.h +2 −0 Original line number Diff line number Diff line Loading @@ -2995,6 +2995,8 @@ extern const Word16 Idx2Freq_Tbl[]; #define FS_32K_IN_NS_Q31 68719 #define FS_16K_IN_NS_Q31 34360 #define ONE_BY_THREE_Q15 10923 /* 1/3.f in Q15 */ typedef enum { MCT_CHAN_MODE_REGULAR, Loading Loading
.gitlab-ci.yml +60 −2 Original line number Diff line number Diff line variables: TESTV_DIR: "/usr/local/testv" LTV_DIR: "/usr/local/ltv" EVS_BE_TEST_DIR_BASOP: "/usr/local/be_2_evs_basop" REFERENCE_TAG: "20231128_Update_Ittiam" Loading @@ -23,6 +24,7 @@ variables: - 'pytest-mld' - 'pytest-mld-interop' - 'pytest-mld-long' - 'pytest-saturation-smoke-test' - 'evs-26444' - 'sanitizer-stv' Loading Loading @@ -54,6 +56,9 @@ workflow: - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'pytest-mld-long' variables: IVAS_PIPELINE_NAME: 'Run MLD tool against float ref (long test vectors): $CI_COMMIT_BRANCH' - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'pytest-saturation-smoke-test' variables: IVAS_PIPELINE_NAME: 'Run saturation smoke-test: $CI_COMMIT_BRANCH' - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'evs-26444' variables: IVAS_PIPELINE_NAME: 'EVS 26.444 test: $CI_COMMIT_BRANCH' Loading Loading @@ -158,6 +163,7 @@ stages: - if: $CI_PIPELINE_SOURCE == 'merge_request_event' when: never .rules-pytest-mld-interop: rules: - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == "pytest-mld-interop" Loading @@ -166,6 +172,15 @@ stages: - if: $CI_PIPELINE_SOURCE == 'merge_request_event' when: never .rules-pytest-saturation-smoke-test: rules: - if: $PYTEST_SMOKE_TEST # Set by scheduled pipeline - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == "pytest-saturation-smoke-test" - if: $CI_PIPELINE_SOURCE == 'push' when: never - if: $CI_PIPELINE_SOURCE == 'merge_request_event' when: never # --------------------------------------------------------------- # Job templates # --------------------------------------------------------------- Loading @@ -186,6 +201,7 @@ stages: .test-job-linux-needs-testv-dir: extends: .test-job-linux before_script: - *update-scripts-repo - if [ ! -d "$TESTV_DIR" ]; then mkdir -p $TESTV_DIR; fi - cp -r scripts/testv/* $TESTV_DIR/ Loading Loading @@ -223,7 +239,7 @@ stages: exit_codes: - 123 artifacts: name: "mld--sha-$CI_COMMIT_SHORT_SHA--stage-$CI_JOB_STAGE--results" name: "mld--sha-$CI_COMMIT_SHORT_SHA--results" expire_in: 1 week when: always paths: Loading Loading @@ -491,6 +507,48 @@ ivas-pytest-mld-long-dec-lev+10: - LEVEL_SCALING=3.162 <<: *ivas-pytest-mld-anchor ivas-smoke-test-saturation: extends: - .rules-pytest-saturation-smoke-test - .test-job-linux-needs-testv-dir script: - USE_LTV=1 - LEVEL_SCALING=32768 - *print-common-info - *update-scripts-repo - if [ $USE_LTV -eq 1 ]; then - *update-ltv-repo - *copy-ltv-files-to-testv-dir - fi - if [ $LEVEL_SCALING != "1.0" ];then - *apply-testv-scaling - fi - cp -r scripts/testv/* $TESTV_DIR/ # skip prepare_mem_dryrun.py script in smoke_test.sh - sed -i 's/python3 .\/scripts\/prepare_mem_dryrun.py/#python3 .\/scripts\/prepare_mem_dryrun.py/g' ci/smoke_test.sh - bash ci/smoke_test.sh ### analyze for failures - if ! [ -s smoke_test_output.txt ] || ! [ -s smoke_test_output_plc.txt ] || ! [ -s smoke_test_output_jbm_noEXT.txt ] || ! [ -s smoke_test_output_hrtf.txt ]; then echo "Error in smoke test"; exit 1; fi - ret_val=0 - if cat smoke_test_output.txt | grep -c "failed" ; then echo "Smoke test without PLC failed"; ret_val=1; fi - if cat smoke_test_output_plc.txt | grep -c "failed"; then echo "Smoke test with PLC failed"; ret_val=1; fi - if cat smoke_test_output_jbm_noEXT.txt | grep -c "failed"; then echo "Smoke test JBM part failed"; ret_val=1; fi - if cat smoke_test_output_hrtf.txt | grep -c "failed"; then echo "Smoke test with external hrtf files failed"; ret_val=1; fi - exit $ret_val artifacts: name: "ivas-smoke-test-saturation--sha-$CI_COMMIT_SHORT_SHA--results" expire_in: 1 week when: always paths: - smoke_test_output.txt - smoke_test_output_plc.txt - smoke_test_output_jbm_noEXT.txt - smoke_test_output_hrtf.txt expose_as: "saturation smoke test results" # --------------------------------------------------------------- # EVS 26.444 test job # --------------------------------------------------------------- Loading Loading @@ -520,7 +578,7 @@ be-2-evs-26444: - exit 0 artifacts: name: "evs-26444--sha-$CI_COMMIT_SHORT_SHA--stage-$CI_JOB_STAGE--results" name: "evs-26444--sha-$CI_COMMIT_SHORT_SHA--results" expire_in: 1 week when: always paths: Loading
lib_com/bits_alloc_fx.c +67 −0 Original line number Diff line number Diff line Loading @@ -1575,6 +1575,72 @@ static Word16 allocate_unused( *--------------------------------------------------------------------*/ /*! r: ACELP16k flag */ #ifdef IVAS_FLOAT_FIXED Word16 set_ACELP_flag( const Word16 element_mode, /* i : element mode */ const Word32 element_brate, /* i : element bitrate */ const Word32 total_brate, /* i : total bitrate per channel */ const Word16 idchan, /* i : Channel id */ const Word16 tdm_LRTD_flag, /* i : LRTD stereo mode flag */ const Word16 bwidth, /* i : audio bandwidth */ const Word16 cng_type /* i : CNG type */ ) { // PMT("Not floating point computation, but fixed point operator are still missing ") test(); test(); test(); test(); IF( EQ_16( element_mode, IVAS_CPE_DFT ) && EQ_16( idchan, 0 ) && LE_32( total_brate, SID_2k40 ) && EQ_16( bwidth, WB ) && EQ_16( cng_type, LP_CNG ) ) { return 1; } ELSE IF( EQ_16( element_mode, IVAS_CPE_TD ) ) { test(); test(); test(); IF( GE_32( element_brate, IVAS_24k4 ) && EQ_16( idchan, 0 ) && ( EQ_16( tdm_LRTD_flag, 0 ) || GT_32( element_brate, IVAS_24k4 ) ) ) { return 1; } ELSE { return 0; } } ELSE IF( EQ_16( element_mode, IVAS_CPE_DFT ) ) { IF( GE_32( element_brate, IVAS_24k4 ) ) { return 1; } ELSE { return 0; } } ELSE IF( EQ_16( element_mode, IVAS_SCE ) ) { IF( GE_32( element_brate, SCE_CORE_16k_LOW_LIMIT ) ) { return 1; } ELSE { return 0; } } ELSE IF( GE_32( total_brate, ACELP_16k_LOW_LIMIT ) ) /* EVS_MONO */ { return 1; } ELSE { return 0; } } #else Word16 set_ACELP_flag( const Word16 element_mode, /* i : element mode */ const Word32 element_brate, /* i : element bitrate */ Loading Loading @@ -1633,4 +1699,5 @@ Word16 set_ACELP_flag( return 0; } } #endif /*#endif IVAS_CODE*/ No newline at end of file
lib_com/cldfb.c +61 −2 Original line number Diff line number Diff line Loading @@ -1598,7 +1598,7 @@ void configureCldfb_ivas_fx( // h_cldfb->no_channels = (int16_t) ( sampling_rate * INV_CLDFB_BANDWIDTH + 0.5f ); Word32 n_sampling_rate = sampling_rate * 2; Word32 val = L_add( Mpy_32_16_1( n_sampling_rate, 41 ), 1 ); Word32 val = L_add( Mpy_32_16_1( n_sampling_rate, 41 /* INV_CLDFB_BANDWIDTH in Q15 */), 1 ); val = L_shr( val, 1 ); h_cldfb->no_channels = extract_l( val ); Loading Loading @@ -1687,7 +1687,8 @@ ivas_error openCldfb_ivas_fx( hs->prototype = prototype; move16(); configureCldfb_ivas( hs, sampling_rate ); //configureCldfb_ivas( hs, sampling_rate ); configureCldfb_ivas_fx( hs, sampling_rate ); hs->memory_flt = NULL; hs->memory_length = 0; move16(); Loading Loading @@ -1914,6 +1915,36 @@ void deleteCldfb_ivas( return; } #ifdef IVAS_FLOAT_FIXED void deleteCldfb_ivas_fx( HANDLE_CLDFB_FILTER_BANK *h_cldfb /* i/o: filter bank handle */ ) { HANDLE_CLDFB_FILTER_BANK hs = *h_cldfb; IF ( h_cldfb == NULL || *h_cldfb == NULL ) { return; } IF ( hs->cldfb_state_fx ) { free( hs->cldfb_state_fx ); } #ifdef IVAS_FLOAT_FIXED // TODO : Will be removed later IF ( hs->cldfb_state ) { free( hs->cldfb_state ); } #endif free( hs ); *h_cldfb = NULL; return; } #endif /*-------------------------------------------------------------------* * cldfb_init_proto_and_twiddles() Loading Loading @@ -1956,6 +1987,8 @@ static void cldfb_init_proto_and_twiddles( hs->rot_vec_syn_delay_re_fx = NULL; hs->p_filter_sf = (Word16) 17036; hs->p_filter = CLDFB80_10_fx; hs->q_scale = norm_s((Word16)CLDFB80_10_SCALE); hs->scale = (Word16)(CLDFB80_10_SCALE*(1<<hs->q_scale)); #endif } else if ( hs->prototype == CLDFB_PROTOTYPE_5_00MS ) Loading @@ -1975,6 +2008,8 @@ static void cldfb_init_proto_and_twiddles( hs->rot_vec_syn_delay_re_fx = rot_vec_delay_im_LDQMF_fx; hs->p_filter_sf = (Word16) 15388; hs->p_filter = LDQMF_10_fx; hs->q_scale = norm_s((Word16)LDQMF_10_SCALE); hs->scale = (Word16)(LDQMF_10_SCALE*(1 << hs->q_scale)); #endif } break; Loading Loading @@ -2007,6 +2042,8 @@ static void cldfb_init_proto_and_twiddles( hs->rot_vec_syn_delay_re_fx = NULL; hs->p_filter_sf = (Word16) 17051; hs->p_filter = CLDFB80_16_fx; hs->q_scale = norm_s((Word16)CLDFB80_16_SCALE); hs->scale = (Word16)(CLDFB80_16_SCALE*(1 << hs->q_scale)); #endif } else if ( hs->prototype == CLDFB_PROTOTYPE_5_00MS ) Loading @@ -2026,6 +2063,8 @@ static void cldfb_init_proto_and_twiddles( hs->rot_vec_syn_delay_re_fx = rot_vec_delay_im_LDQMF_fx; hs->p_filter_sf = (Word16) 15388; hs->p_filter = LDQMF_16_fx; hs->q_scale = norm_s((Word16)LDQMF_16_SCALE); hs->scale = (Word16)(LDQMF_16_SCALE*(1 << hs->q_scale)); #endif } break; Loading Loading @@ -2058,6 +2097,8 @@ static void cldfb_init_proto_and_twiddles( hs->rot_vec_syn_delay_re_fx = NULL; hs->p_filter_sf = (Word16) 17050; hs->p_filter = CLDFB80_20_fx; hs->q_scale = norm_s((Word16)CLDFB80_20_SCALE); hs->scale = (Word16)(CLDFB80_20_SCALE*(1 << hs->q_scale)); #endif } else if ( hs->prototype == CLDFB_PROTOTYPE_5_00MS ) Loading @@ -2077,6 +2118,8 @@ static void cldfb_init_proto_and_twiddles( hs->rot_vec_syn_delay_re_fx = rot_vec_delay_im_LDQMF_fx; hs->p_filter_sf = (Word16) 15390; hs->p_filter = LDQMF_20_fx; hs->q_scale = norm_s((Word16)LDQMF_20_SCALE); hs->scale = (Word16)(LDQMF_20_SCALE*(1 << hs->q_scale)); #endif } break; Loading Loading @@ -2109,6 +2152,8 @@ static void cldfb_init_proto_and_twiddles( hs->rot_vec_syn_delay_re_fx = NULL; hs->p_filter_sf = (Word16) 17051; hs->p_filter = CLDFB80_30_fx; hs->q_scale = norm_s((Word16)CLDFB80_30_SCALE); hs->scale = (Word16)(CLDFB80_30_SCALE*(1 << hs->q_scale)); #endif } else if ( hs->prototype == CLDFB_PROTOTYPE_5_00MS ) Loading @@ -2128,6 +2173,8 @@ static void cldfb_init_proto_and_twiddles( hs->rot_vec_syn_delay_re_fx = rot_vec_delay_im_LDQMF_fx; hs->p_filter_sf = (Word16) 15388; hs->p_filter = LDQMF_30_fx; hs->q_scale = norm_s((Word16)LDQMF_30_SCALE); hs->scale = (Word16)(LDQMF_30_SCALE*(1 << hs->q_scale)); #endif } break; Loading Loading @@ -2160,6 +2207,8 @@ static void cldfb_init_proto_and_twiddles( hs->rot_vec_syn_delay_re_fx = NULL; hs->p_filter_sf = (Word16) 17050; hs->p_filter = CLDFB80_32_fx; hs->q_scale = norm_s((Word16)CLDFB80_32_SCALE); hs->scale = (Word16)(CLDFB80_32_SCALE*(1 << hs->q_scale)); #endif } else if ( hs->prototype == CLDFB_PROTOTYPE_5_00MS ) Loading @@ -2179,6 +2228,8 @@ static void cldfb_init_proto_and_twiddles( hs->rot_vec_syn_delay_re_fx = rot_vec_delay_im_LDQMF_fx; hs->p_filter_sf = (Word16) 15392; hs->p_filter = LDQMF_32_fx; hs->q_scale = norm_s((Word16)LDQMF_32_SCALE); hs->scale = (Word16)(LDQMF_32_SCALE*(1 << hs->q_scale)); #endif } break; Loading Loading @@ -2211,6 +2262,8 @@ static void cldfb_init_proto_and_twiddles( hs->rot_vec_syn_delay_re_fx = NULL; hs->p_filter_sf = (Word16) 17051; hs->p_filter = CLDFB80_40_fx; hs->q_scale = norm_s((Word16)CLDFB80_40_SCALE); hs->scale = (Word16)(CLDFB80_40_SCALE*(1 << hs->q_scale)); #endif } else if ( hs->prototype == CLDFB_PROTOTYPE_5_00MS ) Loading @@ -2230,6 +2283,8 @@ static void cldfb_init_proto_and_twiddles( hs->rot_vec_syn_delay_re_fx = rot_vec_delay_im_LDQMF_fx; hs->p_filter_sf = (Word16) 15391; hs->p_filter = LDQMF_40_fx; hs->q_scale = norm_s((Word16)LDQMF_40_SCALE); hs->scale = (Word16)(LDQMF_40_SCALE*(1 << hs->q_scale)); #endif } break; Loading Loading @@ -2262,6 +2317,8 @@ static void cldfb_init_proto_and_twiddles( hs->rot_vec_syn_delay_re_fx = NULL; hs->p_filter_sf = (Word16) 17051; hs->p_filter = CLDFB80_60_fx; hs->q_scale = norm_s((Word16)CLDFB80_60_SCALE); hs->scale = (Word16)(CLDFB80_60_SCALE*(1 << hs->q_scale)); #endif } else if ( hs->prototype == CLDFB_PROTOTYPE_5_00MS ) Loading @@ -2281,6 +2338,8 @@ static void cldfb_init_proto_and_twiddles( hs->rot_vec_syn_delay_re_fx = rot_vec_delay_im_LDQMF_fx; hs->p_filter_sf = (Word16) 15391; hs->p_filter = LDQMF_60_fx; hs->q_scale = norm_s((Word16)LDQMF_60_SCALE); hs->scale = (Word16)(LDQMF_60_SCALE*(1 << hs->q_scale)); #endif } break; Loading
lib_com/cng_exc_fx.c +215 −1 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ #include "prot_fx1.h" /* Function prototypes */ #include "prot_fx2.h" /* Function prototypes */ #include "rom_com.h" #include "ivas_rom_com_fx.h" /*---------------------------------------------------------------------* * Local constants Loading @@ -14,7 +15,7 @@ #define A2 6554 #define OmA2 (32768-A2) #define GAIN_VAR 11811 /* in Q31 divided by 2 (Q30) */ const Word16 att_pow_tbl[SIZE_SCALE_TABLE_STEREO + 1] = { 9234, 10361, 13044, 16422, 22669, 31292, 32767, 26634, 28212, 20674, 16422, 27254, 30934, 32767 }; /*-------------------------------------------------------* * CNG_exc() * Loading Loading @@ -962,6 +963,219 @@ void cng_params_upd_fx( return; } #ifdef IVAS_FLOAT_FIXED void cng_params_upd_ivas_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 */ 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 */ , const Word16 element_mode, /* i : Element mode */ const Word16 bwidth /* i : Audio bandwidth */ ) { 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 = 0; Word16 temp_lo_fx, temp_hi_fx; Word16 exp_pow; #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif /* update the pointer to circular buffer of old LSP vectors */ *ho_circ_ptr = add( *ho_circ_ptr, 1 ); 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; move16(); L_ener = L_deposit_l( 0 ); 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 ); #ifdef BASOP_NOGLOB L_tmp = L_mac0_o( L_tmp, tmpv, tmpv, &Overflow ); #else L_tmp = L_mac0( L_tmp, tmpv, tmpv ); #endif pt_exc2++; #ifdef BASOP_NOGLOB L_ener = L_add_o( L_ener, L_shr_o( L_tmp, 7, &Overflow ), &Overflow ); /* Q(2*(Q_exc+scale)+1) ,division by L_frame done here */ #else L_ener = L_add( L_ener, L_shr( L_tmp, 7 ) ); /* Q(2*(Q_exc+scale)+1) ,division by L_frame done here */ #endif } } 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 ); #ifdef BASOP_NOGLOB L_tmp = L_mac0_o( L_tmp, tmpv, tmpv, &Overflow ); #else L_tmp = L_mac0( L_tmp, tmpv, tmpv ); #endif pt_exc2++; #ifdef BASOP_NOGLOB L_ener = L_add_o( L_ener, L_shr_o( Mult_32_16( L_tmp, 26214 /* 256/320, Q15 */ ), 7, &Overflow ), &Overflow ); /* Q(2*(Q_exc+scale)+15+1-16+1) ,division by L_frame done here */ #else L_ener = L_add( L_ener, L_shr( 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 */ #endif } } #ifdef BASOP_NOGLOB L_ener = L_shr_o( L_ener, sub( shl( add( Q_exc, scale ), 1 ), 5 ), &Overflow ); /* Q6 (2*(Q_exc+scale)+1-2*(Q_exc+scale)+5) */ #else /* BASOP_NOGLOB */ L_ener = L_shr( L_ener, sub( shl( add( Q_exc, scale ), 1 ), 5 ) ); /* Q6 (2*(Q_exc+scale)+1-2*(Q_exc+scale)+5) */ #endif /* update the circular buffer of old energies */ ho_ener_circ[*ho_circ_ptr] = L_ener; move32(); IF( EQ_16( enc_dec_flag, ENC ) ) { /* Store residual signal for postponed FFT-processing*/ *cng_buf_cnt = add( *cng_buf_cnt, 1 ); 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; move16(); } 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; */ #ifdef BASOP_NOGLOB L_tmp = L_mult_o( *ptR, *ptR, &Overflow ); /* 2*Q_exc+1 */ L_tmp = L_add_o( L_tmp, L_mult_o( *ptI, *ptI, &Overflow ), &Overflow ); /* 2*Q_exc+1 */ L_tmp = L_add_o( L_tmp, L_tmp, &Overflow ); /* 2*Q_exc+1 */ #else L_tmp = L_mult( *ptR, *ptR ); /* 2*Q_exc+1 */ L_tmp = L_add( L_tmp, L_mult( *ptI, *ptI ) ); /* 2*Q_exc+1 */ L_tmp = L_add( L_tmp, L_tmp ); /* 2*Q_exc+1 */ #endif 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); Word16 shift = 0; if (element_mode == IVAS_SCE || element_mode == IVAS_CPE_DFT) { Word32 att_fx = 0; Word16 index = 0; apply_scale_ivas_fx(&att_fx, bwidth, last_active_brate, scaleTableStereo, SIZE_SCALE_TABLE_STEREO, &index); att_fx = pow_10_q23[index];//Q23 tmp = extract_h(att_fx);//Q7 shift = 8; } else { 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 ); scale_sig32(&(ho_env_circ[(*ho_circ_ptr)*NUM_ENV_CNG]), NUM_ENV_CNG, shift); } *ho_circ_size = add( *ho_circ_size, 1 ); if ( GT_16( *ho_circ_size, HO_HIST_SIZE ) ) { *ho_circ_size = HO_HIST_SIZE; move16(); } return; } #endif // IVAS_FLOAT_FIXED /*---------------------------------------------------------------------* * get_cng_mode() * Loading
lib_com/cnst.h +2 −0 Original line number Diff line number Diff line Loading @@ -2995,6 +2995,8 @@ extern const Word16 Idx2Freq_Tbl[]; #define FS_32K_IN_NS_Q31 68719 #define FS_16K_IN_NS_Q31 34360 #define ONE_BY_THREE_Q15 10923 /* 1/3.f in Q15 */ typedef enum { MCT_CHAN_MODE_REGULAR, Loading