FPGA Intellectual Property
PCI Express*, Networking and Connectivity, Memory Interfaces, DSP IP, and Video IP
6343 Discussions

Video 90/180/270 degree rotate function

Altera_Forum
Honored Contributor II
1,580 Views

Would any one of you experts be able to help with how to design a video rotate function ? It would only need to do the 90 / 180 / -90 degree rotations. 

 

I have VIP video path working for HDMI input output using external HDMI chips and feeding RGB to/from FPGA processing system. I also have DDR2 in the system. I use qsys and VIP blocks for this. Everything works just fine but now I would want to add a rotate function and I am running into trouble. 

 

So basically I would imagine the full frame would first be stored into the DDR2 and then the reading routine would need to be changed. However, there is no access to modify any VIP blocks.. The VIP framebuffer just writes and reads automatically frame by frame... Also, I'm not sure if I'm missing some crucial information such as the DDR cannot be used because each pixel in the 90/-90 rotate would be fetched from different rows and I believe row access is slow on the memory. 

 

480p resolution would be enough for this.. no 1080p is needed. 

 

Appreciate any help!
0 Kudos
5 Replies
Altera_Forum
Honored Contributor II
459 Views

Not really much help, but simply confirming your suspicions: 

 

Yes, you will end up having to re-implement basically all of the functionality embedded within the Frame Buffer. Stream-in, Stream-out, and Avalon-MM Master bursting read/write. 

 

Because your external memory is only efficient when bursting, you will need to manage an onchip cache such that you can burst many pixels at a time, and store them onchip until they are needed. 180 degrees is relatively easy in that you simply burst read from the memory and then output the pixels in reverse order from within that burst. +/- 90 is more complicated in that you need to read a burst from each row and cache the contents of each burst until all of the pixels have been output (i.e. you need 480x the amount of onchip RAM dedicated to caching than you do in the 180 degree case). 

 

Assuming you're in a device with adequate memory capacity, it is overall not a particularly hard function to implement, but some care is needed at the higher pixel rates and/or higher utilization of the external memory, none of which sounds problematic for you.
0 Kudos
Altera_Forum
Honored Contributor II
460 Views

Note that 180 degree rotation requires only a pair of line buffers and not a frame buffer.

0 Kudos
Altera_Forum
Honored Contributor II
459 Views

Thank you for comments. Now I realize 180degree should be very simple actually. 

But 90/-90 looks like very difficult...I use cyclone IV series. 30/40k. 480p 4:2:2 would need ~5.5mbits of internal memory..impossible.
0 Kudos
Altera_Forum
Honored Contributor II
460 Views

Just one more comment. Strictly speaking a 180 degree rotation DOES require a frame buffer. A horizontal "mirror" function requires only a pair of line buffers. This is frequently what is required in a video system.

0 Kudos
Altera_Forum
Honored Contributor II
460 Views

Even if it fit, you don't need to cache all of the frame in M9K. 

 

After you have it implemented, it will be easier to experiment with the trade off of reduced M9K use vs. increased inefficiency in the DDR2 access. But for example, bursts of 64 pixels at a time 480 x 64 x 16bpp = 0.5mbit and burst of 32 pixels only 0.25mbit both of which you ought to be able to fit in those size devices, if you haven't already over committed. 

 

Because 480p is so slow compared to your DDR2, you may be able to get away with much smaller (much more inefficient) bursts e.g. 8 pixels.
0 Kudos
Reply