[libcamera-devel] qcam format conversion endianness

Laurent Pinchart laurent.pinchart at ideasonboard.com
Fri Dec 30 21:10:42 CET 2022


Hi Christian,

On Fri, Dec 30, 2022 at 01:56:49AM +0100, Christian Rauch via libcamera-devel wrote:
> Hi,
> 
> The qcam format converter in 'format_converter.cpp' seems to assume
> little-endianness, regardless of the actual native machine endianness.
> E.g. 'libcamera::formats::RGBX8888' is read in the order: (ignored),
> 'B', 'G', 'R'.
> Is this done on purpose? Wouldn't this result in wrong format
> conversions on big-endianness architectures?

The libcamera formats are defined in an endianness-agnostic way. That
is, following the DRM definition, the RGB formats are defined based on
the order of the components as stored in a word (a 32-bit word for
RGBX8888), which is itself stored in memory in little endian. This
definition gives precise layout of the data at the byte level in memory,
regardless of whether the machine uses little endian or big endian
itself.

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list