Rockchip · AI & Linux Hub

Display & audio

Corrupt edges or a green band in Rockchip NV12: check stride and UV offset

The visible width of a picture is not necessarily equal to the distance between two adjacent lines in memory.

Reading aligned Rockchip video buffers as one continuous tight image can result in right-side misalignment or color plane shifts. First obtain the layout from the production buffer interface, rather than just deriving it from the screen size.

Look at the misalignment with a set of numbers

If the picture is 1920 pixels wide and each line of the 8-bit brightness plane actually occupies 2048 bytes, then the next line Y starts 2048 bytes after the previous line. Incrementing by 1920 results in an additional 128 bytes per line. The UV start point also depends on the actual assigned height, plane offset, and buffer tissue.

Make a closely laid out comparison chart

Only for input that is confirmed to be a linear layout, copy the visible Y line by line according to the actual stride, and then copy the UV according to the descriptor. Check the two chromaticity sequences of NV12 and NV21 respectively. Compressed or modified surfaces should follow a conversion path that supports their format.

Which picture to use to judge differences

Save the original descriptor, the converted compact map and the screen display result. The compact graph is correct but displays abnormally, and the scope is mostly in the subsequent display or import process. If the compact graph is also abnormal, fall back to producer format and buffer offset checking.

Fields saved when linear NV12 reads images

field What to decide
Visible width and height Output picture display range
Row step size of Y and UV How many bytes are moved to the next line each time
Plane starting point or offset Where to read colorimetric data
Memory layout identification Can I directly use the CPU to read by row?

Board documentation and references

ArmSoM Sige7

Products and development resources

Check the hardware revision, carrier, image and interfaces in the product documentation. An article association is not evidence that a configuration has been tested.

Explore this topic → · Learning paths →