Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

AlphaComp - YUV

Gavin_S_
Beginner
1,752 Views

I'm quite new to Intel's IPP so forgive me if the answers to my questions are obvious.  There is a function that is of particular interest - AlphaComp.

1. Firstly, I would like confirmation that I can use AlphaComp with planar YCbCr 422 and YUV 422 (both with alpha). There is an existing post from 2010 that affirms that it is possible.  The current documentation states:

This function performs an image compositing operation on RGBA images using alpha values of both images. 

I find it difficult to believe (if it is supported) that after 8 years the documentation has not been updated? For the record that is not a criticism.

2. Secondly, if using a format that uses chroma subsampling how does one set the 'srcStep' or 'dstStep' (if the luma does not use subsampling)? This is one of the reasons for my scepticism for YCbCr/YUV being supported :) Note: I appreciate how the value would be set for RGB pixel format variants.

3. Can I mix different formats as inputs to the function (ie. ARGB composited on YUV)?

0 Kudos
1 Solution
Andrey_B_Intel
Employee
1,752 Views

So you can call

ippiAlphaComp_8u_AC4R

ippiCopy_8u_AC4C3R

ippiRGBToYCbCr422_8u_C3C2R or ippiRGBToYCbCr422_8u_C3P3R

If you work with big enough images (sum of source and dest more than L3 cache ) you can try to split on small slices to maximize reuse data in cache.

Unfortunately looks like that we don't have direct conversion RGBToYCbCr422 from 4 input channels .

Thanks.

 

 

View solution in original post

0 Kudos
8 Replies
Andrey_B_Intel
Employee
1,752 Views

Hi Gavin.

Welcome to IPP.

Just to clarify YUV IPP formats in memory:

YUV or YUV444  
 line 0 Y00 U00 V00   Y01 U01 V01 ..
 line 1 Y10 U10 V10   Y11 U11 V11 ..

YUV422   
 line 0 Y00 U0_01  Y01 V0_01 .. where U0_01 = (U00+U01) / 2 from YUV444 
 line 1 Y10 U1_01  Y11 V1_01 ..

Could you please describe your data format in memory?
Thanks.

 

 

0 Kudos
Gavin_S_
Beginner
1,752 Views

Hi Andrey,

Thanks for the reply/welcome!

At the moment, the video is decoded to a planar YUV 422 format (BT.601 or 709).  The memory layout matches the format described in 'Pixel and Planar Image Formats'  -> 4:2:2 YUV and Figure b.

I have the freedom to choose the format of the overlay.

Gavin.

0 Kudos
Andrey_B_Intel
Employee
1,752 Views

Hi Gavin.

IPP has 2 classes of AlphaComp API:

 1. ippiAlphaComp_8u_AC4R

 2. ippiAlphaCompC_8u_C4R.

First one ippiAlphaComp_8u_AC4R uses alpha channel values of two input pixel to get final alpha combination of destination pixel.

The second variant   ippiAlphaCompC uses input arguments  alpha1 and alpha2 for whole image.

So which one is your case? If second then you can call ippiAlphaCompC_8u_C1R 3 times for every plane. If first -  we need to think further. 

Thanks.

 

0 Kudos
Gavin_S_
Beginner
1,752 Views

Hi Andrey,

So which one is your case? If second then you can call ippiAlphaCompC_8u_C1R 3 times for every plane. If first -  we need to think further. 

I was looking to use the first variation (ippiAlphaComp_8u_AC4R).

A bit more background. I'm looking to composite (decoded) PNG images which by default are in a packed ARGB format (or similar variant) onto YUV (or AYUV) which is in a planar format. I'm looking to do this in real-time of the video (which can be up to about 60fps).

Gavin.

0 Kudos
Andrey_B_Intel
Employee
1,753 Views

So you can call

ippiAlphaComp_8u_AC4R

ippiCopy_8u_AC4C3R

ippiRGBToYCbCr422_8u_C3C2R or ippiRGBToYCbCr422_8u_C3P3R

If you work with big enough images (sum of source and dest more than L3 cache ) you can try to split on small slices to maximize reuse data in cache.

Unfortunately looks like that we don't have direct conversion RGBToYCbCr422 from 4 input channels .

Thanks.

 

 

0 Kudos
Gavin_S_
Beginner
1,752 Views

Hi Andrey,

Thanks again for your time.

As I understand it from those function calls, I get ARGB on the output from 'ippiAlphaComp_8u_AC4R' (and then convert it to YCbCr in the other calls). 

Am I correct in my understanding that I would need to feed 'ippiAlphaComp_8u_AC4R' an ARGB pixel format?  So I need to convert my planar YUYV to ARGB?

Gavin.

0 Kudos
Andrey_B_Intel
Employee
1,752 Views

Hi.

AC4R means 3 color channels  followed by alpha channel. I.e in memory RGBA RGBA ... Looks like that needs additional call ippiSwapChannels_8u_C4R before ippiAlphaComp_8u_AC4R. 

Thanks.

 

0 Kudos
Gavin_S_
Beginner
1,752 Views

Thanks Andrey. Admittedly, it requires a few more pixel format conversions than I wanted to perform, but I'll measure performance before I draw any conclusions.

Thanks for your time and patience.

Gavin.

0 Kudos
Reply