Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New digital gain handling #98

Draft
wants to merge 28 commits into
base: next
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
3a5f322
meson: Add libpisp.wrap
naushir May 4, 2023
d8c7750
libcamera: formats: Add 16-bit mono format
naushir Nov 16, 2023
d9bf157
libcamera: formats: Add RGB48 formats
naushir Nov 16, 2023
776d289
libcamera: formats: Add PiSP specific image and config buffer formats
naushir Nov 17, 2022
41dd9b2
ipa: rpi: Add HDR support
naushir Oct 6, 2023
92e9c46
ipa: rpi: Move variables from private to protected
naushir Nov 16, 2023
0bd8810
pipeline: rpi: Add support for Raspberry Pi 5
naushir Jun 19, 2023
d692e23
ipa: rpi: Add support for Raspberry Pi 5
naushir May 4, 2023
bde9e6b
utils: raspberrypi: ctt: Adapt tuning tool for both VC4 and PiSP
davidplowman Mar 17, 2023
aa1bc48
utils: raspberrypi: ctt: Added CAC support to the CTT
bebon901 Aug 25, 2023
52a3b69
utils: raspberrypi: ctt: Changed CTT handling of VC4 and PiSP
bebon901 Sep 4, 2023
b4fee1c
utils: raspberrypi: ctt: Update tuning tool for HDR
davidplowman Oct 6, 2023
3ffe650
RASPBERRYPI ONLY: Add Sony IMX708 sensor properties
njhollinghurst Dec 8, 2022
9601f00
RASPBERRYPI ONLY: Handle mandatory stream flags
naushir May 23, 2023
33ebf6d
RASPBERRYPI ONLY: Add a Github workflow to generate release tarballs
XECDesign Nov 16, 2023
d758394
build: controls: Add Raspberry Pi vendor specific controls
naushir Nov 23, 2023
2c85cc0
ipa: pipeline: implement vendor controls
naushir Dec 1, 2023
430819e
ipa: rpi: black_level: Add an initialValues method
davidplowman Dec 5, 2023
3dca3f1
ipa: rpi: awb: Add an initialValues method
davidplowman Dec 5, 2023
a409bd5
ipa: rpi: pisp: Fetch good colour gain and black level default values
davidplowman Dec 5, 2023
bc33920
ipa: rpi: agc: Change handling of colour gains less than 1
davidplowman Dec 19, 2023
a58644b
ipa: rpi: Advance the delay context counter even when IPAs don't run
davidplowman Dec 15, 2023
0a155fd
ipa: rpi: agc: Make the maximum digital gain configurable
davidplowman Dec 19, 2023
3c89eca
ipa: rpi: agc: Replace analogue gain by (combined) gain
davidplowman Dec 18, 2023
3f9a5a4
ipa: rpi: agc: Calculate digital gain in process()
davidplowman Dec 19, 2023
18af970
ipa: rpi: Update digital gain handling in base class and pisp versions
davidplowman Dec 19, 2023
1d230d0
ipa: rpi: Update digital gain handling for vc4 platform
davidplowman Dec 19, 2023
12b7632
ipa: rpi: agc: Remove digital gain from AgcPrepareStatus
davidplowman Dec 19, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
ipa: rpi: pisp: Fetch good colour gain and black level default values
On the PiSP platform we have to program the Front End statistics
before we've have a chance to run any of the algorithms. So instead we
ask them for reasonable default values which we program in for the
first few frames.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
davidplowman authored and naushir committed Dec 11, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit a409bd5321bb5db31e90a066e672b917cbe348e7
37 changes: 35 additions & 2 deletions src/ipa/rpi/pisp/pisp.cpp
Original file line number Diff line number Diff line change
@@ -26,7 +26,9 @@
#include "controller/af_status.h"
#include "controller/agc_algorithm.h"
#include "controller/alsc_status.h"
#include "controller/awb_algorithm.h"
#include "controller/awb_status.h"
#include "controller/black_level_algorithm.h"
#include "controller/black_level_status.h"
#include "controller/cac_status.h"
#include "controller/ccm_status.h"
@@ -907,11 +909,42 @@ void IpaPiSP::setDefaultConfig()
}
be_->SetGlobal(beGlobal);

/*
* Ask the AWB algorithm for reasonable gain values so that we can program the
* front end stats sensibly. We must also factor in the conversion to luminance.
*/
pisp_fe_rgby_config rgby = {};
rgby.gain_r = rgby.gain_b = clampField(1.0, 14, 10);
rgby.gain_g = clampField(1.0, 14, 10);
double gainR = 1.5, gainB = 1.5;
RPiController::AwbAlgorithm *awb = dynamic_cast<RPiController::AwbAlgorithm *>(
controller_.getAlgorithm("awb"));
if (awb)
awb->initialValues(gainR, gainB);
/* The BT.601 RGB -> Y coefficients will do. The precise values are not critical. */
rgby.gain_r = clampField(gainR * 0.299, 14, 10);
rgby.gain_g = clampField(1.0 * .587, 14, 10);
rgby.gain_b = clampField(gainB * .114, 14, 10);
fe_->SetRGBY(rgby);

/* Also get sensible front end black level defaults, for the same reason. */
uint16_t blackLevelR = 4096, blackLevelG = 4096, blackLevelB = 4096;
RPiController::BlackLevelAlgorithm *blackLevel = dynamic_cast<RPiController::BlackLevelAlgorithm *>(
controller_.getAlgorithm("black_level"));
if (blackLevel)
blackLevel->initialValues(blackLevelR, blackLevelG, blackLevelB);
/* The front end first equalises all the black levels to the same as green. */
pisp_bla_config bla;
bla.black_level_r = blackLevelR;
bla.black_level_gr = blackLevelG;
bla.black_level_gb = blackLevelG;
bla.black_level_b = blackLevelB;
bla.output_black_level = blackLevelG;
fe_->SetBla(bla);
/* But for the statistics it removes the G black level from everything. */
bla.black_level_r = blackLevelG;
bla.black_level_b = blackLevelG;
bla.output_black_level = 0;
fe_->SetBlc(bla);

pisp_fe_global_config feGlobal;
fe_->GetGlobal(feGlobal);
feGlobal.enables |= PISP_FE_ENABLE_BLA + PISP_FE_ENABLE_BLC + PISP_FE_ENABLE_RGBY;