libcamera: bayer_format: Turn BayerFormat::Packing into scoped enum

The unscoped enum BayerFormat::Packing leads to usage of the ambiguous
BayerFormat::None enumerator. Turn the enumeration into a scoped enum to
force usage of BayerFormat::Packing::None, and drop the now redundant
"Packed" suffix for the CSI2 and IPU3 packing.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
Laurent Pinchart 2021-11-01 09:15:03 +00:00 committed by Kieran Bingham
parent 9e3470ad3e
commit 364ae3b78d
3 changed files with 86 additions and 86 deletions

View file

@ -27,10 +27,10 @@ public:
MONO = 4 MONO = 4
}; };
enum Packing : uint16_t { enum class Packing : uint16_t {
None = 0, None = 0,
CSI2Packed = 1, CSI2 = 1,
IPU3Packed = 2, IPU3 = 2,
}; };
constexpr BayerFormat() constexpr BayerFormat()

View file

@ -53,11 +53,11 @@ namespace libcamera {
* \enum BayerFormat::Packing * \enum BayerFormat::Packing
* \brief Different types of packing that can be applied to a BayerFormat * \brief Different types of packing that can be applied to a BayerFormat
* *
* \var BayerFormat::None * \var BayerFormat::Packing::None
* \brief No packing * \brief No packing
* \var BayerFormat::CSI2Packed * \var BayerFormat::Packing::CSI2
* \brief Format uses MIPI CSI-2 style packing * \brief Format uses MIPI CSI-2 style packing
* \var BayerFormat::IPU3Packed * \var BayerFormat::Packing::IPU3
* \brief Format uses IPU3 style packing * \brief Format uses IPU3 style packing
*/ */
@ -85,73 +85,73 @@ struct BayerFormatComparator {
}; };
const std::map<BayerFormat, V4L2PixelFormat, BayerFormatComparator> bayerToV4l2{ const std::map<BayerFormat, V4L2PixelFormat, BayerFormatComparator> bayerToV4l2{
{ { BayerFormat::BGGR, 8, BayerFormat::None }, V4L2PixelFormat(V4L2_PIX_FMT_SBGGR8) }, { { BayerFormat::BGGR, 8, BayerFormat::Packing::None }, V4L2PixelFormat(V4L2_PIX_FMT_SBGGR8) },
{ { BayerFormat::GBRG, 8, BayerFormat::None }, V4L2PixelFormat(V4L2_PIX_FMT_SGBRG8) }, { { BayerFormat::GBRG, 8, BayerFormat::Packing::None }, V4L2PixelFormat(V4L2_PIX_FMT_SGBRG8) },
{ { BayerFormat::GRBG, 8, BayerFormat::None }, V4L2PixelFormat(V4L2_PIX_FMT_SGRBG8) }, { { BayerFormat::GRBG, 8, BayerFormat::Packing::None }, V4L2PixelFormat(V4L2_PIX_FMT_SGRBG8) },
{ { BayerFormat::RGGB, 8, BayerFormat::None }, V4L2PixelFormat(V4L2_PIX_FMT_SRGGB8) }, { { BayerFormat::RGGB, 8, BayerFormat::Packing::None }, V4L2PixelFormat(V4L2_PIX_FMT_SRGGB8) },
{ { BayerFormat::BGGR, 10, BayerFormat::None }, V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10) }, { { BayerFormat::BGGR, 10, BayerFormat::Packing::None }, V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10) },
{ { BayerFormat::GBRG, 10, BayerFormat::None }, V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10) }, { { BayerFormat::GBRG, 10, BayerFormat::Packing::None }, V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10) },
{ { BayerFormat::GRBG, 10, BayerFormat::None }, V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10) }, { { BayerFormat::GRBG, 10, BayerFormat::Packing::None }, V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10) },
{ { BayerFormat::RGGB, 10, BayerFormat::None }, V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10) }, { { BayerFormat::RGGB, 10, BayerFormat::Packing::None }, V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10) },
{ { BayerFormat::BGGR, 10, BayerFormat::CSI2Packed }, V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10P) }, { { BayerFormat::BGGR, 10, BayerFormat::Packing::CSI2 }, V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10P) },
{ { BayerFormat::GBRG, 10, BayerFormat::CSI2Packed }, V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10P) }, { { BayerFormat::GBRG, 10, BayerFormat::Packing::CSI2 }, V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10P) },
{ { BayerFormat::GRBG, 10, BayerFormat::CSI2Packed }, V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10P) }, { { BayerFormat::GRBG, 10, BayerFormat::Packing::CSI2 }, V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10P) },
{ { BayerFormat::RGGB, 10, BayerFormat::CSI2Packed }, V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10P) }, { { BayerFormat::RGGB, 10, BayerFormat::Packing::CSI2 }, V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10P) },
{ { BayerFormat::BGGR, 10, BayerFormat::IPU3Packed }, V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SBGGR10) }, { { BayerFormat::BGGR, 10, BayerFormat::Packing::IPU3 }, V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SBGGR10) },
{ { BayerFormat::GBRG, 10, BayerFormat::IPU3Packed }, V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SGBRG10) }, { { BayerFormat::GBRG, 10, BayerFormat::Packing::IPU3 }, V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SGBRG10) },
{ { BayerFormat::GRBG, 10, BayerFormat::IPU3Packed }, V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SGRBG10) }, { { BayerFormat::GRBG, 10, BayerFormat::Packing::IPU3 }, V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SGRBG10) },
{ { BayerFormat::RGGB, 10, BayerFormat::IPU3Packed }, V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SRGGB10) }, { { BayerFormat::RGGB, 10, BayerFormat::Packing::IPU3 }, V4L2PixelFormat(V4L2_PIX_FMT_IPU3_SRGGB10) },
{ { BayerFormat::BGGR, 12, BayerFormat::None }, V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12) }, { { BayerFormat::BGGR, 12, BayerFormat::Packing::None }, V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12) },
{ { BayerFormat::GBRG, 12, BayerFormat::None }, V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12) }, { { BayerFormat::GBRG, 12, BayerFormat::Packing::None }, V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12) },
{ { BayerFormat::GRBG, 12, BayerFormat::None }, V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12) }, { { BayerFormat::GRBG, 12, BayerFormat::Packing::None }, V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12) },
{ { BayerFormat::RGGB, 12, BayerFormat::None }, V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12) }, { { BayerFormat::RGGB, 12, BayerFormat::Packing::None }, V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12) },
{ { BayerFormat::BGGR, 12, BayerFormat::CSI2Packed }, V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12P) }, { { BayerFormat::BGGR, 12, BayerFormat::Packing::CSI2 }, V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12P) },
{ { BayerFormat::GBRG, 12, BayerFormat::CSI2Packed }, V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12P) }, { { BayerFormat::GBRG, 12, BayerFormat::Packing::CSI2 }, V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12P) },
{ { BayerFormat::GRBG, 12, BayerFormat::CSI2Packed }, V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12P) }, { { BayerFormat::GRBG, 12, BayerFormat::Packing::CSI2 }, V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12P) },
{ { BayerFormat::RGGB, 12, BayerFormat::CSI2Packed }, V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12P) }, { { BayerFormat::RGGB, 12, BayerFormat::Packing::CSI2 }, V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12P) },
{ { BayerFormat::BGGR, 16, BayerFormat::None }, V4L2PixelFormat(V4L2_PIX_FMT_SBGGR16) }, { { BayerFormat::BGGR, 16, BayerFormat::Packing::None }, V4L2PixelFormat(V4L2_PIX_FMT_SBGGR16) },
{ { BayerFormat::GBRG, 16, BayerFormat::None }, V4L2PixelFormat(V4L2_PIX_FMT_SGBRG16) }, { { BayerFormat::GBRG, 16, BayerFormat::Packing::None }, V4L2PixelFormat(V4L2_PIX_FMT_SGBRG16) },
{ { BayerFormat::GRBG, 16, BayerFormat::None }, V4L2PixelFormat(V4L2_PIX_FMT_SGRBG16) }, { { BayerFormat::GRBG, 16, BayerFormat::Packing::None }, V4L2PixelFormat(V4L2_PIX_FMT_SGRBG16) },
{ { BayerFormat::RGGB, 16, BayerFormat::None }, V4L2PixelFormat(V4L2_PIX_FMT_SRGGB16) }, { { BayerFormat::RGGB, 16, BayerFormat::Packing::None }, V4L2PixelFormat(V4L2_PIX_FMT_SRGGB16) },
{ { BayerFormat::MONO, 8, BayerFormat::None }, V4L2PixelFormat(V4L2_PIX_FMT_GREY) }, { { BayerFormat::MONO, 8, BayerFormat::Packing::None }, V4L2PixelFormat(V4L2_PIX_FMT_GREY) },
{ { BayerFormat::MONO, 10, BayerFormat::CSI2Packed }, V4L2PixelFormat(V4L2_PIX_FMT_Y10P) }, { { BayerFormat::MONO, 10, BayerFormat::Packing::CSI2 }, V4L2PixelFormat(V4L2_PIX_FMT_Y10P) },
}; };
const std::unordered_map<unsigned int, BayerFormat> mbusCodeToBayer{ const std::unordered_map<unsigned int, BayerFormat> mbusCodeToBayer{
{ MEDIA_BUS_FMT_SBGGR8_1X8, { BayerFormat::BGGR, 8, BayerFormat::None } }, { MEDIA_BUS_FMT_SBGGR8_1X8, { BayerFormat::BGGR, 8, BayerFormat::Packing::None } },
{ MEDIA_BUS_FMT_SGBRG8_1X8, { BayerFormat::GBRG, 8, BayerFormat::None } }, { MEDIA_BUS_FMT_SGBRG8_1X8, { BayerFormat::GBRG, 8, BayerFormat::Packing::None } },
{ MEDIA_BUS_FMT_SGRBG8_1X8, { BayerFormat::GRBG, 8, BayerFormat::None } }, { MEDIA_BUS_FMT_SGRBG8_1X8, { BayerFormat::GRBG, 8, BayerFormat::Packing::None } },
{ MEDIA_BUS_FMT_SRGGB8_1X8, { BayerFormat::RGGB, 8, BayerFormat::None } }, { MEDIA_BUS_FMT_SRGGB8_1X8, { BayerFormat::RGGB, 8, BayerFormat::Packing::None } },
{ MEDIA_BUS_FMT_SBGGR10_ALAW8_1X8, { BayerFormat::BGGR, 8, BayerFormat::None } }, { MEDIA_BUS_FMT_SBGGR10_ALAW8_1X8, { BayerFormat::BGGR, 8, BayerFormat::Packing::None } },
{ MEDIA_BUS_FMT_SGBRG10_ALAW8_1X8, { BayerFormat::GBRG, 8, BayerFormat::None } }, { MEDIA_BUS_FMT_SGBRG10_ALAW8_1X8, { BayerFormat::GBRG, 8, BayerFormat::Packing::None } },
{ MEDIA_BUS_FMT_SGRBG10_ALAW8_1X8, { BayerFormat::GRBG, 8, BayerFormat::None } }, { MEDIA_BUS_FMT_SGRBG10_ALAW8_1X8, { BayerFormat::GRBG, 8, BayerFormat::Packing::None } },
{ MEDIA_BUS_FMT_SRGGB10_ALAW8_1X8, { BayerFormat::RGGB, 8, BayerFormat::None } }, { MEDIA_BUS_FMT_SRGGB10_ALAW8_1X8, { BayerFormat::RGGB, 8, BayerFormat::Packing::None } },
{ MEDIA_BUS_FMT_SBGGR10_DPCM8_1X8, { BayerFormat::BGGR, 8, BayerFormat::None } }, { MEDIA_BUS_FMT_SBGGR10_DPCM8_1X8, { BayerFormat::BGGR, 8, BayerFormat::Packing::None } },
{ MEDIA_BUS_FMT_SGBRG10_DPCM8_1X8, { BayerFormat::GBRG, 8, BayerFormat::None } }, { MEDIA_BUS_FMT_SGBRG10_DPCM8_1X8, { BayerFormat::GBRG, 8, BayerFormat::Packing::None } },
{ MEDIA_BUS_FMT_SGRBG10_DPCM8_1X8, { BayerFormat::GRBG, 8, BayerFormat::None } }, { MEDIA_BUS_FMT_SGRBG10_DPCM8_1X8, { BayerFormat::GRBG, 8, BayerFormat::Packing::None } },
{ MEDIA_BUS_FMT_SRGGB10_DPCM8_1X8, { BayerFormat::RGGB, 8, BayerFormat::None } }, { MEDIA_BUS_FMT_SRGGB10_DPCM8_1X8, { BayerFormat::RGGB, 8, BayerFormat::Packing::None } },
{ MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_BE, { BayerFormat::BGGR, 10, BayerFormat::None } }, { MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_BE, { BayerFormat::BGGR, 10, BayerFormat::Packing::None } },
{ MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_LE, { BayerFormat::BGGR, 10, BayerFormat::None } }, { MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_LE, { BayerFormat::BGGR, 10, BayerFormat::Packing::None } },
{ MEDIA_BUS_FMT_SBGGR10_2X8_PADLO_BE, { BayerFormat::BGGR, 10, BayerFormat::None } }, { MEDIA_BUS_FMT_SBGGR10_2X8_PADLO_BE, { BayerFormat::BGGR, 10, BayerFormat::Packing::None } },
{ MEDIA_BUS_FMT_SBGGR10_2X8_PADLO_LE, { BayerFormat::BGGR, 10, BayerFormat::None } }, { MEDIA_BUS_FMT_SBGGR10_2X8_PADLO_LE, { BayerFormat::BGGR, 10, BayerFormat::Packing::None } },
{ MEDIA_BUS_FMT_SBGGR10_1X10, { BayerFormat::BGGR, 10, BayerFormat::None } }, { MEDIA_BUS_FMT_SBGGR10_1X10, { BayerFormat::BGGR, 10, BayerFormat::Packing::None } },
{ MEDIA_BUS_FMT_SGBRG10_1X10, { BayerFormat::GBRG, 10, BayerFormat::None } }, { MEDIA_BUS_FMT_SGBRG10_1X10, { BayerFormat::GBRG, 10, BayerFormat::Packing::None } },
{ MEDIA_BUS_FMT_SGRBG10_1X10, { BayerFormat::GRBG, 10, BayerFormat::None } }, { MEDIA_BUS_FMT_SGRBG10_1X10, { BayerFormat::GRBG, 10, BayerFormat::Packing::None } },
{ MEDIA_BUS_FMT_SRGGB10_1X10, { BayerFormat::RGGB, 10, BayerFormat::None } }, { MEDIA_BUS_FMT_SRGGB10_1X10, { BayerFormat::RGGB, 10, BayerFormat::Packing::None } },
{ MEDIA_BUS_FMT_SBGGR12_1X12, { BayerFormat::BGGR, 12, BayerFormat::None } }, { MEDIA_BUS_FMT_SBGGR12_1X12, { BayerFormat::BGGR, 12, BayerFormat::Packing::None } },
{ MEDIA_BUS_FMT_SGBRG12_1X12, { BayerFormat::GBRG, 12, BayerFormat::None } }, { MEDIA_BUS_FMT_SGBRG12_1X12, { BayerFormat::GBRG, 12, BayerFormat::Packing::None } },
{ MEDIA_BUS_FMT_SGRBG12_1X12, { BayerFormat::GRBG, 12, BayerFormat::None } }, { MEDIA_BUS_FMT_SGRBG12_1X12, { BayerFormat::GRBG, 12, BayerFormat::Packing::None } },
{ MEDIA_BUS_FMT_SRGGB12_1X12, { BayerFormat::RGGB, 12, BayerFormat::None } }, { MEDIA_BUS_FMT_SRGGB12_1X12, { BayerFormat::RGGB, 12, BayerFormat::Packing::None } },
{ MEDIA_BUS_FMT_SBGGR14_1X14, { BayerFormat::BGGR, 14, BayerFormat::None } }, { MEDIA_BUS_FMT_SBGGR14_1X14, { BayerFormat::BGGR, 14, BayerFormat::Packing::None } },
{ MEDIA_BUS_FMT_SGBRG14_1X14, { BayerFormat::GBRG, 14, BayerFormat::None } }, { MEDIA_BUS_FMT_SGBRG14_1X14, { BayerFormat::GBRG, 14, BayerFormat::Packing::None } },
{ MEDIA_BUS_FMT_SGRBG14_1X14, { BayerFormat::GRBG, 14, BayerFormat::None } }, { MEDIA_BUS_FMT_SGRBG14_1X14, { BayerFormat::GRBG, 14, BayerFormat::Packing::None } },
{ MEDIA_BUS_FMT_SRGGB14_1X14, { BayerFormat::RGGB, 14, BayerFormat::None } }, { MEDIA_BUS_FMT_SRGGB14_1X14, { BayerFormat::RGGB, 14, BayerFormat::Packing::None } },
{ MEDIA_BUS_FMT_SBGGR16_1X16, { BayerFormat::BGGR, 16, BayerFormat::None } }, { MEDIA_BUS_FMT_SBGGR16_1X16, { BayerFormat::BGGR, 16, BayerFormat::Packing::None } },
{ MEDIA_BUS_FMT_SGBRG16_1X16, { BayerFormat::GBRG, 16, BayerFormat::None } }, { MEDIA_BUS_FMT_SGBRG16_1X16, { BayerFormat::GBRG, 16, BayerFormat::Packing::None } },
{ MEDIA_BUS_FMT_SGRBG16_1X16, { BayerFormat::GRBG, 16, BayerFormat::None } }, { MEDIA_BUS_FMT_SGRBG16_1X16, { BayerFormat::GRBG, 16, BayerFormat::Packing::None } },
{ MEDIA_BUS_FMT_SRGGB16_1X16, { BayerFormat::RGGB, 16, BayerFormat::None } }, { MEDIA_BUS_FMT_SRGGB16_1X16, { BayerFormat::RGGB, 16, BayerFormat::Packing::None } },
{ MEDIA_BUS_FMT_Y8_1X8, { BayerFormat::MONO, 8, BayerFormat::None } }, { MEDIA_BUS_FMT_Y8_1X8, { BayerFormat::MONO, 8, BayerFormat::Packing::None } },
{ MEDIA_BUS_FMT_Y10_1X10, { BayerFormat::MONO, 10, BayerFormat::None } }, { MEDIA_BUS_FMT_Y10_1X10, { BayerFormat::MONO, 10, BayerFormat::Packing::None } },
}; };
} /* namespace */ } /* namespace */
@ -214,9 +214,9 @@ std::string BayerFormat::toString() const
result += "-" + std::to_string(bitDepth); result += "-" + std::to_string(bitDepth);
if (packing == CSI2Packed) if (packing == Packing::CSI2)
result += "-CSI2P"; result += "-CSI2P";
else if (packing == IPU3Packed) else if (packing == Packing::IPU3)
result += "-IPU3P"; result += "-IPU3P";
return result; return result;

View file

@ -30,7 +30,7 @@ protected:
} }
/* A correct Bayer format has to be valid. */ /* A correct Bayer format has to be valid. */
bayerFmt = BayerFormat(BayerFormat::BGGR, 8, BayerFormat::None); bayerFmt = BayerFormat(BayerFormat::BGGR, 8, BayerFormat::Packing::None);
if (!bayerFmt.isValid()) { if (!bayerFmt.isValid()) {
cerr << "A correct BayerFormat has to be valid." cerr << "A correct BayerFormat has to be valid."
<< endl; << endl;
@ -41,9 +41,9 @@ protected:
* Two bayer formats created with the same order and bit depth * Two bayer formats created with the same order and bit depth
* have to be equal. * have to be equal.
*/ */
bayerFmt = BayerFormat(BayerFormat::BGGR, 8, BayerFormat::None); bayerFmt = BayerFormat(BayerFormat::BGGR, 8, BayerFormat::Packing::None);
BayerFormat bayerFmtExpect = BayerFormat(BayerFormat::BGGR, 8, BayerFormat bayerFmtExpect = BayerFormat(BayerFormat::BGGR, 8,
BayerFormat::None); BayerFormat::Packing::None);
if (bayerFmt != bayerFmtExpect) { if (bayerFmt != bayerFmtExpect) {
cerr << "Comparison of identical formats failed." cerr << "Comparison of identical formats failed."
<< endl; << endl;
@ -54,9 +54,9 @@ protected:
* Two Bayer formats created with the same order but with a * Two Bayer formats created with the same order but with a
* different bitDepth are not equal. * different bitDepth are not equal.
*/ */
bayerFmt = BayerFormat(BayerFormat::BGGR, 8, BayerFormat::None); bayerFmt = BayerFormat(BayerFormat::BGGR, 8, BayerFormat::Packing::None);
bayerFmtExpect = BayerFormat(BayerFormat::BGGR, 12, bayerFmtExpect = BayerFormat(BayerFormat::BGGR, 12,
BayerFormat::None); BayerFormat::Packing::None);
if (bayerFmt == bayerFmtExpect) { if (bayerFmt == bayerFmtExpect) {
cerr << "Comparison of different formats failed." cerr << "Comparison of different formats failed."
<< endl; << endl;
@ -96,7 +96,7 @@ protected:
* to a Bayer format. * to a Bayer format.
*/ */
bayerFmtExpect = BayerFormat(BayerFormat::BGGR, 8, bayerFmtExpect = BayerFormat(BayerFormat::BGGR, 8,
BayerFormat::None); BayerFormat::Packing::None);
v4l2Fmt = V4L2PixelFormat(V4L2_PIX_FMT_SBGGR8); v4l2Fmt = V4L2PixelFormat(V4L2_PIX_FMT_SBGGR8);
bayerFmt = BayerFormat::fromV4L2PixelFormat(v4l2Fmt); bayerFmt = BayerFormat::fromV4L2PixelFormat(v4l2Fmt);
if (bayerFmt != bayerFmtExpect) { if (bayerFmt != bayerFmtExpect) {
@ -123,7 +123,7 @@ protected:
* Test if a valid Bayer format can be converted to a * Test if a valid Bayer format can be converted to a
* string representation. * string representation.
*/ */
bayerFmt = BayerFormat(BayerFormat::BGGR, 8, BayerFormat::None); bayerFmt = BayerFormat(BayerFormat::BGGR, 8, BayerFormat::Packing::None);
if (bayerFmt.toString() != "BGGR-8") { if (bayerFmt.toString() != "BGGR-8") {
cerr << "String representation != 'BGGR-8' (got: '" cerr << "String representation != 'BGGR-8' (got: '"
<< bayerFmt.toString() << "' ) " << endl; << bayerFmt.toString() << "' ) " << endl;
@ -145,9 +145,9 @@ protected:
* Perform a horizontal Flip and make sure that the * Perform a horizontal Flip and make sure that the
* order is adjusted accordingly. * order is adjusted accordingly.
*/ */
bayerFmt = BayerFormat(BayerFormat::BGGR, 8, BayerFormat::None); bayerFmt = BayerFormat(BayerFormat::BGGR, 8, BayerFormat::Packing::None);
bayerFmtExpect = BayerFormat(BayerFormat::GBRG, 8, bayerFmtExpect = BayerFormat(BayerFormat::GBRG, 8,
BayerFormat::None); BayerFormat::Packing::None);
BayerFormat hFlipFmt = bayerFmt.transform(Transform::HFlip); BayerFormat hFlipFmt = bayerFmt.transform(Transform::HFlip);
if (hFlipFmt != bayerFmtExpect) { if (hFlipFmt != bayerFmtExpect) {
cerr << "Horizontal flip of 'BGGR-8' should result in '" cerr << "Horizontal flip of 'BGGR-8' should result in '"
@ -160,9 +160,9 @@ protected:
* Perform a vertical Flip and make sure that * Perform a vertical Flip and make sure that
* the order is adjusted accordingly. * the order is adjusted accordingly.
*/ */
bayerFmt = BayerFormat(BayerFormat::BGGR, 8, BayerFormat::None); bayerFmt = BayerFormat(BayerFormat::BGGR, 8, BayerFormat::Packing::None);
bayerFmtExpect = BayerFormat(BayerFormat::GRBG, 8, bayerFmtExpect = BayerFormat(BayerFormat::GRBG, 8,
BayerFormat::None); BayerFormat::Packing::None);
BayerFormat vFlipFmt = bayerFmt.transform(Transform::VFlip); BayerFormat vFlipFmt = bayerFmt.transform(Transform::VFlip);
if (vFlipFmt != bayerFmtExpect) { if (vFlipFmt != bayerFmtExpect) {
cerr << "Vertical flip of 'BGGR-8' should result in '" cerr << "Vertical flip of 'BGGR-8' should result in '"
@ -176,7 +176,7 @@ protected:
* pixels on the bottom left to top right diagonal and make * pixels on the bottom left to top right diagonal and make
* sure, that it doesn't change. * sure, that it doesn't change.
*/ */
bayerFmt = BayerFormat(BayerFormat::BGGR, 8, BayerFormat::None); bayerFmt = BayerFormat(BayerFormat::BGGR, 8, BayerFormat::Packing::None);
BayerFormat transposeFmt = bayerFmt.transform( BayerFormat transposeFmt = bayerFmt.transform(
Transform::Transpose); Transform::Transpose);
if (transposeFmt != bayerFmt) { if (transposeFmt != bayerFmt) {
@ -192,9 +192,9 @@ protected:
* on the bottom left to top right diagonal and make sure * on the bottom left to top right diagonal and make sure
* that their positions are switched. * that their positions are switched.
*/ */
bayerFmt = BayerFormat(BayerFormat::GBRG, 8, BayerFormat::None); bayerFmt = BayerFormat(BayerFormat::GBRG, 8, BayerFormat::Packing::None);
bayerFmtExpect = BayerFormat(BayerFormat::GRBG, 8, bayerFmtExpect = BayerFormat(BayerFormat::GRBG, 8,
BayerFormat::None); BayerFormat::Packing::None);
transposeFmt = bayerFmt.transform(Transform::Transpose); transposeFmt = bayerFmt.transform(Transform::Transpose);
if (transposeFmt != bayerFmtExpect) { if (transposeFmt != bayerFmtExpect) {
cerr << "Transpose with the red & blue pixels on the " cerr << "Transpose with the red & blue pixels on the "