libpromeki 1.0.0-alpha
PROfessional MEdia toolKIt
 
Loading...
Searching...
No Matches
pixelformat.h
Go to the documentation of this file.
1
8#pragma once
9
10
11#include <promeki/config.h>
12#if PROMEKI_ENABLE_PROAV
13#include <promeki/namespace.h>
14#include <promeki/string.h>
15#include <promeki/list.h>
16#include <promeki/error.h>
17#include <promeki/result.h>
18#include <promeki/fourcc.h>
19#include <promeki/colormodel.h>
21#include <promeki/videocodec.h>
22#include <promeki/enums_color.h>
23#include <promeki/datatype.h>
24
25PROMEKI_NAMESPACE_BEGIN
26
27class DataStream;
28
29class Image;
30class ImageDesc;
31class UncompressedVideoPayload;
32class PaintEngine;
33
196class PixelFormat {
197 public:
198 PROMEKI_DATATYPE(PixelFormat, DataTypePixelFormat, 2)
199
200
212 Error writeToStream(DataStream &s) const;
214 template <uint32_t V> static Result<PixelFormat> readFromStream(DataStream &s);
215
216 static constexpr size_t MaxComps = PixelMemLayout::MaxComps;
217
224 enum ID {
225 Invalid = 0,
226
227 // -- RGB/RGBA uncompressed (8-bit, byte-aligned) --
228 RGBA8_sRGB = 1,
229 RGB8_sRGB = 2,
230
231 // -- RGB DPX packed --
232 RGB10_DPX_sRGB = 3,
233
234 // -- YCbCr 4:2:2 interleaved YUYV --
235 YUV8_422_Rec709 = 4,
236 YUV10_422_Rec709 = 5,
237
238 // -- JPEG compressed --
239 JPEG_RGBA8_sRGB = 6,
240 JPEG_RGB8_sRGB = 7,
241 JPEG_YUV8_422_Rec709 =
242 8,
243 JPEG_YUV8_420_Rec709 =
244 9,
245
246 // -- YCbCr 4:2:2 UYVY --
247 YUV8_422_UYVY_Rec709 = 10,
248 YUV10_422_UYVY_LE_Rec709 = 11,
249 YUV10_422_UYVY_BE_Rec709 = 12,
250 YUV12_422_UYVY_LE_Rec709 = 13,
251 YUV12_422_UYVY_BE_Rec709 = 14,
252
253 // -- YCbCr 4:2:2 v210 --
254 YUV10_422_v210_Rec709 = 15,
255
256 // -- YCbCr 4:2:2 planar --
257 YUV8_422_Planar_Rec709 = 16,
258 YUV10_422_Planar_LE_Rec709 = 17,
259 YUV10_422_Planar_BE_Rec709 = 18,
260 YUV12_422_Planar_LE_Rec709 = 19,
261 YUV12_422_Planar_BE_Rec709 = 20,
262
263 // -- YCbCr 4:2:0 planar --
264 YUV8_420_Planar_Rec709 = 21,
265 YUV10_420_Planar_LE_Rec709 = 22,
266 YUV10_420_Planar_BE_Rec709 = 23,
267 YUV12_420_Planar_LE_Rec709 = 24,
268 YUV12_420_Planar_BE_Rec709 = 25,
269
270 // -- YCbCr 4:2:0 semi-planar (NV12) --
271 YUV8_420_SemiPlanar_Rec709 = 26,
272 YUV10_420_SemiPlanar_LE_Rec709 = 27,
273 YUV10_420_SemiPlanar_BE_Rec709 = 28,
274 YUV12_420_SemiPlanar_LE_Rec709 = 29,
275 YUV12_420_SemiPlanar_BE_Rec709 = 30,
276
277 // -- RGB/RGBA 10/12/16-bit in 16-bit words --
278 RGBA10_LE_sRGB = 31,
279 RGBA10_BE_sRGB = 32,
280 RGB10_LE_sRGB = 33,
281 RGB10_BE_sRGB = 34,
282 RGBA12_LE_sRGB = 35,
283 RGBA12_BE_sRGB = 36,
284 RGB12_LE_sRGB = 37,
285 RGB12_BE_sRGB = 38,
286 RGBA16_LE_sRGB = 39,
287 RGBA16_BE_sRGB = 40,
288 RGB16_LE_sRGB = 41,
289 RGB16_BE_sRGB = 42,
290
291 // -- YCbCr 4:4:4 DPX packed --
292 YUV10_DPX_Rec709 = 43,
293
294 // -- BGRA/BGR (reversed component order) --
295 BGRA8_sRGB = 44,
296 BGR8_sRGB = 45,
297 BGRA10_LE_sRGB = 46,
298 BGRA10_BE_sRGB = 47,
299 BGR10_LE_sRGB = 48,
300 BGR10_BE_sRGB = 49,
301 BGRA12_LE_sRGB = 50,
302 BGRA12_BE_sRGB = 51,
303 BGR12_LE_sRGB = 52,
304 BGR12_BE_sRGB = 53,
305 BGRA16_LE_sRGB = 54,
306 BGRA16_BE_sRGB = 55,
307 BGR16_LE_sRGB = 56,
308 BGR16_BE_sRGB = 57,
309
310 // -- ARGB (alpha-first) --
311 ARGB8_sRGB = 58,
312 ARGB10_LE_sRGB = 59,
313 ARGB10_BE_sRGB = 60,
314 ARGB12_LE_sRGB = 61,
315 ARGB12_BE_sRGB = 62,
316 ARGB16_LE_sRGB = 63,
317 ARGB16_BE_sRGB = 64,
318
319 // -- ABGR (alpha-first, blue-first) --
320 ABGR8_sRGB = 65,
321 ABGR10_LE_sRGB = 66,
322 ABGR10_BE_sRGB = 67,
323 ABGR12_LE_sRGB = 68,
324 ABGR12_BE_sRGB = 69,
325 ABGR16_LE_sRGB = 70,
326 ABGR16_BE_sRGB = 71,
327
328 // -- Monochrome (sRGB luminance) --
329 Mono8_sRGB = 72,
330 Mono10_LE_sRGB = 73,
331 Mono10_BE_sRGB = 74,
332 Mono12_LE_sRGB = 75,
333 Mono12_BE_sRGB = 76,
334 Mono16_LE_sRGB = 77,
335 Mono16_BE_sRGB = 78,
336
337 // -- Float RGBA/RGB/Mono (linear Rec.709 primaries) --
338 RGBAF16_LE_LinearRec709 = 79,
339 RGBAF16_BE_LinearRec709 = 80,
340 RGBF16_LE_LinearRec709 = 81,
341 RGBF16_BE_LinearRec709 = 82,
342 MonoF16_LE_LinearRec709 = 83,
343 MonoF16_BE_LinearRec709 = 84,
344 RGBAF32_LE_LinearRec709 = 85,
345 RGBAF32_BE_LinearRec709 = 86,
346 RGBF32_LE_LinearRec709 = 87,
347 RGBF32_BE_LinearRec709 = 88,
348 MonoF32_LE_LinearRec709 = 89,
349 MonoF32_BE_LinearRec709 = 90,
350
351 // -- 10:10:10:2 packed (3x10 + 1x2 in 32 bits) --
352 RGB10A2_LE_sRGB = 91,
353 RGB10A2_BE_sRGB = 92,
354 BGR10A2_LE_sRGB = 93,
355 BGR10A2_BE_sRGB = 94,
356
357 // -- YCbCr 4:4:4 (non-DPX, Rec.709) --
358 YUV8_Rec709 = 95,
359 YUV10_LE_Rec709 = 96,
360 YUV10_BE_Rec709 = 97,
361 YUV12_LE_Rec709 = 98,
362 YUV12_BE_Rec709 = 99,
363 YUV16_LE_Rec709 = 100,
364 YUV16_BE_Rec709 = 101,
365
366 // -- Rec.2020 YCbCr --
367 YUV10_422_UYVY_LE_Rec2020 = 102,
368 YUV10_422_UYVY_BE_Rec2020 = 103,
369 YUV12_422_UYVY_LE_Rec2020 = 104,
370 YUV12_422_UYVY_BE_Rec2020 = 105,
371 YUV10_420_Planar_LE_Rec2020 = 106,
372 YUV10_420_Planar_BE_Rec2020 = 107,
373 YUV12_420_Planar_LE_Rec2020 = 108,
374 YUV12_420_Planar_BE_Rec2020 = 109,
375
376 // -- BT.2100 PQ / HLG HDR --
377 // Memory layout identical to the SDR
378 // BT.2020 entries above; the distinction is
379 // entirely the EOTF / transfer claim, so
380 // these IDs anchor a different ColorModel
381 // (Rec2020_PQ / Rec2020_HLG /
382 // YCbCr_Rec2020_PQ / YCbCr_Rec2020_HLG)
383 // whose @ref ColorModel::toH273 reports the
384 // matching H.273 transfer codepoint
385 // (16 = PQ, 18 = HLG). Includes only the
386 // memory layouts that practically carry HDR
387 // (V210, P010, P216, 10-bit RGB packed, 16-
388 // bit RGB) — the combinatorial sweep across
389 // every layout × {PQ, HLG} would inflate
390 // the catalog without practical benefit.
391 // SDI / NDI HDR (PQ + HLG):
392 YUV10_422_UYVY_LE_Rec2020_PQ = 200,
393 YUV10_422_UYVY_LE_Rec2020_HLG = 201,
394 YUV12_422_UYVY_LE_Rec2020_PQ = 202,
395 YUV12_422_UYVY_LE_Rec2020_HLG = 203,
396 // Codec / NVDEC HDR output (4:2:0 PQ / HLG):
397 YUV10_420_Planar_LE_Rec2020_PQ = 204,
398 YUV10_420_Planar_LE_Rec2020_HLG = 205,
399 YUV12_420_Planar_LE_Rec2020_PQ = 206,
400 YUV12_420_Planar_LE_Rec2020_HLG = 207,
401 // NV12 / P010 semi-planar HDR (NVDEC, Intel QSV, AMD UVD):
402 YUV10_420_SemiPlanar_LE_Rec2020_PQ = 208,
403 YUV10_420_SemiPlanar_LE_Rec2020_HLG = 209,
404 // P216 (NDI 16-bit HDR):
405 YUV16_422_SemiPlanar_LE_Rec2020_PQ = 210,
406 YUV16_422_SemiPlanar_LE_Rec2020_HLG = 211,
407 // 10-bit RGB packed (RGB10A2):
408 RGB10A2_LE_Rec2020_PQ = 212,
409 RGB10A2_LE_Rec2020_HLG = 213,
410 // 16-bit RGB (host order):
411 RGB16_LE_Rec2020_PQ = 214,
412 RGB16_LE_Rec2020_HLG = 215,
413 // Half-float scene-referred linear (cinema HDR working space):
414 RGBAF16_LE_LinearRec2020 = 216,
415 RGBF16_LE_LinearRec2020 = 217,
416 // DCI-P3 PQ (cinema):
417 RGB16_LE_DCI_P3_PQ = 218,
418
419 // -- Rec.601 YCbCr --
420 YUV8_422_Rec601 = 110,
421 YUV8_422_UYVY_Rec601 = 111,
422 YUV8_420_Planar_Rec601 = 112,
423 YUV8_420_SemiPlanar_Rec601 = 113,
424
425 // -- NV21 (semi-planar 4:2:0, CrCb order, Rec.709) --
426 YUV8_420_NV21_Rec709 = 114,
427 YUV10_420_NV21_LE_Rec709 = 115,
428 YUV10_420_NV21_BE_Rec709 = 116,
429 YUV12_420_NV21_LE_Rec709 = 117,
430 YUV12_420_NV21_BE_Rec709 = 118,
431
432 // -- Semi-planar 4:2:2 (NV16, Rec.709) --
433 YUV8_422_SemiPlanar_Rec709 = 119,
434 YUV10_422_SemiPlanar_LE_Rec709 = 120,
435 YUV10_422_SemiPlanar_BE_Rec709 = 121,
436 YUV12_422_SemiPlanar_LE_Rec709 = 122,
437 YUV12_422_SemiPlanar_BE_Rec709 = 123,
438
439 // -- Planar 4:1:1 (Rec.709) --
440 YUV8_411_Planar_Rec709 = 124,
441
442 // -- 16-bit YCbCr (Rec.709) --
443 YUV16_422_UYVY_LE_Rec709 = 125,
444 YUV16_422_UYVY_BE_Rec709 = 126,
445 YUV16_422_Planar_LE_Rec709 = 127,
446 YUV16_422_Planar_BE_Rec709 = 128,
447 YUV16_420_Planar_LE_Rec709 = 129,
448 YUV16_420_Planar_BE_Rec709 = 130,
449 YUV16_420_SemiPlanar_LE_Rec709 = 131,
450 YUV16_420_SemiPlanar_BE_Rec709 = 132,
451 YUV16_422_SemiPlanar_LE_Rec709 = 164,
452 YUV16_422_SemiPlanar_BE_Rec709 = 165,
453
454 // -- DPX additional packed formats --
455 RGB10_DPX_LE_sRGB = 133,
456 YUV10_DPX_B_Rec709 = 134,
457
458 // ----- Video codec compressed formats (QuickTime/MP4 family) ------------
459 H264 = 135,
460 HEVC = 136,
461 AV1 = 161,
462 ProRes_422_Proxy = 137,
463 ProRes_422_LT = 138,
464 ProRes_422 = 139,
465 ProRes_422_HQ = 140,
466 ProRes_4444 = 141,
467 ProRes_4444_XQ = 142,
468
469 // -- Full-range uncompressed YCbCr --
470 //
471 // The library-wide YCbCr naming convention is that
472 // the unsuffixed form (e.g. YUV8_422_Rec709) is
473 // limited-range (16..235 Y, 16..240 Cb/Cr) to match
474 // broadcast / SDI / ST 2110 defaults. The explicit
475 // "_Full" suffix opts in to full-range 0..255 Y and
476 // 0..255 Cb/Cr, which is what JPEG / JFIF uses and
477 // what most consumer video decoders (ffplay,
478 // browsers, libjpeg-turbo) expect. These
479 // PixelFormats exist both as general-purpose
480 // full-range YCbCr storage and as encode-source
481 // intermediates for the full-range JPEG variants
482 // below.
483 YUV8_422_Rec709_Full = 143,
484 YUV8_422_Rec601_Full = 144,
485 YUV8_420_Planar_Rec709_Full = 145,
486 YUV8_420_Planar_Rec601_Full = 146,
487
488 // -- Full complement of JPEG YCbCr variants (matrix × range) --
489 //
490 // Following the library-wide YCbCr convention: the
491 // unsuffixed JPEG names (existing
492 // JPEG_YUV8_422_Rec709 / JPEG_YUV8_420_Rec709) are
493 // limited-range to stay consistent with the
494 // uncompressed YCbCr defaults. Full-range variants
495 // take the explicit "_Full" suffix. All eight
496 // combinations (matrix × range × subsampling) are
497 // provided; pick the one that matches what the
498 // downstream decoder expects to interpret:
499 //
500 // - Rec.601 + full range (strict JFIF) → ffplay,
501 // browsers, libjpeg-turbo, most consumer apps
502 // - Rec.709 + full range → modern cameras with
503 // an ICC profile; good for high-quality still
504 // storage that a colour-managed viewer honours
505 // - Rec.709 + limited range (existing default) →
506 // broadcast / SDI JPEG pipelines (ST 2110 JPEG XS
507 // style)
508 // - Rec.601 + limited range → legacy broadcast
509 JPEG_YUV8_422_Rec601 =
510 147,
511 JPEG_YUV8_420_Rec601 =
512 148,
513 JPEG_YUV8_422_Rec709_Full =
514 149,
515 JPEG_YUV8_420_Rec709_Full =
516 150,
517 JPEG_YUV8_422_Rec601_Full =
518 151,
519 JPEG_YUV8_420_Rec601_Full =
520 152,
521
522 // -- JPEG XS (ISO/IEC 21122) compressed variants --
523 //
524 // Modern low-complexity intra-only codec. JPEG XS
525 // carries matrix / range out-of-band (in the MP4 sample
526 // entry or RTP SDP — see RFC 9134) rather than inside
527 // the bitstream, so the compressed PixelFormats only
528 // distinguish bit depth and subsampling; Rec.709 is the
529 // canonical broadcast default and the one wired up
530 // here. 10- and 12-bit variants are first-class
531 // citizens since JPEG XS targets high-bit-depth
532 // contribution workflows.
533 JPEG_XS_YUV8_422_Rec709 =
534 153,
535 JPEG_XS_YUV10_422_Rec709 =
536 154,
537 JPEG_XS_YUV12_422_Rec709 =
538 155,
539 JPEG_XS_YUV8_420_Rec709 =
540 156,
541 JPEG_XS_YUV10_420_Rec709 =
542 157,
543 JPEG_XS_YUV12_420_Rec709 =
544 158,
545 JPEG_XS_RGB8_sRGB = 159,
546
547 // -- Planar RGB --
548 RGB8_Planar_sRGB = 160,
549
550 // -- Planar 4:4:4 YCbCr --
551 YUV8_444_Planar_Rec709 = 162,
552 YUV10_444_Planar_LE_Rec709 = 163,
553 YUV12_444_Planar_LE_Rec709 = 166,
554
555 // -- Planar 4:2:2 / 4:4:4 YCbCr colorimetry variants --
556 //
557 // Same memory layouts as the Rec.709 entries above; the
558 // only difference is the anchored @ref ColorModel. These
559 // exist so a decoder can land wide-gamut / HDR / SD content
560 // on a PixelFormat that *encodes* its colour space (rather
561 // than tagging a Rec.709 surface with override metadata) —
562 // the 4:2:2 / 4:4:4 planar analogue of the 4:2:0 Rec.2020 /
563 // PQ / HLG variants. ProRes 422 decodes to the 10-bit 4:2:2
564 // set; ProRes 4444 / XQ to the 10/12-bit 4:4:4 set.
565 YUV10_422_Planar_LE_Rec601 = 167,
566 YUV10_422_Planar_LE_Rec2020 = 168,
567 YUV10_422_Planar_LE_Rec2020_PQ = 169,
568 YUV10_422_Planar_LE_Rec2020_HLG = 170,
569 YUV10_444_Planar_LE_Rec601 = 171,
570 YUV10_444_Planar_LE_Rec2020 = 172,
571 YUV10_444_Planar_LE_Rec2020_PQ = 173,
572 YUV10_444_Planar_LE_Rec2020_HLG = 174,
573 YUV12_444_Planar_LE_Rec601 = 175,
574 YUV12_444_Planar_LE_Rec2020 = 176,
575 YUV12_444_Planar_LE_Rec2020_PQ = 177,
576 YUV12_444_Planar_LE_Rec2020_HLG = 178,
577
578 // -- ST 2110-20 wire-format pixel descriptions --
579 //
580 // First-class PixelFormats matching the §6.2 wire
581 // pgroup catalog. CSC pairs these against the
582 // common in-memory formats so the
583 // _videoWirePixelFormat seam at
584 // rtpmediaio.cpp:1585-1594 routes ST 2110-20
585 // sender / receiver paths through the existing
586 // UncompressedVideoPayload::convert pipeline
587 // rather than through bespoke bit-packing inside
588 // the packetizer. Initial set covers Rec.709
589 // (the broadcast lingua franca); HDR Rec.2020 /
590 // BT.2100 + PQ / HLG and full-range YCbCr
591 // variants land alongside their CSC kernels in
592 // E20c-3/c-4.
593 //
594 // 8-bit and 16/16f wire formats reuse existing
595 // PixelFormats where byte-identical (RGB8_sRGB,
596 // YUV8_422_UYVY_Rec709, YUV16_422_UYVY_BE_Rec709,
597 // etc.); the bridge declares them directly.
598 RGB10_BE_2110_sRGB = 219,
599 RGB12_BE_2110_sRGB = 220,
600 YUV10_2110_Rec709 = 221,
601 YUV12_2110_Rec709 = 222,
602 YUV10_422_2110_Rec709 = 223,
603 YUV12_422_2110_Rec709 = 224,
604 YUV10_420_2110_Rec709 = 225,
605 YUV12_420_2110_Rec709 = 226,
606 Mono10_BE_2110_sRGB = 227,
607 Mono12_BE_2110_sRGB = 228,
608 XYZ12_BE_2110 = 229,
609 XYZ16_BE_2110 = 230,
610 YUV8_420_2110_Rec709 = 231,
611
612 // First ID available for runtime-registered types. Set
613 // well clear of the well-known block (currently up to the
614 // low 200s) so the catalog can keep growing — e.g. with
615 // colorimetry variants — without ever colliding with the
616 // runtime range. Well-known < 0x10000 ≤ runtime.
617 UserDefined = 65536
618 };
619
621 using IDList = ::promeki::List<ID>;
622
624 struct CompSemantic {
625 String name;
626 String abbrev;
627 float rangeMin = 0;
628 float rangeMax = 0;
629 };
630
632 struct Data {
633 ID id = Invalid;
634 String name;
635 String desc;
636 PixelMemLayout memLayout;
637 ColorModel colorModel;
638 bool hasAlpha = false;
639 int alphaCompIndex = -1;
640 bool compressed = false;
641 VideoCodec
642 videoCodec;
643 List<ID> encodeSources;
644 List<ID> decodeTargets;
645 FourCC::List fourccList;
646 CompSemantic compSemantics[MaxComps] = {};
647 VideoRange
648 videoRange;
649
656 PaintEngine (*createPaintEngineFunc)(const Data *d,
657 const UncompressedVideoPayload &payload) = nullptr;
658 };
659
665 static ID registerType();
666
672 static void registerData(Data &&data);
673
696 static PixelFormat withColorModel(const PixelFormat &base, ColorModel::ID colorModel);
697
709 static PixelFormat withColorModel(const PixelFormat &base, ColorModel::ID colorModel, VideoRange range);
710
720 static String nameWithColorModel(const String &baseName, ColorModel::ID from, ColorModel::ID to);
721
729 static IDList registeredIDs();
730
744 static PixelFormat lookup(const String &name);
745
765 static PixelFormat lookup(const String &name, Error *err);
766
774 static Result<PixelFormat> fromString(const String &name) {
775 Error err;
776 PixelFormat p = lookup(name, &err);
777 if (err.isError()) return makeError<PixelFormat>(err);
778 return makeResult(p);
779 }
780
785 inline PixelFormat(ID id = Invalid);
786
788 bool isValid() const { return d != nullptr && d->id != Invalid; }
789
791 ID id() const { return d->id; }
792
794 const String &name() const { return d->name; }
795
797 String toString() const { return d->name; }
798
800 const String &desc() const { return d->desc; }
801
803 const PixelMemLayout &memLayout() const { return d->memLayout; }
804
806 const ColorModel &colorModel() const { return d->colorModel; }
807
825 VideoRange videoRange() const { return d->videoRange; }
826
828 bool hasAlpha() const { return d->hasAlpha; }
829
831 int alphaCompIndex() const { return d->alphaCompIndex; }
832
834 bool isCompressed() const { return d->compressed; }
835
843 const VideoCodec &videoCodec() const { return d->videoCodec; }
844
854 const List<ID> &encodeSources() const { return d->encodeSources; }
855
865 const List<ID> &decodeTargets() const { return d->decodeTargets; }
866
868 const FourCC::List &fourccList() const { return d->fourccList; }
869
871 size_t compCount() const { return d->memLayout.compCount(); }
872
878 const CompSemantic &compSemantic(size_t index) const { return d->compSemantics[index]; }
879
881 size_t planeCount() const { return d->memLayout.planeCount(); }
882
893 int chromaFormatIDC() const {
894 switch (d->memLayout.sampling()) {
895 case PixelMemLayout::Sampling444: return 3;
896 case PixelMemLayout::Sampling422: return 2;
897 case PixelMemLayout::Sampling420: return 1;
898 default: return 0;
899 }
900 }
901
909 int bitsPerComponent() const {
910 return compCount() ? static_cast<int>(d->memLayout.compDesc(0).bits) : 0;
911 }
912
919 int bytesPerComponent() const {
920 const int bits = bitsPerComponent();
921 return bits ? (bits + 7) / 8 : 0;
922 }
923
924 // ---- H.273 colour signalling (encoder VUI policy) ----
925 //
926 // Video encoders turn the caller's colour-description
927 // preferences plus this format's ColorModel / videoRange
928 // into the H.273 codepoints written on the bitstream VUI.
929 // The resolution lives here so every backend (NVENC, x264,
930 // …) signals colour identically.
931
933 static constexpr uint32_t ColorAuto = 255;
934
943 struct H273ColorDescription {
944 uint32_t primaries = 0;
945 uint32_t transfer = 0;
946 uint32_t matrix = 0;
947 uint32_t range = 0;
948 };
949
957 struct VuiColorSignal {
958 bool signalTypePresent = false;
959 bool fullRange = false;
960 bool colorDescriptionPresent = false;
961 uint32_t primaries = 2;
962 uint32_t transfer = 2;
963 uint32_t matrix = 2;
964 };
965
981 H273ColorDescription resolveH273(uint32_t cfgPrimaries = ColorAuto, uint32_t cfgTransfer = ColorAuto,
982 uint32_t cfgMatrix = ColorAuto, uint32_t cfgRange = 0) const;
983
995 static VuiColorSignal vuiColorSignal(const H273ColorDescription &desc);
996
997 // The following methods depend on proav types (ImageDesc, Image,
998 // PaintEngine) — defined in pixelformat.cpp.
999
1006 size_t lineStride(size_t planeIndex, const ImageDesc &desc) const;
1007
1026 int64_t signedLineStride(size_t planeIndex, const ImageDesc &desc) const;
1027
1037 size_t planeSize(size_t planeIndex, const ImageDesc &desc) const;
1038
1047 PaintEngine createPaintEngine(const UncompressedVideoPayload &payload) const;
1048
1063 bool hasPaintEngine() const { return d != nullptr && d->createPaintEngineFunc != nullptr; }
1064
1066 bool operator==(const PixelFormat &o) const { return d == o.d; }
1067
1069 bool operator!=(const PixelFormat &o) const { return d != o.d; }
1070
1072 const Data *data() const { return d; }
1073
1074 private:
1075 const Data *d = nullptr;
1076 static const Data *lookupData(ID id);
1077};
1078
1079inline PixelFormat::PixelFormat(ID id) : d(lookupData(id)) {}
1080
1081PROMEKI_NAMESPACE_END
1082
1083#endif // PROMEKI_ENABLE_PROAV