[{"id":11078,"web_url":"https://patchwork.libcamera.org/comment/11078/","msgid":"<20200702140757.GJ12562@pendragon.ideasonboard.com>","date":"2020-07-02T14:07:57","subject":"Re: [libcamera-devel] [RFC 2/2] libcamera: formats: Remove\n\tImageFormats","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Niklas,\n\nThank you for the patch.\n\nOn Wed, Jul 01, 2020 at 11:16:50PM +0200, Niklas Söderlund wrote:\n> The ImageFormats helper class is not used anymore and can be removed.\n> \n> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nI'm however not closing the door to reintroducing a similar class if we\nfind a better API for it :-)\n\n> ---\n>  include/libcamera/internal/formats.h | 14 -----\n>  src/libcamera/formats.cpp            | 88 ----------------------------\n>  2 files changed, 102 deletions(-)\n> \n> diff --git a/include/libcamera/internal/formats.h b/include/libcamera/internal/formats.h\n> index f59ac8fe36a1623b..70c2f5cb5b7d5eb4 100644\n> --- a/include/libcamera/internal/formats.h\n> +++ b/include/libcamera/internal/formats.h\n> @@ -18,20 +18,6 @@\n>  \n>  namespace libcamera {\n>  \n> -class ImageFormats\n> -{\n> -public:\n> -\tint addFormat(unsigned int format, const std::vector<SizeRange> &sizes);\n> -\n> -\tbool isEmpty() const;\n> -\tstd::vector<unsigned int> formats() const;\n> -\tconst std::vector<SizeRange> &sizes(unsigned int format) const;\n> -\tconst std::map<unsigned int, std::vector<SizeRange>> &data() const;\n> -\n> -private:\n> -\tstd::map<unsigned int, std::vector<SizeRange>> data_;\n> -};\n> -\n>  class PixelFormatInfo\n>  {\n>  public:\n> diff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp\n> index 436672e8bf4f8571..10830ceb9aae8f0c 100644\n> --- a/src/libcamera/formats.cpp\n> +++ b/src/libcamera/formats.cpp\n> @@ -22,94 +22,6 @@ namespace libcamera {\n>  \n>  LOG_DEFINE_CATEGORY(Formats)\n>  \n> -/**\n> - * \\class ImageFormats\n> - * \\brief Describe V4L2Device and V4L2SubDevice image formats\n> - *\n> - * This class stores a list of image formats, each associated with a\n> - * corresponding set of image sizes. It is used to describe the formats and\n> - * sizes supported by a V4L2Device or V4L2Subdevice.\n> - *\n> - * Formats are stored as an integer. When used for a V4L2Device, the image\n> - * formats are fourcc pixel formats. When used for a V4L2Subdevice they are\n> - * media bus codes. Both are defined by the V4L2 specification.\n> - *\n> - * Sizes are stored as a list of SizeRange.\n> - */\n> -\n> -/**\n> - * \\brief Add a format and corresponding sizes to the description\n> - * \\param[in] format Pixel format or media bus code to describe\n> - * \\param[in] sizes List of supported size ranges for the format\n> - *\n> - * \\return 0 on success or a negative error code otherwise\n> - * \\retval -EEXIST The format is already described\n> - */\n> -int ImageFormats::addFormat(unsigned int format, const std::vector<SizeRange> &sizes)\n> -{\n> -\tif (data_.find(format) != data_.end())\n> -\t\treturn -EEXIST;\n> -\n> -\tdata_[format] = sizes;\n> -\n> -\treturn 0;\n> -}\n> -\n> -/**\n> - * \\brief Check if the list of devices supported formats is empty\n> - * \\return True if the list of supported formats is empty\n> - */\n> -bool ImageFormats::isEmpty() const\n> -{\n> -\treturn data_.empty();\n> -}\n> -\n> -/**\n> - * \\brief Retrieve a list of all supported image formats\n> - * \\return List of pixel formats or media bus codes\n> - */\n> -std::vector<unsigned int> ImageFormats::formats() const\n> -{\n> -\tstd::vector<unsigned int> formats;\n> -\tformats.reserve(data_.size());\n> -\n> -\t/* \\todo: Should this be cached instead of computed each time? */\n> -\tfor (auto const &it : data_)\n> -\t\tformats.push_back(it.first);\n> -\n> -\treturn formats;\n> -}\n> -\n> -/**\n> - * \\brief Retrieve all sizes for a specific format\n> - * \\param[in] format The pixel format or mbus code\n> - *\n> - * Retrieve all size ranges for a specific format. For V4L2Device \\a format is a\n> - * pixel format while for a V4L2Subdevice \\a format is a media bus code.\n> - *\n> - * \\return The list of image sizes supported for \\a format, or an empty list if\n> - * the format is not supported\n> - */\n> -const std::vector<SizeRange> &ImageFormats::sizes(unsigned int format) const\n> -{\n> -\tstatic const std::vector<SizeRange> empty;\n> -\n> -\tauto const &it = data_.find(format);\n> -\tif (it == data_.end())\n> -\t\treturn empty;\n> -\n> -\treturn it->second;\n> -}\n> -\n> -/**\n> - * \\brief Retrieve the map that associates formats to image sizes\n> - * \\return The map that associates formats to image sizes\n> - */\n> -const std::map<unsigned int, std::vector<SizeRange>> &ImageFormats::data() const\n> -{\n> -\treturn data_;\n> -}\n> -\n>  /**\n>   * \\class PixelFormatInfo\n>   * \\brief Information about pixel formats","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 7F9E2BFFE2\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  2 Jul 2020 14:08:04 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 11C2660C57;\n\tThu,  2 Jul 2020 16:08:04 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4652C603B4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  2 Jul 2020 16:08:03 +0200 (CEST)","from pendragon.ideasonboard.com (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 5B29A293;\n\tThu,  2 Jul 2020 16:08:02 +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=\"Z/gBAXgh\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1593698882;\n\tbh=E2Y0WSY2TzmOG4jNEaDlLldoyDH8qkRuyfVhXQLGAdQ=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=Z/gBAXgh8PWR107gemL+5lLheMpC1jbSxXQPu411idx3nohD2+CZTBP54NdIB22sc\n\tZruXu90n1IOiEVfBxISkeS+46a5zfkNw4tBxxPr985zFhLTREjGbcrQQ2JC9RjnnGR\n\tBdGWnNDOL/5xfMmMXV7m2/JMKgnR6E85Tg3JGsv4=","Date":"Thu, 2 Jul 2020 17:07:57 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Niklas =?utf-8?q?S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","Message-ID":"<20200702140757.GJ12562@pendragon.ideasonboard.com>","References":"<20200701211650.1002567-1-niklas.soderlund@ragnatech.se>\n\t<20200701211650.1002567-3-niklas.soderlund@ragnatech.se>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20200701211650.1002567-3-niklas.soderlund@ragnatech.se>","Subject":"Re: [libcamera-devel] [RFC 2/2] libcamera: formats: Remove\n\tImageFormats","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":"libcamera-devel@lists.libcamera.org","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>"}}]