{"id":17548,"url":"https://patchwork.libcamera.org/api/1.1/patches/17548/?format=json","web_url":"https://patchwork.libcamera.org/patch/17548/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/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":"<20221006131744.5179-8-naush@raspberrypi.com>","date":"2022-10-06T13:17:41","name":"[libcamera-devel,v2,07/10] ipa: raspberrypi: Add line length calculations helper functions","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"da7f48a6dd24fe69675cd6c3f1515114b60e6561","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/1.1/people/34/?format=json","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/17548/mbox/","series":[{"id":3537,"url":"https://patchwork.libcamera.org/api/1.1/series/3537/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3537","date":"2022-10-06T13:17:34","name":"Raspberry Pi: Horizontal blanking control","version":2,"mbox":"https://patchwork.libcamera.org/series/3537/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/17548/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/17548/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 EBDA2C3286\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  6 Oct 2022 13:18:02 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8751B62D19;\n\tThu,  6 Oct 2022 15:18:02 +0200 (CEST)","from mail-wm1-x334.google.com (mail-wm1-x334.google.com\n\t[IPv6:2a00:1450:4864:20::334])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id ABF5162CFE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  6 Oct 2022 15:17:59 +0200 (CEST)","by mail-wm1-x334.google.com with SMTP id ay36so1036626wmb.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 06 Oct 2022 06:17:59 -0700 (PDT)","from naush-laptop.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\tq18-20020a056000137200b0022cc7c32309sm17986049wrz.115.2022.10.06.06.17.58\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 06 Oct 2022 06:17:58 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1665062282;\n\tbh=oIfN2bhrPLhi8sqa1hMKCz/V8u/e6tzLk1rhkG5IU8A=;\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=NilKDrt8PzOgewSn25n9Z94x8UyyrYDI+pUfUpGYyE1Ti2BsdHXL+0RviRGuIfkME\n\tLLcrGcUvt6/SGMIlGBPzfs4noth+8JYoLEkj3QpJQz5WkViSJUFupWAf9ljvJsFl4M\n\tRZkAfLKLJKEmFBps9iFXdkZEME6ocivv6bam1rsCiKmk7cQ79TINOFQ2dD/pL/m4o1\n\tItspwwwMJyTs/2RHpyO5hUCQvnC+gGbbRoChV5EqVKimUzdpihes+F5MeKaaCnAUaV\n\tjHPfIrckwo0WR7c0IiJiJElF8jW5/esv1WEmk0HU1JG1aGrR3CuvKb/MDyTz0Ftzhw\n\tUZ2z9eL9srR3w==","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=0Gqu8R6R2OicBQ0UOmq1eJlfI5JuYCILNc7IuRsY9DU=;\n\tb=qSEQP85D9R08Pc9h7eXgjuwRWW4NEpyKtjOP0NkdbrNi/3JUtSKZvQ4W1FEq2LUy7k\n\tdHd5ggvslsLq+yf3OK8FAEYFqWIRcOGouQoWIkG8JTqYJFoVwmLc+40DSunAVhAtp03u\n\tmdBePH89NxpKHVqFJdYkzkacZPK+HGfcmyRG6t166s6OMo1odszbjtbwZJk7N3lJL9H0\n\tp4YwFyMHyleK4X7rXBMDi8ssxVg1J7LbUvSUpuT/uulvKb7wODKscjmorMV2bKEzHSf9\n\thEPWJoCCO9OGjdcpON+7WZdGN2gN7USQEw2yLR0IPI/q0aWhS3hTU2D7J6IuGsQ2ksmK\n\tGe4Q=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"qSEQP85D\"; 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=0Gqu8R6R2OicBQ0UOmq1eJlfI5JuYCILNc7IuRsY9DU=;\n\tb=Eer5X9Um0S2F1aQcTvLaFCiVJRJ218dVKe6ex6QWVQ57NT2G9Mc7rEob65kPb/g30j\n\tWyhLmixP7HiU/mJ37s6mWfipbNNzcOzFv4Z9TImtZiWzusD5K99boGHj9C2FOlAVg9+Q\n\t9WX9QIU/qkKsp6b5sTFVA7TpArp39Mnc+7NzEduvThJBZWDn3GhUCVppkc0h9u27jS+h\n\t1TDbwsCGknri69zmsi2Hk2j/QDHBjRBOfOodxY/WY1HgKG1sH3YrSIMaPJF3w3Md0Ih4\n\tbBdIV7FHzkJ41yr0WVlV0IwrQf55SKRSYBc1boLTCQeSLVOxHTtkr2T2EHF4y3cFsCzE\n\t3V1g==","X-Gm-Message-State":"ACrzQf0lH/m+7Fkf7fVcZS8wFtPVxrErGDXM6s23DbxfW1v/u5T2iUH7\n\tpyo0ojHM1HHhR15CwmBm+L5qDxh6vYJcig==","X-Google-Smtp-Source":"AMsMyM6FNtWm2EmWPbKqs1q0SSGP+qneP6mxBf/7CzIB+AfT72MvyhzXYmNckUxcJ3OXmZhLHTky4Q==","X-Received":"by 2002:a05:600c:4109:b0:3c1:b50e:b5ea with SMTP id\n\tj9-20020a05600c410900b003c1b50eb5eamr2216117wmi.71.1665062279154; \n\tThu, 06 Oct 2022 06:17:59 -0700 (PDT)","To":"libcamera-devel@lists.libcamera.org","Date":"Thu,  6 Oct 2022 14:17:41 +0100","Message-Id":"<20221006131744.5179-8-naush@raspberrypi.com>","X-Mailer":"git-send-email 2.25.1","In-Reply-To":"<20221006131744.5179-1-naush@raspberrypi.com>","References":"<20221006131744.5179-1-naush@raspberrypi.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v2 07/10] ipa: raspberrypi: Add line\n\tlength calculations 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>\nTested-by: Dave Stevenson <dave.stevenson@raspberrypi.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.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 dd7236f1b693..bc3f66a51254 100644\n--- a/src/ipa/raspberrypi/cam_helper.cpp\n+++ b/src/ipa/raspberrypi/cam_helper.cpp\n@@ -18,6 +18,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@@ -96,6 +97,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 lineLengthPck * (1.0s / mode_.pixelRate);\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 db2387afc993..6cd1dd397b91 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","v2","07/10"]}