[libcamera-devel,RFC,v2,0/2] qcam: format_converter: add 10 and 12 bit packed raw Bayer formats
mbox series

Message ID 20200908150739.1552-1-andrey.konovalov@linaro.org
Headers show
Series
  • qcam: format_converter: add 10 and 12 bit packed raw Bayer formats
Related show

Message

Andrey Konovalov Sept. 8, 2020, 3:07 p.m. UTC
This is a simple implementation of de-bayering in software.
10 and 12 bit packed raw Bayer formats are supported.
No interpolation is used to get more speed by the price of lower image
quality. In qcam this conversion is used for viewfinder only, so
lower lag is more important than the image quality.

Only SRGGB10P and SRGGB12P formats were tested (the ones I can get from
the camera sensor I am currently using).

On DragonBoard410c, at 1920x1080 resolution the average frame rate printed
by qcam is about 12.3 fps for SRGGB12P, and is about 13.4 fps for SRGGB10P.

Changes in v2:
* new patch added to put the different configurations into params_ union
* calculation of the offsets of the color values in the src buffer moved
  from the convert function to configure(). So that this calculation is
  done at configure time vs per every frame in v1. The number of RAW Bayer
  CSI2P parameters in params_ increased to store the precomputed values
* in the configure() method the check if width_ and height_ are both
  even numbers is added. If this is not the case, -EINVAL is returned,
  and the warning message is printed
* when converting the square of 2x2 bayer pixels (one red, one blue, and
  two green pixels) into four BGRA pixels, the green value is now the average
  of two green bayer components. Using the average vs one green value for even
  raw, and the other green value for the odd raw makes the "saw" pattern on
  vertical borders less noticeable. That said, all the four BGRA pixels use the
  same color values now
* An attempt to consolidate writes to the destination buffer is made. This
  (and the odd lines in the destination buffer being the same as the
  preceding even ones in v2) increased the fps by 40% to 50% compared to v1
* s_linelen replaced with srcLineLength, d_linelen - with dstLineLength
* convertRAW_CSI2P() renamed to convertRawCSI2P()

Andrey Konovalov (2):
  qcam: format_converter: put parameters of different formats into union
  qcam: format_converter: add 10 and 12 bit packed raw Bayer formats

 src/qcam/format_converter.cpp | 271 ++++++++++++++++++++++++++--------
 src/qcam/format_converter.h   |  54 +++++--
 2 files changed, 249 insertions(+), 76 deletions(-)