{"id":9142,"url":"https://patchwork.libcamera.org/api/1.1/patches/9142/?format=json","web_url":"https://patchwork.libcamera.org/patch/9142/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20200803161816.107113-3-kieran.bingham@ideasonboard.com>","date":"2020-08-03T16:18:06","name":"[libcamera-devel,v2,02/12] libcamera: formats: add planeCount helper","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"83afe7d820585f9883b7e924af61fb56f023bbf2","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/1.1/people/4/?format=json","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/9142/mbox/","series":[{"id":1183,"url":"https://patchwork.libcamera.org/api/1.1/series/1183/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1183","date":"2020-08-03T16:18:04","name":"android: jpeg","version":2,"mbox":"https://patchwork.libcamera.org/series/1183/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/9142/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/9142/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 54473BD86F\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  3 Aug 2020 16:18:25 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7B953619F4;\n\tMon,  3 Aug 2020 18:18:24 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8BB07605A9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  3 Aug 2020 18:18:22 +0200 (CEST)","from Q.local (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net\n\t[86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id EC8F69CE;\n\tMon,  3 Aug 2020 18:18:21 +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=\"WOikV1ul\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1596471502;\n\tbh=J6UIdvHGBPmQweKl+qZmHGZG1DflYGit3djkhFdbAgU=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=WOikV1ulzJUPvHUuqchB0CeB/RIQyPMAd9R4mlJEr/aqn1/4R+A/O8EW1aK5zO1kt\n\tbllqL7zthhAfLgicXvUdIRxSB6U9nbcjkp5sLglKcVcghixHfSg7tFMk/CI+G81kWl\n\tU/Pst3nzV58Nwx80hHoY4NQwcl56buxbFvLP7iEQ=","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"libcamera devel <libcamera-devel@lists.libcamera.org>","Date":"Mon,  3 Aug 2020 17:18:06 +0100","Message-Id":"<20200803161816.107113-3-kieran.bingham@ideasonboard.com>","X-Mailer":"git-send-email 2.25.1","In-Reply-To":"<20200803161816.107113-1-kieran.bingham@ideasonboard.com>","References":"<20200803161816.107113-1-kieran.bingham@ideasonboard.com>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH v2 02/12] libcamera: formats: add\n\tplaneCount helper","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=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Determine the number of planes used by a format by counting the number\nof PxielFormatPlaneInfo entries with a valid entry.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n---\nv2:\n - Rename to numPlanes\n - Simplify fucntion doc.\n---\n include/libcamera/internal/formats.h |  2 ++\n src/libcamera/formats.cpp            | 18 ++++++++++++++++++\n 2 files changed, 20 insertions(+)","diff":"diff --git a/include/libcamera/internal/formats.h b/include/libcamera/internal/formats.h\nindex b8e474916378..51a8a6b8b0ae 100644\n--- a/include/libcamera/internal/formats.h\n+++ b/include/libcamera/internal/formats.h\n@@ -46,6 +46,8 @@ public:\n \tunsigned int frameSize(const Size &size,\n \t\t\t       const std::array<unsigned int, 3> &strides) const;\n \n+\tunsigned int numPlanes() const;\n+\n \t/* \\todo Add support for non-contiguous memory planes */\n \tconst char *name;\n \tPixelFormat format;\ndiff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp\nindex a51e96810aed..ebaae9be3d75 100644\n--- a/src/libcamera/formats.cpp\n+++ b/src/libcamera/formats.cpp\n@@ -821,4 +821,22 @@ PixelFormatInfo::frameSize(const Size &size,\n \treturn sum;\n }\n \n+/**\n+ * \\brief Retrieve the number of planes represented by the format\n+ * \\return The number of planes used by the format\n+ */\n+unsigned int PixelFormatInfo::numPlanes() const\n+{\n+\tunsigned int count = 0;\n+\n+\tfor (const PixelFormatPlaneInfo &p : planes) {\n+\t\tif (p.bytesPerGroup == 0)\n+\t\t\tbreak;\n+\n+\t\tcount++;\n+\t}\n+\n+\treturn count;\n+}\n+\n } /* namespace libcamera */\n","prefixes":["libcamera-devel","v2","02/12"]}