Re: libyuv::ConvertToI420 issues

53 views
Skip to first unread message

Frank Barchard

unread,
Oct 8, 2015, 1:48:21 PM10/8/15
to Emircan Uysaler, discuss-libyuv, Miguel Casas
Adding discuss-libyuv
In this part of the referred CL

you use RAW.
RAW is 24 bit, stored as R,G,B in memory.  Typically this is not what you want.
On most platforms, RGB24 is the popular version of 24 bit, stored as B,G,R in memory.


On Thu, Oct 8, 2015 at 10:42 AM, Frank Barchard <fbar...@google.com> wrote:
1.  The naming for libyuv types follows fourcc.org and LMI libraries that we use in hangouts.
FOURCC_ARGB is bgra in memory.
fourcc itself is 4 characters, which would be "BGRA" as a string.  But it gets read as an int, so on little endian it becomes 'ARGB' as an int, reflecting order within a register.
So FOURCC_ARGB is typically what you want.  But libyuv supports ABGR, BGRA and RGBA as well.
Its documented here

2. When converting from a format that has no alpha, to ARGB, the alpha will be set to 255, which is opaque.
There are functions to manipulate images, mostly in the header planar_functions.h
e.g.
// Draw a rectangle into ARGB.
int ARGBRect(uint8* dst_argb, int dst_stride_argb, int x, int y, int width, int height, uint32 value);


On Wed, Oct 7, 2015 at 8:03 PM, Emircan Uysaler <emi...@google.com> wrote:
Hello Frank,

I have some questions regarding the use of libyuv::ConvertToI420. Feel free to pass it to somebody else if you aren't the right person to ask.

So, I am using libyuv::ConvertToI420 in this CL[0] where I am trying to convert kBGRA_8888_SkColorType SKImage into an I420 VideoFrame. 
1) Although the input type is kBGRA, setting libyuv::FOURCC_BGRA as the origin flips the colors. libyuv::FOURCC_ARGB gives the correct behavior. Do you know why?
2) So the alpha channel is transmitted as black pixels. Is there a way to set them as white?

[0] https://codereview.chromium.org/1373163002/ HtmlElementCapturer::createNewFrame()

Thanks,
Emircan


Reply all
Reply to author
Forward
0 new messages