Message ID | 20211111140928.136111-11-jeanmichel.hautbois@ideasonboard.com |
---|---|
State | Accepted |
Headers | show |
Series |
|
Related | show |
Hi JM Thank you for the patch On 11/11/21 7:39 PM, Jean-Michel Hautbois wrote: > The AWB estimates the color temperature, but it is not used at all. It > can be useful for debug purpose at least, but also for lux estimation > later, to be able to know the temperature estimated for a given frame. > > Add a new member to the IPAFrameContext::awb for this purpose, and > update the value in AWB. > > Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> > Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> > --- > src/ipa/ipu3/algorithms/awb.cpp | 1 + > src/ipa/ipu3/ipa_context.cpp | 3 +++ > src/ipa/ipu3/ipa_context.h | 2 ++ > 3 files changed, 6 insertions(+) > > diff --git a/src/ipa/ipu3/algorithms/awb.cpp b/src/ipa/ipu3/algorithms/awb.cpp > index a4114659..c7bcb20e 100644 > --- a/src/ipa/ipu3/algorithms/awb.cpp > +++ b/src/ipa/ipu3/algorithms/awb.cpp > @@ -385,6 +385,7 @@ void Awb::process(IPAContext &context, const ipu3_uapi_stats_3a *stats) > context.frameContext.awb.gains.blue = asyncResults_.blueGain; > context.frameContext.awb.gains.green = asyncResults_.greenGain; > context.frameContext.awb.gains.red = asyncResults_.redGain; > + context.frameContext.awb.temperatureK = asyncResults_.temperatureK; > } > > constexpr uint16_t Awb::threshold(float value) > diff --git a/src/ipa/ipu3/ipa_context.cpp b/src/ipa/ipu3/ipa_context.cpp > index a7ff957d..99caf9ad 100644 > --- a/src/ipa/ipu3/ipa_context.cpp > +++ b/src/ipa/ipu3/ipa_context.cpp > @@ -117,6 +117,9 @@ namespace libcamera::ipa::ipu3 { > * > * \var IPAFrameContext::awb.gains.blue > * \brief White balance gain for B channel > + * > + * \var IPAFrameContext::awb.temperatureK > + * \brief Estimated color temperature > */ > > /** > diff --git a/src/ipa/ipu3/ipa_context.h b/src/ipa/ipu3/ipa_context.h > index a5a19800..fd97e240 100644 > --- a/src/ipa/ipu3/ipa_context.h > +++ b/src/ipa/ipu3/ipa_context.h > @@ -45,6 +45,8 @@ struct IPAFrameContext { > double green; > double blue; > } gains; > + > + double temperatureK; > } awb; > > struct {
Hi Jean-Michel, On Thu, Nov 11, 2021 at 03:09:24PM +0100, Jean-Michel Hautbois wrote: > The AWB estimates the color temperature, but it is not used at all. It > can be useful for debug purpose at least, but also for lux estimation > later, to be able to know the temperature estimated for a given frame. > > Add a new member to the IPAFrameContext::awb for this purpose, and > update the value in AWB. > > Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> > Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> > --- > src/ipa/ipu3/algorithms/awb.cpp | 1 + > src/ipa/ipu3/ipa_context.cpp | 3 +++ > src/ipa/ipu3/ipa_context.h | 2 ++ > 3 files changed, 6 insertions(+) > > diff --git a/src/ipa/ipu3/algorithms/awb.cpp b/src/ipa/ipu3/algorithms/awb.cpp > index a4114659..c7bcb20e 100644 > --- a/src/ipa/ipu3/algorithms/awb.cpp > +++ b/src/ipa/ipu3/algorithms/awb.cpp > @@ -385,6 +385,7 @@ void Awb::process(IPAContext &context, const ipu3_uapi_stats_3a *stats) > context.frameContext.awb.gains.blue = asyncResults_.blueGain; > context.frameContext.awb.gains.green = asyncResults_.greenGain; > context.frameContext.awb.gains.red = asyncResults_.redGain; > + context.frameContext.awb.temperatureK = asyncResults_.temperatureK; > } > > constexpr uint16_t Awb::threshold(float value) > diff --git a/src/ipa/ipu3/ipa_context.cpp b/src/ipa/ipu3/ipa_context.cpp > index a7ff957d..99caf9ad 100644 > --- a/src/ipa/ipu3/ipa_context.cpp > +++ b/src/ipa/ipu3/ipa_context.cpp > @@ -117,6 +117,9 @@ namespace libcamera::ipa::ipu3 { > * > * \var IPAFrameContext::awb.gains.blue > * \brief White balance gain for B channel > + * > + * \var IPAFrameContext::awb.temperatureK > + * \brief Estimated color temperature > */ > > /** > diff --git a/src/ipa/ipu3/ipa_context.h b/src/ipa/ipu3/ipa_context.h > index a5a19800..fd97e240 100644 > --- a/src/ipa/ipu3/ipa_context.h > +++ b/src/ipa/ipu3/ipa_context.h > @@ -45,6 +45,8 @@ struct IPAFrameContext { > double green; > double blue; > } gains; > + > + double temperatureK; > } awb; > > struct { > -- > 2.32.0 >
diff --git a/src/ipa/ipu3/algorithms/awb.cpp b/src/ipa/ipu3/algorithms/awb.cpp index a4114659..c7bcb20e 100644 --- a/src/ipa/ipu3/algorithms/awb.cpp +++ b/src/ipa/ipu3/algorithms/awb.cpp @@ -385,6 +385,7 @@ void Awb::process(IPAContext &context, const ipu3_uapi_stats_3a *stats) context.frameContext.awb.gains.blue = asyncResults_.blueGain; context.frameContext.awb.gains.green = asyncResults_.greenGain; context.frameContext.awb.gains.red = asyncResults_.redGain; + context.frameContext.awb.temperatureK = asyncResults_.temperatureK; } constexpr uint16_t Awb::threshold(float value) diff --git a/src/ipa/ipu3/ipa_context.cpp b/src/ipa/ipu3/ipa_context.cpp index a7ff957d..99caf9ad 100644 --- a/src/ipa/ipu3/ipa_context.cpp +++ b/src/ipa/ipu3/ipa_context.cpp @@ -117,6 +117,9 @@ namespace libcamera::ipa::ipu3 { * * \var IPAFrameContext::awb.gains.blue * \brief White balance gain for B channel + * + * \var IPAFrameContext::awb.temperatureK + * \brief Estimated color temperature */ /** diff --git a/src/ipa/ipu3/ipa_context.h b/src/ipa/ipu3/ipa_context.h index a5a19800..fd97e240 100644 --- a/src/ipa/ipu3/ipa_context.h +++ b/src/ipa/ipu3/ipa_context.h @@ -45,6 +45,8 @@ struct IPAFrameContext { double green; double blue; } gains; + + double temperatureK; } awb; struct {