<?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 ipp 2017 update 2 Histogram buffer size issue in Intel® Integrated Performance Primitives</title>
    <link>https://community.intel.com/t5/Intel-Integrated-Performance/ipp-2017-update-2-Histogram-buffer-size-issue/m-p/1090599#M24947</link>
    <description>&lt;P&gt;I've encountered a&amp;nbsp; problem of calculating the image histogram when using the latest ipp static library(2017 update 2)&lt;/P&gt;

&lt;P&gt;The issue happened when I call the&lt;EM&gt; ippiHistogramGetBufferSize &lt;/EM&gt;function.I&amp;nbsp;needed to calculate the buffer size before doing histogram for single-float type image, but this function return&amp;nbsp; 0 in&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;sizeBuffer&amp;nbsp;&lt;/EM&gt;&lt;/STRONG&gt;.&amp;nbsp;Then it will crash my histogram calculating code.&amp;nbsp;I doubted it was the potential bug for this function.&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;const int WIDTH = 5;
const int HEIGHT = 5;
const int nbins =5;
int nLevels [] = {nbins +1};
ippiSize roi = {WIDTH,HEIGHT};
int sizeHistObj,sizeBuffer;

ippiHistogramGetBufferSize(&lt;STRONG&gt;ipp32f&lt;/STRONG&gt;, roi, nLevels, 1, 1, &amp;amp;sizeHistObj,&amp;amp;sizeBuffer);
&lt;/PRE&gt;

&lt;P&gt;I've&amp;nbsp;tired&amp;nbsp;ipp8u,ipp16u,ipp16s type, they&amp;nbsp;were ok, although return a big memeory size refer to ipp16u or ipp16s.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Please somebody&amp;nbsp;come&amp;nbsp;to help&amp;nbsp;.&lt;BR /&gt;
	&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 24 Apr 2017 12:37:21 GMT</pubDate>
    <dc:creator>Stella_Y_</dc:creator>
    <dc:date>2017-04-24T12:37:21Z</dc:date>
    <item>
      <title>ipp 2017 update 2 Histogram buffer size issue</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/ipp-2017-update-2-Histogram-buffer-size-issue/m-p/1090599#M24947</link>
      <description>&lt;P&gt;I've encountered a&amp;nbsp; problem of calculating the image histogram when using the latest ipp static library(2017 update 2)&lt;/P&gt;

&lt;P&gt;The issue happened when I call the&lt;EM&gt; ippiHistogramGetBufferSize &lt;/EM&gt;function.I&amp;nbsp;needed to calculate the buffer size before doing histogram for single-float type image, but this function return&amp;nbsp; 0 in&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;sizeBuffer&amp;nbsp;&lt;/EM&gt;&lt;/STRONG&gt;.&amp;nbsp;Then it will crash my histogram calculating code.&amp;nbsp;I doubted it was the potential bug for this function.&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;const int WIDTH = 5;
const int HEIGHT = 5;
const int nbins =5;
int nLevels [] = {nbins +1};
ippiSize roi = {WIDTH,HEIGHT};
int sizeHistObj,sizeBuffer;

ippiHistogramGetBufferSize(&lt;STRONG&gt;ipp32f&lt;/STRONG&gt;, roi, nLevels, 1, 1, &amp;amp;sizeHistObj,&amp;amp;sizeBuffer);
&lt;/PRE&gt;

&lt;P&gt;I've&amp;nbsp;tired&amp;nbsp;ipp8u,ipp16u,ipp16s type, they&amp;nbsp;were ok, although return a big memeory size refer to ipp16u or ipp16s.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Please somebody&amp;nbsp;come&amp;nbsp;to help&amp;nbsp;.&lt;BR /&gt;
	&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Apr 2017 12:37:21 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/ipp-2017-update-2-Histogram-buffer-size-issue/m-p/1090599#M24947</guid>
      <dc:creator>Stella_Y_</dc:creator>
      <dc:date>2017-04-24T12:37:21Z</dc:date>
    </item>
    <item>
      <title>Hi Stella,</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/ipp-2017-update-2-Histogram-buffer-size-issue/m-p/1090600#M24948</link>
      <description>&lt;P&gt;Hi Stella,&lt;/P&gt;

&lt;P&gt;how the bufferSize==0 can crash you code? Could you be more specific and/or provide a reproducer? The size of buffer equal to zero means that this function doesn't need any intermediate buffer for histogram&amp;nbsp;calculation, nothing more.&lt;/P&gt;

&lt;P&gt;regards, Igor&lt;/P&gt;</description>
      <pubDate>Mon, 24 Apr 2017 14:45:53 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/ipp-2017-update-2-Histogram-buffer-size-issue/m-p/1090600#M24948</guid>
      <dc:creator>Igor_A_Intel</dc:creator>
      <dc:date>2017-04-24T14:45:53Z</dc:date>
    </item>
    <item>
      <title>Thanks Igor,</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/ipp-2017-update-2-Histogram-buffer-size-issue/m-p/1090601#M24949</link>
      <description>&lt;P&gt;Thanks Igor, Now I understand the bufferSize==0 is normal behavior. But I can't run the histogram calculation in my program after the initialization. Below is my code:&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;/* fill the data */ 
ippInit(); 

float* hh1 = (float*)malloc( 5 * 6 * sizeof(float) );

for(w =0;w&amp;lt;30;w++) 

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; hh1&lt;W&gt; = (float)3.5*w; 

const int HEIGHT = 5; 

const int WIDTH = 6;

IppiSize roi = {WIDTH, HEIGHT}; 

IppStatus sts; 

{ const int nBins = 5;

&amp;nbsp;int nLevels[] = { nBins+1 }; 

&amp;nbsp;Ipp32f lowerLevel[] = {0}; 

&amp;nbsp;Ipp32f upperLevel[] = {255}; 
&amp;nbsp;int sizeHistObj; 
&amp;nbsp;int sizeBuffer; 
&amp;nbsp;IppiHistogramSpec* pHistObj; 
&amp;nbsp;Ipp8u* pBuffer; 
&amp;nbsp;Ipp32u pHistVec[nBins]; 

&amp;nbsp;//get sizes for spec and buffer 
&amp;nbsp;ippiHistogramGetBufferSize(ipp32f, roi, nLevels, 1/*nChan*/, 1/*uniform*/, &amp;amp;sizeHistObj,&amp;amp;sizeBuffer); 

pHistObj = (IppiHistogramSpec*)ippsMalloc_8u( sizeHistObj ); 

pBuffer = ippsMalloc_8u( sizeBuffer ); 

//initialize spec 
ippiHistogramUniformInit( ipp32f, lowerLevel, upperLevel, nLevels, 1, pHistObj ); 

// calculate histogram 
sts = ippiHistogram_32f_C1R( hh1, WIDTH, roi, pHistVec, pHistObj, pBuffer ); 

ippsFree( pHistObj ); 
ippsFree( pBuffer );

&amp;nbsp;for(i = 0;i&amp;lt;nBins;i++)&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf(" %u \n",++*pHistVec);
}
&lt;/W&gt;&lt;/PRE&gt;

&lt;P&gt;So when I print out the bin value of the histogram, it turns out the wrong number which even greater than the total number of the array.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Apr 2017 02:25:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/ipp-2017-update-2-Histogram-buffer-size-issue/m-p/1090601#M24949</guid>
      <dc:creator>Stella_Y_</dc:creator>
      <dc:date>2017-04-25T02:25:00Z</dc:date>
    </item>
    <item>
      <title>I tested your code, didn't</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/ipp-2017-update-2-Histogram-buffer-size-issue/m-p/1090602#M24950</link>
      <description>&lt;P&gt;I tested your code, didn't find any problem.&lt;/P&gt;

&lt;P&gt;How did you compile the code? Please try to use the following command to build the code.&lt;/P&gt;

&lt;P&gt;gcc test.c -o test -I&amp;lt;IPP_INCLUDE_PATH&amp;gt;&lt;SPAN style="font-size: 13.008px;"&gt;&amp;nbsp;&amp;lt;IPP_LIB_PATH&amp;gt;/libippi.a&amp;nbsp;&amp;lt;IPP_LIB_PATH&amp;gt;/libipps.a&amp;nbsp;&amp;lt;IPP_LIB_PATH&amp;gt;/libippcore.a&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 13.008px;"&gt;B.t.w., you don't need to call ippInit() anymore. It will be called automatically.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Apr 2017 07:17:25 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/ipp-2017-update-2-Histogram-buffer-size-issue/m-p/1090602#M24950</guid>
      <dc:creator>Jing_Xu</dc:creator>
      <dc:date>2017-04-25T07:17:25Z</dc:date>
    </item>
    <item>
      <title>Hi Stella,</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/ipp-2017-update-2-Histogram-buffer-size-issue/m-p/1090603#M24951</link>
      <description>&lt;P&gt;Hi Stella,&lt;/P&gt;

&lt;P&gt;1) you don't analyze status code after IPP function execution - with your code it indicates "wrong step"&lt;/P&gt;

&lt;P&gt;2) you've forgotten that step is in bytes -&amp;nbsp;therefore you should multiply it by sizeof( float )&lt;/P&gt;

&lt;P&gt;below is a bit corrected code:&lt;/P&gt;

&lt;DIV&gt;#include &amp;lt;stdio.h&amp;gt;&lt;BR /&gt;
	#include "ipp.h"&lt;/DIV&gt;

&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;

&lt;DIV&gt;#define nBins 5&lt;/DIV&gt;

&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;

&lt;DIV&gt;int main(){&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; int w;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; float *hh1;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; const int HEIGHT = 5;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; const int WIDTH = 6;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; IppiSize roi = {WIDTH, HEIGHT};&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; IppStatus sts;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; int nLevels[] = { nBins+1 };&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; Ipp32f lowerLevel[] = {0};&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; Ipp32f upperLevel[] = {255};&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; int sizeHistObj;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; int sizeBuffer;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; IppiHistogramSpec* pHistObj;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; Ipp8u* pBuffer;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; Ipp32u pHistVec[nBins];&lt;/DIV&gt;

&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;

&lt;DIV&gt;&amp;nbsp;/* fill the data */&lt;/DIV&gt;

&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;

&lt;DIV&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp; ippInit(); /* rudiment, exists for compatibility with "old" IPP versions */&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; hh1 = (float*)ippsMalloc_32f( HEIGHT * WIDTH );&lt;/DIV&gt;

&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;

&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for( w = 0; w &amp;lt; HEIGHT * WIDTH; w++ ){&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; hh1&lt;W&gt; = (float)3.5 * w;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/W&gt;&lt;/DIV&gt;

&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;

&lt;DIV&gt;//get sizes for spec and buffer&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; ippiHistogramGetBufferSize( ipp32f, roi, nLevels, 1/*nChan*/, 1/*uniform*/, &amp;amp;sizeHistObj, &amp;amp;sizeBuffer );&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; pHistObj = (IppiHistogramSpec*)ippsMalloc_8u( sizeHistObj );&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; pBuffer = ippsMalloc_8u( sizeBuffer );&lt;/DIV&gt;

&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;

&lt;DIV&gt;//initialize spec&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; ippiHistogramUniformInit( ipp32f, lowerLevel, upperLevel, nLevels, 1, pHistObj );&lt;/DIV&gt;

&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;

&lt;DIV&gt;// calculate histogram&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; sts = ippiHistogram_32f_C1R( hh1, WIDTH * sizeof( Ipp32f ), roi, pHistVec, pHistObj, pBuffer );&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; if( ippStsNoErr != sts ){&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf( "%s\n", ippGetStatusString( sts ));&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return( -1 );&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; for( w = 0; w &amp;lt; nBins; w++ ){&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf("bin = %d contains %d values\n", w, pHistVec&lt;W&gt; );&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; ippsFree( hh1 );&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; ippsFree( pHistObj );&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; ippsFree( pBuffer );&lt;/W&gt;&lt;/DIV&gt;

&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;

&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return 0;&lt;BR /&gt;
	&amp;nbsp;}&lt;/DIV&gt;

&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;

&lt;P&gt;it works correctly:&lt;/P&gt;

&lt;P&gt;bin = 0 contains 15 values&lt;BR /&gt;
	bin = 1 contains 15 values&lt;BR /&gt;
	bin = 2 contains 0 values&lt;BR /&gt;
	bin = 3 contains 0 values&lt;BR /&gt;
	bin = 4 contains 0 values&lt;BR /&gt;
	Press any key to continue . . .&lt;/P&gt;

&lt;P&gt;regards, Igor&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Apr 2017 09:54:09 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/ipp-2017-update-2-Histogram-buffer-size-issue/m-p/1090603#M24951</guid>
      <dc:creator>Igor_A_Intel</dc:creator>
      <dc:date>2017-04-25T09:54:09Z</dc:date>
    </item>
    <item>
      <title>Great Thanks, Igor and Jing.</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/ipp-2017-update-2-Histogram-buffer-size-issue/m-p/1090604#M24952</link>
      <description>&lt;P&gt;Great Thanks, Igor and Jing.&lt;/P&gt;

&lt;P&gt;Now I find out the root cause of the program failure, in the ippiHistogram_&amp;lt;mod&amp;gt; function the srcStep parameter should be set in byte. when I&amp;nbsp;modified the code&amp;nbsp;as Igor suggested, the program ran correctly then.&lt;/P&gt;

&lt;P&gt;regards,&lt;/P&gt;

&lt;P&gt;Stella&lt;/P&gt;</description>
      <pubDate>Wed, 26 Apr 2017 02:42:52 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/ipp-2017-update-2-Histogram-buffer-size-issue/m-p/1090604#M24952</guid>
      <dc:creator>Stella_Y_</dc:creator>
      <dc:date>2017-04-26T02:42:52Z</dc:date>
    </item>
  </channel>
</rss>

