[{"id":4588,"web_url":"https://patchwork.libcamera.org/comment/4588/","msgid":"<20200427224138.GB1165729@oden.dyn.berto.se>","date":"2020-04-27T22:41:38","subject":"Re: [libcamera-devel] [PATCH 1/2] libcamera: controls: Add\n\trectangle and size control types","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Laurent,\n\nThanks for your work.\n\nOn 2020-04-25 23:56:38 +0300, Laurent Pinchart wrote:\n> Add two control types to store rectangles and sizes. These will be\n> useful for the properties related to the pixel array.\n> \n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\n> ---\n>  include/libcamera/controls.h | 13 +++++++++++++\n>  src/libcamera/controls.cpp   | 12 ++++++++++++\n>  2 files changed, 25 insertions(+)\n> \n> diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h\n> index 4b2e7e9cdd6c..80944efc133a 100644\n> --- a/include/libcamera/controls.h\n> +++ b/include/libcamera/controls.h\n> @@ -13,6 +13,7 @@\n>  #include <string>\n>  #include <unordered_map>\n>  \n> +#include <libcamera/geometry.h>\n>  #include <libcamera/span.h>\n>  \n>  namespace libcamera {\n> @@ -27,6 +28,8 @@ enum ControlType {\n>  \tControlTypeInteger64,\n>  \tControlTypeFloat,\n>  \tControlTypeString,\n> +\tControlTypeRectangle,\n> +\tControlTypeSize,\n>  };\n>  \n>  namespace details {\n> @@ -70,6 +73,16 @@ struct control_type<std::string> {\n>  \tstatic constexpr ControlType value = ControlTypeString;\n>  };\n>  \n> +template<>\n> +struct control_type<Rectangle> {\n> +\tstatic constexpr ControlType value = ControlTypeRectangle;\n> +};\n> +\n> +template<>\n> +struct control_type<Size> {\n> +\tstatic constexpr ControlType value = ControlTypeSize;\n> +};\n> +\n>  template<typename T, std::size_t N>\n>  struct control_type<Span<T, N>> : public control_type<std::remove_cv_t<T>> {\n>  };\n> diff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp\n> index 540cc026417a..08df7f29e938 100644\n> --- a/src/libcamera/controls.cpp\n> +++ b/src/libcamera/controls.cpp\n> @@ -58,6 +58,8 @@ static constexpr size_t ControlValueSize[] = {\n>  \t[ControlTypeInteger64]\t\t= sizeof(int64_t),\n>  \t[ControlTypeFloat]\t\t= sizeof(float),\n>  \t[ControlTypeString]\t\t= sizeof(char),\n> +\t[ControlTypeRectangle]\t\t= sizeof(Rectangle),\n> +\t[ControlTypeSize]\t\t= sizeof(Size),\n>  };\n>  \n>  } /* namespace */\n> @@ -242,6 +244,16 @@ std::string ControlValue::toString() const\n>  \t\t\tstr += std::to_string(*value);\n>  \t\t\tbreak;\n>  \t\t}\n> +\t\tcase ControlTypeRectangle: {\n> +\t\t\tconst Rectangle *value = reinterpret_cast<const Rectangle *>(data);\n> +\t\t\tstr += value->toString();\n> +\t\t\tbreak;\n> +\t\t}\n> +\t\tcase ControlTypeSize: {\n> +\t\t\tconst Size *value = reinterpret_cast<const Size *>(data);\n> +\t\t\tstr += value->toString();\n> +\t\t\tbreak;\n> +\t\t}\n>  \t\tcase ControlTypeNone:\n>  \t\tcase ControlTypeString:\n>  \t\t\tbreak;\n> -- \n> Regards,\n> \n> Laurent Pinchart\n> \n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["from mail-lj1-x244.google.com (mail-lj1-x244.google.com\n\t[IPv6:2a00:1450:4864:20::244])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1674460AF4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 28 Apr 2020 00:41:41 +0200 (CEST)","by mail-lj1-x244.google.com with SMTP id y4so19420958ljn.7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 27 Apr 2020 15:41:41 -0700 (PDT)","from localhost (h-209-203.A463.priv.bahnhof.se. [155.4.209.203])\n\tby smtp.gmail.com with ESMTPSA id\n\tf15sm12128173lfh.76.2020.04.27.15.41.39\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 27 Apr 2020 15:41:39 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected)\n\theader.d=ragnatech-se.20150623.gappssmtp.com\n\theader.i=@ragnatech-se.20150623.gappssmtp.com header.b=\"q/jWvt/0\"; \n\tdkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ragnatech-se.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:content-transfer-encoding:in-reply-to;\n\tbh=WZ+MMbDqsKWGoiP8OdjGG9C7cFjseqhhhroEjV5iF7g=;\n\tb=q/jWvt/0Sn5qMaXsq7kbWB2XsTBg5dHDPsOI5AixII6JnZ1xAUWKmZIyTnMVhkD55m\n\tv2dfTly29ShIursYbiGDWzc0yuMfOKROFFJjVGxCCYkJ91h75Hy4IzZhb+7YM52prkqA\n\tUHuGMr5iW/OpMp4G1UZLQ15zpZkP/8ut7ubk58UxUUP1kmQd3+IReClHUx9bQppY40bW\n\tXy7gwL5uZZ3IejQv1MmV9dUlf6Et6CZaNfCbYsvmtUr4UQoDZ9Ycdr7nk2KGRKzE/VW+\n\tLaEXWLh19WQ9kYOgWl2PHZVGVPrwh5R4GHsdHTK6JxKqgYFPkyaikvUZwJDDGWhoYDz3\n\thXKA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:content-transfer-encoding\n\t:in-reply-to;\n\tbh=WZ+MMbDqsKWGoiP8OdjGG9C7cFjseqhhhroEjV5iF7g=;\n\tb=Jg3zzsjEvoYJgdgTZZKgZdkju20CM4ZXnTLO1oqF4HWEimhhdFi4eqK8X3bNtQ9Nc5\n\tYHmRCuxjzoUcVT9UwByspdtzkc0Wzal7BXjduZZ1oU53lvWqTty138f0Mq9btwkxxFCl\n\tlTZjpHFlXTtw7UVCmMU8E/ihwedKjreyoJtBlTf7936kwMuhOM/jzOQt957cGZOQCXAZ\n\tmMldQ8H0vzKfXC+qOq2e7ZcziLquD9dTR1gcoqdflhpcerhOb5ErbmydqaV50zwgWGlT\n\tT9oHo774Y6hLACkDS0dutfx7PeHLlIECS1hYNd7h2JzZfSw7YN3Gq+GVkZxpAJGc3LeE\n\tyOCQ==","X-Gm-Message-State":"AGi0PuYYspSimAQAZGlmiNItk591FrG7zCTaEXYY2y8LnL1WRrcifbu8\n\tkYXT5oKXMIgIEk2xhV8iqo2suys+Nbg=","X-Google-Smtp-Source":"APiQypKDaOMkMyNLH15PN+8I6P05ozhmQamfdN9rl1ntQu2Cpx14IWBa/5YiRbwBpvkdkwV/vnc2Vw==","X-Received":"by 2002:a05:651c:1058:: with SMTP id\n\tx24mr16198480ljm.39.1588027300197; \n\tMon, 27 Apr 2020 15:41:40 -0700 (PDT)","Date":"Tue, 28 Apr 2020 00:41:38 +0200","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20200427224138.GB1165729@oden.dyn.berto.se>","References":"<20200425205639.30566-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=iso-8859-1","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20200425205639.30566-1-laurent.pinchart@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH 1/2] libcamera: controls: Add\n\trectangle and size control types","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>","X-List-Received-Date":"Mon, 27 Apr 2020 22:41:41 -0000"}},{"id":4613,"web_url":"https://patchwork.libcamera.org/comment/4613/","msgid":"<20200428075647.4fm4rrh5lpywz6pe@uno.localdomain>","date":"2020-04-28T07:56:47","subject":"Re: [libcamera-devel] [PATCH 1/2] libcamera: controls: Add\n\trectangle and size control types","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Laurent,\n\nOn Sat, Apr 25, 2020 at 11:56:38PM +0300, Laurent Pinchart wrote:\n> Add two control types to store rectangles and sizes. These will be\n> useful for the properties related to the pixel array.\n>\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n\nPlease push this one!\n\n> ---\n>  include/libcamera/controls.h | 13 +++++++++++++\n>  src/libcamera/controls.cpp   | 12 ++++++++++++\n>  2 files changed, 25 insertions(+)\n>\n> diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h\n> index 4b2e7e9cdd6c..80944efc133a 100644\n> --- a/include/libcamera/controls.h\n> +++ b/include/libcamera/controls.h\n> @@ -13,6 +13,7 @@\n>  #include <string>\n>  #include <unordered_map>\n>\n> +#include <libcamera/geometry.h>\n>  #include <libcamera/span.h>\n>\n>  namespace libcamera {\n> @@ -27,6 +28,8 @@ enum ControlType {\n>  \tControlTypeInteger64,\n>  \tControlTypeFloat,\n>  \tControlTypeString,\n> +\tControlTypeRectangle,\n> +\tControlTypeSize,\n>  };\n>\n>  namespace details {\n> @@ -70,6 +73,16 @@ struct control_type<std::string> {\n>  \tstatic constexpr ControlType value = ControlTypeString;\n>  };\n>\n> +template<>\n> +struct control_type<Rectangle> {\n> +\tstatic constexpr ControlType value = ControlTypeRectangle;\n> +};\n> +\n> +template<>\n> +struct control_type<Size> {\n> +\tstatic constexpr ControlType value = ControlTypeSize;\n> +};\n> +\n>  template<typename T, std::size_t N>\n>  struct control_type<Span<T, N>> : public control_type<std::remove_cv_t<T>> {\n>  };\n> diff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp\n> index 540cc026417a..08df7f29e938 100644\n> --- a/src/libcamera/controls.cpp\n> +++ b/src/libcamera/controls.cpp\n> @@ -58,6 +58,8 @@ static constexpr size_t ControlValueSize[] = {\n>  \t[ControlTypeInteger64]\t\t= sizeof(int64_t),\n>  \t[ControlTypeFloat]\t\t= sizeof(float),\n>  \t[ControlTypeString]\t\t= sizeof(char),\n> +\t[ControlTypeRectangle]\t\t= sizeof(Rectangle),\n> +\t[ControlTypeSize]\t\t= sizeof(Size),\n>  };\n>\n>  } /* namespace */\n> @@ -242,6 +244,16 @@ std::string ControlValue::toString() const\n>  \t\t\tstr += std::to_string(*value);\n>  \t\t\tbreak;\n>  \t\t}\n> +\t\tcase ControlTypeRectangle: {\n> +\t\t\tconst Rectangle *value = reinterpret_cast<const Rectangle *>(data);\n> +\t\t\tstr += value->toString();\n> +\t\t\tbreak;\n> +\t\t}\n> +\t\tcase ControlTypeSize: {\n> +\t\t\tconst Size *value = reinterpret_cast<const Size *>(data);\n> +\t\t\tstr += value->toString();\n> +\t\t\tbreak;\n> +\t\t}\n>  \t\tcase ControlTypeNone:\n>  \t\tcase ControlTypeString:\n>  \t\t\tbreak;\n> --\n> Regards,\n>\n> Laurent Pinchart\n>","headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net\n\t[217.70.183.201])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id AE50B603F7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 28 Apr 2020 09:53:37 +0200 (CEST)","from uno.localdomain (a-ur1-85.tin.it [212.216.150.148])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay8-d.mail.gandi.net (Postfix) with ESMTPSA id E15141BF205;\n\tTue, 28 Apr 2020 07:53:36 +0000 (UTC)"],"X-Originating-IP":"212.216.150.148","Date":"Tue, 28 Apr 2020 09:56:47 +0200","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20200428075647.4fm4rrh5lpywz6pe@uno.localdomain>","References":"<20200425205639.30566-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20200425205639.30566-1-laurent.pinchart@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH 1/2] libcamera: controls: Add\n\trectangle and size control types","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>","X-List-Received-Date":"Tue, 28 Apr 2020 07:53:37 -0000"}}]