[{"id":20574,"web_url":"https://patchwork.libcamera.org/comment/20574/","msgid":"<CAEmqJPoyc9UdUJPLYZx1m+P_1EOxyjyxihuF8K=XnjA2-N0Sqw@mail.gmail.com>","date":"2021-10-27T12:48:09","subject":"Re: [libcamera-devel] [PATCH] libcamera: bayer_format: Turn\n\tBayerFormat::Packing into scoped enum","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/people/34/","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"content":"Hi Laurent,\n\nThank you for your patch.\n\nOn Wed, 27 Oct 2021 at 13:36, Laurent Pinchart <\nlaurent.pinchart@ideasonboard.com> wrote:\n\n> The unscoped enum BayerFormat::Packing leads to usage of the ambiguous\n> BayerFormat::None enumerator. Turn the enumeration into a scoped enum to\n> force usage of BayerFormat::Packing::None, and drop the now redundant\n> \"Packed\" suffix for the CSI2 and IPU3 packing.\n>\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n>\n\nThis is going to conflict badly with my series :-)\nI definitely prefer scoped enums, but do you think we ought to do the\nsame with the Order enum in this change?\n\nRegards,\nNaush\n\n\n---\n>  include/libcamera/internal/bayer_format.h |   6 +-\n>  src/libcamera/bayer_format.cpp            | 138 +++++++++++-----------\n>  test/bayer-format.cpp                     |  28 ++---\n>  3 files changed, 86 insertions(+), 86 deletions(-)\n>\n> diff --git a/include/libcamera/internal/bayer_format.h\n> b/include/libcamera/internal/bayer_format.h\n> index 723382d4168d..d9a56d744a25 100644\n> --- a/include/libcamera/internal/bayer_format.h\n> +++ b/include/libcamera/internal/bayer_format.h\n> @@ -27,10 +27,10 @@ public:\n>                 MONO = 4\n>         };\n>\n> -       enum Packing : uint16_t {\n> +       enum class Packing : uint16_t {\n>                 None = 0,\n> -               CSI2Packed = 1,\n> -               IPU3Packed = 2,\n> +               CSI2 = 1,\n> +               IPU3 = 2,\n>         };\n>\n>         constexpr BayerFormat()\n> diff --git a/src/libcamera/bayer_format.cpp\n> b/src/libcamera/bayer_format.cpp\n> index 11355f144f66..1c1e849a7e31 100644\n> --- a/src/libcamera/bayer_format.cpp\n> +++ b/src/libcamera/bayer_format.cpp\n> @@ -53,11 +53,11 @@ namespace libcamera {\n>   * \\enum BayerFormat::Packing\n>   * \\brief Different types of packing that can be applied to a BayerFormat\n>   *\n> - * \\var BayerFormat::None\n> + * \\var BayerFormat::Packing::None\n>   * \\brief No packing\n> - * \\var BayerFormat::CSI2Packed\n> + * \\var BayerFormat::Packing::CSI2\n>   * \\brief Format uses MIPI CSI-2 style packing\n> - * \\var BayerFormat::IPU3Packed\n> + * \\var BayerFormat::Packing::IPU3\n>   * \\brief Format uses IPU3 style packing\n>   */\n>\n> @@ -85,73 +85,73 @@ struct BayerFormatComparator {\n>  };\n>\n>  const std::map<BayerFormat, V4L2PixelFormat, BayerFormatComparator>\n> bayerToV4l2{\n> -       { { BayerFormat::BGGR, 8, BayerFormat::None },\n> V4L2PixelFormat(V4L2_PIX_FMT_SBGGR8) },\n> -       { { BayerFormat::GBRG, 8, BayerFormat::None },\n> V4L2PixelFormat(V4L2_PIX_FMT_SGBRG8) },\n> -       { { BayerFormat::GRBG, 8, BayerFormat::None },\n> V4L2PixelFormat(V4L2_PIX_FMT_SGRBG8) },\n> -       { { BayerFormat::RGGB, 8, BayerFormat::None },\n> V4L2PixelFormat(V4L2_PIX_FMT_SRGGB8) },\n> -       { { BayerFormat::BGGR, 10, BayerFormat::None },\n> V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10) },\n> -       { { BayerFormat::GBRG, 10, BayerFormat::None },\n> V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10) },\n> -       { { BayerFormat::GRBG, 10, BayerFormat::None },\n> V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10) },\n> -       { { BayerFormat::RGGB, 10, BayerFormat::None },\n> V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10) },\n> -       { { BayerFormat::BGGR, 10, BayerFormat::CSI2Packed },\n> V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10P) },\n> -       { { BayerFormat::GBRG, 10, BayerFormat::CSI2Packed },\n> V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10P) },\n> -       { { BayerFormat::GRBG, 10, BayerFormat::CSI2Packed },\n> V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10P) },\n> -       { { BayerFormat::RGGB, 10, BayerFormat::CSI2Packed },\n> V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10P) },\n> -       { { BayerFormat::BGGR, 10, BayerFormat::IPU3Packed },\n> V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SBGGR10) },\n> -       { { BayerFormat::GBRG, 10, BayerFormat::IPU3Packed },\n> V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SGBRG10) },\n> -       { { BayerFormat::GRBG, 10, BayerFormat::IPU3Packed },\n> V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SGRBG10) },\n> -       { { BayerFormat::RGGB, 10, BayerFormat::IPU3Packed },\n> V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SRGGB10) },\n> -       { { BayerFormat::BGGR, 12, BayerFormat::None },\n> V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12) },\n> -       { { BayerFormat::GBRG, 12, BayerFormat::None },\n> V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12) },\n> -       { { BayerFormat::GRBG, 12, BayerFormat::None },\n> V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12) },\n> -       { { BayerFormat::RGGB, 12, BayerFormat::None },\n> V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12) },\n> -       { { BayerFormat::BGGR, 12, BayerFormat::CSI2Packed },\n> V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12P) },\n> -       { { BayerFormat::GBRG, 12, BayerFormat::CSI2Packed },\n> V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12P) },\n> -       { { BayerFormat::GRBG, 12, BayerFormat::CSI2Packed },\n> V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12P) },\n> -       { { BayerFormat::RGGB, 12, BayerFormat::CSI2Packed },\n> V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12P) },\n> -       { { BayerFormat::BGGR, 16, BayerFormat::None },\n> V4L2PixelFormat(V4L2_PIX_FMT_SBGGR16) },\n> -       { { BayerFormat::GBRG, 16, BayerFormat::None },\n> V4L2PixelFormat(V4L2_PIX_FMT_SGBRG16) },\n> -       { { BayerFormat::GRBG, 16, BayerFormat::None },\n> V4L2PixelFormat(V4L2_PIX_FMT_SGRBG16) },\n> -       { { BayerFormat::RGGB, 16, BayerFormat::None },\n> V4L2PixelFormat(V4L2_PIX_FMT_SRGGB16) },\n> -       { { BayerFormat::MONO, 8, BayerFormat::None },\n> V4L2PixelFormat(V4L2_PIX_FMT_GREY) },\n> -       { { BayerFormat::MONO, 10, BayerFormat::CSI2Packed },\n> V4L2PixelFormat(V4L2_PIX_FMT_Y10P) },\n> +       { { BayerFormat::BGGR, 8, BayerFormat::Packing::None },\n> V4L2PixelFormat(V4L2_PIX_FMT_SBGGR8) },\n> +       { { BayerFormat::GBRG, 8, BayerFormat::Packing::None },\n> V4L2PixelFormat(V4L2_PIX_FMT_SGBRG8) },\n> +       { { BayerFormat::GRBG, 8, BayerFormat::Packing::None },\n> V4L2PixelFormat(V4L2_PIX_FMT_SGRBG8) },\n> +       { { BayerFormat::RGGB, 8, BayerFormat::Packing::None },\n> V4L2PixelFormat(V4L2_PIX_FMT_SRGGB8) },\n> +       { { BayerFormat::BGGR, 10, BayerFormat::Packing::None },\n> V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10) },\n> +       { { BayerFormat::GBRG, 10, BayerFormat::Packing::None },\n> V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10) },\n> +       { { BayerFormat::GRBG, 10, BayerFormat::Packing::None },\n> V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10) },\n> +       { { BayerFormat::RGGB, 10, BayerFormat::Packing::None },\n> V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10) },\n> +       { { BayerFormat::BGGR, 10, BayerFormat::Packing::CSI2 },\n> V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10P) },\n> +       { { BayerFormat::GBRG, 10, BayerFormat::Packing::CSI2 },\n> V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10P) },\n> +       { { BayerFormat::GRBG, 10, BayerFormat::Packing::CSI2 },\n> V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10P) },\n> +       { { BayerFormat::RGGB, 10, BayerFormat::Packing::CSI2 },\n> V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10P) },\n> +       { { BayerFormat::BGGR, 10, BayerFormat::Packing::IPU3 },\n> V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SBGGR10) },\n> +       { { BayerFormat::GBRG, 10, BayerFormat::Packing::IPU3 },\n> V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SGBRG10) },\n> +       { { BayerFormat::GRBG, 10, BayerFormat::Packing::IPU3 },\n> V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SGRBG10) },\n> +       { { BayerFormat::RGGB, 10, BayerFormat::Packing::IPU3 },\n> V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SRGGB10) },\n> +       { { BayerFormat::BGGR, 12, BayerFormat::Packing::None },\n> V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12) },\n> +       { { BayerFormat::GBRG, 12, BayerFormat::Packing::None },\n> V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12) },\n> +       { { BayerFormat::GRBG, 12, BayerFormat::Packing::None },\n> V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12) },\n> +       { { BayerFormat::RGGB, 12, BayerFormat::Packing::None },\n> V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12) },\n> +       { { BayerFormat::BGGR, 12, BayerFormat::Packing::CSI2 },\n> V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12P) },\n> +       { { BayerFormat::GBRG, 12, BayerFormat::Packing::CSI2 },\n> V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12P) },\n> +       { { BayerFormat::GRBG, 12, BayerFormat::Packing::CSI2 },\n> V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12P) },\n> +       { { BayerFormat::RGGB, 12, BayerFormat::Packing::CSI2 },\n> V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12P) },\n> +       { { BayerFormat::BGGR, 16, BayerFormat::Packing::None },\n> V4L2PixelFormat(V4L2_PIX_FMT_SBGGR16) },\n> +       { { BayerFormat::GBRG, 16, BayerFormat::Packing::None },\n> V4L2PixelFormat(V4L2_PIX_FMT_SGBRG16) },\n> +       { { BayerFormat::GRBG, 16, BayerFormat::Packing::None },\n> V4L2PixelFormat(V4L2_PIX_FMT_SGRBG16) },\n> +       { { BayerFormat::RGGB, 16, BayerFormat::Packing::None },\n> V4L2PixelFormat(V4L2_PIX_FMT_SRGGB16) },\n> +       { { BayerFormat::MONO, 8, BayerFormat::Packing::None },\n> V4L2PixelFormat(V4L2_PIX_FMT_GREY) },\n> +       { { BayerFormat::MONO, 10, BayerFormat::Packing::CSI2 },\n> V4L2PixelFormat(V4L2_PIX_FMT_Y10P) },\n>  };\n>\n>  const std::unordered_map<unsigned int, BayerFormat> mbusCodeToBayer{\n> -       { MEDIA_BUS_FMT_SBGGR8_1X8, { BayerFormat::BGGR, 8,\n> BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SGBRG8_1X8, { BayerFormat::GBRG, 8,\n> BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SGRBG8_1X8, { BayerFormat::GRBG, 8,\n> BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SRGGB8_1X8, { BayerFormat::RGGB, 8,\n> BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SBGGR10_ALAW8_1X8, { BayerFormat::BGGR, 8,\n> BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SGBRG10_ALAW8_1X8, { BayerFormat::GBRG, 8,\n> BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SGRBG10_ALAW8_1X8, { BayerFormat::GRBG, 8,\n> BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SRGGB10_ALAW8_1X8, { BayerFormat::RGGB, 8,\n> BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SBGGR10_DPCM8_1X8, { BayerFormat::BGGR, 8,\n> BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SGBRG10_DPCM8_1X8, { BayerFormat::GBRG, 8,\n> BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SGRBG10_DPCM8_1X8, { BayerFormat::GRBG, 8,\n> BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SRGGB10_DPCM8_1X8, { BayerFormat::RGGB, 8,\n> BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_BE, { BayerFormat::BGGR, 10,\n> BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_LE, { BayerFormat::BGGR, 10,\n> BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SBGGR10_2X8_PADLO_BE, { BayerFormat::BGGR, 10,\n> BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SBGGR10_2X8_PADLO_LE, { BayerFormat::BGGR, 10,\n> BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SBGGR10_1X10, { BayerFormat::BGGR, 10,\n> BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SGBRG10_1X10, { BayerFormat::GBRG, 10,\n> BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SGRBG10_1X10, { BayerFormat::GRBG, 10,\n> BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SRGGB10_1X10, { BayerFormat::RGGB, 10,\n> BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SBGGR12_1X12, { BayerFormat::BGGR, 12,\n> BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SGBRG12_1X12, { BayerFormat::GBRG, 12,\n> BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SGRBG12_1X12, { BayerFormat::GRBG, 12,\n> BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SRGGB12_1X12, { BayerFormat::RGGB, 12,\n> BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SBGGR14_1X14, { BayerFormat::BGGR, 14,\n> BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SGBRG14_1X14, { BayerFormat::GBRG, 14,\n> BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SGRBG14_1X14, { BayerFormat::GRBG, 14,\n> BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SRGGB14_1X14, { BayerFormat::RGGB, 14,\n> BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SBGGR16_1X16, { BayerFormat::BGGR, 16,\n> BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SGBRG16_1X16, { BayerFormat::GBRG, 16,\n> BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SGRBG16_1X16, { BayerFormat::GRBG, 16,\n> BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SRGGB16_1X16, { BayerFormat::RGGB, 16,\n> BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_Y8_1X8, { BayerFormat::MONO, 8, BayerFormat::None\n> } },\n> -       { MEDIA_BUS_FMT_Y10_1X10, { BayerFormat::MONO, 10,\n> BayerFormat::None } },\n> +       { MEDIA_BUS_FMT_SBGGR8_1X8, { BayerFormat::BGGR, 8,\n> BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SGBRG8_1X8, { BayerFormat::GBRG, 8,\n> BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SGRBG8_1X8, { BayerFormat::GRBG, 8,\n> BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SRGGB8_1X8, { BayerFormat::RGGB, 8,\n> BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SBGGR10_ALAW8_1X8, { BayerFormat::BGGR, 8,\n> BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SGBRG10_ALAW8_1X8, { BayerFormat::GBRG, 8,\n> BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SGRBG10_ALAW8_1X8, { BayerFormat::GRBG, 8,\n> BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SRGGB10_ALAW8_1X8, { BayerFormat::RGGB, 8,\n> BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SBGGR10_DPCM8_1X8, { BayerFormat::BGGR, 8,\n> BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SGBRG10_DPCM8_1X8, { BayerFormat::GBRG, 8,\n> BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SGRBG10_DPCM8_1X8, { BayerFormat::GRBG, 8,\n> BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SRGGB10_DPCM8_1X8, { BayerFormat::RGGB, 8,\n> BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_BE, { BayerFormat::BGGR, 10,\n> BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_LE, { BayerFormat::BGGR, 10,\n> BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SBGGR10_2X8_PADLO_BE, { BayerFormat::BGGR, 10,\n> BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SBGGR10_2X8_PADLO_LE, { BayerFormat::BGGR, 10,\n> BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SBGGR10_1X10, { BayerFormat::BGGR, 10,\n> BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SGBRG10_1X10, { BayerFormat::GBRG, 10,\n> BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SGRBG10_1X10, { BayerFormat::GRBG, 10,\n> BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SRGGB10_1X10, { BayerFormat::RGGB, 10,\n> BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SBGGR12_1X12, { BayerFormat::BGGR, 12,\n> BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SGBRG12_1X12, { BayerFormat::GBRG, 12,\n> BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SGRBG12_1X12, { BayerFormat::GRBG, 12,\n> BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SRGGB12_1X12, { BayerFormat::RGGB, 12,\n> BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SBGGR14_1X14, { BayerFormat::BGGR, 14,\n> BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SGBRG14_1X14, { BayerFormat::GBRG, 14,\n> BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SGRBG14_1X14, { BayerFormat::GRBG, 14,\n> BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SRGGB14_1X14, { BayerFormat::RGGB, 14,\n> BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SBGGR16_1X16, { BayerFormat::BGGR, 16,\n> BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SGBRG16_1X16, { BayerFormat::GBRG, 16,\n> BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SGRBG16_1X16, { BayerFormat::GRBG, 16,\n> BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SRGGB16_1X16, { BayerFormat::RGGB, 16,\n> BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_Y8_1X8, { BayerFormat::MONO, 8,\n> BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_Y10_1X10, { BayerFormat::MONO, 10,\n> BayerFormat::Packing::None } },\n>  };\n>\n>  } /* namespace */\n> @@ -214,9 +214,9 @@ std::string BayerFormat::toString() const\n>\n>         result += \"-\" + std::to_string(bitDepth);\n>\n> -       if (packing == CSI2Packed)\n> +       if (packing == Packing::CSI2)\n>                 result += \"-CSI2P\";\n> -       else if (packing == IPU3Packed)\n> +       else if (packing == Packing::IPU3)\n>                 result += \"-IPU3P\";\n>\n>         return result;\n> diff --git a/test/bayer-format.cpp b/test/bayer-format.cpp\n> index e396ee83ca91..135bcb5214c8 100644\n> --- a/test/bayer-format.cpp\n> +++ b/test/bayer-format.cpp\n> @@ -30,7 +30,7 @@ protected:\n>                 }\n>\n>                 /* A correct Bayer format has to be valid. */\n> -               bayerFmt = BayerFormat(BayerFormat::BGGR, 8,\n> BayerFormat::None);\n> +               bayerFmt = BayerFormat(BayerFormat::BGGR, 8,\n> BayerFormat::Packing::None);\n>                 if (!bayerFmt.isValid()) {\n>                         cerr << \"A correct BayerFormat has to be valid.\"\n>                              << endl;\n> @@ -41,9 +41,9 @@ protected:\n>                  * Two bayer formats created with the same order and bit\n> depth\n>                  * have to be equal.\n>                  */\n> -               bayerFmt = BayerFormat(BayerFormat::BGGR, 8,\n> BayerFormat::None);\n> +               bayerFmt = BayerFormat(BayerFormat::BGGR, 8,\n> BayerFormat::Packing::None);\n>                 BayerFormat bayerFmtExpect =\n> BayerFormat(BayerFormat::BGGR, 8,\n> -\n> BayerFormat::None);\n> +\n> BayerFormat::Packing::None);\n>                 if (bayerFmt != bayerFmtExpect) {\n>                         cerr << \"Comparison of identical formats failed.\"\n>                              << endl;\n> @@ -54,9 +54,9 @@ protected:\n>                  * Two Bayer formats created with the same order but with a\n>                  * different bitDepth are not equal.\n>                  */\n> -               bayerFmt = BayerFormat(BayerFormat::BGGR, 8,\n> BayerFormat::None);\n> +               bayerFmt = BayerFormat(BayerFormat::BGGR, 8,\n> BayerFormat::Packing::None);\n>                 bayerFmtExpect = BayerFormat(BayerFormat::BGGR, 12,\n> -                                            BayerFormat::None);\n> +                                            BayerFormat::Packing::None);\n>                 if (bayerFmt == bayerFmtExpect) {\n>                         cerr << \"Comparison of different formats failed.\"\n>                              << endl;\n> @@ -96,7 +96,7 @@ protected:\n>                  * to a Bayer format.\n>                  */\n>                 bayerFmtExpect = BayerFormat(BayerFormat::BGGR, 8,\n> -                                            BayerFormat::None);\n> +                                            BayerFormat::Packing::None);\n>                 v4l2Fmt = V4L2PixelFormat(V4L2_PIX_FMT_SBGGR8);\n>                 bayerFmt = BayerFormat::fromV4L2PixelFormat(v4l2Fmt);\n>                 if (bayerFmt != bayerFmtExpect) {\n> @@ -123,7 +123,7 @@ protected:\n>                  * Test if a valid Bayer format can be converted to a\n>                  * string representation.\n>                  */\n> -               bayerFmt = BayerFormat(BayerFormat::BGGR, 8,\n> BayerFormat::None);\n> +               bayerFmt = BayerFormat(BayerFormat::BGGR, 8,\n> BayerFormat::Packing::None);\n>                 if (bayerFmt.toString() != \"BGGR-8\") {\n>                         cerr << \"String representation != 'BGGR-8' (got: '\"\n>                              << bayerFmt.toString() << \"' ) \" << endl;\n> @@ -145,9 +145,9 @@ protected:\n>                  * Perform a horizontal Flip and make sure that the\n>                  * order is adjusted accordingly.\n>                  */\n> -               bayerFmt = BayerFormat(BayerFormat::BGGR, 8,\n> BayerFormat::None);\n> +               bayerFmt = BayerFormat(BayerFormat::BGGR, 8,\n> BayerFormat::Packing::None);\n>                 bayerFmtExpect = BayerFormat(BayerFormat::GBRG, 8,\n> -                                            BayerFormat::None);\n> +                                            BayerFormat::Packing::None);\n>                 BayerFormat hFlipFmt =\n> bayerFmt.transform(Transform::HFlip);\n>                 if (hFlipFmt != bayerFmtExpect) {\n>                         cerr << \"Horizontal flip of 'BGGR-8' should result\n> in '\"\n> @@ -160,9 +160,9 @@ protected:\n>                  * Perform a vertical Flip and make sure that\n>                  * the order is adjusted accordingly.\n>                  */\n> -               bayerFmt = BayerFormat(BayerFormat::BGGR, 8,\n> BayerFormat::None);\n> +               bayerFmt = BayerFormat(BayerFormat::BGGR, 8,\n> BayerFormat::Packing::None);\n>                 bayerFmtExpect = BayerFormat(BayerFormat::GRBG, 8,\n> -                                            BayerFormat::None);\n> +                                            BayerFormat::Packing::None);\n>                 BayerFormat vFlipFmt =\n> bayerFmt.transform(Transform::VFlip);\n>                 if (vFlipFmt != bayerFmtExpect) {\n>                         cerr << \"Vertical flip of 'BGGR-8' should result\n> in '\"\n> @@ -176,7 +176,7 @@ protected:\n>                  * pixels on the bottom left to top right diagonal and make\n>                  * sure, that it doesn't change.\n>                  */\n> -               bayerFmt = BayerFormat(BayerFormat::BGGR, 8,\n> BayerFormat::None);\n> +               bayerFmt = BayerFormat(BayerFormat::BGGR, 8,\n> BayerFormat::Packing::None);\n>                 BayerFormat transposeFmt = bayerFmt.transform(\n>                         Transform::Transpose);\n>                 if (transposeFmt != bayerFmt) {\n> @@ -192,9 +192,9 @@ protected:\n>                  * on the bottom left to top right diagonal and make sure\n>                  * that their positions are switched.\n>                  */\n> -               bayerFmt = BayerFormat(BayerFormat::GBRG, 8,\n> BayerFormat::None);\n> +               bayerFmt = BayerFormat(BayerFormat::GBRG, 8,\n> BayerFormat::Packing::None);\n>                 bayerFmtExpect = BayerFormat(BayerFormat::GRBG, 8,\n> -                                            BayerFormat::None);\n> +                                            BayerFormat::Packing::None);\n>                 transposeFmt = bayerFmt.transform(Transform::Transpose);\n>                 if (transposeFmt != bayerFmtExpect) {\n>                         cerr << \"Transpose with the red & blue pixels on\n> the \"\n>\n> base-commit: 4d4694cd9f4ea73586dcb75d19905a1860356d9f\n> --\n> Regards,\n>\n> Laurent Pinchart\n>\n>","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 5747EBF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 27 Oct 2021 12:48:29 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9748E64882;\n\tWed, 27 Oct 2021 14:48:28 +0200 (CEST)","from mail-lj1-x230.google.com (mail-lj1-x230.google.com\n\t[IPv6:2a00:1450:4864:20::230])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id AB1CE60123\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 27 Oct 2021 14:48:26 +0200 (CEST)","by mail-lj1-x230.google.com with SMTP id s19so4461684ljj.11\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 27 Oct 2021 05:48:26 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"p6rAIf5A\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=mime-version:references:in-reply-to:from:date:message-id:subject:to\n\t:cc; bh=uJ6vcm0S3pWCPmIbxYX7XHRbY2ZWHKVJvgc+KtaEawU=;\n\tb=p6rAIf5ABsS1pYO/Th5RtwMp5OGxH3zJQrNsCicXoj/8jLXpDCEQaUR/MXppd7ekwt\n\tWG7utGaS2nub7xD4ymSt8pfk12ZcHG80HxT+wlkrJARJkrQGcSTNfKeuv/Rt7XdB5om0\n\taplTzLVnhIgbUmLxSrx4g3z+PI5vmpOosSDI23Z4mrkGL+8LBSuctdkt8RHJoKhiUg2z\n\tmQkQZtAGmEipgf6hiwW6HvOxnQnAgUfTN5yyq+bbL3a3if0sLno3jxpmJYj62+XK5cXR\n\tFVc1gdNwB5dlE9k8fZoGAQCKcwz9e/r3kyGF4WHh904RaIdBGAimZfMORzcHh5zmKOxY\n\tzg8w==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc;\n\tbh=uJ6vcm0S3pWCPmIbxYX7XHRbY2ZWHKVJvgc+KtaEawU=;\n\tb=xeMQEItIG8cNz1X9RegTuKOs2w5nOBr00UvsdB4guPKg3V7kXOD4v/no3yKdPHxjU+\n\tf23Z5JQyEx8Y2w6jk0DCaRIKIz/CXReWwPn8r0016iWl+8WJwCgDxyGmPzh/ZYghBCyf\n\tbTag2cXkRKzCE1eIIcHRAdJsuAiS76fWJEQpj5Dr8WTbw1bxifNoY43AIxnz6PnNv4Ik\n\tASl5XrK8ySymb6KMI9OKNwk7dhKY70VDKPjhjT8rpEGmgBPl3di3fEHHCJm/xASrgL8i\n\t8GqIIa6TC7TaybRNjnMf73JuinTWR7oAQK3zpFELSHACL+FagNK4P6ILdKoA51PIu9fW\n\tjZIg==","X-Gm-Message-State":"AOAM5311AxmpdnmjuoyiAFh9WKZwug0PE8CRlSLUc83CK7w3Ku3U49jc\n\tlPHL6IMf5fAgFb3mnrbnQC+EAGtN0dG846YuuemjAOxonnsC+w==","X-Google-Smtp-Source":"ABdhPJzQtWb/8bXJr08QThrXfOArkANsr5hEeR8eGYq3vx74kWrBbU7EGnlNBR7Is+z1qvEVBCMoclG8j+/ho8iq3/Y=","X-Received":"by 2002:a05:651c:14f:: with SMTP id\n\tc15mr2831998ljd.444.1635338905956; \n\tWed, 27 Oct 2021 05:48:25 -0700 (PDT)","MIME-Version":"1.0","References":"<20211027123619.16640-1-laurent.pinchart@ideasonboard.com>","In-Reply-To":"<20211027123619.16640-1-laurent.pinchart@ideasonboard.com>","From":"Naushir Patuck <naush@raspberrypi.com>","Date":"Wed, 27 Oct 2021 13:48:09 +0100","Message-ID":"<CAEmqJPoyc9UdUJPLYZx1m+P_1EOxyjyxihuF8K=XnjA2-N0Sqw@mail.gmail.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Content-Type":"multipart/alternative; boundary=\"00000000000093d21305cf550216\"","Subject":"Re: [libcamera-devel] [PATCH] libcamera: bayer_format: Turn\n\tBayerFormat::Packing into scoped enum","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 <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":20578,"web_url":"https://patchwork.libcamera.org/comment/20578/","msgid":"<YXlPqTiQsBRdIyy4@pendragon.ideasonboard.com>","date":"2021-10-27T13:10:01","subject":"Re: [libcamera-devel] [PATCH] libcamera: bayer_format: Turn\n\tBayerFormat::Packing into scoped enum","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Naush,\n\nOn Wed, Oct 27, 2021 at 01:48:09PM +0100, Naushir Patuck wrote:\n> On Wed, 27 Oct 2021 at 13:36, Laurent Pinchart wrote:\n> \n> > The unscoped enum BayerFormat::Packing leads to usage of the ambiguous\n> > BayerFormat::None enumerator. Turn the enumeration into a scoped enum to\n> > force usage of BayerFormat::Packing::None, and drop the now redundant\n> > \"Packed\" suffix for the CSI2 and IPU3 packing.\n> >\n> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> \n> This is going to conflict badly with my series :-)\n\nGuess what gave me the idea ? :-)\n\n> I definitely prefer scoped enums, but do you think we ought to do the\n> same with the Order enum in this change?\n\nIt's less ambiguous for the Order, but I wouldn't mind. I can send a v2\nwith that change.\n\n> ---\n> >  include/libcamera/internal/bayer_format.h |   6 +-\n> >  src/libcamera/bayer_format.cpp            | 138 +++++++++++-----------\n> >  test/bayer-format.cpp                     |  28 ++---\n> >  3 files changed, 86 insertions(+), 86 deletions(-)\n> >\n> > diff --git a/include/libcamera/internal/bayer_format.h\n> > b/include/libcamera/internal/bayer_format.h\n> > index 723382d4168d..d9a56d744a25 100644\n> > --- a/include/libcamera/internal/bayer_format.h\n> > +++ b/include/libcamera/internal/bayer_format.h\n> > @@ -27,10 +27,10 @@ public:\n> >                 MONO = 4\n> >         };\n> >\n> > -       enum Packing : uint16_t {\n> > +       enum class Packing : uint16_t {\n> >                 None = 0,\n> > -               CSI2Packed = 1,\n> > -               IPU3Packed = 2,\n> > +               CSI2 = 1,\n> > +               IPU3 = 2,\n> >         };\n> >\n> >         constexpr BayerFormat()\n> > diff --git a/src/libcamera/bayer_format.cpp\n> > b/src/libcamera/bayer_format.cpp\n> > index 11355f144f66..1c1e849a7e31 100644\n> > --- a/src/libcamera/bayer_format.cpp\n> > +++ b/src/libcamera/bayer_format.cpp\n> > @@ -53,11 +53,11 @@ namespace libcamera {\n> >   * \\enum BayerFormat::Packing\n> >   * \\brief Different types of packing that can be applied to a BayerFormat\n> >   *\n> > - * \\var BayerFormat::None\n> > + * \\var BayerFormat::Packing::None\n> >   * \\brief No packing\n> > - * \\var BayerFormat::CSI2Packed\n> > + * \\var BayerFormat::Packing::CSI2\n> >   * \\brief Format uses MIPI CSI-2 style packing\n> > - * \\var BayerFormat::IPU3Packed\n> > + * \\var BayerFormat::Packing::IPU3\n> >   * \\brief Format uses IPU3 style packing\n> >   */\n> >\n> > @@ -85,73 +85,73 @@ struct BayerFormatComparator {\n> >  };\n> >\n> >  const std::map<BayerFormat, V4L2PixelFormat, BayerFormatComparator>\n> > bayerToV4l2{\n> > -       { { BayerFormat::BGGR, 8, BayerFormat::None },\n> > V4L2PixelFormat(V4L2_PIX_FMT_SBGGR8) },\n> > -       { { BayerFormat::GBRG, 8, BayerFormat::None },\n> > V4L2PixelFormat(V4L2_PIX_FMT_SGBRG8) },\n> > -       { { BayerFormat::GRBG, 8, BayerFormat::None },\n> > V4L2PixelFormat(V4L2_PIX_FMT_SGRBG8) },\n> > -       { { BayerFormat::RGGB, 8, BayerFormat::None },\n> > V4L2PixelFormat(V4L2_PIX_FMT_SRGGB8) },\n> > -       { { BayerFormat::BGGR, 10, BayerFormat::None },\n> > V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10) },\n> > -       { { BayerFormat::GBRG, 10, BayerFormat::None },\n> > V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10) },\n> > -       { { BayerFormat::GRBG, 10, BayerFormat::None },\n> > V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10) },\n> > -       { { BayerFormat::RGGB, 10, BayerFormat::None },\n> > V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10) },\n> > -       { { BayerFormat::BGGR, 10, BayerFormat::CSI2Packed },\n> > V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10P) },\n> > -       { { BayerFormat::GBRG, 10, BayerFormat::CSI2Packed },\n> > V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10P) },\n> > -       { { BayerFormat::GRBG, 10, BayerFormat::CSI2Packed },\n> > V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10P) },\n> > -       { { BayerFormat::RGGB, 10, BayerFormat::CSI2Packed },\n> > V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10P) },\n> > -       { { BayerFormat::BGGR, 10, BayerFormat::IPU3Packed },\n> > V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SBGGR10) },\n> > -       { { BayerFormat::GBRG, 10, BayerFormat::IPU3Packed },\n> > V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SGBRG10) },\n> > -       { { BayerFormat::GRBG, 10, BayerFormat::IPU3Packed },\n> > V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SGRBG10) },\n> > -       { { BayerFormat::RGGB, 10, BayerFormat::IPU3Packed },\n> > V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SRGGB10) },\n> > -       { { BayerFormat::BGGR, 12, BayerFormat::None },\n> > V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12) },\n> > -       { { BayerFormat::GBRG, 12, BayerFormat::None },\n> > V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12) },\n> > -       { { BayerFormat::GRBG, 12, BayerFormat::None },\n> > V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12) },\n> > -       { { BayerFormat::RGGB, 12, BayerFormat::None },\n> > V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12) },\n> > -       { { BayerFormat::BGGR, 12, BayerFormat::CSI2Packed },\n> > V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12P) },\n> > -       { { BayerFormat::GBRG, 12, BayerFormat::CSI2Packed },\n> > V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12P) },\n> > -       { { BayerFormat::GRBG, 12, BayerFormat::CSI2Packed },\n> > V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12P) },\n> > -       { { BayerFormat::RGGB, 12, BayerFormat::CSI2Packed },\n> > V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12P) },\n> > -       { { BayerFormat::BGGR, 16, BayerFormat::None },\n> > V4L2PixelFormat(V4L2_PIX_FMT_SBGGR16) },\n> > -       { { BayerFormat::GBRG, 16, BayerFormat::None },\n> > V4L2PixelFormat(V4L2_PIX_FMT_SGBRG16) },\n> > -       { { BayerFormat::GRBG, 16, BayerFormat::None },\n> > V4L2PixelFormat(V4L2_PIX_FMT_SGRBG16) },\n> > -       { { BayerFormat::RGGB, 16, BayerFormat::None },\n> > V4L2PixelFormat(V4L2_PIX_FMT_SRGGB16) },\n> > -       { { BayerFormat::MONO, 8, BayerFormat::None },\n> > V4L2PixelFormat(V4L2_PIX_FMT_GREY) },\n> > -       { { BayerFormat::MONO, 10, BayerFormat::CSI2Packed },\n> > V4L2PixelFormat(V4L2_PIX_FMT_Y10P) },\n> > +       { { BayerFormat::BGGR, 8, BayerFormat::Packing::None },\n> > V4L2PixelFormat(V4L2_PIX_FMT_SBGGR8) },\n> > +       { { BayerFormat::GBRG, 8, BayerFormat::Packing::None },\n> > V4L2PixelFormat(V4L2_PIX_FMT_SGBRG8) },\n> > +       { { BayerFormat::GRBG, 8, BayerFormat::Packing::None },\n> > V4L2PixelFormat(V4L2_PIX_FMT_SGRBG8) },\n> > +       { { BayerFormat::RGGB, 8, BayerFormat::Packing::None },\n> > V4L2PixelFormat(V4L2_PIX_FMT_SRGGB8) },\n> > +       { { BayerFormat::BGGR, 10, BayerFormat::Packing::None },\n> > V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10) },\n> > +       { { BayerFormat::GBRG, 10, BayerFormat::Packing::None },\n> > V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10) },\n> > +       { { BayerFormat::GRBG, 10, BayerFormat::Packing::None },\n> > V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10) },\n> > +       { { BayerFormat::RGGB, 10, BayerFormat::Packing::None },\n> > V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10) },\n> > +       { { BayerFormat::BGGR, 10, BayerFormat::Packing::CSI2 },\n> > V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10P) },\n> > +       { { BayerFormat::GBRG, 10, BayerFormat::Packing::CSI2 },\n> > V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10P) },\n> > +       { { BayerFormat::GRBG, 10, BayerFormat::Packing::CSI2 },\n> > V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10P) },\n> > +       { { BayerFormat::RGGB, 10, BayerFormat::Packing::CSI2 },\n> > V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10P) },\n> > +       { { BayerFormat::BGGR, 10, BayerFormat::Packing::IPU3 },\n> > V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SBGGR10) },\n> > +       { { BayerFormat::GBRG, 10, BayerFormat::Packing::IPU3 },\n> > V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SGBRG10) },\n> > +       { { BayerFormat::GRBG, 10, BayerFormat::Packing::IPU3 },\n> > V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SGRBG10) },\n> > +       { { BayerFormat::RGGB, 10, BayerFormat::Packing::IPU3 },\n> > V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SRGGB10) },\n> > +       { { BayerFormat::BGGR, 12, BayerFormat::Packing::None },\n> > V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12) },\n> > +       { { BayerFormat::GBRG, 12, BayerFormat::Packing::None },\n> > V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12) },\n> > +       { { BayerFormat::GRBG, 12, BayerFormat::Packing::None },\n> > V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12) },\n> > +       { { BayerFormat::RGGB, 12, BayerFormat::Packing::None },\n> > V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12) },\n> > +       { { BayerFormat::BGGR, 12, BayerFormat::Packing::CSI2 },\n> > V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12P) },\n> > +       { { BayerFormat::GBRG, 12, BayerFormat::Packing::CSI2 },\n> > V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12P) },\n> > +       { { BayerFormat::GRBG, 12, BayerFormat::Packing::CSI2 },\n> > V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12P) },\n> > +       { { BayerFormat::RGGB, 12, BayerFormat::Packing::CSI2 },\n> > V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12P) },\n> > +       { { BayerFormat::BGGR, 16, BayerFormat::Packing::None },\n> > V4L2PixelFormat(V4L2_PIX_FMT_SBGGR16) },\n> > +       { { BayerFormat::GBRG, 16, BayerFormat::Packing::None },\n> > V4L2PixelFormat(V4L2_PIX_FMT_SGBRG16) },\n> > +       { { BayerFormat::GRBG, 16, BayerFormat::Packing::None },\n> > V4L2PixelFormat(V4L2_PIX_FMT_SGRBG16) },\n> > +       { { BayerFormat::RGGB, 16, BayerFormat::Packing::None },\n> > V4L2PixelFormat(V4L2_PIX_FMT_SRGGB16) },\n> > +       { { BayerFormat::MONO, 8, BayerFormat::Packing::None },\n> > V4L2PixelFormat(V4L2_PIX_FMT_GREY) },\n> > +       { { BayerFormat::MONO, 10, BayerFormat::Packing::CSI2 },\n> > V4L2PixelFormat(V4L2_PIX_FMT_Y10P) },\n> >  };\n> >\n> >  const std::unordered_map<unsigned int, BayerFormat> mbusCodeToBayer{\n> > -       { MEDIA_BUS_FMT_SBGGR8_1X8, { BayerFormat::BGGR, 8,\n> > BayerFormat::None } },\n> > -       { MEDIA_BUS_FMT_SGBRG8_1X8, { BayerFormat::GBRG, 8,\n> > BayerFormat::None } },\n> > -       { MEDIA_BUS_FMT_SGRBG8_1X8, { BayerFormat::GRBG, 8,\n> > BayerFormat::None } },\n> > -       { MEDIA_BUS_FMT_SRGGB8_1X8, { BayerFormat::RGGB, 8,\n> > BayerFormat::None } },\n> > -       { MEDIA_BUS_FMT_SBGGR10_ALAW8_1X8, { BayerFormat::BGGR, 8,\n> > BayerFormat::None } },\n> > -       { MEDIA_BUS_FMT_SGBRG10_ALAW8_1X8, { BayerFormat::GBRG, 8,\n> > BayerFormat::None } },\n> > -       { MEDIA_BUS_FMT_SGRBG10_ALAW8_1X8, { BayerFormat::GRBG, 8,\n> > BayerFormat::None } },\n> > -       { MEDIA_BUS_FMT_SRGGB10_ALAW8_1X8, { BayerFormat::RGGB, 8,\n> > BayerFormat::None } },\n> > -       { MEDIA_BUS_FMT_SBGGR10_DPCM8_1X8, { BayerFormat::BGGR, 8,\n> > BayerFormat::None } },\n> > -       { MEDIA_BUS_FMT_SGBRG10_DPCM8_1X8, { BayerFormat::GBRG, 8,\n> > BayerFormat::None } },\n> > -       { MEDIA_BUS_FMT_SGRBG10_DPCM8_1X8, { BayerFormat::GRBG, 8,\n> > BayerFormat::None } },\n> > -       { MEDIA_BUS_FMT_SRGGB10_DPCM8_1X8, { BayerFormat::RGGB, 8,\n> > BayerFormat::None } },\n> > -       { MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_BE, { BayerFormat::BGGR, 10,\n> > BayerFormat::None } },\n> > -       { MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_LE, { BayerFormat::BGGR, 10,\n> > BayerFormat::None } },\n> > -       { MEDIA_BUS_FMT_SBGGR10_2X8_PADLO_BE, { BayerFormat::BGGR, 10,\n> > BayerFormat::None } },\n> > -       { MEDIA_BUS_FMT_SBGGR10_2X8_PADLO_LE, { BayerFormat::BGGR, 10,\n> > BayerFormat::None } },\n> > -       { MEDIA_BUS_FMT_SBGGR10_1X10, { BayerFormat::BGGR, 10,\n> > BayerFormat::None } },\n> > -       { MEDIA_BUS_FMT_SGBRG10_1X10, { BayerFormat::GBRG, 10,\n> > BayerFormat::None } },\n> > -       { MEDIA_BUS_FMT_SGRBG10_1X10, { BayerFormat::GRBG, 10,\n> > BayerFormat::None } },\n> > -       { MEDIA_BUS_FMT_SRGGB10_1X10, { BayerFormat::RGGB, 10,\n> > BayerFormat::None } },\n> > -       { MEDIA_BUS_FMT_SBGGR12_1X12, { BayerFormat::BGGR, 12,\n> > BayerFormat::None } },\n> > -       { MEDIA_BUS_FMT_SGBRG12_1X12, { BayerFormat::GBRG, 12,\n> > BayerFormat::None } },\n> > -       { MEDIA_BUS_FMT_SGRBG12_1X12, { BayerFormat::GRBG, 12,\n> > BayerFormat::None } },\n> > -       { MEDIA_BUS_FMT_SRGGB12_1X12, { BayerFormat::RGGB, 12,\n> > BayerFormat::None } },\n> > -       { MEDIA_BUS_FMT_SBGGR14_1X14, { BayerFormat::BGGR, 14,\n> > BayerFormat::None } },\n> > -       { MEDIA_BUS_FMT_SGBRG14_1X14, { BayerFormat::GBRG, 14,\n> > BayerFormat::None } },\n> > -       { MEDIA_BUS_FMT_SGRBG14_1X14, { BayerFormat::GRBG, 14,\n> > BayerFormat::None } },\n> > -       { MEDIA_BUS_FMT_SRGGB14_1X14, { BayerFormat::RGGB, 14,\n> > BayerFormat::None } },\n> > -       { MEDIA_BUS_FMT_SBGGR16_1X16, { BayerFormat::BGGR, 16,\n> > BayerFormat::None } },\n> > -       { MEDIA_BUS_FMT_SGBRG16_1X16, { BayerFormat::GBRG, 16,\n> > BayerFormat::None } },\n> > -       { MEDIA_BUS_FMT_SGRBG16_1X16, { BayerFormat::GRBG, 16,\n> > BayerFormat::None } },\n> > -       { MEDIA_BUS_FMT_SRGGB16_1X16, { BayerFormat::RGGB, 16,\n> > BayerFormat::None } },\n> > -       { MEDIA_BUS_FMT_Y8_1X8, { BayerFormat::MONO, 8, BayerFormat::None\n> > } },\n> > -       { MEDIA_BUS_FMT_Y10_1X10, { BayerFormat::MONO, 10,\n> > BayerFormat::None } },\n> > +       { MEDIA_BUS_FMT_SBGGR8_1X8, { BayerFormat::BGGR, 8,\n> > BayerFormat::Packing::None } },\n> > +       { MEDIA_BUS_FMT_SGBRG8_1X8, { BayerFormat::GBRG, 8,\n> > BayerFormat::Packing::None } },\n> > +       { MEDIA_BUS_FMT_SGRBG8_1X8, { BayerFormat::GRBG, 8,\n> > BayerFormat::Packing::None } },\n> > +       { MEDIA_BUS_FMT_SRGGB8_1X8, { BayerFormat::RGGB, 8,\n> > BayerFormat::Packing::None } },\n> > +       { MEDIA_BUS_FMT_SBGGR10_ALAW8_1X8, { BayerFormat::BGGR, 8,\n> > BayerFormat::Packing::None } },\n> > +       { MEDIA_BUS_FMT_SGBRG10_ALAW8_1X8, { BayerFormat::GBRG, 8,\n> > BayerFormat::Packing::None } },\n> > +       { MEDIA_BUS_FMT_SGRBG10_ALAW8_1X8, { BayerFormat::GRBG, 8,\n> > BayerFormat::Packing::None } },\n> > +       { MEDIA_BUS_FMT_SRGGB10_ALAW8_1X8, { BayerFormat::RGGB, 8,\n> > BayerFormat::Packing::None } },\n> > +       { MEDIA_BUS_FMT_SBGGR10_DPCM8_1X8, { BayerFormat::BGGR, 8,\n> > BayerFormat::Packing::None } },\n> > +       { MEDIA_BUS_FMT_SGBRG10_DPCM8_1X8, { BayerFormat::GBRG, 8,\n> > BayerFormat::Packing::None } },\n> > +       { MEDIA_BUS_FMT_SGRBG10_DPCM8_1X8, { BayerFormat::GRBG, 8,\n> > BayerFormat::Packing::None } },\n> > +       { MEDIA_BUS_FMT_SRGGB10_DPCM8_1X8, { BayerFormat::RGGB, 8,\n> > BayerFormat::Packing::None } },\n> > +       { MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_BE, { BayerFormat::BGGR, 10,\n> > BayerFormat::Packing::None } },\n> > +       { MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_LE, { BayerFormat::BGGR, 10,\n> > BayerFormat::Packing::None } },\n> > +       { MEDIA_BUS_FMT_SBGGR10_2X8_PADLO_BE, { BayerFormat::BGGR, 10,\n> > BayerFormat::Packing::None } },\n> > +       { MEDIA_BUS_FMT_SBGGR10_2X8_PADLO_LE, { BayerFormat::BGGR, 10,\n> > BayerFormat::Packing::None } },\n> > +       { MEDIA_BUS_FMT_SBGGR10_1X10, { BayerFormat::BGGR, 10,\n> > BayerFormat::Packing::None } },\n> > +       { MEDIA_BUS_FMT_SGBRG10_1X10, { BayerFormat::GBRG, 10,\n> > BayerFormat::Packing::None } },\n> > +       { MEDIA_BUS_FMT_SGRBG10_1X10, { BayerFormat::GRBG, 10,\n> > BayerFormat::Packing::None } },\n> > +       { MEDIA_BUS_FMT_SRGGB10_1X10, { BayerFormat::RGGB, 10,\n> > BayerFormat::Packing::None } },\n> > +       { MEDIA_BUS_FMT_SBGGR12_1X12, { BayerFormat::BGGR, 12,\n> > BayerFormat::Packing::None } },\n> > +       { MEDIA_BUS_FMT_SGBRG12_1X12, { BayerFormat::GBRG, 12,\n> > BayerFormat::Packing::None } },\n> > +       { MEDIA_BUS_FMT_SGRBG12_1X12, { BayerFormat::GRBG, 12,\n> > BayerFormat::Packing::None } },\n> > +       { MEDIA_BUS_FMT_SRGGB12_1X12, { BayerFormat::RGGB, 12,\n> > BayerFormat::Packing::None } },\n> > +       { MEDIA_BUS_FMT_SBGGR14_1X14, { BayerFormat::BGGR, 14,\n> > BayerFormat::Packing::None } },\n> > +       { MEDIA_BUS_FMT_SGBRG14_1X14, { BayerFormat::GBRG, 14,\n> > BayerFormat::Packing::None } },\n> > +       { MEDIA_BUS_FMT_SGRBG14_1X14, { BayerFormat::GRBG, 14,\n> > BayerFormat::Packing::None } },\n> > +       { MEDIA_BUS_FMT_SRGGB14_1X14, { BayerFormat::RGGB, 14,\n> > BayerFormat::Packing::None } },\n> > +       { MEDIA_BUS_FMT_SBGGR16_1X16, { BayerFormat::BGGR, 16,\n> > BayerFormat::Packing::None } },\n> > +       { MEDIA_BUS_FMT_SGBRG16_1X16, { BayerFormat::GBRG, 16,\n> > BayerFormat::Packing::None } },\n> > +       { MEDIA_BUS_FMT_SGRBG16_1X16, { BayerFormat::GRBG, 16,\n> > BayerFormat::Packing::None } },\n> > +       { MEDIA_BUS_FMT_SRGGB16_1X16, { BayerFormat::RGGB, 16,\n> > BayerFormat::Packing::None } },\n> > +       { MEDIA_BUS_FMT_Y8_1X8, { BayerFormat::MONO, 8,\n> > BayerFormat::Packing::None } },\n> > +       { MEDIA_BUS_FMT_Y10_1X10, { BayerFormat::MONO, 10,\n> > BayerFormat::Packing::None } },\n> >  };\n> >\n> >  } /* namespace */\n> > @@ -214,9 +214,9 @@ std::string BayerFormat::toString() const\n> >\n> >         result += \"-\" + std::to_string(bitDepth);\n> >\n> > -       if (packing == CSI2Packed)\n> > +       if (packing == Packing::CSI2)\n> >                 result += \"-CSI2P\";\n> > -       else if (packing == IPU3Packed)\n> > +       else if (packing == Packing::IPU3)\n> >                 result += \"-IPU3P\";\n> >\n> >         return result;\n> > diff --git a/test/bayer-format.cpp b/test/bayer-format.cpp\n> > index e396ee83ca91..135bcb5214c8 100644\n> > --- a/test/bayer-format.cpp\n> > +++ b/test/bayer-format.cpp\n> > @@ -30,7 +30,7 @@ protected:\n> >                 }\n> >\n> >                 /* A correct Bayer format has to be valid. */\n> > -               bayerFmt = BayerFormat(BayerFormat::BGGR, 8,\n> > BayerFormat::None);\n> > +               bayerFmt = BayerFormat(BayerFormat::BGGR, 8,\n> > BayerFormat::Packing::None);\n> >                 if (!bayerFmt.isValid()) {\n> >                         cerr << \"A correct BayerFormat has to be valid.\"\n> >                              << endl;\n> > @@ -41,9 +41,9 @@ protected:\n> >                  * Two bayer formats created with the same order and bit\n> > depth\n> >                  * have to be equal.\n> >                  */\n> > -               bayerFmt = BayerFormat(BayerFormat::BGGR, 8,\n> > BayerFormat::None);\n> > +               bayerFmt = BayerFormat(BayerFormat::BGGR, 8,\n> > BayerFormat::Packing::None);\n> >                 BayerFormat bayerFmtExpect =\n> > BayerFormat(BayerFormat::BGGR, 8,\n> > -\n> > BayerFormat::None);\n> > +\n> > BayerFormat::Packing::None);\n> >                 if (bayerFmt != bayerFmtExpect) {\n> >                         cerr << \"Comparison of identical formats failed.\"\n> >                              << endl;\n> > @@ -54,9 +54,9 @@ protected:\n> >                  * Two Bayer formats created with the same order but with a\n> >                  * different bitDepth are not equal.\n> >                  */\n> > -               bayerFmt = BayerFormat(BayerFormat::BGGR, 8,\n> > BayerFormat::None);\n> > +               bayerFmt = BayerFormat(BayerFormat::BGGR, 8,\n> > BayerFormat::Packing::None);\n> >                 bayerFmtExpect = BayerFormat(BayerFormat::BGGR, 12,\n> > -                                            BayerFormat::None);\n> > +                                            BayerFormat::Packing::None);\n> >                 if (bayerFmt == bayerFmtExpect) {\n> >                         cerr << \"Comparison of different formats failed.\"\n> >                              << endl;\n> > @@ -96,7 +96,7 @@ protected:\n> >                  * to a Bayer format.\n> >                  */\n> >                 bayerFmtExpect = BayerFormat(BayerFormat::BGGR, 8,\n> > -                                            BayerFormat::None);\n> > +                                            BayerFormat::Packing::None);\n> >                 v4l2Fmt = V4L2PixelFormat(V4L2_PIX_FMT_SBGGR8);\n> >                 bayerFmt = BayerFormat::fromV4L2PixelFormat(v4l2Fmt);\n> >                 if (bayerFmt != bayerFmtExpect) {\n> > @@ -123,7 +123,7 @@ protected:\n> >                  * Test if a valid Bayer format can be converted to a\n> >                  * string representation.\n> >                  */\n> > -               bayerFmt = BayerFormat(BayerFormat::BGGR, 8,\n> > BayerFormat::None);\n> > +               bayerFmt = BayerFormat(BayerFormat::BGGR, 8,\n> > BayerFormat::Packing::None);\n> >                 if (bayerFmt.toString() != \"BGGR-8\") {\n> >                         cerr << \"String representation != 'BGGR-8' (got: '\"\n> >                              << bayerFmt.toString() << \"' ) \" << endl;\n> > @@ -145,9 +145,9 @@ protected:\n> >                  * Perform a horizontal Flip and make sure that the\n> >                  * order is adjusted accordingly.\n> >                  */\n> > -               bayerFmt = BayerFormat(BayerFormat::BGGR, 8,\n> > BayerFormat::None);\n> > +               bayerFmt = BayerFormat(BayerFormat::BGGR, 8,\n> > BayerFormat::Packing::None);\n> >                 bayerFmtExpect = BayerFormat(BayerFormat::GBRG, 8,\n> > -                                            BayerFormat::None);\n> > +                                            BayerFormat::Packing::None);\n> >                 BayerFormat hFlipFmt =\n> > bayerFmt.transform(Transform::HFlip);\n> >                 if (hFlipFmt != bayerFmtExpect) {\n> >                         cerr << \"Horizontal flip of 'BGGR-8' should result\n> > in '\"\n> > @@ -160,9 +160,9 @@ protected:\n> >                  * Perform a vertical Flip and make sure that\n> >                  * the order is adjusted accordingly.\n> >                  */\n> > -               bayerFmt = BayerFormat(BayerFormat::BGGR, 8,\n> > BayerFormat::None);\n> > +               bayerFmt = BayerFormat(BayerFormat::BGGR, 8,\n> > BayerFormat::Packing::None);\n> >                 bayerFmtExpect = BayerFormat(BayerFormat::GRBG, 8,\n> > -                                            BayerFormat::None);\n> > +                                            BayerFormat::Packing::None);\n> >                 BayerFormat vFlipFmt =\n> > bayerFmt.transform(Transform::VFlip);\n> >                 if (vFlipFmt != bayerFmtExpect) {\n> >                         cerr << \"Vertical flip of 'BGGR-8' should result\n> > in '\"\n> > @@ -176,7 +176,7 @@ protected:\n> >                  * pixels on the bottom left to top right diagonal and make\n> >                  * sure, that it doesn't change.\n> >                  */\n> > -               bayerFmt = BayerFormat(BayerFormat::BGGR, 8,\n> > BayerFormat::None);\n> > +               bayerFmt = BayerFormat(BayerFormat::BGGR, 8,\n> > BayerFormat::Packing::None);\n> >                 BayerFormat transposeFmt = bayerFmt.transform(\n> >                         Transform::Transpose);\n> >                 if (transposeFmt != bayerFmt) {\n> > @@ -192,9 +192,9 @@ protected:\n> >                  * on the bottom left to top right diagonal and make sure\n> >                  * that their positions are switched.\n> >                  */\n> > -               bayerFmt = BayerFormat(BayerFormat::GBRG, 8,\n> > BayerFormat::None);\n> > +               bayerFmt = BayerFormat(BayerFormat::GBRG, 8,\n> > BayerFormat::Packing::None);\n> >                 bayerFmtExpect = BayerFormat(BayerFormat::GRBG, 8,\n> > -                                            BayerFormat::None);\n> > +                                            BayerFormat::Packing::None);\n> >                 transposeFmt = bayerFmt.transform(Transform::Transpose);\n> >                 if (transposeFmt != bayerFmtExpect) {\n> >                         cerr << \"Transpose with the red & blue pixels on\n> > the \"\n> >\n> > base-commit: 4d4694cd9f4ea73586dcb75d19905a1860356d9f","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 B1E45BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 27 Oct 2021 13:10:27 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 137D26487F;\n\tWed, 27 Oct 2021 15:10:27 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 72F0260123\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 27 Oct 2021 15:10:25 +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 E79FF596;\n\tWed, 27 Oct 2021 15:10:24 +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=\"Y11nDqeV\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1635340225;\n\tbh=gPjNKg2k7oPJcoMBRsAPDZh+n5OM+AacXvGK74PnXwY=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=Y11nDqeVVkhvbWA7BkX3NC6aWMTrclIGYLXMnWvJRs9E6bCntIsHCjs/KVVB6em9e\n\t4OX6YW5/cxjYDB7ypNwrwLtXfIBj6MLtH6PpVS7e7KgB+pRuQkuEDH/iD0GNWz4BiR\n\to7MqIwP51ltJmHQjcTJZXNPHGnSJamNvr+NUAAuo=","Date":"Wed, 27 Oct 2021 16:10:01 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Naushir Patuck <naush@raspberrypi.com>","Message-ID":"<YXlPqTiQsBRdIyy4@pendragon.ideasonboard.com>","References":"<20211027123619.16640-1-laurent.pinchart@ideasonboard.com>\n\t<CAEmqJPoyc9UdUJPLYZx1m+P_1EOxyjyxihuF8K=XnjA2-N0Sqw@mail.gmail.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<CAEmqJPoyc9UdUJPLYZx1m+P_1EOxyjyxihuF8K=XnjA2-N0Sqw@mail.gmail.com>","Subject":"Re: [libcamera-devel] [PATCH] libcamera: bayer_format: Turn\n\tBayerFormat::Packing into scoped enum","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 <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":20580,"web_url":"https://patchwork.libcamera.org/comment/20580/","msgid":"<CAEmqJPraUjCfmYqicsG8ig+wZ8WzAJi+dMeamKihGNUOYFoxNw@mail.gmail.com>","date":"2021-10-27T13:15:02","subject":"Re: [libcamera-devel] [PATCH] libcamera: bayer_format: Turn\n\tBayerFormat::Packing into scoped enum","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/people/34/","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"content":"On Wed, 27 Oct 2021 at 14:10, Laurent Pinchart <\nlaurent.pinchart@ideasonboard.com> wrote:\n\n> Hi Naush,\n>\n> On Wed, Oct 27, 2021 at 01:48:09PM +0100, Naushir Patuck wrote:\n> > On Wed, 27 Oct 2021 at 13:36, Laurent Pinchart wrote:\n> >\n> > > The unscoped enum BayerFormat::Packing leads to usage of the ambiguous\n> > > BayerFormat::None enumerator. Turn the enumeration into a scoped enum\n> to\n> > > force usage of BayerFormat::Packing::None, and drop the now redundant\n> > > \"Packed\" suffix for the CSI2 and IPU3 packing.\n> > >\n> > > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> >\n> > This is going to conflict badly with my series :-)\n>\n> Guess what gave me the idea ? :-)\n>\n> > I definitely prefer scoped enums, but do you think we ought to do the\n> > same with the Order enum in this change?\n>\n> It's less ambiguous for the Order, but I wouldn't mind. I can send a v2\n> with that change.\n>\n\nGreat, I'll wait for that and add it to this series.\n\n\n>\n> > ---\n> > >  include/libcamera/internal/bayer_format.h |   6 +-\n> > >  src/libcamera/bayer_format.cpp            | 138 +++++++++++-----------\n> > >  test/bayer-format.cpp                     |  28 ++---\n> > >  3 files changed, 86 insertions(+), 86 deletions(-)\n> > >\n> > > diff --git a/include/libcamera/internal/bayer_format.h\n> > > b/include/libcamera/internal/bayer_format.h\n> > > index 723382d4168d..d9a56d744a25 100644\n> > > --- a/include/libcamera/internal/bayer_format.h\n> > > +++ b/include/libcamera/internal/bayer_format.h\n> > > @@ -27,10 +27,10 @@ public:\n> > >                 MONO = 4\n> > >         };\n> > >\n> > > -       enum Packing : uint16_t {\n> > > +       enum class Packing : uint16_t {\n> > >                 None = 0,\n> > > -               CSI2Packed = 1,\n> > > -               IPU3Packed = 2,\n> > > +               CSI2 = 1,\n> > > +               IPU3 = 2,\n> > >         };\n> > >\n> > >         constexpr BayerFormat()\n> > > diff --git a/src/libcamera/bayer_format.cpp\n> > > b/src/libcamera/bayer_format.cpp\n> > > index 11355f144f66..1c1e849a7e31 100644\n> > > --- a/src/libcamera/bayer_format.cpp\n> > > +++ b/src/libcamera/bayer_format.cpp\n> > > @@ -53,11 +53,11 @@ namespace libcamera {\n> > >   * \\enum BayerFormat::Packing\n> > >   * \\brief Different types of packing that can be applied to a\n> BayerFormat\n> > >   *\n> > > - * \\var BayerFormat::None\n> > > + * \\var BayerFormat::Packing::None\n> > >   * \\brief No packing\n> > > - * \\var BayerFormat::CSI2Packed\n> > > + * \\var BayerFormat::Packing::CSI2\n> > >   * \\brief Format uses MIPI CSI-2 style packing\n> > > - * \\var BayerFormat::IPU3Packed\n> > > + * \\var BayerFormat::Packing::IPU3\n> > >   * \\brief Format uses IPU3 style packing\n> > >   */\n> > >\n> > > @@ -85,73 +85,73 @@ struct BayerFormatComparator {\n> > >  };\n> > >\n> > >  const std::map<BayerFormat, V4L2PixelFormat, BayerFormatComparator>\n> > > bayerToV4l2{\n> > > -       { { BayerFormat::BGGR, 8, BayerFormat::None },\n> > > V4L2PixelFormat(V4L2_PIX_FMT_SBGGR8) },\n> > > -       { { BayerFormat::GBRG, 8, BayerFormat::None },\n> > > V4L2PixelFormat(V4L2_PIX_FMT_SGBRG8) },\n> > > -       { { BayerFormat::GRBG, 8, BayerFormat::None },\n> > > V4L2PixelFormat(V4L2_PIX_FMT_SGRBG8) },\n> > > -       { { BayerFormat::RGGB, 8, BayerFormat::None },\n> > > V4L2PixelFormat(V4L2_PIX_FMT_SRGGB8) },\n> > > -       { { BayerFormat::BGGR, 10, BayerFormat::None },\n> > > V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10) },\n> > > -       { { BayerFormat::GBRG, 10, BayerFormat::None },\n> > > V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10) },\n> > > -       { { BayerFormat::GRBG, 10, BayerFormat::None },\n> > > V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10) },\n> > > -       { { BayerFormat::RGGB, 10, BayerFormat::None },\n> > > V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10) },\n> > > -       { { BayerFormat::BGGR, 10, BayerFormat::CSI2Packed },\n> > > V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10P) },\n> > > -       { { BayerFormat::GBRG, 10, BayerFormat::CSI2Packed },\n> > > V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10P) },\n> > > -       { { BayerFormat::GRBG, 10, BayerFormat::CSI2Packed },\n> > > V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10P) },\n> > > -       { { BayerFormat::RGGB, 10, BayerFormat::CSI2Packed },\n> > > V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10P) },\n> > > -       { { BayerFormat::BGGR, 10, BayerFormat::IPU3Packed },\n> > > V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SBGGR10) },\n> > > -       { { BayerFormat::GBRG, 10, BayerFormat::IPU3Packed },\n> > > V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SGBRG10) },\n> > > -       { { BayerFormat::GRBG, 10, BayerFormat::IPU3Packed },\n> > > V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SGRBG10) },\n> > > -       { { BayerFormat::RGGB, 10, BayerFormat::IPU3Packed },\n> > > V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SRGGB10) },\n> > > -       { { BayerFormat::BGGR, 12, BayerFormat::None },\n> > > V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12) },\n> > > -       { { BayerFormat::GBRG, 12, BayerFormat::None },\n> > > V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12) },\n> > > -       { { BayerFormat::GRBG, 12, BayerFormat::None },\n> > > V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12) },\n> > > -       { { BayerFormat::RGGB, 12, BayerFormat::None },\n> > > V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12) },\n> > > -       { { BayerFormat::BGGR, 12, BayerFormat::CSI2Packed },\n> > > V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12P) },\n> > > -       { { BayerFormat::GBRG, 12, BayerFormat::CSI2Packed },\n> > > V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12P) },\n> > > -       { { BayerFormat::GRBG, 12, BayerFormat::CSI2Packed },\n> > > V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12P) },\n> > > -       { { BayerFormat::RGGB, 12, BayerFormat::CSI2Packed },\n> > > V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12P) },\n> > > -       { { BayerFormat::BGGR, 16, BayerFormat::None },\n> > > V4L2PixelFormat(V4L2_PIX_FMT_SBGGR16) },\n> > > -       { { BayerFormat::GBRG, 16, BayerFormat::None },\n> > > V4L2PixelFormat(V4L2_PIX_FMT_SGBRG16) },\n> > > -       { { BayerFormat::GRBG, 16, BayerFormat::None },\n> > > V4L2PixelFormat(V4L2_PIX_FMT_SGRBG16) },\n> > > -       { { BayerFormat::RGGB, 16, BayerFormat::None },\n> > > V4L2PixelFormat(V4L2_PIX_FMT_SRGGB16) },\n> > > -       { { BayerFormat::MONO, 8, BayerFormat::None },\n> > > V4L2PixelFormat(V4L2_PIX_FMT_GREY) },\n> > > -       { { BayerFormat::MONO, 10, BayerFormat::CSI2Packed },\n> > > V4L2PixelFormat(V4L2_PIX_FMT_Y10P) },\n> > > +       { { BayerFormat::BGGR, 8, BayerFormat::Packing::None },\n> > > V4L2PixelFormat(V4L2_PIX_FMT_SBGGR8) },\n> > > +       { { BayerFormat::GBRG, 8, BayerFormat::Packing::None },\n> > > V4L2PixelFormat(V4L2_PIX_FMT_SGBRG8) },\n> > > +       { { BayerFormat::GRBG, 8, BayerFormat::Packing::None },\n> > > V4L2PixelFormat(V4L2_PIX_FMT_SGRBG8) },\n> > > +       { { BayerFormat::RGGB, 8, BayerFormat::Packing::None },\n> > > V4L2PixelFormat(V4L2_PIX_FMT_SRGGB8) },\n> > > +       { { BayerFormat::BGGR, 10, BayerFormat::Packing::None },\n> > > V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10) },\n> > > +       { { BayerFormat::GBRG, 10, BayerFormat::Packing::None },\n> > > V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10) },\n> > > +       { { BayerFormat::GRBG, 10, BayerFormat::Packing::None },\n> > > V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10) },\n> > > +       { { BayerFormat::RGGB, 10, BayerFormat::Packing::None },\n> > > V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10) },\n> > > +       { { BayerFormat::BGGR, 10, BayerFormat::Packing::CSI2 },\n> > > V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10P) },\n> > > +       { { BayerFormat::GBRG, 10, BayerFormat::Packing::CSI2 },\n> > > V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10P) },\n> > > +       { { BayerFormat::GRBG, 10, BayerFormat::Packing::CSI2 },\n> > > V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10P) },\n> > > +       { { BayerFormat::RGGB, 10, BayerFormat::Packing::CSI2 },\n> > > V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10P) },\n> > > +       { { BayerFormat::BGGR, 10, BayerFormat::Packing::IPU3 },\n> > > V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SBGGR10) },\n> > > +       { { BayerFormat::GBRG, 10, BayerFormat::Packing::IPU3 },\n> > > V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SGBRG10) },\n> > > +       { { BayerFormat::GRBG, 10, BayerFormat::Packing::IPU3 },\n> > > V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SGRBG10) },\n> > > +       { { BayerFormat::RGGB, 10, BayerFormat::Packing::IPU3 },\n> > > V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SRGGB10) },\n> > > +       { { BayerFormat::BGGR, 12, BayerFormat::Packing::None },\n> > > V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12) },\n> > > +       { { BayerFormat::GBRG, 12, BayerFormat::Packing::None },\n> > > V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12) },\n> > > +       { { BayerFormat::GRBG, 12, BayerFormat::Packing::None },\n> > > V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12) },\n> > > +       { { BayerFormat::RGGB, 12, BayerFormat::Packing::None },\n> > > V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12) },\n> > > +       { { BayerFormat::BGGR, 12, BayerFormat::Packing::CSI2 },\n> > > V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12P) },\n> > > +       { { BayerFormat::GBRG, 12, BayerFormat::Packing::CSI2 },\n> > > V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12P) },\n> > > +       { { BayerFormat::GRBG, 12, BayerFormat::Packing::CSI2 },\n> > > V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12P) },\n> > > +       { { BayerFormat::RGGB, 12, BayerFormat::Packing::CSI2 },\n> > > V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12P) },\n> > > +       { { BayerFormat::BGGR, 16, BayerFormat::Packing::None },\n> > > V4L2PixelFormat(V4L2_PIX_FMT_SBGGR16) },\n> > > +       { { BayerFormat::GBRG, 16, BayerFormat::Packing::None },\n> > > V4L2PixelFormat(V4L2_PIX_FMT_SGBRG16) },\n> > > +       { { BayerFormat::GRBG, 16, BayerFormat::Packing::None },\n> > > V4L2PixelFormat(V4L2_PIX_FMT_SGRBG16) },\n> > > +       { { BayerFormat::RGGB, 16, BayerFormat::Packing::None },\n> > > V4L2PixelFormat(V4L2_PIX_FMT_SRGGB16) },\n> > > +       { { BayerFormat::MONO, 8, BayerFormat::Packing::None },\n> > > V4L2PixelFormat(V4L2_PIX_FMT_GREY) },\n> > > +       { { BayerFormat::MONO, 10, BayerFormat::Packing::CSI2 },\n> > > V4L2PixelFormat(V4L2_PIX_FMT_Y10P) },\n> > >  };\n> > >\n> > >  const std::unordered_map<unsigned int, BayerFormat> mbusCodeToBayer{\n> > > -       { MEDIA_BUS_FMT_SBGGR8_1X8, { BayerFormat::BGGR, 8,\n> > > BayerFormat::None } },\n> > > -       { MEDIA_BUS_FMT_SGBRG8_1X8, { BayerFormat::GBRG, 8,\n> > > BayerFormat::None } },\n> > > -       { MEDIA_BUS_FMT_SGRBG8_1X8, { BayerFormat::GRBG, 8,\n> > > BayerFormat::None } },\n> > > -       { MEDIA_BUS_FMT_SRGGB8_1X8, { BayerFormat::RGGB, 8,\n> > > BayerFormat::None } },\n> > > -       { MEDIA_BUS_FMT_SBGGR10_ALAW8_1X8, { BayerFormat::BGGR, 8,\n> > > BayerFormat::None } },\n> > > -       { MEDIA_BUS_FMT_SGBRG10_ALAW8_1X8, { BayerFormat::GBRG, 8,\n> > > BayerFormat::None } },\n> > > -       { MEDIA_BUS_FMT_SGRBG10_ALAW8_1X8, { BayerFormat::GRBG, 8,\n> > > BayerFormat::None } },\n> > > -       { MEDIA_BUS_FMT_SRGGB10_ALAW8_1X8, { BayerFormat::RGGB, 8,\n> > > BayerFormat::None } },\n> > > -       { MEDIA_BUS_FMT_SBGGR10_DPCM8_1X8, { BayerFormat::BGGR, 8,\n> > > BayerFormat::None } },\n> > > -       { MEDIA_BUS_FMT_SGBRG10_DPCM8_1X8, { BayerFormat::GBRG, 8,\n> > > BayerFormat::None } },\n> > > -       { MEDIA_BUS_FMT_SGRBG10_DPCM8_1X8, { BayerFormat::GRBG, 8,\n> > > BayerFormat::None } },\n> > > -       { MEDIA_BUS_FMT_SRGGB10_DPCM8_1X8, { BayerFormat::RGGB, 8,\n> > > BayerFormat::None } },\n> > > -       { MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_BE, { BayerFormat::BGGR, 10,\n> > > BayerFormat::None } },\n> > > -       { MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_LE, { BayerFormat::BGGR, 10,\n> > > BayerFormat::None } },\n> > > -       { MEDIA_BUS_FMT_SBGGR10_2X8_PADLO_BE, { BayerFormat::BGGR, 10,\n> > > BayerFormat::None } },\n> > > -       { MEDIA_BUS_FMT_SBGGR10_2X8_PADLO_LE, { BayerFormat::BGGR, 10,\n> > > BayerFormat::None } },\n> > > -       { MEDIA_BUS_FMT_SBGGR10_1X10, { BayerFormat::BGGR, 10,\n> > > BayerFormat::None } },\n> > > -       { MEDIA_BUS_FMT_SGBRG10_1X10, { BayerFormat::GBRG, 10,\n> > > BayerFormat::None } },\n> > > -       { MEDIA_BUS_FMT_SGRBG10_1X10, { BayerFormat::GRBG, 10,\n> > > BayerFormat::None } },\n> > > -       { MEDIA_BUS_FMT_SRGGB10_1X10, { BayerFormat::RGGB, 10,\n> > > BayerFormat::None } },\n> > > -       { MEDIA_BUS_FMT_SBGGR12_1X12, { BayerFormat::BGGR, 12,\n> > > BayerFormat::None } },\n> > > -       { MEDIA_BUS_FMT_SGBRG12_1X12, { BayerFormat::GBRG, 12,\n> > > BayerFormat::None } },\n> > > -       { MEDIA_BUS_FMT_SGRBG12_1X12, { BayerFormat::GRBG, 12,\n> > > BayerFormat::None } },\n> > > -       { MEDIA_BUS_FMT_SRGGB12_1X12, { BayerFormat::RGGB, 12,\n> > > BayerFormat::None } },\n> > > -       { MEDIA_BUS_FMT_SBGGR14_1X14, { BayerFormat::BGGR, 14,\n> > > BayerFormat::None } },\n> > > -       { MEDIA_BUS_FMT_SGBRG14_1X14, { BayerFormat::GBRG, 14,\n> > > BayerFormat::None } },\n> > > -       { MEDIA_BUS_FMT_SGRBG14_1X14, { BayerFormat::GRBG, 14,\n> > > BayerFormat::None } },\n> > > -       { MEDIA_BUS_FMT_SRGGB14_1X14, { BayerFormat::RGGB, 14,\n> > > BayerFormat::None } },\n> > > -       { MEDIA_BUS_FMT_SBGGR16_1X16, { BayerFormat::BGGR, 16,\n> > > BayerFormat::None } },\n> > > -       { MEDIA_BUS_FMT_SGBRG16_1X16, { BayerFormat::GBRG, 16,\n> > > BayerFormat::None } },\n> > > -       { MEDIA_BUS_FMT_SGRBG16_1X16, { BayerFormat::GRBG, 16,\n> > > BayerFormat::None } },\n> > > -       { MEDIA_BUS_FMT_SRGGB16_1X16, { BayerFormat::RGGB, 16,\n> > > BayerFormat::None } },\n> > > -       { MEDIA_BUS_FMT_Y8_1X8, { BayerFormat::MONO, 8,\n> BayerFormat::None\n> > > } },\n> > > -       { MEDIA_BUS_FMT_Y10_1X10, { BayerFormat::MONO, 10,\n> > > BayerFormat::None } },\n> > > +       { MEDIA_BUS_FMT_SBGGR8_1X8, { BayerFormat::BGGR, 8,\n> > > BayerFormat::Packing::None } },\n> > > +       { MEDIA_BUS_FMT_SGBRG8_1X8, { BayerFormat::GBRG, 8,\n> > > BayerFormat::Packing::None } },\n> > > +       { MEDIA_BUS_FMT_SGRBG8_1X8, { BayerFormat::GRBG, 8,\n> > > BayerFormat::Packing::None } },\n> > > +       { MEDIA_BUS_FMT_SRGGB8_1X8, { BayerFormat::RGGB, 8,\n> > > BayerFormat::Packing::None } },\n> > > +       { MEDIA_BUS_FMT_SBGGR10_ALAW8_1X8, { BayerFormat::BGGR, 8,\n> > > BayerFormat::Packing::None } },\n> > > +       { MEDIA_BUS_FMT_SGBRG10_ALAW8_1X8, { BayerFormat::GBRG, 8,\n> > > BayerFormat::Packing::None } },\n> > > +       { MEDIA_BUS_FMT_SGRBG10_ALAW8_1X8, { BayerFormat::GRBG, 8,\n> > > BayerFormat::Packing::None } },\n> > > +       { MEDIA_BUS_FMT_SRGGB10_ALAW8_1X8, { BayerFormat::RGGB, 8,\n> > > BayerFormat::Packing::None } },\n> > > +       { MEDIA_BUS_FMT_SBGGR10_DPCM8_1X8, { BayerFormat::BGGR, 8,\n> > > BayerFormat::Packing::None } },\n> > > +       { MEDIA_BUS_FMT_SGBRG10_DPCM8_1X8, { BayerFormat::GBRG, 8,\n> > > BayerFormat::Packing::None } },\n> > > +       { MEDIA_BUS_FMT_SGRBG10_DPCM8_1X8, { BayerFormat::GRBG, 8,\n> > > BayerFormat::Packing::None } },\n> > > +       { MEDIA_BUS_FMT_SRGGB10_DPCM8_1X8, { BayerFormat::RGGB, 8,\n> > > BayerFormat::Packing::None } },\n> > > +       { MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_BE, { BayerFormat::BGGR, 10,\n> > > BayerFormat::Packing::None } },\n> > > +       { MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_LE, { BayerFormat::BGGR, 10,\n> > > BayerFormat::Packing::None } },\n> > > +       { MEDIA_BUS_FMT_SBGGR10_2X8_PADLO_BE, { BayerFormat::BGGR, 10,\n> > > BayerFormat::Packing::None } },\n> > > +       { MEDIA_BUS_FMT_SBGGR10_2X8_PADLO_LE, { BayerFormat::BGGR, 10,\n> > > BayerFormat::Packing::None } },\n> > > +       { MEDIA_BUS_FMT_SBGGR10_1X10, { BayerFormat::BGGR, 10,\n> > > BayerFormat::Packing::None } },\n> > > +       { MEDIA_BUS_FMT_SGBRG10_1X10, { BayerFormat::GBRG, 10,\n> > > BayerFormat::Packing::None } },\n> > > +       { MEDIA_BUS_FMT_SGRBG10_1X10, { BayerFormat::GRBG, 10,\n> > > BayerFormat::Packing::None } },\n> > > +       { MEDIA_BUS_FMT_SRGGB10_1X10, { BayerFormat::RGGB, 10,\n> > > BayerFormat::Packing::None } },\n> > > +       { MEDIA_BUS_FMT_SBGGR12_1X12, { BayerFormat::BGGR, 12,\n> > > BayerFormat::Packing::None } },\n> > > +       { MEDIA_BUS_FMT_SGBRG12_1X12, { BayerFormat::GBRG, 12,\n> > > BayerFormat::Packing::None } },\n> > > +       { MEDIA_BUS_FMT_SGRBG12_1X12, { BayerFormat::GRBG, 12,\n> > > BayerFormat::Packing::None } },\n> > > +       { MEDIA_BUS_FMT_SRGGB12_1X12, { BayerFormat::RGGB, 12,\n> > > BayerFormat::Packing::None } },\n> > > +       { MEDIA_BUS_FMT_SBGGR14_1X14, { BayerFormat::BGGR, 14,\n> > > BayerFormat::Packing::None } },\n> > > +       { MEDIA_BUS_FMT_SGBRG14_1X14, { BayerFormat::GBRG, 14,\n> > > BayerFormat::Packing::None } },\n> > > +       { MEDIA_BUS_FMT_SGRBG14_1X14, { BayerFormat::GRBG, 14,\n> > > BayerFormat::Packing::None } },\n> > > +       { MEDIA_BUS_FMT_SRGGB14_1X14, { BayerFormat::RGGB, 14,\n> > > BayerFormat::Packing::None } },\n> > > +       { MEDIA_BUS_FMT_SBGGR16_1X16, { BayerFormat::BGGR, 16,\n> > > BayerFormat::Packing::None } },\n> > > +       { MEDIA_BUS_FMT_SGBRG16_1X16, { BayerFormat::GBRG, 16,\n> > > BayerFormat::Packing::None } },\n> > > +       { MEDIA_BUS_FMT_SGRBG16_1X16, { BayerFormat::GRBG, 16,\n> > > BayerFormat::Packing::None } },\n> > > +       { MEDIA_BUS_FMT_SRGGB16_1X16, { BayerFormat::RGGB, 16,\n> > > BayerFormat::Packing::None } },\n> > > +       { MEDIA_BUS_FMT_Y8_1X8, { BayerFormat::MONO, 8,\n> > > BayerFormat::Packing::None } },\n> > > +       { MEDIA_BUS_FMT_Y10_1X10, { BayerFormat::MONO, 10,\n> > > BayerFormat::Packing::None } },\n> > >  };\n> > >\n> > >  } /* namespace */\n> > > @@ -214,9 +214,9 @@ std::string BayerFormat::toString() const\n> > >\n> > >         result += \"-\" + std::to_string(bitDepth);\n> > >\n> > > -       if (packing == CSI2Packed)\n> > > +       if (packing == Packing::CSI2)\n> > >                 result += \"-CSI2P\";\n> > > -       else if (packing == IPU3Packed)\n> > > +       else if (packing == Packing::IPU3)\n> > >                 result += \"-IPU3P\";\n> > >\n> > >         return result;\n> > > diff --git a/test/bayer-format.cpp b/test/bayer-format.cpp\n> > > index e396ee83ca91..135bcb5214c8 100644\n> > > --- a/test/bayer-format.cpp\n> > > +++ b/test/bayer-format.cpp\n> > > @@ -30,7 +30,7 @@ protected:\n> > >                 }\n> > >\n> > >                 /* A correct Bayer format has to be valid. */\n> > > -               bayerFmt = BayerFormat(BayerFormat::BGGR, 8,\n> > > BayerFormat::None);\n> > > +               bayerFmt = BayerFormat(BayerFormat::BGGR, 8,\n> > > BayerFormat::Packing::None);\n> > >                 if (!bayerFmt.isValid()) {\n> > >                         cerr << \"A correct BayerFormat has to be\n> valid.\"\n> > >                              << endl;\n> > > @@ -41,9 +41,9 @@ protected:\n> > >                  * Two bayer formats created with the same order and\n> bit\n> > > depth\n> > >                  * have to be equal.\n> > >                  */\n> > > -               bayerFmt = BayerFormat(BayerFormat::BGGR, 8,\n> > > BayerFormat::None);\n> > > +               bayerFmt = BayerFormat(BayerFormat::BGGR, 8,\n> > > BayerFormat::Packing::None);\n> > >                 BayerFormat bayerFmtExpect =\n> > > BayerFormat(BayerFormat::BGGR, 8,\n> > > -\n> > > BayerFormat::None);\n> > > +\n> > > BayerFormat::Packing::None);\n> > >                 if (bayerFmt != bayerFmtExpect) {\n> > >                         cerr << \"Comparison of identical formats\n> failed.\"\n> > >                              << endl;\n> > > @@ -54,9 +54,9 @@ protected:\n> > >                  * Two Bayer formats created with the same order but\n> with a\n> > >                  * different bitDepth are not equal.\n> > >                  */\n> > > -               bayerFmt = BayerFormat(BayerFormat::BGGR, 8,\n> > > BayerFormat::None);\n> > > +               bayerFmt = BayerFormat(BayerFormat::BGGR, 8,\n> > > BayerFormat::Packing::None);\n> > >                 bayerFmtExpect = BayerFormat(BayerFormat::BGGR, 12,\n> > > -                                            BayerFormat::None);\n> > > +\n> BayerFormat::Packing::None);\n> > >                 if (bayerFmt == bayerFmtExpect) {\n> > >                         cerr << \"Comparison of different formats\n> failed.\"\n> > >                              << endl;\n> > > @@ -96,7 +96,7 @@ protected:\n> > >                  * to a Bayer format.\n> > >                  */\n> > >                 bayerFmtExpect = BayerFormat(BayerFormat::BGGR, 8,\n> > > -                                            BayerFormat::None);\n> > > +\n> BayerFormat::Packing::None);\n> > >                 v4l2Fmt = V4L2PixelFormat(V4L2_PIX_FMT_SBGGR8);\n> > >                 bayerFmt = BayerFormat::fromV4L2PixelFormat(v4l2Fmt);\n> > >                 if (bayerFmt != bayerFmtExpect) {\n> > > @@ -123,7 +123,7 @@ protected:\n> > >                  * Test if a valid Bayer format can be converted to a\n> > >                  * string representation.\n> > >                  */\n> > > -               bayerFmt = BayerFormat(BayerFormat::BGGR, 8,\n> > > BayerFormat::None);\n> > > +               bayerFmt = BayerFormat(BayerFormat::BGGR, 8,\n> > > BayerFormat::Packing::None);\n> > >                 if (bayerFmt.toString() != \"BGGR-8\") {\n> > >                         cerr << \"String representation != 'BGGR-8'\n> (got: '\"\n> > >                              << bayerFmt.toString() << \"' ) \" << endl;\n> > > @@ -145,9 +145,9 @@ protected:\n> > >                  * Perform a horizontal Flip and make sure that the\n> > >                  * order is adjusted accordingly.\n> > >                  */\n> > > -               bayerFmt = BayerFormat(BayerFormat::BGGR, 8,\n> > > BayerFormat::None);\n> > > +               bayerFmt = BayerFormat(BayerFormat::BGGR, 8,\n> > > BayerFormat::Packing::None);\n> > >                 bayerFmtExpect = BayerFormat(BayerFormat::GBRG, 8,\n> > > -                                            BayerFormat::None);\n> > > +\n> BayerFormat::Packing::None);\n> > >                 BayerFormat hFlipFmt =\n> > > bayerFmt.transform(Transform::HFlip);\n> > >                 if (hFlipFmt != bayerFmtExpect) {\n> > >                         cerr << \"Horizontal flip of 'BGGR-8' should\n> result\n> > > in '\"\n> > > @@ -160,9 +160,9 @@ protected:\n> > >                  * Perform a vertical Flip and make sure that\n> > >                  * the order is adjusted accordingly.\n> > >                  */\n> > > -               bayerFmt = BayerFormat(BayerFormat::BGGR, 8,\n> > > BayerFormat::None);\n> > > +               bayerFmt = BayerFormat(BayerFormat::BGGR, 8,\n> > > BayerFormat::Packing::None);\n> > >                 bayerFmtExpect = BayerFormat(BayerFormat::GRBG, 8,\n> > > -                                            BayerFormat::None);\n> > > +\n> BayerFormat::Packing::None);\n> > >                 BayerFormat vFlipFmt =\n> > > bayerFmt.transform(Transform::VFlip);\n> > >                 if (vFlipFmt != bayerFmtExpect) {\n> > >                         cerr << \"Vertical flip of 'BGGR-8' should\n> result\n> > > in '\"\n> > > @@ -176,7 +176,7 @@ protected:\n> > >                  * pixels on the bottom left to top right diagonal and\n> make\n> > >                  * sure, that it doesn't change.\n> > >                  */\n> > > -               bayerFmt = BayerFormat(BayerFormat::BGGR, 8,\n> > > BayerFormat::None);\n> > > +               bayerFmt = BayerFormat(BayerFormat::BGGR, 8,\n> > > BayerFormat::Packing::None);\n> > >                 BayerFormat transposeFmt = bayerFmt.transform(\n> > >                         Transform::Transpose);\n> > >                 if (transposeFmt != bayerFmt) {\n> > > @@ -192,9 +192,9 @@ protected:\n> > >                  * on the bottom left to top right diagonal and make\n> sure\n> > >                  * that their positions are switched.\n> > >                  */\n> > > -               bayerFmt = BayerFormat(BayerFormat::GBRG, 8,\n> > > BayerFormat::None);\n> > > +               bayerFmt = BayerFormat(BayerFormat::GBRG, 8,\n> > > BayerFormat::Packing::None);\n> > >                 bayerFmtExpect = BayerFormat(BayerFormat::GRBG, 8,\n> > > -                                            BayerFormat::None);\n> > > +\n> BayerFormat::Packing::None);\n> > >                 transposeFmt =\n> bayerFmt.transform(Transform::Transpose);\n> > >                 if (transposeFmt != bayerFmtExpect) {\n> > >                         cerr << \"Transpose with the red & blue pixels\n> on\n> > > the \"\n> > >\n> > > base-commit: 4d4694cd9f4ea73586dcb75d19905a1860356d9f\n>\n> --\n> Regards,\n>\n> Laurent Pinchart\n>","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 EBD85BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 27 Oct 2021 13:15:21 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id ABF1664882;\n\tWed, 27 Oct 2021 15:15:21 +0200 (CEST)","from mail-lj1-x229.google.com (mail-lj1-x229.google.com\n\t[IPv6:2a00:1450:4864:20::229])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A273E60123\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 27 Oct 2021 15:15:19 +0200 (CEST)","by mail-lj1-x229.google.com with SMTP id h11so4686820ljk.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 27 Oct 2021 06:15:19 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"OQ4lztk8\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=mime-version:references:in-reply-to:from:date:message-id:subject:to\n\t:cc; bh=1ZAeIsKPBC/iDo3ms14cXzC5CcqBlgt/zmutZf6aCa8=;\n\tb=OQ4lztk87Yw9r8cBsHn5cMsT+eDOSW8KYxV0+ByOYimZux+rEETMwrqjbd7jrzaJ9N\n\tw/7nR1Egsrax9Ldbqq7T0yJ1w5UPp4ritBLcHGOAHGLlL1ZwIvEhLnEYOLU+lHby6qkd\n\tL9cqF2U9RVHHpj56YfhaLjEauxd4cRB9z09uB/QjISOn9KqxWcyy1+YiJcfcQybCAzHH\n\tjoaZRtEmV/ktMNQlWSVnn+s9x89sJMgYxJqyq0MBoGhEd2D7RuDB5X/pjYoCj9FYObTB\n\t8WLI1NwQUNkUxuzFZVpQniuuo6eo4MZKaxb26w9nGSlC+avT4N4B4bWiacGBHTTYKtA5\n\ttkCg==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc;\n\tbh=1ZAeIsKPBC/iDo3ms14cXzC5CcqBlgt/zmutZf6aCa8=;\n\tb=DJGejonDZ62XBVSr2cyeGxhUys9mWXxqaNM2lG91l/oxbdmC3GlCNJq3O7WnhV6xyw\n\tYoYAWG7vk6+yGpfY8D4JOvCFptwty95S0xxx9TQZD93QBNtbjJCMUvula44LJ2n/SA4F\n\tP0OlU/UAYq7SH/V4m7iGy4wUpRkve4G1DE+DHsiioDVrVJAs79oQIFVr7b43RPEDn0mw\n\t8F+E/9pwx6oyNi1YB1dObN3YawhSs1LkQ4DZTZtA/sQ6A8a7qGBpbBPcdqrdkC/Dvpu5\n\tWLXBQXOary3LA+ngK4NZbe5OPSuMQKV4UTKfr2n4w3StmtURMz26wymS8qKDEP+TkdS3\n\tbcyw==","X-Gm-Message-State":"AOAM532wToDs7NXQIBGX4nDoRm8bWPFlY0+YlrdwjQlGKOX6or2FIxCB\n\tlocuxfLf5o9EL2Y+TjHs+MOT233lOFAdkZ0pOKg5WTtcZBnaTA==","X-Google-Smtp-Source":"ABdhPJwZFEvHZNMqdaXGb6DyH6x+/QuXVLKYwbezlKwYmS6zUAnYDtfp4u69EGIeU70flRUQGV/nZSJRaD3WimwwE+g=","X-Received":"by 2002:a2e:7306:: with SMTP id\n\to6mr31052688ljc.381.1635340518979; \n\tWed, 27 Oct 2021 06:15:18 -0700 (PDT)","MIME-Version":"1.0","References":"<20211027123619.16640-1-laurent.pinchart@ideasonboard.com>\n\t<CAEmqJPoyc9UdUJPLYZx1m+P_1EOxyjyxihuF8K=XnjA2-N0Sqw@mail.gmail.com>\n\t<YXlPqTiQsBRdIyy4@pendragon.ideasonboard.com>","In-Reply-To":"<YXlPqTiQsBRdIyy4@pendragon.ideasonboard.com>","From":"Naushir Patuck <naush@raspberrypi.com>","Date":"Wed, 27 Oct 2021 14:15:02 +0100","Message-ID":"<CAEmqJPraUjCfmYqicsG8ig+wZ8WzAJi+dMeamKihGNUOYFoxNw@mail.gmail.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Content-Type":"multipart/alternative; boundary=\"000000000000b8894705cf556220\"","Subject":"Re: [libcamera-devel] [PATCH] libcamera: bayer_format: Turn\n\tBayerFormat::Packing into scoped enum","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 <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":20582,"web_url":"https://patchwork.libcamera.org/comment/20582/","msgid":"<163534076483.1184428.8815857447780649239@Monstersaurus>","date":"2021-10-27T13:19:24","subject":"Re: [libcamera-devel] [PATCH] libcamera: bayer_format: Turn\n\tBayerFormat::Packing into scoped enum","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Laurent Pinchart (2021-10-27 13:36:19)\n> The unscoped enum BayerFormat::Packing leads to usage of the ambiguous\n> BayerFormat::None enumerator. Turn the enumeration into a scoped enum to\n> force usage of BayerFormat::Packing::None, and drop the now redundant\n> \"Packed\" suffix for the CSI2 and IPU3 packing.\n\nWell this clears up the ambiguities I had reviewing Naushs patches ;-)\n\nI have to admit, when I saw the tables added in Naushs series, I had to\ngo look up to check that BayerFormat::None was valid along side\nBayerFormat::RGGB, so I think as much as I dislike the longer lines -\nthis is a good change to make.\n\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> ---\n>  include/libcamera/internal/bayer_format.h |   6 +-\n>  src/libcamera/bayer_format.cpp            | 138 +++++++++++-----------\n>  test/bayer-format.cpp                     |  28 ++---\n>  3 files changed, 86 insertions(+), 86 deletions(-)\n> \n> diff --git a/include/libcamera/internal/bayer_format.h b/include/libcamera/internal/bayer_format.h\n> index 723382d4168d..d9a56d744a25 100644\n> --- a/include/libcamera/internal/bayer_format.h\n> +++ b/include/libcamera/internal/bayer_format.h\n> @@ -27,10 +27,10 @@ public:\n>                 MONO = 4\n>         };\n>  \n> -       enum Packing : uint16_t {\n> +       enum class Packing : uint16_t {\n>                 None = 0,\n> -               CSI2Packed = 1,\n> -               IPU3Packed = 2,\n> +               CSI2 = 1,\n> +               IPU3 = 2,\n>         };\n>  \n>         constexpr BayerFormat()\n> diff --git a/src/libcamera/bayer_format.cpp b/src/libcamera/bayer_format.cpp\n> index 11355f144f66..1c1e849a7e31 100644\n> --- a/src/libcamera/bayer_format.cpp\n> +++ b/src/libcamera/bayer_format.cpp\n> @@ -53,11 +53,11 @@ namespace libcamera {\n>   * \\enum BayerFormat::Packing\n>   * \\brief Different types of packing that can be applied to a BayerFormat\n>   *\n> - * \\var BayerFormat::None\n> + * \\var BayerFormat::Packing::None\n>   * \\brief No packing\n> - * \\var BayerFormat::CSI2Packed\n> + * \\var BayerFormat::Packing::CSI2\n>   * \\brief Format uses MIPI CSI-2 style packing\n> - * \\var BayerFormat::IPU3Packed\n> + * \\var BayerFormat::Packing::IPU3\n>   * \\brief Format uses IPU3 style packing\n>   */\n>  \n> @@ -85,73 +85,73 @@ struct BayerFormatComparator {\n>  };\n>  \n>  const std::map<BayerFormat, V4L2PixelFormat, BayerFormatComparator> bayerToV4l2{\n> -       { { BayerFormat::BGGR, 8, BayerFormat::None }, V4L2PixelFormat(V4L2_PIX_FMT_SBGGR8) },\n> -       { { BayerFormat::GBRG, 8, BayerFormat::None }, V4L2PixelFormat(V4L2_PIX_FMT_SGBRG8) },\n> -       { { BayerFormat::GRBG, 8, BayerFormat::None }, V4L2PixelFormat(V4L2_PIX_FMT_SGRBG8) },\n> -       { { BayerFormat::RGGB, 8, BayerFormat::None }, V4L2PixelFormat(V4L2_PIX_FMT_SRGGB8) },\n> -       { { BayerFormat::BGGR, 10, BayerFormat::None }, V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10) },\n> -       { { BayerFormat::GBRG, 10, BayerFormat::None }, V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10) },\n> -       { { BayerFormat::GRBG, 10, BayerFormat::None }, V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10) },\n> -       { { BayerFormat::RGGB, 10, BayerFormat::None }, V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10) },\n> -       { { BayerFormat::BGGR, 10, BayerFormat::CSI2Packed }, V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10P) },\n> -       { { BayerFormat::GBRG, 10, BayerFormat::CSI2Packed }, V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10P) },\n> -       { { BayerFormat::GRBG, 10, BayerFormat::CSI2Packed }, V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10P) },\n> -       { { BayerFormat::RGGB, 10, BayerFormat::CSI2Packed }, V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10P) },\n> -       { { BayerFormat::BGGR, 10, BayerFormat::IPU3Packed }, V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SBGGR10) },\n> -       { { BayerFormat::GBRG, 10, BayerFormat::IPU3Packed }, V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SGBRG10) },\n> -       { { BayerFormat::GRBG, 10, BayerFormat::IPU3Packed }, V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SGRBG10) },\n> -       { { BayerFormat::RGGB, 10, BayerFormat::IPU3Packed }, V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SRGGB10) },\n> -       { { BayerFormat::BGGR, 12, BayerFormat::None }, V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12) },\n> -       { { BayerFormat::GBRG, 12, BayerFormat::None }, V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12) },\n> -       { { BayerFormat::GRBG, 12, BayerFormat::None }, V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12) },\n> -       { { BayerFormat::RGGB, 12, BayerFormat::None }, V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12) },\n> -       { { BayerFormat::BGGR, 12, BayerFormat::CSI2Packed }, V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12P) },\n> -       { { BayerFormat::GBRG, 12, BayerFormat::CSI2Packed }, V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12P) },\n> -       { { BayerFormat::GRBG, 12, BayerFormat::CSI2Packed }, V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12P) },\n> -       { { BayerFormat::RGGB, 12, BayerFormat::CSI2Packed }, V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12P) },\n> -       { { BayerFormat::BGGR, 16, BayerFormat::None }, V4L2PixelFormat(V4L2_PIX_FMT_SBGGR16) },\n> -       { { BayerFormat::GBRG, 16, BayerFormat::None }, V4L2PixelFormat(V4L2_PIX_FMT_SGBRG16) },\n> -       { { BayerFormat::GRBG, 16, BayerFormat::None }, V4L2PixelFormat(V4L2_PIX_FMT_SGRBG16) },\n> -       { { BayerFormat::RGGB, 16, BayerFormat::None }, V4L2PixelFormat(V4L2_PIX_FMT_SRGGB16) },\n> -       { { BayerFormat::MONO, 8, BayerFormat::None }, V4L2PixelFormat(V4L2_PIX_FMT_GREY) },\n> -       { { BayerFormat::MONO, 10, BayerFormat::CSI2Packed }, V4L2PixelFormat(V4L2_PIX_FMT_Y10P) },\n> +       { { BayerFormat::BGGR, 8, BayerFormat::Packing::None }, V4L2PixelFormat(V4L2_PIX_FMT_SBGGR8) },\n> +       { { BayerFormat::GBRG, 8, BayerFormat::Packing::None }, V4L2PixelFormat(V4L2_PIX_FMT_SGBRG8) },\n> +       { { BayerFormat::GRBG, 8, BayerFormat::Packing::None }, V4L2PixelFormat(V4L2_PIX_FMT_SGRBG8) },\n> +       { { BayerFormat::RGGB, 8, BayerFormat::Packing::None }, V4L2PixelFormat(V4L2_PIX_FMT_SRGGB8) },\n> +       { { BayerFormat::BGGR, 10, BayerFormat::Packing::None }, V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10) },\n> +       { { BayerFormat::GBRG, 10, BayerFormat::Packing::None }, V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10) },\n> +       { { BayerFormat::GRBG, 10, BayerFormat::Packing::None }, V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10) },\n> +       { { BayerFormat::RGGB, 10, BayerFormat::Packing::None }, V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10) },\n> +       { { BayerFormat::BGGR, 10, BayerFormat::Packing::CSI2 }, V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10P) },\n> +       { { BayerFormat::GBRG, 10, BayerFormat::Packing::CSI2 }, V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10P) },\n> +       { { BayerFormat::GRBG, 10, BayerFormat::Packing::CSI2 }, V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10P) },\n> +       { { BayerFormat::RGGB, 10, BayerFormat::Packing::CSI2 }, V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10P) },\n> +       { { BayerFormat::BGGR, 10, BayerFormat::Packing::IPU3 }, V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SBGGR10) },\n> +       { { BayerFormat::GBRG, 10, BayerFormat::Packing::IPU3 }, V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SGBRG10) },\n> +       { { BayerFormat::GRBG, 10, BayerFormat::Packing::IPU3 }, V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SGRBG10) },\n> +       { { BayerFormat::RGGB, 10, BayerFormat::Packing::IPU3 }, V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SRGGB10) },\n> +       { { BayerFormat::BGGR, 12, BayerFormat::Packing::None }, V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12) },\n> +       { { BayerFormat::GBRG, 12, BayerFormat::Packing::None }, V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12) },\n> +       { { BayerFormat::GRBG, 12, BayerFormat::Packing::None }, V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12) },\n> +       { { BayerFormat::RGGB, 12, BayerFormat::Packing::None }, V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12) },\n> +       { { BayerFormat::BGGR, 12, BayerFormat::Packing::CSI2 }, V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12P) },\n> +       { { BayerFormat::GBRG, 12, BayerFormat::Packing::CSI2 }, V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12P) },\n> +       { { BayerFormat::GRBG, 12, BayerFormat::Packing::CSI2 }, V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12P) },\n> +       { { BayerFormat::RGGB, 12, BayerFormat::Packing::CSI2 }, V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12P) },\n> +       { { BayerFormat::BGGR, 16, BayerFormat::Packing::None }, V4L2PixelFormat(V4L2_PIX_FMT_SBGGR16) },\n> +       { { BayerFormat::GBRG, 16, BayerFormat::Packing::None }, V4L2PixelFormat(V4L2_PIX_FMT_SGBRG16) },\n> +       { { BayerFormat::GRBG, 16, BayerFormat::Packing::None }, V4L2PixelFormat(V4L2_PIX_FMT_SGRBG16) },\n> +       { { BayerFormat::RGGB, 16, BayerFormat::Packing::None }, V4L2PixelFormat(V4L2_PIX_FMT_SRGGB16) },\n> +       { { BayerFormat::MONO, 8, BayerFormat::Packing::None }, V4L2PixelFormat(V4L2_PIX_FMT_GREY) },\n> +       { { BayerFormat::MONO, 10, BayerFormat::Packing::CSI2 }, V4L2PixelFormat(V4L2_PIX_FMT_Y10P) },\n>  };\n>  \n>  const std::unordered_map<unsigned int, BayerFormat> mbusCodeToBayer{\n> -       { MEDIA_BUS_FMT_SBGGR8_1X8, { BayerFormat::BGGR, 8, BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SGBRG8_1X8, { BayerFormat::GBRG, 8, BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SGRBG8_1X8, { BayerFormat::GRBG, 8, BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SRGGB8_1X8, { BayerFormat::RGGB, 8, BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SBGGR10_ALAW8_1X8, { BayerFormat::BGGR, 8, BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SGBRG10_ALAW8_1X8, { BayerFormat::GBRG, 8, BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SGRBG10_ALAW8_1X8, { BayerFormat::GRBG, 8, BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SRGGB10_ALAW8_1X8, { BayerFormat::RGGB, 8, BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SBGGR10_DPCM8_1X8, { BayerFormat::BGGR, 8, BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SGBRG10_DPCM8_1X8, { BayerFormat::GBRG, 8, BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SGRBG10_DPCM8_1X8, { BayerFormat::GRBG, 8, BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SRGGB10_DPCM8_1X8, { BayerFormat::RGGB, 8, BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_BE, { BayerFormat::BGGR, 10, BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_LE, { BayerFormat::BGGR, 10, BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SBGGR10_2X8_PADLO_BE, { BayerFormat::BGGR, 10, BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SBGGR10_2X8_PADLO_LE, { BayerFormat::BGGR, 10, BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SBGGR10_1X10, { BayerFormat::BGGR, 10, BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SGBRG10_1X10, { BayerFormat::GBRG, 10, BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SGRBG10_1X10, { BayerFormat::GRBG, 10, BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SRGGB10_1X10, { BayerFormat::RGGB, 10, BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SBGGR12_1X12, { BayerFormat::BGGR, 12, BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SGBRG12_1X12, { BayerFormat::GBRG, 12, BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SGRBG12_1X12, { BayerFormat::GRBG, 12, BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SRGGB12_1X12, { BayerFormat::RGGB, 12, BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SBGGR14_1X14, { BayerFormat::BGGR, 14, BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SGBRG14_1X14, { BayerFormat::GBRG, 14, BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SGRBG14_1X14, { BayerFormat::GRBG, 14, BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SRGGB14_1X14, { BayerFormat::RGGB, 14, BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SBGGR16_1X16, { BayerFormat::BGGR, 16, BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SGBRG16_1X16, { BayerFormat::GBRG, 16, BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SGRBG16_1X16, { BayerFormat::GRBG, 16, BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_SRGGB16_1X16, { BayerFormat::RGGB, 16, BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_Y8_1X8, { BayerFormat::MONO, 8, BayerFormat::None } },\n> -       { MEDIA_BUS_FMT_Y10_1X10, { BayerFormat::MONO, 10, BayerFormat::None } },\n> +       { MEDIA_BUS_FMT_SBGGR8_1X8, { BayerFormat::BGGR, 8, BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SGBRG8_1X8, { BayerFormat::GBRG, 8, BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SGRBG8_1X8, { BayerFormat::GRBG, 8, BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SRGGB8_1X8, { BayerFormat::RGGB, 8, BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SBGGR10_ALAW8_1X8, { BayerFormat::BGGR, 8, BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SGBRG10_ALAW8_1X8, { BayerFormat::GBRG, 8, BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SGRBG10_ALAW8_1X8, { BayerFormat::GRBG, 8, BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SRGGB10_ALAW8_1X8, { BayerFormat::RGGB, 8, BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SBGGR10_DPCM8_1X8, { BayerFormat::BGGR, 8, BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SGBRG10_DPCM8_1X8, { BayerFormat::GBRG, 8, BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SGRBG10_DPCM8_1X8, { BayerFormat::GRBG, 8, BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SRGGB10_DPCM8_1X8, { BayerFormat::RGGB, 8, BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_BE, { BayerFormat::BGGR, 10, BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_LE, { BayerFormat::BGGR, 10, BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SBGGR10_2X8_PADLO_BE, { BayerFormat::BGGR, 10, BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SBGGR10_2X8_PADLO_LE, { BayerFormat::BGGR, 10, BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SBGGR10_1X10, { BayerFormat::BGGR, 10, BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SGBRG10_1X10, { BayerFormat::GBRG, 10, BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SGRBG10_1X10, { BayerFormat::GRBG, 10, BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SRGGB10_1X10, { BayerFormat::RGGB, 10, BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SBGGR12_1X12, { BayerFormat::BGGR, 12, BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SGBRG12_1X12, { BayerFormat::GBRG, 12, BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SGRBG12_1X12, { BayerFormat::GRBG, 12, BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SRGGB12_1X12, { BayerFormat::RGGB, 12, BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SBGGR14_1X14, { BayerFormat::BGGR, 14, BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SGBRG14_1X14, { BayerFormat::GBRG, 14, BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SGRBG14_1X14, { BayerFormat::GRBG, 14, BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SRGGB14_1X14, { BayerFormat::RGGB, 14, BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SBGGR16_1X16, { BayerFormat::BGGR, 16, BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SGBRG16_1X16, { BayerFormat::GBRG, 16, BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SGRBG16_1X16, { BayerFormat::GRBG, 16, BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_SRGGB16_1X16, { BayerFormat::RGGB, 16, BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_Y8_1X8, { BayerFormat::MONO, 8, BayerFormat::Packing::None } },\n> +       { MEDIA_BUS_FMT_Y10_1X10, { BayerFormat::MONO, 10, BayerFormat::Packing::None } },\n>  };\n>  \n>  } /* namespace */\n> @@ -214,9 +214,9 @@ std::string BayerFormat::toString() const\n>  \n>         result += \"-\" + std::to_string(bitDepth);\n>  \n> -       if (packing == CSI2Packed)\n> +       if (packing == Packing::CSI2)\n>                 result += \"-CSI2P\";\n> -       else if (packing == IPU3Packed)\n> +       else if (packing == Packing::IPU3)\n\nThese read quite nicely\n\n>                 result += \"-IPU3P\";\n>  \n>         return result;\n> diff --git a/test/bayer-format.cpp b/test/bayer-format.cpp\n> index e396ee83ca91..135bcb5214c8 100644\n> --- a/test/bayer-format.cpp\n> +++ b/test/bayer-format.cpp\n> @@ -30,7 +30,7 @@ protected:\n>                 }\n>  \n>                 /* A correct Bayer format has to be valid. */\n> -               bayerFmt = BayerFormat(BayerFormat::BGGR, 8, BayerFormat::None);\n> +               bayerFmt = BayerFormat(BayerFormat::BGGR, 8, BayerFormat::Packing::None);\n>                 if (!bayerFmt.isValid()) {\n>                         cerr << \"A correct BayerFormat has to be valid.\"\n>                              << endl;\n> @@ -41,9 +41,9 @@ protected:\n>                  * Two bayer formats created with the same order and bit depth\n>                  * have to be equal.\n>                  */\n> -               bayerFmt = BayerFormat(BayerFormat::BGGR, 8, BayerFormat::None);\n> +               bayerFmt = BayerFormat(BayerFormat::BGGR, 8, BayerFormat::Packing::None);\n>                 BayerFormat bayerFmtExpect = BayerFormat(BayerFormat::BGGR, 8,\n> -                                                        BayerFormat::None);\n> +                                                        BayerFormat::Packing::None);\n>                 if (bayerFmt != bayerFmtExpect) {\n>                         cerr << \"Comparison of identical formats failed.\"\n>                              << endl;\n> @@ -54,9 +54,9 @@ protected:\n>                  * Two Bayer formats created with the same order but with a\n>                  * different bitDepth are not equal.\n>                  */\n> -               bayerFmt = BayerFormat(BayerFormat::BGGR, 8, BayerFormat::None);\n> +               bayerFmt = BayerFormat(BayerFormat::BGGR, 8, BayerFormat::Packing::None);\n>                 bayerFmtExpect = BayerFormat(BayerFormat::BGGR, 12,\n> -                                            BayerFormat::None);\n> +                                            BayerFormat::Packing::None);\n>                 if (bayerFmt == bayerFmtExpect) {\n>                         cerr << \"Comparison of different formats failed.\"\n>                              << endl;\n> @@ -96,7 +96,7 @@ protected:\n>                  * to a Bayer format.\n>                  */\n>                 bayerFmtExpect = BayerFormat(BayerFormat::BGGR, 8,\n> -                                            BayerFormat::None);\n> +                                            BayerFormat::Packing::None);\n>                 v4l2Fmt = V4L2PixelFormat(V4L2_PIX_FMT_SBGGR8);\n>                 bayerFmt = BayerFormat::fromV4L2PixelFormat(v4l2Fmt);\n>                 if (bayerFmt != bayerFmtExpect) {\n> @@ -123,7 +123,7 @@ protected:\n>                  * Test if a valid Bayer format can be converted to a\n>                  * string representation.\n>                  */\n> -               bayerFmt = BayerFormat(BayerFormat::BGGR, 8, BayerFormat::None);\n> +               bayerFmt = BayerFormat(BayerFormat::BGGR, 8, BayerFormat::Packing::None);\n>                 if (bayerFmt.toString() != \"BGGR-8\") {\n>                         cerr << \"String representation != 'BGGR-8' (got: '\"\n>                              << bayerFmt.toString() << \"' ) \" << endl;\n> @@ -145,9 +145,9 @@ protected:\n>                  * Perform a horizontal Flip and make sure that the\n>                  * order is adjusted accordingly.\n>                  */\n> -               bayerFmt = BayerFormat(BayerFormat::BGGR, 8, BayerFormat::None);\n> +               bayerFmt = BayerFormat(BayerFormat::BGGR, 8, BayerFormat::Packing::None);\n>                 bayerFmtExpect = BayerFormat(BayerFormat::GBRG, 8,\n> -                                            BayerFormat::None);\n> +                                            BayerFormat::Packing::None);\n>                 BayerFormat hFlipFmt = bayerFmt.transform(Transform::HFlip);\n>                 if (hFlipFmt != bayerFmtExpect) {\n>                         cerr << \"Horizontal flip of 'BGGR-8' should result in '\"\n> @@ -160,9 +160,9 @@ protected:\n>                  * Perform a vertical Flip and make sure that\n>                  * the order is adjusted accordingly.\n>                  */\n> -               bayerFmt = BayerFormat(BayerFormat::BGGR, 8, BayerFormat::None);\n> +               bayerFmt = BayerFormat(BayerFormat::BGGR, 8, BayerFormat::Packing::None);\n>                 bayerFmtExpect = BayerFormat(BayerFormat::GRBG, 8,\n> -                                            BayerFormat::None);\n> +                                            BayerFormat::Packing::None);\n>                 BayerFormat vFlipFmt = bayerFmt.transform(Transform::VFlip);\n>                 if (vFlipFmt != bayerFmtExpect) {\n>                         cerr << \"Vertical flip of 'BGGR-8' should result in '\"\n> @@ -176,7 +176,7 @@ protected:\n>                  * pixels on the bottom left to top right diagonal and make\n>                  * sure, that it doesn't change.\n>                  */\n> -               bayerFmt = BayerFormat(BayerFormat::BGGR, 8, BayerFormat::None);\n> +               bayerFmt = BayerFormat(BayerFormat::BGGR, 8, BayerFormat::Packing::None);\n>                 BayerFormat transposeFmt = bayerFmt.transform(\n>                         Transform::Transpose);\n>                 if (transposeFmt != bayerFmt) {\n> @@ -192,9 +192,9 @@ protected:\n>                  * on the bottom left to top right diagonal and make sure\n>                  * that their positions are switched.\n>                  */\n> -               bayerFmt = BayerFormat(BayerFormat::GBRG, 8, BayerFormat::None);\n> +               bayerFmt = BayerFormat(BayerFormat::GBRG, 8, BayerFormat::Packing::None);\n>                 bayerFmtExpect = BayerFormat(BayerFormat::GRBG, 8,\n> -                                            BayerFormat::None);\n> +                                            BayerFormat::Packing::None);\n>                 transposeFmt = bayerFmt.transform(Transform::Transpose);\n>                 if (transposeFmt != bayerFmtExpect) {\n>                         cerr << \"Transpose with the red & blue pixels on the \"\n> \n> base-commit: 4d4694cd9f4ea73586dcb75d19905a1860356d9f\n> -- \n> Regards,\n> \n> Laurent Pinchart\n>","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 5C479BDB1C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 27 Oct 2021 13:19:29 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 18EBE6487F;\n\tWed, 27 Oct 2021 15:19:29 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0791160123\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 27 Oct 2021 15:19:28 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id B1A9A596;\n\tWed, 27 Oct 2021 15:19:27 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"YFNV7w0C\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1635340767;\n\tbh=MMElsRnYk1UjFSPbjvWiUx1J99NYw5FnEU0G1XfGwEk=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=YFNV7w0C0XWgOkNcnDvgqqk1zCJ/7BaqxsuxHjAjJD+A6IH3PSWYI5nfu2awXQmWk\n\tbiiKbW7VtEJmwh8PzzVWxjC2mZ/QNL/mr6GJgyDBmZP6DefDrjdLxVkPEGyXW9RS7d\n\teVhfdTxmcIq6BZDUiDT2SAUa5Mh4Dgk4+1VrZ6QU=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20211027123619.16640-1-laurent.pinchart@ideasonboard.com>","References":"<20211027123619.16640-1-laurent.pinchart@ideasonboard.com>","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Wed, 27 Oct 2021 14:19:24 +0100","Message-ID":"<163534076483.1184428.8815857447780649239@Monstersaurus>","User-Agent":"alot/0.9.1","Subject":"Re: [libcamera-devel] [PATCH] libcamera: bayer_format: Turn\n\tBayerFormat::Packing into scoped enum","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":20584,"web_url":"https://patchwork.libcamera.org/comment/20584/","msgid":"<163534103100.1184428.6691336555178865021@Monstersaurus>","date":"2021-10-27T13:23:51","subject":"Re: [libcamera-devel] [PATCH] libcamera: bayer_format: Turn\n\tBayerFormat::Packing into scoped enum","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Naushir Patuck (2021-10-27 14:15:02)\n> On Wed, 27 Oct 2021 at 14:10, Laurent Pinchart <\n> laurent.pinchart@ideasonboard.com> wrote:\n> \n> > Hi Naush,\n> >\n> > On Wed, Oct 27, 2021 at 01:48:09PM +0100, Naushir Patuck wrote:\n> > > On Wed, 27 Oct 2021 at 13:36, Laurent Pinchart wrote:\n> > >\n> > > > The unscoped enum BayerFormat::Packing leads to usage of the ambiguous\n> > > > BayerFormat::None enumerator. Turn the enumeration into a scoped enum\n> > to\n> > > > force usage of BayerFormat::Packing::None, and drop the now redundant\n> > > > \"Packed\" suffix for the CSI2 and IPU3 packing.\n> > > >\n> > > > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> > >\n> > > This is going to conflict badly with my series :-)\n> >\n> > Guess what gave me the idea ? :-)\n> >\n> > > I definitely prefer scoped enums, but do you think we ought to do the\n> > > same with the Order enum in this change?\n> >\n> > It's less ambiguous for the Order, but I wouldn't mind. I can send a v2\n> > with that change.\n> >\n> \n> Great, I'll wait for that and add it to this series.\n\nI won't object to the Order being scoped ... but I don't think that one\nis needed.\n\nThe BayerFormat::None really threw me off when reviewing before, so that\nreally helps to have the scope.\n\nHowever:\n  BayerFormat::GBRG\n\nIs somewhat more self documenting...\n\n\n> > > ---\n> > > >  include/libcamera/internal/bayer_format.h |   6 +-\n> > > >  src/libcamera/bayer_format.cpp            | 138 +++++++++++-----------\n> > > >  test/bayer-format.cpp                     |  28 ++---\n> > > >  3 files changed, 86 insertions(+), 86 deletions(-)\n> > > >\n> > > > diff --git a/include/libcamera/internal/bayer_format.h\n> > > > b/include/libcamera/internal/bayer_format.h\n> > > > index 723382d4168d..d9a56d744a25 100644\n> > > > --- a/include/libcamera/internal/bayer_format.h\n> > > > +++ b/include/libcamera/internal/bayer_format.h\n> > > > @@ -27,10 +27,10 @@ public:\n> > > >                 MONO = 4\n> > > >         };\n> > > >\n> > > > -       enum Packing : uint16_t {\n> > > > +       enum class Packing : uint16_t {\n> > > >                 None = 0,\n> > > > -               CSI2Packed = 1,\n> > > > -               IPU3Packed = 2,\n> > > > +               CSI2 = 1,\n> > > > +               IPU3 = 2,\n> > > >         };\n> > > >\n> > > >         constexpr BayerFormat()\n> > > > diff --git a/src/libcamera/bayer_format.cpp\n> > > > b/src/libcamera/bayer_format.cpp\n> > > > index 11355f144f66..1c1e849a7e31 100644\n> > > > --- a/src/libcamera/bayer_format.cpp\n> > > > +++ b/src/libcamera/bayer_format.cpp\n> > > > @@ -53,11 +53,11 @@ namespace libcamera {\n> > > >   * \\enum BayerFormat::Packing\n> > > >   * \\brief Different types of packing that can be applied to a\n> > BayerFormat\n> > > >   *\n> > > > - * \\var BayerFormat::None\n> > > > + * \\var BayerFormat::Packing::None\n> > > >   * \\brief No packing\n> > > > - * \\var BayerFormat::CSI2Packed\n> > > > + * \\var BayerFormat::Packing::CSI2\n> > > >   * \\brief Format uses MIPI CSI-2 style packing\n> > > > - * \\var BayerFormat::IPU3Packed\n> > > > + * \\var BayerFormat::Packing::IPU3\n> > > >   * \\brief Format uses IPU3 style packing\n> > > >   */\n> > > >\n> > > > @@ -85,73 +85,73 @@ struct BayerFormatComparator {\n> > > >  };\n> > > >\n> > > >  const std::map<BayerFormat, V4L2PixelFormat, BayerFormatComparator>\n> > > > bayerToV4l2{\n> > > > -       { { BayerFormat::BGGR, 8, BayerFormat::None },\n> > > > V4L2PixelFormat(V4L2_PIX_FMT_SBGGR8) },\n> > > > -       { { BayerFormat::GBRG, 8, BayerFormat::None },\n> > > > V4L2PixelFormat(V4L2_PIX_FMT_SGBRG8) },\n> > > > -       { { BayerFormat::GRBG, 8, BayerFormat::None },\n> > > > V4L2PixelFormat(V4L2_PIX_FMT_SGRBG8) },\n> > > > -       { { BayerFormat::RGGB, 8, BayerFormat::None },\n> > > > V4L2PixelFormat(V4L2_PIX_FMT_SRGGB8) },\n> > > > -       { { BayerFormat::BGGR, 10, BayerFormat::None },\n> > > > V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10) },\n> > > > -       { { BayerFormat::GBRG, 10, BayerFormat::None },\n> > > > V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10) },\n> > > > -       { { BayerFormat::GRBG, 10, BayerFormat::None },\n> > > > V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10) },\n> > > > -       { { BayerFormat::RGGB, 10, BayerFormat::None },\n> > > > V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10) },\n> > > > -       { { BayerFormat::BGGR, 10, BayerFormat::CSI2Packed },\n> > > > V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10P) },\n> > > > -       { { BayerFormat::GBRG, 10, BayerFormat::CSI2Packed },\n> > > > V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10P) },\n> > > > -       { { BayerFormat::GRBG, 10, BayerFormat::CSI2Packed },\n> > > > V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10P) },\n> > > > -       { { BayerFormat::RGGB, 10, BayerFormat::CSI2Packed },\n> > > > V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10P) },\n> > > > -       { { BayerFormat::BGGR, 10, BayerFormat::IPU3Packed },\n> > > > V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SBGGR10) },\n> > > > -       { { BayerFormat::GBRG, 10, BayerFormat::IPU3Packed },\n> > > > V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SGBRG10) },\n> > > > -       { { BayerFormat::GRBG, 10, BayerFormat::IPU3Packed },\n> > > > V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SGRBG10) },\n> > > > -       { { BayerFormat::RGGB, 10, BayerFormat::IPU3Packed },\n> > > > V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SRGGB10) },\n> > > > -       { { BayerFormat::BGGR, 12, BayerFormat::None },\n> > > > V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12) },\n> > > > -       { { BayerFormat::GBRG, 12, BayerFormat::None },\n> > > > V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12) },\n> > > > -       { { BayerFormat::GRBG, 12, BayerFormat::None },\n> > > > V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12) },\n> > > > -       { { BayerFormat::RGGB, 12, BayerFormat::None },\n> > > > V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12) },\n> > > > -       { { BayerFormat::BGGR, 12, BayerFormat::CSI2Packed },\n> > > > V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12P) },\n> > > > -       { { BayerFormat::GBRG, 12, BayerFormat::CSI2Packed },\n> > > > V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12P) },\n> > > > -       { { BayerFormat::GRBG, 12, BayerFormat::CSI2Packed },\n> > > > V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12P) },\n> > > > -       { { BayerFormat::RGGB, 12, BayerFormat::CSI2Packed },\n> > > > V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12P) },\n> > > > -       { { BayerFormat::BGGR, 16, BayerFormat::None },\n> > > > V4L2PixelFormat(V4L2_PIX_FMT_SBGGR16) },\n> > > > -       { { BayerFormat::GBRG, 16, BayerFormat::None },\n> > > > V4L2PixelFormat(V4L2_PIX_FMT_SGBRG16) },\n> > > > -       { { BayerFormat::GRBG, 16, BayerFormat::None },\n> > > > V4L2PixelFormat(V4L2_PIX_FMT_SGRBG16) },\n> > > > -       { { BayerFormat::RGGB, 16, BayerFormat::None },\n> > > > V4L2PixelFormat(V4L2_PIX_FMT_SRGGB16) },\n> > > > -       { { BayerFormat::MONO, 8, BayerFormat::None },\n> > > > V4L2PixelFormat(V4L2_PIX_FMT_GREY) },\n> > > > -       { { BayerFormat::MONO, 10, BayerFormat::CSI2Packed },\n> > > > V4L2PixelFormat(V4L2_PIX_FMT_Y10P) },\n> > > > +       { { BayerFormat::BGGR, 8, BayerFormat::Packing::None },\n> > > > V4L2PixelFormat(V4L2_PIX_FMT_SBGGR8) },\n> > > > +       { { BayerFormat::GBRG, 8, BayerFormat::Packing::None },\n> > > > V4L2PixelFormat(V4L2_PIX_FMT_SGBRG8) },\n> > > > +       { { BayerFormat::GRBG, 8, BayerFormat::Packing::None },\n> > > > V4L2PixelFormat(V4L2_PIX_FMT_SGRBG8) },\n> > > > +       { { BayerFormat::RGGB, 8, BayerFormat::Packing::None },\n> > > > V4L2PixelFormat(V4L2_PIX_FMT_SRGGB8) },\n> > > > +       { { BayerFormat::BGGR, 10, BayerFormat::Packing::None },\n> > > > V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10) },\n> > > > +       { { BayerFormat::GBRG, 10, BayerFormat::Packing::None },\n> > > > V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10) },\n> > > > +       { { BayerFormat::GRBG, 10, BayerFormat::Packing::None },\n> > > > V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10) },\n> > > > +       { { BayerFormat::RGGB, 10, BayerFormat::Packing::None },\n> > > > V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10) },\n> > > > +       { { BayerFormat::BGGR, 10, BayerFormat::Packing::CSI2 },\n> > > > V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10P) },\n> > > > +       { { BayerFormat::GBRG, 10, BayerFormat::Packing::CSI2 },\n> > > > V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10P) },\n> > > > +       { { BayerFormat::GRBG, 10, BayerFormat::Packing::CSI2 },\n> > > > V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10P) },\n> > > > +       { { BayerFormat::RGGB, 10, BayerFormat::Packing::CSI2 },\n> > > > V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10P) },\n> > > > +       { { BayerFormat::BGGR, 10, BayerFormat::Packing::IPU3 },\n> > > > V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SBGGR10) },\n> > > > +       { { BayerFormat::GBRG, 10, BayerFormat::Packing::IPU3 },\n> > > > V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SGBRG10) },\n> > > > +       { { BayerFormat::GRBG, 10, BayerFormat::Packing::IPU3 },\n> > > > V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SGRBG10) },\n> > > > +       { { BayerFormat::RGGB, 10, BayerFormat::Packing::IPU3 },\n> > > > V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SRGGB10) },\n> > > > +       { { BayerFormat::BGGR, 12, BayerFormat::Packing::None },\n> > > > V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12) },\n> > > > +       { { BayerFormat::GBRG, 12, BayerFormat::Packing::None },\n> > > > V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12) },\n> > > > +       { { BayerFormat::GRBG, 12, BayerFormat::Packing::None },\n> > > > V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12) },\n> > > > +       { { BayerFormat::RGGB, 12, BayerFormat::Packing::None },\n> > > > V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12) },\n> > > > +       { { BayerFormat::BGGR, 12, BayerFormat::Packing::CSI2 },\n> > > > V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12P) },\n> > > > +       { { BayerFormat::GBRG, 12, BayerFormat::Packing::CSI2 },\n> > > > V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12P) },\n> > > > +       { { BayerFormat::GRBG, 12, BayerFormat::Packing::CSI2 },\n> > > > V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12P) },\n> > > > +       { { BayerFormat::RGGB, 12, BayerFormat::Packing::CSI2 },\n> > > > V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12P) },\n> > > > +       { { BayerFormat::BGGR, 16, BayerFormat::Packing::None },\n> > > > V4L2PixelFormat(V4L2_PIX_FMT_SBGGR16) },\n> > > > +       { { BayerFormat::GBRG, 16, BayerFormat::Packing::None },\n> > > > V4L2PixelFormat(V4L2_PIX_FMT_SGBRG16) },\n> > > > +       { { BayerFormat::GRBG, 16, BayerFormat::Packing::None },\n> > > > V4L2PixelFormat(V4L2_PIX_FMT_SGRBG16) },\n> > > > +       { { BayerFormat::RGGB, 16, BayerFormat::Packing::None },\n> > > > V4L2PixelFormat(V4L2_PIX_FMT_SRGGB16) },\n> > > > +       { { BayerFormat::MONO, 8, BayerFormat::Packing::None },\n> > > > V4L2PixelFormat(V4L2_PIX_FMT_GREY) },\n> > > > +       { { BayerFormat::MONO, 10, BayerFormat::Packing::CSI2 },\n> > > > V4L2PixelFormat(V4L2_PIX_FMT_Y10P) },\n> > > >  };\n> > > >\n> > > >  const std::unordered_map<unsigned int, BayerFormat> mbusCodeToBayer{\n> > > > -       { MEDIA_BUS_FMT_SBGGR8_1X8, { BayerFormat::BGGR, 8,\n> > > > BayerFormat::None } },\n> > > > -       { MEDIA_BUS_FMT_SGBRG8_1X8, { BayerFormat::GBRG, 8,\n> > > > BayerFormat::None } },\n> > > > -       { MEDIA_BUS_FMT_SGRBG8_1X8, { BayerFormat::GRBG, 8,\n> > > > BayerFormat::None } },\n> > > > -       { MEDIA_BUS_FMT_SRGGB8_1X8, { BayerFormat::RGGB, 8,\n> > > > BayerFormat::None } },\n> > > > -       { MEDIA_BUS_FMT_SBGGR10_ALAW8_1X8, { BayerFormat::BGGR, 8,\n> > > > BayerFormat::None } },\n> > > > -       { MEDIA_BUS_FMT_SGBRG10_ALAW8_1X8, { BayerFormat::GBRG, 8,\n> > > > BayerFormat::None } },\n> > > > -       { MEDIA_BUS_FMT_SGRBG10_ALAW8_1X8, { BayerFormat::GRBG, 8,\n> > > > BayerFormat::None } },\n> > > > -       { MEDIA_BUS_FMT_SRGGB10_ALAW8_1X8, { BayerFormat::RGGB, 8,\n> > > > BayerFormat::None } },\n> > > > -       { MEDIA_BUS_FMT_SBGGR10_DPCM8_1X8, { BayerFormat::BGGR, 8,\n> > > > BayerFormat::None } },\n> > > > -       { MEDIA_BUS_FMT_SGBRG10_DPCM8_1X8, { BayerFormat::GBRG, 8,\n> > > > BayerFormat::None } },\n> > > > -       { MEDIA_BUS_FMT_SGRBG10_DPCM8_1X8, { BayerFormat::GRBG, 8,\n> > > > BayerFormat::None } },\n> > > > -       { MEDIA_BUS_FMT_SRGGB10_DPCM8_1X8, { BayerFormat::RGGB, 8,\n> > > > BayerFormat::None } },\n> > > > -       { MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_BE, { BayerFormat::BGGR, 10,\n> > > > BayerFormat::None } },\n> > > > -       { MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_LE, { BayerFormat::BGGR, 10,\n> > > > BayerFormat::None } },\n> > > > -       { MEDIA_BUS_FMT_SBGGR10_2X8_PADLO_BE, { BayerFormat::BGGR, 10,\n> > > > BayerFormat::None } },\n> > > > -       { MEDIA_BUS_FMT_SBGGR10_2X8_PADLO_LE, { BayerFormat::BGGR, 10,\n> > > > BayerFormat::None } },\n> > > > -       { MEDIA_BUS_FMT_SBGGR10_1X10, { BayerFormat::BGGR, 10,\n> > > > BayerFormat::None } },\n> > > > -       { MEDIA_BUS_FMT_SGBRG10_1X10, { BayerFormat::GBRG, 10,\n> > > > BayerFormat::None } },\n> > > > -       { MEDIA_BUS_FMT_SGRBG10_1X10, { BayerFormat::GRBG, 10,\n> > > > BayerFormat::None } },\n> > > > -       { MEDIA_BUS_FMT_SRGGB10_1X10, { BayerFormat::RGGB, 10,\n> > > > BayerFormat::None } },\n> > > > -       { MEDIA_BUS_FMT_SBGGR12_1X12, { BayerFormat::BGGR, 12,\n> > > > BayerFormat::None } },\n> > > > -       { MEDIA_BUS_FMT_SGBRG12_1X12, { BayerFormat::GBRG, 12,\n> > > > BayerFormat::None } },\n> > > > -       { MEDIA_BUS_FMT_SGRBG12_1X12, { BayerFormat::GRBG, 12,\n> > > > BayerFormat::None } },\n> > > > -       { MEDIA_BUS_FMT_SRGGB12_1X12, { BayerFormat::RGGB, 12,\n> > > > BayerFormat::None } },\n> > > > -       { MEDIA_BUS_FMT_SBGGR14_1X14, { BayerFormat::BGGR, 14,\n> > > > BayerFormat::None } },\n> > > > -       { MEDIA_BUS_FMT_SGBRG14_1X14, { BayerFormat::GBRG, 14,\n> > > > BayerFormat::None } },\n> > > > -       { MEDIA_BUS_FMT_SGRBG14_1X14, { BayerFormat::GRBG, 14,\n> > > > BayerFormat::None } },\n> > > > -       { MEDIA_BUS_FMT_SRGGB14_1X14, { BayerFormat::RGGB, 14,\n> > > > BayerFormat::None } },\n> > > > -       { MEDIA_BUS_FMT_SBGGR16_1X16, { BayerFormat::BGGR, 16,\n> > > > BayerFormat::None } },\n> > > > -       { MEDIA_BUS_FMT_SGBRG16_1X16, { BayerFormat::GBRG, 16,\n> > > > BayerFormat::None } },\n> > > > -       { MEDIA_BUS_FMT_SGRBG16_1X16, { BayerFormat::GRBG, 16,\n> > > > BayerFormat::None } },\n> > > > -       { MEDIA_BUS_FMT_SRGGB16_1X16, { BayerFormat::RGGB, 16,\n> > > > BayerFormat::None } },\n> > > > -       { MEDIA_BUS_FMT_Y8_1X8, { BayerFormat::MONO, 8,\n> > BayerFormat::None\n> > > > } },\n> > > > -       { MEDIA_BUS_FMT_Y10_1X10, { BayerFormat::MONO, 10,\n> > > > BayerFormat::None } },\n> > > > +       { MEDIA_BUS_FMT_SBGGR8_1X8, { BayerFormat::BGGR, 8,\n> > > > BayerFormat::Packing::None } },\n> > > > +       { MEDIA_BUS_FMT_SGBRG8_1X8, { BayerFormat::GBRG, 8,\n> > > > BayerFormat::Packing::None } },\n> > > > +       { MEDIA_BUS_FMT_SGRBG8_1X8, { BayerFormat::GRBG, 8,\n> > > > BayerFormat::Packing::None } },\n> > > > +       { MEDIA_BUS_FMT_SRGGB8_1X8, { BayerFormat::RGGB, 8,\n> > > > BayerFormat::Packing::None } },\n> > > > +       { MEDIA_BUS_FMT_SBGGR10_ALAW8_1X8, { BayerFormat::BGGR, 8,\n> > > > BayerFormat::Packing::None } },\n> > > > +       { MEDIA_BUS_FMT_SGBRG10_ALAW8_1X8, { BayerFormat::GBRG, 8,\n> > > > BayerFormat::Packing::None } },\n> > > > +       { MEDIA_BUS_FMT_SGRBG10_ALAW8_1X8, { BayerFormat::GRBG, 8,\n> > > > BayerFormat::Packing::None } },\n> > > > +       { MEDIA_BUS_FMT_SRGGB10_ALAW8_1X8, { BayerFormat::RGGB, 8,\n> > > > BayerFormat::Packing::None } },\n> > > > +       { MEDIA_BUS_FMT_SBGGR10_DPCM8_1X8, { BayerFormat::BGGR, 8,\n> > > > BayerFormat::Packing::None } },\n> > > > +       { MEDIA_BUS_FMT_SGBRG10_DPCM8_1X8, { BayerFormat::GBRG, 8,\n> > > > BayerFormat::Packing::None } },\n> > > > +       { MEDIA_BUS_FMT_SGRBG10_DPCM8_1X8, { BayerFormat::GRBG, 8,\n> > > > BayerFormat::Packing::None } },\n> > > > +       { MEDIA_BUS_FMT_SRGGB10_DPCM8_1X8, { BayerFormat::RGGB, 8,\n> > > > BayerFormat::Packing::None } },\n> > > > +       { MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_BE, { BayerFormat::BGGR, 10,\n> > > > BayerFormat::Packing::None } },\n> > > > +       { MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_LE, { BayerFormat::BGGR, 10,\n> > > > BayerFormat::Packing::None } },\n> > > > +       { MEDIA_BUS_FMT_SBGGR10_2X8_PADLO_BE, { BayerFormat::BGGR, 10,\n> > > > BayerFormat::Packing::None } },\n> > > > +       { MEDIA_BUS_FMT_SBGGR10_2X8_PADLO_LE, { BayerFormat::BGGR, 10,\n> > > > BayerFormat::Packing::None } },\n> > > > +       { MEDIA_BUS_FMT_SBGGR10_1X10, { BayerFormat::BGGR, 10,\n> > > > BayerFormat::Packing::None } },\n> > > > +       { MEDIA_BUS_FMT_SGBRG10_1X10, { BayerFormat::GBRG, 10,\n> > > > BayerFormat::Packing::None } },\n> > > > +       { MEDIA_BUS_FMT_SGRBG10_1X10, { BayerFormat::GRBG, 10,\n> > > > BayerFormat::Packing::None } },\n> > > > +       { MEDIA_BUS_FMT_SRGGB10_1X10, { BayerFormat::RGGB, 10,\n> > > > BayerFormat::Packing::None } },\n> > > > +       { MEDIA_BUS_FMT_SBGGR12_1X12, { BayerFormat::BGGR, 12,\n> > > > BayerFormat::Packing::None } },\n> > > > +       { MEDIA_BUS_FMT_SGBRG12_1X12, { BayerFormat::GBRG, 12,\n> > > > BayerFormat::Packing::None } },\n> > > > +       { MEDIA_BUS_FMT_SGRBG12_1X12, { BayerFormat::GRBG, 12,\n> > > > BayerFormat::Packing::None } },\n> > > > +       { MEDIA_BUS_FMT_SRGGB12_1X12, { BayerFormat::RGGB, 12,\n> > > > BayerFormat::Packing::None } },\n> > > > +       { MEDIA_BUS_FMT_SBGGR14_1X14, { BayerFormat::BGGR, 14,\n> > > > BayerFormat::Packing::None } },\n> > > > +       { MEDIA_BUS_FMT_SGBRG14_1X14, { BayerFormat::GBRG, 14,\n> > > > BayerFormat::Packing::None } },\n> > > > +       { MEDIA_BUS_FMT_SGRBG14_1X14, { BayerFormat::GRBG, 14,\n> > > > BayerFormat::Packing::None } },\n> > > > +       { MEDIA_BUS_FMT_SRGGB14_1X14, { BayerFormat::RGGB, 14,\n> > > > BayerFormat::Packing::None } },\n> > > > +       { MEDIA_BUS_FMT_SBGGR16_1X16, { BayerFormat::BGGR, 16,\n> > > > BayerFormat::Packing::None } },\n> > > > +       { MEDIA_BUS_FMT_SGBRG16_1X16, { BayerFormat::GBRG, 16,\n> > > > BayerFormat::Packing::None } },\n> > > > +       { MEDIA_BUS_FMT_SGRBG16_1X16, { BayerFormat::GRBG, 16,\n> > > > BayerFormat::Packing::None } },\n> > > > +       { MEDIA_BUS_FMT_SRGGB16_1X16, { BayerFormat::RGGB, 16,\n> > > > BayerFormat::Packing::None } },\n> > > > +       { MEDIA_BUS_FMT_Y8_1X8, { BayerFormat::MONO, 8,\n> > > > BayerFormat::Packing::None } },\n> > > > +       { MEDIA_BUS_FMT_Y10_1X10, { BayerFormat::MONO, 10,\n> > > > BayerFormat::Packing::None } },\n> > > >  };\n> > > >\n> > > >  } /* namespace */\n> > > > @@ -214,9 +214,9 @@ std::string BayerFormat::toString() const\n> > > >\n> > > >         result += \"-\" + std::to_string(bitDepth);\n> > > >\n> > > > -       if (packing == CSI2Packed)\n> > > > +       if (packing == Packing::CSI2)\n> > > >                 result += \"-CSI2P\";\n> > > > -       else if (packing == IPU3Packed)\n> > > > +       else if (packing == Packing::IPU3)\n> > > >                 result += \"-IPU3P\";\n> > > >\n> > > >         return result;\n> > > > diff --git a/test/bayer-format.cpp b/test/bayer-format.cpp\n> > > > index e396ee83ca91..135bcb5214c8 100644\n> > > > --- a/test/bayer-format.cpp\n> > > > +++ b/test/bayer-format.cpp\n> > > > @@ -30,7 +30,7 @@ protected:\n> > > >                 }\n> > > >\n> > > >                 /* A correct Bayer format has to be valid. */\n> > > > -               bayerFmt = BayerFormat(BayerFormat::BGGR, 8,\n> > > > BayerFormat::None);\n> > > > +               bayerFmt = BayerFormat(BayerFormat::BGGR, 8,\n> > > > BayerFormat::Packing::None);\n> > > >                 if (!bayerFmt.isValid()) {\n> > > >                         cerr << \"A correct BayerFormat has to be\n> > valid.\"\n> > > >                              << endl;\n> > > > @@ -41,9 +41,9 @@ protected:\n> > > >                  * Two bayer formats created with the same order and\n> > bit\n> > > > depth\n> > > >                  * have to be equal.\n> > > >                  */\n> > > > -               bayerFmt = BayerFormat(BayerFormat::BGGR, 8,\n> > > > BayerFormat::None);\n> > > > +               bayerFmt = BayerFormat(BayerFormat::BGGR, 8,\n> > > > BayerFormat::Packing::None);\n> > > >                 BayerFormat bayerFmtExpect =\n> > > > BayerFormat(BayerFormat::BGGR, 8,\n> > > > -\n> > > > BayerFormat::None);\n> > > > +\n> > > > BayerFormat::Packing::None);\n> > > >                 if (bayerFmt != bayerFmtExpect) {\n> > > >                         cerr << \"Comparison of identical formats\n> > failed.\"\n> > > >                              << endl;\n> > > > @@ -54,9 +54,9 @@ protected:\n> > > >                  * Two Bayer formats created with the same order but\n> > with a\n> > > >                  * different bitDepth are not equal.\n> > > >                  */\n> > > > -               bayerFmt = BayerFormat(BayerFormat::BGGR, 8,\n> > > > BayerFormat::None);\n> > > > +               bayerFmt = BayerFormat(BayerFormat::BGGR, 8,\n> > > > BayerFormat::Packing::None);\n> > > >                 bayerFmtExpect = BayerFormat(BayerFormat::BGGR, 12,\n> > > > -                                            BayerFormat::None);\n> > > > +\n> > BayerFormat::Packing::None);\n> > > >                 if (bayerFmt == bayerFmtExpect) {\n> > > >                         cerr << \"Comparison of different formats\n> > failed.\"\n> > > >                              << endl;\n> > > > @@ -96,7 +96,7 @@ protected:\n> > > >                  * to a Bayer format.\n> > > >                  */\n> > > >                 bayerFmtExpect = BayerFormat(BayerFormat::BGGR, 8,\n> > > > -                                            BayerFormat::None);\n> > > > +\n> > BayerFormat::Packing::None);\n> > > >                 v4l2Fmt = V4L2PixelFormat(V4L2_PIX_FMT_SBGGR8);\n> > > >                 bayerFmt = BayerFormat::fromV4L2PixelFormat(v4l2Fmt);\n> > > >                 if (bayerFmt != bayerFmtExpect) {\n> > > > @@ -123,7 +123,7 @@ protected:\n> > > >                  * Test if a valid Bayer format can be converted to a\n> > > >                  * string representation.\n> > > >                  */\n> > > > -               bayerFmt = BayerFormat(BayerFormat::BGGR, 8,\n> > > > BayerFormat::None);\n> > > > +               bayerFmt = BayerFormat(BayerFormat::BGGR, 8,\n> > > > BayerFormat::Packing::None);\n> > > >                 if (bayerFmt.toString() != \"BGGR-8\") {\n> > > >                         cerr << \"String representation != 'BGGR-8'\n> > (got: '\"\n> > > >                              << bayerFmt.toString() << \"' ) \" << endl;\n> > > > @@ -145,9 +145,9 @@ protected:\n> > > >                  * Perform a horizontal Flip and make sure that the\n> > > >                  * order is adjusted accordingly.\n> > > >                  */\n> > > > -               bayerFmt = BayerFormat(BayerFormat::BGGR, 8,\n> > > > BayerFormat::None);\n> > > > +               bayerFmt = BayerFormat(BayerFormat::BGGR, 8,\n> > > > BayerFormat::Packing::None);\n> > > >                 bayerFmtExpect = BayerFormat(BayerFormat::GBRG, 8,\n> > > > -                                            BayerFormat::None);\n> > > > +\n> > BayerFormat::Packing::None);\n> > > >                 BayerFormat hFlipFmt =\n> > > > bayerFmt.transform(Transform::HFlip);\n> > > >                 if (hFlipFmt != bayerFmtExpect) {\n> > > >                         cerr << \"Horizontal flip of 'BGGR-8' should\n> > result\n> > > > in '\"\n> > > > @@ -160,9 +160,9 @@ protected:\n> > > >                  * Perform a vertical Flip and make sure that\n> > > >                  * the order is adjusted accordingly.\n> > > >                  */\n> > > > -               bayerFmt = BayerFormat(BayerFormat::BGGR, 8,\n> > > > BayerFormat::None);\n> > > > +               bayerFmt = BayerFormat(BayerFormat::BGGR, 8,\n> > > > BayerFormat::Packing::None);\n> > > >                 bayerFmtExpect = BayerFormat(BayerFormat::GRBG, 8,\n> > > > -                                            BayerFormat::None);\n> > > > +\n> > BayerFormat::Packing::None);\n> > > >                 BayerFormat vFlipFmt =\n> > > > bayerFmt.transform(Transform::VFlip);\n> > > >                 if (vFlipFmt != bayerFmtExpect) {\n> > > >                         cerr << \"Vertical flip of 'BGGR-8' should\n> > result\n> > > > in '\"\n> > > > @@ -176,7 +176,7 @@ protected:\n> > > >                  * pixels on the bottom left to top right diagonal and\n> > make\n> > > >                  * sure, that it doesn't change.\n> > > >                  */\n> > > > -               bayerFmt = BayerFormat(BayerFormat::BGGR, 8,\n> > > > BayerFormat::None);\n> > > > +               bayerFmt = BayerFormat(BayerFormat::BGGR, 8,\n> > > > BayerFormat::Packing::None);\n> > > >                 BayerFormat transposeFmt = bayerFmt.transform(\n> > > >                         Transform::Transpose);\n> > > >                 if (transposeFmt != bayerFmt) {\n> > > > @@ -192,9 +192,9 @@ protected:\n> > > >                  * on the bottom left to top right diagonal and make\n> > sure\n> > > >                  * that their positions are switched.\n> > > >                  */\n> > > > -               bayerFmt = BayerFormat(BayerFormat::GBRG, 8,\n> > > > BayerFormat::None);\n> > > > +               bayerFmt = BayerFormat(BayerFormat::GBRG, 8,\n> > > > BayerFormat::Packing::None);\n> > > >                 bayerFmtExpect = BayerFormat(BayerFormat::GRBG, 8,\n> > > > -                                            BayerFormat::None);\n> > > > +\n> > BayerFormat::Packing::None);\n> > > >                 transposeFmt =\n> > bayerFmt.transform(Transform::Transpose);\n> > > >                 if (transposeFmt != bayerFmtExpect) {\n> > > >                         cerr << \"Transpose with the red & blue pixels\n> > on\n> > > > the \"\n> > > >\n> > > > base-commit: 4d4694cd9f4ea73586dcb75d19905a1860356d9f\n> >\n> > --\n> > Regards,\n> >\n> > Laurent Pinchart\n> >","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 19F2FBF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 27 Oct 2021 13:23:56 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id CB2F260123;\n\tWed, 27 Oct 2021 15:23:55 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C086B60123\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 27 Oct 2021 15:23:53 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 72987596;\n\tWed, 27 Oct 2021 15:23:53 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"Twa4mwtV\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1635341033;\n\tbh=113CjSbUGFA2mQMG/CL5XLJQjuXlzFBUaG7WG/40pUU=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=Twa4mwtVzqtNdBNvBIvkFZDy4bhs4oME/P9G/wogNfWqwparGEQbnkf1GNxH/CLay\n\tZ/KDKNsBylyS3EHKXQQkOCz1K9uFpbe8W7K8VjXGllUAEv9zSDSFmVtx+FQ480Q10x\n\tQjVAzIRfPVSaCIrhfBlx1iAM3eZvP258/otBJMQ4=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<CAEmqJPraUjCfmYqicsG8ig+wZ8WzAJi+dMeamKihGNUOYFoxNw@mail.gmail.com>","References":"<20211027123619.16640-1-laurent.pinchart@ideasonboard.com>\n\t<CAEmqJPoyc9UdUJPLYZx1m+P_1EOxyjyxihuF8K=XnjA2-N0Sqw@mail.gmail.com>\n\t<YXlPqTiQsBRdIyy4@pendragon.ideasonboard.com>\n\t<CAEmqJPraUjCfmYqicsG8ig+wZ8WzAJi+dMeamKihGNUOYFoxNw@mail.gmail.com>","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tNaushir Patuck <naush@raspberrypi.com>","Date":"Wed, 27 Oct 2021 14:23:51 +0100","Message-ID":"<163534103100.1184428.6691336555178865021@Monstersaurus>","User-Agent":"alot/0.9.1","Subject":"Re: [libcamera-devel] [PATCH] libcamera: bayer_format: Turn\n\tBayerFormat::Packing into scoped enum","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 <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]