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

even mask ippiFilterColumn_32f_C1R

seiji-torigoe
Beginner
586 Views
1. I want to calculate the average of y.
2. When the size of the mask is an even number, it is incorrect.
(Pen3 i820 WinXpSp1 IPP4.1.22)
3. Is there something alternative proposal?

// sample code
void main(void)
{
Ipp32f *pSrc; int SrcW, SrcH, SrcS;
Ipp32f *pDst; int DstW, DstH, DstS;
Ipp32f *pMsk; int MskSize;
Ipp32f *pTmp; int yAnchor, x;

IppStatus Status;
IppiSize SrcSize, DstSize;

SrcW = 5; SrcH = 4;
pSrc = ippiMalloc_32f_C1(SrcW, SrcH, &SrcS);
SrcSize.width = SrcW; SrcSize.height = SrcH;
Status = ippiSet_32f_C1R(1.0f, pSrc, SrcS, SrcSize);

MskSize = SrcH;
pMsk = ippsMalloc_32f(MskSize);
Status = ippsSet_32f(1.0f / MskSize, pMsk, MskSize);

DstW = SrcW; DstH = 1;
pDst = ippiMalloc_32f_C1(DstW, DstH, &DstS);

yAnchor = (MskSize - 1) / 2;
pTmp = pSrc + (SrcS / sizeof(Ipp32f)) * yAnchor;
DstSize.width = DstW; DstSize.height = DstH;
Status = ippiFilterColumn_32f_C1R(
pTmp, SrcS, pDst, DstS, DstSize,
pMsk, MskSize, yAnchor);
printf("Status = %d ", Status);
pTmp = pDst;
for ( x = 0; x < DstW; x++ )
{
printf("%f ", *pTmp); pTmp++;
}

ippiFree(pDst);
ippsFree(pMsk);
ippiFree(pSrc);

printf("push any key "); getch();
}
0 Kudos
2 Replies
Vladimir_Dudnik
Employee
586 Views
Hi,
there is answer from our expert:

seemsyou forget (or misread) that arbitrary kernels for filtering operations are used in inverse order (the same as for FIR), therefore anchor should be treated in inverse order too:

pTmp = pSrc + (SrcS /

sizeof(Ipp32f)) * ( MskSize - yAnchor - 1 );

The best way for calculating average is FilterBox or SumColumn function they are faster because dont use muls.

Regards,
Vladimir
0 Kudos
seiji-torigoe
Beginner
586 Views
Thanks.
I understood it.
Thanks.
0 Kudos
Reply