const correctness
jpeg: unified saving codepath