From patchwork Thu Mar 24 13:05:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 15534 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 1EC30C0F1B for ; Thu, 24 Mar 2022 13:05:14 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 757EE604D5; Thu, 24 Mar 2022 14:05:13 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1648127113; bh=jWkImnThPsUAomkcPCl5BD8ZfRBdbhCUnm0ZI4x+DBg=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=c9BZyKxrupE6icvb45nFUHLu8dp4X8iC8K0V9bC4OUH/+XR4ZWibqERjJUFeDytxB hKr9TNPIDjadY0i1bf+t35klV04QlndQ+MeA76hY+eCMdAJF6hBUXEacN3K+YbT2qz aKKA1gCFV1m0IjS7MI7l5jqOssolfyVkDcs6Fbng5Bjn5jcfNllULwJLCz8Vtl1vDs ApDZukDjv9KEl+i3Y5nZ3HQXTmxmEpZEk3UJDesbr8S8PR0ZtgRHW+4gLeD5zwujcM o/mcLSj70auq29qy9G574aN2l+WLU996IuCAAX5R8P0udqji4/rk7IaRrj4P1o2Jdf raKbzXkbNDteA== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1982460397 for ; Thu, 24 Mar 2022 14:05:12 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="WzWT63SM"; dkim-atps=neutral Received: from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 80C111844; Thu, 24 Mar 2022 14:05:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1648127111; bh=jWkImnThPsUAomkcPCl5BD8ZfRBdbhCUnm0ZI4x+DBg=; h=From:To:Cc:Subject:Date:From; b=WzWT63SM5Vc68HLo4vNubYIQQeHl9ORs3e4d9PH/IQvQrVaOxLxLR87sxlHyVHNYV 3xdIO5cB6p8PhHJZikkGuTa7iCtdtI6/lznGOpngAlGtwkCqggMCy2+tsmGaHukFtS LQDe8cf7JdMIWDdVWpietZ92Y8Ng73baOQ+s258M= To: libcamera-devel@lists.libcamera.org Date: Thu, 24 Mar 2022 15:05:06 +0200 Message-Id: <20220324130506.27360-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] pipeline: rkisp1: Match sensor aspect ratio when generating configurations 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: , X-Patchwork-Original-From: Laurent Pinchart via libcamera-devel From: Laurent Pinchart Reply-To: Laurent Pinchart Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The RkISP1Path::generateConfiguration() function limits the maximum resolution to the sensor resolution, to avoid upscaling. It however doesn't take the sensor aspect ratio into account, which leads to a maximum (and default) resolution of 1920x1920 when using the self path with a sensor that has a higher resolution. Fix it by constraining the minimum and maximum resolutions to match the sensor's aspect ratio. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham Reviewed-by: Paul Elder --- src/libcamera/pipeline/rkisp1/rkisp1_path.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp index f8d471204d2e..f195f91ead1f 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp @@ -50,12 +50,13 @@ bool RkISP1Path::init(MediaDevice *media) StreamConfiguration RkISP1Path::generateConfiguration(const Size &resolution) { - Size maxResolution = resolution; - maxResolution.boundTo(maxResolution_); + Size maxResolution = maxResolution_.boundedToAspectRatio(resolution) + .boundedTo(resolution); + Size minResolution = minResolution_.expandedToAspectRatio(resolution); std::map> streamFormats; for (const PixelFormat &format : formats_) - streamFormats[format] = { { minResolution_, maxResolution } }; + streamFormats[format] = { { minResolution, maxResolution } }; StreamFormats formats(streamFormats); StreamConfiguration cfg(formats);