NV12 row stride is the distance in bytes from the beginning of one stored row to the beginning of the next. A frame described as six pixels wide can have an eight-byte stride in its luma plane. When the planes are contiguous, the actual stored length of the luma rows determines where the chroma bytes begin. A small frame is enough to see how a stride error changes both addresses.
In the linear, contiguous eight-bit NV12 layout used here, the first plane has one Y byte per luma sample. The second plane stores alternating Cb and Cr bytes as pairs. For 4:2:0 sampling the chroma plane has half as many positions as luma horizontally and half as many rows vertically. Each chroma position occupies two bytes. This gives the same active bytes per row for the two planes in this even-width example, though the chroma plane has only half as many rows.
Use the memory layout supplied by the actual interface. A separately allocated planar format may supply independent buffer pointers and strides. A tiled format has storage rules different from simple row addition. The example is a linear six-by-four frame with an eight-byte pitch in both planes and the chroma plane directly after all four stored luma rows.
Each luma row contains six active bytes and two padding bytes. The four row starts are therefore offsets 0, 8, 16 and 24. The plane occupies thirty-two bytes, including padding. With zero-based coordinates, the luma sample at x equal to 4 and y equal to 3 sits at byte offset 3 times 8 plus 4, or 28. The width in pixels describes the valid columns, while the stride locates the next row in memory.

Multiplying the visible width by height gives only twenty-four active luma bytes. In this frame, offset 24 is still the start of the last luma row. Using that value as the chroma start would read either active luma samples or padding as if they were color differences. Advancing through each row by the width instead of the pitch would progressively misplace each subsequent row.
For the same example position, divide its coordinates by two and take the integer parts to get the stored chroma column 2 and row 1. The start of the chroma plane is offset 32. The second stored chroma row begins eight bytes later at offset 40. Each Cb/Cr pair occupies two consecutive bytes. Column 2 therefore starts four bytes into that row, giving Cb at offset 44 and Cr at offset 45.

This identifies the 4:2:0 stored cell associated with the small group of luma positions. A particular image converter’s reconstruction still depends on its chroma siting and interpolation rules. When testing a conversion, store the reported format and siting along with the buffer address calculation. Reading the two bytes in reverse order would represent an NV21-style arrangement, rather than the Cb/Cr convention used here.
A displayed area can be smaller than the coded or allocated frame. A crop changes the local pixel coordinates seen by the viewer, while the source buffer still begins at its own origin and uses its own row pitch. Some APIs expose offsets explicitly. Others provide a plane pointer already adjusted to a requested image map. Confirm the contract before adding a crop offset in a second place.
Padding bytes are allocated storage and usually do not represent visible samples. When saving a tightly packed test fixture, copy only the active bytes from each row and describe its new stride. When inspecting an original buffer returned by a device, respect each row’s declared pitch. Two buffers with the same displayed image can have different byte counts because the storage padding differs.
On an invented patterned frame, mark a luma position in the last row and the Cb/Cr pair in the second chroma row. Check offsets 28, 44 and 45 against a separately constructed byte list. Include a visible difference between the Cb and Cr values so pair order is observable. Save frame width, height, plane base offsets and per-plane pitch with the test data. Those fields make the result reproducible regardless of how the pixels are later displayed.
The contiguous example uses 32 bytes for luma and 16 for chroma, for a total of 48 bytes. Of those, 24 luma bytes and 12 chroma bytes carry active samples. The other twelve bytes are row padding. A tightly packed export of the same samples would use 36 bytes and start the chroma plane at byte 24. Comparing these two byte counts checks the storage convention without relying on the rendered image.
Source notes. Microsoft’s 8-bit YUV formats guide describes the NV12 plane order. The Linux video API reference distinguishes linear contiguous and multi-planar forms and describes subsampling and pitch. The six-by-four layout is invented. Find related material in the image resources and technical article directory.