[{"id":29774,"web_url":"https://patchwork.libcamera.org/comment/29774/","msgid":"<171757785736.205609.8094611795995048955@ping.linuxembedded.co.uk>","date":"2024-06-05T08:57:37","subject":"Re: [PATCH] libcamera: libipa: camera_sensor: define AR0521 helper\n\tfunctions inline","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Laurent Pinchart (2024-06-03 23:48:55)\n> All CameraSensorHelper subclasses define their member functions inline,\n> except for the CameraSensorHelperAr0521 class. Inline the gainCode() and\n> gain() functions to match the other classes.\n> \n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> ---\n>  src/ipa/libipa/camera_sensor_helper.cpp | 36 +++++++++++--------------\n>  1 file changed, 16 insertions(+), 20 deletions(-)\n> \n> diff --git a/src/ipa/libipa/camera_sensor_helper.cpp b/src/ipa/libipa/camera_sensor_helper.cpp\n> index 2cd61fccfbb9..782ff9904e81 100644\n> --- a/src/ipa/libipa/camera_sensor_helper.cpp\n> +++ b/src/ipa/libipa/camera_sensor_helper.cpp\n> @@ -369,30 +369,26 @@ static constexpr double expGainDb(double step)\n>  class CameraSensorHelperAr0521 : public CameraSensorHelper\n>  {\n>  public:\n> -       uint32_t gainCode(double gain) const override;\n> -       double gain(uint32_t gainCode) const override;\n> +       uint32_t gainCode(double gain) const override\n> +       {\n> +               gain = std::clamp(gain, 1.0, 15.5);\n> +               unsigned int coarse = std::log2(gain);\n> +               unsigned int fine = (gain / (1 << coarse) - 1) * kStep_;\n> +\n> +               return (coarse << 4) | (fine & 0xf);\n> +       }\n> +\n> +       double gain(uint32_t gainCode) const override\n> +       {\n> +               unsigned int coarse = gainCode >> 4;\n> +               unsigned int fine = gainCode & 0xf;\n> +\n> +               return (1 << coarse) * (1 + fine / kStep_);\n> +       }\n>  \n>  private:\n>         static constexpr double kStep_ = 16;\n>  };\n> -\n> -uint32_t CameraSensorHelperAr0521::gainCode(double gain) const\n> -{\n> -       gain = std::clamp(gain, 1.0, 15.5);\n> -       unsigned int coarse = std::log2(gain);\n> -       unsigned int fine = (gain / (1 << coarse) - 1) * kStep_;\n> -\n> -       return (coarse << 4) | (fine & 0xf);\n> -}\n> -\n> -double CameraSensorHelperAr0521::gain(uint32_t gainCode) const\n> -{\n> -       unsigned int coarse = gainCode >> 4;\n> -       unsigned int fine = gainCode & 0xf;\n> -\n> -       return (1 << coarse) * (1 + fine / kStep_);\n> -}\n> -\n>  REGISTER_CAMERA_SENSOR_HELPER(\"ar0521\", CameraSensorHelperAr0521)\n>  \n>  class CameraSensorHelperImx219 : public CameraSensorHelper\n> \n> base-commit: 6cd17515ffeb67fb38ffcc4d57aadf9732b54800\n> -- \n> Regards,\n> \n> Laurent Pinchart\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 0CC12BD87C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  5 Jun 2024 08:57:43 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 30B4F6543A;\n\tWed,  5 Jun 2024 10:57:42 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 82148634B5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  5 Jun 2024 10:57:40 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 19329EA2;\n\tWed,  5 Jun 2024 10:57:32 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"bhBkdE0M\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1717577852;\n\tbh=mz/BKTsONEzAInE4VVm7Sim8UtBsUwy8mWXkN0ibr2s=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=bhBkdE0MHE3WZ+3ZX9Ecdsi+CtjU7OO+SF1S1ACHGLCbU14e+WUaQ4vOMFZKOe71G\n\txDtzQIoyhqh9lg1JccrkmpcbCoIylWJu6fj3ndbKDIPo4ZcCpfR1zt+pDmwCRcuDXd\n\tLLGLzGR/c+4r9q61DYT0RHGRrBVLBb/0QF2L6ZOI=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20240603224855.25011-1-laurent.pinchart@ideasonboard.com>","References":"<20240603224855.25011-1-laurent.pinchart@ideasonboard.com>","Subject":"Re: [PATCH] libcamera: libipa: camera_sensor: define AR0521 helper\n\tfunctions inline","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Wed, 05 Jun 2024 09:57:37 +0100","Message-ID":"<171757785736.205609.8094611795995048955@ping.linuxembedded.co.uk>","User-Agent":"alot/0.10","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]