GEN-B Engineering Journal

Beyond the Smartphone: Inside GEN-B's Professional HDR and SDR Signal Generation Architecture

Mathematical 10-bit BT.709 and BT.2100 reference patterns, presented through Metal with separate SDR and HDR policies.

Precision Broadcast Engineering

1. A reference generator is defined by its signals

BT.2111 PQ Full

Full-range PQ reference bars. The comparison band is 58%, and black is code 0.

Use: Evaluates full-range PQ HDR signal paths, reference-code integrity, grayscale behavior, and highlight progression.

BT.2111 PQ Narrow

Narrow-range PQ reference bars. Nominal black is code 64, and the comparison band is 58%.

Use: Evaluates narrow-range PQ HDR broadcast chains, code-value handling, ramp continuity, and near-black behavior.

BT.2111 HLG Narrow

Narrow-range HLG reference bars. The 100% bars use codes 940 and 64, and the comparison band is 75%.

Use: Evaluates narrow-range HLG HDR systems, 75% comparison behavior, ramp structure, and broadcast display alignment.

For decades, professional video reference signals have been associated with dedicated broadcast test equipment: rack-mounted signal generators, waveform monitors, calibration instruments, and specialized hardware designed to produce precisely defined digital and analog video signals.

Modern computing architectures have changed what is technically possible.

A contemporary iPhone integrates a central processing unit (CPU), a programmable graphics processing unit (GPU), high-performance memory, display-processing facilities, and external audiovisual connectivity, including USB-C (Universal Serial Bus Type-C) with DisplayPort output, the digital video interface carried on that connector.

GEN-B, developed by Precision Broadcast Engineering (PBE), uses those facilities for television engineering. Its purpose is not to display pictures, simulate broadcast test cards as ordinary images, or apply visual effects. GEN-B selects a reference pattern and presents it through an explicit rendering path.

The reference-signal architecture is native mathematical generation, presented through Metal.

  • Mathematical Standard Dynamic Range (SDR). SDRTenBitPatternEngine generates explicit 10-bit R′G′B′ component values in a 1920 × 1080 raster. Presentation uses ITU-R BT.709 with Extended Dynamic Range (EDR) disabled. ITU-R is the International Telecommunication Union Radiocommunication Sector.
  • Mathematical High Dynamic Range (HDR). Twelve patterns use ITU-R BT.2100 Perceptual Quantization (PQ) or Hybrid Log-Gamma (HLG). PQ and HLG are separate presentation policies. The set includes the color-bar figures of ITU-R BT.2111-3.
  • Mathematical video is a planned architectural extension. It will reuse these reference-pattern definitions and add frame scheduling and temporal signal generation. It is not implemented.

Each mathematical pattern stores explicit 10-bit red, green, and blue component values. SDRTenBitPatternEngine generates the established SDR definitions: GreyScale, Luma, SMPTE RP 219, color fields, European Broadcasting Union (EBU) bars, and mathematical ramps. The twelve HDR patterns use BT.2100 PQ or HLG.

This article describes that architecture: the raster, the pixel format, the color-space tag, and the codes GEN-B stores. Report ITU-R BT.2408-9 discusses operational display of PQ signals, including displays whose peak luminance is below the encoded reference. GEN-B does not implement that report as a processing stage, and it does not change reference codes to suit a particular television.

2. BT.709, BT.1886, BT.2100, and BT.2111

ITU-R BT.709, the SDR foundation

ITU-R BT.709 specifies fundamental image parameters for high-definition television (HDTV), including color primaries, the reference white point, and signal characteristics. It is the foundation for conventional high-definition SDR workflows.

BT.709 is often confused with related but separate ideas: the encoding transfer that relates linear light to a nonlinear signal; the display electro-optical transfer function (EOTF), which relates a video signal to displayed light; the Y′CbCr component form, in which Y′ is luma and Cb and Cr are the blue-difference and red-difference chroma signals, used on many interfaces; and the legal or nominal digital ranges used in transmission. Those ideas are related. They are not interchangeable.

ITU-R BT.1886 is also relevant to SDR reference viewing because it describes a reference EOTF for flat-panel displays in HDTV studio production. GEN-B does not implement BT.1886 in its shader. SDR presentation tags the Metal layer as ITU-R BT.709 and disables EDR. The SDR drawable is bgr10a2Unorm. The fragment shader returns the sampled red, green, and blue values and writes alpha 1. It does not apply a transfer. BGRA, used by ProRes playback, names the memory order blue, green, red, and alpha. Alpha is opacity.

ITU-R BT.2100, the HDR framework

ITU-R BT.2100 establishes image parameters for HDR television production and international programme exchange. It includes two transfer systems.

Perceptual Quantization is an absolute, luminance-oriented system. Its electro-optical transfer function is also specified by Society of Motion Picture and Television Engineers (SMPTE) ST 2084.

Hybrid Log-Gamma is a relative HDR system intended for production and distribution, including operational compatibility considerations.

BT.2100 uses the wide-gamut primaries of ITU-R BT.2020. HDR is not SDR with a higher peak brightness. The relationship among digital codes, displayed luminance, color encoding, and the viewing system is different. In GEN-B, BT.2020 primaries are carried by the BT.2100 PQ or HLG layer color space. The shader does not apply a separate primary-conversion matrix.

ITU-R BT.2111-3, HDR reference color bars

ITU-R BT.2111 defines reference color-bar test patterns for HDR television systems compatible with BT.2100. The edition implemented here is BT.2111-3, approved on 25 May 2025. Its official title is "Specification of colour bar test pattern for high dynamic range television systems."

The recommendation specifies three variants:

  1. HLG Narrow Range.
  2. PQ Narrow Range.
  3. PQ Full Range.

These are distinct signal specifications. The recommendation describes construction for 2K, 4K, and 8K formats. GEN-B implements the 2K raster, 1920 × 1080. It does not generate 4K or 8K BT.2111 rasters. HLG Full is not a BT.2111-3 pattern and is not implemented.

BT.2111-3 itself says the color-bar pattern is not the signal to use for black-level adjustment. That adjustment uses a PLUGE signal. PLUGE means Picture Line-Up Generation Equipment. GEN-B's near-black diagnostic, described later, is a separate pattern. The BT.2111 figure does not replace PLUGE.

3. Mathematical signal architecture

Metal is Apple's graphics and compute framework. A shader is the program the GPU runs while rendering. The external reference surface is one paused Metal view. It draws when the pattern or the drawable size changes. ExternalStillPresentation has three cases: SDR BT.709, HDR PQ, and HDR HLG. Mathematical SDR and HDR share the 10-bit drawable. Color space and EDR select the rendering policy.

Mathematical reference presentation. SDR uses BT.709. PQ and HLG use separate BT.2100 policies.
PropertyMathematical SDRHDR PQHDR HLG
Reference raster1920 × 10801920 × 10801920 × 1080
Drawablebgr10a2Unormbgr10a2Unormbgr10a2Unorm
Components10-bit R′G′B′10-bit R′G′B′10-bit R′G′B′
Color spaceITU-R BT.709ITU-R BT.2100 PQITU-R BT.2100 HLG
EDRDisabledEnabledEnabled
SamplingNearestNearestNearest

Unorm means unsigned normalized. The GPU sees integer codes as values in a normalized numeric interval. Sampling a 10-bit UNORM texture returns code/1023. Writing that value back to a matching attachment stores the code again when the sampler does not blend neighbors.

bgra8Unorm_srgb is intentionally unused. That format would apply the sRGB transfer on write or sample, which is not the BT.709 transfer and would stop the drawable from holding the authored codes.

Figure 01 is this architecture. Mathematical SDR uses BT.709 with EDR off. Mathematical HDR uses BT.2100 PQ or BT.2100 HLG, with EDR on. Bundled ProRes playback is a separate decode: its texture and drawable are bgra8Unorm, tagged BT.709, with EDR off. Sampling that 8-bit texture returns code/255. That playback is not the mathematical video engine in Figure 01. The engine is planned. It will reuse these reference-pattern definitions and add frame scheduling and temporal signal generation.

GEN-B generates mathematical SDR and HDR reference signals and presents them through Metal. SDR uses a 10-bit BT.709 policy. HDR uses separate BT.2100 PQ and HLG policies. A mathematical video engine is a planned extension for frame scheduling and temporal generation.
var drawablePixelFormat: MTLPixelFormat {
    switch self {
    case .sdrBT709:
        return MetalOutputConfiguration.drawablePixelFormat
    case .hdrPQ, .hdrHLG:
        return .bgr10a2Unorm
    }
}

ExternalStillPresentation.swift. MetalOutputConfiguration.drawablePixelFormat is bgr10a2Unorm, the format PQ and HLG return directly. ProRes playback uses bgra8Unorm in MetalVideoPolicy.

4. Native 10-bit SDR

SDRTenBitPatternEngine is the generator for SDR patterns whose 10-bit R′G′B′ definition is established. Colorimetry is ITU-R BT.709. The engine does not apply a transfer, a Y′CbCr matrix, PQ, or HLG. Integer coding uses the 10-bit forms of the studio equations also used by ITU-R BT.601 and ITU-R BT.2020:

Full D = Round(1023 × E′)

Narrow D = Round(876 × E′ + 64)

E′ is the encoded nonlinear component, not emitted light. Full-range black is 0 and full-range white is 1023. Narrow-range black is 64 and narrow-range reference white is 940. Positive rounding is half away from zero, implemented as integer division (numerator + denominator / 2) / denominator.

Each component is a 10-bit value held in a UInt16, then packed with the same bgr10a2Unorm word used by the HDR rasters. Alpha is the opaque value 3. The external pixel source is recorded as procedural and mathematical. MetalOutputRenderer uploads that word buffer into a texture cached per pattern. A later selection of the same pattern reuses the texture.

The layer color space is kCGColorSpaceITUR_709. EDR is off. Because these codes are the reference, the draw forces nearest-neighbor sampling even when the fitted scale would otherwise be linear. Nearest-neighbor selects one source sample. Linear sampling would blend neighboring codes.

SDRTenBitPatternEngine is the reusable foundation for these procedural signals. Established definitions include GreyScale, Luma, SMPTE RP 219, defined color fields, EBU bars, and mathematical ramps. Further reference signals use the same quantization, packing, color space, and sampling when their 10-bit definition is established.

5. SMPTE RP 219 and PLUGE

The SDR broadcast reference is SDRTenBitRP219Pattern, titled SMPTE RP 219 — HD Color Bars + PLUGE. The edition implemented is RP 219-1:2014, High-Definition, Standard-Definition Compatible Color Bar Signal.

The raster is 1920 × 1080, narrow-range BT.709. GEN-B uses the Section 4.1 defaults: sub-pattern *1 is 40% gray, *2 is 75% white, and *3 is 0% black. Sub-patterns *5 and *6 stay at 0% black and 100% white. The optional sub-black valley and super-white peak are not generated. Heights follow Table C.5 for the 1920 × 1080 system: pattern 1 is 630 lines, patterns 2 and 3 are 90 lines each, and pattern 4 is 270 lines.

RP 219-1:2014 segmentation at 1920 × 1080. Rows are numbered from the top.
BandRowsContents
Pattern 10–62940% gray, 75% white, 75% color bars, 40% gray
Pattern 2630–719100% cyan, 75% white, 100% blue
Pattern 3720–809100% yellow, black, narrow ramp, 100% white, 100% red
Pattern 4810–107915% gray sides, black, 100% white, and PLUGE

Pattern 1 widths are the even integers of Table C.1(b): 240, 206, 206, 206, 204, 206, 206, 206, and 240 pixels. The outer 240-pixel columns are 40% gray. The seven 75% bars occupy the centered 1440-pixel 4:3 area. Pattern 4 uses Table C.2(b) inside that same 1440-pixel center, with 240-pixel 15% gray side panels. The PLUGE excursions are −2%, +2%, and +4% on 0% black.

SMPTE RP 219 — HD Color Bars + PLUGE, generated from the same 1920 × 1080 definition as SDRTenBitRP219Pattern. Band heights follow Table C.5. Bar widths follow Tables C.1(b) and C.2(b). Fills are the 8-bit preview of the stored narrow-range 10-bit codes.

Annex B of RP 219-1 publishes Y′CBCR codes. It does not publish R′G′B′. GEN-B stores the component codes produced by the narrow-range equation. Neutral bars and the 75% and 100% primaries and secondaries use that equation directly. Those stored triples forward-map, with BT.709 coefficients KR = 0.2126 and KB = 0.0722, to the Annex B 10-bit Y′CBCR values. The shader does not apply the matrix. The Y′CBCR column below is the interpretation of the stored components, not a second raster.

Narrow-range 10-bit R′G′B′ stored by GEN-B, and the Annex B Y′CBCR values those triples forward-map to.
ReferenceR′G′B′Y′CBCR
0% black64646464512512
100% white940940940940512512
75% white721721721721512512
75% yellow72172164674176543
75% cyan64721721581589176
75% green6472164534253207
75% magenta72164721251771817
75% red7216464204435848
75% blue6464721111848481
40% gray414414414414512512
15% gray195195195195512512
PLUGE −2%46464646512512
PLUGE +2%82828282512512
PLUGE +4%99999999512512

An active 75% channel is 721. An inactive channel is 64, the same integer as 0% black. One hundred percent cyan is (64, 940, 940), 100% yellow is (940, 940, 64), 100% red is (940, 64, 64), and 100% blue is (64, 64, 940). Pattern 3 places 100% yellow in the left 240 pixels, 0% black until x = 446, a narrow ramp from code 64 at x = 446 to code 940 at x = 1473, 100% white until x = 1680, and 100% red in the right 240 pixels.

Pattern 4, from the left, is 240 pixels of 15% gray, then black, 100% white, black, PLUGE −2%, black, PLUGE +2%, black, PLUGE +4%, black, and 240 pixels of 15% gray. The −2% code 46 is below nominal black. It is a black-level reference inside this SMPTE figure. It is not the HDR near-black diagnostic, and it is not the optional Annex B sub-black valley at Y′ code 4.

6. GreyScale and Luma

GreyScale and Luma are mathematically complete. GreyScale is 5 of 5: GreyScale Composite Ramp, Grey Bars, Step Ramp, Grey Ramp, and GreyScale Logarithmic. Luma is 12 of 12: Luma Black Legal Range, Clipping Target, Full Black, Legal White, Luma Grad Step, Luma Gray Scale Steps, Luma Grey Black, Luma Grey Legal Range 235, Mid Grey, Luma RGB Primary Ramp, Luma White 191 75, and Luma White 255. Each raster is procedural full-range or narrow-range BT.709, as its definition requires. The examples below are representative. They are not a dump of every internal field.

Eleven-step grayscale

Luma Gray Scale Steps and Grey Bars share one full-range definition: eleven vertical bars, E′ = index / 10, from code 0 through code 1023. Bar index covers floor(index × 1920 / 11) up to the next edge. The edges are 0, 174, 349, 523, 698, 872, 1047, 1221, 1396, 1570, 1745, and 1920. Those edges match the HDR eleven-step geometry in Section 11. The codes do not. These SDR bars are full-range, from code 0 through code 1023. The HDR pattern stores the BT.2111 PQ Narrow Table 3 codes.

Full-range 10-bit neutral codes for the SDR eleven-step bars. D = Round(1023 × index / 10).
StepE′R′ = G′ = B′Starts at x
0000
10.1102174
20.2205349
30.3307523
40.4409698
50.5512872
60.66141047
70.77161221
80.88181396
90.99211570
10110231745

Mid Grey

Mid Grey is a uniform full-range field at the encoded-signal midpoint, E′ = 0.5. Then R′ = G′ = B′ = Round(1023 × 0.5) = 512. That is the midpoint of the 10-bit code range. It is not a statement that a display emits 50% of its peak luminance.

Clipping Target

Clipping Target is a GEN-B diagnostic, not an SMPTE, EBU, or ITU pattern. It draws two bullseyes on a 1920 × 1080 full-range field. Centers are (512, 540) and (1408, 540). Radii are 128, 256, and 384. A pixel is inside radius r when dx² + dy² ≤ r² + r. The concentric levels use V = 0, 12, 25, 127, 229, 242, and 255. Each stored code is Round(1023 × V / 255).

Clipping Target codes. The left bullseye descends toward black. The right bullseye ascends toward white. The field is code 509.
RegionSource level VStored 10-bit code
Left outer00
Left middle1248
Left inner25100
Background127509
Right inner229919
Right middle242971
Right outer2551023

Mathematical ramps

A linear encoded-signal ramp changes the code in proportion to horizontal position. The full-range GreyScale ramp uses

D(x) = Round(1023 × x / 1919)

so x = 0 is code 0 and x = 1919 is code 1023. The narrow SDR gray ramp uses the same construction from 64 to 940. Equal code steps across the raster are not equal steps of displayed light.

GreyScale linear steps are 32 equal bars, E′ = index / 31, full range, each 60 pixels wide. The logarithmic chart is a different progression. Five rows hold 8, 16, 32, 64, and 128 equal bars. Each row is 200 lines, separated by a 20-line black rule. For a bar after the first,

E′ = 255index / (count − 1) / 255

The first bar is E′ = 1/255, which quantizes to code 4. The last bar of each row is code 1023. Early bars therefore stay near black, and later bars climb toward white. That is a power of the encoded magnitude. It is not a statement that the row is linear in candelas.

The composite ramp stacks four 270-line bands: 16 steps up, a linear ramp up, a linear ramp down, and 16 steps down. Step E′ = index / 15. Luma Grad Step uses the same band height with an ascending ramp, eleven steps up, eleven steps down, and a descending ramp. The primary-color ramp fills the top 720 rows with full-range red, green, and blue in 640-pixel thirds, the next 180 rows with black and white halves, and the bottom 180 rows with the neutral ramp from 0 to 1023.

Several Luma names record an earlier level number. Luma White 191 75 is full-range 75%, code 767. Luma Grey Legal Range 235 is narrow-range white, code 940. Full Legal White is a split field: full-range white 1023 on the left and narrow-range white 940 on the right. Luma Grey Black is narrow black 64 beside full black 0. The external integers are the 10-bit definitions.

7. Building a 10-bit HDR raster

Each HDR red, green, and blue component is a 10-bit unsigned integer from 0 through 1023, which is 1,024 levels. Swift stores each component in a UInt16. That 16-bit container holds a 10-bit value without changing its precision. The components are then packed into 32-bit words for Metal's bgr10a2Unorm format.

Bit fields of one packed pixel. Bit 0 is the least significant bit.
BitsFieldWidth
0–9Blue10
10–19Green10
20–29Red10
30–31Alpha2

P = B + (G << 10) + (R << 20) + (3 << 30)

The symbol << is a left bit shift. Alpha 3 is the maximum 2-bit value, used for an opaque reference pixel. Each component is masked to 10 bits before it is shifted.

The raster contains 1920 × 1080 = 2,073,600 pixels. At four bytes per pixel the buffer is 8,294,400 bytes, about 7.91 mebibytes (MiB). One MiB is 1,048,576 bytes. Row 0 is the top of the picture.

The GPU samples that texture and presents it through a matching 10-bit drawable. The fragment shader does not apply PQ, HLG, a matrix, or a range map. BT.2111 color-bar values are already encoded reference codes. Running the transfer function again would change the signal.

The texture and the drawable both use bgr10a2Unorm. HDR selects the BT.2100 PQ or HLG color space and enables EDR. SDR selects BT.709 and leaves EDR disabled. Mastering-display metadata is not attached to this layer configuration.

Every mathematical SDR and HDR pixel is one 32-bit word. Ten-bit red, green, and blue codes occupy the Metal bgr10a2Unorm fields, and alpha is the opaque value 3.
static func word(red: UInt16, green: UInt16, blue: UInt16, alpha: UInt16 = 3) -> UInt32 {
    let redBits = UInt32(red) & 0x3FF
    let greenBits = UInt32(green) & 0x3FF
    let blueBits = UInt32(blue) & 0x3FF
    let alphaBits = UInt32(alpha) & 0x3
    return blueBits | (greenBits << 10) | (redBits << 20) | (alphaBits << 30)
}

BGR10A2UnormPacking in BT2111PQFullPattern.swift. The same packer is used by mathematical SDR and HDR rasters.

8. PQ, HLG, and narrow-range quantization

A nit is a candela per square metre

A nit is the everyday name for one candela per square metre:

1 nit = 1 cd/m²

The candela is the International System of Units (SI) base unit of luminous intensity. Luminance is luminous intensity per unit of projected area in a stated direction. A lumen measures luminous flux, not luminance.

The PQ transfer functions

PQ relates a normalized encoded signal to absolute luminance. The inverse EOTF encodes luminance into a PQ signal:

V = [(c1 + c2 · Ym₁) / (1 + c3 · Ym₁)]m₂

Y = L / 10000

L is luminance in cd/m². V is the normalized PQ signal. The constants, in the form used by GEN-B's Color Volume generator and in the equivalent reduced fractions, are:

ConstantValue in narrowCode(nits:)Equivalent fraction
m12610 / 163842610 / 16384
m2(2523 / 4096) × 1282523 / 32
c13424 / 40963424 / 4096
c2(2413 / 4096) × 322413 / 128
c3(2392 / 4096) × 322392 / 128

The EOTF recovers luminance from the normalized signal:

L = 10000 · [max(V1/m₂ − c1, 0) / (c2 − c3 · V1/m₂)]1/m₁

The encoding can represent references up to 10,000 cd/m². That does not mean a display produces 10,000 cd/m². Tone mapping and panel limits are display behavior. BT.2408-9 discusses that operational problem. GEN-B's reference codes stay fixed.

The PQ equations relate normalized signal and absolute luminance. GEN-B evaluates the inverse electro-optical transfer function only in the Color Volume generator.

Narrow-range quantization

For the diagnostics that compute a narrow-range code, GEN-B uses the BT.2100 10-bit relationship

D = Round(64 + 876·V)

with the Table 9 rounding rule

Round(x) = Sign(x) × Floor(|x| + 0.5)

Nominal black is code 64. Nominal white is code 940. For V = 0.5,

D = Round(64 + 876 × 0.5) = Round(502) = 502

On these nonnegative values, that rule matches the half-away-from-zero rounding used inside narrowCode(nits:). The unit tests for the 11-step and Color Tracking patterns treat the floor form as the authority.

Full range is a different assignment. PQ Full uses the whole 10-bit scale, including codes 0 and 1023. It does not use the narrow interval 64 to 940. Inactive channels in PQ Full are 0. Inactive channels in the narrow-range patterns are 64.

HLG is not PQ with different numbers

The HLG opto-electronic transfer function (OETF) is piecewise. For normalized scene-linear light E:

E′ = √(3E)   for 0 ≤ E ≤ 1/12

E′ = a · ln(12E − b) + c   for 1/12 < E ≤ 1

with a = 0.17883277, b = 1 − 4a, and c = 0.5 − a · ln(4a). Displayed light still depends on the system transfer and the display. GEN-B does not evaluate this OETF. HLG Narrow stores the Table 2 codes and tags the layer itur_2100_HLG. A shared integer such as 940 is not a PQ luminance when the color space is HLG.

Hybrid Log-Gamma is a relative scene-light system. GEN-B HLG Narrow stores the prescribed Table 2 codes and does not evaluate this transfer function again.
static func narrowCode(nits: Double) -> UInt16 {
    precondition(nits >= 0 && nits <= 10000)
    let m1 = 2610.0 / 16384.0
    let m2 = (2523.0 / 4096.0) * 128.0
    let c1 = 3424.0 / 4096.0
    let c2 = (2413.0 / 4096.0) * 32.0
    let c3 = (2392.0 / 4096.0) * 32.0
    let normalized = nits / 10000.0
    let powered = pow(normalized, m1)
    let signal = pow((c1 + c2 * powered) / (1.0 + c3 * powered), m2)
    let code = Int((64.0 + 876.0 * signal).rounded())
    precondition((64 ... 940).contains(code))
    return UInt16(code)
}

HDRColorVolumeRec2020PQNarrowPattern.narrowCode(nits:). This is the HDR generator that evaluates the PQ inverse EOTF. The color-bar generators do not.

9. The three BT.2111 color-bar figures

GEN-B implements all three BT.2111-3 variants. A shared walker places geometry. Each variant passes its own code table. The walker does not convert one table into another.

The color bars occupy horizontal pixels 240 through 1679. The boundary at 1680 is the start of the right side column, not a bar pixel. The seven widths are 206, 206, 206, 204, 206, 206, and 206. Green is the 204-wide bar, and its left edge is x = 858. The vertical bands are b/12, b/2, b/12, b/12, and b/4, which are 90, 540, 90, 90, and 270 rows.

Table 1 geometry at 0.36 scale. Swatches identify regions. The stored 10-bit codes come from each variant's own table, not from these fills.

PQ Full, Table 4 and ramp Table 6

A 100% white bar is R′ = 1023, G′ = 1023, B′ = 1023. Full-scale red is 1023, 0, 0. The other 100% bars put 1023 on each active channel and 0 on each inactive channel. The 58% bars use 594 on active channels and 0 on inactive channels. Forty percent gray is 409. The grayscale steps are 0, 102, 205, 307, 409, 512, 614, 716, 818, 921, and 1023. Near-black references are 0 for 0%, 19 for +2%, and 41 for +4%. There is no −2% box.

The 58% BT.709 comparison triples are yellow 589, 593, 370; cyan 491, 586, 592; green 479, 585, 355; magenta 552, 348, 584; red 545, 335, 225; and blue 296, 201, 582.

The ramp is 1680 pixels wide, starting at x = 240: 618 pixels at code 0, then one pixel per code from 1 through 1022, then 40 pixels at 1023. The widths 618 + 1022 + 40 equal 1680. The code on a rising pixel is (x − risingOrigin + 1) + floorCode.

PQ Narrow, Table 3 and ramp Table 5

PQ Narrow reference anchors stored by GEN-B. Inactive color channels use 64, not 0.
Reference10-bit code
−7%4
−2% black48
Nominal black, 0%64
+2% black80
+4% black99
40% gray414
58% active channel573
Nominal white, 100%940
109%1019

One hundred percent bars use 940 on active channels and 64 on inactive channels. The source identifies code 4 as the BT.2100 narrow minimum and code 1019 as the narrow maximum. Codes 0 and 1023 are not used. The 58% BT.709 triples are yellow 569, 572, 381; cyan 485, 566, 571; green 474, 565, 368; magenta 537, 362, 564; red 531, 351, 257; and blue 318, 236, 563.

The narrow ramp is flat at code 4 for 559 pixels, then one code per pixel from 5 through 1018 (1014 pixels), then flat at 1019 for 107 pixels. Those widths sum to 1680. Code 64, the 0% level, lands on the left edge of green.

HLG Narrow, Table 2 and ramp Table 5

HLG Narrow uses the same Table 1 geometry and a 75% comparison band, not 58%. An active 75% component is code 721. An inactive component is code 64. One hundred percent digital bars use 940 and 64, the same integers as PQ Narrow 100% bars, stored as Table 2 values rather than computed from PQ. The grayscale steps from −7% through 109% use the same integers as the PQ Narrow steps: 4, 64, 152, 239, 327, 414, 502, 590, 677, 765, 852, 940, and 1019. The ramp widths and endpoints match the PQ Narrow ramp. The layer color space is HLG.

The 75% BT.709 triples are yellow 713, 719, 316; cyan 538, 709, 718; green 512, 706, 296; magenta 651, 286, 705; red 639, 269, 164; and blue 227, 147, 702.

The tests named for Tables 2, 3, 4, 5, and 6 lock these integers, the geometry, the ramp progression, and the presence of low-order bits that an 8-bit quantizer would remove. This article reports those stored values and those tests.

10. Twelve mathematical HDR patterns

Three of the twelve HDR patterns are the BT.2111 color-bar figures. The other nine are GEN-B diagnostics. They use BT.2100 PQ narrow coding and, where noted, individual BT.2111 code anchors. Their geometry is not the BT.2111 color-bar figure. All twelve external rasters are procedural.

Three patterns are the BT.2111-3 color-bar figures. The other nine are GEN-B diagnostics on the HDR PQ path.
PatternClassWhat the generator writes
BT.2111 PQ FullStandard color barsTable 4 codes, Table 6 ramp, HDR PQ
BT.2111 PQ NarrowStandard color barsTable 3 codes, Table 5 ramp, HDR PQ
BT.2111 HLG NarrowStandard color barsTable 2 codes, 75% comparison, HDR HLG
11-step grayscaleGEN-B diagnosticTable 3 neutral steps, 0% through 100% only
Gray rampGEN-B diagnosticEncoded codes from 64 to 940 across x
Multi-window PQGEN-B diagnosticBackground 64, windows 723
HDR clippingGEN-B diagnosticTwelve bands, neutral half and red half
Color trackingGEN-B diagnostic7 × 7 grid, E′ = k/8
Near black detailGEN-B diagnosticEighteen codes around nominal black
Highlight roll-offGEN-B diagnosticCode ramp 509 to 940, then twelve bands
Color volumeGEN-B diagnosticInverse EOTF, then narrow quantization
Saturation sweepGEN-B diagnosticComponent sweeps from neutral 723 toward 64

The SDR gray ramp, described with the native SDR patterns, runs from code 64 to code 940. It is a separate construction from this HDR diagnostic.

11. HDR eleven-step grayscale: stored PQ codes and nominal light

The 11-step HDR pattern is eleven full-height neutral columns, R′ = G′ = B′, across 1920 × 1080. Column edges are floor(i × 1920 / 11) for i from 0 through 11. The resulting edges are 0, 174, 349, 523, 698, 872, 1047, 1221, 1396, 1570, 1745, and 1920. The 50% column is x = 872 through 1046. The SDR eleven-step bars use these same edges with full-range codes 0 through 1023. This pattern does not. It stores PQ Narrow codes.

The percentages are tenths of the normalized PQ signal, E′ = k/10. They are not linear percentages of emitted light. The generator copies the BT.2111 PQ Narrow Table 3 steps for 0% through 100%. It does not include sub-black code 4 or super-white code 1019, and it does not run ST 2084 while filling pixels.

The test testSignalTenthsFollowBT2100NarrowQuantization derives the same integers without reading the production array first:

D = Round(64 + 876 × k/10), using Round(x) = Sign(x) × Floor(|x| + 0.5)

For 40%, 876 × 0.4 = 350.4 and 64 + 350.4 = 414.4. Then Floor(414.4 + 0.5) = Floor(414.9) = 414. For 70%, 876 × 0.7 = 613.2 and 64 + 613.2 = 677.2. Then Floor(677.2 + 0.5) = Floor(677.7) = 677. Successive codes differ by 87 or 88. The nominal luminance steps do not.

Stored 10-bit codes, and the nominal PQ luminance recorded for those codes. GEN-B writes only the code column into the raster.
StepEncoded PQStored R′ = G′ = B′Nominal luminance
00%640 cd/m²
110%1520.33 cd/m²
220%2392.42 cd/m²
330%32710.07 cd/m²
440%41432.29 cd/m²
550%50292.25 cd/m²
660%590245.07 cd/m²
770%677619.57 cd/m²
880%7651,558.44 cd/m²
990%8523,889.14 cd/m²
10100%94010,000 cd/m²

The luminance column is the nominal PQ interpretation documented with this pattern. It is not computed by the generator, it is not stored in the texture, and it is not a photometric measurement. A display with limited peak luminance can keep the darker divisions distinct and still compress the brighter ones. That behavior belongs to the display and the signal path. It is not a reason to change the reference codes.

GEN-B stores the digital codes. The candela-per-square-meter column is the nominal PQ interpretation of those codes, not a value written into the raster and not a measured display luminance.
static let stepPercents = [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100]

static let signalCodes: [UInt16] = stepPercents.map { percent in
    let code = BT2111PQNarrowSignalValues.step(percent)
    precondition(code.red == code.green && code.green == code.blue)
    return code.red
}

HDRGrayscale11StepPQNarrowPattern.swift. The percentages select already-encoded Table 3 codes.

12. Multi-window peak white

The multi-window pattern places six rectangles on nominal black. The background code is 64. Every window is the neutral triple 723, 723, 723. For a neutral pixel, narrowCode(nits: 1000) is 723, and the generator stores 723 as that narrow-range value. The frame loop does not evaluate PQ. It writes one of those two codes.

Code 723 corresponds to the 1,000 cd/m² neutral reference only when R′ = G′ = B′. A color such as (723, 64, 64) is not a 1,000 cd/m² red. That distinction matters again in the saturation sweep.

Stored window rectangles. Areas sum to 822,592 pixels. The rectangles do not overlap.
WindowOriginSizeArea
1(288, 238)64 × 644,096
2(896, 206)128 × 12816,384
3(1472, 142)256 × 25665,536
4(128, 618)384 × 384147,456
5(704, 554)512 × 512262,144
6(1288, 548)624 × 524326,976

Different illuminated areas can provoke different behavior in a display that uses automatic brightness limiting (ABL), local dimming, or another power limit. The pattern holds the encoded white constant so that area can be the variable under observation. The layout is GEN-B geometry, not a BT.2111 figure.

The six windows are the stored artwork rectangles. Each is neutral code 723. Their areas sum to 822,592 pixels.

13. The other HDR diagnostics

Gray ramp

The gray ramp is neutral and continuous in encoded code, not in cd/m². Every row is the same. Integer division gives

code(x) = 64 + ((876 × x + 959) / 1919)

Here 876 is 940 − 64, 1919 is the last column, and 959 is 1919 / 2. The endpoints are the PQ Narrow nominal black and nominal white codes.

Near black detail

Eighteen columns use these codes, left to right: 4, 16, 32, 48, 56, 60, 62, 63, 64, 65, 66, 68, 72, 80, 88, 99, 112, and 128. Codes below 64 are written unchanged. The area below each bar's stored active height is code 64. Codes 4, 48, 64, 80, and 99 match BT.2111 narrow anchors. The other codes are GEN-B diagnostic levels. This staircase is not the BT.2111 color-bar figure and it is not a PLUGE signal.

Highlight roll-off

The top 540 rows are a neutral ramp that is linear in code:

D(x) = 509 + ((431 × x + 959) / 1919)

The span 431 is 940 − 509. The lower half stores twelve neutral codes: 509, 571, 636, 674, 701, 723, 761, 789, 827, 855, 893, and 940. The source also lists descriptive cd/m² anchors beside those bands. Those anchors are not used to generate pixels, and the raster loop does not evaluate ST 2084.

HDR clipping

Twelve horizontal bands, each 90 rows, are split at x = 960. The left half is neutral, R′ = G′ = B′ = D. The right half is R′ = D, G′ = B′ = 64. It is not (D, 0, 0). From top to bottom, D is 614, 682, 751, 785, 820, 854, 871, 888, 906, 923, 937, and 940. Comments in the source give a descriptive luminance for the neutral half. Those comments are not recomputed while the raster is filled. The red half uses the same R′ with the other channels at narrow zero, so it is not the same photometric luminance.

Color tracking

Seven columns, left to right, are gray, red, green, blue, cyan, magenta, and yellow. Seven rows use E′ = k/8 for k = 1 through 7, which is 12.5% through 87.5% of the normalized PQ signal. The stored codes are 174, 283, 393, 502, 612, 721, and 831. Inactive channels are 64. Column edges are 0, 274, 548, 822, 1096, 1370, 1644, and 1920. Row edges are 0, 154, 308, 462, 616, 770, 924, and 1080. The test derives the codes from D = Round(64 + 876 × k/8) using the Table 9 rule, including the half cases 173.5, 392.5, 611.5, and 830.5, which round to 174, 393, 612, and 831.

Color volume

Color Volume is the diagnostic that evaluates the PQ inverse EOTF during generation, then quantizes with D = Round(64 + 876V). The pattern peak used here is 1,000 cd/m², code 723. Full-width hue rows are 1,000, 203, and 100 cd/m², producing component codes 723, 573, and 509. Neutral patches are 0, 26, 100, 162, 203, and 1,000 cd/m², producing 64, 397, 509, 552, 573, and 723. An active channel carries that code. Inactive channels stay at 64. A red patch is BT.2020 red at that red-component code. It is not an equal-luminance color.

Neutral and component codes produced by narrowCode(nits:).
Input luminanceNarrow PQ code
0 cd/m²64
26 cd/m²397
100 cd/m²509
162 cd/m²552
203 cd/m²573
1,000 cd/m²723

Saturation sweep

Six bands, red, green, blue, cyan, magenta, and yellow, are each 180 rows. Every band starts at the neutral triplet 723, 723, 723. The decreasing component is

inactive(x) = 723 − ((659 × x + 959) / 1919)

The span 659 is 723 − 64. The right edge reaches code 64 on the decreasing channels while the active channels remain 723. This is an encoded-component sweep. It is not constant-luminance, not perceptually uniform, and not a hue-saturation-value conversion. HSV means Hue, Saturation, Value. GEN-B does not use that model here.

14. Sampling and the fixed Full HD raster

The source pattern is defined at 1920 × 1080 even when the connected display has another native resolution. Presentation is a centered aspect-fit of that raster. The picture is not stretched, cropped, or filled by GEN-B. Unused drawable area is black. Exact 1:1 is reported only when the fitted rectangle is 1920 × 1080. A 3840 × 2160 drawable is an integer scale of 2.

Mathematical SDR and HDR reference rasters are presented with nearest-neighbor sampling, including when the fitted scale is not an integer. Nearest-neighbor selects one source sample, so the stored code is not blended with its neighbors. A linear sampler exists in the general presentation policy for other catalog images. It is not used on the mathematical reference path.

let preserveReferenceCodes = catalogSourcePrecision == .nativeTenBitBT709

MetalOutputRenderer.draw(in:). When the bound raster is mathematical BT.709, this flag selects nearestSampler.

drawTexturedQuad(
    encoder: encoder,
    pipelineState: hdrPipelineState,
    texture: proceduralTexture,
    sampler: nearestSampler,
    fit: fit,
    drawableSize: drawableSize
)

MetalOutputRenderer.draw(in:). The HDR path passes nearestSampler directly.

15. Switching paths and caching textures

The layer is rewritten only when the pixel format, the EDR flag, or the color-space name changes. Moving from one PQ pattern to another PQ pattern leaves the 10-bit PQ configuration in place and replaces the bound texture. Moving from PQ to HLG changes the color space and keeps the 10-bit format. Returning to SDR keeps bgr10a2Unorm, writes the BT.709 color space, and turns EDR off. A pattern from SDRTenBitPatternEngine then binds its cached mathematical texture.

Each mathematical HDR pattern has its own texture cache. The first build of a missing HDR texture runs off the caller thread. A later selection of the same pattern reuses the texture instead of rebuilding all 2,073,600 pixels. Native SDR textures are cached the same way, per pattern, when the raster is first generated. A generation counter rejects a completion that belongs to an older request. Selecting HDR does not change the presented pattern until the matching frame is acknowledged. The loading indicator appears only when an external display is connected, a mathematical HDR pattern is requested, and the current surface has no valid presented frame.

static let assignsCurrentMode = false
static let externalModePolicy = "ADAPTIVE"

ExternalDisplayAdaptationPolicy. The internal raster stays 1920 × 1080. The transport mode is negotiated outside GEN-B.

16. What this architecture is for

The technical identity of GEN-B is explicit international code tables, procedural 10-bit HDR rasters, native 10-bit BT.709 SDR, color-space tags that match the selected system, nearest sampling of those mathematical textures, and tests that lock the integers and the renderer state.

Those tests lock RP 219 geometry, GreyScale and Luma codes, packed words, PQ versus HLG layer configuration, stale-request rejection, and nearest sampling of the mathematical rasters.

The patterns support visual examination of signal-path configuration, color-component behavior, encoded ramps, near-black handling, highlight separation, and the difference between a reference code and what a particular display can reproduce.

17. Conclusion

GEN-B combines ITU-R and SMPTE reference mathematics with Metal. Native 10-bit SDR stores explicit BT.709 codes. HDR stores prescribed or computed 10-bit codes under BT.2100 PQ or BT.2100 HLG. The shader does not reinterpret those codes. ProRes playback remains a separate 8-bit BGRA decode and is not the planned mathematical video engine.

GEN-B does not redefine broadcast engineering standards.

It implements established reference values as precise digital codes on a computer that fits in your pocket.

Developed by Precision Broadcast Engineering LLC.

Written by

Luis A. Martínez

Founder & Principal Engineer

Precision Broadcast Engineering LLC

References

  1. Recommendation ITU-R BT.709, Parameter values for the HDTV standards for production and international programme exchange.
  2. Recommendation ITU-R BT.1886, Reference electro-optical transfer function for flat panel displays used in HDTV studio production.
  3. Recommendation ITU-R BT.2020, Parameter values for ultra-high definition television systems for production and international programme exchange.
  4. Recommendation ITU-R BT.2100-3 (2025), Image parameter values for high dynamic range television for use in production and international programme exchange.
  5. Recommendation ITU-R BT.2111-3 (05/2025), Specification of colour bar test pattern for high dynamic range television systems. Approved 25 May 2025.
  6. Report ITU-R BT.2408-9 (03/2026), Guidelines for operational practices in high dynamic range television production.
  7. SMPTE ST 2084:2014, High Dynamic Range Electro-Optical Transfer Function of Mastering Reference Displays.
  8. SMPTE RP 219-1:2014, High-Definition, Standard-Definition Compatible Color Bar Signal.
  9. Recommendation ITU-R BT.601, Studio encoding parameters of digital television for standard 4:3 and wide-screen 16:9 aspect ratios.
  10. Apple Developer Documentation, Using color spaces to display HDR content.
  11. Apple Developer Documentation, MTLPixelFormat.
  12. Apple Developer Documentation, CAMetalLayer.
  13. Apple Developer Documentation, CGColorSpace.itur_709.
  14. Apple Developer Documentation, CGColorSpace.itur_2100_PQ.
  15. Apple Developer Documentation, CGColorSpace.itur_2100_HLG.

Nominal 11-step luminances are the values recorded in GEN-B's engineering note HDR-Grayscale-Display-Luminance-Limitations.md. Source excerpts are from the GEN-B implementation on branch feature/metal-output-pipeline, commit a84788e.

Engineered for digital precision

GEN-B implements mathematically defined reference signals through dedicated SDR BT.709 and HDR BT.2100 rendering architectures. Its Metal pipeline preserves the intended digital component values, applies the corresponding color-space configurations, and uses the advanced graphics capabilities of modern Apple hardware for professional reference-signal presentation.

GEN-B

Carry the reference generator with you.

GEN-B is a professional Full HD test-signal generator and display-analysis platform from Precision Broadcast Engineering.