Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

ResamplePolyphaseFixed in "block mode"

drd
Beginner
290 Views
I'm trying to use ResamplePolyPhaseFixed to upsample and downsample with interpolation via kaiser window in a "block mode" scenario, where the block could potentially be as small as 32 samples... however the blocksize, sample rate and upsample rate are constants and therefore I'm using the Fixed versions, but with unexpected results... (the output looks nothing like the input, basically garbage)... quite probably due to my confusion about some of the parameters... namely how to determine filter length, and what to do with pTime and pOutlen in a scenario where I'm processing the entire block at once.

Obviously the blocks are part a continuos signal, so I imagine some amount of history samples are needed for the filter. The struct init does not provide for a delay line, so I assumed this information was stored in the state? Is it possible to probe the state struct to look at the filter it produces? For history, do I need to create my own delayline and give it data from that instead? Are any of my variables glaringly wrong? What do I do about the filterlen and history in this case, if the state does not accomodate it? Unfortunately I could not find any examples which process an entire block at a time in this way.

example:

int main()
{

int blockSize = 64;
int fs = 48000;
int upsampleRate = 6;

int inRate = fs;
int outRate = fs * upsampleRate;

int filterLen = blockSize; // ? since I'm doing the whole block at once?
float alpha = 12.0f; // I assume this produces same filter as if I did: ippsWinKaiser(window, filterLen, 0.12f) ?
float cuttoff = (1.0 / upsampleRate) * (2.0 / 3.0); // 16kHz / 6 (~0.1111)

IppsResamplingPolyphaseFixed_32f* upSampState;
IppsResamplingPolyphaseFixed_32f* downSampState;
IppStatus status;

status = ippsResamplePolyphaseFixedInitAlloc_32f(&upSampState, inRate, outRate, filterLen, cuttoff, alpha, ippAlgHintAccurate);

status = ippsResamplePolyphaseFixedInitAlloc_32f(&downSampState, outRate, inRate, filterLen, cuttoff, alpha, ippAlgHintAccurate);
}

void process(float* src)
{
int size;
double time;

Ipp32f* dst = ippsMalloc_32f(blockSize * upsampleRate);
IppStatus status;

status = ippsResamplePolyphaseFixed_32f(upSampState, src, blockSize, dst, 0.98f, &time, &size);

//... do stuff with "dst"

status = ippsResamplePolyphaseFixed_32f(downSampState, dst, blockSize * upsampleRate, src, 0.98f, &time, &size);
}

TIA for any pointers... note that I've been using FIRMR to do this in the past, which is probably adding to my confusion in that I'm attempting to polyphase in the same way, except that for FIRMR I have to generate the kaiser filter for it and set the taps manually of course, but at least the output is closer to what I'd expect.


0 Kudos
0 Replies
Reply