Patch Detail
Show a patch.
GET /api/1.1/patches/10894/?format=api
{ "id": 10894, "url": "https://patchwork.libcamera.org/api/1.1/patches/10894/?format=api", "web_url": "https://patchwork.libcamera.org/patch/10894/", "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": "<20210119143711.153517-7-jacopo@jmondi.org>", "date": "2021-01-19T14:37:06", "name": "[libcamera-devel,v2,06/11] libcamera: ipu3: Register ScalerCrop control", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "e3db916f70a856a5c824f9ccb88b346b956fcfec", "submitter": { "id": 3, "url": "https://patchwork.libcamera.org/api/1.1/people/3/?format=api", "name": "Jacopo Mondi", "email": "jacopo@jmondi.org" }, "delegate": { "id": 15, "url": "https://patchwork.libcamera.org/api/1.1/users/15/?format=api", "username": "jmondi", "first_name": "Jacopo", "last_name": "Mondi", "email": "jacopo@jmondi.org" }, "mbox": "https://patchwork.libcamera.org/patch/10894/mbox/", "series": [ { "id": 1584, "url": "https://patchwork.libcamera.org/api/1.1/series/1584/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1584", "date": "2021-01-19T14:37:00", "name": "android: Exposure times + scaler crop + android metadata", "version": 2, "mbox": "https://patchwork.libcamera.org/series/1584/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/10894/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/10894/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 DF995BD808\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 19 Jan 2021 14:37:03 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id ADF5F6815F;\n\tTue, 19 Jan 2021 15:37:03 +0100 (CET)", "from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net\n\t[217.70.183.198])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A9B6E68140\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 19 Jan 2021 15:36:59 +0100 (CET)", "from uno.LocalDomain (93-61-96-190.ip145.fastwebnet.it\n\t[93.61.96.190]) (Authenticated sender: jacopo@jmondi.org)\n\tby relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 6F0F2C0007\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 19 Jan 2021 14:36:59 +0000 (UTC)" ], "X-Originating-IP": "93.61.96.190", "From": "Jacopo Mondi <jacopo@jmondi.org>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 19 Jan 2021 15:37:06 +0100", "Message-Id": "<20210119143711.153517-7-jacopo@jmondi.org>", "X-Mailer": "git-send-email 2.29.2", "In-Reply-To": "<20210119143711.153517-1-jacopo@jmondi.org>", "References": "<20210119143711.153517-1-jacopo@jmondi.org>", "MIME-Version": "1.0", "Subject": "[libcamera-devel] [PATCH v2 06/11] libcamera: ipu3: Register\n\tScalerCrop control", "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>", "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>" }, "content": "Register the ScalerCrop control in the ImgU pipeline handler computed\nby using the Viewfinder [1280x720] pipeline output configuration and\nthe sensor resolution as parameters.\n\nThe ScalerCrop control limits should be updated everytime a new\nconfiguration is applied to the sensor.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/libcamera/pipeline/ipu3/ipu3.cpp | 73 +++++++++++++++++++++++++++-\n 1 file changed, 71 insertions(+), 2 deletions(-)", "diff": "diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex f928af4d92a2..fc5592f33032 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -40,6 +40,7 @@ static constexpr unsigned int IMGU_OUTPUT_WIDTH_ALIGN = 64;\n static constexpr unsigned int IMGU_OUTPUT_HEIGHT_ALIGN = 4;\n static constexpr unsigned int IMGU_OUTPUT_WIDTH_MARGIN = 64;\n static constexpr unsigned int IMGU_OUTPUT_HEIGHT_MARGIN = 32;\n+static constexpr Size IPU3ViewfinderSize(1280, 720);\n \n static const ControlInfoMap::Map IPU3Controls = {\n \t{ &controls::draft::PipelineDepth, ControlInfo(2, 3) },\n@@ -376,7 +377,7 @@ CameraConfiguration *PipelineHandlerIPU3::generateConfiguration(Camera *camera,\n \t\t\t * capped to the maximum sensor resolution and aligned\n \t\t\t * to the ImgU output constraints.\n \t\t\t */\n-\t\t\tsize = sensorResolution.boundedTo({ 1280, 720 })\n+\t\t\tsize = sensorResolution.boundedTo(IPU3ViewfinderSize)\n \t\t\t\t\t .alignedDownTo(IMGU_OUTPUT_WIDTH_ALIGN,\n \t\t\t\t\t\t\t IMGU_OUTPUT_HEIGHT_ALIGN);\n \t\t\tpixelFormat = formats::NV12;\n@@ -745,7 +746,7 @@ bool PipelineHandlerIPU3::match(DeviceEnumerator *enumerator)\n */\n int PipelineHandlerIPU3::initControls(IPU3CameraData *data)\n {\n-\tconst CameraSensor *sensor = data->cio2_.sensor();\n+\tCameraSensor *sensor = data->cio2_.sensor();\n \tCameraSensorInfo sensorInfo{};\n \n \tint ret = sensor->sensorInfo(&sensorInfo);\n@@ -780,6 +781,74 @@ int PipelineHandlerIPU3::initControls(IPU3CameraData *data)\n \tcontrols[&controls::ExposureTime] = ControlInfo(minExposure, maxExposure,\n \t\t\t\t\t\t\tdefExposure);\n \n+\t/*\n+\t * Compute the scaler crop limits.\n+\t *\n+\t * \\todo The scaler crop limits depend on the sensor configuration. It\n+\t * should be updated when a new configuration is applied. To initialize\n+\t * the control use the 'Viewfinder' configuration (1280x720) as the\n+\t * pipeline output resolution and the full sensor size as input frame\n+\t * (see the todo note in the validate() function about the usage of the\n+\t * sensor's full frame as ImgU input).\n+\t */\n+\n+\t/* Re-fetch the sensor info updated to use the largest resolution. */\n+\tV4L2SubdeviceFormat sensorFormat;\n+\tsensorFormat.size = sensor->resolution();\n+\tret = sensor->setFormat(&sensorFormat);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tret = sensor->sensorInfo(&sensorInfo);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\t/*\n+\t * The maximum scaler crop rectangle is the analogue crop used to\n+\t * produce the maximum frame size.\n+\t */\n+\tconst Rectangle &analogueCrop = sensorInfo.analogCrop;\n+\tRectangle maxCrop = analogueCrop;\n+\n+\t/*\n+\t * As the ImgU cannot up-scale, the minimum selection rectangle has to\n+\t * be as large as the pipeline output size. Use the default viewfinder\n+\t * configuration as the desired output size and calculate the minimum\n+\t * rectangle required to satisfy the ImgU processing margins, unless the\n+\t * sensor resolution is smaller.\n+\t *\n+\t * \\todo This implementation is based on the same assumptions about the\n+\t * ImgU pipeline configuration described in then viewfinder and main\n+\t * output sizes calculation in the validate() function.\n+\t */\n+\n+\t/* The strictly smaller size than the sensor resolution, aligned to margins. */\n+\tSize minSize = Size(sensor->resolution().width - 1,\n+\t\t\t sensor->resolution().height - 1)\n+\t\t .alignedDownTo(IMGU_OUTPUT_WIDTH_MARGIN,\n+\t\t\t\t IMGU_OUTPUT_HEIGHT_MARGIN);\n+\n+\t/*\n+\t * Either the smallest margin-aligned size larger than the viewfinder\n+\t * size or the adjusted sensor resolution.\n+\t */\n+\tminSize = Size(IPU3ViewfinderSize.width + 1,\n+\t\t IPU3ViewfinderSize.height + 1)\n+\t\t .alignedUpTo(IMGU_OUTPUT_WIDTH_MARGIN,\n+\t\t\t IMGU_OUTPUT_HEIGHT_MARGIN)\n+\t\t .boundedTo(minSize);\n+\n+\t/*\n+\t * Re-scale in the sensor's native coordinates. Report (0,0) as\n+\t * top-left corner as we allow application to feely pan the crop area.\n+\t */\n+\tRectangle minCrop(minSize);\n+\tminCrop.scaledBy(analogueCrop.size(), sensorInfo.outputSize);\n+\tminCrop.x = 0;\n+\tminCrop.y = 0;\n+\n+\tcontrols[&controls::ScalerCrop] = ControlInfo(minCrop, maxCrop, maxCrop);\n+\n \tdata->controlInfo_ = std::move(controls);\n \n \treturn 0;\n", "prefixes": [ "libcamera-devel", "v2", "06/11" ] }