summaryrefslogtreecommitdiff
path: root/utils/raspberrypi/ctt
ModeNameSize
-rwxr-xr-xctt.py31244logplain
-rw-r--r--ctt_alsc.py10172logplain
-rw-r--r--ctt_awb.py13271logplain
-rw-r--r--ctt_ccm.py6680logplain
-rw-r--r--ctt_config_example.json210logplain
-rw-r--r--ctt_geq.py6297logplain
-rw-r--r--ctt_image_load.py14070logplain
-rw-r--r--ctt_lux.py1925logplain
-rw-r--r--ctt_macbeth_locator.py26321logplain
-rw-r--r--ctt_noise.py3662logplain
-rw-r--r--ctt_pretty_print_json.py3082logplain
-rw-r--r--ctt_ransac.py2327logplain
-rw-r--r--ctt_ref.pgm9641logplain
-rw-r--r--ctt_tools.py3980logplain
onverter(MediaDevice *media) { /* * Locate the video node. There's no need to validate the pipeline * further, the caller guarantees that this is a V4L2 mem2mem device. */ const std::vector<MediaEntity *> &entities = media->entities(); auto it = std::find_if(entities.begin(), entities.end(), [](MediaEntity *entity) { return entity->function() == MEDIA_ENT_F_IO_V4L; }); if (it == entities.end()) return; m2m_ = std::make_unique<V4L2M2MDevice>((*it)->deviceNode()); m2m_->output()->bufferReady.connect(this, &SimpleConverter::outputBufferReady); m2m_->capture()->bufferReady.connect(this, &SimpleConverter::captureBufferReady); } int SimpleConverter::open() { if (!m2m_) return -ENODEV; return m2m_->open(); } void SimpleConverter::close() { if (m2m_) m2m_->close(); } std::vector<PixelFormat> SimpleConverter::formats(PixelFormat input) { if (!m2m_) return {}; /* * Set the format on the input side (V4L2 output) of the converter to * enumerate the conversion capabilities on its output (V4L2 capture). */ V4L2DeviceFormat v4l2Format; v4l2Format.fourcc = m2m_->output()->toV4L2PixelFormat(input); v4l2Format.size = { 1, 1 }; int ret = m2m_->output()->setFormat(&v4l2Format); if (ret < 0) { LOG(SimplePipeline, Error) << "Failed to set format: " << strerror(-ret); return {}; } std::vector<PixelFormat> pixelFormats; for (const auto &format : m2m_->capture()->formats()) { PixelFormat pixelFormat = format.first.toPixelFormat(); if (pixelFormat) pixelFormats.push_back(pixelFormat); } return pixelFormats; } SizeRange SimpleConverter::sizes(const Size &input) { if (!m2m_) return {}; /* * Set the size on the input side (V4L2 output) of the converter to * enumerate the scaling capabilities on its output (V4L2 capture). */ V4L2DeviceFormat format; format.fourcc = V4L2PixelFormat(); format.size = input; int ret = m2m_->output()->setFormat(&format); if (ret < 0) { LOG(SimplePipeline, Error) << "Failed to set format: " << strerror(-ret); return {}; } SizeRange sizes; format.size = { 1, 1 }; ret = m2m_->capture()->setFormat(&format); if (ret < 0) { LOG(SimplePipeline, Error) << "Failed to set format: " << strerror(-ret); return {}; } sizes.min = format.size; format.size = { UINT_MAX, UINT_MAX }; ret = m2m_->capture()->setFormat(&format); if (ret < 0) { LOG(SimplePipeline, Error) << "Failed to set format: " << strerror(-ret); return {}; } sizes.max = format.size; return sizes; } std::tuple<unsigned int, unsigned int> SimpleConverter::strideAndFrameSize(const PixelFormat &pixelFormat, const Size &size) { V4L2DeviceFormat format; format.fourcc = m2m_->capture()->toV4L2PixelFormat(pixelFormat); format.size = size; int ret = m2m_->capture()->tryFormat(&format); if (ret < 0) return std::make_tuple(0, 0); return std::make_tuple(format.planes[0].bpl, format.planes[0].size); } int SimpleConverter::configure(PixelFormat inputFormat, const Size &inputSize,