/*==================================================================================== EVS Codec 3GPP TS26.443 Jun 30, 2015. Version CR 26.443-0006 ====================================================================================*/ #include #include #include "prot.h" /*-------------------------------------------------------------------* * qlpc_avq() * * *--------------------------------------------------------------------*/ void qlpc_avq( const float *lsf, /* (i) Input LSF vectors */ const float *lsfmid, float *lsf_q, /* (o) Quantized LFS vectors */ float *lsfmid_q, int *index, /* (o) Quantization indices */ int *nb_indices, /* (o) Number of quantization indices */ int *nbbits, /* (o) Number of quantization bits */ int core, float sr_core ) { int i; float lsfmid_q0[M]; int *tmp_index, indxt[256], nbits, nbt, nit; float dummy[M]; /* Init */ tmp_index = &index[0]; *nb_indices = 0; /* Quantize end_frame LPC */ for (i=0; i= 16) { push_next_indice(st, 0xffffU, 16); nb_bits += 16; ind -= 16; } if (ind > 0) { push_next_indice(st, (1U< 4) { push_next_indice(st, prm[i], 4); nbits -= 4; i++; } push_next_indice(st, prm[i], nbits); i++; } return(i); } /*-------------------------------------------------------------------* * encode_lpc_avq() * * *--------------------------------------------------------------------*/ int encode_lpc_avq( Encoder_State *st, int numlpc, int *param_lpc, int mode ) { int k,j; int q_type, nb_ind; int i,qn1,qn2,nb,avqBits,st1=0; int nb_bits; j = 0; nb_bits = 0; for (k=0; k3)) { i = 3; } push_next_indice(st, i, 2); i = qn2-2; if ((i<0) || (i>3)) { i = 3; } push_next_indice(st, i, 2); /* Unary code for abs and rel LPC0/LPC2 */ /* Q5 = 0, Q6=10, Q0=110, Q7=1110, ... */ nb = qn1; if (nb > 6) { nb -= 3; } else if (nb > 4) { nb -= 4; } else if (nb == 0) { nb = 3; } else { nb = 0; } if (nb > 0) { unary_code(nb, st); } nb_bits += nb; nb = qn2; if (nb > 6) { nb -= 3; } else if (nb > 4) { nb -= 4; } else if (nb == 0) { nb = 3; } else { nb = 0; } if (nb > 0) { unary_code(nb, st); } nb_bits += nb; avqBits = 4*qn1; unpack4bits(avqBits, ¶m_lpc[j], st); j += qn1; nb_bits += avqBits; avqBits = 4*qn2; unpack4bits(avqBits, ¶m_lpc[j], st); j += qn2; nb_bits += avqBits; } else { j += nb_ind; } } return(nb_bits); }