Show a patch.

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

{
    "id": 8523,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/8523/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/8523/",
    "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": "<20200630145808.2976956-5-paul.elder@ideasonboard.com>",
    "date": "2020-06-30T14:58:06",
    "name": "[libcamera-devel,v2,4/6] libcamera: PixelFormatInfo: Add functions bytesPerLine and imageSize",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "2af07e2650c3e7c5a4359113538cb12bb1a4fabc",
    "submitter": {
        "id": 17,
        "url": "https://patchwork.libcamera.org/api/1.1/people/17/?format=api",
        "name": "Paul Elder",
        "email": "paul.elder@ideasonboard.com"
    },
    "delegate": {
        "id": 17,
        "url": "https://patchwork.libcamera.org/api/1.1/users/17/?format=api",
        "username": "epaul",
        "first_name": "Paul",
        "last_name": "Elder",
        "email": "paul.elder@ideasonboard.com"
    },
    "mbox": "https://patchwork.libcamera.org/patch/8523/mbox/",
    "series": [
        {
            "id": 1064,
            "url": "https://patchwork.libcamera.org/api/1.1/series/1064/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1064",
            "date": "2020-06-30T14:58:02",
            "name": "Move formats from v4l2-compat into libcamera",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/1064/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/8523/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/8523/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 7B5CEBF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 30 Jun 2020 14:58:32 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 480BD60C61;\n\tTue, 30 Jun 2020 16:58:32 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 19EAD60C5F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 30 Jun 2020 16:58:31 +0200 (CEST)",
            "from pyrite.rasen.tech (unknown\n\t[IPv6:2400:4051:61:600:2c71:1b79:d06d:5032])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 970A329F;\n\tTue, 30 Jun 2020 16:58:29 +0200 (CEST)"
        ],
        "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=\"CQwDS5DF\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1593529110;\n\tbh=Gy7Ju+OuZwBHQkoZozUhku4niNFTxzhbSrTNSWuo3Gs=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=CQwDS5DFWEPTbrqrEHKDiuxhv3I4PV7KkrHDI3EfHUAvZAbaVW+Z0bHEOfsH50pCq\n\t3350+sOLLXxa3WWnAEjjM1/zKV/j4LeyNDura0+LZ3fMtQyaOMYtj4ZUfMgLzYWVVV\n\t1Ha1mu2iVMUa4dDGowtFcyhNAL8EFgz2AplfFE78=",
        "From": "Paul Elder <paul.elder@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Tue, 30 Jun 2020 23:58:06 +0900",
        "Message-Id": "<20200630145808.2976956-5-paul.elder@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.27.0",
        "In-Reply-To": "<20200630145808.2976956-1-paul.elder@ideasonboard.com>",
        "References": "<20200630145808.2976956-1-paul.elder@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH v2 4/6] libcamera: PixelFormatInfo: Add\n\tfunctions bytesPerLine and imageSize",
        "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": "Add member functions to PixelFormatInfo for calculating bytes-per-line\nand image size. This will simplify existing code that calculates these\nthings.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\n\n---\nChanges in v2:\n- make these functions const\n- add documentation\n- inline DIV_ROUND_UP\n---\n include/libcamera/internal/formats.h |  3 +++\n src/libcamera/formats.cpp            | 27 +++++++++++++++++++++++++++\n 2 files changed, 30 insertions(+)",
    "diff": "diff --git a/include/libcamera/internal/formats.h b/include/libcamera/internal/formats.h\nindex 3c7440a..af0f1ac 100644\n--- a/include/libcamera/internal/formats.h\n+++ b/include/libcamera/internal/formats.h\n@@ -46,6 +46,9 @@ public:\n \tstatic const PixelFormatInfo &info(const PixelFormat &format);\n \tstatic const PixelFormatInfo &info(const V4L2PixelFormat &format);\n \n+\tunsigned int bytesPerLine(unsigned int width) const;\n+\tunsigned int imageSize(const Size &size) const;\n+\n \tconst char *name;\n \tPixelFormat format;\n \tV4L2PixelFormat v4l2Format;\ndiff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp\nindex 4d18825..698c905 100644\n--- a/src/libcamera/formats.cpp\n+++ b/src/libcamera/formats.cpp\n@@ -693,4 +693,31 @@ const PixelFormatInfo &PixelFormatInfo::info(const V4L2PixelFormat &format)\n \treturn info->second;\n }\n \n+/**\n+ * \\brief Compute the bytes per line\n+ * \\param[in] width The width of the line, in pixels\n+ * \\return The number of bytes necessary to store the line, or 0 if the\n+ * PixelFormatInfo instance not valid\n+ */\n+unsigned int PixelFormatInfo::bytesPerLine(unsigned int width) const\n+{\n+\tif (!isValid())\n+\t\treturn 0;\n+\n+\t/* ceil(width / pixelsPerGroup) * bytesPerGroup */\n+\treturn ((width + pixelsPerGroup - 1) / pixelsPerGroup) * bytesPerGroup;\n+\n+}\n+\n+/**\n+ * \\brief Compute the bytes necessary to store the frame\n+ * \\param[in] size The size of the frame, in pixels\n+ * \\return The number of bytes necessary to store the frame, or 0 if the\n+ * PixelFormatInfo instance is not valid\n+ */\n+unsigned int PixelFormatInfo::imageSize(const Size &size) const\n+{\n+\treturn size.height * bytesPerLine(size.width);\n+}\n+\n } /* namespace libcamera */\n",
    "prefixes": [
        "libcamera-devel",
        "v2",
        "4/6"
    ]
}