{"id":8918,"url":"https://patchwork.libcamera.org/api/1.1/patches/8918/?format=json","web_url":"https://patchwork.libcamera.org/patch/8918/","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":"<20200722133009.26528-2-kgupta@es.iitr.ac.in>","date":"2020-07-22T13:30:03","name":"[libcamera-devel,1/7] libcamera: formats: Move isRaw() helper to formats.cpp","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"5212fec5d14af176d39f2d4f7ba2758667e4fe0c","submitter":{"id":39,"url":"https://patchwork.libcamera.org/api/1.1/people/39/?format=json","name":"Kaaira Gupta","email":"kgupta@es.iitr.ac.in"},"delegate":{"id":11,"url":"https://patchwork.libcamera.org/api/1.1/users/11/?format=json","username":"kbingham","first_name":"Kieran","last_name":"Bingham","email":"kieran.bingham@ideasonboard.com"},"mbox":"https://patchwork.libcamera.org/patch/8918/mbox/","series":[{"id":1127,"url":"https://patchwork.libcamera.org/api/1.1/series/1127/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1127","date":"2020-07-22T13:30:02","name":"vimc: Introduce multiple streaming","version":1,"mbox":"https://patchwork.libcamera.org/series/1127/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/8918/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/8918/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 B4BADBDB1B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 22 Jul 2020 13:30:22 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3AAEF60991;\n\tWed, 22 Jul 2020 15:30:22 +0200 (CEST)","from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com\n\t[IPv6:2607:f8b0:4864:20::52c])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4DFEE60540\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 22 Jul 2020 15:30:21 +0200 (CEST)","by mail-pg1-x52c.google.com with SMTP id g67so1257743pgc.8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 22 Jul 2020 06:30:21 -0700 (PDT)","from kaaira-HP-Pavilion-Notebook ([103.113.213.178])\n\tby smtp.gmail.com with ESMTPSA id\n\t19sm24251482pfy.193.2020.07.22.06.30.18\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 22 Jul 2020 06:30:19 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=es-iitr-ac-in.20150623.gappssmtp.com\n\theader.i=@es-iitr-ac-in.20150623.gappssmtp.com\n\theader.b=\"G6OPeEVf\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=es-iitr-ac-in.20150623.gappssmtp.com; s=20150623;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=4E1ZlEtGdGzXU4Xw7uWK+RfEUYGCwrDfIrGBicfEWTI=;\n\tb=G6OPeEVfuuVVAVc3zdxqjVYx0lnfy6tbxPpo/y8EYlOoeKEQcD2ou85RFPAmi/AH5U\n\tfI5RBM76amduV+qch4KPWXdGNnZSSwALLywIp2NsbWWML1PDv3F1lXTkffnOsSYRGKil\n\t+Ag7xYDJqHcE2Mjv7ZuSOhEXeGsUUV+Ulqm2VORoPG4TaYPKrPYZ9GyQRI8u5U8JzQWt\n\tsDkjIUkmf6SzDww8yUsTrxUkzF/Dk8xK6CWUKTkxN2n00VNQC4DQiqTPPsAEuE8k3SJ9\n\tldOQ8RR7E37iI7nM2hSxRr/Yx295gKmZkagaadZMhRZUVn0V+/nW98dP1vCWCR2s6+np\n\t+5kQ==","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;\n\tbh=4E1ZlEtGdGzXU4Xw7uWK+RfEUYGCwrDfIrGBicfEWTI=;\n\tb=oJu7rZdyIFJeysPMnCFzqAeY9drELpkbCmuwcyaVYkeJK9tcfZBzaZDQYqalGNnY2d\n\trIR+vnlnpkx9CGgVSx/phLbEd8YcImNNQTgpesP1+BYehSMOocXppJOBGFbjqWwvW1xh\n\tEE/WNDUUb3srlfVMsE7sUsyarLt/6sxCCYICil0LQxmmWyYuGDpMDy5SbA7dZn2aZJw0\n\tVDOFTOjbhtMEMBDWyzdb2uWcjlAYrZcEmWFnd9UJrZRFC3MEonoraG4wF5BmcOqHKFjp\n\tPp5pXX9uhQcStTNsMPxtYp5PJVN/By5Kn2/KetigXB7fFNrC2FiAqI8nIyqFYeReyGc/\n\tshIg==","X-Gm-Message-State":"AOAM532i83zCdx+gyneqjNacP6moJokbLEKAJhxkQUgd0g6xzRDAl19l\n\tJ2VcShCFe9CF3aLVbP3I2X96yovtY7s=","X-Google-Smtp-Source":"ABdhPJzsy6a+E9dBx0IIe/9vgnhp+Xi2Y7bAIy4P5GqznCCzKhEA1NlIaPAJtvctJNCVwkswkPcE7g==","X-Received":"by 2002:a62:fc15:: with SMTP id\n\te21mr29671276pfh.167.1595424619855; \n\tWed, 22 Jul 2020 06:30:19 -0700 (PDT)","From":"Kaaira Gupta <kgupta@es.iitr.ac.in>","To":"libcamera-devel@lists.libcamera.org,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>","Date":"Wed, 22 Jul 2020 19:00:03 +0530","Message-Id":"<20200722133009.26528-2-kgupta@es.iitr.ac.in>","X-Mailer":"git-send-email 2.17.1","In-Reply-To":"<20200722133009.26528-1-kgupta@es.iitr.ac.in>","References":"<20200722133009.26528-1-kgupta@es.iitr.ac.in>","Subject":"[libcamera-devel] [PATCH 1/7] libcamera: formats: Move isRaw()\n\thelper to formats.cpp","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>","Cc":"Kaaira Gupta <kgupta@es.iitr.ac.in>","MIME-Version":"1.0","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":"isRaw() helper is used in subsequent patches by VIMC as well. Hence move\nit from raspberrypi pippeline handler to a common place to make it\nreusable.\n\nSigned-off-by: Kaaira Gupta <kgupta@es.iitr.ac.in>\n---\n include/libcamera/internal/formats.h          |  1 +\n src/libcamera/formats.cpp                     | 13 +++++++++\n .../pipeline/raspberrypi/raspberrypi.cpp      | 27 ++++++++-----------\n 3 files changed, 25 insertions(+), 16 deletions(-)","diff":"diff --git a/include/libcamera/internal/formats.h b/include/libcamera/internal/formats.h\nindex cad41ad..8032fab 100644\n--- a/include/libcamera/internal/formats.h\n+++ b/include/libcamera/internal/formats.h\n@@ -49,6 +49,7 @@ public:\n \t};\n \n \tbool isValid() const { return format.isValid(); }\n+\tbool isRaw(PixelFormat &pixFmt) const;\n \n \tstatic const PixelFormatInfo &info(const PixelFormat &format);\n \tstatic const PixelFormatInfo &info(const V4L2PixelFormat &format);\ndiff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp\nindex af3996c..efb7de9 100644\n--- a/src/libcamera/formats.cpp\n+++ b/src/libcamera/formats.cpp\n@@ -853,4 +853,17 @@ PixelFormatInfo::frameSize(const Size &size,\n \treturn sum;\n }\n \n+/**\n+ * \\brief Check if given pixel format is RAW or not\n+ * \\return True if the format is RAW, false otherwise\n+ */\n+bool PixelFormatInfo::isRaw(PixelFormat &pixFmt) const\n+{\n+\tconst PixelFormatInfo &info = PixelFormatInfo::info(pixFmt);\n+\tif (!info.isValid())\n+\t\treturn false;\n+\n+\treturn info.colourEncoding == PixelFormatInfo::ColourEncodingRAW;\n+}\n+\n } /* namespace libcamera */\ndiff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex bf1c771..8f35434 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -43,19 +43,6 @@ using V4L2PixFmtMap = std::map<V4L2PixelFormat, std::vector<SizeRange>>;\n \n namespace {\n \n-bool isRaw(PixelFormat &pixFmt)\n-{\n-\t/*\n-\t * The isRaw test might be redundant right now the pipeline handler only\n-\t * supports RAW sensors. Leave it in for now, just as a sanity check.\n-\t */\n-\tconst PixelFormatInfo &info = PixelFormatInfo::info(pixFmt);\n-\tif (!info.isValid())\n-\t\treturn false;\n-\n-\treturn info.colourEncoding == PixelFormatInfo::ColourEncodingRAW;\n-}\n-\n double scoreFormat(double desired, double actual)\n {\n \tdouble score = desired - actual;\n@@ -405,7 +392,13 @@ CameraConfiguration::Status RPiCameraConfiguration::validate()\n \tstd::pair<int, Size> outSize[2];\n \tSize maxSize;\n \tfor (StreamConfiguration &cfg : config_) {\n-\t\tif (isRaw(cfg.pixelFormat)) {\n+\t\t/*\n+\t\t * The isRaw test might be redundant right now the pipeline handler only\n+\t\t * supports RAW sensors. Leave it in for now, just as a sanity check.\n+\t\t */\n+\t\tconst PixelFormatInfo &info = PixelFormatInfo::info(cfg.pixelFormat);\n+\n+\t\tif (info.isRaw(cfg.pixelFormat)) {\n \t\t\t/*\n \t\t\t * Calculate the best sensor mode we can use based on\n \t\t\t * the user request.\n@@ -616,8 +609,9 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)\n \t */\n \tfor (unsigned i = 0; i < config->size(); i++) {\n \t\tStreamConfiguration &cfg = config->at(i);\n+\t\tconst PixelFormatInfo &info = PixelFormatInfo::info(cfg.pixelFormat);\n \n-\t\tif (isRaw(cfg.pixelFormat)) {\n+\t\tif (info.isRaw(cfg.pixelFormat)) {\n \t\t\t/*\n \t\t\t * If we have been given a RAW stream, use that size\n \t\t\t * for setting up the sensor.\n@@ -661,7 +655,8 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)\n \tfor (unsigned i = 0; i < config->size(); i++) {\n \t\tStreamConfiguration &cfg = config->at(i);\n \n-\t\tif (isRaw(cfg.pixelFormat)) {\n+\t\tconst PixelFormatInfo &info = PixelFormatInfo::info(cfg..pixelFormat);\n+\t\tif (info.isRaw(cfg.pixelFormat)) {\n \t\t\tcfg.setStream(&data->isp_[Isp::Input]);\n \t\t\tdata->isp_[Isp::Input].setExternal(true);\n \t\t\tcontinue;\n","prefixes":["libcamera-devel","1/7"]}