From patchwork Mon Oct 19 12:51:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 10094 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 CE501BDB1F for ; Mon, 19 Oct 2020 12:52:07 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9B93E61373; Mon, 19 Oct 2020 14:52:07 +0200 (CEST) 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="PW00Q4Ue"; dkim-atps=neutral Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 9538D607B8 for ; Mon, 19 Oct 2020 14:52:05 +0200 (CEST) Received: by mail-wm1-x32e.google.com with SMTP id f21so10170631wml.3 for ; Mon, 19 Oct 2020 05:52:05 -0700 (PDT) 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=/WLhuioAaAxZG5md68I0FvxCpeK1giav9XNpGnp9Z04=; b=PW00Q4UePKBjfPNxT8OM3gMVvJWdOXbwz2WWZmSEXJ0kb6MrCCyqyB/Z2eA+gCD3QH 9vEKAWGb0+qXbn6pR2zL1azO0bskfA5Te55V/xWjUFlD5dggi8O8eEsfGbwJtJcWgVb5 aWc1kq58UA535IWPZ5CB4cChiapYqO6S9PIymyblFqVKcOzevDgHe67UM5RJ3nORBHew mennCUSceU+Ud4OB6YrHVZAoq5d+Sbtf+9eukrVfshoK53E0iFYBr5KB3Q0WJkvyF3s7 yF6sHxJwe3RXxkybARFTuAC59z+AIS/MZBKJlNGDWB/iKvqYF+OgFSV90xOJMnxQ/4bI syoA== 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=/WLhuioAaAxZG5md68I0FvxCpeK1giav9XNpGnp9Z04=; b=eaZMd1iGbjaH2dEZNqomUOo9K7GQ0yj/H6NGBQ5KhWqAvSjroG//rFl5hz51nGDYTc QlXgcgJtRiJgbFpUlr3TwVgRi2xFzM8mJTd8lDSaPoEB9/GpJCswtewllXpCPxojY1HI G0vO8eLQ+YfCBhTIPDuUtnqTvf5IvjMmRIbvh91iJTDvgZEy8maGESC6zk6MtfnFsewn DKjyGXmUpAezqt5iwuQOxxAKFZDIdaQrdbdV5wqDndZ6T6vbTsmONmSZXsgxpW+p0no1 P9VWGlCdWTr2Ay48DjOht8HFKMIz/yQ7psuCkM6lguslRYvw2kjjdBJRFH6Z/QZyvKJ7 EjQQ== X-Gm-Message-State: AOAM530xjg8rbVvYBFKxsl5nQPRoIub7hjbiDJKitjGNQ4ky/7ZTF88b wiAT13D2sSgczaIxNLRIfrqx/9y9fZVFlg== X-Google-Smtp-Source: ABdhPJz12lQTf6XaYUW2qpPXc0fhat8Yw6ZVWpFnxDlJjnAqBQCMnkYjDEsVlMmN6uST8jynf+YX0A== X-Received: by 2002:a7b:c255:: with SMTP id b21mr18362369wmj.25.1603111924875; Mon, 19 Oct 2020 05:52:04 -0700 (PDT) Received: from pi4-davidp.pitowers.org ([2a00:1098:3142:14:1ce1:9965:4328:89c4]) by smtp.gmail.com with ESMTPSA id q6sm16634335wma.0.2020.10.19.05.52.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Oct 2020 05:52:04 -0700 (PDT) From: David Plowman To: libcamera-devel@lists.libcamera.org Date: Mon, 19 Oct 2020 13:51:51 +0100 Message-Id: <20201019125156.26751-1-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 0/5] Digital zoom 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 Here's a new version of the digital zoom patches, following on from the previous implementations and the discussions that have been ongoing since then. Firstly I should point out that I've dropped the patch that added digital zoom parameters to the cam application as someone had suggested they might do something there (so thanks for that!). Also, I'm happy to add some geometry tests once there's a bit less churn in this patch set as a whole. In view of the current churn, I've dropped other "Reviewed by" tags - I hope that's reasonable. That leaves 5 patches, as follows: 1. Adds the ScalerCropMaximum property. This is the property that expresses the part of the sensor array within which an application can crop to implement digital zoom. The property name has been changed, obviously, and the documentation updated to be in line with recent discussion, otherwise nothing here is very different. 2. Initialisation of the ScalerCropMaximum property. This is unchanged. Given that the property isn't really very meaningful until you know what camera mode you mean, I do wonder whether we might be better to initialise this to all zeroes? Applications could always call isNull to be sure that they have something sensible. 3. Adds the ScalerCrop property. No great changes, apart from the property name and description. 4. Geometry helpers. Mostly as before, with the addition of a Point class and translation functions. There's also a Rectangle::rescaledTo function to make it easier to scale crop regions between sensor native and binned/scaled coordinates. Maybe someone would prefer a different name? I've split Rectangle::boundedTo into a separate true intersection function (taking the name Rectangle::boundedTo) and a function I've named Rectangle::clampedTo. I'm open to suggestions on the name, I wanted to choose something that didn't sound like it might be the intersection... 5. Implementation in the Raspberry Pi pipeline. Mostly as before, with the modifications required by earlier changes (notably scaling to and from native sensor coordinates). Some of the code here might look a little nicer if we added a "Point Rectangle::offset() const { return { x, y }; }" function, and changed the translate methods to take a Point instead of a pair of ints. Though I realise that the word "offset" is not popular, and I find the idea of translating by a Point mildly offensive, so I'm not sure about all that. Thoughts? Well, I think that's everything! Thanks and best regards David David Plowman (5): libcamera: Add SensorCropMaximum property libcamera: Initialise the ScalerCropMaximum property libcamera: Add ScalerCrop control libcamera: Add geometry helper functions libcamera: pipeline: raspberrypi: Implementation of digital zoom include/libcamera/geometry.h | 53 ++++ include/libcamera/ipa/raspberrypi.h | 1 + src/ipa/raspberrypi/raspberrypi.cpp | 7 + src/libcamera/camera_sensor.cpp | 6 + src/libcamera/control_ids.yaml | 12 + src/libcamera/geometry.cpp | 296 ++++++++++++++++++ .../pipeline/raspberrypi/raspberrypi.cpp | 70 ++++- src/libcamera/property_ids.yaml | 23 ++ 8 files changed, 453 insertions(+), 15 deletions(-)