{"id":17494,"url":"https://patchwork.libcamera.org/api/patches/17494/?format=json","web_url":"https://patchwork.libcamera.org/patch/17494/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20221003083934.31629-8-naush@raspberrypi.com>","date":"2022-10-03T08:39:33","name":"[libcamera-devel,v1,7/9] ipa: raspberrypi: Add line length calculations helper functions","commit_ref":null,"pull_url":null,"state":"changes-requested","archived":false,"hash":"fefa8b5512f48aa0d1dbcdd942f7ee09fc2da1e4","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/people/34/?format=json","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/17494/mbox/","series":[{"id":3523,"url":"https://patchwork.libcamera.org/api/series/3523/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3523","date":"2022-10-03T08:39:26","name":"Raspberry Pi: Horizontal blanking control","version":1,"mbox":"https://patchwork.libcamera.org/series/3523/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/17494/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/17494/checks/","tags":{},"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 225A5C3285\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  3 Oct 2022 08:40:09 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id AF60D62CEC;\n\tMon,  3 Oct 2022 10:40:08 +0200 (CEST)","from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com\n\t[IPv6:2a00:1450:4864:20::32c])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DC16D62CE3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  3 Oct 2022 10:40:02 +0200 (CEST)","by mail-wm1-x32c.google.com with SMTP id\n\t130-20020a1c0288000000b003b494ffc00bso8065064wmc.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 03 Oct 2022 01:40:02 -0700 (PDT)","from naush-laptop.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\ti13-20020a5d55cd000000b0022ae59d472esm8922787wrw.112.2022.10.03.01.40.01\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 03 Oct 2022 01:40:01 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1664786408;\n\tbh=t1UCF8Q7mQ1fCcwA8Uu0vQ+Qnx4V99ck8EbaIkOuaX0=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=baJPatHHfPA3TJSBM52IRMm8msjX0geFrNUUX5L8DN/qL/7cOnaPFPhvIXonmQRfb\n\tf7mBWqMmHWmBZsVT+2UMcMSPiJ3VNYHqBFJnFXY2F7OymljbzMEj7uX0G9RoxXMKEx\n\tGfc7oEPBxGMzHMiiuhFJrY0RnH2KoiYjNf4LxRt/6ti71/R4eXMuMtC58MoGv/Vh0C\n\tOXfYNiFdvS85NrW0NMm7y6BjPhTRTrg2g+gOPEEHN0wnCvaPpaOkr/e45z2srf5PuC\n\ts43xo63JxAPGxzw4AbhOInmNZbwoQUkvL7kAyUNRfWldGlhuKxO+aKJ+0X44WJ3XKV\n\tDHaSletA6/PiA==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date;\n\tbh=PVBXrAWjZI0UrO8LOKOH/Cj3AAKHluADuH/8z3r3jUc=;\n\tb=SMjEMFm/C0aAIIwbEdIZlFb6L9ESxkegbgi3/BH4+KSRZVIAQ9AKdB9pf716LJhRdn\n\teZ06fsWby1mojT79EyUbyzylZyF2DuPDL5y42W4ABQlbiTgSDHfENWtBU832qpW/Rfsi\n\tZ17IGr2Kwm+BdwUi7Ht0MWc1ywDJB8Uk0LRKFO3Tlee8oN5E7zy1DAdxZb20aYAwm5ty\n\tJxKRrBsMZRNRSmSwXVU9e/GyRPfabp3yPc7A/rtkSCq0rxHmiJKuhp2Pi0rkKvMt7DgF\n\to/7OXPtzZytJ3wD2B324da3FlDvhsbQozwUtujR+u1MjuvtMhSMTw/6cAoow2a7DkJKP\n\tC1pQ=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"SMjEMFm/\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date;\n\tbh=PVBXrAWjZI0UrO8LOKOH/Cj3AAKHluADuH/8z3r3jUc=;\n\tb=rcMvUb674JHJupsN/8xIAlRJL6D/4o/LB25njg86NydJc7VgKHSucdu+7/LQOMJY91\n\tuTKoqz8l4rNZHM+MJqwl/1KrlQUaELZ6B0HRSzlohInEOQ55eio9wyE6TuY6B9KuHtBg\n\tjhfdRIhCNNnwrZVUgL2JopCvsg7CFgHb4Z625unzmm6iTSx6b4MlXDad+aEiJLa0mvhm\n\t3yCoXEP6TsKPlX3ADxFhf6ZShUHQB7aDVl0p3LouQFNb0ve7lRNOVGZchJMeRfYdaa37\n\t+orEtDZ9TgQjIRwWI4+ipEXr52oEum5s44JZh8s1eoWT7x+dKUM2oCD003ETbmBEs/36\n\tvEjA==","X-Gm-Message-State":"ACrzQf3mIwmJt/UExxdyzEFjSBDpyNkrdrKHtU39Vuw9zISvGgOWoN5S\n\t31ZdhznqkcDSG0Zt2nsakoFe4xRlYJQVwg==","X-Google-Smtp-Source":"AMsMyM52tu5sNhzRPwgS6BPagflG9Qm5SqiPVngp+X8ZEXBLyqpJgbcXwC3Cg4zvZlRU4TTQaRc+rg==","X-Received":"by 2002:a7b:c417:0:b0:3b4:5c94:24c1 with SMTP id\n\tk23-20020a7bc417000000b003b45c9424c1mr6049361wmi.86.1664786402189; \n\tMon, 03 Oct 2022 01:40:02 -0700 (PDT)","To":"libcamera-devel@lists.libcamera.org","Date":"Mon,  3 Oct 2022 09:39:33 +0100","Message-Id":"<20221003083934.31629-8-naush@raspberrypi.com>","X-Mailer":"git-send-email 2.25.1","In-Reply-To":"<20221003083934.31629-1-naush@raspberrypi.com>","References":"<20221003083934.31629-1-naush@raspberrypi.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v1 7/9] ipa: raspberrypi: Add line length\n\tcalculations helper functions","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Add CamHelper::hblankToLineLength() to calculate the line length duration\nfrom the horizontal blanking (in pixels) value.\n\nAdd CamHelper::LineLengthToHblank() to calculate the horizontal blanking (in\npixels) value from the line length duration.\n\nAdd CamHelper::lineLengthPckToDuration() to calculate the line length duration\nfrom the line length in pixels.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\n---\n src/ipa/raspberrypi/cam_helper.cpp | 16 ++++++++++++++++\n src/ipa/raspberrypi/cam_helper.h   |  3 +++\n 2 files changed, 19 insertions(+)","diff":"diff --git a/src/ipa/raspberrypi/cam_helper.cpp b/src/ipa/raspberrypi/cam_helper.cpp\nindex 916632f83037..c255ab0cb53f 100644\n--- a/src/ipa/raspberrypi/cam_helper.cpp\n+++ b/src/ipa/raspberrypi/cam_helper.cpp\n@@ -19,6 +19,7 @@\n using namespace RPiController;\n using namespace libcamera;\n using libcamera::utils::Duration;\n+using namespace std::literals::chrono_literals;\n \n namespace libcamera {\n LOG_DECLARE_CATEGORY(IPARPI)\n@@ -102,6 +103,21 @@ uint32_t CamHelper::getVBlanking(Duration &exposure,\n \treturn vblank;\n }\n \n+Duration CamHelper::hblankToLineLength(uint32_t hblank) const\n+{\n+\treturn (mode_.width + hblank) * (1.0s / mode_.pixelRate);\n+}\n+\n+uint32_t CamHelper::lineLengthToHblank(const Duration &lineLength) const\n+{\n+\treturn (lineLength * mode_.pixelRate / 1.0s) - mode_.width;\n+}\n+\n+Duration CamHelper::lineLengthPckToDuration(uint32_t lineLengthPck) const\n+{\n+\treturn hblankToLineLength(lineLengthPck - mode_.width);\n+}\n+\n void CamHelper::setCameraMode(const CameraMode &mode)\n {\n \tmode_ = mode;\ndiff --git a/src/ipa/raspberrypi/cam_helper.h b/src/ipa/raspberrypi/cam_helper.h\nindex 1bbdd715d2b1..b5c0726ff00e 100644\n--- a/src/ipa/raspberrypi/cam_helper.h\n+++ b/src/ipa/raspberrypi/cam_helper.h\n@@ -85,6 +85,9 @@ public:\n \tvirtual uint32_t getVBlanking(libcamera::utils::Duration &exposure,\n \t\t\t\t      libcamera::utils::Duration minFrameDuration,\n \t\t\t\t      libcamera::utils::Duration maxFrameDuration) const;\n+\tlibcamera::utils::Duration hblankToLineLength(uint32_t hblank) const;\n+\tuint32_t lineLengthToHblank(const libcamera::utils::Duration &duration) const;\n+\tlibcamera::utils::Duration lineLengthPckToDuration(uint32_t lineLengthPck) const;\n \tvirtual uint32_t gainCode(double gain) const = 0;\n \tvirtual double gain(uint32_t gainCode) const = 0;\n \tvirtual void getDelays(int &exposureDelay, int &gainDelay,\n","prefixes":["libcamera-devel","v1","7/9"]}