-
Notifications
You must be signed in to change notification settings - Fork 1.7k
MMAL: Discrepancy of I420 buffer lengths between components #1659
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
It's a requirement of the ISP hardware that the base address of all planes is a multiple of 32 on both input and output sides. All components should accept a port format with a custom stride as long as it meets the other constraints of the port. Your test app isn't checking the return value from mmal_port_format_commit. I would have expected that to have returned an error when you called it with a stride that wasn't a multiple of 64. |
I used assertions before uploading the test app,
In such case, my test program works with a width of 1440.
Not very convenient, but it does the job. |
You appear to have an incorrect view of what stride sets for I420. For your 1440 x 1080 image, you will get a stride of 1472 bytes (as a multiple of 64), and typically you'll get the height aligned up to a multiple of 16 (actually neither the ISP nor video_render enforce that requirement).
is all you should need. format->es->video.[width|height] defines the buffer geometry (ie stride/pitch and plane height) You'll typically see
|
Oh yes, I forgot that stride for I420 is not strictly the stride for one line of luma plane, that's where I got confused. So now I know that both ISP and video_render behave as expected with valid formats, I think my actual problem with buffer sizes comes from other components. I added image_fx inbetween isp and video_render and the discrepancy is there now:
Source: imgfx_output_issue.zip Edit: this might also concern video_splitter, but not resize. |
The original question has been answered. Are you happy to close? |
Not quite, the discrepancy remains with image_fx and video_splitter, even when padding buffer width to a multiple of 64. That's why I changed the title of issue. |
Uh oh!
There was an error while loading. Please reload this page.
Using commit 6b855fb (compared to, say, 01ecfd2), length of I420 output buffers is a little bigger than expected at certain widths : for example, at 1440 pixels of width, even though it's a multiple of 32, the recommended buffer size is as if the supplied width was 1472 pixels.
This may cause subsequent components using such buffers not to function properly, as they do not expect buffers of that size.
Using this minimal use case that converts a RGB frame to I420 using the ISP and passes the resulting buffer to video_render: isp_output_issue.zip
Allocation of a pool for the video_render input port was not necessary in order to demonstrate the discrepancy on the ISP side, but it illustrates what buffer size the component expects.
The text was updated successfully, but these errors were encountered: