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

Unified Diff: Source/core/platform/image-decoders/gif/GIFImageReader.h

Issue 23646005: Improve GIF decoding performance (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: test data moved to Source/core/platform/image-decoders/testing Created 7 years, 2 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/gif/GIFImageReader.h
diff --git a/Source/core/platform/image-decoders/gif/GIFImageReader.h b/Source/core/platform/image-decoders/gif/GIFImageReader.h
index 79d0b4ba75c5cc6fdca625684906df92d44f4ed8..ef85725ddf8fc0446e2d8bd244c8793c0903f10d 100644
--- a/Source/core/platform/image-decoders/gif/GIFImageReader.h
+++ b/Source/core/platform/image-decoders/gif/GIFImageReader.h
@@ -46,10 +46,10 @@
#include "wtf/PassOwnPtr.h"
#include "wtf/Vector.h"
-#define MAX_LZW_BITS 12
-#define MAX_BYTES 4097 /* 2^MAX_LZW_BITS+1 */
-#define MAX_COLORS 256
-#define GIF_COLORS 3
+#define MAX_DICTIONARY_ENTRY_BITS 12
+#define MAX_DICTIONARY_ENTRIES 4096 // 2^MAX_DICTIONARY_ENTRY_BITS
+#define MAX_COLORS 256
+#define BYTES_PER_COLORMAP_ENTRY 3
const int cLoopCountNotSeen = -2;
@@ -95,14 +95,13 @@ public:
, ipass(0)
, irow(0)
, rowsRemaining(0)
- , stackp(0)
, rowIter(0)
, m_client(client)
, m_frameContext(frameContext)
{ }
bool prepareToDecode();
- bool outputRow();
+ bool outputRow(GIFRow::const_iterator rowBegin);
bool doLZW(const unsigned char* block, size_t bytesInBlock);
bool hasRemainingRows() { return rowsRemaining; }
@@ -120,13 +119,11 @@ private:
size_t irow; // Current output row, starting at zero.
size_t rowsRemaining; // Rows remaining to be output.
- unsigned short prefix[MAX_BYTES];
- unsigned char suffix[MAX_BYTES];
- unsigned char stack[MAX_BYTES];
- Vector<unsigned char> rowBuffer; // Single scanline temporary buffer.
-
- size_t stackp; // Current stack pointer.
- Vector<unsigned char>::iterator rowIter;
+ unsigned short prefix[MAX_DICTIONARY_ENTRIES];
+ unsigned char suffix[MAX_DICTIONARY_ENTRIES];
+ unsigned short suffixLength[MAX_DICTIONARY_ENTRIES];
+ GIFRow rowBuffer; // Single scanline temporary buffer.
+ GIFRow::iterator rowIter;
// Initialized during construction and read-only.
WebCore::GIFImageDecoder* m_client;

Powered by Google App Engine
This is Rietveld 408576698