[FFmpeg-user] FFv1: Encode rgb48le?

Carl Eugen Hoyos cehoyos at ag.or.at
Wed Jun 13 16:32:34 CEST 2012


Peter B. <pb <at> das-werkstatt.com> writes:

> > There are two reasons for RGB0's existence:
> > ffv1 (and other encoders) in the past claimed to support 
> > RGBA but actually supported only RGB0
> > It might be faster to process RGB0 than RGB24 (for 
> > some encoders)
>
> Thanks for clearing that up!
> So, I presume that the 32bit representation of 24bit information can be
> processed faster because of it's a more "native" word size (16, 32, 64
> bits)?

That is the "second reason", yes.

> However, I'm still confused about the following piece of code, taking
> from the previously mentioned diff:
> 
> //------------
> 
> +    [PIX_FMT_0RGB] = {
> +        .name = "0rgb",
> +        .nb_components= 3,
> +        .log2_chroma_w= 0,
> +        .log2_chroma_h= 0,
> +        .comp = {
> +            {0,3,2,0,7},        /* R */
> +            {0,3,3,0,7},        /* G */
> +            {0,3,4,0,7},        /* B */
> +        },
> +        .flags = PIX_FMT_RGB,
> +    },
> +    [PIX_FMT_RGB0] = {
> +        .name = "rgb0",
> +        .nb_components= 3,
> +        .log2_chroma_w= 0,
> +        .log2_chroma_h= 0,
> +        .comp = {
> +            {0,3,1,0,7},        /* R */
> +            {0,3,2,0,7},        /* G */
> +            {0,3,3,0,7},        /* B */

> +            {0,3,4,0,7},        /* A */

This line is superfluous (and has no effect because the 
number of components is three), patch probably welcome.

[...]

> This looks to me as if PIX_FMT_0RGB is a 32bit 
> representation of RGB24, whereas PIX_FMT_RGB0 
> contains an alpha channel?

No, see above.

> > (The naming is FFmpeg-specific afaik.)
>
> I see.
> btw: How are the 3x8bit (RGB24) stored in a 32bit word?

Apart from the naming, the third number in {., ., x, ., .} 
tells you.

[...]

> >> What is necessary in order to support it?
> > encode_rgb_frame() needs to support bits_per_raw_sample>8 
> > similar to encode_plane()
>
> I see...
> I'll take a look at the code - maybe I'll understand it :)

Unfortunately, it is less simple than I thought;-(
ffv1 currently encodes up to 16 bit but 16bit RGB needs 
17bit, so this is definitely not trivial.

Carl Eugen



More information about the ffmpeg-user mailing list