Tweak jpeg code
Remove code repetition
Clean up jpeg's post decode phase