Vendor-neutral pixel format vocabulary + descriptive metadata. More...
Detailed Description
Vendor-neutral pixel format vocabulary + descriptive metadata.
Capture/output cards each have their own pixel-format enums: AJA NTV2FrameBufferFormat, DeckLink BMDPixelFormat, Magewell MWFOURCC, V4L2 fourccs, DRM fourccs, PipeWire SPA formats, GStreamer format strings, Ximea XI_IMG_FORMAT. Strategies translate between those and score's internal representation; without a central vocabulary every strategy reinvents the mapping table, and they drift apart.
AVPixelFormat cannot serve as that vocabulary on its own: FFmpeg models several formats the SDI cards put on the wire as codecs rather than pixel formats (v210, v216, r210, DPX 10/12-bit, 12-bit packed RGB, 10-bit ARGB), so they have no AV_PIX_FMT_* at all. VideoPixelFormatAV.hpp bridges the representable subset in both directions.
This vocabulary describes sample layout only. Colorimetry – range, primaries, transfer characteristic, chroma siting, HDR metadata – is a separate orthogonal axis, owned by Video::ImageFormat. Do not add colour fields here: a format says how bytes are arranged, not how to interpret the values in them.
Everything is generated from one declarative table, SCORE_VIDEO_PIXEL_FORMATS: the enum, the descriptor array, the name lookup, and the list the unit test sweeps. A format therefore cannot be declared without being described – which is how 28 formats previously ended up declared with a zero-byte descriptor, so that bytesPerFrame silently returned 0 for them.
Vendor-specific translation tables (e.g. bmdFormatTo(...), ntv2FormatTo(...)) live in each vendor's addon to avoid pulling vendor headers into score-plugin-gfx.
Go to the source code of this file.
Classes | |
| struct | score::gfx::interop::VideoPixelFormatInfo |
Namespaces | |
| namespace | score |
| Base toolkit upon which the software is built. | |
| namespace | score::gfx |
| Graphics rendering pipeline for ossia score. | |
Macros | |
| #define | SCORE_VIDEO_PIXEL_FORMATS(X) |
| #define | SCORE_VPF_ENUM_ROW(Name, Value, ...) Name = Value, |
| #define | SCORE_VPF_COUNT_ROW(...) +1 |
Enumerations | |
| enum class | score::gfx::interop::ColorModel : uint8_t { Unknown = 0 , RGB , YUV , Grey , Bayer } |
| enum class | score::gfx::interop::ByteOrder : uint8_t { NA = 0 , Little , Big } |
| enum class | score::gfx::interop::VideoPixelFormat : uint16_t { Unknown = 0 , SCORE_VPF_ENUM_ROW , BGRA8 = 1 , RGBA8 = 2 , ARGB8 = 3 , ABGR8 = 4 , RGB24 = 5 , BGR24 = 6 , BGRX8 = 7 , RGBX8 = 8 , XRGB8 = 9 , XBGR8 = 19 , R210 = 10 , R12B = 11 , R12L = 12 , ARGB10 = 13 , DPX10 = 14 , DPX10LE = 15 , RGB12P = 16 , RGB48 = 17 , RGB10 = 18 , X2RGB10 = 120 , X2BGR10 = 121 , RGB332 = 90 , RGB565 = 91 , RGB565BE = 92 , RGB555 = 93 , RGB555BE = 94 , ARGB1555 = 95 , RGB444 = 96 , ARGB4444 = 97 , AYUV4444 = 98 , AYUV1555 = 99 , YUV565 = 100 , UYVY422 = 20 , YUYV422 = 21 , YVYU422 = 22 , VYUY422 = 23 , V210 = 30 , V216 = 31 , Y210 = 106 , Y216 = 107 , NV12 = 40 , P010 = 41 , YUV420P = 42 , YUV420P10 = 43 , NV21 = 44 , YVU420P = 45 , P210 = 50 , YUV422P = 51 , YUV422P10 = 52 , NV16 = 53 , NV61 = 54 , YUV422P12 = 55 , YUV422P16 = 110 , YVU422P = 104 , P216 = 108 , YUV411P = 101 , YUV410P = 102 , YVU410P = 103 , UYYVYY411 = 105 , YUV444P = 60 , YUV444P10 = 61 , YUV444P12 = 62 , NV24 = 63 , NV42 = 64 , VUYA = 65 , VUYX = 66 , AYUV = 67 , XYUV = 68 , YUVA = 69 , YUVX = 73 , YUVA444P = 111 , P416 = 109 , XV30 = 112 , AYUV64 = 113 , RGBA16 = 70 , RGBA16F = 71 , RGBA32F = 72 , Mono8 = 80 , Mono10 = 81 , Mono12 = 82 , Mono16 = 83 , BayerRG8 = 84 , BayerRG12 = 85 , BayerBGGR8 = 114 , BayerGBRG8 = 115 , BayerGRBG8 = 116 , BayerRGGB8 = 117 , BayerBGGR16 = 118 , BayerRGGB16 = 119 , BayerBGGR10 = 123 , BayerGBRG10 = 124 , BayerGRBG10 = 125 , BayerRGGB10 = 126 , Mono16BE = 86 } |
Functions | |
| constexpr std::size_t | score::gfx::interop::formatCount () noexcept |
| constexpr std::size_t | score::gfx::interop::alignUp (std::size_t v, std::size_t a) noexcept |
| const VideoPixelFormatInfo & | score::gfx::interop::formatInfo (VideoPixelFormat f) noexcept |
| const char * | score::gfx::interop::formatName (VideoPixelFormat f) noexcept |
| VideoPixelFormat | score::gfx::interop::chromaSwappedTwin (VideoPixelFormat f) noexcept |
| const VideoPixelFormatInfo * | score::gfx::interop::allFormats (std::size_t &count) noexcept |
| std::size_t | score::gfx::interop::rowBytes (VideoPixelFormat f, uint32_t width) noexcept |
| std::size_t | score::gfx::interop::alignedRowBytes (VideoPixelFormat f, uint32_t width, std::size_t alignment) noexcept |
| std::size_t | score::gfx::interop::defaultStride (VideoPixelFormat f, uint32_t width) noexcept |
| std::size_t | score::gfx::interop::bytesPerFrame (VideoPixelFormat f, uint32_t width, uint32_t height) noexcept |
Enumeration Type Documentation
◆ ByteOrder
|
strong |
Byte order of multi-byte samples. NA means the format has no multi-byte sample whose order could differ – 8-bit packed layouts, and byte-addressed ones like RGB24 where component order is part of the format identity.
◆ ColorModel
|
strong |
◆ VideoPixelFormat
|
strong |
Comprehensive pixel format enum, generated from the table above. Values are stable; reorder only with serialization migration.
Function Documentation
◆ alignedRowBytes()
|
noexcept |
rowBytes rounded up to alignment. This is the form device paths should use, passing the alignment their allocator actually requires.
◆ alignUp()
|
constexprnoexcept |
Round v up to a multiple of a. a <= 1 means no alignment; a need not be a power of two (V210's 128 happens to be, a V4L2 bytesperline may not).
◆ allFormats()
|
noexcept |
Every described format, in table order. Lets callers – and the unit test – enumerate the vocabulary without maintaining a second copy of the list.
◆ bytesPerFrame()
|
noexcept |
Total byte size of one frame at width × height, summing every plane at the format's preferred stride.
◆ chromaSwappedTwin()
|
noexcept |
For a layout that stores its chroma planes V-before-U (YV12, NV21, YV16, ...), the otherwise identical U-before-V layout; Unknown for anything else.
FFmpeg has no pixel format for the swapped orders – it expresses them by exchanging the U and V pointers – so a consumer that can only name an AVPixelFormat needs both this twin and the knowledge that it must swap. That is strictly more information than mapping the swapped layout onto its twin and forgetting, which silently exchanges red and blue.
◆ defaultStride()
|
noexcept |
alignedRowBytes using the format's preferredStrideAlignment, for callers that have no constraint of their own.
◆ formatCount()
|
constexprnoexcept |
Number of described formats, excluding Unknown.
◆ formatInfo()
|
noexcept |
Descriptive info for f. Returns a reference to storage with static lifetime; the Unknown sentinel is returned for unrecognised values.
◆ formatName()
|
noexcept |
Human-readable short name, e.g. "UYVY422", "V210".
◆ rowBytes()
|
noexcept |
Tight primary-plane row size in bytes, with no padding at all.