/* attempt to deal with prototype, bootstrap, jquery conflicts */ /* for dropdown menus */

Jump to content

- - - - -

moderately optimizing a JPEG encoder...

4: Adsense

Basically, this is a moderately micro-optimized JPEG encoder.
This version skips out on a few things to try to make encoding a little faster (for example, it uses fixed Huffman tables, ...), and is intended mostly for things like video-capture (where speed is slightly more important than compression or quality).

It hasn't really been well tested yet (say, with a variety of images at different resolutions), but basic tests seem to show it "still working".

Note that this version isn't thread-safe.

code here:

in my current tests though, it is currently pulling off around 50 Mpx/s encoding on my computer (basically, re-encoding a 512x512 frame at around 200 frames/second, or approx: a 360p image at around 290 frames/second, or 720p at 54 frames/second).

I may still see if it can be made much faster, and maybe look into making a thread-safe version (say, so that interleaved multi-threaded encoding can be used).

the reason for this is mostly so that hopefully in-engine video encoding can be made a little faster.

I have since discovered/fixed a few minor issues, as well as modified it to be thread-safe, but haven't put it on pastebin yet.
I have noted that exact performance depends somewhat on the image being compressed.

modified code:

this version adds the capability of being used from multiple threads, and a slight bit more work trying to fine-tune it, before I mostly got distracted and was working on other stuff...

as for in-engine recording: it also seems to be working well enough at 18fps (a little faster than before). I tried 24fps recording, and while this worked, it ate up a bit more HDD space than I was happy with (though dropping the image quality could be an option here). 18fps was chosen as the average of 12 and 24.

Note: GameDev.net moderates comments.