#pragma once // Single-component-per-pixel formats. Most are grayscale (Y) modeled as // a YUV format with synthesized neutral chroma; R8 is the RGB-kind // counterpart, modeled grey-style with G=B=R on read. Y10/Y12 carry an // explicit X padding bitfield. XYYY2101010 is multi-pixel-per-word: 3 Y // samples in 32 bits. #include "../layout.h" #include "../io/gray.h" #include "../io/gray_packed.h" #include "../io/mono_rgb.h" namespace pixpat::formats { #define PIXPAT_GRAY(name, ...) \ struct name : Layout { \ using Source = GraySource; \ using Sink = GraySink; \ } PIXPAT_GRAY(Y8, Plane); PIXPAT_GRAY(Y10, Plane); PIXPAT_GRAY(Y12, Plane); PIXPAT_GRAY(Y16, Plane); #undef PIXPAT_GRAY // R8: single 8-bit R channel. Read synthesizes G=B=R; write encodes R // and drops G/B/A. Symmetric to Y8 but ColorKind::RGB so cross-pipeline // conversions go through the RGB->YUV ColorXfm direction. struct R8 : Layout > { using Source = MonoRGBSource; using Sink = MonoRGBSink; }; struct XYYY2101010 : Layout > { using Source = MultiPixelGraySource; using Sink = MultiPixelGraySink; }; // MIPI CSI-2 packed grayscale (Y10P / Y12P). The Layout doesn't capture // the packed bit layout — GrayPackedSource/Sink delegate to the shared // CSI-2 helper (io/csi2.h). uint8_t plane shape is a placeholder so // dispatch plumbing is uniform (mirrors bayer_detail::Bayer10P/12P). namespace gray_csi2_detail { using Gray10P = Layout >; using Gray12P = Layout >; } // namespace gray_csi2_detail struct Y10P : gray_csi2_detail::Gray10P { using Source = GrayPackedSource; using Sink = GrayPackedSink; }; struct Y12P : gray_csi2_detail::Gray12P { using Source = GrayPackedSource; using Sink = GrayPackedSink; }; } // namespace pixpat::formats