Asterisk - The Open Source Telephony Project  18.5.0
Functions
chanwr.c File Reference
#include <stdlib.h>
#include "f2c.h"
Include dependency graph for chanwr.c:

Go to the source code of this file.

Functions

int chanrd_ (integer *order, integer *ipitv, integer *irms, integer *irc, integer *ibits)
 
int chanwr_ (integer *order, integer *ipitv, integer *irms, integer *irc, integer *ibits, struct lpc10_encoder_state *st)
 
int chanwr_0_ (int n__, integer *order, integer *ipitv, integer *irms, integer *irc, integer *ibits, struct lpc10_encoder_state *st)
 

Function Documentation

◆ chanrd_()

int chanrd_ ( integer order,
integer ipitv,
integer irms,
integer irc,
integer ibits 
)

Definition at line 229 of file chanwr.c.

References chanwr_0_(), and NULL.

Referenced by lpc10_decode().

231 {
232  return chanwr_0_(1, order, ipitv, irms, irc, ibits, NULL);
233  }
#define NULL
Definition: resample.c:96
integer order
Definition: analys.c:66
int chanwr_0_(int n__, integer *order, integer *ipitv, integer *irms, integer *irc, integer *ibits, struct lpc10_encoder_state *st)
Definition: chanwr.c:132

◆ chanwr_()

int chanwr_ ( integer order,
integer ipitv,
integer irms,
integer irc,
integer ibits,
struct lpc10_encoder_state st 
)

Definition at line 223 of file chanwr.c.

References chanwr_0_().

Referenced by lpc10_encode().

225 {
226  return chanwr_0_(0, order, ipitv, irms, irc, ibits, st);
227  }
integer order
Definition: analys.c:66
int chanwr_0_(int n__, integer *order, integer *ipitv, integer *irms, integer *irc, integer *ibits, struct lpc10_encoder_state *st)
Definition: chanwr.c:132

◆ chanwr_0_()

int chanwr_0_ ( int  n__,
integer order,
integer ipitv,
integer irms,
integer irc,
integer ibits,
struct lpc10_encoder_state st 
)

Definition at line 132 of file chanwr.c.

References lpc10_encoder_state::isync, and order.

Referenced by chanrd_(), and chanwr_().

135 {
136  /* Initialized data */
137 
138  integer *isync;
139  static integer bit[10] = { 2,4,8,8,8,8,16,16,16,16 };
140  static integer iblist[53] = { 13,12,11,1,2,13,12,11,1,2,13,10,11,2,1,10,
141  13,12,11,10,2,13,12,11,10,2,1,12,7,6,1,10,9,8,7,4,6,9,8,7,5,1,9,8,
142  4,6,1,5,9,8,7,5,6 };
143 
144  /* System generated locals */
145  integer i__1;
146 
147  /* Local variables */
148  integer itab[13], i__;
149 
150 /* Arguments */
151 /* Parameters/constants */
152 /* These arrays are not Fortran PARAMETER's, but they are defined */
153 /* by DATA statements below, and their contents are never altered.
154 */
155 /* Local variables that need not be saved */
156 /* Local state */
157 /* ISYNC is only used by CHANWR, not by ENTRY CHANRD. */
158 
159  /* Parameter adjustments */
160  --irc;
161  --ibits;
162 
163  /* Function Body */
164  switch(n__) {
165  case 1: goto L_chanrd;
166  }
167 
168  isync = &(st->isync);
169 
170 /* ***********************************************************************
171  */
172 /* Place quantized parameters into bitstream */
173 /* ***********************************************************************
174  */
175 /* Place parameters into ITAB */
176  itab[0] = *ipitv;
177  itab[1] = *irms;
178  itab[2] = 0;
179  i__1 = *order;
180  for (i__ = 1; i__ <= i__1; ++i__) {
181  itab[i__ + 2] = irc[*order + 1 - i__] & 32767;
182  }
183 /* Put 54 bits into IBITS array */
184  for (i__ = 1; i__ <= 53; ++i__) {
185  ibits[i__] = itab[iblist[i__ - 1] - 1] & 1;
186  itab[iblist[i__ - 1] - 1] /= 2;
187  }
188  ibits[54] = *isync & 1;
189  *isync = 1 - *isync;
190  return 0;
191 /* ***********************************************************************
192  */
193 /* Reconstruct parameters from bitstream */
194 /* ***********************************************************************
195  */
196 
197 L_chanrd:
198 /* Reconstruct ITAB */
199  for (i__ = 1; i__ <= 13; ++i__) {
200  itab[i__ - 1] = 0;
201  }
202  for (i__ = 1; i__ <= 53; ++i__) {
203  itab[iblist[54 - i__ - 1] - 1] = (itab[iblist[54 - i__ - 1] - 1] << 1)
204  + ibits[54 - i__];
205  }
206 /* Sign extend RC's */
207  i__1 = *order;
208  for (i__ = 1; i__ <= i__1; ++i__) {
209  if ((itab[i__ + 2] & bit[i__ - 1]) != 0) {
210  itab[i__ + 2] -= bit[i__ - 1] << 1;
211  }
212  }
213 /* Restore variables */
214  *ipitv = itab[0];
215  *irms = itab[1];
216  i__1 = *order;
217  for (i__ = 1; i__ <= i__1; ++i__) {
218  irc[i__] = itab[*order + 4 - i__ - 1];
219  }
220  return 0;
221 } /* chanwr_ */
integer order
Definition: analys.c:66
integer isync
Definition: lpc10.h:144
INT32 integer
Definition: lpc10.h:80