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

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().

00231 {
00232     return chanwr_0_(1, order, ipitv, irms, irc, ibits, NULL);
00233     }

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().

00225 {
00226     return chanwr_0_(0, order, ipitv, irms, irc, ibits, st);
00227     }

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.

Referenced by chanrd_(), and chanwr_().

00135 {
00136     /* Initialized data */
00137 
00138     integer *isync;
00139     static integer bit[10] = { 2,4,8,8,8,8,16,16,16,16 };
00140     static integer iblist[53] = { 13,12,11,1,2,13,12,11,1,2,13,10,11,2,1,10,
00141        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,
00142        4,6,1,5,9,8,7,5,6 };
00143 
00144     /* System generated locals */
00145     integer i__1;
00146 
00147     /* Local variables */
00148     integer itab[13], i__;
00149 
00150 /*       Arguments */
00151 /*       Parameters/constants */
00152 /*       These arrays are not Fortran PARAMETER's, but they are defined */
00153 /*       by DATA statements below, and their contents are never altered. 
00154 */
00155 /*       Local variables that need not be saved */
00156 /*       Local state */
00157 /*       ISYNC is only used by CHANWR, not by ENTRY CHANRD. */
00158 
00159     /* Parameter adjustments */
00160     --irc;
00161     --ibits;
00162 
00163     /* Function Body */
00164     switch(n__) {
00165    case 1: goto L_chanrd;
00166    }
00167 
00168     isync = &(st->isync);
00169 
00170 /* ***********************************************************************
00171  */
00172 /*    Place quantized parameters into bitstream */
00173 /* ***********************************************************************
00174  */
00175 /*   Place parameters into ITAB */
00176     itab[0] = *ipitv;
00177     itab[1] = *irms;
00178     itab[2] = 0;
00179     i__1 = *order;
00180     for (i__ = 1; i__ <= i__1; ++i__) {
00181    itab[i__ + 2] = irc[*order + 1 - i__] & 32767;
00182     }
00183 /*   Put 54 bits into IBITS array */
00184     for (i__ = 1; i__ <= 53; ++i__) {
00185    ibits[i__] = itab[iblist[i__ - 1] - 1] & 1;
00186    itab[iblist[i__ - 1] - 1] /= 2;
00187     }
00188     ibits[54] = *isync & 1;
00189     *isync = 1 - *isync;
00190     return 0;
00191 /* ***********************************************************************
00192  */
00193 /*    Reconstruct parameters from bitstream */
00194 /* ***********************************************************************
00195  */
00196 
00197 L_chanrd:
00198 /*   Reconstruct ITAB */
00199     for (i__ = 1; i__ <= 13; ++i__) {
00200    itab[i__ - 1] = 0;
00201     }
00202     for (i__ = 1; i__ <= 53; ++i__) {
00203    itab[iblist[54 - i__ - 1] - 1] = (itab[iblist[54 - i__ - 1] - 1] << 1)
00204        + ibits[54 - i__];
00205     }
00206 /*   Sign extend RC's */
00207     i__1 = *order;
00208     for (i__ = 1; i__ <= i__1; ++i__) {
00209    if ((itab[i__ + 2] & bit[i__ - 1]) != 0) {
00210        itab[i__ + 2] -= bit[i__ - 1] << 1;
00211    }
00212     }
00213 /*   Restore variables */
00214     *ipitv = itab[0];
00215     *irms = itab[1];
00216     i__1 = *order;
00217     for (i__ = 1; i__ <= i__1; ++i__) {
00218    irc[i__] = itab[*order + 4 - i__ - 1];
00219     }
00220     return 0;
00221 } /* chanwr_ */


Generated on Thu Apr 16 06:30:11 2015 for Asterisk - The Open Source Telephony Project by  doxygen 1.5.6