[libcamera-devel] [PATCH 0/2] Raspberrypi: support per-mode camera sensitivities

David Plowman david.plowman at raspberrypi.com
Thu May 27 10:45:38 CEST 2021


Hi

Here's an implementation of "per-mode camera sensitivities", following
on from a recent discussion email. This is taking the "don't lie, even
a little" approach, which I am inclined to prefer. There are two
patches as follows, though still some outstanding questions.

1. The first patch adds a "sensitivity" field to our camera mode
structure. The main question here is how to set this value correctly.

- For now, I've just used a virtual function in the CamHelper. This is
  dead simple and it works. (Though the sensor that needs this
  function is still unreleased.)

- But should I be using the sensor database? I'd have to add fields
  for "full resolution sensitivity", "2x2 binned sensitivity" as a
  minimum, though why stop there? There could be many different
  binning modes! Also, I'd have to get this through to the IPA. Would
  that mean writing a serialiser/deserialiser? Some clues on how to do
  that would be helpful, I looked at ipa_data_serializer.cpp but it
  was quite intimidating...

- Or would we be better getting the value from the driver? That might
  need a new read-only V4L2 control. And how would we pass that to the
  IPA, in the IPACameraSensorInfo? It already has mode-dependent
  fields...

2. The second patch takes care of the changing sensitivity in the
AEC/AGC, when the SwitchMode method is called.

Finally, I think there's still a problem with this approach. Suppose
you wanted to run preview, then do a capture with the same output
brightness, but selecting the exposure and gain explicitly for
yourself. You simply can't do this without knowing the sensitivity of
the camera modes. So how could we report this? Note that signalling it
in metadata with completed requests is too late - the typical pattern
would be:

Stop camera -> Reconfigure camera -> Recalculate exposure/gain ->
Start camera

Opinions both sought and appreciated!

Best regards
David

David Plowman (2):
  ipa: raspberrypi: Add sensitivity field to camera mode
  ipa: raspberrypi: AGC: handle modes with different sensitivities

 src/ipa/raspberrypi/cam_helper.cpp           |  5 ++++
 src/ipa/raspberrypi/cam_helper.hpp           |  3 +++
 src/ipa/raspberrypi/controller/camera_mode.h |  2 ++
 src/ipa/raspberrypi/controller/rpi/agc.cpp   | 25 ++++++++++++++++----
 src/ipa/raspberrypi/controller/rpi/agc.hpp   |  1 +
 src/ipa/raspberrypi/raspberrypi.cpp          | 12 ++++++++++
 6 files changed, 43 insertions(+), 5 deletions(-)

-- 
2.20.1



More information about the libcamera-devel mailing list