aboutsummaryrefslogtreecommitdiff
path: root/video
diff options
context:
space:
mode:
authorWillem Jan Palenstijn2017-07-24 21:01:19 +0200
committerWillem Jan Palenstijn2017-08-24 19:46:59 +0200
commitdde259f06813534c7179a714403d8fd6fe918d09 (patch)
tree1379a5c2600057ba53032c722e3a5a1578db8507 /video
parent265fc48d1590cdd503187c79dc254d65623c8d7b (diff)
downloadscummvm-rg350-dde259f06813534c7179a714403d8fd6fe918d09.tar.gz
scummvm-rg350-dde259f06813534c7179a714403d8fd6fe918d09.tar.bz2
scummvm-rg350-dde259f06813534c7179a714403d8fd6fe918d09.zip
COMMON: Remove BitStream base class to allow inlining calls
All users of BitStream were in fact using a specific, hardcoded variant, so we can hardcode that variant, removing the need for virtual calls, and enabling inlining.
Diffstat (limited to 'video')
-rw-r--r--video/bink_decoder.h6
-rw-r--r--video/psx_decoder.cpp10
-rw-r--r--video/psx_decoder.h12
-rw-r--r--video/smk_decoder.cpp24
-rw-r--r--video/smk_decoder.h6
5 files changed, 29 insertions, 29 deletions
diff --git a/video/bink_decoder.h b/video/bink_decoder.h
index 6f18dd539c..8a67913a03 100644
--- a/video/bink_decoder.h
+++ b/video/bink_decoder.h
@@ -32,6 +32,7 @@
#define VIDEO_BINK_DECODER_H
#include "common/array.h"
+#include "common/bitstream.h"
#include "common/rational.h"
#include "video/video_decoder.h"
@@ -45,7 +46,6 @@ class QueuingAudioStream;
namespace Common {
class SeekableReadStream;
-class BitStream;
class Huffman;
class RDFT;
@@ -100,7 +100,7 @@ private:
uint32 sampleCount;
- Common::BitStream *bits;
+ Common::BitStream32LELSB *bits;
bool first;
@@ -133,7 +133,7 @@ private:
uint32 offset;
uint32 size;
- Common::BitStream *bits;
+ Common::BitStream32LELSB *bits;
VideoFrame();
~VideoFrame();
diff --git a/video/psx_decoder.cpp b/video/psx_decoder.cpp
index 426f5eb608..973803e69f 100644
--- a/video/psx_decoder.cpp
+++ b/video/psx_decoder.cpp
@@ -499,7 +499,7 @@ void PSXStreamDecoder::PSXVideoTrack::decodeFrame(Common::SeekableReadStream *fr
_nextFrameStartTime = _nextFrameStartTime.addFrames(sectorCount);
}
-void PSXStreamDecoder::PSXVideoTrack::decodeMacroBlock(Common::BitStream *bits, int mbX, int mbY, uint16 scale, uint16 version) {
+void PSXStreamDecoder::PSXVideoTrack::decodeMacroBlock(Common::BitStream16LEMSB *bits, int mbX, int mbY, uint16 scale, uint16 version) {
int pitchY = _macroBlocksW * 16;
int pitchC = _macroBlocksW * 8;
@@ -546,7 +546,7 @@ void PSXStreamDecoder::PSXVideoTrack::dequantizeBlock(int *coefficients, float *
}
}
-int PSXStreamDecoder::PSXVideoTrack::readDC(Common::BitStream *bits, uint16 version, PlaneType plane) {
+int PSXStreamDecoder::PSXVideoTrack::readDC(Common::BitStream16LEMSB *bits, uint16 version, PlaneType plane) {
// Version 2 just has its coefficient as 10-bits
if (version == 2)
return readSignedCoefficient(bits);
@@ -576,7 +576,7 @@ int PSXStreamDecoder::PSXVideoTrack::readDC(Common::BitStream *bits, uint16 vers
if (count > 63) \
error("PSXStreamDecoder::readAC(): Too many coefficients")
-void PSXStreamDecoder::PSXVideoTrack::readAC(Common::BitStream *bits, int *block) {
+void PSXStreamDecoder::PSXVideoTrack::readAC(Common::BitStream16LEMSB *bits, int *block) {
// Clear the block first
for (int i = 0; i < 63; i++)
block[i] = 0;
@@ -611,7 +611,7 @@ void PSXStreamDecoder::PSXVideoTrack::readAC(Common::BitStream *bits, int *block
}
}
-int PSXStreamDecoder::PSXVideoTrack::readSignedCoefficient(Common::BitStream *bits) {
+int PSXStreamDecoder::PSXVideoTrack::readSignedCoefficient(Common::BitStream16LEMSB *bits) {
uint val = bits->getBits(10);
// extend the sign
@@ -672,7 +672,7 @@ void PSXStreamDecoder::PSXVideoTrack::idct(float *dequantData, float *result) {
}
}
-void PSXStreamDecoder::PSXVideoTrack::decodeBlock(Common::BitStream *bits, byte *block, int pitch, uint16 scale, uint16 version, PlaneType plane) {
+void PSXStreamDecoder::PSXVideoTrack::decodeBlock(Common::BitStream16LEMSB *bits, byte *block, int pitch, uint16 scale, uint16 version, PlaneType plane) {
// Version 2 just has signed 10 bits for DC
// Version 3 has them huffman coded
int coefficients[8 * 8];
diff --git a/video/psx_decoder.h b/video/psx_decoder.h
index b19bd72fa0..fa36af1bb3 100644
--- a/video/psx_decoder.h
+++ b/video/psx_decoder.h
@@ -23,6 +23,7 @@
#ifndef VIDEO_PSX_DECODER_H
#define VIDEO_PSX_DECODER_H
+#include "common/bitstream.h"
#include "common/endian.h"
#include "common/rational.h"
#include "common/rect.h"
@@ -35,7 +36,6 @@ class QueuingAudioStream;
}
namespace Common {
-class BitStream;
class Huffman;
class SeekableReadStream;
}
@@ -108,19 +108,19 @@ private:
uint16 _macroBlocksW, _macroBlocksH;
byte *_yBuffer, *_cbBuffer, *_crBuffer;
- void decodeMacroBlock(Common::BitStream *bits, int mbX, int mbY, uint16 scale, uint16 version);
- void decodeBlock(Common::BitStream *bits, byte *block, int pitch, uint16 scale, uint16 version, PlaneType plane);
+ void decodeMacroBlock(Common::BitStream16LEMSB *bits, int mbX, int mbY, uint16 scale, uint16 version);
+ void decodeBlock(Common::BitStream16LEMSB *bits, byte *block, int pitch, uint16 scale, uint16 version, PlaneType plane);
- void readAC(Common::BitStream *bits, int *block);
+ void readAC(Common::BitStream16LEMSB *bits, int *block);
Common::Huffman *_acHuffman;
- int readDC(Common::BitStream *bits, uint16 version, PlaneType plane);
+ int readDC(Common::BitStream16LEMSB *bits, uint16 version, PlaneType plane);
Common::Huffman *_dcHuffmanLuma, *_dcHuffmanChroma;
int _lastDC[3];
void dequantizeBlock(int *coefficients, float *block, uint16 scale);
void idct(float *dequantData, float *result);
- int readSignedCoefficient(Common::BitStream *bits);
+ int readSignedCoefficient(Common::BitStream16LEMSB *bits);
};
class PSXAudioTrack : public AudioTrack {
diff --git a/video/smk_decoder.cpp b/video/smk_decoder.cpp
index d913707119..d8057ac068 100644
--- a/video/smk_decoder.cpp
+++ b/video/smk_decoder.cpp
@@ -54,9 +54,9 @@ enum SmkBlockTypes {
class SmallHuffmanTree {
public:
- SmallHuffmanTree(Common::BitStream &bs);
+ SmallHuffmanTree(Common::BitStream8LSB &bs);
- uint16 getCode(Common::BitStream &bs);
+ uint16 getCode(Common::BitStream8LSB &bs);
private:
enum {
SMK_NODE = 0x8000
@@ -70,10 +70,10 @@ private:
uint16 _prefixtree[256];
byte _prefixlength[256];
- Common::BitStream &_bs;
+ Common::BitStream8LSB &_bs;
};
-SmallHuffmanTree::SmallHuffmanTree(Common::BitStream &bs)
+SmallHuffmanTree::SmallHuffmanTree(Common::BitStream8LSB &bs)
: _treeSize(0), _bs(bs) {
uint32 bit = _bs.getBit();
assert(bit);
@@ -118,7 +118,7 @@ uint16 SmallHuffmanTree::decodeTree(uint32 prefix, int length) {
return r1+r2+1;
}
-uint16 SmallHuffmanTree::getCode(Common::BitStream &bs) {
+uint16 SmallHuffmanTree::getCode(Common::BitStream8LSB &bs) {
byte peek = bs.peekBits(MIN<uint32>(bs.size() - bs.pos(), 8));
uint16 *p = &_tree[_prefixtree[peek]];
bs.skip(_prefixlength[peek]);
@@ -139,11 +139,11 @@ uint16 SmallHuffmanTree::getCode(Common::BitStream &bs) {
class BigHuffmanTree {
public:
- BigHuffmanTree(Common::BitStream &bs, int allocSize);
+ BigHuffmanTree(Common::BitStream8LSB &bs, int allocSize);
~BigHuffmanTree();
void reset();
- uint32 getCode(Common::BitStream &bs);
+ uint32 getCode(Common::BitStream8LSB &bs);
private:
enum {
SMK_NODE = 0x80000000
@@ -159,13 +159,13 @@ private:
byte _prefixlength[256];
/* Used during construction */
- Common::BitStream &_bs;
+ Common::BitStream8LSB &_bs;
uint32 _markers[3];
SmallHuffmanTree *_loBytes;
SmallHuffmanTree *_hiBytes;
};
-BigHuffmanTree::BigHuffmanTree(Common::BitStream &bs, int allocSize)
+BigHuffmanTree::BigHuffmanTree(Common::BitStream8LSB &bs, int allocSize)
: _bs(bs) {
uint32 bit = _bs.getBit();
if (!bit) {
@@ -256,7 +256,7 @@ uint32 BigHuffmanTree::decodeTree(uint32 prefix, int length) {
return r1+r2+1;
}
-uint32 BigHuffmanTree::getCode(Common::BitStream &bs) {
+uint32 BigHuffmanTree::getCode(Common::BitStream8LSB &bs) {
byte peek = bs.peekBits(MIN<uint32>(bs.size() - bs.pos(), 8));
uint32 *p = &_tree[_prefixtree[peek]];
bs.skip(_prefixlength[peek]);
@@ -553,14 +553,14 @@ Graphics::PixelFormat SmackerDecoder::SmackerVideoTrack::getPixelFormat() const
return _surface->format;
}
-void SmackerDecoder::SmackerVideoTrack::readTrees(Common::BitStream &bs, uint32 mMapSize, uint32 mClrSize, uint32 fullSize, uint32 typeSize) {
+void SmackerDecoder::SmackerVideoTrack::readTrees(Common::BitStream8LSB &bs, uint32 mMapSize, uint32 mClrSize, uint32 fullSize, uint32 typeSize) {
_MMapTree = new BigHuffmanTree(bs, mMapSize);
_MClrTree = new BigHuffmanTree(bs, mClrSize);
_FullTree = new BigHuffmanTree(bs, fullSize);
_TypeTree = new BigHuffmanTree(bs, typeSize);
}
-void SmackerDecoder::SmackerVideoTrack::decodeFrame(Common::BitStream &bs) {
+void SmackerDecoder::SmackerVideoTrack::decodeFrame(Common::BitStream8LSB &bs) {
_MMapTree->reset();
_MClrTree->reset();
_FullTree->reset();
diff --git a/video/smk_decoder.h b/video/smk_decoder.h
index bc04a683d2..e0ea600f6d 100644
--- a/video/smk_decoder.h
+++ b/video/smk_decoder.h
@@ -23,6 +23,7 @@
#ifndef VIDEO_SMK_PLAYER_H
#define VIDEO_SMK_PLAYER_H
+#include "common/bitstream.h"
#include "common/rational.h"
#include "graphics/pixelformat.h"
#include "graphics/surface.h"
@@ -34,7 +35,6 @@ class QueuingAudioStream;
}
namespace Common {
-class BitStream;
class SeekableReadStream;
}
@@ -91,9 +91,9 @@ protected:
const byte *getPalette() const { _dirtyPalette = false; return _palette; }
bool hasDirtyPalette() const { return _dirtyPalette; }
- void readTrees(Common::BitStream &bs, uint32 mMapSize, uint32 mClrSize, uint32 fullSize, uint32 typeSize);
+ void readTrees(Common::BitStream8LSB &bs, uint32 mMapSize, uint32 mClrSize, uint32 fullSize, uint32 typeSize);
void increaseCurFrame() { _curFrame++; }
- void decodeFrame(Common::BitStream &bs);
+ void decodeFrame(Common::BitStream8LSB &bs);
void unpackPalette(Common::SeekableReadStream *stream);
protected: