summaryrefslogtreecommitdiff
path: root/utils
AgeCommit message (Expand)Author
2022-01-27utils: ipc: Add __init__.py for local module utils/ipc/generatorsHan-Lin Chen
2022-01-03utils: update-kernel-headers: Update path to intel-ipu3.hLaurent Pinchart
2021-12-14utils: tracepoints: gen-tp-header: Add execute permissionBrian Olson
2021-12-04libcamera: base: Rename FileDescriptor to SharedFDLaurent Pinchart
2021-12-04libcamera: ipc_unixsocket: Use UniqueFD for a file descriptorHirokazu Honda
2021-11-24utils: Convert to pragma onceKieran Bingham
2021-10-19build: Preserve upstream git versioning using meson distNaushir Patuck
2021-10-19utils: gen-version: Pass the meson source root to the gen-version.sh scriptNaushir Patuck
2021-10-19utils: hooks: pre-push: Check push to integration/* branchesLaurent Pinchart
2021-09-27libcamera: control_serializer: Separate the handles spaceJacopo Mondi
2021-09-27ipa: proxy_worker: Reset ControlSerializer on workerJacopo Mondi
2021-09-10utils: ipc: proxy worker: Fix indentation in call deserializationPaul Elder
2021-09-02libcamera: Drop emitter object pointer from signal argumentsLaurent Pinchart
2021-09-02libcamera: Don't use emitter object pointer argument to slotLaurent Pinchart
2021-08-27utils: checkstyle.py: Use single-quoted strings when possibleLaurent Pinchart
2021-08-19ipa: Use FileDescriptor instead of int in layers above IPC payloadPaul Elder
2021-08-18utils: ipc: ipa_proxy_worker: Log IPCUnixSocket::send() failuresLaurent Pinchart
2021-08-05utils: ipc: Initialise ThreadProxyKieran Bingham
2021-08-03utils: raspberrypi: ctt: Fix namespace for sklearn NearestCentroid functionDavid Plowman
2021-08-02utils: raspberrypi: ctt: Fix usage of findHomography functionDavid Plowman
2021-07-27utils: ipc: Assign a new gid to proxy workerUmang Jain
2021-07-09utils: ipc: proxy: Reset ControlSerializer during IPA configureUmang Jain
2021-06-25libcamera/base: Move extended base functionalityKieran Bingham
2021-06-01utils: ipc: mojo: Error if ControlInfoMap/List doesn't prefix libcameraPaul Elder
2021-05-31utils: ipc: extract-docs: Extract the SPDX headerPaul Elder
2021-05-27utils: ipc: Add script to extract doxygen docs from mojom filesPaul Elder
2021-05-26utils: ipc: Update mojoPaul Elder
2021-05-26utils: update-mojo.sh: Add script for updating mojoPaul Elder
2021-05-24ipa: Move core IPA interface documentation to a .cpp fileUmang Jain
2021-04-27utils: ipc: Use the proper namespace for mojom structsPaul Elder
2021-03-29utils: ipc: proxy: Track IPA with a state machineKieran Bingham
2021-03-24utils: ipc: proxy: Process pending messagesLaurent Pinchart
2021-03-24utils: ipc: proxy: Assert asynchronous calls execute in the running stateLaurent Pinchart
2021-03-12utils: raspberrypi: Add a DelayedControls log parserNaushir Patuck
2021-03-09utils: ipc: Make first output parameter direct return if int32Paul Elder
2021-03-09utils: ipc: Support custom parameters to init()Paul Elder
2021-03-08utils: Add kernel headers update scriptLaurent Pinchart
2021-03-04utils: ipc: templates: Drop unused variableLaurent Pinchart
2021-02-16utils: checkstyle.py: Handle renamed files in header add checkerLaurent Pinchart
2021-02-16utils: checkstyle.py: Restore checks of renamed filesLaurent Pinchart
2021-02-16meson: ipa, proxy: Generate headers and proxy with mojoPaul Elder
2021-02-16utils: ipc: add parser scriptPaul Elder
2021-02-16utils: ipc: add generator scriptPaul Elder
2021-02-16utils: ipc: add templates for code generation for IPC mechanismPaul Elder
2021-02-01utils: gen-formats: Support big-endian DRM formatsLaurent Pinchart
2021-01-21utils: checkstyle.py: Fix "protected" members in Commit classLaurent Pinchart
2020-12-29utils: checkstyle.py: Drop astyle supportLaurent Pinchart
2020-12-29utils: checkstyle.py: Add header add checkerLaurent Pinchart
2020-12-29utils: checkstyle.py: Add commit checkersLaurent Pinchart
2020-12-29utils: checkstyle.py: Move diff parsing to Commit classLaurent Pinchart
span> * explicit value() and implicit uint32_t conversion operators may be used. */ namespace { const std::map<V4L2PixelFormat, V4L2PixelFormat::Info> vpf2pf{ /* RGB formats. */ { V4L2PixelFormat(V4L2_PIX_FMT_RGB565), { formats::RGB565, "16-bit RGB 5-6-5" } }, { V4L2PixelFormat(V4L2_PIX_FMT_RGB565X), { formats::RGB565_BE, "16-bit RGB 5-6-5 BE" } }, { V4L2PixelFormat(V4L2_PIX_FMT_RGB24), { formats::BGR888, "24-bit RGB 8-8-8" } }, { V4L2PixelFormat(V4L2_PIX_FMT_BGR24), { formats::RGB888, "24-bit BGR 8-8-8" } }, { V4L2PixelFormat(V4L2_PIX_FMT_XBGR32), { formats::XRGB8888, "32-bit BGRX 8-8-8-8" } }, { V4L2PixelFormat(V4L2_PIX_FMT_XRGB32), { formats::BGRX8888, "32-bit XRGB 8-8-8-8" } }, { V4L2PixelFormat(V4L2_PIX_FMT_RGBX32), { formats::XBGR8888, "32-bit RGBX 8-8-8-8" } }, { V4L2PixelFormat(V4L2_PIX_FMT_BGRX32), { formats::RGBX8888, "32-bit XBGR 8-8-8-8" } }, { V4L2PixelFormat(V4L2_PIX_FMT_RGBA32), { formats::ABGR8888, "32-bit RGBA 8-8-8-8" } }, { V4L2PixelFormat(V4L2_PIX_FMT_ABGR32), { formats::ARGB8888, "32-bit BGRA 8-8-8-8" } }, { V4L2PixelFormat(V4L2_PIX_FMT_ARGB32), { formats::BGRA8888, "32-bit ARGB 8-8-8-8" } }, { V4L2PixelFormat(V4L2_PIX_FMT_BGRA32), { formats::RGBA8888, "32-bit ABGR 8-8-8-8" } }, /* YUV packed formats. */ { V4L2PixelFormat(V4L2_PIX_FMT_YUYV), { formats::YUYV, "YUYV 4:2:2" } }, { V4L2PixelFormat(V4L2_PIX_FMT_YVYU), { formats::YVYU, "YVYU 4:2:2" } }, { V4L2PixelFormat(V4L2_PIX_FMT_UYVY), { formats::UYVY, "UYVY 4:2:2" } }, { V4L2PixelFormat(V4L2_PIX_FMT_VYUY), { formats::VYUY, "VYUY 4:2:2" } }, /* YUV planar formats. */ { V4L2PixelFormat(V4L2_PIX_FMT_NV16), { formats::NV16, "Y/CbCr 4:2:2" } }, { V4L2PixelFormat(V4L2_PIX_FMT_NV16M), { formats::NV16, "Y/CbCr 4:2:2 (N-C)" } }, { V4L2PixelFormat(V4L2_PIX_FMT_NV61), { formats::NV61, "Y/CrCb 4:2:2" } }, { V4L2PixelFormat(V4L2_PIX_FMT_NV61M), { formats::NV61, "Y/CrCb 4:2:2 (N-C)" } }, { V4L2PixelFormat(V4L2_PIX_FMT_NV12), { formats::NV12, "Y/CbCr 4:2:0" } }, { V4L2PixelFormat(V4L2_PIX_FMT_NV12M), { formats::NV12, "Y/CbCr 4:2:0 (N-C)" } }, { V4L2PixelFormat(V4L2_PIX_FMT_NV21), { formats::NV21, "Y/CrCb 4:2:0" } }, { V4L2PixelFormat(V4L2_PIX_FMT_NV21M), { formats::NV21, "Y/CrCb 4:2:0 (N-C)" } }, { V4L2PixelFormat(V4L2_PIX_FMT_NV24), { formats::NV24, "Y/CbCr 4:4:4" } }, { V4L2PixelFormat(V4L2_PIX_FMT_NV42), { formats::NV42, "Y/CrCb 4:4:4" } }, { V4L2PixelFormat(V4L2_PIX_FMT_YUV420), { formats::YUV420, "Planar YUV 4:2:0" } }, { V4L2PixelFormat(V4L2_PIX_FMT_YUV420M), { formats::YUV420, "Planar YUV 4:2:0 (N-C)" } }, { V4L2PixelFormat(V4L2_PIX_FMT_YVU420), { formats::YVU420, "Planar YVU 4:2:0" } }, { V4L2PixelFormat(V4L2_PIX_FMT_YVU420M), { formats::YVU420, "Planar YVU 4:2:0 (N-C)" } }, { V4L2PixelFormat(V4L2_PIX_FMT_YUV422P), { formats::YUV422, "Planar YUV 4:2:2" } }, { V4L2PixelFormat(V4L2_PIX_FMT_YUV422M), { formats::YUV422, "Planar YUV 4:2:2 (N-C)" } }, { V4L2PixelFormat(V4L2_PIX_FMT_YVU422M), { formats::YVU422, "Planar YVU 4:2:2 (N-C)" } }, { V4L2PixelFormat(V4L2_PIX_FMT_YUV444M), { formats::YUV444, "Planar YUV 4:4:4 (N-C)" } }, { V4L2PixelFormat(V4L2_PIX_FMT_YUV444M), { formats::YVU444, "Planar YVU 4:4:4 (N-C)" } }, /* Greyscale formats. */ { V4L2PixelFormat(V4L2_PIX_FMT_GREY), { formats::R8, "8-bit Greyscale" } }, { V4L2PixelFormat(V4L2_PIX_FMT_Y10), { formats::R10, "10-bit Greyscale" } }, { V4L2PixelFormat(V4L2_PIX_FMT_Y12), { formats::R12, "12-bit Greyscale" } }, /* Bayer formats. */ { V4L2PixelFormat(V4L2_PIX_FMT_SBGGR8), { formats::SBGGR8, "8-bit Bayer BGBG/GRGR" } }, { V4L2PixelFormat(V4L2_PIX_FMT_SGBRG8), { formats::SGBRG8, "8-bit Bayer GBGB/RGRG" } }, { V4L2PixelFormat(V4L2_PIX_FMT_SGRBG8), { formats::SGRBG8, "8-bit Bayer GRGR/BGBG" } }, { V4L2PixelFormat(V4L2_PIX_FMT_SRGGB8), { formats::SRGGB8, "8-bit Bayer RGRG/GBGB" } }, { V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10), { formats::SBGGR10, "10-bit Bayer BGBG/GRGR" } }, { V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10), { formats::SGBRG10, "10-bit Bayer GBGB/RGRG" } }, { V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10), { formats::SGRBG10, "10-bit Bayer GRGR/BGBG" } }, { V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10), { formats::SRGGB10, "10-bit Bayer RGRG/GBGB" } }, { V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10P), { formats::SBGGR10_CSI2P, "10-bit Bayer BGBG/GRGR Packed" } }, { V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10P), { formats::SGBRG10_CSI2P, "10-bit Bayer GBGB/RGRG Packed" } }, { V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10P), { formats::SGRBG10_CSI2P, "10-bit Bayer GRGR/BGBG Packed" } }, { V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10P), { formats::SRGGB10_CSI2P, "10-bit Bayer RGRG/GBGB Packed" } }, { V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12), { formats::SBGGR12, "12-bit Bayer BGBG/GRGR" } }, { V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12), { formats::SGBRG12, "12-bit Bayer GBGB/RGRG" } }, { V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12), { formats::SGRBG12, "12-bit Bayer GRGR/BGBG" } }, { V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12), { formats::SRGGB12, "12-bit Bayer RGRG/GBGB" } }, { V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12P), { formats::SBGGR12_CSI2P, "12-bit Bayer BGBG/GRGR Packed" } }, { V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12P), { formats::SGBRG12_CSI2P, "12-bit Bayer GBGB/RGRG Packed" } }, { V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12P), { formats::SGRBG12_CSI2P, "12-bit Bayer GRGR/BGBG Packed" } }, { V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12P), { formats::SRGGB12_CSI2P, "12-bit Bayer RGRG/GBGB Packed" } }, { V4L2PixelFormat(V4L2_PIX_FMT_SBGGR16), { formats::SBGGR16, "16-bit Bayer BGBG/GRGR" } }, { V4L2PixelFormat(V4L2_PIX_FMT_SGBRG16), { formats::SGBRG16, "16-bit Bayer GBGB/RGRG" } }, { V4L2PixelFormat(V4L2_PIX_FMT_SGRBG16), { formats::SGRBG16, "16-bit Bayer GRGR/BGBG" } }, { V4L2PixelFormat(V4L2_PIX_FMT_SRGGB16), { formats::SRGGB16, "16-bit Bayer RGRG/GBGB" } }, /* Compressed formats. */ { V4L2PixelFormat(V4L2_PIX_FMT_MJPEG), { formats::MJPEG, "Motion-JPEG" } }, }; } /* namespace */ /** * \struct V4L2PixelFormat::Info * \brief Information about a V4L2 pixel format * * \var V4L2PixelFormat::Info::format * \brief The corresponding libcamera PixelFormat * * \sa PixelFormat * * \var V4L2PixelFormat::Info::description * \brief The human-readable description of the V4L2 pixel format */ /** * \fn V4L2PixelFormat::V4L2PixelFormat() * \brief Construct a V4L2PixelFormat with an invalid format * * V4L2PixelFormat instances constructed with the default constructor are * invalid, calling the isValid() function returns false. */ /** * \fn V4L2PixelFormat::V4L2PixelFormat(uint32_t fourcc) * \brief Construct a V4L2PixelFormat from a FourCC value * \param[in] fourcc The pixel format FourCC numerical value */ /** * \fn bool V4L2PixelFormat::isValid() const * \brief Check if the pixel format is valid * * V4L2PixelFormat instances constructed with the default constructor are * invalid. Instances constructed with a FourCC defined in the V4L2 API are * valid. The behaviour is undefined otherwise. * * \return True if the pixel format is valid, false otherwise */ /** * \fn uint32_t V4L2PixelFormat::fourcc() const * \brief Retrieve the pixel format FourCC numerical value * \return The pixel format FourCC numerical value */ /** * \fn V4L2PixelFormat::operator uint32_t() const * \brief Convert to the pixel format FourCC numerical value * \return The pixel format FourCC numerical value */ /** * \brief Assemble and return a string describing the pixel format * \return A string describing the pixel format */ std::string V4L2PixelFormat::toString() const { if (fourcc_ == 0) return "<INVALID>"; char ss[8] = { static_cast<char>(fourcc_ & 0x7f), static_cast<char>((fourcc_ >> 8) & 0x7f), static_cast<char>((fourcc_ >> 16) & 0x7f), static_cast<char>((fourcc_ >> 24) & 0x7f) }; for (unsigned int i = 0; i < 4; i++) { if (!isprint(ss[i])) ss[i] = '.'; } if (fourcc_ & (1 << 31)) strcat(ss, "-BE"); return ss; } /** * \brief Retrieve the V4L2 description for the format * * The description matches the value used by the kernel, as would be reported * by the VIDIOC_ENUM_FMT ioctl. * * \return The V4L2 description corresponding to the V4L2 format, or a * placeholder description if not found */ const char *V4L2PixelFormat::description() const { const auto iter = vpf2pf.find(*this); if (iter == vpf2pf.end()) { LOG(V4L2, Warning) << "Unsupported V4L2 pixel format " << toString(); return "Unsupported format"; } return iter->second.description; } /** * \brief Convert the V4L2 pixel format to the corresponding PixelFormat * \return The PixelFormat corresponding to the V4L2 pixel format */ PixelFormat V4L2PixelFormat::toPixelFormat() const { const auto iter = vpf2pf.find(*this); if (iter == vpf2pf.end()) { LOG(V4L2, Warning) << "Unsupported V4L2 pixel format " << toString(); return PixelFormat(); } return iter->second.format; } /** * \brief Convert \a pixelFormat to its corresponding V4L2PixelFormat * \param[in] pixelFormat The PixelFormat to convert * \param[in] multiplanar V4L2 Multiplanar API support flag * * Multiple V4L2 formats may exist for one PixelFormat when the format uses * multiple planes, as V4L2 defines separate 4CCs for contiguous and separate * planes formats. Set the \a multiplanar parameter to false to select a format * with contiguous planes, or to true to select a format with non-contiguous * planes. * * \return The V4L2PixelFormat corresponding to \a pixelFormat */ V4L2PixelFormat V4L2PixelFormat::fromPixelFormat(const PixelFormat &pixelFormat, bool multiplanar) { const PixelFormatInfo &info = PixelFormatInfo::info(pixelFormat); if (!info.isValid()) return V4L2PixelFormat(); return multiplanar ? info.v4l2Formats.multi : info.v4l2Formats.single; } /** * \brief Insert a text representation of a V4L2PixelFormat into an output * stream * \param[in] out The output stream * \param[in] f The V4L2PixelFormat * \return The output stream \a out */ std::ostream &operator<<(std::ostream &out, const V4L2PixelFormat &f) { out << f.toString(); return out; } } /* namespace libcamera */