[{"id":10890,"web_url":"https://patchwork.libcamera.org/comment/10890/","msgid":"<CAHW6GYJoNDNnx5r+fZ1y=SYgQwVQ=jh80aEV9q0VdPurcKCwhQ@mail.gmail.com>","date":"2020-06-26T12:37:16","subject":"Re: [libcamera-devel] [PATCH 4/4] libcamera: ipa: raspberrypi:\n\tPopulate focus FoM from the ISP statistics","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 change. It looks good to me, I think you're right to average\nthe two middle zones. Though I'm sure the clamour to make them\nadjustable will follow at some point...!\n\nReviewed-by: David Plowman <david.plowman@raspberrypi.com>\n\nBest regards\nDavid\n\nOn Fri, 26 Jun 2020 at 11:25, Naushir Patuck <naush@raspberrypi.com> wrote:\n>\n> Switch FocusStatus::num to unsigned int for convenience.\n>\n> Fill in libcamera::controls::FocusFoM with the average of the middle two\n> regions (across a 4x3 grid) FoM statistics from the ISP.\n>\n> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n> ---\n>  src/ipa/raspberrypi/controller/focus_status.h |  2 +-\n>  src/ipa/raspberrypi/raspberrypi.cpp           | 12 ++++++++++++\n>  2 files changed, 13 insertions(+), 1 deletion(-)\n>\n> diff --git a/src/ipa/raspberrypi/controller/focus_status.h b/src/ipa/raspberrypi/controller/focus_status.h\n> index 3ad88777..ace2fe2c 100644\n> --- a/src/ipa/raspberrypi/controller/focus_status.h\n> +++ b/src/ipa/raspberrypi/controller/focus_status.h\n> @@ -17,7 +17,7 @@ extern \"C\" {\n>  #endif\n>\n>  struct FocusStatus {\n> -       int num;\n> +       unsigned int num;\n>         uint32_t focus_measures[FOCUS_REGIONS];\n>  };\n>\n> diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp\n> index 62730198..b1f27861 100644\n> --- a/src/ipa/raspberrypi/raspberrypi.cpp\n> +++ b/src/ipa/raspberrypi/raspberrypi.cpp\n> @@ -42,6 +42,7 @@\n>  #include \"contrast_status.h\"\n>  #include \"controller.hpp\"\n>  #include \"dpc_status.h\"\n> +#include \"focus_status.h\"\n>  #include \"geq_status.h\"\n>  #include \"lux_status.h\"\n>  #include \"metadata.hpp\"\n> @@ -405,6 +406,17 @@ void IPARPi::reportMetadata()\n>                                          static_cast<int32_t>(blackLevelStatus->black_level_g),\n>                                          static_cast<int32_t>(blackLevelStatus->black_level_g),\n>                                          static_cast<int32_t>(blackLevelStatus->black_level_b) });\n> +\n> +       FocusStatus *focusStatus = rpiMetadata_.GetLocked<FocusStatus>(\"focus.status\");\n> +       if (focusStatus && focusStatus->num == 12) {\n> +               /*\n> +                * We get a 4x3 grid of regions by default. Calculate the average\n> +                * FoM over the central two positions to give an overall scene FoM.\n> +                * This can change later if it is not deemed suitable.\n> +                */\n> +               int32_t focusFoM = (focusStatus->focus_measures[5] + focusStatus->focus_measures[6]) / 2;\n> +               libcameraMetadata_.set(controls::FocusFoM, focusFoM);\n> +       }\n>  }\n>\n>  /*\n> --\n> 2.25.1\n>\n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","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 D6B57C2E66\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 26 Jun 2020 12:37:30 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 49757609D6;\n\tFri, 26 Jun 2020 14:37:30 +0200 (CEST)","from mail-ot1-x343.google.com (mail-ot1-x343.google.com\n\t[IPv6:2607:f8b0:4864:20::343])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 83596609C3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 26 Jun 2020 14:37:28 +0200 (CEST)","by mail-ot1-x343.google.com with SMTP id w17so582536otl.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 26 Jun 2020 05:37:28 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"Le6/yUGr\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=mime-version:references:in-reply-to:from:date:message-id:subject:to\n\t:cc; bh=P8PKGepg2d+agrUVvd5N/Wgnsi1kfsXi8hdS1fiXaqU=;\n\tb=Le6/yUGr9YyMn68T3RjKjIADUHUslmuMQD1rmN5UXt1Rtk5Gk2MEKjEYRWcFJ/h1si\n\tWlrRaPpgKQzP2d7BMFUKisGB4LKXVUbs/qosv/Q7eeILOSsKsdCVm6aSpGysmVXGWHoA\n\tk9PqxyEy3GwFwAcqxm/9GDljareHd3zzv5G4rgvL4OfXTWEs8NkJyAppmGttYMiAyhh4\n\tEEGxwIPE60kVuOUMewqAveZ6A312sg+NRB78SMbKe1v8g84EKRAxQg5ROB8hBOImokOg\n\tupt9n1BsSIvBpFvALTEFSEQf6F+lFjoJ0uXLvQMx+MALALlzCq9OBJWRK7Xc4b5le6So\n\tI1lw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc;\n\tbh=P8PKGepg2d+agrUVvd5N/Wgnsi1kfsXi8hdS1fiXaqU=;\n\tb=swHjlt8/O8Kit0a2H2TIGD+VIL5ezN/CnrLvDpDdAOtTEHaeMjF4rHfcEBr+LzLCkW\n\t6CCpEbXwLv1p3ZI5ptrO8kaMH3dkXIuQ8Nc2g4D5Npwe3bt217R4RT+LSQND7HNrnTSQ\n\ty8kxfpa8MadjdxOvMbnN8I33BZWa1vps87Od74DtyQmW5uStr86R+gWQrcI0hv81gav8\n\t810qiDBKnJjIwkEHw7dK1unSB9R1i50eXBMhAUkTUaAzMKCDf3PiIUO6yIy2XlnrDnlf\n\tFiSBzgMBIiE1+44hgKk7jJascyDUXpx8L9YIMwlG3J4yTSXJv3SXz9CcBkl/qSKlpUhs\n\tBQ+g==","X-Gm-Message-State":"AOAM532fWfh/FyYcpjM7nh95EF8hRP1g7dyPKtbYDu5X/YpGy62BhuBv\n\tyRS0AujEUQk7t19b1RHPvFgNe6A5HWtk96b/Q7juVblWpwc=","X-Google-Smtp-Source":"ABdhPJwoMzMpBIRM3n4HI3hzC2szCwnH2A4CyCj74DJqsYasQTy54U6jesORxuC7hwtPxe94vRyVljOJebnNyGWffqU=","X-Received":"by 2002:a9d:6b19:: with SMTP id\n\tg25mr2285520otp.160.1593175047324; \n\tFri, 26 Jun 2020 05:37:27 -0700 (PDT)","MIME-Version":"1.0","References":"<20200626102531.1187650-1-naush@raspberrypi.com>\n\t<20200626102531.1187650-5-naush@raspberrypi.com>","In-Reply-To":"<20200626102531.1187650-5-naush@raspberrypi.com>","From":"David Plowman <david.plowman@raspberrypi.com>","Date":"Fri, 26 Jun 2020 13:37:16 +0100","Message-ID":"<CAHW6GYJoNDNnx5r+fZ1y=SYgQwVQ=jh80aEV9q0VdPurcKCwhQ@mail.gmail.com>","To":"Naushir Patuck <naush@raspberrypi.com>","Subject":"Re: [libcamera-devel] [PATCH 4/4] libcamera: ipa: raspberrypi:\n\tPopulate focus FoM from the ISP statistics","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>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":11110,"web_url":"https://patchwork.libcamera.org/comment/11110/","msgid":"<20200703010645.GL12562@pendragon.ideasonboard.com>","date":"2020-07-03T01:06:45","subject":"Re: [libcamera-devel] [PATCH 4/4] libcamera: ipa: raspberrypi:\n\tPopulate focus FoM from the ISP statistics","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Naush,\n\nThank you for the patch.\n\nOn Fri, Jun 26, 2020 at 11:25:31AM +0100, Naushir Patuck wrote:\n> Switch FocusStatus::num to unsigned int for convenience.\n> \n> Fill in libcamera::controls::FocusFoM with the average of the middle two\n> regions (across a 4x3 grid) FoM statistics from the ISP.\n> \n> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n\nChanges may be needed depending on the outcome of of the discussion on\n1/4, but otherwise,\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> ---\n>  src/ipa/raspberrypi/controller/focus_status.h |  2 +-\n>  src/ipa/raspberrypi/raspberrypi.cpp           | 12 ++++++++++++\n>  2 files changed, 13 insertions(+), 1 deletion(-)\n> \n> diff --git a/src/ipa/raspberrypi/controller/focus_status.h b/src/ipa/raspberrypi/controller/focus_status.h\n> index 3ad88777..ace2fe2c 100644\n> --- a/src/ipa/raspberrypi/controller/focus_status.h\n> +++ b/src/ipa/raspberrypi/controller/focus_status.h\n> @@ -17,7 +17,7 @@ extern \"C\" {\n>  #endif\n>  \n>  struct FocusStatus {\n> -\tint num;\n> +\tunsigned int num;\n>  \tuint32_t focus_measures[FOCUS_REGIONS];\n>  };\n>  \n> diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp\n> index 62730198..b1f27861 100644\n> --- a/src/ipa/raspberrypi/raspberrypi.cpp\n> +++ b/src/ipa/raspberrypi/raspberrypi.cpp\n> @@ -42,6 +42,7 @@\n>  #include \"contrast_status.h\"\n>  #include \"controller.hpp\"\n>  #include \"dpc_status.h\"\n> +#include \"focus_status.h\"\n>  #include \"geq_status.h\"\n>  #include \"lux_status.h\"\n>  #include \"metadata.hpp\"\n> @@ -405,6 +406,17 @@ void IPARPi::reportMetadata()\n>  \t\t\t\t\t static_cast<int32_t>(blackLevelStatus->black_level_g),\n>  \t\t\t\t\t static_cast<int32_t>(blackLevelStatus->black_level_g),\n>  \t\t\t\t\t static_cast<int32_t>(blackLevelStatus->black_level_b) });\n> +\n> +\tFocusStatus *focusStatus = rpiMetadata_.GetLocked<FocusStatus>(\"focus.status\");\n> +\tif (focusStatus && focusStatus->num == 12) {\n> +\t\t/*\n> +\t\t * We get a 4x3 grid of regions by default. Calculate the average\n> +\t\t * FoM over the central two positions to give an overall scene FoM.\n> +\t\t * This can change later if it is not deemed suitable.\n> +\t\t */\n> +\t\tint32_t focusFoM = (focusStatus->focus_measures[5] + focusStatus->focus_measures[6]) / 2;\n> +\t\tlibcameraMetadata_.set(controls::FocusFoM, focusFoM);\n> +\t}\n>  }\n>  \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 92BEBBE905\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  3 Jul 2020 01:06:53 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1FD47609C7;\n\tFri,  3 Jul 2020 03:06:53 +0200 (CEST)","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 C8FA0603B3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  3 Jul 2020 03:06:51 +0200 (CEST)","from pendragon.ideasonboard.com (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id E2B9531F;\n\tFri,  3 Jul 2020 03:06:50 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"tFf6HWY/\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1593738411;\n\tbh=nPF3d3hrDgt2xE5N3aonrmjvC+BlkGpz5DCElS54g+Q=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=tFf6HWY/aD60BLTQlXnB2yNqtMeieRkt8J1vI11B80ghfsf3mAER3PgYNi3P4jpVo\n\tG6AfIadSfCUCB1JTpy5BhifDm7sj5dmn7Vvi5gdL6EU4ALRKwLBO6jFnspUHgZFA5H\n\t0HpO/KYLvpVOvAPzUYYh/ZpZEABIB8agccs1yV4c=","Date":"Fri, 3 Jul 2020 04:06:45 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Naushir Patuck <naush@raspberrypi.com>","Message-ID":"<20200703010645.GL12562@pendragon.ideasonboard.com>","References":"<20200626102531.1187650-1-naush@raspberrypi.com>\n\t<20200626102531.1187650-5-naush@raspberrypi.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20200626102531.1187650-5-naush@raspberrypi.com>","Subject":"Re: [libcamera-devel] [PATCH 4/4] libcamera: ipa: raspberrypi:\n\tPopulate focus FoM from the ISP statistics","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>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]