[{"id":13644,"web_url":"https://patchwork.libcamera.org/comment/13644/","msgid":"<20201109124242.GA88486@oden.dyn.berto.se>","date":"2020-11-09T12:42:42","subject":"Re: [libcamera-devel] [PATCH 1/4] libcamera: camera_sensor: Adjust\n\tCameraSensorInfo::analogCrop","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Jacopo,\n\nThanks for your work.\n\nOn 2020-11-06 16:49:44 +0100, Jacopo Mondi wrote:\n> The CameraSensorInfo::analogCrop top-left corner is defined relatively\n> to the sensor active area.\n> \n> The analogCrop rectangle is constucted by retrieving the V4L2\n> selection target V4L2_SEL_TGT_CROP which is instead defined relatively\n> to the whole sensor's pixel array size.\n> \n> Adjust the the analogCrop rectangle subtracting from its top-left corner\n> the active area distance from the full pixel array.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\n> \n> ---\n> This patch depends on the upstreaming of\n> \"media: i2c: imx219: Selection compliance fixes\" in mainline Linux\n\nI assume this patch do not depend on this fix as this implements the \ncorrect behavior in libcamera. But libcamera using an IMX219 sensor will \nbe broken without the upstream fix?\n\n> ---\n>  src/libcamera/camera_sensor.cpp | 9 +++++++++\n>  1 file changed, 9 insertions(+)\n> \n> diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\n> index 935de528c496..2af0b0a8db52 100644\n> --- a/src/libcamera/camera_sensor.cpp\n> +++ b/src/libcamera/camera_sensor.cpp\n> @@ -526,6 +526,15 @@ int CameraSensor::sensorInfo(CameraSensorInfo *info) const\n>  \t\t\t<< \"the camera sensor does not report the crop rectangle\";\n>  \t\treturn ret;\n>  \t}\n> +\t/*\n> +\t * CameraSensorInfo::analogCrop::x and CameraSensorInfo::analogCrop::y\n> +\t * are defined in respect to the active pixel area, while V4L2's\n> +\t * TGT_CROP target is defined in respect to the native pixel array.\n> +\t *\n> +\t * Compensate it subtracting the active areas offset.\n> +\t */\n> +\tinfo->analogCrop.x -= rect.x;\n> +\tinfo->analogCrop.y -= rect.y;\n>  \n>  \t/* The bit depth and image size depend on the currently applied format. */\n>  \tV4L2SubdeviceFormat format{};\n> -- \n> 2.29.1\n> \n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","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 2D278BE082\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  9 Nov 2020 12:42:46 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A026263079;\n\tMon,  9 Nov 2020 13:42:45 +0100 (CET)","from mail-lj1-x244.google.com (mail-lj1-x244.google.com\n\t[IPv6:2a00:1450:4864:20::244])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C7B1C61E57\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  9 Nov 2020 13:42:44 +0100 (CET)","by mail-lj1-x244.google.com with SMTP id s9so8362553ljo.11\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 09 Nov 2020 04:42:44 -0800 (PST)","from localhost (h-209-203.A463.priv.bahnhof.se. [155.4.209.203])\n\tby smtp.gmail.com with ESMTPSA id\n\tw3sm2167135ljj.113.2020.11.09.04.42.42\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 09 Nov 2020 04:42:43 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=ragnatech-se.20150623.gappssmtp.com\n\theader.i=@ragnatech-se.20150623.gappssmtp.com\n\theader.b=\"XsqxofI0\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ragnatech-se.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:content-transfer-encoding:in-reply-to;\n\tbh=ok4hfgqIbwZVQezDnXhMMskNGWpJrbd46g0G+7vk8xs=;\n\tb=XsqxofI0f8Wf/6l5nagl/94v5at5i0/D923z1Jx89+NnptucO6VLlbKk11FywW45NN\n\tAZ+aGN568o/5QTREQj6GKEVb3t2VDLFaVNjCr16Agp9rljFmxaLzBwA41b0ukvSGjIKX\n\ti8ZqsJmQw0B/gGHs6S3r5rkuXtcU0MOprWESKrka42G4fudhnkpzBCt9g8ykDOI791HW\n\tMYch/WWfU5TdtKHayoAnijbnUHJdzFPGZNR8k0Op79x0RpJT1WDZ6D1WW67yDNgOmbp7\n\tqWzhbkoQqNsp6xa+d3iBlJyjnULmTkwWr1kQPUcaRfVmv7dnCa/6kzX0K2z+9/NdcDlz\n\tFVSw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:content-transfer-encoding\n\t:in-reply-to;\n\tbh=ok4hfgqIbwZVQezDnXhMMskNGWpJrbd46g0G+7vk8xs=;\n\tb=LIW3A5PjJNVMHr6OlvrjQrevvDNQiMr5O4taRwDWGtgYXI81NaBsFKIKGVGNp++Mr4\n\tOwmaBXeXSafEFmU1lRcHCJ637xGMfxMTrUWzcHYqIkPOkCc0Bb6Q3A29FJnyb9uO7b9/\n\tEM8XAvwaAdZb0IyckAiGvJ3JvrHQo4QUelQbpdkrgC5rcVWt96Kq75AQ3QutA2ysTBLe\n\t6Fze2ldZMWFGx7gWsqcBkCNgW7yS3gbUGn4DS7E2HrrexMGtgEnQWz2hpo+y7Yyberak\n\t+sJ9JmAOu0tr+XZ7F+Lcpk5nn2LCzudRdr8P0zqOfzPfFchDac+x9P6GLuFFyNO7JVYG\n\tLNag==","X-Gm-Message-State":"AOAM530CPk6bH7Ext2FFbpGuotdSqj2+ES0/YqmA0hJYs9D5EP/YNezJ\n\tjyNpy0l3LckYP4hBGzuf8UKapfL5rO8pbQ==","X-Google-Smtp-Source":"ABdhPJyIytWXvIca6Y+kFf/8Seas7069AF0Pqlk4W6B3LbkZyr+xu/2NVynbE1kG0A4ecUf+ithLOw==","X-Received":"by 2002:a2e:87c9:: with SMTP id v9mr6465542ljj.368.1604925763868;\n\tMon, 09 Nov 2020 04:42:43 -0800 (PST)","Date":"Mon, 9 Nov 2020 13:42:42 +0100","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Jacopo Mondi <jacopo@jmondi.org>","Message-ID":"<20201109124242.GA88486@oden.dyn.berto.se>","References":"<20201106154947.261132-1-jacopo@jmondi.org>\n\t<20201106154947.261132-2-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20201106154947.261132-2-jacopo@jmondi.org>","Subject":"Re: [libcamera-devel] [PATCH 1/4] libcamera: camera_sensor: Adjust\n\tCameraSensorInfo::analogCrop","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>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"iso-8859-1\"","Content-Transfer-Encoding":"quoted-printable","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":13999,"web_url":"https://patchwork.libcamera.org/comment/13999/","msgid":"<20201201111324.hconc2d2j2y5v45e@uno.localdomain>","date":"2020-12-01T11:13:24","subject":"Re: [libcamera-devel] [PATCH 1/4] libcamera: camera_sensor: Adjust\n\tCameraSensorInfo::analogCrop","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Niklas,\n        +Naush, Dave\n\nOn Mon, Nov 09, 2020 at 01:42:42PM +0100, Niklas Söderlund wrote:\n> Hi Jacopo,\n>\n> Thanks for your work.\n>\n> On 2020-11-06 16:49:44 +0100, Jacopo Mondi wrote:\n> > The CameraSensorInfo::analogCrop top-left corner is defined relatively\n> > to the sensor active area.\n> >\n> > The analogCrop rectangle is constucted by retrieving the V4L2\n> > selection target V4L2_SEL_TGT_CROP which is instead defined relatively\n> > to the whole sensor's pixel array size.\n> >\n> > Adjust the the analogCrop rectangle subtracting from its top-left corner\n> > the active area distance from the full pixel array.\n> >\n> > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n>\n> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n>\n> >\n> > ---\n> > This patch depends on the upstreaming of\n> > \"media: i2c: imx219: Selection compliance fixes\" in mainline Linux\n>\n> I assume this patch do not depend on this fix as this implements the\n> correct behavior in libcamera. But libcamera using an IMX219 sensor will\n> be broken without the upstream fix?\n\nCorrect. Libcamera with this patch applied and a kernel which does not\ninclude the above patch will report slightl incorrect sizes.\n\nThe patch has now been collected for 5.11, I'll make sure the same\nhits rpi's downstream.\n\nThanks\n  j\n\n>\n> > ---\n> >  src/libcamera/camera_sensor.cpp | 9 +++++++++\n> >  1 file changed, 9 insertions(+)\n> >\n> > diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\n> > index 935de528c496..2af0b0a8db52 100644\n> > --- a/src/libcamera/camera_sensor.cpp\n> > +++ b/src/libcamera/camera_sensor.cpp\n> > @@ -526,6 +526,15 @@ int CameraSensor::sensorInfo(CameraSensorInfo *info) const\n> >  \t\t\t<< \"the camera sensor does not report the crop rectangle\";\n> >  \t\treturn ret;\n> >  \t}\n> > +\t/*\n> > +\t * CameraSensorInfo::analogCrop::x and CameraSensorInfo::analogCrop::y\n> > +\t * are defined in respect to the active pixel area, while V4L2's\n> > +\t * TGT_CROP target is defined in respect to the native pixel array.\n> > +\t *\n> > +\t * Compensate it subtracting the active areas offset.\n> > +\t */\n> > +\tinfo->analogCrop.x -= rect.x;\n> > +\tinfo->analogCrop.y -= rect.y;\n> >\n> >  \t/* The bit depth and image size depend on the currently applied format. */\n> >  \tV4L2SubdeviceFormat format{};\n> > --\n> > 2.29.1\n> >\n> > _______________________________________________\n> > libcamera-devel mailing list\n> > libcamera-devel@lists.libcamera.org\n> > https://lists.libcamera.org/listinfo/libcamera-devel\n>\n> --\n> Regards,\n> Niklas Söderlund","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 B3A4CBE176\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  1 Dec 2020 11:13:21 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 44BB7634A3;\n\tTue,  1 Dec 2020 12:13:21 +0100 (CET)","from relay10.mail.gandi.net (relay10.mail.gandi.net\n\t[217.70.178.230])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6964D6032D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  1 Dec 2020 12:13:19 +0100 (CET)","from uno.localdomain (93-34-118-233.ip49.fastwebnet.it\n\t[93.34.118.233]) (Authenticated sender: jacopo@jmondi.org)\n\tby relay10.mail.gandi.net (Postfix) with ESMTPSA id E209B240006;\n\tTue,  1 Dec 2020 11:13:17 +0000 (UTC)"],"Date":"Tue, 1 Dec 2020 12:13:24 +0100","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Niklas =?utf-8?q?S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>,\n\tNaushir Patuck <naush@raspberrypi.com>, Dave Stevenson\n\t<dave.stevenson@raspberrypi.org>","Message-ID":"<20201201111324.hconc2d2j2y5v45e@uno.localdomain>","References":"<20201106154947.261132-1-jacopo@jmondi.org>\n\t<20201106154947.261132-2-jacopo@jmondi.org>\n\t<20201109124242.GA88486@oden.dyn.berto.se>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20201109124242.GA88486@oden.dyn.berto.se>","Subject":"Re: [libcamera-devel] [PATCH 1/4] libcamera: camera_sensor: Adjust\n\tCameraSensorInfo::analogCrop","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>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":14025,"web_url":"https://patchwork.libcamera.org/comment/14025/","msgid":"<20201201185050.GU4569@pendragon.ideasonboard.com>","date":"2020-12-01T18:50:50","subject":"Re: [libcamera-devel] [PATCH 1/4] libcamera: camera_sensor: Adjust\n\tCameraSensorInfo::analogCrop","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nThank you for the patch.\n\nOn Fri, Nov 06, 2020 at 04:49:44PM +0100, Jacopo Mondi wrote:\n> The CameraSensorInfo::analogCrop top-left corner is defined relatively\n> to the sensor active area.\n> \n> The analogCrop rectangle is constucted by retrieving the V4L2\n> selection target V4L2_SEL_TGT_CROP which is instead defined relatively\n> to the whole sensor's pixel array size.\n> \n> Adjust the the analogCrop rectangle subtracting from its top-left corner\n> the active area distance from the full pixel array.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> \n> ---\n> This patch depends on the upstreaming of\n> \"media: i2c: imx219: Selection compliance fixes\" in mainline Linux\n> ---\n>  src/libcamera/camera_sensor.cpp | 9 +++++++++\n>  1 file changed, 9 insertions(+)\n> \n> diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\n> index 935de528c496..2af0b0a8db52 100644\n> --- a/src/libcamera/camera_sensor.cpp\n> +++ b/src/libcamera/camera_sensor.cpp\n> @@ -526,6 +526,15 @@ int CameraSensor::sensorInfo(CameraSensorInfo *info) const\n>  \t\t\t<< \"the camera sensor does not report the crop rectangle\";\n>  \t\treturn ret;\n>  \t}\n\nI'd add a blank line here.\n\n> +\t/*\n> +\t * CameraSensorInfo::analogCrop::x and CameraSensorInfo::analogCrop::y\n> +\t * are defined in respect to the active pixel area, while V4L2's\n\ns/in respect/relatively/ ? (not sure, \"in respect\" sounds a bit weird to\nme here, but I could be wrong). Same on the next line.\n\n> +\t * TGT_CROP target is defined in respect to the native pixel array.\n\ns/native/full/ ? Not sure, I'm lost between the different terms and how\nthey're used differently in different contexts :-)\n\n> +\t *\n> +\t * Compensate it subtracting the active areas offset.\n\ns/it/it by/ ?\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> +\t */\n> +\tinfo->analogCrop.x -= rect.x;\n> +\tinfo->analogCrop.y -= rect.y;\n>  \n>  \t/* The bit depth and image size depend on the currently applied format. */\n>  \tV4L2SubdeviceFormat format{};","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 9632CBE177\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  1 Dec 2020 18:51:00 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 31AD363501;\n\tTue,  1 Dec 2020 19:51:00 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3853F63460\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  1 Dec 2020 19:50:59 +0100 (CET)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id A7514DBD;\n\tTue,  1 Dec 2020 19:50:58 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"KupKvCja\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1606848658;\n\tbh=ye2+6zt/gX1MRMUJollLrVLwYCNJ3CDMcZefrCNdLAw=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=KupKvCjaaVW/XJuMZtw4Ti43vHcpVmPX2IRhcvtm109ivKMB2ssWb/DEN6Vr3vzhY\n\tkHJ1yrmGi7FnSOZWoz5p1suyvSQQcF7SaiACo+B9N674cPVQjqCkv+uqDpxLfImfan\n\tgttcAe/ZF77WLIkp6XXMYiWL3fuoQx3SnPbcmK1s=","Date":"Tue, 1 Dec 2020 20:50:50 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Message-ID":"<20201201185050.GU4569@pendragon.ideasonboard.com>","References":"<20201106154947.261132-1-jacopo@jmondi.org>\n\t<20201106154947.261132-2-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20201106154947.261132-2-jacopo@jmondi.org>","Subject":"Re: [libcamera-devel] [PATCH 1/4] libcamera: camera_sensor: Adjust\n\tCameraSensorInfo::analogCrop","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>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]