From patchwork Thu Oct 3 07:47:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 21488 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 C2FBDBD80A for ; Thu, 3 Oct 2024 07:53:55 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 881586352E; Thu, 3 Oct 2024 09:53:50 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="LmNlU4tL"; 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 A1D7162C93 for ; Thu, 3 Oct 2024 09:53:46 +0200 (CEST) Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-42cb3c6c353so1082815e9.3 for ; Thu, 03 Oct 2024 00:53:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1727942026; x=1728546826; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=gF1CRK5658pUZV0uzy7B6zhR0H6HtzA+lmLE8dz6KjA=; b=LmNlU4tLWVxh155owywBmgcxrXytkkQadbQ0LfMrvT4C7RwPU8Je6vPkJkzGAK8Vu9 Z08uSPDe0xb3b1iXUuRQSYJb/rMSsQR1Vk+A9AtZk7Is5iuodnE/9Jhhiia9ctL+aXU+ wcQSKAXy2zydRaPJUsp8+ypmLXcVDvdSeN1SCSQ0Agmo3cKxTHsQthSfzJkIV98n5JUy Nspa6n+CMkPotk69X6eUCdlIUGnIb40wh7D3UCp9eIU5gqDZjuf8pawf258BmRJolTwQ UvLkK+ua4EHkJ4h6CwJEL6h9OqPttDPdkLO2ZRHnspF5sDKEiTFCYIP2tSsh+woYEond A/dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727942026; x=1728546826; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gF1CRK5658pUZV0uzy7B6zhR0H6HtzA+lmLE8dz6KjA=; b=ZfRLQXFZbWybPj/pth8sIphX7Jylgeq9KKSNbvLWfU/U8z6Cj9YkLBfqMUAPrvsq5b JTzqVZr7YQCRGDwxSwKjlH80bgN8xusoRkgKttkjS+e/WhMjUJpNMCxxqTLw77Rv7b29 559NKny/vAkptJHkY/APIrqrNEbM0778la4uQtzx5rc/yHeafuJvJmeugGSycAOVJX0B JN4g8ZR5mCpzhPNexbV9Bj5OSdXpDYqzBQyFf92H6jVOwoOECL8zfHGpTNd74CGTFoOL YkNoBl94W/65EwsSolUOY1kd6bA80nL21bNykshD04lRdix5lb7NNBLNTFpuxOu/fZOf 52Qg== X-Gm-Message-State: AOJu0Yzyz9xDmrOFIpVBIVTTpvZ8rW7Eg8VP45AfRkVAhgqDq9gZLgW4 WLDxaJ1DoAYuRteVZd1PCIgknVne4nOmmc8AdgbL5qDd1u3sjesHYrvQ4lwWHrAWFZUbB6j57+v w X-Google-Smtp-Source: AGHT+IHFdsOFLVd/0HLDP7ZzeOprKcDizHXOc1ot80O1tRrLN7wThoA4VqIC31U0IeN4wodp8pLJuQ== X-Received: by 2002:a05:600c:3c93:b0:42c:bb35:b6d0 with SMTP id 5b1f17b1804b1-42f777b0043mr19815795e9.1.1727942025822; Thu, 03 Oct 2024 00:53:45 -0700 (PDT) Received: from naush-laptop.pitowers.org ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42f8025b583sm8740825e9.12.2024.10.03.00.53.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Oct 2024 00:53:44 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Cc: Naushir Patuck , Laurent Pinchart , Jacopo Mondi Subject: [PATCH v3 2/7] pipeline: rpi: Remove CameraData::scalerCrop_ Date: Thu, 3 Oct 2024 08:47:15 +0100 Message-Id: <20241003074720.18882-3-naush@raspberrypi.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241003074720.18882-1-naush@raspberrypi.com> References: <20241003074720.18882-1-naush@raspberrypi.com> MIME-Version: 1.0 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" Do not cache the scalerCrop_ parameter. The cached value is used to update the request metadata, but since this is not an expensive operation (and can only occur once per frame), caching it is of limited value. This will simplify logic in a future commit where we can specify a crop per-output stream. Signed-off-by: Naushir Patuck Reviewed-by: Laurent Pinchart Reviewed-by: Jacopo Mondi --- .../pipeline/rpi/common/pipeline_base.cpp | 18 +++--------------- .../pipeline/rpi/common/pipeline_base.h | 1 - 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp index 3041fd1ed9fd..11f1bfd4a5da 100644 --- a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp +++ b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp @@ -544,12 +544,6 @@ int PipelineHandlerBase::configure(Camera *camera, CameraConfiguration *config) return ret; } - /* - * Set the scaler crop to the value we are using (scaled to native sensor - * coordinates). - */ - data->scalerCrop_ = data->scaleIspCrop(data->ispCrop_); - /* * Update the ScalerCropMaximum to the correct value for this camera mode. * For us, it's the same as the "analogue crop". @@ -569,7 +563,8 @@ int PipelineHandlerBase::configure(Camera *camera, CameraConfiguration *config) /* Add the ScalerCrop control limits based on the current mode. */ Rectangle ispMinCrop = data->scaleIspCrop(Rectangle(data->ispMinCropSize_)); - ctrlMap[&controls::ScalerCrop] = ControlInfo(ispMinCrop, data->sensorInfo_.analogCrop, data->scalerCrop_); + ctrlMap[&controls::ScalerCrop] = ControlInfo(ispMinCrop, data->sensorInfo_.analogCrop, + data->scaleIspCrop(data->ispCrop_)); data->controlInfo_ = ControlInfoMap(std::move(ctrlMap), result.controlInfo.idmap()); @@ -1320,13 +1315,6 @@ void CameraData::applyScalerCrop(const ControlList &controls) if (ispCrop != ispCrop_) { ispCrop_ = ispCrop; platformSetIspCrop(); - - /* - * Also update the ScalerCrop in the metadata with what we actually - * used. But we must first rescale that from ISP (camera mode) pixels - * back into sensor native pixels. - */ - scalerCrop_ = scaleIspCrop(ispCrop_); } } } @@ -1483,7 +1471,7 @@ void CameraData::fillRequestMetadata(const ControlList &bufferControls, Request request->metadata().set(controls::SensorTimestamp, bufferControls.get(controls::SensorTimestamp).value_or(0)); - request->metadata().set(controls::ScalerCrop, scalerCrop_); + request->metadata().set(controls::ScalerCrop, scaleIspCrop(ispCrop_)); } } /* namespace libcamera */ diff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.h b/src/libcamera/pipeline/rpi/common/pipeline_base.h index f9cecf70f179..5161c16e518f 100644 --- a/src/libcamera/pipeline/rpi/common/pipeline_base.h +++ b/src/libcamera/pipeline/rpi/common/pipeline_base.h @@ -134,7 +134,6 @@ public: /* For handling digital zoom. */ IPACameraSensorInfo sensorInfo_; Rectangle ispCrop_; /* crop in ISP (camera mode) pixels */ - Rectangle scalerCrop_; /* crop in sensor native pixels */ Size ispMinCropSize_; unsigned int dropFrameCount_;