[{"id":28261,"web_url":"https://patchwork.libcamera.org/comment/28261/","msgid":"<CAHW6GYJo6Tua=c6PKvW1dDnT36tWko7Xa8kpy7CvK2OX26BL_Q@mail.gmail.com>","date":"2023-12-06T17:00:11","subject":"Re: [libcamera-devel] [PATCH v1 2/2] ipa: vc4: Implement the\n\tStatsOutputEnable vendor control","submitter":{"id":42,"url":"https://patchwork.libcamera.org/api/people/42/","name":"David Plowman","email":"david.plowman@raspberrypi.com"},"content":"Hi Naush\n\nThanks for this. Looks good!\n\nOn Mon, 4 Dec 2023 at 16:18, Naushir Patuck via libcamera-devel\n<libcamera-devel@lists.libcamera.org> wrote:\n>\n> Implement the StatsOutputEnable control for the VC4 IPA. When set,\n> this outputs the ISP statistics as a uint8_t span through the Bcm2835StatsOutput\n> metadata control.\n>\n> To get this working, IpaBase::libcameraMetadata_ is moved from a private\n> to a protected member variable. This makes it accessable to the VC4\n> derived IPA class.\n>\n> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n> ---\n>  src/ipa/rpi/common/ipa_base.cpp | 12 +++++++++---\n>  src/ipa/rpi/common/ipa_base.h   |  3 ++-\n>  src/ipa/rpi/vc4/vc4.cpp         |  6 ++++++\n>  3 files changed, 17 insertions(+), 4 deletions(-)\n>\n> diff --git a/src/ipa/rpi/common/ipa_base.cpp b/src/ipa/rpi/common/ipa_base.cpp\n> index 6ac9d5de2f88..c4d17a2130c8 100644\n> --- a/src/ipa/rpi/common/ipa_base.cpp\n> +++ b/src/ipa/rpi/common/ipa_base.cpp\n> @@ -70,7 +70,8 @@ const ControlInfoMap::Map ipaControls{\n>         { &controls::Sharpness, ControlInfo(0.0f, 16.0f, 1.0f) },\n>         { &controls::ScalerCrop, ControlInfo(Rectangle{}, Rectangle(65535, 65535, 65535, 65535), Rectangle{}) },\n>         { &controls::FrameDurationLimits, ControlInfo(INT64_C(33333), INT64_C(120000)) },\n> -       { &controls::draft::NoiseReductionMode, ControlInfo(controls::draft::NoiseReductionModeValues) }\n> +       { &controls::draft::NoiseReductionMode, ControlInfo(controls::draft::NoiseReductionModeValues) },\n> +       { &controls::rpi::StatsOutputEnable, ControlInfo(false, true) },\n>  };\n>\n>  /* IPA controls handled conditionally, if the sensor is not mono */\n> @@ -100,8 +101,9 @@ LOG_DEFINE_CATEGORY(IPARPI)\n>  namespace ipa::RPi {\n>\n>  IpaBase::IpaBase()\n> -       : controller_(), frameLengths_(FrameLengthsQueueSize, 0s), frameCount_(0),\n> -         mistrustCount_(0), lastRunTimestamp_(0), firstStart_(true), flickerState_({ 0, 0s })\n> +       : controller_(), frameLengths_(FrameLengthsQueueSize, 0s), statsMetadataOutput_(false),\n> +         frameCount_(0), mistrustCount_(0), lastRunTimestamp_(0), firstStart_(true),\n> +         flickerState_({ 0, 0s })\n>  {\n>  }\n>\n> @@ -1135,6 +1137,10 @@ void IpaBase::applyControls(const ControlList &controls)\n>                         break;\n>                 }\n>\n> +               case controls::rpi::STATS_OUTPUT_ENABLE:\n> +                       statsMetadataOutput_ = ctrl.second.get<bool>();\n> +                       break;\n> +\n>                 default:\n>                         LOG(IPARPI, Warning)\n>                                 << \"Ctrl \" << controls::controls.at(ctrl.first)->name()\n> diff --git a/src/ipa/rpi/common/ipa_base.h b/src/ipa/rpi/common/ipa_base.h\n> index eaa9f71182ed..4db4411eed7c 100644\n> --- a/src/ipa/rpi/common/ipa_base.h\n> +++ b/src/ipa/rpi/common/ipa_base.h\n> @@ -61,6 +61,8 @@ protected:\n>         /* Track the frame length times over FrameLengthsQueueSize frames. */\n>         std::deque<utils::Duration> frameLengths_;\n>         utils::Duration lastTimeout_;\n> +       ControlList libcameraMetadata_;\n> +       bool statsMetadataOutput_;\n>\n>  private:\n>         /* Number of metadata objects available in the context list. */\n> @@ -89,7 +91,6 @@ private:\n>\n>         bool lensPresent_;\n>         bool monoSensor_;\n> -       ControlList libcameraMetadata_;\n>\n>         std::array<RPiController::Metadata, numMetadataContexts> rpiMetadata_;\n>\n> diff --git a/src/ipa/rpi/vc4/vc4.cpp b/src/ipa/rpi/vc4/vc4.cpp\n> index c165a5b8b0b6..ccd4141943dd 100644\n> --- a/src/ipa/rpi/vc4/vc4.cpp\n> +++ b/src/ipa/rpi/vc4/vc4.cpp\n> @@ -11,6 +11,7 @@\n>  #include <linux/bcm2835-isp.h>\n>\n>  #include <libcamera/base/log.h>\n> +#include <libcamera/base/span.h>\n>  #include <libcamera/control_ids.h>\n>  #include <libcamera/ipa/ipa_module_info.h>\n>\n> @@ -245,6 +246,11 @@ RPiController::StatisticsPtr IpaVc4::platformProcessStats(Span<uint8_t> mem)\n>                                                   stats->focus_stats[i].contrast_val_num[1][1],\n>                                                   stats->focus_stats[i].contrast_val_num[1][0] });\n>\n> +       if (statsMetadataOutput_) {\n> +               Span<uint8_t> statsSpan((uint8_t *)(stats), sizeof(bcm2835_isp_stats));\n\nI thought folks preferred C++ style casts these days, but honestly...\nI really don't care!!\n\nReviewed-by: David Plowman <david.plowman@raspberrypi.com>\n\nThanks!\nDavid\n\n> +               libcameraMetadata_.set(controls::rpi::Bcm2835StatsOutput, statsSpan);\n> +       }\n> +\n>         return statistics;\n>  }\n>\n> --\n> 2.34.1\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id D4677C322E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  6 Dec 2023 17:00:25 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2895062B2C;\n\tWed,  6 Dec 2023 18:00:25 +0100 (CET)","from mail-qt1-x82e.google.com (mail-qt1-x82e.google.com\n\t[IPv6:2607:f8b0:4864:20::82e])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C4C6A61D9E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  6 Dec 2023 18:00:23 +0100 (CET)","by mail-qt1-x82e.google.com with SMTP id\n\td75a77b69052e-42542163a1fso6266961cf.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 06 Dec 2023 09:00:23 -0800 (PST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1701882025;\n\tbh=XKFxW+Z69TQ0MUoubBr2maIus0lOhiH00OAry6xMn9k=;\n\th=References:In-Reply-To:Date:To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=MoRBqjrA2TzT5bswd8Uq2qqgl/USnOtZ9ElHUbXbbokFmPWxjTaxt8UIRpvgYi5W4\n\tyG8rOK5cQz28Sf09E1/VY1G9C5VDdpdPgWfwJ38fuZGHda3LdwXaE/rdeGISJyfYPb\n\tKfunfVjTfdLgdVozgoUyfx8KlWEhjjAbp5qM5crJ1xYPT1xMTr95+wObv3HV6COg9p\n\tr4HE6kknKvkGODv+v4pF4qrvCRPLYDsjCN1WH3X9UQQL/t1pFUojYDFprCtD/B63r2\n\tCu2NuR7Yzq9I8Mc+HT1X2cXbfsN8NnaGOzqP+xmurPSjd9Z8sTDNU8wwsGjY/QX1+Z\n\thRCg55h8TJ7PQ==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1701882022; x=1702486822;\n\tdarn=lists.libcamera.org; \n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:from:to:cc:subject:date:message-id:reply-to;\n\tbh=PyI52h6faWqgJ9scrN7XwIdnrsyUi8RO1S8igVUadQA=;\n\tb=O9Y2ph1khqCV3Xpldm0gpTBqHml/ID8BHL6Ooul3H2E4IDx300xehZFN3nWqg4+GbX\n\tGaAHpT+5gLdlhYAIaf4LVX0RsQbvSJdqr4It3msrDMzF80QdwvIbIt/5fD4Ii6jEQ4Ne\n\tnAK33LNtxRMNZpgvEpvGPaC4lvUURQrM+qMvNosp1UrA1j7Pl2FxX5jRwiCRu6aRa3Jl\n\tMeNnQmjQySAjHptCVPkAO7ub6dD5QKGXzrQOnhWIY4WVBl7xPTWHx7dtH/D8JDRKjqyy\n\tUClvTmfIIMDqXw7PRFewjQdJT6S6AMoPcTfENp/LZqAu73ZAm0sGXy+zLJOHP3qXYmp1\n\tDv0g=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"O9Y2ph1k\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1701882022; x=1702486822;\n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:x-gm-message-state:from:to:cc:subject:date:message-id\n\t:reply-to;\n\tbh=PyI52h6faWqgJ9scrN7XwIdnrsyUi8RO1S8igVUadQA=;\n\tb=U8+WWiD/txKh9SLN+z8rbnsONH6IimiOZx1WyMFhZhvM8yvHDe1itnxUlmsIUOwFGJ\n\togj7kmRVM9KD6po/An0YzBiwN+GQaO4Tm6+HxPaER1T6Mza5XrA36Xxz9GL32GcIQ5II\n\tgJKlxKRjP/Hdacm8tUvOtOal2M6yXtdjmoNUG38wcEbGPHXffn4dNcK83mNrH+qYw1mk\n\t1KmerCgZOoK8px6b9gC5/tnfWM/JkJLKwWRzS/Sob31BzQVZRHsdWbI+g1mE/41lnbu/\n\tO+J2mkWSAcwHU7Nm4nPUCr/P7ZRjzhVizWSqKvqFtLGy5gI9VuLR0zUqnoX3Oq5iqwpX\n\tcxZQ==","X-Gm-Message-State":"AOJu0Yw+NbnopQHfMSFi61HsEGdOsKh/kGVaKDVcu+qTDu1BRssg4Va9\n\tutOElU1UQPWgzscKCFYWqHBW+rK9P4wuzIVpNw96Tw==","X-Google-Smtp-Source":"AGHT+IGAGOQE7ifUpBUHY3V3B9yA6fKwn3+MBmM2eFAFPKvzp1IOibZVdbdI9ZcrbL+TikILDyF8jc9vUmH5NmrNVhI=","X-Received":"by 2002:ad4:5749:0:b0:67a:a767:372 with SMTP id\n\tq9-20020ad45749000000b0067aa7670372mr1814390qvx.122.1701882022447;\n\tWed, 06 Dec 2023 09:00:22 -0800 (PST)","MIME-Version":"1.0","References":"<20231204161901.6632-1-naush@raspberrypi.com>\n\t<20231204161901.6632-3-naush@raspberrypi.com>","In-Reply-To":"<20231204161901.6632-3-naush@raspberrypi.com>","Date":"Wed, 6 Dec 2023 17:00:11 +0000","Message-ID":"<CAHW6GYJo6Tua=c6PKvW1dDnT36tWko7Xa8kpy7CvK2OX26BL_Q@mail.gmail.com>","To":"Naushir Patuck <naush@raspberrypi.com>","Content-Type":"text/plain; charset=\"UTF-8\"","Subject":"Re: [libcamera-devel] [PATCH v1 2/2] ipa: vc4: Implement the\n\tStatsOutputEnable vendor control","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"David Plowman via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"David Plowman <david.plowman@raspberrypi.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":28393,"web_url":"https://patchwork.libcamera.org/comment/28393/","msgid":"<170473575258.3044059.4298954940959153319@ping.linuxembedded.co.uk>","date":"2024-01-08T17:42:32","subject":"Re: [libcamera-devel] [PATCH v1 2/2] ipa: vc4: Implement the\n\tStatsOutputEnable vendor control","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting David Plowman via libcamera-devel (2023-12-06 17:00:11)\n> Hi Naush\n> \n> Thanks for this. Looks good!\n> \n> On Mon, 4 Dec 2023 at 16:18, Naushir Patuck via libcamera-devel\n> <libcamera-devel@lists.libcamera.org> wrote:\n> >\n> > Implement the StatsOutputEnable control for the VC4 IPA. When set,\n> > this outputs the ISP statistics as a uint8_t span through the Bcm2835StatsOutput\n> > metadata control.\n> >\n> > To get this working, IpaBase::libcameraMetadata_ is moved from a private\n> > to a protected member variable. This makes it accessable to the VC4\n> > derived IPA class.\n> >\n> > Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n> > ---\n> >  src/ipa/rpi/common/ipa_base.cpp | 12 +++++++++---\n> >  src/ipa/rpi/common/ipa_base.h   |  3 ++-\n> >  src/ipa/rpi/vc4/vc4.cpp         |  6 ++++++\n> >  3 files changed, 17 insertions(+), 4 deletions(-)\n> >\n> > diff --git a/src/ipa/rpi/common/ipa_base.cpp b/src/ipa/rpi/common/ipa_base.cpp\n> > index 6ac9d5de2f88..c4d17a2130c8 100644\n> > --- a/src/ipa/rpi/common/ipa_base.cpp\n> > +++ b/src/ipa/rpi/common/ipa_base.cpp\n> > @@ -70,7 +70,8 @@ const ControlInfoMap::Map ipaControls{\n> >         { &controls::Sharpness, ControlInfo(0.0f, 16.0f, 1.0f) },\n> >         { &controls::ScalerCrop, ControlInfo(Rectangle{}, Rectangle(65535, 65535, 65535, 65535), Rectangle{}) },\n> >         { &controls::FrameDurationLimits, ControlInfo(INT64_C(33333), INT64_C(120000)) },\n> > -       { &controls::draft::NoiseReductionMode, ControlInfo(controls::draft::NoiseReductionModeValues) }\n> > +       { &controls::draft::NoiseReductionMode, ControlInfo(controls::draft::NoiseReductionModeValues) },\n> > +       { &controls::rpi::StatsOutputEnable, ControlInfo(false, true) },\n> >  };\n> >\n> >  /* IPA controls handled conditionally, if the sensor is not mono */\n> > @@ -100,8 +101,9 @@ LOG_DEFINE_CATEGORY(IPARPI)\n> >  namespace ipa::RPi {\n> >\n> >  IpaBase::IpaBase()\n> > -       : controller_(), frameLengths_(FrameLengthsQueueSize, 0s), frameCount_(0),\n> > -         mistrustCount_(0), lastRunTimestamp_(0), firstStart_(true), flickerState_({ 0, 0s })\n> > +       : controller_(), frameLengths_(FrameLengthsQueueSize, 0s), statsMetadataOutput_(false),\n> > +         frameCount_(0), mistrustCount_(0), lastRunTimestamp_(0), firstStart_(true),\n> > +         flickerState_({ 0, 0s })\n> >  {\n> >  }\n> >\n> > @@ -1135,6 +1137,10 @@ void IpaBase::applyControls(const ControlList &controls)\n> >                         break;\n> >                 }\n> >\n> > +               case controls::rpi::STATS_OUTPUT_ENABLE:\n> > +                       statsMetadataOutput_ = ctrl.second.get<bool>();\n> > +                       break;\n> > +\n> >                 default:\n> >                         LOG(IPARPI, Warning)\n> >                                 << \"Ctrl \" << controls::controls.at(ctrl.first)->name()\n> > diff --git a/src/ipa/rpi/common/ipa_base.h b/src/ipa/rpi/common/ipa_base.h\n> > index eaa9f71182ed..4db4411eed7c 100644\n> > --- a/src/ipa/rpi/common/ipa_base.h\n> > +++ b/src/ipa/rpi/common/ipa_base.h\n> > @@ -61,6 +61,8 @@ protected:\n> >         /* Track the frame length times over FrameLengthsQueueSize frames. */\n> >         std::deque<utils::Duration> frameLengths_;\n> >         utils::Duration lastTimeout_;\n> > +       ControlList libcameraMetadata_;\n> > +       bool statsMetadataOutput_;\n> >\n> >  private:\n> >         /* Number of metadata objects available in the context list. */\n> > @@ -89,7 +91,6 @@ private:\n> >\n> >         bool lensPresent_;\n> >         bool monoSensor_;\n> > -       ControlList libcameraMetadata_;\n> >\n> >         std::array<RPiController::Metadata, numMetadataContexts> rpiMetadata_;\n> >\n> > diff --git a/src/ipa/rpi/vc4/vc4.cpp b/src/ipa/rpi/vc4/vc4.cpp\n> > index c165a5b8b0b6..ccd4141943dd 100644\n> > --- a/src/ipa/rpi/vc4/vc4.cpp\n> > +++ b/src/ipa/rpi/vc4/vc4.cpp\n> > @@ -11,6 +11,7 @@\n> >  #include <linux/bcm2835-isp.h>\n> >\n> >  #include <libcamera/base/log.h>\n> > +#include <libcamera/base/span.h>\n> >  #include <libcamera/control_ids.h>\n> >  #include <libcamera/ipa/ipa_module_info.h>\n> >\n> > @@ -245,6 +246,11 @@ RPiController::StatisticsPtr IpaVc4::platformProcessStats(Span<uint8_t> mem)\n> >                                                   stats->focus_stats[i].contrast_val_num[1][1],\n> >                                                   stats->focus_stats[i].contrast_val_num[1][0] });\n> >\n> > +       if (statsMetadataOutput_) {\n> > +               Span<uint8_t> statsSpan((uint8_t *)(stats), sizeof(bcm2835_isp_stats));\n> \n> I thought folks preferred C++ style casts these days, but honestly...\n> I really don't care!!\n> \n> Reviewed-by: David Plowman <david.plowman@raspberrypi.com>\n\nYes, any objection to changing this to the following?:\n\n\t\tSpan<uint8_t> statsSpan(static_cast<uint8_t *>(stats),\n\t\t\t\t\tsizeOf(bcm2835_isp_stats));\n\nAnd then:\n\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> \n> Thanks!\n> David\n> \n> > +               libcameraMetadata_.set(controls::rpi::Bcm2835StatsOutput, statsSpan);\n> > +       }\n> > +\n> >         return statistics;\n> >  }\n> >\n> > --\n> > 2.34.1\n> >","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 4C023C323E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  8 Jan 2024 17:42:37 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4A4A662B41;\n\tMon,  8 Jan 2024 18:42:36 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id F14B061D7E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  8 Jan 2024 18:42:34 +0100 (CET)","from pendragon.ideasonboard.com\n\t(aztw-30-b2-v4wan-166917-cust845.vm26.cable.virginm.net\n\t[82.37.23.78])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 77AAA552;\n\tMon,  8 Jan 2024 18:41:31 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1704735756;\n\tbh=4pe1AHkj4nWOPpx1m5A9HdJZUmMWcv6f1FAiYcOUb20=;\n\th=In-Reply-To:References:To:Date:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=yxWuEVJqkUrVwpmwyRViU9DINDHwEYp3Ak9Cp6jSuKGi4YF/Uf6+HA3F2JXdDpqc0\n\trjldGjAPkLuc6RTy7UJvDE8BVf1gYTDyPMRzJObcg4HdbVnJLdXIOHTSdRKAmPdVFa\n\tb6Ixx2cPlx+MIrrlWENcTelz/7Qi3iUPj2Ik9w8g9EfecoeMNAaJwlRVWv/u+CM0EQ\n\tXpaqgqiEMEWN/xtYDDLICFFtlBcvPqFnbYEGOoR+slvf39TP+MankYQyGY8saWkQ2v\n\tFhuBLPzZHog9OsZsHfwz2LTWsX5kHSiuNVlxZxVAClgWYTx8BYypaujOF6/MXqHqeT\n\tMZQBVIjEniCgA==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1704735691;\n\tbh=4pe1AHkj4nWOPpx1m5A9HdJZUmMWcv6f1FAiYcOUb20=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=EDJB6GmLJ0Mk6g6dakL50nYDadm7OesZAVepfhTMhhSO7h+RndLq6e/OLJ7zuqeiu\n\ta0mr4cn9mK3BHybBfm1EMMP5TRsL9g0NmIUl9Odtx0b46AZUaTzcY7cjsuJeC8rqyl\n\tJaQdaHvlhwNru4Fp47/vyEDIVCE30EO7HJIjooS0="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"EDJB6GmL\"; dkim-atps=neutral","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<CAHW6GYJo6Tua=c6PKvW1dDnT36tWko7Xa8kpy7CvK2OX26BL_Q@mail.gmail.com>","References":"<20231204161901.6632-1-naush@raspberrypi.com>\n\t<20231204161901.6632-3-naush@raspberrypi.com>\n\t<CAHW6GYJo6Tua=c6PKvW1dDnT36tWko7Xa8kpy7CvK2OX26BL_Q@mail.gmail.com>","To":"David Plowman <david.plowman@raspberrypi.com>,\n\tDavid Plowman via libcamera-devel <libcamera-devel@lists.libcamera.org>, \n\tNaushir Patuck <naush@raspberrypi.com>","Date":"Mon, 08 Jan 2024 17:42:32 +0000","Message-ID":"<170473575258.3044059.4298954940959153319@ping.linuxembedded.co.uk>","User-Agent":"alot/0.10","Subject":"Re: [libcamera-devel] [PATCH v1 2/2] ipa: vc4: Implement the\n\tStatsOutputEnable vendor control","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Kieran Bingham via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":28397,"web_url":"https://patchwork.libcamera.org/comment/28397/","msgid":"<CAEmqJPqG_4VCTqo9E2XPy+7U5JJ2jGH9ioNzZSbAxre5c39KJA@mail.gmail.com>","date":"2024-01-09T09:01:38","subject":"Re: [libcamera-devel] [PATCH v1 2/2] ipa: vc4: Implement the\n\tStatsOutputEnable vendor control","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/people/34/","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"content":"Hi Kieran and David,\n\nOn Mon, 8 Jan 2024 at 17:42, Kieran Bingham\n<kieran.bingham@ideasonboard.com> wrote:\n>\n> Quoting David Plowman via libcamera-devel (2023-12-06 17:00:11)\n> > Hi Naush\n> >\n> > Thanks for this. Looks good!\n> >\n> > On Mon, 4 Dec 2023 at 16:18, Naushir Patuck via libcamera-devel\n> > <libcamera-devel@lists.libcamera.org> wrote:\n> > >\n> > > Implement the StatsOutputEnable control for the VC4 IPA. When set,\n> > > this outputs the ISP statistics as a uint8_t span through the Bcm2835StatsOutput\n> > > metadata control.\n> > >\n> > > To get this working, IpaBase::libcameraMetadata_ is moved from a private\n> > > to a protected member variable. This makes it accessable to the VC4\n> > > derived IPA class.\n> > >\n> > > Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n> > > ---\n> > >  src/ipa/rpi/common/ipa_base.cpp | 12 +++++++++---\n> > >  src/ipa/rpi/common/ipa_base.h   |  3 ++-\n> > >  src/ipa/rpi/vc4/vc4.cpp         |  6 ++++++\n> > >  3 files changed, 17 insertions(+), 4 deletions(-)\n> > >\n> > > diff --git a/src/ipa/rpi/common/ipa_base.cpp b/src/ipa/rpi/common/ipa_base.cpp\n> > > index 6ac9d5de2f88..c4d17a2130c8 100644\n> > > --- a/src/ipa/rpi/common/ipa_base.cpp\n> > > +++ b/src/ipa/rpi/common/ipa_base.cpp\n> > > @@ -70,7 +70,8 @@ const ControlInfoMap::Map ipaControls{\n> > >         { &controls::Sharpness, ControlInfo(0.0f, 16.0f, 1.0f) },\n> > >         { &controls::ScalerCrop, ControlInfo(Rectangle{}, Rectangle(65535, 65535, 65535, 65535), Rectangle{}) },\n> > >         { &controls::FrameDurationLimits, ControlInfo(INT64_C(33333), INT64_C(120000)) },\n> > > -       { &controls::draft::NoiseReductionMode, ControlInfo(controls::draft::NoiseReductionModeValues) }\n> > > +       { &controls::draft::NoiseReductionMode, ControlInfo(controls::draft::NoiseReductionModeValues) },\n> > > +       { &controls::rpi::StatsOutputEnable, ControlInfo(false, true) },\n> > >  };\n> > >\n> > >  /* IPA controls handled conditionally, if the sensor is not mono */\n> > > @@ -100,8 +101,9 @@ LOG_DEFINE_CATEGORY(IPARPI)\n> > >  namespace ipa::RPi {\n> > >\n> > >  IpaBase::IpaBase()\n> > > -       : controller_(), frameLengths_(FrameLengthsQueueSize, 0s), frameCount_(0),\n> > > -         mistrustCount_(0), lastRunTimestamp_(0), firstStart_(true), flickerState_({ 0, 0s })\n> > > +       : controller_(), frameLengths_(FrameLengthsQueueSize, 0s), statsMetadataOutput_(false),\n> > > +         frameCount_(0), mistrustCount_(0), lastRunTimestamp_(0), firstStart_(true),\n> > > +         flickerState_({ 0, 0s })\n> > >  {\n> > >  }\n> > >\n> > > @@ -1135,6 +1137,10 @@ void IpaBase::applyControls(const ControlList &controls)\n> > >                         break;\n> > >                 }\n> > >\n> > > +               case controls::rpi::STATS_OUTPUT_ENABLE:\n> > > +                       statsMetadataOutput_ = ctrl.second.get<bool>();\n> > > +                       break;\n> > > +\n> > >                 default:\n> > >                         LOG(IPARPI, Warning)\n> > >                                 << \"Ctrl \" << controls::controls.at(ctrl.first)->name()\n> > > diff --git a/src/ipa/rpi/common/ipa_base.h b/src/ipa/rpi/common/ipa_base.h\n> > > index eaa9f71182ed..4db4411eed7c 100644\n> > > --- a/src/ipa/rpi/common/ipa_base.h\n> > > +++ b/src/ipa/rpi/common/ipa_base.h\n> > > @@ -61,6 +61,8 @@ protected:\n> > >         /* Track the frame length times over FrameLengthsQueueSize frames. */\n> > >         std::deque<utils::Duration> frameLengths_;\n> > >         utils::Duration lastTimeout_;\n> > > +       ControlList libcameraMetadata_;\n> > > +       bool statsMetadataOutput_;\n> > >\n> > >  private:\n> > >         /* Number of metadata objects available in the context list. */\n> > > @@ -89,7 +91,6 @@ private:\n> > >\n> > >         bool lensPresent_;\n> > >         bool monoSensor_;\n> > > -       ControlList libcameraMetadata_;\n> > >\n> > >         std::array<RPiController::Metadata, numMetadataContexts> rpiMetadata_;\n> > >\n> > > diff --git a/src/ipa/rpi/vc4/vc4.cpp b/src/ipa/rpi/vc4/vc4.cpp\n> > > index c165a5b8b0b6..ccd4141943dd 100644\n> > > --- a/src/ipa/rpi/vc4/vc4.cpp\n> > > +++ b/src/ipa/rpi/vc4/vc4.cpp\n> > > @@ -11,6 +11,7 @@\n> > >  #include <linux/bcm2835-isp.h>\n> > >\n> > >  #include <libcamera/base/log.h>\n> > > +#include <libcamera/base/span.h>\n> > >  #include <libcamera/control_ids.h>\n> > >  #include <libcamera/ipa/ipa_module_info.h>\n> > >\n> > > @@ -245,6 +246,11 @@ RPiController::StatisticsPtr IpaVc4::platformProcessStats(Span<uint8_t> mem)\n> > >                                                   stats->focus_stats[i].contrast_val_num[1][1],\n> > >                                                   stats->focus_stats[i].contrast_val_num[1][0] });\n> > >\n> > > +       if (statsMetadataOutput_) {\n> > > +               Span<uint8_t> statsSpan((uint8_t *)(stats), sizeof(bcm2835_isp_stats));\n> >\n> > I thought folks preferred C++ style casts these days, but honestly...\n> > I really don't care!!\n> >\n> > Reviewed-by: David Plowman <david.plowman@raspberrypi.com>\n>\n> Yes, any objection to changing this to the following?:\n>\n>                 Span<uint8_t> statsSpan(static_cast<uint8_t *>(stats),\n>                                         sizeOf(bcm2835_isp_stats));\n\nNo objections to doing that.\n\n>\n> And then:\n>\n>\n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\nThanks!\nNaush\n\n>\n> >\n> > Thanks!\n> > David\n> >\n> > > +               libcameraMetadata_.set(controls::rpi::Bcm2835StatsOutput, statsSpan);\n> > > +       }\n> > > +\n> > >         return statistics;\n> > >  }\n> > >\n> > > --\n> > > 2.34.1\n> > >","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 25D87BDB1D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  9 Jan 2024 09:02:18 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 70AA562B32;\n\tTue,  9 Jan 2024 10:02:17 +0100 (CET)","from mail-oi1-x233.google.com (mail-oi1-x233.google.com\n\t[IPv6:2607:f8b0:4864:20::233])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3FF4561D72\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  9 Jan 2024 10:02:15 +0100 (CET)","by mail-oi1-x233.google.com with SMTP id\n\t5614622812f47-3bbd6e37af4so2529979b6e.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 09 Jan 2024 01:02:15 -0800 (PST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1704790937;\n\tbh=UacOPJ+cy3XQn3e4mITvlugIU9UZtQnypFQYxLy2LEM=;\n\th=References:In-Reply-To:Date:To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=t0NJBdrcYQUXj2pdS+oAVMuOAfVOeuaTRXOwskwtzTEyVJ8Nrml7VjzKhTbOvlYtM\n\tJqnvwt8ALk9Wj1Oa3vXs8vty1RuHC4Ob+GqhQ1t6BU7W3rVQ/j/6J5pvuD1cX9KNVx\n\t738T1HxOKIzJFOLd8JawppyvvRqCcy8TUOrpLIbvft8T5usC4AVFGjuABRldMZe9Gd\n\t3aRn/uSPcQMYOYWToRRZBk/WDsVD+CPdr7KBwrcVa7tO+qjOojKAccdZmIY9Gd78a5\n\tbWzb8N8fl7dNLL0GTuTg9ADIbqijjCWnXi1PVrAORwcr76CF+CQD9KE7buXA+0fg2F\n\tSy53zZ3atYDRA==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1704790934; x=1705395734;\n\tdarn=lists.libcamera.org; \n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:from:to:cc:subject:date:message-id:reply-to;\n\tbh=bx1dZm8w+PpvWrvtIKcF+dMY5lSVBzxTtLGVc0dj7nY=;\n\tb=d5bbIQfsgmbxEyN2wsPeQNyoMiifldPKWJnpuiZ+mV8w+Xh/gN/uRQs7xcn6rDi7/g\n\tBivoFpfCAQjjCgI8Jqe+L4/IyTF+ycx61QUvZa0z2lDd4m0ROjt5yCxJQKgNgbRBmXFs\n\tgSkM4UkBpDfNRBSio//sgS428FX6S3GXcJXrb0NOp+UI3Ae9czuRMXYkT+FezO4ziPyy\n\tWrBIWUAKJqO4ZK2dQCOS37zadK0zRTrEeBDKKQCvon7QKIC+LD+wQT7i7ZeqsGZ4dElH\n\tslaFU13iTnaWuXzWrt1kr3vWT66iFaldL5lTwPiliN6lyRklQi02yJ3o1T0I8JeXkoNL\n\tndcg=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"d5bbIQfs\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1704790934; x=1705395734;\n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:x-gm-message-state:from:to:cc:subject:date:message-id\n\t:reply-to;\n\tbh=bx1dZm8w+PpvWrvtIKcF+dMY5lSVBzxTtLGVc0dj7nY=;\n\tb=J5yvQ7Uc58eiVmxuwVflxw+r9LwYbDJiDlJdg+6lnqy1CNDvCmM9vMw8j2EQ3JJM4w\n\t/HKaKAjhn7dHtDNFUsMSufnu8V5gTmQdULJ+oA/8rWtGOP4SvtzKc2ZtOhQUR18rUwEM\n\tvIq2qBnQqVhp6YtnPdrHCa2ISc9gC8mKTP6wHvf1YhGu7lQlO5SL4qRgyMWP/mr6R6tg\n\tJcasw71eC0obkWBuGNj7c3pf+J/qtSiQVkaHNqvlETFtBqDOVDsQQq0ob6a5IxLbT0Mj\n\tT6M79nH1RXyleh2zEBK6IXNrFD2qDPeZjpI0CkmpnPmV+Z6GY8iEeqaUyGdwmvn1cCyb\n\tlXWw==","X-Gm-Message-State":"AOJu0Yx7Xk3g+vyacTdC/HLZNl4B4KspEIfk+/4YCOX6XqRgNEYwgNbn\n\tBxCJXVfI8bvxSpoK/EN5Qmf07OLQUbWNAWgcH6x6mHHCwMlELw==","X-Google-Smtp-Source":"AGHT+IFL4bpB2RKDjhxS9b/3sMLnxrP7iMhEWWJbD4FA1MwIwLR49Sp6NlBpZoUyBoYOEuMMQX74ici7Dr2LYU7Upcc=","X-Received":"by 2002:a05:6808:1b09:b0:3bd:3ebc:4448 with SMTP id\n\tbx9-20020a0568081b0900b003bd3ebc4448mr314600oib.28.1704790933732;\n\tTue, 09 Jan 2024 01:02:13 -0800 (PST)","MIME-Version":"1.0","References":"<20231204161901.6632-1-naush@raspberrypi.com>\n\t<20231204161901.6632-3-naush@raspberrypi.com>\n\t<CAHW6GYJo6Tua=c6PKvW1dDnT36tWko7Xa8kpy7CvK2OX26BL_Q@mail.gmail.com>\n\t<170473575258.3044059.4298954940959153319@ping.linuxembedded.co.uk>","In-Reply-To":"<170473575258.3044059.4298954940959153319@ping.linuxembedded.co.uk>","Date":"Tue, 9 Jan 2024 09:01:38 +0000","Message-ID":"<CAEmqJPqG_4VCTqo9E2XPy+7U5JJ2jGH9ioNzZSbAxre5c39KJA@mail.gmail.com>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Content-Type":"text/plain; charset=\"UTF-8\"","Subject":"Re: [libcamera-devel] [PATCH v1 2/2] ipa: vc4: Implement the\n\tStatsOutputEnable vendor control","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Naushir Patuck via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Naushir Patuck <naush@raspberrypi.com>","Cc":"David Plowman via libcamera-devel <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":28399,"web_url":"https://patchwork.libcamera.org/comment/28399/","msgid":"<170479559541.3044059.13916873122577264933@ping.linuxembedded.co.uk>","date":"2024-01-09T10:19:55","subject":"Re: [libcamera-devel] [PATCH v1 2/2] ipa: vc4: Implement the\n\tStatsOutputEnable vendor control","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Naushir Patuck (2024-01-09 09:01:38)\n> Hi Kieran and David,\n> \n> On Mon, 8 Jan 2024 at 17:42, Kieran Bingham\n> <kieran.bingham@ideasonboard.com> wrote:\n> >\n> > Quoting David Plowman via libcamera-devel (2023-12-06 17:00:11)\n> > > Hi Naush\n> > >\n> > > Thanks for this. Looks good!\n> > >\n> > > On Mon, 4 Dec 2023 at 16:18, Naushir Patuck via libcamera-devel\n> > > <libcamera-devel@lists.libcamera.org> wrote:\n> > > >\n> > > > Implement the StatsOutputEnable control for the VC4 IPA. When set,\n> > > > this outputs the ISP statistics as a uint8_t span through the Bcm2835StatsOutput\n> > > > metadata control.\n> > > >\n> > > > To get this working, IpaBase::libcameraMetadata_ is moved from a private\n> > > > to a protected member variable. This makes it accessable to the VC4\n> > > > derived IPA class.\n> > > >\n> > > > Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n> > > > ---\n> > > >  src/ipa/rpi/common/ipa_base.cpp | 12 +++++++++---\n> > > >  src/ipa/rpi/common/ipa_base.h   |  3 ++-\n> > > >  src/ipa/rpi/vc4/vc4.cpp         |  6 ++++++\n> > > >  3 files changed, 17 insertions(+), 4 deletions(-)\n> > > >\n> > > > diff --git a/src/ipa/rpi/common/ipa_base.cpp b/src/ipa/rpi/common/ipa_base.cpp\n> > > > index 6ac9d5de2f88..c4d17a2130c8 100644\n> > > > --- a/src/ipa/rpi/common/ipa_base.cpp\n> > > > +++ b/src/ipa/rpi/common/ipa_base.cpp\n> > > > @@ -70,7 +70,8 @@ const ControlInfoMap::Map ipaControls{\n> > > >         { &controls::Sharpness, ControlInfo(0.0f, 16.0f, 1.0f) },\n> > > >         { &controls::ScalerCrop, ControlInfo(Rectangle{}, Rectangle(65535, 65535, 65535, 65535), Rectangle{}) },\n> > > >         { &controls::FrameDurationLimits, ControlInfo(INT64_C(33333), INT64_C(120000)) },\n> > > > -       { &controls::draft::NoiseReductionMode, ControlInfo(controls::draft::NoiseReductionModeValues) }\n> > > > +       { &controls::draft::NoiseReductionMode, ControlInfo(controls::draft::NoiseReductionModeValues) },\n> > > > +       { &controls::rpi::StatsOutputEnable, ControlInfo(false, true) },\n> > > >  };\n> > > >\n> > > >  /* IPA controls handled conditionally, if the sensor is not mono */\n> > > > @@ -100,8 +101,9 @@ LOG_DEFINE_CATEGORY(IPARPI)\n> > > >  namespace ipa::RPi {\n> > > >\n> > > >  IpaBase::IpaBase()\n> > > > -       : controller_(), frameLengths_(FrameLengthsQueueSize, 0s), frameCount_(0),\n> > > > -         mistrustCount_(0), lastRunTimestamp_(0), firstStart_(true), flickerState_({ 0, 0s })\n> > > > +       : controller_(), frameLengths_(FrameLengthsQueueSize, 0s), statsMetadataOutput_(false),\n> > > > +         frameCount_(0), mistrustCount_(0), lastRunTimestamp_(0), firstStart_(true),\n> > > > +         flickerState_({ 0, 0s })\n> > > >  {\n> > > >  }\n> > > >\n> > > > @@ -1135,6 +1137,10 @@ void IpaBase::applyControls(const ControlList &controls)\n> > > >                         break;\n> > > >                 }\n> > > >\n> > > > +               case controls::rpi::STATS_OUTPUT_ENABLE:\n> > > > +                       statsMetadataOutput_ = ctrl.second.get<bool>();\n> > > > +                       break;\n> > > > +\n> > > >                 default:\n> > > >                         LOG(IPARPI, Warning)\n> > > >                                 << \"Ctrl \" << controls::controls.at(ctrl.first)->name()\n> > > > diff --git a/src/ipa/rpi/common/ipa_base.h b/src/ipa/rpi/common/ipa_base.h\n> > > > index eaa9f71182ed..4db4411eed7c 100644\n> > > > --- a/src/ipa/rpi/common/ipa_base.h\n> > > > +++ b/src/ipa/rpi/common/ipa_base.h\n> > > > @@ -61,6 +61,8 @@ protected:\n> > > >         /* Track the frame length times over FrameLengthsQueueSize frames. */\n> > > >         std::deque<utils::Duration> frameLengths_;\n> > > >         utils::Duration lastTimeout_;\n> > > > +       ControlList libcameraMetadata_;\n> > > > +       bool statsMetadataOutput_;\n> > > >\n> > > >  private:\n> > > >         /* Number of metadata objects available in the context list. */\n> > > > @@ -89,7 +91,6 @@ private:\n> > > >\n> > > >         bool lensPresent_;\n> > > >         bool monoSensor_;\n> > > > -       ControlList libcameraMetadata_;\n> > > >\n> > > >         std::array<RPiController::Metadata, numMetadataContexts> rpiMetadata_;\n> > > >\n> > > > diff --git a/src/ipa/rpi/vc4/vc4.cpp b/src/ipa/rpi/vc4/vc4.cpp\n> > > > index c165a5b8b0b6..ccd4141943dd 100644\n> > > > --- a/src/ipa/rpi/vc4/vc4.cpp\n> > > > +++ b/src/ipa/rpi/vc4/vc4.cpp\n> > > > @@ -11,6 +11,7 @@\n> > > >  #include <linux/bcm2835-isp.h>\n> > > >\n> > > >  #include <libcamera/base/log.h>\n> > > > +#include <libcamera/base/span.h>\n> > > >  #include <libcamera/control_ids.h>\n> > > >  #include <libcamera/ipa/ipa_module_info.h>\n> > > >\n> > > > @@ -245,6 +246,11 @@ RPiController::StatisticsPtr IpaVc4::platformProcessStats(Span<uint8_t> mem)\n> > > >                                                   stats->focus_stats[i].contrast_val_num[1][1],\n> > > >                                                   stats->focus_stats[i].contrast_val_num[1][0] });\n> > > >\n> > > > +       if (statsMetadataOutput_) {\n> > > > +               Span<uint8_t> statsSpan((uint8_t *)(stats), sizeof(bcm2835_isp_stats));\n> > >\n> > > I thought folks preferred C++ style casts these days, but honestly...\n> > > I really don't care!!\n> > >\n> > > Reviewed-by: David Plowman <david.plowman@raspberrypi.com>\n> >\n> > Yes, any objection to changing this to the following?:\n> >\n> >                 Span<uint8_t> statsSpan(static_cast<uint8_t *>(stats),\n> >                                         sizeOf(bcm2835_isp_stats));\n> \n> No objections to doing that.\n\nOk - so actually doing this it looks like it needs:\n\n\n                Span<const uint8_t> statsSpan(reinterpret_cast<const uint8_t *>(stats),\n                                              sizeof(bcm2835_isp_stats));\n\n--\nKieran\n\n> \n> >\n> > And then:\n> >\n> >\n> > Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> \n> Thanks!\n> Naush\n> \n> >\n> > >\n> > > Thanks!\n> > > David\n> > >\n> > > > +               libcameraMetadata_.set(controls::rpi::Bcm2835StatsOutput, statsSpan);\n> > > > +       }\n> > > > +\n> > > >         return statistics;\n> > > >  }\n> > > >\n> > > > --\n> > > > 2.34.1\n> > > >","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id C33E4BDB1D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  9 Jan 2024 10:20:00 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 04F4D62B32;\n\tTue,  9 Jan 2024 11:20:00 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9108C61D72\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  9 Jan 2024 11:19:58 +0100 (CET)","from pendragon.ideasonboard.com\n\t(aztw-30-b2-v4wan-166917-cust845.vm26.cable.virginm.net\n\t[82.37.23.78])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 929BD922;\n\tTue,  9 Jan 2024 11:18:54 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1704795600;\n\tbh=9iXWO5Zfe3wP0qefCYo2kjIPJP/LVV2aZrXsL3O8q3M=;\n\th=In-Reply-To:References:To:Date:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=N87EJ0vz0vkVsuiuleMsCx4hoPpVGJ0Utj2Onq8+G18eetg2WiJYnfijU9iMKrJti\n\t8v6jkqeHAuPVYJlud1ob9PrKQaV5BLlu5wjejTaetRgZjC5HxyHfgASzleCPAlFJEM\n\t/8+RX18qZWwd7t0oTuut91xwOFtb2ABrPTVvaZfV0HG4pxdE0g2tmIkulBuCCudVI6\n\tZQ1XzY40QEM7nphKeNc4T0PGXxYddY4vZYy7KHMk4pakqN3JP/5VtoipKfoZBY5nKv\n\tpb027Zbf2e8+7I4UXfqX0liQIOvJXAIcMqjJJnI/m4gB25LFtZ2bMccex0JW2NUwTK\n\tZNyrZzKwZbfiQ==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1704795534;\n\tbh=9iXWO5Zfe3wP0qefCYo2kjIPJP/LVV2aZrXsL3O8q3M=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=C8uanLtpP9x40uvwMrgd00/0HahRASIO+rxFweWZtlvxIf2qQpNOo26YMk4auewRu\n\tHX+UmqlvnI8nUjoZJw0YxRqPm8v7K7B0/N93ARJQRWHXsXBSIj3F131Qn5m1wIieuX\n\tW8FD7+fwNFDui0Pdr5yC1/ljl+zWSYVy8totaKS0="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"C8uanLtp\"; dkim-atps=neutral","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<CAEmqJPqG_4VCTqo9E2XPy+7U5JJ2jGH9ioNzZSbAxre5c39KJA@mail.gmail.com>","References":"<20231204161901.6632-1-naush@raspberrypi.com>\n\t<20231204161901.6632-3-naush@raspberrypi.com>\n\t<CAHW6GYJo6Tua=c6PKvW1dDnT36tWko7Xa8kpy7CvK2OX26BL_Q@mail.gmail.com>\n\t<170473575258.3044059.4298954940959153319@ping.linuxembedded.co.uk>\n\t<CAEmqJPqG_4VCTqo9E2XPy+7U5JJ2jGH9ioNzZSbAxre5c39KJA@mail.gmail.com>","To":"Naushir Patuck <naush@raspberrypi.com>","Date":"Tue, 09 Jan 2024 10:19:55 +0000","Message-ID":"<170479559541.3044059.13916873122577264933@ping.linuxembedded.co.uk>","User-Agent":"alot/0.10","Subject":"Re: [libcamera-devel] [PATCH v1 2/2] ipa: vc4: Implement the\n\tStatsOutputEnable vendor control","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Kieran Bingham via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"David Plowman via libcamera-devel <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]