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

Definition for IppiHistogramSpec ,IppiFilterBorderSpec

MM_Leo
Beginner
1,171 Views

Hi Team,

Since moving to new IPP version 9.0 few of the APIs in the Ippi library are not present and hence we started to use the substitute as mentioned in intel's link (https://software.intel.com/en-us/ipp-dev-reference-appendix-c-removed-functions-for-image-and-video-processing#IPPI).For the following new APIs I need to define a local type as struct for the new parameters that I have to use with the new methods.We use IPP libraries  in C# and use dllimport to read the APIs in the assemblies of IPP. So for the parameter type declaration we need to know the type definition,in the ippi.h header file I saw the typedef but no body was present .Can you provide the information for the below API parameters ?

IPPAPI(IppStatus, ippiHistogram_32f_C1R, (const Ipp32f* pSrc, int srcStep, IppiSize roiSize, Ipp32u* pHist   , const IppiHistogramSpec* pSpec, Ipp8u* pBuffer

IPPAPI( IppStatus, ippiFilterBorderInit_32f, ( const Ipp32f* pKernel, IppiSize  kernelSize,  IppDataType dataType, int numChannels , IppRoundMode roundMode, IppiFilterBorderSpec* pSpec ))

In these the type definition is required for us to be able to use the parameters namely IppiHistogramSpec & IppiFilterBorderSpec.

For the below APIs the workaround mentioned in the Appendix link was not present .Please tell us that as well what to use in place of these.

ippiErode_8u_C1IR,ippiDilate_8u_C1IR 

Regards,

Leo

0 Kudos
7 Replies
Chao_Y_Intel
Moderator
1,171 Views

Leo, 

IppiXXXXSpec is an internal structure, you can use the following to initialize  it:   1) use  ippiHistogramGetBufferSize to get the size of spec, and some internal buffer,  2)allocate the memory for them.  3) use  xxxInit() function to  initialize the struct: 

      ippiHistogramGetBufferSize(.... &sizeHistObj, &sizeBuffer);
      pHistObj = (IppiHistogramSpec*)ippsMalloc_8u( sizeHistObj );
      pBuffer = (Ipp8u*)ippsMalloc_8u( sizeBuffer );
      ippiHistogramUniformInit( ipp8u, lowerLevel, upperLevel, nLevels, 1, pHistObj );
      sts = ippiHistogram_8u_C1R( pImg, WIDTH, roi, pHistVec, pHistObj, pBuffer );

You can find some example at the IPP manual:
histogram: https://software.intel.com/en-us/ipp-dev-reference-histogram
filter border:  FilterBorder.c

Thanks,
Chao

0 Kudos
Chao_Y_Intel
Moderator
1,171 Views

For these to functions:  ippiErode_8u_C1IR,ippiDilate_8u_C1IR  are inplace function,  there some out-place version function: 
https://software.intel.com/en-us/ipp-dev-reference-erode
https://software.intel.com/en-us/ipp-dev-reference-dilate

They can used as the replacement. 

thanks,
Chao


 

 

0 Kudos
MM_Leo
Beginner
1,171 Views

Hi Chao,

Thank you for information on  ippiErode_8u_C1IR,ippiDilate_8u_C1IR ,it is quite useful.

For IppiXXXXSpec initialization ,I have used the   ippiHistogramGetBufferSize(.... &sizeHistObj, &sizeBuffer). However the question remains on how to declare the IppiXXXXSpec structure in my C# class ? Since I don't know the internal members ,here is what I have declared it as, to be able to use it as the parameters required my the new methods.

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct HistogramSpec { }
 
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct FilterBorderSpec { }

Please let me know declaring like this is sufficient or do I need to do it differently?

Regards,

Leo

0 Kudos
MM_Leo
Beginner
1,171 Views

Hi Chao,

Can you give sample code to use ippiErode_8u_C1R_L and ippiDilate_8u_C1R_L from ippcv_l library as there are addiotional parameters in these 2 methods?

Regards,

Leo

0 Kudos
MM_Leo
Beginner
1,171 Views

Hi Chao,

It will be highly helpful ,if you could provide sample on  ippiErode_8u_C1R_L and ippiDilate_8u_C1R_L from ippcv_l.Below is how I have initialized it but it doesn't work ,AccessViolationException is thrown for ippiErodeGetBufferSize_L.

ipcvMorphStateL* iMorphStateLObjSpec;

byte* pBuffer;
int sizeiMorphStateLObj;
int pBufferSize;
 
ippResult = ippcv_l.ippiErodeGetBufferSize_L(kernelSize, imageSizeWithBorder, IppDataType.ipp8u, 1, &pBufferSize);
ippResult = ippcv_l.ippiErodeGetSpecSize_L(kernelSize, imageSizeWithBorder, &sizeiMorphStateLObj);
pBuffer = ipps.ippsMalloc_8u(pBufferSize);
iMorphStateLObjSpec = (ipcvMorphStateL*)ipps.ippsMalloc_8u(sizeiMorphStateLObj);
ippResult = ippcv_l.ippiErodeInit_L(imageSizeWithBorder, pKernelMask, kernelSize, iMorphStateLObjSpec);

 
ippResult = ippcv_l.ippiErode_8u_C1R_L(pImageAsBinaryMaskWithBorder + offsetBinaryMaskWithBorder, imageSizeWithBorder.width, pKernelMask, kernelSize.width, kernelSize
    , IppiBorderType.ippBorderRepl, borderValue, iMorphStateLObjSpec, pBuffer);

Regards,

Leo

 

0 Kudos
Chao_Y_Intel
Moderator
1,171 Views

Leo,

Could you post the value/definition on:
kernelSize, imageSizeWithBorder,  pBufferSize,

and it the processors, IPP versions you are working on. We want to reproduce this issue. This APIs is simple, I do not expect it will crash.

Thanks,
Chao

 

0 Kudos
MM_Leo
Beginner
1,171 Views

Hi Chao,

Below are the required details .IPP version (IPP2017.0.3.1087 ) and from assembly ippcv.dll

kernelsize: 3,3
imageSizeWithBorder 419,419
pBufferSize : 0
 
Regards,
Leo
0 Kudos
Reply