Remove debug checks for unsupported ICC profiles

This was never fully integrated with our automated image testing.
I feel it has limited usefulness in terms of catching bugs.

Bug: skia:
Change-Id: Iecd0a4e9b664ab0b351debde45ada864379de7ec
Reviewed-on: https://skia-review.googlesource.com/19267
Reviewed-by: Leon Scroggins <scroggo@google.com>
Reviewed-by: Matt Sarett <msarett@google.com>
Commit-Queue: Matt Sarett <msarett@google.com>
This commit is contained in:
Matt Sarett 2017-06-09 10:18:34 -04:00 committed by Skia Commit-Bot
parent 1aa2369883
commit ee7c8202eb
5 changed files with 1 additions and 42 deletions

View File

@ -848,8 +848,6 @@ protected:
return 0;
}
void setUnsupportedICC(bool SkDEBUGCODE(value)) { SkDEBUGCODE(fUnsupportedICC = value); }
private:
const SkEncodedInfo fEncodedInfo;
const SkImageInfo fSrcInfo;
@ -868,9 +866,6 @@ private:
int fCurrScanline;
bool fStartedIncrementalDecode;
#ifdef SK_DEBUG
bool fUnsupportedICC = false;
#endif
/**
* Return whether these dimensions are supported as a scale.
@ -935,7 +930,5 @@ private:
friend class DM::CodecSrc; // for fillIncompleteImage
friend class SkSampledCodec;
friend class SkIcoCodec;
friend struct Sniffer; // for fUnsupportedICC
friend class AutoCleanPng; // for setUnsupportedICC()
};
#endif // SkCodec_DEFINED

View File

@ -225,7 +225,6 @@ bool SkJpegCodec::ReadHeader(SkStream* stream, SkCodec** codecOut, JpegDecoderMg
Origin orientation = get_exif_orientation(decoderMgr->dinfo());
sk_sp<SkData> iccData = get_icc_profile(decoderMgr->dinfo());
sk_sp<SkColorSpace> colorSpace = nullptr;
bool unsupportedICC = false;
if (iccData) {
SkColorSpace_Base::ICCTypeFlag iccType = SkColorSpace_Base::kRGB_ICCTypeFlag;
switch (decoderMgr->dinfo()->jpeg_color_space) {
@ -241,10 +240,6 @@ bool SkJpegCodec::ReadHeader(SkStream* stream, SkCodec** codecOut, JpegDecoderMg
break;
}
colorSpace = SkColorSpace_Base::MakeICC(iccData->data(), iccData->size(), iccType);
if (!colorSpace) {
SkCodecPrintf("Could not create SkColorSpace from ICC data.\n");
unsupportedICC = true;
}
}
if (!colorSpace) {
colorSpace = defaultColorSpace;
@ -254,7 +249,6 @@ bool SkJpegCodec::ReadHeader(SkStream* stream, SkCodec** codecOut, JpegDecoderMg
const int height = decoderMgr->dinfo()->image_height;
SkJpegCodec* codec = new SkJpegCodec(width, height, info, stream, decoderMgr.release(),
std::move(colorSpace), orientation);
codec->setUnsupportedICC(unsupportedICC);
*codecOut = codec;
} else {
SkASSERT(nullptr != decoderMgrOut);

View File

@ -909,7 +909,6 @@ void AutoCleanPng::infoCallback(size_t idatLength) {
iccType |= SkColorSpace_Base::kGray_ICCTypeFlag;
}
sk_sp<SkColorSpace> colorSpace = read_color_space(fPng_ptr, fInfo_ptr, iccType);
const bool unsupportedICC = !colorSpace;
if (!colorSpace) {
// Treat unsupported/invalid color spaces as sRGB.
colorSpace = SkColorSpace::MakeSRGB();
@ -935,7 +934,6 @@ void AutoCleanPng::infoCallback(size_t idatLength) {
*fOutCodec = new SkPngInterlacedDecoder(encodedInfo, imageInfo, fStream,
fChunkReader, fPng_ptr, fInfo_ptr, bitDepth, numberPasses);
}
(*fOutCodec)->setUnsupportedICC(unsupportedICC);
static_cast<SkPngCodec*>(*fOutCodec)->setIdatLength(idatLength);
}

View File

@ -85,12 +85,8 @@ SkCodec* SkWebpCodec::NewFromStream(SkStream* stream) {
WebPChunkIterator chunkIterator;
SkAutoTCallVProc<WebPChunkIterator, WebPDemuxReleaseChunkIterator> autoCI(&chunkIterator);
sk_sp<SkColorSpace> colorSpace = nullptr;
bool unsupportedICC = false;
if (WebPDemuxGetChunk(demux, "ICCP", 1, &chunkIterator)) {
colorSpace = SkColorSpace::MakeICC(chunkIterator.chunk.bytes, chunkIterator.chunk.size);
if (!colorSpace) {
unsupportedICC = true;
}
}
if (!colorSpace) {
colorSpace = SkColorSpace::MakeSRGB();
@ -150,7 +146,6 @@ SkCodec* SkWebpCodec::NewFromStream(SkStream* stream) {
SkWebpCodec* codecOut = new SkWebpCodec(width, height, info, std::move(colorSpace),
streamDeleter.release(), demux.release(),
std::move(data));
codecOut->setUnsupportedICC(unsupportedICC);
return codecOut;
}

View File

@ -30,8 +30,6 @@ DEFINE_bool(writeImages, true,
"Indicates if we want to write out supported/decoded images.");
DEFINE_bool(writeFailedImages, false,
"Indicates if we want to write out unsupported/failed to decode images.");
DEFINE_bool(testICCSupport, false,
"Indicates if we want to test that the images with ICC profiles are supported");
DEFINE_string2(failuresJsonPath, j, "",
"Dump SKP and count of unknown images to the specified JSON file. Will not be "
"written anywhere if empty.");
@ -114,19 +112,6 @@ struct Sniffer : public SkPixelSerializer {
}
}
#ifdef SK_DEBUG
if (FLAGS_testICCSupport) {
if (codec->fUnsupportedICC) {
SkDebugf("Color correction failed for %s\n", skpName.c_str());
gSkpToUnsupportedCount[skpName]++;
if (FLAGS_writeFailedImages) {
writeImage();
}
return;
}
}
#endif
if (FLAGS_writeImages) {
writeImage();
}
@ -154,7 +139,7 @@ static void get_images_from_file(const SkString& file) {
int main(int argc, char** argv) {
SkCommandLineFlags::SetUsage(
"Usage: get_images_from_skps -s <dir of skps> -o <dir for output images> --testDecode "
"-j <output JSON path> --testICCSupport --writeImages, --writeFailedImages\n");
"-j <output JSON path> --writeImages, --writeFailedImages\n");
SkCommandLineFlags::Parse(argc, argv);
const char* inputs = FLAGS_skps[0];
@ -164,12 +149,6 @@ int main(int argc, char** argv) {
SkCommandLineFlags::PrintUsage();
return 1;
}
#ifndef SK_DEBUG
if (FLAGS_testICCSupport) {
std::cerr << "--testICCSupport unavailable outside of SK_DEBUG builds" << std::endl;
return 1;
}
#endif
if (sk_isdir(inputs)) {
SkOSFile::Iter iter(inputs, "skp");