libpromeki 1.0.0-alpha
PROfessional MEdia toolKIt
 
Loading...
Searching...
No Matches
sdistandards.h
Go to the documentation of this file.
1
8#pragma once
9
10
11#include <promeki/config.h>
12#if PROMEKI_ENABLE_CORE
13#include <promeki/enums.h>
14#include <promeki/namespace.h>
15
16PROMEKI_NAMESPACE_BEGIN
17
36// ============================================================================
37// SdiLinkStandard helpers
38// ============================================================================
39
50inline int sdiCableCount(const SdiLinkStandard &standard) {
51 if (standard == SdiLinkStandard::Auto) return 0;
52 if (standard == SdiLinkStandard::DL_HD) return 2;
53 if (standard == SdiLinkStandard::DL_3GB) return 2;
54 if (standard == SdiLinkStandard::DL_3G) return 2;
55 if (standard == SdiLinkStandard::QL_3G_SQD) return 4;
56 if (standard == SdiLinkStandard::QL_3G_2SI) return 4;
57 return 1;
58}
59
64inline bool sdiIsDualLink(const SdiLinkStandard &standard) {
65 return standard == SdiLinkStandard::DL_HD ||
66 standard == SdiLinkStandard::DL_3GB ||
67 standard == SdiLinkStandard::DL_3G;
68}
69
74inline bool sdiIsQuadLink(const SdiLinkStandard &standard) {
75 return standard == SdiLinkStandard::QL_3G_SQD ||
76 standard == SdiLinkStandard::QL_3G_2SI;
77}
78
93inline double sdiNominalDataRateGbps(const SdiLinkStandard &standard) {
94 if (standard == SdiLinkStandard::Auto) return 0.0;
95 if (standard == SdiLinkStandard::SL_SD) return 0.270;
96 if (standard == SdiLinkStandard::SL_HD) return 1.485;
97 if (standard == SdiLinkStandard::DL_HD) return 2.970; // 2 × 1.485
98 if (standard == SdiLinkStandard::SL_3GA) return 2.970;
99 if (standard == SdiLinkStandard::SL_3GB) return 2.970;
100 if (standard == SdiLinkStandard::DL_3GB) return 2.970; // 2 × 1.485
101 if (standard == SdiLinkStandard::DL_3G) return 5.940; // 2 × 2.97
102 if (standard == SdiLinkStandard::QL_3G_SQD) return 11.880; // 4 × 2.97
103 if (standard == SdiLinkStandard::QL_3G_2SI) return 11.880; // 4 × 2.97
104 if (standard == SdiLinkStandard::SL_6G) return 5.940;
105 if (standard == SdiLinkStandard::SL_12G) return 11.880;
106 if (standard == SdiLinkStandard::SL_24G) return 23.760;
107 return 0.0;
108}
109
110// ============================================================================
111// SdiWireFormat helpers
112// ============================================================================
113
133inline int sdiBitsPerPixel(const SdiWireFormat &wf) {
134 if (wf == SdiWireFormat::YCbCr_422_10) return 20;
135 if (wf == SdiWireFormat::YCbCr_422_12) return 24;
136 if (wf == SdiWireFormat::YCbCr_444_10) return 30;
137 if (wf == SdiWireFormat::YCbCr_444_12) return 36;
138 if (wf == SdiWireFormat::RGB_444_10) return 30;
139 if (wf == SdiWireFormat::RGB_444_12) return 36;
140 if (wf == SdiWireFormat::RGBA_444_10) return 40;
141 return 0;
142}
143
144PROMEKI_NAMESPACE_END
145
146#endif // PROMEKI_ENABLE_CORE