From patchwork Mon Sep 26 09:36:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 17396 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 03761C0DA4 for ; Mon, 26 Sep 2022 09:36:43 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id AC3596224E; Mon, 26 Sep 2022 11:36:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1664185003; bh=MZgm/27T1rqyPNYqZ9WDFMbHjkEHIHNE3GGHD19laTg=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=m9a45oVhvr7scNK4apwtmpkS3FIJPxniszcTye2dzJh6N0oxWbnxkZQOphrzaCL9y hX4Iox6vkXOGyOWMpDARcdCXyLh1WY3YCQg9kEjNb83FPROD2ouK7U8mPiL16aMjqd RbgEqENE5f1+ptcUlr/flbG9haNWmvzLXnwMxtUjOP3mHm6UEjXEt5aCt2gdS+sYuY YWvJ0ingeVzMwbfmzjVPeU/32I6cIRV8H2fMLtysmm9hlT2ua6w1EJNcUWj59yzA4/ 0eFAqEriohfyENQyVi2SpWhaAvQuzckpaa9escBzTmO8xb/zDMNz4loTW8jI6wZw1P wcLuUiOgQMuUA== Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id B26D061F7C for ; Mon, 26 Sep 2022 11:36:42 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="QEzgyTPn"; dkim-atps=neutral Received: by mail-wr1-x429.google.com with SMTP id s14so9356512wro.0 for ; Mon, 26 Sep 2022 02:36:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date; bh=6Neb+A802aTfBC8/5BcN3yy+EzBUfPtueeijCiSaKnk=; b=QEzgyTPn27YqNsoLi27gSzlqEZJYZyE6KV0+cSrW1mQ6o5gWNlu75LijBl4SPPnPJl XPotrS33vAgloPzzOX0z399c8sjT2/JTok69JK8UB+JfdbdD0kNg/ugztwFdVET4OKvJ avCqZorWFUP+Cof3soVsrpid4AxzEgZ0VAeLtMiJesYKsySxw2v+Q+sai1Qm1xhYWLU3 I8bXwfCRQ+KC75HJGq/sgQ5MbE1fR74NjWurMeCPOcet1m+e9IRyRyq/BMO4pQ/5apJC 5jlmk3ZaafS43qpfScjHcTvrX7TGb5j7AQ6yBowOLwBK14+0ZYrimNRoYTQH+oSEiF/p qa7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date; bh=6Neb+A802aTfBC8/5BcN3yy+EzBUfPtueeijCiSaKnk=; b=Djrqv/3M+T2CzkXqFdX4e2Wq0q7XaD6UfigXL6W3zJcPFOq+Gm5CgIG3lsSos9SNsJ z3HiJhy4WeQVQfovHqfsyWAKlBy794ZlxD8BCzn84RW2fMv/HTdHXAw1edHzAXNlpMRM eYRXJxBkEo9bPH2fZu1eH6MnIfzZATnsJVFSKCFfXG+C9+uYWtk+chTaL6+BXuwd3EXI G4gkWdGXMxyGrsvNYUpK42dnaYpbqepxThRFsQHqwPqYP1vNpIiTV9Vx1zztVm5lOPZn CYeBYvCq7L0Gp4TramkhbK5g2Wy43hR6ntiCn1RTtoTfplBuQEUL8GnRI3/qTeuknTx9 jPnA== X-Gm-Message-State: ACrzQf0mN5UEksArK14LdFB77ze5zXnXGe/AGnN3fPI1AvXSHf/wSMrB r0495aHXoKOvZK6lFvQXnW2YdICYP97f7X1a X-Google-Smtp-Source: AMsMyM64P/qNbhwjZgV2TBAC20vQHNEteGmEYSXonCln+ev95rr773adkd7RYXDYq6XQilHR0OR4gQ== X-Received: by 2002:adf:fa12:0:b0:228:62a8:7c79 with SMTP id m18-20020adffa12000000b0022862a87c79mr12429470wrr.231.1664185002212; Mon, 26 Sep 2022 02:36:42 -0700 (PDT) Received: from naush-laptop.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id c8-20020a5d4148000000b0022af865810esm14110705wrq.75.2022.09.26.02.36.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Sep 2022 02:36:41 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Mon, 26 Sep 2022 10:36:39 +0100 Message-Id: <20220926093639.29946-1-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] ipa: raspberrypi: Limit minimum exposure time for the IMX296 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Naushir Patuck via libcamera-devel From: Naushir Patuck Reply-To: Naushir Patuck Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Limit the minimum allowable exposure time to a single line in the IMX296 camera helper. This equates to approximately 30us. Signed-off-by: Naushir Patuck Reviewed-by: Jacopo Mondi Reviewed-by: David Plowman --- src/ipa/raspberrypi/cam_helper_imx296.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ipa/raspberrypi/cam_helper_imx296.cpp b/src/ipa/raspberrypi/cam_helper_imx296.cpp index 09f828ea6249..66d21e36ecd0 100644 --- a/src/ipa/raspberrypi/cam_helper_imx296.cpp +++ b/src/ipa/raspberrypi/cam_helper_imx296.cpp @@ -26,6 +26,7 @@ public: void getDelays(int &exposureDelay, int &gainDelay, int &vblankDelay) const override; private: + static constexpr uint32_t minExposureLines = 1; static constexpr uint32_t maxGainCode = 239; static constexpr Duration timePerLine = 550.0 / 37.125e6 * 1.0s; @@ -54,12 +55,12 @@ double CamHelperImx296::gain(uint32_t gainCode) const uint32_t CamHelperImx296::exposureLines(Duration exposure) const { - return (exposure - 14.26us) / timePerLine; + return std::max(minExposureLines, (exposure - 14.26us) / timePerLine); } Duration CamHelperImx296::exposure(uint32_t exposureLines) const { - return exposureLines * timePerLine + 14.26us; + return std::max(minExposureLines, exposureLines) * timePerLine + 14.26us; } void CamHelperImx296::getDelays(int &exposureDelay, int &gainDelay,