From patchwork Thu Aug 8 10:23:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 20833 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 C6DE0C324E for ; Thu, 8 Aug 2024 10:23:59 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 3E822633B1; Thu, 8 Aug 2024 12:23:53 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="pnCrsCfo"; dkim-atps=neutral Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id F22AF63382 for ; Thu, 8 Aug 2024 12:23:47 +0200 (CEST) Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-368380828d6so427060f8f.1 for ; Thu, 08 Aug 2024 03:23:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1723112627; x=1723717427; 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=8sYDQCCj57XZitX0+7BLhUA3FP4/j7VspqlO+P/HyUY=; b=pnCrsCfoMwdi4BiksWzLh3HmTvrvu61ap6MPixRnt1Iat5Azq3r4L9dVoXeFjGGTG/ EaejBs8+esGeCrgWbpAtslCW4e5lyfSOJjSAIW8sn24Ak5DiXg8+8MUtLOD4cVIOKJL0 Vfm789Omu9zLKhGy6Ek6bEk0s7m08C1oFKhmY8eW9xBvwwNsBsG3uM64C+Mafn6NEZ0O mDMpEuIXrdcKfxB7I8Asijcgt1GVSQ4YBP4i4reOMqQ1arcUIBrWgB8BJsXo7AegqjsZ okQAEX9b7B/Y2Q4cEMTGf4IIllpEkzIIwprCQcZUytSq56kiBREp4G1uJviUdPKDS9X3 Yjpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723112627; x=1723717427; 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=8sYDQCCj57XZitX0+7BLhUA3FP4/j7VspqlO+P/HyUY=; b=IfJU1WOxoONU2UOrM15M7HQopBKzpC9iqWduYRsF/cul2N4vkSCtVp5LGrbEh3OiE1 6tldT/e+L/5jFohn5KylTfdvJ6Vuv5SdgEi6bMQryCFMxGaOZsuv5VdxMz6HYPoKG3RF KHnDSynoBlEJXNVtP2cu/xcy5AIrui6rGvcBDhD2nr0xNvDNV3f78i9j77XvqNi57nAR qGhh+48nk9RcSK0WuXKkEZR0SN82B0VibP1sdzcFTYR/ypHuYqenTKiEObbq7s518qqn 6kp1kfJ5BkA9Hjz5vwqOMmU25I1nChh1QCYCZY7tRsOXjMLz0L0NNfWXh8JgfIUpEPSv 4HOQ== X-Gm-Message-State: AOJu0YxKMCR/XG+9TvffvRpyH2iK0p0WVu1BEjKVrWA/njE0hQVADLRE pSYcdahN3/zimUkPOr9tnfA/1f785fYLOR7ofj/K07Ais6aw07B2AdCkoiBH18kMApkLx3a7jRb i X-Google-Smtp-Source: AGHT+IHuzKcbdu+6yEQxqqSvyqM2vmBsibvD9At9FjqwgVKkEMETk8yCcbII2fgdlLYqBU9OHgHX5g== X-Received: by 2002:adf:ec85:0:b0:367:434f:ca9a with SMTP id ffacd0b85a97d-36d2728fea8mr882259f8f.0.1723112627142; Thu, 08 Aug 2024 03:23:47 -0700 (PDT) Received: from naush-laptop.pitowers.org ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36d272290c2sm1404234f8f.92.2024.08.08.03.23.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 03:23:46 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Cc: Naushir Patuck Subject: [PATCH v1 2/7] pipeline: rpi: Remove CameraData::scalerCrop_ Date: Thu, 8 Aug 2024 11:23:41 +0100 Message-Id: <20240808102346.13065-3-naush@raspberrypi.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240808102346.13065-1-naush@raspberrypi.com> References: <20240808102346.13065-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 --- .../pipeline/rpi/common/pipeline_base.cpp | 17 +++-------------- .../pipeline/rpi/common/pipeline_base.h | 1 - 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp index 3041fd1ed9fd..5322fd798a36 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()); @@ -1321,12 +1316,6 @@ void CameraData::applyScalerCrop(const ControlList &controls) 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 +1472,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_;