= V4L2 plane data offset
{c}
The \b[V4L2 plane data offset] is the byte distance from the beginning of an <image memory plane> to its image data. It is the `data_offset` member of a <V4L2 plane descriptor>. In this interface, `bytesused` includes that prefix, so the image-data extent is `bytesused - data_offset`.<Buffers in the Linux Kernel video API documentation>[§3.5.3, data_offset definition and note]{ref}
Write $d$ for `data_offset`, $u$ for `bytesused` and $a$ for the plane's `length`, all in <bytes>. A consistent nonnegative extent satisfies
$$
0\leq d\leq u\leq a,\qquad L_{\rm image}=u-d.
$$
If $p$ is the mapped plane-base address, the image begins at $p+d$ and ends immediately before $p+u$. This is an offset within a plane, distinct from the descriptor's `mem_offset` used when arranging a memory mapping.
For an original bounds example, stipulate $a=8192$, $u=6144$ and $d=256$. The image occupies 5888 bytes beginning at byte offset 256. Its last byte is at offset 6143. Taking a length of 6144 from the shifted starting address would instead read through offset 6399, including 256 bytes beyond the declared extent. Conversely, discarding the prefix twice would lose 256 valid bytes.
The offset does not specify <framebuffer stride> or component order. Once the correct image start is found, the negotiated <pixel format> still determines how rows and <color components> are read. A correct extent prevents a boundary mistake; it does not by itself establish that the samples represent the intended image.
Back to article page