[vlc-devel] [PATCH] swscale: Fix pixel format for VLC_CODEC_RGBA

Rémi Denis-Courmont remi at remlab.net
Thu Dec 20 23:33:03 CET 2012

Le vendredi 21 décembre 2012 00:02:06, Florian Albrechtskirchinger a écrit :
> How about taking it one step at a time:
> 1) Rename all occurrences of VLC_CODEC_RGB(8|15|16|24|32) to
> VLC_CODEC_RGB(8|15|16|24|32)_OLD.
> 2) Introduce mask-less VLC_CODEC_RGB(15|16|24|32),
> VLC_CODEC_BGR(15|16|24|32).
> 3) Gradually port the existing code over to the new codecs.
> 4) Remove the old codecs.

I don't see how you can do that gradually. Multiple plugins in a given 
pipeline need to agree with one another on the meaning of given formats.

The only criterias to divide the work are:
- the input side (before rawvideo decoder)
  or the output side (after rawvideo decoder), and
- the pixel size (8, 15, 16, 24, 32).

> What about the FourCCs? Are RV24, RV32, etc. globally used or are they
> VLC-internal? Assuming they are internal and can be renamed without
> consequence, here's a simple idea: RGB4 = 32bit, RGB3 = 24bit, RGB2 =
> 16bit, RGB1 = 15bit; BGR analogous.
> RGB8 = GREY?

No. RGB8 is 256 colours. GREY is 8-bits grey scale (a.k.a. Y8).

> VLC_CODEC_RGBA16 should be removed.
>  > $ grep -r VLC_CODEC_RGBA16 .
>  > ./include/vlc_fourcc.h:#define VLC_CODEC_RGBA16
> VLC_FOURCC('A','V','1','6')
>  > ./modules/video_output/xcb/xvideo.c:                    return
>  > ./src/misc/fourcc.c:    B(VLC_CODEC_RGBA16, "16 bits RGBA"),
>  > ./src/misc/fourcc.c:        VLC_CODEC_RGBA16, 0 },
> Does that sound doable/reasonable to you?
> I'd be willing to complete steps 1) and 2) and start step 3) to the
> extent I'm immediately concerned with, i.e. XCB screen capture and
> related code paths. I might contribute more to this end in the future,
> starting with V4L2, but I'm not promising anything.

Inputs (demux and access_demux plugins) are relatively easy: They only have to 
be consistent with the rawvideo decoder. But even then, all inputs must agree; 
you cannot patch each of them separately.

The difficult and/or tedious parts regard video chroma converters, the scaler, 
blending, video filters and video outputs...

If you are *only* interested in X11 windows capture, it would be far simpler 
to define VLC_CODEC_BGRA, and convert to VLC_CODEC_RGBA in codec/rawvideo.c. 
Then you don't need to care about all the output or RGB intricacies

Rémi Denis-Courmont

More information about the vlc-devel mailing list