Patch Detail
Show a patch.
GET /api/1.1/patches/15404/?format=api
{ "id": 15404, "url": "https://patchwork.libcamera.org/api/1.1/patches/15404/?format=api", "web_url": "https://patchwork.libcamera.org/patch/15404/", "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": "<20220303121113.16839-1-david.plowman@raspberrypi.com>", "date": "2022-03-03T12:11:13", "name": "[libcamera-devel,v2] libcamera: pipeline: raspberrypi: Fix scaler crop when sensor is configured", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "ff505b0d757208fd7b4437b3f33f5f3bd07d688c", "submitter": { "id": 42, "url": "https://patchwork.libcamera.org/api/1.1/people/42/?format=api", "name": "David Plowman", "email": "david.plowman@raspberrypi.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/15404/mbox/", "series": [ { "id": 2948, "url": "https://patchwork.libcamera.org/api/1.1/series/2948/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2948", "date": "2022-03-03T12:11:13", "name": "[libcamera-devel,v2] libcamera: pipeline: raspberrypi: Fix scaler crop when sensor is configured", "version": 2, "mbox": "https://patchwork.libcamera.org/series/2948/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/15404/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/15404/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 3B1BCBF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 3 Mar 2022 12:11:30 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8B84B60475;\n\tThu, 3 Mar 2022 13:11:29 +0100 (CET)", "from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com\n\t[IPv6:2a00:1450:4864:20::32e])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E67DC601FF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 3 Mar 2022 13:11:27 +0100 (CET)", "by mail-wm1-x32e.google.com with SMTP id\n\to18-20020a05600c4fd200b003826701f847so4608850wmq.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 03 Mar 2022 04:11:27 -0800 (PST)", "from pi4-davidp.pitowers.org\n\t([2a00:1098:3142:14:e4a2:3070:eea4:e434])\n\tby smtp.gmail.com with ESMTPSA id\n\tf18-20020a05600c155200b003816bac83f6sm2320821wmg.27.2022.03.03.04.11.26\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 03 Mar 2022 04:11:26 -0800 (PST)" ], "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"GPPXUTsj\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=V0xSEc0yJ/sm6L6Ol6shJ76H6eiG7BFG1w515hWqhIQ=;\n\tb=GPPXUTsj3JWuDkM+FDoNC4c9iQ/KfBlZGgeElvq3z/cfxiXimKN+TGqJGAfzmmfAXM\n\tR2RuCC/oCwtOoNr2qgMAZcyPKxwE4tU+0HegjEqYfuqdudcEokurI0e/9XUg1pwcUscE\n\t/PMPocGeD8iqbNPu+A8YvARz5tN8nWgOx6YETI1EpflgJbgVv9eudGPlEZ9IYWIXNeOQ\n\tubwPlyop/idI3G5yHp4K688GS+Katc70VvdnCps7GcFDpfkaO0pD8R99LAdY/LdiF9Fg\n\teY9t0Iy5uZsiuBau9+Hy0973K4WTGwtNe2kreWRTqHUY3SBeooG9LvDths+93EOoKyEt\n\tq6KA==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=V0xSEc0yJ/sm6L6Ol6shJ76H6eiG7BFG1w515hWqhIQ=;\n\tb=v2/ICXg7tRiXT9QIIaHzY+3n95u41jZ/nwfxja5vqH/IM7IL7DyP9pocdFYGWKS/7A\n\t8oDa1afmaLwrkIp8xf1o8SUjB/WtNxhv4M+6cnuPm+LcrteIDz72W942xWIKlwH0GdgM\n\tnfa/nc7UaK0rrg1ylfdYmlenAS8l7q5zkrLNv4vnt82ByPDboG2AdQ7WKtHVAS3bcVqv\n\tUk3XYcGXYuYDF3jPSNp9q3Qeejhua/cdkZcz6vc7k3M5QmKp5aQE9ZZsVf0IZp2gndRK\n\tNe/mSqAZDykdmwfKxFzMya4X3Shr4GW6aQal5WeqqDBwDLjH2HvJWwQerthVwpnpPeoU\n\tm6aw==", "X-Gm-Message-State": "AOAM532am8iK6zXM9G/X+Y/C5EbGfyzbAaMExZByKQhSdKDnExwRXRWw\n\tuSRuSTPmpyIxESPMUY2UMJ+W3plWA6tEkQ==", "X-Google-Smtp-Source": "ABdhPJzO79DcC3FbZNu6IpEKm6UomH5gB3gagdftScHUl42Psjofp1UJBxSefI/cmhDYwJtXJX8p1w==", "X-Received": "by 2002:a05:600c:4e48:b0:381:83d8:54f6 with SMTP id\n\te8-20020a05600c4e4800b0038183d854f6mr3597720wmq.18.1646309487344; \n\tThu, 03 Mar 2022 04:11:27 -0800 (PST)", "From": "David Plowman <david.plowman@raspberrypi.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Thu, 3 Mar 2022 12:11:13 +0000", "Message-Id": "<20220303121113.16839-1-david.plowman@raspberrypi.com>", "X-Mailer": "git-send-email 2.30.2", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v2] libcamera: pipeline: raspberrypi: Fix\n\tscaler crop when sensor is configured", "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": "We must calculate the initial scaler crop when the camera is\nconfigured, otherwise the metadata will report this rectangle as being\nall zeroes.\n\nBecause the calculation is identical to that performed later in handling\nthe scaler crop control, we factor it into a small helper function,\nRPiCameraData::scaleIspCrop.\n\nSigned-off-by: David Plowman <david.plowman@raspberrypi.com>\n---\n .../pipeline/raspberrypi/raspberrypi.cpp | 20 ++++++++++++++++---\n 1 file changed, 17 insertions(+), 3 deletions(-)", "diff": "diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex 29bff9d6..eede78e6 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -212,6 +212,7 @@ public:\n \tvoid handleStreamBuffer(FrameBuffer *buffer, RPi::Stream *stream);\n \tvoid handleExternalBuffer(FrameBuffer *buffer, RPi::Stream *stream);\n \tvoid handleState();\n+\tRectangle scaleIspCrop(const Rectangle &ispCrop) const;\n \tvoid applyScalerCrop(const ControlList &controls);\n \n \tstd::unique_ptr<ipa::RPi::IPAProxyRPi> ipa_;\n@@ -887,6 +888,9 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)\n \tif (ret)\n \t\tLOG(RPI, Error) << \"Failed to configure the IPA: \" << ret;\n \n+\t/* Set the scaler crop to the value we are using (scaled to native sensor coordinates). */\n+\tdata->scalerCrop_ = data->scaleIspCrop(data->ispCrop_);\n+\n \t/*\n \t * Configure the Unicam embedded data output format only if the sensor\n \t * supports it.\n@@ -1974,6 +1978,18 @@ void RPiCameraData::checkRequestCompleted()\n \t}\n }\n \n+Rectangle RPiCameraData::scaleIspCrop(const Rectangle &ispCrop) const\n+{\n+\t/*\n+\t * Scale a crop rectangle defined in the ISP's coordinates into native sensor\n+\t * coordinates.\n+\t */\n+\tRectangle nativeCrop = ispCrop.scaledBy(sensorInfo_.analogCrop.size(),\n+\t\t\t\t\t\tsensorInfo_.outputSize);\n+\tnativeCrop.translateBy(sensorInfo_.analogCrop.topLeft());\n+\treturn nativeCrop;\n+}\n+\n void RPiCameraData::applyScalerCrop(const ControlList &controls)\n {\n \tif (controls.contains(controls::ScalerCrop)) {\n@@ -2006,9 +2022,7 @@ void RPiCameraData::applyScalerCrop(const ControlList &controls)\n \t\t\t * used. But we must first rescale that from ISP (camera mode) pixels\n \t\t\t * back into sensor native pixels.\n \t\t\t */\n-\t\t\tscalerCrop_ = ispCrop_.scaledBy(sensorInfo_.analogCrop.size(),\n-\t\t\t\t\t\t\tsensorInfo_.outputSize);\n-\t\t\tscalerCrop_.translateBy(sensorInfo_.analogCrop.topLeft());\n+\t\t\tscalerCrop_ = scaleIspCrop(ispCrop_);\n \t\t}\n \t}\n }\n", "prefixes": [ "libcamera-devel", "v2" ] }