A video surface’s row stride is the number of bytes needed to move from one scan line to the next. It can exceed the bytes occupied by visible samples on that row. Processing rows with visible width alone can therefore read padding as picture data and gradually misalign the image.
Distinguish pixels, sample bytes and pitch
A width of 1,920 pixels does not mean every format advances by 1,920 bytes per row. Component storage and layout determine the visible row’s byte count, while the allocation can add padding. Microsoft notes that equal image dimensions can have different strides. A conversion routine must use each buffer’s actual row contract rather than infer that its input and output share the same pitch.
Calculate padded line starts
Take an illustrative eight-bit luma plane with 1,920 visible bytes per row and a positive stride of 2,048 bytes. The unused difference is 128 bytes per row. Starting from the first line’s address, the next lines begin at offsets 2,048 and 4,096. Advancing by 1,920 instead starts the second read inside the first row’s padding. Repeating that mistake moves each later read farther away from its intended line start.
Keep padding distinct from a crop
Padding is part of memory organization and does not add visible columns. It should not be interpreted as extra image width or automatically exposed in a saved picture. Planar formats also require separate access to their chroma planes according to their own layout. Copying a whole allocation as though it were a tightly packed image can therefore combine row padding and plane data into a misleading export, even when the decoded samples themselves are correct.
Preserve orientation and both strides
Microsoft’s general image-stride guidance also distinguishes top-down images from bottom-up images, where the signed stride can be negative relative to displayed row order. Its YUV and Direct3D guidance expects top-down organization. A processing handoff should record the first displayed-row pointer, stride sign, source and destination pitches, format and visible dimensions. That makes a row-by-row copy well defined and permits a clear diagnosis of layout mistakes without changing color conversion or compressed-media settings.

