Patch Detail
Show a patch.
GET /api/1.1/patches/9827/?format=api
{ "id": 9827, "url": "https://patchwork.libcamera.org/api/1.1/patches/9827/?format=api", "web_url": "https://patchwork.libcamera.org/patch/9827/", "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": "<20200925085127.17214-7-david.plowman@raspberrypi.com>", "date": "2020-09-25T08:51:27", "name": "[libcamera-devel,v2,6/6] cam: Add command line option to test IspCrop control", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "b63b0c79eb1ba68b5b29035e9cce989cc435d254", "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/9827/mbox/", "series": [ { "id": 1326, "url": "https://patchwork.libcamera.org/api/1.1/series/1326/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1326", "date": "2020-09-25T08:51:21", "name": "Digital zoom", "version": 2, "mbox": "https://patchwork.libcamera.org/series/1326/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/9827/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/9827/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 64059C3B5E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 25 Sep 2020 08:51:41 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2DEE76303E;\n\tFri, 25 Sep 2020 10:51:41 +0200 (CEST)", "from mail-wm1-x335.google.com (mail-wm1-x335.google.com\n\t[IPv6:2a00:1450:4864:20::335])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9E49363043\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 25 Sep 2020 10:51:37 +0200 (CEST)", "by mail-wm1-x335.google.com with SMTP id w2so2221739wmi.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 25 Sep 2020 01:51:37 -0700 (PDT)", "from pi4-davidp.lan (plowpeople3.plus.com. [80.229.223.72])\n\tby smtp.gmail.com with ESMTPSA id\n\tn4sm2001383wrp.61.2020.09.25.01.51.36\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 25 Sep 2020 01:51:36 -0700 (PDT)" ], "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=\"Cb82YblN\"; 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:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=9KYLEfSfm9lWEFuKcyq5x/Li6dFc8LJrxWJSayBldfI=;\n\tb=Cb82YblNKMLHsJN7E+MsJO2HH5L4PwnOcJ7U6T6MBYzDfjJy4tqBjkVVr51YQoOhFz\n\tr38bL6xvUYPq6yza8IkA6dJu8uv09goGUg8g7cD1boMm+NnxKNyh4pgPs3Pv/fsLiJxe\n\t42XwWPQyum60T5F4YJqHlJdnmDjO4c/zSO/PShcbDIkcKr5UAPninXc0aIAPlQv+CIrL\n\tM8GGRklycQomD+P9UKJ3vzI1sXodQLj/RyZDS30cWX7W2/7E3VhJbGv+kbGGGqLmS5+R\n\tx3Qk3XkAu5Yd0nB4OYulwcZ90KdsYu7thI8MvIxgw4IADFXimiVwvNSD3P0mXhAUSdn0\n\tVnzg==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=9KYLEfSfm9lWEFuKcyq5x/Li6dFc8LJrxWJSayBldfI=;\n\tb=lvvLNLq+gUjgezfY697H0BunU9APC9yOKi7yPsFWHtjgbcmCDbyMbDf3pg4/Isj7gW\n\t6nlfOyfv3UV/AmgNcxoQCWCMDwfsnsGyipOfc4mFZN+uTL71RsCVWvdTxSUdLPmZSHIj\n\tlmSWvKQ+1CFHOXbC2G6zYZgiJvuYM0vripYai+xPbQYHfkJ4kNCoJBH+OzKJpab/LfLb\n\tA7yKKRWHCodtmMiwEJ0taPqOXn82ff5SssVufkodhJalAL/EO57pD4fBIh2nPt6llaRL\n\tTxJr7L7V7uxTaAO2WaAnNEATd/1c2zav0HQDWmaEASKxlsZ1yx91bA5NuttcY6Dlysxb\n\tnUwA==", "X-Gm-Message-State": "AOAM532VuLasblP9wG1s+0nG4KoWeMvyrG58WTj4R8sOaQdDfwSlg9ko\n\tUI8qHMQCPrxSXYr7sdXa8ATJL3C67A6XZQ==", "X-Google-Smtp-Source": "ABdhPJyHeheRKX71RbD7I2gSCkSAyXoTs5oJaL1IC2UcFKL42FGNS0u/naPUhIH+ViwVC3ZRHDI65w==", "X-Received": "by 2002:a1c:740c:: with SMTP id\n\tp12mr1939475wmc.176.1601023897113; \n\tFri, 25 Sep 2020 01:51:37 -0700 (PDT)", "From": "David Plowman <david.plowman@raspberrypi.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Fri, 25 Sep 2020 09:51:27 +0100", "Message-Id": "<20200925085127.17214-7-david.plowman@raspberrypi.com>", "X-Mailer": "git-send-email 2.20.1", "In-Reply-To": "<20200925085127.17214-1-david.plowman@raspberrypi.com>", "References": "<20200925085127.17214-1-david.plowman@raspberrypi.com>", "MIME-Version": "1.0", "Subject": "[libcamera-devel] [PATCH v2 6/6] cam: Add command line option to\n\ttest IspCrop 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": "This allows the user to request digital zoom by adding, for example,\n\"-z 0.25,0.25,0.5,0.5\" which would give a 2x zoom, still centred in\nthe middle of the image.\n\nSigned-off-by: David Plowman <david.plowman@raspberrypi.com>\n---\n src/cam/capture.cpp | 25 +++++++++++++++++++++++--\n src/cam/capture.h | 2 +-\n src/cam/main.cpp | 3 +++\n src/cam/main.h | 1 +\n 4 files changed, 28 insertions(+), 3 deletions(-)", "diff": "diff --git a/src/cam/capture.cpp b/src/cam/capture.cpp\nindex 5510c00..3b50c59 100644\n--- a/src/cam/capture.cpp\n+++ b/src/cam/capture.cpp\n@@ -10,6 +10,9 @@\n #include <limits.h>\n #include <sstream>\n \n+#include <libcamera/control_ids.h>\n+#include <libcamera/property_ids.h>\n+\n #include \"capture.h\"\n #include \"main.h\"\n \n@@ -58,7 +61,7 @@ int Capture::run(const OptionsParser::Options &options)\n \n \tFrameBufferAllocator *allocator = new FrameBufferAllocator(camera_);\n \n-\tret = capture(allocator);\n+\tret = capture(allocator, options);\n \n \tif (options.isSet(OptFile)) {\n \t\tdelete writer_;\n@@ -70,7 +73,7 @@ int Capture::run(const OptionsParser::Options &options)\n \treturn ret;\n }\n \n-int Capture::capture(FrameBufferAllocator *allocator)\n+int Capture::capture(FrameBufferAllocator *allocator, const OptionsParser::Options &options)\n {\n \tint ret;\n \n@@ -120,6 +123,24 @@ int Capture::capture(FrameBufferAllocator *allocator)\n \t\trequests.push_back(request);\n \t}\n \n+\t/* Set up digital zoom if it was requested on the command line. */\n+\tif (options.isSet(OptZoom)) {\n+\t\tstd::string zoom = options[OptZoom].toString();\n+\t\tfloat x, y, width, height;\n+\n+\t\tif (sscanf(zoom.c_str(), \"%f,%f,%f,%f\", &x, &y, &width, &height) == 4) {\n+\t\t\tSize sensorArea = camera_->properties().get(properties::SensorOutputSize);\n+\t\t\tRectangle crop(x * sensorArea.width,\n+\t\t\t\t y * sensorArea.height,\n+\t\t\t\t width * sensorArea.width,\n+\t\t\t\t height * sensorArea.height);\n+\n+\t\t\trequests.front()->controls().set(controls::IspCrop, crop);\n+\t\t} else {\n+\t\t\tstd::cout << \"Invalid zoom values - ignoring\" << std::endl;\n+\t\t}\n+\t}\n+\n \tret = camera_->start();\n \tif (ret) {\n \t\tstd::cout << \"Failed to start capture\" << std::endl;\ndiff --git a/src/cam/capture.h b/src/cam/capture.h\nindex 0aebdac..5280616 100644\n--- a/src/cam/capture.h\n+++ b/src/cam/capture.h\n@@ -29,7 +29,7 @@ public:\n \n \tint run(const OptionsParser::Options &options);\n private:\n-\tint capture(libcamera::FrameBufferAllocator *allocator);\n+\tint capture(libcamera::FrameBufferAllocator *allocator, const OptionsParser::Options &options);\n \n \tvoid requestComplete(libcamera::Request *request);\n \ndiff --git a/src/cam/main.cpp b/src/cam/main.cpp\nindex 244720b..8f326d9 100644\n--- a/src/cam/main.cpp\n+++ b/src/cam/main.cpp\n@@ -201,6 +201,9 @@ int CamApp::parseOptions(int argc, char *argv[])\n \tparser.addOption(OptStrictFormats, OptionNone,\n \t\t\t \"Do not allow requested stream format(s) to be adjusted\",\n \t\t\t \"strict-formats\");\n+\tparser.addOption(OptZoom, OptionString,\n+\t\t\t \"Specify digital zoom by supplying IspCrop control as x,y,width,height e.g. 0.25,0.25,0.5,0.5\",\n+\t\t\t \"zoom\", ArgumentRequired, \"zoom\");\n \n \toptions_ = parser.parse(argc, argv);\n \tif (!options_.valid())\ndiff --git a/src/cam/main.h b/src/cam/main.h\nindex ea8dfd3..a1fd899 100644\n--- a/src/cam/main.h\n+++ b/src/cam/main.h\n@@ -17,6 +17,7 @@ enum {\n \tOptListProperties = 'p',\n \tOptMonitor = 'm',\n \tOptStream = 's',\n+\tOptZoom = 'z',\n \tOptListControls = 256,\n \tOptStrictFormats = 257,\n };\n", "prefixes": [ "libcamera-devel", "v2", "6/6" ] }