From patchwork Wed Feb 9 12:08:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 15354 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 66B9DBDCBF for ; Wed, 9 Feb 2022 12:08:15 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A29C661092; Wed, 9 Feb 2022 13:08:14 +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="Ce2jkWBJ"; dkim-atps=neutral Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 5889F6106D for ; Wed, 9 Feb 2022 13:08:12 +0100 (CET) Received: by mail-wr1-x42d.google.com with SMTP id s18so3657174wrv.7 for ; Wed, 09 Feb 2022 04:08:12 -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=WgUz9i+6JmC+2yVWhj8LpLZnCUYdLr8/Iu3YV5UUSzs=; b=Ce2jkWBJ3mrxloE1XE0v9jZCSw6WcFsqTF6HljFkSIzVt3wITh7P9OOm86vXf17tdQ Nnn+4UdqnOslgpHQgnj0N18lHDgF/dowYFqR6jQ7P6N3eEdZ1CbUgeRVm5+K2dFtjcnO lzfq25uDipBPpOJXZyf2o0HBDHSv18LJfjOMxS2coQXcVakYSID2J8yplOKqdlkXT96e /ZSZiJF/h3rRUq9lVbmAEOhMPatRtJYNCm4zVdrYeCXA5ucmMHrIjUfeuaTlQv4YezAQ wfzWx3hxUsV9XEEB84dW7mSX804DjXCrKHKfMwCXl0hrG5P2afInHVzG6mPs4eJ6+Uz2 YelA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=WgUz9i+6JmC+2yVWhj8LpLZnCUYdLr8/Iu3YV5UUSzs=; b=Bwiqcqm6Al5HiBTphnPKLQ3DMw3Gw+PNT7tAVOrXPQuS/OWGdam7HCs0oARsEZoLxc NFG6aHAmfLrxF7sgGLy1QnesrxMqgcqCSiU6MRC7sZSp1gjArYLuHsqV0tGr6UfjLoDi V0la07ThQxvDK0cro7ath4aqy3bpCQPun+VFj52GdnrLr9zvHyzQ8+AisqIvhFA0VXk4 Wo0KHCEYA6H6dyokszP1ZEYJ7GauSU5fn+0t9Tlrb0p/+H9IZH6pJCd3oV9BYHrP4zcH nTJRmfMHIBuyhLogdR1n6NFP/5nP4cYFdn4/o41gGlxABp889v3LBVn/jE6gGBTcuknT vBEQ== X-Gm-Message-State: AOAM5313nBjVwtoEftZ8i8vHwBuWxG2lLRXCBOId+IcDZmu682lnr6sN GesLSG0CYQykpFVE7tP4Im+aBDes9FE4N1IO X-Google-Smtp-Source: ABdhPJwt3XIM5JnNxUITIzeNzjwEmnHEIANAUyW2uY/tYX4ftBnt65gZB1zH6e+ALhKuzWTuk+pcsw== X-Received: by 2002:a5d:560a:: with SMTP id l10mr1861393wrv.290.1644408491768; Wed, 09 Feb 2022 04:08:11 -0800 (PST) Received: from pi4-davidp.pitowers.org ([2a00:1098:3142:15:d2be:68f0:ab8:a2fb]) by smtp.gmail.com with ESMTPSA id q2sm15288782wrw.14.2022.02.09.04.08.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Feb 2022 04:08:11 -0800 (PST) From: David Plowman To: libcamera-devel@lists.libcamera.org Date: Wed, 9 Feb 2022 12:08:04 +0000 Message-Id: <20220209120804.21352-1-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] libcamera: pipeline: raspberrypi: Fix scaler crop when sensor is configured 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" We must calculate the initial scaler crop when the camera is configured, otherwise the metadata will report this rectangle as being all zeroes. Signed-off-by: David Plowman Reviewed-by: Kieran Bingham --- src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index 583ee798..d6c57e7a 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -887,6 +887,11 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config) if (ret) LOG(RPI, Error) << "Failed to configure the IPA: " << ret; + /* Set the scaler crop to the value that we are using. */ + data->scalerCrop_ = data->ispCrop_.scaledBy(data->sensorInfo_.analogCrop.size(), + data->sensorInfo_.outputSize); + data->scalerCrop_.translateBy(data->sensorInfo_.analogCrop.topLeft()); + /* * Configure the Unicam embedded data output format only if the sensor * supports it.