Add lcameraBuff Stage 2 plugin with YUV attach and unit tests.

Introduce params parsing, pixel/format decisions, capture layout, shared
YuvStimProducer per camera, and channel stimulus buffers with attach flow.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-14 11:03:19 -04:00
parent 809861be2b
commit e7b7a311f7
18 changed files with 1698 additions and 0 deletions
@@ -0,0 +1,70 @@
#include <yuvChannelStimulusBuffer.h>
#include <stdexcept>
namespace smo {
namespace stim_buff {
namespace lcamera_buff {
namespace {
constexpr const char *qualeIfaceColourYuvY = "colour-yuv-y";
constexpr const char *qualeIfaceColourYuvU = "colour-yuv-u";
constexpr const char *qualeIfaceColourYuvV = "colour-yuv-v";
} // namespace
YuvChannelKind YuvChannelStimulusBuffer::yuvChannelKindFromQualeIfaceApi(
const std::string& qualeIfaceApi)
{
if (qualeIfaceApi == qualeIfaceColourYuvY) {
return YuvChannelKind::Y;
}
if (qualeIfaceApi == qualeIfaceColourYuvU) {
return YuvChannelKind::U;
}
if (qualeIfaceApi == qualeIfaceColourYuvV) {
return YuvChannelKind::V;
}
throw std::runtime_error(
"lcameraBuff: unsupported qualeIfaceApi '" + qualeIfaceApi
+ "'; expected colour-yuv-y, colour-yuv-u, or colour-yuv-v");
}
StagingBuffer::IOEngineConstraints yuvChannelStagingInputConstraints(
size_t channelByteSize)
{
const size_t pageSize = static_cast<size_t>(sysconf(_SC_PAGE_SIZE));
return StagingBuffer::IOEngineConstraints(
1,
channelByteSize,
pageSize,
pageSize);
}
YuvChannelStimulusBuffer::YuvChannelStimulusBuffer(
StimulusProducer& parent,
const std::shared_ptr<device::DeviceAttachmentSpec>& deviceAttachmentSpec,
int histbuffMs,
YuvChannelKind _channelKind,
size_t _channelByteSize,
const SmoCallbacks& callbacks,
cl_mem_flags flags)
: StimulusBuffer(
parent,
deviceAttachmentSpec,
histbuffMs,
yuvChannelStagingInputConstraints(_channelByteSize),
yuvChannelStagingInputConstraints(_channelByteSize),
callbacks,
flags),
channelKind(_channelKind),
channelByteSize(_channelByteSize)
{}
} // namespace lcamera_buff
} // namespace stim_buff
} // namespace smo