[{"id":38983,"web_url":"https://patchwork.libcamera.org/comment/38983/","msgid":"<178041503794.66229.14626181372145996771@localhost>","date":"2026-06-02T15:43:57","subject":"Re: [PATCH 0/2] pipeline: simple: Add ScalerCrop reporting","submitter":{"id":184,"url":"https://patchwork.libcamera.org/api/people/184/","name":"Stefan Klug","email":"stefan.klug@ideasonboard.com"},"content":"Hi Kieran,\n\nQuoting Kieran Bingham (2026-05-07 17:25:32)\n> While the Simple Pipeline handler doesn't support ScalerCrop, it can be\n> beneficial to report the ScalerCropMaximum and the ScalerCrop metadata\n> anyway as applications can use this information to determine the\n> positioning of the pixels captured in respect to the active area.\n> \n> This series reports the AnalogCrop as the ScalerCropMaximum in the\n> camera properties, and also as the the ScalerCrop in each completed\n> frame metadata.\n> \n> I'm curious on opinions if we should have more specific names for\n> reporting this metadata when theres' not actually a ScalerCrop\n> involved... \n\nI think that would be beneficial.\n\nMy proposal would be to add a PixelArray property of type Rectangle.\nThis would complement PixelArraySize [1] by also specifying the offset.\n\nThe documentation of PixelArrayActiveAreas [2] even mentions the\n\"PixelArraySize rectangle\" which could then become the \"PixelArray\nrectangle\".\n\nThis series uses the analog crop rectangle for the ScalerCrop. I fear\nthis is not according to documentation the same way as it is on rkisp1.\nIn both cases we report ScalerCrop relative to the physical pixel array\nand not relative to the libcamera \"PixelArraySize\" (effectively we would\nneed to set the offset to 0 in this case to comply with the docs.) But\nthen we'd need the above mentioned PixelArray property to get the offset\nin physical world.  I don't know how right or wrong other platforms are\n(especially Rpi), but it ties into the rectangles discussion.\n\nSo question is: Merge this in even though it is as wrong as rkisp1 or\nclarify the proper behavior first (I have a slight hope that other\nplatforms do the same mistake as rkisp1) and we could change the docs to\nsay ScalerCrop references the physical array...\n\n[1] https://docs.libcamera.org/master/internal-api/namespacelibcamera_1_1properties.html#aac88aeb6478c1f8528cc08521486dae3 \n[2] https://docs.libcamera.org/master/internal-api/namespacelibcamera_1_1properties.html#acec5675f79b6c456aca72c7532a263a4\n\n> \n> With this series, it's possible to view the bounding rectangles and crop\n> positions of the selected modes in camshark.\n\nIn my sklug/next branch I reworked the rectangle drawing. It might make\nsense to double check with the current version. My expectation is that\nthe ScalerCrop is as big as PixelArraySize, but offset from it.\n\nBest regards,\nStefan\n\n> \n> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> ---\n> Kieran Bingham (2):\n>       pipeline: simple: Report ScalerCropMaximum camera property\n>       pipeline: simple: Report the ScalerCrop\n> \n>  src/libcamera/pipeline/simple/simple.cpp | 13 +++++++++++++\n>  1 file changed, 13 insertions(+)\n> ---\n> base-commit: 183e37362f57ff3ce7493abf0bc6f1b57b931f55\n> change-id: 20260507-kbingham-simple-scaler-crop-60b506e2bc4c\n> \n> Best regards,\n> -- \n> --\n> Kieran\n>","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 AA024BDCBC\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  2 Jun 2026 15:44:03 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8833263138;\n\tTue,  2 Jun 2026 17:44:02 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 934FF61754\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  2 Jun 2026 17:44:00 +0200 (CEST)","from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:a238:bd09:2239:cb8b])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 2927A78C;\n\tTue,  2 Jun 2026 17:43:37 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"tOLSr3pH\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1780415017;\n\tbh=sa+Z+R2WL02R4hfWMcGfciYdPnCNv45xxvJY1GHAboM=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=tOLSr3pH7o8huR1PNMIHBEGBpky7vj0frmHMcucLVvkAgQF2myyUtZA4jF9vUEIDb\n\tGJyPdpjjMqFd2rgGUqC9dfFemJ+tvxIdN9GVq2w9MBzR/T4QrjEmL+tVk9TXkwdn3X\n\t/Z0hswG+40wZ1Kt9D7WBQNQHaN+U/okDlohWJ5rU=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20260507-kbingham-simple-scaler-crop-v1-0-7a5af1948565@ideasonboard.com>","References":"<20260507-kbingham-simple-scaler-crop-v1-0-7a5af1948565@ideasonboard.com>","Subject":"Re: [PATCH 0/2] pipeline: simple: Add ScalerCrop reporting","From":"Stefan Klug <stefan.klug@ideasonboard.com>","Cc":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Tue, 02 Jun 2026 17:43:57 +0200","Message-ID":"<178041503794.66229.14626181372145996771@localhost>","User-Agent":"alot/0.12.dev43+g2cacc0d03","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>"}},{"id":39585,"web_url":"https://patchwork.libcamera.org/comment/39585/","msgid":"<178332590682.292172.5112551617240736047@neptunite.rasen.tech>","date":"2026-07-06T08:18:26","subject":"Re: [PATCH 0/2] pipeline: simple: Add ScalerCrop reporting","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"content":"Hi Kieran,\n\nQuoting Kieran Bingham (2026-05-08 00:25:32)\n> While the Simple Pipeline handler doesn't support ScalerCrop, it can be\n> beneficial to report the ScalerCropMaximum and the ScalerCrop metadata\n> anyway as applications can use this information to determine the\n> positioning of the pixels captured in respect to the active area.\n\nI wrote three versions of this reply arguing with myself and I think I've\nfinally reached a conclusion. I'll document all three of my thoughts for\nposterity...\n\nThe first gut feeling is that this feels like a hack. I was going to reference\nthe ScalerCrop documentation but it only mentions what happens to it as a\ncontrol, and not what happens to it as metadata.\n\nRegardless, it feels like this conflates ScalerCrop as \"the metadata that\ndescribes what scaling and cropping was applied by the pipeline\" with \"metadata\nto describe the sensor crop\". It's still useful information to report, but it\nmight be better in a different property.\n\nWell, I suppose if ScalerCrop can be implemented completely by sensor scaling\nor cropping then maybe this could work as-is... But hold on, the libcamera\nScalerCrop is defined as being relative to PixelArrayActiveAreas. So it's a\ncombination of all scaling and cropping done in the *entire pipeline*,\nincluding the sensor.\n\nIf there are multiple points in the pipeline where scaling and cropping are\ndone, then they are all summed together into the final ScalerCrop metadata; in\nthe case of the control then it would be split into each portion of the\npipeline that does part of the scaler crop. And currently many sensors have a\ncrop in them already (depending on the \"best resolution\") and we have to take\ninto account the sensor crop to adjust the ScalerCrop control/metadata compared\nto what is done by other components in the pipeline.\n\nSo in conclusion I think it is actually fair to use the ScalerCrop for this\npurpose. It won't be available as a control as it's not controlable, but the\nsensor crop is indeed *a part of the pipeline* in which \"scaling or cropping\"\nis done relative to PixelArrayActiveAreas.\n\nWe'll need to update the control documentation to cover nuances in the metadata\ncase though.\n\n\nPaul\n\n> \n> This series reports the AnalogCrop as the ScalerCropMaximum in the\n> camera properties, and also as the the ScalerCrop in each completed\n> frame metadata.\n> \n> I'm curious on opinions if we should have more specific names for\n> reporting this metadata when theres' not actually a ScalerCrop\n> involved... \n> \n> With this series, it's possible to view the bounding rectangles and crop\n> positions of the selected modes in camshark.\n> \n> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> ---\n> Kieran Bingham (2):\n>       pipeline: simple: Report ScalerCropMaximum camera property\n>       pipeline: simple: Report the ScalerCrop\n> \n>  src/libcamera/pipeline/simple/simple.cpp | 13 +++++++++++++\n>  1 file changed, 13 insertions(+)\n> ---\n> base-commit: 183e37362f57ff3ce7493abf0bc6f1b57b931f55\n> change-id: 20260507-kbingham-simple-scaler-crop-60b506e2bc4c\n> \n> Best regards,\n> -- \n> --\n> Kieran\n>","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 CAFA8BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  6 Jul 2026 08:18:36 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id DCC2B6601A;\n\tMon,  6 Jul 2026 10:18:35 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DE96C65EFF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  6 Jul 2026 10:18:33 +0200 (CEST)","from neptunite.rasen.tech (unknown\n\t[IPv6:2404:7a81:160:2100:172d:69a4:1f4a:e2])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 1CF3433D;\n\tMon,  6 Jul 2026 10:17:44 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"IPXDhdqK\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1783325865;\n\tbh=iAb9kkYYMfTk5WqS1zIhNQesuwws2PTP24YITT2VrOI=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=IPXDhdqKzHbul6lX7XOxlqCfLOiSbeSFeXS3bDhkzDPfxO6i07sVxgTnFYGWjQ9Gm\n\teNCMuVEyzbhFZ8ln6n9NcTdsv4ffh4qFkzMeLdT4ASQt3DtcCKH338166/uebA+q3V\n\tBdjI3an1EYuXxbyZ2XPPGsGR7HKd49t4vBrWXqSo=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20260507-kbingham-simple-scaler-crop-v1-0-7a5af1948565@ideasonboard.com>","References":"<20260507-kbingham-simple-scaler-crop-v1-0-7a5af1948565@ideasonboard.com>","Subject":"Re: [PATCH 0/2] pipeline: simple: Add ScalerCrop reporting","From":"Paul Elder <paul.elder@ideasonboard.com>","Cc":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Mon, 06 Jul 2026 17:18:26 +0900","Message-ID":"<178332590682.292172.5112551617240736047@neptunite.rasen.tech>","User-Agent":"alot/0.0.0","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>"}}]