From 8e367bab2734ab4b783aa6f99806e558a92086fa Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Mon, 17 Jun 2024 15:03:42 -0400 Subject: [PATCH 1/5] 798 Fix proposal, modifications under FIX_798_LSF_SECONDARY_CH_MISSING_CODE and FIX_798_WRONG_CPY_OF_PITCH --- lib_com/bits_alloc_fx.c | 4 +-- lib_com/ivas_stereo_td_bit_alloc.c | 19 ++++++++++- lib_com/options.h | 2 ++ lib_com/prot_fx2.h | 6 ++-- lib_dec/acelp_core_dec_fx.c | 2 +- lib_dec/acelp_core_dec_ivas_fx.c | 4 +++ lib_dec/cng_dec_fx.c | 2 +- lib_dec/dlpc_stoch_fx.c | 6 ++-- lib_dec/lsf_dec_fx.c | 54 ++++++++++++++++-------------- 9 files changed, 62 insertions(+), 37 deletions(-) diff --git a/lib_com/bits_alloc_fx.c b/lib_com/bits_alloc_fx.c index 514a9f894..5d3fc0dcf 100644 --- a/lib_com/bits_alloc_fx.c +++ b/lib_com/bits_alloc_fx.c @@ -823,7 +823,7 @@ ivas_error config_acelp1( bits -= acelp_cfg->mid_lsf_bits; } -#ifdef LSF_RE_USE_SECONDARY_CHANNEL +#if defined LSF_RE_USE_SECONDARY_CHANNEL || defined FIX_798_LSF_SECONDARY_CH_MISSING_CODE else if ( tdm_lp_reuse_flag == 1 && idchan == 1 && active_cnt != 1 ) { bits -= TDM_IC_LSF_PRED_BITS; @@ -1384,7 +1384,7 @@ ivas_error config_acelp1( { if ( idchan > 0 && element_mode == IVAS_CPE_TD ) { -#ifdef LSF_RE_USE_SECONDARY_CHANNEL +#if defined LSF_RE_USE_SECONDARY_CHANNEL || defined FIX_798_LSF_SECONDARY_CH_MISSING_CODE if ( !tdm_lp_reuse_flag ) { acelp_cfg->lsf_bits += bits; /* increase LSF Q bits */ diff --git a/lib_com/ivas_stereo_td_bit_alloc.c b/lib_com/ivas_stereo_td_bit_alloc.c index 1458bc8e6..326eae880 100644 --- a/lib_com/ivas_stereo_td_bit_alloc.c +++ b/lib_com/ivas_stereo_td_bit_alloc.c @@ -893,7 +893,24 @@ void td_stereo_param_updt_fx( Copy( lsp_old_PCh_fx, tdm_lspQ_PCh_fx, M ); Copy( lsf_old_PCh_fx, tdm_lsfQ_PCh_fx, M ); } +#ifdef FIX_798_WRONG_CPY_OF_PITCH + IF( EQ_16( flag_ACELP16k , 1 ) ) + { + Word16 tmp16; + Word16 mult_factor = 26214 /*0.8f in Q15*/; + FOR( i = 0; i < NB_SUBFR; i++ ) + { + tmp16 = mult_r( pitch_buf_PCh_fx[i], mult_factor ); /* Convert 16kHz to 12.8 kHz pitch values */ + tdm_Pri_pitch_buf_fx[i] = s_max( tmp16, PIT_MIN << 6 ); /* pitch is represented in Q6*/ + move16(); + } + } + ELSE + { + Copy( pitch_buf_PCh_fx, tdm_Pri_pitch_buf_fx, NB_SUBFR ); + } +#else /* This is only to keep the buffer up-to-date */ Word16 mult_factor = 26214 /*0.8f in Q15*/; Word16 min_tdm_Pri_pitch_buf_fx = 0; @@ -919,7 +936,7 @@ void td_stereo_param_updt_fx( { Copy( pitch_buf_PCh_fx, tdm_Pri_pitch_buf_fx, NB_SUBFR ); } - +#endif return; } #endif diff --git a/lib_com/options.h b/lib_com/options.h index 5a6238041..54efb5ce1 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -146,6 +146,8 @@ #define FIX_778_STEREO_BRATE_SWITCHING #define FIX_774_ENERGY_BURST /* Fix 0 bit BWE */ #define FIX_729_MISSING_RESCALING +#define FIX_798_LSF_SECONDARY_CH_MISSING_CODE /* Adding the missing code to properly render the secondary channel of TD stereo*/ +#define FIX_798_WRONG_CPY_OF_PITCH /* The copy of the pitch from primary to secondary channel was wrong AND safety check was really wrong */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_com/prot_fx2.h b/lib_com/prot_fx2.h index 12927bceb..131a12285 100644 --- a/lib_com/prot_fx2.h +++ b/lib_com/prot_fx2.h @@ -5501,7 +5501,7 @@ void lsf_dec_fx( Word16 *lsp_new, /* o : de-quantized LSP vector */ Word16 *lsp_mid, /* o : de-quantized mid-frame LSP vector */ const Word16 tdm_low_rate_mode /* i : secondary channel low rate mode flag */ -#ifdef LSF_RE_USE_SECONDARY_CHANNEL +#if defined LSF_RE_USE_SECONDARY_CHANNEL || defined FIX_798_LSF_SECONDARY_CH_MISSING_CODE , const Word16 tdm_lsfQ_PCh[M] /* i : Q LSFs for primary channel */ #endif @@ -5615,9 +5615,9 @@ void lsf_end_dec_fx( Word16 *lpc_param, Word16 *LSF_Q_prediction, /* o : LSF prediction mode */ Word16 *nb_indices -#ifdef LSF_RE_USE_SECONDARY_CHANNEL +#if defined LSF_RE_USE_SECONDARY_CHANNEL || defined FIX_798_LSF_SECONDARY_CH_MISSING_CODE , - const float tdm_lsfQ_PCh[M] + const Word16 tdm_lsfQ_PCh[M] #endif ); diff --git a/lib_dec/acelp_core_dec_fx.c b/lib_dec/acelp_core_dec_fx.c index dd25918d2..c3cf9be3b 100644 --- a/lib_dec/acelp_core_dec_fx.c +++ b/lib_dec/acelp_core_dec_fx.c @@ -801,7 +801,7 @@ ivas_error acelp_core_dec_fx( #endif { lsf_dec_fx( st_fx, tc_subfr_fx, Aq_fx, &LSF_Q_prediction, lsf_new_fx, lsp_new_fx, lsp_mid_fx, tdm_low_rate_mode -#ifdef LSF_RE_USE_SECONDARY_CHANNEL +#if defined LSF_RE_USE_SECONDARY_CHANNEL || defined FIX_798_LSF_SECONDARY_CH_MISSING_CODE , tdm_lsfQ_PCh #endif diff --git a/lib_dec/acelp_core_dec_ivas_fx.c b/lib_dec/acelp_core_dec_ivas_fx.c index 89559d6c2..7722df190 100644 --- a/lib_dec/acelp_core_dec_ivas_fx.c +++ b/lib_dec/acelp_core_dec_ivas_fx.c @@ -755,7 +755,11 @@ ivas_error acelp_core_dec_ivas_fx( if ( !tdm_lp_reuse_flag ) { +#ifdef FIX_798_LSF_SECONDARY_CH_MISSING_CODE + lsf_dec_fx( st, tc_subfr, Aq_fx, &LSF_Q_prediction, lsf_new_fx, lsp_new_fx, lsp_mid_fx, tdm_low_rate_mode , tdm_lsfQ_PCh_fx ); +#else lsf_dec_fx( st, tc_subfr, Aq_fx, &LSF_Q_prediction, lsf_new_fx, lsp_new_fx, lsp_mid_fx, tdm_low_rate_mode /*, tdm_lsfQ_PCh*/ ); +#endif } else { diff --git a/lib_dec/cng_dec_fx.c b/lib_dec/cng_dec_fx.c index 1c5628c8c..d68b63446 100644 --- a/lib_dec/cng_dec_fx.c +++ b/lib_dec/cng_dec_fx.c @@ -114,7 +114,7 @@ void CNG_dec_fx( ELSE { lsf_dec_fx( st_fx, 0, Aq, &LSF_Q_prediction, lsf_new, lsp_new, 0, 0 -#ifdef LSF_RE_USE_SECONDARY_CHANNEL +#if defined LSF_RE_USE_SECONDARY_CHANNEL || defined FIX_798_LSF_SECONDARY_CH_MISSING_CODE , NULL #endif diff --git a/lib_dec/dlpc_stoch_fx.c b/lib_dec/dlpc_stoch_fx.c index c024f1622..83436ea99 100644 --- a/lib_dec/dlpc_stoch_fx.c +++ b/lib_dec/dlpc_stoch_fx.c @@ -51,7 +51,7 @@ void lpc_unquantize_fx( IF( ( EQ_32( st->sr_core, INT_FS_16k ) ) && ( EQ_16( coder_type, UNVOICED ) ) ) { lsf_end_dec_fx( st, 1, GENERIC, sub( 1, st->narrowBand ) /* st->bwidth */, ENDLSF_NBITS, &lsf[m], param_lpc, LSF_Q_prediction, &nb_indices -#ifdef LSF_RE_USE_SECONDARY_CHANNEL +#if defined LSF_RE_USE_SECONDARY_CHANNEL || defined FIX_798_LSF_SECONDARY_CH_MISSING_CODE , NULL #endif @@ -62,7 +62,7 @@ void lpc_unquantize_fx( IF( EQ_16( st->core, TCX_20_CORE ) ) { lsf_end_dec_fx( st, 1, AUDIO, sub( 1, st->narrowBand ) /* st->bwidth */, ENDLSF_NBITS, &lsf[m], param_lpc, LSF_Q_prediction, &nb_indices -#ifdef LSF_RE_USE_SECONDARY_CHANNEL +#if defined LSF_RE_USE_SECONDARY_CHANNEL || defined FIX_798_LSF_SECONDARY_CH_MISSING_CODE , NULL #endif @@ -71,7 +71,7 @@ void lpc_unquantize_fx( ELSE { lsf_end_dec_fx( st, 1, coder_type, sub( 1, st->narrowBand ) /* st->bwidth */, ENDLSF_NBITS, &lsf[m], param_lpc, LSF_Q_prediction, &nb_indices -#ifdef LSF_RE_USE_SECONDARY_CHANNEL +#if defined LSF_RE_USE_SECONDARY_CHANNEL || defined FIX_798_LSF_SECONDARY_CH_MISSING_CODE , NULL #endif diff --git a/lib_dec/lsf_dec_fx.c b/lib_dec/lsf_dec_fx.c index 407ea463f..1324c2071 100644 --- a/lib_dec/lsf_dec_fx.c +++ b/lib_dec/lsf_dec_fx.c @@ -8,9 +8,9 @@ #include "rom_com.h" /* Static table prototypes */ #include "prot_fx1.h" /* Function prototypes */ #include "prot_fx2.h" /* Function prototypes */ -#ifdef LSF_RE_USE_SECONDARY_CHANNEL +#if defined LSF_RE_USE_SECONDARY_CHANNEL || defined FIX_798_LSF_SECONDARY_CH_MISSING_CODE #include "ivas_prot.h" -#include "ivas_rom_com.h" +//#include "ivas_rom_com.h" #endif /*-------------------------------------------------------------------* * Local functions @@ -110,7 +110,7 @@ void lsf_dec_fx( Word16 *lsp_new, /* o : de-quantized LSP vector */ Word16 *lsp_mid, /* o : de-quantized mid-frame LSP vector */ const Word16 tdm_low_rate_mode /* i : secondary channel low rate mode flag */ -#ifdef LSF_RE_USE_SECONDARY_CHANNEL +#if defined LSF_RE_USE_SECONDARY_CHANNEL || defined FIX_798_LSF_SECONDARY_CH_MISSING_CODE , const Word16 tdm_lsfQ_PCh[M] /* i : Q LSFs for primary channel */ #endif @@ -124,9 +124,7 @@ void lsf_dec_fx( Word16 tmp_old[M + 1], tmp_new[M + 1]; Word16 enr_old = 0, enr_new = 0; Word16 lsf_diff, coder_type; -#ifdef REMOVE_IVAS_UNUSED_PARAMETERS_WARNING - (void) ( tdm_low_rate_mode ); -#endif + /* initialize */ coder_type = st_fx->coder_type; if ( EQ_32( st_fx->core_brate, SID_2k40 ) ) @@ -180,7 +178,12 @@ void lsf_dec_fx( } /* LSF de-quantization */ - lsf_end_dec_fx( st_fx, 0, coder_type, st_fx->bwidth, nBits, lsf_new, param_lpc, LSF_Q_prediction, &no_param_lpc ); + lsf_end_dec_fx( st_fx, 0, coder_type, st_fx->bwidth, nBits, lsf_new, param_lpc, LSF_Q_prediction, &no_param_lpc +#ifdef FIX_798_LSF_SECONDARY_CH_MISSING_CODE + , + tdm_lsfQ_PCh +#endif + ); /* convert quantized LSFs to LSPs */ @@ -367,7 +370,7 @@ void lsf_end_dec_fx( Word16 *lpc_param, /* i : LPC parameters */ Word16 *LSF_Q_prediction, /* o : LSF prediction mode */ Word16 *nb_indices /* o : number of indices */ -#ifdef LSF_RE_USE_SECONDARY_CHANNEL +#if defined LSF_RE_USE_SECONDARY_CHANNEL || defined FIX_798_LSF_SECONDARY_CH_MISSING_CODE , const Word16 tdm_lsfQ_PCh[M] /* i : Q LSFs for primary channel */ #endif @@ -395,7 +398,7 @@ void lsf_end_dec_fx( Word16 coder_type; Word16 ber_flag; Word16 flag_1bit_gran; -#ifdef LSF_RE_USE_SECONDARY_CHANNEL +#if defined LSF_RE_USE_SECONDARY_CHANNEL || defined FIX_798_LSF_SECONDARY_CH_MISSING_CODE Word16 pred3[M]; #endif flag_1bit_gran = (Word16) GT_16( st->element_mode, EVS_MONO ); @@ -456,7 +459,7 @@ void lsf_end_dec_fx( /*--------------------------------------------------------------------------* * Select safety_net or predictive mode *--------------------------------------------------------------------------*/ -#ifdef LSF_RE_USE_SECONDARY_CHANNEL +#if defined LSF_RE_USE_SECONDARY_CHANNEL || defined FIX_798_LSF_SECONDARY_CH_MISSING_CODE IF( st->tdm_LRTD_flag == 0 && EQ_16( st->idchan, 1 ) && tdm_lsfQ_PCh != NULL ) { /* if secondary channel predmode is set to be > 2 */ @@ -500,16 +503,15 @@ void lsf_end_dec_fx( /*--------------------------------------------------------------------------* * Read indices from array *--------------------------------------------------------------------------*/ -#ifdef LSF_RE_USE_SECONDARY_CHANNEL +#if defined LSF_RE_USE_SECONDARY_CHANNEL || defined FIX_798_LSF_SECONDARY_CH_MISSING_CODE /* Make sure there are the correct bit allocations */ - IF( st->idchan == 1 && predmode > 2 ) + IF( EQ_16(st->idchan, 1) && GT_16(predmode, 2) ) { - PMTE() /* use same AR prediction bit allocation for intra and inter modes*/ - lsf_allocate( nBits - 1, mode_lvq, 9, &stages0, &stages1, levels0, levels1, bits0, bits1 ); + lsf_allocate_fx( nBits - 1, mode_lvq, 9, &stages0, &stages1, levels0, levels1, bits0, bits1 ); stages0 = stages1; - mvs2s( levels1, levels0, stages0 ); - mvs2s( bits1, bits0, stages0 ); + Copy( levels1, levels0, stages0 ); + Copy( bits1, bits0, stages0 ); } #endif @@ -680,26 +682,26 @@ void lsf_end_dec_fx( { pred1[i] = add( pred0[i], mult_r( MU_MA_FX, st->mem_MA_fx[i] ) ); } -#ifdef LSF_RE_USE_SECONDARY_CHANNEL +#if defined LSF_RE_USE_SECONDARY_CHANNEL || defined FIX_798_LSF_SECONDARY_CH_MISSING_CODE /* TD stereo SCh: perform intra-frame prediction with pulling-to-mean */ - if ( st->tdm_LRTD_flag == 0 && st->idchan == 1 && tdm_lsfQ_PCh != NULL ) + if ( st->tdm_LRTD_flag == 0 && EQ_16(st->idchan, 1) && tdm_lsfQ_PCh != NULL ) { - tdm_SCh_LSF_intra_pred( st->element_brate, tdm_lsfQ_PCh, pred3 ); + tdm_SCh_LSF_intra_pred_fx( st->element_brate, tdm_lsfQ_PCh, pred3 ); } #endif IF( safety_net ) { /* LVQ */ -#ifdef LSF_RE_USE_SECONDARY_CHANNEL - if ( st->tdm_LRTD_flag == 0 && st->idchan == 1 && tdm_lsfQ_PCh != NULL ) +#if defined LSF_RE_USE_SECONDARY_CHANNEL || defined FIX_798_LSF_SECONDARY_CH_MISSING_CODE + if ( st->tdm_LRTD_flag == 0 && EQ_16( st->idchan, 1 ) && tdm_lsfQ_PCh != NULL ) { /* intra mode*/ st->BER_detect = st->BER_detect | - vq_dec_lvq( 0, qlsf, &lindice[1], stages0, M, 9, /*mode_lvq_p,*/ levels0[stages0 - 1] ); + vq_dec_lvq_ivas_fx( 0, qlsf, &lindice[1], stages0, M, 9, levels0[stages0 - 1] ); - v_add( qlsf, pred3, qlsf, M ); - v_sub( qlsf, pred1, st->mem_MA, M ); + Vr_add( qlsf, pred3, qlsf, M ); + Vr_subt( qlsf, pred1, st->mem_MA_fx, M ); } else #endif @@ -721,7 +723,7 @@ void lsf_end_dec_fx( } ELSE { -#ifdef LSF_RE_USE_SECONDARY_CHANNEL +#if defined LSF_RE_USE_SECONDARY_CHANNEL || defined FIX_798_LSF_SECONDARY_CH_MISSING_CODE IF( EQ_16( predmode, 4 ) ) { mode_lvq_p = 9; @@ -741,7 +743,7 @@ void lsf_end_dec_fx( &st->no_scales_fx[0][0], &st->no_scales_p_fx[0][0] ); } st->BER_detect = s_or( st->BER_detect, ber_flag ); -#ifdef LSF_RE_USE_SECONDARY_CHANNEL +#if defined LSF_RE_USE_SECONDARY_CHANNEL || defined FIX_798_LSF_SECONDARY_CH_MISSING_CODE test(); IF( EQ_16( predmode, 1 ) || EQ_16( predmode, 4 ) ) /* MA only */ #else -- GitLab From a2d668cd05f83f4db53c99cb5d6c3c2ef28001ba Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Mon, 17 Jun 2024 18:49:59 -0400 Subject: [PATCH 2/5] fix clang_format --- lib_com/ivas_stereo_td_bit_alloc.c | 3 ++- lib_dec/acelp_core_dec_ivas_fx.c | 2 +- lib_dec/lsf_dec_fx.c | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib_com/ivas_stereo_td_bit_alloc.c b/lib_com/ivas_stereo_td_bit_alloc.c index 326eae880..d86e0a3d7 100644 --- a/lib_com/ivas_stereo_td_bit_alloc.c +++ b/lib_com/ivas_stereo_td_bit_alloc.c @@ -894,7 +894,8 @@ void td_stereo_param_updt_fx( Copy( lsf_old_PCh_fx, tdm_lsfQ_PCh_fx, M ); } #ifdef FIX_798_WRONG_CPY_OF_PITCH - IF( EQ_16( flag_ACELP16k , 1 ) ) + Q_var = 0; + IF( EQ_16( flag_ACELP16k, 1 ) ) { Word16 tmp16; Word16 mult_factor = 26214 /*0.8f in Q15*/; diff --git a/lib_dec/acelp_core_dec_ivas_fx.c b/lib_dec/acelp_core_dec_ivas_fx.c index 7722df190..57ac9397a 100644 --- a/lib_dec/acelp_core_dec_ivas_fx.c +++ b/lib_dec/acelp_core_dec_ivas_fx.c @@ -756,7 +756,7 @@ ivas_error acelp_core_dec_ivas_fx( if ( !tdm_lp_reuse_flag ) { #ifdef FIX_798_LSF_SECONDARY_CH_MISSING_CODE - lsf_dec_fx( st, tc_subfr, Aq_fx, &LSF_Q_prediction, lsf_new_fx, lsp_new_fx, lsp_mid_fx, tdm_low_rate_mode , tdm_lsfQ_PCh_fx ); + lsf_dec_fx( st, tc_subfr, Aq_fx, &LSF_Q_prediction, lsf_new_fx, lsp_new_fx, lsp_mid_fx, tdm_low_rate_mode, tdm_lsfQ_PCh_fx ); #else lsf_dec_fx( st, tc_subfr, Aq_fx, &LSF_Q_prediction, lsf_new_fx, lsp_new_fx, lsp_mid_fx, tdm_low_rate_mode /*, tdm_lsfQ_PCh*/ ); #endif diff --git a/lib_dec/lsf_dec_fx.c b/lib_dec/lsf_dec_fx.c index 1324c2071..9ba2e84d7 100644 --- a/lib_dec/lsf_dec_fx.c +++ b/lib_dec/lsf_dec_fx.c @@ -505,7 +505,7 @@ void lsf_end_dec_fx( *--------------------------------------------------------------------------*/ #if defined LSF_RE_USE_SECONDARY_CHANNEL || defined FIX_798_LSF_SECONDARY_CH_MISSING_CODE /* Make sure there are the correct bit allocations */ - IF( EQ_16(st->idchan, 1) && GT_16(predmode, 2) ) + IF( EQ_16( st->idchan, 1 ) && GT_16( predmode, 2 ) ) { /* use same AR prediction bit allocation for intra and inter modes*/ lsf_allocate_fx( nBits - 1, mode_lvq, 9, &stages0, &stages1, levels0, levels1, bits0, bits1 ); @@ -684,7 +684,7 @@ void lsf_end_dec_fx( } #if defined LSF_RE_USE_SECONDARY_CHANNEL || defined FIX_798_LSF_SECONDARY_CH_MISSING_CODE /* TD stereo SCh: perform intra-frame prediction with pulling-to-mean */ - if ( st->tdm_LRTD_flag == 0 && EQ_16(st->idchan, 1) && tdm_lsfQ_PCh != NULL ) + if ( st->tdm_LRTD_flag == 0 && EQ_16( st->idchan, 1 ) && tdm_lsfQ_PCh != NULL ) { tdm_SCh_LSF_intra_pred_fx( st->element_brate, tdm_lsfQ_PCh, pred3 ); } -- GitLab From f4fa28668df6405bac23f97509a650aafe8d1e8c Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Mon, 17 Jun 2024 18:55:21 -0400 Subject: [PATCH 3/5] fix gcc warning --- lib_com/ivas_stereo_td_bit_alloc.c | 9 ++++++--- lib_dec/ivas_core_dec.c | 7 ++++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/lib_com/ivas_stereo_td_bit_alloc.c b/lib_com/ivas_stereo_td_bit_alloc.c index d86e0a3d7..78fb93730 100644 --- a/lib_com/ivas_stereo_td_bit_alloc.c +++ b/lib_com/ivas_stereo_td_bit_alloc.c @@ -871,8 +871,12 @@ void td_stereo_param_updt_fx( Word16 tdm_lsfQ_PCh_fx[], /* o : Q LSFs for primary channel Qx2.56*/ Word16 tdm_Pri_pitch_buf_fx[], /* o : pitch values for primary channel Q_var */ const Word16 flag_ACELP16k, /* i : ACELP@16kHz flag */ - const Word16 tdm_use_IAWB_Ave_lpc, /* i : flag to indicate the usage of mean inactive LP coefficients */ - Word16 Q_var ) + const Word16 tdm_use_IAWB_Ave_lpc /* i : flag to indicate the usage of mean inactive LP coefficients */ +#ifndef FIX_798_WRONG_CPY_OF_PITCH + , + Word16 Q_var +#endif +) { Word16 i; /* Copy some primary channel information into the secondary channel structure for later usage */ @@ -894,7 +898,6 @@ void td_stereo_param_updt_fx( Copy( lsf_old_PCh_fx, tdm_lsfQ_PCh_fx, M ); } #ifdef FIX_798_WRONG_CPY_OF_PITCH - Q_var = 0; IF( EQ_16( flag_ACELP16k, 1 ) ) { Word16 tmp16; diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c index 0bccf0c82..667dd2902 100644 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -538,7 +538,12 @@ ivas_error ivas_core_dec( Copy_Scale_sig_32_16( hCPE->hCoreCoder[0]->old_pitch_buf_fx, hCPE->hCoreCoder[0]->old_pitch_buf_16_fx, 2 * NB_SUBFR16k + 2, -10 ); td_stereo_param_updt_fx( st->lsp_old_fx, st->lsf_old_fx, st->old_pitch_buf_16_fx + st->nb_subfr, - tdm_lspQ_PCh_fx, tdm_lsfQ_PCh_fx, hStereoTD->tdm_Pri_pitch_buf_fx, st->flag_ACELP16k, hStereoTD->tdm_use_IAWB_Ave_lpc, Q6 ); + tdm_lspQ_PCh_fx, tdm_lsfQ_PCh_fx, hStereoTD->tdm_Pri_pitch_buf_fx, st->flag_ACELP16k, hStereoTD->tdm_use_IAWB_Ave_lpc +#ifndef FIX_798_WRONG_CPY_OF_PITCH + , + Q6 +#endif + ); Copy_Scale_sig_16_32( hCPE->hCoreCoder[0]->old_pitch_buf_16_fx, hCPE->hCoreCoder[0]->old_pitch_buf_fx, 2 * NB_SUBFR16k + 2, 10 ); } -- GitLab From 05eab919b5820b7c41527928ab6328da3d7d7654 Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Mon, 17 Jun 2024 19:05:19 -0400 Subject: [PATCH 4/5] fix gcc error --- lib_com/ivas_prot_fx.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index e91e31d23..d093336b6 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -835,8 +835,12 @@ void td_stereo_param_updt_fx( Word16 tdm_lsfQ_PCh[], /* o : Q LSFs for primary channel */ Word16 tdm_Pri_pitch_buf[], /* o : pitch values for primary channel */ const Word16 flag_ACELP16k, /* i : ACELP@16kHz flag */ - const Word16 tdm_use_IAWB_Ave_lpc, /* i : flag to indicate the usage of mean inactive LP coefficients */ - Word16 Q_var ); + const Word16 tdm_use_IAWB_Ave_lpc /* i : flag to indicate the usage of mean inactive LP coefficients */ +#ifndef FIX_798_WRONG_CPY_OF_PITCH + , + Word16 Q_var +#endif +); void updateBuffersForDmxMdctStereo_fx( CPE_DEC_HANDLE hCPE, /* i/o: CPE handle */ -- GitLab From 4ab99a122f49adb21ce4ac2fbe8ee7b57b14c2da Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Mon, 17 Jun 2024 19:43:54 -0400 Subject: [PATCH 5/5] fix again clang formatting --- lib_com/ivas_prot_fx.h | 18 +++++++++--------- lib_com/ivas_stereo_td_bit_alloc.c | 20 ++++++++++---------- lib_dec/ivas_core_dec.c | 2 +- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index d093336b6..91be1b984 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -828,17 +828,17 @@ void ivas_lfe_dec_close_fx( void td_stereo_param_updt_fx( - const Word16 lsp_old_PCh[], /* i : primary channel old LSPs */ - const Word16 lsf_old_PCh[], /* i : primary channel old LSFs */ - const Word16 pitch_buf_PCh[], /* i : primary channel pitch buffer */ - Word16 tdm_lspQ_PCh[], /* o : Q LSPs for primary channel */ - Word16 tdm_lsfQ_PCh[], /* o : Q LSFs for primary channel */ - Word16 tdm_Pri_pitch_buf[], /* o : pitch values for primary channel */ - const Word16 flag_ACELP16k, /* i : ACELP@16kHz flag */ - const Word16 tdm_use_IAWB_Ave_lpc /* i : flag to indicate the usage of mean inactive LP coefficients */ + const Word16 lsp_old_PCh[], /* i : primary channel old LSPs */ + const Word16 lsf_old_PCh[], /* i : primary channel old LSFs */ + const Word16 pitch_buf_PCh[], /* i : primary channel pitch buffer */ + Word16 tdm_lspQ_PCh[], /* o : Q LSPs for primary channel */ + Word16 tdm_lsfQ_PCh[], /* o : Q LSFs for primary channel */ + Word16 tdm_Pri_pitch_buf[], /* o : pitch values for primary channel */ + const Word16 flag_ACELP16k, /* i : ACELP@16kHz flag */ + const Word16 tdm_use_IAWB_Ave_lpc /* i : flag to indicate the usage of mean inactive LP coefficients */ #ifndef FIX_798_WRONG_CPY_OF_PITCH , - Word16 Q_var + Word16 Q_var #endif ); diff --git a/lib_com/ivas_stereo_td_bit_alloc.c b/lib_com/ivas_stereo_td_bit_alloc.c index 78fb93730..2ca004b6e 100644 --- a/lib_com/ivas_stereo_td_bit_alloc.c +++ b/lib_com/ivas_stereo_td_bit_alloc.c @@ -864,17 +864,17 @@ void td_stereo_param_updt( #ifdef IVAS_FLOAT_FIXED void td_stereo_param_updt_fx( - const Word16 lsp_old_PCh_fx[], /* i : primary channel old LSPs Q15*/ - const Word16 lsf_old_PCh_fx[], /* i : primary channel old LSFs Qx2.56*/ - const Word16 pitch_buf_PCh_fx[], /* i : primary channel pitch buffer Q_var*/ - Word16 tdm_lspQ_PCh_fx[], /* o : Q LSPs for primary channel Q15*/ - Word16 tdm_lsfQ_PCh_fx[], /* o : Q LSFs for primary channel Qx2.56*/ - Word16 tdm_Pri_pitch_buf_fx[], /* o : pitch values for primary channel Q_var */ - const Word16 flag_ACELP16k, /* i : ACELP@16kHz flag */ - const Word16 tdm_use_IAWB_Ave_lpc /* i : flag to indicate the usage of mean inactive LP coefficients */ + const Word16 lsp_old_PCh_fx[], /* i : primary channel old LSPs Q15*/ + const Word16 lsf_old_PCh_fx[], /* i : primary channel old LSFs Qx2.56*/ + const Word16 pitch_buf_PCh_fx[], /* i : primary channel pitch buffer Q_var*/ + Word16 tdm_lspQ_PCh_fx[], /* o : Q LSPs for primary channel Q15*/ + Word16 tdm_lsfQ_PCh_fx[], /* o : Q LSFs for primary channel Qx2.56*/ + Word16 tdm_Pri_pitch_buf_fx[], /* o : pitch values for primary channel Q_var */ + const Word16 flag_ACELP16k, /* i : ACELP@16kHz flag */ + const Word16 tdm_use_IAWB_Ave_lpc /* i : flag to indicate the usage of mean inactive LP coefficients */ #ifndef FIX_798_WRONG_CPY_OF_PITCH - , - Word16 Q_var + , + Word16 Q_var #endif ) { diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c index 667dd2902..70b47f009 100644 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -541,7 +541,7 @@ ivas_error ivas_core_dec( tdm_lspQ_PCh_fx, tdm_lsfQ_PCh_fx, hStereoTD->tdm_Pri_pitch_buf_fx, st->flag_ACELP16k, hStereoTD->tdm_use_IAWB_Ave_lpc #ifndef FIX_798_WRONG_CPY_OF_PITCH , - Q6 + Q6 #endif ); -- GitLab