[v2,0/6] ipa: software_isp: AGC: Fox AGC oscillation bug
mbox series

Message ID 20250925221708.7471-1-hansg@kernel.org
Headers show
Series
  • ipa: software_isp: AGC: Fox AGC oscillation bug
Related show

Message

Hans de Goede Sept. 25, 2025, 10:17 p.m. UTC
Hi All,

Due to a combination of not having correct control-delay information for
various sensors as well as the generic nature of the simple-pipeline +
software-ISP meaning that any pipeline delays are unknown it is impossible
to get reliable control-delay values.

Wrong control-delay values can lead to pretty bad oscilation. See the v1
cover-letter for more details.

This series fixes some unrelated issues in the softIPA AGC algorithm
and in the last 2 patches addresses the oscillation issue. Note this v2
takes a new approach to fixing the oscilation by only generating statistics
for every 4th frame and having the IPA only run its algorithms when there
actually are statistics. This saves CPU time, while at the same time
avoiding the oscillation issue.

Changes in v2:
- Skip running IPA algorithms when there are no statistics
- Only generate statistics for every 4th frame

Note the speed of the AGC algorithm converges on the desired brightness
level is unchanged compared to v1 since in v1 the AGC algorithm would
skip 3 frames after every gain/exposure change.

Regards,

Hans


Hans de Goede (6):
  ipa: software_isp: Fix context_.configuration.agc.againMin init
  ipa: software_isp: AGC: Do not lower gain below 1.0
  ipa: software_isp: AGC: Raise exposure or gain not both at the same
    time
  ipa: software_isp: AGC: Only use integers for exposure calculations
  libcamera: software_isp: Add valid flag to struct SwIspStats
  libcamera: software_isp: Run sw-statistics once every 4th frame

 .../internal/software_isp/swisp_stats.h       |  4 +++
 src/ipa/simple/algorithms/agc.cpp             | 26 ++++++++++---------
 src/ipa/simple/algorithms/awb.cpp             |  3 +++
 src/ipa/simple/algorithms/blc.cpp             |  3 +++
 src/ipa/simple/ipa_context.h                  |  2 +-
 src/ipa/simple/soft_simple.cpp                | 10 ++++++-
 src/libcamera/software_isp/debayer_cpu.cpp    | 25 +++++++++++-------
 src/libcamera/software_isp/debayer_cpu.h      |  4 +--
 src/libcamera/software_isp/swstats_cpu.cpp    |  9 ++++++-
 src/libcamera/software_isp/swstats_cpu.h      |  5 +++-
 10 files changed, 63 insertions(+), 28 deletions(-)