Show a patch.

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

{
    "id": 11104,
    "url": "https://patchwork.libcamera.org/api/patches/11104/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/11104/",
    "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": "<20210202123620.45200-1-jacopo@jmondi.org>",
    "date": "2021-02-02T12:36:20",
    "name": "[libcamera-devel] android: camera_device: Calculate MAX_JPEG_SIZE",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "e112c807dfc7ee2ce229bf83b2b05e5ea764d847",
    "submitter": {
        "id": 3,
        "url": "https://patchwork.libcamera.org/api/people/3/?format=api",
        "name": "Jacopo Mondi",
        "email": "jacopo@jmondi.org"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/11104/mbox/",
    "series": [
        {
            "id": 1637,
            "url": "https://patchwork.libcamera.org/api/series/1637/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1637",
            "date": "2021-02-02T12:36:20",
            "name": "[libcamera-devel] android: camera_device: Calculate MAX_JPEG_SIZE",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/1637/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/11104/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/11104/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 69100BD161\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  2 Feb 2021 12:36:05 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 08B7C68425;\n\tTue,  2 Feb 2021 13:36:05 +0100 (CET)",
            "from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net\n\t[217.70.183.199])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 748FC60307\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  2 Feb 2021 13:36:03 +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 relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 1F46BFF80F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  2 Feb 2021 12:36:02 +0000 (UTC)"
        ],
        "X-Originating-IP": "93.61.96.190",
        "From": "Jacopo Mondi <jacopo@jmondi.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Tue,  2 Feb 2021 13:36:20 +0100",
        "Message-Id": "<20210202123620.45200-1-jacopo@jmondi.org>",
        "X-Mailer": "git-send-email 2.30.0",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH] android: camera_device: Calculate\n\tMAX_JPEG_SIZE",
        "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": "Calculate the JPEG maximum size using the maximum preview format size\nmultiplied by a 1.5 factor.\n\nThe same multiplication factor is used in the existing HAL\nimplementation in ChromeOS.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/android/camera_device.cpp | 21 ++++++++++-----------\n 1 file changed, 10 insertions(+), 11 deletions(-)",
    "diff": "diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex a50b0ebfe60e..cb87d97888ed 100644\n--- a/src/android/camera_device.cpp\n+++ b/src/android/camera_device.cpp\n@@ -347,12 +347,6 @@ CameraDevice::CameraDevice(unsigned int id, const std::shared_ptr<Camera> &camer\n {\n \tcamera_->requestCompleted.connect(this, &CameraDevice::requestComplete);\n \n-\t/*\n-\t * \\todo Determine a more accurate value for this during\n-\t *  streamConfiguration.\n-\t */\n-\tmaxJpegBufferSize_ = 13 << 20; /* 13631488 from USB HAL */\n-\n \tmaker_ = \"libcamera\";\n \tmodel_ = \"cameraModel\";\n \n@@ -629,6 +623,7 @@ int CameraDevice::initializeStreamConfigurations()\n \t\t\t\t\t\t\tmappedFormat,\n \t\t\t\t\t\t\tcameraResolutions);\n \n+\t\tSize maxJpegSize;\n \t\tfor (const Size &res : resolutions) {\n \t\t\tstreamConfigurations_.push_back({ res, androidFormat });\n \n@@ -643,9 +638,17 @@ int CameraDevice::initializeStreamConfigurations()\n \t\t\t * \\todo Support JPEG streams produced by the Camera\n \t\t\t * natively.\n \t\t\t */\n-\t\t\tif (androidFormat == HAL_PIXEL_FORMAT_YCbCr_420_888)\n+\t\t\tif (androidFormat == HAL_PIXEL_FORMAT_YCbCr_420_888) {\n \t\t\t\tstreamConfigurations_.push_back(\n \t\t\t\t\t{ res, HAL_PIXEL_FORMAT_BLOB });\n+\n+\t\t\t\tif (res > maxJpegSize) {\n+\t\t\t\t\tmaxJpegSize = res;\n+\t\t\t\t\tmaxJpegBufferSize_ = maxJpegSize.width\n+\t\t\t\t\t\t\t   * maxJpegSize.height\n+\t\t\t\t\t\t\t   * 1.5;\n+\t\t\t\t}\n+\t\t\t}\n \t\t}\n \t}\n \n@@ -878,10 +881,6 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()\n \t\t\t\t  availableThumbnailSizes.data(),\n \t\t\t\t  availableThumbnailSizes.size());\n \n-\t/*\n-\t * \\todo Calculate the maximum JPEG buffer size by asking the encoder\n-\t * giving the maximum frame size required.\n-\t */\n \tstaticMetadata_->addEntry(ANDROID_JPEG_MAX_SIZE, &maxJpegBufferSize_, 1);\n \n \t/* Sensor static metadata. */\n",
    "prefixes": [
        "libcamera-devel"
    ]
}