aboutsummaryrefslogtreecommitdiff
path: root/image
diff options
context:
space:
mode:
Diffstat (limited to 'image')
-rw-r--r--image/codecs/cinepak.cpp20
-rw-r--r--image/codecs/cinepak.h1
2 files changed, 20 insertions, 1 deletions
diff --git a/image/codecs/cinepak.cpp b/image/codecs/cinepak.cpp
index f356e87971..1c477c82d5 100644
--- a/image/codecs/cinepak.cpp
+++ b/image/codecs/cinepak.cpp
@@ -405,8 +405,13 @@ const Graphics::Surface *CinepakDecoder::decodeFrame(Common::SeekableReadStream
_curFrame.height = stream.readUint16BE();
_curFrame.stripCount = stream.readUint16BE();
- if (!_curFrame.strips)
+ if (!_curFrame.strips) {
_curFrame.strips = new CinepakStrip[_curFrame.stripCount];
+ for (uint16 i = 0; i < _curFrame.stripCount; i++) {
+ initializeCodebook(i, 1);
+ initializeCodebook(i, 4);
+ }
+ }
debug(4, "Cinepak Frame: Width = %d, Height = %d, Strip Count = %d", _curFrame.width, _curFrame.height, _curFrame.stripCount);
@@ -499,6 +504,19 @@ const Graphics::Surface *CinepakDecoder::decodeFrame(Common::SeekableReadStream
return _curFrame.surface;
}
+void CinepakDecoder::initializeCodebook(uint16 strip, byte codebookType) {
+ CinepakCodebook *codebook = (codebookType == 1) ? _curFrame.strips[strip].v1_codebook : _curFrame.strips[strip].v4_codebook;
+
+ for (uint16 i = 0; i < 256; i++) {
+ memset(codebook[i].y, 0, 4);
+ codebook[i].u = 0;
+ codebook[i].v = 0;
+
+ if (_ditherType == kDitherTypeQT)
+ ditherCodebookQT(strip, codebookType, i);
+ }
+}
+
void CinepakDecoder::loadCodebook(Common::SeekableReadStream &stream, uint16 strip, byte codebookType, byte chunkID, uint32 chunkSize) {
CinepakCodebook *codebook = (codebookType == 1) ? _curFrame.strips[strip].v1_codebook : _curFrame.strips[strip].v4_codebook;
diff --git a/image/codecs/cinepak.h b/image/codecs/cinepak.h
index 4efb1191cc..3b0fe477a6 100644
--- a/image/codecs/cinepak.h
+++ b/image/codecs/cinepak.h
@@ -94,6 +94,7 @@ private:
byte *_colorMap;
DitherType _ditherType;
+ void initializeCodebook(uint16 strip, byte codebookType);
void loadCodebook(Common::SeekableReadStream &stream, uint16 strip, byte codebookType, byte chunkID, uint32 chunkSize);
void decodeVectors(Common::SeekableReadStream &stream, uint16 strip, byte chunkID, uint32 chunkSize);