ipa: rkisp1: awb: Clamp gains to machine limits
When the color gains are set manually it is possible to specify a gain that wrapped the hardware limits. It would also be possible to further tune the floating point limits, but that is an error prone approach. So the limits are imposed on the integers, just before writing to the hardware. This noticeably reduces some oscillations in the awb regulation. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
committed by
Kieran Bingham
parent
7ee9ef451d
commit
7b8094d6fc
@@ -120,10 +120,14 @@ void Awb::prepare(IPAContext &context, const uint32_t frame,
|
||||
frameContext.awb.gains.blue = context.activeState.awb.gains.automatic.blue;
|
||||
}
|
||||
|
||||
params->others.awb_gain_config.gain_green_b = 256 * frameContext.awb.gains.green;
|
||||
params->others.awb_gain_config.gain_blue = 256 * frameContext.awb.gains.blue;
|
||||
params->others.awb_gain_config.gain_red = 256 * frameContext.awb.gains.red;
|
||||
params->others.awb_gain_config.gain_green_r = 256 * frameContext.awb.gains.green;
|
||||
params->others.awb_gain_config.gain_green_b =
|
||||
std::clamp<int>(256 * frameContext.awb.gains.green, 0, 0x3ff);
|
||||
params->others.awb_gain_config.gain_blue =
|
||||
std::clamp<int>(256 * frameContext.awb.gains.blue, 0, 0x3ff);
|
||||
params->others.awb_gain_config.gain_red =
|
||||
std::clamp<int>(256 * frameContext.awb.gains.red, 0, 0x3ff);
|
||||
params->others.awb_gain_config.gain_green_r =
|
||||
std::clamp<int>(256 * frameContext.awb.gains.green, 0, 0x3ff);
|
||||
|
||||
/* Update the gains. */
|
||||
params->module_cfg_update |= RKISP1_CIF_ISP_MODULE_AWB_GAIN;
|
||||
|
||||
Reference in New Issue
Block a user