6161// some stuff for HDR tone mapping
6262#define LUT_FILE_SIZE 50331648
6363
64+ namespace
65+ {
66+ #ifdef V4L2_PIX_FMT_P010
67+ #pragma message "P010 is supported on the build machine"
68+ bool supportedP010 = true ;
69+ #else
70+ #pragma message "P010 is NOT supported on the build machine"
71+ bool supportedP010 = false ;
72+ #endif
73+ };
74+
75+ #ifndef V4L2_PIX_FMT_P010
76+ #define V4L2_PIX_FMT_P010 v4l2_fourcc (' P' , ' 0' , ' 1' , ' 0' )
77+ #endif
78+
6479static const V4L2Grabber::HyperHdrFormat supportedFormats[] =
6580{
6681 { V4L2_PIX_FMT_YUYV, PixelFormat::YUYV },
6782 { V4L2_PIX_FMT_XRGB32, PixelFormat::XRGB },
6883 { V4L2_PIX_FMT_RGB24, PixelFormat::RGB24 },
6984 { V4L2_PIX_FMT_YUV420, PixelFormat::I420 },
7085 { V4L2_PIX_FMT_NV12, PixelFormat::NV12 },
71- { V4L2_PIX_FMT_MJPEG, PixelFormat::MJPEG }
72- #ifdef V4L2_PIX_FMT_P010
73- ,{ V4L2_PIX_FMT_P010, PixelFormat::P010 }
74- #endif
86+ { V4L2_PIX_FMT_MJPEG, PixelFormat::MJPEG },
87+ { V4L2_PIX_FMT_P010, PixelFormat::P010 }
7588};
7689
7790
@@ -84,6 +97,8 @@ V4L2Grabber::V4L2Grabber(const QString& device, const QString& configurationPath
8497{
8598 // Refresh devices
8699 getV4L2devices ();
100+
101+ Debug (_log, " P010 was %s on the build machine" , (supportedP010) ? " supported" : " unsupported" );
87102}
88103
89104QString V4L2Grabber::GetSharedLut ()
@@ -132,7 +147,8 @@ void V4L2Grabber::setHdrToneMappingEnabled(int mode)
132147 {
133148 Debug (_log, " setHdrToneMappingMode replacing LUT and restarting" );
134149 _V4L2WorkerManager.Stop ();
135- if ((_actualVideoFormat == PixelFormat::YUYV) || (_actualVideoFormat == PixelFormat::I420) || (_actualVideoFormat == PixelFormat::NV12) || (_actualVideoFormat == PixelFormat::MJPEG))
150+ if ((_actualVideoFormat == PixelFormat::YUYV) || (_actualVideoFormat == PixelFormat::I420) || (_actualVideoFormat == PixelFormat::NV12)
151+ || (_actualVideoFormat == PixelFormat::P010) || (_actualVideoFormat == PixelFormat::MJPEG))
136152 loadLutFile (PixelFormat::YUYV);
137153 else
138154 loadLutFile (PixelFormat::RGB24);
@@ -985,6 +1001,16 @@ bool V4L2Grabber::init_device(QString selectedDeviceName, DevicePropertiesItem p
9851001 }
9861002 break ;
9871003
1004+ case V4L2_PIX_FMT_P010:
1005+ {
1006+ loadLutFile (PixelFormat::YUYV);
1007+ _actualVideoFormat = PixelFormat::P010;
1008+ _frameByteSize = (props.x * props.y * 6 ) / 2 ;
1009+ _lineLength = props.x * 2 ;
1010+ Info (_log, " Video pixel format is set to: P010" );
1011+ }
1012+ break ;
1013+
9881014 case V4L2_PIX_FMT_NV12:
9891015 {
9901016 loadLutFile (PixelFormat::YUYV);
0 commit comments