PYNQ: PYTHON PRODUCTIVITY

Read partial frame from hdmi in

I have pynq z2 board and i am using an incoming hdmi signal of 1080p 60fps for further processing (read frame, do some stuff and so on).
Now i have read the documentation that pynq z2 is not supposed to work with 1080p and it is so in my case as i get things working perfectly for 720p video but 1080p video are not working at all.
Now what i want to do is read partial frame instead for full readframe of 1080p video (preferably central portion, say 100x100 pixels from centre) . Please let me know if it can be done.
I have already tried modifying the configure method in video library to forcefully fix the incoming video resolution to a lower resolution, but it didn’t work, as when i call readframe after that the board just stopped working. The reason i think is that frames are read in cache. Any help in this case is much appreciated.
Regards

i have changed the configure method by modifying “\192.168.2.99\xilinx\pynq\lib\video\hierarchies.py”
line 110
self._vdma.readchannel.mode = VideoMode(input_mode.width,input_mode.height,pixelformat.bits_per_pixel,input_mode.fps)
to
self._vdma.readchannel.mode = VideoMode(1280,720,pixelformat.bits_per_pixel,input_mode.fps)
so that it forcefully reads the incoming video to 720p but this gives error of “hdmi_in.start fails”

Hi @bilal_ahmad,

If the input signal is 1080p @ 60fps you need to resize the image somehow on hardware before moving it to the PS.
You can use the example on the Vitis libraries to do so https://github.com/Xilinx/Vitis_Libraries/tree/master/vision/L1/examples/resize

Mario

Hi @marioruiz
Thanks for your reply. Is there a way to modify the existing base.tcl of pynq z2 to incorporate resize functionality in it.
I have expertise in verilog but new to tcl scripting.

Hi @bilal_ahmad,

I’d recommend to open the Vivado project for the base overlay and do the changes using the IP integrator, it is much easier. Once the design is working you can incorporate the changes to the tcl file.

The example I provided is generic one and will need some configuration from the PS. You can make your own resize version where the input and output sizes are fixed in the hardware, and also use ap_ctrl_none. Therefore no need for software configuration.

Mario