<?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 Using custom dll in C# program in Intel® Integrated Performance Primitives</title>
    <link>https://community.intel.com/t5/Intel-Integrated-Performance/Using-custom-dll-in-C-program/m-p/877011#M9654</link>
    <description>I'm doing a custom dll so that I can use it in C# by using PInvoke. One of the function i need to include in my custom dll is ippiRGBToYUV420_8u_C3P3. I'm not sure how should Icode it as there's a pointer array andI'm not surehowto call it in C# using intptr pointer. &lt;BR /&gt;&lt;BR /&gt;The code i wrote is as follow:&lt;BR /&gt;&lt;BR /&gt;/*_________in my custom dll_____________*/&lt;BR /&gt;&lt;BR /&gt;int CIppEncoder::RGBtoYUV(BYTE* pSrc, BYTE ** pDst, int width, int height){&lt;BR /&gt;IppiSize imgSize;&lt;BR /&gt;imgSize.height = height;&lt;BR /&gt;imgSize.width = width;&lt;BR /&gt;IppStatus check;&lt;BR /&gt;check = ippiRGBToYUV420_8u_C3P3((Ipp8u*) pSrc, (Ipp8u**) pDst, (IppiSize) imgSize);&lt;BR /&gt;&lt;BR /&gt;if (check == ippStsNullPtrErr) { return -1;}&lt;BR /&gt;if (check == ippStsSizeErr ) {return -2;}&lt;BR /&gt;if (check == ippStsDoubleSize) {return -3;}&lt;BR /&gt;&lt;BR /&gt;return 1;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;//function to export&lt;BR /&gt;&lt;BR /&gt;IPPENCODER_API int BGRtoYUV(void* objPtr, BYTE* pSrc, BYTE ** pDst, int width, int height){&lt;BR /&gt;CIppEncoder* encodeSample = (CIppEncoder*) objPtr;&lt;BR /&gt;if (encodeSample)&lt;BR /&gt;return encodeSample-&amp;gt;RGBtoYUV(pSrc, pDst, width, height);&lt;BR /&gt;else&lt;BR /&gt;return -5;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;/*________in my C# code_____________*/&lt;BR /&gt;&lt;BR /&gt;//under class SampleDllLib&lt;BR /&gt;&lt;BR /&gt;[DllImport("IppEncoder.dll")]&lt;BR /&gt;internal static extern int BGRtoYUV(IntPtr objPtr, IntPtr pSrc, IntPtr pDst, int width, int height);&lt;BR /&gt;&lt;BR /&gt;//under my calling program&lt;BR /&gt;IntPtr dstImg = Marshal.AllocCoTaskMem(m_videoHeight * m_videoWidth * 2 * 3);&lt;BR /&gt;&lt;BR /&gt;if (m_SampleEncoder == IntPtr.Zero)&lt;BR /&gt;MessageBox.Show("Can't open IppEncoder.DLL!");&lt;BR /&gt;else&lt;BR /&gt;{&lt;BR /&gt;int result = SampleDllLib.BGRtoYUV(m_SampleEncoder, pRGB2, dstImg, TARGET_IMAGE_WIDTH, TARGET_IMAGE_HEIGHT);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;My codewill always return me a -1. May i know which part of the code is wrong? Is it with the dstImg?&lt;BR /&gt;&lt;BR /&gt;Thanks in advance.</description>
    <pubDate>Mon, 07 Sep 2009 07:44:58 GMT</pubDate>
    <dc:creator>yanqin</dc:creator>
    <dc:date>2009-09-07T07:44:58Z</dc:date>
    <item>
      <title>Using custom dll in C# program</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/Using-custom-dll-in-C-program/m-p/877011#M9654</link>
      <description>I'm doing a custom dll so that I can use it in C# by using PInvoke. One of the function i need to include in my custom dll is ippiRGBToYUV420_8u_C3P3. I'm not sure how should Icode it as there's a pointer array andI'm not surehowto call it in C# using intptr pointer. &lt;BR /&gt;&lt;BR /&gt;The code i wrote is as follow:&lt;BR /&gt;&lt;BR /&gt;/*_________in my custom dll_____________*/&lt;BR /&gt;&lt;BR /&gt;int CIppEncoder::RGBtoYUV(BYTE* pSrc, BYTE ** pDst, int width, int height){&lt;BR /&gt;IppiSize imgSize;&lt;BR /&gt;imgSize.height = height;&lt;BR /&gt;imgSize.width = width;&lt;BR /&gt;IppStatus check;&lt;BR /&gt;check = ippiRGBToYUV420_8u_C3P3((Ipp8u*) pSrc, (Ipp8u**) pDst, (IppiSize) imgSize);&lt;BR /&gt;&lt;BR /&gt;if (check == ippStsNullPtrErr) { return -1;}&lt;BR /&gt;if (check == ippStsSizeErr ) {return -2;}&lt;BR /&gt;if (check == ippStsDoubleSize) {return -3;}&lt;BR /&gt;&lt;BR /&gt;return 1;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;//function to export&lt;BR /&gt;&lt;BR /&gt;IPPENCODER_API int BGRtoYUV(void* objPtr, BYTE* pSrc, BYTE ** pDst, int width, int height){&lt;BR /&gt;CIppEncoder* encodeSample = (CIppEncoder*) objPtr;&lt;BR /&gt;if (encodeSample)&lt;BR /&gt;return encodeSample-&amp;gt;RGBtoYUV(pSrc, pDst, width, height);&lt;BR /&gt;else&lt;BR /&gt;return -5;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;/*________in my C# code_____________*/&lt;BR /&gt;&lt;BR /&gt;//under class SampleDllLib&lt;BR /&gt;&lt;BR /&gt;[DllImport("IppEncoder.dll")]&lt;BR /&gt;internal static extern int BGRtoYUV(IntPtr objPtr, IntPtr pSrc, IntPtr pDst, int width, int height);&lt;BR /&gt;&lt;BR /&gt;//under my calling program&lt;BR /&gt;IntPtr dstImg = Marshal.AllocCoTaskMem(m_videoHeight * m_videoWidth * 2 * 3);&lt;BR /&gt;&lt;BR /&gt;if (m_SampleEncoder == IntPtr.Zero)&lt;BR /&gt;MessageBox.Show("Can't open IppEncoder.DLL!");&lt;BR /&gt;else&lt;BR /&gt;{&lt;BR /&gt;int result = SampleDllLib.BGRtoYUV(m_SampleEncoder, pRGB2, dstImg, TARGET_IMAGE_WIDTH, TARGET_IMAGE_HEIGHT);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;My codewill always return me a -1. May i know which part of the code is wrong? Is it with the dstImg?&lt;BR /&gt;&lt;BR /&gt;Thanks in advance.</description>
      <pubDate>Mon, 07 Sep 2009 07:44:58 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/Using-custom-dll-in-C-program/m-p/877011#M9654</guid>
      <dc:creator>yanqin</dc:creator>
      <dc:date>2009-09-07T07:44:58Z</dc:date>
    </item>
    <item>
      <title>Re: Using custom dll in C# program</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/Using-custom-dll-in-C-program/m-p/877012#M9655</link>
      <description>&lt;DIV style="margin:0px;"&gt;
&lt;DIV id="quote_reply" style="margin-top: 5px; width: 100%;"&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;Quoting - &lt;A href="https://community.intel.com/en-us/profile/441042"&gt;yanqin&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="background-color:#E5E5E5; padding:5px;border: 1px; border-style: inset;margin-left:2px;margin-right:2px;"&gt;&lt;EM&gt;I'm doing a custom dll so that I can use it in C# by using PInvoke. One of the function i need to include in my custom dll is ippiRGBToYUV420_8u_C3P3. I'm not sure how should Icode it as there's a pointer array andI'm not surehowto call it in C# using intptr pointer. &lt;BR /&gt;&lt;BR /&gt;The code i wrote is as follow:&lt;BR /&gt;&lt;BR /&gt;/*_________in my custom dll_____________*/&lt;BR /&gt;&lt;BR /&gt;int CIppEncoder::RGBtoYUV(BYTE* pSrc, BYTE ** pDst, int width, int height){&lt;BR /&gt;IppiSize imgSize;&lt;BR /&gt;imgSize.height = height;&lt;BR /&gt;imgSize.width = width;&lt;BR /&gt;IppStatus check;&lt;BR /&gt;check = ippiRGBToYUV420_8u_C3P3((Ipp8u*) pSrc, (Ipp8u**) pDst, (IppiSize) imgSize);&lt;BR /&gt;&lt;BR /&gt;if (check == ippStsNullPtrErr) { return -1;}&lt;BR /&gt;if (check == ippStsSizeErr ) {return -2;}&lt;BR /&gt;if (check == ippStsDoubleSize) {return -3;}&lt;BR /&gt;&lt;BR /&gt;return 1;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;//function to export&lt;BR /&gt;&lt;BR /&gt;IPPENCODER_API int BGRtoYUV(void* objPtr, BYTE* pSrc, BYTE ** pDst, int width, int height){&lt;BR /&gt;CIppEncoder* encodeSample = (CIppEncoder*) objPtr;&lt;BR /&gt;if (encodeSample)&lt;BR /&gt;return encodeSample-&amp;gt;RGBtoYUV(pSrc, pDst, width, height);&lt;BR /&gt;else&lt;BR /&gt;return -5;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;/*________in my C# code_____________*/&lt;BR /&gt;&lt;BR /&gt;//under class SampleDllLib&lt;BR /&gt;&lt;BR /&gt;[DllImport("IppEncoder.dll")]&lt;BR /&gt;internal static extern int BGRtoYUV(IntPtr objPtr, IntPtr pSrc, IntPtr pDst, int width, int height);&lt;BR /&gt;&lt;BR /&gt;//under my calling program&lt;BR /&gt;IntPtr dstImg = Marshal.AllocCoTaskMem(m_videoHeight * m_videoWidth * 2 * 3);&lt;BR /&gt;&lt;BR /&gt;if (m_SampleEncoder == IntPtr.Zero)&lt;BR /&gt;MessageBox.Show("Can't open IppEncoder.DLL!");&lt;BR /&gt;else&lt;BR /&gt;{&lt;BR /&gt;int result = SampleDllLib.BGRtoYUV(m_SampleEncoder, pRGB2, dstImg, TARGET_IMAGE_WIDTH, TARGET_IMAGE_HEIGHT);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;My codewill always return me a -1. May i know which part of the code is wrong? Is it with the dstImg?&lt;BR /&gt;&lt;BR /&gt;Thanks in advance.&lt;/EM&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;BR /&gt;Hello, &lt;BR /&gt;&lt;BR /&gt;IPP provide some C# sample, like image processing, string processingand provide docomention how to do these.would you like try them at&amp;lt;&amp;lt;&lt;A href="http://software.intel.com/en-us/articles/intel-integrated-performance-primitives-code-samples/"&gt;http://software.intel.com/en-us/articles/intel-integrated-performance-primitives-code-samples/&lt;/A&gt;&amp;gt;&amp;gt;? &lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Ying</description>
      <pubDate>Tue, 08 Sep 2009 07:37:05 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/Using-custom-dll-in-C-program/m-p/877012#M9655</guid>
      <dc:creator>Ying_H_Intel</dc:creator>
      <dc:date>2009-09-08T07:37:05Z</dc:date>
    </item>
    <item>
      <title>Re: Using custom dll in C# program</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/Using-custom-dll-in-C-program/m-p/877013#M9656</link>
      <description>&lt;BR /&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;Thanks for your help. I overlook that example. I'm able to use the function now. May i ask how could i get just a single pointer to point to the converted YUV data instead of an array of pointers to each color plane?&lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt;IppStatus ippiRGBToYUV420_8u_C3P3(const Ipp8u* pSrc, Ipp8u* pDst[3], IppiSize imgSize)&lt;/EM&gt; return me an array pointer. &lt;BR /&gt;&lt;BR /&gt;I use to try compose everything to one pointer with the below function but I get a totally green image as output&lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt;IppStatus ippiCopy_8u_P3C3R( const Ipp&lt;DATATYPE&gt;* const pSrc[3], int srcStep, Ipp&lt;DATATYPE&gt;* pDst, int dstStep, IppiSize roiSize);&lt;BR /&gt;&lt;/DATATYPE&gt;&lt;/DATATYPE&gt;&lt;/EM&gt;&lt;BR /&gt;I'm my roiSize is my whole image and my srcStep and dstStep is 0 for the function i use. Please help and thanks.&lt;BR /&gt;&lt;BR /&gt;YanQin&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 09 Sep 2009 01:51:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/Using-custom-dll-in-C-program/m-p/877013#M9656</guid>
      <dc:creator>yanqin</dc:creator>
      <dc:date>2009-09-09T01:51:00Z</dc:date>
    </item>
    <item>
      <title>Re: Using custom dll in C# program</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/Using-custom-dll-in-C-program/m-p/877014#M9657</link>
      <description>&lt;DIV style="margin:0px;"&gt;&lt;/DIV&gt;
&lt;BR /&gt;Hi YanQin,&lt;BR /&gt;&lt;BR /&gt;Seem a little hardif use ippiCopy_8u_P3C3R as the 3 seperateYUV planehave diferent stepByte,your pDst dstStep can be neither 0, nor Width of Y,U,V.&lt;BR /&gt;&lt;BR /&gt;As I understand, you hope to store YUV420 3 plane in one consecutive Array, right? For example,theRGB image is 320x240.&lt;BR /&gt;Then your first part of connect_YUV array is Y(320x240), then U (160x120), then V (160x120). &lt;BR /&gt;&lt;BR /&gt;is there any reason for you to use such kind of array? mayyour follow operationuse the YUV 420 in one array?&lt;BR /&gt;If you have toconnectthe3 seperate arraystogether, you may copy them one by one.&lt;BR /&gt;ippiCopy_8u_C1R(Yplane, Ystep, pDst, Ystep, roiSize)&lt;BR /&gt;ippiCopy_8u_C1R(Uplane, Ustep, pDst+Ystep*height, roisize/2);&lt;BR /&gt;ippiCopy_8u_C1R(Vplane, Vstep, pDst+5*Ystep*height/4, roisize/2);&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Ying &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 11 Sep 2009 09:09:34 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/Using-custom-dll-in-C-program/m-p/877014#M9657</guid>
      <dc:creator>Ying_H_Intel</dc:creator>
      <dc:date>2009-09-11T09:09:34Z</dc:date>
    </item>
    <item>
      <title>Re: Using custom dll in C# program</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/Using-custom-dll-in-C-program/m-p/877015#M9658</link>
      <description>&lt;DIV style="margin:0px;"&gt;&lt;/DIV&gt;
&lt;BR /&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;Yes. I would like to store the 3 plane in a consecutive array. I wanted to do so because i wanted to pass encode this data to h264 format. As for the code i used for encoding h264, it's the one providedat &lt;A href="http://software.intel.com/en-us/articles/getting-started-with-intel-ipp-unified-media-classes-sample/"&gt;http://software.intel.com/en-us/articles/getting-started-with-intel-ipp-unified-media-classes-sample/&lt;/A&gt;&lt;BR /&gt;under EncodeStream, the code required me to pass in a ipp8u* data instead of an array. &lt;BR /&gt;Is there any other approach thatcan use? like changing thesomelines in the encoder topass in the array?&lt;BR /&gt;&lt;BR /&gt;Best Regards,&lt;BR /&gt;YanQin</description>
      <pubDate>Fri, 11 Sep 2009 10:02:14 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/Using-custom-dll-in-C-program/m-p/877015#M9658</guid>
      <dc:creator>yanqin</dc:creator>
      <dc:date>2009-09-11T10:02:14Z</dc:date>
    </item>
    <item>
      <title>Re: Using custom dll in C# program</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/Using-custom-dll-in-C-program/m-p/877016#M9659</link>
      <description>&lt;DIV style="margin:0px;"&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;Thanks for your help. I've already found a solution to my problems. I amend the simple encoder so that it could read in the 3 plane seperately instead of taking it as a single pointer.&lt;BR /&gt;&lt;BR /&gt;For people who encounter the same problem as me, this is what i reference from:&lt;BR /&gt;&lt;A href="http://software.intel.com/en-us/forums/showthread.php?t=64882"&gt;http://software.intel.com/en-us/forums/showthread.php?t=64882&lt;/A&gt;&lt;/DIV&gt;
&lt;P&gt;&lt;BR /&gt;i change &lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt;DataIn.SetBufferPointer((Ipp8u* cYUVData,imgWidth*imgHeight*3/2);&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;to &lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt;DataIn-&amp;gt;SetPlanePointer(cYUVData[0], 0); // Y&lt;BR /&gt;DataIn-&amp;gt;SetPlanePointer(cYUVData[1], 1); // U&lt;BR /&gt;DataIn-&amp;gt;SetPlanePointer(cYUVData[2], 2); // V&lt;BR /&gt;&lt;BR /&gt;&lt;/EM&gt;Best regards,&lt;BR /&gt;YanQin&lt;/P&gt;</description>
      <pubDate>Mon, 14 Sep 2009 05:40:59 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/Using-custom-dll-in-C-program/m-p/877016#M9659</guid>
      <dc:creator>yanqin</dc:creator>
      <dc:date>2009-09-14T05:40:59Z</dc:date>
    </item>
    <item>
      <title>Re: Using custom dll in C# program</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/Using-custom-dll-in-C-program/m-p/877017#M9660</link>
      <description>&lt;DIV style="margin:0px;"&gt;
&lt;DIV id="quote_reply" style="margin-top: 5px; width: 100%;"&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;Quoting - &lt;A href="https://community.intel.com/en-us/profile/441042"&gt;yanqin&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="background-color:#E5E5E5; padding:5px;border: 1px; border-style: inset;margin-left:2px;margin-right:2px;"&gt;&lt;EM&gt;
&lt;DIV style="margin:0px;"&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;Thanks for your help. I've already found a solution to my problems. I amend the simple encoder so that it could read in the 3 plane seperately instead of taking it as a single pointer.&lt;BR /&gt;&lt;BR /&gt;For people who encounter the same problem as me, this is what i reference from:&lt;BR /&gt;&lt;A href="http://software.intel.com/en-us/forums/showthread.php?t=64882"&gt;http://software.intel.com/en-us/forums/showthread.php?t=64882&lt;/A&gt;&lt;/DIV&gt;
&lt;P&gt;&lt;BR /&gt;i change &lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt;DataIn.SetBufferPointer((Ipp8u* cYUVData,imgWidth*imgHeight*3/2);&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;to &lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt;DataIn-&amp;gt;SetPlanePointer(cYUVData[0], 0); // Y&lt;BR /&gt;DataIn-&amp;gt;SetPlanePointer(cYUVData[1], 1); // U&lt;BR /&gt;DataIn-&amp;gt;SetPlanePointer(cYUVData[2], 2); // V&lt;BR /&gt;&lt;BR /&gt;&lt;/EM&gt;Best regards,&lt;BR /&gt;YanQin&lt;/P&gt;
&lt;/EM&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;BR /&gt;Hi YanQin, &lt;BR /&gt;&lt;BR /&gt;I see. Thank you a lot for sharing. No wander you ask a single consecutive pointer of YUV data,not 3 seperate pointer, where it is stored in Y, U, V 3 seperate arraynaturally. I add onenotes to the Artilce &lt;BR /&gt;&lt;A href="http://software.intel.com/en-us/articles/getting-started-with-intel-ipp-unified-media-classes-sample/" target="_blank"&gt;http://software.intel.com/en-us/articles/getting-started-with-intel-ipp-unified-media-classes-sample/&lt;/A&gt;&lt;BR /&gt;to notify more users the problem. &lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Ying</description>
      <pubDate>Mon, 14 Sep 2009 09:21:28 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/Using-custom-dll-in-C-program/m-p/877017#M9660</guid>
      <dc:creator>Ying_H_Intel</dc:creator>
      <dc:date>2009-09-14T09:21:28Z</dc:date>
    </item>
  </channel>
</rss>

