1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75

/*
* FILE: resample.h
* BY: Julius Smith (at CCRMA, Stanford U)
* C BY: translated from SAIL to C by Christopher Lee Fraley
* (cf0v@andrew.cmu.edu)
* DATE: 7JUN88
* VERS: 2.0 (17JUN88, 3:00pm)
*/
#define MAXNWING 5122
#define MAXFACTOR 4 /* Maximum Factor without output buff overflow */
/* Conversion constants */
#define Nhc 8
#define Na 7
#define Np (Nhc+Na)
#define Npc (1<<Nhc)
#define Amask ((1<<Na)1)
#define Pmask ((1<<Np)1)
#define Nh 16
#define Nb 16
#define Nhxn 14
#define Nhg (NhNhxn)
#define NLpScl 13
/* Description of constants:
*
* Npc  is the number of lookup values available for the lowpass filter
* between the beginning of its impulse response and the "cutoff time"
* of the filter. The cutoff time is defined as the reciprocal of the
* lowpassfilter cut off frequence in Hz. For example, if the
* lowpass filter were a sinc function, Npc would be the index of the
* impulseresponse lookuptable corresponding to the first zero
* crossing of the sinc function. (The inverse first zerocrossing
* time of a sinc function equals its nominal cutoff frequency in Hz.)
* Npc must be a power of 2 due to the details of the current
* implementation. The default value of 512 is sufficiently high that
* using linear interpolation to fill in between the table entries
* gives approximately 16bit accuracy in filter coefficients.
*
* Nhc  is log base 2 of Npc.
*
* Na  is the number of bits devoted to linear interpolation of the
* filter coefficients.
*
* Np  is Na + Nhc, the number of bits to the right of the binary point
* in the integer "time" variable. To the left of the point, it indexes
* the input array (X), and to the right, it is interpreted as a number
* between 0 and 1 sample of the input X. Np must be less than 16 in
* this implementation.
*
* Nh  is the number of bits in the filter coefficients. The sum of Nh and
* the number of bits in the input data (typically 16) cannot exceed 32.
* Thus Nh should be 16. The largest filter coefficient should nearly
* fill 16 bits (32767).
*
* Nb  is the number of bits in the input data. The sum of Nb and Nh cannot
* exceed 32.
*
* Nhxn  is the number of bits to right shift after multiplying each input
* sample times a filter coefficient. It can be as great as Nh and as
* small as 0. Nhxn = Nh2 gives 2 guard bits in the multiplyadd
* accumulation. If Nhxn=0, the accumulation will soon overflow 32 bits.
*
* Nhg  is the number of guard bits in mpyadd accumulation (equal to NhNhxn).
*
* NLpScl  is the number of bits allocated to the unitygain normalization
* factor. The output of the lowpass filter is multiplied by LpScl and
* then rightshifted NLpScl bits. To avoid overflow, we must have
* Nb+Nhg+NLpScl < 32.
*/
