aboutsummaryrefslogtreecommitdiff
path: root/image/codecs/svq1.h
diff options
context:
space:
mode:
authorBastien Bouclet2019-04-08 19:24:00 +0200
committerFilippos Karapetis2019-04-13 16:24:25 +0300
commit0f57aea2df2a1272b57de896e2f6aad80809e5d3 (patch)
tree3d39b80c59af9cfaab7663e24c5c8d21e3293101 /image/codecs/svq1.h
parentae9eeb731f435d16f2bb9ae69d48ce60c3a47fa3 (diff)
downloadscummvm-rg350-0f57aea2df2a1272b57de896e2f6aad80809e5d3.tar.gz
scummvm-rg350-0f57aea2df2a1272b57de896e2f6aad80809e5d3.tar.bz2
scummvm-rg350-0f57aea2df2a1272b57de896e2f6aad80809e5d3.zip
COMMON: Use a prefix table to speed up the Huffman decoder
Symbols for codes shorter than the prefix table index width are stored in the table. All the entries in the table with an index starting with the code are set to the symbol value. That way, when decoding it is possible to get the number of bits corresponding to the table width from the bitstream and directly find the symbol value. Longer code still need to be searched for in the codes list.
Diffstat (limited to 'image/codecs/svq1.h')
-rw-r--r--image/codecs/svq1.h15
1 files changed, 9 insertions, 6 deletions
diff --git a/image/codecs/svq1.h b/image/codecs/svq1.h
index 148501d17f..4a005761a5 100644
--- a/image/codecs/svq1.h
+++ b/image/codecs/svq1.h
@@ -27,6 +27,7 @@
#include "image/codecs/codec.h"
namespace Common {
+template <class BITSTREAM>
class Huffman;
struct Point;
}
@@ -53,12 +54,14 @@ private:
byte *_last[3];
- Common::Huffman *_blockType;
- Common::Huffman *_intraMultistage[6];
- Common::Huffman *_interMultistage[6];
- Common::Huffman *_intraMean;
- Common::Huffman *_interMean;
- Common::Huffman *_motionComponent;
+ typedef Common::Huffman<Common::BitStream32BEMSB> HuffmanDecoder;
+
+ HuffmanDecoder *_blockType;
+ HuffmanDecoder *_intraMultistage[6];
+ HuffmanDecoder *_interMultistage[6];
+ HuffmanDecoder *_intraMean;
+ HuffmanDecoder *_interMean;
+ HuffmanDecoder *_motionComponent;
bool svq1DecodeBlockIntra(Common::BitStream32BEMSB *s, byte *pixels, int pitch);
bool svq1DecodeBlockNonIntra(Common::BitStream32BEMSB *s, byte *pixels, int pitch);