[libcamera-devel] [RFC 0/6] libcamera: PixelFormat: Turn into a class

Niklas Söderlund niklas.soderlund at ragnatech.se
Fri Feb 28 04:29:07 CET 2020


Hi,

This series replaces the PixelFormat definition of a unisgned int with a 
class implementation that can translate between V4L2 and DRM fourccs in 
addition to adding support for DRM modifiers.

As an added bonus it makes it much stricter who can create a PixelFormat 
from a V4L2 fourcc which hopefully will remedy the confusion that exist 
today about with fourcc namespace the variable is in.

Patch 1/6 and 2/6 lay the ground work by more tightly integrating the 
PixelFormat defined as unsigned int into libcamera. Patch  3/6 do the 
big work and implements PixelFormat as a class.

Patch 4/6 Adds some possible usability features that could be built 
ontop to make fourcc more friends to end users by allowing printing and 
selecting them with friendly string names.

Patch 5/6 and 6/6 do some cleanup removing functions that are now 
redundant since the large change in 3/6.

I post this as a RFC as the design for modifiers for Bayer formats in 
DRM are still up in the air so their is no real world test-case to 
verify the design is the one we will end up with. The aim is to develop 
RAW buffer format enumeration on top of this series. Since this is an 
RFC as the upstream design is not yet finished documentation is also 
lacking.

Niklas Söderlund (6):
  libcamera: Use PixelFormat instead of unsigned int where appropriate
  libcamera: formats: Turn ImageFormats into a template
  libcamera: PixelFormat: Turn into a class
  libcamera: PixelFormat: Add operations to operate on names
  libcamera: v4l2_videodevice: Remove pixel format translators
  v4l2: camera_proxy: Switch to PixelFormat

 include/libcamera/pixelformats.h         |  43 ++++++-
 src/cam/main.cpp                         |  11 +-
 src/libcamera/camera_sensor.cpp          |   2 +-
 src/libcamera/formats.cpp                |  22 +++-
 src/libcamera/include/formats.h          |  11 +-
 src/libcamera/include/v4l2_subdevice.h   |   2 +-
 src/libcamera/include/v4l2_videodevice.h |   6 +-
 src/libcamera/pipeline/ipu3/ipu3.cpp     |   8 +-
 src/libcamera/pipeline/rkisp1/rkisp1.cpp |  26 ++--
 src/libcamera/pipeline/uvcvideo.cpp      |  14 +--
 src/libcamera/pipeline/vimc.cpp          |  20 +--
 src/libcamera/pixelformats.cpp           | 148 +++++++++++++++++++++++
 src/libcamera/stream.cpp                 |   6 +-
 src/libcamera/v4l2_subdevice.cpp         |   4 +-
 src/libcamera/v4l2_videodevice.cpp       | 145 +---------------------
 src/qcam/format_converter.cpp            |   4 +-
 src/qcam/format_converter.h              |   6 +-
 src/qcam/viewfinder.cpp                  |   4 +-
 src/qcam/viewfinder.h                    |   6 +-
 src/v4l2/v4l2_camera_proxy.cpp           |  73 ++++-------
 src/v4l2/v4l2_camera_proxy.h             |   3 -
 test/camera/buffer_import.cpp            |   2 +-
 test/stream/stream_formats.cpp           |  33 +++--
 test/v4l2_subdevice/list_formats.cpp     |   2 +-
 24 files changed, 321 insertions(+), 280 deletions(-)

-- 
2.25.1



More information about the libcamera-devel mailing list