<?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 Greetings Kristian, in Intel® Integrated Performance Primitives</title>
    <link>https://community.intel.com/t5/Intel-Integrated-Performance/IPP903-ippiPyramidLayerDown-32f-C1R-is-giving-access-violation/m-p/1103881#M25219</link>
    <description>&lt;P&gt;Greetings Kristian,&lt;/P&gt;

&lt;P&gt;You are on the right track. Very good work to visualize the offsets of each field in the struct, now you can see where the problem is.&lt;/P&gt;

&lt;P&gt;My main development platform is Delphi/Pascal and there, I can declare a struct as a record, and in addition, as a packed record. A packed record is a struct in which the fields are positioned without "air", also less code-efficient, but often a useful feature; i.e., if saving a struct to file.&lt;/P&gt;

&lt;P&gt;In your world, your C# starts at offset 8; this looks like a class, since a class can have a VMT in the beginning.&lt;/P&gt;

&lt;P&gt;Your work will be: in C#, how can you define a raw struct, ending up with what you see in C++.&lt;/P&gt;

&lt;P&gt;Thomas&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 27 Jun 2016 16:46:57 GMT</pubDate>
    <dc:creator>Thomas_Jensen1</dc:creator>
    <dc:date>2016-06-27T16:46:57Z</dc:date>
    <item>
      <title>[IPP903] ippiPyramidLayerDown_32f_C1R is giving access violation errors</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/IPP903-ippiPyramidLayerDown-32f-C1R-is-giving-access-violation/m-p/1103876#M25214</link>
      <description>&lt;P&gt;Dear Intel&lt;/P&gt;

&lt;P&gt;We are working on updating our software in C# from IPP 8.0.2 to IPP 9.0.3.&lt;/P&gt;

&lt;P&gt;We have problems calling “ippiPyramidLayerDown_32f_C1R”. Calling “ippiPyramidLayerDown_8u_C1R” works fine and gives no errors.&lt;/P&gt;

&lt;P&gt;We have noticed the following:&lt;/P&gt;

&lt;UL&gt;
	&lt;LI&gt;Sometimes we get an error of access violation.&lt;/LI&gt;
	&lt;LI&gt;Sometimes we get a return value of -6 corresponding to “ippStsSizeErr: Incorrect value for data size”.&lt;/LI&gt;
	&lt;LI&gt;There The values of the width and height in the pPyramidStruct[0].pRoi[0] is wrong.&lt;BR /&gt;
		Our roi is 513x511 and the value in pRoi[0] is 492247304x0.&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pRoiError.PNG"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/8914i184806602FEF9390/image-size/large?v=v2&amp;amp;px=999&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" role="button" title="pRoiError.PNG" alt="pRoiError.PNG" /&gt;&lt;/span&gt;&lt;BR /&gt;
	&lt;BR /&gt;
	Our C# implementation of the “IppiPyramid” structure look like this (and is also attached):&lt;BR /&gt;
	&lt;BR /&gt;
	&lt;span class="lia-inline-image-display-wrapper" image-alt="ippiPyramid.PNG"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/8915i556DAD138399A08F/image-size/large?v=v2&amp;amp;px=999&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" role="button" title="ippiPyramid.PNG" alt="ippiPyramid.PNG" /&gt;&lt;/span&gt;&lt;BR /&gt;
	Please find attached the C# code for the dll imports and the pyramidDown function.&lt;BR /&gt;
	&lt;BR /&gt;
	Are we implementing the “IppiPyramid” structure wrongly?&lt;BR /&gt;
	&lt;BR /&gt;
	Best Regards&lt;BR /&gt;
	Kristian Thomsen&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jun 2016 15:55:33 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/IPP903-ippiPyramidLayerDown-32f-C1R-is-giving-access-violation/m-p/1103876#M25214</guid>
      <dc:creator>Lars_A_</dc:creator>
      <dc:date>2016-06-21T15:55:33Z</dc:date>
    </item>
    <item>
      <title>Just a thought, are you very</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/IPP903-ippiPyramidLayerDown-32f-C1R-is-giving-access-violation/m-p/1103877#M25215</link>
      <description>&lt;P&gt;Just a thought, are you very sure that your C# struct "private struct IppiPyramid" is compatible in size with IPP?&lt;/P&gt;

&lt;P&gt;If any member is aligned differently, or has a difference in 32-bit / 64-bit, it will fail.&lt;/P&gt;

&lt;P&gt;Thomas&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jun 2016 07:38:57 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/IPP903-ippiPyramidLayerDown-32f-C1R-is-giving-access-violation/m-p/1103877#M25215</guid>
      <dc:creator>Thomas_Jensen1</dc:creator>
      <dc:date>2016-06-22T07:38:57Z</dc:date>
    </item>
    <item>
      <title>Dear Thomas</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/IPP903-ippiPyramidLayerDown-32f-C1R-is-giving-access-violation/m-p/1103878#M25216</link>
      <description>&lt;P&gt;Dear Thomas&lt;/P&gt;

&lt;P&gt;Thank you for your response.&lt;/P&gt;

&lt;P&gt;We are running all our software in 64bit.&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
	&lt;P&gt;are you very sure that your C# struct "private struct IppiPyramid" is compatible in size with IPP?&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;No, we don't know that for sure. Do you know how we can check it?&lt;/P&gt;

&lt;P&gt;Regards Kristian&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jun 2016 09:38:58 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/IPP903-ippiPyramidLayerDown-32f-C1R-is-giving-access-violation/m-p/1103878#M25216</guid>
      <dc:creator>Lars_A_</dc:creator>
      <dc:date>2016-06-23T09:38:58Z</dc:date>
    </item>
    <item>
      <title>Look in ippcv.h :</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/IPP903-ippiPyramidLayerDown-32f-C1R-is-giving-access-violation/m-p/1103879#M25217</link>
      <description>&lt;P&gt;Look in ippcv.h :&lt;/P&gt;

&lt;P&gt;typedef struct _IppiPyramid {&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; Ipp8u&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; **pImage;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; IppiSize&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *pRoi;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; Ipp64f&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *pRate;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; int&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *pStep;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; Ipp8u&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *pState;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; int&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; level;&lt;BR /&gt;
	} IppiPyramid;&lt;/P&gt;

&lt;P&gt;&lt;BR /&gt;
	A test could be to compare sizeof of the C++ and C# structures; they should be the same.&lt;/P&gt;

&lt;P&gt;Thomas&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jun 2016 11:43:20 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/IPP903-ippiPyramidLayerDown-32f-C1R-is-giving-access-violation/m-p/1103879#M25217</guid>
      <dc:creator>Thomas_Jensen1</dc:creator>
      <dc:date>2016-06-23T11:43:20Z</dc:date>
    </item>
    <item>
      <title>Thank you for your answer</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/IPP903-ippiPyramidLayerDown-32f-C1R-is-giving-access-violation/m-p/1103880#M25218</link>
      <description>&lt;P&gt;Thank you for your answer Thomas.&lt;BR /&gt;
	&lt;BR /&gt;
	We have made a small C++ consol application and tested the sizeof the IppiPyramid struct. We have also tested it in C#. Both in C++ and C# we get a size of 48 in 64bit. (we are only interested in using 64 bit.) The code is attached.&lt;/P&gt;

&lt;P&gt;However when we print out the address in memory of each &lt;SPAN class="st"&gt;variable in the&amp;nbsp;&lt;/SPAN&gt;IppiPyramid &lt;SPAN class="st"&gt; struct we see that the each variabel in the C# implementation is placed with an offset of 8 bytes when &lt;/SPAN&gt;compared &lt;SPAN class="st"&gt;to the C++ implementation.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;In C++ this method was used:&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;IppiPyramid pyr;
std::cout &amp;lt;&amp;lt; (unsigned long)&amp;amp;pyr.pImage - (unsigned long)&amp;amp;pyr;&lt;/PRE&gt;

&lt;P&gt;In C# this method was used:&lt;/P&gt;

&lt;PRE class="brush:csharp;"&gt;var pyr = new IppiPyramid();
ulong ptrMain;
{

	TypedReference tr = __makeref(pyr);
	IntPtr ptr = **(IntPtr**)(&amp;amp;tr);
	string pointerDisplay = ptr.ToString();
	Console.Write("pyr:");
	Console.WriteLine(pointerDisplay);
	ptrMain = (ulong)ptr;
}
fixed (void* adress = &amp;amp;pyr.pImage)
{
	Console.Write("pImage:");
	Console.WriteLine((ulong)adress - ptrMain);
}&lt;/PRE&gt;

&lt;P&gt;The output looks like this:&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="adressOffset.PNG"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/8916i8EBB0A1E132A8E2D/image-size/large?v=v2&amp;amp;px=999&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" role="button" title="adressOffset.PNG" alt="adressOffset.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;UL&gt;
	&lt;LI&gt;We are not sure what to make out of this though?&lt;/LI&gt;
	&lt;LI&gt;In C# should IppiPyramid be a class or a struct?&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;Our code is attached.&lt;BR /&gt;
	&lt;BR /&gt;
	Regards Kristian&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jun 2016 15:55:41 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/IPP903-ippiPyramidLayerDown-32f-C1R-is-giving-access-violation/m-p/1103880#M25218</guid>
      <dc:creator>Lars_A_</dc:creator>
      <dc:date>2016-06-27T15:55:41Z</dc:date>
    </item>
    <item>
      <title>Greetings Kristian,</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/IPP903-ippiPyramidLayerDown-32f-C1R-is-giving-access-violation/m-p/1103881#M25219</link>
      <description>&lt;P&gt;Greetings Kristian,&lt;/P&gt;

&lt;P&gt;You are on the right track. Very good work to visualize the offsets of each field in the struct, now you can see where the problem is.&lt;/P&gt;

&lt;P&gt;My main development platform is Delphi/Pascal and there, I can declare a struct as a record, and in addition, as a packed record. A packed record is a struct in which the fields are positioned without "air", also less code-efficient, but often a useful feature; i.e., if saving a struct to file.&lt;/P&gt;

&lt;P&gt;In your world, your C# starts at offset 8; this looks like a class, since a class can have a VMT in the beginning.&lt;/P&gt;

&lt;P&gt;Your work will be: in C#, how can you define a raw struct, ending up with what you see in C++.&lt;/P&gt;

&lt;P&gt;Thomas&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jun 2016 16:46:57 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/IPP903-ippiPyramidLayerDown-32f-C1R-is-giving-access-violation/m-p/1103881#M25219</guid>
      <dc:creator>Thomas_Jensen1</dc:creator>
      <dc:date>2016-06-27T16:46:57Z</dc:date>
    </item>
    <item>
      <title>We tried changing from class</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/IPP903-ippiPyramidLayerDown-32f-C1R-is-giving-access-violation/m-p/1103882#M25220</link>
      <description>&lt;P&gt;We tried changing from class to a struct, and the offsets are now identical to the C++ ones.&lt;/P&gt;

&lt;P&gt;But we still have problem passing the structure to the functions that uses the ippiPyramid.&lt;/P&gt;

&lt;P&gt;Conceptually, I don't really understand how it could work... for instance, we allocate:&lt;/P&gt;

&lt;PRE class="brush:csharp;"&gt;IppiPyramid pyr;
IppiPyramid* pPyramidStruct = &amp;amp;pyr;
&lt;/PRE&gt;

&lt;P&gt;and initialize&lt;/P&gt;

&lt;PRE class="brush:csharp;"&gt;ippStatus = ippiPyramidGetSize(&amp;amp;pyramidStructSize, &amp;amp;pyramidBufferSize, level, input.GetRoiSize(), rate);
HandleReturnValue(ippStatus);
&lt;/PRE&gt;

&lt;P&gt;in the C++ example from Intel the following happens&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;IppiPyramid *pPyrStruct    = NULL;
 
...

/* Initializes Gaussian structure for pyramids */
check_sts( status = ippiPyramidInit(&amp;amp;pPyrStruct, level, roiSize, rate, pPyrStrBuffer, pPyrBuffer) )
&lt;/PRE&gt;

&lt;P&gt;now from what I understand, the pyrimadStruct is 'really' allocated inside the pyramidInit, and then the pPyrStruct pointer is updated to point to the allocated memory...&lt;/P&gt;

&lt;P&gt;This allocated memory is then unmanaged memory, how will .net manage that?&lt;/P&gt;

&lt;P&gt;Is there something I am missing?&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jun 2016 14:17:41 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/IPP903-ippiPyramidLayerDown-32f-C1R-is-giving-access-violation/m-p/1103882#M25220</guid>
      <dc:creator>Lars_A_</dc:creator>
      <dc:date>2016-06-28T14:17:41Z</dc:date>
    </item>
  </channel>
</rss>

