Patch Detail
Show a patch.
GET /api/1.1/patches/22348/?format=api
{ "id": 22348, "url": "https://patchwork.libcamera.org/api/1.1/patches/22348/?format=api", "web_url": "https://patchwork.libcamera.org/patch/22348/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20241216154124.203650-3-stefan.klug@ideasonboard.com>", "date": "2024-12-16T15:40:42", "name": "[v4,02/20] pipeline: rkisp1: Keep aspect ratio on imx8mp", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "f132eb262b055643ac6cf966dac08f3794c7f8d4", "submitter": { "id": 184, "url": "https://patchwork.libcamera.org/api/1.1/people/184/?format=api", "name": "Stefan Klug", "email": "stefan.klug@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/22348/mbox/", "series": [ { "id": 4896, "url": "https://patchwork.libcamera.org/api/1.1/series/4896/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4896", "date": "2024-12-16T15:40:40", "name": "rkisp1: Fix aspect ratio and ScalerCrop", "version": 4, "mbox": "https://patchwork.libcamera.org/series/4896/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/22348/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/22348/checks/", "tags": {}, "headers": { "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>", "X-Original-To": "parsemail@patchwork.libcamera.org", "Delivered-To": "parsemail@patchwork.libcamera.org", "Received": [ "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id C830DC32DA\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 16 Dec 2024 15:41:54 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 75EF967F76;\n\tMon, 16 Dec 2024 16:41:54 +0100 (CET)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 576E167F6D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 16 Dec 2024 16:41:52 +0100 (CET)", "from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:bfdf:3a3c:e45:66e3])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id B2E0B675;\n\tMon, 16 Dec 2024 16:41:15 +0100 (CET)" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"Ega+78fr\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1734363675;\n\tbh=p7dat2hlw29p77nf/2ynDNFPwqBK/iiEVvknL9O2Bh4=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=Ega+78frp6bjLqYhBUV7qmBaNy8A9Iyx1WSdltzNkJbaRhLxQd+Sqdj5COon0I8Fi\n\tvTCCjmxIFK40LuJ3H08Kzbjx+E715RuyUzuA50nkz8JQnKaY/yTrtsmhDxf4e6ZUha\n\tiL6Q0/NCB2yGNcwEOBmpfESu9HWWcsvs3ygS1vME=", "From": "Stefan Klug <stefan.klug@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "Stefan Klug <stefan.klug@ideasonboard.com>,\n\tPaul Elder <paul.elder@ideasonboard.com>,\n\tJacopo Mondi <jacopo.mondi@ideasonboard.com>", "Subject": "[PATCH v4 02/20] pipeline: rkisp1: Keep aspect ratio on imx8mp", "Date": "Mon, 16 Dec 2024 16:40:42 +0100", "Message-ID": "<20241216154124.203650-3-stefan.klug@ideasonboard.com>", "X-Mailer": "git-send-email 2.43.0", "In-Reply-To": "<20241216154124.203650-1-stefan.klug@ideasonboard.com>", "References": "<20241216154124.203650-1-stefan.klug@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "X-BeenThere": "libcamera-devel@lists.libcamera.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "<libcamera-devel.lists.libcamera.org>", "List-Unsubscribe": "<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>", "List-Archive": "<https://lists.libcamera.org/pipermail/libcamera-devel/>", "List-Post": "<mailto:libcamera-devel@lists.libcamera.org>", "List-Help": "<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>", "List-Subscribe": "<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "In the current code, the input stage of the image resizer is used to\napply a crop to keep the aspect ratio in cases where the requested\noutput aspect ratio differs from the one of the selected sensor mode. On\nthe imx8mp the resizer hardware is not capable of cropping (for\nreference see also rkisp1-resizer.c:rkisp1_rsz_set_sink_crop() in the\nlinux kernel v6.10).\n\nTherefore apply the necessary cropping on the output of the ISP (on the\nimage stabilization block). The cropping code on the image resizer\ndoesn't need modifications as the requested crop gets ignored by the\nkernel.\n\nWhile at it, remove a todo comment that is no longer needed.\n\nSigned-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\nReviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n\n---\nChanges in v4:\n- Changed title to pipeline:\n\nChanges in v3:\n- Dropped info message about the crop\n\nChanges in v2:\n- Fixed alignment\n- Improved comments\n- Removed todo comment\n- Collected tags\n---\n src/libcamera/pipeline/rkisp1/rkisp1.cpp | 13 +++++++++++++\n src/libcamera/pipeline/rkisp1/rkisp1_path.cpp | 13 ++++++++-----\n 2 files changed, 21 insertions(+), 5 deletions(-)", "diff": "diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\nindex 8b92fdebdd63..698fe9ff57a4 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n@@ -812,6 +812,19 @@ int PipelineHandlerRkISP1::configure(Camera *camera, CameraConfiguration *c)\n \tif (!isRaw_)\n \t\tformat.code = MEDIA_BUS_FMT_YUYV8_2X8;\n \n+\t/*\n+\t * On devices without DUAL_CROP (like the imx8mp) cropping needs to be\n+\t * done on the ISP/IS output.\n+\t */\n+\tif (media_->hwRevision() == RKISP1_V_IMX8MP) {\n+\t\t/* imx8mp has only a single path. */\n+\t\tconst auto &cfg = config->at(0);\n+\t\tSize ispCrop = format.size.boundedToAspectRatio(cfg.size)\n+\t\t\t\t\t .alignedUpTo(2, 2);\n+\t\trect = ispCrop.centeredTo(Rectangle(format.size).center());\n+\t\tformat.size = ispCrop;\n+\t}\n+\n \tLOG(RkISP1, Debug)\n \t\t<< \"Configuring ISP output pad with \" << format\n \t\t<< \" crop \" << rect;\ndiff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp\nindex 236d05af7a2f..eee5b09e2ff0 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp\n@@ -417,11 +417,14 @@ int RkISP1Path::configure(const StreamConfiguration &config,\n \t/*\n \t * Crop on the resizer input to maintain FOV before downscaling.\n \t *\n-\t * \\todo The alignment to a multiple of 2 pixels is required but may\n-\t * change the aspect ratio very slightly. A more advanced algorithm to\n-\t * compute the resizer input crop rectangle is needed, and it should\n-\t * also take into account the need to crop away the edge pixels affected\n-\t * by the ISP processing blocks.\n+\t * Note that this does not apply to devices without DUAL_CROP support\n+\t * (like imx8mp) , where the cropping needs to be done on the\n+\t * ImageStabilizer block on the ISP source pad and therefore is\n+\t * configured before this stage. For simplicity we still set the crop.\n+\t * This gets ignored by the kernel driver because the hardware is\n+\t * missing the capability.\n+\t *\n+\t * Alignment to a multiple of 2 pixels is required by the resizer.\n \t */\n \tSize ispCrop = inputFormat.size.boundedToAspectRatio(config.size)\n \t\t\t\t .alignedUpTo(2, 2);\n", "prefixes": [ "v4", "02/20" ] }