force vmem output to be ARGB and not BGRA

This forum is about all development around libVLC.
alb84
Blank Cone
Blank Cone
Posts: 29
Joined: 16 Dec 2009 15:40

force vmem output to be ARGB and not BGRA

Postby alb84 » 09 Feb 2010 17:36

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

ninjamint
New Cone
New Cone
Posts: 7
Joined: 05 Feb 2010 22:40

Re: force vmem output to be ARGB and not BGRA

Postby ninjamint » 09 Feb 2010 19:24

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.

Rémi Denis-Courmont
Developer
Developer
Posts: 15267
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: force vmem output to be ARGB and not BGRA

Postby Rémi Denis-Courmont » 09 Feb 2010 21:32

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).
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

olga.krupina
Blank Cone
Blank Cone
Posts: 21
Joined: 10 May 2011 00:42

Re: force vmem output to be ARGB and not BGRA

Postby olga.krupina » 10 May 2011 01:36

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.

Rémi Denis-Courmont
Developer
Developer
Posts: 15267
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: force vmem output to be ARGB and not BGRA

Postby Rémi Denis-Courmont » 10 May 2011 09:10

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.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 22 guests