aboutsummaryrefslogtreecommitdiff
path: root/video
diff options
context:
space:
mode:
authorWillem Jan Palenstijn2017-07-24 22:54:27 +0200
committerWillem Jan Palenstijn2017-08-24 19:46:59 +0200
commit47539e1939433de73a75a60b15924afc23237cde (patch)
tree07aad02b36285c4fffd022424be9398a8a5e3daf /video
parente72f681ceb6fe77fcd82d97360cc5f1e48f7490e (diff)
downloadscummvm-rg350-47539e1939433de73a75a60b15924afc23237cde.tar.gz
scummvm-rg350-47539e1939433de73a75a60b15924afc23237cde.tar.bz2
scummvm-rg350-47539e1939433de73a75a60b15924afc23237cde.zip
VIDEO: Use new BitStreamMemory class for PSXStreamDecoder
Diffstat (limited to 'video')
-rw-r--r--video/psx_decoder.cpp17
-rw-r--r--video/psx_decoder.h13
2 files changed, 14 insertions, 16 deletions
diff --git a/video/psx_decoder.cpp b/video/psx_decoder.cpp
index 973803e69f..562da885b1 100644
--- a/video/psx_decoder.cpp
+++ b/video/psx_decoder.cpp
@@ -27,7 +27,6 @@
#include "audio/decoders/raw.h"
#include "common/bitstream.h"
#include "common/huffman.h"
-#include "common/memstream.h"
#include "common/stream.h"
#include "common/system.h"
#include "common/textconsole.h"
@@ -232,7 +231,7 @@ void PSXStreamDecoder::readNextPacket() {
if (curSector == sectorCount - 1) {
// Done assembling the frame
- Common::SeekableReadStream *frame = new Common::MemoryReadStream(partialFrame, frameSize, DisposeAfterUse::YES);
+ Common::BitStreamMemoryStream *frame = new Common::BitStreamMemoryStream(partialFrame, frameSize, DisposeAfterUse::YES);
_videoTrack->decodeFrame(frame, sectorsRead);
@@ -464,10 +463,10 @@ const Graphics::Surface *PSXStreamDecoder::PSXVideoTrack::decodeNextFrame() {
return _surface;
}
-void PSXStreamDecoder::PSXVideoTrack::decodeFrame(Common::SeekableReadStream *frame, uint sectorCount) {
+void PSXStreamDecoder::PSXVideoTrack::decodeFrame(Common::BitStreamMemoryStream *frame, uint sectorCount) {
// A frame is essentially an MPEG-1 intra frame
- Common::BitStream16LEMSB bits(frame);
+ Common::BitStreamMemory16LEMSB bits(frame);
bits.skip(16); // unknown
bits.skip(16); // 0x3800
@@ -499,7 +498,7 @@ void PSXStreamDecoder::PSXVideoTrack::decodeFrame(Common::SeekableReadStream *fr
_nextFrameStartTime = _nextFrameStartTime.addFrames(sectorCount);
}
-void PSXStreamDecoder::PSXVideoTrack::decodeMacroBlock(Common::BitStream16LEMSB *bits, int mbX, int mbY, uint16 scale, uint16 version) {
+void PSXStreamDecoder::PSXVideoTrack::decodeMacroBlock(Common::BitStreamMemory16LEMSB *bits, int mbX, int mbY, uint16 scale, uint16 version) {
int pitchY = _macroBlocksW * 16;
int pitchC = _macroBlocksW * 8;
@@ -546,7 +545,7 @@ void PSXStreamDecoder::PSXVideoTrack::dequantizeBlock(int *coefficients, float *
}
}
-int PSXStreamDecoder::PSXVideoTrack::readDC(Common::BitStream16LEMSB *bits, uint16 version, PlaneType plane) {
+int PSXStreamDecoder::PSXVideoTrack::readDC(Common::BitStreamMemory16LEMSB *bits, uint16 version, PlaneType plane) {
// Version 2 just has its coefficient as 10-bits
if (version == 2)
return readSignedCoefficient(bits);
@@ -576,7 +575,7 @@ int PSXStreamDecoder::PSXVideoTrack::readDC(Common::BitStream16LEMSB *bits, uint
if (count > 63) \
error("PSXStreamDecoder::readAC(): Too many coefficients")
-void PSXStreamDecoder::PSXVideoTrack::readAC(Common::BitStream16LEMSB *bits, int *block) {
+void PSXStreamDecoder::PSXVideoTrack::readAC(Common::BitStreamMemory16LEMSB *bits, int *block) {
// Clear the block first
for (int i = 0; i < 63; i++)
block[i] = 0;
@@ -611,7 +610,7 @@ void PSXStreamDecoder::PSXVideoTrack::readAC(Common::BitStream16LEMSB *bits, int
}
}
-int PSXStreamDecoder::PSXVideoTrack::readSignedCoefficient(Common::BitStream16LEMSB *bits) {
+int PSXStreamDecoder::PSXVideoTrack::readSignedCoefficient(Common::BitStreamMemory16LEMSB *bits) {
uint val = bits->getBits(10);
// extend the sign
@@ -672,7 +671,7 @@ void PSXStreamDecoder::PSXVideoTrack::idct(float *dequantData, float *result) {
}
}
-void PSXStreamDecoder::PSXVideoTrack::decodeBlock(Common::BitStream16LEMSB *bits, byte *block, int pitch, uint16 scale, uint16 version, PlaneType plane) {
+void PSXStreamDecoder::PSXVideoTrack::decodeBlock(Common::BitStreamMemory16LEMSB *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 fa36af1bb3..c96642276a 100644
--- a/video/psx_decoder.h
+++ b/video/psx_decoder.h
@@ -37,7 +37,6 @@ class QueuingAudioStream;
namespace Common {
class Huffman;
-class SeekableReadStream;
}
namespace Graphics {
@@ -91,7 +90,7 @@ private:
const Graphics::Surface *decodeNextFrame();
void setEndOfTrack() { _endOfTrack = true; }
- void decodeFrame(Common::SeekableReadStream *frame, uint sectorCount);
+ void decodeFrame(Common::BitStreamMemoryStream *frame, uint sectorCount);
private:
Graphics::Surface *_surface;
@@ -108,19 +107,19 @@ private:
uint16 _macroBlocksW, _macroBlocksH;
byte *_yBuffer, *_cbBuffer, *_crBuffer;
- 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 decodeMacroBlock(Common::BitStreamMemory16LEMSB *bits, int mbX, int mbY, uint16 scale, uint16 version);
+ void decodeBlock(Common::BitStreamMemory16LEMSB *bits, byte *block, int pitch, uint16 scale, uint16 version, PlaneType plane);
- void readAC(Common::BitStream16LEMSB *bits, int *block);
+ void readAC(Common::BitStreamMemory16LEMSB *bits, int *block);
Common::Huffman *_acHuffman;
- int readDC(Common::BitStream16LEMSB *bits, uint16 version, PlaneType plane);
+ int readDC(Common::BitStreamMemory16LEMSB *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::BitStream16LEMSB *bits);
+ int readSignedCoefficient(Common::BitStreamMemory16LEMSB *bits);
};
class PSXAudioTrack : public AudioTrack {