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];
69 void readFrame(
int frame, uint readFlags = kVQAReadAll);
71 void decodeVideoFrame(
Graphics::Surface *surface,
int frame,
bool forceDraw =
false);
72 void decodeZBuffer(
ZBuffer *zbuffer);
74 void decodeView(
View *view);
76 void decodeLights(
Lights *lights);
78 uint16 numFrames()
const {
return _header.numFrames; }
79 uint8 frameRate()
const {
return _header.frameRate; }
81 uint16 offsetX()
const {
return _header.offsetX; }
82 uint16 offsetY()
const {
return _header.offsetY; }
84 void overrideOffsetXY(uint16 offX, uint16 offY);
86 bool hasAudio()
const {
return _header.channels != 0; }
87 uint16 frequency()
const {
return _header.freq; }
89 bool getLoopBeginAndEndFrame(
int loopId,
int *begin,
int *end);
90 int getLoopIdFromFrame(
int frame);
92 void allocatePaletteVQPTable(
const uint32 numOfPalettes);
93 void updatePaletteVQPTable(uint32 palId, uint16 j, uint16 k, uint8 colorByte);
94 void deleteVQPTable();
137 LoopInfo() : loopCount(0), loops(
nullptr), flags(0) {}
166 VQPPalette *_vqpPalsArr;
167 uint16 _numOfVQPPalettes;
171 bool _allowHorizontalScanlines;
172 bool _allowVerticalScanlines;
173 bool _scaleVideoTo2xRequested;
174 bool _scale2xPossible;
175 bool _centerVideoRequested;
180 uint32 _maxVIEWChunkSize;
181 uint32 _maxZBUFChunkSize;
182 uint32 _maxAESCChunkSize;
187 void readPacket(uint readFlags);
201 static const uint kSizeInBytesOfCPL0Chunk = 768;
206 uint16 getWidth()
const;
207 uint16 getHeight()
const;
209 int getFrameCount()
const;
211 void overrideOffsetXY(uint16 offX, uint16 offY);
214 void decodeZBuffer(
ZBuffer *zbuffer);
215 void decodeView(
View *view);
217 void decodeLights(
Lights *lights);
234 bool useAudioSync()
const {
return false; }
242 uint16 _width, _height;
243 uint8 _blockW, _blockH;
247 uint16 _offsetX, _offsetY;
251 uint32 _maxZBUFChunkSize;
255 uint32 _zbufChunkSize;
258 uint32 _vpointerSize;
264 uint32 _viewDataSize;
266 uint32 _lightsDataSize;
267 uint8 *_screenEffectsData;
268 uint32 _screenEffectsDataSize;
270 int32 _currentPaletteId;
272 uint8 *_cpalPointerNext;
273 uint32 _cpalPointerSize;
274 uint32 _cpalPointerSizeNext;
277 uint8 _countOfCBPsToCBF;
278 uint32 _accumulatedCBPZsizeToCBF;
282 void VPTRWriteBlock(
Graphics::Surface *surface,
unsigned int dstBlock,
unsigned int srcBlock,
int count,
bool alpha =
false);
287 static const uint kSizeInShortsAllocatedToAudioFrame = 2940;
288 static const uint kSizeInBytesOfCompressedAudioFrame = 735;
289 static const uint kSizeInShortsAllocatedToAudioFrameMax = 22048;
290 static const uint kSizeInBytesOfCompressedAudioFrameMax = 5512;
304 bool _bigCompressedAudioFrame;
305 uint8 _compressedAudioFrame[kSizeInBytesOfCompressedAudioFrameMax];
Definition: vqa_decoder.h:150
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:132
Definition: vqa_decoder.h:200
Definition: vqa_decoder.h:286
Definition: screen_effects.h:39
Definition: vqa_decoder.h:121