<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Difference between FIR MR and FIR MR stream? in Intel® Integrated Performance Primitives</title>
    <link>https://community.intel.com/t5/Intel-Integrated-Performance/Difference-between-FIR-MR-and-FIR-MR-stream/m-p/772863#M903</link>
    <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Can someone please tell me what the practical difference is 
between defining a multirate filter using ippsFIRMRStreamInitAlloc vs 
ippsFIRMRInitAlloc?&lt;BR /&gt;The documentation in the FIR part of the IPPS manual (version 6) is not helpful with this.&lt;BR /&gt;&lt;BR /&gt;I
 have tired filtering some test data with both of these and they produce
 the same output. The "stream" in the first one's name suggests that it 
might be suitable for "streaming" applications where you want to call 
the filter lots of times and have the result "stream" of data be the 
concatenation of all the blocks from the input "stream". However, this 
implies that there is some sort of memory of the state of the filter 
from the last call. I tried filtering some data, then filtering all 
zeros, and the output of the second call was all zeros, so there is no 
memory.&lt;BR /&gt;&lt;BR /&gt;What I want to do is to change the sampling rate on a 
huge file of data. The file is so big that it has to be broken up into 
chunks. However because of the impulse response of the filter output 
lags the input by about NTAPS/2, so you have to overlap the blocks to 
make sure the samples at the end of a block are handled correctly and 
not lost. It seems like there should be a way to do this without having 
to overlap chunks of data. Perhaps this is what the "delay line" 
settings are for, but the IPPS manual really says nothing about what the
 delay lines are for, so it is hard to know. There is no concept of 
"delay line" in the Multirate DSP book I'm referencing (Crochiere &amp;amp; 
Rabiner), so I have not been able to translate the terminology.&lt;BR /&gt;&lt;BR /&gt;Clarification
 of the difference between "stream" and "non-stream" filters and 
suggestions for a simple way to process my file would be much 
appreciated.&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Randall.</description>
    <pubDate>Thu, 02 Dec 2010 08:21:30 GMT</pubDate>
    <dc:creator>Randall_W</dc:creator>
    <dc:date>2010-12-02T08:21:30Z</dc:date>
    <item>
      <title>Difference between FIR MR and FIR MR stream?</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/Difference-between-FIR-MR-and-FIR-MR-stream/m-p/772863#M903</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Can someone please tell me what the practical difference is 
between defining a multirate filter using ippsFIRMRStreamInitAlloc vs 
ippsFIRMRInitAlloc?&lt;BR /&gt;The documentation in the FIR part of the IPPS manual (version 6) is not helpful with this.&lt;BR /&gt;&lt;BR /&gt;I
 have tired filtering some test data with both of these and they produce
 the same output. The "stream" in the first one's name suggests that it 
might be suitable for "streaming" applications where you want to call 
the filter lots of times and have the result "stream" of data be the 
concatenation of all the blocks from the input "stream". However, this 
implies that there is some sort of memory of the state of the filter 
from the last call. I tried filtering some data, then filtering all 
zeros, and the output of the second call was all zeros, so there is no 
memory.&lt;BR /&gt;&lt;BR /&gt;What I want to do is to change the sampling rate on a 
huge file of data. The file is so big that it has to be broken up into 
chunks. However because of the impulse response of the filter output 
lags the input by about NTAPS/2, so you have to overlap the blocks to 
make sure the samples at the end of a block are handled correctly and 
not lost. It seems like there should be a way to do this without having 
to overlap chunks of data. Perhaps this is what the "delay line" 
settings are for, but the IPPS manual really says nothing about what the
 delay lines are for, so it is hard to know. There is no concept of 
"delay line" in the Multirate DSP book I'm referencing (Crochiere &amp;amp; 
Rabiner), so I have not been able to translate the terminology.&lt;BR /&gt;&lt;BR /&gt;Clarification
 of the difference between "stream" and "non-stream" filters and 
suggestions for a simple way to process my file would be much 
appreciated.&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Randall.</description>
      <pubDate>Thu, 02 Dec 2010 08:21:30 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/Difference-between-FIR-MR-and-FIR-MR-stream/m-p/772863#M903</guid>
      <dc:creator>Randall_W</dc:creator>
      <dc:date>2010-12-02T08:21:30Z</dc:date>
    </item>
    <item>
      <title>Difference between FIR MR and FIR MR stream?</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/Difference-between-FIR-MR-and-FIR-MR-stream/m-p/772864#M904</link>
      <description>Hi Randall,&lt;BR /&gt;&lt;BR /&gt;Don't use FIR function with "Stream" suffix - the only difference it has in comparison with the general purpose MR FIR - it uses data before pSrc as delay line - it will not be supported in the next IPP version and has limited optimization only (for 1specific case). &lt;BR /&gt;&lt;BR /&gt;You should use ippsFIRMRInitAlloc/ippsFIR functionality in order to process long vectors by chunks - stitching mechanism is provided automatically with delay line support - you don't need to shift pSrc pointer to overlap the blocks. Pay attention to thenumIters parameter only as it is a number of iterations, not the source or destination length.&lt;BR /&gt;&lt;BR /&gt;Igor</description>
      <pubDate>Fri, 03 Dec 2010 14:52:43 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/Difference-between-FIR-MR-and-FIR-MR-stream/m-p/772864#M904</guid>
      <dc:creator>igorastakhov</dc:creator>
      <dc:date>2010-12-03T14:52:43Z</dc:date>
    </item>
    <item>
      <title>Difference between FIR MR and FIR MR stream?</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/Difference-between-FIR-MR-and-FIR-MR-stream/m-p/772865#M905</link>
      <description>Hi Igor,&lt;BR /&gt;&lt;BR /&gt;Thanks for your reply. I still don't understand what the delay lines actually are or when/how you use them. If you could sketch out for me the high level steps to decimate the samples in a large file by a rate of 24/25, then I would very much appreciate it. I'll attach my little test program so that you can see what I'm currently doing (or trying to do).&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Randall.&lt;BR /&gt;&lt;PRE&gt;[cpp]/* test multirate FIR filter functions in the IPP library. */
#include &lt;STDIO.H&gt;
#include &lt;STRING.H&gt;
#include &lt;STDLIB.H&gt;
#include &lt;MATH.H&gt;
#include &lt;IPPS.H&gt;

#define DSIZE 1000
#define NCHUNKS     10
#define FIR_MR_UP   24	// multirate sample rate increase factor
#define FIR_MR_DOWN 25  // multirate sample rate decrease factor
#define FILTER_TAPS 12  // number of conceptual taps in lowpass filter
#define NTAPS (FILTER_TAPS*FIR_MR_UP)  // number of taps in actual low-pass filter.
                                       // this is oversampled by a factor of FIR_MR_UP by design

int main(int argc, char *argv[]) {
    Ipp64f taps64[NTAPS];
    Ipp32f taps32[NTAPS],taps_check[NTAPS];
    Ipp32f *indata,*outdata;
    int i,chunk,status;
    IppsFIRState_32f *fState=NULL;
    FILE *fp=NULL;
    char *infilename  = "/tmp/mr_FIR_in",*outfilename;

    indata  = ippsMalloc_32f(DSIZE);
    outdata = ippsMalloc_32f(DSIZE);
    memset(outdata,'&amp;#0;',sizeof(float)*DSIZE);

    for(i=0; i&lt;DSIZE&gt; = drand48()-0.5 + sin(0.1*i*M_PI)*0.1;
    indata[0] = 1.0;

    // dump test input data
    if ((fp = fopen(infilename,"w")) ==NULL) {
        fprintf(stderr,"Cannot open test data file %sn",infilename);
        return 1;
    }

    fwrite(indata,sizeof(float),DSIZE,fp);
    if(fp !=NULL) {
        fclose(fp);
        fp=NULL;
    }

    // get filter taps
    // the cutoff freq for the lowpass filter in a multirate system must be the minimum of the cutoff
    // freqs for the two conceptual filters that would be required after the up and down sampling. In
    // practise, this means the  min of 1/FIR_MR_UP and 1/FIR_MR_DOWN. See Crochiere &amp;amp; Rabiner eq 2.84.
    // the IPP filters are normalised so that the max freq is 0.5, so the cutoff must be relative to 0.5
    status = ippsFIRGenLowpass_64f(0.5/FIR_MR_DOWN, taps64, NTAPS, ippWinHann, ippTrue);
    if(status != ippStsNoErr) {
      printf("ippsFIRGenLowpass_64f returned %dn",status);
      return status;
    }
    // copy taps and normalise. For a multirate filter, the normalisation is the rate upscale factor
    for (i=0; i&lt;NTAPS&gt; = taps64&lt;I&gt;*FIR_MR_UP;

    // create multirate filter
    status = ippsFIRMRInitAlloc_32f(&amp;amp;fState, taps32, NTAPS, FIR_MR_UP, 0, FIR_MR_DOWN, 0, NULL);
    if(status != ippStsNoErr || fState==NULL) {
      printf("ippsFIRMRInitAlloc_32f returned %dn",status);
      return status;
    }
    // check taps - verification only
    for(i=0; i&lt;NTAPS&gt;=0.0;
    status = ippsFIRGetTaps_32f(fState, taps_check);

    for (i=0; i&lt;NTAPS&gt;);
    }

    // open output file
    outfilename = "/tmp/mr_FIR_out_chunks";
    if ((fp = fopen(outfilename,"w")) ==NULL) {
        fprintf(stderr,"Cannot open output file %sn",outfilename);
        return 1;
    }
    for (chunk=0; chunk&lt;NCHUNKS-1&gt;&lt;/NCHUNKS-1&gt;&lt;/NTAPS&gt;&lt;/NTAPS&gt;&lt;/I&gt;&lt;/NTAPS&gt;&lt;/DSIZE&gt;&lt;/IPPS.H&gt;&lt;/MATH.H&gt;&lt;/STDLIB.H&gt;&lt;/STRING.H&gt;&lt;/STDIO.H&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 Dec 2010 01:35:52 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/Difference-between-FIR-MR-and-FIR-MR-stream/m-p/772865#M905</guid>
      <dc:creator>Randall_W</dc:creator>
      <dc:date>2010-12-06T01:35:52Z</dc:date>
    </item>
    <item>
      <title>Difference between FIR MR and FIR MR stream?</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/Difference-between-FIR-MR-and-FIR-MR-stream/m-p/772866#M906</link>
      <description>Hi Randall.&lt;BR /&gt;Thank you for so detailedtest.&lt;BR /&gt;I prepared small picture for you to demonstrate what delay line is. I used the simpliest single rate case. MultirateFIR uses the same conception. See attachment please.&lt;BR /&gt;Thanks.&lt;BR /&gt;Andrey.</description>
      <pubDate>Fri, 17 Dec 2010 10:42:28 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/Difference-between-FIR-MR-and-FIR-MR-stream/m-p/772866#M906</guid>
      <dc:creator>Andrey_B_Intel</dc:creator>
      <dc:date>2010-12-17T10:42:28Z</dc:date>
    </item>
  </channel>
</rss>

