# HG changeset patch # User Mychaela Falconia # Date 1669484891 0 # Node ID 77803ce2cc2247de2e5c322a5b944dc2c962c742 # Parent 03599300d2db9b1b95c0049475d7eef4afb5271a libgsmefr: q_plsf_5.c compiles diff -r 03599300d2db -r 77803ce2cc22 libgsmefr/Makefile --- a/libgsmefr/Makefile Sat Nov 26 11:21:22 2022 +0000 +++ b/libgsmefr/Makefile Sat Nov 26 17:48:11 2022 +0000 @@ -6,7 +6,7 @@ g_code.o g_pitch.o int_lpc.o inter_6.o inv_sqrt.o lag_wind.o levinson.o\ log2.o lsp_az.o lsp_lsf.o oper_32b.o params2frame.o pitch_f6.o \ pitch_ol.o pow2.o pre_proc.o pred_lt6.o preemph.o pstfilt2.o q_gains.o \ - sid_class.o sid_insert.o tls_flags.o + q_plsf_5.o sid_class.o sid_insert.o tls_flags.o HDRS= basic_op.h cnst.h codec.h d_homing.h dec_state.h dtx.h e_homing.h \ enc_state.h gains_tb.h gsm_efr.h memops.h namespace.h no_count.h \ oper_32b.h sig_proc.h typedef.h vad.h diff -r 03599300d2db -r 77803ce2cc22 libgsmefr/enc_state.h --- a/libgsmefr/enc_state.h Sat Nov 26 11:21:22 2022 +0000 +++ b/libgsmefr/enc_state.h Sat Nov 26 17:48:11 2022 +0000 @@ -32,6 +32,7 @@ } pre_proc; /* from q_plsf_5.c */ Word16 past_r2_q[M]; + Word16 lsf_p_CN[M]; /* from q_gains.c */ Word16 past_qua_en[4]; Word16 pred[4]; diff -r 03599300d2db -r 77803ce2cc22 libgsmefr/q_plsf_5.c --- a/libgsmefr/q_plsf_5.c Sat Nov 26 11:21:22 2022 +0000 +++ b/libgsmefr/q_plsf_5.c Sat Nov 26 17:48:11 2022 +0000 @@ -25,21 +25,26 @@ * *************************************************************************/ +#include "gsm_efr.h" #include "typedef.h" +#include "namespace.h" #include "basic_op.h" -#include "count.h" +#include "no_count.h" #include "sig_proc.h" +#include "codec.h" #include "cnst.h" #include "dtx.h" +#include "enc_state.h" /* Locals functions */ -void Lsf_wt ( +static void Lsf_wt ( Word16 *lsf, /* input : LSF vector */ Word16 *wf2 /* output: square of weighting factors */ ); +static Word16 Vq_subvec ( /* output: return quantization index */ Word16 *lsf_r1, /* input : 1st LSF residual vector */ Word16 *lsf_r2, /* input : and LSF residual vector */ @@ -48,6 +53,8 @@ Word16 *wf2, /* input : 2nd LSF weighting factors */ Word16 dico_size /* input : size of quantization codebook */ ); + +static Word16 Vq_subvec_s ( /* output: return quantization index */ Word16 *lsf_r1, /* input : 1st LSF residual vector */ Word16 *lsf_r2, /* input : and LSF residual vector */ @@ -56,6 +63,7 @@ Word16 *wf2, /* input : 2nd LSF weighting factors */ Word16 dico_size /* input : size of quantization codebook */ ); + /* M ->order of linear prediction filter */ /* LSF_GAP -> Minimum distance between LSF after quantization */ /* 50 Hz = 205 */ @@ -67,13 +75,8 @@ #include "q_plsf_5.tab" /* Codebooks of LSF prediction residual */ - /* Past quantized prediction error */ - -Word16 past_r2_q[M]; - -extern Word16 lsf_old_tx[DTX_HANGOVER][M]; - void Q_plsf_5 ( + struct EFR_encoder_state *st, Word16 *lsp1, /* input : 1st LSP vector */ Word16 *lsp2, /* input : 2nd LSP vector */ Word16 *lsp1_q, /* output: quantized 1st LSP vector */ @@ -86,7 +89,6 @@ Word16 lsf1[M], lsf2[M], wf1[M], wf2[M], lsf_p[M], lsf_r1[M], lsf_r2[M]; Word16 lsf1_q[M], lsf2_q[M]; Word16 lsf_aver[M]; - static Word16 lsf_p_CN[M]; /* convert LSFs to normalize frequency domain 0..16384 */ @@ -95,29 +97,25 @@ /* Update LSF CN quantizer "memory" */ - logic16 (); logic16 (); test (); test (); if ((txdtx_ctrl & TX_SP_FLAG) == 0 && (txdtx_ctrl & TX_PREV_HANGOVER_ACTIVE) != 0) { - update_lsf_p_CN (lsf_old_tx, lsf_p_CN); + update_lsf_p_CN (st->lsf_old_tx, st->lsf_p_CN); } - logic16 (); test (); if ((txdtx_ctrl & TX_SID_UPDATE) != 0) { /* New SID frame is to be sent: Compute average of the current LSFs and the LSFs in the history */ - aver_lsf_history (lsf_old_tx, lsf1, lsf2, lsf_aver); + aver_lsf_history (st->lsf_old_tx, lsf1, lsf2, lsf_aver); } /* Update LSF history with unquantized LSFs when no speech activity is present */ - logic16 (); test (); if ((txdtx_ctrl & TX_SP_FLAG) == 0) { - update_lsf_history (lsf1, lsf2, lsf_old_tx); + update_lsf_history (lsf1, lsf2, st->lsf_old_tx); } - logic16 (); test (); if ((txdtx_ctrl & TX_SID_UPDATE) != 0) { /* Compute LSF weighting factors for lsf2, using averaged LSFs */ @@ -142,23 +140,21 @@ /* Compute predicted LSF and prediction error */ - logic16 (); test (); if ((txdtx_ctrl & TX_SP_FLAG) != 0) { for (i = 0; i < M; i++) { - lsf_p[i] = add (mean_lsf[i], mult (past_r2_q[i], PRED_FAC)); - move16 (); - lsf_r1[i] = sub (lsf1[i], lsf_p[i]); move16 (); - lsf_r2[i] = sub (lsf2[i], lsf_p[i]); move16 (); + lsf_p[i] = add (mean_lsf[i], mult (st->past_r2_q[i], PRED_FAC)); + lsf_r1[i] = sub (lsf1[i], lsf_p[i]); + lsf_r2[i] = sub (lsf2[i], lsf_p[i]); } } else { for (i = 0; i < M; i++) { - lsf_r1[i] = sub (lsf1[i], lsf_p_CN[i]); move16 (); - lsf_r2[i] = sub (lsf2[i], lsf_p_CN[i]); move16 (); + lsf_r1[i] = sub (lsf1[i], st->lsf_p_CN[i]); + lsf_r2[i] = sub (lsf2[i], st->lsf_p_CN[i]); } } @@ -188,14 +184,13 @@ /* In case of no speech activity, skip computing the quantized LSFs, and set past_r2_q to zero (initial value) */ - logic16 (); test (); if ((txdtx_ctrl & TX_SP_FLAG) != 0) { for (i = 0; i < M; i++) { - lsf1_q[i] = add (lsf_r1[i], lsf_p[i]); move16 (); - lsf2_q[i] = add (lsf_r2[i], lsf_p[i]); move16 (); - past_r2_q[i] = lsf_r2[i]; move16 (); + lsf1_q[i] = add (lsf_r1[i], lsf_p[i]); + lsf2_q[i] = add (lsf_r2[i], lsf_p[i]); + st->past_r2_q[i] = lsf_r2[i]; } /* verification that LSFs has minimum distance of LSF_GAP */ @@ -206,10 +201,9 @@ /* Update LSF history with quantized LSFs when hangover period is active */ - logic16 (); test (); if ((txdtx_ctrl & TX_HANGOVER_ACTIVE) != 0) { - update_lsf_history (lsf1_q, lsf2_q, lsf_old_tx); + update_lsf_history (lsf1_q, lsf2_q, st->lsf_old_tx); } /* convert LSFs to the cosine domain */ @@ -220,7 +214,7 @@ { for (i = 0; i < M; i++) { - past_r2_q[i] = 0; move16 (); + st->past_r2_q[i] = 0; } } @@ -229,6 +223,7 @@ /* Quantization of a 4 dimensional subvector */ +static Word16 Vq_subvec ( /* output: return quantization index */ Word16 *lsf_r1, /* input : 1st LSF residual vector */ Word16 *lsf_r2, /* input : and LSF residual vector */ @@ -285,6 +280,7 @@ /* Quantization of a 4 dimensional subvector with a signed codebook */ +static Word16 Vq_subvec_s ( /* output: return quantization index */ Word16 *lsf_r1, /* input : 1st LSF residual vector */ Word16 *lsf_r2, /* input : and LSF residual vector */ @@ -414,6 +410,7 @@ * * *--------------------------------------------------------------------------*/ +static void Lsf_wt ( Word16 *lsf, /* input : LSF vector */ Word16 *wf) /* output: square of weighting factors */