Community
cancel
Showing results for 
Search instead for 
Did you mean: 
umundry
Beginner
52 Views

[Resolved] ippiFilter

I have trouble with filter functions. Why does the code given throw an exception? dimX is 336, dimY is 333. The incoming image is single channel Ipp32f* type.

Pulling my hair out.

Thanks!

 

[cpp]

bool GetSmoothImage(const ImageCoreC&pInMap, int dimX, int dimY) {

IppStatus ippStatus =ippStsNoErr;

int bytesperPix =sizeof(Ipp32f);

int filterWing = 1;

IppiSize srcSize = {dimX,dimY};

int srcStepOrg = srcSize.width * bytesperPix;

IppiSize roiSize = {dimX- (2*filterWing),dimY- (2*filterWing)};

 

int dstStep;

Ipp32f*pDst = ippiMalloc_32f_C1(srcSize.width,srcSize.height,&dstStep);

Ipp32f* pSrcStartpoint =pInMap.Data() + (filterWing * srcSize.width) + filterWing;

Ipp32f* pDstStartpoint = pDst + (filterWing * srcSize.width) + filterWing;

ippStatus = ippiFilterGauss_32f_C1R(pSrcStartpoint, srcStepOrg, pDstStartpoint, dstStep, roiSize,

ippMskSize3x3);

[/cpp]

0 Kudos
2 Replies
Sergey_K_Intel
Employee
52 Views

Works in my case:

[cpp]

#include <ipp.h>
#include <stdlib.h>

const static int dimX = 336, dimY = 333;

int main()
{
    ippInit();

    IppStatus ippStatus = ippStsNoErr;
    Ipp32f *pSrcImage;
    int bytesperPix = sizeof(Ipp32f);
    int filterWing = 1;
    pSrcImage = (Ipp32f*)malloc(dimX * bytesperPix * dimY);
    IppiSize srcSize = {dimX, dimY};
    ippiImageJaehne_32f_C1R(pSrcImage, dimX * bytesperPix, srcSize);
    int srcStepOrg = dimX * bytesperPix;
    IppiSize roiSize = {dimX - (2 * filterWing), dimY - (2 * filterWing)};

    int dstStep;
    Ipp32f *pDst = ippiMalloc_32f_C1(dimX, dimY, &dstStep);
    Ipp32f *pSrcStartpoint = pSrcImage + (filterWing * dimX) + filterWing;

    Ipp32f* pDstStartpoint = pDst + (filterWing * srcSize.width) + filterWing;
    ippStatus = ippiFilterGauss_32f_C1R(pSrcStartpoint, srcStepOrg, 
                pDstStartpoint, dstStep, roiSize, ippMskSize3x3);
   
    ippiFree(pDst);
    free(pSrcImage);
    return 0;
}
[/cpp]

:))

Regards,
Sergey 

 

umundry
Beginner
52 Views

Thank you Sergey, I'll have to continue fishing. Like you if I run your code in a stand-alone environment, it works. I am running my original code in a DLL invoked from a separate thread. Something must be wrong there, at least I now know that the code fragment in question is not the culprit.

Uwe

Reply