[libcamera-devel] libcamera: formats: Remove unnecessary explicit constructor calls

Message ID 20200723233852.17415-1-laurent.pinchart@ideasonboard.com
State Accepted
Commit 7145d15e043a9066a7e0a6a53ba95b1b1af851d5
Headers show
Series
  • [libcamera-devel] libcamera: formats: Remove unnecessary explicit constructor calls
Related show

Commit Message

Laurent Pinchart July 23, 2020, 11:38 p.m. UTC
When initializing the PixelFormatInfo::format field with a PixelFormat,
there's no need to cal the PixelFormat (copy) constructor explicitly.
Remove the unnecessary calls.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 src/libcamera/formats.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Niklas Söderlund July 24, 2020, 7:17 a.m. UTC | #1
Hi Laurent,

Thanks for your work.

On 2020-07-24 02:38:52 +0300, Laurent Pinchart wrote:
> When initializing the PixelFormatInfo::format field with a PixelFormat,
> there's no need to cal the PixelFormat (copy) constructor explicitly.
> Remove the unnecessary calls.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>

> ---
>  src/libcamera/formats.cpp | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp
> index 60b42ce23c21..11774b0cfb12 100644
> --- a/src/libcamera/formats.cpp
> +++ b/src/libcamera/formats.cpp
> @@ -321,7 +321,7 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  	} },
>  	{ formats::YUV420, {
>  		.name = "YUV420",
> -		.format = PixelFormat(formats::YUV420),
> +		.format = formats::YUV420,
>  		.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_YUV420),
>  		.bitsPerPixel = 12,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
> @@ -331,7 +331,7 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  	} },
>  	{ formats::YVU420, {
>  		.name = "YVU420",
> -		.format = PixelFormat(formats::YVU420),
> +		.format = formats::YVU420,
>  		.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_YVU420),
>  		.bitsPerPixel = 12,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
> @@ -341,7 +341,7 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  	} },
>  	{ formats::YUV422, {
>  		.name = "YUV422",
> -		.format = PixelFormat(formats::YUV422),
> +		.format = formats::YUV422,
>  		.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_YUV422P),
>  		.bitsPerPixel = 16,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
Kieran Bingham July 24, 2020, 9:41 a.m. UTC | #2
Hi Laurent,

On 24/07/2020 00:38, Laurent Pinchart wrote:
> When initializing the PixelFormatInfo::format field with a PixelFormat,
> there's no need to cal the PixelFormat (copy) constructor explicitly.

s/cal/call/

> Remove the unnecessary calls.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>


Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

> ---
>  src/libcamera/formats.cpp | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp
> index 60b42ce23c21..11774b0cfb12 100644
> --- a/src/libcamera/formats.cpp
> +++ b/src/libcamera/formats.cpp
> @@ -321,7 +321,7 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  	} },
>  	{ formats::YUV420, {
>  		.name = "YUV420",
> -		.format = PixelFormat(formats::YUV420),
> +		.format = formats::YUV420,
>  		.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_YUV420),
>  		.bitsPerPixel = 12,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
> @@ -331,7 +331,7 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  	} },
>  	{ formats::YVU420, {
>  		.name = "YVU420",
> -		.format = PixelFormat(formats::YVU420),
> +		.format = formats::YVU420,
>  		.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_YVU420),
>  		.bitsPerPixel = 12,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
> @@ -341,7 +341,7 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  	} },
>  	{ formats::YUV422, {
>  		.name = "YUV422",
> -		.format = PixelFormat(formats::YUV422),
> +		.format = formats::YUV422,
>  		.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_YUV422P),
>  		.bitsPerPixel = 16,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
>

Patch

diff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp
index 60b42ce23c21..11774b0cfb12 100644
--- a/src/libcamera/formats.cpp
+++ b/src/libcamera/formats.cpp
@@ -321,7 +321,7 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 	} },
 	{ formats::YUV420, {
 		.name = "YUV420",
-		.format = PixelFormat(formats::YUV420),
+		.format = formats::YUV420,
 		.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_YUV420),
 		.bitsPerPixel = 12,
 		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
@@ -331,7 +331,7 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 	} },
 	{ formats::YVU420, {
 		.name = "YVU420",
-		.format = PixelFormat(formats::YVU420),
+		.format = formats::YVU420,
 		.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_YVU420),
 		.bitsPerPixel = 12,
 		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
@@ -341,7 +341,7 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 	} },
 	{ formats::YUV422, {
 		.name = "YUV422",
-		.format = PixelFormat(formats::YUV422),
+		.format = formats::YUV422,
 		.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_YUV422P),
 		.bitsPerPixel = 16,
 		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,