If the model frame is passed directly to RGA, an error may be reported when the target is close to the edge. The business frame and the actual sampling frame should be kept separately to facilitate explanation of position differences after cropping.
View constraints from chroma sampling
Chroma for NV12 is shared by 2×2 luma pixels horizontally and vertically. The legality of cropping starting points and sizes also depends on the RGA generation and format. Check the current librga support table, use its inspection interface to verify the input and output descriptions, and do not generalize the alignment rules of a certain chip to all platforms.
Processing a bounding box
Assume that the business focus area starts from x=101, and the current combination requires an even starting point, which can be expanded to the left to 100 and the right boundary is recalculated. If it has reached the edge of the screen, it needs to be cropped to a valid rectangle before and after expansion. Pass the offset of the business frame relative to the new sampling frame to post-processing.
Use corners to do regression
Select at least the upper left, lower right and very narrow rectangles, and record the actual submission parameters and return values. Ordinary centered targets always pass, but it cannot be proven that corners and tiny targets can also be cropped correctly.
Board documentation and references

- ArmSoM Sige5 · hardware and interface manual · Sige5 · product page
- Rockchip librga interface and constraints
- Building a Reproducible Camera Pipeline with V4L2 and GStreamer
