<?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 Gaussian filter in frequency domain (FFT) question in Intel® Integrated Performance Primitives</title>
    <link>https://community.intel.com/t5/Intel-Integrated-Performance/Gaussian-filter-in-frequency-domain-FFT-question/m-p/985878#M21789</link>
    <description>&lt;P&gt;I'm trying to do gaussian filtering of image in frequency domain (FFT) w/ IPP.&lt;BR /&gt;For image of size MxN and gauss&amp;nbsp;kernel UxV, the steps:&lt;BR /&gt;1. zero-pad kernel to (M+U-1)x(N+V-1)&lt;BR /&gt;2. Fwd FFT kernel&lt;BR /&gt;3. zero-pad img to (M+U-1)x(N+V-1)&lt;BR /&gt;4. Fwd FFT img&lt;BR /&gt;5. multiply the 2 FFTs in float-complex format&lt;BR /&gt;4. Inv FFT the multiplied result&lt;BR /&gt;5. Trim edges&lt;BR /&gt;&lt;BR /&gt;My resulting image looks a little strange. The best result I have is when I border extend both kernel and img but keep both left border width&amp;nbsp;and top border&amp;nbsp;height to 0. &lt;BR /&gt;Can the experts have a look to see what I'm doing wrong? NOTE: The test code below purposely uses a small kernel. Real code would be using very large kernels.&lt;/P&gt;
&lt;P&gt;[cpp]&lt;/P&gt;
&lt;P&gt;void foo(Ipp8u*&lt;B&gt; &lt;/B&gt;img,&lt;B&gt; &lt;/B&gt;int&lt;B&gt; &lt;/B&gt;lineStep,&lt;B&gt; &lt;/B&gt;int&lt;B&gt; &lt;/B&gt;width,&lt;B&gt; &lt;/B&gt;int&lt;B&gt; &lt;/B&gt;height)&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;IppStatus&lt;B&gt; &lt;/B&gt;status;&lt;/P&gt;
&lt;P&gt;// assume kernel is 5x5 with sigma = 1&lt;/P&gt;
&lt;P&gt;int&lt;B&gt; &lt;/B&gt;kernelStep;&lt;/P&gt;
&lt;P&gt;Ipp32f*&lt;B&gt; &lt;/B&gt;kernel&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;ippiMalloc_32f_C1(5,&lt;B&gt; &lt;/B&gt;5,&lt;B&gt; &lt;/B&gt;&amp;amp;kernelStep);&lt;/P&gt;
&lt;P&gt;IppiSize&lt;B&gt; &lt;/B&gt;kernelRoi&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;{&lt;B&gt; &lt;/B&gt;5,&lt;B&gt; &lt;/B&gt;5&lt;B&gt; &lt;/B&gt;};&lt;/P&gt;
&lt;P&gt;kernel[0]&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0.0030f;&lt;B&gt; &lt;/B&gt;kernel[1]&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0.0133f;&lt;B&gt; &lt;/B&gt;kernel[2]&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0.0219f;&lt;B&gt; &lt;/B&gt;kernel[3]&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0.0133f;&lt;B&gt; &lt;/B&gt;kernel[4]&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0.0030f;&lt;/P&gt;
&lt;P&gt;kernel[8]&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0.0133f;&lt;B&gt; &lt;/B&gt;kernel[9]&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0.0596f;&lt;B&gt; &lt;/B&gt;kernel[10]&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0.0983f;&lt;B&gt; &lt;/B&gt;kernel[11]&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0.0596f;&lt;B&gt; &lt;/B&gt;kernel[12]&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0.0133f;&lt;/P&gt;
&lt;P&gt;kernel[16]&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0.0219f;&lt;B&gt; &lt;/B&gt;kernel[17]&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0.0983f;&lt;B&gt; &lt;/B&gt;kernel[18]&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0.1621f;&lt;B&gt; &lt;/B&gt;kernel[19]&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0.0983f;&lt;B&gt; &lt;/B&gt;kernel[20]&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0.0219f;&lt;/P&gt;
&lt;P&gt;kernel[24]&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0.0133f;&lt;B&gt; &lt;/B&gt;kernel[25]&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0.0596f;&lt;B&gt; &lt;/B&gt;kernel[26]&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0.0983f;&lt;B&gt; &lt;/B&gt;kernel[27]&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0.0596f;&lt;B&gt; &lt;/B&gt;kernel[28]&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0.0133f;&lt;/P&gt;
&lt;P&gt;kernel[32]&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0.0030f;&lt;B&gt; &lt;/B&gt;kernel[33]&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0.0133f;&lt;B&gt; &lt;/B&gt;kernel[34]&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0.0219f;&lt;B&gt; &lt;/B&gt;kernel[35]&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0.0133f;&lt;B&gt; &lt;/B&gt;kernel[36]&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0.0030f;&lt;/P&gt;
&lt;P&gt;// pad kernel&lt;/P&gt;
&lt;P&gt;IppiSize&lt;B&gt; &lt;/B&gt;padRoi&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;{&lt;B&gt; &lt;/B&gt;width&lt;B&gt; &lt;/B&gt;+&lt;B&gt; &lt;/B&gt;4,&lt;B&gt; &lt;/B&gt;height&lt;B&gt; &lt;/B&gt;+&lt;B&gt; &lt;/B&gt;4&lt;B&gt; &lt;/B&gt;};&lt;/P&gt;
&lt;P&gt;// 2d fft padded kernel&lt;/P&gt;
&lt;P&gt;IppiDFTSpec_C_32fc*&lt;B&gt; &lt;/B&gt;spec;&lt;/P&gt;
&lt;P&gt;status&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;ippiDFTInitAlloc_C_32fc(&amp;amp;spec,&lt;B&gt; &lt;/B&gt;padRoi,&lt;B&gt; &lt;/B&gt;IPP_FFT_DIV_INV_BY_N,&lt;B&gt; &lt;/B&gt;ippAlgHintFast);&lt;/P&gt;
&lt;P&gt;// extend border by 4 pixels on each dimension&lt;/P&gt;
&lt;P&gt;int&lt;B&gt; &lt;/B&gt;extKernelStep;&lt;/P&gt;
&lt;P&gt;Ipp32f*&lt;B&gt; &lt;/B&gt;extKernel&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;ippiMalloc_32f_C1(width&lt;B&gt; &lt;/B&gt;+&lt;B&gt; &lt;/B&gt;4,&lt;B&gt; &lt;/B&gt;height&lt;B&gt; &lt;/B&gt;+&lt;B&gt; &lt;/B&gt;4,&lt;B&gt; &lt;/B&gt;&amp;amp;extKernelStep);&lt;/P&gt;
&lt;P&gt;status&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;ippiCopyConstBorder_32f_C1R(kernel,&lt;B&gt; &lt;/B&gt;kernelStep,&lt;B&gt; &lt;/B&gt;kernelRoi,&lt;B&gt; &lt;/B&gt;extKernel,&lt;B&gt; &lt;/B&gt;extKernelStep,&lt;B&gt; &lt;/B&gt;padRoi,&lt;B&gt; &lt;/B&gt;0,&lt;B&gt; &lt;/B&gt;0,&lt;B&gt; &lt;/B&gt;0.f);&lt;/P&gt;
&lt;P&gt;int&lt;B&gt; &lt;/B&gt;fftKernelStep;&lt;/P&gt;
&lt;P&gt;Ipp32fc*&lt;B&gt; &lt;/B&gt;fftKernel&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;ippiMalloc_32fc_C1(width&lt;B&gt; &lt;/B&gt;+&lt;B&gt; &lt;/B&gt;4,&lt;B&gt; &lt;/B&gt;height&lt;B&gt; &lt;/B&gt;+&lt;B&gt; &lt;/B&gt;4,&lt;B&gt; &lt;/B&gt;&amp;amp;fftKernelStep);&lt;/P&gt;
&lt;P&gt;// copy over, then Fwd FFT it&lt;/P&gt;
&lt;P&gt;int&lt;B&gt; &lt;/B&gt;kernelCorrectedStep&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;extKernelStep/4;&lt;/P&gt;
&lt;P&gt;int&lt;B&gt; &lt;/B&gt;kernelFcStep&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;fftKernelStep/8;&lt;/P&gt;
&lt;P&gt;for(int&lt;B&gt; &lt;/B&gt;h&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0;&lt;B&gt; &lt;/B&gt;h&lt;B&gt; &lt;/B&gt;&amp;lt;&lt;B&gt; &lt;/B&gt;height&lt;B&gt; &lt;/B&gt;+&lt;B&gt; &lt;/B&gt;4;&lt;B&gt; &lt;/B&gt;++h)&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;Ipp32f*&lt;B&gt; &lt;/B&gt;currentKernelRow&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;extKernel&lt;B&gt; &lt;/B&gt;+&lt;B&gt; &lt;/B&gt;(h&lt;B&gt; &lt;/B&gt;*&lt;B&gt; &lt;/B&gt;kernelCorrectedStep);&lt;/P&gt;
&lt;P&gt;Ipp32fc*&lt;B&gt; &lt;/B&gt;currentFFTKernelRow&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;fftKernel&lt;B&gt; &lt;/B&gt;+&lt;B&gt; &lt;/B&gt;(h&lt;B&gt; &lt;/B&gt;*&lt;B&gt; &lt;/B&gt;kernelFcStep);&lt;/P&gt;
&lt;P&gt;for(int&lt;B&gt; &lt;/B&gt;w&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0;&lt;B&gt; &lt;/B&gt;w&lt;B&gt; &lt;/B&gt;&amp;lt;&lt;B&gt; &lt;/B&gt;width&lt;B&gt; &lt;/B&gt;+&lt;B&gt; &lt;/B&gt;4;&lt;B&gt; &lt;/B&gt;++w)&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;Ipp32f*&lt;B&gt; &lt;/B&gt;currentKernel&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;currentKernelRow&lt;B&gt; &lt;/B&gt;+&lt;B&gt; &lt;/B&gt;w;&lt;/P&gt;
&lt;P&gt;Ipp32fc*&lt;B&gt; &lt;/B&gt;currentFFTKernel&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;currentFFTKernelRow&lt;B&gt; &lt;/B&gt;+&lt;B&gt; &lt;/B&gt;w;&lt;/P&gt;
&lt;P&gt;(*currentFFTKernel).re&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;*currentKernel;&lt;/P&gt;
&lt;P&gt;(*currentFFTKernel).im&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0.f;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;// FWD kernel&lt;/P&gt;
&lt;P&gt;status&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;ippiDFTFwd_CToC_32fc_C1IR(fftKernel,&lt;B&gt; &lt;/B&gt;fftKernelStep,&lt;B&gt; &lt;/B&gt;spec,&lt;B&gt; &lt;/B&gt;NULL);&lt;/P&gt;
&lt;P&gt;// convert img to 32f&lt;/P&gt;
&lt;P&gt;IppiSize&lt;B&gt; &lt;/B&gt;imgRoi&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;{&lt;B&gt; &lt;/B&gt;width,&lt;B&gt; &lt;/B&gt;height&lt;B&gt; &lt;/B&gt;};&lt;/P&gt;
&lt;P&gt;int&lt;B&gt; &lt;/B&gt;imgFStep;&lt;/P&gt;
&lt;P&gt;Ipp32f*&lt;B&gt; &lt;/B&gt;imgF&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;ippiMalloc_32f_C1(width,&lt;B&gt; &lt;/B&gt;height,&lt;B&gt; &lt;/B&gt;&amp;amp;imgFStep);&lt;/P&gt;
&lt;P&gt;status&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;ippiConvert_8u32f_C1R(img,&lt;B&gt; &lt;/B&gt;lineStep,&lt;B&gt; &lt;/B&gt;imgF,&lt;B&gt; &lt;/B&gt;imgFStep,&lt;B&gt; &lt;/B&gt;imgRoi);&lt;/P&gt;
&lt;P&gt;// extend&lt;/P&gt;
&lt;P&gt;int&lt;B&gt; &lt;/B&gt;extImgStep;&lt;/P&gt;
&lt;P&gt;Ipp32f*&lt;B&gt; &lt;/B&gt;extImg&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;ippiMalloc_32f_C1(width&lt;B&gt; &lt;/B&gt;+&lt;B&gt; &lt;/B&gt;4,&lt;B&gt; &lt;/B&gt;height&lt;B&gt; &lt;/B&gt;+&lt;B&gt; &lt;/B&gt;4,&lt;B&gt; &lt;/B&gt;&amp;amp;extImgStep);&lt;/P&gt;
&lt;P&gt;//status = ippiCopyReplicateBorder_32f_C1R(imgF, imgFStep, imgRoi, extImg, extImgStep, padRoi, 0, 0);&lt;/P&gt;
&lt;P&gt;status&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;ippiCopyConstBorder_32f_C1R(imgF,&lt;B&gt; &lt;/B&gt;imgFStep,&lt;B&gt; &lt;/B&gt;imgRoi,&lt;B&gt; &lt;/B&gt;extImg,&lt;B&gt; &lt;/B&gt;extImgStep,&lt;B&gt; &lt;/B&gt;padRoi,&lt;B&gt; &lt;/B&gt;0,&lt;B&gt; &lt;/B&gt;0,&lt;B&gt; &lt;/B&gt;0.f);&lt;/P&gt;
&lt;P&gt;int&lt;B&gt; &lt;/B&gt;fftImgStep;&lt;/P&gt;
&lt;P&gt;Ipp32fc*&lt;B&gt; &lt;/B&gt;fftImg&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;ippiMalloc_32fc_C1(width&lt;B&gt; &lt;/B&gt;+&lt;B&gt; &lt;/B&gt;4,&lt;B&gt; &lt;/B&gt;height&lt;B&gt; &lt;/B&gt;+&lt;B&gt; &lt;/B&gt;4,&lt;B&gt; &lt;/B&gt;&amp;amp;fftImgStep);&lt;/P&gt;
&lt;P&gt;int&lt;B&gt; &lt;/B&gt;imgCorrectedStep&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;extImgStep/4;&lt;/P&gt;
&lt;P&gt;int&lt;B&gt; &lt;/B&gt;imgFcStep&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;fftImgStep/8;&lt;/P&gt;
&lt;P&gt;for(int&lt;B&gt; &lt;/B&gt;h&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0;&lt;B&gt; &lt;/B&gt;h&lt;B&gt; &lt;/B&gt;&amp;lt;&lt;B&gt; &lt;/B&gt;height&lt;B&gt; &lt;/B&gt;+&lt;B&gt; &lt;/B&gt;4;&lt;B&gt; &lt;/B&gt;++h)&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;Ipp32f*&lt;B&gt; &lt;/B&gt;currentImgRow&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;extImg&lt;B&gt; &lt;/B&gt;+&lt;B&gt; &lt;/B&gt;(h&lt;B&gt; &lt;/B&gt;*&lt;B&gt; &lt;/B&gt;imgCorrectedStep);&lt;/P&gt;
&lt;P&gt;Ipp32fc*&lt;B&gt; &lt;/B&gt;currentFFTImgRow&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;fftImg&lt;B&gt; &lt;/B&gt;+&lt;B&gt; &lt;/B&gt;(h&lt;B&gt; &lt;/B&gt;*&lt;B&gt; &lt;/B&gt;imgFcStep);&lt;/P&gt;
&lt;P&gt;for(int&lt;B&gt; &lt;/B&gt;w&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0;&lt;B&gt; &lt;/B&gt;w&lt;B&gt; &lt;/B&gt;&amp;lt;&lt;B&gt; &lt;/B&gt;width&lt;B&gt; &lt;/B&gt;+&lt;B&gt; &lt;/B&gt;4;&lt;B&gt; &lt;/B&gt;++w)&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;Ipp32f*&lt;B&gt; &lt;/B&gt;currentImg&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;currentImgRow&lt;B&gt; &lt;/B&gt;+&lt;B&gt; &lt;/B&gt;w;&lt;/P&gt;
&lt;P&gt;Ipp32fc*&lt;B&gt; &lt;/B&gt;currentFFTImg&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;currentFFTImgRow&lt;B&gt; &lt;/B&gt;+&lt;B&gt; &lt;/B&gt;w;&lt;/P&gt;
&lt;P&gt;(*currentFFTImg).re&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;*currentImg;&lt;/P&gt;
&lt;P&gt;(*currentFFTImg).im&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0.f;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;// FWD img&lt;/P&gt;
&lt;P&gt;status&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;ippiDFTFwd_CToC_32fc_C1IR(fftImg,&lt;B&gt; &lt;/B&gt;fftImgStep,&lt;B&gt; &lt;/B&gt;spec,&lt;B&gt; &lt;/B&gt;NULL);&lt;/P&gt;
&lt;P&gt;// now multiply both&lt;/P&gt;
&lt;P&gt;status&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;ippiMul_32fc_C1IR(fftKernel,&lt;B&gt; &lt;/B&gt;fftKernelStep,&lt;B&gt; &lt;/B&gt;fftImg,&lt;B&gt; &lt;/B&gt;fftImgStep,&lt;B&gt; &lt;/B&gt;padRoi);&lt;/P&gt;
&lt;P&gt;// inv FFT&lt;/P&gt;
&lt;P&gt;status&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;ippiDFTInv_CToC_32fc_C1IR(fftImg,&lt;B&gt; &lt;/B&gt;fftImgStep,&lt;B&gt; &lt;/B&gt;spec,&lt;B&gt; &lt;/B&gt;NULL);&lt;/P&gt;
&lt;P&gt;// copy back out to extImg&lt;/P&gt;
&lt;P&gt;int&lt;B&gt; &lt;/B&gt;fftCStep&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;fftImgStep/8;&lt;/P&gt;
&lt;P&gt;int&lt;B&gt; &lt;/B&gt;cImgStep&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;extImgStep/4;&lt;/P&gt;
&lt;P&gt;for(int&lt;B&gt; &lt;/B&gt;h&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0;&lt;B&gt; &lt;/B&gt;h&lt;B&gt; &lt;/B&gt;&amp;lt;&lt;B&gt; &lt;/B&gt;height&lt;B&gt; &lt;/B&gt;+&lt;B&gt; &lt;/B&gt;4;&lt;B&gt; &lt;/B&gt;++h)&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;Ipp32fc*&lt;B&gt; &lt;/B&gt;currentFFTRow&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;fftImg&lt;B&gt; &lt;/B&gt;+&lt;B&gt; &lt;/B&gt;(h&lt;B&gt; &lt;/B&gt;*&lt;B&gt; &lt;/B&gt;fftCStep);&lt;/P&gt;
&lt;P&gt;Ipp32f*&lt;B&gt; &lt;/B&gt;currentRow&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;extImg&lt;B&gt; &lt;/B&gt;+&lt;B&gt; &lt;/B&gt;(h&lt;B&gt; &lt;/B&gt;*&lt;B&gt; &lt;/B&gt;cImgStep);&lt;/P&gt;
&lt;P&gt;for(int&lt;B&gt; &lt;/B&gt;w&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0;&lt;B&gt; &lt;/B&gt;w&lt;B&gt; &lt;/B&gt;&amp;lt;&lt;B&gt; &lt;/B&gt;width&lt;B&gt; &lt;/B&gt;+&lt;B&gt; &lt;/B&gt;4;&lt;B&gt; &lt;/B&gt;++w)&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;Ipp32fc*&lt;B&gt; &lt;/B&gt;currentFFT&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;currentFFTRow&lt;B&gt; &lt;/B&gt;+&lt;B&gt; &lt;/B&gt;w;&lt;/P&gt;
&lt;P&gt;Ipp32f*&lt;B&gt; &lt;/B&gt;currentImg&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;currentRow&lt;B&gt; &lt;/B&gt;+&lt;B&gt; &lt;/B&gt;w;&lt;/P&gt;
&lt;P&gt;*currentImg&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;(*currentFFT).re;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;Ipp32f*&lt;B&gt; &lt;/B&gt;startPt&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;extImg&lt;B&gt; &lt;/B&gt;+&lt;B&gt; &lt;/B&gt;(2&lt;B&gt; &lt;/B&gt;*&lt;B&gt; &lt;/B&gt;cImgStep)&lt;B&gt; &lt;/B&gt;+&lt;B&gt; &lt;/B&gt;2;&lt;B&gt; &lt;/B&gt;// looks better?&lt;/P&gt;
&lt;P&gt;//Ipp32f* startPt = extImg; // shifted???&lt;/P&gt;
&lt;P&gt;status&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;ippiConvert_32f8u_C1R(startPt,&lt;B&gt; &lt;/B&gt;extImgStep,&lt;B&gt; &lt;/B&gt;img,&lt;B&gt; &lt;/B&gt;lineStep,&lt;B&gt; &lt;/B&gt;imgRoi,&lt;B&gt; &lt;/B&gt;ippRndNear);&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;[/cpp]&lt;/P&gt;</description>
    <pubDate>Mon, 07 Jan 2013 10:08:44 GMT</pubDate>
    <dc:creator>cks2k2</dc:creator>
    <dc:date>2013-01-07T10:08:44Z</dc:date>
    <item>
      <title>Gaussian filter in frequency domain (FFT) question</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/Gaussian-filter-in-frequency-domain-FFT-question/m-p/985878#M21789</link>
      <description>&lt;P&gt;I'm trying to do gaussian filtering of image in frequency domain (FFT) w/ IPP.&lt;BR /&gt;For image of size MxN and gauss&amp;nbsp;kernel UxV, the steps:&lt;BR /&gt;1. zero-pad kernel to (M+U-1)x(N+V-1)&lt;BR /&gt;2. Fwd FFT kernel&lt;BR /&gt;3. zero-pad img to (M+U-1)x(N+V-1)&lt;BR /&gt;4. Fwd FFT img&lt;BR /&gt;5. multiply the 2 FFTs in float-complex format&lt;BR /&gt;4. Inv FFT the multiplied result&lt;BR /&gt;5. Trim edges&lt;BR /&gt;&lt;BR /&gt;My resulting image looks a little strange. The best result I have is when I border extend both kernel and img but keep both left border width&amp;nbsp;and top border&amp;nbsp;height to 0. &lt;BR /&gt;Can the experts have a look to see what I'm doing wrong? NOTE: The test code below purposely uses a small kernel. Real code would be using very large kernels.&lt;/P&gt;
&lt;P&gt;[cpp]&lt;/P&gt;
&lt;P&gt;void foo(Ipp8u*&lt;B&gt; &lt;/B&gt;img,&lt;B&gt; &lt;/B&gt;int&lt;B&gt; &lt;/B&gt;lineStep,&lt;B&gt; &lt;/B&gt;int&lt;B&gt; &lt;/B&gt;width,&lt;B&gt; &lt;/B&gt;int&lt;B&gt; &lt;/B&gt;height)&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;IppStatus&lt;B&gt; &lt;/B&gt;status;&lt;/P&gt;
&lt;P&gt;// assume kernel is 5x5 with sigma = 1&lt;/P&gt;
&lt;P&gt;int&lt;B&gt; &lt;/B&gt;kernelStep;&lt;/P&gt;
&lt;P&gt;Ipp32f*&lt;B&gt; &lt;/B&gt;kernel&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;ippiMalloc_32f_C1(5,&lt;B&gt; &lt;/B&gt;5,&lt;B&gt; &lt;/B&gt;&amp;amp;kernelStep);&lt;/P&gt;
&lt;P&gt;IppiSize&lt;B&gt; &lt;/B&gt;kernelRoi&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;{&lt;B&gt; &lt;/B&gt;5,&lt;B&gt; &lt;/B&gt;5&lt;B&gt; &lt;/B&gt;};&lt;/P&gt;
&lt;P&gt;kernel[0]&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0.0030f;&lt;B&gt; &lt;/B&gt;kernel[1]&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0.0133f;&lt;B&gt; &lt;/B&gt;kernel[2]&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0.0219f;&lt;B&gt; &lt;/B&gt;kernel[3]&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0.0133f;&lt;B&gt; &lt;/B&gt;kernel[4]&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0.0030f;&lt;/P&gt;
&lt;P&gt;kernel[8]&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0.0133f;&lt;B&gt; &lt;/B&gt;kernel[9]&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0.0596f;&lt;B&gt; &lt;/B&gt;kernel[10]&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0.0983f;&lt;B&gt; &lt;/B&gt;kernel[11]&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0.0596f;&lt;B&gt; &lt;/B&gt;kernel[12]&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0.0133f;&lt;/P&gt;
&lt;P&gt;kernel[16]&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0.0219f;&lt;B&gt; &lt;/B&gt;kernel[17]&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0.0983f;&lt;B&gt; &lt;/B&gt;kernel[18]&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0.1621f;&lt;B&gt; &lt;/B&gt;kernel[19]&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0.0983f;&lt;B&gt; &lt;/B&gt;kernel[20]&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0.0219f;&lt;/P&gt;
&lt;P&gt;kernel[24]&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0.0133f;&lt;B&gt; &lt;/B&gt;kernel[25]&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0.0596f;&lt;B&gt; &lt;/B&gt;kernel[26]&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0.0983f;&lt;B&gt; &lt;/B&gt;kernel[27]&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0.0596f;&lt;B&gt; &lt;/B&gt;kernel[28]&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0.0133f;&lt;/P&gt;
&lt;P&gt;kernel[32]&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0.0030f;&lt;B&gt; &lt;/B&gt;kernel[33]&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0.0133f;&lt;B&gt; &lt;/B&gt;kernel[34]&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0.0219f;&lt;B&gt; &lt;/B&gt;kernel[35]&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0.0133f;&lt;B&gt; &lt;/B&gt;kernel[36]&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0.0030f;&lt;/P&gt;
&lt;P&gt;// pad kernel&lt;/P&gt;
&lt;P&gt;IppiSize&lt;B&gt; &lt;/B&gt;padRoi&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;{&lt;B&gt; &lt;/B&gt;width&lt;B&gt; &lt;/B&gt;+&lt;B&gt; &lt;/B&gt;4,&lt;B&gt; &lt;/B&gt;height&lt;B&gt; &lt;/B&gt;+&lt;B&gt; &lt;/B&gt;4&lt;B&gt; &lt;/B&gt;};&lt;/P&gt;
&lt;P&gt;// 2d fft padded kernel&lt;/P&gt;
&lt;P&gt;IppiDFTSpec_C_32fc*&lt;B&gt; &lt;/B&gt;spec;&lt;/P&gt;
&lt;P&gt;status&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;ippiDFTInitAlloc_C_32fc(&amp;amp;spec,&lt;B&gt; &lt;/B&gt;padRoi,&lt;B&gt; &lt;/B&gt;IPP_FFT_DIV_INV_BY_N,&lt;B&gt; &lt;/B&gt;ippAlgHintFast);&lt;/P&gt;
&lt;P&gt;// extend border by 4 pixels on each dimension&lt;/P&gt;
&lt;P&gt;int&lt;B&gt; &lt;/B&gt;extKernelStep;&lt;/P&gt;
&lt;P&gt;Ipp32f*&lt;B&gt; &lt;/B&gt;extKernel&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;ippiMalloc_32f_C1(width&lt;B&gt; &lt;/B&gt;+&lt;B&gt; &lt;/B&gt;4,&lt;B&gt; &lt;/B&gt;height&lt;B&gt; &lt;/B&gt;+&lt;B&gt; &lt;/B&gt;4,&lt;B&gt; &lt;/B&gt;&amp;amp;extKernelStep);&lt;/P&gt;
&lt;P&gt;status&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;ippiCopyConstBorder_32f_C1R(kernel,&lt;B&gt; &lt;/B&gt;kernelStep,&lt;B&gt; &lt;/B&gt;kernelRoi,&lt;B&gt; &lt;/B&gt;extKernel,&lt;B&gt; &lt;/B&gt;extKernelStep,&lt;B&gt; &lt;/B&gt;padRoi,&lt;B&gt; &lt;/B&gt;0,&lt;B&gt; &lt;/B&gt;0,&lt;B&gt; &lt;/B&gt;0.f);&lt;/P&gt;
&lt;P&gt;int&lt;B&gt; &lt;/B&gt;fftKernelStep;&lt;/P&gt;
&lt;P&gt;Ipp32fc*&lt;B&gt; &lt;/B&gt;fftKernel&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;ippiMalloc_32fc_C1(width&lt;B&gt; &lt;/B&gt;+&lt;B&gt; &lt;/B&gt;4,&lt;B&gt; &lt;/B&gt;height&lt;B&gt; &lt;/B&gt;+&lt;B&gt; &lt;/B&gt;4,&lt;B&gt; &lt;/B&gt;&amp;amp;fftKernelStep);&lt;/P&gt;
&lt;P&gt;// copy over, then Fwd FFT it&lt;/P&gt;
&lt;P&gt;int&lt;B&gt; &lt;/B&gt;kernelCorrectedStep&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;extKernelStep/4;&lt;/P&gt;
&lt;P&gt;int&lt;B&gt; &lt;/B&gt;kernelFcStep&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;fftKernelStep/8;&lt;/P&gt;
&lt;P&gt;for(int&lt;B&gt; &lt;/B&gt;h&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0;&lt;B&gt; &lt;/B&gt;h&lt;B&gt; &lt;/B&gt;&amp;lt;&lt;B&gt; &lt;/B&gt;height&lt;B&gt; &lt;/B&gt;+&lt;B&gt; &lt;/B&gt;4;&lt;B&gt; &lt;/B&gt;++h)&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;Ipp32f*&lt;B&gt; &lt;/B&gt;currentKernelRow&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;extKernel&lt;B&gt; &lt;/B&gt;+&lt;B&gt; &lt;/B&gt;(h&lt;B&gt; &lt;/B&gt;*&lt;B&gt; &lt;/B&gt;kernelCorrectedStep);&lt;/P&gt;
&lt;P&gt;Ipp32fc*&lt;B&gt; &lt;/B&gt;currentFFTKernelRow&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;fftKernel&lt;B&gt; &lt;/B&gt;+&lt;B&gt; &lt;/B&gt;(h&lt;B&gt; &lt;/B&gt;*&lt;B&gt; &lt;/B&gt;kernelFcStep);&lt;/P&gt;
&lt;P&gt;for(int&lt;B&gt; &lt;/B&gt;w&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0;&lt;B&gt; &lt;/B&gt;w&lt;B&gt; &lt;/B&gt;&amp;lt;&lt;B&gt; &lt;/B&gt;width&lt;B&gt; &lt;/B&gt;+&lt;B&gt; &lt;/B&gt;4;&lt;B&gt; &lt;/B&gt;++w)&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;Ipp32f*&lt;B&gt; &lt;/B&gt;currentKernel&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;currentKernelRow&lt;B&gt; &lt;/B&gt;+&lt;B&gt; &lt;/B&gt;w;&lt;/P&gt;
&lt;P&gt;Ipp32fc*&lt;B&gt; &lt;/B&gt;currentFFTKernel&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;currentFFTKernelRow&lt;B&gt; &lt;/B&gt;+&lt;B&gt; &lt;/B&gt;w;&lt;/P&gt;
&lt;P&gt;(*currentFFTKernel).re&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;*currentKernel;&lt;/P&gt;
&lt;P&gt;(*currentFFTKernel).im&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0.f;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;// FWD kernel&lt;/P&gt;
&lt;P&gt;status&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;ippiDFTFwd_CToC_32fc_C1IR(fftKernel,&lt;B&gt; &lt;/B&gt;fftKernelStep,&lt;B&gt; &lt;/B&gt;spec,&lt;B&gt; &lt;/B&gt;NULL);&lt;/P&gt;
&lt;P&gt;// convert img to 32f&lt;/P&gt;
&lt;P&gt;IppiSize&lt;B&gt; &lt;/B&gt;imgRoi&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;{&lt;B&gt; &lt;/B&gt;width,&lt;B&gt; &lt;/B&gt;height&lt;B&gt; &lt;/B&gt;};&lt;/P&gt;
&lt;P&gt;int&lt;B&gt; &lt;/B&gt;imgFStep;&lt;/P&gt;
&lt;P&gt;Ipp32f*&lt;B&gt; &lt;/B&gt;imgF&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;ippiMalloc_32f_C1(width,&lt;B&gt; &lt;/B&gt;height,&lt;B&gt; &lt;/B&gt;&amp;amp;imgFStep);&lt;/P&gt;
&lt;P&gt;status&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;ippiConvert_8u32f_C1R(img,&lt;B&gt; &lt;/B&gt;lineStep,&lt;B&gt; &lt;/B&gt;imgF,&lt;B&gt; &lt;/B&gt;imgFStep,&lt;B&gt; &lt;/B&gt;imgRoi);&lt;/P&gt;
&lt;P&gt;// extend&lt;/P&gt;
&lt;P&gt;int&lt;B&gt; &lt;/B&gt;extImgStep;&lt;/P&gt;
&lt;P&gt;Ipp32f*&lt;B&gt; &lt;/B&gt;extImg&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;ippiMalloc_32f_C1(width&lt;B&gt; &lt;/B&gt;+&lt;B&gt; &lt;/B&gt;4,&lt;B&gt; &lt;/B&gt;height&lt;B&gt; &lt;/B&gt;+&lt;B&gt; &lt;/B&gt;4,&lt;B&gt; &lt;/B&gt;&amp;amp;extImgStep);&lt;/P&gt;
&lt;P&gt;//status = ippiCopyReplicateBorder_32f_C1R(imgF, imgFStep, imgRoi, extImg, extImgStep, padRoi, 0, 0);&lt;/P&gt;
&lt;P&gt;status&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;ippiCopyConstBorder_32f_C1R(imgF,&lt;B&gt; &lt;/B&gt;imgFStep,&lt;B&gt; &lt;/B&gt;imgRoi,&lt;B&gt; &lt;/B&gt;extImg,&lt;B&gt; &lt;/B&gt;extImgStep,&lt;B&gt; &lt;/B&gt;padRoi,&lt;B&gt; &lt;/B&gt;0,&lt;B&gt; &lt;/B&gt;0,&lt;B&gt; &lt;/B&gt;0.f);&lt;/P&gt;
&lt;P&gt;int&lt;B&gt; &lt;/B&gt;fftImgStep;&lt;/P&gt;
&lt;P&gt;Ipp32fc*&lt;B&gt; &lt;/B&gt;fftImg&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;ippiMalloc_32fc_C1(width&lt;B&gt; &lt;/B&gt;+&lt;B&gt; &lt;/B&gt;4,&lt;B&gt; &lt;/B&gt;height&lt;B&gt; &lt;/B&gt;+&lt;B&gt; &lt;/B&gt;4,&lt;B&gt; &lt;/B&gt;&amp;amp;fftImgStep);&lt;/P&gt;
&lt;P&gt;int&lt;B&gt; &lt;/B&gt;imgCorrectedStep&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;extImgStep/4;&lt;/P&gt;
&lt;P&gt;int&lt;B&gt; &lt;/B&gt;imgFcStep&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;fftImgStep/8;&lt;/P&gt;
&lt;P&gt;for(int&lt;B&gt; &lt;/B&gt;h&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0;&lt;B&gt; &lt;/B&gt;h&lt;B&gt; &lt;/B&gt;&amp;lt;&lt;B&gt; &lt;/B&gt;height&lt;B&gt; &lt;/B&gt;+&lt;B&gt; &lt;/B&gt;4;&lt;B&gt; &lt;/B&gt;++h)&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;Ipp32f*&lt;B&gt; &lt;/B&gt;currentImgRow&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;extImg&lt;B&gt; &lt;/B&gt;+&lt;B&gt; &lt;/B&gt;(h&lt;B&gt; &lt;/B&gt;*&lt;B&gt; &lt;/B&gt;imgCorrectedStep);&lt;/P&gt;
&lt;P&gt;Ipp32fc*&lt;B&gt; &lt;/B&gt;currentFFTImgRow&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;fftImg&lt;B&gt; &lt;/B&gt;+&lt;B&gt; &lt;/B&gt;(h&lt;B&gt; &lt;/B&gt;*&lt;B&gt; &lt;/B&gt;imgFcStep);&lt;/P&gt;
&lt;P&gt;for(int&lt;B&gt; &lt;/B&gt;w&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0;&lt;B&gt; &lt;/B&gt;w&lt;B&gt; &lt;/B&gt;&amp;lt;&lt;B&gt; &lt;/B&gt;width&lt;B&gt; &lt;/B&gt;+&lt;B&gt; &lt;/B&gt;4;&lt;B&gt; &lt;/B&gt;++w)&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;Ipp32f*&lt;B&gt; &lt;/B&gt;currentImg&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;currentImgRow&lt;B&gt; &lt;/B&gt;+&lt;B&gt; &lt;/B&gt;w;&lt;/P&gt;
&lt;P&gt;Ipp32fc*&lt;B&gt; &lt;/B&gt;currentFFTImg&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;currentFFTImgRow&lt;B&gt; &lt;/B&gt;+&lt;B&gt; &lt;/B&gt;w;&lt;/P&gt;
&lt;P&gt;(*currentFFTImg).re&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;*currentImg;&lt;/P&gt;
&lt;P&gt;(*currentFFTImg).im&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0.f;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;// FWD img&lt;/P&gt;
&lt;P&gt;status&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;ippiDFTFwd_CToC_32fc_C1IR(fftImg,&lt;B&gt; &lt;/B&gt;fftImgStep,&lt;B&gt; &lt;/B&gt;spec,&lt;B&gt; &lt;/B&gt;NULL);&lt;/P&gt;
&lt;P&gt;// now multiply both&lt;/P&gt;
&lt;P&gt;status&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;ippiMul_32fc_C1IR(fftKernel,&lt;B&gt; &lt;/B&gt;fftKernelStep,&lt;B&gt; &lt;/B&gt;fftImg,&lt;B&gt; &lt;/B&gt;fftImgStep,&lt;B&gt; &lt;/B&gt;padRoi);&lt;/P&gt;
&lt;P&gt;// inv FFT&lt;/P&gt;
&lt;P&gt;status&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;ippiDFTInv_CToC_32fc_C1IR(fftImg,&lt;B&gt; &lt;/B&gt;fftImgStep,&lt;B&gt; &lt;/B&gt;spec,&lt;B&gt; &lt;/B&gt;NULL);&lt;/P&gt;
&lt;P&gt;// copy back out to extImg&lt;/P&gt;
&lt;P&gt;int&lt;B&gt; &lt;/B&gt;fftCStep&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;fftImgStep/8;&lt;/P&gt;
&lt;P&gt;int&lt;B&gt; &lt;/B&gt;cImgStep&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;extImgStep/4;&lt;/P&gt;
&lt;P&gt;for(int&lt;B&gt; &lt;/B&gt;h&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0;&lt;B&gt; &lt;/B&gt;h&lt;B&gt; &lt;/B&gt;&amp;lt;&lt;B&gt; &lt;/B&gt;height&lt;B&gt; &lt;/B&gt;+&lt;B&gt; &lt;/B&gt;4;&lt;B&gt; &lt;/B&gt;++h)&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;Ipp32fc*&lt;B&gt; &lt;/B&gt;currentFFTRow&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;fftImg&lt;B&gt; &lt;/B&gt;+&lt;B&gt; &lt;/B&gt;(h&lt;B&gt; &lt;/B&gt;*&lt;B&gt; &lt;/B&gt;fftCStep);&lt;/P&gt;
&lt;P&gt;Ipp32f*&lt;B&gt; &lt;/B&gt;currentRow&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;extImg&lt;B&gt; &lt;/B&gt;+&lt;B&gt; &lt;/B&gt;(h&lt;B&gt; &lt;/B&gt;*&lt;B&gt; &lt;/B&gt;cImgStep);&lt;/P&gt;
&lt;P&gt;for(int&lt;B&gt; &lt;/B&gt;w&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;0;&lt;B&gt; &lt;/B&gt;w&lt;B&gt; &lt;/B&gt;&amp;lt;&lt;B&gt; &lt;/B&gt;width&lt;B&gt; &lt;/B&gt;+&lt;B&gt; &lt;/B&gt;4;&lt;B&gt; &lt;/B&gt;++w)&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;Ipp32fc*&lt;B&gt; &lt;/B&gt;currentFFT&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;currentFFTRow&lt;B&gt; &lt;/B&gt;+&lt;B&gt; &lt;/B&gt;w;&lt;/P&gt;
&lt;P&gt;Ipp32f*&lt;B&gt; &lt;/B&gt;currentImg&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;currentRow&lt;B&gt; &lt;/B&gt;+&lt;B&gt; &lt;/B&gt;w;&lt;/P&gt;
&lt;P&gt;*currentImg&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;(*currentFFT).re;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;Ipp32f*&lt;B&gt; &lt;/B&gt;startPt&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;extImg&lt;B&gt; &lt;/B&gt;+&lt;B&gt; &lt;/B&gt;(2&lt;B&gt; &lt;/B&gt;*&lt;B&gt; &lt;/B&gt;cImgStep)&lt;B&gt; &lt;/B&gt;+&lt;B&gt; &lt;/B&gt;2;&lt;B&gt; &lt;/B&gt;// looks better?&lt;/P&gt;
&lt;P&gt;//Ipp32f* startPt = extImg; // shifted???&lt;/P&gt;
&lt;P&gt;status&lt;B&gt; &lt;/B&gt;=&lt;B&gt; &lt;/B&gt;ippiConvert_32f8u_C1R(startPt,&lt;B&gt; &lt;/B&gt;extImgStep,&lt;B&gt; &lt;/B&gt;img,&lt;B&gt; &lt;/B&gt;lineStep,&lt;B&gt; &lt;/B&gt;imgRoi,&lt;B&gt; &lt;/B&gt;ippRndNear);&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;[/cpp]&lt;/P&gt;</description>
      <pubDate>Mon, 07 Jan 2013 10:08:44 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/Gaussian-filter-in-frequency-domain-FFT-question/m-p/985878#M21789</guid>
      <dc:creator>cks2k2</dc:creator>
      <dc:date>2013-01-07T10:08:44Z</dc:date>
    </item>
    <item>
      <title>Could you upload your source</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/Gaussian-filter-in-frequency-domain-FFT-question/m-p/985879#M21790</link>
      <description>Could you upload your source and resulting images ( in a raw-format or as text-images )?</description>
      <pubDate>Tue, 08 Jan 2013 07:06:41 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/Gaussian-filter-in-frequency-domain-FFT-question/m-p/985879#M21790</guid>
      <dc:creator>SergeyKostrov</dc:creator>
      <dc:date>2013-01-08T07:06:41Z</dc:date>
    </item>
    <item>
      <title>Hi Serget, I am uploading the</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/Gaussian-filter-in-frequency-domain-FFT-question/m-p/985880#M21791</link>
      <description>Hi Sergey, I uploaded the source code (some changes made i.e. using 5x5 kernel) and the test/result images.
beach.bmp is the test image (1 channel).
beach_blur.bmp is the result - the borders seem incorrect.
I also tried using ippiFilterGauss with 5x5 kernel and the result is quite different from blurring using FFT.</description>
      <pubDate>Tue, 08 Jan 2013 08:42:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/Gaussian-filter-in-frequency-domain-FFT-question/m-p/985880#M21791</guid>
      <dc:creator>cks2k2</dc:creator>
      <dc:date>2013-01-08T08:42:00Z</dc:date>
    </item>
    <item>
      <title>Hi, Thanks for these uploads!</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/Gaussian-filter-in-frequency-domain-FFT-question/m-p/985881#M21792</link>
      <description>Hi, Thanks for these uploads!

&amp;gt;&amp;gt;I uploaded the source code (some changes made i.e. using 5x5 kernel) and the test/result images.
&amp;gt;&amp;gt;beach.bmp is the test image (1 channel).
&amp;gt;&amp;gt;beach_blur.bmp is the result - &lt;STRONG&gt;the borders seem incorrect&lt;/STRONG&gt;.

To be honest, I don't see any artifacts, or defects, in the resulting image after filtering.

I checked attributes for both bmp-files and I see that sizes are &lt;STRONG&gt;500x333&lt;/STRONG&gt;. So, both numbers are not power of 2 and I would verify a zero-padding steps #1 and #3: (M+U-1)x(N+V-1).

What values for M, N, U and V did you use during your processing?</description>
      <pubDate>Wed, 09 Jan 2013 01:27:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/Gaussian-filter-in-frequency-domain-FFT-question/m-p/985881#M21792</guid>
      <dc:creator>SergeyKostrov</dc:creator>
      <dc:date>2013-01-09T01:27:00Z</dc:date>
    </item>
    <item>
      <title>Hi, for M and N I just use</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/Gaussian-filter-in-frequency-domain-FFT-question/m-p/985882#M21793</link>
      <description>Hi, for M and N I just use the image width and height (500, 333).
For U and V I use kernel width and height (5, 5).
With DFT isn't it not necessary to have numbers which are power of 2?</description>
      <pubDate>Wed, 09 Jan 2013 01:56:46 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/Gaussian-filter-in-frequency-domain-FFT-question/m-p/985882#M21793</guid>
      <dc:creator>cks2k2</dc:creator>
      <dc:date>2013-01-09T01:56:46Z</dc:date>
    </item>
    <item>
      <title>&gt;&gt;...With DFT isn't it not</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/Gaussian-filter-in-frequency-domain-FFT-question/m-p/985883#M21794</link>
      <description>&amp;gt;&amp;gt;...With DFT isn't it not necessary to have numbers which are power of 2?

I checked IPP headers and docs and I didn't find any constraints.</description>
      <pubDate>Thu, 10 Jan 2013 00:49:09 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/Gaussian-filter-in-frequency-domain-FFT-question/m-p/985883#M21794</guid>
      <dc:creator>SergeyKostrov</dc:creator>
      <dc:date>2013-01-10T00:49:09Z</dc:date>
    </item>
  </channel>
</rss>

