22 #ifndef BLADERUNNER_VQA_DECODER_H 23 #define BLADERUNNER_VQA_DECODER_H 25 #include "bladerunner/adpcm_decoder.h" 27 #include "audio/audiostream.h" 29 #include "common/debug.h" 30 #include "common/str.h" 31 #include "common/stream.h" 32 #include "common/types.h" 34 #include "graphics/surface.h" 36 #include "common/array.h" 37 #include "common/rational.h" 46 enum VQADecoderSkipFlags {
48 kVQAReadVectorPointerTable = 2,
50 kVQAReadVideo = kVQAReadCodebook|kVQAReadVectorPointerTable|kVQAReadCustom,
52 kVQAReadAll = kVQAReadVideo|kVQAReadAudio
59 uint8 interpol2D[256][256];
68 void readFrame(
int frame, uint readFlags = kVQAReadAll);
70 void decodeVideoFrame(
Graphics::Surface *surface,
int frame,
bool forceDraw =
false);
71 void decodeZBuffer(
ZBuffer *zbuffer);
73 void decodeView(
View *view);
75 void decodeLights(
Lights *lights);
77 uint16 numFrames()
const {
return _header.numFrames; }
78 uint8 frameRate()
const {
return _header.frameRate; }
80 uint16 offsetX()
const {
return _header.offsetX; }
81 uint16 offsetY()
const {
return _header.offsetY; }
83 void overrideOffsetXY(uint16 offX, uint16 offY);
85 bool hasAudio()
const {
return _header.channels != 0; }
86 uint16 frequency()
const {
return _header.freq; }
88 bool getLoopBeginAndEndFrame(
int loopId,
int *begin,
int *end);
89 int getLoopIdFromFrame(
int frame);
91 void allocatePaletteVQPTable(
const uint32 numOfPalettes);
92 void updatePaletteVQPTable(uint32 palId, uint16 j, uint16 k, uint8 colorByte);
93 void deleteVQPTable();
136 LoopInfo() : loopCount(0), loops(
nullptr), flags(0) {}
158 VQPPalette *_vqpPalsArr;
159 uint16 _numOfVQPPalettes;
163 bool _allowHorizontalScanlines;
164 bool _allowVerticalScanlines;
165 bool _scaleVideoTo2xRequested;
166 bool _scale2xPossible;
167 bool _centerVideoRequested;
172 uint32 _maxVIEWChunkSize;
173 uint32 _maxZBUFChunkSize;
174 uint32 _maxAESCChunkSize;
179 void readPacket(uint readFlags);
193 static const uint kSizeInBytesOfCPL0Chunk = 768;
198 uint16 getWidth()
const;
199 uint16 getHeight()
const;
201 int getFrameCount()
const;
203 void overrideOffsetXY(uint16 offX, uint16 offY);
206 void decodeZBuffer(
ZBuffer *zbuffer);
207 void decodeView(
View *view);
209 void decodeLights(
Lights *lights);
226 bool useAudioSync()
const {
return false; }
234 uint16 _width, _height;
235 uint8 _blockW, _blockH;
239 uint16 _offsetX, _offsetY;
243 uint32 _maxZBUFChunkSize;
247 uint32 _zbufChunkSize;
250 uint32 _vpointerSize;
256 uint32 _viewDataSize;
258 uint32 _lightsDataSize;
259 uint8 *_screenEffectsData;
260 uint32 _screenEffectsDataSize;
262 int32 _currentPaletteId;
264 uint8 *_cpalPointerNext;
265 uint32 _cpalPointerSize;
266 uint32 _cpalPointerSizeNext;
269 uint8 _countOfCBPsToCBF;
270 uint32 _accumulatedCBPZsizeToCBF;
274 void VPTRWriteBlock(
Graphics::Surface *surface,
unsigned int dstBlock,
unsigned int srcBlock,
int count,
bool alpha =
false);
279 static const uint kSizeInShortsAllocatedToAudioFrame = 2940;
280 static const uint kSizeInBytesOfCompressedAudioFrame = 735;
281 static const uint kSizeInShortsAllocatedToAudioFrameMax = 22048;
282 static const uint kSizeInBytesOfCompressedAudioFrameMax = 5512;
296 bool _bigCompressedAudioFrame;
297 uint8 _compressedAudioFrame[kSizeInBytesOfCompressedAudioFrameMax];
Definition: vqa_decoder.h:142
Definition: rational.h:40
Definition: audiostream.h:212
Definition: debugger.h:56
Definition: adpcm_decoder.h:29
Definition: vqa_decoder.h:55
Definition: vqa_decoder.h:131
Definition: vqa_decoder.h:192
Definition: vqa_decoder.h:278
Definition: screen_effects.h:39
Definition: vqa_decoder.h:120