<?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 Re: iMX6 IPU Color Space Conversion with Alpha in i.MX Processors</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/iMX6-IPU-Color-Space-Conversion-with-Alpha/m-p/330563#M44628</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, that would be correct.&amp;nbsp; I want my RGB image to have 4 bytes per pixel with the alpha pixel to "disabled" or 255.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 01 Aug 2014 19:44:04 GMT</pubDate>
    <dc:creator>phopkins</dc:creator>
    <dc:date>2014-08-01T19:44:04Z</dc:date>
    <item>
      <title>iMX6 IPU Color Space Conversion with Alpha</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/iMX6-IPU-Color-Space-Conversion-with-Alpha/m-p/330559#M44624</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm having an issue converting color space: NV12 to ABGR(32).&amp;nbsp; I'm taking an NV12 frame and converting it to ABGR to render into a bitmap for Android.&amp;nbsp; However, I cannot seem to set the Alpha level for the conversion.&amp;nbsp; When the ABGR buffer is populated, all the alpha bytes are 0.&amp;nbsp; I want them to be 0xFF or 255, so I can see my bitmap!&amp;nbsp; Any idea on how to set the Alpha level when converting from NV12 to ABGR?&amp;nbsp; If I manually set the alpha, I can see my image, but it's an expensive process that takes too long for motion video and must be done in hardware.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here's some code that I'm using to convert( NOTE: these are snippits of working code for reference, not critiquing!):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Input image size and format&lt;/P&gt;&lt;P&gt;task.input.width = width;&lt;/P&gt;&lt;P&gt;task.input.height = height;&lt;/P&gt;&lt;P&gt;task.input.format = IPU_PIX_FMT_NV12;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Output image size and format&lt;/P&gt;&lt;P&gt;task.output.width = width;&lt;/P&gt;&lt;P&gt;task.output.height = height;&lt;/P&gt;&lt;P&gt;task.output.format = IPU_PIX_FMT_ABGR32;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Perform color space conversion&lt;/P&gt;&lt;P&gt;ioctl(fd_ipu, IPU_QUEUE_TASK, &amp;amp;task);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// manual alpha set, expensive process!!&lt;/P&gt;&lt;P&gt;int* src = outbuf;&lt;/P&gt;&lt;P&gt;int* dst = out;&lt;/P&gt;&lt;P&gt;int len = osize/4;&lt;/P&gt;&lt;P&gt;while(len--)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp; *dst++ = *src++ | 0xFF000000;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Aug 2014 17:32:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/iMX6-IPU-Color-Space-Conversion-with-Alpha/m-p/330559#M44624</guid>
      <dc:creator>phopkins</dc:creator>
      <dc:date>2014-08-01T17:32:48Z</dc:date>
    </item>
    <item>
      <title>Re: iMX6 IPU Color Space Conversion with Alpha</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/iMX6-IPU-Color-Space-Conversion-with-Alpha/m-p/330560#M44625</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Philip,&lt;/P&gt;&lt;P&gt;You can set the "&lt;SPAN class="n" style="color: #333333; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;task&lt;/SPAN&gt;&lt;SPAN class="p" style="color: #333333; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="n" style="color: #333333; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;overlay&lt;/SPAN&gt;&lt;SPAN class="p" style="color: #333333; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="n" style="color: #333333; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;alpha&lt;/SPAN&gt;&lt;SPAN class="p" style="color: #333333; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="n" style="color: #333333; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;gvalue&lt;/SPAN&gt;&lt;SPAN style="color: #333333; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt; &lt;/SPAN&gt;&lt;SPAN class="o" style="font-weight: bold; color: #333333; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #333333; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt; &lt;/SPAN&gt;&lt;SPAN class="n" style="color: #333333; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;i".&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="n" style="color: #333333; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;Here is a test code you can take as example:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="n" style="color: #333333; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;&lt;A href="https://github.com/rogeriorps/ipu-examples/blob/master/mx6/alphablending/example1/alpha_ex1.c" title="https://github.com/rogeriorps/ipu-examples/blob/master/mx6/alphablending/example1/alpha_ex1.c"&gt;https://github.com/rogeriorps/ipu-examples/blob/master/mx6/alphablending/example1/alpha_ex1.c&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="n" style="color: #333333; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;It fills the screen with solid colors and change the global alpha every 0.1 secs.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Aug 2014 18:18:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/iMX6-IPU-Color-Space-Conversion-with-Alpha/m-p/330560#M44625</guid>
      <dc:creator>rogerio_silva</dc:creator>
      <dc:date>2014-08-01T18:18:03Z</dc:date>
    </item>
    <item>
      <title>Re: iMX6 IPU Color Space Conversion with Alpha</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/iMX6-IPU-Color-Space-Conversion-with-Alpha/m-p/330561#M44626</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've read into and played the overlay stuff in the IPU.&amp;nbsp; It seems to only involve an overlay image ontop of the input buffer.&amp;nbsp; I don't need to overlay something, I just need the output alpha to be viewable.&amp;nbsp; Perhaps there is more to the overlay functionality that I currently understand.&amp;nbsp; The linked example does not deal with an ABGR image buffer.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Aug 2014 18:34:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/iMX6-IPU-Color-Space-Conversion-with-Alpha/m-p/330561#M44626</guid>
      <dc:creator>phopkins</dc:creator>
      <dc:date>2014-08-01T18:34:28Z</dc:date>
    </item>
    <item>
      <title>Re: iMX6 IPU Color Space Conversion with Alpha</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/iMX6-IPU-Color-Space-Conversion-with-Alpha/m-p/330562#M44627</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What do you want to do is to "disable" the alpha for all pixels? Doing this, all pixels on your image will be 100% on, right?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Aug 2014 19:14:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/iMX6-IPU-Color-Space-Conversion-with-Alpha/m-p/330562#M44627</guid>
      <dc:creator>rogerio_silva</dc:creator>
      <dc:date>2014-08-01T19:14:02Z</dc:date>
    </item>
    <item>
      <title>Re: iMX6 IPU Color Space Conversion with Alpha</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/iMX6-IPU-Color-Space-Conversion-with-Alpha/m-p/330563#M44628</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, that would be correct.&amp;nbsp; I want my RGB image to have 4 bytes per pixel with the alpha pixel to "disabled" or 255.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Aug 2014 19:44:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/iMX6-IPU-Color-Space-Conversion-with-Alpha/m-p/330563#M44628</guid>
      <dc:creator>phopkins</dc:creator>
      <dc:date>2014-08-01T19:44:04Z</dc:date>
    </item>
    <item>
      <title>Re: iMX6 IPU Color Space Conversion with Alpha</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/iMX6-IPU-Color-Space-Conversion-with-Alpha/m-p/330564#M44629</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Could you send me an ABGR sample picture? I'd like to make a test with it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Aug 2014 17:11:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/iMX6-IPU-Color-Space-Conversion-with-Alpha/m-p/330564#M44629</guid>
      <dc:creator>rogerio_silva</dc:creator>
      <dc:date>2014-08-04T17:11:13Z</dc:date>
    </item>
    <item>
      <title>Re: iMX6 IPU Color Space Conversion with Alpha</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/iMX6-IPU-Color-Space-Conversion-with-Alpha/m-p/330565#M44630</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I can send you one, but I think we may be missing the big picture here.&amp;nbsp; Let me describe what is going on:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Summary:&lt;/P&gt;&lt;P&gt;The objective here is to receive a JPG stream (MJPEG) over the network, decode it using the VPU, and display it on a view in Android.&amp;nbsp; Effectively, the user will see a real time video stream within our Android application.&amp;nbsp; We must use a view for Android, not a direct FB write.&amp;nbsp; We also must using an mjpeg stream.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Steps:&lt;/P&gt;&lt;P&gt;1. We receive a JPG over the network.&amp;nbsp; This jpg, if saved to file, will open in any picture viewer.&lt;/P&gt;&lt;P&gt;2.&amp;nbsp; We use the vpu to decode this jpeg.&amp;nbsp; Colorspace goes from jpg-&amp;gt;NV12.&lt;/P&gt;&lt;P&gt;3. Since the output buffer of the decoder is NV12, as cannot render this in an Android view&lt;/P&gt;&lt;P&gt;4. The most efficient way to render a frame in Android within Java is: onDraw + canvas.drawBitmap (int[], offset, stride, ....).&amp;nbsp; The format of the int[] must be ARGB, 4 bytes per pixel with an alpha.&lt;/P&gt;&lt;P&gt;5. in order to convert NV12 to ARGB is to use the CSC on the IPU.&lt;/P&gt;&lt;P&gt;6. I set up the input/ouput to go from NV12 -&amp;gt; RGBA.&lt;/P&gt;&lt;P&gt;7. CSC task is ran&lt;/P&gt;&lt;P&gt;8. I take the output of the CSC and pass it back to Java&lt;/P&gt;&lt;P&gt;9. Java takes the int[] and renders it using the functions show in Step 4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The issue here is the output show in Step 8 has the alpha values set to 0.&amp;nbsp; So when Step 9 renders the frame, it is invisible, since the alpha is 0.&amp;nbsp; NV12 colorspace does not contain alpha values, however ARGB does.&amp;nbsp; So during the conversion process, there must be a default alpha value that is used, since there was no alpha to begin with.&amp;nbsp; I need to figure out this "default" value location.&amp;nbsp; At least I hope there a default alpha value we can setup in some register somewhere.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Aug 2014 17:26:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/iMX6-IPU-Color-Space-Conversion-with-Alpha/m-p/330565#M44630</guid>
      <dc:creator>phopkins</dc:creator>
      <dc:date>2014-08-04T17:26:39Z</dc:date>
    </item>
    <item>
      <title>Re: iMX6 IPU Color Space Conversion with Alpha</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/iMX6-IPU-Color-Space-Conversion-with-Alpha/m-p/330566#M44631</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can use the example that you linked me.&amp;nbsp; If you dig around, you can find the CSC example from the same example set.&amp;nbsp; There is an NV12 raw picture.&amp;nbsp; Try to convert it to RGBA.&amp;nbsp; You will see all the alpha bytes are zero.&amp;nbsp; You can try any 32bit RGB colorspace conversion.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Aug 2014 17:37:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/iMX6-IPU-Color-Space-Conversion-with-Alpha/m-p/330566#M44631</guid>
      <dc:creator>phopkins</dc:creator>
      <dc:date>2014-08-04T17:37:01Z</dc:date>
    </item>
    <item>
      <title>Re: iMX6 IPU Color Space Conversion with Alpha</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/iMX6-IPU-Color-Space-Conversion-with-Alpha/m-p/330567#M44632</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes... Let me see if I can find a solution...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Aug 2014 12:26:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/iMX6-IPU-Color-Space-Conversion-with-Alpha/m-p/330567#M44632</guid>
      <dc:creator>rogerio_silva</dc:creator>
      <dc:date>2014-08-05T12:26:28Z</dc:date>
    </item>
    <item>
      <title>Re: iMX6 IPU Color Space Conversion with Alpha</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/iMX6-IPU-Color-Space-Conversion-with-Alpha/m-p/330568#M44633</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Philip,&lt;/P&gt;&lt;P&gt;I made some tests and I wasn't able to only change the alpha channel of AGBR. Whenever I changed the alpha using IPU, the result was always alpha being applied on RGB, leaving A = 0 for all pixels.&lt;/P&gt;&lt;P&gt;I'll ask internally if there is a way to do it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Aug 2014 16:47:07 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/iMX6-IPU-Color-Space-Conversion-with-Alpha/m-p/330568#M44633</guid>
      <dc:creator>rogerio_silva</dc:creator>
      <dc:date>2014-08-08T16:47:07Z</dc:date>
    </item>
    <item>
      <title>Re: iMX6 IPU Color Space Conversion with Alpha</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/iMX6-IPU-Color-Space-Conversion-with-Alpha/m-p/330569#M44634</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Philip,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I confirmed, it's not possible to add a value to A channel using IPU. It will always change the RGB value instead of change only the A channel.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Aug 2014 12:30:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/iMX6-IPU-Color-Space-Conversion-with-Alpha/m-p/330569#M44634</guid>
      <dc:creator>rogerio_silva</dc:creator>
      <dc:date>2014-08-13T12:30:46Z</dc:date>
    </item>
    <item>
      <title>Re: iMX6 IPU Color Space Conversion with Alpha</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/iMX6-IPU-Color-Space-Conversion-with-Alpha/m-p/330570#M44635</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Alright.&amp;nbsp; We have a work around for now.&amp;nbsp; I know we can play an AVI that is mjpeg and it decodes with using about 1% CPU, so that tells me there may be another method decode and view jpegs.&amp;nbsp; Thank you for your efforts and research!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Sep 2014 17:06:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/iMX6-IPU-Color-Space-Conversion-with-Alpha/m-p/330570#M44635</guid>
      <dc:creator>phopkins</dc:creator>
      <dc:date>2014-09-16T17:06:47Z</dc:date>
    </item>
    <item>
      <title>Re: iMX6 IPU Color Space Conversion with Alpha</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/iMX6-IPU-Color-Space-Conversion-with-Alpha/m-p/330571#M44636</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Philip,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if it is not crucial to use IPU, use VPU.&lt;/P&gt;&lt;P&gt;VPU can fill the A channel properly (also in comparable time per frame as IPU).&lt;/P&gt;&lt;P&gt;I use G2D API for that work (but G2D can only do CSC into RGB(A) formats, not into YUV!).&lt;/P&gt;&lt;P&gt;So for other CSC into YUV formats i use IPU, as you can see:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example (both CSC thru IPU and thru VPU, path depends on bool value):&lt;/P&gt;&lt;PRE&gt;#include &amp;lt;linux/ipu.h&amp;gt;
#include "g2d.h"

... // open functions for "/dev/mxc_ipu" also for g2d handle (and vpu_Init) are omitted

&amp;nbsp;&amp;nbsp;&amp;nbsp; struct ipu_task&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ipu_resizer_task;
&amp;nbsp;&amp;nbsp;&amp;nbsp; struct g2d_surface&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; vpu_resizer_task_input;
&amp;nbsp;&amp;nbsp;&amp;nbsp; struct g2d_surface&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; vpu_resizer_task_output;

&amp;nbsp;&amp;nbsp;&amp;nbsp; memset( &amp;amp;ipu_resizer_task,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0, sizeof(ipu_resizer_task) );
&amp;nbsp;&amp;nbsp;&amp;nbsp; memset( &amp;amp;vpu_resizer_task_input,&amp;nbsp; 0, sizeof(vpu_resizer_task_input) );
&amp;nbsp;&amp;nbsp;&amp;nbsp; memset( &amp;amp;vpu_resizer_task_output, 0, sizeof(vpu_resizer_task_output) );

&amp;nbsp;&amp;nbsp;&amp;nbsp; // config the G2D
&amp;nbsp;&amp;nbsp;&amp;nbsp; g2d_enable( p_vpu_g2d_handle, G2D_BLEND );
&amp;nbsp;&amp;nbsp;&amp;nbsp; g2d_enable( p_vpu_g2d_handle, G2D_GLOBAL_ALPHA );&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // G2D_GLOBAL_ALPHA valid only if G2D_BLEND enabled

&amp;nbsp;&amp;nbsp;&amp;nbsp; // source credentials
&amp;nbsp;&amp;nbsp;&amp;nbsp; ipu_resizer_task.input.paddr&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = //source frame phy addr;
&amp;nbsp;&amp;nbsp;&amp;nbsp; ipu_resizer_task.input.deinterlace.enable&amp;nbsp;&amp;nbsp; = 0;
&amp;nbsp;&amp;nbsp;&amp;nbsp; ipu_resizer_task.input.deinterlace.motion&amp;nbsp;&amp;nbsp; = 0;

&amp;nbsp;&amp;nbsp;&amp;nbsp; vpu_resizer_task_input.planes[0]&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = // source frame phy addr;
&amp;nbsp;&amp;nbsp;&amp;nbsp; vpu_resizer_task_input.blendfunc&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = G2D_SRC_ALPHA;
&amp;nbsp;&amp;nbsp;&amp;nbsp; vpu_resizer_task_input.global_alpha&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = 0xff;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // use this value as default ALPHA, for those reason we only use VPU instead of IPU
&amp;nbsp;&amp;nbsp;&amp;nbsp; vpu_resizer_task_input.clrcolor&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = 0x00;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // special blending dimension, not used
&amp;nbsp;&amp;nbsp;&amp;nbsp; vpu_resizer_task_input.rot&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = G2D_ROTATION_0;

// width, height stride settings on source and dest frame...
&lt;PRE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ipu_resizer_task.input.format&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = IPU_PIX_FMT_....;
&amp;nbsp;&amp;nbsp;&amp;nbsp; ipu_resizer_task.input.width&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = p_src_video_frame-&amp;gt;width;
&amp;nbsp;&amp;nbsp;&amp;nbsp; ipu_resizer_task.input.height&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = p_src_video_frame-&amp;gt;height;&lt;/PRE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ipu_resizer_task.output.format&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = IPU_PIX_FMT_RGBA32;
&amp;nbsp;&amp;nbsp;&amp;nbsp; ipu_resizer_task.output.width&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = p_dst_video_frame-&amp;gt;width;
&amp;nbsp;&amp;nbsp;&amp;nbsp; ipu_resizer_task.output.height&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = p_dst_video_frame-&amp;gt;height;

&amp;nbsp;&amp;nbsp;&amp;nbsp; vpu_resizer_task_input.format &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = G2D_....;
&amp;nbsp;&amp;nbsp;&amp;nbsp; vpu_resizer_task_input.width&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = p_src_video_frame-&amp;gt;width;
&amp;nbsp;&amp;nbsp;&amp;nbsp; vpu_resizer_task_input.height&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = p_src_video_frame-&amp;gt;height;
 &amp;nbsp;&amp;nbsp; vpu_resizer_task_input.stride&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = p_src_video_frame-&amp;gt;width;

&amp;nbsp;&amp;nbsp;&amp;nbsp; vpu_resizer_task_output.format&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = G2D_RGBA8888;
&amp;nbsp;&amp;nbsp;&amp;nbsp; vpu_resizer_task_output.width&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = p_dst_video_frame-&amp;gt;width;
&amp;nbsp;&amp;nbsp;&amp;nbsp; vpu_resizer_task_output.height&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = p_dst_video_frame-&amp;gt;height;
&amp;nbsp;&amp;nbsp;&amp;nbsp; vpu_resizer_task_output.stride&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = p_dst_video_frame-&amp;gt;width;

&amp;nbsp;&amp;nbsp;&amp;nbsp; vpu_resizer_task_output.planes[0]&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = // dest frame phy addr

&amp;nbsp;&amp;nbsp;&amp;nbsp; if ( say_if_vpu_is_needed )
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // G2D (VPU) can handle only RGB(A) destination formats (not YUV)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // G2D (VPU) can fill ALPHA channel in conversions form YUV to RGBA formats (and also unfortunately impacts R,G,B channel by ALPHA value)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; g2d_blit(
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; p_vpu_g2d_handle,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp;vpu_resizer_task_input,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp;vpu_resizer_task_output);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; g2d_finish( p_vpu_g2d_handle );
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; else
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // IPU can not fill ALPHA channel in conversions into RGBA formats (leaves it as 0x00)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; retcode = ioctl(
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ipu_fd,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IPU_QUEUE_TASK,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp;ipu_resizer_task );
&amp;nbsp;&amp;nbsp;&amp;nbsp; }

Best regards, 
F.Hacker&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Nov 2018 08:22:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/iMX6-IPU-Color-Space-Conversion-with-Alpha/m-p/330571#M44636</guid>
      <dc:creator>frantisekhacker</dc:creator>
      <dc:date>2018-11-22T08:22:53Z</dc:date>
    </item>
  </channel>
</rss>

