Add optimize_coding setting for JPEG encoding.

Produces smaller encoded output at the expense of encoding time. No visual differences.

sample image 1 (RGB gradients):
default (80): 2.5x slower, 34% smaller
quality 0: 1.7x slower, 52% smaller
quality 20: 2.1x slower, 55% smaller
quality 40: 2.3x slower, 37% smaller
quality 60: 2.5x slower, 36% smaller
quality 100: 3.9x slower, 22% smaller

sample image 2 (photo):
default (80): 2x slower, 8% smaller
quality 0: 1.5x slower, 49% smaller
quality 20: 1.7x slower, 22% smaller
quality 40: 1.9x slower, 15% smaller
quality 60: 1.9x slower, 11% smaller
quality 100: 2x slower, 9% smaller

BUG=skia:3460
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1589593002

Review URL: https://codereview.chromium.org/1589593002
This commit is contained in:
benjaminwagner 2016-01-14 18:13:32 -08:00 committed by Commit bot
parent c55f699e8b
commit 0a35620a16

View File

@ -958,6 +958,7 @@ protected:
cinfo.input_gamma = 1;
jpeg_set_defaults(&cinfo);
cinfo.optimize_coding = TRUE;
jpeg_set_quality(&cinfo, quality, TRUE /* limit to baseline-JPEG values */);
#ifdef DCT_IFAST_SUPPORTED
cinfo.dct_method = JDCT_IFAST;