Skip to content

Commit

Permalink
Remove unwanted images in Gold
Browse files Browse the repository at this point in the history
These extra outputs were caused by recent changes to
push_codec_srcs.
https://codereview.chromium.org/1327433003/

*** First, I would argue that we do not want to test
"native" modes (ex: codec, scanline, etc) to scales
that require sampling (ex: 0.1, 0.2, etc).  Right now,
we are trying to scale jpegs to 0.1, settling for 0.125
as the closest option, and then trying to compare the
0.125 scaled image to the actual 0.1 scaled image in
Gold.

*** Second, I messed up and caused our test setup to
try to decode to kIndex8 and kGray8 "always" instead
of only when it is recommended.  The bad effect of this
happens because we can decode jpegs to kGray8 even if
they are color images.  Right now in Gold, we have a
bunch of untriaged gray versions of color images.

The second issue would have been caught if we signaled
a fatal failure for invalid conversions.  Maybe we should
look into this now that 565 is supported everywhere?

BUG=skia:

Review URL: https://codereview.chromium.org/1314163007
  • Loading branch information
mattsarett authored and Commit bot committed Sep 2, 2015
1 parent 0881b95 commit 36c3796
Showing 1 changed file with 52 additions and 17 deletions.
69 changes: 52 additions & 17 deletions dm/DM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ static void push_codec_src(Path path, CodecSrc::Mode mode, CodecSrc::DstColorTyp
folder.append("stripe");
break;
case CodecSrc::kSubset_Mode:
folder.append("subset");
folder.append("codec_subset");
break;
}

Expand Down Expand Up @@ -260,34 +260,69 @@ static void push_codec_srcs(Path path) {
return;
}

// Choose scales for scaling tests.
// Native Scales
// TODO (msarett): Implement scaling tests for SkImageDecoder in order to compare with these
// tests. SkImageDecoder supports downscales by integer factors.
// SkJpegCodec natively supports scaling to: 0.125, 0.25, 0.375, 0.5, 0.625, 0.75, 0.875
// 0.1, 0.16, 0.2 etc allow us to test SkScaledCodec with sampleSize 10, 6, 5, etc
// 0.4, 0.7 etc allow to test what happens when the client requests a scale that
// does not exactly match a sampleSize or native scaling capability
const float scales[] = { 0.1f, 0.125f, 0.166f, 0.2f, 0.25f, 0.333f, 0.375f, 0.4f, 0.5f, 0.6f,
0.625f, 0.750f, 0.8f, 0.875f, 1.0f };
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::kScanline_Mode,
CodecSrc::kScanline_Subset_Mode, CodecSrc::kStripe_Mode, CodecSrc::kSubset_Mode };

CodecSrc::DstColorType colorTypes[3];
uint32_t numColorTypes;
switch (codec->getInfo().colorType()) {
case kGray_8_SkColorType:
// FIXME: Is this a long term solution for testing wbmps decodes to kIndex8?
// Further discussion on this topic is at skbug.com/3683
colorTypes[0] = CodecSrc::kGetFromCanvas_DstColorType;
colorTypes[1] = CodecSrc::kGrayscale_Always_DstColorType;
colorTypes[2] = CodecSrc::kIndex8_Always_DstColorType;
numColorTypes = 3;
break;
case kIndex_8_SkColorType:
colorTypes[0] = CodecSrc::kGetFromCanvas_DstColorType;
colorTypes[1] = CodecSrc::kIndex8_Always_DstColorType;
numColorTypes = 2;
break;
default:
colorTypes[0] = CodecSrc::kGetFromCanvas_DstColorType;
numColorTypes = 1;
break;
}

const CodecSrc::Mode modes[] = { CodecSrc::kCodec_Mode, CodecSrc::kScaledCodec_Mode,
CodecSrc::kScanline_Mode, CodecSrc::kScanline_Subset_Mode, CodecSrc::kStripe_Mode,
CodecSrc::kSubset_Mode };
for (float scale : nativeScales) {
if (scale != 1.0f && (path.endsWith(".webp") || path.endsWith(".WEBP"))) {
// FIXME: skbug.com/4038 Scaling webp seems to leave some pixels uninitialized/
// compute their colors based on uninitialized values.
continue;
}

for (CodecSrc::Mode mode : nativeModes) {
for (uint32_t i = 0; i < numColorTypes; i++) {
push_codec_src(path, mode, colorTypes[i], scale);
}
}
}

const CodecSrc::DstColorType colorTypes[] = { CodecSrc::kGetFromCanvas_DstColorType,
CodecSrc::kGrayscale_Always_DstColorType, CodecSrc::kIndex8_Always_DstColorType };
// SkScaledCodec Scales
// The native scales are included to make sure that SkScaledCodec defaults to the native
// scaling strategy when possible.
// 0.1, 0.16, 0.2 etc allow us to test SkScaledCodec with sampleSize 10, 6, 5, etc.
// 0.4, 0.7 etc allow to test what happens when the client requests a scale that
// does not exactly match a sampleSize or native scaling capability.
const float samplingScales[] = { 0.1f, 0.125f, 0.166f, 0.2f, 0.25f, 0.333f, 0.375f, 0.4f, 0.5f,
0.6f, 0.625f, 0.750f, 0.8f, 0.875f, 1.0f };

for (float scale : scales) {
for (float scale : samplingScales) {
if (scale != 1.0f && (path.endsWith(".webp") || path.endsWith(".WEBP"))) {
// FIXME: skbug.com/4038 Scaling webp seems to leave some pixels uninitialized/
// compute their colors based on uninitialized values.
continue;
}

for (CodecSrc::Mode mode : modes) {
for (CodecSrc::DstColorType colorType : colorTypes) {
push_codec_src(path, mode, colorType, scale);
}
for (uint32_t i = 0; i < numColorTypes; i++) {
push_codec_src(path, CodecSrc::kScaledCodec_Mode, colorTypes[i], scale);
}
}
}
Expand Down

0 comments on commit 36c3796

Please sign in to comment.