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/blit.h" 35 #include "graphics/surface.h" 37 #include "common/array.h" 38 #include "common/rational.h" 47 enum VQADecoderSkipFlags {
49 kVQAReadVectorPointerTable = 2,
51 kVQAReadVideo = kVQAReadCodebook|kVQAReadVectorPointerTable|kVQAReadCustom,
53 kVQAReadAll = kVQAReadVideo|kVQAReadAudio
60 uint8 interpol2D[256][256];
70 void readFrame(
int frame, uint readFlags = kVQAReadAll);
72 void decodeVideoFrame(
Graphics::Surface *surface,
int frame,
bool forceDraw =
false);
73 void decodeZBuffer(
ZBuffer *zbuffer);
75 void decodeView(
View *view);
77 void decodeLights(
Lights *lights);
79 uint16 numFrames()
const {
return _header.numFrames; }
80 uint8 frameRate()
const {
return _header.frameRate; }
82 uint16 offsetX()
const {
return _header.offsetX; }
83 uint16 offsetY()
const {
return _header.offsetY; }
85 void overrideOffsetXY(uint16 offX, uint16 offY);
87 bool hasAudio()
const {
return _header.channels != 0; }
88 uint16 frequency()
const {
return _header.freq; }
90 bool getLoopBeginAndEndFrame(
int loopId,
int *begin,
int *end);
91 int getLoopIdFromFrame(
int frame);
93 void allocatePaletteVQPTable(
const uint32 numOfPalettes);
94 void updatePaletteVQPTable(uint32 palId, uint16 j, uint16 k, uint8 colorByte);
95 void deleteVQPTable();
138 LoopInfo() : loopCount(0), loops(
nullptr), flags(0) {}
167 VQPPalette *_vqpPalsArr;
168 uint16 _numOfVQPPalettes;
172 bool _allowHorizontalScanlines;
173 bool _allowVerticalScanlines;
174 bool _scaleVideoTo2xRequested;
175 bool _scale2xPossible;
176 bool _centerVideoRequested;
181 uint32 _maxVIEWChunkSize;
182 uint32 _maxZBUFChunkSize;
183 uint32 _maxAESCChunkSize;
188 void readPacket(uint readFlags);
202 static const uint kSizeInBytesOfCPL0Chunk = 768;
207 uint16 getWidth()
const;
208 uint16 getHeight()
const;
210 int getFrameCount()
const;
212 void overrideOffsetXY(uint16 offX, uint16 offY);
215 void decodeZBuffer(
ZBuffer *zbuffer);
216 void decodeView(
View *view);
218 void decodeLights(
Lights *lights);
235 bool useAudioSync()
const {
return false; }
243 uint16 _width, _height;
244 uint8 _blockW, _blockH;
248 uint16 _offsetX, _offsetY;
252 uint32 _maxZBUFChunkSize;
256 uint32 _zbufChunkSize;
259 uint32 _vpointerSize;
265 uint32 _viewDataSize;
267 uint32 _lightsDataSize;
268 uint8 *_screenEffectsData;
269 uint32 _screenEffectsDataSize;
271 int32 _currentPaletteId;
273 uint8 *_cpalPointerNext;
274 uint32 _cpalPointerSize;
275 uint32 _cpalPointerSizeNext;
278 uint8 _countOfCBPsToCBF;
279 uint32 _accumulatedCBPZsizeToCBF;
283 Graphics::FastBlitFunc _blitFunc;
285 void VPTRWriteBlock(
Graphics::Surface *surface,
unsigned int dstBlock,
unsigned int srcBlock,
int count,
bool alpha =
false);
290 static const uint kSizeInShortsAllocatedToAudioFrame = 2940;
291 static const uint kSizeInBytesOfCompressedAudioFrame = 735;
292 static const uint kSizeInShortsAllocatedToAudioFrameMax = 22048;
293 static const uint kSizeInBytesOfCompressedAudioFrameMax = 5512;
307 bool _bigCompressedAudioFrame;
308 uint8 _compressedAudioFrame[kSizeInBytesOfCompressedAudioFrameMax];
Definition: vqa_decoder.h:151
Definition: rational.h:40
Definition: audiostream.h:212
Definition: debugger.h:56
Definition: adpcm_decoder.h:29
Definition: vqa_decoder.h:56
Definition: vqa_decoder.h:133
Definition: vqa_decoder.h:201
Definition: vqa_decoder.h:289
Definition: screen_effects.h:39
Definition: vqa_decoder.h:122