Line data Source code
1 : /*==================================================================================== 2 : EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0 3 : ====================================================================================*/ 4 : #include <stdint.h> 5 : #include "options.h" /* Compilation switches */ 6 : #include "cnst.h" 7 : #include "prot_fx.h" /* Function prototypes */ 8 : #include "prot_fx_enc.h" /* Function prototypes */ 9 : 10 : /*------------------------------------------------------------------------ 11 : * RE8_cod: 12 : * 13 : * MULTI-RATE INDEXING OF A POINT y in THE LATTICE RE8 (INDEX COMPUTATION) 14 : * note: the index I is defined as a 32-bit word, but only 15 : * 16 bits are required (long can be replaced by unsigned integer) 16 : *--------------------------------------------------------------------------*/ 17 : 18 1907653 : void re8_cod_fx( 19 : Word16 x[], /* i : point in RE8 (8-dimensional integer vector) Q0*/ 20 : Word16 *n, /* i : codebook number (*n is an integer defined in {0,2,3,4,..,n_max}) Q0*/ 21 : UWord16 *I, /* o : index of c (pointer to unsigned 16-bit word) Q0*/ 22 : Word16 k[] /* o : index of v (8-dimensional vector of binary indices) = Voronoi index Q0*/ 23 : ) 24 : { 25 : Word16 ka_fx, c_fx[8]; 26 : /*---------------------------------------------------------------------- 27 : * decompose x as x = 2^r c + v, where r is an integer >=0, c is an element 28 : * of Q0, Q2, Q3 or Q4, and v is an element of a Voronoi code in RE8 29 : * (if r=0, x=c) 30 : * this decomposition produces as a side-product the index k[] of v 31 : * and the identifier ka of the absolute leader related to c 32 : * 33 : * the index of y is split into 2 parts : 34 : * - the index I of c 35 : * - the index k[] of v 36 : ----------------------------------------------------------------------*/ 37 1907653 : re8_vor_fx( x, n, k, c_fx, &ka_fx ); 38 : 39 : /* safeguard in case that the AVQ subquantizer is not found - might happen for extremely strong onsets at the end of the frame */ 40 1907653 : IF( GE_16( ka_fx, NB_LEADER ) ) 41 : { 42 200522 : *n = 0; 43 200522 : move16(); 44 200522 : set16_fx( x, 0, 8 ); 45 : } 46 : 47 : /* compute the index I (only if c is in Q2, Q3 or Q4) */ 48 1907653 : IF( *n > 0 ) 49 : { 50 1707131 : re8_compute_base_index_fx( c_fx, ka_fx, I ); 51 : } 52 : 53 1907653 : return; 54 : }