phoboslab / qoi

The “Quite OK Image Format” for fast, lossless image compression
MIT License
6.92k stars 330 forks source link

QOI on an FPGA (Verilog)! #190

Closed amstan closed 2 years ago

amstan commented 2 years ago

Hey, when I saw how simple the QOI format is (single pass, barely any state), I was wondering how an FPGA implementation would fare (I've been doing FPGA image transporting recently, so it was fresh on my mind). I noticed nobody else has done it, so here's my implementation: https://github.com/amstan/qoi-fpga!

For now I have it implemented in a simulator (verilator), with that I'm able to have drop in replacement functions (see the shim file) for qoi_{encode,decode}, which are linked back into qoiconv and the other tools for easier testing.

Hooking up to a real FPGA system (like a memory map and DMA) is still TODO, but should be very possible, I have all the "knobs" exposed.

Besides verilog, I also have plans to implement QOI using LiteX, which is another framework/python dialect used to develop fpga systems.

Once encoders/decoders become a thing in hardware, things could get ridiculous: HDMI screen capture cards, webcams providing lossless compressed QOI images. Devices like like DisplayLink using QOI to compress the screen contents to save USB bandwidth (though, I think they already implement their own RLE format, but it would be cool if they used the now a standard QOI). Linux kernel V4L framework having an option for QOI encoded streams (as opposed to MJPG). I2C/SPI displays allowing QOI encoding for higher framerate.

oscardssmith commented 2 years ago

QOI probably isn't suitable for dsc some it doesn't support 10 bit or 12 bit images.