Title: [136410] trunk/Source/WebCore
- Revision
- 136410
- Author
- [email protected]
- Date
- 2012-12-03 10:18:22 -0800 (Mon, 03 Dec 2012)
Log Message
Optimization in image decoding
https://bugs.webkit.org/show_bug.cgi?id=88424
Patch by Viatcheslav Ostapenko <[email protected]> on 2012-12-03
Reviewed by Brent Fulgham.
Replace int with J_COLOR_SPACE in parameters of templates setPixel and
outputScanlines to avoid casting from int to enum. It required move
inclusion of jpeglib.h and related #if to JPEGImageDecoder.h .
* platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
(WebCore):
(WebCore::setPixel):
(WebCore::JPEGImageDecoder::outputScanlines):
* platform/image-decoders/jpeg/JPEGImageDecoder.h:
(JPEGImageDecoder):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (136409 => 136410)
--- trunk/Source/WebCore/ChangeLog 2012-12-03 18:12:02 UTC (rev 136409)
+++ trunk/Source/WebCore/ChangeLog 2012-12-03 18:18:22 UTC (rev 136410)
@@ -1,3 +1,21 @@
+2012-12-03 Viatcheslav Ostapenko <[email protected]>
+
+ Optimization in image decoding
+ https://bugs.webkit.org/show_bug.cgi?id=88424
+
+ Reviewed by Brent Fulgham.
+
+ Replace int with J_COLOR_SPACE in parameters of templates setPixel and
+ outputScanlines to avoid casting from int to enum. It required move
+ inclusion of jpeglib.h and related #if to JPEGImageDecoder.h .
+
+ * platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
+ (WebCore):
+ (WebCore::setPixel):
+ (WebCore::JPEGImageDecoder::outputScanlines):
+ * platform/image-decoders/jpeg/JPEGImageDecoder.h:
+ (JPEGImageDecoder):
+
2012-12-03 Tony Chang <[email protected]>
[mathml] Improve performance of nested sup or sub elements
Modified: trunk/Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp (136409 => 136410)
--- trunk/Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp 2012-12-03 18:12:02 UTC (rev 136409)
+++ trunk/Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp 2012-12-03 18:18:22 UTC (rev 136410)
@@ -40,20 +40,9 @@
#include "config.h"
#include "JPEGImageDecoder.h"
#include "PlatformInstrumentation.h"
-#include <stdio.h> // Needed by jpeglib.h for FILE.
#include <wtf/PassOwnPtr.h>
-#if OS(WINCE)
-// Remove warning: 'FAR' macro redefinition
-#undef FAR
-
-// jmorecfg.h in libjpeg checks for XMD_H with the comment: "X11/xmd.h correctly defines INT32"
-// fix INT32 redefinition error by pretending we are X11/xmd.h
-#define XMD_H
-#endif
-
extern "C" {
-#include "jpeglib.h"
#if USE(ICCJPEG)
#include "iccjpeg.h"
#endif
@@ -646,12 +635,12 @@
return ImageDecoder::setFailed();
}
-template <int colorSpace>
+template <J_COLOR_SPACE colorSpace>
void setPixel(ImageFrame& buffer, ImageFrame::PixelData* currentAddress, JSAMPARRAY samples, int column)
{
- JSAMPLE* jsample = *samples + column * (static_cast<J_COLOR_SPACE>(colorSpace) == JCS_RGB ? 3 : 4);
+ JSAMPLE* jsample = *samples + column * (colorSpace == JCS_RGB ? 3 : 4);
- switch (static_cast<J_COLOR_SPACE>(colorSpace)) {
+ switch (colorSpace) {
#if defined(TURBO_JPEG_RGB_SWIZZLE)
case JCS_EXT_BGRA:
buffer.setRGBA(currentAddress, jsample[2], jsample[1], jsample[0], 0xFF);
@@ -677,7 +666,7 @@
}
}
-template <int colorSpace, bool isScaled>
+template <J_COLOR_SPACE colorSpace, bool isScaled>
bool JPEGImageDecoder::outputScanlines(ImageFrame& buffer)
{
JSAMPARRAY samples = m_reader->samples();
@@ -712,7 +701,7 @@
return true;
}
-template <int colorSpace>
+template <J_COLOR_SPACE colorSpace>
bool JPEGImageDecoder::outputScanlines(ImageFrame& buffer)
{
return m_scaled ? outputScanlines<colorSpace, true>(buffer) : outputScanlines<colorSpace, false>(buffer);
Modified: trunk/Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.h (136409 => 136410)
--- trunk/Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.h 2012-12-03 18:12:02 UTC (rev 136409)
+++ trunk/Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.h 2012-12-03 18:18:22 UTC (rev 136410)
@@ -28,8 +28,22 @@
#define JPEGImageDecoder_h
#include "ImageDecoder.h"
+#include <stdio.h> // Needed by jpeglib.h for FILE.
#include <wtf/OwnPtr.h>
+#if OS(WINCE)
+// Remove warning: 'FAR' macro redefinition
+#undef FAR
+
+// jmorecfg.h in libjpeg checks for XMD_H with the comment: "X11/xmd.h correctly defines INT32"
+// fix INT32 redefinition error by pretending we are X11/xmd.h
+#define XMD_H
+#endif
+
+extern "C" {
+#include "jpeglib.h"
+}
+
namespace WebCore {
class JPEGImageReader;
@@ -62,10 +76,10 @@
// data coming, sets the "decode failure" flag.
void decode(bool onlySize);
- template <int colorSpace>
+ template <J_COLOR_SPACE colorSpace>
bool outputScanlines(ImageFrame& buffer);
- template <int colorSpace, bool isScaled>
+ template <J_COLOR_SPACE colorSpace, bool isScaled>
bool outputScanlines(ImageFrame& buffer);
OwnPtr<JPEGImageReader> m_reader;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes