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

Go to the source code of this file.

Functions

int preemp_ (real *inbuf, real *pebuf, integer *nsamp, real *coef, real *z__)
 

Function Documentation

◆ preemp_()

int preemp_ ( real inbuf,
real pebuf,
integer nsamp,
real coef,
real z__ 
)

Definition at line 82 of file preemp.c.

References inbuf().

Referenced by analys_().

84 {
85  /* System generated locals */
86  integer i__1;
87 
88  /* Local variables */
89  real temp;
90  integer i__;
91 
92 /* Arguments */
93 /* Local variables */
94 
95 /* None of these need to have their values saved from one */
96 /* invocation to the next. */
97 
98 /* Logically, this subroutine computes the output sequence */
99 /* pebuf(1:nsamp) defined by: */
100 
101 /* pebuf(i) = inbuf(i) - coef * inbuf(i-1) */
102 
103 /* where inbuf(0) is defined by the value of z given as input to */
104 /* this subroutine. */
105 
106 /* What is this filter's frequency response and phase response? */
107 
108 /* Why is this filter applied to the speech? */
109 
110 /* Could it be more efficient to apply multiple filters */
111 /* simultaneously, by combining them into one equivalent filter? */
112 
113 /* Are there ever cases when "factoring" one high-order filter into
114 */
115 /* multiple smaller-order filter actually reduces the number of */
116 /* arithmetic operations needed to perform them? */
117 /* When I first read this subroutine, I didn't understand why the */
118 /* variable temp was used. It seemed that the statements in the do
119 */
120 /* loop could be replaced with the following: */
121 
122 /* pebuf(i) = inbuf(i) - coef * z */
123 /* z = inbuf(i) */
124 
125 /* The reason for temp is so that even if pebuf and inbuf are the */
126 /* same arrays in memory (i.e., they are aliased), then this */
127 /* subroutine will still work correctly. I didn't realize this */
128 /* until seeing the comment after PEBUF above that says "(can be */
129 /* equal to INBUF)". */
130  /* Parameter adjustments */
131  --pebuf;
132  --inbuf;
133 
134  /* Function Body */
135  i__1 = *nsamp;
136  for (i__ = 1; i__ <= i__1; ++i__) {
137  temp = inbuf[i__] - *coef * *z__;
138  *z__ = inbuf[i__];
139  pebuf[i__] = temp;
140 /* L10: */
141  }
142  return 0;
143 } /* preemp_ */
static int inbuf(struct baseio *bio, FILE *fi)
utility used by inchar(), for base_encode()
float real
Definition: lpc10.h:79
INT32 integer
Definition: lpc10.h:80