Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
Need Forum Guidance? Click here

Search our FPGA Knowledge Articles here.
18972 Discussions

How to Parse a JPEG file instead of PPM

Honored Contributor II



I am currently using the sobel filter design example for OpenCL on FPGA application. I notice that there is two cpp files, one for the host and one which handles the parsing of a ppm file. I find the code quite difficult to understand, and don't want to plagiarise the code, and would therefore like to develop one similar that instead parses a jpeg file to improve my coding knowledge., and use that to load a jpeg file for the sobel filter application instead. How could that be achieved? I have attached the parsing cpp code to this thread, as txt file as cpp is invalid file format. Thanks. 


Thanks in advance 

0 Kudos
1 Reply
Honored Contributor II

a jpeg image is a compressed image. this means you need to decode the image first. This is more complicated than using the uncompressed ppm format. Decoding the jpeg takes time, so if speed is your goal, you might want this to run on the fpga as well. But if you might be able to only pass the image data (not the encoder data) if the encoder data will be unchanged. The steps you will need to run though are 

jpeg file -> decode -> run filter -> do other stuff