Re: Is V4L2_PIX_FMT_RGB656 RGB or BGR ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Em 12-08-2011 13:26, Laurent Pinchart escreveu:
> According to http://linuxtv.org/downloads/v4l-dvb-apis/packed-rgb.html, 
> V4L2_PIX_FMT_RGB565 is defined as
> 
>  Identifier           Byte 0 in memory         Byte 1 
>                   Bit  7  6  5  4  3  2  1  0    7  6  5  4  3  2  1  0
>  V4L2_PIX_FMT_RGB565  g2 g1 g0 r4 r3 r2 r1 r0   b4 b3 b2 b1 b0 g5 g4 g3
> 
> As this is stored in little-endian, the color word is thus
> 
> b4 b3 b2 b1 b0 g5 g4 g3 g2 g1 g0 r4 r3 r2 r1 r0
> 
> This looks awfully like BGR to me, not RGB.
> 
> I need to define a FOURCC for the corresponding RGB format
> 
>  Identifier           Byte 0 in memory         Byte 1 
>                   Bit  7  6  5  4  3  2  1  0    7  6  5  4  3  2  1  0
>  V4L2_PIX_FMT_RGB565  g2 g1 g0 b4 b3 b2 b1 b0   r4 r3 r2 r1 r0 g5 g4 g3
> 
> Should I call it V4L2_PIX_FMT_BGR565 ? :-)
> 

Had you seen both Tables 2.6 and 2.7?

http://linuxtv.org/downloads/v4l-dvb-apis/packed-rgb.html#rgb-formats-corrected

The format you're looking for is "table 2.7" version of V4L2_PIX_FMT_BGR565.

Yeah, this looks crazy. Basically, some drivers were using it on one way, while
other drivers were using it the other way. I suspect that this trouble were there
since V4L1 times.

See at the changelogs (http://linuxtv.org/downloads/v4l-dvb-apis/hist-v4l2.html),
in particular the one on 2003:

1998-11-14: V4L2_PIX_FMT_RGB24 changed to V4L2_PIX_FMT_BGR24, and V4L2_PIX_FMT_RGB32 changed to V4L2_PIX_FMT_BGR32. Audio controls are now accessible with the VIDIOC_G_CTRL and VIDIOC_S_CTRL ioctls under names starting with V4L2_CID_AUDIO. The V4L2_MAJOR define was removed from videodev.h since it was only used once in the videodev kernel module. The YUV422 and YUV411 planar image formats were added.

2001-04-13: Big endian 16-bit RGB formats were added.

V4L2 2003-11-05:

  In the section called “RGB Formats” the following pixel formats were incorrectly transferred from Bill Dirks' V4L2 specification. Descriptions below refer to bytes in memory, in ascending address order.
  In the section called “Image Properties” the mapping of the V4L VIDEO_PALETTE_RGB24 and VIDEO_PALETTE_RGB32 formats to V4L2 pixel formats was accordingly corrected.
  Unrelated to the fixes above, drivers may still interpret some V4L2 RGB pixel formats differently. These issues have yet to be addressed, for details see the section called “RGB Formats”.


Mauro.
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux