From patchwork Mon Dec 7 18:01:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 10597 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 63452BDB1F for ; Mon, 7 Dec 2020 18:01:50 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E943E67E6C; Mon, 7 Dec 2020 19:01:49 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="H/b0ZpUK"; dkim-atps=neutral Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 368EE635A0 for ; Mon, 7 Dec 2020 19:01:48 +0100 (CET) Received: by mail-ed1-x529.google.com with SMTP id b2so14713427edm.3 for ; Mon, 07 Dec 2020 10:01:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=SrJh41mzZJSU8iGwBwl9bnWoLDVGry3P5lseWpXoVUs=; b=H/b0ZpUKpme/PG1Au74FVkzayPQCQbIm2QSCXGpDoDUtr6+/AxWgAwmYMrF051cUl8 zcHWh0UAHFaqnJfRyH74jm25S3MJPbnDM2Vdcj6Kdthr1xpjtWgzKXD+5cbMtD/trZ+P st9ZAKQG0WDynpu33rNSJhyUPjhPA0c0GxUQFuSiwaV//4KVwscNnZKlhurnK1bSAi2o SmaiPwssXsZFMEbsR6F1nybOSh1iHLa3S2B0BS5OkQPzeVJ7tWjKxCn57+tCib7kWQI1 /PCXEk8V+GrghrWztBVE38bdMn4nzTadfHDud2eII73WjwbJ50T0FXdDoO86wNjHD4Hv 8WUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=SrJh41mzZJSU8iGwBwl9bnWoLDVGry3P5lseWpXoVUs=; b=lJh875fX2sfG4I+R8suq1Tm4Lmm35Sky1eu+o4qsbYEqu7P6E6T6mHYkceDpFBQpf6 WEyr1ahX5q+hgSwlfsO5hKutZxy5uLU28JbaZitppaqd8rqa4xefpGFvaaKRp1dqk5XU 7mEqp99Vj8inYjV80CDj8Br2abh0snaeJ9zkPUdX/ceRsrT3wBUor1dq4g3hOrAfn2eB nbzlu4PrkIXncy3DtildbUbjuY74BqykdcPT8w0x1KuuzyCJtVr2MD2hvD4z2wP+wSX2 KjQMMJHCVQVRh+/pVAIJ4JuWRRMPbJg/qKGTcW4i3HsFHxkFUmOxkBH8Mghwd0jh/PkZ KYuQ== X-Gm-Message-State: AOAM532SwZjEqfvDo4bk+7ignIReSXQZYRA6KXtAy30XeGZTidk4zLFH z//GfahJTs2QgV6zU+0JST5h1Nch0gtPPIKz X-Google-Smtp-Source: ABdhPJxmibhupHxnTOmhwz3lHMck/9xJ021n4H0S5nbJPWft6bi4evcJLBKq5ca9NdVWlpwMbzqoqA== X-Received: by 2002:a05:6402:46:: with SMTP id f6mr6842533edu.163.1607364107270; Mon, 07 Dec 2020 10:01:47 -0800 (PST) Received: from pi4-davidp.lan (plowpeople3.plus.com. [80.229.223.72]) by smtp.gmail.com with ESMTPSA id be6sm14657977edb.29.2020.12.07.10.01.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Dec 2020 10:01:35 -0800 (PST) From: David Plowman To: libcamera-devel@lists.libcamera.org Date: Mon, 7 Dec 2020 18:01:15 +0000 Message-Id: <20201207180121.6374-1-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 0/6] Raspberry Pi AGC: initial frame drop count 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Hi everyone Thanks for the reviews, comments and suggestions. Here's a version 2 that takes account of the feedback. There are now 6 commits: 1. This actually squashes together the previous first two patches, but is otherwise unchanged. 2. The new method for Agc is called GetConvergenceFrames, but this is otherwise unchanged. 3. The same as the previous patch, but for Awb rather than Agc. (There's actually an issue here - the AWB really only takes one frame to converge, except the calculation runs in another thread so you can't be certain. So for that reason I've left the value at 3. I don't really feel inclined to complicate everything on account of this... but it is something to keep in mind.) 4. A helper function for the Pwl (piecewise linear function) class that I found useful in the following patch. 5. Here we extend the AWB to estimate a colour temperature given fixed colour gains. We pass this out in the metadata where the ALSC picks it up in its SwitchMode. I only do this the very first time everything starts - I'm not convinced about doing it on other occasions, though we could review that based on the usage it gets. (Note: looking through awb.cpp I am reminded it needs a bit of a tidy like we have done elsewhere, such as in ALSC and AGC. I left myself a little reminder at the top to get back to this once we've got our apps out of the door!) 6. This patch is essentially the final two patches of the v1 set. I squashed them together because I think the ov5647 change makes more sense incorporated. Beyond that the only real difference is that I query both the AGC and AWB for their convergence numbers, and handle them in the way proposed in some of the discussions. You may notice that I haven't given ALSC a GetConvergenceFrames method. In fact it just tags along with the AWB, reading the colour temperature that it produced. If AWB is happy, so is ALSC. If AWB needs frames to converge, so does ALSC. It has no "independance" in this regard, so it felt tidier to leave it alone. Hope that makes sense! Thanks and best regards David David Plowman (6): src: raspberrypi: Pass the drop frame count in start, not configure src: ipa: raspberrypi: agc: Add GetConvergenceFrames method to AGC base class src: ipa: raspberrypi: agc: Add GetConvergenceFrames method to AWB base class src: ipa: raspberrypi: Compute inverse of piecewise linear function src: ipa: raspberrypi: Estimate the colour temerature if starting with fixed colour gains src: ipa: raspberrypi: Move initial frame drop decision to AGC/AWB src/ipa/raspberrypi/cam_helper.cpp | 6 +- src/ipa/raspberrypi/cam_helper_ov5647.cpp | 10 +++ .../raspberrypi/controller/agc_algorithm.hpp | 1 + .../raspberrypi/controller/awb_algorithm.hpp | 1 + src/ipa/raspberrypi/controller/pwl.cpp | 27 ++++++++ src/ipa/raspberrypi/controller/pwl.hpp | 3 + src/ipa/raspberrypi/controller/rpi/agc.cpp | 13 ++++ src/ipa/raspberrypi/controller/rpi/agc.hpp | 2 + src/ipa/raspberrypi/controller/rpi/alsc.cpp | 6 +- src/ipa/raspberrypi/controller/rpi/awb.cpp | 27 ++++++++ src/ipa/raspberrypi/controller/rpi/awb.hpp | 3 + src/ipa/raspberrypi/raspberrypi.cpp | 61 +++++++++++++------ .../pipeline/raspberrypi/raspberrypi.cpp | 25 ++++---- 13 files changed, 149 insertions(+), 36 deletions(-)