Thanks. That makes perfect sense. The Intel functions are still confusing
though. The manuals are in PDF form, so I've cut and pasted pertinent
sections below and cleaned them up as best as possible. There are two main
groupings of functions. The first ones are used to initialize a state
structure that is used during filtering. The second ones actual filter and
generate resampled output. You'll probably want to read the discussion
sections first. BTW, there is reference to what appears to be a
mathematical operation notated HHO(.). I have no idea what that is. Thanks
for your help! --Matt
Oh, here's a link to the manual in PDF form if the text down below isn't
clear...
http://www.intel.com/software/products/ipp/docs/ippsman.htm
And the text below should be read in a Courier font.
------------------------------------------------------------------
Polyphase Resampling
--------------------
The Intel IPP functions described in this section build, apply and free
Kaiser-windowed polyphase filters for data resampling. Functions with Fixed
suffix are intended for fixed rational resampling factor and provide faster
speed. Functions without this suffix build universal resampling filter with
linear interpolation of filter coefficients and allow to use a variable
factor.
ResamplePolyphaseInitAlloc
--------------------------
Initializes the structure for polyphase data resampling.
IppStatus ippsResamplePolyphaseInitAlloc_16s(IppsResamplePolyphaseSpec_16s**
pSpec, Ipp32f window, int nStep, Ipp32f rollf, Ipp32f alpha,
IppHintAlgorithm hint);
IppStatus ippsResamplePolyphaseInitAlloc_32f(IppsResamplePolyphaseSpec_32f**
pSpec, Ipp32f window, int nStep, Ipp32f rollf, Ipp32f alpha,
IppHintAlgorithm hint);
IppStatus ippsResamplePolyphaseFixedInitAlloc_16s(
IppsResamplePolyphaseSpecFixed_16s** pSpec, int inRate, int outRate, int
len, Ipp32f rollf, Ipp32f alpha, IppHintAlgorithm hint);
IppStatus ippsResamplePolyphaseFixedInitAlloc_32f(
IppsResamplePolyphaseSpecFixed_32f** pSpec, int inRate, int outRate, int
len, Ipp32f rollf, Ipp32f alpha, IppHintAlgorithm hint);
Arguments
---------
window - The size of the ideal lowpass filter window.
nStep - The discretization step for filter coefficients.
rollf - The roll-off frequency of the filter.
alpha - The parameter of the Kaiser window.
inRate - The input rate for resampling with fixed factor.
outRate - The output rate for resampling with fixed factor.
len - The filter length for resampling with fixed factor.
pSpec - The pointer to the resampling state structure to be created.
hint - Suggests using specific code. The values for the hint argument are
described in Table 7-3, "Flag and Hint
Arguments".
Discussion
----------
These functions are declared in the ippsr.h file. The function
ippsResamplePolyphaseInitAlloc creates structures for data resampling using
the ideal lowpass filter
rollf/nStep , i=0
h[i] = , |i| <= window*nStep , 0 < rollf
<= 1
sin(roof*i*pi/nStep)
-------------------- , i<>0
i*pi/nStep
and applies the Kaiser window with alpha parameter and width window to it.
The structure created could be used to resample input samples by the
function ippsResample with arbitrary resampling factor. Linear interpolation
is used to calculate filter coefficients for each output sample. The filter
size depends on the resampling factor.
The function ippsResamplePolyphaseFixedInitAlloc creates structures for data
resampling with the factor equal to inRate/outRate. Values window and nStep
in the formula above are chosen to provide the filter length
flen = min(l)
l>=len, l%4=0
and flen+1 for zero phase.
fn = outRate/HHO(inRate,outRate)
of filters are created for different phases.
Return Value
------------
ippStsNoErr Indicates no error.
ippStsNullPtrErr Indicates an error when pSpec pointer is NULL.
ippStsSizeErr Indicates an error when inRate, outRate, nStep or len is
less than or equal to 0.
ippStsBadArgErr Indicates an error when rollf is less than or equal to 0
or isgreater than 1, or if alpha is less than 1, or if window is less than
2/nStep.
ippStsMemAllocErr Indicates a memory allocation error.
****************************************
****************************************
Okay, that stuff above was just for initialization of that state structure.
The stuff below is the function that actually generates resampled output.
****************************************
****************************************
Discussion
----------
The functions ippsResamplePolyphase and ippsResamplePolyphaseFixed are
declared in the ippsr.h file. These functions convert data from the input
vector changing their frequency. The ratio of output and input frequencies
is defined by the factor argument for the function ippsResamplePolyphase.
For the function ippsResamplePolyphaseFixed, this ratio is defined during
creation of the resampling structure. The value pTime[0] defines the time
value for which the first output sample is calculated.
The history data of filters are in the input vector with indexes less than
pTime[0]. The history length is equal to flen/2 for function
ippsResamplePolyphaseFixed and
[1/2 * window * max(1,1/factor)] + 1
for function ippsResamplePolyphase. The input vector should contain the same
number of elements with indexes greater than pTime[0]+len for the right
filter wing for the last element.
After function execution, the time value is updated and pOutlen[0] contains
the number of calculated output samples.
The output samples are multiplied by norm*min(1,factor) before saturation.
Return Value
------------
ippStsNoErr Indicates no error.
ippStsNullPtrErr Indicates an error when pSpec, pSrc, pDst, pTime or
pOutlen pointer is NULL.
ippStsSizeErr Indicates an error when len is less than or equal to 0.
ippStsBadArgErr Indicates an error when factor is less than or equal to.
"Jon Harris" <goldentully@hotmail.com> wrote in message
news:2p47s0Fg1tk7U1@uni-berlin.de...
> "Matt Roos" <XXmatt.roos@verizon.net> wrote in message
> news:T8ednT_HJM2-S7HcRVn-gw@comcast.com...
>> Hi, All. I'm trying to use Intel's IPP polyphase resampling functions.
>> They are part of the signal processing set and found in the manual under
>> Speech Recognition Functions. I've found the manual's usage description
>> somewhat lacking. I don't understand it well enough to implement.
>>
>> Can anyone provide a reference that might match well with Intel's
>> implementation? It's been a while since I've used a polyphase filter, so
>> I
>> reviewed it in Proakis/Manolakis and still couldn't fully understand the
>> IPP
>> version. IPP has a version for fixed rational resampling factors, and a
>> version for arbitrary resampling factors -- i'm intereseted in the later.
>> The IPP manual says that this uses "linear interpolation of filter
>> coefficients". I'm not sure what this means. Proakis/Manolakis discuss
>> linear interpolation of points from the output of a fixed rational
>> resampler, but this wouldn't appear to be the same thing.
>
> I can't help you on the Intel side as I have no experience with that, but
> I will
> attempt to explain the "linear interpolation of filter coefficients" bit.
>
> If you have a known fixed ratio of output/input sample rates, you can
> construct
> a table of filter coefficients based on this ratio. The number of
> "phases" or
> table entries per tap is based on this ratio. For example, for a simple
> ratio
> such as 2:1 upsampling, you would only need 2 phases per tap. For a more
> complex ratio suc has 48K:44.1K upsampling (a ratio of 160:147), you would
> need
> 160 phases per tap. Now, if the ratio was dynamic (or just too large to
> fit
> into available memory) then this exact method would no longer work.
> Instead,
> the table could contain a "large" number of phases--as many as pratical
> for the
> particular implementation--and then the exact phase would be calculated by
> interpolating between adjacent table entries for each tap.
>
> Consider another example, in this case a table with 10 phases per tap.
> This
> would allow you to exactly calculate output sample values that were
> located at
> between sample positions of 0, 0.1, 0.2, 0.3...0.9. But if you wanted to
> calculate the output sample at say 0.15, you could interpolate between the
> entries for 0.1 and 0.2 to get the coefficients to use.
>
> Note that you could also calculate the output value at 0.1 and 0.2 and
> then
> average the resulant values and get the same answer. Interpolating the
> filter
> coefficients is mathematically equivalent to (and the same amount of
> computation
> as) interpolating the results. (If you write out the equations, you can
> use a
> bit of algrebra to transform one method into the other.)
>
> I'm not sure how much sense I'm making here. Maybe a better bet would be
> to
> refer to this data sheet:
> http://www.analog.com/UploadedFiles/Data_Sheets/71654447AD1896_a.pdf,
> especially
> p. 19.
>
>> While full knowledge of the implementation would be nice, I'm primarily
>> considered with just understanding what the filter's frequency response
>> will
>> be for the specific arguments I pass to the function. I'm particularly
>> confused by the "nStep" argument.
>
> The frequency response should be independent of the number of phases. I
> can
> only guess as to what nStep means--if you can post a link for the
> documentation
> you don't understand, or quote a section of it, we may be able to help
> more.
>
> -Jon
>
>