aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/images
diff options
context:
space:
mode:
authorGravatar msarett <msarett@google.com>2015-11-11 06:41:01 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-11-11 06:41:02 -0800
commitb5213e69c599c4ca492bd43fd235d698891ce34c (patch)
tree705412fff4c6777bb11b22ade9d46858aef2e028 /src/images
parent8dcdedc4a087ea46ce1e2458d335d60918e56310 (diff)
Change quality settings on SkImageDecoder_libjpeg
It has been demonstrated that higher quality settings really do make a difference in the visual quality of the output image. https://code.google.com/p/chromium/issues/detail?id=385515 https://code.google.com/p/skia/issues/detail?id=3770 We are planning to replace SkImageDecoder with SkCodec, and SkCodec will use the higher quality settings. As a first step, we are using SkCodec as the underlying implementation for BitmapRegionDecoder. CTS tests require that BitmapRegionDecoder be a close match to BitmapFactory (which uses SkImageDecoder), so we must also update the quality of SkImageDecoder to maintain CTS compatibility. BUG=skia: Committed: https://skia.googlesource.com/skia/+/69ad6a9d03dd6f14b7c730465319313725a7c903 Review URL: https://codereview.chromium.org/1412803009
Diffstat (limited to 'src/images')
-rw-r--r--src/images/SkImageDecoder_libjpeg.cpp28
1 files changed, 0 insertions, 28 deletions
diff --git a/src/images/SkImageDecoder_libjpeg.cpp b/src/images/SkImageDecoder_libjpeg.cpp
index c80cd9b64f..58eff75dc9 100644
--- a/src/images/SkImageDecoder_libjpeg.cpp
+++ b/src/images/SkImageDecoder_libjpeg.cpp
@@ -223,35 +223,11 @@ static void set_error_mgr(jpeg_decompress_struct* cinfo, skjpeg_error_mgr* error
}
/**
- * Common code for turning off upsampling and smoothing. Turning these
- * off helps performance without showing noticable differences in the
- * resulting bitmap.
- */
-static void turn_off_visual_optimizations(jpeg_decompress_struct* cinfo) {
- SkASSERT(cinfo != nullptr);
- /* this gives about 30% performance improvement. In theory it may
- reduce the visual quality, in practice I'm not seeing a difference
- */
- cinfo->do_fancy_upsampling = 0;
-
- /* this gives another few percents */
- cinfo->do_block_smoothing = 0;
-}
-
-/**
* Common code for setting the dct method.
*/
static void set_dct_method(const SkImageDecoder& decoder, jpeg_decompress_struct* cinfo) {
SkASSERT(cinfo != nullptr);
-#ifdef DCT_IFAST_SUPPORTED
- if (decoder.getPreferQualityOverSpeed()) {
- cinfo->dct_method = JDCT_ISLOW;
- } else {
- cinfo->dct_method = JDCT_IFAST;
- }
-#else
cinfo->dct_method = JDCT_ISLOW;
-#endif
}
SkColorType SkJPEGImageDecoder::getBitmapColorType(jpeg_decompress_struct* cinfo) {
@@ -420,8 +396,6 @@ SkImageDecoder::Result SkJPEGImageDecoder::onDecode(SkStream* stream, SkBitmap*
SkASSERT(1 == cinfo.scale_num);
cinfo.scale_denom = sampleSize;
- turn_off_visual_optimizations(&cinfo);
-
const SkColorType colorType = this->getBitmapColorType(&cinfo);
const SkAlphaType alphaType = kAlpha_8_SkColorType == colorType ?
kPremul_SkAlphaType : kOpaque_SkAlphaType;
@@ -747,8 +721,6 @@ bool SkJPEGImageDecoder::onDecodeYUV8Planes(SkStream* stream, SkISize componentS
SkASSERT(1 == cinfo.scale_num);
cinfo.scale_denom = 1;
- turn_off_visual_optimizations(&cinfo);
-
#ifdef ANDROID_RGB
cinfo.dither_mode = JDITHER_NONE;
#endif