Page 1 of 1
force vmem output to be ARGB and not BGRA
Posted: 09 Feb 2010 17:36
by alb84
Anybody knows if it is possible to force the byte disposition of the vmem output to be ARGB and not BGRA?
I've looked for documentation for vmem-chroma but I found nothing... Anyway RV32 gives me BGRA data, but .NET Image data is arranged in ARGB.
If you need to understand better the context I am working on see this other thread
viewtopic.php?f=32&t=71999
Re: force vmem output to be ARGB and not BGRA
Posted: 09 Feb 2010 19:24
by ninjamint
It appears that C#'s Image/Bitmap class doesn't allow a PixelFormat of BGR ( I guess they're to lazy? );
So, the best I could say is to convert the buffer to RGB32, before you render it.. this will make things slower, but I'm not sure of any work-around atm.. I don't use C# often.
If you can use XNA, you'll find they support the BGR pixel format. Though, I'm sure you're not looking to change the means at which you render the video.. I'm not sure how to help you other then reading each pixel(using direct access to the bitmaps memory, to make things faster), and just converting it manually to RGB.
Re: force vmem output to be ARGB and not BGRA
Posted: 09 Feb 2010 21:32
by Rémi Denis-Courmont
vmem RV32 is hard-coded to BGR_ (which is the typical X11 pixmap format). You can't output ARGB nor RGBA with VLC at the moment (the last 8 bits are garbage).
Re: force vmem output to be ARGB and not BGRA
Posted: 10 May 2011 01:36
by olga.krupina
Sory for asking, and not answering...
How do you know that vmem RV32 is ARGB and not BGRA? I have the same feeling with RV16, but was too lazy to go through the whole source code to confirm that.
Also, I believe that for the libvlc 1.0.* it sends the output in the (A)RGB.
Re: force vmem output to be ARGB and not BGRA
Posted: 10 May 2011 09:10
by Rémi Denis-Courmont
Orders are currently hard-coded in modules/video_output/vmem.c:
Code: Select all
case VLC_CODEC_RGB15:
fmt.i_rmask = 0x001f;
fmt.i_gmask = 0x03e0;
fmt.i_bmask = 0x7c00;
break;
case VLC_CODEC_RGB16:
fmt.i_rmask = 0x001f;
fmt.i_gmask = 0x07e0;
fmt.i_bmask = 0xf800;
break;
case VLC_CODEC_RGB24:
fmt.i_rmask = 0xff0000;
fmt.i_gmask = 0x00ff00;
fmt.i_bmask = 0x0000ff;
break;
case VLC_CODEC_RGB32:
fmt.i_rmask = 0xff0000;
fmt.i_gmask = 0x00ff00;
fmt.i_bmask = 0x0000ff;
break;
Note that this is host byte order, so RV32 gives BGR_ on little-endian.