# HG changeset patch # User Mychaela Falconia # Date 1718761743 0 # Node ID 17c0aabae474c90e94f950b8941675d8888c19be # Parent 024615de06fedb5e20e1aca0b07a6e2a2abf1f94 libgsmhr1: integrate fillBitAlloc() diff -r 024615de06fe -r 17c0aabae474 libgsmhr1/Makefile --- a/libgsmhr1/Makefile Wed Jun 19 01:19:41 2024 +0000 +++ b/libgsmhr1/Makefile Wed Jun 19 01:49:03 2024 +0000 @@ -1,6 +1,7 @@ -OBJS= dhf_params.o mathdp31.o mathhalf.o pack_frame.o rtp_in.o sid_detect.o \ - sid_reset.o twts002_in.o twts002_out.o unpack_frame.o -HDRS= mathdp31.h mathhalf.h namespace.h tw_gsmhr.h typedefs.h +OBJS= dhf_params.o enc_out_order.o mathdp31.o mathhalf.o pack_frame.o \ + rtp_in.o sid_detect.o sid_reset.o twts002_in.o twts002_out.o \ + unpack_frame.o +HDRS= enc_out_order.h mathdp31.h mathhalf.h namespace.h tw_gsmhr.h typedefs.h LIB= libgsmhr1.a include ../config.defs diff -r 024615de06fe -r 17c0aabae474 libgsmhr1/enc_out_order.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgsmhr1/enc_out_order.c Wed Jun 19 01:49:03 2024 +0000 @@ -0,0 +1,101 @@ +/* + * This module was derived from host.c in the original GSM 06.06 source, + * reduced to just fillBitAlloc() function. + */ + +/*_________________________________________________________________________ + | | + | Include Files | + |_________________________________________________________________________| +*/ + +#include "typedefs.h" +#include "namespace.h" +#include "enc_out_order.h" + +/*************************************************************************** + * + * FUNCTION NAME: fillBitAlloc + * + * PURPOSE: + * + * Arrange speech parameters for encoder output + * + * INPUTS: + * + * The speechcoders codewords: + * iR0 - Frame energy + * piVqIndeces[0:2] - LPC vector quantizer codewords + * iSoftInterp - Soft interpolation bit 1 or 0 + * iVoicing - voicing mode 0,1,2,3 + * piLags[0:3] - Frame and delta lag codewords + * piCodeWrdsA[0:3] - VSELP codevector 1 + * piCodeWrdsB[0:3] - VSELP codevector 2 (n/a for voiced modes) + * piGsp0s[0:3] - GSP0 codewords + * swVadFlag - voice activity detection flag + * swSP - Speech flag + * + * OUTPUTS: + * + * pswBAlloc[0:20] - an array into which the coded data is moved + * + * RETURN VALUE: + * + * none + * + * REFERENCES: Sub-clause 2.1 and 4.1.12 of GSM Recomendation 06.20 + * + **************************************************************************/ + +void fillBitAlloc(int iVoicing, int iR0, int *piVqIndeces, + int iSoftInterp, int *piLags, + int *piCodeWrdsA, int *piCodeWrdsB, + int *piGsp0s, Shortword swVadFlag, + Shortword swSP, Shortword *pswBAlloc) +{ + +/*_________________________________________________________________________ + | | + | Automatic Variables | + |_________________________________________________________________________| +*/ + + int i; + Shortword *pswNxt; + +/*_________________________________________________________________________ + | | + | Executable Code | + |_________________________________________________________________________| +*/ + + pswNxt = pswBAlloc; + *pswNxt++ = iR0; + for (i = 0; i < 3; i++) + *pswNxt++ = *piVqIndeces++; + *pswNxt++ = iSoftInterp; + *pswNxt++ = iVoicing; + + /* check voicing mode */ + if (iVoicing) + { + /* voiced mode */ + for (i = 0; i < N_SUB; i++) + { + *pswNxt++ = *piLags++; + *pswNxt++ = *piCodeWrdsA++; + *pswNxt++ = *piGsp0s++; + } + } + else + { /* unvoiced frame */ + for (i = 0; i < N_SUB; i++) + { + *pswNxt++ = *piCodeWrdsA++; + *pswNxt++ = *piCodeWrdsB++; + *pswNxt++ = *piGsp0s++; + } + } + *pswNxt++ = swVadFlag; + *pswNxt++ = swSP; +} diff -r 024615de06fe -r 17c0aabae474 libgsmhr1/enc_out_order.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgsmhr1/enc_out_order.h Wed Jun 19 01:49:03 2024 +0000 @@ -0,0 +1,12 @@ +#ifndef enc_out_order_h +#define enc_out_order_h + +#include "typedefs.h" + +void fillBitAlloc(int iVoicing, int iR0, int *piVqIndeces, + int iSoftInterp, int *piLags, + int *piCodeWrdsA, int *piCodeWrdsB, + int *piGsp0s, Shortword swVadFlag, + Shortword swSP, Shortword *pswBAlloc); + +#endif /* include guard */ diff -r 024615de06fe -r 17c0aabae474 libgsmhr1/namespace.list --- a/libgsmhr1/namespace.list Wed Jun 19 01:19:41 2024 +0000 +++ b/libgsmhr1/namespace.list Wed Jun 19 01:49:03 2024 +0000 @@ -12,3 +12,5 @@ L_deposit_l L_deposit_h extract_l extract_h round norm_l norm_s divide_s L_mpy_ls L_mpy_ll isSwLimit isLwLimit + +fillBitAlloc