Message ID | 20210930093715.73293-9-jeanmichel.hautbois@ideasonboard.com |
---|---|
State | Accepted |
Headers | show |
Series |
|
Related | show |
Hi Jean-Michel, Thank you for the patch. On Thu, Sep 30, 2021 at 11:37:11AM +0200, Jean-Michel Hautbois wrote: > The gains have a precision u3.13, range [0, 8[ which means that a gain > multiplier value of 1.0 is represented as a multiplication by 8192 in > the ImgU. Correct the gains as this was misunderstood in the first > place. > > Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> > Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > --- > src/ipa/ipu3/algorithms/awb.cpp | 15 ++++++--------- > 1 file changed, 6 insertions(+), 9 deletions(-) > > diff --git a/src/ipa/ipu3/algorithms/awb.cpp b/src/ipa/ipu3/algorithms/awb.cpp > index be764c79..c1ff9450 100644 > --- a/src/ipa/ipu3/algorithms/awb.cpp > +++ b/src/ipa/ipu3/algorithms/awb.cpp > @@ -313,6 +313,7 @@ void Awb::awbGreyWorld() > /* Color temperature is not relevant in Grey world but still useful to estimate it :-) */ > asyncResults_.temperatureK = estimateCCT(sumRed.R, sumRed.G, sumBlue.B); > asyncResults_.redGain = redGain; > + /*Hardcode the green gain to 1.0. */ Missing space before Hardcode. > asyncResults_.greenGain = 1.0; > asyncResults_.blueGain = blueGain; > } > @@ -376,15 +377,11 @@ void Awb::prepare(IPAContext &context, ipu3_uapi_params *params) > * params->acc_param.bnr.opt_center.x_reset; > params->acc_param.bnr.opt_center_sqr.y_sqr_reset = params->acc_param.bnr.opt_center.y_reset > * params->acc_param.bnr.opt_center.y_reset; > - /* > - * Green gains should not be touched and considered 1. > - * Default is 16, so do not change it at all. > - * 4096 is the value for a gain of 1.0 > - */ > - params->acc_param.bnr.wb_gains.gr = 16 * context.frameContext.awb.gains.green; > - params->acc_param.bnr.wb_gains.r = 4096 * context.frameContext.awb.gains.red; > - params->acc_param.bnr.wb_gains.b = 4096 * context.frameContext.awb.gains.blue; > - params->acc_param.bnr.wb_gains.gb = 16 * context.frameContext.awb.gains.green; > + /* Convert to u3.13 fixed point values */ > + params->acc_param.bnr.wb_gains.gr = 8192 * context.frameContext.awb.gains.green; > + params->acc_param.bnr.wb_gains.r = 8192 * context.frameContext.awb.gains.red; > + params->acc_param.bnr.wb_gains.b = 8192 * context.frameContext.awb.gains.blue; > + params->acc_param.bnr.wb_gains.gb = 8192 * context.frameContext.awb.gains.green; > > LOG(IPU3Awb, Debug) << "Color temperature estimated: " << asyncResults_.temperatureK; >
diff --git a/src/ipa/ipu3/algorithms/awb.cpp b/src/ipa/ipu3/algorithms/awb.cpp index be764c79..c1ff9450 100644 --- a/src/ipa/ipu3/algorithms/awb.cpp +++ b/src/ipa/ipu3/algorithms/awb.cpp @@ -313,6 +313,7 @@ void Awb::awbGreyWorld() /* Color temperature is not relevant in Grey world but still useful to estimate it :-) */ asyncResults_.temperatureK = estimateCCT(sumRed.R, sumRed.G, sumBlue.B); asyncResults_.redGain = redGain; + /*Hardcode the green gain to 1.0. */ asyncResults_.greenGain = 1.0; asyncResults_.blueGain = blueGain; } @@ -376,15 +377,11 @@ void Awb::prepare(IPAContext &context, ipu3_uapi_params *params) * params->acc_param.bnr.opt_center.x_reset; params->acc_param.bnr.opt_center_sqr.y_sqr_reset = params->acc_param.bnr.opt_center.y_reset * params->acc_param.bnr.opt_center.y_reset; - /* - * Green gains should not be touched and considered 1. - * Default is 16, so do not change it at all. - * 4096 is the value for a gain of 1.0 - */ - params->acc_param.bnr.wb_gains.gr = 16 * context.frameContext.awb.gains.green; - params->acc_param.bnr.wb_gains.r = 4096 * context.frameContext.awb.gains.red; - params->acc_param.bnr.wb_gains.b = 4096 * context.frameContext.awb.gains.blue; - params->acc_param.bnr.wb_gains.gb = 16 * context.frameContext.awb.gains.green; + /* Convert to u3.13 fixed point values */ + params->acc_param.bnr.wb_gains.gr = 8192 * context.frameContext.awb.gains.green; + params->acc_param.bnr.wb_gains.r = 8192 * context.frameContext.awb.gains.red; + params->acc_param.bnr.wb_gains.b = 8192 * context.frameContext.awb.gains.blue; + params->acc_param.bnr.wb_gains.gb = 8192 * context.frameContext.awb.gains.green; LOG(IPU3Awb, Debug) << "Color temperature estimated: " << asyncResults_.temperatureK;