Show a patch.

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

{
    "id": 19009,
    "url": "https://patchwork.libcamera.org/api/patches/19009/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/19009/",
    "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": "<20230915-libyuv-convert-v1-3-1e5bcf68adac@baylibre.com>",
    "date": "2023-09-15T07:57:27",
    "name": "[libcamera-devel,RFC,3/7] android: yuv: prepare support for other pixel formats",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "40167a2e726ffe10e6c03a1ae576eea55db5c9ab",
    "submitter": {
        "id": 153,
        "url": "https://patchwork.libcamera.org/api/people/153/?format=api",
        "name": "Mattijs Korpershoek",
        "email": "mkorpershoek@baylibre.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/19009/mbox/",
    "series": [
        {
            "id": 4023,
            "url": "https://patchwork.libcamera.org/api/series/4023/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4023",
            "date": "2023-09-15T07:57:24",
            "name": "android: add YUYV->NV12 conversion via libyuv",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/4023/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/19009/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/19009/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 AF1BABD160\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 15 Sep 2023 07:57:35 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C01FC62927;\n\tFri, 15 Sep 2023 09:57:32 +0200 (CEST)",
            "from mail-wr1-x434.google.com (mail-wr1-x434.google.com\n\t[IPv6:2a00:1450:4864:20::434])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D1CF16291A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 15 Sep 2023 09:57:29 +0200 (CEST)",
            "by mail-wr1-x434.google.com with SMTP id\n\tffacd0b85a97d-313e742a787so1181775f8f.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 15 Sep 2023 00:57:29 -0700 (PDT)",
            "from [192.168.1.20] ([2a01:cb19:8704:be00:4f55:bd9d:611a:6c8e])\n\tby smtp.gmail.com with ESMTPSA id\n\tm2-20020a056000174200b0031fe9a47a87sm2506942wrf.112.2023.09.15.00.57.28\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 15 Sep 2023 00:57:29 -0700 (PDT)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1694764652;\n\tbh=0hHduLXnGmQRUinzMw3HA8Pdweuxi4OWV720ADh/2cI=;\n\th=Date:References:In-Reply-To:To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=R5CzMKXxImhKZbpAYgZ9dcXkn/ytdf1NciRSuUqCYppLvC4Y7ZLsulZY98jk/+fWy\n\tfap9m/1qFFQIbSlJkyYfe5NBZwBnvPl6ImdCu4ohmESsyIJwXo09pFDL4Jb2JstbcN\n\tkCATv5K3TBW5CVRKAlGXmlUEsMg7rwoA349WbamsIEdKcsxDXFarfURSC0AyrWOWvY\n\tMr09XCoaYZPx7S3R57kvlyL15lX2ilEploI8xhemSQLjF2WnTZH0zQFjD2IuSGEjqs\n\tXk4G2OzUWzqPsNgWjqmy637IJ+5ZTp0tg3Y90kgf1og/n6Lm2Vmh4+ttjSf6fsIb//\n\t8H1/iwMtI7b5Q==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1694764649;\n\tx=1695369449; darn=lists.libcamera.org; \n\th=cc:to:in-reply-to:references:message-id:content-transfer-encoding\n\t:mime-version:subject:date:from:from:to:cc:subject:date:message-id\n\t:reply-to; bh=b/wOgWma/1S7FO6/zEXOhIIMNxsMj5cc2vXJjrkX00w=;\n\tb=Pg6kyn7Cu+8gSvX8VjPyGujWhHvyg+Lz6l3UG0OB7wWFA0jSl5cYewawwZmFsxWC5h\n\t08OEPYl4uNeFxwxosNKbk0FQ1sjOhSR4szh2wzETbiqFw3QJ677IAfof2TvEbLRx3A3T\n\tCklEP0b+0zgjgRfCfBllWV0y384FTIA+FLhf2MwE18uhfRlk3KlrOKWIEfHnn8tsmZL/\n\tDdq1FuilEnJBNkaMtLks+IQq94ZcrNVdP3A1k3wzPSkfgYLDMijPlPbkWwEy9nk5TDiG\n\thxA3noYonXXQM/uoWUSX55iic0G0au9TH+CmjQL/tz/GiAJ2XbgRW2QqUiGTPi/B6Qqm\n\tq1Qw=="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected)\n\theader.d=baylibre-com.20230601.gappssmtp.com\n\theader.i=@baylibre-com.20230601.gappssmtp.com header.b=\"Pg6kyn7C\"; \n\tdkim-atps=neutral",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1694764649; x=1695369449;\n\th=cc:to:in-reply-to:references:message-id:content-transfer-encoding\n\t:mime-version:subject:date:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=b/wOgWma/1S7FO6/zEXOhIIMNxsMj5cc2vXJjrkX00w=;\n\tb=uYXqoyPtJgTdMGsnwl4QN73uaXdSAPWfuQA3UTVuWMxiK7sUIJ90cahbhq49Hp7G7Z\n\tqXINxzoIddvfNtFs5fFw5qavST65KYBhs4VmYEN3H+t7yPKCEM6jBJcmqf+9dD59vWNZ\n\tEVKHhjp9cTuJ+F/Byh2aIgsVg/FWetZvWUTuZCnscS9pnTUAVgWwex2zW12Irc+Mt5fZ\n\tQpludYYxdz2Q7/qiJhn9LyKCtwKOFX0l3sFSgIIklLr/hiDQ8Cxk6eYqlE33SVdJtHtp\n\t+uMjVJpL3Ja3gFnxKvoliM4YNRyZmTXAYZsrx/g4kcOi/V5mvX/btMTOPv7BnorAk+dw\n\tAMIQ==",
        "X-Gm-Message-State": "AOJu0Ywy2uaumUakvp7MbVDiJoN5fOSGn1UVLvGBNTbxCpdDbiMbb9AN\n\t3qtki7r4E3tpOSgpzZlZpBwczQ==",
        "X-Google-Smtp-Source": "AGHT+IHyYHYC0JnSqUmB2Q5e6L82bCm/r40Bkes++y72PayEMp/FFHAFkQBpVTJ/83t2PsndqIeu2w==",
        "X-Received": "by 2002:adf:fc42:0:b0:31f:d8be:a313 with SMTP id\n\te2-20020adffc42000000b0031fd8bea313mr599172wrs.5.1694764649474; \n\tFri, 15 Sep 2023 00:57:29 -0700 (PDT)",
        "Date": "Fri, 15 Sep 2023 09:57:27 +0200",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"utf-8\"",
        "Content-Transfer-Encoding": "7bit",
        "Message-Id": "<20230915-libyuv-convert-v1-3-1e5bcf68adac@baylibre.com>",
        "References": "<20230915-libyuv-convert-v1-0-1e5bcf68adac@baylibre.com>",
        "In-Reply-To": "<20230915-libyuv-convert-v1-0-1e5bcf68adac@baylibre.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "X-Mailer": "b4 0.12.4-dev-6aa5d",
        "Subject": "[libcamera-devel] [PATCH RFC 3/7] android: yuv: prepare support for\n\tother pixel formats",
        "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>",
        "From": "Mattijs Korpershoek via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>",
        "Reply-To": "Mattijs Korpershoek <mkorpershoek@baylibre.com>",
        "Cc": "Guillaume La Roque <glaroque@baylibre.com>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "PostProcessorYuv assumes that both source and destination pixel formats\nwill always be formats::NV12.\nThis might change in the future, for example when doing pixel format\nconversion via libyuv.\n\nAdd the necessary plumbing so that other formats can be added easily in\nthe future.\n\nAlso increase plane number to 3, since some YUV format [1] are\nfully planar (and thus have 3 planes).\n\n[1] https://docs.kernel.org/userspace-api/media/v4l/pixfmt-yuv-planar.html#fully-planar-yuv-formats\nSigned-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>\n---\n src/android/yuv/post_processor_yuv.cpp | 26 +++++++++++++++-----------\n src/android/yuv/post_processor_yuv.h   | 12 ++++++++----\n 2 files changed, 23 insertions(+), 15 deletions(-)",
    "diff": "diff --git a/src/android/yuv/post_processor_yuv.cpp b/src/android/yuv/post_processor_yuv.cpp\nindex d58090db14ee..734bb85b7351 100644\n--- a/src/android/yuv/post_processor_yuv.cpp\n+++ b/src/android/yuv/post_processor_yuv.cpp\n@@ -90,18 +90,18 @@ void PostProcessorYuv::process(Camera3RequestDescriptor::StreamBuffer *streamBuf\n bool PostProcessorYuv::isValidBuffers(const FrameBuffer &source,\n \t\t\t\t      const CameraBuffer &destination) const\n {\n-\tif (source.planes().size() != 2) {\n+\tif (source.planes().size() != sourceNumPlanes_) {\n \t\tLOG(YUV, Error) << \"Invalid number of source planes: \"\n \t\t\t\t<< source.planes().size();\n \t\treturn false;\n \t}\n-\tif (destination.numPlanes() != 2) {\n+\tif (destination.numPlanes() != destinationNumPlanes_) {\n \t\tLOG(YUV, Error) << \"Invalid number of destination planes: \"\n \t\t\t\t<< destination.numPlanes();\n \t\treturn false;\n \t}\n \n-\tfor (unsigned int i = 0; i < 2; i++) {\n+\tfor (unsigned int i = 0; i < sourceNumPlanes_; i++) {\n \t\tif (source.planes()[i].length < sourceLength_[i]) {\n \t\t\tLOG(YUV, Error)\n \t\t\t\t<< \"The source planes lengths are too small, \"\n@@ -112,7 +112,7 @@ bool PostProcessorYuv::isValidBuffers(const FrameBuffer &source,\n \t\t\treturn false;\n \t\t}\n \t}\n-\tfor (unsigned int i = 0; i < 2; i++) {\n+\tfor (unsigned int i = 0; i < destinationNumPlanes_; i++) {\n \t\tif (destination.plane(i).size() < destinationLength_[i]) {\n \t\t\tLOG(YUV, Error)\n \t\t\t\t<< \"The destination planes lengths are too small, \"\n@@ -132,18 +132,22 @@ void PostProcessorYuv::calculateLengths(const StreamConfiguration &inCfg,\n {\n \tsourceSize_ = inCfg.size;\n \tdestinationSize_ = outCfg.size;\n+\tsourceFormat_ = inCfg.pixelFormat;\n+\tdestinationFormat_ = outCfg.pixelFormat;\n \n-\tconst PixelFormatInfo &sourceInfo = PixelFormatInfo::info(formats::NV12);\n-\tfor (unsigned int i = 0; i < 2; i++) {\n+\tconst PixelFormatInfo &sourceInfo = PixelFormatInfo::info(sourceFormat_);\n+\tsourceNumPlanes_ = sourceInfo.numPlanes();\n+\tfor (unsigned int i = 0; i < sourceInfo.numPlanes(); i++) {\n \t\tsourceStride_[i] = inCfg.stride;\n \t\tsourceLength_[i] = sourceInfo.planeSize(sourceSize_.height, i,\n \t\t\t\t\t\t\tsourceStride_[i]);\n \t}\n \n-\tconst PixelFormatInfo &destinationInfo = PixelFormatInfo::info(formats::NV12);\n-\tfor (unsigned int i = 0; i < 2; i++) {\n-\t\tdestinationStride_[i] = sourceInfo.stride(destinationSize_.width, i, 1);\n-\t\tdestinationLength_[i] = sourceInfo.planeSize(destinationSize_.height, i,\n-\t\t\t\t\t\t\t     destinationStride_[i]);\n+\tconst PixelFormatInfo &destinationInfo = PixelFormatInfo::info(destinationFormat_);\n+\tdestinationNumPlanes_ = destinationInfo.numPlanes();\n+\tfor (unsigned int i = 0; i < destinationInfo.numPlanes(); i++) {\n+\t\tdestinationStride_[i] = destinationInfo.stride(destinationSize_.width, i, 1);\n+\t\tdestinationLength_[i] = destinationInfo.planeSize(destinationSize_.height, i,\n+\t\t\t\t\t\t\t\t  destinationStride_[i]);\n \t}\n }\ndiff --git a/src/android/yuv/post_processor_yuv.h b/src/android/yuv/post_processor_yuv.h\nindex a7ac17c564b6..bfe35f46c6dc 100644\n--- a/src/android/yuv/post_processor_yuv.h\n+++ b/src/android/yuv/post_processor_yuv.h\n@@ -28,8 +28,12 @@ private:\n \n \tlibcamera::Size sourceSize_;\n \tlibcamera::Size destinationSize_;\n-\tunsigned int sourceLength_[2] = {};\n-\tunsigned int destinationLength_[2] = {};\n-\tunsigned int sourceStride_[2] = {};\n-\tunsigned int destinationStride_[2] = {};\n+\tlibcamera::PixelFormat sourceFormat_;\n+\tlibcamera::PixelFormat destinationFormat_;\n+\tunsigned int sourceLength_[3] = {};\n+\tunsigned int destinationLength_[3] = {};\n+\tunsigned int sourceStride_[3] = {};\n+\tunsigned int destinationStride_[3] = {};\n+\tunsigned int sourceNumPlanes_;\n+\tunsigned int destinationNumPlanes_;\n };\n",
    "prefixes": [
        "libcamera-devel",
        "RFC",
        "3/7"
    ]
}