Line data Source code
1 : /****************************************************************************** 2 : * ETSI TS 103 634 V1.5.1 * 3 : * Low Complexity Communication Codec Plus (LC3plus) * 4 : * * 5 : * Copyright licence is solely granted through ETSI Intellectual Property * 6 : * Rights Policy, 3rd April 2019. No patent licence is granted by implication, * 7 : * estoppel or otherwise. * 8 : ******************************************************************************/ 9 : 10 : #include "functions.h" 11 : 12 0 : void processMdctShaping_fx(Word32 x[], 13 : #ifdef ENABLE_HR_MODE 14 : Word32 scf[], 15 : #else 16 : Word16 scf[], 17 : #endif 18 : Word16 scf_exp[], const Word16 bands_offset[], Word16 fdns_npts) 19 : { 20 : Counter i, j; 21 : 22 : #ifdef DYNMEM_COUNT 23 : Dyn_Mem_In("processMdctShaping_fx", sizeof(struct { Counter i, j; })); 24 : #endif 25 : 26 0 : j = 0; move16(); 27 0 : FOR (i = 0; i < fdns_npts; i++) 28 : { 29 0 : FOR (; j < bands_offset[i + 1]; j++) 30 : { 31 : #ifdef ENABLE_HR_MODE 32 0 : x[j] = L_shl(Mpy_32_32_lc3plus(x[j], scf[i]), scf_exp[i]); move32(); 33 : #else 34 : x[j] = L_shl(Mpy_32_16_lc3plus(x[j], scf[i]), scf_exp[i]); move32(); 35 : #endif 36 : } 37 : } 38 : 39 : #ifdef DYNMEM_COUNT 40 : Dyn_Mem_Out(); 41 : #endif 42 0 : } 43 : 44 : 45 0 : void processScfScaling(Word16 scf_exp[], Word16 fdns_npts, Word16 *x_e) 46 : { 47 : Counter i; 48 : Word16 scf_exp_max; 49 : 50 : #ifdef DYNMEM_COUNT 51 : Dyn_Mem_In("processLpcGainScaling", sizeof(struct { 52 : Counter i; 53 : Word16 scf_exp_max; 54 : })); 55 : #endif 56 : 57 0 : scf_exp_max = scf_exp[0]; move16(); 58 : 59 0 : FOR (i = 1; i < fdns_npts; i++) 60 : { 61 0 : scf_exp_max = s_max(scf_exp_max, scf_exp[i]); 62 : } 63 : 64 0 : FOR (i = 0; i < fdns_npts; i++) 65 : { 66 0 : scf_exp[i] = sub(scf_exp[i], scf_exp_max); move16(); 67 : } 68 : 69 0 : *x_e = add(*x_e, scf_exp_max); move16(); 70 : #ifdef DYNMEM_COUNT 71 : Dyn_Mem_Out(); 72 : #endif 73 0 : } 74 :