Jump to content
  • Advertisement
Sign in to follow this  
  • entries
    37
  • comments
    37
  • views
    37270

moderately optimizing a JPEG encoder...

Sign in to follow this  
cr88192

1222 views

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:
http://pastebin.com/bPg73PPi


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.


EDIT/ADD:
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.

EDIT/ADD2:
modified code:
http://pastebin.com/G77WBhRu

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.
Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!