[{"id":24593,"web_url":"https://patchwork.libcamera.org/comment/24593/","msgid":"<YvsF0kWUJuSpf/Q/@pendragon.ideasonboard.com>","date":"2022-08-16T02:49:54","subject":"Re: [libcamera-devel] [PATCH] libcamera: ColorSpace: Helper to\n\tcheck for standard colorspaces","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Umang,\n\nThank you for the patch.\n\nOn Tue, Jul 12, 2022 at 11:26:09AM +0530, Umang Jain via libcamera-devel wrote:\n> Provide a convenience helper to check is the given colorspace\n> belongs to a set of standard colorspace or not.\n> \n> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>\n> ---\n>  include/libcamera/color_space.h |  1 +\n>  src/libcamera/color_space.cpp   | 31 +++++++++++++++++++++++++++++++\n>  2 files changed, 32 insertions(+)\n> \n> diff --git a/include/libcamera/color_space.h b/include/libcamera/color_space.h\n> index 086c56c1..43786d2a 100644\n> --- a/include/libcamera/color_space.h\n> +++ b/include/libcamera/color_space.h\n> @@ -59,6 +59,7 @@ public:\n>  \n>  \tstd::string toString() const;\n>  \tstatic std::string toString(const std::optional<ColorSpace> &colorSpace);\n> +\tbool isStandardColorSpace();\n>  };\n>  \n>  bool operator==(const ColorSpace &lhs, const ColorSpace &rhs);\n> diff --git a/src/libcamera/color_space.cpp b/src/libcamera/color_space.cpp\n> index 895e5c8e..004346f5 100644\n> --- a/src/libcamera/color_space.cpp\n> +++ b/src/libcamera/color_space.cpp\n> @@ -212,6 +212,37 @@ std::string ColorSpace::toString(const std::optional<ColorSpace> &colorSpace)\n>  \treturn colorSpace->toString();\n>  }\n>  \n> +/**\n> + * brief Checks whether the colorspace is a standard colorspace or not\n> + *\n> + * This is convenience helper to check whether the given colorspace is\n> + * a standard colorspace or not.\n> + *\n> + * \\return True if it is a standard colorspace, false otherwise\n> + */\n> +bool ColorSpace::isStandardColorSpace()\n> +{\n> +\tbool isStdColorSpace = false;\n> +\n> +\tstatic const std::vector<ColorSpace> stdColorSpaces = {\n> +\t\tColorSpace::Raw,\n> +\t\tColorSpace::Jpeg,\n> +\t\tColorSpace::Srgb,\n> +\t\tColorSpace::Smpte170m,\n> +\t\tColorSpace::Rec709,\n> +\t\tColorSpace::Rec2020\n> +\t};\n> +\n> +\tauto it = std::find_if(stdColorSpaces.begin(), stdColorSpaces.end(),\n> +\t\t\t       [this](const auto &item) {\n> +\t\t\t\t       return *this == item;\n> +\t\t\t       });\n> +\tif (it != stdColorSpaces.end())\n> +\t\tisStdColorSpace = true;\n> +\n> +\treturn isStdColorSpace;\n\n\treturn it != stdColorSpaces.end();\n\nThe implementation otherwise looks fine, but I'm not sure where we would\nuse this :-)\n\n> +}\n> +\n>  /**\n>   * \\var ColorSpace::primaries\n>   * \\brief The color primaries of this color space","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 E3225BE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 16 Aug 2022 02:50:10 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3C27E61FC0;\n\tTue, 16 Aug 2022 04:50:10 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id BDA82603E3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 16 Aug 2022 04:50:08 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 11ACD496;\n\tTue, 16 Aug 2022 04:50:08 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1660618210;\n\tbh=KiI9IOUAgzRUYL3MjTwe7x/fzpb+3r05Zk8eAfhkWnE=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=pv+2/5/Q5D5nn1gPiSs/vHbx5KZySo0wKaXBU+qNLU7E9bHkcjgyVDTztLi6FtFE/\n\tlAZ1L9zNep364rSGodX3sDz4SaVNmhcc0gD0IL18YzKQxQvg+6qklR3HkTm2PDRaiZ\n\tV0UN+h7Hv4CeL6xTfGljEAltNf9E/5n7hJlX+SdOnCHW1B/uazvBERBYMAV1NgxcgJ\n\tdbl0TK8zg2a1RKmgc7jpJgiKeBTg5mmolYbRcnZlpJHF1wnpzpwS9+BpnPMyP5E0Yr\n\tTI1sg1kblZ4qCHlD3y7pAHXwHwXEvWio+qSLI611aWuW42NEEzdsH1WM7rDPGD5BmY\n\t2bQiLxbWTt2YQ==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1660618208;\n\tbh=KiI9IOUAgzRUYL3MjTwe7x/fzpb+3r05Zk8eAfhkWnE=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=CWzGYTDUqIA4PLGzQEEvH8aiIHnHvA3RJPbg+2es9zl9ndPzFIwEK4VJK4Gy+YzHO\n\tzPsa96wbnLzAyhuObzRyx0Qtw2B31dnG7MBcuaKQAcnQk2PeRggB5+9Blzj758f5Mq\n\t4K0XSt4Ald6z26L45/GdG7+RMTNiCad0EB2iiiPY="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"CWzGYTDU\"; dkim-atps=neutral","Date":"Tue, 16 Aug 2022 05:49:54 +0300","To":"Umang Jain <umang.jain@ideasonboard.com>","Message-ID":"<YvsF0kWUJuSpf/Q/@pendragon.ideasonboard.com>","References":"<20220712055609.14910-1-umang.jain@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20220712055609.14910-1-umang.jain@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH] libcamera: ColorSpace: Helper to\n\tcheck for standard colorspaces","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":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"rishikeshdonadkar@gmail.com, libcamera-devel@lists.libcamera.org,\n\tnicolas.dufresne@collabora.com","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]