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

Unified Diff: Source/core/platform/image-decoders/jpeg/JPEGImageDecoder.cpp

Issue 15466004: Make image decoders faster by refactoring hot loops that fills the lines of ImageFrame. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Make image decoders faster by refactoring hot loops that fills the lines of ImageFrame. Created 7 years, 6 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
Index: Source/core/platform/image-decoders/jpeg/JPEGImageDecoder.cpp
diff --git a/Source/core/platform/image-decoders/jpeg/JPEGImageDecoder.cpp b/Source/core/platform/image-decoders/jpeg/JPEGImageDecoder.cpp
index 7974b79a7ee2dd3a4fbb4c7579bab8dad2315872..4251d946b4339d5112f87b8ead56785ac1d9d580 100644
--- a/Source/core/platform/image-decoders/jpeg/JPEGImageDecoder.cpp
+++ b/Source/core/platform/image-decoders/jpeg/JPEGImageDecoder.cpp
@@ -646,17 +646,7 @@ template <J_COLOR_SPACE colorSpace> void setPixel(ImageFrame& buffer, ImageFrame
buffer.setRGBA(pixel, jsample[0], jsample[1], jsample[2], 0xFF);
break;
case JCS_CMYK:
- // Source is 'Inverted CMYK', output is RGB.
- // See: http://www.easyrgb.com/math.php?MATH=M12#text12
- // Or: http://www.ilkeratalay.com/colorspacesfaq.php#rgb
- // From CMYK to CMY:
- // X = X * (1 - K ) + K [for X = C, M, or Y]
- // Thus, from Inverted CMYK to CMY is:
- // X = (1-iX) * (1 - (1-iK)) + (1-iK) => 1 - iX*iK
- // From CMY (0..1) to RGB (0..1):
- // R = 1 - C => 1 - (1 - iC*iK) => iC*iK [G and B similar]
- unsigned k = jsample[3];
- buffer.setRGBA(pixel, jsample[0] * k / 255, jsample[1] * k / 255, jsample[2] * k / 255, 0xFF);
+ buffer.setInvertedCMYK(pixel, jsample[0], jsample[1], jsample[2], jsample[3]);
break;
}
}

Powered by Google App Engine
This is Rietveld 408576698