使用 Intel Performance Primitives 进行流过滤

问题描述

我尝试使用 ippsFirsR_32f 就地过滤数据,如 in this example 所示。但它没有描述,如何将其放入一个循环中并无间隙地过滤多个缓冲区。 所以我尝试了以下方法

        const int LEN = 100;
        const int TAPS_LEN = 8;

        IppsFirspec_32f* pSpec;
        float* src,* dst,* taps;
        Ipp8u* buf;
        int             specsize,bufSize;

        //get sizes of the spec structure and the work buffer
        ippsFirsRGetSize(TAPS_LEN,ipp32f,&specsize,&bufSize);

        src = ippsMalloc_32f(LEN + TAPS_LEN - 1);
        for (int i = 0; i < LEN + TAPS_LEN - 1; i++) src[i] =1;
        dst = src;
        taps = ippsMalloc_32f(TAPS_LEN);
        for (int i = 0; i < TAPS_LEN; i++) taps[i] = 1;
        pSpec = (IppsFirspec_32f*)ippsMalloc_8u(specsize);
        buf = ippsMalloc_8u(bufSize);

        //initialize the spec structure
        ippsFirsRInit_32f(taps,TAPS_LEN,ippAlgDirect,pSpec);
        std::vector<Ipp32f> out;
        //apply the FIR filter
        for (int i = 0; i < 3; i++) {
            for (int i = 0; i < LEN; i++) src[i] = 2;
            ippsFirsR_32f(src + TAPS_LEN - 1,dst,LEN,pSpec,src,NULL,buf);
            out.insert(out.end(),dst + LEN);
        }

但结果 out 看起来像这样:

enter image description here

我预计一开始会上升,然后在 16 点持平。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)