26 #include "common/scummsys.h" 30 #ifndef VIDEO_BINK_DECODER_H 31 #define VIDEO_BINK_DECODER_H 33 #include "common/array.h" 34 #include "common/bitstream.h" 35 #include "common/rational.h" 37 #include "video/video_decoder.h" 39 #include "graphics/surface.h" 43 class QueuingAudioStream;
47 class SeekableReadStream;
48 template <
class BITSTREAM>
69 class BinkDecoder :
public VideoDecoder {
80 void readNextPacket();
81 bool supportsAudioTrackSwitching()
const {
return true; }
82 AudioTrack *getAudioTrack(
int index);
84 uint32 findKeyFrame(uint32 frame)
const;
87 static const int kAudioChannelsMax = 2;
88 static const int kAudioBlockSizeMax = (kAudioChannelsMax << 11);
102 uint32 outSampleRate;
123 float coeffs[16 * kAudioBlockSizeMax];
124 int16 prevCoeffs[kAudioBlockSizeMax];
126 float *coeffsPtr[kAudioChannelsMax];
148 class BinkVideoTrack :
public FixedRateVideoTrack {
150 BinkVideoTrack(uint32 width, uint32 height, uint32 frameCount,
const Common::Rational &frameRate,
bool swapPlanes,
bool hasAlpha, uint32
id);
153 uint16 getWidth()
const override {
return _width; }
154 uint16 getHeight()
const override{
return _height; }
159 _pixelFormat = format;
163 int getCurFrame()
const override {
return _curFrame; }
164 int getFrameCount()
const override {
return _frameCount; }
166 bool isSeekable()
const override{
return true; }
168 bool rewind()
override;
169 void setCurFrame(uint32 frame) { _curFrame = frame; }
172 void decodePacket(VideoFrame &frame);
178 struct DecodeContext {
189 byte *destStart, *destEnd;
190 byte *prevStart, *prevEnd;
195 int coordScaledMap1[64];
196 int coordScaledMap2[64];
197 int coordScaledMap3[64];
198 int coordScaledMap4[64];
203 kSourceBlockTypes = 0,
204 kSourceSubBlockTypes ,
267 Bundle _bundles[kSourceMAX];
272 Huffman _colHighHuffman[16];
277 uint32 _yBlockHeight;
278 uint32 _uvBlockWidth;
279 uint32 _uvBlockHeight;
287 void deinitBundles();
293 void decodePlane(VideoFrame &video,
int planeIdx,
bool isChroma);
296 void readBundle(VideoFrame &video, Source source);
299 void readHuffman(VideoFrame &video, Huffman &huffman);
301 void mergeHuffmanSymbols(VideoFrame &video, byte *dst,
const byte *src,
int size);
304 byte getHuffmanSymbol(VideoFrame &video, Huffman &huffman);
307 int32 getBundleValue(Source source);
309 uint32 readBundleCount(VideoFrame &video, Bundle &bundle);
312 void blockSkip (DecodeContext &ctx);
313 void blockScaledSkip (DecodeContext &ctx);
314 void blockScaledRun (DecodeContext &ctx);
315 void blockScaledIntra (DecodeContext &ctx);
316 void blockScaledFill (DecodeContext &ctx);
317 void blockScaledPattern(DecodeContext &ctx);
318 void blockScaledRaw (DecodeContext &ctx);
319 void blockScaled (DecodeContext &ctx);
320 void blockMotion (DecodeContext &ctx);
321 void blockRun (DecodeContext &ctx);
322 void blockResidue (DecodeContext &ctx);
323 void blockIntra (DecodeContext &ctx);
324 void blockFill (DecodeContext &ctx);
325 void blockInter (DecodeContext &ctx);
326 void blockPattern (DecodeContext &ctx);
327 void blockRaw (DecodeContext &ctx);
330 void readRuns (VideoFrame &video, Bundle &bundle);
331 void readMotionValues(VideoFrame &video, Bundle &bundle);
332 void readBlockTypes (VideoFrame &video, Bundle &bundle);
333 void readPatterns (VideoFrame &video, Bundle &bundle);
334 void readColors (VideoFrame &video, Bundle &bundle);
335 template<
int startBits,
bool hasSign>
336 void readDCS (VideoFrame &video, Bundle &bundle);
337 void readDCTCoeffs (VideoFrame &video, int32 *block,
bool isIntra);
338 void readResidue (VideoFrame &video, int16 *block,
int masksCount);
341 void IDCT(int32 *block);
342 void IDCTPut(DecodeContext &ctx, int32 *block);
343 void IDCTAdd(DecodeContext &ctx, int32 *block);
346 class BinkAudioTrack :
public AudioTrack {
355 bool isSeekable()
const {
return true; }
363 AudioInfo *_audioInfo;
369 void audioBlock(int16 *out);
371 void audioBlockDCT();
373 void audioBlockRDFT();
375 void readAudioCoeffs(
float *coeffs);
377 static void floatToInt16Interleave(int16 *dst,
const float **src, uint32 length, uint8 channels);
385 void initAudioTrack(AudioInfo &audio);
390 #endif // VIDEO_BINK_DECODER_H
Definition: timestamp.h:83
Definition: rational.h:40
SoundType
Definition: mixer.h:62
Definition: bitstream.h:55
Definition: algorithm.h:29
Definition: formatinfo.h:28
Definition: audiostream.h:50
Definition: audiostream.h:370
Definition: avi_frames.h:36