- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I played around with ippsResamplePolyphase_16s function and came across its kind of strange behavior. First of all, let me define a lowpass filter with a window size of 5 and discretization step for filter coefficients of 3. After I initialize the structure for polyphase resampling, I assign the resampling factor to 3 and the resampling start time to 1 (i.e. the second input item). For simplicity, I take the first 5 input items to resample. As an output, I get the resampling start time of 6.33 and the number of calculated output items of 16. It means that the next time I will call the ippsResamplePolyphase function, there will be a shift of 0.33 in the input data portion yielding the shift of the output data. It looks weird, because I assigned the resampling factor to the integer value and expected to receive all the resampled data uniformly distributed. I also noticed that the shift doesn’t arise when I process input data with a chunks size equal to 3 or 9. What can be the reason for such an odd thing?
The code is attached
//size of the ideal lowpass filter window Ipp32f window = 5; //discretization step for filter coefficients int nStep = 3; //size of the polyphase resampling structure int size; //suggests using specific code (must be equal to ippAlgHintFast) IppHintAlgorithm hint = ippAlgHintAccurate; //get the size of the polyphase resampling structure ippsResamplePolyphaseGetSize_16s(window, nStep, &size, hint); //roll-off frequency of the filter Ipp32f rollf = 0.95; //parameter of the Kaiser window Ipp32f alpha = 9; //pointer to the resampling state structure IppsResamplingPolyphase_16s* state = (IppsResamplingPolyphase_16s*)(new Ipp8u[size]); //initialize the structure for polyphase resampling with calculating the filter coefficients //values of the ideal lowpass filtering function are calculated for all i values such that |i/nStep| <= window ippsResamplePolyphaseInit_16s(window, nStep, rollf, alpha, state, hint); //resampling factor Ipp64f factor = float(46) / 29; // accum ff / num of pSrc //history int history = (0.5 * window * IPP_MAX(1.0, 1.0 / factor)) + 1; //number of input vector elements to resample int lenSrc = 29 + 2 * history; //pointer to the input vector Ipp16s pSrc[] = { 105, 115, 105, -55, -100, -120, -115, -120, -75, 85, 125, 125, 105, -60, -115, -125, -125, -105, -65, 20, 85, 105, 135, 105, -85, -105, -105, -100, -80, -80, -80, -80 }; //array of sample rates Ipp16s ff[] = { 3, 1, 4, 1, 1, 1, 1, 1, 5, 1, 1, 1, 4, 1, 1, 1, 1, 1, 2, 1, 1, 2, 2, 4, 1, 1, 1, 1, 1}; //number of calculated output vector elements int lenDst = (int)((lenSrc - history) * factor + 2); //pointer to the output vector Ipp16s* pDst = new Ipp16s[lenDst]; //norm factor for output samples that are multiplied by norm * min (1, factor) before saturation Ipp32f norm = 0.98; //start time of resampling (in input vector elements) //keeps the input sample number and the phase for the first output sample from the next input data portion Ipp64f time = 1.0; //temporary vector vector<Ipp32f> temp; //resample input data using polyphase filters factor = ff[0]; ippsResamplePolyphase_16s(pSrc, 1, pDst, factor, norm, &time, &lenDst, state); for (size_t i = 0; i < lenDst; i++) { temp.push_back(pDst); }
Sincerely,
Slava
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ippsResamplePolyphase_16s(pSrc, 1, pDst, factor, norm, &
time
, &lenDst, state);
Why the second parameter is 1 in your function call? As refered to the description of this api function shown below (https://software.intel.com/en-us/node/502289), the second parameter should be The number of input vector elements to resample.
IppStatus ippsResamplePolyphase_16s(const Ipp16s* pSrc, int len, Ipp16s* pDst, Ipp64ffactor, Ipp32f norm, Ipp64f* pTime, int* pOutlen, const IppsResamplingPolyphase_16s* pSpec);
Parameters
pSrc |
The pointer to the input vector. |
pDst |
The pointer to the output vector. |
len |
The number of input vector elements to resample. |
norm |
The norm factor for output samples. |
factor |
The resampling factor. |
pTime |
The pointer to the start time of resampling (in input vector elements). Keeps the input sample number and the phase for the first output sample from the next input data portion. |
pOutlen |
The number of calculated output vector elements. |
pSpec |
The pointer to the resampling state structure. |
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Jing,
It’s a mistyping. Sure, it should be 5 in the case test.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The problem is still not solved. Looks like there is a BUG in the implementation of the polyphase resampling algorithm in IPP.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
We are working on it, we will get back to you soon.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Looking forward to your response.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page