[libcamera-devel] [PATCH] libcamera: ipa: raspberrypi: Enable focus measure without recompile

Laurent Pinchart laurent.pinchart at ideasonboard.com
Wed Jul 1 13:50:25 CEST 2020


Hi David,

On Wed, Jul 01, 2020 at 12:43:47PM +0100, David Plowman wrote:
> On Wed, 1 Jul 2020 at 10:11, Laurent Pinchart wrote:
> > On Wed, Jul 01, 2020 at 09:53:56AM +0100, David Plowman wrote:
> > > Previously output of the focus measure could be enabled without
> > > recompiling (because of the RPI_LOGGING_ENABLE macro). Here we disable
> > > it in the imx477 tuning, but if re-enabled there it will now be output
> > > to the console (much more helpful behaviour).
> > >
> > > Signed-off-by: David Plowman <david.plowman at raspberrypi.com>
> > > ---
> > >  src/ipa/raspberrypi/controller/rpi/focus.cpp | 2 +-
> > >  src/ipa/raspberrypi/data/imx477.json         | 2 +-
> > >  2 files changed, 2 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/src/ipa/raspberrypi/controller/rpi/focus.cpp b/src/ipa/raspberrypi/controller/rpi/focus.cpp
> > > index 1e2b649..133ea6f 100644
> > > --- a/src/ipa/raspberrypi/controller/rpi/focus.cpp
> > > +++ b/src/ipa/raspberrypi/controller/rpi/focus.cpp
> > > @@ -39,7 +39,7 @@ void Focus::Process(StatisticsPtr &stats, Metadata *image_metadata)
> > >       image_metadata->Set("focus.status", status);
> > >       if (print_) {
> > >               uint32_t value = (status.focus_measures[5] + status.focus_measures[6]) / 10;
> > > -             RPI_LOG("Focus contrast measure: " << value);
> > > +             std::cout << "Focus contrast measure: " << value << std::endl;
> >
> > How about using the libcamera logging infrastructure ? It would give you
> > runtime-controllable log categories and levels.
> 
> Yes, thank you for the thought. I spent way longer trying to make up
> my mind than such a trivial and unimportant thing really warrants! But
> I think I've eventually come down on the side of using the libcamera
> logging, so expect a v2 patch momentarily.

Nice to hear :-) Feel free to define different log categories for
different algorithms, that could even allow dropping the print options
from the json file completely. Categories have to be valid C++ symbol
names so RPI.Focus wouldn't be valid unfortunately.

Additionally, we're thinking about adding a tracing mechanism that would
work similarly to the log but would be more lightweight, it could be
used in the future for such messages. Or maybe we'll just improve the
efficiency of the logging system.

> > >       }
> > >  }
> > >
> > > diff --git a/src/ipa/raspberrypi/data/imx477.json b/src/ipa/raspberrypi/data/imx477.json
> > > index 389e8ce..8976e31 100644
> > > --- a/src/ipa/raspberrypi/data/imx477.json
> > > +++ b/src/ipa/raspberrypi/data/imx477.json
> > > @@ -415,6 +415,6 @@
> > >      },
> > >      "rpi.focus":
> > >      {
> > > -     "print": 1
> > > +     "print": 0
> > >      }
> > >  }

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list