Show a patch.

GET /api/patches/8553/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 8553,
    "url": "https://patchwork.libcamera.org/api/patches/8553/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/8553/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/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": "<20200702105337.31161-2-david.plowman@raspberrypi.com>",
    "date": "2020-07-02T10:53:36",
    "name": "[libcamera-devel,1/2] libcamera: Implement digital zoom",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "ba0c207c88b52ccfcd1d9e2d8032f2a4d54166f6",
    "submitter": {
        "id": 42,
        "url": "https://patchwork.libcamera.org/api/people/42/?format=api",
        "name": "David Plowman",
        "email": "david.plowman@raspberrypi.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/8553/mbox/",
    "series": [
        {
            "id": 1072,
            "url": "https://patchwork.libcamera.org/api/series/1072/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1072",
            "date": "2020-07-02T10:53:35",
            "name": "Digital zoom implementation",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/1072/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/8553/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/8553/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 940B9BE905\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  2 Jul 2020 10:53:43 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 152AF60C5B;\n\tThu,  2 Jul 2020 12:53:43 +0200 (CEST)",
            "from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com\n\t[IPv6:2a00:1450:4864:20::32d])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1FA8F603B3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  2 Jul 2020 12:53:42 +0200 (CEST)",
            "by mail-wm1-x32d.google.com with SMTP id 17so27370479wmo.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 02 Jul 2020 03:53:42 -0700 (PDT)",
            "from pi4-davidp.lan (plowpeople3.plus.com. [80.229.223.72])\n\tby smtp.gmail.com with ESMTPSA id\n\tp25sm9768444wmg.39.2020.07.02.03.53.40\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 02 Jul 2020 03:53:41 -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=\"O4cuPLwe\"; 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=sVayGIGwKG3GvXC6jRhNzM2V+z4slLKJl0H3Fq3690s=;\n\tb=O4cuPLwezUAhQLyEcdhIQlMvnVz39O4WrYUTDWFAJFzfwTsNtjQq9IZdvE7m/vKjzG\n\tLQqMsAqg27rxxdSTTkFVoH/N5f7pBGBPsnpzgszOTr0wG1Il9fICSuUbVKYZaJjzZngE\n\tHqP1hnUlRx/kpwGjJEYXRgxIBMXfFIKnCP8yVOIvgO6iTbIDph5/2UO4zqh1gzQDXVvd\n\tW2c3ayTIHswX+KiWkZtdTZurt7dbaIoAPv3cQPA7ltC0jipfvIca9hyRJnvvQIV+IbH8\n\tMg8MBS2hhjT/xVc/Uorv5Z1UzgtV33a8iJFE/jlUYR4j+3wpedM9wBAwBISjT7kW1HHg\n\tGwcQ==",
        "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=sVayGIGwKG3GvXC6jRhNzM2V+z4slLKJl0H3Fq3690s=;\n\tb=IdcpeCbYB4nAkPBGVBj1k+tTo7f57jmcxHxjcXuBT7Jhc5scACfxfexYS5JfzKoBPZ\n\teJwK9m7Q2KlOFsrpFa90t6umMaRxH5bT2tisuutj1V9IarZ/7hhyGj09a74y5nB0usHL\n\tMsBmYgwfjlVTZ1u26j6f127KXJFoPRPGrueG2oKvNuxFuC98+whWVcICDzmaP1TC9ZGM\n\tFXAxo2ElrEZ8bP3ICLumzm/Rz4CcPjp2e9Q0mZEL91PFzeHeJKIVcEKhiSWgbdF0mzFI\n\tUVg36aykqWZ4aW6sXocpfiBerCeRdN860Hy4uCsbHT8iz6sszsHJE/S/pMbKHu5N1i7x\n\teohw==",
        "X-Gm-Message-State": "AOAM530kah4WYLoWrz/1Al8564SkL8fSp6a6Myz5Wf9PDVen4mEyybX4\n\tTuCgbybFGWv8EmkhO5xwxVJl5gWEETE=",
        "X-Google-Smtp-Source": "ABdhPJyMJJ0fOTfUQw1cpJtt1W5AdoKJ2/8LoqAL1PIh9XIxsX6AJKsgY/lOo4Lpie1mDTkq8Eoqtg==",
        "X-Received": "by 2002:a1c:f003:: with SMTP id\n\ta3mr30549703wmb.119.1593687221529; \n\tThu, 02 Jul 2020 03:53:41 -0700 (PDT)",
        "From": "David Plowman <david.plowman@raspberrypi.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Thu,  2 Jul 2020 11:53:36 +0100",
        "Message-Id": "<20200702105337.31161-2-david.plowman@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.20.1",
        "In-Reply-To": "<20200702105337.31161-1-david.plowman@raspberrypi.com>",
        "References": "<20200702105337.31161-1-david.plowman@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH 1/2] libcamera: Implement digital zoom",
        "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": "These changes add a Digital Zoom control, tacking a rectangle as its\nargument, indicating the region of the sensor output that will be\nzoomed up to the final output size.\n\nAdditionally, we need have a method returning the \"sensorCrop\" which\ngives the dimensions of the sensor output within which we can pan and\nzoom.\n---\n include/libcamera/camera.h                    |  2 ++\n include/libcamera/internal/pipeline_handler.h |  4 +++\n src/libcamera/camera.cpp                      | 26 +++++++++++++++++++\n src/libcamera/control_ids.yaml                | 10 +++++++\n 4 files changed, 42 insertions(+)",
    "diff": "diff --git a/include/libcamera/camera.h b/include/libcamera/camera.h\nindex 9c0e58f..d57b606 100644\n--- a/include/libcamera/camera.h\n+++ b/include/libcamera/camera.h\n@@ -92,6 +92,8 @@ public:\n \tstd::unique_ptr<CameraConfiguration> generateConfiguration(const StreamRoles &roles);\n \tint configure(CameraConfiguration *config);\n \n+\tSize const &getSensorCrop() const;\n+\n \tRequest *createRequest(uint64_t cookie = 0);\n \tint queueRequest(Request *request);\n \ndiff --git a/include/libcamera/internal/pipeline_handler.h b/include/libcamera/internal/pipeline_handler.h\nindex 22e629a..37e069a 100644\n--- a/include/libcamera/internal/pipeline_handler.h\n+++ b/include/libcamera/internal/pipeline_handler.h\n@@ -89,6 +89,8 @@ public:\n \n \tconst char *name() const { return name_; }\n \n+\tSize const &getSensorCrop() const { return sensorCrop_; }\n+\n protected:\n \tvoid registerCamera(std::shared_ptr<Camera> camera,\n \t\t\t    std::unique_ptr<CameraData> data);\n@@ -100,6 +102,8 @@ protected:\n \n \tCameraManager *manager_;\n \n+\tSize sensorCrop_;\n+\n private:\n \tvoid mediaDeviceDisconnected(MediaDevice *media);\n \tvirtual void disconnect();\ndiff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp\nindex 69a1b44..6614c93 100644\n--- a/src/libcamera/camera.cpp\n+++ b/src/libcamera/camera.cpp\n@@ -793,6 +793,32 @@ int Camera::configure(CameraConfiguration *config)\n \treturn 0;\n }\n \n+/**\n+ * \\brief Return the size of the sensor image being used to form the output\n+ *\n+ * This method returns the size, in pixels, of the raw image read from the\n+ * sensor and which is used to form the output image(s). Note that these\n+ * values take account of any cropping performed on the sensor output so\n+ * as to produce the correct aspect ratio. It would normally be necessary\n+ * to retrieve these values in order to calculate correct parameters for\n+ * digital zoom.\n+ *\n+ * Example: a sensor mode may produce a 1920x1440 output image. But if an\n+ * application has requested a 16:9 image, the values returned here would\n+ * be 1920x1080 - the largest portion of the sensor output that provides\n+ * the correct aspect ratio.\n+ *\n+ * \\context This function is \\threadsafe. It will only return valid\n+ * (non-zero) values when the camera has been configured.\n+ *\n+ * \\return The dimensions of the sensor image in use.\n+ */\n+\n+Size const &Camera::getSensorCrop() const\n+{\n+\treturn p_->pipe_->getSensorCrop();\n+}\n+\n /**\n  * \\brief Create a request object for the camera\n  * \\param[in] cookie Opaque cookie for application use\ndiff --git a/src/libcamera/control_ids.yaml b/src/libcamera/control_ids.yaml\nindex 8c3e4c7..ac72e2a 100644\n--- a/src/libcamera/control_ids.yaml\n+++ b/src/libcamera/control_ids.yaml\n@@ -251,4 +251,14 @@ controls:\n         higher than anyone could reasonably want. Negative values are\n         not allowed. Note also that sharpening is not applied to raw\n         streams.\n+\n+  - DigitalZoom:\n+      type: Rectangle\n+      description: |\n+        Sets the portion of the full sensor image, in pixels, that will be\n+        used for digital zoom. That is, this part of the sensor output will\n+        be scaled up to make the full size output image (and everything else\n+        discarded). To obtain the \"full sensor image\" that is available, the\n+        method Camera::getOutputCrop() should be called once the camera is\n+        configured. An application may pan and zoom within this rectangle.\n ...\n",
    "prefixes": [
        "libcamera-devel",
        "1/2"
    ]
}