From patchwork Wed Nov 20 08:57:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 22022 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 61ADFC32F5 for ; Wed, 20 Nov 2024 08:58:02 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id DAD3E65F32; Wed, 20 Nov 2024 09:58:00 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="byMGHFuI"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7FA36658B6 for ; Wed, 20 Nov 2024 09:57:58 +0100 (CET) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:bbd:82cc:f3f3:e12e]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 5073E55A; Wed, 20 Nov 2024 09:57:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1732093060; bh=icixU+vvjaooFuLU+5d3UJa0TMHWYpLPEXimfTrDyV4=; h=From:To:Cc:Subject:Date:From; b=byMGHFuIZ07LF7p2Mk1kxcxj6HpjIJezIO77+BPgwqmMCwpKQdvaEYwPsqNAgIT6M deWqfqfawDWYgjetCn+5nzMuXT3uoV3GBj0vD5Hlz7nonNF3XIqhGyL6PuaH9h4O5v XlQJ2UxwelV0GzoTdWZVdKpfxEpbrZPM2LV3fCjs= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug Subject: [PATCH 0/7] rkisp1: Fix aspect ratio and ScalerCrop Date: Wed, 20 Nov 2024 09:57:39 +0100 Message-ID: <20241120085753.1993436-1-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.43.0 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" Hi all, This series contains fixes for a few issues on the imx8mp that I'd like to get in before the next release. Patch 1/7 is a drive by fix Patch 2/7 Fixes the aspect ratio on the imx8mp. There exists code to keep the aspect ratio in the rkisp1 pipeline that adjust the input crop on the resizer stage. On the imx8mp however the resizer hardware is missing that functionality and cropping needs to be done on the ISP output. Patch 2 implements that. Patches 3-7 fix the ScalerCrop control. The existing implementation implements ScalerCrop in dewarper coordinates (After scaling down). This is incorrect as ScalerCrop is specified to be in sensor coordinates. To fix that, patches 3-5 do preparatory changes and patch 6 implements the correct ScalerCrop control. Patch 7 adds ScalerMaximumCrop for completeness sake. Note that this solution while being correct on the numbers is still not ideal, because the aspect ratio preserving crop on the ISP output is still applied unconditionally. That will get fixed in an upcoming series, where the full sensor size get's passed to the dewarper and all cropping/scaling gets handled there. Best regards, Stefan Stefan Klug (7): libcamera: rkisp1: Fix scope of dewarper stop() exit action libcamera: rkisp1: Keep aspect ratio on imx8mp libcamera: geometry: Add Rectangle::mappedBetween() pipeline: rkisp1: Split inputCrop and outputCrop pipeline: rkisp1: Reorder sensorInfo collection code pipeline: rkisp1: Fix ScalerCrop to be in sensor coordinates pipeline: rkisp1: Add ScalerMaximumCrop property include/libcamera/geometry.h | 2 + src/libcamera/geometry.cpp | 33 +++++++ src/libcamera/pipeline/rkisp1/rkisp1.cpp | 97 ++++++++++++++----- src/libcamera/pipeline/rkisp1/rkisp1_path.cpp | 6 ++ 4 files changed, 114 insertions(+), 24 deletions(-)