Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(149)

Side by Side Diff: src/images/SkImageDecoder_libjpeg.cpp

Issue 1589593002: Add optimize_coding setting for JPEG encoding. (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2007 The Android Open Source Project 2 * Copyright 2007 The Android Open Source Project
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 8
9 #include "SkImageDecoder.h" 9 #include "SkImageDecoder.h"
10 #include "SkImageEncoder.h" 10 #include "SkImageEncoder.h"
(...skipping 940 matching lines...) Expand 10 before | Expand all | Expand 10 after
951 cinfo.image_height = bm.height(); 951 cinfo.image_height = bm.height();
952 cinfo.input_components = 3; 952 cinfo.input_components = 3;
953 #ifdef WE_CONVERT_TO_YUV 953 #ifdef WE_CONVERT_TO_YUV
954 cinfo.in_color_space = JCS_YCbCr; 954 cinfo.in_color_space = JCS_YCbCr;
955 #else 955 #else
956 cinfo.in_color_space = JCS_RGB; 956 cinfo.in_color_space = JCS_RGB;
957 #endif 957 #endif
958 cinfo.input_gamma = 1; 958 cinfo.input_gamma = 1;
959 959
960 jpeg_set_defaults(&cinfo); 960 jpeg_set_defaults(&cinfo);
961 cinfo.optimize_coding = TRUE;
961 jpeg_set_quality(&cinfo, quality, TRUE /* limit to baseline-JPEG values */); 962 jpeg_set_quality(&cinfo, quality, TRUE /* limit to baseline-JPEG values */);
962 #ifdef DCT_IFAST_SUPPORTED 963 #ifdef DCT_IFAST_SUPPORTED
963 cinfo.dct_method = JDCT_IFAST; 964 cinfo.dct_method = JDCT_IFAST;
964 #endif 965 #endif
965 966
966 jpeg_start_compress(&cinfo, TRUE); 967 jpeg_start_compress(&cinfo, TRUE);
967 968
968 const int width = bm.width(); 969 const int width = bm.width();
969 uint8_t* oneRowP = oneRow.reset(width * 3); 970 uint8_t* oneRowP = oneRow.reset(width * 3);
970 971
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1023 return SkImageDecoder::kUnknown_Format; 1024 return SkImageDecoder::kUnknown_Format;
1024 } 1025 }
1025 1026
1026 static SkImageEncoder* sk_libjpeg_efactory(SkImageEncoder::Type t) { 1027 static SkImageEncoder* sk_libjpeg_efactory(SkImageEncoder::Type t) {
1027 return (SkImageEncoder::kJPEG_Type == t) ? new SkJPEGImageEncoder : nullptr; 1028 return (SkImageEncoder::kJPEG_Type == t) ? new SkJPEGImageEncoder : nullptr;
1028 } 1029 }
1029 1030
1030 static SkImageDecoder_DecodeReg gDReg(sk_libjpeg_dfactory); 1031 static SkImageDecoder_DecodeReg gDReg(sk_libjpeg_dfactory);
1031 static SkImageDecoder_FormatReg gFormatReg(get_format_jpeg); 1032 static SkImageDecoder_FormatReg gFormatReg(get_format_jpeg);
1032 static SkImageEncoder_EncodeReg gEReg(sk_libjpeg_efactory); 1033 static SkImageEncoder_EncodeReg gEReg(sk_libjpeg_efactory);
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698