Vision Systems & Engineering
Camera Interfaces
The link between a camera and its host, one layer below the interface standards, covering what a frame costs in bytes, pixel-format packing in GenICam's PFNC and in Linux V4L2, the MIPI CSI-2 link-rate formula, frame grabbers against network and USB hosts, GenTL producers and consumers, and the open-source acquisition libraries, with an example that packs, unpacks and cross-decodes two 10-bit layouts.
intermediate
A camera interface is the link that carries frames from a camera to the computer that uses them, together with the conventions on both ends that say how the bits of each pixel are laid out and how software finds the camera and receives its buffers. Industrial machine vision tabulates the machine-vision interface standards (GigE Vision, USB3 Vision, Camera Link, Camera Link HS and CoaXPress) and introduces the GenICam stack above them; machine vision cameras describes the camera side, from sensors and binning to pixel formats and bit depth; real-time vision pipelines treats transfer to the host as one stage of a pipeline with its own latency and buffering. This article goes one layer down. It covers what a frame costs in bytes, how 10- and 12-bit pixels are packed in GenICam’s Pixel Format Naming Convention (PFNC) and in the Linux Video4Linux2 (V4L2) API, the formula that turns a MIPI CSI-2 link’s frequency and lanes into a pixel rate, frame grabbers against network and USB hosts, GenICam’s transport-layer interface (GenTL) as a programmer meets it, and the open-source libraries that acquire from such cameras.
The interface standards themselves (the A3 and JIIA documents for GigE Vision, USB3 Vision, Camera Link and CoaXPress, and the MIPI specifications for CSI-2 and its physical layers) were not read for this article and nothing is attributed to them. What is stated comes from documents that are public: the EMVA’s GenICam documents (PFNC 2.5, SFNC 2.8, GenTL 1.6 and the pixel-format value list), the Linux kernel’s media documentation at v7.3, read as a specification of formats and formulas, and the READMEs of two acquisition libraries.
Purpose
Two things can go wrong at the interface: the frame does not fit through the link at the rate the application wants, or it arrives but is decoded with the wrong layout. Both are questions of bits per pixel. A 10-bit pixel can travel as a 16-bit word, wasting six bits, or packed with its neighbours so that four pixels share five bytes; there is more than one way to pack, and the ways differ in which bits go into which byte. Bit depth, packing, resolution and frame rate together set the data rate, and the link’s capacity bounds it. An engineer who knows both can choose a pixel format that fits the link, size buffers correctly and recognize a decoding mismatch when it occurs.
Core Capabilities
What a frame costs
The payload of a frame is its width times its height times the bytes each pixel occupies in the chosen format. SFNC’s PayloadSize is “the number of bytes transferred for each data buffer or chunk on the stream channel”, including any end-of-line or end-of-frame statistics and stamps; the convention says that an image without metadata typically has a payload of width × height × pixel size in bytes, and recommends strongly that software read PayloadSize from the camera instead of relying on that formula (SFNC 2.8, Section 27.2.5). GenTL repeats the warning from the host’s side: a consumer that tries to calculate the payload size from the device configuration gets a calculation that “would never be reliable”, and must instead query the producer or the remote device (GenTL 1.6, Section 5.2.1). In our reading, transport headers, packet framing and blanking periods come on top of the payload; the interface standards that define them were not read.
The arithmetic for one camera, with frame size and data rate derived from requirements, belongs to designing a vision system, and the bandwidth of several cameras sharing a link, with SFNC’s DeviceLinkThroughputLimit for spreading their bursts, to multi-camera systems. Two further link features in the SFNC are DeviceLinkSpeed, which reports the speed negotiated on a link, in the unit the convention writes as Bps, as the total of all its connections (SFNC 2.8, Section 3.35), and DeviceLinkThroughputLimitMode, which switches the limit on or off (Section 3.36).
Pixel formats in GenICam: PFNC
PixelFormat names the layout a camera delivers (SFNC 2.8, Section 4.40), and the PFNC defines how such names are built and what layout they mean. A name has up to five fields: components and location (for example Mono or BayerRG), the number of bits per component, an optional data type, an optional packing style and an optional interface-specific field (PFNC 2.5, Section 2). The PFNC keeps its numeric identifiers in a separate list (Appendix C); in that list, dated 13 May 2026, Mono10, Mono10p and BayerRG10p are PFNC formats and Mono10Packed and BayerRG10Packed are formats defined by GigE Vision 2.0, each with its own 32-bit value.
The PFNC uses lower-case lsb and msb for the least and most significant bit and upper-case LSB and MSB for the least and most significant byte (Section 1.2.2), a distinction that matters when reading its figures. Its packing styles are:
- Unpacked (no tag). Each component starts on a byte boundary. In the default “lsb unpacked” style the value sits in the low bits and the high bits are zero-padded, so
Mono10occupies two bytes with six padding bits at the top (Section 6.1.1, figure 6-2); “msb unpacked” puts the value at the top and must be named explicitly (Section 6.1.2). - Packed (
p). Components follow each other with no bits between them. In the default lsb-packed style, filling starts with bit 0 of byte 0 and each component is appended from its own lsb (Section 6.3.1). ForMono10pthis places the first pixel’s eight low bits in byte 0 and its two high bits in the low bits of byte 1, the second pixel’s six low bits in the rest of byte 1, and so on, four pixels in five bytes (figure 6-9). An msb-packed variant is named withpmsb(Section 6.3.2). - Grouped (
g). The eight most significant bits of each component take a byte of their own, and the remaining low bits of all components are collected in a last byte or bytes (Section 6.4.1). For monochrome formats each pixel is padded to the stated bit count:Mono10g12puts two 10-bit pixels in three bytes, with padding beside each pixel’s two low bits (figure 6-12). The value list of 13 May 2026 assigns a value to no grouped format. - Cluster (
c) and align (a) markers group several monochrome pixels into one unit and pad a pixel or cluster to a stated boundary (Sections 6.2 and 6.5).
PFNC defines lsb ordering as the default for image buffers: unless a name says msb, the layout is lsb (Section 6). Two things it leaves to the standard that references it: whether multi-byte words are stored little- or big-endian (Section 1.4; its figures use little-endian), and whether a packing group may continue across the end of a line (“image padding”) or each line is padded to a byte boundary (“line padding”) (Section 6.7). It also allows an imaging standard to encode pixels differently inside its own boundary, as long as the layout respects the PFNC when the data leave it (Section 1.1). The SFNC says the same of frame grabbers: transport layers with a grabber on the receiving side may code pixels differently on the link, to save bandwidth for example, and then define how the grabber converts the data into a PFNC-compliant format (SFNC 2.8, Section 4.40).
Pixel formats in Linux: V4L2 and CSI-2
V4L2 has its own pixel formats, each with a four-character code. V4L2_PIX_FMT_SRGGB10 (‘RG10’) stores each 10-bit Bayer sample in a 16-bit word with six unused high bits set to zero, in little-endian byte order (Linux v7.3, pixfmt-srggb10.rst). The packed V4L2_PIX_FMT_SRGGB10P (‘pRAA’) packs four consecutive samples into five bytes: each of the first four bytes holds the eight high-order bits of one pixel, and the fifth holds the two least significant bits of each pixel “in the same order”, the first pixel’s in bits 1–0 and the fourth’s in bits 7–6 (pixfmt-srggb10p.rst). The 12-bit version SRGGB12P packs two samples into three bytes the same way, with the four low bits of each pixel in the third byte (pixfmt-srggb12p.rst). These format pages do not mention CSI-2, and the CSI-2 specification was not read, so nothing here says which layout a CSI-2 link itself carries; the planning notes for this article called SRGGB10P the CSI-2 RAW10 layout, and that label, which survives as shorthand in the example’s code, is not relied on.
The two packed 10-bit layouts take the same space and differ in where every bit goes. Mono10p and BayerRG10p keep each pixel’s bits contiguous, starting from the low end; SRGGB10P splits each pixel into a high byte and a 2-bit low part. In our reading, SRGGB10P follows the grouped principle of the PFNC without the per-pixel padding of Mono10g12, and the value list, which assigns a value to no grouped format, gives no PFNC name with this layout. A buffer in one layout decoded as the other has the right size and the wrong values, which the example below measures.
MIPI CSI-2 and the link rate
CSI-2 is a data bus “intended for transferring images from cameras to the host SoC”, defined by the MIPI Alliance (Linux v7.3, tx-rx.rst). On Linux, V4L2 drivers model hardware components as sub-devices, which applications can discover through the media controller’s entities, pads and links and, where the drivers allow it, configure directly through /dev/v4l-subdev* nodes, negotiating formats pad by pad (dev-subdev.rst); the transmitter–receiver guide speaks of the receiver obtaining the link frequency from the transmitter sub-device (tx-rx.rst). The transmitter tells the receiver the bus frequency through the V4L2_CID_LINK_FREQ control, a value that “is not the same as the symbol rate”, and the receiver learns whether the physical layer is D-PHY or C-PHY, and how many data lanes it uses, from the firmware’s endpoint configuration (tx-rx.rst). The sensor’s own clocks are set from the external clock frequency and the link frequency, both normally obtained from system firmware, and the camera-sensor guide insists that no other frequencies be used, since the clock signals leave the SoC and a different frequency may cause harmful effects elsewhere (camera-sensor.rst).
The kernel documentation gives the pixel rate on the bus as
where is the link frequency (link_freq), the number of data lanes (nr_of_lanes), the bits per sample (bits_per_sample), the factor 2 is there because data move on both the rising and the falling edge, and is 16 for D-PHY and 7 for C-PHY (tx-rx.rst). The same page notes that this bus rate is not the pixel rate of the sensor’s pixel array, which the separate V4L2_CID_PIXEL_RATE control reports. A frame also contains idle time: V4L2’s V4L2_CID_HBLANK is the idle period after every line, in pixels, and V4L2_CID_VBLANK the idle period after every frame, in lines, where every line lasts the image width plus horizontal blanking at the pixel rate given by V4L2_CID_PIXEL_RATE (ext-ctrls-image-source.rst). In our reading, a frame rate computed from a pixel rate and the active resolution alone, ignoring blanking and protocol overhead, is therefore an upper bound.
Before entering high-speed mode, a CSI-2 transmitter typically sets the bus briefly to the LP-11 or LP-111 state, for as little as 100 µs; most receivers handle this by themselves, and the kernel provides pre_streamon() and post_streamoff() callbacks for those that need the transmitter held in that state (tx-rx.rst).
Frame grabbers, network and USB hosts
The interfaces divide by what sits on the host. GenTL’s Interface module “represents one physical interface in the system”: for Ethernet-based transport layers a network interface card, for a Camera Link implementation one frame-grabber board (GenTL 1.6, Section 2.2.2). With a grabber, the host-side end of the link is a dedicated card, and the SFNC allows such a transport layer to re-code pixels on the cable and have the grabber convert them to a PFNC format (SFNC 2.8, Section 4.40). Industrial Machine Vision reasons that GigE Vision and USB3 Vision frames arrive through the host’s own network or USB stack, while a frame-grabber interface uses a point-to-point cable into a dedicated card, which bears on how predictable delivery is; its table gives what the public descriptions of each standard state. An embedded camera on CSI-2 is a third case: the receiver is part of the SoC and the driver stack is the kernel’s.
GenTL: producers and consumers
GenTL gives every GenICam interface one software shape. A GenTL producer is a software driver that implements the GenTL interface so that an application or library can access and configure hardware in a generic way and stream image data from a device; a GenTL consumer is any software that uses one or several producers through that interface (GenTL 1.6, Section 2.1.1). A producer is a dynamically loadable library whose file extension is cti, for “Common Transport Interface”, with a C interface, and an installer makes it findable by adding its directory to the GENICAM_GENTL64_PATH (or GENICAM_GENTL32_PATH) environment variable (Section 6.1).
A producer presents a tree of modules: the System module as root, Interface modules (one per physical interface), Device modules (the producer’s proxy for one remote camera), Data Stream modules (one per stream, holding the acquisition engine and the buffer pool) and Buffer modules (one memory buffer each) (Section 2.2). Acquisition follows a fixed chain (Section 5.2): the consumer obtains the payload size from the Data Stream module, or from the remote device’s PayloadSize feature; allocates buffers and announces them to the stream; queues them into the input pool; registers for the New Buffer event; starts acquisition on the host and then sets the camera’s AcquisitionStart; and then loops, waiting for a filled buffer, processing it and re-queuing it. A buffer outside the input pool and the output queue is not written by the acquisition engine, which is how GenTL locks a buffer while the application reads it (Section 5.2.6). The standard notes that the acquisition engine normally keeps extra data with each announced buffer, for example to fill it by DMA (Section 5.2.2), and that a producer may preprocess images in ways that change the format or the buffer size (Section 2.2.5).
Minimal Example
The example writes, from the documents, pack and unpack functions for three 10-bit layouts and checks four things on synthetic data: that each round trip is exact, what each layout costs, what happens when one packing is decoded with the other’s unpacker, and what pixel rates the CSI-2 formula gives. No camera, driver or library is involved; the outcome tests our reproduction of the documented layouts and formula, not any device.
Data. A 64 × 64 synthetic 10-bit test pattern in RGGB Bayer order. Each of the four colour planes (R, Gr, Gb and B, 32 × 32 pixels each) holds every code from 0 to 1023 exactly once: R as a raster ramp , Gr as , Gb as the transpose of the ramp, and B as , a permutation because 397 is odd. There is no randomness. The pixel stream is the image in raster order. The width is a multiple of 4, so no packing group crosses a line end and PFNC’s choice between line and image padding does not arise; packing does not depend on the colour filter, so Mono10p and BayerRG10p share a layout.
Formats. Mono10 (equivalently V4L2 SRGGB10): 16-bit words in little-endian order, as V4L2 states; PFNC leaves the byte order to the standard that references it. SRGGB10P: the V4L2 packed layout described above; in the code and its output, “RAW10” is shorthand for it. Mono10p: PFNC lsb packing, read from figure 6-9. A separate pure-Python packer for each format, written bit by bit from the documents’ bit lists, serves as a reference for the vectorized NumPy code.
Checks and hypotheses.
- C0 (data): each colour plane contains 1024 distinct codes, from 0 to 1023.
- C1 (implementation): each vectorized packer produces the same bytes as its bit-by-bit reference.
- C2 (formula): the implementation of the kernel’s formula gives 160,000,000 pixels per second for D-PHY, a 400 MHz link frequency, 2 lanes and 10 bits per sample, the value of worked out by hand before any script ran.
- H1: every round trip is exact (0 mismatched pixels in each format).
- H2:
SRGGB10PandMono10peach take 5 bytes per 4 pixels (5,120 bytes for the 4,096-pixel pattern);Mono10takes 8 (8,192 bytes). - H3a: in each cross-decoding direction, the number of pixels decoded correctly, overall and at each position within a 4-pixel group, equals the count that a planning script obtained beforehand with the bit-by-bit reference implementation: 4 of 4,096, at positions [1, 0, 0, 3], for
SRGGB10Pbytes read asMono10p, and 7 of 4,096, at [0, 3, 0, 4], forMono10pbytes read asSRGGB10P. - H3b: a derivation, written before any script ran. When
SRGGB10Pbytes are read asMono10p, the pixel at group position 0 decodes as , which can equal only for , the codes whose ten bits repeat a 2-bit pattern. In the same way, position 1 decodes as and can be right only for 16 codes, and position 2 as and only for 64 codes; in general, position with can be right only for the codes , . The hypothesis is that every correctly decoded pixel at positions 0, 1 and 2 has a code in its set. Membership is necessary, not sufficient, since the neighbour’s bits must also match. - H4: arithmetic on the formula, not a test of it. For every setting, the pixel rate at 12 bits is 5/6 of the rate at 10 bits, and at equal settings C-PHY gives 16/7 of the D-PHY rate. Settings: D-PHY at 200, 400 and 800 MHz with 1, 2 and 4 lanes, and C-PHY at 400 MHz with 1, 2 and 4 lanes, each at 10 and 12 bits. Frame rates are printed for 1920 × 1080 from the pixel rate and the active pixels alone, ignoring blanking and protocol overhead; they are upper bounds and decide nothing.
The maximum and mean code errors of cross-decoding are printed as descriptions, with no hypothesis.
What was fixed after a planning script. A planning script, run once after the hypotheses above were written and before the example’s code existed, implemented the bit-by-bit reference alone and printed, on the same pattern, the round trips, the byte counts, the cross-decoding counts and the error statistics. The H3a targets (4 and 7 correct pixels, at positions [1, 0, 0, 3] and [0, 3, 0, 4]) and C0’s bar of 1,024 codes per plane were written from its output. Because that script printed the H1 and H2 outcomes first, H1, H2 and H3a are illustrations of the layouts rather than tests of a prediction; they also cross-check the vectorized code against the reference. H3b, derived before any script, and C2, worked out by hand, are the tests; H4 is arithmetic on the formula.
Departures and runs. The batch plan for this example listed PFNC’s grouped style as optional; it is not coded, because PFNC’s 10-bit monochrome grouped format pads each pixel to 12 bits and no grouped format has a value in the list, and it appears above in prose only. The optional 16-bit Mono10 is included. Checks C0–C2 and the split of H3 into H3a and H3b, cross-decoding in both directions and per group position, the C-PHY rows and the C-PHY/D-PHY ratio, and the exact form of the pattern were added in the example’s plan and approved before the first run. A pilot of the same script printed the same output as the first run shown here, and the script was not changed between them. It runs in well under a second (about 0.05 s); two runs printed identical output. It uses Python 3.13.9 and NumPy 2.3.5 with the standard library’s fractions, reads and writes no files, and contains no code from the Linux kernel or any library: the kernel documentation was read as a specification of formats and of the formula.
import os
for v in ("OPENBLAS_NUM_THREADS", "OMP_NUM_THREADS", "MKL_NUM_THREADS"):
os.environ[v] = "1" # one BLAS thread, set before NumPy is imported
from fractions import Fraction
import numpy as np
# ---- data: 64 x 64 RGGB test pattern, every 10-bit code once in each CFA plane ----
H = W = 64
k = np.arange(32 * 32).reshape(32, 32)
img = np.zeros((H, W), dtype=np.uint16)
img[0::2, 0::2] = k # R
img[0::2, 1::2] = 1023 - k # Gr
img[1::2, 0::2] = k.T # Gb: transpose of the R ramp
img[1::2, 1::2] = (397 * k) % 1024 # B: 397 is odd, so this permutes 0..1023
planes = [img[dy::2, dx::2] for dy, dx in ((0, 0), (0, 1), (1, 0), (1, 1))]
print("C0 distinct codes per plane:", [len(np.unique(p)) for p in planes],
"| min", int(img.min()), "max", int(img.max()))
px = img.ravel() # pixel stream in raster order; W % 4 == 0
N = px.size
# ---- three formats, vectorized ----
def mono10_pack(p): # PFNC Mono10 / V4L2 SRGGB10: 16-bit words, little endian
return p.astype("<u2").tobytes()
def mono10_unpack(b):
return np.frombuffer(b, dtype="<u2").astype(np.uint16)
def raw10_pack(p): # V4L2 SRGGB10P (CSI-2 RAW10 layout)
g = p.reshape(-1, 4).astype(np.uint16)
out = np.empty((g.shape[0], 5), dtype=np.uint8)
out[:, :4] = g >> 2 # 8 high bits of each pixel
out[:, 4] = ((g[:, 0] & 3) | (g[:, 1] & 3) << 2 | (g[:, 2] & 3) << 4 | (g[:, 3] & 3) << 6)
return out.tobytes()
def raw10_unpack(b):
g = np.frombuffer(b, dtype=np.uint8).reshape(-1, 5).astype(np.uint16)
low = np.stack([(g[:, 4] >> (2 * i)) & 3 for i in range(4)], axis=1)
return ((g[:, :4] << 2) | low).ravel()
def mono10p_pack(p): # PFNC Mono10p: lsb packed, 40 bits per 4 pixels
g = p.reshape(-1, 4).astype(np.uint64)
word = g[:, 0] | g[:, 1] << 10 | g[:, 2] << 20 | g[:, 3] << 30
return np.stack([(word >> (8 * i)) & 0xFF for i in range(5)], axis=1).astype(np.uint8).tobytes()
def mono10p_unpack(b):
g = np.frombuffer(b, dtype=np.uint8).reshape(-1, 5).astype(np.uint64)
word = sum(g[:, i] << (8 * i) for i in range(5))
return np.stack([(word >> (10 * i)) & 0x3FF for i in range(4)], axis=1).astype(np.uint16).ravel()
# ---- bit-by-bit reference packers, written separately from the documents' bit lists ----
def bits(v, n): return [(v >> i) & 1 for i in range(n)] # lsb first
def val(bl): return sum(bit << i for i, bit in enumerate(bl))
def ref_mono10(p): return bytes(x for v in p for x in (v & 0xFF, v >> 8))
def ref_raw10(p):
out = []
for i in range(0, len(p), 4):
grp = p[i:i + 4]
out += [val(bits(v, 10)[2:]) for v in grp] # bytes 0-3: bits 9..2
out.append(val([bit for v in grp for bit in bits(v, 10)[:2]])) # byte 4: pixel 0 in bits 1..0
return bytes(out)
def ref_mono10p(p):
stream = [bit for v in p for bit in bits(v, 10)] # each pixel appended from its lsb
return bytes(val(stream[i:i + 8]) for i in range(0, len(stream), 8))
formats = {"Mono10": (mono10_pack, mono10_unpack, ref_mono10),
"SRGGB10P": (raw10_pack, raw10_unpack, ref_raw10),
"Mono10p": (mono10p_pack, mono10p_unpack, ref_mono10p)}
plist = [int(v) for v in px]
print("\nformat bytes bytes/4px bytes at 1920x1080 C1 bytes != reference H1 mismatches")
packed = {}
for name, (pack, unpack, ref) in formats.items():
b = pack(px); packed[name] = b
diff = sum(x != y for x, y in zip(b, ref(plist))) + abs(len(b) - len(ref(plist)))
mism = int(np.count_nonzero(unpack(b) != px))
print(f"{name:9s} {len(b):6d} {Fraction(4 * len(b), N)!s:>9} {len(b) * 1920 * 1080 // N:18d}"
f" {diff:21d} {mism:13d}")
# ---- cross-decoding: one packing read with the other's unpacker ----
def derived_set(pos): # our derivation: codes that can survive at positions 0-2
s = 2 * (pos + 1) # pixel pos is read as (p >> s) + 2**(10 - s) * m
den, cmax = 2**s - 1, 2**(10 - s) - 1
return {min((2**(10 - s) * m) // den, cmax) + 2**(10 - s) * m for m in range(2**s)}
print()
for label, dec in (("RAW10 bytes -> Mono10p unpacker", mono10p_unpack(packed["SRGGB10P"])),
("Mono10p bytes -> RAW10 unpacker", raw10_unpack(packed["Mono10p"]))):
ok = dec == px
err = np.abs(dec.astype(int) - px.astype(int))
pos = [int(ok[i::4].sum()) for i in range(4)]
print(f"{label}: correct {int(ok.sum())}/{N} | per position {pos} | "
f"max error {int(err.max())} | mean error {err.mean():.3f}")
if label.startswith("RAW10"):
outside = [int(sum(int(c) not in derived_set(i) for c in px[i::4][ok[i::4]])) for i in range(3)]
print(f" H3b correct codes outside the derived sets at positions 0, 1, 2: {outside}"
f" | set sizes {[len(derived_set(i)) for i in range(3)]} | position-0 set {sorted(derived_set(0))}")
# ---- CSI-2 link budget: Linux v7.3 Documentation/driver-api/media/tx-rx.rst ----
def pixel_rate(link_freq, lanes, bits_per_sample, phy):
k = {"D-PHY": 16, "C-PHY": 7}[phy]
return Fraction(link_freq * 2 * lanes * 16, k * bits_per_sample)
def show(r):
return f"{int(r):,}" if r.denominator == 1 else f"{float(r):,.1f}"
print("\nC2 pixel_rate(400 MHz, 2 lanes, 10 bit, D-PHY) =", show(pixel_rate(400_000_000, 2, 10, "D-PHY")),
"| expected 160,000,000:", pixel_rate(400_000_000, 2, 10, "D-PHY") == 160_000_000)
FW, FH = 1920, 1080
print(f"\nphy link MHz lanes pixel/s at 10 bit pixel/s at 12 bit 12/10 fps 10 bit fps 12 bit ({FW}x{FH}, no blanking)")
rows = [("D-PHY", f, n) for f in (200, 400, 800) for n in (1, 2, 4)] + [("C-PHY", 400, n) for n in (1, 2, 4)]
for phy, f, n in rows:
r10, r12 = pixel_rate(f * 10**6, n, 10, phy), pixel_rate(f * 10**6, n, 12, phy)
print(f"{phy} {f:8d} {n:5d} {show(r10):>17} {show(r12):>17} {str(r12 / r10):>5}"
f" {float(r10 / (FW * FH)):10.2f} {float(r12 / (FW * FH)):10.2f}")
print("H4 C-PHY / D-PHY at 400 MHz, equal lanes and bits:",
sorted({str(pixel_rate(4 * 10**8, n, b, "C-PHY") / pixel_rate(4 * 10**8, n, b, "D-PHY"))
for n in (1, 2, 4) for b in (10, 12)}))
C0 distinct codes per plane: [1024, 1024, 1024, 1024] | min 0 max 1023
format bytes bytes/4px bytes at 1920x1080 C1 bytes != reference H1 mismatches
Mono10 8192 8 4147200 0 0
SRGGB10P 5120 5 2592000 0 0
Mono10p 5120 5 2592000 0 0
RAW10 bytes -> Mono10p unpacker: correct 4/4096 | per position [1, 0, 0, 3] | max error 1008 | mean error 327.672
H3b correct codes outside the derived sets at positions 0, 1, 2: [0, 0, 0] | set sizes [4, 16, 64] | position-0 set [0, 341, 682, 1023]
Mono10p bytes -> RAW10 unpacker: correct 7/4096 | per position [0, 3, 0, 4] | max error 1017 | mean error 334.764
C2 pixel_rate(400 MHz, 2 lanes, 10 bit, D-PHY) = 160,000,000 | expected 160,000,000: True
phy link MHz lanes pixel/s at 10 bit pixel/s at 12 bit 12/10 fps 10 bit fps 12 bit (1920x1080, no blanking)
D-PHY 200 1 40,000,000 33,333,333.3 5/6 19.29 16.08
D-PHY 200 2 80,000,000 66,666,666.7 5/6 38.58 32.15
D-PHY 200 4 160,000,000 133,333,333.3 5/6 77.16 64.30
D-PHY 400 1 80,000,000 66,666,666.7 5/6 38.58 32.15
D-PHY 400 2 160,000,000 133,333,333.3 5/6 77.16 64.30
D-PHY 400 4 320,000,000 266,666,666.7 5/6 154.32 128.60
D-PHY 800 1 160,000,000 133,333,333.3 5/6 77.16 64.30
D-PHY 800 2 320,000,000 266,666,666.7 5/6 154.32 128.60
D-PHY 800 4 640,000,000 533,333,333.3 5/6 308.64 257.20
C-PHY 400 1 182,857,142.9 152,380,952.4 5/6 88.18 73.49
C-PHY 400 2 365,714,285.7 304,761,904.8 5/6 176.37 146.97
C-PHY 400 4 731,428,571.4 609,523,809.5 5/6 352.73 293.94
H4 C-PHY / D-PHY at 400 MHz, equal lanes and bits: ['16/7']
All three checks held. C0: each colour plane held 1,024 distinct codes, from 0 to 1023. C1: each vectorized packer matched its bit-by-bit reference in every byte (0 differing bytes in all three formats). C2: the formula gave exactly 160,000,000 pixels per second for D-PHY at 400 MHz, 2 lanes and 10 bits.
Size and round trips. H1 held: all three formats returned every pixel unchanged (0 mismatches each). H2 held: both packed layouts took 5,120 bytes, 5 bytes per 4 pixels, and Mono10 8,192, 8 per 4 pixels. At 1920 × 1080 the construction gives 2,592,000 bytes for a packed frame against 4,147,200 unpacked; in our arithmetic the packed frame is 5/8 of the unpacked one, the ratio of 10 bits to 16. That the two packed layouts have exactly the same size is the practical point: a check of buffer length cannot tell them apart.
Cross-decoding. H3a held in both directions. Reading SRGGB10P bytes with the Mono10p unpacker decoded 4 of the 4,096 pixels correctly, at positions [1, 0, 0, 3], and reading Mono10p bytes with the SRGGB10P unpacker decoded 7 correctly, at positions [0, 3, 0, 4], the counts the planning script printed. Every other pixel was wrong. The maximum errors were 1008 and 1017 codes, close to the full range of 1023, and the mean errors 327.672 and 334.764 codes, about a third of the range in our arithmetic. H3b held: none of the correctly decoded pixels at positions 0, 1 and 2 lay outside the derived sets of 4, 16 and 64 codes, and the one correct pixel at position 0 is therefore one of 0, 341, 682 and 1023. In our reading, such a mismatch is not a small bias: almost no pixel survives and the largest errors approach the full code range, so the decoded frame is far from the original rather than slightly off.
Link rate. By the formula, the pixel rate scales with the link frequency and the number of lanes, so 400 MHz on 2 lanes and 200 MHz on 4 lanes give the same 160,000,000 pixels per second at 10 bits; that rate allows at most 77.16 frames per second of 1920 × 1080, an upper bound that ignores blanking and protocol overhead. H4 held as arithmetic: the 12-bit rate was 5/6 of the 10-bit rate in all twelve rows (133,333,333.3 pixels per second in that row, and at most 64.30 frames per second, again ignoring blanking and overhead), and C-PHY gave 16/7 of the D-PHY rate at equal settings. The C-PHY rates are not whole numbers of pixels per second because of the 7 in the denominator.
Ecosystem and Integrations
GenTL consumers. Harvester, a Python library from the GenICam organization on GitHub, acquires images through GenTL producers, can load several producers in one script and manipulates GenICam feature nodes; it is released under the Apache License 2.0 (Harvester README, tag 1.4.3). Its README’s session loads a producer’s .cti file, enumerates devices, sets Width, Height and PixelFormat through the node map, starts acquisition and fetches a buffer whose payload component the session reshapes into a two-dimensional NumPy array: the GenTL acquisition chain above, seen from Python. A frame delivered in a packed format still has to be unpacked into an array of integers, as in the example, before processing.
Aravis. Aravis is a GLib/GObject-based library for video acquisition from GenICam cameras that implements the Gigabit Ethernet and USB3 protocols used by industrial cameras, with a basic Ethernet camera simulator, a simple viewer and a GStreamer plugin; it is released under the LGPL 2.1 or later (Aravis README, tag 0.9.2). Its README states that contributions to its GigE and USB3 protocol code must not be based on the A3 specification documents, because that organization forbids the use of its documents for developing an open-source implementation. Aravis is named here from its README only; its code was not read.
V4L2 and OpenCV. V4L2 supports devices that transmit and receive pixel data, among them camera sensors and CSI-2 receivers in an SoC (tx-rx.rst); its drivers model hardware components as the sub-devices described above. OpenCV’s videoio module reads camera streams through back ends; as Real-Time Vision Pipelines reports, the V4L2 back end of VideoCapture in OpenCV 5.0.0 requests four driver buffers by default and returns the V4L2 buffer timestamp as CAP_PROP_POS_MSEC. The timestamps, sequence numbers and dropped-frame semantics of V4L2 buffers belong to that article, as do multi-camera synchronization with PTP and action commands; the rig-level view is in multi-camera systems.
Downstream formats. Unpacked raw frames can be stored as raw files or in containers that carry raw data, which image file formats covers; colour is reconstructed from the mosaic by demosaicing, described in the Bayer filter and digital camera articles.
Alternatives
- USB Video Class (UVC). The USB device class for video devices; its specification was not read, and nothing is claimed about it here.
- Other camera links. GMSL and FPD-Link are named here only; their documents were not read, and nothing is claimed about them.
- Standard machine-vision interfaces. GigE Vision, USB3 Vision, Camera Link, Camera Link HS and CoaXPress are compared in industrial machine vision, whose table reports what their public descriptions state.
- Vendor libraries. Camera makers’ own acquisition libraries were not read for this article, and nothing is claimed about them.
Versions and Compatibility
The documents read, as of November 2026, are PFNC 2.5 (4 November 2026), the GenICam pixel-format value list of 13 May 2026, SFNC 2.8 (8 April 2026), GenTL 1.6 (4 November 2019), the Linux kernel documentation at tag v7.3 (commit c03c1a1), the Aravis README at tag 0.9.2 (released 26 April 2026 and marked a pre-release on GitHub, alongside 0.8.36, which is not so marked) and the Harvester README at tag 1.4.3 (16 May 2024, the latest release listed). The example ran with Python 3.13.9 and NumPy 2.3.5. Nothing is claimed about versions not read.
In our reading, compatibility at the interface is largely a matter of names. The PFNC defines pixel names and formats so that they can be shared across technologies (Section 1.1), and the value list gives each standardized name a 32-bit identifier (PFNC 2.5, Appendix C). Other names remain in the list: Mono10Packed and BayerRG10Packed are listed as GigE Vision 2.0 formats with values different from Mono10p and BayerRG10p, so a reader of a buffer should dispatch on the exact PixelFormat name or value rather than on the bit depth. Between GenICam and Linux the names differ entirely: SRGGB10P in V4L2 and BayerRG10p in PFNC are both 10-bit packed RGGB formats of five bytes per four pixels, and the example shows that they are not interchangeable. PFNC leaves byte order and line-end padding to the referencing standard, so code that reads 16-bit or packed buffers from more than one source should take both from that standard.
Licences. The PFNC, SFNC and GenTL documents are published by the EMVA. The Linux documentation pages used are under the GFDL 1.1 or later (the userspace-API pages) and the GPL 2.0 (the driver-API pages); they were read as specifications of formats and of the formula, and no kernel code was copied. Harvester is Apache-2.0 and Aravis LGPL-2.1-or-later; neither’s code was read or reproduced.
Limitations
- The interface specifications are not public. The A3 and JIIA standards and the MIPI CSI-2 and PHY specifications were not read; what is stated about them here comes from GenICam, the Linux documentation and published articles. Aravis’s README reports that A3 forbids the use of its documents for open-source implementations.
- Rates from the CSI-2 formula are bus rates. They are not the sensor array’s pixel rate, and a frame rate computed from them and the active resolution ignores horizontal and vertical blanking and protocol overhead, so it is only an upper bound.
- Payload size cannot be computed reliably on the host. SFNC and GenTL both direct software to read the payload size from the device or producer, since metadata and a producer’s preprocessing can change it.
- Equal sizes hide different layouts. The two packed 10-bit layouts have the same size, so only the format name tells them apart; decoding with the wrong one scrambled all but 4 or 7 of 4,096 pixels in the example.
- Conventions left open. PFNC leaves byte order and line-end padding to the referencing standard, and frame grabbers may re-code pixels on the cable, so the layout in host memory is the one the referencing standard or the grabber defines.
- The example tests a reproduction. It checks our implementation of the documented layouts and formula on synthetic data; it does not show what any camera, driver or receiver does.
Related
- Digital Camera
The camera as an imaging system, from lens, shutter and sensor to the image signal processor that demosaics, white-balances, colour-corrects, tone-maps and compresses its output; RAW against processed images, metadata, machine-vision interfaces, camera classes, and where processing breaks the assumptions of vision methods.
- Real-Time Vision Pipelines
How a vision system turns a stream of camera frames into timely decisions, covering frame budgets, latency against throughput, pipelining and threads, queues and dropped frames, timestamps and clock synchronization, and how end-to-end latency is measured.
- Multi-Camera Systems
Rigs of several cameras treated as one instrument, covering topologies, the overlap graph between views, joint extrinsic calibration of more than two cameras and its upkeep in service, the synchronization budget, clock mapping of many streams, and bandwidth on shared links.
- Designing a Computer Vision System
How a working vision system is designed from its requirements, through the choice of sensor, optics, lighting, compute and model, to the data it is trained on, its validation in the field and its maintenance once deployed, with the requirement arithmetic for a measurement station worked through in code.
- Image File Formats
What PNG, TIFF, JPEG files, OpenEXR and RAW containers store, including chunks, tags, sample types, bit depths and metadata; how far each one's dynamic range reaches; and what Pillow, imageio and tifffile return when they read them.
- Bayer Filter
The colour filter array over a single-chip colour sensor, seen as a sampling design, from the Bayer pattern and its four phases to X-Trans, RGBW and Condat's 2 × 3 array, with the Fourier view that places luminance at the origin and colour on carriers.
References
- European Machine Vision Association (2026). GenICam Pixel Format Naming Convention (PFNC), Version 2.5.
- European Machine Vision Association (2026). GenICam Pixel Format Names and Values (list dated 13 May 2026).
- European Machine Vision Association (2026). GenICam Standard Features Naming Convention (SFNC), Version 2.8.
- European Machine Vision Association (2019). GenICam GenTL Standard, Version 1.6.
- The Linux kernel documentation. V4L2_PIX_FMT_SRGGB10P and related 10-bit packed Bayer formats, Documentation/userspace-api/media/v4l/pixfmt-srggb10p.rst (tag v7.3, commit c03c1a1; read November 2026).
- The Linux kernel documentation. V4L2_PIX_FMT_SRGGB10 and related 10-bit Bayer formats expanded to 16 bits, Documentation/userspace-api/media/v4l/pixfmt-srggb10.rst (tag v7.3, commit c03c1a1; read November 2026).
- The Linux kernel documentation. V4L2_PIX_FMT_SRGGB12P and related 12-bit packed Bayer formats, Documentation/userspace-api/media/v4l/pixfmt-srggb12p.rst (tag v7.3, commit c03c1a1; read November 2026).
- The Linux kernel documentation. Pixel data transmitter and receiver drivers, Documentation/driver-api/media/tx-rx.rst (tag v7.3, commit c03c1a1; read November 2026).
- The Linux kernel documentation. Writing camera sensor drivers, Documentation/driver-api/media/camera-sensor.rst (tag v7.3, commit c03c1a1; read November 2026).
- The Linux kernel documentation. Sub-device Interface, Documentation/userspace-api/media/v4l/dev-subdev.rst, and Image Source Control Reference, ext-ctrls-image-source.rst (tag v7.3, commit c03c1a1; read November 2026).
- Aravis project. README.md (GitHub repository AravisProject/aravis at tag 0.9.2, 26 April 2026; read November 2026).
- GenICam Harvester project. README.rst (GitHub repository genicam/harvesters at tag 1.4.3, 16 May 2024; read November 2026).
- MIPI Alliance. MIPI CSI-2, D-PHY and C-PHY specifications (not read; available to members).
- Association for Advancing Automation (A3) and Japan Industrial Imaging Association (JIIA). GigE Vision, USB3 Vision, Camera Link, Camera Link HS and CoaXPress standards (not read).
- USB Implementers Forum. USB Device Class Definition for Video Devices (USB Video Class) (not read).