From ffeb27b7a9395e71b2d08ef43af6d9c4373fae0a Mon Sep 17 00:00:00 2001 From: mave2802 <59919483+mave2802@users.noreply.github.com> Date: Tue, 21 Jan 2025 11:13:32 +0100 Subject: [PATCH 001/113] increased accuracy for mixing matrix calculation by using seperate scalefactors for ref_power and cx_diag for each freq band (to avoid holes especially in the upper freq band region) --- lib_dec/ivas_ism_param_dec.c | 91 ++++++++++++------------------------ 1 file changed, 31 insertions(+), 60 deletions(-) diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index 9514e5e2a..5eaae88fe 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -177,25 +177,17 @@ static void ivas_param_ism_collect_slot_fx( Word16 exp_imag, const Word16 ch, Word32 ref_power_fx[], /*Q(31-exp_ref_power)*/ - Word16 *exp_ref_power, + Word16 exp_ref_power[], Word32 cx_diag_fx[][PARAM_ISM_MAX_DMX], /*Q(31-exp_cx_diag)*/ - Word16 *exp_cx_diag ) + Word16 exp_cx_diag[][PARAM_ISM_MAX_DMX] ) { Word16 band_idx, bin_idx; Word16 brange[2]; Word32 tmp_fx; Word16 exp_tmp; - Word16 i, j; /* loop over parameter bands to collect transport channel energies */ - Word16 exp_ref_power_buf[CLDFB_NO_CHANNELS_MAX]; - Word16 exp_cx_diag_buf[CLDFB_NO_CHANNELS_MAX][PARAM_ISM_MAX_DMX]; - set16_fx( exp_ref_power_buf, *exp_ref_power, CLDFB_NO_CHANNELS_MAX ); - FOR( i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ ) - { - set16_fx( exp_cx_diag_buf[i], *exp_cx_diag, PARAM_ISM_MAX_DMX ); - } FOR( band_idx = 0; band_idx < hParamIsmDec->hParamIsm->nbands; band_idx++ ) { brange[0] = hParamIsmDec->hParamIsm->band_grouping[band_idx]; @@ -216,50 +208,19 @@ static void ivas_param_ism_collect_slot_fx( Word16 exp_cx_diag_new = 0, exp_ref_power_new = 0; move16(); move16(); - cx_diag_fx[bin_idx][ch] = BASOP_Util_Add_Mant32Exp( cx_diag_fx[bin_idx][ch], exp_cx_diag_buf[bin_idx][ch], tmp_fx, exp_tmp, &exp_cx_diag_new ); + cx_diag_fx[bin_idx][ch] = BASOP_Util_Add_Mant32Exp( cx_diag_fx[bin_idx][ch], exp_cx_diag[bin_idx][ch], tmp_fx, exp_tmp, &exp_cx_diag_new ); move32(); - ref_power_fx[bin_idx] = BASOP_Util_Add_Mant32Exp( ref_power_fx[bin_idx], exp_ref_power_buf[bin_idx], tmp_fx, exp_tmp, &exp_ref_power_new ); + ref_power_fx[bin_idx] = BASOP_Util_Add_Mant32Exp( ref_power_fx[bin_idx], exp_ref_power[bin_idx], tmp_fx, exp_tmp, &exp_ref_power_new ); move32(); - exp_cx_diag_buf[bin_idx][ch] = exp_cx_diag_new; + exp_cx_diag[bin_idx][ch] = exp_cx_diag_new; move16(); - exp_ref_power_buf[bin_idx] = exp_ref_power_new; + exp_ref_power[bin_idx] = exp_ref_power_new; move16(); } } - - /*make common exponent*/ - Word16 max_exp_cx_diag = exp_cx_diag_buf[0][0], max_exp_ref_power = exp_ref_power_buf[0]; - move16(); - move16(); - FOR( i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ ) - { - FOR( j = 0; j < PARAM_ISM_MAX_DMX; j++ ) - { - max_exp_cx_diag = s_max( max_exp_cx_diag, exp_cx_diag_buf[i][j] ); - } - max_exp_ref_power = s_max( max_exp_ref_power, exp_ref_power_buf[i] ); - } - - FOR( i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ ) - { - FOR( j = 0; j < PARAM_ISM_MAX_DMX; j++ ) - { - cx_diag_fx[i][j] = L_shr_r( cx_diag_fx[i][j], sub( max_exp_cx_diag, exp_cx_diag_buf[i][j] ) ); // Q(31-max_exp_cx_diag) - move32(); - } - ref_power_fx[i] = L_shr_r( ref_power_fx[i], sub( max_exp_ref_power, exp_ref_power_buf[i] ) ); // Q(31-max_exp_ref_power) - move16(); - } - - *exp_cx_diag = max_exp_cx_diag; - move16(); - *exp_ref_power = max_exp_ref_power; - move16(); - return; } - static void ivas_param_ism_compute_mixing_matrix_fx( const Word16 nchan_ism, /* i : number of ISM channels */ PARAM_ISM_DEC_HANDLE hParamIsmDec, /* i/o: decoder ParamISM handle */ @@ -268,9 +229,9 @@ static void ivas_param_ism_compute_mixing_matrix_fx( const Word16 nchan_transport, const Word16 nchan_out_woLFE, Word32 cx_diag_fx[][PARAM_ISM_MAX_DMX], /*Q(31-cx_diag_e)*/ - Word16 cx_diag_e, + Word16 cx_diag_e[][PARAM_ISM_MAX_DMX], Word32 ref_power_fx[], /*Q(31-ref_power_e)*/ - Word16 ref_power_e, + Word16 ref_power_e[], Word32 mixing_matrix_fx[CLDFB_NO_CHANNELS_MAX][PARAM_ISM_MAX_CHAN * PARAM_ISM_MAX_DMX], /*Q(31-mixing_matrix_e)*/ Word16 mixing_matrix_e[CLDFB_NO_CHANNELS_MAX] ) { @@ -367,10 +328,10 @@ static void ivas_param_ism_compute_mixing_matrix_fx( } ELSE { - direct_power_fx[w] = Mpy_32_16_1( ref_power_fx[bin_idx], hParamIsmDec->power_ratios_fx[band_idx][0][w] ); // Q(31-ref_power_e) + direct_power_fx[w] = Mpy_32_16_1( ref_power_fx[bin_idx], hParamIsmDec->power_ratios_fx[band_idx][0][w] ); // Q(31-ref_power_e[bin_idx]) move32(); } - direct_power_e = ref_power_e; + direct_power_e = ref_power_e[bin_idx]; move16(); IF( direct_power_fx[w] != 0 ) { @@ -409,8 +370,20 @@ static void ivas_param_ism_compute_mixing_matrix_fx( move32(); } + /* equal cx diag exponents */ + Word16 max_exp_cx_diag = cx_diag_e[bin_idx][0]; + Word32 cx_diag_eq_exp_fx[PARAM_ISM_MAX_DMX]; + FOR( i = 1; i < PARAM_ISM_MAX_DMX; i++ ) + { + max_exp_cx_diag = s_max( max_exp_cx_diag, cx_diag_e[bin_idx][i] ); + } + FOR( i = 0; i < PARAM_ISM_MAX_DMX; i++ ) + { + cx_diag_eq_exp_fx[i] = L_shr_r( cx_diag_fx[bin_idx][i], sub( max_exp_cx_diag, cx_diag_e[bin_idx][i] ) ); // Q(31-max_exp_cx_diag) + } + /* Compute mixing matrix */ - computeMixingMatricesISM_fx( nchan_transport, num_wave, nchan_out_woLFE, response_matrix_fx, response_matrix_e, direct_power_fx, direct_power_e, cx_diag_fx[bin_idx], cx_diag_e, cy_diag_fx, cy_diag_e, proto_matrix_fx, 1, + computeMixingMatricesISM_fx( nchan_transport, num_wave, nchan_out_woLFE, response_matrix_fx, response_matrix_e, direct_power_fx, direct_power_e, cx_diag_eq_exp_fx, max_exp_cx_diag, cy_diag_fx, cy_diag_e, proto_matrix_fx, 1, PARAM_MC_REG_SX_FX, PARAM_MC_REG_GHAT_FX, mixing_matrix_fx[bin_idx], &mixing_matrix_e[bin_idx] ); } } @@ -1070,7 +1043,6 @@ void ivas_param_ism_dec_digest_tc_fx( Word32 *transport_channels[], /* i : synthesized core-coder transport channels/DirAC output q_tc_in*/ Word16 q_tc_in ) { - Word16 exp_ref_power = 31, exp_cx_diag = 31; Word16 exp_real_tmp = 0, exp_imag_tmp = 0; move16(); move16(); @@ -1078,6 +1050,9 @@ void ivas_param_ism_dec_digest_tc_fx( move16(); Word32 ref_power_fx[CLDFB_NO_CHANNELS_MAX]; Word32 cx_diag_fx[CLDFB_NO_CHANNELS_MAX][PARAM_ISM_MAX_DMX]; + Word16 exp_ref_power[CLDFB_NO_CHANNELS_MAX]; + Word16 exp_cx_diag[CLDFB_NO_CHANNELS_MAX][PARAM_ISM_MAX_DMX]; + Word16 q_tc = q_tc_in; move16(); Word16 ch, nchan_transport, nchan_out, nchan_out_woLFE, i; @@ -1132,15 +1107,11 @@ void ivas_param_ism_dec_digest_tc_fx( ivas_dirac_dec_set_md_map_fx( st_ivas, nCldfbSlots ); /* set buffers to zero */ - FOR( bin_idx = 0; bin_idx < CLDFB_NO_CHANNELS_MAX; bin_idx++ ) - { - set_zero_fx( cx_diag_fx[bin_idx], PARAM_ISM_MAX_DMX ); - } - exp_cx_diag = 0; - move16(); + set_zero_fx(&cx_diag_fx[0][0], CLDFB_NO_CHANNELS_MAX * PARAM_ISM_MAX_DMX); + set16_zero_fx(&exp_cx_diag[0][0], CLDFB_NO_CHANNELS_MAX * PARAM_ISM_MAX_DMX); + set_zero_fx( ref_power_fx, CLDFB_NO_CHANNELS_MAX ); - exp_ref_power = 0; - move16(); + set16_zero_fx(&exp_ref_power[0], CLDFB_NO_CHANNELS_MAX); /* Frame-level Processing */ /* De-quantization */ @@ -1269,7 +1240,7 @@ void ivas_param_ism_dec_digest_tc_fx( &hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc_fx[current_idx], exp_imag_tmp, ch, - ref_power_fx, &exp_ref_power, cx_diag_fx, &exp_cx_diag ); + ref_power_fx, exp_ref_power, cx_diag_fx, exp_cx_diag ); exp_real_tmp = add( exp_real_tmp, scale_factor_real ); exp_imag_tmp = add( exp_imag_tmp, scale_factor_imag ); -- GitLab From d9b2947a16fb0a0730687088c92cfc13f181b001 Mon Sep 17 00:00:00 2001 From: mave2802 <59919483+mave2802@users.noreply.github.com> Date: Tue, 21 Jan 2025 13:26:20 +0100 Subject: [PATCH 002/113] complexity reductions --- lib_dec/ivas_ism_param_dec.c | 65 +++++++++++++++++------------------- 1 file changed, 31 insertions(+), 34 deletions(-) diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index 5eaae88fe..10f384638 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -176,8 +176,6 @@ static void ivas_param_ism_collect_slot_fx( Word32 *Cldfb_ImagBuffer_in_fx, /*Q(31-exp_imag)*/ Word16 exp_imag, const Word16 ch, - Word32 ref_power_fx[], /*Q(31-exp_ref_power)*/ - Word16 exp_ref_power[], Word32 cx_diag_fx[][PARAM_ISM_MAX_DMX], /*Q(31-exp_cx_diag)*/ Word16 exp_cx_diag[][PARAM_ISM_MAX_DMX] ) { @@ -205,17 +203,13 @@ static void ivas_param_ism_collect_slot_fx( tmp_fx = BASOP_Util_Add_Mant32Exp( tmp_fx, exp_tmp, var1, add( exp_real, exp_real ), &exp_tmp ); tmp_fx = BASOP_Util_Add_Mant32Exp( tmp_fx, exp_tmp, var2, add( exp_imag, exp_imag ), &exp_tmp ); - Word16 exp_cx_diag_new = 0, exp_ref_power_new = 0; + Word16 exp_cx_diag_new; move16(); move16(); cx_diag_fx[bin_idx][ch] = BASOP_Util_Add_Mant32Exp( cx_diag_fx[bin_idx][ch], exp_cx_diag[bin_idx][ch], tmp_fx, exp_tmp, &exp_cx_diag_new ); move32(); - ref_power_fx[bin_idx] = BASOP_Util_Add_Mant32Exp( ref_power_fx[bin_idx], exp_ref_power[bin_idx], tmp_fx, exp_tmp, &exp_ref_power_new ); - move32(); exp_cx_diag[bin_idx][ch] = exp_cx_diag_new; move16(); - exp_ref_power[bin_idx] = exp_ref_power_new; - move16(); } } return; @@ -230,8 +224,6 @@ static void ivas_param_ism_compute_mixing_matrix_fx( const Word16 nchan_out_woLFE, Word32 cx_diag_fx[][PARAM_ISM_MAX_DMX], /*Q(31-cx_diag_e)*/ Word16 cx_diag_e[][PARAM_ISM_MAX_DMX], - Word32 ref_power_fx[], /*Q(31-ref_power_e)*/ - Word16 ref_power_e[], Word32 mixing_matrix_fx[CLDFB_NO_CHANNELS_MAX][PARAM_ISM_MAX_CHAN * PARAM_ISM_MAX_DMX], /*Q(31-mixing_matrix_e)*/ Word16 mixing_matrix_e[CLDFB_NO_CHANNELS_MAX] ) { @@ -304,6 +296,27 @@ static void ivas_param_ism_compute_mixing_matrix_fx( set32_fx( cy_diag_fx, 0, nchan_out_woLFE ); set16_fx( cy_diag_e_arr, 0, nchan_out_woLFE ); + + /* equal cx diag exponents, compute ref power from cx_diag*/ + Word16 max_exp_cx_diag; + Word32 cx_diag_eq_exp_fx[PARAM_ISM_MAX_DMX]; + Word32 ref_power_fx; + Word16 ref_power_e, ref_power_e_new; + ref_power_fx = cx_diag_fx[bin_idx][0]; + ref_power_e = cx_diag_e[bin_idx][0]; + + FOR( i = 1; i < PARAM_ISM_MAX_DMX; i++ ) + { + ref_power_fx = BASOP_Util_Add_Mant32Exp( ref_power_fx, ref_power_e, cx_diag_fx[bin_idx][i], cx_diag_e[bin_idx][i], &ref_power_e_new ); + ref_power_e = ref_power_e_new; + } + max_exp_cx_diag = ref_power_e; + FOR( i = 0; i < PARAM_ISM_MAX_DMX; i++ ) + { + cx_diag_eq_exp_fx[i] = L_shr_r( cx_diag_fx[bin_idx][i], sub( max_exp_cx_diag, cx_diag_e[bin_idx][i] ) ); // Q(31-max_exp_cx_diag) + } + + FOR( w = 0; w < num_wave; w++ ) { test(); @@ -313,25 +326,26 @@ static void ivas_param_ism_compute_mixing_matrix_fx( SWITCH( nchan_ism ) { case 2: - direct_power_fx[w] = L_shr_r( ref_power_fx[bin_idx], 1 ); + direct_power_fx[w] = L_shr_r( ref_power_fx, 1 ); move32(); BREAK; case 3: - direct_power_fx[w] = Mpy_32_16_1( ref_power_fx[bin_idx], 10923 ); // 10923 = 1/3f in Q15 + direct_power_fx[w] = Mpy_32_16_1( ref_power_fx, 10923 ); // 10923 = 1/3f in Q15 move32(); BREAK; case 4: - direct_power_fx[w] = L_shr_r( ref_power_fx[bin_idx], 2 ); + direct_power_fx[w] = L_shr_r( ref_power_fx, 2 ); move32(); BREAK; } } ELSE { - direct_power_fx[w] = Mpy_32_16_1( ref_power_fx[bin_idx], hParamIsmDec->power_ratios_fx[band_idx][0][w] ); // Q(31-ref_power_e[bin_idx]) + direct_power_fx[w] = Mpy_32_16_1( ref_power_fx, hParamIsmDec->power_ratios_fx[band_idx][0][w] ); // Q(31-ref_power_e[bin_idx]) move32(); } - direct_power_e = ref_power_e[bin_idx]; + //direct_power_e = ref_power_e[bin_idx]; + direct_power_e = ref_power_e; move16(); IF( direct_power_fx[w] != 0 ) { @@ -370,18 +384,6 @@ static void ivas_param_ism_compute_mixing_matrix_fx( move32(); } - /* equal cx diag exponents */ - Word16 max_exp_cx_diag = cx_diag_e[bin_idx][0]; - Word32 cx_diag_eq_exp_fx[PARAM_ISM_MAX_DMX]; - FOR( i = 1; i < PARAM_ISM_MAX_DMX; i++ ) - { - max_exp_cx_diag = s_max( max_exp_cx_diag, cx_diag_e[bin_idx][i] ); - } - FOR( i = 0; i < PARAM_ISM_MAX_DMX; i++ ) - { - cx_diag_eq_exp_fx[i] = L_shr_r( cx_diag_fx[bin_idx][i], sub( max_exp_cx_diag, cx_diag_e[bin_idx][i] ) ); // Q(31-max_exp_cx_diag) - } - /* Compute mixing matrix */ computeMixingMatricesISM_fx( nchan_transport, num_wave, nchan_out_woLFE, response_matrix_fx, response_matrix_e, direct_power_fx, direct_power_e, cx_diag_eq_exp_fx, max_exp_cx_diag, cy_diag_fx, cy_diag_e, proto_matrix_fx, 1, PARAM_MC_REG_SX_FX, PARAM_MC_REG_GHAT_FX, mixing_matrix_fx[bin_idx], &mixing_matrix_e[bin_idx] ); @@ -1048,9 +1050,7 @@ void ivas_param_ism_dec_digest_tc_fx( move16(); move16(); move16(); - Word32 ref_power_fx[CLDFB_NO_CHANNELS_MAX]; - Word32 cx_diag_fx[CLDFB_NO_CHANNELS_MAX][PARAM_ISM_MAX_DMX]; - Word16 exp_ref_power[CLDFB_NO_CHANNELS_MAX]; + Word32 cx_diag_fx[CLDFB_NO_CHANNELS_MAX][PARAM_ISM_MAX_DMX]; Word16 exp_cx_diag[CLDFB_NO_CHANNELS_MAX][PARAM_ISM_MAX_DMX]; Word16 q_tc = q_tc_in; @@ -1110,9 +1110,6 @@ void ivas_param_ism_dec_digest_tc_fx( set_zero_fx(&cx_diag_fx[0][0], CLDFB_NO_CHANNELS_MAX * PARAM_ISM_MAX_DMX); set16_zero_fx(&exp_cx_diag[0][0], CLDFB_NO_CHANNELS_MAX * PARAM_ISM_MAX_DMX); - set_zero_fx( ref_power_fx, CLDFB_NO_CHANNELS_MAX ); - set16_zero_fx(&exp_ref_power[0], CLDFB_NO_CHANNELS_MAX); - /* Frame-level Processing */ /* De-quantization */ test(); @@ -1240,7 +1237,7 @@ void ivas_param_ism_dec_digest_tc_fx( &hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc_fx[current_idx], exp_imag_tmp, ch, - ref_power_fx, exp_ref_power, cx_diag_fx, exp_cx_diag ); + cx_diag_fx, exp_cx_diag ); exp_real_tmp = add( exp_real_tmp, scale_factor_real ); exp_imag_tmp = add( exp_imag_tmp, scale_factor_imag ); @@ -1255,7 +1252,7 @@ void ivas_param_ism_dec_digest_tc_fx( } /* Compute mixing matrix */ - ivas_param_ism_compute_mixing_matrix_fx( st_ivas->nchan_ism, hParamIsmDec, st_ivas->hISMDTX, direct_response_fx, nchan_transport, nchan_out_woLFE, cx_diag_fx, exp_cx_diag, ref_power_fx, exp_ref_power, + ivas_param_ism_compute_mixing_matrix_fx( st_ivas->nchan_ism, hParamIsmDec, st_ivas->hISMDTX, direct_response_fx, nchan_transport, nchan_out_woLFE, cx_diag_fx, exp_cx_diag, hParamIsmDec->hParamIsmRendering->mixing_matrix_lin_fx, hParamIsmDec->hParamIsmRendering->exp_mixing_matrix_lin_fx ); pop_wmops(); -- GitLab From d86fd6130c852a67591e3fcf320433f11a4a3956 Mon Sep 17 00:00:00 2001 From: mave2802 <59919483+mave2802@users.noreply.github.com> Date: Thu, 23 Jan 2025 09:20:03 +0100 Subject: [PATCH 003/113] clang format --- lib_dec/ivas_ism_param_dec.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index 10f384638..c7fce8dd5 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -344,7 +344,7 @@ static void ivas_param_ism_compute_mixing_matrix_fx( direct_power_fx[w] = Mpy_32_16_1( ref_power_fx, hParamIsmDec->power_ratios_fx[band_idx][0][w] ); // Q(31-ref_power_e[bin_idx]) move32(); } - //direct_power_e = ref_power_e[bin_idx]; + // direct_power_e = ref_power_e[bin_idx]; direct_power_e = ref_power_e; move16(); IF( direct_power_fx[w] != 0 ) @@ -1050,8 +1050,8 @@ void ivas_param_ism_dec_digest_tc_fx( move16(); move16(); move16(); - Word32 cx_diag_fx[CLDFB_NO_CHANNELS_MAX][PARAM_ISM_MAX_DMX]; - Word16 exp_cx_diag[CLDFB_NO_CHANNELS_MAX][PARAM_ISM_MAX_DMX]; + Word32 cx_diag_fx[CLDFB_NO_CHANNELS_MAX][PARAM_ISM_MAX_DMX]; + Word16 exp_cx_diag[CLDFB_NO_CHANNELS_MAX][PARAM_ISM_MAX_DMX]; Word16 q_tc = q_tc_in; move16(); @@ -1107,8 +1107,8 @@ void ivas_param_ism_dec_digest_tc_fx( ivas_dirac_dec_set_md_map_fx( st_ivas, nCldfbSlots ); /* set buffers to zero */ - set_zero_fx(&cx_diag_fx[0][0], CLDFB_NO_CHANNELS_MAX * PARAM_ISM_MAX_DMX); - set16_zero_fx(&exp_cx_diag[0][0], CLDFB_NO_CHANNELS_MAX * PARAM_ISM_MAX_DMX); + set_zero_fx( &cx_diag_fx[0][0], CLDFB_NO_CHANNELS_MAX * PARAM_ISM_MAX_DMX ); + set16_zero_fx( &exp_cx_diag[0][0], CLDFB_NO_CHANNELS_MAX * PARAM_ISM_MAX_DMX ); /* Frame-level Processing */ /* De-quantization */ -- GitLab From b9a68dac1db96f835c597b26b4cc05ce49219174 Mon Sep 17 00:00:00 2001 From: Erik Norvell Date: Thu, 23 Jan 2025 16:49:02 +0100 Subject: [PATCH 004/113] Add manual job for PEAQ encoder passthrough --- .gitlab-ci.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f62acb284..f9c890019 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -47,6 +47,7 @@ variables: - 'complexity' - 'coverage' - 'voip-be-test' + - 'peaq-enc-passthrough' default: @@ -95,6 +96,9 @@ workflow: - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'voip-be-test' variables: IVAS_PIPELINE_NAME: 'Voip BE test on $CI_COMMIT_BRANCH' + - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == 'peaq-enc-passthrough' + variables: + IVAS_PIPELINE_NAME: 'PEAQ encoder pass-through test: $CI_COMMIT_BRANCH' - if: $CI_PIPELINE_SOURCE == 'schedule' # Scheduled in any branch variables: IVAS_PIPELINE_NAME: 'Scheduled pipeline: $CI_COMMIT_BRANCH' @@ -1172,6 +1176,16 @@ ivas-pytest-renderer: - LEVEL_SCALING=1.0 <<: *ivas-pytest-anchor +peaq-enc-passthrough: + extends: + - .test-job-linux + rules: + - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == "peaq-enc-passthrough" + before_script: + - USE_LTV=0 + - TEST_SUITE="tests/test_enc_passthrough.py" + - LEVEL_SCALING=1.0 + <<: *ivas-pytest-anchor # --------------------------------------------------------------- # Various other tests -- GitLab From 5c80b92c1fb1f92bcfa72e03d08e28c7627559bf Mon Sep 17 00:00:00 2001 From: Erik Norvell Date: Thu, 23 Jan 2025 19:49:19 +0100 Subject: [PATCH 005/113] Fix in peaq-enc-passthrough --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f9c890019..9a9e1efb5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1183,6 +1183,7 @@ peaq-enc-passthrough: - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == "peaq-enc-passthrough" before_script: - USE_LTV=0 + - DUT_DECODER_PATH=./$REF_DECODER_PATH - TEST_SUITE="tests/test_enc_passthrough.py" - LEVEL_SCALING=1.0 <<: *ivas-pytest-anchor -- GitLab From d9575b5e78594cc6147889de70ebdd76cfccb1ed Mon Sep 17 00:00:00 2001 From: norvell Date: Thu, 30 Jan 2025 09:09:38 +0000 Subject: [PATCH 006/113] Set BASOP_CI_BRANCH_PC_REPO: "ci/bring-back-per-channel-odg" for testing of both PEAQ measurements in parallel --- .gitlab-ci.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9a9e1efb5..ebf6a3e91 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -19,7 +19,7 @@ variables: REF_DECODER_PATH: "./IVAS_dec_ref" LEVEL_SCALING: "1.0" IVAS_PIPELINE_NAME: '' - BASOP_CI_BRANCH_PC_REPO: "basop-ci-branch" + BASOP_CI_BRANCH_PC_REPO: "ci/bring-back-per-channel-odg" PRM_FILES: "scripts/config/self_test.prm scripts/config/self_test_ltv.prm" TESTCASE_TIMEOUT_STV: 900 TESTCASE_TIMEOUT_LTV: 2400 @@ -32,6 +32,7 @@ variables: INSTR_DIR: "scripts/c-code_instrument" BUILD_WITH_DEBUG_MODE_INFO: "" ENCODER_TEST: "" + DELTA_ODG: "" MANUAL_PIPELINE_TYPE: description: "Type for the manual pipeline run. Use 'pytest-compare' to run comparison test against reference float codec." value: 'default' @@ -314,9 +315,13 @@ stages: - *build-and-create-reference-outputs - comp_args="--mld --ssnr --odg" + - summary_args="MLD DIFF SSNR ODG" - if [ "$ENCODER_TEST" = "true" ]; then comp_args="${comp_args} --enc_stats"; fi + - if [ "$DELTA_ODG" = "true" ]; then comp_args="${comp_args} --odg_bin"; summary_args="${summary_args} DELTA_ODG";fi - echo "$comp_args" + + ### run pytest - exit_code=0 - python3 -m pytest --tb=no $TEST_SUITE -v --create_cut --html=report.html --self-contained-html --junit-xml=report-junit.xml $comp_args -n auto --testcase_timeout $testcase_timeout --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH || exit_code=$? @@ -324,7 +329,7 @@ stages: - python3 scripts/parse_xml_report.py report-junit.xml $CSV_ARTIFACT_NAME - mkdir $IMAGES_ARTIFACT_NAME - - for MEASURE in MLD DIFF SSNR ODG;do python3 scripts/create_histogram_summary.py $CSV_ARTIFACT_NAME $IMAGES_ARTIFACT_NAME/summary_"$MEASURE".csv $IMAGES_ARTIFACT_NAME/summary_"$MEASURE".png --measure $MEASURE; done + - for MEASURE in $summary_args;do python3 scripts/create_histogram_summary.py $CSV_ARTIFACT_NAME $IMAGES_ARTIFACT_NAME/summary_"$MEASURE".csv $IMAGES_ARTIFACT_NAME/summary_"$MEASURE".png --measure $MEASURE; done - python3 ci/basop-pages/create_summary_page.py $SUMMARY_HTML_ARTIFACT_NAME $CI_JOB_ID $CI_JOB_NAME - if [ $USE_LTV -eq 1 ] && [ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]; then @@ -1185,6 +1190,7 @@ peaq-enc-passthrough: - USE_LTV=0 - DUT_DECODER_PATH=./$REF_DECODER_PATH - TEST_SUITE="tests/test_enc_passthrough.py" + - DELTA_ODG="true" - LEVEL_SCALING=1.0 <<: *ivas-pytest-anchor -- GitLab From bd35dc1b3f7602aec02ac9577a04d2cbd8c1fc70 Mon Sep 17 00:00:00 2001 From: Erik Norvell Date: Thu, 30 Jan 2025 12:40:22 +0100 Subject: [PATCH 007/113] Fix for parse_xml_report.py call --- .gitlab-ci.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ebf6a3e91..3c912285e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -316,18 +316,17 @@ stages: - comp_args="--mld --ssnr --odg" - summary_args="MLD DIFF SSNR ODG" + - ="" - if [ "$ENCODER_TEST" = "true" ]; then comp_args="${comp_args} --enc_stats"; fi - - if [ "$DELTA_ODG" = "true" ]; then comp_args="${comp_args} --odg_bin"; summary_args="${summary_args} DELTA_ODG";fi + - if [ "$DELTA_ODG" = "true" ]; then comp_args="${comp_args} --odg_bin"; summary_args="${summary_args} DELTA_ODG"; REPORT_ARG="--delta_odg"; fi - echo "$comp_args" - - ### run pytest - exit_code=0 - python3 -m pytest --tb=no $TEST_SUITE -v --create_cut --html=report.html --self-contained-html --junit-xml=report-junit.xml $comp_args -n auto --testcase_timeout $testcase_timeout --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH || exit_code=$? - zero_errors=$(cat report-junit.xml | grep -c 'errors="0"') || true - - python3 scripts/parse_xml_report.py report-junit.xml $CSV_ARTIFACT_NAME + - python3 scripts/parse_xml_report.py report-junit.xml $CSV_ARTIFACT_NAME $REPORT_ARG - mkdir $IMAGES_ARTIFACT_NAME - for MEASURE in $summary_args;do python3 scripts/create_histogram_summary.py $CSV_ARTIFACT_NAME $IMAGES_ARTIFACT_NAME/summary_"$MEASURE".csv $IMAGES_ARTIFACT_NAME/summary_"$MEASURE".png --measure $MEASURE; done - python3 ci/basop-pages/create_summary_page.py $SUMMARY_HTML_ARTIFACT_NAME $CI_JOB_ID $CI_JOB_NAME -- GitLab From f10b357e0b4c0bd06d7eb5d70863708e968ecb9d Mon Sep 17 00:00:00 2001 From: Erik Norvell Date: Thu, 30 Jan 2025 12:54:23 +0100 Subject: [PATCH 008/113] Fix syntax error --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3c912285e..d5f6294f8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -316,7 +316,7 @@ stages: - comp_args="--mld --ssnr --odg" - summary_args="MLD DIFF SSNR ODG" - - ="" + - REPORT_ARG="" - if [ "$ENCODER_TEST" = "true" ]; then comp_args="${comp_args} --enc_stats"; fi - if [ "$DELTA_ODG" = "true" ]; then comp_args="${comp_args} --odg_bin"; summary_args="${summary_args} DELTA_ODG"; REPORT_ARG="--delta_odg"; fi - echo "$comp_args" -- GitLab From 06f8a2cd5f208feffe98ce79b876af5b84cbc3b9 Mon Sep 17 00:00:00 2001 From: Erik Norvell Date: Thu, 30 Jan 2025 15:51:35 +0100 Subject: [PATCH 009/113] Reset BASOP_CI_BRANCH_PC_REPO: basop-ci-branch --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d5f6294f8..3d41cc11d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -19,7 +19,7 @@ variables: REF_DECODER_PATH: "./IVAS_dec_ref" LEVEL_SCALING: "1.0" IVAS_PIPELINE_NAME: '' - BASOP_CI_BRANCH_PC_REPO: "ci/bring-back-per-channel-odg" + BASOP_CI_BRANCH_PC_REPO: "basop-ci-branch" PRM_FILES: "scripts/config/self_test.prm scripts/config/self_test_ltv.prm" TESTCASE_TIMEOUT_STV: 900 TESTCASE_TIMEOUT_LTV: 2400 -- GitLab From 8d14bce5907700aa296db9634ad20e093adc309f Mon Sep 17 00:00:00 2001 From: ber Date: Thu, 6 Feb 2025 13:03:40 +0100 Subject: [PATCH 010/113] some push/pop wmops added, also addedd FIX_1072_SPEEDUP_gainpanning and FIX_1072_SPEEDUP_COMPUTEDIFUSENESSB active --- lib_com/ivas_dirac_com.c | 51 +++++++++++++ lib_com/options.h | 6 +- lib_dec/ivas_dirac_dec.c | 23 ++++-- lib_rend/ivas_dirac_output_synthesis_dec.c | 89 +++++++++++++++++++++- 4 files changed, 160 insertions(+), 9 deletions(-) diff --git a/lib_com/ivas_dirac_com.c b/lib_com/ivas_dirac_com.c index ebd958e1b..796fc8960 100644 --- a/lib_com/ivas_dirac_com.c +++ b/lib_com/ivas_dirac_com.c @@ -960,6 +960,7 @@ void computeDiffuseness_fixed( q_intensity = add( q_factor_intensity[0], min_q_shift2 ); move16(); + push_wmops( "(IDR) LOOP1 DirACparams computeDiffuseness B <<-|" ); FOR( i = 0; i < DIRAC_NO_COL_AVG_DIFF; ++i ) { /* Energy slow */ @@ -967,6 +968,28 @@ void computeDiffuseness_fixed( q_tmp = add( q_factor_energy[i], min_q_shift1 ); + +#ifdef FIX_1072_SPEEDUP_COMPUTEDIFUSENESSB + Word16 shift_q = sub( q_tmp, q_ene ); + Word32 shiftEquiv; + Word16 shift_qtotal; + if( shift_q < 0 ) + { + shiftEquiv = L_lshl( 0x80000000, shift_q ); + shift_qtotal = sub( min_q_shift1, 0 ); + } + if( shift_q >= 0 ) + { + shiftEquiv = L_add( 0x7FFFFFFF, 0 ); + shift_qtotal = sub( min_q_shift1, shift_q ); + } + FOR( k = 0; k < num_freq_bands; k++ ) + { + tmp = L_shl( p_tmp_c[k], shift_qtotal ); + energy_slow[k] = Madd_32_32_r( tmp, energy_slow[k], shiftEquiv ); + move32(); + } +#else Word16 shift_q = sub( q_tmp, q_ene ); IF( shift_q < 0 ) { @@ -986,6 +1009,9 @@ void computeDiffuseness_fixed( move32(); } } +#endif + + q_ene = s_min( q_ene, q_tmp ); @@ -993,6 +1019,28 @@ void computeDiffuseness_fixed( q_tmp = add( q_factor_intensity[i], min_q_shift2 ); shift_q = sub( q_tmp, q_intensity ); +#ifdef FIX_1072_SPEEDUP_COMPUTEDIFUSENESSB + if( shift_q >= 0 ) + { + shiftEquiv = L_lshl( 0x7FFFFFFF, 0 ); + shift_qtotal = sub( min_q_shift2, shift_q ); + } + if ( shift_q < 0 ) + { + shiftEquiv = L_lshl( 0x80000000, shift_q ); + shift_qtotal = sub( min_q_shift2, 0 ); + } + FOR( j = 0; j < DIRAC_NUM_DIMS; ++j ) + { + p_tmp = buffer_intensity[j][i]; + FOR( k = 0; k < num_freq_bands; k++ ) + { + tmp = L_shl( p_tmp[k], shift_qtotal ); + intensity_slow[j * num_freq_bands + k] = Madd_32_32_r( tmp, intensity_slow[j * num_freq_bands + k], shiftEquiv ); + move32(); + } + } +#else IF( shift_q > 0 ) { FOR( j = 0; j < DIRAC_NUM_DIMS; ++j ) @@ -1019,8 +1067,11 @@ void computeDiffuseness_fixed( } } } +#endif + q_intensity = s_min( q_intensity, q_tmp ); } + pop_wmops(); /*push_wmops( "(IDR) LOOP1 DirACparams computeDiffuseness B <<-|" );/*/ min_q_shift1 = getScaleFactor32( intensity_slow, i_mult( DIRAC_NUM_DIMS, num_freq_bands ) ); min_q_shift1 = sub( min_q_shift1, idiv1616( add( find_guarded_bits_fx( DIRAC_NUM_DIMS ), 1 ), 2 ) ); diff --git a/lib_com/options.h b/lib_com/options.h index fa1fd8f4e..5dfebfaa6 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -56,7 +56,7 @@ #define SUPPORT_JBM_TRACEFILE /* Support for JBM tracefile, which is needed for 3GPP objective/subjective testing, but not relevant for real-world implementations */ -/*#define WMOPS*/ /* Activate complexity and memory counters */ +//#define WMOPS /* Activate complexity and memory counters */ #ifdef WMOPS /*#define WMOPS_PER_FRAME*/ /* Output per-frame complexity (writes one float value per frame to the file "wmops_analysis") */ /*#define WMOPS_DETAIL*/ /* Output detailed complexity printout for every function. Increases runtime overhead */ @@ -153,3 +153,7 @@ #define FIX_881_HILBERT_FILTER /* VA: improve the precision of the Hilbert filter to remove 2kHz unwanted tone */ #endif #define FIX_MINOR_SVD_WMOPS_MR1010X /* FhG: Minor WMOPS tuning, bit-exact to previous version, saves about 8.2 WMOPS for MR1010 */ + + +#define FIX_1072_SPEEDUP_gainpanning /* FhG: WMOPS tuning, in development*/ +#define FIX_1072_SPEEDUP_COMPUTEDIFUSENESSB /* "-" */ \ No newline at end of file diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 95cca12a0..318a3ec55 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -2231,7 +2231,7 @@ void ivas_dirac_dec_render_sf_fx( move16(); Word16 tmp1; - push_wmops( "ivas_dirac_dec_render" ); + push_wmops( "ivas_dirac_dec_render (IDR)" ); /* Initialize aux buffers */ hDirAC = st_ivas->hDirAC; @@ -2341,6 +2341,7 @@ void ivas_dirac_dec_render_sf_fx( } ELSE IF( !( EQ_16( st_ivas->ivas_format, SBA_FORMAT ) || EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) ) { + push_wmops( "(IDR) SBA_FORMAT | SBA_ISM_FORMAT" ); Word16 outchannels; idx_lfe = 0; move16(); @@ -2409,6 +2410,7 @@ void ivas_dirac_dec_render_sf_fx( } } } + pop_wmops(); /*push_wmops( "(IDR) SBA_FORMAT | SBA_ISM_FORMAT" );*/ } size = imult1616( hDirACRend->num_outputs_dir, hSpatParamRendCom->num_freq_bands ); @@ -2555,7 +2557,7 @@ void ivas_dirac_dec_render_sf_fx( p_Rmat_fx = 0; move32(); } - + IF( ( hDirAC->hConfig->dec_param_estim == FALSE ) ) { Word16 *masa_band_mapping; @@ -2706,6 +2708,7 @@ void ivas_dirac_dec_render_sf_fx( } } + push_wmops( "(IDR) LOOP1" ); FOR( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) { index_slot = add( slot_idx_start, slot_idx ); @@ -2923,6 +2926,8 @@ void ivas_dirac_dec_render_sf_fx( move16(); BREAK; default: + pop_wmops(); /* push_wmops( "ivas_dirac_dec_render (IDR)" );*/ + pop_wmops(); /*push_wmops( "(IDR) LOOP1");/*/ return; } q_proto_direct_buffer[slot_idx] = hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q; @@ -2932,6 +2937,7 @@ void ivas_dirac_dec_render_sf_fx( /*-----------------------------------------------------------------* * Compute DirAC parameters at decoder side *-----------------------------------------------------------------*/ + push_wmops( "(IDR) LOOP1 DirACparams |" ); IF( EQ_16( hDirAC->hConfig->dec_param_estim, TRUE ) ) { Copy( &hSpatParamRendCom->azimuth[md_idx][hDirAC->hConfig->enc_param_start_band], &azimuth[hDirAC->hConfig->enc_param_start_band], sub( hSpatParamRendCom->num_freq_bands, hDirAC->hConfig->enc_param_start_band ) ); @@ -2980,8 +2986,11 @@ void ivas_dirac_dec_render_sf_fx( hDirACRend->q_buffer_energy[index - 1] = DirAC_mem.reference_power_q; move16(); + push_wmops( "(IDR) LOOP1 DirACparams computeDiffuseness <-|" ); computeDiffuseness_fixed( hDirACRend->buffer_intensity_real_fx, hDirACRend->buffer_energy_fx, num_freq_bands, hSpatParamRendCom->diffuseness_vector_fx[md_idx], hDirACRend->q_buffer_intensity_real, hDirACRend->q_buffer_energy, &hSpatParamRendCom->q_diffuseness_vector ); + pop_wmops(); /*push_wmops( "(IDR) LOOP1 DirACparams computeDiffuseness <-|" );/*/ } + pop_wmops(); /* push_wmops( "(IDR) LOOP1 DirACparams |" );*/ /*-----------------------------------------------------------------* * frequency domain decorrelation @@ -3083,6 +3092,7 @@ void ivas_dirac_dec_render_sf_fx( } /*Compute PSDs*/ + push_wmops( "(IDR) LOOP1 PSDs |" ); h_dirac_output_synthesis_params = &( hDirACRend->h_output_synthesis_psd_params ); h_dirac_output_synthesis_state = &( hDirACRend->h_output_synthesis_psd_state ); num_channels_dir = hDirACRend->num_outputs_dir; @@ -3165,6 +3175,7 @@ void ivas_dirac_dec_render_sf_fx( } ELSE { + push_wmops( "(IDR) LOOP1 PSDs PATH3 <-|" ); ivas_dirac_dec_output_synthesis_process_slot_fx( reference_power_fx, DirAC_mem.reference_power_q, p_onset_filter_fx, @@ -3182,6 +3193,7 @@ void ivas_dirac_dec_render_sf_fx( md_idx, hodirac_flag, hDirAC->hConfig->dec_param_estim ); + pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 <-|" );/*/ } IF( hDirAC->hConfig->dec_param_estim ) @@ -3252,7 +3264,9 @@ void ivas_dirac_dec_render_sf_fx( v_add_fixed( reference_power_fx, reference_power_smooth_fx, reference_power_smooth_fx, hSpatParamRendCom->num_freq_bands, 1 ); q_reference_power_smooth = sub( q_reference_power_smooth, 1 ); } + pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs |" );*/ } + pop_wmops(); /*push_wmops( "(IDR) LOOP1" );*/ minimum_s( q_proto_direct_buffer, hSpatParamRendCom->subframe_nbslots[subframe_idx], &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q ); IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) @@ -3581,7 +3595,6 @@ void ivas_dirac_dec_render_sf_fx( /*-----------------------------------------------------------------* * CLDFB synthesis (and binaural rendering) *-----------------------------------------------------------------*/ - index_slot = slot_idx_start_cldfb_synth; move16(); @@ -3963,6 +3976,7 @@ void ivas_dirac_dec_render_sf_fx( } } + hSpatParamRendCom->slots_rendered = add( hSpatParamRendCom->slots_rendered, hSpatParamRendCom->subframe_nbslots[subframe_idx] ); move16(); hSpatParamRendCom->subframes_rendered = add( hSpatParamRendCom->subframes_rendered, 1 ); @@ -4077,8 +4091,7 @@ void ivas_dirac_dec_render_sf_fx( } } } - - pop_wmops(); + pop_wmops(); /*push_wmops( "ivas_dirac_dec_render (IDR)" );*/ return; } diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index 4686ca1e6..5b37ab7d9 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -710,11 +710,13 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( } } + push_wmops( "(IDR) LOOP1 PSDs PATH3 B <<-|" ); test(); IF( dec_param_estim == FALSE && hodirac_flag ) { IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) { + push_wmops( "(IDR) LOOP1 PSDs PATH3 B1<<<-|" ); v_multc_fixed( hSpatParamRendCom->energy_ratio1_fx[md_idx], -MAX_32 /*-1 Q31*/, aux_buf, num_freq_bands ); /* 30 + 31 - 31 -> 30 */ v_addc_fixed( aux_buf, ONE_IN_Q30 /*1 Q30*/, aux_buf, num_freq_bands ); /*30*/ Copy32( hSpatParamRendCom->energy_ratio1_fx[md_idx], @@ -737,19 +739,24 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( move16(); h_dirac_output_synthesis_state->direct_power_factor_q = 30; move16(); + pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B1<<<-|" );/*/ } ELSE { + push_wmops( "(IDR) LOOP1 PSDs PATH3 B2<<<-|" ); ivas_dirac_dec_compute_gain_factors_fx( num_freq_bands, hSpatParamRendCom->diffuseness_vector_fx[md_idx], h_dirac_output_synthesis_state->direct_power_factor_fx, h_dirac_output_synthesis_state->diffuse_power_factor_fx, &h_dirac_output_synthesis_state->direct_power_factor_q, &h_dirac_output_synthesis_state->diffuse_power_factor_q ); + pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B2<<<-|" );*/ } } ELSE IF( EQ_16( dec_param_estim, TRUE ) ) { + push_wmops( "(IDR) LOOP1 PSDs PATH3 B3<<<-|" ); + push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.1<<<<-|" ); /* compute direct responses */ ivas_dirac_dec_compute_directional_responses_fx( hSpatParamRendCom, hDirACRend, @@ -764,7 +771,7 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( sh_rot_max_order, p_Rmat, hodirac_flag ); - + pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.1<<<<-|" );*/ { IF( h_dirac_output_synthesis_state->direct_responses_square_fx ) { @@ -811,12 +818,14 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( Q_temp_cy_cross_dir_smooth_fx[kk] = h_dirac_output_synthesis_state->q_cy_cross_dir_smooth; move16(); } - + push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop <<<<-|" ); FOR( ch_idx = 0; ch_idx < s_min( 4, nchan_transport ); ch_idx++ ) { Word16 k; IF( ch_idx != 0 ) { + push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop IF <<<<<-|" ); + ; Word32 a, c; Word16 b, b_exp, sqr_exp, q_diff_aab, q_diff_c; Word32 mpy_a_a_b, mpy_diff_c, mpy_diff_aab; @@ -906,6 +915,8 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( } } c = Madd_32_16( ONE_IN_Q27 /*1 Q27*/, L_sub( h_dirac_output_synthesis_params->diffuse_compensation_factor_fx, ONE_IN_Q27 /*1 Q27*/ ), 5461 ); /*Diffuseness modellling nrg compensation*/ /* 1.0 / 6.0 = 5461 in Q15*/ /*Q27*/ + + push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop IF nfreqbds <<<<<<-|" ); FOR( ; k < num_freq_bands; k++ ) { a = h_dirac_output_synthesis_state->direct_responses_fx[ch_idx * num_freq_bands + k]; // Q = h_dirac_output_synthesis_state->q_direct_responses @@ -987,9 +998,12 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( move16(); } } + pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop IF nfreqbds <<<<<<-|" );*/ + pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop IF <<<<<-|" );*/ } ELSE { + push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop ELSE <<<<<-|" ); Word32 sqr_inp, mpy_diff, sqr; Word16 sqr_exp; /*Diffuseness modellling nrg compensation*/ @@ -1027,6 +1041,7 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( move16(); } } + push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop ELSE nfreqbds <<<<<<-|" ); FOR( ; k < num_freq_bands; k++ ) { mpy_diff = Mpy_32_32( diffuseness[k], L_sub( h_dirac_output_synthesis_params->diffuse_compensation_factor_decorr_fx, ONE_IN_Q29 /*1 Q29*/ ) ); // Q = q_diffuseness - 1 @@ -1060,8 +1075,12 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( move16(); } } + pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop ELSE nfreqbds <<<<<<-|" );*/ + pop_wmops();/*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop ELSE <<<<<-|" );/*/ } } + pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop <<<<-|" );/*/ + Word16 temp = MAX_16; /*q0*/ move16(); tmp16 = imult1616( num_freq_bands, num_channels_dir ); @@ -1078,9 +1097,21 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( } free( Q_temp_cy_cross_dir_smooth_fx ); /*Directional gain (panning)*/ + push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 gainpanning <<<<-|" ); + Word16 temp_q = sub( add( h_dirac_output_synthesis_state->direct_power_factor_q, h_dirac_output_synthesis_state->direct_responses_q ), 31 ); IF( LT_16( temp_q, h_dirac_output_synthesis_state->q_cy_cross_dir_smooth ) ) { +#ifdef FIX_1072_SPEEDUP_gainpanning /*is there any difference in any bitstream?*/ + Word16 temp_q1 = sub( temp_q, h_dirac_output_synthesis_state->q_cy_cross_dir_smooth ); + FOR( Word16 kk = 0; kk < tmp16; kk++ ) + { + h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[kk] = L_shl( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[kk], temp_q1 ); /*h_dirac_output_synthesis_state->q_cy_cross_dir_smooth ->temp_q*/ + move32(); + } + h_dirac_output_synthesis_state->q_cy_cross_dir_smooth = temp_q; + move16(); +#else FOR( Word16 kk = 0; kk < tmp16; kk++ ) { h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[kk] = L_shl( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[kk], sub( temp_q, h_dirac_output_synthesis_state->q_cy_cross_dir_smooth ) ); /*h_dirac_output_synthesis_state->q_cy_cross_dir_smooth ->temp_q*/ @@ -1088,7 +1119,53 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( } h_dirac_output_synthesis_state->q_cy_cross_dir_smooth = temp_q; move16(); +#endif + } +#ifdef FIX_1072_SPEEDUP_gainpanning + Word16 temp_q1 = sub( h_dirac_output_synthesis_state->q_cy_cross_dir_smooth, temp_q ); + FOR( ch_idx = s_min( 4, nchan_transport ); ch_idx < num_channels_dir; ch_idx++ ) + { + IF( NE_16( temp_q, h_dirac_output_synthesis_state->q_cy_cross_dir_smooth ) ) + { + Word16 i; + Word32 aux; + IF(temp_q1 < 0) + { + Word32 temp_q1_equiv = L_lshl( 0x80000000, temp_q1 ); + FOR( i = 0; i < num_freq_bands; i++ ) + { + aux = Mpy_32_32( h_dirac_output_synthesis_state->direct_power_factor_fx[i], h_dirac_output_synthesis_state->direct_responses_fx[ch_idx * num_freq_bands + i] ); + h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + i] = Madd_32_32( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + i] , aux, temp_q1_equiv ); + move32(); + } + } + ELSE + { + FOR( i = 0; i < num_freq_bands; i++ ) + { + aux = Mpy_32_32( h_dirac_output_synthesis_state->direct_power_factor_fx[i], h_dirac_output_synthesis_state->direct_responses_fx[ch_idx * num_freq_bands + i] ); + aux = L_shl( aux, temp_q1 ); + h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + i] = L_add( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + i], aux ); + move32(); + } + } + + } + ELSE + { + Word16 i; + FOR( i = 0; i < num_freq_bands; i++ ) + { + h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + i] = Madd_32_32( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + i], h_dirac_output_synthesis_state->direct_power_factor_fx[i], h_dirac_output_synthesis_state->direct_responses_fx[ch_idx * num_freq_bands + i] ); + move32(); + } + } + + + } + +#else FOR( ch_idx = s_min( 4, nchan_transport ); ch_idx < num_channels_dir; ch_idx++ ) { v_mult_fixed( h_dirac_output_synthesis_state->direct_power_factor_fx, @@ -1107,6 +1184,9 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( num_freq_bands, 0 ); /*Q(h_dirac_output_synthesis_state->q_cy_cross_dir_smooth)*/ } +#endif + pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 gainpanning <<<<-|" );*/ + /*Diffuse gain*/ FOR( ch_idx = s_min( 4, nchan_transport ); ch_idx < num_channels_diff; ch_idx++ ) { @@ -1124,7 +1204,8 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( &h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx[ch_idx * num_freq_bands_diff], num_freq_bands_diff, 0 ); /*h_dirac_output_synthesis_state->q_cy_auto_diff_smooth*/ } - + pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3 <<-|" );/*/ + pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B <<-|" );/*/ return; } ELSE @@ -1143,7 +1224,9 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( h_dirac_output_synthesis_state->direct_power_factor_q = 31; move16(); } + pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3<<<-|" );/*/ } + pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B <<-|" );/*/ diff_start_band = 0; move16(); -- GitLab From 6a2e3a1e83a250a8e6748af2bf6ad963f403cb30 Mon Sep 17 00:00:00 2001 From: ber Date: Thu, 6 Feb 2025 15:14:20 +0100 Subject: [PATCH 011/113] some introduction to more tunings :: FIX_1072_SPEEDUP_output_synthesis_procSlot - inactive --- lib_com/options.h | 5 +++-- lib_rend/ivas_dirac_output_synthesis_dec.c | 13 +++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 5dfebfaa6..92144ade1 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -56,7 +56,7 @@ #define SUPPORT_JBM_TRACEFILE /* Support for JBM tracefile, which is needed for 3GPP objective/subjective testing, but not relevant for real-world implementations */ -//#define WMOPS /* Activate complexity and memory counters */ +/*#define WMOPS*/ /* Activate complexity and memory counters */ #ifdef WMOPS /*#define WMOPS_PER_FRAME*/ /* Output per-frame complexity (writes one float value per frame to the file "wmops_analysis") */ /*#define WMOPS_DETAIL*/ /* Output detailed complexity printout for every function. Increases runtime overhead */ @@ -156,4 +156,5 @@ #define FIX_1072_SPEEDUP_gainpanning /* FhG: WMOPS tuning, in development*/ -#define FIX_1072_SPEEDUP_COMPUTEDIFUSENESSB /* "-" */ \ No newline at end of file +#define FIX_1072_SPEEDUP_COMPUTEDIFUSENESSB /* "-" */ +//#define FIX_1072_SPEEDUP_output_synthesis_procSlot /* "-" */ \ No newline at end of file diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index 5b37ab7d9..404f98b1b 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -942,7 +942,18 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( b = BASOP_Util_Divide3232_Scale( reference_power[k + num_freq_bands], reference_power[k + ( ch_idx + 1 ) * num_freq_bands], &b_exp ); /*q(15-b_exp)*/ } } +#ifdef FIX_1072_SPEEDUP_output_synthesis_procSlot + q_diff_aab = add( h_dirac_output_synthesis_state->direct_responses_q + sub( sub( 15, b_exp ), 15 ), add( sub( h_dirac_output_synthesis_state->direct_responses_q, 31 ), sub( q_diffuseness, 31 ) ) ); + q_diff_c = sub( q_diffuseness, 4 ); + + mpy_a_a_b = Mpy_32_32( a, Mpy_32_16_1( a, b ) ); // Q = (h_dirac_output_synthesis_state->q_direct_responses + (15 - b_exp) - 15) + (h_dirac_output_synthesis_state->q_direct_responses) - 31 + mpy_diff_aab = Mpy_32_32( L_sub( L_shl( 1, q_diffuseness ), diffuseness[k] ), mpy_a_a_b ); // Q = 2*(h_dirac_output_synthesis_state->q_direct_responses) - b_exp - 31 + q_diffuseness -31 + mpy_diff_c = Mpy_32_32( diffuseness[k], c ); // Q = q_diffuseness - 4 + + /*Todo: simplify so that mpy+add can be merged to madd*/ + sqr_inp = BASOP_Util_Add_Mant32Exp( mpy_diff_c, sub( 31, q_diff_c ), mpy_diff_aab, sub( 31, q_diff_aab ), &sqr_exp ); /*q(31-sqr_exp)*/ +#else mpy_a_a_b = Mpy_32_32( a, Mpy_32_16_1( a, b ) ); // Q = (h_dirac_output_synthesis_state->q_direct_responses + (15 - b_exp) - 15) + (h_dirac_output_synthesis_state->q_direct_responses) - 31 mpy_diff_aab = Mpy_32_32( L_sub( L_shl( 1, q_diffuseness ), diffuseness[k] ), mpy_a_a_b ); // Q = 2*(h_dirac_output_synthesis_state->q_direct_responses) - b_exp - 31 + q_diffuseness -31 mpy_diff_c = Mpy_32_32( diffuseness[k], c ); // Q = q_diffuseness - 4 @@ -970,6 +981,8 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( sqr_exp = sub( 31, q_diff_c ); /*q_diff_c*/ } } +#endif + sqr = Sqrt32( sqr_inp, &sqr_exp ); /*Q(31-sqr_exp)*/ sqr = L_shr( sqr, 2 ); /*Q(31-sqr_exp)*/ IF( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k] != 0 ) -- GitLab From b05d69a9edf078616466f69a705ceb5845b831c8 Mon Sep 17 00:00:00 2001 From: ber Date: Thu, 6 Feb 2025 15:16:18 +0100 Subject: [PATCH 012/113] cleaning up options.h --- lib_com/options.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 92144ade1..7e8912490 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -155,6 +155,5 @@ #define FIX_MINOR_SVD_WMOPS_MR1010X /* FhG: Minor WMOPS tuning, bit-exact to previous version, saves about 8.2 WMOPS for MR1010 */ -#define FIX_1072_SPEEDUP_gainpanning /* FhG: WMOPS tuning, in development*/ -#define FIX_1072_SPEEDUP_COMPUTEDIFUSENESSB /* "-" */ -//#define FIX_1072_SPEEDUP_output_synthesis_procSlot /* "-" */ \ No newline at end of file +#define FIX_1072_SPEEDUP_gainpanning /* FhG: Minor WMOPS tuning, nonbe */ +#define FIX_1072_SPEEDUP_COMPUTEDIFUSENESSB /* FhG: Minor WMOPS tuning, nonbe */ -- GitLab From 0917f3f7b1c455ae3c6fedf4c4e0830415137fbe Mon Sep 17 00:00:00 2001 From: ber Date: Thu, 6 Feb 2025 15:17:58 +0100 Subject: [PATCH 013/113] some more cleaning --- lib_com/ivas_dirac_com.c | 4 ++-- lib_com/options.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib_com/ivas_dirac_com.c b/lib_com/ivas_dirac_com.c index 796fc8960..97c8a88bd 100644 --- a/lib_com/ivas_dirac_com.c +++ b/lib_com/ivas_dirac_com.c @@ -969,7 +969,7 @@ void computeDiffuseness_fixed( q_tmp = add( q_factor_energy[i], min_q_shift1 ); -#ifdef FIX_1072_SPEEDUP_COMPUTEDIFUSENESSB +#ifdef FIX_1072_SPEEDUP_COMPUTEDIFUSENESS Word16 shift_q = sub( q_tmp, q_ene ); Word32 shiftEquiv; Word16 shift_qtotal; @@ -1019,7 +1019,7 @@ void computeDiffuseness_fixed( q_tmp = add( q_factor_intensity[i], min_q_shift2 ); shift_q = sub( q_tmp, q_intensity ); -#ifdef FIX_1072_SPEEDUP_COMPUTEDIFUSENESSB +#ifdef FIX_1072_SPEEDUP_COMPUTEDIFUSENESS if( shift_q >= 0 ) { shiftEquiv = L_lshl( 0x7FFFFFFF, 0 ); diff --git a/lib_com/options.h b/lib_com/options.h index 7e8912490..b47825b32 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -156,4 +156,4 @@ #define FIX_1072_SPEEDUP_gainpanning /* FhG: Minor WMOPS tuning, nonbe */ -#define FIX_1072_SPEEDUP_COMPUTEDIFUSENESSB /* FhG: Minor WMOPS tuning, nonbe */ +#define FIX_1072_SPEEDUP_COMPUTEDIFUSENESS /* FhG: Minor WMOPS tuning, nonbe */ -- GitLab From 491400705b0984e8379706dfd004e883507edee1 Mon Sep 17 00:00:00 2001 From: ber Date: Thu, 6 Feb 2025 15:22:03 +0100 Subject: [PATCH 014/113] apply clang format patch --- lib_com/ivas_dirac_com.c | 7 +++---- lib_dec/ivas_dirac_dec.c | 4 ++-- lib_rend/ivas_dirac_output_synthesis_dec.c | 12 ++++-------- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/lib_com/ivas_dirac_com.c b/lib_com/ivas_dirac_com.c index 97c8a88bd..d03191084 100644 --- a/lib_com/ivas_dirac_com.c +++ b/lib_com/ivas_dirac_com.c @@ -973,12 +973,12 @@ void computeDiffuseness_fixed( Word16 shift_q = sub( q_tmp, q_ene ); Word32 shiftEquiv; Word16 shift_qtotal; - if( shift_q < 0 ) + if ( shift_q < 0 ) { shiftEquiv = L_lshl( 0x80000000, shift_q ); shift_qtotal = sub( min_q_shift1, 0 ); } - if( shift_q >= 0 ) + if ( shift_q >= 0 ) { shiftEquiv = L_add( 0x7FFFFFFF, 0 ); shift_qtotal = sub( min_q_shift1, shift_q ); @@ -1012,7 +1012,6 @@ void computeDiffuseness_fixed( #endif - q_ene = s_min( q_ene, q_tmp ); /* Intensity slow */ @@ -1020,7 +1019,7 @@ void computeDiffuseness_fixed( shift_q = sub( q_tmp, q_intensity ); #ifdef FIX_1072_SPEEDUP_COMPUTEDIFUSENESS - if( shift_q >= 0 ) + if ( shift_q >= 0 ) { shiftEquiv = L_lshl( 0x7FFFFFFF, 0 ); shift_qtotal = sub( min_q_shift2, shift_q ); diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 318a3ec55..81429927a 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -2557,7 +2557,7 @@ void ivas_dirac_dec_render_sf_fx( p_Rmat_fx = 0; move32(); } - + IF( ( hDirAC->hConfig->dec_param_estim == FALSE ) ) { Word16 *masa_band_mapping; @@ -2926,7 +2926,7 @@ void ivas_dirac_dec_render_sf_fx( move16(); BREAK; default: - pop_wmops(); /* push_wmops( "ivas_dirac_dec_render (IDR)" );*/ + pop_wmops(); /* push_wmops( "ivas_dirac_dec_render (IDR)" );*/ pop_wmops(); /*push_wmops( "(IDR) LOOP1");/*/ return; } diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index 404f98b1b..3f4111253 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -1089,7 +1089,7 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( } } pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop ELSE nfreqbds <<<<<<-|" );*/ - pop_wmops();/*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop ELSE <<<<<-|" );/*/ + pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop ELSE <<<<<-|" );/*/ } } pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop <<<<-|" );/*/ @@ -1133,7 +1133,6 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( h_dirac_output_synthesis_state->q_cy_cross_dir_smooth = temp_q; move16(); #endif - } #ifdef FIX_1072_SPEEDUP_gainpanning Word16 temp_q1 = sub( h_dirac_output_synthesis_state->q_cy_cross_dir_smooth, temp_q ); @@ -1143,13 +1142,13 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( { Word16 i; Word32 aux; - IF(temp_q1 < 0) + IF( temp_q1 < 0 ) { Word32 temp_q1_equiv = L_lshl( 0x80000000, temp_q1 ); FOR( i = 0; i < num_freq_bands; i++ ) { aux = Mpy_32_32( h_dirac_output_synthesis_state->direct_power_factor_fx[i], h_dirac_output_synthesis_state->direct_responses_fx[ch_idx * num_freq_bands + i] ); - h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + i] = Madd_32_32( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + i] , aux, temp_q1_equiv ); + h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + i] = Madd_32_32( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + i], aux, temp_q1_equiv ); move32(); } } @@ -1163,7 +1162,6 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( move32(); } } - } ELSE { @@ -1174,8 +1172,6 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( move32(); } } - - } #else @@ -1237,7 +1233,7 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( h_dirac_output_synthesis_state->direct_power_factor_q = 31; move16(); } - pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3<<<-|" );/*/ + pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3<<<-|" );/*/ } pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B <<-|" );/*/ -- GitLab From 59fd769bd56da5f9aec8aad04125283815b1a260 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 6 Feb 2025 14:30:48 +0000 Subject: [PATCH 015/113] Final cleanups before merge --- lib_com/ivas_dirac_com.c | 2 - lib_dec/ivas_dirac_dec.c | 21 ++-------- lib_rend/ivas_dirac_output_synthesis_dec.c | 45 ++-------------------- 3 files changed, 7 insertions(+), 61 deletions(-) diff --git a/lib_com/ivas_dirac_com.c b/lib_com/ivas_dirac_com.c index d03191084..e07d36b1e 100644 --- a/lib_com/ivas_dirac_com.c +++ b/lib_com/ivas_dirac_com.c @@ -960,7 +960,6 @@ void computeDiffuseness_fixed( q_intensity = add( q_factor_intensity[0], min_q_shift2 ); move16(); - push_wmops( "(IDR) LOOP1 DirACparams computeDiffuseness B <<-|" ); FOR( i = 0; i < DIRAC_NO_COL_AVG_DIFF; ++i ) { /* Energy slow */ @@ -1070,7 +1069,6 @@ void computeDiffuseness_fixed( q_intensity = s_min( q_intensity, q_tmp ); } - pop_wmops(); /*push_wmops( "(IDR) LOOP1 DirACparams computeDiffuseness B <<-|" );/*/ min_q_shift1 = getScaleFactor32( intensity_slow, i_mult( DIRAC_NUM_DIMS, num_freq_bands ) ); min_q_shift1 = sub( min_q_shift1, idiv1616( add( find_guarded_bits_fx( DIRAC_NUM_DIMS ), 1 ), 2 ) ); diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 81429927a..95cca12a0 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -2231,7 +2231,7 @@ void ivas_dirac_dec_render_sf_fx( move16(); Word16 tmp1; - push_wmops( "ivas_dirac_dec_render (IDR)" ); + push_wmops( "ivas_dirac_dec_render" ); /* Initialize aux buffers */ hDirAC = st_ivas->hDirAC; @@ -2341,7 +2341,6 @@ void ivas_dirac_dec_render_sf_fx( } ELSE IF( !( EQ_16( st_ivas->ivas_format, SBA_FORMAT ) || EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) ) { - push_wmops( "(IDR) SBA_FORMAT | SBA_ISM_FORMAT" ); Word16 outchannels; idx_lfe = 0; move16(); @@ -2410,7 +2409,6 @@ void ivas_dirac_dec_render_sf_fx( } } } - pop_wmops(); /*push_wmops( "(IDR) SBA_FORMAT | SBA_ISM_FORMAT" );*/ } size = imult1616( hDirACRend->num_outputs_dir, hSpatParamRendCom->num_freq_bands ); @@ -2708,7 +2706,6 @@ void ivas_dirac_dec_render_sf_fx( } } - push_wmops( "(IDR) LOOP1" ); FOR( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) { index_slot = add( slot_idx_start, slot_idx ); @@ -2926,8 +2923,6 @@ void ivas_dirac_dec_render_sf_fx( move16(); BREAK; default: - pop_wmops(); /* push_wmops( "ivas_dirac_dec_render (IDR)" );*/ - pop_wmops(); /*push_wmops( "(IDR) LOOP1");/*/ return; } q_proto_direct_buffer[slot_idx] = hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q; @@ -2937,7 +2932,6 @@ void ivas_dirac_dec_render_sf_fx( /*-----------------------------------------------------------------* * Compute DirAC parameters at decoder side *-----------------------------------------------------------------*/ - push_wmops( "(IDR) LOOP1 DirACparams |" ); IF( EQ_16( hDirAC->hConfig->dec_param_estim, TRUE ) ) { Copy( &hSpatParamRendCom->azimuth[md_idx][hDirAC->hConfig->enc_param_start_band], &azimuth[hDirAC->hConfig->enc_param_start_band], sub( hSpatParamRendCom->num_freq_bands, hDirAC->hConfig->enc_param_start_band ) ); @@ -2986,11 +2980,8 @@ void ivas_dirac_dec_render_sf_fx( hDirACRend->q_buffer_energy[index - 1] = DirAC_mem.reference_power_q; move16(); - push_wmops( "(IDR) LOOP1 DirACparams computeDiffuseness <-|" ); computeDiffuseness_fixed( hDirACRend->buffer_intensity_real_fx, hDirACRend->buffer_energy_fx, num_freq_bands, hSpatParamRendCom->diffuseness_vector_fx[md_idx], hDirACRend->q_buffer_intensity_real, hDirACRend->q_buffer_energy, &hSpatParamRendCom->q_diffuseness_vector ); - pop_wmops(); /*push_wmops( "(IDR) LOOP1 DirACparams computeDiffuseness <-|" );/*/ } - pop_wmops(); /* push_wmops( "(IDR) LOOP1 DirACparams |" );*/ /*-----------------------------------------------------------------* * frequency domain decorrelation @@ -3092,7 +3083,6 @@ void ivas_dirac_dec_render_sf_fx( } /*Compute PSDs*/ - push_wmops( "(IDR) LOOP1 PSDs |" ); h_dirac_output_synthesis_params = &( hDirACRend->h_output_synthesis_psd_params ); h_dirac_output_synthesis_state = &( hDirACRend->h_output_synthesis_psd_state ); num_channels_dir = hDirACRend->num_outputs_dir; @@ -3175,7 +3165,6 @@ void ivas_dirac_dec_render_sf_fx( } ELSE { - push_wmops( "(IDR) LOOP1 PSDs PATH3 <-|" ); ivas_dirac_dec_output_synthesis_process_slot_fx( reference_power_fx, DirAC_mem.reference_power_q, p_onset_filter_fx, @@ -3193,7 +3182,6 @@ void ivas_dirac_dec_render_sf_fx( md_idx, hodirac_flag, hDirAC->hConfig->dec_param_estim ); - pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 <-|" );/*/ } IF( hDirAC->hConfig->dec_param_estim ) @@ -3264,9 +3252,7 @@ void ivas_dirac_dec_render_sf_fx( v_add_fixed( reference_power_fx, reference_power_smooth_fx, reference_power_smooth_fx, hSpatParamRendCom->num_freq_bands, 1 ); q_reference_power_smooth = sub( q_reference_power_smooth, 1 ); } - pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs |" );*/ } - pop_wmops(); /*push_wmops( "(IDR) LOOP1" );*/ minimum_s( q_proto_direct_buffer, hSpatParamRendCom->subframe_nbslots[subframe_idx], &hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q ); IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) @@ -3595,6 +3581,7 @@ void ivas_dirac_dec_render_sf_fx( /*-----------------------------------------------------------------* * CLDFB synthesis (and binaural rendering) *-----------------------------------------------------------------*/ + index_slot = slot_idx_start_cldfb_synth; move16(); @@ -3976,7 +3963,6 @@ void ivas_dirac_dec_render_sf_fx( } } - hSpatParamRendCom->slots_rendered = add( hSpatParamRendCom->slots_rendered, hSpatParamRendCom->subframe_nbslots[subframe_idx] ); move16(); hSpatParamRendCom->subframes_rendered = add( hSpatParamRendCom->subframes_rendered, 1 ); @@ -4091,7 +4077,8 @@ void ivas_dirac_dec_render_sf_fx( } } } - pop_wmops(); /*push_wmops( "ivas_dirac_dec_render (IDR)" );*/ + + pop_wmops(); return; } diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index 3f4111253..866badda0 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -710,13 +710,11 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( } } - push_wmops( "(IDR) LOOP1 PSDs PATH3 B <<-|" ); test(); IF( dec_param_estim == FALSE && hodirac_flag ) { IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) { - push_wmops( "(IDR) LOOP1 PSDs PATH3 B1<<<-|" ); v_multc_fixed( hSpatParamRendCom->energy_ratio1_fx[md_idx], -MAX_32 /*-1 Q31*/, aux_buf, num_freq_bands ); /* 30 + 31 - 31 -> 30 */ v_addc_fixed( aux_buf, ONE_IN_Q30 /*1 Q30*/, aux_buf, num_freq_bands ); /*30*/ Copy32( hSpatParamRendCom->energy_ratio1_fx[md_idx], @@ -739,24 +737,19 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( move16(); h_dirac_output_synthesis_state->direct_power_factor_q = 30; move16(); - pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B1<<<-|" );/*/ } ELSE { - push_wmops( "(IDR) LOOP1 PSDs PATH3 B2<<<-|" ); ivas_dirac_dec_compute_gain_factors_fx( num_freq_bands, hSpatParamRendCom->diffuseness_vector_fx[md_idx], h_dirac_output_synthesis_state->direct_power_factor_fx, h_dirac_output_synthesis_state->diffuse_power_factor_fx, &h_dirac_output_synthesis_state->direct_power_factor_q, &h_dirac_output_synthesis_state->diffuse_power_factor_q ); - pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B2<<<-|" );*/ } } ELSE IF( EQ_16( dec_param_estim, TRUE ) ) { - push_wmops( "(IDR) LOOP1 PSDs PATH3 B3<<<-|" ); - push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.1<<<<-|" ); /* compute direct responses */ ivas_dirac_dec_compute_directional_responses_fx( hSpatParamRendCom, hDirACRend, @@ -771,7 +764,7 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( sh_rot_max_order, p_Rmat, hodirac_flag ); - pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.1<<<<-|" );*/ + { IF( h_dirac_output_synthesis_state->direct_responses_square_fx ) { @@ -818,14 +811,12 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( Q_temp_cy_cross_dir_smooth_fx[kk] = h_dirac_output_synthesis_state->q_cy_cross_dir_smooth; move16(); } - push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop <<<<-|" ); + FOR( ch_idx = 0; ch_idx < s_min( 4, nchan_transport ); ch_idx++ ) { Word16 k; IF( ch_idx != 0 ) { - push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop IF <<<<<-|" ); - ; Word32 a, c; Word16 b, b_exp, sqr_exp, q_diff_aab, q_diff_c; Word32 mpy_a_a_b, mpy_diff_c, mpy_diff_aab; @@ -915,8 +906,6 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( } } c = Madd_32_16( ONE_IN_Q27 /*1 Q27*/, L_sub( h_dirac_output_synthesis_params->diffuse_compensation_factor_fx, ONE_IN_Q27 /*1 Q27*/ ), 5461 ); /*Diffuseness modellling nrg compensation*/ /* 1.0 / 6.0 = 5461 in Q15*/ /*Q27*/ - - push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop IF nfreqbds <<<<<<-|" ); FOR( ; k < num_freq_bands; k++ ) { a = h_dirac_output_synthesis_state->direct_responses_fx[ch_idx * num_freq_bands + k]; // Q = h_dirac_output_synthesis_state->q_direct_responses @@ -942,22 +931,11 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( b = BASOP_Util_Divide3232_Scale( reference_power[k + num_freq_bands], reference_power[k + ( ch_idx + 1 ) * num_freq_bands], &b_exp ); /*q(15-b_exp)*/ } } -#ifdef FIX_1072_SPEEDUP_output_synthesis_procSlot - q_diff_aab = add( h_dirac_output_synthesis_state->direct_responses_q + sub( sub( 15, b_exp ), 15 ), add( sub( h_dirac_output_synthesis_state->direct_responses_q, 31 ), sub( q_diffuseness, 31 ) ) ); - q_diff_c = sub( q_diffuseness, 4 ); mpy_a_a_b = Mpy_32_32( a, Mpy_32_16_1( a, b ) ); // Q = (h_dirac_output_synthesis_state->q_direct_responses + (15 - b_exp) - 15) + (h_dirac_output_synthesis_state->q_direct_responses) - 31 mpy_diff_aab = Mpy_32_32( L_sub( L_shl( 1, q_diffuseness ), diffuseness[k] ), mpy_a_a_b ); // Q = 2*(h_dirac_output_synthesis_state->q_direct_responses) - b_exp - 31 + q_diffuseness -31 mpy_diff_c = Mpy_32_32( diffuseness[k], c ); // Q = q_diffuseness - 4 - /*Todo: simplify so that mpy+add can be merged to madd*/ - sqr_inp = BASOP_Util_Add_Mant32Exp( mpy_diff_c, sub( 31, q_diff_c ), mpy_diff_aab, sub( 31, q_diff_aab ), &sqr_exp ); /*q(31-sqr_exp)*/ - -#else - mpy_a_a_b = Mpy_32_32( a, Mpy_32_16_1( a, b ) ); // Q = (h_dirac_output_synthesis_state->q_direct_responses + (15 - b_exp) - 15) + (h_dirac_output_synthesis_state->q_direct_responses) - 31 - mpy_diff_aab = Mpy_32_32( L_sub( L_shl( 1, q_diffuseness ), diffuseness[k] ), mpy_a_a_b ); // Q = 2*(h_dirac_output_synthesis_state->q_direct_responses) - b_exp - 31 + q_diffuseness -31 - mpy_diff_c = Mpy_32_32( diffuseness[k], c ); // Q = q_diffuseness - 4 - q_diff_aab = add( h_dirac_output_synthesis_state->direct_responses_q + sub( sub( 15, b_exp ), 15 ), add( sub( h_dirac_output_synthesis_state->direct_responses_q, 31 ), sub( q_diffuseness, 31 ) ) ); q_diff_c = sub( q_diffuseness, 4 ); @@ -981,8 +959,6 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( sqr_exp = sub( 31, q_diff_c ); /*q_diff_c*/ } } -#endif - sqr = Sqrt32( sqr_inp, &sqr_exp ); /*Q(31-sqr_exp)*/ sqr = L_shr( sqr, 2 ); /*Q(31-sqr_exp)*/ IF( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + k] != 0 ) @@ -1011,12 +987,9 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( move16(); } } - pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop IF nfreqbds <<<<<<-|" );*/ - pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop IF <<<<<-|" );*/ } ELSE { - push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop ELSE <<<<<-|" ); Word32 sqr_inp, mpy_diff, sqr; Word16 sqr_exp; /*Diffuseness modellling nrg compensation*/ @@ -1054,7 +1027,6 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( move16(); } } - push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop ELSE nfreqbds <<<<<<-|" ); FOR( ; k < num_freq_bands; k++ ) { mpy_diff = Mpy_32_32( diffuseness[k], L_sub( h_dirac_output_synthesis_params->diffuse_compensation_factor_decorr_fx, ONE_IN_Q29 /*1 Q29*/ ) ); // Q = q_diffuseness - 1 @@ -1088,12 +1060,8 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( move16(); } } - pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop ELSE nfreqbds <<<<<<-|" );*/ - pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop ELSE <<<<<-|" );/*/ } } - pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop <<<<-|" );/*/ - Word16 temp = MAX_16; /*q0*/ move16(); tmp16 = imult1616( num_freq_bands, num_channels_dir ); @@ -1110,8 +1078,6 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( } free( Q_temp_cy_cross_dir_smooth_fx ); /*Directional gain (panning)*/ - push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 gainpanning <<<<-|" ); - Word16 temp_q = sub( add( h_dirac_output_synthesis_state->direct_power_factor_q, h_dirac_output_synthesis_state->direct_responses_q ), 31 ); IF( LT_16( temp_q, h_dirac_output_synthesis_state->q_cy_cross_dir_smooth ) ) { @@ -1192,9 +1158,7 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( &h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands], num_freq_bands, 0 ); /*Q(h_dirac_output_synthesis_state->q_cy_cross_dir_smooth)*/ } - #endif - pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 gainpanning <<<<-|" );*/ /*Diffuse gain*/ FOR( ch_idx = s_min( 4, nchan_transport ); ch_idx < num_channels_diff; ch_idx++ ) @@ -1213,8 +1177,7 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( &h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx[ch_idx * num_freq_bands_diff], num_freq_bands_diff, 0 ); /*h_dirac_output_synthesis_state->q_cy_auto_diff_smooth*/ } - pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3 <<-|" );/*/ - pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B <<-|" );/*/ + return; } ELSE @@ -1233,9 +1196,7 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( h_dirac_output_synthesis_state->direct_power_factor_q = 31; move16(); } - pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3<<<-|" );/*/ } - pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B <<-|" );/*/ diff_start_band = 0; move16(); -- GitLab From f5fe2f050dca5c506a610bb38f9290e5e057826f Mon Sep 17 00:00:00 2001 From: ber Date: Thu, 6 Feb 2025 15:53:56 +0100 Subject: [PATCH 016/113] Revert "apply clang format patch" This reverts commit 491400705b0984e8379706dfd004e883507edee1. --- lib_com/ivas_dirac_com.c | 7 ++++--- lib_dec/ivas_dirac_dec.c | 4 ++-- lib_rend/ivas_dirac_output_synthesis_dec.c | 12 ++++++++---- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/lib_com/ivas_dirac_com.c b/lib_com/ivas_dirac_com.c index d03191084..97c8a88bd 100644 --- a/lib_com/ivas_dirac_com.c +++ b/lib_com/ivas_dirac_com.c @@ -973,12 +973,12 @@ void computeDiffuseness_fixed( Word16 shift_q = sub( q_tmp, q_ene ); Word32 shiftEquiv; Word16 shift_qtotal; - if ( shift_q < 0 ) + if( shift_q < 0 ) { shiftEquiv = L_lshl( 0x80000000, shift_q ); shift_qtotal = sub( min_q_shift1, 0 ); } - if ( shift_q >= 0 ) + if( shift_q >= 0 ) { shiftEquiv = L_add( 0x7FFFFFFF, 0 ); shift_qtotal = sub( min_q_shift1, shift_q ); @@ -1012,6 +1012,7 @@ void computeDiffuseness_fixed( #endif + q_ene = s_min( q_ene, q_tmp ); /* Intensity slow */ @@ -1019,7 +1020,7 @@ void computeDiffuseness_fixed( shift_q = sub( q_tmp, q_intensity ); #ifdef FIX_1072_SPEEDUP_COMPUTEDIFUSENESS - if ( shift_q >= 0 ) + if( shift_q >= 0 ) { shiftEquiv = L_lshl( 0x7FFFFFFF, 0 ); shift_qtotal = sub( min_q_shift2, shift_q ); diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 81429927a..318a3ec55 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -2557,7 +2557,7 @@ void ivas_dirac_dec_render_sf_fx( p_Rmat_fx = 0; move32(); } - + IF( ( hDirAC->hConfig->dec_param_estim == FALSE ) ) { Word16 *masa_band_mapping; @@ -2926,7 +2926,7 @@ void ivas_dirac_dec_render_sf_fx( move16(); BREAK; default: - pop_wmops(); /* push_wmops( "ivas_dirac_dec_render (IDR)" );*/ + pop_wmops(); /* push_wmops( "ivas_dirac_dec_render (IDR)" );*/ pop_wmops(); /*push_wmops( "(IDR) LOOP1");/*/ return; } diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index 3f4111253..404f98b1b 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -1089,7 +1089,7 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( } } pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop ELSE nfreqbds <<<<<<-|" );*/ - pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop ELSE <<<<<-|" );/*/ + pop_wmops();/*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop ELSE <<<<<-|" );/*/ } } pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3.3 bigloop <<<<-|" );/*/ @@ -1133,6 +1133,7 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( h_dirac_output_synthesis_state->q_cy_cross_dir_smooth = temp_q; move16(); #endif + } #ifdef FIX_1072_SPEEDUP_gainpanning Word16 temp_q1 = sub( h_dirac_output_synthesis_state->q_cy_cross_dir_smooth, temp_q ); @@ -1142,13 +1143,13 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( { Word16 i; Word32 aux; - IF( temp_q1 < 0 ) + IF(temp_q1 < 0) { Word32 temp_q1_equiv = L_lshl( 0x80000000, temp_q1 ); FOR( i = 0; i < num_freq_bands; i++ ) { aux = Mpy_32_32( h_dirac_output_synthesis_state->direct_power_factor_fx[i], h_dirac_output_synthesis_state->direct_responses_fx[ch_idx * num_freq_bands + i] ); - h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + i] = Madd_32_32( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + i], aux, temp_q1_equiv ); + h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + i] = Madd_32_32( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + i] , aux, temp_q1_equiv ); move32(); } } @@ -1162,6 +1163,7 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( move32(); } } + } ELSE { @@ -1172,6 +1174,8 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( move32(); } } + + } #else @@ -1233,7 +1237,7 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( h_dirac_output_synthesis_state->direct_power_factor_q = 31; move16(); } - pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3<<<-|" );/*/ + pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B3<<<-|" );/*/ } pop_wmops(); /*push_wmops( "(IDR) LOOP1 PSDs PATH3 B <<-|" );/*/ -- GitLab From 896f21e54f609aaaab580d12e6056add7a6b5899 Mon Sep 17 00:00:00 2001 From: ber Date: Thu, 6 Feb 2025 15:54:25 +0100 Subject: [PATCH 017/113] Revert "some more cleaning" This reverts commit 0917f3f7b1c455ae3c6fedf4c4e0830415137fbe. --- lib_com/ivas_dirac_com.c | 4 ++-- lib_com/options.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib_com/ivas_dirac_com.c b/lib_com/ivas_dirac_com.c index 97c8a88bd..796fc8960 100644 --- a/lib_com/ivas_dirac_com.c +++ b/lib_com/ivas_dirac_com.c @@ -969,7 +969,7 @@ void computeDiffuseness_fixed( q_tmp = add( q_factor_energy[i], min_q_shift1 ); -#ifdef FIX_1072_SPEEDUP_COMPUTEDIFUSENESS +#ifdef FIX_1072_SPEEDUP_COMPUTEDIFUSENESSB Word16 shift_q = sub( q_tmp, q_ene ); Word32 shiftEquiv; Word16 shift_qtotal; @@ -1019,7 +1019,7 @@ void computeDiffuseness_fixed( q_tmp = add( q_factor_intensity[i], min_q_shift2 ); shift_q = sub( q_tmp, q_intensity ); -#ifdef FIX_1072_SPEEDUP_COMPUTEDIFUSENESS +#ifdef FIX_1072_SPEEDUP_COMPUTEDIFUSENESSB if( shift_q >= 0 ) { shiftEquiv = L_lshl( 0x7FFFFFFF, 0 ); diff --git a/lib_com/options.h b/lib_com/options.h index b47825b32..7e8912490 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -156,4 +156,4 @@ #define FIX_1072_SPEEDUP_gainpanning /* FhG: Minor WMOPS tuning, nonbe */ -#define FIX_1072_SPEEDUP_COMPUTEDIFUSENESS /* FhG: Minor WMOPS tuning, nonbe */ +#define FIX_1072_SPEEDUP_COMPUTEDIFUSENESSB /* FhG: Minor WMOPS tuning, nonbe */ -- GitLab From ac90f9d69453b85c66a40220c4a4e6cc9b715d72 Mon Sep 17 00:00:00 2001 From: ber Date: Thu, 6 Feb 2025 15:54:47 +0100 Subject: [PATCH 018/113] Revert "cleaning up options.h" This reverts commit b05d69a9edf078616466f69a705ceb5845b831c8. --- lib_com/options.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 7e8912490..92144ade1 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -155,5 +155,6 @@ #define FIX_MINOR_SVD_WMOPS_MR1010X /* FhG: Minor WMOPS tuning, bit-exact to previous version, saves about 8.2 WMOPS for MR1010 */ -#define FIX_1072_SPEEDUP_gainpanning /* FhG: Minor WMOPS tuning, nonbe */ -#define FIX_1072_SPEEDUP_COMPUTEDIFUSENESSB /* FhG: Minor WMOPS tuning, nonbe */ +#define FIX_1072_SPEEDUP_gainpanning /* FhG: WMOPS tuning, in development*/ +#define FIX_1072_SPEEDUP_COMPUTEDIFUSENESSB /* "-" */ +//#define FIX_1072_SPEEDUP_output_synthesis_procSlot /* "-" */ \ No newline at end of file -- GitLab From 43633d492c8a1b5d9cb793788e09567f393f896b Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Sun, 9 Feb 2025 20:46:21 +0100 Subject: [PATCH 019/113] fix instrumentation --- lib_com/ivas_dirac_com.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib_com/ivas_dirac_com.c b/lib_com/ivas_dirac_com.c index e07d36b1e..2704c1f08 100644 --- a/lib_com/ivas_dirac_com.c +++ b/lib_com/ivas_dirac_com.c @@ -975,13 +975,13 @@ void computeDiffuseness_fixed( if ( shift_q < 0 ) { shiftEquiv = L_lshl( 0x80000000, shift_q ); - shift_qtotal = sub( min_q_shift1, 0 ); } if ( shift_q >= 0 ) { shiftEquiv = L_add( 0x7FFFFFFF, 0 ); - shift_qtotal = sub( min_q_shift1, shift_q ); } + shift_qtotal = sub( min_q_shift1, s_max( shift_q, 0 ) ); + FOR( k = 0; k < num_freq_bands; k++ ) { tmp = L_shl( p_tmp_c[k], shift_qtotal ); @@ -1018,16 +1018,16 @@ void computeDiffuseness_fixed( shift_q = sub( q_tmp, q_intensity ); #ifdef FIX_1072_SPEEDUP_COMPUTEDIFUSENESS - if ( shift_q >= 0 ) - { - shiftEquiv = L_lshl( 0x7FFFFFFF, 0 ); - shift_qtotal = sub( min_q_shift2, shift_q ); - } if ( shift_q < 0 ) { shiftEquiv = L_lshl( 0x80000000, shift_q ); - shift_qtotal = sub( min_q_shift2, 0 ); } + if ( shift_q >= 0 ) + { + shiftEquiv = L_lshl( 0x7FFFFFFF, 0 ); + } + shift_qtotal = sub( min_q_shift2, s_max( shift_q, 0 ) ); + FOR( j = 0; j < DIRAC_NUM_DIMS; ++j ) { p_tmp = buffer_intensity[j][i]; -- GitLab From 19726c715a0689d98b57bc4a9d18e72bd8c44b1e Mon Sep 17 00:00:00 2001 From: Thomas Dettbarn Date: Tue, 11 Feb 2025 10:27:38 +0100 Subject: [PATCH 020/113] fix(point)ed RCcontextMapping_encode2_estimate_bandWise_start_fx() and RCcontextMapping_encode2_estimate_bandWise_fx() already. --- lib_enc/ACcontextMapping_enc_fx.c | 122 +++++++++++++++--------------- lib_enc/stat_enc.h | 3 +- 2 files changed, 64 insertions(+), 61 deletions(-) diff --git a/lib_enc/ACcontextMapping_enc_fx.c b/lib_enc/ACcontextMapping_enc_fx.c index 08baa4f3d..53af78878 100644 --- a/lib_enc/ACcontextMapping_enc_fx.c +++ b/lib_enc/ACcontextMapping_enc_fx.c @@ -16,6 +16,9 @@ #include "prot_fx_enc.h" #include "ivas_prot.h" /* Range coder header file */ +#define MAKE_NUMBER_QX(number,QX) ((number)<<(QX)) +#define MAKE_VARIABLE_QX(variable,QX) W_shl(W_deposit32_l(L_deposit_l(( variable) ) ), (QX)) + /*-------------------------------------------------------------------* * ACcontextMapping_encode2_no_mem_s17_LC_fx() * @@ -1106,8 +1109,8 @@ void RCcontextMapping_encode2_no_mem_s17_LCS_fx( } /* Finish range encoder */ - rc_tot_bits = rc_uni_enc_finish_fx( &rc_st_enc ); /* No. of bits consumed by range coder Q0*/ - bp = add( rc_tot_bits, nbbits_ntuples ); /* Update bitstream pointer Q0*/ + rc_tot_bits = rc_uni_enc_finish_fx( &rc_st_enc ); /* No. of bits consumed by range coder Q0*/ + bp = add( rc_tot_bits, nbbits_ntuples ); /* Update bitstream pointer Q0*/ /* Cross-check that there is no overflow */ @@ -1215,15 +1218,15 @@ static Word16 find_last_nz_pair_fx( *-------------------------------------------------------------------*/ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( - Word16 *x, /* Spectral coefficients Q0*/ - const Word16 nt, /* L - size of spectrum (no. of spectral coefficients) Q0*/ - Word16 *lastnz_out, /* Q0 */ - Word16 *nEncoded, /* No. of spectral coefficients that can be coded without an overflow occuring Q0*/ - const Word16 target, /* Target bits Q0*/ - Word16 *stop, /* Q0 */ - Word16 mode, /* Q0 */ - CONTEXT_HM_CONFIG *hm_cfg /* context-based harmonic model configuration */ -) + Word16 *x, /* Spectral coefficients Q0*/ + const Word16 nt, /* L - size of spectrum (no. of spectral coefficients) Q0*/ + Word16 *lastnz_out, /* Q0 */ + Word16 *nEncoded, /* No. of spectral coefficients that can be coded without an overflow occuring Q0*/ + const Word16 target, /* Target bits Q0*/ + Word16 *stop, /* Q0 */ + Word16 mode, /* Q0 */ + CONTEXT_HM_CONFIG *hm_cfg /* context-based harmonic model configuration */ + ) { /* Common variables */ Word16 a1, b1; @@ -1363,7 +1366,7 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( pki = lookup[lev1]; /* ESC symbol */ bit_estimate_fx = BASOP_Util_Add_Mant32Exp( bit_estimate_fx, bit_estimate_e, ari_bit_estimate_s17_LC_fx[pki][VAL_ESC], 8, &bit_estimate_e ); /* exp(bit_estimate_e) */ - bit_estimate_fx = BASOP_Util_Add_Mant32Exp( bit_estimate_fx, bit_estimate_e, 2 * ONE_IN_Q29, 2, &bit_estimate_e ); /* Add 2 LSB bits corresponding to the bit-plane exp(bit_estimate_e) */ + bit_estimate_fx = BASOP_Util_Add_Mant32Exp( bit_estimate_fx, bit_estimate_e, 2 * ONE_IN_Q29, 2, &bit_estimate_e ); /* Add 2 LSB bits corresponding to the bit-plane exp(bit_estimate_e) */ a1 = shr( a1, 1 ); b1 = shr( b1, 1 ); @@ -1451,7 +1454,7 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( *nEncoded = lastnz2; /* Q0 */ move16(); - *stop = stop2; /* If zero, it means no overflow occured during bit-estimation Q0*/ + *stop = stop2; /* If zero, it means no overflow occured during bit-estimation Q0*/ move16(); *lastnz_out = lastnz; /* Q0 */ move16(); @@ -1512,7 +1515,7 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( lastnz = add( lastnz, 2 ); /* Q0 */ IF( LT_16( lastnz, 2 ) ) { - lastnz = 2; /* At least one tuple is coded Q0*/ + lastnz = 2; /* At least one tuple is coded Q0*/ move16(); } @@ -1611,37 +1614,37 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( move16(); } ELSE /* Overflow */ + { + IF( *stop ){ + *stop = tot_bits2; /* Q0 */ + move16(); + } + ELSE { - IF( *stop ){ - *stop = tot_bits2; /* Q0 */ + *stop = round_fx( L_shr( bit_estimate_fx, sub( Q15, bit_estimate_e ) ) ); /* Q0 */ + move16(); + } + } + + *lastnz_out = lastnz; /* Q0 */ move16(); - } - ELSE - { - *stop = round_fx( L_shr( bit_estimate_fx, sub( Q15, bit_estimate_e ) ) ); /* Q0 */ + *nEncoded = lastnz2; /* Q0 */ move16(); - } -} + /* Safety mechanism to avoid overflow */ + test(); + IF( EQ_16( lastnz2, 2 ) && EQ_16( overflow_flag, 1 ) ) + { + FOR( k = 0; k < lastnz2; k++ ) + { + x[k] = 0; + move16(); + } + } -*lastnz_out = lastnz; /* Q0 */ -move16(); -*nEncoded = lastnz2; /* Q0 */ -move16(); -/* Safety mechanism to avoid overflow */ -test(); -IF( EQ_16( lastnz2, 2 ) && EQ_16( overflow_flag, 1 ) ) -{ - FOR( k = 0; k < lastnz2; k++ ) - { - x[k] = 0; - move16(); + return tot_bits2; } } -return tot_bits2; -} -} - /*-------------------------------------------------------------------* * RCcontextMapping_encode2_estimate_bandWise_start_fx() @@ -1669,10 +1672,9 @@ Word16 RCcontextMapping_encode2_estimate_bandWise_start_fx( move16(); } - hContextMem->bit_estimate_fx = 2; /* Q0 */ - move32(); - hContextMem->bit_estimate_e = Q31; - move16(); + hContextMem->bit_estimate_accu = MAKE_NUMBER_QX(2, Q23 ); + move64(); + /* Init */ @@ -1682,18 +1684,21 @@ Word16 RCcontextMapping_encode2_estimate_bandWise_start_fx( /* bits to encode lastnz */ k = 1; move16(); + i = 2; + move16(); WHILE( LT_16( k, hContextMem->nt_half ) ) { - hContextMem->bit_estimate_fx = L_add( hContextMem->bit_estimate_fx, 1 ); /* exp(bit_estimate_e) */ - move32(); + hContextMem->bit_estimate_accu = W_add( hContextMem->bit_estimate_accu, MAKE_NUMBER_QX(1, Q23 ) ); + move64(); k = shl( k, 1 ); + i = add( i, 1 ); /* check while condition */ } /* bits to encode lastnz */ - hContextMem->nbits_old = extract_l( hContextMem->bit_estimate_fx ); /* Q0 */ + hContextMem->nbits_old = i; move16(); hContextMem->ctx = 0; @@ -1713,14 +1718,8 @@ Word16 RCcontextMapping_encode2_estimate_bandWise_start_fx( BREAK; } } - Word16 tmp2 = extract_l( hContextMem->bit_estimate_fx ); - Word16 tmp = norm_l( hContextMem->bit_estimate_fx ); - hContextMem->bit_estimate_e = sub( Q31, tmp ); - move16(); - hContextMem->bit_estimate_fx = L_shl( hContextMem->bit_estimate_fx, tmp ); /* exp(bit_estimate_e) */ - move32(); - return tmp2; + return hContextMem->nbits_old; } /*-------------------------------------------------------------------* @@ -1777,8 +1776,9 @@ Word16 RCcontextMapping_encode2_estimate_bandWise_fx( lev1 = -( 1 << ( NBITS_CONTEXT + NBITS_RATEQ ) ); /* Q0 */ /* Signs Bits */ - hContextMem->bit_estimate_fx = BASOP_Util_Add_Mant32Exp( hContextMem->bit_estimate_fx, hContextMem->bit_estimate_e, imult3216( ONE_IN_Q30, s_min( a1, 1 ) ), Q1, &hContextMem->bit_estimate_e ); /* exp(hContextMem->bit_estimate_e) */ - hContextMem->bit_estimate_fx = BASOP_Util_Add_Mant32Exp( hContextMem->bit_estimate_fx, hContextMem->bit_estimate_e, imult3216( ONE_IN_Q30, s_min( b1, 1 ) ), Q1, &hContextMem->bit_estimate_e ); /* exp(hContextMem->bit_estimate_e) */ + hContextMem->bit_estimate_accu = W_add_nosat( hContextMem->bit_estimate_accu, MAKE_VARIABLE_QX( s_min( a1, 1 ), Q23 ) ); + hContextMem->bit_estimate_accu = W_add_nosat( hContextMem->bit_estimate_accu, MAKE_VARIABLE_QX( s_min( b1, 1 ), Q23 ) ); + move32(); move32(); @@ -1792,11 +1792,13 @@ Word16 RCcontextMapping_encode2_estimate_bandWise_fx( pki = lookup[lev1]; /* Q0 */ move16(); - hContextMem->bit_estimate_fx = BASOP_Util_Add_Mant32Exp( hContextMem->bit_estimate_fx, hContextMem->bit_estimate_e, ari_bit_estimate_s17_LC_fx[pki][VAL_ESC], Q8, &hContextMem->bit_estimate_e ); /* exp(hContextMem->bit_estimate_e) */ - hContextMem->bit_estimate_fx = BASOP_Util_Add_Mant32Exp( hContextMem->bit_estimate_fx, hContextMem->bit_estimate_e, 2 * ONE_IN_Q29, Q2, &hContextMem->bit_estimate_e ); /* Add the 2 LSB bits that were shifted out exp(hContextMem->bit_estimate_e) */ + hContextMem->bit_estimate_accu = W_add_nosat( hContextMem->bit_estimate_accu, ari_bit_estimate_s17_LC_fx[pki][VAL_ESC] ); + hContextMem->bit_estimate_accu = W_add_nosat( hContextMem->bit_estimate_accu, MAKE_VARIABLE_QX(2, Q23 ) ); move32(); move32(); + + // 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 */ @@ -1809,8 +1811,9 @@ Word16 RCcontextMapping_encode2_estimate_bandWise_fx( pki = lookup[lev1]; /* Q0 */ move16(); - symbol = add( a1, i_mult( A_THRES, b1 ) ); /* MSB symbol Q0*/ - hContextMem->bit_estimate_fx = BASOP_Util_Add_Mant32Exp( hContextMem->bit_estimate_fx, hContextMem->bit_estimate_e, ari_bit_estimate_s17_LC_fx[pki][symbol], Q8, &hContextMem->bit_estimate_e ); /* exp(bit_estimate_e) */ + symbol = add( a1, i_mult( A_THRES, b1 ) ); /* MSB symbol Q0*/ + hContextMem->bit_estimate_accu = W_add_nosat( hContextMem->bit_estimate_accu, ari_bit_estimate_s17_LC_fx[pki][symbol] ); + move32(); // hContextMem->bit_estimate = hContextMem->bit_estimate + ari_bit_estimate_s17_LC[pki][symbol]; @@ -1830,9 +1833,10 @@ Word16 RCcontextMapping_encode2_estimate_bandWise_fx( move16(); } /*end of the 2-tuples loop*/ - total_output_bits = round_fx( L_shr( hContextMem->bit_estimate_fx, sub( Q15, hContextMem->bit_estimate_e ) ) ); /* Q0 */ + total_output_bits = round_fx( W_shr( hContextMem->bit_estimate_accu, Q7 ) ); /* Q0 */ // total_output_bits = (Word16) ( hContextMem->bit_estimate + 0.5f ); + bandBits = sub( total_output_bits, hContextMem->nbits_old ); /* Q0 */ hContextMem->nbits_old = total_output_bits; /* Q0 */ move16(); diff --git a/lib_enc/stat_enc.h b/lib_enc/stat_enc.h index 0f1c2e906..a3a743509 100644 --- a/lib_enc/stat_enc.h +++ b/lib_enc/stat_enc.h @@ -2348,8 +2348,7 @@ typedef struct context_rc_mem_struct { int16_t nbits_old; int16_t ctx; - Word32 bit_estimate_fx; - Word16 bit_estimate_e; + Word64 bit_estimate_accu; int16_t rateFlag; int16_t lastnz; int16_t nt_half; -- GitLab From 0a0a50baf43f721019b3d5f55672e05cbd3a547e Mon Sep 17 00:00:00 2001 From: Thomas Dettbarn Date: Tue, 11 Feb 2025 12:51:54 +0100 Subject: [PATCH 021/113] removed bit_estimate_fx and bit_estimate_e from the ACcontextMapping_enc_fx.c completely. --- lib_enc/ACcontextMapping_enc_fx.c | 87 ++++++++++++++----------------- 1 file changed, 40 insertions(+), 47 deletions(-) diff --git a/lib_enc/ACcontextMapping_enc_fx.c b/lib_enc/ACcontextMapping_enc_fx.c index 53af78878..2c58b4557 100644 --- a/lib_enc/ACcontextMapping_enc_fx.c +++ b/lib_enc/ACcontextMapping_enc_fx.c @@ -1230,43 +1230,40 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( { /* Common variables */ Word16 a1, b1; - Word16 k, pki, lev1; + Word16 i, k, pki, lev1; UWord16 t; Word16 lastnz, lastnz2; Word16 rateFlag; - Word32 bit_estimate_fx; - Word16 bit_estimate_e; + Word64 bit_estimate_accu; + Word16 symbol; const UWord8 *lookup; - Word32 nbits2_fx; // Q23 - Word16 nbits2_e; + Word64 nbits2_accu; /* Initialization */ - bit_estimate_fx = 2 * ONE_IN_Q29; - bit_estimate_e = 2; - move32(); - move16(); + bit_estimate_accu = MAKE_NUMBER_QX(2, Q23 ); + move64(); - nbits2_fx = 0; - nbits2_e = 0; - move32(); - move16(); + nbits2_accu = 0; + move64(); /* bits to encode lastnz */ k = 1; move16(); + i = 2; + move64(); WHILE( LT_16( k, nt / 2 ) ) { - bit_estimate_fx = BASOP_Util_Add_Mant32Exp( bit_estimate_fx, bit_estimate_e, ONE_IN_Q30, 1, &bit_estimate_e ); - k = k << 1; + bit_estimate_accu = W_add( bit_estimate_accu, MAKE_NUMBER_QX(1, Q23 ) ); + k = shl( k, 1 ); + i = add( i, 2 ); /* check while condition */ + } - nbits2_fx = bit_estimate_fx; /* exp(bit_estimate_e) */ - nbits2_e = bit_estimate_e; - move32(); - move16(); + nbits2_accu = bit_estimate_accu; + move64(); IF( hm_cfg ) { @@ -1353,9 +1350,8 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( b1 = (Word16) abs( x[b1_i] ); lev1 = -( 1 << ( NBITS_CONTEXT + NBITS_RATEQ ) ); - bit_estimate_fx = BASOP_Util_Add_Mant32Exp( bit_estimate_fx, bit_estimate_e, s_min( a1, 1 ) * ONE_IN_Q30, 1, &bit_estimate_e ); /* exp(bit_estimate_e) */ - bit_estimate_fx = BASOP_Util_Add_Mant32Exp( bit_estimate_fx, bit_estimate_e, s_min( b1, 1 ) * ONE_IN_Q30, 1, &bit_estimate_e ); /* exp(bit_estimate_e) */ - + bit_estimate_accu = W_add_nosat( bit_estimate_accu, MAKE_VARIABLE_QX( s_min( a1, 1 ), Q23 ) ); + bit_estimate_accu = W_add_nosat( bit_estimate_accu, MAKE_VARIABLE_QX( s_min( b1, 1 ), Q23 ) ); /* 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 ) ); @@ -1365,9 +1361,8 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( { pki = lookup[lev1]; /* ESC symbol */ - bit_estimate_fx = BASOP_Util_Add_Mant32Exp( bit_estimate_fx, bit_estimate_e, ari_bit_estimate_s17_LC_fx[pki][VAL_ESC], 8, &bit_estimate_e ); /* exp(bit_estimate_e) */ - bit_estimate_fx = BASOP_Util_Add_Mant32Exp( bit_estimate_fx, bit_estimate_e, 2 * ONE_IN_Q29, 2, &bit_estimate_e ); /* Add 2 LSB bits corresponding to the bit-plane exp(bit_estimate_e) */ - + bit_estimate_accu = W_add_nosat( bit_estimate_accu, ari_bit_estimate_s17_LC_fx[pki][VAL_ESC] ); + bit_estimate_accu = W_add_nosat( bit_estimate_accu, MAKE_VARIABLE_QX(2, Q23 ) ); a1 = shr( a1, 1 ); b1 = shr( b1, 1 ); @@ -1379,10 +1374,10 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( pki = lookup[lev1]; symbol = add( a1, i_mult( A_THRES, b1 ) ); /* Q0 */ - bit_estimate_fx = BASOP_Util_Add_Mant32Exp( bit_estimate_fx, bit_estimate_e, ari_bit_estimate_s17_LC_fx[pki][symbol], 8, &bit_estimate_e ); /* exp(bit_estimate_e) */ + bit_estimate_accu = W_add_nosat( bit_estimate_accu, ari_bit_estimate_s17_LC_fx[pki][symbol] ); /* Should we truncate? */ - IF( GT_32( L_shr( bit_estimate_fx, sub( Q16, bit_estimate_e ) ), L_shl( target, Q15 ) ) ) + IF( GT_32( W_shr( bit_estimate_accu, Q8 ), L_shl( target, Q15 ) ) ) { stop2 = 1; move16(); @@ -1395,10 +1390,8 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( ELSE { lastnz2 = add( b1_i, 1 ); - nbits2_fx = bit_estimate_fx; - move32(); - nbits2_e = bit_estimate_e; - move16(); + nbits2_accu = bit_estimate_accu; + move64(); } /* Update context for next 2-tuple */ @@ -1439,11 +1432,11 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( } /*end of the 2-tuples loop*/ - total_output_bits = round_fx( L_shr( bit_estimate_fx, sub( Q15, bit_estimate_e ) ) ); /* Q0 */ + total_output_bits = round_fx( W_shr(bit_estimate_accu, Q7 ) ); IF( *stop ) { - total_output_bits = round_fx( L_shr( nbits2_fx, sub( Q15, nbits2_e ) ) ); /* Q0 */ + total_output_bits = round_fx( W_shr( nbits2_accu, Q7 ) ); } IF( stop2 ) @@ -1468,7 +1461,8 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( hm_cfg->numPeakIndices = numPeakIndicesOrig; /* Q0 */ move16(); - return round_fx( L_add( L_shr( nbits2_fx, sub( Q15, nbits2_e ) ), ONE_IN_Q14 ) ); /* Q0 */ + + return round_fx( L_add( W_shr( nbits2_accu, Q7 ), ONE_IN_Q14 ) ); /* Q0 */ } ELSE /* if (!hm_cfg) */ { @@ -1534,8 +1528,8 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( move16(); rateQ = add( rateFlag, extract_l( GT_16( k, shr( nt, 1 ) ) ) ); /* Q0 */ - bit_estimate_fx = BASOP_Util_Add_Mant32Exp( bit_estimate_fx, bit_estimate_e, s_min( a1, 1 ) * ONE_IN_Q30, 1, &bit_estimate_e ); /* exp(bit_estimate_e) */ - bit_estimate_fx = BASOP_Util_Add_Mant32Exp( bit_estimate_fx, bit_estimate_e, s_min( b1, 1 ) * ONE_IN_Q30, 1, &bit_estimate_e ); /* exp(bit_estimate_e) */ + bit_estimate_accu = W_add_nosat( bit_estimate_accu, MAKE_VARIABLE_QX( s_min( a1, 1 ), Q23 ) ); + bit_estimate_accu = W_add_nosat( bit_estimate_accu, MAKE_VARIABLE_QX( s_min( b1, 1 ), Q23 ) ); /* 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 + shl( rateQ, NBITS_CONTEXT )]; /* Q0 */ @@ -1547,8 +1541,8 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( pki = lookup[( esc_nb << ( NBITS_CONTEXT + NBITS_RATEQ ) )]; /* Q0 */ move16(); - bit_estimate_fx = BASOP_Util_Add_Mant32Exp( bit_estimate_fx, bit_estimate_e, ari_bit_estimate_s17_LC_fx[pki][VAL_ESC], 8, &bit_estimate_e ); /* exp(bit_estimate_e) */ - bit_estimate_fx = BASOP_Util_Add_Mant32Exp( bit_estimate_fx, bit_estimate_e, 2 * ONE_IN_Q29, 2, &bit_estimate_e ); /* Add 2 LSB bits corresponding to the bit-plane exp(bit_estimate_e) */ + bit_estimate_accu = W_add_nosat( bit_estimate_accu, ari_bit_estimate_s17_LC_fx[pki][VAL_ESC] ); + bit_estimate_accu = W_add_nosat( bit_estimate_accu, MAKE_VARIABLE_QX(2, Q23 ) ); a1 = shr( a1, 1 ); b1 = shr( b1, 1 ); @@ -1563,10 +1557,10 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( move16(); symbol = add( a1, i_mult( A_THRES, b1 ) ); /* Q0 */ - bit_estimate_fx = BASOP_Util_Add_Mant32Exp( bit_estimate_fx, bit_estimate_e, ari_bit_estimate_s17_LC_fx[pki][symbol], 8, &bit_estimate_e ); /* exp(bit_estimate_e) */ + bit_estimate_accu = W_add_nosat( bit_estimate_accu, ari_bit_estimate_s17_LC_fx[pki][symbol] ); /* Should we truncate? */ - IF( GT_32( L_shr( bit_estimate_fx, sub( Q16, bit_estimate_e ) ), L_shl( target, Q15 ) ) ) /* Overflow occured */ + IF( GT_32( W_shr( bit_estimate_accu, Q8 ), L_shl( target, Q15 ) ) ) { overflow_flag = 1; move16(); @@ -1575,10 +1569,9 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( { IF( abs_s( x[k] ) || abs_s( x[k + 1] ) ) /* No overflow & non-zero tuple */ { - nbits2_fx = bit_estimate_fx; /* exp(bit_estimate_e) */ - nbits2_e = bit_estimate_e; - move32(); - move16(); + nbits2_accu = bit_estimate_accu; /* exp(bit_estimate_e) */ + move64(); + lastnz2 = add( k, 2 ); } } @@ -1598,7 +1591,7 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( } /*end of the 2-tuples loop*/ - tot_bits2 = round_fx( L_shr( nbits2_fx, sub( Q15, nbits2_e ) ) ); + tot_bits2 = round_fx( W_shr( nbits2_accu, Q7 ) ); IF( LT_16( lastnz2, lastnz ) ) /* Overflow occured because unable to code all tuples */ { overflow_flag = 1; @@ -1606,7 +1599,7 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( } IF( EQ_16( mode, -1 ) ) { - tot_bits2 = round_fx( L_shr( bit_estimate_fx, sub( Q15, bit_estimate_e ) ) ); /* Q0 */ + tot_bits2 = round_fx( W_shr( bit_estimate_accu, Q7 ) ); } IF( overflow_flag == 0 ) /* No overflow */ { @@ -1621,7 +1614,7 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( } ELSE { - *stop = round_fx( L_shr( bit_estimate_fx, sub( Q15, bit_estimate_e ) ) ); /* Q0 */ + *stop = round_fx( W_shr( bit_estimate_accu, Q7 ) ); move16(); } } -- GitLab From 95a6efce548173b6b0c53bf197c5c1447615abfa Mon Sep 17 00:00:00 2001 From: Thomas Dettbarn Date: Wed, 12 Feb 2025 11:13:52 +0100 Subject: [PATCH 022/113] applied the patches from the review. --- lib_enc/ACcontextMapping_enc_fx.c | 85 +++++++++++++++---------------- lib_enc/stat_enc.h | 2 +- 2 files changed, 43 insertions(+), 44 deletions(-) diff --git a/lib_enc/ACcontextMapping_enc_fx.c b/lib_enc/ACcontextMapping_enc_fx.c index 2c58b4557..f0298a647 100644 --- a/lib_enc/ACcontextMapping_enc_fx.c +++ b/lib_enc/ACcontextMapping_enc_fx.c @@ -16,8 +16,8 @@ #include "prot_fx_enc.h" #include "ivas_prot.h" /* Range coder header file */ -#define MAKE_NUMBER_QX(number,QX) ((number)<<(QX)) -#define MAKE_VARIABLE_QX(variable,QX) W_shl(W_deposit32_l(L_deposit_l(( variable) ) ), (QX)) +#define MAKE_NUMBER_QX( number, QX ) ( ( number ) << ( QX ) ) +#define MAKE_VARIABLE_QX( variable, QX ) W_shl( W_deposit32_l( L_deposit_l( ( variable ) ) ), ( QX ) ) /*-------------------------------------------------------------------* * ACcontextMapping_encode2_no_mem_s17_LC_fx() @@ -1218,15 +1218,15 @@ static Word16 find_last_nz_pair_fx( *-------------------------------------------------------------------*/ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( - Word16 *x, /* Spectral coefficients Q0*/ - const Word16 nt, /* L - size of spectrum (no. of spectral coefficients) Q0*/ - Word16 *lastnz_out, /* Q0 */ - Word16 *nEncoded, /* No. of spectral coefficients that can be coded without an overflow occuring Q0*/ - const Word16 target, /* Target bits Q0*/ - Word16 *stop, /* Q0 */ - Word16 mode, /* Q0 */ - CONTEXT_HM_CONFIG *hm_cfg /* context-based harmonic model configuration */ - ) + Word16 *x, /* Spectral coefficients Q0*/ + const Word16 nt, /* L - size of spectrum (no. of spectral coefficients) Q0*/ + Word16 *lastnz_out, /* Q0 */ + Word16 *nEncoded, /* No. of spectral coefficients that can be coded without an overflow occuring Q0*/ + const Word16 target, /* Target bits Q0*/ + Word16 *stop, /* Q0 */ + Word16 mode, /* Q0 */ + CONTEXT_HM_CONFIG *hm_cfg /* context-based harmonic model configuration */ +) { /* Common variables */ Word16 a1, b1; @@ -1234,14 +1234,14 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( UWord16 t; Word16 lastnz, lastnz2; Word16 rateFlag; - Word64 bit_estimate_accu; + Word64 bit_estimate_fx; Word16 symbol; const UWord8 *lookup; Word64 nbits2_accu; /* Initialization */ - bit_estimate_accu = MAKE_NUMBER_QX(2, Q23 ); + bit_estimate_fx = MAKE_NUMBER_QX(2, Q23 ); move64(); nbits2_accu = 0; @@ -1255,14 +1255,14 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( WHILE( LT_16( k, nt / 2 ) ) { - bit_estimate_accu = W_add( bit_estimate_accu, MAKE_NUMBER_QX(1, Q23 ) ); + bit_estimate_fx = W_add( bit_estimate_fx, MAKE_NUMBER_QX(1, Q23 ) ); k = shl( k, 1 ); i = add( i, 2 ); /* check while condition */ } - nbits2_accu = bit_estimate_accu; + nbits2_accu = bit_estimate_fx; move64(); IF( hm_cfg ) @@ -1350,8 +1350,8 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( b1 = (Word16) abs( x[b1_i] ); lev1 = -( 1 << ( NBITS_CONTEXT + NBITS_RATEQ ) ); - bit_estimate_accu = W_add_nosat( bit_estimate_accu, MAKE_VARIABLE_QX( s_min( a1, 1 ), Q23 ) ); - bit_estimate_accu = W_add_nosat( bit_estimate_accu, MAKE_VARIABLE_QX( s_min( b1, 1 ), Q23 ) ); + bit_estimate_fx = W_add_nosat( bit_estimate_fx, MAKE_VARIABLE_QX( s_min( a1, 1 ), Q23 ) ); + bit_estimate_fx = W_add_nosat( bit_estimate_fx, MAKE_VARIABLE_QX( s_min( b1, 1 ), Q23 ) ); /* 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 ) ); @@ -1361,8 +1361,8 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( { pki = lookup[lev1]; /* ESC symbol */ - bit_estimate_accu = W_add_nosat( bit_estimate_accu, ari_bit_estimate_s17_LC_fx[pki][VAL_ESC] ); - bit_estimate_accu = W_add_nosat( bit_estimate_accu, MAKE_VARIABLE_QX(2, Q23 ) ); + bit_estimate_fx = W_add_nosat( bit_estimate_fx, ari_bit_estimate_s17_LC_fx[pki][VAL_ESC] ); + bit_estimate_fx = W_add_nosat( bit_estimate_fx, MAKE_VARIABLE_QX(2, Q23 ) ); a1 = shr( a1, 1 ); b1 = shr( b1, 1 ); @@ -1374,10 +1374,10 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( pki = lookup[lev1]; symbol = add( a1, i_mult( A_THRES, b1 ) ); /* Q0 */ - bit_estimate_accu = W_add_nosat( bit_estimate_accu, ari_bit_estimate_s17_LC_fx[pki][symbol] ); + bit_estimate_fx = W_add_nosat( bit_estimate_fx, ari_bit_estimate_s17_LC_fx[pki][symbol] ); /* Should we truncate? */ - IF( GT_32( W_shr( bit_estimate_accu, Q8 ), L_shl( target, Q15 ) ) ) + IF( GT_32( W_shr( bit_estimate_fx, Q8 ), L_shl( target, Q15 ) ) ) { stop2 = 1; move16(); @@ -1390,7 +1390,7 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( ELSE { lastnz2 = add( b1_i, 1 ); - nbits2_accu = bit_estimate_accu; + nbits2_accu = bit_estimate_fx; move64(); } @@ -1432,7 +1432,7 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( } /*end of the 2-tuples loop*/ - total_output_bits = round_fx( W_shr(bit_estimate_accu, Q7 ) ); + total_output_bits = round_fx( W_shr(bit_estimate_fx, Q7 ) ); IF( *stop ) { @@ -1528,8 +1528,8 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( move16(); rateQ = add( rateFlag, extract_l( GT_16( k, shr( nt, 1 ) ) ) ); /* Q0 */ - bit_estimate_accu = W_add_nosat( bit_estimate_accu, MAKE_VARIABLE_QX( s_min( a1, 1 ), Q23 ) ); - bit_estimate_accu = W_add_nosat( bit_estimate_accu, MAKE_VARIABLE_QX( s_min( b1, 1 ), Q23 ) ); + bit_estimate_fx = W_add_nosat( bit_estimate_fx, MAKE_VARIABLE_QX( s_min( a1, 1 ), Q23 ) ); + bit_estimate_fx = W_add_nosat( bit_estimate_fx, MAKE_VARIABLE_QX( s_min( b1, 1 ), Q23 ) ); /* 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 + shl( rateQ, NBITS_CONTEXT )]; /* Q0 */ @@ -1541,8 +1541,8 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( pki = lookup[( esc_nb << ( NBITS_CONTEXT + NBITS_RATEQ ) )]; /* Q0 */ move16(); - bit_estimate_accu = W_add_nosat( bit_estimate_accu, ari_bit_estimate_s17_LC_fx[pki][VAL_ESC] ); - bit_estimate_accu = W_add_nosat( bit_estimate_accu, MAKE_VARIABLE_QX(2, Q23 ) ); + bit_estimate_fx = W_add_nosat( bit_estimate_fx, ari_bit_estimate_s17_LC_fx[pki][VAL_ESC] ); + bit_estimate_fx = W_add_nosat( bit_estimate_fx, MAKE_VARIABLE_QX(2, Q23 ) ); a1 = shr( a1, 1 ); b1 = shr( b1, 1 ); @@ -1557,10 +1557,10 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( move16(); symbol = add( a1, i_mult( A_THRES, b1 ) ); /* Q0 */ - bit_estimate_accu = W_add_nosat( bit_estimate_accu, ari_bit_estimate_s17_LC_fx[pki][symbol] ); + bit_estimate_fx = W_add_nosat( bit_estimate_fx, ari_bit_estimate_s17_LC_fx[pki][symbol] ); /* Should we truncate? */ - IF( GT_32( W_shr( bit_estimate_accu, Q8 ), L_shl( target, Q15 ) ) ) + IF( GT_32( W_shr( bit_estimate_fx, Q8 ), L_shl( target, Q15 ) ) ) { overflow_flag = 1; move16(); @@ -1569,7 +1569,7 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( { IF( abs_s( x[k] ) || abs_s( x[k + 1] ) ) /* No overflow & non-zero tuple */ { - nbits2_accu = bit_estimate_accu; /* exp(bit_estimate_e) */ + nbits2_accu = bit_estimate_fx; /* exp(bit_estimate_e) */ move64(); lastnz2 = add( k, 2 ); @@ -1599,7 +1599,7 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( } IF( EQ_16( mode, -1 ) ) { - tot_bits2 = round_fx( W_shr( bit_estimate_accu, Q7 ) ); + tot_bits2 = round_fx( W_shr( bit_estimate_fx, Q7 ) ); } IF( overflow_flag == 0 ) /* No overflow */ { @@ -1614,7 +1614,7 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( } ELSE { - *stop = round_fx( W_shr( bit_estimate_accu, Q7 ) ); + *stop = round_fx( W_shr( bit_estimate_fx, Q7 ) ); move16(); } } @@ -1665,7 +1665,7 @@ Word16 RCcontextMapping_encode2_estimate_bandWise_start_fx( move16(); } - hContextMem->bit_estimate_accu = MAKE_NUMBER_QX(2, Q23 ); + hContextMem->bit_estimate_fx = MAKE_NUMBER_QX(2, Q23 ); move64(); @@ -1682,7 +1682,7 @@ Word16 RCcontextMapping_encode2_estimate_bandWise_start_fx( WHILE( LT_16( k, hContextMem->nt_half ) ) { - hContextMem->bit_estimate_accu = W_add( hContextMem->bit_estimate_accu, MAKE_NUMBER_QX(1, Q23 ) ); + hContextMem->bit_estimate_fx = W_add( hContextMem->bit_estimate_fx, MAKE_NUMBER_QX( 1, Q23 ) ); move64(); k = shl( k, 1 ); @@ -1769,8 +1769,8 @@ Word16 RCcontextMapping_encode2_estimate_bandWise_fx( lev1 = -( 1 << ( NBITS_CONTEXT + NBITS_RATEQ ) ); /* Q0 */ /* Signs Bits */ - hContextMem->bit_estimate_accu = W_add_nosat( hContextMem->bit_estimate_accu, MAKE_VARIABLE_QX( s_min( a1, 1 ), Q23 ) ); - hContextMem->bit_estimate_accu = W_add_nosat( hContextMem->bit_estimate_accu, MAKE_VARIABLE_QX( s_min( b1, 1 ), Q23 ) ); + hContextMem->bit_estimate_fx = W_add_nosat( hContextMem->bit_estimate_fx, MAKE_VARIABLE_QX( s_min( a1, 1 ), Q23 ) ); + hContextMem->bit_estimate_fx = W_add_nosat( hContextMem->bit_estimate_fx, MAKE_VARIABLE_QX( s_min( b1, 1 ), Q23 ) ); move32(); move32(); @@ -1785,13 +1785,12 @@ Word16 RCcontextMapping_encode2_estimate_bandWise_fx( pki = lookup[lev1]; /* Q0 */ move16(); - hContextMem->bit_estimate_accu = W_add_nosat( hContextMem->bit_estimate_accu, ari_bit_estimate_s17_LC_fx[pki][VAL_ESC] ); - hContextMem->bit_estimate_accu = W_add_nosat( hContextMem->bit_estimate_accu, MAKE_VARIABLE_QX(2, Q23 ) ); + hContextMem->bit_estimate_fx = W_add_nosat( hContextMem->bit_estimate_fx, ari_bit_estimate_s17_LC_fx[pki][VAL_ESC] ); + hContextMem->bit_estimate_fx = W_add_nosat( hContextMem->bit_estimate_fx, MAKE_VARIABLE_QX( 2, Q23 ) ); move32(); move32(); - // 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 */ @@ -1804,8 +1803,8 @@ Word16 RCcontextMapping_encode2_estimate_bandWise_fx( pki = lookup[lev1]; /* Q0 */ move16(); - symbol = add( a1, i_mult( A_THRES, b1 ) ); /* MSB symbol Q0*/ - hContextMem->bit_estimate_accu = W_add_nosat( hContextMem->bit_estimate_accu, ari_bit_estimate_s17_LC_fx[pki][symbol] ); + symbol = add( a1, i_mult( A_THRES, b1 ) ); /* MSB symbol Q0*/ + hContextMem->bit_estimate_fx = W_add_nosat( hContextMem->bit_estimate_fx, ari_bit_estimate_s17_LC_fx[pki][symbol] ); move32(); // hContextMem->bit_estimate = hContextMem->bit_estimate + ari_bit_estimate_s17_LC[pki][symbol]; @@ -1825,8 +1824,8 @@ Word16 RCcontextMapping_encode2_estimate_bandWise_fx( hContextMem->ctx = add( i_mult( s_and( hContextMem->ctx, 0xf ), 16 ), t ); /* Q0 */ move16(); - } /*end of the 2-tuples loop*/ - total_output_bits = round_fx( W_shr( hContextMem->bit_estimate_accu, Q7 ) ); /* Q0 */ + } /*end of the 2-tuples loop*/ + total_output_bits = round_fx( W_shr( hContextMem->bit_estimate_fx, Q7 ) ); /* Q0 */ // total_output_bits = (Word16) ( hContextMem->bit_estimate + 0.5f ); diff --git a/lib_enc/stat_enc.h b/lib_enc/stat_enc.h index a3a743509..ee7f7f9b4 100644 --- a/lib_enc/stat_enc.h +++ b/lib_enc/stat_enc.h @@ -2348,7 +2348,7 @@ typedef struct context_rc_mem_struct { int16_t nbits_old; int16_t ctx; - Word64 bit_estimate_accu; + Word64 bit_estimate_fx; int16_t rateFlag; int16_t lastnz; int16_t nt_half; -- GitLab From 4454ffcb6b9557f8f989a470878993c52fce6f6e Mon Sep 17 00:00:00 2001 From: Thomas Dettbarn Date: Wed, 12 Feb 2025 11:30:22 +0100 Subject: [PATCH 023/113] added a comment for the datatype (Q23). --- lib_enc/ACcontextMapping_enc_fx.c | 2 +- lib_enc/stat_enc.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_enc/ACcontextMapping_enc_fx.c b/lib_enc/ACcontextMapping_enc_fx.c index f0298a647..d20db6b86 100644 --- a/lib_enc/ACcontextMapping_enc_fx.c +++ b/lib_enc/ACcontextMapping_enc_fx.c @@ -1234,7 +1234,7 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( UWord16 t; Word16 lastnz, lastnz2; Word16 rateFlag; - Word64 bit_estimate_fx; + Word64 bit_estimate_fx; /* Q23 */ Word16 symbol; const UWord8 *lookup; diff --git a/lib_enc/stat_enc.h b/lib_enc/stat_enc.h index ee7f7f9b4..0fa9aeb88 100644 --- a/lib_enc/stat_enc.h +++ b/lib_enc/stat_enc.h @@ -2348,7 +2348,7 @@ typedef struct context_rc_mem_struct { int16_t nbits_old; int16_t ctx; - Word64 bit_estimate_fx; + Word64 bit_estimate_fx; /* Q23 */ int16_t rateFlag; int16_t lastnz; int16_t nt_half; -- GitLab From ea99231dc0aac04b07fbe0ef59ee1b80919e3f31 Mon Sep 17 00:00:00 2001 From: Thomas Dettbarn Date: Wed, 12 Feb 2025 12:28:52 +0100 Subject: [PATCH 024/113] applied the formatting patch. --- lib_enc/ACcontextMapping_enc_fx.c | 72 +++++++++++++++---------------- 1 file changed, 35 insertions(+), 37 deletions(-) diff --git a/lib_enc/ACcontextMapping_enc_fx.c b/lib_enc/ACcontextMapping_enc_fx.c index d20db6b86..0e816e77c 100644 --- a/lib_enc/ACcontextMapping_enc_fx.c +++ b/lib_enc/ACcontextMapping_enc_fx.c @@ -1238,10 +1238,10 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( Word16 symbol; const UWord8 *lookup; - Word64 nbits2_accu; + Word64 nbits2_accu; /* Initialization */ - bit_estimate_fx = MAKE_NUMBER_QX(2, Q23 ); + bit_estimate_fx = MAKE_NUMBER_QX( 2, Q23 ); move64(); nbits2_accu = 0; @@ -1255,11 +1255,10 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( WHILE( LT_16( k, nt / 2 ) ) { - bit_estimate_fx = W_add( bit_estimate_fx, MAKE_NUMBER_QX(1, Q23 ) ); + bit_estimate_fx = W_add( bit_estimate_fx, MAKE_NUMBER_QX( 1, Q23 ) ); k = shl( k, 1 ); i = add( i, 2 ); /* check while condition */ - } nbits2_accu = bit_estimate_fx; @@ -1362,7 +1361,7 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( pki = lookup[lev1]; /* ESC symbol */ bit_estimate_fx = W_add_nosat( bit_estimate_fx, ari_bit_estimate_s17_LC_fx[pki][VAL_ESC] ); - bit_estimate_fx = W_add_nosat( bit_estimate_fx, MAKE_VARIABLE_QX(2, Q23 ) ); + bit_estimate_fx = W_add_nosat( bit_estimate_fx, MAKE_VARIABLE_QX( 2, Q23 ) ); a1 = shr( a1, 1 ); b1 = shr( b1, 1 ); @@ -1373,7 +1372,7 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( pki = lookup[lev1]; - symbol = add( a1, i_mult( A_THRES, b1 ) ); /* Q0 */ + symbol = add( a1, i_mult( A_THRES, b1 ) ); /* Q0 */ bit_estimate_fx = W_add_nosat( bit_estimate_fx, ari_bit_estimate_s17_LC_fx[pki][symbol] ); /* Should we truncate? */ @@ -1390,7 +1389,7 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( ELSE { lastnz2 = add( b1_i, 1 ); - nbits2_accu = bit_estimate_fx; + nbits2_accu = bit_estimate_fx; move64(); } @@ -1432,7 +1431,7 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( } /*end of the 2-tuples loop*/ - total_output_bits = round_fx( W_shr(bit_estimate_fx, Q7 ) ); + total_output_bits = round_fx( W_shr( bit_estimate_fx, Q7 ) ); IF( *stop ) { @@ -1542,7 +1541,7 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( move16(); bit_estimate_fx = W_add_nosat( bit_estimate_fx, ari_bit_estimate_s17_LC_fx[pki][VAL_ESC] ); - bit_estimate_fx = W_add_nosat( bit_estimate_fx, MAKE_VARIABLE_QX(2, Q23 ) ); + bit_estimate_fx = W_add_nosat( bit_estimate_fx, MAKE_VARIABLE_QX( 2, Q23 ) ); a1 = shr( a1, 1 ); b1 = shr( b1, 1 ); @@ -1556,7 +1555,7 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( pki = lookup[( esc_nb << ( NBITS_CONTEXT + NBITS_RATEQ ) )]; /* Q0 */ move16(); - symbol = add( a1, i_mult( A_THRES, b1 ) ); /* Q0 */ + symbol = add( a1, i_mult( A_THRES, b1 ) ); /* Q0 */ bit_estimate_fx = W_add_nosat( bit_estimate_fx, ari_bit_estimate_s17_LC_fx[pki][symbol] ); /* Should we truncate? */ @@ -1607,37 +1606,37 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( move16(); } ELSE /* Overflow */ - { - IF( *stop ){ - *stop = tot_bits2; /* Q0 */ - move16(); - } - ELSE { - *stop = round_fx( W_shr( bit_estimate_fx, Q7 ) ); - move16(); - } - } - - *lastnz_out = lastnz; /* Q0 */ + IF( *stop ){ + *stop = tot_bits2; /* Q0 */ move16(); - *nEncoded = lastnz2; /* Q0 */ + } + ELSE + { + *stop = round_fx( W_shr( bit_estimate_fx, Q7 ) ); move16(); - /* Safety mechanism to avoid overflow */ - test(); - IF( EQ_16( lastnz2, 2 ) && EQ_16( overflow_flag, 1 ) ) - { - FOR( k = 0; k < lastnz2; k++ ) - { - x[k] = 0; - move16(); - } - } + } +} - return tot_bits2; +*lastnz_out = lastnz; /* Q0 */ +move16(); +*nEncoded = lastnz2; /* Q0 */ +move16(); +/* Safety mechanism to avoid overflow */ +test(); +IF( EQ_16( lastnz2, 2 ) && EQ_16( overflow_flag, 1 ) ) +{ + FOR( k = 0; k < lastnz2; k++ ) + { + x[k] = 0; + move16(); } } +return tot_bits2; +} +} + /*-------------------------------------------------------------------* * RCcontextMapping_encode2_estimate_bandWise_start_fx() @@ -1665,9 +1664,8 @@ Word16 RCcontextMapping_encode2_estimate_bandWise_start_fx( move16(); } - hContextMem->bit_estimate_fx = MAKE_NUMBER_QX(2, Q23 ); + hContextMem->bit_estimate_fx = MAKE_NUMBER_QX( 2, Q23 ); move64(); - /* Init */ @@ -1824,7 +1822,7 @@ Word16 RCcontextMapping_encode2_estimate_bandWise_fx( hContextMem->ctx = add( i_mult( s_and( hContextMem->ctx, 0xf ), 16 ), t ); /* Q0 */ move16(); - } /*end of the 2-tuples loop*/ + } /*end of the 2-tuples loop*/ total_output_bits = round_fx( W_shr( hContextMem->bit_estimate_fx, Q7 ) ); /* Q0 */ // total_output_bits = (Word16) ( hContextMem->bit_estimate + 0.5f ); -- GitLab From 1ed2851535b85c983858296f3a4b977f57bcb257 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Wed, 12 Feb 2025 21:32:05 +0530 Subject: [PATCH 025/113] Fix for 3GPP issue 1202: BASOP encoder ParamISM: strong timbre differences in the noise track Link #1202 --- lib_enc/ivas_ism_param_enc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib_enc/ivas_ism_param_enc.c b/lib_enc/ivas_ism_param_enc.c index 1430607d6..5e91a30fb 100644 --- a/lib_enc/ivas_ism_param_enc.c +++ b/lib_enc/ivas_ism_param_enc.c @@ -307,7 +307,7 @@ void ivas_param_ism_stereo_dmx_fx( /* Smoothing */ cardioid_left[i] = add( mult( 24576 /* 0.75f in Q15 */, cardioid_left[i] ), mult( 8192 /* 0.25f in Q15 */, last_cardioid_left ) ); // Q14 move16(); - grad = mult( sub( cardioid_left[i], last_cardioid_left ), shl( one_by_input_frame, 1 ) /* 2.0f / (float) input_frame*/ ); /* Q14 */ /* for the right cardioid, multiply with -1 */ + Word32 grad_32 = L_mult( sub( cardioid_left[i], last_cardioid_left ), shl( one_by_input_frame, 1 ) /* 2.0f / (float) input_frame*/ ); /* Q14+Q16 = Q30 */ /* for the right cardioid, multiply with -1 */ /* Cardioids sum up to 1 */ cardioid_right[i] = sub( ONE_IN_Q14 /* 1.0f in Q14 */, cardioid_left[i] ); /* corresponds to: alpha + ( 1 - alpha ) * cosf( tmp + tmp_1 ); */ move16(); @@ -316,13 +316,13 @@ void ivas_param_ism_stereo_dmx_fx( { tmp = data[i][j]; move32(); - tmp = W_extract_l( W_shr( W_mult_32_16( tmp, add( last_cardioid_left, mult0( j, grad ) ) ), 15 ) ); /* Qx DMX Left */ - stereo_dmx[0][j] = L_add( stereo_dmx[0][j], tmp ); /* Qx DMX Left */ + tmp = W_extract_l( W_shr( W_mult_32_32( tmp, L_add( last_cardioid_left, L_shr( Mpy_32_32( L_shl( j, 22 ), grad_32 ), 7 ) ) ), 15 ) ); /* Qx DMX Left */ + stereo_dmx[0][j] = L_add( stereo_dmx[0][j], tmp ); /* Qx DMX Left */ move32(); tmp = data[i][j]; move32(); - tmp = W_extract_l( W_shr( W_mult_32_16( tmp, add( last_cardioid_right, negate( mult0( j, grad ) ) ) ), 15 ) ); /* Qx DMX Right */ - stereo_dmx[1][j] = L_add( stereo_dmx[1][j], tmp ); /* Qx DMX Right */ + tmp = W_extract_l( W_shr( W_mult_32_32( tmp, L_add( last_cardioid_right, L_shr( L_negate( Mpy_32_32( L_shl( j, 22 ), grad_32 ) ), 7 ) ) ), 15 ) ); /* Qx DMX Right */ + stereo_dmx[1][j] = L_add( stereo_dmx[1][j], tmp ); /* Qx DMX Right */ move32(); ene_data = W_add( ene_data, W_mult_32_32( data[i][j], data[i][j] ) ); /* 2 * Qx + 1 energy of all objects combined */ } -- GitLab From 018322d6e02720037f50f6f003a858057f4a81cf Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Thu, 13 Feb 2025 16:33:45 +0530 Subject: [PATCH 026/113] Fix for 3GPP issue 1291: Wrong use of imult1616() in ACELP rescaling Link #1291 --- lib_com/cnst.h | 1 + lib_com/options.h | 1 + lib_dec/acelp_core_dec_ivas_fx.c | 4 ++++ 3 files changed, 6 insertions(+) diff --git a/lib_com/cnst.h b/lib_com/cnst.h index a5030ac9c..197fbd3c4 100644 --- a/lib_com/cnst.h +++ b/lib_com/cnst.h @@ -1536,6 +1536,7 @@ enum #define SHB_OVERLAP_LEN ( L_FRAME16k - L_SHB_LAHEAD ) / ( NUM_SHB_SUBFR - 1 ) #define QUANT_DIST_INIT ( 10000000000.0f ) /* Quantiser search distance initialisation */ #define HIBND_ACB_L_FAC 5 / 2 /* SHB Interpolation Factor */ +#define HIBND_ACB_L_FAC_Q1 ( 5 ) /* SHB Interpolation Factor Q1 */ #define NUM_HILBERTS 2 #define HILBERT_ORDER1 5 #define HILBERT_ORDER2 4 diff --git a/lib_com/options.h b/lib_com/options.h index d6bbaf88a..5f585d891 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -155,6 +155,7 @@ #define FIX_ISSUE_1214 /* Ittiam: Fix for issue 1214: Energy leakage in IGF tiles for MDCT-stereo @64kbps SWB*/ #define FIX_881_HILBERT_FILTER /* VA: improve the precision of the Hilbert filter to remove 2kHz unwanted tone */ #define FIX_ISSUE_1245 /* Ittiam: Fix for issue 1245: Basop Encoder: Audible noise for silent Stereo input DTX on @24.4 kbps, @32 kbps*/ +#define FIX_ISSUE_1291 /* Ittiam: Wrong use of imult1616() in ACELP rescaling */ #define FIX_920_IGF_INIT_ERROR /* FhG: issue 920: fix bitrate mismatch in initial IGF config to avoid error message in same cases */ #define FIX_MINOR_SVD_WMOPS_MR1010X /* FhG: Minor WMOPS tuning, bit-exact to previous version, saves about 8.2 WMOPS for MR1010 */ #define SVD_WMOPS_OPT /* Ittiam : SVD related optimizations */ diff --git a/lib_dec/acelp_core_dec_ivas_fx.c b/lib_dec/acelp_core_dec_ivas_fx.c index e52c52c7c..165594e77 100644 --- a/lib_dec/acelp_core_dec_ivas_fx.c +++ b/lib_dec/acelp_core_dec_ivas_fx.c @@ -748,7 +748,11 @@ ivas_error acelp_core_dec_ivas_fx( IF( st->hMusicPF && st->hGSCDec ) { Rescale_exc( st->hMusicPF->dct_post_old_exc_fx, exc_fx, bwe_exc_fx, st->hGSCDec->last_exc_dct_in_fx, st->L_frame, +#ifdef FIX_ISSUE_1291 + shr( imult1616( st->L_frame, HIBND_ACB_L_FAC_Q1 ), 1 ), 0, &( st->Q_exc ), st->Q_subfr, NULL, 0, INACTIVE ); +#else imult1616( st->L_frame, HIBND_ACB_L_FAC ), 0, &( st->Q_exc ), st->Q_subfr, NULL, 0, INACTIVE ); +#endif } IF( st->hPFstat != NULL ) { -- GitLab From 3ea6e92d666de55982e2fc5dded4a33000838471 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Thu, 13 Feb 2025 13:26:19 +0100 Subject: [PATCH 027/113] add new stage for checking BE with target branch --- .gitlab-ci.yml | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index bc48090cd..a19358b6a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -110,6 +110,7 @@ stages: - .pre - prevalidate - build + - check-be - test - deploy @@ -410,6 +411,62 @@ stages: junit: - report-junit.xml +.check-be-to-target-anchor: &check-be-to-target-anchor + stage: check-be + needs: ["build-codec-linux-make"] + timeout: "300 minutes" + variables: + XML_REPORT: "report--$CI_JOB_NAME--sha-$CI_COMMIT_SHORT_SHA.xml" + HTML_REPORT: "report--$CI_JOB_NAME--sha-$CI_COMMIT_SHORT_SHA.html" + FAILED_TESTCASES_LIST: "failed-testcases.txt" + script: + - set -euxo pipefail + - *print-common-info + - *update-scripts-repo + + - if [ $USE_LTV -eq 1 ]; then + - *update-ltv-repo + - *copy-ltv-files-to-testv-dir + - testcase_timeout=$TESTCASE_TIMEOUT_LTV + - else + - testcase_timeout=$TESTCASE_TIMEOUT_STV + - fi + + - python3 ci/remove_unsupported_testcases.py $PRM_FILES + - if [ $LEVEL_SCALING != "1.0" ];then + - *apply-testv-scaling + - fi + + - *build-and-create-reference-outputs + + - exit_code=0 + - python3 -m pytest --tb=no $TEST_SUITE -v --keep_files --create_cut --html=$HTML_REPORT --self-contained-html --junit-xml=$XML_REPORT --mld --ssnr --odg --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH -n auto --testcase_timeout $testcase_timeout > pytest_log.txt || exit_code=$? + - zero_errors_branch=$(cat $XML_REPORT_BRANCH | grep -c 'errors="0"') || true + + - touch $FAILED_TESTCASES_LIST + - if [ $exit_code -ne 0 ]; then + - exit_code=$EXIT_CODE_NON_BE + - grep "FAILED" pytest_log.txt | sed 's/^FAILED //' | awk -F'::' '{print "\"" $1 "::" $2 "\"" }' > $FAILED_TESTCASES_LIST + - fi + + - exit $exit_code + + allow_failure: + exit_codes: + - 123 + artifacts: + name: "$CI_JOB_NAME--sha-$CI_COMMIT_SHORT_SHA--results" + expire_in: 1 week + when: always + paths: + - $XML_REPORT + - $HTML_REPORT + expose_as: "pytest compare results" + reports: + junit: + - $XML_REPORT_BRANCH + - $XML_REPORT_MAIN + .ivas-pytest-on-merge-request-anchor: &ivas-pytest-on-merge-request-anchor stage: test needs: ["build-codec-linux-make"] @@ -789,6 +846,19 @@ build-codec-windows-msbuild: # Short test jobs that run in merge request pipelines # --------------------------------------------------------------- +### jobs that check for bitexactness of fx encoder and decoder +check-be-to-target-short-enc-0db: + extends: + - .rules-pytest-to-main-short + - .test-job-linux + before_script: + - USE_LTV=0 + - DUT_DECODER_PATH=./IVAS_dec_ref + - TEST_SUITE="$SHORT_TEST_SUITE_ENCODER" + - LEVEL_SCALING=1.0 + - SKIP_REGRESSION_CHECK="true" + <<: *check-be-to-target-anchor + ### jobs that test fx encoder -> flt decoder ivas-pytest-compare_to_main-short-enc: extends: -- GitLab From 4823811f127ba86dd516b6f840ca6570ff070cdf Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Thu, 13 Feb 2025 13:27:05 +0100 Subject: [PATCH 028/113] disable jobs to save time --- .gitlab-ci.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a19358b6a..41e70e8eb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -860,7 +860,7 @@ check-be-to-target-short-enc-0db: <<: *check-be-to-target-anchor ### jobs that test fx encoder -> flt decoder -ivas-pytest-compare_to_main-short-enc: +.ivas-pytest-compare_to_main-short-enc: extends: - .rules-pytest-to-main-short - .test-job-linux @@ -872,7 +872,7 @@ ivas-pytest-compare_to_main-short-enc: - SKIP_REGRESSION_CHECK="true" <<: *ivas-pytest-on-merge-request-anchor -ivas-pytest-compare_to_main-short-enc-lev-10: +.ivas-pytest-compare_to_main-short-enc-lev-10: extends: - .rules-pytest-to-main-short - .test-job-linux @@ -884,7 +884,7 @@ ivas-pytest-compare_to_main-short-enc-lev-10: - SKIP_REGRESSION_CHECK="true" <<: *ivas-pytest-on-merge-request-anchor -ivas-pytest-compare_to_main-short-enc-lev+10: +.ivas-pytest-compare_to_main-short-enc-lev+10: extends: - .rules-pytest-to-main-short - .test-job-linux @@ -897,7 +897,7 @@ ivas-pytest-compare_to_main-short-enc-lev+10: <<: *ivas-pytest-on-merge-request-anchor ### jobs that test flt encoder -> fx decoder -ivas-pytest-compare_to_main-short-dec: +.ivas-pytest-compare_to_main-short-dec: extends: - .rules-pytest-to-main-short - .test-job-linux @@ -909,7 +909,7 @@ ivas-pytest-compare_to_main-short-dec: - rm -rf tests/dut tests/ref <<: *ivas-pytest-on-merge-request-anchor -ivas-pytest-compare_to_main-short-dec-lev-10: +.ivas-pytest-compare_to_main-short-dec-lev-10: extends: - .rules-pytest-to-main-short - .test-job-linux @@ -921,7 +921,7 @@ ivas-pytest-compare_to_main-short-dec-lev-10: - rm -rf tests/dut tests/ref <<: *ivas-pytest-on-merge-request-anchor -ivas-pytest-compare_to_main-short-dec-lev+10: +.ivas-pytest-compare_to_main-short-dec-lev+10: extends: - .rules-pytest-to-main-short - .test-job-linux -- GitLab From 74319da31f87d17fdc7ccf301485ffa83e4dfa90 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Thu, 13 Feb 2025 13:52:02 +0100 Subject: [PATCH 029/113] set REFERENCE_BRANCH correctly --- .gitlab-ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 41e70e8eb..d34fbf169 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -416,6 +416,7 @@ stages: needs: ["build-codec-linux-make"] timeout: "300 minutes" variables: + REFERENCE_BRANCH: "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" XML_REPORT: "report--$CI_JOB_NAME--sha-$CI_COMMIT_SHORT_SHA.xml" HTML_REPORT: "report--$CI_JOB_NAME--sha-$CI_COMMIT_SHORT_SHA.html" FAILED_TESTCASES_LIST: "failed-testcases.txt" @@ -441,7 +442,7 @@ stages: - exit_code=0 - python3 -m pytest --tb=no $TEST_SUITE -v --keep_files --create_cut --html=$HTML_REPORT --self-contained-html --junit-xml=$XML_REPORT --mld --ssnr --odg --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH -n auto --testcase_timeout $testcase_timeout > pytest_log.txt || exit_code=$? - - zero_errors_branch=$(cat $XML_REPORT_BRANCH | grep -c 'errors="0"') || true + - zero_errors_branch=$(cat $XML_REPORT | grep -c 'errors="0"') || true - touch $FAILED_TESTCASES_LIST - if [ $exit_code -ne 0 ]; then -- GitLab From 0c8ec9b91662d084a339802d4b68fb2a19d2bcb6 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Thu, 13 Feb 2025 14:28:42 +0100 Subject: [PATCH 030/113] first shorter test version with needs relation --- .gitlab-ci.yml | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d34fbf169..9a8e4cf44 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -185,7 +185,7 @@ stages: - enc_dmx_arg="--compare_enc_dmx" - fi - - python3 -m pytest $TEST_SUITE -v --update_ref 1 $enc_stats_arg $enc_dmx_arg --create_ref -n auto --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH || exit_code=$? + - python3 -m pytest -k "stereo and at" $TEST_SUITE -v --update_ref 1 $enc_stats_arg $enc_dmx_arg --create_ref -n auto --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH || exit_code=$? .update-scripts-repo: &update-scripts-repo - cd $SCRIPTS_DIR @@ -441,7 +441,7 @@ stages: - *build-and-create-reference-outputs - exit_code=0 - - python3 -m pytest --tb=no $TEST_SUITE -v --keep_files --create_cut --html=$HTML_REPORT --self-contained-html --junit-xml=$XML_REPORT --mld --ssnr --odg --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH -n auto --testcase_timeout $testcase_timeout > pytest_log.txt || exit_code=$? + - python3 -m pytest -k "stereo and at" --tb=no $TEST_SUITE -v --keep_files --create_cut --html=$HTML_REPORT --self-contained-html --junit-xml=$XML_REPORT --mld --ssnr --odg --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH -n auto --testcase_timeout $testcase_timeout > pytest_log.txt || exit_code=$? - zero_errors_branch=$(cat $XML_REPORT | grep -c 'errors="0"') || true - touch $FAILED_TESTCASES_LIST @@ -467,6 +467,7 @@ stages: junit: - $XML_REPORT_BRANCH - $XML_REPORT_MAIN + - $FAILED_TESTCASES_LIST .ivas-pytest-on-merge-request-anchor: &ivas-pytest-on-merge-request-anchor stage: test @@ -485,6 +486,9 @@ stages: - set -euxo pipefail - *print-common-info - *update-scripts-repo + + - ls + - if [ $USE_LTV -eq 1 ]; then - *update-ltv-repo - *copy-ltv-files-to-testv-dir @@ -860,6 +864,22 @@ check-be-to-target-short-enc-0db: - SKIP_REGRESSION_CHECK="true" <<: *check-be-to-target-anchor +check-regressions-short-enc-0db: + stage: test + needs: + - job: "check-be-to-target-short-enc-0db" + artifacts: true + extends: + - .rules-pytest-to-main-short + - .test-job-linux + before_script: + - USE_LTV=0 + - DUT_DECODER_PATH=./IVAS_dec_ref + - TEST_SUITE="$SHORT_TEST_SUITE_ENCODER" + - LEVEL_SCALING=1.0 + - SKIP_REGRESSION_CHECK="true" + <<: *ivas-pytest-on-merge-request-anchor + ### jobs that test fx encoder -> flt decoder .ivas-pytest-compare_to_main-short-enc: extends: -- GitLab From cde22561d513cb94e03a99e2d1a478265a4002a2 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Thu, 13 Feb 2025 14:35:06 +0100 Subject: [PATCH 031/113] remove needs: in anchor to not overwrite value from job --- .gitlab-ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9a8e4cf44..05f531b7f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -471,7 +471,6 @@ stages: .ivas-pytest-on-merge-request-anchor: &ivas-pytest-on-merge-request-anchor stage: test - needs: ["build-codec-linux-make"] timeout: "300 minutes" variables: XML_REPORT_BRANCH: "report-junit-branch-$CI_JOB_NAME--sha-$CI_COMMIT_SHORT_SHA.xml" -- GitLab From 2a5b563122d4e82278c17d17f22e5b645faf0bf7 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Thu, 13 Feb 2025 14:41:07 +0100 Subject: [PATCH 032/113] fix artifacts --- .gitlab-ci.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 05f531b7f..4fa731231 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -450,6 +450,8 @@ stages: - grep "FAILED" pytest_log.txt | sed 's/^FAILED //' | awk -F'::' '{print "\"" $1 "::" $2 "\"" }' > $FAILED_TESTCASES_LIST - fi + - cat $FAILED_TESTCASES_LIST + - exit $exit_code allow_failure: @@ -462,12 +464,12 @@ stages: paths: - $XML_REPORT - $HTML_REPORT + - $FAILED_TESTCASES_LIST expose_as: "pytest compare results" reports: junit: - - $XML_REPORT_BRANCH - - $XML_REPORT_MAIN - - $FAILED_TESTCASES_LIST + - $XML_REPORT + - $XML_REPORT .ivas-pytest-on-merge-request-anchor: &ivas-pytest-on-merge-request-anchor stage: test -- GitLab From 403c61ad3b7ff7f0ff81075c0325592894b6ae32 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Thu, 13 Feb 2025 14:50:52 +0100 Subject: [PATCH 033/113] improve failed testcase parsing and add dbg artifact --- .gitlab-ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4fa731231..747f03d13 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -441,13 +441,13 @@ stages: - *build-and-create-reference-outputs - exit_code=0 - - python3 -m pytest -k "stereo and at" --tb=no $TEST_SUITE -v --keep_files --create_cut --html=$HTML_REPORT --self-contained-html --junit-xml=$XML_REPORT --mld --ssnr --odg --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH -n auto --testcase_timeout $testcase_timeout > pytest_log.txt || exit_code=$? + - python3 -m pytest -k "stereo and at" --tb=no -q $TEST_SUITE -v --keep_files --create_cut --html=$HTML_REPORT --self-contained-html --junit-xml=$XML_REPORT --mld --ssnr --odg --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH -n auto --testcase_timeout $testcase_timeout > pytest_log.txt || exit_code=$? - zero_errors_branch=$(cat $XML_REPORT | grep -c 'errors="0"') || true - touch $FAILED_TESTCASES_LIST - if [ $exit_code -ne 0 ]; then - exit_code=$EXIT_CODE_NON_BE - - grep "FAILED" pytest_log.txt | sed 's/^FAILED //' | awk -F'::' '{print "\"" $1 "::" $2 "\"" }' > $FAILED_TESTCASES_LIST + - grep "^FAILED" pytest_log.txt | sed 's/^FAILED //' | awk -F'::' '{print "\"" $1 "::" $2 "\"" }' > $FAILED_TESTCASES_LIST - fi - cat $FAILED_TESTCASES_LIST @@ -465,6 +465,7 @@ stages: - $XML_REPORT - $HTML_REPORT - $FAILED_TESTCASES_LIST + - pytest_log.txt expose_as: "pytest compare results" reports: junit: -- GitLab From 3cae2338706c558cdb1a3b92258076b3c435d959 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Thu, 13 Feb 2025 15:02:25 +0100 Subject: [PATCH 034/113] amend pipeline for getting the failed testcases --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 747f03d13..77bba1c95 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -447,7 +447,7 @@ stages: - touch $FAILED_TESTCASES_LIST - if [ $exit_code -ne 0 ]; then - exit_code=$EXIT_CODE_NON_BE - - grep "^FAILED" pytest_log.txt | sed 's/^FAILED //' | awk -F'::' '{print "\"" $1 "::" $2 "\"" }' > $FAILED_TESTCASES_LIST + - grep "^FAILED" pytest_log.txt | sed 's/^FAILED //' | sed 's/] - .*/]/' | awk -F'::' '{print "\"" $1 "::" $2 "\"" }' > $FAILED_TESTCASES_LIST - fi - cat $FAILED_TESTCASES_LIST -- GitLab From 4535432e323fffaf8b8462f4bed0d685b5d187cc Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Thu, 13 Feb 2025 15:10:42 +0100 Subject: [PATCH 035/113] check artifacts for BE in comparison job --- .gitlab-ci.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 77bba1c95..b15c5939f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -34,6 +34,7 @@ variables: ENCODER_TEST: "" COMPARE_DMX: "" SKIP_REGRESSION_CHECK: "" + FAILED_TESTCASES_LIST: "failed-testcases.txt" MANUAL_PIPELINE_TYPE: description: "Type for the manual pipeline run. Use 'pytest-compare' to run comparison test against reference float codec." value: 'default' @@ -419,7 +420,6 @@ stages: REFERENCE_BRANCH: "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" XML_REPORT: "report--$CI_JOB_NAME--sha-$CI_COMMIT_SHORT_SHA.xml" HTML_REPORT: "report--$CI_JOB_NAME--sha-$CI_COMMIT_SHORT_SHA.html" - FAILED_TESTCASES_LIST: "failed-testcases.txt" script: - set -euxo pipefail - *print-common-info @@ -487,9 +487,16 @@ stages: script: - set -euxo pipefail - *print-common-info - - *update-scripts-repo - - ls + - cat $FAILED_TESTCASES_LIST + - if [ -f "$FAILED_TESTCASES_LIST" ]; then + - $TEST_SUITE=$(cat $FAILED_TESTCASES_LIST) + - else + - echo "All tested cases were bit-exact between $CI_MERGE_REQUEST_TARGET_BRANCH_NAME and $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME. No need to check for regressions." + - exit 0 + - fi + + - *update-scripts-repo - if [ $USE_LTV -eq 1 ]; then - *update-ltv-repo -- GitLab From dde36765f44603386812b899a932524d5a30dc09 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Thu, 13 Feb 2025 15:22:43 +0100 Subject: [PATCH 036/113] check for file being empty --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6fc3c1fa0..7db27dd63 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -489,7 +489,7 @@ stages: - *print-common-info - cat $FAILED_TESTCASES_LIST - - if [ -f "$FAILED_TESTCASES_LIST" ]; then + - if [ -f "$FAILED_TESTCASES_LIST" ] && [ ! -z "$( ls -A $FAILED_TESTCASES_LIST )" ]; then - $TEST_SUITE=$(cat $FAILED_TESTCASES_LIST) - else - echo "All tested cases were bit-exact between $CI_MERGE_REQUEST_TARGET_BRANCH_NAME and $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME. No need to check for regressions." -- GitLab From 27456c3c28a80e478a94dfc22a4a1d16b1485719 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Thu, 13 Feb 2025 15:37:45 +0100 Subject: [PATCH 037/113] fix check for empty file --- .gitlab-ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7db27dd63..77fb89dbe 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -488,8 +488,7 @@ stages: - set -euxo pipefail - *print-common-info - - cat $FAILED_TESTCASES_LIST - - if [ -f "$FAILED_TESTCASES_LIST" ] && [ ! -z "$( ls -A $FAILED_TESTCASES_LIST )" ]; then + - if [ -s $FAILED_TESTCASES_LIST ]; then - $TEST_SUITE=$(cat $FAILED_TESTCASES_LIST) - else - echo "All tested cases were bit-exact between $CI_MERGE_REQUEST_TARGET_BRANCH_NAME and $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME. No need to check for regressions." -- GitLab From fe6d391188618437e769f57f858eebed7b8f5d42 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Thu, 13 Feb 2025 15:54:40 +0100 Subject: [PATCH 038/113] remove unncessary code increasing i --- lib_enc/ACcontextMapping_enc_fx.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib_enc/ACcontextMapping_enc_fx.c b/lib_enc/ACcontextMapping_enc_fx.c index 0e816e77c..6b0129123 100644 --- a/lib_enc/ACcontextMapping_enc_fx.c +++ b/lib_enc/ACcontextMapping_enc_fx.c @@ -1230,7 +1230,7 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( { /* Common variables */ Word16 a1, b1; - Word16 i, k, pki, lev1; + Word16 k, pki, lev1; UWord16 t; Word16 lastnz, lastnz2; Word16 rateFlag; @@ -1250,14 +1250,11 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( /* bits to encode lastnz */ k = 1; move16(); - i = 2; - move64(); WHILE( LT_16( k, nt / 2 ) ) { bit_estimate_fx = W_add( bit_estimate_fx, MAKE_NUMBER_QX( 1, Q23 ) ); k = shl( k, 1 ); - i = add( i, 2 ); /* check while condition */ } -- GitLab From b79cca58f691da72f9ca7cb32548af5ebbded60c Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Thu, 13 Feb 2025 15:55:10 +0100 Subject: [PATCH 039/113] [revert-me] force TCX20 to provoke diff for testing --- lib_enc/transient_detection_fx.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib_enc/transient_detection_fx.c b/lib_enc/transient_detection_fx.c index d9859a1a1..b0d131258 100644 --- a/lib_enc/transient_detection_fx.c +++ b/lib_enc/transient_detection_fx.c @@ -804,6 +804,8 @@ void SetTCXModeInfo_ivas_fx( hTcxEnc->tcxMode = TCX_20; move16(); } + + hTcxEnc->tcxMode = TCX_20; } ELSE { -- GitLab From 42a1d25e5b743dfaa4cbd1873b5070caea330930 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Thu, 13 Feb 2025 16:05:51 +0100 Subject: [PATCH 040/113] fix variable assignment --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 77fb89dbe..a3c12f6c9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -489,7 +489,7 @@ stages: - *print-common-info - if [ -s $FAILED_TESTCASES_LIST ]; then - - $TEST_SUITE=$(cat $FAILED_TESTCASES_LIST) + - TEST_SUITE=$(cat $FAILED_TESTCASES_LIST) - else - echo "All tested cases were bit-exact between $CI_MERGE_REQUEST_TARGET_BRANCH_NAME and $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME. No need to check for regressions." - exit 0 -- GitLab From a494d1d67767cf35567cef8c7b4203db68df04df Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Thu, 13 Feb 2025 16:16:35 +0100 Subject: [PATCH 041/113] remove newlines from artifact file --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a3c12f6c9..dbdd25f75 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -447,7 +447,7 @@ stages: - touch $FAILED_TESTCASES_LIST - if [ $exit_code -ne 0 ]; then - exit_code=$EXIT_CODE_NON_BE - - grep "^FAILED" pytest_log.txt | sed 's/^FAILED //' | sed 's/] - .*/]/' | awk -F'::' '{print "\"" $1 "::" $2 "\"" }' > $FAILED_TESTCASES_LIST + - grep "^FAILED" pytest_log.txt | sed 's/^FAILED //' | sed 's/] - .*/]/' | awk -F'::' '{print "\"" $1 "::" $2 "\"" }' | tr "\n" " " > $FAILED_TESTCASES_LIST - fi - cat $FAILED_TESTCASES_LIST -- GitLab From 3d459969828c4ea73d0220258a190002a2cc7fbe Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Thu, 13 Feb 2025 16:24:54 +0100 Subject: [PATCH 042/113] try without additional "" --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index dbdd25f75..fcad772f7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -447,7 +447,7 @@ stages: - touch $FAILED_TESTCASES_LIST - if [ $exit_code -ne 0 ]; then - exit_code=$EXIT_CODE_NON_BE - - grep "^FAILED" pytest_log.txt | sed 's/^FAILED //' | sed 's/] - .*/]/' | awk -F'::' '{print "\"" $1 "::" $2 "\"" }' | tr "\n" " " > $FAILED_TESTCASES_LIST + - grep "^FAILED" pytest_log.txt | sed 's/^FAILED //' | sed 's/] - .*/]/' | tr "\n" " " > $FAILED_TESTCASES_LIST - fi - cat $FAILED_TESTCASES_LIST -- GitLab From 37049c2c4fd6ab53c600c6785090560e10e40e10 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Thu, 13 Feb 2025 16:37:08 +0100 Subject: [PATCH 043/113] clean up RCcontextMapping_encode2_estimate_bandWise_start_fx() --- lib_enc/ACcontextMapping_enc_fx.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib_enc/ACcontextMapping_enc_fx.c b/lib_enc/ACcontextMapping_enc_fx.c index 6b0129123..dd9e57626 100644 --- a/lib_enc/ACcontextMapping_enc_fx.c +++ b/lib_enc/ACcontextMapping_enc_fx.c @@ -1672,8 +1672,6 @@ Word16 RCcontextMapping_encode2_estimate_bandWise_start_fx( /* bits to encode lastnz */ k = 1; move16(); - i = 2; - move16(); WHILE( LT_16( k, hContextMem->nt_half ) ) { @@ -1681,12 +1679,11 @@ Word16 RCcontextMapping_encode2_estimate_bandWise_start_fx( move64(); k = shl( k, 1 ); - i = add( i, 1 ); /* check while condition */ } /* bits to encode lastnz */ - hContextMem->nbits_old = i; + hContextMem->nbits_old = round_fx( W_shr( hContextMem->bit_estimate_fx, Q7 ) ); /* Q0 */; move16(); hContextMem->ctx = 0; -- GitLab From e0c6fd18548e729d9f00fce04bf099b6e64449ab Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Thu, 13 Feb 2025 16:59:25 +0100 Subject: [PATCH 044/113] try with moving the pytest cache instead of file parsing --- .gitlab-ci.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fcad772f7..2c570229b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -35,6 +35,7 @@ variables: COMPARE_DMX: "" SKIP_REGRESSION_CHECK: "" FAILED_TESTCASES_LIST: "failed-testcases.txt" + PYTEST_CACHE_ARTIFACT: "pytest_cache.zip" MANUAL_PIPELINE_TYPE: description: "Type for the manual pipeline run. Use 'pytest-compare' to run comparison test against reference float codec." value: 'default' @@ -441,6 +442,7 @@ stages: - *build-and-create-reference-outputs - exit_code=0 + - rm -rf .pytest_cache || true - python3 -m pytest -k "stereo and at" --tb=no -q $TEST_SUITE -v --keep_files --create_cut --html=$HTML_REPORT --self-contained-html --junit-xml=$XML_REPORT --mld --ssnr --odg --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH -n auto --testcase_timeout $testcase_timeout > pytest_log.txt || exit_code=$? - zero_errors_branch=$(cat $XML_REPORT | grep -c 'errors="0"') || true @@ -452,6 +454,7 @@ stages: - cat $FAILED_TESTCASES_LIST + - zip -r $PYTEST_CACHE_ARTIFACT .pytest_cache - exit $exit_code allow_failure: @@ -466,6 +469,7 @@ stages: - $HTML_REPORT - $FAILED_TESTCASES_LIST - pytest_log.txt + - $PYTEST_CACHE_ARTIFACT expose_as: "pytest compare results" reports: junit: @@ -489,7 +493,9 @@ stages: - *print-common-info - if [ -s $FAILED_TESTCASES_LIST ]; then - - TEST_SUITE=$(cat $FAILED_TESTCASES_LIST) + - rm -rf .pytest_cache || true + - unzip $PYTEST_CACHE_ARTIFACT + - PYTEST_ADDOPTS="--last-failed" - else - echo "All tested cases were bit-exact between $CI_MERGE_REQUEST_TARGET_BRANCH_NAME and $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME. No need to check for regressions." - exit 0 -- GitLab From 29a875d5c013fbb6c259024358e6e1f76a55606b Mon Sep 17 00:00:00 2001 From: Thomas Dettbarn Date: Thu, 13 Feb 2025 17:04:04 +0100 Subject: [PATCH 045/113] identation problem in one of the functions, due to { in the wrong place. --- lib_enc/ACcontextMapping_enc_fx.c | 49 ++++++++++++++++--------------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/lib_enc/ACcontextMapping_enc_fx.c b/lib_enc/ACcontextMapping_enc_fx.c index dd9e57626..9715f6bb8 100644 --- a/lib_enc/ACcontextMapping_enc_fx.c +++ b/lib_enc/ACcontextMapping_enc_fx.c @@ -1603,37 +1603,38 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( move16(); } ELSE /* Overflow */ + { + IF( *stop ) + { + *stop = tot_bits2; /* Q0 */ + move16(); + } + ELSE { - IF( *stop ){ - *stop = tot_bits2; /* Q0 */ + *stop = round_fx( W_shr( bit_estimate_fx, Q7 ) ); + move16(); + } + } + + *lastnz_out = lastnz; /* Q0 */ move16(); - } - ELSE - { - *stop = round_fx( W_shr( bit_estimate_fx, Q7 ) ); + *nEncoded = lastnz2; /* Q0 */ move16(); - } -} + /* Safety mechanism to avoid overflow */ + test(); + IF( EQ_16( lastnz2, 2 ) && EQ_16( overflow_flag, 1 ) ) + { + FOR( k = 0; k < lastnz2; k++ ) + { + x[k] = 0; + move16(); + } + } -*lastnz_out = lastnz; /* Q0 */ -move16(); -*nEncoded = lastnz2; /* Q0 */ -move16(); -/* Safety mechanism to avoid overflow */ -test(); -IF( EQ_16( lastnz2, 2 ) && EQ_16( overflow_flag, 1 ) ) -{ - FOR( k = 0; k < lastnz2; k++ ) - { - x[k] = 0; - move16(); + return tot_bits2; } } -return tot_bits2; -} -} - /*-------------------------------------------------------------------* * RCcontextMapping_encode2_estimate_bandWise_start_fx() -- GitLab From cae305518a72bc5ff14db3c6f3c0c1e1dae209ba Mon Sep 17 00:00:00 2001 From: Thomas Dettbarn Date: Thu, 13 Feb 2025 17:09:46 +0100 Subject: [PATCH 046/113] indentation problem due to missing return. --- lib_enc/ACcontextMapping_enc_fx.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib_enc/ACcontextMapping_enc_fx.c b/lib_enc/ACcontextMapping_enc_fx.c index 9715f6bb8..a0e819313 100644 --- a/lib_enc/ACcontextMapping_enc_fx.c +++ b/lib_enc/ACcontextMapping_enc_fx.c @@ -1633,6 +1633,7 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( return tot_bits2; } + return 0; } -- GitLab From 4e815c1a00fb533432ff7ac7525261f731c7f4e0 Mon Sep 17 00:00:00 2001 From: Thomas Dettbarn Date: Thu, 13 Feb 2025 17:14:58 +0100 Subject: [PATCH 047/113] indentation problem due to return inside if statement. --- lib_enc/ACcontextMapping_enc_fx.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib_enc/ACcontextMapping_enc_fx.c b/lib_enc/ACcontextMapping_enc_fx.c index a0e819313..149ad36b0 100644 --- a/lib_enc/ACcontextMapping_enc_fx.c +++ b/lib_enc/ACcontextMapping_enc_fx.c @@ -1228,6 +1228,7 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( CONTEXT_HM_CONFIG *hm_cfg /* context-based harmonic model configuration */ ) { + Word16 retval; /* Common variables */ Word16 a1, b1; Word16 k, pki, lev1; @@ -1239,6 +1240,8 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( Word16 symbol; const UWord8 *lookup; Word64 nbits2_accu; + retval = 0; + move16(); /* Initialization */ bit_estimate_fx = MAKE_NUMBER_QX( 2, Q23 ); @@ -1458,7 +1461,7 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( move16(); - return round_fx( L_add( W_shr( nbits2_accu, Q7 ), ONE_IN_Q14 ) ); /* Q0 */ + retval = round_fx( L_add( W_shr( nbits2_accu, Q7 ), ONE_IN_Q14 ) ); /* Q0 */ } ELSE /* if (!hm_cfg) */ { @@ -1631,9 +1634,9 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( } } - return tot_bits2; + retval = tot_bits2; } - return 0; + return retval; } -- GitLab From 6be56cb42c5094400bdba05e8704d138f0531e5a Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Thu, 13 Feb 2025 17:22:40 +0100 Subject: [PATCH 048/113] set PYTEST_ADDOPTS as env var --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2c570229b..7ae61dc30 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -495,7 +495,7 @@ stages: - if [ -s $FAILED_TESTCASES_LIST ]; then - rm -rf .pytest_cache || true - unzip $PYTEST_CACHE_ARTIFACT - - PYTEST_ADDOPTS="--last-failed" + - export PYTEST_ADDOPTS=--last-failed - else - echo "All tested cases were bit-exact between $CI_MERGE_REQUEST_TARGET_BRANCH_NAME and $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME. No need to check for regressions." - exit 0 -- GitLab From 8597d69739c136ca71a0c5b552f2d336c2aae7d6 Mon Sep 17 00:00:00 2001 From: Thomas Dettbarn Date: Thu, 13 Feb 2025 17:29:53 +0100 Subject: [PATCH 049/113] indentation problem persists --- lib_enc/ACcontextMapping_enc_fx.c | 57 ++++++++++++++----------------- 1 file changed, 26 insertions(+), 31 deletions(-) diff --git a/lib_enc/ACcontextMapping_enc_fx.c b/lib_enc/ACcontextMapping_enc_fx.c index 149ad36b0..cad29d320 100644 --- a/lib_enc/ACcontextMapping_enc_fx.c +++ b/lib_enc/ACcontextMapping_enc_fx.c @@ -1228,7 +1228,6 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( CONTEXT_HM_CONFIG *hm_cfg /* context-based harmonic model configuration */ ) { - Word16 retval; /* Common variables */ Word16 a1, b1; Word16 k, pki, lev1; @@ -1240,8 +1239,6 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( Word16 symbol; const UWord8 *lookup; Word64 nbits2_accu; - retval = 0; - move16(); /* Initialization */ bit_estimate_fx = MAKE_NUMBER_QX( 2, Q23 ); @@ -1461,7 +1458,7 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( move16(); - retval = round_fx( L_add( W_shr( nbits2_accu, Q7 ), ONE_IN_Q14 ) ); /* Q0 */ + return round_fx( L_add( W_shr( nbits2_accu, Q7 ), ONE_IN_Q14 ) ); /* Q0 */ } ELSE /* if (!hm_cfg) */ { @@ -1606,37 +1603,35 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( move16(); } ELSE /* Overflow */ - { - IF( *stop ) - { - *stop = tot_bits2; /* Q0 */ - move16(); - } - ELSE { - *stop = round_fx( W_shr( bit_estimate_fx, Q7 ) ); - move16(); - } - } - - *lastnz_out = lastnz; /* Q0 */ + IF( *stop ){ + *stop = tot_bits2; /* Q0 */ move16(); - *nEncoded = lastnz2; /* Q0 */ + } + ELSE + { + *stop = round_fx( W_shr( bit_estimate_fx, Q7 ) ); move16(); - /* Safety mechanism to avoid overflow */ - test(); - IF( EQ_16( lastnz2, 2 ) && EQ_16( overflow_flag, 1 ) ) - { - FOR( k = 0; k < lastnz2; k++ ) - { - x[k] = 0; - move16(); - } - } + } +} - retval = tot_bits2; +*lastnz_out = lastnz; /* Q0 */ +move16(); +*nEncoded = lastnz2; /* Q0 */ +move16(); +/* Safety mechanism to avoid overflow */ +test(); +IF( EQ_16( lastnz2, 2 ) && EQ_16( overflow_flag, 1 ) ) +{ + FOR( k = 0; k < lastnz2; k++ ) + { + x[k] = 0; + move16(); } - return retval; +} + +return tot_bits2; +} } @@ -1688,7 +1683,7 @@ Word16 RCcontextMapping_encode2_estimate_bandWise_start_fx( } /* bits to encode lastnz */ - hContextMem->nbits_old = round_fx( W_shr( hContextMem->bit_estimate_fx, Q7 ) ); /* Q0 */; + hContextMem->nbits_old = round_fx( W_shr( hContextMem->bit_estimate_fx, Q7 ) ); /* Q0 */ move16(); hContextMem->ctx = 0; -- GitLab From b48d823bdd916292c018e338c0fe9df8d28340af Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Thu, 13 Feb 2025 17:31:42 +0100 Subject: [PATCH 050/113] overwrite cache b4 every pytest call --- .gitlab-ci.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7ae61dc30..5017a4112 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -476,6 +476,12 @@ stages: - $XML_REPORT - $XML_REPORT +.overwrite-pytest-cache-with-artifact: &overwrite-pytest-cache-with-artifact + - if [ -f $PYTEST_CACHE_ARTIFACT ] then + - rm -rf .pytest_cache || true + - unzip $PYTEST_CACHE_ARTIFACT + - fi + .ivas-pytest-on-merge-request-anchor: &ivas-pytest-on-merge-request-anchor stage: test timeout: "300 minutes" @@ -493,8 +499,7 @@ stages: - *print-common-info - if [ -s $FAILED_TESTCASES_LIST ]; then - - rm -rf .pytest_cache || true - - unzip $PYTEST_CACHE_ARTIFACT + - *overwrite-pytest-cache-with-artifact - export PYTEST_ADDOPTS=--last-failed - else - echo "All tested cases were bit-exact between $CI_MERGE_REQUEST_TARGET_BRANCH_NAME and $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME. No need to check for regressions." @@ -524,6 +529,8 @@ stages: # this per default builds the branch and the reference and creates the reference outputs - *build-and-create-reference-outputs - exit_code=0 + # need to restore cache again + - *overwrite-pytest-cache-with-artifact - python3 -m pytest --tb=no $TEST_SUITE -v --keep_files --create_cut --html=$HTML_REPORT_BRANCH --self-contained-html --junit-xml=$XML_REPORT_BRANCH --mld --ssnr --odg --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH -n auto --testcase_timeout $testcase_timeout || exit_code=$? - zero_errors_branch=$(cat $XML_REPORT_BRANCH | grep -c 'errors="0"') || true - python3 scripts/parse_xml_report.py $XML_REPORT_BRANCH $CSV_BRANCH @@ -541,6 +548,8 @@ stages: - git pull - make clean - make -j + # need to restore cache again + - *overwrite-pytest-cache-with-artifact - python3 -m pytest --tb=no $TEST_SUITE -v --keep_files --create_cut --html=$HTML_REPORT_MAIN --self-contained-html --junit-xml=$XML_REPORT_MAIN --mld --ssnr --odg --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH -n auto --testcase_timeout $testcase_timeout || true - python3 scripts/parse_xml_report.py $XML_REPORT_MAIN $CSV_MAIN -- GitLab From b76abea1c07f129a2b4bd72e8907cc432aae5105 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Thu, 13 Feb 2025 17:45:48 +0100 Subject: [PATCH 051/113] fix syntax error --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5017a4112..3e034bebd 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -477,7 +477,7 @@ stages: - $XML_REPORT .overwrite-pytest-cache-with-artifact: &overwrite-pytest-cache-with-artifact - - if [ -f $PYTEST_CACHE_ARTIFACT ] then + - if [ -f $PYTEST_CACHE_ARTIFACT ]; then - rm -rf .pytest_cache || true - unzip $PYTEST_CACHE_ARTIFACT - fi -- GitLab From 94fe3242b661346909ff5ebb142191d8a6d4fc41 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Thu, 13 Feb 2025 17:47:16 +0100 Subject: [PATCH 052/113] [revert-me] deactivate more jobs for faster testing --- .gitlab-ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3e034bebd..4e5748231 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -817,7 +817,7 @@ build-codec-linux-make: - make -j # ensure that codec builds on linux with instrumentation active -build-codec-linux-instrumented-make: +.build-codec-linux-instrumented-make: rules: - if: $CI_PIPELINE_SOURCE == 'web' - if: $CI_PIPELINE_SOURCE == 'push' && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH @@ -834,7 +834,7 @@ build-codec-linux-instrumented-make: - bash scripts/prepare_instrumentation.sh -m MEM_ONLY -p BASOP - make -j -C $INSTR_DIR -build-codec-linux-debugging-make: +.build-codec-linux-debugging-make: rules: - if: $CI_PIPELINE_SOURCE == 'web' - if: $CI_PIPELINE_SOURCE == 'push' && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH @@ -852,7 +852,7 @@ build-codec-linux-debugging-make: - *activate-debug-mode-info-if-set - make -j -build-codec-windows-msbuild: +.build-codec-windows-msbuild: rules: - if: $CI_PIPELINE_SOURCE == 'web' - if: $CI_PIPELINE_SOURCE == 'push' && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH @@ -1352,7 +1352,7 @@ coverage-test-on-main-scheduled: # --------------------------------------------------------------- # check bitexactness to EVS -be-2-evs-26444: +.be-2-evs-26444: extends: - .test-job-linux rules: -- GitLab From bd5f9b08172ba992243c71f005cc6e58fcdbac45 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Thu, 13 Feb 2025 18:00:29 +0100 Subject: [PATCH 053/113] add missing jobs --- .gitlab-ci.yml | 111 ++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 92 insertions(+), 19 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4e5748231..881b41b8b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -885,13 +885,10 @@ check-be-to-target-short-enc-0db: - TEST_SUITE="$SHORT_TEST_SUITE_ENCODER" - LEVEL_SCALING=1.0 - SKIP_REGRESSION_CHECK="true" + - rm -rf tests/dut tests/ref <<: *check-be-to-target-anchor -check-regressions-short-enc-0db: - stage: test - needs: - - job: "check-be-to-target-short-enc-0db" - artifacts: true +check-be-to-target-short-enc-+10db: extends: - .rules-pytest-to-main-short - .test-job-linux @@ -899,12 +896,66 @@ check-regressions-short-enc-0db: - USE_LTV=0 - DUT_DECODER_PATH=./IVAS_dec_ref - TEST_SUITE="$SHORT_TEST_SUITE_ENCODER" - - LEVEL_SCALING=1.0 + - LEVEL_SCALING=3.162 - SKIP_REGRESSION_CHECK="true" - <<: *ivas-pytest-on-merge-request-anchor + - rm -rf tests/dut tests/ref + <<: *check-be-to-target-anchor -### jobs that test fx encoder -> flt decoder -.ivas-pytest-compare_to_main-short-enc: +check-be-to-target-short-enc--10db: + extends: + - .rules-pytest-to-main-short + - .test-job-linux + before_script: + - USE_LTV=0 + - DUT_DECODER_PATH=./IVAS_dec_ref + - TEST_SUITE="$SHORT_TEST_SUITE_ENCODER" + - LEVEL_SCALING=0.3162 + - SKIP_REGRESSION_CHECK="true" + - rm -rf tests/dut tests/ref + <<: *check-be-to-target-anchor + +check-be-to-target-short-dec-0db: + extends: + - .rules-pytest-to-main-short + - .test-job-linux + before_script: + - USE_LTV=0 + - DUT_ENCODER_PATH=./IVAS_cod_ref + - TEST_SUITE="$SHORT_TEST_SUITE" + - LEVEL_SCALING=1.0 + - rm -rf tests/dut tests/ref + <<: *check-be-to-target-anchor + +check-be-to-target-short-dec-+10db: + extends: + - .rules-pytest-to-main-short + - .test-job-linux + before_script: + - USE_LTV=0 + - DUT_ENCODER_PATH=./IVAS_cod_ref + - TEST_SUITE="$SHORT_TEST_SUITE" + - LEVEL_SCALING=3.162 + - rm -rf tests/dut tests/ref + <<: *check-be-to-target-anchor + +check-be-to-target-short-dec--10db: + extends: + - .rules-pytest-to-main-short + - .test-job-linux + before_script: + - USE_LTV=0 + - DUT_ENCODER_PATH=./IVAS_cod_ref + - TEST_SUITE="$SHORT_TEST_SUITE" + - LEVEL_SCALING=0.3162 + - rm -rf tests/dut tests/ref + <<: *check-be-to-target-anchor + +### jobs that check for regressions on non-BE testcases +check-regressions-short-enc-0db: + stage: test + needs: + - job: "check-be-to-target-short-enc-0db" + artifacts: true extends: - .rules-pytest-to-main-short - .test-job-linux @@ -914,9 +965,14 @@ check-regressions-short-enc-0db: - TEST_SUITE="$SHORT_TEST_SUITE_ENCODER" - LEVEL_SCALING=1.0 - SKIP_REGRESSION_CHECK="true" + - rm -rf tests/dut tests/ref <<: *ivas-pytest-on-merge-request-anchor -.ivas-pytest-compare_to_main-short-enc-lev-10: +check-regressions-short-enc-+10db: + stage: test + needs: + - job: "check-be-to-target-short-enc-+10db" + artifacts: true extends: - .rules-pytest-to-main-short - .test-job-linux @@ -924,11 +980,16 @@ check-regressions-short-enc-0db: - USE_LTV=0 - DUT_DECODER_PATH=./IVAS_dec_ref - TEST_SUITE="$SHORT_TEST_SUITE_ENCODER" - - LEVEL_SCALING=0.3162 + - LEVEL_SCALING=3.162 - SKIP_REGRESSION_CHECK="true" + - rm -rf tests/dut tests/ref <<: *ivas-pytest-on-merge-request-anchor -.ivas-pytest-compare_to_main-short-enc-lev+10: +check-regressions-short-enc--10db: + stage: test + needs: + - job: "check-be-to-target-short-enc--10db" + artifacts: true extends: - .rules-pytest-to-main-short - .test-job-linux @@ -936,12 +997,16 @@ check-regressions-short-enc-0db: - USE_LTV=0 - DUT_DECODER_PATH=./IVAS_dec_ref - TEST_SUITE="$SHORT_TEST_SUITE_ENCODER" - - LEVEL_SCALING=3.162 + - LEVEL_SCALING=0.3162 - SKIP_REGRESSION_CHECK="true" + - rm -rf tests/dut tests/ref <<: *ivas-pytest-on-merge-request-anchor -### jobs that test flt encoder -> fx decoder -.ivas-pytest-compare_to_main-short-dec: +check-regressions-short-dec-0db: + stage: test + needs: + - job: "check-be-to-target-short-dec-0db" + artifacts: true extends: - .rules-pytest-to-main-short - .test-job-linux @@ -953,7 +1018,11 @@ check-regressions-short-enc-0db: - rm -rf tests/dut tests/ref <<: *ivas-pytest-on-merge-request-anchor -.ivas-pytest-compare_to_main-short-dec-lev-10: +check-regressions-short-enc-+10db: + stage: test + needs: + - job: "check-be-to-target-short-enc-+10db" + artifacts: true extends: - .rules-pytest-to-main-short - .test-job-linux @@ -961,11 +1030,15 @@ check-regressions-short-enc-0db: - USE_LTV=0 - DUT_ENCODER_PATH=./IVAS_cod_ref - TEST_SUITE="$SHORT_TEST_SUITE" - - LEVEL_SCALING=0.3162 + - LEVEL_SCALING=3.162 - rm -rf tests/dut tests/ref <<: *ivas-pytest-on-merge-request-anchor -.ivas-pytest-compare_to_main-short-dec-lev+10: +check-regressions-short-enc--10db: + stage: test + needs: + - job: "check-be-to-target-short-enc--10db" + artifacts: true extends: - .rules-pytest-to-main-short - .test-job-linux @@ -973,7 +1046,7 @@ check-regressions-short-enc-0db: - USE_LTV=0 - DUT_ENCODER_PATH=./IVAS_cod_ref - TEST_SUITE="$SHORT_TEST_SUITE" - - LEVEL_SCALING=3.162 + - LEVEL_SCALING=0.3162 - rm -rf tests/dut tests/ref <<: *ivas-pytest-on-merge-request-anchor -- GitLab From 4fcc08c18f5b08ff9ce4fa602a21d41b58aff97a Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Thu, 13 Feb 2025 18:01:49 +0100 Subject: [PATCH 054/113] fix job names --- .gitlab-ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 881b41b8b..32003043d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1018,10 +1018,10 @@ check-regressions-short-dec-0db: - rm -rf tests/dut tests/ref <<: *ivas-pytest-on-merge-request-anchor -check-regressions-short-enc-+10db: +check-regressions-short-dec-+10db: stage: test needs: - - job: "check-be-to-target-short-enc-+10db" + - job: "check-be-to-target-short-dec-+10db" artifacts: true extends: - .rules-pytest-to-main-short @@ -1034,10 +1034,10 @@ check-regressions-short-enc-+10db: - rm -rf tests/dut tests/ref <<: *ivas-pytest-on-merge-request-anchor -check-regressions-short-enc--10db: +check-regressions-short-dec--10db: stage: test needs: - - job: "check-be-to-target-short-enc--10db" + - job: "check-be-to-target-short-dec--10db" artifacts: true extends: - .rules-pytest-to-main-short -- GitLab From 9c6af891a99b1d612528b8fd18e870fcf3c42d97 Mon Sep 17 00:00:00 2001 From: Thomas Dettbarn Date: Fri, 14 Feb 2025 08:53:21 +0100 Subject: [PATCH 055/113] one variable still had a name from the development nomenklature. --- lib_enc/ACcontextMapping_enc_fx.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib_enc/ACcontextMapping_enc_fx.c b/lib_enc/ACcontextMapping_enc_fx.c index cad29d320..aad058c27 100644 --- a/lib_enc/ACcontextMapping_enc_fx.c +++ b/lib_enc/ACcontextMapping_enc_fx.c @@ -1238,13 +1238,13 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( Word16 symbol; const UWord8 *lookup; - Word64 nbits2_accu; + Word64 nbits2_fx; /* Initialization */ bit_estimate_fx = MAKE_NUMBER_QX( 2, Q23 ); move64(); - nbits2_accu = 0; + nbits2_fx = 0; move64(); /* bits to encode lastnz */ @@ -1258,7 +1258,7 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( /* check while condition */ } - nbits2_accu = bit_estimate_fx; + nbits2_fx = bit_estimate_fx; move64(); IF( hm_cfg ) @@ -1386,7 +1386,7 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( ELSE { lastnz2 = add( b1_i, 1 ); - nbits2_accu = bit_estimate_fx; + nbits2_fx = bit_estimate_fx; move64(); } @@ -1432,7 +1432,7 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( IF( *stop ) { - total_output_bits = round_fx( W_shr( nbits2_accu, Q7 ) ); + total_output_bits = round_fx( W_shr( nbits2_fx, Q7 ) ); } IF( stop2 ) @@ -1458,7 +1458,7 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( move16(); - return round_fx( L_add( W_shr( nbits2_accu, Q7 ), ONE_IN_Q14 ) ); /* Q0 */ + return round_fx( L_add( W_shr( nbits2_fx, Q7 ), ONE_IN_Q14 ) ); /* Q0 */ } ELSE /* if (!hm_cfg) */ { @@ -1565,7 +1565,7 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( { IF( abs_s( x[k] ) || abs_s( x[k + 1] ) ) /* No overflow & non-zero tuple */ { - nbits2_accu = bit_estimate_fx; /* exp(bit_estimate_e) */ + nbits2_fx = bit_estimate_fx; /* exp(bit_estimate_e) */ move64(); lastnz2 = add( k, 2 ); @@ -1587,7 +1587,7 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( } /*end of the 2-tuples loop*/ - tot_bits2 = round_fx( W_shr( nbits2_accu, Q7 ) ); + tot_bits2 = round_fx( W_shr( nbits2_fx, Q7 ) ); IF( LT_16( lastnz2, lastnz ) ) /* Overflow occured because unable to code all tuples */ { overflow_flag = 1; -- GitLab From 9ced24f50a9f43c5eb4a476dd55639158d96be69 Mon Sep 17 00:00:00 2001 From: Thomas Dettbarn Date: Fri, 14 Feb 2025 09:47:39 +0100 Subject: [PATCH 056/113] removed some compiler warnings and commented the representations a bit better. --- lib_enc/ACcontextMapping_enc_fx.c | 54 +++++++++++++++---------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/lib_enc/ACcontextMapping_enc_fx.c b/lib_enc/ACcontextMapping_enc_fx.c index aad058c27..4c12b6907 100644 --- a/lib_enc/ACcontextMapping_enc_fx.c +++ b/lib_enc/ACcontextMapping_enc_fx.c @@ -16,8 +16,8 @@ #include "prot_fx_enc.h" #include "ivas_prot.h" /* Range coder header file */ -#define MAKE_NUMBER_QX( number, QX ) ( ( number ) << ( QX ) ) -#define MAKE_VARIABLE_QX( variable, QX ) W_shl( W_deposit32_l( L_deposit_l( ( variable ) ) ), ( QX ) ) +#define MAKE_NUMBER_QX( number, QX ) ( ( number ) << ( QX ) ) /* evaulated at compile time */ +#define MAKE_VARIABLE_QX( variable, QX ) W_shl( W_deposit32_l( L_deposit_l( ( variable ) ) ), ( QX ) ) /* evaluated at run time */ /*-------------------------------------------------------------------* * ACcontextMapping_encode2_no_mem_s17_LC_fx() @@ -1346,8 +1346,8 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( b1 = (Word16) abs( x[b1_i] ); lev1 = -( 1 << ( NBITS_CONTEXT + NBITS_RATEQ ) ); - bit_estimate_fx = W_add_nosat( bit_estimate_fx, MAKE_VARIABLE_QX( s_min( a1, 1 ), Q23 ) ); - bit_estimate_fx = W_add_nosat( bit_estimate_fx, MAKE_VARIABLE_QX( s_min( b1, 1 ), Q23 ) ); + bit_estimate_fx = W_add( bit_estimate_fx, MAKE_VARIABLE_QX( s_min( a1, 1 ), Q23 ) ); + bit_estimate_fx = W_add( bit_estimate_fx, MAKE_VARIABLE_QX( s_min( b1, 1 ), Q23 ) ); /* 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 ) ); @@ -1357,8 +1357,8 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( { pki = lookup[lev1]; /* ESC symbol */ - bit_estimate_fx = W_add_nosat( bit_estimate_fx, ari_bit_estimate_s17_LC_fx[pki][VAL_ESC] ); - bit_estimate_fx = W_add_nosat( bit_estimate_fx, MAKE_VARIABLE_QX( 2, Q23 ) ); + bit_estimate_fx = W_add( bit_estimate_fx, ari_bit_estimate_s17_LC_fx[pki][VAL_ESC] ); + bit_estimate_fx = W_add( bit_estimate_fx, MAKE_VARIABLE_QX( 2, Q23 ) ); a1 = shr( a1, 1 ); b1 = shr( b1, 1 ); @@ -1370,10 +1370,10 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( pki = lookup[lev1]; symbol = add( a1, i_mult( A_THRES, b1 ) ); /* Q0 */ - bit_estimate_fx = W_add_nosat( bit_estimate_fx, ari_bit_estimate_s17_LC_fx[pki][symbol] ); + bit_estimate_fx = W_add( bit_estimate_fx, ari_bit_estimate_s17_LC_fx[pki][symbol] ); /* Should we truncate? */ - IF( GT_32( W_shr( bit_estimate_fx, Q8 ), L_shl( target, Q15 ) ) ) + IF( GT_32( W_extract_l( W_shr( bit_estimate_fx, Q8 ) ), L_shl( target, Q15 ) ) ) { stop2 = 1; move16(); @@ -1428,11 +1428,11 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( } /*end of the 2-tuples loop*/ - total_output_bits = round_fx( W_shr( bit_estimate_fx, Q7 ) ); + total_output_bits = round_fx( W_extract_l( W_shr( bit_estimate_fx, Q7 ) ) ); /* Q23 -> Q16 -> Q0 */ IF( *stop ) { - total_output_bits = round_fx( W_shr( nbits2_fx, Q7 ) ); + total_output_bits = round_fx( W_extract_l( W_shr( nbits2_fx, Q7 ) ) ); /* Q23 -> Q16 -> Q0 */ } IF( stop2 ) @@ -1458,7 +1458,7 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( move16(); - return round_fx( L_add( W_shr( nbits2_fx, Q7 ), ONE_IN_Q14 ) ); /* Q0 */ + return round_fx( L_add( W_extract_l( W_shr( nbits2_fx, Q7 ) ), ONE_IN_Q14 ) ); /* Q0 */ } ELSE /* if (!hm_cfg) */ { @@ -1524,8 +1524,8 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( move16(); rateQ = add( rateFlag, extract_l( GT_16( k, shr( nt, 1 ) ) ) ); /* Q0 */ - bit_estimate_fx = W_add_nosat( bit_estimate_fx, MAKE_VARIABLE_QX( s_min( a1, 1 ), Q23 ) ); - bit_estimate_fx = W_add_nosat( bit_estimate_fx, MAKE_VARIABLE_QX( s_min( b1, 1 ), Q23 ) ); + bit_estimate_fx = W_add( bit_estimate_fx, MAKE_VARIABLE_QX( s_min( a1, 1 ), Q23 ) ); + bit_estimate_fx = W_add( bit_estimate_fx, MAKE_VARIABLE_QX( s_min( b1, 1 ), Q23 ) ); /* 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 + shl( rateQ, NBITS_CONTEXT )]; /* Q0 */ @@ -1537,8 +1537,8 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( pki = lookup[( esc_nb << ( NBITS_CONTEXT + NBITS_RATEQ ) )]; /* Q0 */ move16(); - bit_estimate_fx = W_add_nosat( bit_estimate_fx, ari_bit_estimate_s17_LC_fx[pki][VAL_ESC] ); - bit_estimate_fx = W_add_nosat( bit_estimate_fx, MAKE_VARIABLE_QX( 2, Q23 ) ); + bit_estimate_fx = W_add( bit_estimate_fx, ari_bit_estimate_s17_LC_fx[pki][VAL_ESC] ); + bit_estimate_fx = W_add( bit_estimate_fx, MAKE_NUMBER_QX( 2, Q23 ) ); a1 = shr( a1, 1 ); b1 = shr( b1, 1 ); @@ -1553,10 +1553,10 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( move16(); symbol = add( a1, i_mult( A_THRES, b1 ) ); /* Q0 */ - bit_estimate_fx = W_add_nosat( bit_estimate_fx, ari_bit_estimate_s17_LC_fx[pki][symbol] ); + bit_estimate_fx = W_add( bit_estimate_fx, ari_bit_estimate_s17_LC_fx[pki][symbol] ); /* Should we truncate? */ - IF( GT_32( W_shr( bit_estimate_fx, Q8 ), L_shl( target, Q15 ) ) ) + IF( GT_32( W_extract_l( W_shr( bit_estimate_fx, Q8 ) ), L_shl( target, Q15 ) ) ) { overflow_flag = 1; move16(); @@ -1587,7 +1587,7 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( } /*end of the 2-tuples loop*/ - tot_bits2 = round_fx( W_shr( nbits2_fx, Q7 ) ); + tot_bits2 = round_fx( W_extract_l( W_shr( nbits2_fx, Q7 ) ) ); /* Q23 -> Q16 -> Q0 */ IF( LT_16( lastnz2, lastnz ) ) /* Overflow occured because unable to code all tuples */ { overflow_flag = 1; @@ -1595,7 +1595,7 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( } IF( EQ_16( mode, -1 ) ) { - tot_bits2 = round_fx( W_shr( bit_estimate_fx, Q7 ) ); + tot_bits2 = round_fx( W_extract_l( W_shr( bit_estimate_fx, Q7 ) ) ); /* Q23 -> Q16 -> Q0 */ } IF( overflow_flag == 0 ) /* No overflow */ { @@ -1610,7 +1610,7 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( } ELSE { - *stop = round_fx( W_shr( bit_estimate_fx, Q7 ) ); + *stop = round_fx( W_extract_l( W_shr( bit_estimate_fx, Q7 ) ) ); /* Q23 -> Q16 -> Q0 */ move16(); } } @@ -1683,7 +1683,7 @@ Word16 RCcontextMapping_encode2_estimate_bandWise_start_fx( } /* bits to encode lastnz */ - hContextMem->nbits_old = round_fx( W_shr( hContextMem->bit_estimate_fx, Q7 ) ); /* Q0 */ + hContextMem->nbits_old = round_fx( W_extract_l( W_shr( hContextMem->bit_estimate_fx, Q7 ) ) ); /* Q0 */ move16(); hContextMem->ctx = 0; @@ -1761,8 +1761,8 @@ Word16 RCcontextMapping_encode2_estimate_bandWise_fx( lev1 = -( 1 << ( NBITS_CONTEXT + NBITS_RATEQ ) ); /* Q0 */ /* Signs Bits */ - hContextMem->bit_estimate_fx = W_add_nosat( hContextMem->bit_estimate_fx, MAKE_VARIABLE_QX( s_min( a1, 1 ), Q23 ) ); - hContextMem->bit_estimate_fx = W_add_nosat( hContextMem->bit_estimate_fx, MAKE_VARIABLE_QX( s_min( b1, 1 ), Q23 ) ); + hContextMem->bit_estimate_fx = W_add( hContextMem->bit_estimate_fx, MAKE_VARIABLE_QX( s_min( a1, 1 ), Q23 ) ); + hContextMem->bit_estimate_fx = W_add( hContextMem->bit_estimate_fx, MAKE_VARIABLE_QX( s_min( b1, 1 ), Q23 ) ); move32(); move32(); @@ -1777,8 +1777,8 @@ Word16 RCcontextMapping_encode2_estimate_bandWise_fx( pki = lookup[lev1]; /* Q0 */ move16(); - hContextMem->bit_estimate_fx = W_add_nosat( hContextMem->bit_estimate_fx, ari_bit_estimate_s17_LC_fx[pki][VAL_ESC] ); - hContextMem->bit_estimate_fx = W_add_nosat( hContextMem->bit_estimate_fx, MAKE_VARIABLE_QX( 2, Q23 ) ); + hContextMem->bit_estimate_fx = W_add( hContextMem->bit_estimate_fx, ari_bit_estimate_s17_LC_fx[pki][VAL_ESC] ); + hContextMem->bit_estimate_fx = W_add( hContextMem->bit_estimate_fx, MAKE_NUMBER_QX( 2, Q23 ) ); move32(); move32(); @@ -1796,7 +1796,7 @@ Word16 RCcontextMapping_encode2_estimate_bandWise_fx( pki = lookup[lev1]; /* Q0 */ move16(); symbol = add( a1, i_mult( A_THRES, b1 ) ); /* MSB symbol Q0*/ - hContextMem->bit_estimate_fx = W_add_nosat( hContextMem->bit_estimate_fx, ari_bit_estimate_s17_LC_fx[pki][symbol] ); + hContextMem->bit_estimate_fx = W_add( hContextMem->bit_estimate_fx, ari_bit_estimate_s17_LC_fx[pki][symbol] ); move32(); // hContextMem->bit_estimate = hContextMem->bit_estimate + ari_bit_estimate_s17_LC[pki][symbol]; @@ -1817,7 +1817,7 @@ Word16 RCcontextMapping_encode2_estimate_bandWise_fx( move16(); } /*end of the 2-tuples loop*/ - total_output_bits = round_fx( W_shr( hContextMem->bit_estimate_fx, Q7 ) ); /* Q0 */ + total_output_bits = round_fx( W_extract_l( W_shr( hContextMem->bit_estimate_fx, Q7 ) ) ); /* Q0 */ // total_output_bits = (Word16) ( hContextMem->bit_estimate + 0.5f ); -- GitLab From dbb55697955ed456f41e51f63e5498fb9438a941 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Fri, 14 Feb 2025 09:52:13 +0100 Subject: [PATCH 057/113] improve reporting in be check job --- .gitlab-ci.yml | 69 +++++++++++++++++++++++++++++--------------------- 1 file changed, 40 insertions(+), 29 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 32003043d..5007018a3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -35,6 +35,7 @@ variables: COMPARE_DMX: "" SKIP_REGRESSION_CHECK: "" FAILED_TESTCASES_LIST: "failed-testcases.txt" + ERRORS_TESTCASES_LIST: "errors-testcases.txt" PYTEST_CACHE_ARTIFACT: "pytest_cache.zip" MANUAL_PIPELINE_TYPE: description: "Type for the manual pipeline run. Use 'pytest-compare' to run comparison test against reference float codec." @@ -305,6 +306,14 @@ stages: tags: - ivas-windows +.print-results-banner: &print-results-banner + - set +x + - echo "" + - echo "==================================================================================================================" + - echo "================================================== TEST RESULTS ==================================================" + - echo "==================================================================================================================" + - echo "" + # template for test jobs on linux that need the TESTV_DIR .test-job-linux-needs-testv-dir: extends: .test-job-linux @@ -444,17 +453,37 @@ stages: - exit_code=0 - rm -rf .pytest_cache || true - python3 -m pytest -k "stereo and at" --tb=no -q $TEST_SUITE -v --keep_files --create_cut --html=$HTML_REPORT --self-contained-html --junit-xml=$XML_REPORT --mld --ssnr --odg --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH -n auto --testcase_timeout $testcase_timeout > pytest_log.txt || exit_code=$? - - zero_errors_branch=$(cat $XML_REPORT | grep -c 'errors="0"') || true - touch $FAILED_TESTCASES_LIST + - touch $ERRORS_TESTCASES_LIST + - touch $PYTEST_CACHE_ARTIFACT - if [ $exit_code -ne 0 ]; then - exit_code=$EXIT_CODE_NON_BE + - zip -r $PYTEST_CACHE_ARTIFACT .pytest_cache + - grep "^FAILED" pytest_log.txt | sed 's/^FAILED //' | sed 's/] - .*/]/' | tr "\n" " " > $FAILED_TESTCASES_LIST - - fi + - grep "^FAILED" pytest_log.txt | sed 's/^FAILED //' | sed 's/] - .*/]/' > failed_testcases_for_printing.txt + - num_failures=$(wc -l < failed_testcases_for_printing.txt) - - cat $FAILED_TESTCASES_LIST + - grep "^ERROR" pytest_log.txt | sed 's/^ERROR //' | sed 's/] - .*/]/' | tr "\n" " " > $ERRORS_TESTCASES_LIST + - grep "^ERROR" pytest_log.txt | sed 's/^ERROR //' | sed 's/] - .*/]/' > errors_testcases_for_printing.txt + - num_errors=$(wc -l < errors_testcases_for_printing.txt) - - zip -r $PYTEST_CACHE_ARTIFACT .pytest_cache + - *print-results-banner + - echo "Found these $num_failures non-bitexact testcases:" + - cat failed_testcases_for_printing.txt + + - if [ $num_errors -ne 0 ]; then + - exit_code=1 + - echo "There were errors present in the following testcases:" + - cat errors_testcases_for_printing.txt + - fi + + - exit $exit_code + - else + - *print-results-banner + - echo "All testcases are bitexact." + - fi - exit $exit_code allow_failure: @@ -502,7 +531,10 @@ stages: - *overwrite-pytest-cache-with-artifact - export PYTEST_ADDOPTS=--last-failed - else - - echo "All tested cases were bit-exact between $CI_MERGE_REQUEST_TARGET_BRANCH_NAME and $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME. No need to check for regressions." + # turn off echoing back of commands for result printout + - *print-results-banner + - echo "All tested cases were bit-exact between $CI_MERGE_REQUEST_TARGET_BRANCH_NAME and $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME." + - echo "No need to check for regressions. All is fine." - exit 0 - fi @@ -528,10 +560,9 @@ stages: ### run branch first # this per default builds the branch and the reference and creates the reference outputs - *build-and-create-reference-outputs - - exit_code=0 # need to restore cache again - *overwrite-pytest-cache-with-artifact - - python3 -m pytest --tb=no $TEST_SUITE -v --keep_files --create_cut --html=$HTML_REPORT_BRANCH --self-contained-html --junit-xml=$XML_REPORT_BRANCH --mld --ssnr --odg --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH -n auto --testcase_timeout $testcase_timeout || exit_code=$? + - python3 -m pytest --tb=no -q $TEST_SUITE -v --keep_files --create_cut --html=$HTML_REPORT_BRANCH --self-contained-html --junit-xml=$XML_REPORT_BRANCH --mld --ssnr --odg --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH -n auto --testcase_timeout $testcase_timeout || true - zero_errors_branch=$(cat $XML_REPORT_BRANCH | grep -c 'errors="0"') || true - python3 scripts/parse_xml_report.py $XML_REPORT_BRANCH $CSV_BRANCH @@ -550,34 +581,14 @@ stages: - make -j # need to restore cache again - *overwrite-pytest-cache-with-artifact - - python3 -m pytest --tb=no $TEST_SUITE -v --keep_files --create_cut --html=$HTML_REPORT_MAIN --self-contained-html --junit-xml=$XML_REPORT_MAIN --mld --ssnr --odg --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH -n auto --testcase_timeout $testcase_timeout || true + - python3 -m pytest --tb=no -q $TEST_SUITE -v --keep_files --create_cut --html=$HTML_REPORT_MAIN --self-contained-html --junit-xml=$XML_REPORT_MAIN --mld --ssnr --odg --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH -n auto --testcase_timeout $testcase_timeout || true - python3 scripts/parse_xml_report.py $XML_REPORT_MAIN $CSV_MAIN - # If outputs of main and branch are equal, have equal reports and no run errors were encountered, the job will pass. - - diff_sba=0 - - diff_param=0 - - diff_report=0 - # SHORT_TEST_SUITE_ENCODER does not contain test_sba.py. This leads to non-existing output folders being compared and to diff_sba=1. Therefore, this is skipped for the encoder tests - - if [ "$TEST_SUITE" != "$SHORT_TEST_SUITE_ENCODER" ]; then - - python3 scripts/batch_comp_audio.py --tool pyaudio3dtools -sd tests/dut/sba_bs/raw tests/dut_branch/sba_bs/raw || diff_sba=$? - - fi - - python3 scripts/batch_comp_audio.py --tool pyaudio3dtools -sd tests/dut/param_file/dec tests/dut_branch/param_file/dec || diff_param=$? - - diff $CSV_BRANCH $CSV_MAIN || diff_report=$? - - if [ $diff_param -eq 0 ] && [ $diff_sba -eq 0 ] && [ $diff_report -eq 0 ] && [ $zero_errors_branch -eq 1 ]; then - - echo "Output BE to main, identical report and no run errors encountered." - # Add dummy files to avoid warning on missing artifacts - - touch changes_crashes.csv - - touch changes_MLD.csv - - touch changes_MAXIMUM_ABS_DIFF.csv - - touch changes_MIN_SSNR.csv - - touch changes_MIN_ODG.csv - - exit 0; - - fi - ### compare the two csv files for regressions - regressions_found=0 - python3 scripts/basop_check_for_changes_in_testcases.py --xml_report $XML_REPORT_BRANCH $CSV_MAIN $CSV_BRANCH || regressions_found=$? + - exit_code=0 - if [ $exit_code -eq 1 ]; then echo "Differences encountered"; exit_code=$EXIT_CODE_NON_BE; fi - if [ $zero_errors_branch != 1 ]; then echo "Run errors encountered!"; exit_code=$EXIT_CODE_NON_BE; fi - if [ $regressions_found != 0 ] && [ "$SKIP_REGRESSION_CHECK" != "true" ]; then -- GitLab From e7adcd904f205e4aa4577394a8eb58af7f831ded Mon Sep 17 00:00:00 2001 From: Thomas Dettbarn Date: Fri, 14 Feb 2025 09:59:49 +0100 Subject: [PATCH 058/113] applied the clang patch. --- lib_enc/ACcontextMapping_enc_fx.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib_enc/ACcontextMapping_enc_fx.c b/lib_enc/ACcontextMapping_enc_fx.c index 4c12b6907..203f39707 100644 --- a/lib_enc/ACcontextMapping_enc_fx.c +++ b/lib_enc/ACcontextMapping_enc_fx.c @@ -16,8 +16,8 @@ #include "prot_fx_enc.h" #include "ivas_prot.h" /* Range coder header file */ -#define MAKE_NUMBER_QX( number, QX ) ( ( number ) << ( QX ) ) /* evaulated at compile time */ -#define MAKE_VARIABLE_QX( variable, QX ) W_shl( W_deposit32_l( L_deposit_l( ( variable ) ) ), ( QX ) ) /* evaluated at run time */ +#define MAKE_NUMBER_QX( number, QX ) ( ( number ) << ( QX ) ) /* evaulated at compile time */ +#define MAKE_VARIABLE_QX( variable, QX ) W_shl( W_deposit32_l( L_deposit_l( ( variable ) ) ), ( QX ) ) /* evaluated at run time */ /*-------------------------------------------------------------------* * ACcontextMapping_encode2_no_mem_s17_LC_fx() @@ -1588,7 +1588,7 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx( } /*end of the 2-tuples loop*/ tot_bits2 = round_fx( W_extract_l( W_shr( nbits2_fx, Q7 ) ) ); /* Q23 -> Q16 -> Q0 */ - IF( LT_16( lastnz2, lastnz ) ) /* Overflow occured because unable to code all tuples */ + IF( LT_16( lastnz2, lastnz ) ) /* Overflow occured because unable to code all tuples */ { overflow_flag = 1; move16(); @@ -1816,7 +1816,7 @@ Word16 RCcontextMapping_encode2_estimate_bandWise_fx( hContextMem->ctx = add( i_mult( s_and( hContextMem->ctx, 0xf ), 16 ), t ); /* Q0 */ move16(); - } /*end of the 2-tuples loop*/ + } /*end of the 2-tuples loop*/ total_output_bits = round_fx( W_extract_l( W_shr( hContextMem->bit_estimate_fx, Q7 ) ) ); /* Q0 */ // total_output_bits = (Word16) ( hContextMem->bit_estimate + 0.5f ); -- GitLab From 6e747abbf37c5e0cbe41d683cb416c10b83d3d6c Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Fri, 14 Feb 2025 10:32:00 +0100 Subject: [PATCH 059/113] condense printout --- .gitlab-ci.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5007018a3..b8b21b72b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -309,10 +309,10 @@ stages: .print-results-banner: &print-results-banner - set +x - echo "" - - echo "==================================================================================================================" - - echo "================================================== TEST RESULTS ==================================================" - - echo "==================================================================================================================" - - echo "" + - > + echo -e "==================================================================================================================\n +================================================== TEST RESULTS ==================================================\n +==================================================================================================================\n" # template for test jobs on linux that need the TESTV_DIR .test-job-linux-needs-testv-dir: @@ -533,8 +533,7 @@ stages: - else # turn off echoing back of commands for result printout - *print-results-banner - - echo "All tested cases were bit-exact between $CI_MERGE_REQUEST_TARGET_BRANCH_NAME and $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME." - - echo "No need to check for regressions. All is fine." + - echo -e "All tested cases were bit-exact between $CI_MERGE_REQUEST_TARGET_BRANCH_NAME and $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME.\nNo need to check for regressions. All is fine." - exit 0 - fi -- GitLab From 0cae04a9ef1b5ceac92c43f42f2c51e70be10c0d Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Fri, 14 Feb 2025 10:33:44 +0100 Subject: [PATCH 060/113] fix artifact-related zip error --- .gitlab-ci.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b8b21b72b..d8eecaabe 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -454,9 +454,6 @@ stages: - rm -rf .pytest_cache || true - python3 -m pytest -k "stereo and at" --tb=no -q $TEST_SUITE -v --keep_files --create_cut --html=$HTML_REPORT --self-contained-html --junit-xml=$XML_REPORT --mld --ssnr --odg --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH -n auto --testcase_timeout $testcase_timeout > pytest_log.txt || exit_code=$? - - touch $FAILED_TESTCASES_LIST - - touch $ERRORS_TESTCASES_LIST - - touch $PYTEST_CACHE_ARTIFACT - if [ $exit_code -ne 0 ]; then - exit_code=$EXIT_CODE_NON_BE - zip -r $PYTEST_CACHE_ARTIFACT .pytest_cache @@ -481,6 +478,10 @@ stages: - exit $exit_code - else + # create empty files to not have errors at artifact stage + - touch $FAILED_TESTCASES_LIST + - touch $ERRORS_TESTCASES_LIST + - touch $PYTEST_CACHE_ARTIFACT - *print-results-banner - echo "All testcases are bitexact." - fi @@ -497,6 +498,7 @@ stages: - $XML_REPORT - $HTML_REPORT - $FAILED_TESTCASES_LIST + - $ERRORS_TESTCASES_LIST - pytest_log.txt - $PYTEST_CACHE_ARTIFACT expose_as: "pytest compare results" -- GitLab From b39991b5fdadac3d4ed624d569d955b5ba187906 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Fri, 14 Feb 2025 10:35:17 +0100 Subject: [PATCH 061/113] collapse into one line --- .gitlab-ci.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d8eecaabe..5ee556e60 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -309,10 +309,7 @@ stages: .print-results-banner: &print-results-banner - set +x - echo "" - - > - echo -e "==================================================================================================================\n -================================================== TEST RESULTS ==================================================\n -==================================================================================================================\n" + - echo -e "==================================================================================================================\n================================================== TEST RESULTS ==================================================\n==================================================================================================================\n" # template for test jobs on linux that need the TESTV_DIR .test-job-linux-needs-testv-dir: -- GitLab From db14b5ea2514f5349ed819e2b27b6052a19dfcb3 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Fri, 14 Feb 2025 10:42:12 +0100 Subject: [PATCH 062/113] ignore return codes for grep pipes --- .gitlab-ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5ee556e60..d672a4b98 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -455,12 +455,12 @@ stages: - exit_code=$EXIT_CODE_NON_BE - zip -r $PYTEST_CACHE_ARTIFACT .pytest_cache - - grep "^FAILED" pytest_log.txt | sed 's/^FAILED //' | sed 's/] - .*/]/' | tr "\n" " " > $FAILED_TESTCASES_LIST - - grep "^FAILED" pytest_log.txt | sed 's/^FAILED //' | sed 's/] - .*/]/' > failed_testcases_for_printing.txt + - grep "^FAILED" pytest_log.txt | sed 's/^FAILED //' | sed 's/] - .*/]/' | tr "\n" " " > $FAILED_TESTCASES_LIST || true + - grep "^FAILED" pytest_log.txt | sed 's/^FAILED //' | sed 's/] - .*/]/' > failed_testcases_for_printing.txt || true - num_failures=$(wc -l < failed_testcases_for_printing.txt) - - grep "^ERROR" pytest_log.txt | sed 's/^ERROR //' | sed 's/] - .*/]/' | tr "\n" " " > $ERRORS_TESTCASES_LIST - - grep "^ERROR" pytest_log.txt | sed 's/^ERROR //' | sed 's/] - .*/]/' > errors_testcases_for_printing.txt + - grep "^ERROR" pytest_log.txt | sed 's/^ERROR //' | sed 's/] - .*/]/' | tr "\n" " " > $ERRORS_TESTCASES_LIST || true + - grep "^ERROR" pytest_log.txt | sed 's/^ERROR //' | sed 's/] - .*/]/' > errors_testcases_for_printing.txt || true - num_errors=$(wc -l < errors_testcases_for_printing.txt) - *print-results-banner -- GitLab From 499c80b726336eb6294211a28ce07ed3cc389b51 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Fri, 14 Feb 2025 10:57:43 +0100 Subject: [PATCH 063/113] rework if and result reporting in regression branch --- .gitlab-ci.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d672a4b98..c0e04314d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -587,14 +587,16 @@ stages: - python3 scripts/basop_check_for_changes_in_testcases.py --xml_report $XML_REPORT_BRANCH $CSV_MAIN $CSV_BRANCH || regressions_found=$? - exit_code=0 - - if [ $exit_code -eq 1 ]; then echo "Differences encountered"; exit_code=$EXIT_CODE_NON_BE; fi - - if [ $zero_errors_branch != 1 ]; then echo "Run errors encountered!"; exit_code=$EXIT_CODE_NON_BE; fi - - if [ $regressions_found != 0 ] && [ "$SKIP_REGRESSION_CHECK" != "true" ]; then + - *print-results-banner + - if [ $zero_errors_branch != 1 ]; then + - echo "Run errors encountered!" + - exit_code=$EXIT_CODE_FAIL + - elif [ $regressions_found != 0 ] && [ "$SKIP_REGRESSION_CHECK" != "true" ]; then - if [ $allow_regressions_flag == 0 ]; then - - echo "Detected regression wrt to main, [allow regression] not set!" + - echo "Detected regression wrt to $CI_MERGE_REQUEST_TARGET_BRANCH_NAME, [allow regression] not set!" - exit_code=$EXIT_CODE_FAIL; - else - - echo "Detected regression wrt to main, [allow regression] set." + - echo "Detected regression wrt to $CI_MERGE_REQUEST_TARGET_BRANCH_NAME, [allow regression] set." - exit_code=$EXIT_CODE_NON_BE; - fi - fi -- GitLab From 5eb39f0dd6600569a66c417297df647e0b17aa08 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Fri, 14 Feb 2025 11:23:00 +0100 Subject: [PATCH 064/113] remove SKIP_REGrESSION_CHECK --- .gitlab-ci.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c0e04314d..36bb0d5d5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -895,7 +895,6 @@ check-be-to-target-short-enc-0db: - DUT_DECODER_PATH=./IVAS_dec_ref - TEST_SUITE="$SHORT_TEST_SUITE_ENCODER" - LEVEL_SCALING=1.0 - - SKIP_REGRESSION_CHECK="true" - rm -rf tests/dut tests/ref <<: *check-be-to-target-anchor @@ -908,7 +907,6 @@ check-be-to-target-short-enc-+10db: - DUT_DECODER_PATH=./IVAS_dec_ref - TEST_SUITE="$SHORT_TEST_SUITE_ENCODER" - LEVEL_SCALING=3.162 - - SKIP_REGRESSION_CHECK="true" - rm -rf tests/dut tests/ref <<: *check-be-to-target-anchor @@ -921,7 +919,6 @@ check-be-to-target-short-enc--10db: - DUT_DECODER_PATH=./IVAS_dec_ref - TEST_SUITE="$SHORT_TEST_SUITE_ENCODER" - LEVEL_SCALING=0.3162 - - SKIP_REGRESSION_CHECK="true" - rm -rf tests/dut tests/ref <<: *check-be-to-target-anchor @@ -975,7 +972,6 @@ check-regressions-short-enc-0db: - DUT_DECODER_PATH=./IVAS_dec_ref - TEST_SUITE="$SHORT_TEST_SUITE_ENCODER" - LEVEL_SCALING=1.0 - - SKIP_REGRESSION_CHECK="true" - rm -rf tests/dut tests/ref <<: *ivas-pytest-on-merge-request-anchor @@ -992,7 +988,6 @@ check-regressions-short-enc-+10db: - DUT_DECODER_PATH=./IVAS_dec_ref - TEST_SUITE="$SHORT_TEST_SUITE_ENCODER" - LEVEL_SCALING=3.162 - - SKIP_REGRESSION_CHECK="true" - rm -rf tests/dut tests/ref <<: *ivas-pytest-on-merge-request-anchor @@ -1009,7 +1004,6 @@ check-regressions-short-enc--10db: - DUT_DECODER_PATH=./IVAS_dec_ref - TEST_SUITE="$SHORT_TEST_SUITE_ENCODER" - LEVEL_SCALING=0.3162 - - SKIP_REGRESSION_CHECK="true" - rm -rf tests/dut tests/ref <<: *ivas-pytest-on-merge-request-anchor -- GitLab From 8a5c23e97fd44728ac6ede26212596c0a3c9bd14 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Fri, 14 Feb 2025 11:34:47 +0100 Subject: [PATCH 065/113] move printout of regression testcases into results section --- .gitlab-ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 36bb0d5d5..ec7634a6f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -584,7 +584,7 @@ stages: ### compare the two csv files for regressions - regressions_found=0 - - python3 scripts/basop_check_for_changes_in_testcases.py --xml_report $XML_REPORT_BRANCH $CSV_MAIN $CSV_BRANCH || regressions_found=$? + - python3 scripts/basop_check_for_changes_in_testcases.py --xml_report $XML_REPORT_BRANCH $CSV_MAIN $CSV_BRANCH > regression_log.txt || regressions_found=$? - exit_code=0 - *print-results-banner @@ -592,6 +592,7 @@ stages: - echo "Run errors encountered!" - exit_code=$EXIT_CODE_FAIL - elif [ $regressions_found != 0 ] && [ "$SKIP_REGRESSION_CHECK" != "true" ]; then + - cat regression_log.txt - if [ $allow_regressions_flag == 0 ]; then - echo "Detected regression wrt to $CI_MERGE_REQUEST_TARGET_BRANCH_NAME, [allow regression] not set!" - exit_code=$EXIT_CODE_FAIL; -- GitLab From 9db1630e8057b7f6d16f35371c6dd2675b41672c Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Fri, 14 Feb 2025 12:14:58 +0100 Subject: [PATCH 066/113] add infos for local reproduction to check-be tests --- .gitlab-ci.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ec7634a6f..e80445293 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -37,6 +37,8 @@ variables: FAILED_TESTCASES_LIST: "failed-testcases.txt" ERRORS_TESTCASES_LIST: "errors-testcases.txt" PYTEST_CACHE_ARTIFACT: "pytest_cache.zip" + REF_COMMIT_FILE: "ref-branch-git-sha" + CUT_COMMIT_FILE: "CuT-branch-git-sha" MANUAL_PIPELINE_TYPE: description: "Type for the manual pipeline run. Use 'pytest-compare' to run comparison test against reference float codec." value: 'default' @@ -145,6 +147,7 @@ stages: - fi .build-reference-binaries: &build-reference-binaries + - git rev-parse HEAD > $CUT_COMMIT_FILE - current_commit_sha=$(git rev-parse HEAD) ### build reference binaries - git checkout $REFERENCE_BRANCH @@ -158,6 +161,7 @@ stages: - mv ./IVAS_rend ./IVAS_rend_ref ### Return to current branch - git restore . + - git rev-parse HEAD > $REF_COMMIT_FILE - git checkout $current_commit_sha @@ -467,6 +471,10 @@ stages: - echo "Found these $num_failures non-bitexact testcases:" - cat failed_testcases_for_printing.txt + - echo "Reproduce locally with:" + - echo -e "1. Create references with target branch $CI_MERGE_REQUEST_TARGET_BRANCH_NAME:\n\t- git checkout $(cat $REF_COMMIT_FILE)\n\t- make clean\n\t- make -j\n\t- mv IVAS_cod IVAS_cod_ref\n\t- mv IVAS_dec IVAS_dec_ref\n\t- python3 -m pytest $(cat $FAILED_TESTCASES_LIST) --update_ref 1 --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH" + - echo -e "2. Run test with source branch $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME:\n\t- git checkout $(cat $CUT_COMMIT_FILE)\n\t- make clean\n\t- make -j\n\t- python3 -m pytest $(cat $FAILED_TESTCASES_LIST) --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH" + - if [ $num_errors -ne 0 ]; then - exit_code=1 - echo "There were errors present in the following testcases:" @@ -498,6 +506,8 @@ stages: - $ERRORS_TESTCASES_LIST - pytest_log.txt - $PYTEST_CACHE_ARTIFACT + - $REF_COMMIT_FILE + - $CUT_COMMIT_FILE expose_as: "pytest compare results" reports: junit: -- GitLab From 5f54c650b822bc251d02df4806786079818e694d Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Fri, 14 Feb 2025 12:17:25 +0100 Subject: [PATCH 067/113] add infos also to regression check jobs --- .gitlab-ci.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e80445293..fd0596d4d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -601,6 +601,9 @@ stages: - if [ $zero_errors_branch != 1 ]; then - echo "Run errors encountered!" - exit_code=$EXIT_CODE_FAIL + - echo "Reproduce locally with:" + - echo -e "1. Create references with target branch $CI_MERGE_REQUEST_TARGET_BRANCH_NAME:\n\t- git checkout $(cat $REF_COMMIT_FILE)\n\t- make clean\n\t- make -j\n\t- mv IVAS_cod IVAS_cod_ref\n\t- mv IVAS_dec IVAS_dec_ref\n\t- python3 -m pytest $(cat $ERRORS_TESTCASES_LIST) --update_ref 1 --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH" + - echo -e "2. Run test with source branch $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME:\n\t- git checkout $(cat $CUT_COMMIT_FILE)\n\t- make clean\n\t- make -j\n\t- python3 -m pytest $(cat $ERRORS_TESTCASES_LIST) --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH" - elif [ $regressions_found != 0 ] && [ "$SKIP_REGRESSION_CHECK" != "true" ]; then - cat regression_log.txt - if [ $allow_regressions_flag == 0 ]; then @@ -610,6 +613,9 @@ stages: - echo "Detected regression wrt to $CI_MERGE_REQUEST_TARGET_BRANCH_NAME, [allow regression] set." - exit_code=$EXIT_CODE_NON_BE; - fi + - echo "Reproduce locally with:" + - echo -e "1. Create references with target branch $CI_MERGE_REQUEST_TARGET_BRANCH_NAME:\n\t- git checkout $(cat $REF_COMMIT_FILE)\n\t- make clean\n\t- make -j\n\t- mv IVAS_cod IVAS_cod_ref\n\t- mv IVAS_dec IVAS_dec_ref\n\t- python3 -m pytest $(cat $FAILED_TESTCASES_LIST) --update_ref 1 --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH" + - echo -e "2. Run test with source branch $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME:\n\t- git checkout $(cat $CUT_COMMIT_FILE)\n\t- make clean\n\t- make -j\n\t- python3 -m pytest $(cat $FAILED_TESTCASES_LIST) --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH" - fi - exit $exit_code -- GitLab From b8f5e73dc5e8c9383ee681d0ed8fce68aa47e20a Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Fri, 14 Feb 2025 12:27:28 +0100 Subject: [PATCH 068/113] change formatting in FAILED_TESTCASE_LIST and ERRORS_TESTCASES_LIST to this should make command pasteable --- .gitlab-ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fd0596d4d..f351c5c27 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -459,12 +459,12 @@ stages: - exit_code=$EXIT_CODE_NON_BE - zip -r $PYTEST_CACHE_ARTIFACT .pytest_cache - - grep "^FAILED" pytest_log.txt | sed 's/^FAILED //' | sed 's/] - .*/]/' | tr "\n" " " > $FAILED_TESTCASES_LIST || true - - grep "^FAILED" pytest_log.txt | sed 's/^FAILED //' | sed 's/] - .*/]/' > failed_testcases_for_printing.txt || true + - grep "^FAILED" pytest_log.txt | sed "s/^FAILED /'/" | sed "s/] - .*/]'/" | tr "\n" " " > $FAILED_TESTCASES_LIST || true + - grep "^FAILED" pytest_log.txt | sed "s/^FAILED //" | sed "s/] - .*/]/" > failed_testcases_for_printing.txt || true - num_failures=$(wc -l < failed_testcases_for_printing.txt) - - grep "^ERROR" pytest_log.txt | sed 's/^ERROR //' | sed 's/] - .*/]/' | tr "\n" " " > $ERRORS_TESTCASES_LIST || true - - grep "^ERROR" pytest_log.txt | sed 's/^ERROR //' | sed 's/] - .*/]/' > errors_testcases_for_printing.txt || true + - grep "^ERROR" pytest_log.txt | sed "s/^ERROR /'/" | sed "s/] - .*/]'/" | tr "\n" " " > $ERRORS_TESTCASES_LIST || true + - grep "^ERROR" pytest_log.txt | sed "s/^ERROR //" | sed "s/] - .*/]/" > errors_testcases_for_printing.txt || true - num_errors=$(wc -l < errors_testcases_for_printing.txt) - *print-results-banner -- GitLab From 556377cbfec6ae4006d2609e4a6c6f0681223f01 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Fri, 14 Feb 2025 12:37:05 +0100 Subject: [PATCH 069/113] add notion about where to find the command lines --- .gitlab-ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f351c5c27..875a4a478 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -474,7 +474,7 @@ stages: - echo "Reproduce locally with:" - echo -e "1. Create references with target branch $CI_MERGE_REQUEST_TARGET_BRANCH_NAME:\n\t- git checkout $(cat $REF_COMMIT_FILE)\n\t- make clean\n\t- make -j\n\t- mv IVAS_cod IVAS_cod_ref\n\t- mv IVAS_dec IVAS_dec_ref\n\t- python3 -m pytest $(cat $FAILED_TESTCASES_LIST) --update_ref 1 --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH" - echo -e "2. Run test with source branch $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME:\n\t- git checkout $(cat $CUT_COMMIT_FILE)\n\t- make clean\n\t- make -j\n\t- python3 -m pytest $(cat $FAILED_TESTCASES_LIST) --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH" - + - echo "The individual command lines can be found in the html report in the job artifacts." - if [ $num_errors -ne 0 ]; then - exit_code=1 - echo "There were errors present in the following testcases:" @@ -604,6 +604,7 @@ stages: - echo "Reproduce locally with:" - echo -e "1. Create references with target branch $CI_MERGE_REQUEST_TARGET_BRANCH_NAME:\n\t- git checkout $(cat $REF_COMMIT_FILE)\n\t- make clean\n\t- make -j\n\t- mv IVAS_cod IVAS_cod_ref\n\t- mv IVAS_dec IVAS_dec_ref\n\t- python3 -m pytest $(cat $ERRORS_TESTCASES_LIST) --update_ref 1 --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH" - echo -e "2. Run test with source branch $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME:\n\t- git checkout $(cat $CUT_COMMIT_FILE)\n\t- make clean\n\t- make -j\n\t- python3 -m pytest $(cat $ERRORS_TESTCASES_LIST) --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH" + - echo "The individual command lines can be found in the changes*.csv files in the job artifacts." - elif [ $regressions_found != 0 ] && [ "$SKIP_REGRESSION_CHECK" != "true" ]; then - cat regression_log.txt - if [ $allow_regressions_flag == 0 ]; then @@ -616,6 +617,7 @@ stages: - echo "Reproduce locally with:" - echo -e "1. Create references with target branch $CI_MERGE_REQUEST_TARGET_BRANCH_NAME:\n\t- git checkout $(cat $REF_COMMIT_FILE)\n\t- make clean\n\t- make -j\n\t- mv IVAS_cod IVAS_cod_ref\n\t- mv IVAS_dec IVAS_dec_ref\n\t- python3 -m pytest $(cat $FAILED_TESTCASES_LIST) --update_ref 1 --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH" - echo -e "2. Run test with source branch $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME:\n\t- git checkout $(cat $CUT_COMMIT_FILE)\n\t- make clean\n\t- make -j\n\t- python3 -m pytest $(cat $FAILED_TESTCASES_LIST) --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH" + - echo "The individual command lines can be found in the changes*.csv files in the job artifacts." - fi - exit $exit_code -- GitLab From 4b7574d6caaa4ee87b5cc11918dbce5415d15d3d Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 17 Feb 2025 12:37:00 +0100 Subject: [PATCH 070/113] add pre and post check for being up-to-date with target --- .gitlab-ci.yml | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 875a4a478..97de3b670 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -117,6 +117,7 @@ stages: - build - check-be - test + - postvalidate - deploy # --------------------------------------------------------------- @@ -229,6 +230,13 @@ stages: - (Get-Content -Path "CMakeLists.txt") -replace '# \(add_compile_options\("\/WX"\)\)', '$1' | Set-Content -Path "CMakeLists.txt" - Get-ChildItem -Path "Workspace_msvc" -Filter "*.vcxproj" | ForEach-Object { (Get-Content -Path $_.FullName) -replace 'false', 'true' | Set-Content -Path $_.FullName } +.rules-merge-request: + extends: .rules-basis + rules: + - if: $CI_PIPELINE_SOURCE == 'merge_request_event' + - if: $CI_PIPELINE_SOURCE == 'push' + when: never + .rules-pytest-to-ref-short: rules: - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == "pytest-compare" @@ -774,6 +782,35 @@ uninterruptible: # verification jobs # --------------------------------------------------------------- +branch-is-up-to-date-with-target-pre: + extends: + - .rules-merge-request + stage: prevalidate + needs: [] + tags: + - ivas-basop-linux + script: + - *get-commits-behind-count + - | + if [ $commits_behind_count -ne 0 ]; then + echo -e "Your branch is $commits_behind_count commits behind the target branch, run\n\tgit pull origin $CI_MERGE_REQUEST_TARGET_BRANCH_NAME\nto update." + exit 1 + fi + +branch-is-up-to-date-with-target-post: + extends: + - .rules-merge-request + stage: postvalidate + tags: + - ivas-basop-linux + script: + - *get-commits-behind-count + - | + if [ $commits_behind_count -ne 0 ]; then + echo -e "Your branch is $commits_behind_count commits behind the target branch, possibly main changed during your pipeline run, run\n\tgit pull origin $CI_MERGE_REQUEST_TARGET_BRANCH_NAME\nto update." + exit 1 + fi + clang-format-check: extends: - .test-job-linux -- GitLab From 543229ce49a777b1cfab2ac3c0f198f6c745b6a9 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 17 Feb 2025 12:40:07 +0100 Subject: [PATCH 071/113] add up-to-date check to BE test as well --- .gitlab-ci.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 97de3b670..597e15e40 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -441,6 +441,14 @@ stages: HTML_REPORT: "report--$CI_JOB_NAME--sha-$CI_COMMIT_SHORT_SHA.html" script: - set -euxo pipefail + + - *get-commits-behind-count + - | + if [ $commits_behind_count -ne 0 ]; then + echo -e "Your branch is $commits_behind_count commits behind the target branch, possibly main changed during your pipeline run. Checking bitexactness now can result in meaningless results. Run\n\t git pull origin $CI_MERGE_REQUEST_TARGET_BRANCH_NAME\nto update." + exit 1 + fi + - *print-common-info - *update-scripts-repo -- GitLab From 5ab4502a9c76ada0195f5ad59756b0e8cbc5c12b Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 17 Feb 2025 12:42:11 +0100 Subject: [PATCH 072/113] add missing anchor --- .gitlab-ci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 597e15e40..bcfed96df 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -217,6 +217,11 @@ stages: - cd $LTV_DIR - git pull - cd - + +.get-commits-behind-count: &get-commits-behind-count + - echo $CI_COMMIT_SHA + - echo $CI_MERGE_REQUEST_TARGET_BRANCH_NAME + - commits_behind_count=$(git rev-list --count $CI_COMMIT_SHA..origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME) .copy-ltv-files-to-testv-dir: ©-ltv-files-to-testv-dir - cp "$LTV_DIR"/*.wav scripts/testv/ -- GitLab From e28286c8c2df0cb223ce0620b28942626f23ad48 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 17 Feb 2025 12:44:54 +0100 Subject: [PATCH 073/113] fix rule template --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index bcfed96df..b6be74fd5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -236,11 +236,11 @@ stages: - Get-ChildItem -Path "Workspace_msvc" -Filter "*.vcxproj" | ForEach-Object { (Get-Content -Path $_.FullName) -replace 'false', 'true' | Set-Content -Path $_.FullName } .rules-merge-request: - extends: .rules-basis rules: - if: $CI_PIPELINE_SOURCE == 'merge_request_event' - if: $CI_PIPELINE_SOURCE == 'push' when: never + - when: never .rules-pytest-to-ref-short: rules: -- GitLab From 53228a4ae9aa28723f0059092363dd8f5319a738 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 17 Feb 2025 12:51:33 +0100 Subject: [PATCH 074/113] check for up-to-date with main in regression jobs, too also rename anchor as it is only used for the regressions checks now --- .gitlab-ci.yml | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b6be74fd5..0d757075f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -436,6 +436,14 @@ stages: junit: - report-junit.xml +.check-up-to-date-in-comparison-jobs: &check-up-to-date-in-comparison-jobs + - *get-commits-behind-count + - | + if [ $commits_behind_count -ne 0 ]; then + echo -e "Your branch is $commits_behind_count commits behind the target branch, possibly main changed during your pipeline run. Checking bitexactness or testing for regressions now can result in meaningless results. Run\n\t git pull origin $CI_MERGE_REQUEST_TARGET_BRANCH_NAME\nto update." + exit 1 + fi + .check-be-to-target-anchor: &check-be-to-target-anchor stage: check-be needs: ["build-codec-linux-make"] @@ -445,16 +453,11 @@ stages: XML_REPORT: "report--$CI_JOB_NAME--sha-$CI_COMMIT_SHORT_SHA.xml" HTML_REPORT: "report--$CI_JOB_NAME--sha-$CI_COMMIT_SHORT_SHA.html" script: - - set -euxo pipefail + - *check-up-to-date-in-comparison-jobs + - *print-common-info - - *get-commits-behind-count - - | - if [ $commits_behind_count -ne 0 ]; then - echo -e "Your branch is $commits_behind_count commits behind the target branch, possibly main changed during your pipeline run. Checking bitexactness now can result in meaningless results. Run\n\t git pull origin $CI_MERGE_REQUEST_TARGET_BRANCH_NAME\nto update." - exit 1 - fi + - set -euxo pipefail - - *print-common-info - *update-scripts-repo - if [ $USE_LTV -eq 1 ]; then @@ -541,7 +544,7 @@ stages: - unzip $PYTEST_CACHE_ARTIFACT - fi -.ivas-pytest-on-merge-request-anchor: &ivas-pytest-on-merge-request-anchor +.check-regressions-pytest-anchor: &check-regressions-pytest-anchor stage: test timeout: "300 minutes" variables: @@ -554,9 +557,11 @@ stages: IMAGES_ARTIFACT_NAME: "images_$CI_JOB_NAME" SUMMARY_HTML_ARTIFACT_NAME: "summary_$CI_JOB_NAME.html" script: - - set -euxo pipefail + - *check-up-to-date-in-comparison-jobs - *print-common-info + - set -euxo pipefail + - if [ -s $FAILED_TESTCASES_LIST ]; then - *overwrite-pytest-cache-with-artifact - export PYTEST_ADDOPTS=--last-failed @@ -1042,7 +1047,7 @@ check-regressions-short-enc-0db: - TEST_SUITE="$SHORT_TEST_SUITE_ENCODER" - LEVEL_SCALING=1.0 - rm -rf tests/dut tests/ref - <<: *ivas-pytest-on-merge-request-anchor + <<: *check-regressions-pytest-anchor check-regressions-short-enc-+10db: stage: test @@ -1058,7 +1063,7 @@ check-regressions-short-enc-+10db: - TEST_SUITE="$SHORT_TEST_SUITE_ENCODER" - LEVEL_SCALING=3.162 - rm -rf tests/dut tests/ref - <<: *ivas-pytest-on-merge-request-anchor + <<: *check-regressions-pytest-anchor check-regressions-short-enc--10db: stage: test @@ -1074,7 +1079,7 @@ check-regressions-short-enc--10db: - TEST_SUITE="$SHORT_TEST_SUITE_ENCODER" - LEVEL_SCALING=0.3162 - rm -rf tests/dut tests/ref - <<: *ivas-pytest-on-merge-request-anchor + <<: *check-regressions-pytest-anchor check-regressions-short-dec-0db: stage: test @@ -1090,7 +1095,7 @@ check-regressions-short-dec-0db: - TEST_SUITE="$SHORT_TEST_SUITE" - LEVEL_SCALING=1.0 - rm -rf tests/dut tests/ref - <<: *ivas-pytest-on-merge-request-anchor + <<: *check-regressions-pytest-anchor check-regressions-short-dec-+10db: stage: test @@ -1106,7 +1111,7 @@ check-regressions-short-dec-+10db: - TEST_SUITE="$SHORT_TEST_SUITE" - LEVEL_SCALING=3.162 - rm -rf tests/dut tests/ref - <<: *ivas-pytest-on-merge-request-anchor + <<: *check-regressions-pytest-anchor check-regressions-short-dec--10db: stage: test @@ -1122,7 +1127,7 @@ check-regressions-short-dec--10db: - TEST_SUITE="$SHORT_TEST_SUITE" - LEVEL_SCALING=0.3162 - rm -rf tests/dut tests/ref - <<: *ivas-pytest-on-merge-request-anchor + <<: *check-regressions-pytest-anchor # --------------------------------------------------------------- # Short test jobs for running from web interface or schedule -- GitLab From 978268149b7ce3d432ac43b6f34721f6ea731a5c Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 17 Feb 2025 12:53:09 +0100 Subject: [PATCH 075/113] add commit files to regression check artifacts --- .gitlab-ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0d757075f..5bd1627ae 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -665,6 +665,8 @@ stages: - $CSV_MAIN - $SUMMARY_HTML_ARTIFACT_NAME - $IMAGES_ARTIFACT_NAME + - $REF_COMMIT_FILE + - $CUT_COMMIT_FILE - changes_crashes.csv - changes_MLD.csv - changes_MAXIMUM_ABS_DIFF.csv -- GitLab From 752cb148959cac020d7a6bdca4580e54f18f8842 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 17 Feb 2025 12:57:33 +0100 Subject: [PATCH 076/113] remove empty needs in build stage --- .gitlab-ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5bd1627ae..aeb3c601b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -312,13 +312,11 @@ stages: .build-job-linux: stage: build timeout: "2 minutes" - needs: [] tags: - ivas-basop-linux .build-job-windows: stage: build - needs: [] timeout: "4 minutes" tags: - ivas-windows -- GitLab From 61fb4a0eaa696effa2b3cb2ce8b59d4b5c0b9cd8 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 17 Feb 2025 14:06:47 +0100 Subject: [PATCH 077/113] Revert "[revert-me] deactivate more jobs for faster testing" This reverts commit 94fe3242b661346909ff5ebb142191d8a6d4fc41. --- .gitlab-ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index aeb3c601b..6961113f4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -902,7 +902,7 @@ build-codec-linux-make: - make -j # ensure that codec builds on linux with instrumentation active -.build-codec-linux-instrumented-make: +build-codec-linux-instrumented-make: rules: - if: $CI_PIPELINE_SOURCE == 'web' - if: $CI_PIPELINE_SOURCE == 'push' && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH @@ -919,7 +919,7 @@ build-codec-linux-make: - bash scripts/prepare_instrumentation.sh -m MEM_ONLY -p BASOP - make -j -C $INSTR_DIR -.build-codec-linux-debugging-make: +build-codec-linux-debugging-make: rules: - if: $CI_PIPELINE_SOURCE == 'web' - if: $CI_PIPELINE_SOURCE == 'push' && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH @@ -937,7 +937,7 @@ build-codec-linux-make: - *activate-debug-mode-info-if-set - make -j -.build-codec-windows-msbuild: +build-codec-windows-msbuild: rules: - if: $CI_PIPELINE_SOURCE == 'web' - if: $CI_PIPELINE_SOURCE == 'push' && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH @@ -1504,7 +1504,7 @@ coverage-test-on-main-scheduled: # --------------------------------------------------------------- # check bitexactness to EVS -.be-2-evs-26444: +be-2-evs-26444: extends: - .test-job-linux rules: -- GitLab From 09823bfe6741dfcec344878c7120320f4e3c594a Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 17 Feb 2025 14:07:31 +0100 Subject: [PATCH 078/113] Revert "[revert-me] force TCX20 to provoke diff for testing" This reverts commit b79cca58f691da72f9ca7cb32548af5ebbded60c. --- lib_enc/transient_detection_fx.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib_enc/transient_detection_fx.c b/lib_enc/transient_detection_fx.c index b0d131258..d9859a1a1 100644 --- a/lib_enc/transient_detection_fx.c +++ b/lib_enc/transient_detection_fx.c @@ -804,8 +804,6 @@ void SetTCXModeInfo_ivas_fx( hTcxEnc->tcxMode = TCX_20; move16(); } - - hTcxEnc->tcxMode = TCX_20; } ELSE { -- GitLab From 3af8351a7f5d0794817df190871841d59233e272 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 17 Feb 2025 14:12:11 +0100 Subject: [PATCH 079/113] remove pytest filter which was used for testing only --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6961113f4..d0b4e4d6a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -193,7 +193,7 @@ stages: - enc_dmx_arg="--compare_enc_dmx" - fi - - python3 -m pytest -k "stereo and at" $TEST_SUITE -v --update_ref 1 $enc_stats_arg $enc_dmx_arg --create_ref -n auto --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH || exit_code=$? + - python3 -m pytest $TEST_SUITE -v --update_ref 1 $enc_stats_arg $enc_dmx_arg --create_ref -n auto --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH || exit_code=$? .update-scripts-repo: &update-scripts-repo - cd $SCRIPTS_DIR @@ -475,7 +475,7 @@ stages: - exit_code=0 - rm -rf .pytest_cache || true - - python3 -m pytest -k "stereo and at" --tb=no -q $TEST_SUITE -v --keep_files --create_cut --html=$HTML_REPORT --self-contained-html --junit-xml=$XML_REPORT --mld --ssnr --odg --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH -n auto --testcase_timeout $testcase_timeout > pytest_log.txt || exit_code=$? + - python3 -m pytest --tb=no -q $TEST_SUITE -v --keep_files --create_cut --html=$HTML_REPORT --self-contained-html --junit-xml=$XML_REPORT --mld --ssnr --odg --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH -n auto --testcase_timeout $testcase_timeout > pytest_log.txt || exit_code=$? - if [ $exit_code -ne 0 ]; then - exit_code=$EXIT_CODE_NON_BE -- GitLab From 960fffa18703d87baedeb23b2a12f9c21fd04860 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 17 Feb 2025 15:05:12 +0100 Subject: [PATCH 080/113] check for up to date branch after build of reference --- .gitlab-ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d0b4e4d6a..8e1d38a6f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -438,6 +438,7 @@ stages: - *get-commits-behind-count - | if [ $commits_behind_count -ne 0 ]; then + set +x echo -e "Your branch is $commits_behind_count commits behind the target branch, possibly main changed during your pipeline run. Checking bitexactness or testing for regressions now can result in meaningless results. Run\n\t git pull origin $CI_MERGE_REQUEST_TARGET_BRANCH_NAME\nto update." exit 1 fi @@ -451,7 +452,6 @@ stages: XML_REPORT: "report--$CI_JOB_NAME--sha-$CI_COMMIT_SHORT_SHA.xml" HTML_REPORT: "report--$CI_JOB_NAME--sha-$CI_COMMIT_SHORT_SHA.html" script: - - *check-up-to-date-in-comparison-jobs - *print-common-info - set -euxo pipefail @@ -472,6 +472,7 @@ stages: - fi - *build-and-create-reference-outputs + - *check-up-to-date-in-comparison-jobs - exit_code=0 - rm -rf .pytest_cache || true @@ -555,7 +556,6 @@ stages: IMAGES_ARTIFACT_NAME: "images_$CI_JOB_NAME" SUMMARY_HTML_ARTIFACT_NAME: "summary_$CI_JOB_NAME.html" script: - - *check-up-to-date-in-comparison-jobs - *print-common-info - set -euxo pipefail @@ -592,6 +592,7 @@ stages: ### run branch first # this per default builds the branch and the reference and creates the reference outputs - *build-and-create-reference-outputs + - *check-up-to-date-in-comparison-jobs # need to restore cache again - *overwrite-pytest-cache-with-artifact - python3 -m pytest --tb=no -q $TEST_SUITE -v --keep_files --create_cut --html=$HTML_REPORT_BRANCH --self-contained-html --junit-xml=$XML_REPORT_BRANCH --mld --ssnr --odg --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH -n auto --testcase_timeout $testcase_timeout || true -- GitLab From 2de341b9b6f0b35595bcfe85b8746366f7202e6e Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 17 Feb 2025 15:12:35 +0100 Subject: [PATCH 081/113] add --show_improvements arg to basop_check_for_changes.py --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8e1d38a6f..f0dfa5668 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -619,7 +619,7 @@ stages: ### compare the two csv files for regressions - regressions_found=0 - - python3 scripts/basop_check_for_changes_in_testcases.py --xml_report $XML_REPORT_BRANCH $CSV_MAIN $CSV_BRANCH > regression_log.txt || regressions_found=$? + - python3 scripts/basop_check_for_changes_in_testcases.py --show_improvements --xml_report $XML_REPORT_BRANCH $CSV_MAIN $CSV_BRANCH > regression_log.txt || regressions_found=$? - exit_code=0 - *print-results-banner -- GitLab From 38678a41ba18f765d3c49e114772ee16609621ad Mon Sep 17 00:00:00 2001 From: Anjaneyulu Sana Date: Mon, 17 Feb 2025 22:34:25 +0530 Subject: [PATCH 082/113] Fix for 3GPP issue 1262: Saturated signal in discrete multichannel output with fx encoder in v2 release --- lib_enc/ivas_mct_enc.c | 2 ++ lib_enc/ivas_mdct_core_enc.c | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/lib_enc/ivas_mct_enc.c b/lib_enc/ivas_mct_enc.c index 8c194bed1..5510f1eb1 100644 --- a/lib_enc/ivas_mct_enc.c +++ b/lib_enc/ivas_mct_enc.c @@ -401,6 +401,8 @@ ivas_error ivas_mct_enc_fx( move16(); st_ivas->hCPE[cpe_id]->hCoreCoder[ch]->hTcxEnc->spectrum_e[1] = sub( 31, q_spec ); move16(); + st_ivas->hCPE[cpe_id]->hCoreCoder[ch]->hTcxEnc->spectrum_long_e = sub( 31, q_spec ); + move16(); IF( st_ivas->hCPE[cpe_id]->hCoreCoder[ch]->last_core == ACELP_CORE ) { diff --git a/lib_enc/ivas_mdct_core_enc.c b/lib_enc/ivas_mdct_core_enc.c index 18bee6777..4997a6715 100644 --- a/lib_enc/ivas_mdct_core_enc.c +++ b/lib_enc/ivas_mdct_core_enc.c @@ -2672,6 +2672,11 @@ void ivas_mdct_quant_coder_fx( st->hTcxEnc->spectrum_e[n] = min_shift; move16(); } + if ( GT_16( nSubframes, 1 ) ) + { + st->hTcxEnc->spectrum_long_e = min_shift; + move16(); + } } EstimateStereoTCXNoiseLevel_fx( sts, quantized_spectrum_fx, gain_tcx_fx, gain_tcx_e, L_frame, noiseFillingBorder, hm_active, ignore_chan, fac_ns_fx, param_core, MCT_flag ); -- GitLab From 74f66bf8e65f7b3e63d8df19e27d02b07af0feeb Mon Sep 17 00:00:00 2001 From: ber Date: Tue, 18 Feb 2025 09:47:30 +0100 Subject: [PATCH 083/113] further cleanup --- lib_com/options.h | 1 - lib_rend/ivas_dirac_output_synthesis_dec.c | 13 ------------- 2 files changed, 14 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 92144ade1..2747226b4 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -157,4 +157,3 @@ #define FIX_1072_SPEEDUP_gainpanning /* FhG: WMOPS tuning, in development*/ #define FIX_1072_SPEEDUP_COMPUTEDIFUSENESSB /* "-" */ -//#define FIX_1072_SPEEDUP_output_synthesis_procSlot /* "-" */ \ No newline at end of file diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index 404f98b1b..6a7a73c18 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -942,18 +942,6 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( b = BASOP_Util_Divide3232_Scale( reference_power[k + num_freq_bands], reference_power[k + ( ch_idx + 1 ) * num_freq_bands], &b_exp ); /*q(15-b_exp)*/ } } -#ifdef FIX_1072_SPEEDUP_output_synthesis_procSlot - q_diff_aab = add( h_dirac_output_synthesis_state->direct_responses_q + sub( sub( 15, b_exp ), 15 ), add( sub( h_dirac_output_synthesis_state->direct_responses_q, 31 ), sub( q_diffuseness, 31 ) ) ); - q_diff_c = sub( q_diffuseness, 4 ); - - mpy_a_a_b = Mpy_32_32( a, Mpy_32_16_1( a, b ) ); // Q = (h_dirac_output_synthesis_state->q_direct_responses + (15 - b_exp) - 15) + (h_dirac_output_synthesis_state->q_direct_responses) - 31 - mpy_diff_aab = Mpy_32_32( L_sub( L_shl( 1, q_diffuseness ), diffuseness[k] ), mpy_a_a_b ); // Q = 2*(h_dirac_output_synthesis_state->q_direct_responses) - b_exp - 31 + q_diffuseness -31 - mpy_diff_c = Mpy_32_32( diffuseness[k], c ); // Q = q_diffuseness - 4 - - /*Todo: simplify so that mpy+add can be merged to madd*/ - sqr_inp = BASOP_Util_Add_Mant32Exp( mpy_diff_c, sub( 31, q_diff_c ), mpy_diff_aab, sub( 31, q_diff_aab ), &sqr_exp ); /*q(31-sqr_exp)*/ - -#else mpy_a_a_b = Mpy_32_32( a, Mpy_32_16_1( a, b ) ); // Q = (h_dirac_output_synthesis_state->q_direct_responses + (15 - b_exp) - 15) + (h_dirac_output_synthesis_state->q_direct_responses) - 31 mpy_diff_aab = Mpy_32_32( L_sub( L_shl( 1, q_diffuseness ), diffuseness[k] ), mpy_a_a_b ); // Q = 2*(h_dirac_output_synthesis_state->q_direct_responses) - b_exp - 31 + q_diffuseness -31 mpy_diff_c = Mpy_32_32( diffuseness[k], c ); // Q = q_diffuseness - 4 @@ -981,7 +969,6 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( sqr_exp = sub( 31, q_diff_c ); /*q_diff_c*/ } } -#endif sqr = Sqrt32( sqr_inp, &sqr_exp ); /*Q(31-sqr_exp)*/ sqr = L_shr( sqr, 2 ); /*Q(31-sqr_exp)*/ -- GitLab From fc11d020838a7da70152594f05efce479afaddcb Mon Sep 17 00:00:00 2001 From: ber Date: Tue, 18 Feb 2025 11:34:22 +0100 Subject: [PATCH 084/113] tiny fix --- lib_com/ivas_dirac_com.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/ivas_dirac_com.c b/lib_com/ivas_dirac_com.c index 9fe68f250..38abc76f3 100644 --- a/lib_com/ivas_dirac_com.c +++ b/lib_com/ivas_dirac_com.c @@ -968,7 +968,7 @@ void computeDiffuseness_fixed( q_tmp = add( q_factor_energy[i], min_q_shift1 ); -#ifdef FIX_1072_SPEEDUP_COMPUTEDIFUSENESSB +#ifdef FIX_1072_SPEEDUP_COMPUTEDIFUSENESS Word16 shift_q = sub( q_tmp, q_ene ); Word32 shiftEquiv; Word16 shift_qtotal; -- GitLab From 74d1e1951db936a260f30cd2fefe11c1a41e9cf9 Mon Sep 17 00:00:00 2001 From: ber Date: Tue, 18 Feb 2025 11:39:19 +0100 Subject: [PATCH 085/113] apply clang format patch --- lib_com/ivas_dirac_com.c | 5 ++--- lib_dec/ivas_dirac_dec.c | 2 +- lib_rend/ivas_dirac_output_synthesis_dec.c | 8 ++------ 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/lib_com/ivas_dirac_com.c b/lib_com/ivas_dirac_com.c index 38abc76f3..2704c1f08 100644 --- a/lib_com/ivas_dirac_com.c +++ b/lib_com/ivas_dirac_com.c @@ -972,11 +972,11 @@ void computeDiffuseness_fixed( Word16 shift_q = sub( q_tmp, q_ene ); Word32 shiftEquiv; Word16 shift_qtotal; - if( shift_q < 0 ) + if ( shift_q < 0 ) { shiftEquiv = L_lshl( 0x80000000, shift_q ); } - if( shift_q >= 0 ) + if ( shift_q >= 0 ) { shiftEquiv = L_add( 0x7FFFFFFF, 0 ); } @@ -1011,7 +1011,6 @@ void computeDiffuseness_fixed( #endif - q_ene = s_min( q_ene, q_tmp ); /* Intensity slow */ diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index ed1f292b2..95cca12a0 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -2555,7 +2555,7 @@ void ivas_dirac_dec_render_sf_fx( p_Rmat_fx = 0; move32(); } - + IF( ( hDirAC->hConfig->dec_param_estim == FALSE ) ) { Word16 *masa_band_mapping; diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index ba8048267..866badda0 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -1099,7 +1099,6 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( h_dirac_output_synthesis_state->q_cy_cross_dir_smooth = temp_q; move16(); #endif - } #ifdef FIX_1072_SPEEDUP_gainpanning Word16 temp_q1 = sub( h_dirac_output_synthesis_state->q_cy_cross_dir_smooth, temp_q ); @@ -1109,13 +1108,13 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( { Word16 i; Word32 aux; - IF(temp_q1 < 0) + IF( temp_q1 < 0 ) { Word32 temp_q1_equiv = L_lshl( 0x80000000, temp_q1 ); FOR( i = 0; i < num_freq_bands; i++ ) { aux = Mpy_32_32( h_dirac_output_synthesis_state->direct_power_factor_fx[i], h_dirac_output_synthesis_state->direct_responses_fx[ch_idx * num_freq_bands + i] ); - h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + i] = Madd_32_32( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + i] , aux, temp_q1_equiv ); + h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + i] = Madd_32_32( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx[ch_idx * num_freq_bands + i], aux, temp_q1_equiv ); move32(); } } @@ -1129,7 +1128,6 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( move32(); } } - } ELSE { @@ -1140,8 +1138,6 @@ void ivas_dirac_dec_output_synthesis_process_slot_fx( move32(); } } - - } #else -- GitLab From 48ece3d0c459c1563c8f25f674d063c7b6a86a2d Mon Sep 17 00:00:00 2001 From: Anjaneyulu Sana Date: Wed, 19 Feb 2025 14:00:48 +0530 Subject: [PATCH 086/113] Fix for 3GPP issue 1258: Decoder: Click artifact for Stereo to Mono Decoding --- lib_dec/ivas_core_dec.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c index 8d88074a8..9aaddb2fb 100644 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -782,6 +782,7 @@ ivas_error ivas_core_dec_fx( /* for inactive frames with mono output, copy and (if necessary) downmix buffers */ ELSE IF( EQ_16( hCPE->nchan_out, 1 ) ) { + Word16 shift1, shift2; sts[0] = hCPE->hCoreCoder[0]; sts[1] = hCPE->hCoreCoder[1]; @@ -800,6 +801,15 @@ ivas_error ivas_core_dec_fx( move16(); sts[1]->hHQ_core->Q_old_wtda = sub( 15, sts[1]->hHQ_core->exp_old_out ); move16(); + + shift1 = norm_arr( sts[0]->hHQ_core->old_out_fx, L_FRAME48k ); + shift2 = norm_arr( sts[1]->hHQ_core->old_out_fx, L_FRAME48k ); + scale_sig( sts[0]->hHQ_core->old_out_fx, L_FRAME48k, shift1 ); + scale_sig( sts[1]->hHQ_core->old_out_fx, L_FRAME48k, shift2 ); + sts[0]->hHQ_core->Q_old_wtda = add( sts[0]->hHQ_core->Q_old_wtda, shift1 ); + sts[1]->hHQ_core->Q_old_wtda = add( sts[1]->hHQ_core->Q_old_wtda, shift2 ); + move16(); + move16(); } } -- GitLab From 3adbd6fbee1af752c0dae017f684a30aef7f2029 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Thu, 20 Feb 2025 11:01:39 +0100 Subject: [PATCH 087/113] use ignorelist in USAN job --- .gitlab-ci.yml | 10 ++++++++-- Makefile | 6 +++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1bc5a6f07..855f5d571 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -553,9 +553,15 @@ stages: - *copy-ltv-files-to-testv-dir - python3 ci/remove_unsupported_testcases.py $PRM_FILES - *build-reference-and-dut-binaries + + - make_args="CLANG=$CLANG_NUM" + - if [[ $CLANG_NUM == 3 ]]; then + - export UBSAN_OPTIONS="suppressions=scripts/ubsan_basop.supp,report_error_type=1" + - python3 scripts/basop_create_ignorelist_for_ubsan.py + - make_args="$make_args IGNORELIST=1" + - fi - make clean - - make -j CLANG=$CLANG_NUM - - if [[ $CLANG_NUM == 3 ]]; then export UBSAN_OPTIONS="suppressions=scripts/ubsan_basop.supp,report_error_type=1"; fi + - make -j $make_args - testcase_timeout=$TESTCASE_TIMEOUT_LTV_SANITIZERS - python3 -m pytest $TEST_SUITE -v --tb=no --update_ref 1 --html=report.html --self-contained-html --junit-xml=report-junit.xml --testcase_timeout $testcase_timeout --ref_encoder_path $DUT_ENCODER_PATH --ref_decoder_path $DUT_DECODER_PATH artifacts: diff --git a/Makefile b/Makefile index 4e92bc951..e444cc54b 100644 --- a/Makefile +++ b/Makefile @@ -82,10 +82,14 @@ ifeq "$(CLANG)" "3" CC = $(CCCLANG) # NOTE: keep in sync with list in CMakeLists.txt usan_checks = undefined,float-divide-by-zero,implicit-conversion,local-bounds -CFLAGS += -fsanitize=$(usan_checks) +CFLAGS += -fsanitize=$(usan_checks) CFLAGS += -fsanitize-recover=$(usan_checks) LDFLAGS += -fsanitize=$(usan_checks) LDFLAGS += -fsanitize-recover=$(usan_checks) + +ifeq "$(IGNORELIST)" "1" +CFLAGS += -fsanitize-ignorelist=ubsan_ignorelist.txt +LDFLAGS += -fsanitize-ignorelist=ubsan_ignorelist.txt endif ifeq "$(RELEASE)" "1" -- GitLab From fc5fb077d82513ee77924703f210e305063a3052 Mon Sep 17 00:00:00 2001 From: Anjaneyulu Sana Date: Wed, 19 Feb 2025 14:37:14 +0530 Subject: [PATCH 088/113] Updates in MCT core encoder path for precision improvement --- lib_com/ivas_prot_fx.h | 19 ++++++++++--------- lib_enc/igf_enc.c | 4 ++-- lib_enc/ivas_lfe_enc.c | 7 ++++--- lib_enc/ivas_mct_core_enc.c | 38 ++++++++++++++++++------------------- lib_enc/ivas_mct_enc_mct.c | 25 ++++++++++++++---------- lib_enc/tcx_utils_enc_fx.c | 4 ++-- 6 files changed, 52 insertions(+), 45 deletions(-) diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index 5ce037b9a..1682c255b 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -3341,15 +3341,16 @@ void ivas_omasa_enc_fx( ); void mctStereoIGF_enc_fx( - MCT_ENC_HANDLE hMCT, /* i/o: MCT encoder structure */ - Encoder_State **sts, /* i/o: encoder state structure */ - Word32 *orig_spectrum_fx[MCT_MAX_CHANNELS][2], /* i : MDCT spectrum for ITF */ - Word16 q_origSpec, /* i : Q for MDCT spectrum */ - Word32 powerSpec_fx[MCT_MAX_CHANNELS][L_FRAME48k], /* i/o: MDCT^2 + MDST^2 spectrum,or estimate*/ - Word32 *powerSpecMsInv_fx[MCT_MAX_CHANNELS][NB_DIV], /* i : same as above but for inverse spect.*/ - Word16 q_powerSpec[MCT_MAX_CHANNELS], /* i : Q for powSpec_fx and powSpecMsInv_fx*/ - Word32 *inv_spectrum_fx[MCT_MAX_CHANNELS][NB_DIV], /* i : inverse spectrum */ - const Word16 sp_aud_decision0[MCT_MAX_CHANNELS] /* i : speech audio decision */ + MCT_ENC_HANDLE hMCT, /* i/o: MCT encoder structure */ + Encoder_State **sts, /* i/o: encoder state structure */ + Word32 *orig_spectrum_fx[MCT_MAX_CHANNELS][2], /* i : MDCT spectrum for ITF */ + Word16 q_origSpec, /* i : Q for MDCT spectrum */ + Word32 powerSpec_fx[MCT_MAX_CHANNELS][L_FRAME48k], /* i/o: MDCT^2 + MDST^2 spectrum,or estimate */ + Word16 q_powerSpec[MCT_MAX_CHANNELS], /* i : Q for powSpec_fx */ + Word32 *powerSpecMsInv_fx[MCT_MAX_CHANNELS][NB_DIV], /* i : same as powerSpec_fx but for inverse spect.*/ + Word16 q_powerSpecMsInv[MCT_MAX_CHANNELS], /* i : Q for powSpecMsInv_fx */ + Word32 *inv_spectrum_fx[MCT_MAX_CHANNELS][NB_DIV], /* i : inverse spectrum */ + const Word16 sp_aud_decision0[MCT_MAX_CHANNELS] /* i : speech audio decision */ ); void ivas_mct_core_enc_fx( diff --git a/lib_enc/igf_enc.c b/lib_enc/igf_enc.c index d20169e73..0ce087508 100644 --- a/lib_enc/igf_enc.c +++ b/lib_enc/igf_enc.c @@ -943,9 +943,9 @@ static void IGF_CalculateEnvelope_ivas_fx( move16(); sfbEnergyR = add_sat( EPSILON_FX, BASOP_Util_Divide3216_Scale( sum2_32_fx( pMDCTSpectrum_fx + swb_offset[sfb], width, &tmp_e ) /*exp: tmp_e*/, width, &sfbEnergyR_e ) ); // sfbEnergyR_e sfbEnergyR_e = add( sfbEnergyR_e, add( tmp_e, -15 ) ); - gain = sfbEnergyR; // gain_e + gain = L_shl( sfbEnergyR, 16 ); // gain_e move32(); - gain_e = add( sfbEnergyR_e, 16 ); + gain_e = sfbEnergyR_e; IF( element_mode > EVS_MONO ) { diff --git a/lib_enc/ivas_lfe_enc.c b/lib_enc/ivas_lfe_enc.c index e72270e6c..e219e8b37 100644 --- a/lib_enc/ivas_lfe_enc.c +++ b/lib_enc/ivas_lfe_enc.c @@ -199,12 +199,13 @@ static void ivas_lfe_enc_quant_fx( q_lfe_abs_sum = sub( q_lfe_abs_sum, q_tmp ); } - tmp = BASOP_Util_Divide3232_Scale( max_value, W_extract_l( lfe_abs_sum ), &q_tmp ); - tmp = L_shl( tmp, sub( q_lfe_abs_sum, sub( 15, q_tmp ) ) ); /* Q0 (max_value / lfe_abs_sum) */ + tmp = L_deposit_h( BASOP_Util_Divide3232_Scale( max_value, W_extract_l( lfe_abs_sum ), &q_tmp ) ); + // tmp = L_shl( tmp, sub( q_lfe_abs_sum, sub( 15, q_tmp ) ) ); /* Q0 (max_value / lfe_abs_sum) */ + q_tmp = sub( Q16, sub( q_lfe_abs_sum, sub( 15, q_tmp ) ) ); /* log2_f(max_value / lfe_abs_sum) -> Q25 */ tmp = BASOP_Util_Log2( tmp ); - tmp = L_add( tmp, 1040187392 ) /* (31<<25) -> 1040187392 */; /* Q25 */ + tmp = L_add( tmp, L_shl( sub( Q31, q_tmp ), Q25 ) ) /* (31<<25) -> 1040187392 */; /* Q25 */ /* IVAS_LFE_SHIFTS_PER_DOUBLE * log2_f(max_value / lfe_abs_sum) */ tmp = Mpy_32_16_1( tmp, IVAS_LFE_SHIFTS_PER_DOUBLE ); /* 25-15 -> Q10 */ diff --git a/lib_enc/ivas_mct_core_enc.c b/lib_enc/ivas_mct_core_enc.c index f5f179778..52fd554d8 100644 --- a/lib_enc/ivas_mct_core_enc.c +++ b/lib_enc/ivas_mct_core_enc.c @@ -247,7 +247,7 @@ void ivas_mct_core_enc_fx( Word32 inv_spectrum_long_fx[MCT_MAX_CHANNELS][L_FRAME48k]; /* quantized MDCT spectrum, inv ms mask mdst spectrum, scratch for MS spectra in the MS decision */ Word16 total_side_bits; Word16 chBitRatios[MCT_MAX_CHANNELS]; - Word16 q_powSpec[MCT_MAX_CHANNELS], q_spec, q_origSpec, tmp_s; + Word16 q_powSpec[MCT_MAX_CHANNELS], q_powerSpecMsInv[MCT_MAX_CHANNELS], q_spec, q_origSpec, tmp_s; Word16 tmp_q_powSpec[L_FRAME48k], tmp_q_powSpecInv[L_FRAME48k], *tmp_q_psi[2]; Word64 W_tmp; Encoder_State *sts[MCT_MAX_CHANNELS]; @@ -437,7 +437,7 @@ void ivas_mct_core_enc_fx( FOR( i = 0; i < L_subframeTCX; i++ ) { W_tmp = W_mac_32_32( W_mult_32_32( mdst_spectrum_fx[ch][n][i], mdst_spectrum_fx[ch][n][i] ), sts[ch]->hTcxEnc->spectrum_fx[n][i], sts[ch]->hTcxEnc->spectrum_fx[n][i] ); - tmp_s = sub( W_norm( W_tmp ), 1 ); + tmp_s = W_norm( W_tmp ); W_tmp = W_shl( W_tmp, tmp_s ); powerSpec_fx[ch][( i + ( n * L_subframeTCX ) )] = W_extract_h( W_tmp ); tmp_q_powSpec[( i + ( n * L_subframeTCX ) )] = sub( add( imult1616( q_spec, 2 ), tmp_s ), 31 ); // Q = 2 * q_spec + 1 + tmp_s - 32 @@ -445,7 +445,7 @@ void ivas_mct_core_enc_fx( move16(); W_tmp = W_mac_32_32( W_mult_32_32( inv_mdst_spectrum_fx[ch][n][i], inv_mdst_spectrum_fx[ch][n][i] ), inv_spectrum_fx[ch][n][i], inv_spectrum_fx[ch][n][i] ); - tmp_s = sub( W_norm( W_tmp ), 1 ); + tmp_s = W_norm( W_tmp ); W_tmp = W_shl( W_tmp, tmp_s ); powerSpecMsInv_fx[ch][n][i] = W_extract_h( W_tmp ); tmp_q_psi[n][i] = sub( add( imult1616( q_spec, 2 ), tmp_s ), 31 ); // Q = 2 * q_spec + 1 + tmp_s - 32 @@ -459,7 +459,7 @@ void ivas_mct_core_enc_fx( { /* power spectrum: MDCT^2 + MDST^2 */ W_tmp = W_mult_32_32( inv_spectrum_fx[ch][n][0], inv_spectrum_fx[ch][n][0] ); - tmp_s = sub( W_norm( W_tmp ), 1 ); + tmp_s = W_norm( W_tmp ); W_tmp = W_shl( W_tmp, tmp_s ); powerSpecMsInv_fx[ch][n][0] = W_extract_h( W_tmp ); tmp_q_psi[n][0] = sub( add( imult1616( q_spec, 2 ), tmp_s ), 31 ); // Q = 2 * q_spec + 1 + tmp_s - 32 @@ -471,7 +471,7 @@ void ivas_mct_core_enc_fx( mdst_fx = L_sub( inv_spectrum_fx[ch][n][i + 1], inv_spectrum_fx[ch][n][i - 1] ); /* An MDST estimate */ W_tmp = W_mac_32_32( W_mult_32_32( mdst_fx, mdst_fx ), inv_spectrum_fx[ch][n][i], inv_spectrum_fx[ch][n][i] ); - tmp_s = sub( W_norm( W_tmp ), 1 ); + tmp_s = W_norm( W_tmp ); W_tmp = W_shl( W_tmp, tmp_s ); powerSpecMsInv_fx[ch][n][i] = W_extract_h( W_tmp ); tmp_q_psi[n][i] = sub( add( imult1616( q_spec, 2 ), tmp_s ), 31 ); // Q = 2 * q_spec + 1 + tmp_s - 32 @@ -480,7 +480,7 @@ void ivas_mct_core_enc_fx( } W_tmp = W_mult_32_32( inv_spectrum_fx[ch][n][L_subframeTCX - 1], inv_spectrum_fx[ch][n][L_subframeTCX - 1] ); - tmp_s = sub( W_norm( W_tmp ), 1 ); + tmp_s = W_norm( W_tmp ); W_tmp = W_shl( W_tmp, tmp_s ); powerSpecMsInv_fx[ch][n][L_subframeTCX - 1] = W_extract_h( W_tmp ); tmp_q_psi[n][L_subframeTCX - 1] = sub( add( imult1616( q_spec, 2 ), tmp_s ), 31 ); // Q = 2 * q_spec + 1 + tmp_s - 32 @@ -490,7 +490,7 @@ void ivas_mct_core_enc_fx( /* power spectrum: MDCT^2 + MDST^2 */ W_tmp = W_mult_32_32( sts[ch]->hTcxEnc->spectrum_fx[n][0], sts[ch]->hTcxEnc->spectrum_fx[n][0] ); - tmp_s = sub( W_norm( W_tmp ), 1 ); + tmp_s = W_norm( W_tmp ); W_tmp = W_shl( W_tmp, tmp_s ); powerSpec_fx[ch][n * L_subframeTCX] = W_extract_h( W_tmp ); tmp_q_powSpec[n * L_subframeTCX] = sub( add( imult1616( q_spec, 2 ), tmp_s ), 31 ); // Q = 2 * q_spec + 1 + tmp_s - 32 @@ -513,7 +513,7 @@ void ivas_mct_core_enc_fx( } W_tmp = W_mult_32_32( sts[ch]->hTcxEnc->spectrum_fx[n][L_subframeTCX - 1], sts[ch]->hTcxEnc->spectrum_fx[n][L_subframeTCX - 1] ); - tmp_s = sub( W_norm( W_tmp ), 1 ); + tmp_s = W_norm( W_tmp ); W_tmp = W_shl( W_tmp, tmp_s ); powerSpec_fx[ch][( ( L_subframeTCX - 1 ) + ( n * L_subframeTCX ) )] = W_extract_h( W_tmp ); tmp_q_powSpec[( ( L_subframeTCX - 1 ) + ( n * L_subframeTCX ) )] = sub( add( imult1616( q_spec, 2 ), tmp_s ), 31 ); // Q = 2 * q_spec + 1 + tmp_s - 32 @@ -524,31 +524,31 @@ void ivas_mct_core_enc_fx( /* Aligning the Q-factors */ { + q_powSpec[ch] = Q31; + move16(); + q_powerSpecMsInv[ch] = Q31; + move16(); /* NOTE: This logic has been added because using a constant headroom while computing `powSpec` and `powSpecMsInv` leads to significant precision loss, which results in poor quality. */ FOR( i = 0; i < L_FRAME48k; i++ ) { - if ( powerSpec_fx[ch][i] == 0 ) + IF( powerSpec_fx[ch][i] != 0 ) { - tmp_q_powSpec[i] = 63; + q_powSpec[ch] = s_min( q_powSpec[ch], add( tmp_q_powSpec[i], norm_l( powerSpec_fx[ch][i] ) ) ); move16(); } - if ( powerSpecMsInv_fx[ch][0][i] == 0 ) + IF( powerSpecMsInv_fx[ch][0][i] != 0 ) { - tmp_q_powSpecInv[i] = 63; + q_powerSpecMsInv[ch] = s_min( q_powerSpecMsInv[ch], add( tmp_q_powSpecInv[i], norm_l( powerSpecMsInv_fx[ch][0][i] ) ) ); move16(); } } - minimum_s( tmp_q_powSpec, L_FRAME48k, &q_powSpec[ch] ); - minimum_s( tmp_q_powSpecInv, L_FRAME48k, &tmp_s ); - q_powSpec[ch] = s_min( q_powSpec[ch], tmp_s ); - move16(); FOR( n = 0; n < nSubframes; n++ ) { FOR( i = 0; i < L_subframeTCX; i++ ) { - powerSpecMsInv_fx[ch][n][i] = L_shr( powerSpecMsInv_fx[ch][n][i], sub( tmp_q_psi[n][i], q_powSpec[ch] ) ); - powerSpec_fx[ch][( i + ( n * L_subframeTCX ) )] = L_shr( powerSpec_fx[ch][( i + ( n * L_subframeTCX ) )], sub( tmp_q_powSpec[i], q_powSpec[ch] ) ); + powerSpecMsInv_fx[ch][n][i] = L_shr( powerSpecMsInv_fx[ch][n][i], sub( tmp_q_psi[n][i], q_powerSpecMsInv[ch] ) ); + powerSpec_fx[ch][( i + ( n * L_subframeTCX ) )] = L_shr( powerSpec_fx[ch][( i + ( n * L_subframeTCX ) )], sub( tmp_q_powSpec[i + ( n * L_subframeTCX )], q_powSpec[ch] ) ); move32(); move32(); } @@ -606,7 +606,7 @@ void ivas_mct_core_enc_fx( { IF( hMCT->currBlockDataCnt > 0 ) { - mctStereoIGF_enc_fx( hMCT, sts, orig_spectrum_fx, q_origSpec, powerSpec_fx, powerSpecMsInv_fx, q_powSpec, inv_spectrum_fx, sp_aud_decision0 ); + mctStereoIGF_enc_fx( hMCT, sts, orig_spectrum_fx, q_origSpec, powerSpec_fx, q_powSpec, powerSpecMsInv_fx, q_powerSpecMsInv, inv_spectrum_fx, sp_aud_decision0 ); } ELSE { diff --git a/lib_enc/ivas_mct_enc_mct.c b/lib_enc/ivas_mct_enc_mct.c index 4b84ea9cb..654c00db4 100644 --- a/lib_enc/ivas_mct_enc_mct.c +++ b/lib_enc/ivas_mct_enc_mct.c @@ -981,15 +981,16 @@ void write_mct_bitstream_fx( * IGF analysis of channels after MCT processing *--------------------------------------------------------------------*/ void mctStereoIGF_enc_fx( - MCT_ENC_HANDLE hMCT, /* i/o: MCT encoder structure */ - Encoder_State **sts, /* i/o: encoder state structure */ - Word32 *orig_spectrum_fx[MCT_MAX_CHANNELS][2], /* i : MDCT spectrum for ITF */ - Word16 q_origSpec, /* i : Q for MDCT spectrum */ - Word32 powerSpec_fx[MCT_MAX_CHANNELS][L_FRAME48k], /* i/o: MDCT^2 + MDST^2 spectrum,or estimate*/ - Word32 *powerSpecMsInv_fx[MCT_MAX_CHANNELS][NB_DIV], /* i : same as above but for inverse spect.*/ - Word16 q_powerSpec[MCT_MAX_CHANNELS], /* i : Q for powSpec_fx and powSpecMsInv_fx*/ - Word32 *inv_spectrum_fx[MCT_MAX_CHANNELS][NB_DIV], /* i : inverse spectrum */ - const Word16 sp_aud_decision0[MCT_MAX_CHANNELS] /* i : speech audio decision */ + MCT_ENC_HANDLE hMCT, /* i/o: MCT encoder structure */ + Encoder_State **sts, /* i/o: encoder state structure */ + Word32 *orig_spectrum_fx[MCT_MAX_CHANNELS][2], /* i : MDCT spectrum for ITF */ + Word16 q_origSpec, /* i : Q for MDCT spectrum */ + Word32 powerSpec_fx[MCT_MAX_CHANNELS][L_FRAME48k], /* i/o: MDCT^2 + MDST^2 spectrum,or estimate */ + Word16 q_powerSpec[MCT_MAX_CHANNELS], /* i : Q for powSpec_fx */ + Word32 *powerSpecMsInv_fx[MCT_MAX_CHANNELS][NB_DIV], /* i : same as powerSpec_fx but for inverse spect.*/ + Word16 q_powerSpecMsInv[MCT_MAX_CHANNELS], /* i : Q for powSpecMsInv_fx */ + Word32 *inv_spectrum_fx[MCT_MAX_CHANNELS][NB_DIV], /* i : inverse spectrum */ + const Word16 sp_aud_decision0[MCT_MAX_CHANNELS] /* i : speech audio decision */ ) { Word32 *p_powerSpecMsInv_fx[CPE_CHANNELS][NB_DIV]; @@ -999,6 +1000,7 @@ void mctStereoIGF_enc_fx( Word16 b, nSubframes, L_subframeTCX; Word16 p_ch[2], n, ch, ch1, ch2, s = 31; + Word16 q_pSI_ch[2]; Word16 q_pS_ch[2]; Encoder_State *p_st[NB_DIV]; Encoder_State *st; @@ -1062,7 +1064,9 @@ void mctStereoIGF_enc_fx( p_inv_spectrum_fx[0][n] = inv_spectrum_fx[ch1][n]; p_inv_spectrum_fx[1][n] = inv_spectrum_fx[ch2][n]; q_pS_ch[0] = q_powerSpec[ch1]; + q_pSI_ch[0] = q_powerSpecMsInv[ch1]; q_pS_ch[1] = q_powerSpec[ch2]; + q_pSI_ch[1] = q_powerSpecMsInv[ch2]; move16(); move16(); @@ -1075,6 +1079,7 @@ void mctStereoIGF_enc_fx( { s = s_min( s, sub( 31, p_st[ch]->hTcxEnc->spectrum_e[n] ) ); s = s_min( s, q_pS_ch[ch] ); + s = s_min( s, q_pSI_ch[ch] ); } FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) { @@ -1085,7 +1090,7 @@ void mctStereoIGF_enc_fx( move16(); move16(); - scale_sig32( p_powerSpecMsInv_fx[ch][0], L_FRAME48k, sub( s, q_pS_ch[ch] ) ); + scale_sig32( p_powerSpecMsInv_fx[ch][0], L_FRAME48k, sub( s, q_pSI_ch[ch] ) ); scale_sig32( &p_powerSpec_fx[ch][0], sts[ch]->hTcxEnc->L_frameTCX, sub( s, q_pS_ch[ch] ) ); q_powerSpec[ch1] = s; q_powerSpec[ch2] = s; diff --git a/lib_enc/tcx_utils_enc_fx.c b/lib_enc/tcx_utils_enc_fx.c index 1e35c78c4..27c8e6f5f 100644 --- a/lib_enc/tcx_utils_enc_fx.c +++ b/lib_enc/tcx_utils_enc_fx.c @@ -3842,7 +3842,7 @@ void ProcessIGF_ivas_fx( ITF_Detect_ivas_fx( hIGFEnc->spec_be_igf, hIGFEnc->infoStartLine, hIGFEnc->infoStopLine, 8 /*maxOrder*/, A, &q_A, &predictionGain, &curr_order, sub( 31, hIGFEnc->spec_be_igf_e ) ); test(); - IF( LT_32( L_deposit_l( hIGFEnc->tns_predictionGain ), 9646899 /* 1.15 in Q23 */ ) && LT_32( L_deposit_l( predictionGain ), 9646899 /* 1.15 in Q23 */ ) ) + IF( LT_16( hIGFEnc->tns_predictionGain, ONE_POINT_ONE_FIVE_Q7 ) && LT_16( predictionGain, ONE_POINT_ONE_FIVE_Q7 ) ) { hIGFEnc->flatteningTrigger = 1; move16(); @@ -3949,7 +3949,7 @@ void ProcessStereoIGF_fx( ITF_Detect_ivas_fx( hIGFEnc[ch]->spec_be_igf, hIGFEnc[ch]->infoStartLine, hIGFEnc[ch]->infoStopLine, 8 /*maxOrder*/, A, &Q_A, &predictionGain, &curr_order, sub( 31, hIGFEnc[ch]->spec_be_igf_e ) ); test(); - hIGFEnc[ch]->flatteningTrigger = LT_32( hIGFEnc[ch]->tns_predictionGain, ONE_POINT_ONE_FIVE_Q23 ) && LT_32( predictionGain, ONE_POINT_ONE_FIVE_Q7 ); + hIGFEnc[ch]->flatteningTrigger = LT_16( hIGFEnc[ch]->tns_predictionGain, ONE_POINT_ONE_FIVE_Q7 ) && LT_16( predictionGain, ONE_POINT_ONE_FIVE_Q7 ); move16(); hIGFEnc[ch]->infoTotalBitsPerFrameWritten = 0; -- GitLab From f016e6dd8aa1358d8f459755d87fa721f8a40fa1 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Thu, 20 Feb 2025 12:27:45 +0100 Subject: [PATCH 089/113] fix missing endif --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index e444cc54b..9d18cbde3 100644 --- a/Makefile +++ b/Makefile @@ -91,6 +91,7 @@ ifeq "$(IGNORELIST)" "1" CFLAGS += -fsanitize-ignorelist=ubsan_ignorelist.txt LDFLAGS += -fsanitize-ignorelist=ubsan_ignorelist.txt endif +endif ifeq "$(RELEASE)" "1" CFLAGS += -DRELEASE -- GitLab From 550a38ef5fb2ae8ee48555504ae3b1b13b7d3a9c Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Thu, 20 Feb 2025 13:28:25 +0100 Subject: [PATCH 090/113] remove redundant builds and set bash strict mode --- .gitlab-ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 855f5d571..c1e56d48d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -552,8 +552,9 @@ stages: - *update-scripts-repo - *copy-ltv-files-to-testv-dir - python3 ci/remove_unsupported_testcases.py $PRM_FILES - - *build-reference-and-dut-binaries + - *build-reference-binaries + - set -euxo pipefail - make_args="CLANG=$CLANG_NUM" - if [[ $CLANG_NUM == 3 ]]; then - export UBSAN_OPTIONS="suppressions=scripts/ubsan_basop.supp,report_error_type=1" -- GitLab From 81b0eae0d1ed28a9e59a25f0397ef9b8887693ba Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Thu, 20 Feb 2025 14:58:30 +0100 Subject: [PATCH 091/113] fix order of arguments in basop_check_for_changes.py script --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1bc5a6f07..1aa93e06c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -491,7 +491,7 @@ stages: ### compare the two csv files for regressions - regressions_found=0 - - python3 scripts/basop_check_for_changes_in_testcases.py --xml_report $XML_REPORT_BRANCH $CSV_MAIN $CSV_BRANCH || regressions_found=$? + - python3 scripts/basop_check_for_changes_in_testcases.py --xml_report $XML_REPORT_BRANCH $CSV_BRANCH $CSV_MAIN || regressions_found=$? - if [ $exit_code -eq 1 ]; then echo "Differences encountered"; exit_code=$EXIT_CODE_NON_BE; fi - if [ $zero_errors_branch != 1 ]; then echo "Run errors encountered!"; exit_code=$EXIT_CODE_NON_BE; fi -- GitLab From 10c03e0a51a27a6e37d269f7ecb930926a407a6e Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Thu, 20 Feb 2025 14:58:30 +0100 Subject: [PATCH 092/113] fix order of arguments in basop_check_for_changes.py script --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f3f527373..51d5bc42e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -619,7 +619,7 @@ stages: ### compare the two csv files for regressions - regressions_found=0 - - python3 scripts/basop_check_for_changes_in_testcases.py --show_improvements --xml_report $XML_REPORT_BRANCH $CSV_MAIN $CSV_BRANCH > regression_log.txt || regressions_found=$? + - python3 scripts/basop_check_for_changes_in_testcases.py --show_improvements --xml_report $XML_REPORT_BRANCH $CSV_BRANCH $CSV_MAIN > regression_log.txt || regressions_found=$? - exit_code=0 - *print-results-banner -- GitLab From ff8a621a25b32357e22ed3f256ef62cfea74f66b Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Fri, 21 Feb 2025 14:27:21 +0100 Subject: [PATCH 093/113] fix check-be tests comparison was always done with full chain BASOP codec, not using the flt ref en/decoder where applicable --- .gitlab-ci.yml | 81 ++++++++++++++++++++++++++++++++++---------------- 1 file changed, 56 insertions(+), 25 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 51d5bc42e..65ae34075 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,7 +2,7 @@ variables: TESTV_DIR: "/usr/local/testv" LTV_DIR: "/usr/local/ltv" EVS_BE_TEST_DIR_BASOP: "/usr/local/be_2_evs_basop" - REFERENCE_BRANCH: "ivas-float-update" + FLOAT_REF_BRANCH: "ivas-float-update" BUILD_OUTPUT: "build_output.txt" SCRIPTS_DIR: "/usr/local/scripts" EXIT_CODE_NON_BE: 123 @@ -17,6 +17,8 @@ variables: DUT_DECODER_PATH: "./IVAS_dec" REF_ENCODER_PATH: "./IVAS_cod_ref" REF_DECODER_PATH: "./IVAS_dec_ref" + MERGE_TARGET_ENCODER_PATH: "./IVAS_cod_merge_target" + MERGE_TARGET_DECODER_PATH: "./IVAS_dec_merge_target" LEVEL_SCALING: "1.0" IVAS_PIPELINE_NAME: '' BASOP_CI_BRANCH_PC_REPO: "basop-ci-branch" @@ -37,8 +39,9 @@ variables: FAILED_TESTCASES_LIST: "failed-testcases.txt" ERRORS_TESTCASES_LIST: "errors-testcases.txt" PYTEST_CACHE_ARTIFACT: "pytest_cache.zip" - REF_COMMIT_FILE: "ref-branch-git-sha" - CUT_COMMIT_FILE: "CuT-branch-git-sha" + FLOAT_REF_COMMIT_FILE: "float-ref-git-sha" + CUT_COMMIT_FILE: "CuT-git-sha" + MERGE_TARGET_COMMIT_FILE: "merge-target-git-sha" MANUAL_PIPELINE_TYPE: description: "Type for the manual pipeline run. Use 'pytest-compare' to run comparison test against reference float codec." value: 'default' @@ -147,14 +150,13 @@ stages: - sed -i.bak -e "s/\/\*\ *\(#define\ *DEBUG_MODE_INFO\ *\)\*\//\1/g" lib_com/options.h - fi -.build-reference-binaries: &build-reference-binaries +.build-float-ref-binaries: &build-float-ref-binaries - git rev-parse HEAD > $CUT_COMMIT_FILE - current_commit_sha=$(git rev-parse HEAD) ### build reference binaries - - git checkout $REFERENCE_BRANCH + - git checkout $FLOAT_REF_BRANCH - git pull - *activate-debug-mode-info-if-set - - cat lib_com/options.h - make clean - make -j - mv ./IVAS_cod ./$REF_ENCODER_PATH @@ -162,20 +164,35 @@ stages: - mv ./IVAS_rend ./IVAS_rend_ref ### Return to current branch - git restore . - - git rev-parse HEAD > $REF_COMMIT_FILE + - git rev-parse HEAD > $FLOAT_REF_COMMIT_FILE - git checkout $current_commit_sha +.build-merge-target-binaries: &build-merge-target-binaries + - current_commit_sha=$(git rev-parse HEAD) + ### build merge target binaries + - git checkout $CI_MERGE_REQUEST_TARGET_BRANCH_NAME + - git pull + - *activate-debug-mode-info-if-set + - make clean + - make -j + - mv ./IVAS_cod ./$MERGE_TARGET_ENCODER_PATH + - mv ./IVAS_dec ./$MERGE_TARGET_DECODER_PATH + - mv ./IVAS_rend ./IVAS_rend_merge_target + ### Return to current branch + - git restore . + - git rev-parse HEAD > $MERGE_TARGET_COMMIT_FILE + - git checkout $current_commit_sha -.build-reference-and-dut-binaries: &build-reference-and-dut-binaries +.build-float-ref-and-dut-binaries: &build-float-ref-and-dut-binaries ### build reference binaries - - *build-reference-binaries + - *build-float-ref-binaries ### build dut binaries - *activate-debug-mode-info-if-set - make clean - make -j -.build-and-create-reference-outputs: &build-and-create-reference-outputs - - *build-reference-and-dut-binaries +.build-and-create-float-ref-outputs: &build-and-create-float-ref-outputs + - *build-float-ref-and-dut-binaries ### prepare pytest # create short test vectors @@ -365,7 +382,7 @@ stages: - if [ "$COMPARE_DMX" = "true" ] || [ "$ENCODER_TEST" = "true" ]; then - BUILD_WITH_DEBUG_MODE_INFO="true" - fi - - *build-and-create-reference-outputs + - *build-and-create-float-ref-outputs - comp_args="--mld --ssnr --odg" - if [ "$ENCODER_TEST" = "true" ]; then @@ -448,15 +465,16 @@ stages: needs: ["build-codec-linux-make"] timeout: "300 minutes" variables: - REFERENCE_BRANCH: "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" XML_REPORT: "report--$CI_JOB_NAME--sha-$CI_COMMIT_SHORT_SHA.xml" HTML_REPORT: "report--$CI_JOB_NAME--sha-$CI_COMMIT_SHORT_SHA.html" + PYTEST_LOG_TARGET_BRANCH: "pytest-log-$CI_MERGE_REQUEST_TARGET_BRANCH_NAME.txt" script: - *print-common-info - set -euxo pipefail - *update-scripts-repo + - python3 tests/create_short_testvectors.py - if [ $USE_LTV -eq 1 ]; then - *update-ltv-repo @@ -471,12 +489,16 @@ stages: - *apply-testv-scaling - fi - - *build-and-create-reference-outputs + - *build-float-ref-binaries + - *build-merge-target-binaries - *check-up-to-date-in-comparison-jobs + - exit_code_target=0 + - python3 -m pytest $TEST_SUITE -v --update_ref 1 --create_ref -n auto --ref_encoder_path $MERGE_TARGET_ENCODER_PATH --ref_decoder_path $MERGE_TARGET_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH > $PYTEST_LOG_TARGET_BRANCH || exit_code_target=$? + - exit_code=0 - rm -rf .pytest_cache || true - - python3 -m pytest --tb=no -q $TEST_SUITE -v --keep_files --create_cut --html=$HTML_REPORT --self-contained-html --junit-xml=$XML_REPORT --mld --ssnr --odg --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH -n auto --testcase_timeout $testcase_timeout > pytest_log.txt || exit_code=$? + - python3 -m pytest --tb=no -q $TEST_SUITE -v --keep_files --create_cut --html=$HTML_REPORT --self-contained-html --junit-xml=$XML_REPORT --mld --ssnr --odg --ref_encoder_path $MERGE_TARGET_ENCODER_PATH --ref_decoder_path $MERGE_TARGET_DECODER_PATH --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH -n auto --testcase_timeout $testcase_timeout > pytest_log.txt || exit_code=$? - if [ $exit_code -ne 0 ]; then - exit_code=$EXIT_CODE_NON_BE @@ -495,7 +517,7 @@ stages: - cat failed_testcases_for_printing.txt - echo "Reproduce locally with:" - - echo -e "1. Create references with target branch $CI_MERGE_REQUEST_TARGET_BRANCH_NAME:\n\t- git checkout $(cat $REF_COMMIT_FILE)\n\t- make clean\n\t- make -j\n\t- mv IVAS_cod IVAS_cod_ref\n\t- mv IVAS_dec IVAS_dec_ref\n\t- python3 -m pytest $(cat $FAILED_TESTCASES_LIST) --update_ref 1 --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH" + - echo -e "1. Create references with target branch $CI_MERGE_REQUEST_TARGET_BRANCH_NAME:\n\t- git checkout $(cat $FLOAT_REF_COMMIT_FILE)\n\t- make clean\n\t- make -j\n\t- mv IVAS_cod IVAS_cod_ref\n\t- mv IVAS_dec IVAS_dec_ref\n\t- python3 -m pytest $(cat $FAILED_TESTCASES_LIST) --update_ref 1 --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH" - echo -e "2. Run test with source branch $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME:\n\t- git checkout $(cat $CUT_COMMIT_FILE)\n\t- make clean\n\t- make -j\n\t- python3 -m pytest $(cat $FAILED_TESTCASES_LIST) --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH" - echo "The individual command lines can be found in the html report in the job artifacts." - if [ $num_errors -ne 0 ]; then @@ -529,8 +551,10 @@ stages: - $ERRORS_TESTCASES_LIST - pytest_log.txt - $PYTEST_CACHE_ARTIFACT - - $REF_COMMIT_FILE + - $FLOAT_REF_COMMIT_FILE - $CUT_COMMIT_FILE + - $MERGE_TARGET_COMMIT_FILE + - $PYTEST_LOG_TARGET_BRANCH expose_as: "pytest compare results" reports: junit: @@ -591,7 +615,7 @@ stages: ### run branch first # this per default builds the branch and the reference and creates the reference outputs - - *build-and-create-reference-outputs + - *build-and-create-float-ref-outputs - *check-up-to-date-in-comparison-jobs # need to restore cache again - *overwrite-pytest-cache-with-artifact @@ -627,7 +651,7 @@ stages: - echo "Run errors encountered!" - exit_code=$EXIT_CODE_FAIL - echo "Reproduce locally with:" - - echo -e "1. Create references with target branch $CI_MERGE_REQUEST_TARGET_BRANCH_NAME:\n\t- git checkout $(cat $REF_COMMIT_FILE)\n\t- make clean\n\t- make -j\n\t- mv IVAS_cod IVAS_cod_ref\n\t- mv IVAS_dec IVAS_dec_ref\n\t- python3 -m pytest $(cat $ERRORS_TESTCASES_LIST) --update_ref 1 --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH" + - echo -e "1. Create references with target branch $CI_MERGE_REQUEST_TARGET_BRANCH_NAME:\n\t- git checkout $(cat $FLOAT_REF_COMMIT_FILE)\n\t- make clean\n\t- make -j\n\t- mv IVAS_cod IVAS_cod_ref\n\t- mv IVAS_dec IVAS_dec_ref\n\t- python3 -m pytest $(cat $ERRORS_TESTCASES_LIST) --update_ref 1 --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH" - echo -e "2. Run test with source branch $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME:\n\t- git checkout $(cat $CUT_COMMIT_FILE)\n\t- make clean\n\t- make -j\n\t- python3 -m pytest $(cat $ERRORS_TESTCASES_LIST) --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH" - echo "The individual command lines can be found in the changes*.csv files in the job artifacts." - elif [ $regressions_found != 0 ] && [ "$SKIP_REGRESSION_CHECK" != "true" ]; then @@ -640,7 +664,7 @@ stages: - exit_code=$EXIT_CODE_NON_BE; - fi - echo "Reproduce locally with:" - - echo -e "1. Create references with target branch $CI_MERGE_REQUEST_TARGET_BRANCH_NAME:\n\t- git checkout $(cat $REF_COMMIT_FILE)\n\t- make clean\n\t- make -j\n\t- mv IVAS_cod IVAS_cod_ref\n\t- mv IVAS_dec IVAS_dec_ref\n\t- python3 -m pytest $(cat $FAILED_TESTCASES_LIST) --update_ref 1 --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH" + - echo -e "1. Create references with target branch $CI_MERGE_REQUEST_TARGET_BRANCH_NAME:\n\t- git checkout $(cat $FLOAT_REF_COMMIT_FILE)\n\t- make clean\n\t- make -j\n\t- mv IVAS_cod IVAS_cod_ref\n\t- mv IVAS_dec IVAS_dec_ref\n\t- python3 -m pytest $(cat $FAILED_TESTCASES_LIST) --update_ref 1 --ref_encoder_path $REF_ENCODER_PATH --ref_decoder_path $REF_DECODER_PATH" - echo -e "2. Run test with source branch $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME:\n\t- git checkout $(cat $CUT_COMMIT_FILE)\n\t- make clean\n\t- make -j\n\t- python3 -m pytest $(cat $FAILED_TESTCASES_LIST) --dut_encoder_path $DUT_ENCODER_PATH --dut_decoder_path $DUT_DECODER_PATH" - echo "The individual command lines can be found in the changes*.csv files in the job artifacts." - fi @@ -664,8 +688,9 @@ stages: - $CSV_MAIN - $SUMMARY_HTML_ARTIFACT_NAME - $IMAGES_ARTIFACT_NAME - - $REF_COMMIT_FILE + - $FLOAT_REF_COMMIT_FILE - $CUT_COMMIT_FILE + - $MERGE_TARGET_COMMIT_FILE - changes_crashes.csv - changes_MLD.csv - changes_MAXIMUM_ABS_DIFF.csv @@ -695,7 +720,7 @@ stages: - *copy-ltv-files-to-testv-dir - python3 ci/remove_unsupported_testcases.py $PRM_FILES - - *build-reference-binaries + - *build-float-ref-binaries - set -euxo pipefail - make_args="CLANG=$CLANG_NUM" - if [[ $CLANG_NUM == 3 ]]; then @@ -740,7 +765,7 @@ stages: - if [ $LEVEL_SCALING != "1.0" ];then - *apply-testv-scaling - fi - - *build-reference-and-dut-binaries + - *build-float-ref-and-dut-binaries ### run pytest - exit_code=0 @@ -975,6 +1000,7 @@ check-be-to-target-short-enc-0db: before_script: - USE_LTV=0 - DUT_DECODER_PATH=./IVAS_dec_ref + - MERGE_TARGET_DECODER_PATH=./IVAS_dec_ref - TEST_SUITE="$SHORT_TEST_SUITE_ENCODER" - LEVEL_SCALING=1.0 - rm -rf tests/dut tests/ref @@ -987,6 +1013,7 @@ check-be-to-target-short-enc-+10db: before_script: - USE_LTV=0 - DUT_DECODER_PATH=./IVAS_dec_ref + - MERGE_TARGET_DECODER_PATH=./IVAS_dec_ref - TEST_SUITE="$SHORT_TEST_SUITE_ENCODER" - LEVEL_SCALING=3.162 - rm -rf tests/dut tests/ref @@ -999,6 +1026,7 @@ check-be-to-target-short-enc--10db: before_script: - USE_LTV=0 - DUT_DECODER_PATH=./IVAS_dec_ref + - MERGE_TARGET_DECODER_PATH=./IVAS_dec_ref - TEST_SUITE="$SHORT_TEST_SUITE_ENCODER" - LEVEL_SCALING=0.3162 - rm -rf tests/dut tests/ref @@ -1011,6 +1039,7 @@ check-be-to-target-short-dec-0db: before_script: - USE_LTV=0 - DUT_ENCODER_PATH=./IVAS_cod_ref + - MERGE_TARGET_ENCODER_PATH=./IVAS_cod_ref - TEST_SUITE="$SHORT_TEST_SUITE" - LEVEL_SCALING=1.0 - rm -rf tests/dut tests/ref @@ -1023,6 +1052,7 @@ check-be-to-target-short-dec-+10db: before_script: - USE_LTV=0 - DUT_ENCODER_PATH=./IVAS_cod_ref + - MERGE_TARGET_ENCODER_PATH=./IVAS_cod_ref - TEST_SUITE="$SHORT_TEST_SUITE" - LEVEL_SCALING=3.162 - rm -rf tests/dut tests/ref @@ -1035,6 +1065,7 @@ check-be-to-target-short-dec--10db: before_script: - USE_LTV=0 - DUT_ENCODER_PATH=./IVAS_cod_ref + - MERGE_TARGET_ENCODER_PATH=./IVAS_cod_ref - TEST_SUITE="$SHORT_TEST_SUITE" - LEVEL_SCALING=0.3162 - rm -rf tests/dut tests/ref @@ -1466,7 +1497,7 @@ coverage-test-on-main-scheduled: - *update-scripts-repo - *update-ltv-repo - *copy-ltv-files-to-testv-dir - - *build-reference-binaries + - *build-float-ref-binaries # Build DuT binaries with GCOV - make clean - make GCOV=1 -j @@ -1665,7 +1696,7 @@ voip-be-on-merge-request: - *print-common-info - *update-scripts-repo - *update-ltv-repo - - *build-reference-and-dut-binaries + - *build-float-ref-and-dut-binaries - *complexity-measurements-setup - which coan artifacts: -- GitLab From 548bdacb70227acf2f10c292563f021c385ce1c7 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Fri, 21 Feb 2025 14:38:17 +0100 Subject: [PATCH 094/113] add missing build for branch --- .gitlab-ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 65ae34075..292d8ae41 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -491,6 +491,8 @@ stages: - *build-float-ref-binaries - *build-merge-target-binaries + - make clean + - make -j - *check-up-to-date-in-comparison-jobs - exit_code_target=0 -- GitLab From e463cc92c149c82a8142eb0045a072ed5cca73f3 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Fri, 21 Feb 2025 15:41:28 +0100 Subject: [PATCH 095/113] run prepare_combined_files script --- .gitlab-ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 292d8ae41..1ea012c2a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -485,6 +485,8 @@ stages: - fi - python3 ci/remove_unsupported_testcases.py $PRM_FILES + - python3 scripts/prepare_combined_format_inputs.py + - if [ $LEVEL_SCALING != "1.0" ];then - *apply-testv-scaling - fi -- GitLab From c1781082bdb607eb3b887167229c5b1f1cbd678b Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Mon, 24 Feb 2025 08:35:30 +0000 Subject: [PATCH 096/113] Update 2 files - /.gitlab/issue_templates/float-update-porting.md - /.gitlab/merge_request_templates/float-update-porting.md --- .gitlab/issue_templates/float-update-porting.md | 2 -- .gitlab/merge_request_templates/float-update-porting.md | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.gitlab/issue_templates/float-update-porting.md b/.gitlab/issue_templates/float-update-porting.md index 84d15a8c8..19bbf7ba8 100644 --- a/.gitlab/issue_templates/float-update-porting.md +++ b/.gitlab/issue_templates/float-update-porting.md @@ -2,7 +2,5 @@ - Original merge request in float repo: -- Branch for float ref update: -- Branch for BASOP update: /label ~Type:FloatUpdatePorting ~Status::ToDo diff --git a/.gitlab/merge_request_templates/float-update-porting.md b/.gitlab/merge_request_templates/float-update-porting.md index 7ffdee333..5b6d90dad 100644 --- a/.gitlab/merge_request_templates/float-update-porting.md +++ b/.gitlab/merge_request_templates/float-update-porting.md @@ -1,6 +1,6 @@ - Link to issue in BASOP repo: -- Link to original issue in float repo: +- Link to original MR in float repo: - Requested reviewers: /label Type:FloatUpdatePorting -- GitLab From e21996d8675465373eb719b2aed585878a2aa0c3 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 24 Feb 2025 11:23:37 +0100 Subject: [PATCH 097/113] fix bug in renaming of the codec binaries for use by pytest --- .gitlab-ci.yml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1ea012c2a..a7f044dad 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -13,12 +13,20 @@ variables: SHORT_TEST_SUITE_ENCODER: "tests/codec_be_on_mr_nonselection/test_param_file.py --param_file scripts/config/self_test_basop_encoder.prm" LONG_TEST_SUITE_ENCODER: "tests/codec_be_on_mr_nonselection/test_param_file.py --param_file scripts/config/self_test_ltv_basop_encoder.prm" TEST_SUITE: "" + # These path variables are used by the pytest calls. + # They can be overwritten in the job templates to e.g. only test encoder or decoder in the chain DUT_ENCODER_PATH: "./IVAS_cod" DUT_DECODER_PATH: "./IVAS_dec" REF_ENCODER_PATH: "./IVAS_cod_ref" REF_DECODER_PATH: "./IVAS_dec_ref" MERGE_TARGET_ENCODER_PATH: "./IVAS_cod_merge_target" MERGE_TARGET_DECODER_PATH: "./IVAS_dec_merge_target" + # These path variables are used for building the binaries + # They should never be overwritten! + REF_ENCODER_PATH_FOR_BUILD_DO_NOT_MODIFY: "./IVAS_cod_ref" + REF_DECODER_PATH_FOR_BUILD_DO_NOT_MODIFY: "./IVAS_dec_ref" + MERGE_TARGET_ENCODER_PATH_FOR_BUILD_DO_NOT_MODIFY: "./IVAS_cod_merge_target" + MERGE_TARGET_DECODER_PATH_FOR_BUILD_DO_NOT_MODIFY: "./IVAS_dec_merge_target" LEVEL_SCALING: "1.0" IVAS_PIPELINE_NAME: '' BASOP_CI_BRANCH_PC_REPO: "basop-ci-branch" @@ -159,8 +167,8 @@ stages: - *activate-debug-mode-info-if-set - make clean - make -j - - mv ./IVAS_cod ./$REF_ENCODER_PATH - - mv ./IVAS_dec ./$REF_DECODER_PATH + - mv ./IVAS_cod ./$REF_ENCODER_PATH_FOR_BUILD_DO_NOT_MODIFY + - mv ./IVAS_dec ./$REF_DECODER_PATH_FOR_BUILD_DO_NOT_MODIFY - mv ./IVAS_rend ./IVAS_rend_ref ### Return to current branch - git restore . @@ -175,8 +183,8 @@ stages: - *activate-debug-mode-info-if-set - make clean - make -j - - mv ./IVAS_cod ./$MERGE_TARGET_ENCODER_PATH - - mv ./IVAS_dec ./$MERGE_TARGET_DECODER_PATH + - mv ./IVAS_cod ./$MERGE_TARGET_ENCODER_PATH_FOR_BUILD_DO_NOT_MODIFY + - mv ./IVAS_dec ./$MERGE_TARGET_DECODER_PATH_FOR_BUILD_DO_NOT_MODIFY - mv ./IVAS_rend ./IVAS_rend_merge_target ### Return to current branch - git restore . -- GitLab From 42023f79808d5a4eb3103741cd872ccdc983a9ab Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Mon, 24 Feb 2025 09:14:12 -0500 Subject: [PATCH 098/113] possible fix to 1320 --- lib_enc/ivas_td_low_rate_enc.c | 53 ++++++++++++++++++++++++++++++---- 1 file changed, 48 insertions(+), 5 deletions(-) diff --git a/lib_enc/ivas_td_low_rate_enc.c b/lib_enc/ivas_td_low_rate_enc.c index 95762fa29..a39a17d99 100644 --- a/lib_enc/ivas_td_low_rate_enc.c +++ b/lib_enc/ivas_td_low_rate_enc.c @@ -222,6 +222,10 @@ void encod_gen_2sbfr( LPD_state_HANDLE hLPDmem = st->hLPDmem; +#ifdef FIX_1320_LOWRATE_ACELP + Word16 gcode16; + Word32 Lgcode, Ltmp; +#endif #ifdef MSAN_FIX set16_fx( cn, 0, 2 * L_SUBFR ); /* Target vector in residual domain */ #endif @@ -269,8 +273,12 @@ void encod_gen_2sbfr( // Scale_sig( &hLPDmem->mem_w0, M + 1, sub( add( *Q_new, hLPDmem->e_mem_syn ), Q16 ) ); // M + 1 to sync mem_syn exponent with mem_w0 exponent // hLPDmem->e_mem_syn = sub( Q16, *Q_new ); - find_targets_fx( speech, hLPDmem->mem_syn, i_subfr, &hLPDmem->mem_w0, p_Aq, res, 2 * L_SUBFR, p_Aw, st->preemph_fac, xn, cn, h1 ); +#ifndef FIX_1320_LOWRATE_ACELP + find_targets_fx( speech, hLPDmem->mem_syn, i_subfr, &hLPDmem->mem_w0, p_Aq, res, 2 * L_SUBFR, p_Aw, st->preemph_fac, xn, cn, h1 ); +#else + find_targets_ivas_fx( speech, hLPDmem->mem_syn, i_subfr, &hLPDmem->mem_w0, p_Aq, res, 2 * L_SUBFR, p_Aw, st->preemph_fac, xn, cn, h1 ); +#endif /*Scale_sig(h1, L_SUBFR, shift); */ /*Q14-shift */ Copy_Scale_sig( h1, h2, 2 * L_SUBFR, -2 ); Scale_sig( h1, 2 * L_SUBFR, add( 1, shift ) ); /* set h1[] in Q14 with scaling for convolution */ @@ -300,8 +308,11 @@ void encod_gen_2sbfr( * LP filtering of the adaptive excitation, codebook target computation *-----------------------------------------------------------------*/ +#ifndef FIX_1320_LOWRATE_ACELP lp_filt_exc_enc_fx( MODE1, coder_type, i_subfr, exc, h1, xn, y1, xn2, 2 * L_SUBFR, L_frame, g_corr, clip_gain, &gain_pit, &st->acelp_cfg.ltf_mode ); - +#else + lp_filt_exc_enc_ivas_fx( MODE1, coder_type, i_subfr, exc, h1, xn, y1, xn2, 2 * L_SUBFR, L_frame, g_corr, clip_gain, &gain_pit, &st->acelp_cfg.ltf_mode ); +#endif /* update long-term pitch gain for speech/music classifier */ st->hSpMusClas->lowrate_pitchGain = add( mult( 29491, st->hSpMusClas->lowrate_pitchGain ), mult( 3277, gain_pit ) ); // Q14 move16(); @@ -334,14 +345,30 @@ void encod_gen_2sbfr( gp_clip_test_gain_pit_fx( st->element_mode, st->core_brate, gain_pit, st->clip_var_fx ); +#ifndef FIX_1320_LOWRATE_ACELP hLPDmem->tilt_code = est_tilt_ivas_fx( exc + i_subfr, gain_pit, code, gain_code, &voice_fac, Q_new, 2 * L_SUBFR, 0 ); +#else + Lgcode = L_shl_sat( gain_code, sub( Q_new, 0 ) ); /* scaled gain_code with Qnew -> Q16*/ + gcode16 = round_fx_sat( Lgcode ); /*Q0*/ + hLPDmem->tilt_code = est_tilt_ivas_fx(exc + i_subfr, gain_pit, code, Lgcode, &voice_fac, Q_new, 2 * L_SUBFR, 0); +#endif move16(); /*-----------------------------------------------------------------* * Update memory of the weighting filter *-----------------------------------------------------------------*/ +#ifndef FIX_1320_LOWRATE_ACELP hLPDmem->mem_w0 = sub( sub( xn[2 * L_SUBFR - 1], mult_r( gain_pit, y1[2 * L_SUBFR - 1] ) ), mult_r( extract_h( gain_code ), y2[2 * L_SUBFR - 1] ) ); +#else + Ltmp = L_mult0( gcode16, y2[2 * L_SUBFR - 1] ); /*Q10*/ + Ltmp = L_shl( Ltmp, add(5, shift ) ); /*Q15+shift*/ + Ltmp = L_negate( Ltmp ); + Ltmp = L_mac( Ltmp, xn[2 * L_SUBFR - 1], 16384 /*Q14*/ ); /* Q_new-1+shift+14+1 */ + Ltmp = L_msu( Ltmp, y1[2 * L_SUBFR - 1], gain_pit /*Q14*/ ); /* Q_new-1+shift+14+1 */ + Ltmp = L_shl_sat( Ltmp, sub( 1, shift ) ); /* 15 + Q_new */ + hLPDmem->mem_w0 = round_fx_sat( Ltmp ); /*Q_new-1 */ +#endif move16(); /*-----------------------------------------------------------------* @@ -349,6 +376,7 @@ void encod_gen_2sbfr( * Save the non-enhanced excitation for FEC_exc *-----------------------------------------------------------------*/ +#ifndef FIX_1320_LOWRATE_ACELP FOR( i = 0; i < 2 * L_SUBFR; i++ ) { exc2[i + i_subfr] = mult( gain_pit, exc[i + i_subfr] ); @@ -356,7 +384,20 @@ void encod_gen_2sbfr( exc[i + i_subfr] = add( exc2[i + i_subfr], mult( extract_h( gain_code ), code[i] ) ); move16(); } - +#else + FOR(i = 0; i < 2 * L_SUBFR; i++) + { + /* code in Q9, gain_pit in Q14 */ + exc2[i + i_subfr] = shl_sat( mult( gain_pit, exc[i + i_subfr] ), 1 ); + Ltmp = L_mult( gcode16, code[i] ); /* Q10 */ + Ltmp = L_shl_sat( Ltmp, 5 ); /* Q15 */ + Ltmp = L_mac_sat( Ltmp, exc[i + i_subfr], gain_pit ); /* Q15 */ + Ltmp = L_shl_sat( Ltmp, 1 ); /* saturation can occur here Q16*/ + exc[i + i_subfr] = round_fx_sat( Ltmp ); + move16(); + move16(); + } +#endif /*-----------------------------------------------------------------* * Prepare TBE excitation *-----------------------------------------------------------------*/ @@ -370,9 +411,11 @@ void encod_gen_2sbfr( * Synthesize speech to update mem_syn_flt[]. * Update A(z) filters *-----------------------------------------------------------------*/ - +#ifndef FIX_1320_LOWRATE_ACELP E_UTIL_synthesis( 0, p_Aq, &exc[i_subfr], &syn[i_subfr], 2 * L_SUBFR, hLPDmem->mem_syn, 1, M ); - +#else + Syn_filt_s(1, p_Aq, M, &exc[i_subfr], &syn[i_subfr], 2 * L_SUBFR, hLPDmem->mem_syn, 1 ); +#endif p_Aw += 2 * ( M + 1 ); p_Aq += 2 * ( M + 1 ); -- GitLab From 7de3bc969f7709963211055a4be0df334663f3b5 Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Mon, 24 Feb 2025 09:38:14 -0500 Subject: [PATCH 099/113] small correction to the fix --- lib_com/options.h | 2 ++ lib_enc/ivas_td_low_rate_enc.c | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 0c8105d8c..8204162b7 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -164,4 +164,6 @@ #define FIX_ISSUE_1247 #define NONBE_FIX_1087_OOB_SBA_DTX_RS /* VA: issue 1087: Extend the length of the buffer for MCT decoding to avoid out-of-bound writing in SBA SID bitrate switching decoding */ #define FIX_1285_DECODER_CRASH + +#define FIX_1320_LOWRATE_ACELP #endif diff --git a/lib_enc/ivas_td_low_rate_enc.c b/lib_enc/ivas_td_low_rate_enc.c index a39a17d99..e29810db0 100644 --- a/lib_enc/ivas_td_low_rate_enc.c +++ b/lib_enc/ivas_td_low_rate_enc.c @@ -302,8 +302,11 @@ void encod_gen_2sbfr( * Gain clipping test to avoid unstable synthesis on frame erasure *-----------------------------------------------------------------*/ +#ifndef FIX_1320_LOWRATE_ACELP clip_gain = gp_clip_fx( st->element_mode, st->core_brate, st->voicing_fx, i_subfr, coder_type, xn, st->clip_var_fx, Q_new ); // Q0 - +#else + clip_gain = gp_clip_fx( st->element_mode, st->core_brate, st->voicing_fx, i_subfr, coder_type, xn, st->clip_var_fx, sub( Q_new, 1 ) ); // Q0 +#endif /*-----------------------------------------------------------------* * LP filtering of the adaptive excitation, codebook target computation *-----------------------------------------------------------------*/ @@ -348,7 +351,7 @@ void encod_gen_2sbfr( #ifndef FIX_1320_LOWRATE_ACELP hLPDmem->tilt_code = est_tilt_ivas_fx( exc + i_subfr, gain_pit, code, gain_code, &voice_fac, Q_new, 2 * L_SUBFR, 0 ); #else - Lgcode = L_shl_sat( gain_code, sub( Q_new, 0 ) ); /* scaled gain_code with Qnew -> Q16*/ + Lgcode = L_shl_sat( gain_code, Q_new ); /* scaled gain_code with Qnew -> Q16*/ gcode16 = round_fx_sat( Lgcode ); /*Q0*/ hLPDmem->tilt_code = est_tilt_ivas_fx(exc + i_subfr, gain_pit, code, Lgcode, &voice_fac, Q_new, 2 * L_SUBFR, 0); #endif -- GitLab From dc11ee23067a74b0572c2dd331a99640d7c6ca5f Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Mon, 24 Feb 2025 09:55:30 -0500 Subject: [PATCH 100/113] fix clang --- lib_enc/ivas_td_low_rate_enc.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lib_enc/ivas_td_low_rate_enc.c b/lib_enc/ivas_td_low_rate_enc.c index e29810db0..d09134951 100644 --- a/lib_enc/ivas_td_low_rate_enc.c +++ b/lib_enc/ivas_td_low_rate_enc.c @@ -352,8 +352,8 @@ void encod_gen_2sbfr( hLPDmem->tilt_code = est_tilt_ivas_fx( exc + i_subfr, gain_pit, code, gain_code, &voice_fac, Q_new, 2 * L_SUBFR, 0 ); #else Lgcode = L_shl_sat( gain_code, Q_new ); /* scaled gain_code with Qnew -> Q16*/ - gcode16 = round_fx_sat( Lgcode ); /*Q0*/ - hLPDmem->tilt_code = est_tilt_ivas_fx(exc + i_subfr, gain_pit, code, Lgcode, &voice_fac, Q_new, 2 * L_SUBFR, 0); + gcode16 = round_fx_sat( Lgcode ); /*Q0*/ + hLPDmem->tilt_code = est_tilt_ivas_fx( exc + i_subfr, gain_pit, code, Lgcode, &voice_fac, Q_new, 2 * L_SUBFR, 0 ); #endif move16(); @@ -365,12 +365,12 @@ void encod_gen_2sbfr( hLPDmem->mem_w0 = sub( sub( xn[2 * L_SUBFR - 1], mult_r( gain_pit, y1[2 * L_SUBFR - 1] ) ), mult_r( extract_h( gain_code ), y2[2 * L_SUBFR - 1] ) ); #else Ltmp = L_mult0( gcode16, y2[2 * L_SUBFR - 1] ); /*Q10*/ - Ltmp = L_shl( Ltmp, add(5, shift ) ); /*Q15+shift*/ + Ltmp = L_shl( Ltmp, add( 5, shift ) ); /*Q15+shift*/ Ltmp = L_negate( Ltmp ); - Ltmp = L_mac( Ltmp, xn[2 * L_SUBFR - 1], 16384 /*Q14*/ ); /* Q_new-1+shift+14+1 */ + Ltmp = L_mac( Ltmp, xn[2 * L_SUBFR - 1], 16384 /*Q14*/ ); /* Q_new-1+shift+14+1 */ Ltmp = L_msu( Ltmp, y1[2 * L_SUBFR - 1], gain_pit /*Q14*/ ); /* Q_new-1+shift+14+1 */ - Ltmp = L_shl_sat( Ltmp, sub( 1, shift ) ); /* 15 + Q_new */ - hLPDmem->mem_w0 = round_fx_sat( Ltmp ); /*Q_new-1 */ + Ltmp = L_shl_sat( Ltmp, sub( 1, shift ) ); /* 15 + Q_new */ + hLPDmem->mem_w0 = round_fx_sat( Ltmp ); /*Q_new-1 */ #endif move16(); @@ -388,14 +388,14 @@ void encod_gen_2sbfr( move16(); } #else - FOR(i = 0; i < 2 * L_SUBFR; i++) + FOR( i = 0; i < 2 * L_SUBFR; i++ ) { /* code in Q9, gain_pit in Q14 */ exc2[i + i_subfr] = shl_sat( mult( gain_pit, exc[i + i_subfr] ), 1 ); - Ltmp = L_mult( gcode16, code[i] ); /* Q10 */ - Ltmp = L_shl_sat( Ltmp, 5 ); /* Q15 */ + Ltmp = L_mult( gcode16, code[i] ); /* Q10 */ + Ltmp = L_shl_sat( Ltmp, 5 ); /* Q15 */ Ltmp = L_mac_sat( Ltmp, exc[i + i_subfr], gain_pit ); /* Q15 */ - Ltmp = L_shl_sat( Ltmp, 1 ); /* saturation can occur here Q16*/ + Ltmp = L_shl_sat( Ltmp, 1 ); /* saturation can occur here Q16*/ exc[i + i_subfr] = round_fx_sat( Ltmp ); move16(); move16(); @@ -417,7 +417,7 @@ void encod_gen_2sbfr( #ifndef FIX_1320_LOWRATE_ACELP E_UTIL_synthesis( 0, p_Aq, &exc[i_subfr], &syn[i_subfr], 2 * L_SUBFR, hLPDmem->mem_syn, 1, M ); #else - Syn_filt_s(1, p_Aq, M, &exc[i_subfr], &syn[i_subfr], 2 * L_SUBFR, hLPDmem->mem_syn, 1 ); + Syn_filt_s( 1, p_Aq, M, &exc[i_subfr], &syn[i_subfr], 2 * L_SUBFR, hLPDmem->mem_syn, 1 ); #endif p_Aw += 2 * ( M + 1 ); p_Aq += 2 * ( M + 1 ); -- GitLab From bbc6fea61ff3becd414c2abc783a4818d662f7b2 Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Thu, 13 Feb 2025 14:02:03 -0500 Subject: [PATCH 101/113] fixes to overflow in preprocessing --- lib_com/options.h | 1 + lib_enc/ivas_stereo_classifier.c | 4 ++++ lib_enc/speech_music_classif_fx.c | 11 +++++++++-- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 974237f4c..2d359665c 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -168,4 +168,5 @@ #define FIX_1072_SPEEDUP_gainpanning /* FhG: Minor WMOPS tuning, nonbe */ #define FIX_1072_SPEEDUP_COMPUTEDIFUSENESS /* FhG: Minor WMOPS tuning, nonbe */ #define FIX_1320_LOWRATE_ACELP +#define FIX_1297_OVERFLOW /* VA: fixes issue with overflows in pre-processing */ #endif diff --git a/lib_enc/ivas_stereo_classifier.c b/lib_enc/ivas_stereo_classifier.c index c84fd73f1..4913f2545 100644 --- a/lib_enc/ivas_stereo_classifier.c +++ b/lib_enc/ivas_stereo_classifier.c @@ -1647,7 +1647,11 @@ static void edge_detect_fx( } } +#ifndef FIX_1297_OVERFLOW *edge_str = extract_l( L_shr( edge_min, 10 ) ); // Q15 +#else + *edge_str = extract_h( L_shl_sat( edge_min, 16 - 10 ) ); // Q15 +#endif move16(); *edge_type = et; // Q0 move16(); diff --git a/lib_enc/speech_music_classif_fx.c b/lib_enc/speech_music_classif_fx.c index 32b521ef4..295cff8a1 100644 --- a/lib_enc/speech_music_classif_fx.c +++ b/lib_enc/speech_music_classif_fx.c @@ -2303,14 +2303,21 @@ Word16 ivas_smc_gmm_fx( *high_lpn_flag = 1; move32(); } - +#ifndef FIX_1297_OVERFLOW hSpMusClas->lpm_fx = extract_l( L_shr( lpm_fx, 11 ) ); // Q7 move16(); hSpMusClas->lps_fx = extract_l( L_shr( lps_fx, 11 ) ); // Q7 move16(); hSpMusClas->lpn_fx = extract_l( L_shr( lpn_fx, 11 ) ); // Q7 move16(); - +#else + hSpMusClas->lpm_fx = extract_h( L_shl_sat( lpm_fx, 16 - 11 ) ); // Q7 + move16(); + hSpMusClas->lps_fx = extract_h( L_shl_sat( lps_fx, 16 - 11 ) ); // Q7 + move16(); + hSpMusClas->lpn_fx = extract_h( L_shl_sat( lpn_fx, 16 - 11 ) ); // Q7 + move16(); +#endif /* determine HQ Generic speech class */ IF( st->hHQ_core != NULL ) { -- GitLab From 89812809bebc8e1dbd5c87502203ff08e13b797d Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Thu, 13 Feb 2025 15:27:40 -0500 Subject: [PATCH 102/113] fix for possible assert in guas_enc (1298) --- lib_com/options.h | 1 + lib_enc/gaus_enc_fx.c | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 2d359665c..e7c3f2ce5 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -169,4 +169,5 @@ #define FIX_1072_SPEEDUP_COMPUTEDIFUSENESS /* FhG: Minor WMOPS tuning, nonbe */ #define FIX_1320_LOWRATE_ACELP #define FIX_1297_OVERFLOW /* VA: fixes issue with overflows in pre-processing */ +#define FIX_1298 /* VA: fix possible assert in gaus_enc */ #endif diff --git a/lib_enc/gaus_enc_fx.c b/lib_enc/gaus_enc_fx.c index a9add7ea8..a7d60642b 100644 --- a/lib_enc/gaus_enc_fx.c +++ b/lib_enc/gaus_enc_fx.c @@ -980,9 +980,13 @@ void gauss2v_ivas_fx( /* eneri = round_fx(ener[i]) + round_fx(ener[j]) + 2*round_fx(dotprod) */ /* Use ScalingShift to stay aligned with ener[] */ eneri = L_shl( dotprod, 1 ); /* One left shift added for factor of 2 */ +#ifndef FIX_1298 eneri = L_add( ener[i], eneri ); eneri = L_add( ener[j], eneri ); /* Q31 */ - +#else + eneri = L_add_sat( ener[i], eneri ); + eneri = L_add_sat( ener[j], eneri ); /* Q31 */ +#endif lo1 = L_Extract_lc( cor32, &hi1 ); cor2 = Sad_32( 0, hi1, lo1 ); /* Square + Add */ -- GitLab From 20387d7dd12d252d2611f807d9534887654ffc4a Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Fri, 14 Feb 2025 13:49:39 -0500 Subject: [PATCH 103/113] possible modification to improve #1300 --- lib_com/options.h | 1 + lib_enc/ivas_stereo_ica_enc.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index e7c3f2ce5..2788649c8 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -170,4 +170,5 @@ #define FIX_1320_LOWRATE_ACELP #define FIX_1297_OVERFLOW /* VA: fixes issue with overflows in pre-processing */ #define FIX_1298 /* VA: fix possible assert in gaus_enc */ +#define FIX_1300_ICA_SHIFT_QUANT_IMPROV /* VA: Fix to 1300 to improve precision of the lag quantizer */ #endif diff --git a/lib_enc/ivas_stereo_ica_enc.c b/lib_enc/ivas_stereo_ica_enc.c index 9d06a5523..4c77f86af 100644 --- a/lib_enc/ivas_stereo_ica_enc.c +++ b/lib_enc/ivas_stereo_ica_enc.c @@ -1965,6 +1965,8 @@ void stereo_tca_enc_fx( Word16 temp_exp, tempF_16fx; Word16 scalar_value = BASOP_Util_Divide1616_Scale( currentNCShift, dsFactor, &temp_exp ); /* Q15-temp_exp */ + +#ifndef FIX_1300_ICA_SHIFT_QUANT_IMPROV IF( temp_exp < 0 ) { scalar_value = shl( scalar_value, sub( temp_exp, Q3 ) ); // Q12 @@ -1976,6 +1978,11 @@ void stereo_tca_enc_fx( hStereoTCA->indx_ica_NCShift = usquant_fx( scalar_value, &tempF_16fx, 0, shl( 1, sub( 14, temp_exp ) ), ( 1 << STEREO_BITS_TCA_CORRSTATS ) ); /* Q0 */ move16(); } +#else + scalar_value = shl_sat( scalar_value, sub( temp_exp, 5 ) ); /*Q10*/ + hStereoTCA->indx_ica_NCShift = usquant_fx( scalar_value, &tempF_16fx, 0, 512 /* 0.5 in Q10 */, ( 1 << STEREO_BITS_TCA_CORRSTATS ) ); /* Q0 */ +#endif + tempF_fx = tempF_16fx; move32(); } -- GitLab From 5dc906cb2e73c390ae3ad6c41605b0acf9612ef1 Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Fri, 14 Feb 2025 14:55:44 -0500 Subject: [PATCH 104/113] fix clang --- lib_enc/ivas_stereo_ica_enc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_enc/ivas_stereo_ica_enc.c b/lib_enc/ivas_stereo_ica_enc.c index 4c77f86af..5b79f416a 100644 --- a/lib_enc/ivas_stereo_ica_enc.c +++ b/lib_enc/ivas_stereo_ica_enc.c @@ -1979,8 +1979,8 @@ void stereo_tca_enc_fx( move16(); } #else - scalar_value = shl_sat( scalar_value, sub( temp_exp, 5 ) ); /*Q10*/ - hStereoTCA->indx_ica_NCShift = usquant_fx( scalar_value, &tempF_16fx, 0, 512 /* 0.5 in Q10 */, ( 1 << STEREO_BITS_TCA_CORRSTATS ) ); /* Q0 */ + scalar_value = shl_sat( scalar_value, sub( temp_exp, 5 ) ); /*Q10*/ + hStereoTCA->indx_ica_NCShift = usquant_fx( scalar_value, &tempF_16fx, 0, 512 /* 0.5 in Q10 */, ( 1 << STEREO_BITS_TCA_CORRSTATS ) ); /* Q0 */ #endif tempF_fx = tempF_16fx; -- GitLab From 3064dbd12837fdec68c7b8617f01c8a59ef10b9b Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Fri, 14 Feb 2025 15:09:06 -0500 Subject: [PATCH 105/113] correction of constants --- lib_com/options.h | 1 + lib_enc/ivas_stereo_td_analysis.c | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 2788649c8..288145122 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -171,4 +171,5 @@ #define FIX_1297_OVERFLOW /* VA: fixes issue with overflows in pre-processing */ #define FIX_1298 /* VA: fix possible assert in gaus_enc */ #define FIX_1300_ICA_SHIFT_QUANT_IMPROV /* VA: Fix to 1300 to improve precision of the lag quantizer */ +#define FIX_1301_CORRECT_TD_CNST /* VA: Fix 1301, correct wrong constant in TD stereo */ #endif diff --git a/lib_enc/ivas_stereo_td_analysis.c b/lib_enc/ivas_stereo_td_analysis.c index 49ac895ef..a938083e6 100644 --- a/lib_enc/ivas_stereo_td_analysis.c +++ b/lib_enc/ivas_stereo_td_analysis.c @@ -74,9 +74,13 @@ #define RATIO_MAX 1.5f /* Maximum correlation ratio */ #define RATIO_MAX_FX_Q30 ( 1610612736 ) /* 1.5f in Q30 */ /* Maximum correlation ratio */ +#ifdef FIX_1301_CORRECT_TD_CNST +#define RATIO_MAX_FX_Q24 ( 25165824 ) /* 1.5f in Q24 */ /* Maximum correlation ratio */ +#define RATIO_MAX_FX_Q23 ( 12582912 ) /* 1.5f in Q23 */ /* Maximum correlation ratio */ +#else #define RATIO_MAX_FX_Q24 ( 2516582 ) /* 1.5f in Q24 */ /* Maximum correlation ratio */ #define RATIO_MAX_FX_Q23 ( 1258291 ) /* 1.5f in Q23 */ /* Maximum correlation ratio */ - +#endif #define LIMIT_ADAP_FAC_FX_Q16 ( 9830 ) /* 0.15f in Q16 */ #define MIN_ADAP_FAC_FX_Q16 ( 6554 ) /*0.1f in Q16*/ #define M_ADAP_FX_Q31 ( 1932735 ) /* 0.0009f in Q31 */ -- GitLab From 6237fb9cb1fee12e6d7a1d9bbe9ee8d9d740aa62 Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Fri, 14 Feb 2025 15:12:22 -0500 Subject: [PATCH 106/113] fix clang format --- lib_enc/ivas_stereo_td_analysis.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_enc/ivas_stereo_td_analysis.c b/lib_enc/ivas_stereo_td_analysis.c index a938083e6..4e8b51c11 100644 --- a/lib_enc/ivas_stereo_td_analysis.c +++ b/lib_enc/ivas_stereo_td_analysis.c @@ -78,8 +78,8 @@ #define RATIO_MAX_FX_Q24 ( 25165824 ) /* 1.5f in Q24 */ /* Maximum correlation ratio */ #define RATIO_MAX_FX_Q23 ( 12582912 ) /* 1.5f in Q23 */ /* Maximum correlation ratio */ #else -#define RATIO_MAX_FX_Q24 ( 2516582 ) /* 1.5f in Q24 */ /* Maximum correlation ratio */ -#define RATIO_MAX_FX_Q23 ( 1258291 ) /* 1.5f in Q23 */ /* Maximum correlation ratio */ +#define RATIO_MAX_FX_Q24 ( 2516582 ) /* 1.5f in Q24 */ /* Maximum correlation ratio */ +#define RATIO_MAX_FX_Q23 ( 1258291 ) /* 1.5f in Q23 */ /* Maximum correlation ratio */ #endif #define LIMIT_ADAP_FAC_FX_Q16 ( 9830 ) /* 0.15f in Q16 */ #define MIN_ADAP_FAC_FX_Q16 ( 6554 ) /*0.1f in Q16*/ -- GitLab From cae6da2568bee735bbc6347ca81c5c1a4d677d2e Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Mon, 17 Feb 2025 15:40:20 -0500 Subject: [PATCH 107/113] more correction on constant error, plus one potential saturation was missing --- lib_enc/ivas_stereo_td_analysis.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/lib_enc/ivas_stereo_td_analysis.c b/lib_enc/ivas_stereo_td_analysis.c index 4e8b51c11..f80c74c69 100644 --- a/lib_enc/ivas_stereo_td_analysis.c +++ b/lib_enc/ivas_stereo_td_analysis.c @@ -262,7 +262,11 @@ Word16 stereo_tdm_ener_analysis_fx( rms_thd_fx = L_shr( rms_thd_fx, 2 ); /*Q16*/ /*rms_thd_fx *= 0.25f*/ test(); test(); +#ifdef FIX_1301_CORRECT_TD_CNST + IF( LE_32( hStereoTD->tdm_lt_rms_L_fx, 4915200 /* 75 in Q16*/ ) || LE_32( hStereoTD->tdm_lt_rms_R_fx, 4915200 /* 75 in Q16*/ ) /*|| sts[0]->last_coder_type == TRANSITION */ ) +#else IF( LE_32( hStereoTD->tdm_lt_rms_L_fx, 4915200 /* 75 in Q16*/ ) || LE_32( hStereoTD->tdm_lt_rms_R_fx, 75 /* 75 in Q16*/ ) /*|| sts[0]->last_coder_type == TRANSITION */ ) +#endif { rms_thd_fx = L_shr( rms_thd_fx, 5 ); /* Q16*/ /*rms_thd_fx *= 0.03125f*/ } @@ -336,6 +340,10 @@ Word16 stereo_tdm_ener_analysis_fx( move16(); } +#ifdef FIX_1301_CORRECT_TD_CNST + rms_L_fx = L_shl( rms_L_fx, sub( Q16, q_rms_L ) ); /* All the following energy comparison are done in Q16 */ + rms_R_fx = L_shl( rms_R_fx, sub( Q16, q_rms_R ) ); +#endif test(); IF( EQ_16( hStereoTD->prev_fr_LRTD_TD_dec, 1 ) && side_can_change == 0 ) { @@ -434,7 +442,11 @@ Word16 stereo_tdm_ener_analysis_fx( ELSE { /*ratio_L = ( 1.0f - cosf( EVS_PI * ratio_L / 2.0f ) ) / 2.0f;*/ +#ifdef FIX_1301_CORRECT_TD_CNST + ratio_L_fx = L_deposit_h( sub_sat( ONE_IN_Q14, getCosWord16( extract_l( Mpy_32_32( 1647099 /* EVS_PI/2 in Q20 */, ratio_L_fx ) ) ) ) ); // Q31 (Q14 + Q1(division by 2.0f) + Q16) +#else ratio_L_fx = L_deposit_h( sub( ONE_IN_Q14, getCosWord16( extract_l( Mpy_32_32( 1647099 /* EVS_PI/2 in Q20 */, ratio_L_fx ) ) ) ) ); // Q31 (Q14 + Q1(division by 2.0f) + Q16) +#endif } test(); @@ -482,7 +494,7 @@ Word16 stereo_tdm_ener_analysis_fx( { test(); test(); - IF( GE_32( hCPE->element_brate, IVAS_48k ) && sts[0]->hVAD->hangover_cnt != 0 && LT_32( L_max( hStereoTD->tdm_lt_rms_L_fx, hStereoTD->tdm_lt_rms_R_fx ), 33554432 /* 512.0f */ ) ) + IF( GE_32( hCPE->element_brate, IVAS_48k ) && sts[0]->hVAD->hangover_cnt != 0 && LT_32( L_max( hStereoTD->tdm_lt_rms_L_fx, hStereoTD->tdm_lt_rms_R_fx ), 33554432 /* 512.0f in Q16*/ ) ) { ratio_L_fx = check_bounds_l( ratio_L_fx, 644245094 /*0.3f in Q31*/, 1503238554 /*0.7f in Q31*/ ); /* Q31 */ } @@ -491,7 +503,7 @@ Word16 stereo_tdm_ener_analysis_fx( test(); test(); test(); - IF( ( GT_32( hCPE->hStereoTCA->instTargetGain_fx, 644245094 /*1.2f in Q29*/ ) || GT_32( hCPE->hStereoTCA->targetGain_fx, ONE_IN_Q29 ) ) && LT_32( ratio_L_fx, 858993459 /*0.4f*/ ) ) + IF( ( GT_32( hCPE->hStereoTCA->instTargetGain_fx, 644245094 /*1.2f in Q29*/ ) || GT_32( hCPE->hStereoTCA->targetGain_fx, ONE_IN_Q29 ) ) && LT_32( ratio_L_fx, 858993459 /*0.4f in Q31*/ ) ) { ratio_L_fx = 858993459; /*0.4f in Q31*/ move32(); @@ -569,7 +581,7 @@ Word16 stereo_tdm_ener_analysis_fx( } } - IF( LT_16( sub( sts[1]->lp_speech_fx, sts[1]->lp_noise_fx ), 12800 /*50.0f*/ ) ) /* likely presence of noisy content */ + IF( LT_16( sub( sts[1]->lp_speech_fx, sts[1]->lp_noise_fx ), 12800 /*50.0f in Q8*/ ) ) /* likely presence of noisy content */ { /* pointing in the right direction, inverse it else do nothing */ test(); @@ -1063,7 +1075,11 @@ static void NOOP_decision_fx( } ELSE { - if ( LT_32( sts[0]->ee_old_fx, 160000 /* 5000.f in Q6 */ ) && LT_32( sts[1]->ee_old_fx, 160000 /* 5000.f in Q6 */ ) ) +#ifdef FIX_1301_CORRECT_TD_CNST + if ( LT_32( sts[0]->ee_old_fx, 320000 /* 5000.f in Q6 */ ) && LT_32( sts[1]->ee_old_fx, 320000 /* 5000.f in Q6 */ ) ) +#else + if ( LT_32( sts[0]->ee_old_fx, 160000 /* 5000.f in Q6 */ ) && LT_32( sts[1]->ee_old_fx, 160000 /* 5000.f in Q6 */ ) ) +#endif { tdm_NOOP_switch_flag = 1; move16(); -- GitLab From 7b46b2feacdf05d77fe95c1dae2a336ab3b0c294 Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Mon, 17 Feb 2025 15:42:59 -0500 Subject: [PATCH 108/113] fix clang --- lib_enc/ivas_stereo_td_analysis.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib_enc/ivas_stereo_td_analysis.c b/lib_enc/ivas_stereo_td_analysis.c index f80c74c69..5bc62bc8b 100644 --- a/lib_enc/ivas_stereo_td_analysis.c +++ b/lib_enc/ivas_stereo_td_analysis.c @@ -341,7 +341,7 @@ Word16 stereo_tdm_ener_analysis_fx( } #ifdef FIX_1301_CORRECT_TD_CNST - rms_L_fx = L_shl( rms_L_fx, sub( Q16, q_rms_L ) ); /* All the following energy comparison are done in Q16 */ + rms_L_fx = L_shl( rms_L_fx, sub( Q16, q_rms_L ) ); /* All the following energy comparison are done in Q16 */ rms_R_fx = L_shl( rms_R_fx, sub( Q16, q_rms_R ) ); #endif test(); @@ -655,7 +655,7 @@ Word16 stereo_tdm_ener_analysis_fx( #ifdef FIX_ISSUE_1125 ratio_L_fx = tdm_ratio_tabl_fx_Q30[idx]; // Q30 #else - ratio_L_fx = tdm_ratio_tabl_fx[idx]; // Q31 + ratio_L_fx = tdm_ratio_tabl_fx[idx]; // Q31 #endif move32(); @@ -666,7 +666,7 @@ Word16 stereo_tdm_ener_analysis_fx( #ifdef FIX_ISSUE_1125 ratio_L_fx = tdm_ratio_tabl_fx_Q30[idx]; // Q30 #else - ratio_L_fx = tdm_ratio_tabl_fx[idx]; // Q31 + ratio_L_fx = tdm_ratio_tabl_fx[idx]; // Q31 #endif move32(); } @@ -1076,9 +1076,9 @@ static void NOOP_decision_fx( ELSE { #ifdef FIX_1301_CORRECT_TD_CNST - if ( LT_32( sts[0]->ee_old_fx, 320000 /* 5000.f in Q6 */ ) && LT_32( sts[1]->ee_old_fx, 320000 /* 5000.f in Q6 */ ) ) + if ( LT_32( sts[0]->ee_old_fx, 320000 /* 5000.f in Q6 */ ) && LT_32( sts[1]->ee_old_fx, 320000 /* 5000.f in Q6 */ ) ) #else - if ( LT_32( sts[0]->ee_old_fx, 160000 /* 5000.f in Q6 */ ) && LT_32( sts[1]->ee_old_fx, 160000 /* 5000.f in Q6 */ ) ) + if ( LT_32( sts[0]->ee_old_fx, 160000 /* 5000.f in Q6 */ ) && LT_32( sts[1]->ee_old_fx, 160000 /* 5000.f in Q6 */ ) ) #endif { tdm_NOOP_switch_flag = 1; -- GitLab From 0cfe1705750f642dcf30a2e96e7d737396a55504 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Tue, 25 Feb 2025 19:09:18 +0530 Subject: [PATCH 109/113] Fix for 3GPP issue 1291: Wrong use of imult1616() in ACELP rescaling - 2 Correction for L_frame=320 --- lib_dec/acelp_core_dec_ivas_fx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_dec/acelp_core_dec_ivas_fx.c b/lib_dec/acelp_core_dec_ivas_fx.c index e9e4625ce..712a3339f 100644 --- a/lib_dec/acelp_core_dec_ivas_fx.c +++ b/lib_dec/acelp_core_dec_ivas_fx.c @@ -749,7 +749,7 @@ ivas_error acelp_core_dec_ivas_fx( { Rescale_exc( st->hMusicPF->dct_post_old_exc_fx, exc_fx, bwe_exc_fx, st->hGSCDec->last_exc_dct_in_fx, st->L_frame, #ifdef FIX_ISSUE_1291 - shr( imult1616( st->L_frame, HIBND_ACB_L_FAC_Q1 ), 1 ), 0, &( st->Q_exc ), st->Q_subfr, NULL, 0, INACTIVE ); + L_FRAME32k, 0, &( st->Q_exc ), st->Q_subfr, NULL, 0, INACTIVE ); #else imult1616( st->L_frame, HIBND_ACB_L_FAC ), 0, &( st->Q_exc ), st->Q_subfr, NULL, 0, INACTIVE ); #endif @@ -803,7 +803,7 @@ ivas_error acelp_core_dec_ivas_fx( Copy( syn1_fx + st->L_frame - L_SYN_MEM_CLAS_ESTIM, st->mem_syn_clas_estim_fx, L_SYN_MEM_CLAS_ESTIM ); /* save and delay synthesis to be used by SWB BWE */ - Copy_Scale_sig( syn1_fx, temp_buf_fx, st->L_frame, sub( -1, st->Q_syn ) ); // Q_syn + Copy_Scale_sig( syn1_fx, temp_buf_fx, st->L_frame, sub( -1, st->Q_syn ) ); // Q_syn -> Q(-1) IF( st->hBWE_FD != NULL ) { #ifdef FIX_ISSUE_1290 -- GitLab From a1211a4adebb7620583a6b5002d6de1234f0da49 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 26 Feb 2025 08:42:58 +0100 Subject: [PATCH 110/113] fix weird CI errors by pulling branches explicitly from origin --- .gitlab-ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ef9e8cc54..16f8030ef 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -223,7 +223,7 @@ stages: - current_commit_sha=$(git rev-parse HEAD) ### build reference binaries - git checkout $FLOAT_REF_BRANCH - - git pull + - git pull origin $FLOAT_REF_BRANCH - *activate-debug-mode-info-if-set - make clean - make -j @@ -239,7 +239,7 @@ stages: - current_commit_sha=$(git rev-parse HEAD) ### build merge target binaries - git checkout $CI_MERGE_REQUEST_TARGET_BRANCH_NAME - - git pull + - git pull $CI_MERGE_REQUEST_TARGET_BRANCH_NAME - *activate-debug-mode-info-if-set - make clean - make -j @@ -278,7 +278,7 @@ stages: - git fetch - git restore . # Just as a precaution - git checkout $BASOP_CI_BRANCH_PC_REPO - - git pull + - git pull $BASOP_CI_BRANCH_PC_REPO - cd - - cp -r $SCRIPTS_DIR/ci . - cp -r $SCRIPTS_DIR/scripts . -- GitLab From 39798c72231ddba0a3487ddded22d78e2d0b2f71 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 26 Feb 2025 08:45:14 +0100 Subject: [PATCH 111/113] fix git pull commands - forgot "origin" --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 16f8030ef..0613f3af7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -239,7 +239,7 @@ stages: - current_commit_sha=$(git rev-parse HEAD) ### build merge target binaries - git checkout $CI_MERGE_REQUEST_TARGET_BRANCH_NAME - - git pull $CI_MERGE_REQUEST_TARGET_BRANCH_NAME + - git pull origin $CI_MERGE_REQUEST_TARGET_BRANCH_NAME - *activate-debug-mode-info-if-set - make clean - make -j @@ -278,7 +278,7 @@ stages: - git fetch - git restore . # Just as a precaution - git checkout $BASOP_CI_BRANCH_PC_REPO - - git pull $BASOP_CI_BRANCH_PC_REPO + - git pull origin $BASOP_CI_BRANCH_PC_REPO - cd - - cp -r $SCRIPTS_DIR/ci . - cp -r $SCRIPTS_DIR/scripts . -- GitLab From 4411e4bb692ed7f3a893596525044e1d910bafaa Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 26 Feb 2025 09:26:15 +0100 Subject: [PATCH 112/113] dummy commit to trigger CI -- GitLab From 76b5ae0a23945c3d3e627331d696efd62d808b5e Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 26 Feb 2025 10:24:35 +0100 Subject: [PATCH 113/113] dummy commit to trigger CI -- GitLab