22#include "common/scummsys.h"
23#include "graphics/surface.h"
24#include "image/codecs/codec.h"
35#ifndef IMAGE_CODECS_INDEO_INDEO_H
36#define IMAGE_CODECS_INDEO_INDEO_H
38#include "image/codecs/indeo/get_bits.h"
39#include "image/codecs/indeo/vlc.h"
48 IVI4_FRAMETYPE_INTRA = 0,
49 IVI4_FRAMETYPE_INTRA1 = 1,
50 IVI4_FRAMETYPE_INTER = 2,
51 IVI4_FRAMETYPE_BIDIR = 3,
52 IVI4_FRAMETYPE_INTER_NOREF = 4,
53 IVI4_FRAMETYPE_NULL_FIRST = 5,
54 IVI4_FRAMETYPE_NULL_LAST = 6
65typedef void (InvTransformPtr)(
const int32 *in, int16 *out, uint32 pitch,
const uint8 *flags);
66typedef void (DCTransformPtr)(
const int32 *in, int16 *out, uint32 pitch,
int blkSize);
68typedef void (*IviMCFunc)(int16 *buf,
const int16 *refBuf, uint32 pitch,
int mcType);
69typedef void (*IviMCAvgFunc)(int16 *buf,
const int16 *refBuf1,
const int16 *refBuf2,
70 uint32 pitch,
int mcType,
int mcType2);
73#define IVI_VLC_BITS 13
74#define IVI5_IS_PROTECTED 0x20
79#define IVI_TOSIGNED(val) (-(((val) >> 1) ^ -((val) & 1)))
84#define IVI_MBs_PER_TILE(tileWidth, tileHeight, mbSize) \
85 ((((tileWidth) + (mbSize) - 1) / (mbSize)) * (((tileHeight) + (mbSize) - 1) / (mbSize)))
234 InvTransformPtr *_invTransform;
236 DCTransformPtr *_dcTransform;
239 int _checksumPresent;
248 int initTiles(
IVITile *refTile,
int p,
int b,
int tHeight,
int tWidth);
255 uint16 _chromaHeight;
282 static int initTiles(
IVIPlaneDesc *planes,
int tileWidth,
int tileHeight);
309#define AV_NUM_DATA_POINTERS 3
370 VLC_TYPE _tableData[8192 * 16][2];
371 VLC _iviMbVlcTabs[8];
372 VLC _iviBlkVlcTabs[8];
422 uint32 _transKeyColor;
432 static const RVMapDesc _ff_ivi_rvmap_tabs[9];
452 void recomposeHaar(
const IVIPlaneDesc *plane, uint8 *dst,
const int dstPitch);
461 void recompose53(
const IVIPlaneDesc *plane, uint8 *dst,
const int dstPitch);
472 void outputPlane(
IVIPlaneDesc *plane, uint8 *dst,
int dstPitch);
494 int decodeTileDataSize(
GetBits *gb);
509 int iviMc(
IVIBandDesc *band, IviMCFunc mc, IviMCAvgFunc mcAvg,
510 int offs,
int mvX,
int mvY,
int mvX2,
int mvY2,
int mcType,
int mcType2);
513 IviMCFunc mc, IviMCAvgFunc mcAvg,
int mvX,
int mvY,
514 int mvX2,
int mvY2, int32 *prevDc,
int isIntra,
515 int mcType,
int mcType2, uint32 quant,
int offs);
517 int iviDcTransform(
IVIBandDesc *band, int32 *prevDc,
int bufOffs,
531 static const uint8 _ffIviHorizontalScan8x8[64];
532 static const uint8 _ffIviDirectScan4x4[16];
544 if (format.bytesPerPixel != 2 && format.bytesPerPixel != 4)
546 _pixelFormat = format;
561 virtual bool isNonNullFrame()
const = 0;
Definition: get_bits.h:33
Graphics::PixelFormat getPixelFormat() const override
Definition: indeo.h:537
virtual int decodeMbInfo(IVIBandDesc *band, IVITile *tile)=0
static const uint8 _ffIviVerticalScan8x8[64]
Definition: indeo.h:530
virtual int decodePictureHeader()=0
bool setOutputPixelFormat(const Graphics::PixelFormat &format) override
Definition: indeo.h:543
virtual int decodeTransparency()
Definition: indeo.h:584
int scaleMV(int mv, int mvScale)
virtual int decodeBandHeader(IVIBandDesc *band)=0
virtual void switchBuffers()=0
uint8 * _data[3]
Definition: indeo.h:322
int setDimensions(uint16 width, uint16 height)
int _width
Definition: indeo.h:307
~AVFrame()
Definition: indeo.h:349
int _linesize[3]
Definition: indeo.h:339
uint32 _dataSize
size of the frame data in bytes from picture header
Definition: indeo.h:380
uint32 _picHdrSize
picture header size in bytes
Definition: indeo.h:385
uint32 _frameSize
frame size in bytes
Definition: indeo.h:384
int _dstBuf
buffer index for the currently decoded frame
Definition: indeo.h:393
const uint8 * _frameData
input frame data pointer
Definition: indeo.h:382
int _refBuf
inter frame reference buffer index
Definition: indeo.h:394
uint16 _checksum
frame _checksum
Definition: indeo.h:387
IVIPlaneDesc _planes[3]
color planes
Definition: indeo.h:390
int _interScal
signals a sequence of scalable inter frames
Definition: indeo.h:383
int _bRefBuf
second reference frame buffer index
Definition: indeo.h:396
bool _inQ
flag for explicitly stored quantiser delta
Definition: indeo.h:404
IVIHuffTab _transVlc
current transparency table descriptor
Definition: indeo.h:400
int _prevFrameType
frame type of the previous frame
Definition: indeo.h:379
IVIHuffTab _blkVlc
current block table descriptor
Definition: indeo.h:399
RVMapDesc _rvmapTabs[9]
local corrected copy of the static rvmap tables
Definition: indeo.h:375
bool _hasTransp
transparency mode enabled
Definition: indeo.h:413
int _bufSwitch
used to switch between three buffers
Definition: indeo.h:392
int _ref2Buf
temporal storage for switching buffers
Definition: indeo.h:395
IVIHuffTab _mbVlc
current macroblock table descriptor
Definition: indeo.h:398
int _scanSize
size of the scantable
Definition: indeo.h:224
int _blkSize
block size
Definition: indeo.h:216
const uint8 * _dataPtr
ptr to the first byte of the band data
Definition: indeo.h:207
RVMapDesc * _rvMap
ptr to the RLE table for this band
Definition: indeo.h:231
int _bandNum
band number
Definition: indeo.h:203
int _numTiles
number of tiles in this band
Definition: indeo.h:232
int32 _checksum
for debug purposes
Definition: indeo.h:238
bool _qdeltaPresent
tells if Qdelta signal is present in the bitstream (Indeo5 only)
Definition: indeo.h:220
int _pitch
_pitch associated with the buffers above
Definition: indeo.h:213
int _rvmapSel
rvmap table selector
Definition: indeo.h:230
const uint8 * _interScale
quantization coefficient for inter blocks
Definition: indeo.h:244
int _mbSize
macroblock size
Definition: indeo.h:215
int _quantMat
dequant matrix index
Definition: indeo.h:221
int _bufSize
band buffer size in bytes
Definition: indeo.h:240
const uint8 * _scan
ptr to the scan pattern
Definition: indeo.h:223
int16 * _bufs[4]
array of pointers to the band buffers
Definition: indeo.h:212
int _aHeight
aligned band height
Definition: indeo.h:206
uint8 _corr[61 *2]
rvmap correction pairs
Definition: indeo.h:229
const uint8 * _intraScale
quantization coefficient for intra blocks
Definition: indeo.h:243
int _dataSize
size of the band data
Definition: indeo.h:208
int16 * _refBuf
pointer to the reference frame buffer (for motion compensation)
Definition: indeo.h:210
int16 * _buf
pointer to the output buffer for this band
Definition: indeo.h:209
int _globQuant
quant base for this band
Definition: indeo.h:222
const uint16 * _intraBase
quantization matrix for intra blocks
Definition: indeo.h:241
bool _inheritMv
tells if motion vector is inherited from reference macroblock
Definition: indeo.h:218
bool _inheritQDelta
tells if quantiser delta is inherited from reference macroblock
Definition: indeo.h:219
int _plane
plane number this band belongs to
Definition: indeo.h:202
uint8 _isHalfpel
precision of the motion compensation: 0 - fullpel, 1 - halfpel
Definition: indeo.h:217
IVIHuffTab _blkVlc
vlc table for decoding block data
Definition: indeo.h:226
IVITile * _tiles
array of tile descriptors
Definition: indeo.h:233
int _numCorr
number of correction entries
Definition: indeo.h:228
int16 * _bRefBuf
pointer to the second reference frame buffer (for motion compensation)
Definition: indeo.h:211
const uint16 * _interBase
quantization matrix for inter blocks
Definition: indeo.h:242
int createHuffFromDesc(VLC *vlc, bool flag) const
bool huffDescCompare(const IVIHuffDesc *desc2) const
void huffDescCopy(const IVIHuffDesc *src)
VLC * _tab
Definition: indeo.h:129
VLC _custTab
custom Huffman codebook descriptor
Definition: indeo.h:133
int decodeHuffDesc(IVI45DecContext *ctx, int descCoded, int whichTab)
IVIHuffTab()
vlc table for custom codebook
IVIHuffDesc _custDesc
pointer to the table associated with tab_sel
Definition: indeo.h:132
int8 _mvY
motion vector (y component)
Definition: indeo.h:173
int8 _bMvX
second motion vector (x component)
Definition: indeo.h:174
uint8 _type
macroblock type: 0 - INTRA, 1 - INTER
Definition: indeo.h:169
int8 _qDelta
quant delta
Definition: indeo.h:171
uint32 _bufOffs
address in the output buffer for this mb
Definition: indeo.h:168
int8 _mvX
motion vector (x component)
Definition: indeo.h:172
int8 _bMvY
second motion vector (y component)
Definition: indeo.h:175
uint8 _cbp
coded block pattern
Definition: indeo.h:170
bool ivi_pic_config_cmp(const IVIPicConfig &cfg2)
IVIBandDesc * _bands
array of band descriptors
Definition: indeo.h:276
static int checkImageSize(unsigned int w, unsigned int h, int logOffset)
uint8 _numBands
number of bands this plane subdivided into
Definition: indeo.h:275
static void freeBuffers(IVIPlaneDesc *planes)
int _dataSize
size of the data in bytes
Definition: indeo.h:190
IVIMbInfo * _mbs
array of macroblock descriptors
Definition: indeo.h:192
IVIMbInfo * _refMbs
ptr to the macroblock descriptors of the reference tile
Definition: indeo.h:193
int _numMBs
number of macroblocks in this tile
Definition: indeo.h:191
uint8 _escSym
escape symbol
Definition: indeo.h:157
uint8 _eobSym
end of block symbol
Definition: indeo.h:156