FPGARelated.com
Forums

Image Compression in an FPGA

Started by rickman July 24, 2015
Someone is looking to generate compressed images in an FPGA to display 
graph data on a browser.  Looking around the GIF, TIFF or PNG formats 
seem rather straightforward to implement.  Anyone know of an 
implementation of one of these in an HDL?  It doesn't need to implement 
the entire standard, just enough to generate one image style.

-- 

Rick
rickman <gnuarm@gmail.com> wrote:
> Someone is looking to generate compressed images in an FPGA to display > graph data on a browser. Looking around the GIF, TIFF or PNG formats > seem rather straightforward to implement. Anyone know of an > implementation of one of these in an HDL? It doesn't need to implement > the entire standard, just enough to generate one image style.
Does it actually need to be compressed, or will wrapping headers around uncompressed data be enough? All of those have uncompressed formats that will be accepted by a web browser - that may suffice if you aren't concerned about bandwidth, and would be easier to implement. Theo
On 7/25/2015 2:19 PM, Theo Markettos wrote:
> rickman <gnuarm@gmail.com> wrote: >> Someone is looking to generate compressed images in an FPGA to display >> graph data on a browser. Looking around the GIF, TIFF or PNG formats >> seem rather straightforward to implement. Anyone know of an >> implementation of one of these in an HDL? It doesn't need to implement >> the entire standard, just enough to generate one image style. > > Does it actually need to be compressed, or will wrapping headers around > uncompressed data be enough? All of those have uncompressed formats that > will be accepted by a web browser - that may suffice if you aren't concerned > about bandwidth, and would be easier to implement.
Yes, I suspect he can even use a fully uncompressed format like bitmap. His requirements to be for the format to be "widely supported" which doesn't indicate how recent the browsers need to be and to produce the image files with little working memory. He seems to like SVG which seems to meet the latter requirement well if meeting the former requirement is a bit fuzzy. It looks like nearly all browsers currently support SVG but only the more recent versions of some. He does not seem to be limited to connection bandwidth and has not indicated his needed update rate. This guy often posts discussion points without giving details until you offer a solution that does not meet one of the unmentioned requirements. Looks like SVG may be the way he goes. -- Rick

"rickman" <gnuarm@gmail.com> wrote in message 
news:moufqn$8d1$1@dont-email.me...
> Someone is looking to generate compressed images in an FPGA to display > graph data on a browser. Looking around the GIF, TIFF or PNG formats seem > rather straightforward to implement. Anyone know of an implementation of > one of these in an HDL? It doesn't need to implement the entire standard, > just enough to generate one image style.
There are lots of JPEG encoders out there. Maybe use one? Tomas D.
On 7/26/2015 5:24 PM, Tomas D. wrote:
> "rickman" <gnuarm@gmail.com> wrote in message > news:moufqn$8d1$1@dont-email.me... >> Someone is looking to generate compressed images in an FPGA to display >> graph data on a browser. Looking around the GIF, TIFF or PNG formats seem >> rather straightforward to implement. Anyone know of an implementation of >> one of these in an HDL? It doesn't need to implement the entire standard, >> just enough to generate one image style. > > There are lots of JPEG encoders out there. Maybe use one?
Thanks for the advice. I will use it in the spirit it was intended. :) -- Rick
rickman <gnuarm@gmail.com> wrote:
> He seems to like SVG which seems to meet the latter requirement well if > meeting the former requirement is a bit fuzzy. It looks like nearly all > browsers currently support SVG but only the more recent versions of some.
If you're just plotting X/Y then SVG may suffice, if you can make a suitable wrapper around it. One other thought - get the browser to do the work. Just emit the data in whatever format you fancy - JSON is a simple one, but even base64 might work - and then just include some Javascript that plots it in the browser for you. There's lots of libraries for that: http://www.sitepoint.com/15-best-javascript-charting-libraries/ You can just use a URL so don't need the JS framework on the FPGA. Lots of 'analytics' sites do this - download the table of (eg) share prices as XML or JSON and plot locally, rather than plotting server-side. Makes for better interaction too - easier to navigate when your browser has the dataset. Theo
rickman wrote:
> On 7/26/2015 5:24 PM, Tomas D. wrote: >> "rickman" <gnuarm@gmail.com> wrote in message >> news:moufqn$8d1$1@dont-email.me... >>> Someone is looking to generate compressed images in an FPGA to display >>> graph data on a browser. Looking around the GIF, TIFF or PNG formats >>> seem >>> rather straightforward to implement. Anyone know of an >>> implementation of >>> one of these in an HDL? It doesn't need to implement the entire >>> standard, >>> just enough to generate one image style. >> >> There are lots of JPEG encoders out there. Maybe use one? > > Thanks for the advice. I will use it in the spirit it was intended. :) >
JPEG is not very good at reproducing line art with high contrast ratio. For example save a screen capture in TIFF, PNG, and JPEG and you'll see that JPEG gives the most blurring and artefacts unless you set it for very little compression. PNG is quite good at achieving compression on computer-generated images with text or line drawings. -- Gabor
> JPEG is not very good at reproducing line art with high contrast > ratio. For example save a screen capture in TIFF, PNG, > and JPEG and you'll see that JPEG gives the most blurring and > artefacts unless you set it for very little compression. PNG > is quite good at achieving compression on computer-generated > images with text or line drawings.
The reason I've offered JPEG is because it's available on OpenCores and tested to work fine. I am not sure if there's PNG encoder anywhere available for free... And I wonder what's the logic utilization difference.
On 8/2/2015 11:28 AM, Tomas D. wrote:
>> JPEG is not very good at reproducing line art with high contrast >> ratio. For example save a screen capture in TIFF, PNG, >> and JPEG and you'll see that JPEG gives the most blurring and >> artefacts unless you set it for very little compression. PNG >> is quite good at achieving compression on computer-generated >> images with text or line drawings. > > The reason I've offered JPEG is because it's available on OpenCores and > tested to work fine. I am not sure if there's PNG encoder anywhere available > for free... And I wonder what's the logic utilization difference.
The guy is using SVG which is not only much more highly compressed compared to JPG, it is *much* easier to produce. I don't think he has any trouble finding someone to write the code. Even if a core is stated to be "working", you need to do your due diligence and verify any core you use. That is often as much work as writing the core. -- Rick