Files
salmanoff/stimBuffApis/lcameraBuff/pixelAndColorFormatDecisions.h
T
hayodea e7b7a311f7 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>
2026-06-14 11:03:19 -04:00

60 lines
1.7 KiB
C++

#ifndef LCAMERA_BUFF_PIXEL_AND_COLOR_FORMAT_DECISIONS_H
#define LCAMERA_BUFF_PIXEL_AND_COLOR_FORMAT_DECISIONS_H
#include <cameraModeRequest.h>
#include <cstddef>
/**
* Y/U/V channel sizing for lcameraBuff.
*
* lcameraBuff exports three quale ifaces (colour-yuv-y/u/v), each backed by a
* separate deinterleaved channel buffer. libcamera, however, negotiates a single
* configured pixel format (YUYV, NV12, YUV420, etc.) that may be packed or
* multi-plane. This module bridges that gap at attach time: it classifies the
* configured fourcc into a chroma subsampling family (420 / 422 / 444) and
* computes how many bytes each deinterleaved Y, U, or V plane needs for the
* negotiated width and height.
*
* What it provides to the stimbuff:
* - YuvChromaSubsampling on YuvStimProducer (derived from configured mode)
* - channelByteSize for each YuvChannelStimulusBuffer / StagingBuffer mmap
*
* Capture layout (packed vs planar, direct vs deinterleaved backing) is handled
* separately by yuvCaptureLayout.h; this module is only plane geometry and
* byte counts. Future capture/deinterleave stages must write into buffers sized
* by these functions.
*/
namespace smo {
namespace stim_buff {
namespace lcamera_buff {
enum class YuvChannelKind
{
Y,
U,
V,
};
enum class YuvChromaSubsampling
{
Yuv420,
Yuv422,
Yuv444,
};
YuvChromaSubsampling classifyYuvChromaSubsampling(
const lcamera_dev::LcameraDevConfiguredCameraMode& configuredMode);
size_t computeDeinterleavedChannelByteSize(
YuvChannelKind channel,
unsigned width,
unsigned height,
YuvChromaSubsampling subsampling);
} // namespace lcamera_buff
} // namespace stim_buff
} // namespace smo
#endif // LCAMERA_BUFF_PIXEL_AND_COLOR_FORMAT_DECISIONS_H