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

Advice on how to use 2D Fir Filter Megacore Function?

Altera_Forum
Honored Contributor II
1,359 Views

Hi everyone, 

 

I am a bit of a newbie when it comes to FPGAs, so I hope this question doesnt seem too trivial. I currently have an Altera DE0 University Program Development Kit, and would like to do some simple image processing on it.  

 

Specifically, I would like to access a jpeg image from an SD card, and then provide either smoothing or sharpening to this image via the 2D FIR Filter megacore function. Then, I would like to either save it back to the SD card as a seperate file, so that I can see the effects of the processing on my computer when I take the card out. 

 

To anyone here's knowledge, are there any tutorials on how to do this? I've searched the web for tutorials on how to use the 2D FIR filter, as well as the SD Card, but was largely unsuccessful. 

 

Thanks in advance if anyone can provide some guidance on this.
0 Kudos
6 Replies
Altera_Forum
Honored Contributor II
455 Views

You can't process a JPEG image directly. You will need a JPEG decoder before the filter, and then if you want to save the processed image back as a JPEG you will need a JPEG encoder after the filter. I would suggest that you work with uncompressed images for this project unless you already have access to a JPEG codec. 

 

As for how to use the filter, do some research! It's asking a lot for someone here to walk you through something so complicated.
0 Kudos
Altera_Forum
Honored Contributor II
455 Views

Ahh I see, well I don't think I have access to a JPEG codec at the moment. Would I first need to save the jpeg data bits onto SRAM before I can access it, or can it be read off of the SD card directly? 

 

Also, what I was really looking for was just some guidance on to how to use Qsys to create and use that 2D fir filter. The tutorials that I found for that showed me how to create the object, but I am unsure what I need to connect the data ready, packet start and end, and data bus to. I'm guessing I would connect them to the SRAM or SD card address locations, is this correct? 

 

Sorry if my question was vague, as I am really a beginner at this
0 Kudos
Altera_Forum
Honored Contributor II
455 Views

It would be much better if you convert that jpeg into a bitmap (our some other raw format ) on a pc. That way you can easily steam it in and process it while you steam it.

0 Kudos
Altera_Forum
Honored Contributor II
455 Views

I agree with Tricky - use a program on the PC to convert the .jpg to an uncompressed format and store that on your SD card. IrfanView is a great program for doing this, and it can also convert your processed image back into a .jpg afterward. 

 

http://www.irfanview.com/ 

 

As for Qsys, I'm a dinosaur and like to integrate my own designs so I don't use it. I try to keep the tools out of my way as much as possible. If there's a processor in your design that's a different story, but if not then I can't imagine why anyone would want to use Qsys to stitch a design together when it can be done in verilog in an hour or two. Then you have much more control and fewer tools to learn. Just my personal preference.
0 Kudos
Altera_Forum
Honored Contributor II
455 Views

Ok that is a good suggestion rsefton, essentially I would just need to combine d flip flops and full adders to achieve that? That level of simplicity I can do, but it seemed as if this megacore function may just be an already made solution that could do what I want in a much better fashion.

0 Kudos
Altera_Forum
Honored Contributor II
455 Views

So, just an update in case anyone else has been struggling with this. 

 

I successfully got the SD card IP on my DE0 board to work, and I can now read characters from a file (be it .txt or .bmp). However, I am still unsure how to integrate this with the 2d fir filter IP provided; it seems I need an avalon stream source to connect to the fir filter in sopc builder, but unfortunately the sd card does not qualify for this. 

 

Does anyone have any suggestions where to go from here? Any help would be greatly appreciated.
0 Kudos
Reply