Line data Source code
1 : /*==================================================================================== 2 : EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0 3 : ====================================================================================*/ 4 : 5 : #include <stdint.h> 6 : #include <stdlib.h> 7 : #include "options.h" 8 : #include "prot_fx.h" 9 : //#ifdef DEBUGGING to be removed 10 : #include <assert.h> 11 : //#endif 12 : 13 103112 : void vlpc_2st_dec( 14 : Word16 *lsfq, /* i/o: i:1st stage o:1st+2nd stage 14Q1*1.28*/ 15 : Word16 *indx, /* i : index[] (4 bits per words) */ 16 : Word16 mode, /* i : 0=abs, >0=rel */ 17 : Word32 sr_core /* i : internal sampling rate */ 18 : ) 19 : { 20 : Word16 i; 21 : Word16 w[M]; 22 : Word16 xq[M]; 23 : Word16 gap; 24 : 25 : 26 : /* weighting from the 1st stage */ 27 103112 : lsf_weight_2st( lsfq, w, mode ); 28 : 29 : /* quantize */ 30 103112 : AVQ_dec_lpc( indx, xq, 2 ); 31 : 32 : /* quantized lsf */ 33 : 34 1752904 : FOR( i = 0; i < M; i++ ) 35 : { 36 : //#ifdef DEBUGGING to be removed 37 1649792 : assert( abs_s( xq[i] ) <= 32 ); /* If xq > 32 for IVAS, we might need a different loop implementation */ 38 : //#endif 39 1649792 : lsfq[i] = add( lsfq[i], shl( mult_r( w[i], shl_sat( xq[i], 10 ) ), 2 ) ); /*14Q1*1.28*/ 40 1649792 : move16(); 41 : } 42 : 43 : /* reorder */ 44 103112 : sort_fx( lsfq, 0, M - 1 ); 45 103112 : IF( EQ_32( sr_core, 16000 ) ) 46 : { 47 514 : gap = 102; 48 514 : move16(); 49 : } 50 102598 : ELSE IF( EQ_32( sr_core, 25600 ) ) 51 : { 52 7082 : gap = 64; 53 7082 : move16(); 54 : } 55 95516 : ELSE IF( EQ_32( sr_core, 32000 ) ) 56 : { 57 95516 : gap = 51; 58 95516 : move16(); 59 : } 60 : ELSE 61 : { 62 0 : gap = 34; 63 0 : move16(); 64 : } 65 103112 : reorder_lsf_fx( lsfq, gap, M, INT_FS_FX ); 66 : 67 : 68 103112 : return; 69 : }