vdr-plugin-softhddevice-drm-gles 1.6.2
drmhdr.h
Go to the documentation of this file.
1// SPDX-License-Identifier: AGPL-3.0-or-later
2
16#ifndef __DRMHDR_H
17#define __DRMHDR_H
18
19extern "C" {
20#include <libavutil/frame.h>
21#include <libavutil/mastering_display_metadata.h>
22}
23
24#include <drm_mode.h>
25
26class cVideoRender;
27
33struct vector {
34 float f[4];
35};
36
37struct colorspace {
38 struct vector r, g, b;
40 const char *name;
41 const char *whitepoint_name;
42};
43
47static struct colorspace bt709 = {
48 .r = {{ 0.640f, 0.330f, }},
49 .g = {{ 0.300f, 0.600f, }},
50 .b = {{ 0.150f, 0.060f, }},
51 .whitepoint = {{ 0.3127f, 0.3290f, }},
52 .name = "BT.709",
53 .whitepoint_name = "D65",
54};
55
59static struct colorspace bt2020 = {
60 .r = {{ 0.708f, 0.292f, }},
61 .g = {{ 0.170f, 0.797f, }},
62 .b = {{ 0.131f, 0.046f, }},
63 .whitepoint = {{ 0.3127f, 0.3290f, }},
64 .name = "BT.2020",
65 .whitepoint_name = "D65",
66};
67
68
72static struct colorspace bt470bg = {
73 .r = {{ 0.640f, 0.330f, }},
74 .g = {{ 0.290f, 0.600f, }},
75 .b = {{ 0.150f, 0.060f, }},
76 .whitepoint = {{ 0.3127f, 0.3290f, }},
77 .name = "BT.470 B/G",
78 .whitepoint_name = "D65",
79};
80
81static struct colorspace *const colorspaces[] = {
82 &bt709, &bt2020, &bt470bg,
83};
84
85#define ARRAY_LENGTH(a) (sizeof(a) / sizeof(a)[0])
86static inline struct colorspace *colorspace_lookup(const char *name)
87{
88 unsigned i;
89
90 if (!name)
91 return NULL;
92
93 for (i = 0; i < ARRAY_LENGTH(colorspaces); i++) {
94 struct colorspace *c = colorspaces[i];
95 if (!strcmp(c->name, name))
96 return c;
97 }
98
99 return NULL;
100}
101
120
123#endif
HDR Metadata.
Definition drmhdr.h:105
AVMasteringDisplayMetadata m_mdMetadata
saved mastering display metadata fron AVFrame sidedata
Definition drmhdr.h:116
cHdrMetadata(cVideoRender *render)
Definition drmhdr.h:107
AVContentLightMetadata m_clMetadata
saved content light metadata fron AVFrame sidedata
Definition drmhdr.h:117
int m_colorTrc
saved transfer charateristics
Definition drmhdr.h:115
cVideoRender * m_pRender
pointer to cVideoRender object
Definition drmhdr.h:113
int GetColorPrimaries(void)
Definition drmhdr.h:109
int m_colorPrimaries
saved color primaries
Definition drmhdr.h:114
int GetColorTrc(void)
Definition drmhdr.h:110
struct colorspace m_hdr10
hdr colorspace
Definition drmhdr.h:118
Video Renderer.
static struct colorspace bt470bg
BT470bg Color Space.
Definition drmhdr.h:72
static struct colorspace bt2020
BT2020 Color Space.
Definition drmhdr.h:59
static struct colorspace *const colorspaces[]
Definition drmhdr.h:81
static struct colorspace bt709
BT709 Color Space.
Definition drmhdr.h:47
static struct colorspace * colorspace_lookup(const char *name)
Definition drmhdr.h:86
int Build(struct hdr_output_metadata *, int, int, AVFrameSideData *, AVFrameSideData *)
Build an HDR static metadata blob.
Definition drmhdr.cpp:60
#define ARRAY_LENGTH(a)
Definition drmhdr.h:85
struct vector whitepoint
Definition drmhdr.h:39
const char * whitepoint_name
Definition drmhdr.h:41
const char * name
Definition drmhdr.h:40
struct vector r g b
Definition drmhdr.h:38
float f[4]
Definition drmhdr.h:34