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

Unified Diff: dm/DM.cpp

Issue 1719073002: Use new jpeg_crop_scanlines() API to optimize jpeg subset decodes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « DEPS ('k') | dm/DMSrcSink.h » ('j') | dm/DMSrcSink.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dm/DM.cpp
diff --git a/dm/DM.cpp b/dm/DM.cpp
index c8b65842d042f660abbf5614407b99fa46e0399d..6b94f83ae1d4b26b0b33053e9c394842d624dd45 100644
--- a/dm/DM.cpp
+++ b/dm/DM.cpp
@@ -239,8 +239,8 @@ static void push_codec_src(Path path, CodecSrc::Mode mode, CodecSrc::DstColorTyp
case CodecSrc::kScanline_Mode:
folder.append("scanline");
break;
- case CodecSrc::kStripe_Mode:
- folder.append("stripe");
+ case CodecSrc::kTile_Mode:
+ folder.append("tile");
break;
case CodecSrc::kSubset_Mode:
folder.append("codec_subset");
@@ -346,9 +346,26 @@ static void push_codec_srcs(Path path) {
// SkJpegCodec natively supports scaling to: 0.125, 0.25, 0.375, 0.5, 0.625, 0.75, 0.875
const float nativeScales[] = { 0.125f, 0.25f, 0.375f, 0.5f, 0.625f, 0.750f, 0.875f, 1.0f };
- const CodecSrc::Mode nativeModes[] = { CodecSrc::kCodec_Mode, CodecSrc::kCodecZeroInit_Mode,
- CodecSrc::kScanline_Mode, CodecSrc::kStripe_Mode, CodecSrc::kSubset_Mode,
- CodecSrc::kGen_Mode };
+ CodecSrc::Mode nativeModes[5];
scroggo 2016/02/22 15:55:03 nit: As long as you're rewriting this code, why no
msarett 2016/02/22 17:38:15 Agreed that's better. I'll fix the color types as
+ nativeModes[0] = CodecSrc::kCodec_Mode;
+ nativeModes[1] = CodecSrc::kCodecZeroInit_Mode;
+ nativeModes[2] = CodecSrc::kGen_Mode;
+ uint32_t numNativeModes;
+ switch (codec->getEncodedFormat()) {
+ case SkEncodedFormat::kJPEG_SkEncodedFormat:
+ nativeModes[3] = CodecSrc::kScanline_Mode;
+ nativeModes[4] = CodecSrc::kTile_Mode;
+ numNativeModes = 5;
+ break;
+ case SkEncodedFormat::kWEBP_SkEncodedFormat:
+ nativeModes[3] = CodecSrc::kSubset_Mode;
+ numNativeModes = 4;
+ break;
+ default:
+ nativeModes[3] = CodecSrc::kScanline_Mode;
+ numNativeModes = 4;
+ break;
+ }
CodecSrc::DstColorType colorTypes[3];
uint32_t numColorTypes;
@@ -381,15 +398,15 @@ static void push_codec_srcs(Path path) {
alphaModes.push_back(kOpaque_SkAlphaType);
}
- for (CodecSrc::Mode mode : nativeModes) {
+ for (uint32_t j = 0; j < numNativeModes; j++) {
// SkCodecImageGenerator only runs for the default colorType
// recommended by SkCodec. There is no need to generate multiple
// tests for different colorTypes.
// TODO (msarett): Add scaling support to SkCodecImageGenerator.
- if (CodecSrc::kGen_Mode == mode) {
+ if (CodecSrc::kGen_Mode == nativeModes[j]) {
// FIXME: The gpu backend does not draw kGray sources correctly. (skbug.com/4822)
if (kGray_8_SkColorType != codec->getInfo().colorType()) {
- push_codec_src(path, mode, CodecSrc::kGetFromCanvas_DstColorType,
+ push_codec_src(path, CodecSrc::kGen_Mode, CodecSrc::kGetFromCanvas_DstColorType,
codec->getInfo().alphaType(), 1.0f);
}
continue;
@@ -398,7 +415,7 @@ static void push_codec_srcs(Path path) {
for (float scale : nativeScales) {
for (uint32_t i = 0; i < numColorTypes; i++) {
for (SkAlphaType alphaType : alphaModes) {
- push_codec_src(path, mode, colorTypes[i], alphaType, scale);
+ push_codec_src(path, nativeModes[j], colorTypes[i], alphaType, scale);
}
}
}
« no previous file with comments | « DEPS ('k') | dm/DMSrcSink.h » ('j') | dm/DMSrcSink.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698