[{"id":13646,"web_url":"https://patchwork.libcamera.org/comment/13646/","msgid":"<20201109124405.GC88486@oden.dyn.berto.se>","date":"2020-11-09T12:44:05","subject":"Re: [libcamera-devel] [PATCH 3/4] libcamera: camera_sensor:\n\tInitialize PixelArray properties","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:46 +0100, Jacopo Mondi wrote:\n> Initialize pixel array properties 'PixelArraySize' and\n> 'PixelArrayActiveArea' inspecting the V4L2 CROP_BOUNDS and CROP_DEFAULT\n> selection targets.\n> \n> The properties are registered only if the sensor subdevice support\n> the above mentioned selection targets.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\n> ---\n>  src/libcamera/camera_sensor.cpp | 22 ++++++++++++++++++++++\n>  1 file changed, 22 insertions(+)\n> \n> diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\n> index 49b0a026125c..266ed7e9238e 100644\n> --- a/src/libcamera/camera_sensor.cpp\n> +++ b/src/libcamera/camera_sensor.cpp\n> @@ -288,6 +288,28 @@ int CameraSensor::initProperties()\n>  \t\tpropertyValue = 0;\n>  \tproperties_.set(properties::Rotation, propertyValue);\n>  \n> +\tRectangle bounds{};\n> +\tret = subdev_->getSelection(pad_, V4L2_SEL_TGT_CROP_BOUNDS, &bounds);\n> +\tif (!ret) {\n> +\t\tproperties_.set(properties::PixelArraySize,\n> +\t\t\t\tSize(bounds.width, bounds.height));\n> +\t}\n> +\n> +\tRectangle crop{};\n> +\tret = subdev_->getSelection(pad_, V4L2_SEL_TGT_CROP_DEFAULT, &crop);\n> +\tif (!ret) {\n> +\t\t/*\n> +\t\t * V4L2_SEL_TGT_CROP_DEFAULT and V4L2_SEL_TGT_CROP_BOUNDS are\n> +\t\t * defined relatively to the sensor native pixel array size,\n> +\t\t * while properties::PixelArrayActiveAreas is defined relatively\n> +\t\t * to properties::PixelArraySize. Adjust them\n> +\t\t */\n> +\t\tcrop.x -= bounds.x;\n> +\t\tcrop.y -= bounds.y;\n> +\t\tproperties_.set(properties::PixelArrayActiveAreas,\n> +\t\t\t\t{ crop });\n> +\t}\n> +\n>  \treturn 0;\n>  }\n>  \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 13CC1BDB89\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  9 Nov 2020 12:44:08 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D652763077;\n\tMon,  9 Nov 2020 13:44:07 +0100 (CET)","from mail-lf1-x143.google.com (mail-lf1-x143.google.com\n\t[IPv6:2a00:1450:4864:20::143])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6330761E57\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  9 Nov 2020 13:44:07 +0100 (CET)","by mail-lf1-x143.google.com with SMTP id e27so12188596lfn.7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 09 Nov 2020 04:44:07 -0800 (PST)","from localhost (h-209-203.A463.priv.bahnhof.se. [155.4.209.203])\n\tby smtp.gmail.com with ESMTPSA id\n\to23sm1740124lfl.285.2020.11.09.04.44.05\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 09 Nov 2020 04:44:06 -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=\"RiyeDJKP\"; 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=yapCGy1K79enh1SmNReJ1g/0UUbxwXTha3W+YsOERjY=;\n\tb=RiyeDJKPdF+G3n+MJy8L0e3fQ62nTEwLos4OLnKEii9+aKV/9vpGC9t4hi7xeiYwlC\n\tRbL+pqDHVK4+5LXGlGfrTuHj0Ynwr5eSW5Ja7gkbptd1uIezTNFb/s0G0OzMDLooFvka\n\t5yu7JyaKWISgJMpGhA+ygEfNySeSewk+e6ClgwLhRXKjhfAKsONhWXuaYLREHZarXxS7\n\tYrckQN1ewh0L8YSJF8R0agy4EkALkBbhAfrW12EUhE2k6V/zfpaKyJLFrMRADm3NSTJA\n\tbL5o5Ev+9kzOuR1ZiO/i1QxHJKQMerf3Ht07V9hUfx8ZWr5wGllCr+pli4Ix58HHXZNq\n\tr3AA==","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=yapCGy1K79enh1SmNReJ1g/0UUbxwXTha3W+YsOERjY=;\n\tb=OqD7XzpJmVIn2zzvJOcTvZHBLTNxYNUjT9e235SPQAG74/ee3zlORodckBJlRRFjFC\n\tpyy26OBDrwBQoy1fkC+878148oRj0x1DXGzzN4m8o0sZpXChatum7ImRtgzXVuam0qEo\n\tWfzcOt8VXL0Cuz3JMU7U9R+eF4TVd+F32dURES37ebmu3NSVVIrkCq7fUDLUN+CFv+il\n\tWdpyiQknAc00nee8ln9AyV8JxLVQy+tIcxyXI++S1lacIfaADHCBB0TnCg0eWBl4S1C5\n\tvfG55i503PbqPdlrUp7koq6VVUAZNGpQPIQ3kjDoIVsZ9+96BqcPI2To0e5wT63Hf2qt\n\tbDmw==","X-Gm-Message-State":"AOAM532H+9ug7BerYSYWk0VF38edGC0nvdsOw0gBTLqhTVqtWZ18QOFe\n\td1ASlPEknTAZhXjvRjWuJRaCaA==","X-Google-Smtp-Source":"ABdhPJxsHOpCc8iURo4nv7lgLU/3JIWUeTR0+T8eyQtFn0g40eSNb60HlcMGJoi8J8uZCmOP+r+pFg==","X-Received":"by 2002:a19:7409:: with SMTP id v9mr6107562lfe.402.1604925846884;\n\tMon, 09 Nov 2020 04:44:06 -0800 (PST)","Date":"Mon, 9 Nov 2020 13:44:05 +0100","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Jacopo Mondi <jacopo@jmondi.org>","Message-ID":"<20201109124405.GC88486@oden.dyn.berto.se>","References":"<20201106154947.261132-1-jacopo@jmondi.org>\n\t<20201106154947.261132-4-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20201106154947.261132-4-jacopo@jmondi.org>","Subject":"Re: [libcamera-devel] [PATCH 3/4] libcamera: camera_sensor:\n\tInitialize PixelArray properties","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":14027,"web_url":"https://patchwork.libcamera.org/comment/14027/","msgid":"<20201201190103.GX4569@pendragon.ideasonboard.com>","date":"2020-12-01T19:01:03","subject":"Re: [libcamera-devel] [PATCH 3/4] libcamera: camera_sensor:\n\tInitialize PixelArray properties","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:46PM +0100, Jacopo Mondi wrote:\n> Initialize pixel array properties 'PixelArraySize' and\n> 'PixelArrayActiveArea' inspecting the V4L2 CROP_BOUNDS and CROP_DEFAULT\n\ns/Area/Areas/\ns/inspecting/by inspecting/\n\n> selection targets.\n> \n> The properties are registered only if the sensor subdevice support\n> the above mentioned selection targets.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  src/libcamera/camera_sensor.cpp | 22 ++++++++++++++++++++++\n>  1 file changed, 22 insertions(+)\n> \n> diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\n> index 49b0a026125c..266ed7e9238e 100644\n> --- a/src/libcamera/camera_sensor.cpp\n> +++ b/src/libcamera/camera_sensor.cpp\n> @@ -288,6 +288,28 @@ int CameraSensor::initProperties()\n>  \t\tpropertyValue = 0;\n>  \tproperties_.set(properties::Rotation, propertyValue);\n>  \n> +\tRectangle bounds{};\n\nThe default constructor initializes all members to 0, you can drop {}.\nSame below.\n\n> +\tret = subdev_->getSelection(pad_, V4L2_SEL_TGT_CROP_BOUNDS, &bounds);\n> +\tif (!ret) {\n> +\t\tproperties_.set(properties::PixelArraySize,\n> +\t\t\t\tSize(bounds.width, bounds.height));\n\nYou could use bounds.size().\n\n> +\t}\n\nNo need for curly braces.\n\n> +\n> +\tRectangle crop{};\n> +\tret = subdev_->getSelection(pad_, V4L2_SEL_TGT_CROP_DEFAULT, &crop);\n> +\tif (!ret) {\n> +\t\t/*\n> +\t\t * V4L2_SEL_TGT_CROP_DEFAULT and V4L2_SEL_TGT_CROP_BOUNDS are\n> +\t\t * defined relatively to the sensor native pixel array size,\n> +\t\t * while properties::PixelArrayActiveAreas is defined relatively\n> +\t\t * to properties::PixelArraySize. Adjust them\n\ns/them/them./\n\nOr actually should it be \"it\", or \"the former\" ? You only adjust\nPixelArrayActiveAreas.\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> +\t\t */\n> +\t\tcrop.x -= bounds.x;\n> +\t\tcrop.y -= bounds.y;\n> +\t\tproperties_.set(properties::PixelArrayActiveAreas,\n> +\t\t\t\t{ crop });\n> +\t}\n> +\n>  \treturn 0;\n>  }\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 28368BE177\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  1 Dec 2020 19:01:14 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A25BE63503;\n\tTue,  1 Dec 2020 20:01:13 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0397663460\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  1 Dec 2020 20:01:12 +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 3A24BDBD;\n\tTue,  1 Dec 2020 20:01:12 +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=\"HtNGpf0D\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1606849272;\n\tbh=pJBfGdGad3sKWUtVCSOOAspdZdfjBIaA7VcCRl8GeGc=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=HtNGpf0DO29BbOPtRS4KJ3mMEfOXAAsUtJJEB/6cUCvUDz+ra9DiEVQR/+SRcmu0A\n\tzB7bNe6yfGJl4Y8GhFrAdV048WapK760SRHoPNdbMhCF8QsgmfHqV+FKjL6VT31V8c\n\tGl5QaUPy5PvVQR9jSmOJ81UiVi4jFLWjbsQuA77k=","Date":"Tue, 1 Dec 2020 21:01:03 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Message-ID":"<20201201190103.GX4569@pendragon.ideasonboard.com>","References":"<20201106154947.261132-1-jacopo@jmondi.org>\n\t<20201106154947.261132-4-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20201106154947.261132-4-jacopo@jmondi.org>","Subject":"Re: [libcamera-devel] [PATCH 3/4] libcamera: camera_sensor:\n\tInitialize PixelArray properties","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>"}}]