aboutsummaryrefslogtreecommitdiff
path: root/image/codecs
diff options
context:
space:
mode:
authorPaul Gilbert2016-09-10 16:04:22 -0400
committerPaul Gilbert2016-09-10 16:04:22 -0400
commit58ad70f351caa6f7791bf5ff62b0166e37dadf47 (patch)
treee89c600142ad884258e5e689804cdb568ff324ab /image/codecs
parentfe6d624277412e7a9b32126da2586d6e663c9e91 (diff)
downloadscummvm-rg350-58ad70f351caa6f7791bf5ff62b0166e37dadf47.tar.gz
scummvm-rg350-58ad70f351caa6f7791bf5ff62b0166e37dadf47.tar.bz2
scummvm-rg350-58ad70f351caa6f7791bf5ff62b0166e37dadf47.zip
IMAGE: Renaming structure fields for Indeo decoders
Diffstat (limited to 'image/codecs')
-rw-r--r--image/codecs/indeo/indeo.cpp934
-rw-r--r--image/codecs/indeo/indeo.h315
-rw-r--r--image/codecs/indeo4.cpp465
-rw-r--r--image/codecs/indeo4.h6
-rw-r--r--image/codecs/indeo5.cpp482
5 files changed, 1102 insertions, 1100 deletions
diff --git a/image/codecs/indeo/indeo.cpp b/image/codecs/indeo/indeo.cpp
index 1968638436..632e39ea7b 100644
--- a/image/codecs/indeo/indeo.cpp
+++ b/image/codecs/indeo/indeo.cpp
@@ -79,7 +79,7 @@ static const IVIHuffDesc ivi_blk_huff_desc[8] = {
/*------------------------------------------------------------------------*/
/**
- * calculate number of tiles in a stride
+ * calculate number of _tiles in a stride
*/
#define IVI_NUM_TILES(stride, tile_size) (((stride) + (tile_size) - 1) / (tile_size))
@@ -92,16 +92,16 @@ int IVIHuffDesc::ivi_create_huff_from_desc(VLC *vlc, int flag) const {
pos = 0; // current position = 0
- for (i = 0; i < num_rows; i++) {
- codes_per_row = 1 << xbits[i];
- not_last_row = (i != num_rows - 1);
- prefix = ((1 << i) - 1) << (xbits[i] + not_last_row);
+ for (i = 0; i < _numRows; i++) {
+ codes_per_row = 1 << _xBits[i];
+ not_last_row = (i != _numRows - 1);
+ prefix = ((1 << i) - 1) << (_xBits[i] + not_last_row);
for (j = 0; j < codes_per_row; j++) {
if (pos >= 256) // Some Indeo5 codebooks can have more than 256
break; // elements, but only 256 codes are allowed!
- bits[pos] = i + xbits[i] + not_last_row;
+ bits[pos] = i + _xBits[i] + not_last_row;
if (bits[pos] > IVI_VLC_BITS)
return -1; // invalid descriptor
@@ -121,18 +121,18 @@ int IVIHuffDesc::ivi_create_huff_from_desc(VLC *vlc, int flag) const {
/*------------------------------------------------------------------------*/
bool IVIHuffDesc::ivi_huff_desc_cmp(const IVIHuffDesc *desc2) const {
- return num_rows != desc2->num_rows ||
- memcmp(xbits, desc2->xbits, num_rows);
+ return _numRows != desc2->_numRows ||
+ memcmp(_xBits, desc2->_xBits, _numRows);
}
void IVIHuffDesc::ivi_huff_desc_copy(const IVIHuffDesc *src) {
- num_rows = src->num_rows;
- memcpy(xbits, src->xbits, src->num_rows);
+ _numRows = src->_numRows;
+ memcpy(_xBits, src->_xBits, src->_numRows);
}
/*------------------------------------------------------------------------*/
-IVIHuffTab::IVIHuffTab() : tab(nullptr) {
+IVIHuffTab::IVIHuffTab() : _tab(nullptr) {
}
int IVIHuffTab::ff_ivi_dec_huff_desc(IVI45DecContext *ctx, int desc_coded, int which_tab) {
@@ -141,42 +141,42 @@ int IVIHuffTab::ff_ivi_dec_huff_desc(IVI45DecContext *ctx, int desc_coded, int w
if (!desc_coded) {
// select default table
- tab = (which_tab) ? &ctx->ivi_blk_vlc_tabs[7]
- : &ctx->ivi_mb_vlc_tabs[7];
+ _tab = (which_tab) ? &ctx->_iviBlkVlcTabs[7]
+ : &ctx->_iviMbVlcTabs[7];
return 0;
}
- tab_sel = ctx->gb->getBits(3);
- if (tab_sel == 7) {
+ _tabSel = ctx->_gb->getBits(3);
+ if (_tabSel == 7) {
// custom huffman table (explicitly encoded)
- new_huff.num_rows = ctx->gb->getBits(4);
- if (!new_huff.num_rows) {
+ new_huff._numRows = ctx->_gb->getBits(4);
+ if (!new_huff._numRows) {
warning("Empty custom Huffman table!");
return -1;
}
- for (i = 0; i < new_huff.num_rows; i++)
- new_huff.xbits[i] = ctx->gb->getBits(4);
+ for (i = 0; i < new_huff._numRows; i++)
+ new_huff._xBits[i] = ctx->_gb->getBits(4);
// Have we got the same custom table? Rebuild if not.
- if (new_huff.ivi_huff_desc_cmp(&cust_desc) || !cust_tab._table) {
- cust_desc.ivi_huff_desc_copy(&new_huff);
+ if (new_huff.ivi_huff_desc_cmp(&_custDesc) || !_custTab._table) {
+ _custDesc.ivi_huff_desc_copy(&new_huff);
- if (cust_tab._table)
- cust_tab.ff_free_vlc();
- result = cust_desc.ivi_create_huff_from_desc(&cust_tab, 0);
+ if (_custTab._table)
+ _custTab.ff_free_vlc();
+ result = _custDesc.ivi_create_huff_from_desc(&_custTab, 0);
if (result) {
// reset faulty description
- cust_desc.num_rows = 0;
+ _custDesc._numRows = 0;
warning("Error while initializing custom vlc table!");
return result;
}
}
- tab = &cust_tab;
+ _tab = &_custTab;
} else {
// select one of predefined tables
- tab = (which_tab) ? &ctx->ivi_blk_vlc_tabs[tab_sel]
- : &ctx->ivi_mb_vlc_tabs[tab_sel];
+ _tab = (which_tab) ? &ctx->_iviBlkVlcTabs[_tabSel]
+ : &ctx->_iviMbVlcTabs[_tabSel];
}
return 0;
@@ -184,60 +184,62 @@ int IVIHuffTab::ff_ivi_dec_huff_desc(IVI45DecContext *ctx, int desc_coded, int w
/*------------------------------------------------------------------------*/
-IVIMbInfo::IVIMbInfo() : xpos(0), ypos(0), buf_offs(0), type(0), cbp(0),
- q_delta(0), mv_x(0), mv_y(0), b_mv_x(0), b_mv_y(0) {
+IVIMbInfo::IVIMbInfo() : _xPos(0), _yPos(0), _bufOffs(0), _type(0), _cbp(0),
+ _qDelta(0), _mvX(0), _mvY(0), _bMvX(0), _bMvY(0) {
}
/*------------------------------------------------------------------------*/
-IVITile::IVITile() : xpos(0), ypos(0), width(0), height(0), mb_size(0),
- is_empty(0), data_size(0), num_MBs(0), mbs(nullptr), ref_mbs(nullptr) {
+IVITile::IVITile() : _xPos(0), _yPos(0), _width(0), _height(0), _mbSize(0),
+ _isEmpty(false), _dataSize(0), _numMBs(0), _mbs(nullptr), _refMbs(nullptr) {
}
/*------------------------------------------------------------------------*/
-IVIBandDesc::IVIBandDesc() : plane(0), band_num(0), width(0), height(0),
- aheight(0), data_ptr(nullptr), data_size(0), buf(nullptr),
- ref_buf(nullptr), b_ref_buf(nullptr), pitch(0), is_empty(0),
- mb_size(0), blk_size(0), is_halfpel(0), inherit_mv(0), bufsize(0),
- inherit_qdelta(0), qdelta_present(0), quant_mat(0), glob_quant(0),
- scan(nullptr), scan_size(0), num_corr(0), rvmap_sel(0), rv_map(nullptr),
- num_tiles(0), tiles(nullptr), inv_transform(nullptr), transform_size(0),
- dc_transform(nullptr), is_2d_trans(0), checksum(0), checksum_present(0),
- intra_base(nullptr), inter_base(nullptr), intra_scale(nullptr),
- inter_scale(nullptr) {
- Common::fill(&bufs[0], &bufs[4], (int16 *)nullptr);
- Common::fill(&corr[0], &corr[61 * 2], 0);
+IVIBandDesc::IVIBandDesc() : _plane(0), _bandNum(0), _width(0), _height(0),
+ _aHeight(0), _dataPtr(nullptr), _dataSize(0), _buf(nullptr),
+ _refBuf(nullptr), _bRefBuf(nullptr), _pitch(0), _isEmpty(false),
+ _mbSize(0), _blkSize(0), _isHalfpel(false), _inheritMv(false), _bufSize(0),
+ _inheritQDelta(false), _qdeltaPresent(false), _quantMat(0), _globQuant(0),
+ _scan(nullptr), _scanSize(0), _numCorr(0), _rvmapSel(0), _rvMap(nullptr),
+ _numTiles(0), _tiles(nullptr), _invTransform(nullptr), _transformSize(0),
+ _dcTransform(nullptr), _is2dTrans(0), _checksum(0), _checksumPresent(false),
+ _intraBase(nullptr), _interBase(nullptr), _intraScale(nullptr),
+ _interScale(nullptr) {
+ Common::fill(&_bufs[0], &_bufs[4], (int16 *)nullptr);
+ Common::fill(&_corr[0], &_corr[61 * 2], 0);
}
int IVIBandDesc::ivi_init_tiles(IVITile *ref_tile, int p, int b, int t_height, int t_width) {
int x, y;
- IVITile *tile = tiles;
-
- for (y = 0; y < height; y += t_height) {
- for (x = 0; x < width; x += t_width) {
- tile->xpos = x;
- tile->ypos = y;
- tile->mb_size = mb_size;
- tile->width = MIN(width - x, t_width);
- tile->height = MIN(height - y, t_height);
- tile->is_empty = tile->data_size = 0;
+ IVITile *tile = _tiles;
+
+ for (y = 0; y < _height; y += t_height) {
+ for (x = 0; x < _width; x += t_width) {
+ tile->_xPos = x;
+ tile->_yPos = y;
+ tile->_mbSize = _mbSize;
+ tile->_width = MIN(_width - x, t_width);
+ tile->_height = MIN(_height - y, t_height);
+ tile->_dataSize = 0;
+ tile->_isEmpty = false;
+
// calculate number of macroblocks
- tile->num_MBs = IVI_MBs_PER_TILE(tile->width, tile->height,
- mb_size);
+ tile->_numMBs = IVI_MBs_PER_TILE(tile->_width, tile->_height,
+ _mbSize);
- av_freep(&tile->mbs);
- tile->mbs = (IVIMbInfo *)av_mallocz_array(tile->num_MBs, sizeof(IVIMbInfo));
- if (!tile->mbs)
+ av_freep(&tile->_mbs);
+ tile->_mbs = (IVIMbInfo *)av_mallocz_array(tile->_numMBs, sizeof(IVIMbInfo));
+ if (!tile->_mbs)
return -2;
- tile->ref_mbs = 0;
+ tile->_refMbs = 0;
if (p || b) {
- if (tile->num_MBs != ref_tile->num_MBs) {
+ if (tile->_numMBs != ref_tile->_numMBs) {
warning("ref_tile mismatch");
return -1;
}
- tile->ref_mbs = ref_tile->mbs;
+ tile->_refMbs = ref_tile->_mbs;
ref_tile++;
}
tile++;
@@ -249,23 +251,23 @@ int IVIBandDesc::ivi_init_tiles(IVITile *ref_tile, int p, int b, int t_height, i
/*------------------------------------------------------------------------*/
-IVIPicConfig::IVIPicConfig() : pic_width(0), pic_height(0), chroma_width(0),
- chroma_height(0), tile_width(0), tile_height(0), luma_bands(0), chroma_bands(0) {
+IVIPicConfig::IVIPicConfig() : _picWidth(0), _picHeight(0), _chromaWidth(0),
+ _chromaHeight(0), _tileWidth(0), _tileHeight(0), _lumaBands(0), _chromaBands(0) {
}
bool IVIPicConfig::ivi_pic_config_cmp(const IVIPicConfig &cfg2) {
- return pic_width != cfg2.pic_width || pic_height != cfg2.pic_height ||
- chroma_width != cfg2.chroma_width || chroma_height != cfg2.chroma_height ||
- tile_width != cfg2.tile_width || tile_height != cfg2.tile_height ||
- luma_bands != cfg2.luma_bands || chroma_bands != cfg2.chroma_bands;
+ return _picWidth != cfg2._picWidth || _picHeight != cfg2._picHeight ||
+ _chromaWidth != cfg2._chromaWidth || _chromaHeight != cfg2._chromaHeight ||
+ _tileWidth != cfg2._tileWidth || _tileHeight != cfg2._tileHeight ||
+ _lumaBands != cfg2._lumaBands || _chromaBands != cfg2._chromaBands;
}
/*------------------------------------------------------------------------*/
-IVIPlaneDesc::IVIPlaneDesc() : width(0), height(0), num_bands(0), bands(nullptr) {
+IVIPlaneDesc::IVIPlaneDesc() : _width(0), _height(0), _numBands(0), _bands(nullptr) {
}
-int IVIPlaneDesc::ff_ivi_init_planes(IVIPlaneDesc *planes, const IVIPicConfig *cfg, bool is_indeo4) {
+int IVIPlaneDesc::ff_ivi_init_planes(IVIPlaneDesc *planes, const IVIPicConfig *cfg, bool _isIndeo4) {
int p, b;
uint32 b_width, b_height, align_fac, width_aligned,
height_aligned, buf_size;
@@ -273,32 +275,32 @@ int IVIPlaneDesc::ff_ivi_init_planes(IVIPlaneDesc *planes, const IVIPicConfig *c
ivi_free_buffers(planes);
- if (av_image_check_size(cfg->pic_width, cfg->pic_height, 0, NULL) < 0 ||
- cfg->luma_bands < 1 || cfg->chroma_bands < 1)
+ if (av_image_check_size(cfg->_picWidth, cfg->_picHeight, 0, NULL) < 0 ||
+ cfg->_lumaBands < 1 || cfg->_chromaBands < 1)
return -1;
- // fill in the descriptor of the luminance plane
- planes[0].width = cfg->pic_width;
- planes[0].height = cfg->pic_height;
- planes[0].num_bands = cfg->luma_bands;
+ // fill in the descriptor of the luminance _plane
+ planes[0]._width = cfg->_picWidth;
+ planes[0]._height = cfg->_picHeight;
+ planes[0]._numBands = cfg->_lumaBands;
// fill in the descriptors of the chrominance planes
- planes[1].width = planes[2].width = (cfg->pic_width + 3) >> 2;
- planes[1].height = planes[2].height = (cfg->pic_height + 3) >> 2;
- planes[1].num_bands = planes[2].num_bands = cfg->chroma_bands;
+ planes[1]._width = planes[2]._width = (cfg->_picWidth + 3) >> 2;
+ planes[1]._height = planes[2]._height = (cfg->_picHeight + 3) >> 2;
+ planes[1]._numBands = planes[2]._numBands = cfg->_chromaBands;
for (p = 0; p < 3; p++) {
- planes[p].bands = (IVIBandDesc *)av_mallocz_array(planes[p].num_bands, sizeof(IVIBandDesc));
- if (!planes[p].bands)
+ planes[p]._bands = (IVIBandDesc *)av_mallocz_array(planes[p]._numBands, sizeof(IVIBandDesc));
+ if (!planes[p]._bands)
return -2;
// select band dimensions: if there is only one band then it
// has the full size, if there are several bands each of them
// has only half size
- b_width = planes[p].num_bands == 1 ? planes[p].width
- : (planes[p].width + 1) >> 1;
- b_height = planes[p].num_bands == 1 ? planes[p].height
- : (planes[p].height + 1) >> 1;
+ b_width = planes[p]._numBands == 1 ? planes[p]._width
+ : (planes[p]._width + 1) >> 1;
+ b_height = planes[p]._numBands == 1 ? planes[p]._height
+ : (planes[p]._height + 1) >> 1;
// luma band buffers will be aligned on 16x16 (max macroblock size)
// chroma band buffers will be aligned on 8x8 (max macroblock size)
@@ -307,33 +309,33 @@ int IVIPlaneDesc::ff_ivi_init_planes(IVIPlaneDesc *planes, const IVIPicConfig *c
height_aligned = FFALIGN(b_height, align_fac);
buf_size = width_aligned * height_aligned * sizeof(int16);
- for (b = 0; b < planes[p].num_bands; b++) {
- band = &planes[p].bands[b]; // select appropriate plane/band
- band->plane = p;
- band->band_num = b;
- band->width = b_width;
- band->height = b_height;
- band->pitch = width_aligned;
- band->aheight = height_aligned;
- band->bufs[0] = (int16 *)av_mallocz(buf_size);
- band->bufs[1] = (int16 *)av_mallocz(buf_size);
- band->bufsize = buf_size / 2;
- if (!band->bufs[0] || !band->bufs[1])
+ for (b = 0; b < planes[p]._numBands; b++) {
+ band = &planes[p]._bands[b]; // select appropriate _plane/band
+ band->_plane = p;
+ band->_bandNum = b;
+ band->_width = b_width;
+ band->_height = b_height;
+ band->_pitch = width_aligned;
+ band->_aHeight = height_aligned;
+ band->_bufs[0] = (int16 *)av_mallocz(buf_size);
+ band->_bufs[1] = (int16 *)av_mallocz(buf_size);
+ band->_bufSize = buf_size / 2;
+ if (!band->_bufs[0] || !band->_bufs[1])
return -2;
// allocate the 3rd band buffer for scalability mode
- if (cfg->luma_bands > 1) {
- band->bufs[2] = (int16 *)av_mallocz(buf_size);
- if (!band->bufs[2])
+ if (cfg->_lumaBands > 1) {
+ band->_bufs[2] = (int16 *)av_mallocz(buf_size);
+ if (!band->_bufs[2])
return -2;
}
- if (is_indeo4) {
- band->bufs[3] = (int16 *)av_mallocz(buf_size);
- if (!band->bufs[3])
+ if (_isIndeo4) {
+ band->_bufs[3] = (int16 *)av_mallocz(buf_size);
+ if (!band->_bufs[3])
return -2;
}
// reset custom vlc
- planes[p].bands[0].blk_vlc.cust_desc.num_rows = 0;
+ planes[p]._bands[0]._blkVlc._custDesc._numRows = 0;
}
}
@@ -341,35 +343,35 @@ int IVIPlaneDesc::ff_ivi_init_planes(IVIPlaneDesc *planes, const IVIPicConfig *c
}
int IVIPlaneDesc::ff_ivi_init_tiles(IVIPlaneDesc *planes,
- int tile_width, int tile_height) {
+ int _tileWidth, int _tileHeight) {
int p, b, x_tiles, y_tiles, t_width, t_height, ret;
IVIBandDesc *band;
for (p = 0; p < 3; p++) {
- t_width = !p ? tile_width : (tile_width + 3) >> 2;
- t_height = !p ? tile_height : (tile_height + 3) >> 2;
+ t_width = !p ? _tileWidth : (_tileWidth + 3) >> 2;
+ t_height = !p ? _tileHeight : (_tileHeight + 3) >> 2;
- if (!p && planes[0].num_bands == 4) {
+ if (!p && planes[0]._numBands == 4) {
t_width >>= 1;
t_height >>= 1;
}
if (t_width <= 0 || t_height <= 0)
return -3;
- for (b = 0; b < planes[p].num_bands; b++) {
- band = &planes[p].bands[b];
- x_tiles = IVI_NUM_TILES(band->width, t_width);
- y_tiles = IVI_NUM_TILES(band->height, t_height);
- band->num_tiles = x_tiles * y_tiles;
+ for (b = 0; b < planes[p]._numBands; b++) {
+ band = &planes[p]._bands[b];
+ x_tiles = IVI_NUM_TILES(band->_width, t_width);
+ y_tiles = IVI_NUM_TILES(band->_height, t_height);
+ band->_numTiles = x_tiles * y_tiles;
- av_freep(&band->tiles);
- band->tiles = (IVITile *)av_mallocz_array(band->num_tiles, sizeof(IVITile));
- if (!band->tiles)
+ av_freep(&band->_tiles);
+ band->_tiles = (IVITile *)av_mallocz_array(band->_numTiles, sizeof(IVITile));
+ if (!band->_tiles)
return -2;
// use the first luma band as reference for motion vectors
// and quant
- ret = band->ivi_init_tiles(planes[0].bands[0].tiles,
+ ret = band->ivi_init_tiles(planes[0]._bands[0]._tiles,
p, b, t_height, t_width);
if (ret < 0)
return ret;
@@ -383,21 +385,21 @@ void IVIPlaneDesc::ivi_free_buffers(IVIPlaneDesc *planes) {
int p, b, t;
for (p = 0; p < 3; p++) {
- if (planes[p].bands)
- for (b = 0; b < planes[p].num_bands; b++) {
- av_freep(&planes[p].bands[b].bufs[0]);
- av_freep(&planes[p].bands[b].bufs[1]);
- av_freep(&planes[p].bands[b].bufs[2]);
- av_freep(&planes[p].bands[b].bufs[3]);
-
- if (planes[p].bands[b].blk_vlc.cust_tab._table)
- planes[p].bands[b].blk_vlc.cust_tab.ff_free_vlc();
- for (t = 0; t < planes[p].bands[b].num_tiles; t++)
- av_freep(&planes[p].bands[b].tiles[t].mbs);
- av_freep(&planes[p].bands[b].tiles);
+ if (planes[p]._bands)
+ for (b = 0; b < planes[p]._numBands; b++) {
+ av_freep(&planes[p]._bands[b]._bufs[0]);
+ av_freep(&planes[p]._bands[b]._bufs[1]);
+ av_freep(&planes[p]._bands[b]._bufs[2]);
+ av_freep(&planes[p]._bands[b]._bufs[3]);
+
+ if (planes[p]._bands[b]._blkVlc._custTab._table)
+ planes[p]._bands[b]._blkVlc._custTab.ff_free_vlc();
+ for (t = 0; t < planes[p]._bands[b]._numTiles; t++)
+ av_freep(&planes[p]._bands[b]._tiles[t]._mbs);
+ av_freep(&planes[p]._bands[b]._tiles);
}
- av_freep(&planes[p].bands);
- planes[p].num_bands = 0;
+ av_freep(&planes[p]._bands);
+ planes[p]._numBands = 0;
}
}
@@ -439,48 +441,48 @@ void AVFrame::av_frame_free() {
/*------------------------------------------------------------------------*/
-IVI45DecContext::IVI45DecContext() : gb(nullptr), frame_num(0), frame_type(0),
- prev_frame_type(0), data_size(0), is_scalable(0), frame_data(0),
- inter_scal(0), frame_size(0), pic_hdr_size(0), frame_flags(0),
- checksum(0), buf_switch(0), dst_buf(0), ref_buf(0), ref2_buf(0),
- b_ref_buf(0), rvmap_sel(0), in_imf(0), in_q(0), pic_glob_quant(0),
- unknown1(0), gop_hdr_size(0), gop_flags(0), lock_word(0), has_b_frames(0),
- has_transp(0), uses_tiling(0), uses_haar(0), uses_fullpel(0), gop_invalid(0),
- is_indeo4(0), p_frame(nullptr), got_p_frame(0) {
- Common::fill(&buf_invalid[0], &buf_invalid[4], 0);
- Common::copy(&_ff_ivi_rvmap_tabs[0], &_ff_ivi_rvmap_tabs[9], &rvmap_tabs[0]);
+IVI45DecContext::IVI45DecContext() : _gb(nullptr), _frameNum(0), _frameType(0),
+ _prevFrameType(0), _dataSize(0), _isScalable(0), _frameData(0),
+ _interScal(0), _frameSize(0), _picHdrSize(0), _frameFlags(0),
+ _checksum(0), _bufSwitch(0), _dstBuf(0), _refBuf(0), _ref2Buf(0),
+ _bRefBuf(0), _rvmapSel(0), _inImf(false), _inQ(false), _picGlobQuant(0),
+ _unknown1(0), _gopHdrSize(0), _gopFlags(0), _lockWord(0), _hasBFrames(false),
+ _hasTransp(false), _usesTiling(false), _usesHaar(false), _usesFullpel(false),
+ _gopInvalid(false), _isIndeo4(false), _pFrame(nullptr), _gotPFrame(false) {
+ Common::fill(&_bufInvalid[0], &_bufInvalid[4], 0);
+ Common::copy(&_ff_ivi_rvmap_tabs[0], &_ff_ivi_rvmap_tabs[9], &_rvmapTabs[0]);
for (int idx = 0; idx < (8192 * 16); ++idx)
- table_data[idx][0] = table_data[idx][1] = 0;
+ _tableData[idx][0] = _tableData[idx][1] = 0;
for (int i = 0; i < 8; i++) {
- ivi_mb_vlc_tabs[i]._table = table_data + i * 2 * 8192;
- ivi_mb_vlc_tabs[i]._table_allocated = 8192;
- ivi_mb_huff_desc[i].ivi_create_huff_from_desc(&ivi_mb_vlc_tabs[i], 1);
- ivi_blk_vlc_tabs[i]._table = table_data + (i * 2 + 1) * 8192;
- ivi_blk_vlc_tabs[i]._table_allocated = 8192;
- ivi_blk_huff_desc[i].ivi_create_huff_from_desc(&ivi_blk_vlc_tabs[i], 1);
+ _iviMbVlcTabs[i]._table = _tableData + i * 2 * 8192;
+ _iviMbVlcTabs[i]._table_allocated = 8192;
+ ivi_mb_huff_desc[i].ivi_create_huff_from_desc(&_iviMbVlcTabs[i], 1);
+ _iviBlkVlcTabs[i]._table = _tableData + (i * 2 + 1) * 8192;
+ _iviBlkVlcTabs[i]._table_allocated = 8192;
+ ivi_blk_huff_desc[i].ivi_create_huff_from_desc(&_iviBlkVlcTabs[i], 1);
}
}
/*------------------------------------------------------------------------*/
-IndeoDecoderBase::IndeoDecoderBase(uint16 width, uint16 height) : Codec() {
+IndeoDecoderBase::IndeoDecoderBase(uint16 _width, uint16 _height) : Codec() {
_pixelFormat = g_system->getScreenFormat();
assert(_pixelFormat.bytesPerPixel > 1);
_surface = new Graphics::ManagedSurface();
- _surface->create(width, height, _pixelFormat);
- _surface->fillRect(Common::Rect(0, 0, width, height), 0);
- _ctx.b_ref_buf = 3; // buffer 2 is used for scalability mode
+ _surface->create(_width, _height, _pixelFormat);
+ _surface->fillRect(Common::Rect(0, 0, _width, _height), 0);
+ _ctx._bRefBuf = 3; // buffer 2 is used for scalability mode
}
IndeoDecoderBase::~IndeoDecoderBase() {
delete _surface;
- IVIPlaneDesc::ivi_free_buffers(_ctx.planes);
- if (_ctx.mb_vlc.cust_tab._table)
- _ctx.mb_vlc.cust_tab.ff_free_vlc();
+ IVIPlaneDesc::ivi_free_buffers(_ctx._planes);
+ if (_ctx._mbVlc._custTab._table)
+ _ctx._mbVlc._custTab.ff_free_vlc();
- delete _ctx.p_frame;
+ delete _ctx._pFrame;
}
int IndeoDecoderBase::decodeIndeoFrame() {
@@ -492,20 +494,20 @@ int IndeoDecoderBase::decodeIndeoFrame() {
if (decodePictureHeader() < 0)
return -1;
- if (_ctx.gop_invalid)
+ if (_ctx._gopInvalid)
return -1;
- if (_ctx.frame_type == IVI4_FRAMETYPE_NULL_LAST) {
+ if (_ctx._frameType == IVI4_FRAMETYPE_NULL_LAST) {
// Returning the previous frame, so exit wth success
return 0;
}
- if (_ctx.gop_flags & IVI5_IS_PROTECTED) {
+ if (_ctx._gopFlags & IVI5_IS_PROTECTED) {
warning("Password-protected clip");
return -1;
}
- if (!_ctx.planes[0].bands) {
+ if (!_ctx._planes[0]._bands) {
warning("Color planes not initialized yet");
return -1;
}
@@ -515,27 +517,27 @@ int IndeoDecoderBase::decodeIndeoFrame() {
//{ START_TIMER;
if (is_nonnull_frame()) {
- _ctx.buf_invalid[_ctx.dst_buf] = 1;
+ _ctx._bufInvalid[_ctx._dstBuf] = 1;
for (p = 0; p < 3; p++) {
- for (b = 0; b < _ctx.planes[p].num_bands; b++) {
- result = decode_band(&_ctx.planes[p].bands[b]);
+ for (b = 0; b < _ctx._planes[p]._numBands; b++) {
+ result = decode_band(&_ctx._planes[p]._bands[b]);
if (result < 0) {
- warning("Error while decoding band: %d, plane: %d", b, p);
+ warning("Error while decoding band: %d, _plane: %d", b, p);
return result;
}
}
}
- _ctx.buf_invalid[_ctx.dst_buf] = 0;
+ _ctx._bufInvalid[_ctx._dstBuf] = 0;
} else {
- if (_ctx.is_scalable)
+ if (_ctx._isScalable)
return -1;
for (p = 0; p < 3; p++) {
- if (!_ctx.planes[p].bands[0].buf)
+ if (!_ctx._planes[p]._bands[0]._buf)
return -1;
}
}
- if (_ctx.buf_invalid[_ctx.dst_buf])
+ if (_ctx._bufInvalid[_ctx._dstBuf])
return -1;
//STOP_TIMER("decode_planes"); }
@@ -543,42 +545,42 @@ int IndeoDecoderBase::decodeIndeoFrame() {
if (!is_nonnull_frame())
return 0;
- assert(_ctx.planes[0].width <= _surface->w && _ctx.planes[0].height <= _surface->h);
- result = frame->ff_set_dimensions(_ctx.planes[0].width, _ctx.planes[0].height);
+ assert(_ctx._planes[0]._width <= _surface->w && _ctx._planes[0]._height <= _surface->h);
+ result = frame->ff_set_dimensions(_ctx._planes[0]._width, _ctx._planes[0]._height);
if (result < 0)
return result;
if ((result = frame->ff_get_buffer(0)) < 0)
return result;
- if (_ctx.is_scalable) {
- if (_ctx.is_indeo4)
- ff_ivi_recompose_haar(&_ctx.planes[0], frame->_data[0], frame->_linesize[0]);
+ if (_ctx._isScalable) {
+ if (_ctx._isIndeo4)
+ ff_ivi_recompose_haar(&_ctx._planes[0], frame->_data[0], frame->_linesize[0]);
else
- ff_ivi_recompose53(&_ctx.planes[0], frame->_data[0], frame->_linesize[0]);
+ ff_ivi_recompose53(&_ctx._planes[0], frame->_data[0], frame->_linesize[0]);
} else {
- ivi_output_plane(&_ctx.planes[0], frame->_data[0], frame->_linesize[0]);
+ ivi_output_plane(&_ctx._planes[0], frame->_data[0], frame->_linesize[0]);
}
- ivi_output_plane(&_ctx.planes[2], frame->_data[1], frame->_linesize[1]);
- ivi_output_plane(&_ctx.planes[1], frame->_data[2], frame->_linesize[2]);
+ ivi_output_plane(&_ctx._planes[2], frame->_data[1], frame->_linesize[1]);
+ ivi_output_plane(&_ctx._planes[1], frame->_data[2], frame->_linesize[2]);
// If the bidirectional mode is enabled, next I and the following P
// frame will be sent together. Unfortunately the approach below seems
// to be the only way to handle the B-frames mode.
// That's exactly the same Intel decoders do.
- if (_ctx.is_indeo4 && _ctx.frame_type == IVI4_FRAMETYPE_INTRA) {
+ if (_ctx._isIndeo4 && _ctx._frameType == IVI4_FRAMETYPE_INTRA) {
int left;
// skip version string
- while (_ctx.gb->getBits(8)) {
- if (_ctx.gb->getBitsLeft() < 8)
+ while (_ctx._gb->getBits(8)) {
+ if (_ctx._gb->getBitsLeft() < 8)
return -1;
}
- left = _ctx.gb->getBitsCount() & 0x18;
- _ctx.gb->skipBitsLong(64 - left);
- if (_ctx.gb->getBitsLeft() > 18 &&
- _ctx.gb->showBitsLong(21) == 0xBFFF8) { // syncheader + inter type
+ left = _ctx._gb->getBitsCount() & 0x18;
+ _ctx._gb->skipBitsLong(64 - left);
+ if (_ctx._gb->getBitsLeft() > 18 &&
+ _ctx._gb->showBitsLong(21) == 0xBFFF8) { // syncheader + inter _type
error("Indeo decoder: Mode not currently implemented in ScummVM");
}
}
@@ -599,19 +601,19 @@ int IndeoDecoderBase::decode_band(IVIBandDesc *band) {
int result, i, t, idx1, idx2, pos;
IVITile * tile;
- band->buf = band->bufs[_ctx.dst_buf];
- if (!band->buf) {
+ band->_buf = band->_bufs[_ctx._dstBuf];
+ if (!band->_buf) {
warning("Band buffer points to no data!");
return -1;
}
- if (_ctx.is_indeo4 && _ctx.frame_type == IVI4_FRAMETYPE_BIDIR) {
- band->ref_buf = band->bufs[_ctx.b_ref_buf];
- band->b_ref_buf = band->bufs[_ctx.ref_buf];
+ if (_ctx._isIndeo4 && _ctx._frameType == IVI4_FRAMETYPE_BIDIR) {
+ band->_refBuf = band->_bufs[_ctx._bRefBuf];
+ band->_bRefBuf = band->_bufs[_ctx._refBuf];
} else {
- band->ref_buf = band->bufs[_ctx.ref_buf];
- band->b_ref_buf = 0;
+ band->_refBuf = band->_bufs[_ctx._refBuf];
+ band->_bRefBuf = 0;
}
- band->data_ptr = _ctx.frame_data + (_ctx.gb->getBitsCount() >> 3);
+ band->_dataPtr = _ctx._frameData + (_ctx._gb->getBitsCount() >> 3);
result = decode_band_hdr(band);
if (result) {
@@ -620,45 +622,45 @@ int IndeoDecoderBase::decode_band(IVIBandDesc *band) {
return result;
}
- if (band->is_empty) {
+ if (band->_isEmpty) {
warning("Empty band encountered!");
return -1;
}
- band->rv_map = &_ctx.rvmap_tabs[band->rvmap_sel];
+ band->_rvMap = &_ctx._rvmapTabs[band->_rvmapSel];
// apply corrections to the selected rvmap table if present
- for (i = 0; i < band->num_corr; i++) {
- idx1 = band->corr[i * 2];
- idx2 = band->corr[i * 2 + 1];
- FFSWAP(uint8, band->rv_map->runtab[idx1], band->rv_map->runtab[idx2]);
- FFSWAP(int16, band->rv_map->valtab[idx1], band->rv_map->valtab[idx2]);
- if (idx1 == band->rv_map->eob_sym || idx2 == band->rv_map->eob_sym)
- band->rv_map->eob_sym ^= idx1 ^ idx2;
- if (idx1 == band->rv_map->esc_sym || idx2 == band->rv_map->esc_sym)
- band->rv_map->esc_sym ^= idx1 ^ idx2;
+ for (i = 0; i < band->_numCorr; i++) {
+ idx1 = band->_corr[i * 2];
+ idx2 = band->_corr[i * 2 + 1];
+ FFSWAP(uint8, band->_rvMap->_runtab[idx1], band->_rvMap->_runtab[idx2]);
+ FFSWAP(int16, band->_rvMap->_valtab[idx1], band->_rvMap->_valtab[idx2]);
+ if (idx1 == band->_rvMap->_eobSym || idx2 == band->_rvMap->_eobSym)
+ band->_rvMap->_eobSym ^= idx1 ^ idx2;
+ if (idx1 == band->_rvMap->_escSym || idx2 == band->_rvMap->_escSym)
+ band->_rvMap->_escSym ^= idx1 ^ idx2;
}
- pos = _ctx.gb->getBitsCount();
+ pos = _ctx._gb->getBitsCount();
- for (t = 0; t < band->num_tiles; t++) {
- tile = &band->tiles[t];
+ for (t = 0; t < band->_numTiles; t++) {
+ tile = &band->_tiles[t];
- if (tile->mb_size != band->mb_size) {
+ if (tile->_mbSize != band->_mbSize) {
warning("MB sizes mismatch: %d vs. %d",
- band->mb_size, tile->mb_size);
+ band->_mbSize, tile->_mbSize);
return -1;
}
- tile->is_empty = _ctx.gb->getBits1();
- if (tile->is_empty) {
+ tile->_isEmpty = _ctx._gb->getBits1();
+ if (tile->_isEmpty) {
result = ivi_process_empty_tile(band, tile,
- (_ctx.planes[0].bands[0].mb_size >> 3) - (band->mb_size >> 3));
+ (_ctx._planes[0]._bands[0]._mbSize >> 3) - (band->_mbSize >> 3));
if (result < 0)
break;
warning("Empty tile encountered!");
} else {
- tile->data_size = ivi_dec_tile_data_size(_ctx.gb);
- if (!tile->data_size) {
+ tile->_dataSize = ivi_dec_tile_data_size(_ctx._gb);
+ if (!tile->_dataSize) {
warning("Tile data size is zero!");
result = -1;
break;
@@ -668,62 +670,62 @@ int IndeoDecoderBase::decode_band(IVIBandDesc *band) {
if (result < 0)
break;
- result = ivi_decode_blocks(_ctx.gb, band, tile);
+ result = ivi_decode_blocks(_ctx._gb, band, tile);
if (result < 0) {
warning("Corrupted tile data encountered!");
break;
}
- if ((((int)_ctx.gb->getBitsCount() - pos) >> 3) != tile->data_size) {
- warning("Tile data_size mismatch!");
+ if ((((int)_ctx._gb->getBitsCount() - pos) >> 3) != tile->_dataSize) {
+ warning("Tile _dataSize mismatch!");
result = -1;
break;
}
- pos += tile->data_size << 3; // skip to next tile
+ pos += tile->_dataSize << 3; // skip to next tile
}
}
// restore the selected rvmap table by applying its corrections in
// reverse order
- for (i = band->num_corr - 1; i >= 0; i--) {
- idx1 = band->corr[i * 2];
- idx2 = band->corr[i * 2 + 1];
- FFSWAP(uint8, band->rv_map->runtab[idx1], band->rv_map->runtab[idx2]);
- FFSWAP(int16, band->rv_map->valtab[idx1], band->rv_map->valtab[idx2]);
- if (idx1 == band->rv_map->eob_sym || idx2 == band->rv_map->eob_sym)
- band->rv_map->eob_sym ^= idx1 ^ idx2;
- if (idx1 == band->rv_map->esc_sym || idx2 == band->rv_map->esc_sym)
- band->rv_map->esc_sym ^= idx1 ^ idx2;
+ for (i = band->_numCorr - 1; i >= 0; i--) {
+ idx1 = band->_corr[i * 2];
+ idx2 = band->_corr[i * 2 + 1];
+ FFSWAP(uint8, band->_rvMap->_runtab[idx1], band->_rvMap->_runtab[idx2]);
+ FFSWAP(int16, band->_rvMap->_valtab[idx1], band->_rvMap->_valtab[idx2]);
+ if (idx1 == band->_rvMap->_eobSym || idx2 == band->_rvMap->_eobSym)
+ band->_rvMap->_eobSym ^= idx1 ^ idx2;
+ if (idx1 == band->_rvMap->_escSym || idx2 == band->_rvMap->_escSym)
+ band->_rvMap->_escSym ^= idx1 ^ idx2;
}
- _ctx.gb->alignGetBits();
+ _ctx._gb->alignGetBits();
return result;
}
-void IndeoDecoderBase::ff_ivi_recompose_haar(const IVIPlaneDesc *plane,
+void IndeoDecoderBase::ff_ivi_recompose_haar(const IVIPlaneDesc *_plane,
uint8 *dst, const int dst_pitch) {
int x, y, indx, b0, b1, b2, b3, p0, p1, p2, p3;
const short * b0_ptr, *b1_ptr, *b2_ptr, *b3_ptr;
- int32 pitch;
+ int32 _pitch;
- // all bands should have the same pitch
- pitch = plane->bands[0].pitch;
+ // all bands should have the same _pitch
+ _pitch = _plane->_bands[0]._pitch;
// get pointers to the wavelet bands
- b0_ptr = plane->bands[0].buf;
- b1_ptr = plane->bands[1].buf;
- b2_ptr = plane->bands[2].buf;
- b3_ptr = plane->bands[3].buf;
+ b0_ptr = _plane->_bands[0]._buf;
+ b1_ptr = _plane->_bands[1]._buf;
+ b2_ptr = _plane->_bands[2]._buf;
+ b3_ptr = _plane->_bands[3]._buf;
- for (y = 0; y < plane->height; y += 2) {
- for (x = 0, indx = 0; x < plane->width; x += 2, indx++) {
+ for (y = 0; y < _plane->_height; y += 2) {
+ for (x = 0, indx = 0; x < _plane->_width; x += 2, indx++) {
// load coefficients
- b0 = b0_ptr[indx]; //should be: b0 = (num_bands > 0) ? b0_ptr[indx] : 0;
- b1 = b1_ptr[indx]; //should be: b1 = (num_bands > 1) ? b1_ptr[indx] : 0;
- b2 = b2_ptr[indx]; //should be: b2 = (num_bands > 2) ? b2_ptr[indx] : 0;
- b3 = b3_ptr[indx]; //should be: b3 = (num_bands > 3) ? b3_ptr[indx] : 0;
+ b0 = b0_ptr[indx]; //should be: b0 = (_numBands > 0) ? b0_ptr[indx] : 0;
+ b1 = b1_ptr[indx]; //should be: b1 = (_numBands > 1) ? b1_ptr[indx] : 0;
+ b2 = b2_ptr[indx]; //should be: b2 = (_numBands > 2) ? b2_ptr[indx] : 0;
+ b3 = b3_ptr[indx]; //should be: b3 = (_numBands > 3) ? b3_ptr[indx] : 0;
// haar wavelet recomposition
p0 = (b0 + b1 + b2 + b3 + 2) >> 2;
@@ -740,70 +742,70 @@ void IndeoDecoderBase::ff_ivi_recompose_haar(const IVIPlaneDesc *plane,
dst += dst_pitch << 1;
- b0_ptr += pitch;
- b1_ptr += pitch;
- b2_ptr += pitch;
- b3_ptr += pitch;
+ b0_ptr += _pitch;
+ b1_ptr += _pitch;
+ b2_ptr += _pitch;
+ b3_ptr += _pitch;
}// for y
}
-void IndeoDecoderBase::ff_ivi_recompose53(const IVIPlaneDesc *plane,
+void IndeoDecoderBase::ff_ivi_recompose53(const IVIPlaneDesc *_plane,
uint8 *dst, const int dst_pitch) {
int x, y, indx;
int32 p0, p1, p2, p3, tmp0, tmp1, tmp2;
int32 b0_1, b0_2, b1_1, b1_2, b1_3, b2_1, b2_2, b2_3, b2_4, b2_5, b2_6;
int32 b3_1, b3_2, b3_3, b3_4, b3_5, b3_6, b3_7, b3_8, b3_9;
- int32 pitch, back_pitch;
+ int32 _pitch, back_pitch;
const short * b0_ptr, *b1_ptr, *b2_ptr, *b3_ptr;
- const int num_bands = 4;
+ const int _numBands = 4;
- // all bands should have the same pitch
- pitch = plane->bands[0].pitch;
+ // all bands should have the same _pitch
+ _pitch = _plane->_bands[0]._pitch;
// pixels at the position "y-1" will be set to pixels at the "y" for the 1st iteration
back_pitch = 0;
// get pointers to the wavelet bands
- b0_ptr = plane->bands[0].buf;
- b1_ptr = plane->bands[1].buf;
- b2_ptr = plane->bands[2].buf;
- b3_ptr = plane->bands[3].buf;
+ b0_ptr = _plane->_bands[0]._buf;
+ b1_ptr = _plane->_bands[1]._buf;
+ b2_ptr = _plane->_bands[2]._buf;
+ b3_ptr = _plane->_bands[3]._buf;
- for (y = 0; y < plane->height; y += 2) {
+ for (y = 0; y < _plane->_height; y += 2) {
- if (y + 2 >= plane->height)
- pitch = 0;
+ if (y + 2 >= _plane->_height)
+ _pitch = 0;
// load storage variables with values
- if (num_bands > 0) {
+ if (_numBands > 0) {
b0_1 = b0_ptr[0];
- b0_2 = b0_ptr[pitch];
+ b0_2 = b0_ptr[_pitch];
}
- if (num_bands > 1) {
+ if (_numBands > 1) {
b1_1 = b1_ptr[back_pitch];
b1_2 = b1_ptr[0];
- b1_3 = b1_1 - b1_2 * 6 + b1_ptr[pitch];
+ b1_3 = b1_1 - b1_2 * 6 + b1_ptr[_pitch];
}
- if (num_bands > 2) {
+ if (_numBands > 2) {
b2_2 = b2_ptr[0]; // b2[x, y ]
b2_3 = b2_2; // b2[x+1,y ] = b2[x,y]
- b2_5 = b2_ptr[pitch]; // b2[x ,y+1]
+ b2_5 = b2_ptr[_pitch]; // b2[x ,y+1]
b2_6 = b2_5; // b2[x+1,y+1] = b2[x,y+1]
}
- if (num_bands > 3) {
+ if (_numBands > 3) {
b3_2 = b3_ptr[back_pitch]; // b3[x ,y-1]
b3_3 = b3_2; // b3[x+1,y-1] = b3[x ,y-1]
b3_5 = b3_ptr[0]; // b3[x ,y ]
b3_6 = b3_5; // b3[x+1,y ] = b3[x ,y ]
- b3_8 = b3_2 - b3_5 * 6 + b3_ptr[pitch];
+ b3_8 = b3_2 - b3_5 * 6 + b3_ptr[_pitch];
b3_9 = b3_8;
}
- for (x = 0, indx = 0; x < plane->width; x += 2, indx++) {
- if (x + 2 >= plane->width) {
+ for (x = 0, indx = 0; x < _plane->_width; x += 2, indx++) {
+ if (x + 2 >= _plane->_width) {
b0_ptr--;
b1_ptr--;
b2_ptr--;
@@ -826,11 +828,11 @@ void IndeoDecoderBase::ff_ivi_recompose53(const IVIPlaneDesc *plane,
p0 = p1 = p2 = p3 = 0;
// process the LL-band by applying LPF both vertically and horizontally
- if (num_bands > 0) {
+ if (_numBands > 0) {
tmp0 = b0_1;
tmp2 = b0_2;
b0_1 = b0_ptr[indx + 1];
- b0_2 = b0_ptr[pitch + indx + 1];
+ b0_2 = b0_ptr[_pitch + indx + 1];
tmp1 = tmp0 + b0_1;
p0 = tmp0 << 4;
@@ -840,14 +842,14 @@ void IndeoDecoderBase::ff_ivi_recompose53(const IVIPlaneDesc *plane,
}
// process the HL-band by applying HPF vertically and LPF horizontally
- if (num_bands > 1) {
+ if (_numBands > 1) {
tmp0 = b1_2;
tmp1 = b1_1;
b1_2 = b1_ptr[indx + 1];
b1_1 = b1_ptr[back_pitch + indx + 1];
tmp2 = tmp1 - tmp0 * 6 + b1_3;
- b1_3 = b1_1 - b1_2 * 6 + b1_ptr[pitch + indx + 1];
+ b1_3 = b1_1 - b1_2 * 6 + b1_ptr[_pitch + indx + 1];
p0 += (tmp0 + tmp1) << 3;
p1 += (tmp0 + tmp1 + b1_1 + b1_2) << 2;
@@ -856,9 +858,9 @@ void IndeoDecoderBase::ff_ivi_recompose53(const IVIPlaneDesc *plane,
}
// process the LH-band by applying LPF vertically and HPF horizontally
- if (num_bands > 2) {
+ if (_numBands > 2) {
b2_3 = b2_ptr[indx + 1];
- b2_6 = b2_ptr[pitch + indx + 1];
+ b2_6 = b2_ptr[_pitch + indx + 1];
tmp0 = b2_1 + b2_2;
tmp1 = b2_1 - b2_2 * 6 + b2_3;
@@ -870,7 +872,7 @@ void IndeoDecoderBase::ff_ivi_recompose53(const IVIPlaneDesc *plane,
}
// process the HH-band by applying HPF both vertically and horizontally
- if (num_bands > 3) {
+ if (_numBands > 3) {
b3_6 = b3_ptr[indx + 1]; // b3[x+1,y ]
b3_3 = b3_ptr[back_pitch + indx + 1]; // b3[x+1,y-1]
@@ -878,7 +880,7 @@ void IndeoDecoderBase::ff_ivi_recompose53(const IVIPlaneDesc *plane,
tmp1 = b3_2 + b3_5;
tmp2 = b3_3 + b3_6;
- b3_9 = b3_3 - b3_6 * 6 + b3_ptr[pitch + indx + 1];
+ b3_9 = b3_3 - b3_6 * 6 + b3_ptr[_pitch + indx + 1];
p0 += (tmp0 + tmp1) << 2;
p1 += (tmp0 - tmp1 * 6 + tmp2) << 1;
@@ -895,95 +897,95 @@ void IndeoDecoderBase::ff_ivi_recompose53(const IVIPlaneDesc *plane,
dst += dst_pitch << 1;
- back_pitch = -pitch;
+ back_pitch = -_pitch;
- b0_ptr += pitch + 1;
- b1_ptr += pitch + 1;
- b2_ptr += pitch + 1;
- b3_ptr += pitch + 1;
+ b0_ptr += _pitch + 1;
+ b1_ptr += _pitch + 1;
+ b2_ptr += _pitch + 1;
+ b3_ptr += _pitch + 1;
}
}
-void IndeoDecoderBase::ivi_output_plane(IVIPlaneDesc *plane, uint8 *dst, int dst_pitch) {
+void IndeoDecoderBase::ivi_output_plane(IVIPlaneDesc *_plane, uint8 *dst, int dst_pitch) {
int x, y;
- const int16 * src = plane->bands[0].buf;
- uint32 pitch = plane->bands[0].pitch;
+ const int16 * src = _plane->_bands[0]._buf;
+ uint32 _pitch = _plane->_bands[0]._pitch;
if (!src)
return;
- for (y = 0; y < plane->height; y++) {
- for (x = 0; x < plane->width; x++)
+ for (y = 0; y < _plane->_height; y++) {
+ for (x = 0; x < _plane->_width; x++)
dst[x] = av_clip_uint8(src[x] + 128);
- src += pitch;
+ src += _pitch;
dst += dst_pitch;
}
}
int IndeoDecoderBase::ivi_process_empty_tile(IVIBandDesc *band,
IVITile *tile, int32 mv_scale) {
- int x, y, need_mc, mbn, blk, num_blocks, mv_x, mv_y, mc_type;
+ int x, y, need_mc, mbn, blk, num_blocks, _mvX, _mvY, mc_type;
int offs, mb_offset, row_offset, ret;
IVIMbInfo *mb, *ref_mb;
- const int16 *src;
- int16 *dst;
- ivi_mc_func mc_no_delta_func;
+ const int16 * src;
+ int16 * dst;
+ IviMCFunc mc_no_delta_func;
- if (tile->num_MBs != IVI_MBs_PER_TILE(tile->width, tile->height, band->mb_size)) {
+ if (tile->_numMBs != IVI_MBs_PER_TILE(tile->_width, tile->_height, band->_mbSize)) {
warning("Allocated tile size %d mismatches "
"parameters %d in ivi_process_empty_tile()",
- tile->num_MBs, IVI_MBs_PER_TILE(tile->width, tile->height, band->mb_size));
+ tile->_numMBs, IVI_MBs_PER_TILE(tile->_width, tile->_height, band->_mbSize));
return -1;
}
- offs = tile->ypos * band->pitch + tile->xpos;
- mb = tile->mbs;
- ref_mb = tile->ref_mbs;
- row_offset = band->mb_size * band->pitch;
+ offs = tile->_yPos * band->_pitch + tile->_xPos;
+ mb = tile->_mbs;
+ ref_mb = tile->_refMbs;
+ row_offset = band->_mbSize * band->_pitch;
need_mc = 0; // reset the mc tracking flag
- for (y = tile->ypos; y < (tile->ypos + tile->height); y += band->mb_size) {
+ for (y = tile->_yPos; y < (tile->_yPos + tile->_height); y += band->_mbSize) {
mb_offset = offs;
- for (x = tile->xpos; x < (tile->xpos + tile->width); x += band->mb_size) {
- mb->xpos = x;
- mb->ypos = y;
- mb->buf_offs = mb_offset;
+ for (x = tile->_xPos; x < (tile->_xPos + tile->_width); x += band->_mbSize) {
+ mb->_xPos = x;
+ mb->_yPos = y;
+ mb->_bufOffs = mb_offset;
- mb->type = 1; // set the macroblocks type = INTER
- mb->cbp = 0; // all blocks are empty
+ mb->_type = 1; // set the macroblocks _type = INTER
+ mb->_cbp = 0; // all blocks are empty
- if (!band->qdelta_present && !band->plane && !band->band_num) {
- mb->q_delta = band->glob_quant;
- mb->mv_x = 0;
- mb->mv_y = 0;
+ if (!band->_qdeltaPresent && !band->_plane && !band->_bandNum) {
+ mb->_qDelta = band->_globQuant;
+ mb->_mvX = 0;
+ mb->_mvY = 0;
}
- if (band->inherit_qdelta && ref_mb)
- mb->q_delta = ref_mb->q_delta;
+ if (band->_inheritQDelta && ref_mb)
+ mb->_qDelta = ref_mb->_qDelta;
- if (band->inherit_mv && ref_mb) {
+ if (band->_inheritMv && ref_mb) {
// motion vector inheritance
if (mv_scale) {
- mb->mv_x = ivi_scale_mv(ref_mb->mv_x, mv_scale);
- mb->mv_y = ivi_scale_mv(ref_mb->mv_y, mv_scale);
+ mb->_mvX = ivi_scale_mv(ref_mb->_mvX, mv_scale);
+ mb->_mvY = ivi_scale_mv(ref_mb->_mvY, mv_scale);
} else {
- mb->mv_x = ref_mb->mv_x;
- mb->mv_y = ref_mb->mv_y;
+ mb->_mvX = ref_mb->_mvX;
+ mb->_mvY = ref_mb->_mvY;
}
- need_mc |= mb->mv_x || mb->mv_y; // tracking non-zero motion vectors
+ need_mc |= mb->_mvX || mb->_mvY; // tracking non-zero motion vectors
{
int dmv_x, dmv_y, cx, cy;
- dmv_x = mb->mv_x >> band->is_halfpel;
- dmv_y = mb->mv_y >> band->is_halfpel;
- cx = mb->mv_x & band->is_halfpel;
- cy = mb->mv_y & band->is_halfpel;
+ dmv_x = mb->_mvX >> band->_isHalfpel;
+ dmv_y = mb->_mvY >> band->_isHalfpel;
+ cx = mb->_mvX & band->_isHalfpel;
+ cy = mb->_mvY & band->_isHalfpel;
- if (mb->xpos + dmv_x < 0
- || mb->xpos + dmv_x + band->mb_size + cx > band->pitch
- || mb->ypos + dmv_y < 0
- || mb->ypos + dmv_y + band->mb_size + cy > band->aheight) {
+ if (mb->_xPos + dmv_x < 0
+ || mb->_xPos + dmv_x + band->_mbSize + cx > band->_pitch
+ || mb->_yPos + dmv_y < 0
+ || mb->_yPos + dmv_y + band->_mbSize + cy > band->_aHeight) {
warning("MV out of bounds");
return -1;
}
@@ -993,82 +995,82 @@ int IndeoDecoderBase::ivi_process_empty_tile(IVIBandDesc *band,
mb++;
if (ref_mb)
ref_mb++;
- mb_offset += band->mb_size;
+ mb_offset += band->_mbSize;
} // for x
offs += row_offset;
} // for y
- if (band->inherit_mv && need_mc) { // apply motion compensation if there is at least one non-zero motion vector
- num_blocks = (band->mb_size != band->blk_size) ? 4 : 1; // number of blocks per mb
- mc_no_delta_func = (band->blk_size == 8) ? IndeoDSP::ff_ivi_mc_8x8_no_delta
+ if (band->_inheritMv && need_mc) { // apply motion compensation if there is at least one non-zero motion vector
+ num_blocks = (band->_mbSize != band->_blkSize) ? 4 : 1; // number of blocks per mb
+ mc_no_delta_func = (band->_blkSize == 8) ? IndeoDSP::ff_ivi_mc_8x8_no_delta
: IndeoDSP::ff_ivi_mc_4x4_no_delta;
- for (mbn = 0, mb = tile->mbs; mbn < tile->num_MBs; mb++, mbn++) {
- mv_x = mb->mv_x;
- mv_y = mb->mv_y;
- if (!band->is_halfpel) {
+ for (mbn = 0, mb = tile->_mbs; mbn < tile->_numMBs; mb++, mbn++) {
+ _mvX = mb->_mvX;
+ _mvY = mb->_mvY;
+ if (!band->_isHalfpel) {
mc_type = 0; // we have only fullpel vectors
} else {
- mc_type = ((mv_y & 1) << 1) | (mv_x & 1);
- mv_x >>= 1;
- mv_y >>= 1; // convert halfpel vectors into fullpel ones
+ mc_type = ((_mvY & 1) << 1) | (_mvX & 1);
+ _mvX >>= 1;
+ _mvY >>= 1; // convert halfpel vectors into fullpel ones
}
for (blk = 0; blk < num_blocks; blk++) {
// adjust block position in the buffer according with its number
- offs = mb->buf_offs + band->blk_size * ((blk & 1) + !!(blk & 2) * band->pitch);
+ offs = mb->_bufOffs + band->_blkSize * ((blk & 1) + !!(blk & 2) * band->_pitch);
ret = ivi_mc(band, mc_no_delta_func, nullptr, offs,
- mv_x, mv_y, 0, 0, mc_type, -1);
+ _mvX, _mvY, 0, 0, mc_type, -1);
if (ret < 0)
return ret;
}
}
} else {
// copy data from the reference tile into the current one
- src = band->ref_buf + tile->ypos * band->pitch + tile->xpos;
- dst = band->buf + tile->ypos * band->pitch + tile->xpos;
- for (y = 0; y < tile->height; y++) {
- memcpy(dst, src, tile->width*sizeof(band->buf[0]));
- src += band->pitch;
- dst += band->pitch;
+ src = band->_refBuf + tile->_yPos * band->_pitch + tile->_xPos;
+ dst = band->_buf + tile->_yPos * band->_pitch + tile->_xPos;
+ for (y = 0; y < tile->_height; y++) {
+ memcpy(dst, src, tile->_width*sizeof(band->_buf[0]));
+ src += band->_pitch;
+ dst += band->_pitch;
}
}
return 0;
}
-int IndeoDecoderBase::ivi_dec_tile_data_size(GetBits *gb) {
+int IndeoDecoderBase::ivi_dec_tile_data_size(GetBits *_gb) {
int len = 0;
- if (gb->getBits1()) {
- len = gb->getBits(8);
+ if (_gb->getBits1()) {
+ len = _gb->getBits(8);
if (len == 255)
- len = gb->getBitsLong(24);
+ len = _gb->getBitsLong(24);
}
// align the bitstream reader on the byte boundary
- gb->alignGetBits();
+ _gb->alignGetBits();
return len;
}
-int IndeoDecoderBase::ivi_decode_blocks(GetBits *gb, IVIBandDesc *band, IVITile *tile) {
- int mbn, blk, num_blocks, blk_size, ret, is_intra;
+int IndeoDecoderBase::ivi_decode_blocks(GetBits *_gb, IVIBandDesc *band, IVITile *tile) {
+ int mbn, blk, num_blocks, _blkSize, ret, is_intra;
int mc_type = 0, mc_type2 = -1;
- int mv_x = 0, mv_y = 0, mv_x2 = 0, mv_y2 = 0;
+ int _mvX = 0, _mvY = 0, mv_x2 = 0, mv_y2 = 0;
int32 prev_dc;
- uint32 cbp, quant, buf_offs;
+ uint32 _cbp, quant, _bufOffs;
IVIMbInfo *mb;
- ivi_mc_func mc_with_delta_func, mc_no_delta_func;
- ivi_mc_avg_func mc_avg_with_delta_func, mc_avg_no_delta_func;
+ IviMCFunc mc_with_delta_func, mc_no_delta_func;
+ IviMCAvgFunc mc_avg_with_delta_func, mc_avg_no_delta_func;
const uint8 *scale_tab;
// init intra prediction for the DC coefficient
prev_dc = 0;
- blk_size = band->blk_size;
+ _blkSize = band->_blkSize;
// number of blocks per mb
- num_blocks = (band->mb_size != blk_size) ? 4 : 1;
- if (blk_size == 8) {
+ num_blocks = (band->_mbSize != _blkSize) ? 4 : 1;
+ if (_blkSize == 8) {
mc_with_delta_func = IndeoDSP::ff_ivi_mc_8x8_delta;
mc_no_delta_func = IndeoDSP::ff_ivi_mc_8x8_no_delta;
mc_avg_with_delta_func = IndeoDSP::ff_ivi_mc_avg_8x8_delta;
@@ -1080,65 +1082,65 @@ int IndeoDecoderBase::ivi_decode_blocks(GetBits *gb, IVIBandDesc *band, IVITile
mc_avg_no_delta_func = IndeoDSP::ff_ivi_mc_avg_4x4_no_delta;
}
- for (mbn = 0, mb = tile->mbs; mbn < tile->num_MBs; mb++, mbn++) {
- is_intra = !mb->type;
- cbp = mb->cbp;
- buf_offs = mb->buf_offs;
+ for (mbn = 0, mb = tile->_mbs; mbn < tile->_numMBs; mb++, mbn++) {
+ is_intra = !mb->_type;
+ _cbp = mb->_cbp;
+ _bufOffs = mb->_bufOffs;
- quant = band->glob_quant + mb->q_delta;
- if (_ctx.is_indeo4)
+ quant = band->_globQuant + mb->_qDelta;
+ if (_ctx._isIndeo4)
quant = av_clip_uintp2(quant, 5);
else
quant = av_clip((int)quant, 0, 23);
- scale_tab = is_intra ? band->intra_scale : band->inter_scale;
+ scale_tab = is_intra ? band->_intraScale : band->_interScale;
if (scale_tab)
quant = scale_tab[quant];
if (!is_intra) {
- mv_x = mb->mv_x;
- mv_y = mb->mv_y;
- mv_x2 = mb->b_mv_x;
- mv_y2 = mb->b_mv_y;
- if (band->is_halfpel) {
- mc_type = ((mv_y & 1) << 1) | (mv_x & 1);
+ _mvX = mb->_mvX;
+ _mvY = mb->_mvY;
+ mv_x2 = mb->_bMvX;
+ mv_y2 = mb->_bMvY;
+ if (band->_isHalfpel) {
+ mc_type = ((_mvY & 1) << 1) | (_mvX & 1);
mc_type2 = ((mv_y2 & 1) << 1) | (mv_x2 & 1);
- mv_x >>= 1;
- mv_y >>= 1;
+ _mvX >>= 1;
+ _mvY >>= 1;
mv_x2 >>= 1;
mv_y2 >>= 1; // convert halfpel vectors into fullpel ones
}
- if (mb->type == 2)
+ if (mb->_type == 2)
mc_type = -1;
- if (mb->type != 2 && mb->type != 3)
+ if (mb->_type != 2 && mb->_type != 3)
mc_type2 = -1;
- if (mb->type) {
+ if (mb->_type) {
int dmv_x, dmv_y, cx, cy;
- dmv_x = mb->mv_x >> band->is_halfpel;
- dmv_y = mb->mv_y >> band->is_halfpel;
- cx = mb->mv_x & band->is_halfpel;
- cy = mb->mv_y & band->is_halfpel;
+ dmv_x = mb->_mvX >> band->_isHalfpel;
+ dmv_y = mb->_mvY >> band->_isHalfpel;
+ cx = mb->_mvX & band->_isHalfpel;
+ cy = mb->_mvY & band->_isHalfpel;
- if (mb->xpos + dmv_x < 0 ||
- mb->xpos + dmv_x + band->mb_size + cx > band->pitch ||
- mb->ypos + dmv_y < 0 ||
- mb->ypos + dmv_y + band->mb_size + cy > band->aheight) {
+ if (mb->_xPos + dmv_x < 0 ||
+ mb->_xPos + dmv_x + band->_mbSize + cx > band->_pitch ||
+ mb->_yPos + dmv_y < 0 ||
+ mb->_yPos + dmv_y + band->_mbSize + cy > band->_aHeight) {
return -1;
}
}
- if (mb->type == 2 || mb->type == 3) {
+ if (mb->_type == 2 || mb->_type == 3) {
int dmv_x, dmv_y, cx, cy;
- dmv_x = mb->b_mv_x >> band->is_halfpel;
- dmv_y = mb->b_mv_y >> band->is_halfpel;
- cx = mb->b_mv_x & band->is_halfpel;
- cy = mb->b_mv_y & band->is_halfpel;
+ dmv_x = mb->_bMvX >> band->_isHalfpel;
+ dmv_y = mb->_bMvY >> band->_isHalfpel;
+ cx = mb->_bMvX & band->_isHalfpel;
+ cy = mb->_bMvY & band->_isHalfpel;
- if (mb->xpos + dmv_x < 0 ||
- mb->xpos + dmv_x + band->mb_size + cx > band->pitch ||
- mb->ypos + dmv_y < 0 ||
- mb->ypos + dmv_y + band->mb_size + cy > band->aheight) {
+ if (mb->_xPos + dmv_x < 0 ||
+ mb->_xPos + dmv_x + band->_mbSize + cx > band->_pitch ||
+ mb->_yPos + dmv_y < 0 ||
+ mb->_yPos + dmv_y + band->_mbSize + cy > band->_aHeight) {
return -1;
}
}
@@ -1147,19 +1149,19 @@ int IndeoDecoderBase::ivi_decode_blocks(GetBits *gb, IVIBandDesc *band, IVITile
for (blk = 0; blk < num_blocks; blk++) {
// adjust block position in the buffer according to its number
if (blk & 1) {
- buf_offs += blk_size;
+ _bufOffs += _blkSize;
} else if (blk == 2) {
- buf_offs -= blk_size;
- buf_offs += blk_size * band->pitch;
+ _bufOffs -= _blkSize;
+ _bufOffs += _blkSize * band->_pitch;
}
- if (cbp & 1) { // block coded ?
- ret = ivi_decode_coded_blocks(gb, band, mc_with_delta_func,
+ if (_cbp & 1) { // block coded ?
+ ret = ivi_decode_coded_blocks(_gb, band, mc_with_delta_func,
mc_avg_with_delta_func,
- mv_x, mv_y, mv_x2, mv_y2,
+ _mvX, _mvY, mv_x2, mv_y2,
&prev_dc, is_intra,
mc_type, mc_type2, quant,
- buf_offs);
+ _bufOffs);
if (ret < 0)
return ret;
} else {
@@ -1167,23 +1169,23 @@ int IndeoDecoderBase::ivi_decode_blocks(GetBits *gb, IVIBandDesc *band, IVITile
// for intra blocks apply the dc slant transform
// for inter - perform the motion compensation without delta
if (is_intra) {
- ret = ivi_dc_transform(band, &prev_dc, buf_offs, blk_size);
+ ret = ivi_dc_transform(band, &prev_dc, _bufOffs, _blkSize);
if (ret < 0)
return ret;
} else {
ret = ivi_mc(band, mc_no_delta_func, mc_avg_no_delta_func,
- buf_offs, mv_x, mv_y, mv_x2, mv_y2,
+ _bufOffs, _mvX, _mvY, mv_x2, mv_y2,
mc_type, mc_type2);
if (ret < 0)
return ret;
}
}
- cbp >>= 1;
+ _cbp >>= 1;
}// for blk
}// for mbn
- gb->alignGetBits();
+ _gb->alignGetBits();
return 0;
}
@@ -1191,65 +1193,65 @@ int IndeoDecoderBase::ivi_scale_mv(int mv, int mv_scale){
return (mv + (mv > 0) + (mv_scale - 1)) >> mv_scale;
}
-int IndeoDecoderBase::ivi_mc(IVIBandDesc *band, ivi_mc_func mc, ivi_mc_avg_func mc_avg,
- int offs, int mv_x, int mv_y, int mv_x2, int mv_y2,
+int IndeoDecoderBase::ivi_mc(IVIBandDesc *band, IviMCFunc mc, IviMCAvgFunc mc_avg,
+ int offs, int _mvX, int _mvY, int mv_x2, int mv_y2,
int mc_type, int mc_type2){
- int ref_offs = offs + mv_y * band->pitch + mv_x;
- int buf_size = band->pitch * band->aheight;
- int min_size = band->pitch * (band->blk_size - 1) + band->blk_size;
- int ref_size = (mc_type > 1) * band->pitch + (mc_type & 1);
+ int ref_offs = offs + _mvY * band->_pitch + _mvX;
+ int buf_size = band->_pitch * band->_aHeight;
+ int min_size = band->_pitch * (band->_blkSize - 1) + band->_blkSize;
+ int ref_size = (mc_type > 1) * band->_pitch + (mc_type & 1);
if (mc_type != -1) {
- assert(offs >= 0 && ref_offs >= 0 && band->ref_buf);
+ assert(offs >= 0 && ref_offs >= 0 && band->_refBuf);
assert(buf_size - min_size >= offs);
assert(buf_size - min_size - ref_size >= ref_offs);
}
if (mc_type2 == -1) {
- mc(band->buf + offs, band->ref_buf + ref_offs, band->pitch, mc_type);
+ mc(band->_buf + offs, band->_refBuf + ref_offs, band->_pitch, mc_type);
} else {
- int ref_offs2 = offs + mv_y2 * band->pitch + mv_x2;
- int ref_size2 = (mc_type2 > 1) * band->pitch + (mc_type2 & 1);
- if (offs < 0 || ref_offs2 < 0 || !band->b_ref_buf)
+ int ref_offs2 = offs + mv_y2 * band->_pitch + mv_x2;
+ int ref_size2 = (mc_type2 > 1) * band->_pitch + (mc_type2 & 1);
+ if (offs < 0 || ref_offs2 < 0 || !band->_bRefBuf)
return -1;
if (buf_size - min_size - ref_size2 < ref_offs2)
return -1;
if (mc_type == -1)
- mc(band->buf + offs, band->b_ref_buf + ref_offs2,
- band->pitch, mc_type2);
+ mc(band->_buf + offs, band->_bRefBuf + ref_offs2,
+ band->_pitch, mc_type2);
else
- mc_avg(band->buf + offs, band->ref_buf + ref_offs,
- band->b_ref_buf + ref_offs2, band->pitch,
+ mc_avg(band->_buf + offs, band->_refBuf + ref_offs,
+ band->_bRefBuf + ref_offs2, band->_pitch,
mc_type, mc_type2);
}
return 0;
}
-int IndeoDecoderBase::ivi_decode_coded_blocks(GetBits *gb, IVIBandDesc *band,
- ivi_mc_func mc, ivi_mc_avg_func mc_avg, int mv_x, int mv_y,
+int IndeoDecoderBase::ivi_decode_coded_blocks(GetBits *_gb, IVIBandDesc *band,
+ IviMCFunc mc, IviMCAvgFunc mc_avg, int _mvX, int _mvY,
int mv_x2, int mv_y2, int *prev_dc, int is_intra,
int mc_type, int mc_type2, uint32 quant, int offs) {
- const uint16 *base_tab = is_intra ? band->intra_base : band->inter_base;
- RVMapDesc *rvmap = band->rv_map;
+ const uint16 *base_tab = is_intra ? band->_intraBase : band->_interBase;
+ RVMapDesc *rvmap = band->_rvMap;
uint8 col_flags[8];
int32 trvec[64];
uint32 sym = 0, q;
int lo, hi;
int pos, run, val;
- int blk_size = band->blk_size;
- int num_coeffs = blk_size * blk_size;
- int col_mask = blk_size - 1;
+ int _blkSize = band->_blkSize;
+ int num_coeffs = _blkSize * _blkSize;
+ int col_mask = _blkSize - 1;
int scan_pos = -1;
- int min_size = band->pitch * (band->transform_size - 1) +
- band->transform_size;
- int buf_size = band->pitch * band->aheight - offs;
+ int min_size = band->_pitch * (band->_transformSize - 1) +
+ band->_transformSize;
+ int buf_size = band->_pitch * band->_aHeight - offs;
if (min_size > buf_size)
return -1;
- if (!band->scan) {
+ if (!band->_scan) {
warning("Scan pattern is not set.");
return -1;
}
@@ -1259,16 +1261,16 @@ int IndeoDecoderBase::ivi_decode_coded_blocks(GetBits *gb, IVIBandDesc *band,
// zero column flags
memset(col_flags, 0, sizeof(col_flags));
while (scan_pos <= num_coeffs) {
- sym = gb->getVLC2(band->blk_vlc.tab->_table,
+ sym = _gb->getVLC2(band->_blkVlc._tab->_table,
IVI_VLC_BITS, 1);
- if (sym == rvmap->eob_sym)
+ if (sym == rvmap->_eobSym)
break; // End of block
// Escape - run/val explicitly coded using 3 vlc codes
- if (sym == rvmap->esc_sym) {
- run = gb->getVLC2(band->blk_vlc.tab->_table, IVI_VLC_BITS, 1) + 1;
- lo = gb->getVLC2(band->blk_vlc.tab->_table, IVI_VLC_BITS, 1);
- hi = gb->getVLC2(band->blk_vlc.tab->_table, IVI_VLC_BITS, 1);
+ if (sym == rvmap->_escSym) {
+ run = _gb->getVLC2(band->_blkVlc._tab->_table, IVI_VLC_BITS, 1) + 1;
+ lo = _gb->getVLC2(band->_blkVlc._tab->_table, IVI_VLC_BITS, 1);
+ hi = _gb->getVLC2(band->_blkVlc._tab->_table, IVI_VLC_BITS, 1);
// merge them and convert into signed val
val = IVI_TOSIGNED((hi << 6) | lo);
} else {
@@ -1276,15 +1278,15 @@ int IndeoDecoderBase::ivi_decode_coded_blocks(GetBits *gb, IVIBandDesc *band,
warning("Invalid sym encountered");
return -1;
}
- run = rvmap->runtab[sym];
- val = rvmap->valtab[sym];
+ run = rvmap->_runtab[sym];
+ val = rvmap->_valtab[sym];
}
// de-zigzag and dequantize
scan_pos += run;
if (scan_pos >= num_coeffs || scan_pos < 0)
break;
- pos = band->scan[scan_pos];
+ pos = band->_scan[scan_pos];
if (!val)
warning("Val = 0 encountered!");
@@ -1297,43 +1299,43 @@ int IndeoDecoderBase::ivi_decode_coded_blocks(GetBits *gb, IVIBandDesc *band,
col_flags[pos & col_mask] |= !!val;
}
- if (scan_pos < 0 || (scan_pos >= num_coeffs && sym != rvmap->eob_sym))
+ if (scan_pos < 0 || (scan_pos >= num_coeffs && sym != rvmap->_eobSym))
return -1; // corrupt block data
// undoing DC coeff prediction for intra-blocks
- if (is_intra && band->is_2d_trans) {
+ if (is_intra && band->_is2dTrans) {
*prev_dc += trvec[0];
trvec[0] = *prev_dc;
col_flags[0] |= !!*prev_dc;
}
- if (band->transform_size > band->blk_size) {
+ if (band->_transformSize > band->_blkSize) {
warning("Too large transform");
return -1;
}
// apply inverse transform
- band->inv_transform(trvec, band->buf + offs,
- band->pitch, col_flags);
+ band->_invTransform(trvec, band->_buf + offs,
+ band->_pitch, col_flags);
// apply motion compensation
if (!is_intra)
- return ivi_mc(band, mc, mc_avg, offs, mv_x, mv_y, mv_x2, mv_y2,
+ return ivi_mc(band, mc, mc_avg, offs, _mvX, _mvY, mv_x2, mv_y2,
mc_type, mc_type2);
return 0;
}
int IndeoDecoderBase::ivi_dc_transform(IVIBandDesc *band, int *prev_dc,
- int buf_offs, int blk_size) {
- int buf_size = band->pitch * band->aheight - buf_offs;
- int min_size = (blk_size - 1) * band->pitch + blk_size;
+ int bufOffs, int blkSize) {
+ int buf_size = band->_pitch * band->_aHeight - bufOffs;
+ int min_size = (blkSize - 1) * band->_pitch + blkSize;
if (min_size > buf_size)
return -1;
- band->dc_transform(prev_dc, band->buf + buf_offs,
- band->pitch, blk_size);
+ band->_dcTransform(prev_dc, band->_buf + bufOffs,
+ band->_pitch, blkSize);
return 0;
}
@@ -1377,8 +1379,8 @@ const uint8 IndeoDecoderBase::_ff_ivi_direct_scan_4x4[16] = {
const RVMapDesc IVI45DecContext::_ff_ivi_rvmap_tabs[9] = {
{ // MapTab0
- 5, // eob_sym
- 2, // esc_sym
+ 5, // _eobSym
+ 2, // _escSym
// run table
{1, 1, 0, 1, 1, 0, 1, 1, 2, 2, 1, 1, 1, 1, 3, 3,
1, 1, 2, 2, 1, 1, 4, 4, 1, 1, 1, 1, 2, 2, 5, 5,
@@ -1416,8 +1418,8 @@ const RVMapDesc IVI45DecContext::_ff_ivi_rvmap_tabs[9] = {
-1, -2, 2, -1, -1, -1, 1, 1, 1, -1, 1, -1, 1, -1, 1, -1}
},{
// MapTab1
- 0, // eob_sym
- 38, // esc_sym
+ 0, // _eobSym
+ 38, // _escSym
// run table
{0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 8, 6, 8, 7,
7, 9, 9, 10, 10, 11, 11, 1, 12, 1, 12, 13, 13, 16, 14, 16,
@@ -1455,8 +1457,8 @@ const RVMapDesc IVI45DecContext::_ff_ivi_rvmap_tabs[9] = {
-5, -4, -3, 4, 2, -3, 3, -2, -5, 5, 3, 3, -2, -3, -10, -4}
},{
// MapTab2
- 2, // eob_sym
- 11, // esc_sym
+ 2, // _eobSym
+ 11, // _escSym
// run table
{1, 1, 0, 2, 2, 1, 1, 3, 3, 4, 4, 0, 1, 1, 5, 5,
2, 2, 6, 6, 7, 7, 1, 8, 1, 8, 3, 3, 9, 9, 1, 2,
@@ -1494,8 +1496,8 @@ const RVMapDesc IVI45DecContext::_ff_ivi_rvmap_tabs[9] = {
-6, 1, -1, 1, -16, 1, 7, -1, 1, -1, -6, -3, 6, -7, 3, -1}
},{
// MapTab3
- 0, // eob_sym
- 35, // esc_sym
+ 0, // _eobSym
+ 35, // _escSym
// run table
{0, 1, 1, 2, 2, 3, 3, 4, 4, 1, 1, 5, 5, 6, 6, 7,
7, 8, 8, 9, 9, 2, 2, 10, 10, 1, 1, 11, 11, 12, 12, 3,
@@ -1533,8 +1535,8 @@ const RVMapDesc IVI45DecContext::_ff_ivi_rvmap_tabs[9] = {
-2, 2, 2, 2, -5, 3, 5, 13, -3, 7, -3, -3, -7, 3, -13, 3}
},{
// MapTab4
- 0, // eob_sym
- 34, // esc_sym
+ 0, // _eobSym
+ 34, // _escSym
// run table
{0, 1, 1, 1, 2, 2, 1, 3, 3, 1, 1, 1, 4, 4, 1, 5,
2, 1, 5, 2, 1, 1, 6, 6, 1, 1, 1, 1, 1, 7, 3, 1,
@@ -1572,8 +1574,8 @@ const RVMapDesc IVI45DecContext::_ff_ivi_rvmap_tabs[9] = {
83, -81, 82, -82, 84, -87, -86, 85, -11, -85, 86, -89, 87, -88, 88, 89}
},{
// MapTab5
- 2, // eob_sym
- 33, // esc_sym
+ 2, // _eobSym
+ 33, // _escSym
// run table
{1, 1, 0, 2, 1, 2, 1, 3, 3, 1, 1, 4, 4, 2, 2, 1,
1, 5, 5, 6, 1, 6, 1, 7, 7, 3, 3, 2, 8, 2, 8, 1,
@@ -1611,8 +1613,8 @@ const RVMapDesc IVI45DecContext::_ff_ivi_rvmap_tabs[9] = {
-1, -32, 13, 7, 32, 33, -33, -1, -9, -34, 9, 34, -6, 5, 6, -5}
},{
// MapTab6
- 2, // eob_sym
- 13, // esc_sym
+ 2, // _eobSym
+ 13, // _escSym
// run table
{1, 1, 0, 1, 1, 2, 2, 1, 1, 3, 3, 1, 1, 0, 2, 2,
4, 1, 4, 1, 1, 1, 5, 5, 1, 1, 6, 6, 2, 2, 1, 1,
@@ -1650,8 +1652,8 @@ const RVMapDesc IVI45DecContext::_ff_ivi_rvmap_tabs[9] = {
2, 58, 3, 8, -2, 57, -58, -60, -59, -57, -3, 60, 59, -14, 3, 14}
},{
// MapTab7
- 2, // eob_sym
- 38, // esc_sym
+ 2, // _eobSym
+ 38, // _escSym
// run table
{1, 1, 0, 2, 2, 1, 1, 3, 3, 4, 4, 5, 5, 1, 1, 6,
6, 2, 2, 7, 7, 8, 8, 1, 1, 3, 3, 9, 9, 10, 10, 1,
@@ -1689,8 +1691,8 @@ const RVMapDesc IVI45DecContext::_ff_ivi_rvmap_tabs[9] = {
3, -1, 3, -3, -23, 4, -4, 1, 23, -1, 1, -1, 1, -2, 2, -1}
},{
// MapTab8
- 4, // eob_sym
- 11, // esc_sym
+ 4, // _eobSym
+ 11, // _escSym
// run table
{1, 1, 1, 1, 0, 2, 2, 1, 1, 3, 3, 0, 1, 1, 2, 2,
4, 4, 1, 1, 5, 5, 1, 1, 2, 2, 3, 3, 6, 6, 1, 1,
diff --git a/image/codecs/indeo/indeo.h b/image/codecs/indeo/indeo.h
index c9d556a92f..b9e46931b0 100644
--- a/image/codecs/indeo/indeo.h
+++ b/image/codecs/indeo/indeo.h
@@ -64,15 +64,14 @@ enum {
* Declare inverse transform function types
*/
typedef void (InvTransformPtr)(const int32 *in, int16 *out, uint32 pitch, const uint8 *flags);
-typedef void (DCTransformPtr) (const int32 *in, int16 *out, uint32 pitch, int blk_size);
+typedef void (DCTransformPtr) (const int32 *in, int16 *out, uint32 pitch, int blkSize);
-typedef void(*ivi_mc_func) (int16 *buf, const int16 *ref_buf,
- uint32 pitch, int mc_type);
-typedef void(*ivi_mc_avg_func) (int16 *buf, const int16 *ref_buf1,
- const int16 *ref_buf2,
- uint32 pitch, int mc_type, int mc_type2);
+typedef void(*IviMCFunc) (int16 *buf, const int16 *refBuf, uint32 pitch, int mc_type);
+typedef void(*IviMCAvgFunc) (int16 *buf, const int16 *refBuf1, const int16 *refBuf2,
+ uint32 pitch, int mcType, int mcType2);
-#define IVI_VLC_BITS 13 ///< max number of bits of the ivi's huffman codes
+///< max number of bits of the ivi's huffman codes
+#define IVI_VLC_BITS 13
#define IVI5_IS_PROTECTED 0x20
/**
@@ -83,15 +82,15 @@ typedef void(*ivi_mc_avg_func) (int16 *buf, const int16 *ref_buf1,
/**
* calculate number of macroblocks in a tile
*/
-#define IVI_MBs_PER_TILE(tile_width, tile_height, mb_size) \
- ((((tile_width) + (mb_size) - 1) / (mb_size)) * (((tile_height) + (mb_size) - 1) / (mb_size)))
+#define IVI_MBs_PER_TILE(_tileWidth, _tileHeight, _mbSize) \
+ ((((_tileWidth) + (_mbSize) - 1) / (_mbSize)) * (((_tileHeight) + (_mbSize) - 1) / (_mbSize)))
/**
* huffman codebook descriptor
*/
struct IVIHuffDesc {
- int32 num_rows;
- uint8 xbits[16];
+ int32 _numRows;
+ uint8 _xBits[16];
/*
* Generate a huffman codebook from the given descriptor
@@ -126,13 +125,13 @@ struct IVI45DecContext;
*/
struct IVIHuffTab {
public:
- int32 tab_sel; /// index of one of the predefined tables
+ int32 _tabSel; /// index of one of the predefined tables
/// or "7" for custom one
- VLC *tab; /// pointer to the table associated with tab_sel
+ VLC * _tab; /// pointer to the table associated with tab_sel
/// the following are used only when tab_sel == 7
- IVIHuffDesc cust_desc; /// custom Huffman codebook descriptor
- VLC cust_tab; /// vlc table for custom codebook
+ IVIHuffDesc _custDesc; /// custom Huffman codebook descriptor
+ VLC _custTab; /// vlc table for custom codebook
/**
* Constructor
@@ -146,26 +145,26 @@ public:
* run-value (RLE) table descriptor
*/
struct RVMapDesc {
- uint8 eob_sym; ///< end of block symbol
- uint8 esc_sym; ///< escape symbol
- uint8 runtab[256];
- int8 valtab[256];
+ uint8 _eobSym; ///< end of block symbol
+ uint8 _escSym; ///< escape symbol
+ uint8 _runtab[256];
+ int8 _valtab[256];
};
/**
* information for Indeo macroblock (16x16, 8x8 or 4x4)
*/
struct IVIMbInfo {
- int16 xpos;
- int16 ypos;
- uint32 buf_offs; ///< address in the output buffer for this mb
- uint8 type; ///< macroblock type: 0 - INTRA, 1 - INTER
- uint8 cbp; ///< coded block pattern
- int8 q_delta; ///< quant delta
- int8 mv_x; ///< motion vector (x component)
- int8 mv_y; ///< motion vector (y component)
- int8 b_mv_x; ///< second motion vector (x component)
- int8 b_mv_y; ///< second motion vector (y component)
+ int16 _xPos;
+ int16 _yPos;
+ uint32 _bufOffs; ///< address in the output buffer for this mb
+ uint8 _type; ///< macroblock type: 0 - INTRA, 1 - INTER
+ uint8 _cbp; ///< coded block pattern
+ int8 _qDelta; ///< quant delta
+ int8 _mvX; ///< motion vector (x component)
+ int8 _mvY; ///< motion vector (y component)
+ int8 _bMvX; ///< second motion vector (x component)
+ int8 _bMvY; ///< second motion vector (y component)
IVIMbInfo();
};
@@ -174,16 +173,16 @@ struct IVIMbInfo {
* information for Indeo tile
*/
struct IVITile {
- int xpos;
- int ypos;
- int width;
- int height;
- int mb_size;
- int is_empty; ///< = 1 if this tile doesn't contain any data
- int data_size; ///< size of the data in bytes
- int num_MBs; ///< number of macroblocks in this tile
- IVIMbInfo * mbs; ///< array of macroblock descriptors
- IVIMbInfo * ref_mbs; ///< ptr to the macroblock descriptors of the reference tile
+ int _xPos;
+ int _yPos;
+ int _width;
+ int _height;
+ int _mbSize;
+ bool _isEmpty;
+ int _dataSize; ///< size of the data in bytes
+ int _numMBs; ///< number of macroblocks in this tile
+ IVIMbInfo * _mbs; ///< array of macroblock descriptors
+ IVIMbInfo * _refMbs; ///< ptr to the macroblock descriptors of the reference tile
IVITile();
};
@@ -192,49 +191,49 @@ struct IVITile {
* information for Indeo wavelet band
*/
struct IVIBandDesc {
- int plane; ///< plane number this band belongs to
- int band_num; ///< band number
- int width;
- int height;
- int aheight; ///< aligned band height
- const uint8 * data_ptr; ///< ptr to the first byte of the band data
- int data_size; ///< size of the band data
- int16 * buf; ///< pointer to the output buffer for this band
- int16 * ref_buf; ///< pointer to the reference frame buffer (for motion compensation)
- int16 * b_ref_buf; ///< pointer to the second reference frame buffer (for motion compensation)
- int16 * bufs[4]; ///< array of pointers to the band buffers
- int pitch; ///< pitch associated with the buffers above
- int is_empty; ///< = 1 if this band doesn't contain any data
- int mb_size; ///< macroblock size
- int blk_size; ///< block size
- int is_halfpel; ///< precision of the motion compensation: 0 - fullpel, 1 - halfpel
- int inherit_mv; ///< tells if motion vector is inherited from reference macroblock
- int inherit_qdelta; ///< tells if quantiser delta is inherited from reference macroblock
- int qdelta_present; ///< tells if Qdelta signal is present in the bitstream (Indeo5 only)
- int quant_mat; ///< dequant matrix index
- int glob_quant; ///< quant base for this band
- const uint8 * scan; ///< ptr to the scan pattern
- int scan_size; ///< size of the scantable
-
- IVIHuffTab blk_vlc; ///< vlc table for decoding block data
-
- int num_corr; ///< number of correction entries
- uint8 corr[61 * 2]; ///< rvmap correction pairs
- int rvmap_sel; ///< rvmap table selector
- RVMapDesc * rv_map; ///< ptr to the RLE table for this band
- int num_tiles; ///< number of tiles in this band
- IVITile * tiles; ///< array of tile descriptors
- InvTransformPtr *inv_transform;
- int transform_size;
- DCTransformPtr *dc_transform;
- int is_2d_trans; ///< 1 indicates that the two-dimensional inverse transform is used
- int32 checksum; ///< for debug purposes
- int checksum_present;
- int bufsize; ///< band buffer size in bytes
- const uint16 * intra_base; ///< quantization matrix for intra blocks
- const uint16 * inter_base; ///< quantization matrix for inter blocks
- const uint8 * intra_scale; ///< quantization coefficient for intra blocks
- const uint8 * inter_scale; ///< quantization coefficient for inter blocks
+ int _plane; ///< plane number this band belongs to
+ int _bandNum; ///< band number
+ int _width;
+ int _height;
+ int _aHeight; ///< aligned band height
+ const uint8 * _dataPtr; ///< ptr to the first byte of the band data
+ int _dataSize; ///< size of the band data
+ int16 * _buf; ///< pointer to the output buffer for this band
+ int16 * _refBuf; ///< pointer to the reference frame buffer (for motion compensation)
+ int16 * _bRefBuf; ///< pointer to the second reference frame buffer (for motion compensation)
+ int16 * _bufs[4]; ///< array of pointers to the band buffers
+ int _pitch; ///< _pitch associated with the buffers above
+ bool _isEmpty;
+ int _mbSize; ///< macroblock size
+ int _blkSize; ///< block size
+ uint8 _isHalfpel; ///< precision of the motion compensation: 0 - fullpel, 1 - halfpel
+ bool _inheritMv; ///< tells if motion vector is inherited from reference macroblock
+ bool _inheritQDelta; ///< tells if quantiser delta is inherited from reference macroblock
+ bool _qdeltaPresent; ///< tells if Qdelta signal is present in the bitstream (Indeo5 only)
+ int _quantMat; ///< dequant matrix index
+ int _globQuant; ///< quant base for this band
+ const uint8 * _scan; ///< ptr to the scan pattern
+ int _scanSize; ///< size of the scantable
+
+ IVIHuffTab _blkVlc; ///< vlc table for decoding block data
+
+ int _numCorr; ///< number of correction entries
+ uint8 _corr[61 * 2]; ///< rvmap correction pairs
+ int _rvmapSel; ///< rvmap table selector
+ RVMapDesc * _rvMap; ///< ptr to the RLE table for this band
+ int _numTiles; ///< number of tiles in this band
+ IVITile * _tiles; ///< array of tile descriptors
+ InvTransformPtr *_invTransform;
+ int _transformSize;
+ DCTransformPtr *_dcTransform;
+ bool _is2dTrans;
+ int32 _checksum; ///< for debug purposes
+ int _checksumPresent;
+ int _bufSize; ///< band buffer size in bytes
+ const uint16 * _intraBase; ///< quantization matrix for intra blocks
+ const uint16 * _interBase; ///< quantization matrix for inter blocks
+ const uint8 * _intraScale; ///< quantization coefficient for intra blocks
+ const uint8 * _interScale; ///< quantization coefficient for inter blocks
IVIBandDesc();
@@ -242,14 +241,14 @@ struct IVIBandDesc {
};
struct IVIPicConfig {
- uint16 pic_width;
- uint16 pic_height;
- uint16 chroma_width;
- uint16 chroma_height;
- uint16 tile_width;
- uint16 tile_height;
- uint8 luma_bands;
- uint8 chroma_bands;
+ uint16 _picWidth;
+ uint16 _picHeight;
+ uint16 _chromaWidth;
+ uint16 _chromaHeight;
+ uint16 _tileWidth;
+ uint16 _tileHeight;
+ uint8 _lumaBands;
+ uint8 _chromaBands;
IVIPicConfig();
@@ -263,16 +262,16 @@ struct IVIPicConfig {
* color plane (luma or chroma) information
*/
struct IVIPlaneDesc {
- uint16 width;
- uint16 height;
- uint8 num_bands; ///< number of bands this plane subdivided into
- IVIBandDesc *bands; ///< array of band descriptors
+ uint16 _width;
+ uint16 _height;
+ uint8 _numBands; ///< number of bands this plane subdivided into
+ IVIBandDesc * _bands; ///< array of band descriptors
IVIPlaneDesc();
- static int ff_ivi_init_planes(IVIPlaneDesc *planes, const IVIPicConfig *cfg, bool is_indeo4);
+ static int ff_ivi_init_planes(IVIPlaneDesc *planes, const IVIPicConfig *cfg, bool _isIndeo4);
- static int ff_ivi_init_tiles(IVIPlaneDesc *planes, int tile_width, int tile_height);
+ static int ff_ivi_init_tiles(IVIPlaneDesc *planes, int _tileWidth, int _tileHeight);
/*
* Free planes, bands and macroblocks buffers.
@@ -349,60 +348,60 @@ struct AVFrame {
struct IVI45DecContext {
friend struct IVIHuffTab;
private:
- VLC_TYPE table_data[8192 * 16][2];
- VLC ivi_mb_vlc_tabs[8]; ///< static macroblock Huffman tables
- VLC ivi_blk_vlc_tabs[8]; ///< static block Huffman tables
+ VLC_TYPE _tableData[8192 * 16][2];
+ VLC _iviMbVlcTabs[8]; ///< static macroblock Huffman tables
+ VLC _iviBlkVlcTabs[8]; ///< static block Huffman tables
public:
- GetBits * gb;
- RVMapDesc rvmap_tabs[9]; ///< local corrected copy of the static rvmap tables
-
- uint32 frame_num;
- int frame_type;
- int prev_frame_type; ///< frame type of the previous frame
- uint32 data_size; ///< size of the frame data in bytes from picture header
- int is_scalable;
- const uint8 * frame_data; ///< input frame data pointer
- int inter_scal; ///< signals a sequence of scalable inter frames
- uint32 frame_size; ///< frame size in bytes
- uint32 pic_hdr_size; ///< picture header size in bytes
- uint8 frame_flags;
- uint16 checksum; ///< frame checksum
-
- IVIPicConfig pic_conf;
- IVIPlaneDesc planes[3]; ///< color planes
-
- int buf_switch; ///< used to switch between three buffers
- int dst_buf; ///< buffer index for the currently decoded frame
- int ref_buf; ///< inter frame reference buffer index
- int ref2_buf; ///< temporal storage for switching buffers
- int b_ref_buf; ///< second reference frame buffer index
-
- IVIHuffTab mb_vlc; ///< current macroblock table descriptor
- IVIHuffTab blk_vlc; ///< current block table descriptor
-
- uint8 rvmap_sel;
- uint8 in_imf;
- uint8 in_q; ///< flag for explicitly stored quantiser delta
- uint8 pic_glob_quant;
- uint8 unknown1;
-
- uint16 gop_hdr_size;
- uint8 gop_flags;
- uint32 lock_word;
-
- uint8 has_b_frames;
- uint8 has_transp; ///< transparency mode status: 1 - enabled
- uint8 uses_tiling;
- uint8 uses_haar;
- uint8 uses_fullpel;
-
- int gop_invalid;
- int buf_invalid[4];
-
- int is_indeo4;
-
- AVFrame * p_frame;
- int got_p_frame;
+ GetBits * _gb;
+ RVMapDesc _rvmapTabs[9]; ///< local corrected copy of the static rvmap tables
+
+ uint32 _frameNum;
+ int _frameType;
+ int _prevFrameType; ///< frame type of the previous frame
+ uint32 _dataSize; ///< size of the frame data in bytes from picture header
+ int _isScalable;
+ const uint8 * _frameData; ///< input frame data pointer
+ int _interScal; ///< signals a sequence of scalable inter frames
+ uint32 _frameSize; ///< frame size in bytes
+ uint32 _picHdrSize; ///< picture header size in bytes
+ uint8 _frameFlags;
+ uint16 _checksum; ///< frame _checksum
+
+ IVIPicConfig _picConf;
+ IVIPlaneDesc _planes[3]; ///< color planes
+
+ int _bufSwitch; ///< used to switch between three buffers
+ int _dstBuf; ///< buffer index for the currently decoded frame
+ int _refBuf; ///< inter frame reference buffer index
+ int _ref2Buf; ///< temporal storage for switching buffers
+ int _bRefBuf; ///< second reference frame buffer index
+
+ IVIHuffTab _mbVlc; ///< current macroblock table descriptor
+ IVIHuffTab _blkVlc; ///< current block table descriptor
+
+ uint8 _rvmapSel;
+ bool _inImf;
+ bool _inQ; ///< flag for explicitly stored quantiser delta
+ uint8 _picGlobQuant;
+ uint8 _unknown1;
+
+ uint16 _gopHdrSize;
+ uint8 _gopFlags;
+ uint32 _lockWord;
+
+ bool _hasBFrames;
+ bool _hasTransp; ///< transparency mode enabled
+ bool _usesTiling;
+ bool _usesHaar;
+ bool _usesFullpel;
+
+ bool _gopInvalid;
+ int _bufInvalid[4];
+
+ bool _isIndeo4;
+
+ AVFrame * _pFrame;
+ bool _gotPFrame;
IVI45DecContext();
private:
@@ -427,7 +426,7 @@ private:
*
* @param[in] plane pointer to the descriptor of the plane being processed
* @param[out] dst pointer to the destination buffer
- * @param[in] dst_pitch pitch of the destination buffer
+ * @param[in] dst_pitch _pitch of the destination buffer
*/
void ff_ivi_recompose_haar(const IVIPlaneDesc *plane, uint8 *dst,
const int dst_pitch);
@@ -437,7 +436,7 @@ private:
*
* @param[in] plane pointer to the descriptor of the plane being processed
* @param[out] dst pointer to the destination buffer
- * @param[in] dst_pitch pitch of the destination buffer
+ * @param[in] dst_pitch _pitch of the destination buffer
*/
void ff_ivi_recompose53(const IVIPlaneDesc *plane,
uint8 *dst, const int dst_pitch);
@@ -449,7 +448,7 @@ private:
*
* @param[in] plane pointer to the descriptor of the plane being processed
* @param[out] dst pointer to the buffer receiving converted pixels
- * @param[in] dst_pitch pitch for moving to the next y line
+ * @param[in] dst_pitch _pitch for moving to the next y line
*/
void ivi_output_plane(IVIPlaneDesc *plane, uint8 *dst, int dst_pitch);
@@ -488,17 +487,17 @@ private:
*/
int ivi_decode_blocks(GetBits *gb, IVIBandDesc *band, IVITile *tile);
- int ivi_mc(IVIBandDesc *band, ivi_mc_func mc, ivi_mc_avg_func mc_avg,
- int offs, int mv_x, int mv_y, int mv_x2, int mv_y2,
+ int ivi_mc(IVIBandDesc *band, IviMCFunc mc, IviMCAvgFunc mc_avg,
+ int offs, int _mvX, int _mvY, int mv_x2, int mv_y2,
int mc_type, int mc_type2);
int ivi_decode_coded_blocks(GetBits *gb, IVIBandDesc *band,
- ivi_mc_func mc, ivi_mc_avg_func mc_avg, int mv_x, int mv_y,
+ IviMCFunc mc, IviMCAvgFunc mc_avg, int _mvX, int _mvY,
int mv_x2, int mv_y2, int *prev_dc, int is_intra,
int mc_type, int mc_type2, uint32 quant, int offs);
- int ivi_dc_transform(IVIBandDesc *band, int *prev_dc, int buf_offs,
- int blk_size);
+ int ivi_dc_transform(IVIBandDesc *band, int *prevDc, int bufOffs,
+ int blkSize);
protected:
IVI45DecContext _ctx;
Graphics::PixelFormat _pixelFormat;
@@ -538,7 +537,7 @@ protected:
virtual int decode_band_hdr(IVIBandDesc *band) = 0;
/**
- * Decode information (block type, cbp, quant delta, motion vector)
+ * Decode information (block type, _cbp, quant delta, motion vector)
* for all macroblocks in the current tile.
*
* @param[in,out] band pointer to the band descriptor
diff --git a/image/codecs/indeo4.cpp b/image/codecs/indeo4.cpp
index 7e0a4516d1..12ab988bda 100644
--- a/image/codecs/indeo4.cpp
+++ b/image/codecs/indeo4.cpp
@@ -41,10 +41,10 @@ namespace Image {
#define IVI4_PIC_SIZE_ESC 7
Indeo4Decoder::Indeo4Decoder(uint16 width, uint16 height) : IndeoDecoderBase(width, height) {
- _ctx.is_indeo4 = true;
- _ctx.ref_buf = 1;
- _ctx.b_ref_buf = 3;
- _ctx.p_frame = new AVFrame();
+ _ctx._isIndeo4 = true;
+ _ctx._refBuf = 1;
+ _ctx._bRefBuf = 3;
+ _ctx._pFrame = new AVFrame();
}
bool Indeo4Decoder::isIndeo4(Common::SeekableReadStream &stream) {
@@ -72,56 +72,56 @@ const Graphics::Surface *Indeo4Decoder::decodeFrame(Common::SeekableReadStream &
// Set up the frame data buffer
byte *frameData = new byte[stream.size()];
stream.read(frameData, stream.size());
- _ctx.frame_data = frameData;
- _ctx.frame_size = stream.size();
+ _ctx._frameData = frameData;
+ _ctx._frameSize = stream.size();
// Set up the GetBits instance for reading the data
- _ctx.gb = new GetBits(_ctx.frame_data, _ctx.frame_size * 8);
+ _ctx._gb = new GetBits(_ctx._frameData, _ctx._frameSize * 8);
// Decode the frame
int err = decodeIndeoFrame();
// Free the bit reader and frame buffer
- delete _ctx.gb;
- _ctx.gb = nullptr;
+ delete _ctx._gb;
+ _ctx._gb = nullptr;
delete[] frameData;
- _ctx.frame_data = nullptr;
- _ctx.frame_size = 0;
+ _ctx._frameData = nullptr;
+ _ctx._frameSize = 0;
return (err < 0) ? nullptr : &_surface->rawSurface();
}
int Indeo4Decoder::decodePictureHeader() {
int pic_size_indx, i, p;
- IVIPicConfig pic_conf;
+ IVIPicConfig _picConf;
- if (_ctx.gb->getBits(18) != 0x3FFF8) {
+ if (_ctx._gb->getBits(18) != 0x3FFF8) {
warning("Invalid picture start code!");
return -1;
}
- _ctx.prev_frame_type = _ctx.frame_type;
- _ctx.frame_type = _ctx.gb->getBits(3);
- if (_ctx.frame_type == 7) {
- warning("Invalid frame type: %d", _ctx.frame_type);
+ _ctx._prevFrameType = _ctx._frameType;
+ _ctx._frameType = _ctx._gb->getBits(3);
+ if (_ctx._frameType == 7) {
+ warning("Invalid frame type: %d", _ctx._frameType);
return -1;
}
- if (_ctx.frame_type == IVI4_FRAMETYPE_BIDIR)
- _ctx.has_b_frames = 1;
+ if (_ctx._frameType == IVI4_FRAMETYPE_BIDIR)
+ _ctx._hasBFrames = true;
- _ctx.has_transp = _ctx.gb->getBits1();
+ _ctx._hasTransp = _ctx._gb->getBits1();
// unknown bit: Mac decoder ignores this bit, XANIM returns error
- if (_ctx.gb->getBits1()) {
+ if (_ctx._gb->getBits1()) {
warning("Sync bit is set!");
return -1;
}
- _ctx.data_size = _ctx.gb->getBits1() ? _ctx.gb->getBits(24) : 0;
+ _ctx._dataSize = _ctx._gb->getBits1() ? _ctx._gb->getBits(24) : 0;
// null frames don't contain anything else so we just return
- if (_ctx.frame_type >= IVI4_FRAMETYPE_NULL_FIRST) {
+ if (_ctx._frameType >= IVI4_FRAMETYPE_NULL_FIRST) {
warning("Null frame encountered!");
return 0;
}
@@ -129,108 +129,108 @@ int Indeo4Decoder::decodePictureHeader() {
// Check key lock status. If enabled - ignore lock word.
// Usually we have to prompt the user for the password, but
// we don't do that because Indeo 4 videos can be decoded anyway
- if (_ctx.gb->getBits1()) {
- _ctx.gb->skipBitsLong(32);
+ if (_ctx._gb->getBits1()) {
+ _ctx._gb->skipBitsLong(32);
warning("Password-protected clip!");
}
- pic_size_indx = _ctx.gb->getBits(3);
+ pic_size_indx = _ctx._gb->getBits(3);
if (pic_size_indx == IVI4_PIC_SIZE_ESC) {
- pic_conf.pic_height = _ctx.gb->getBits(16);
- pic_conf.pic_width = _ctx.gb->getBits(16);
+ _picConf._picHeight = _ctx._gb->getBits(16);
+ _picConf._picWidth = _ctx._gb->getBits(16);
} else {
- pic_conf.pic_height = _ivi4_common_pic_sizes[pic_size_indx * 2 + 1];
- pic_conf.pic_width = _ivi4_common_pic_sizes[pic_size_indx * 2];
+ _picConf._picHeight = _ivi4_common_pic_sizes[pic_size_indx * 2 + 1];
+ _picConf._picWidth = _ivi4_common_pic_sizes[pic_size_indx * 2];
}
// Decode tile dimensions.
- _ctx.uses_tiling = _ctx.gb->getBits1();
- if (_ctx.uses_tiling) {
- pic_conf.tile_height = scaleTileSize(pic_conf.pic_height, _ctx.gb->getBits(4));
- pic_conf.tile_width = scaleTileSize(pic_conf.pic_width, _ctx.gb->getBits(4));
+ _ctx._usesTiling = _ctx._gb->getBits1();
+ if (_ctx._usesTiling) {
+ _picConf._tileHeight = scaleTileSize(_picConf._picHeight, _ctx._gb->getBits(4));
+ _picConf._tileWidth = scaleTileSize(_picConf._picWidth, _ctx._gb->getBits(4));
} else {
- pic_conf.tile_height = pic_conf.pic_height;
- pic_conf.tile_width = pic_conf.pic_width;
+ _picConf._tileHeight = _picConf._picHeight;
+ _picConf._tileWidth = _picConf._picWidth;
}
// Decode chroma subsampling. We support only 4:4 aka YVU9.
- if (_ctx.gb->getBits(2)) {
+ if (_ctx._gb->getBits(2)) {
warning("Only YVU9 picture format is supported!");
return -1;
}
- pic_conf.chroma_height = (pic_conf.pic_height + 3) >> 2;
- pic_conf.chroma_width = (pic_conf.pic_width + 3) >> 2;
+ _picConf._chromaHeight = (_picConf._picHeight + 3) >> 2;
+ _picConf._chromaWidth = (_picConf._picWidth + 3) >> 2;
// decode subdivision of the planes
- pic_conf.luma_bands = decodePlaneSubdivision();
- pic_conf.chroma_bands = 0;
- if (pic_conf.luma_bands)
- pic_conf.chroma_bands = decodePlaneSubdivision();
- _ctx.is_scalable = pic_conf.luma_bands != 1 || pic_conf.chroma_bands != 1;
- if (_ctx.is_scalable && (pic_conf.luma_bands != 4 || pic_conf.chroma_bands != 1)) {
+ _picConf._lumaBands = decodePlaneSubdivision();
+ _picConf._chromaBands = 0;
+ if (_picConf._lumaBands)
+ _picConf._chromaBands = decodePlaneSubdivision();
+ _ctx._isScalable = _picConf._lumaBands != 1 || _picConf._chromaBands != 1;
+ if (_ctx._isScalable && (_picConf._lumaBands != 4 || _picConf._chromaBands != 1)) {
warning("Scalability: unsupported subdivision! Luma bands: %d, chroma bands: %d",
- pic_conf.luma_bands, pic_conf.chroma_bands);
+ _picConf._lumaBands, _picConf._chromaBands);
return -1;
}
// check if picture layout was changed and reallocate buffers
- if (pic_conf.ivi_pic_config_cmp(_ctx.pic_conf)) {
- if (IVIPlaneDesc::ff_ivi_init_planes(_ctx.planes, &pic_conf, 1)) {
+ if (_picConf.ivi_pic_config_cmp(_ctx._picConf)) {
+ if (IVIPlaneDesc::ff_ivi_init_planes(_ctx._planes, &_picConf, 1)) {
warning("Couldn't reallocate color planes!");
- _ctx.pic_conf.luma_bands = 0;
+ _ctx._picConf._lumaBands = 0;
return -2;
}
- _ctx.pic_conf = pic_conf;
+ _ctx._picConf = _picConf;
// set default macroblock/block dimensions
for (p = 0; p <= 2; p++) {
- for (i = 0; i < (!p ? pic_conf.luma_bands : pic_conf.chroma_bands); i++) {
- _ctx.planes[p].bands[i].mb_size = !p ? (!_ctx.is_scalable ? 16 : 8) : 4;
- _ctx.planes[p].bands[i].blk_size = !p ? 8 : 4;
+ for (i = 0; i < (!p ? _picConf._lumaBands : _picConf._chromaBands); i++) {
+ _ctx._planes[p]._bands[i]._mbSize = !p ? (!_ctx._isScalable ? 16 : 8) : 4;
+ _ctx._planes[p]._bands[i]._blkSize = !p ? 8 : 4;
}
}
- if (IVIPlaneDesc::ff_ivi_init_tiles(_ctx.planes, _ctx.pic_conf.tile_width,
- _ctx.pic_conf.tile_height)) {
+ if (IVIPlaneDesc::ff_ivi_init_tiles(_ctx._planes, _ctx._picConf._tileWidth,
+ _ctx._picConf._tileHeight)) {
warning("Couldn't reallocate internal structures!");
return -2;
}
}
- _ctx.frame_num = _ctx.gb->getBits1() ? _ctx.gb->getBits(20) : 0;
+ _ctx._frameNum = _ctx._gb->getBits1() ? _ctx._gb->getBits(20) : 0;
// skip decTimeEst field if present
- if (_ctx.gb->getBits1())
- _ctx.gb->skipBits(8);
+ if (_ctx._gb->getBits1())
+ _ctx._gb->skipBits(8);
// decode macroblock and block huffman codebooks
- if (_ctx.mb_vlc.ff_ivi_dec_huff_desc(&_ctx, _ctx.gb->getBits1(), IVI_MB_HUFF) ||
- _ctx.blk_vlc.ff_ivi_dec_huff_desc(&_ctx, _ctx.gb->getBits1(), IVI_BLK_HUFF))
+ if (_ctx._mbVlc.ff_ivi_dec_huff_desc(&_ctx, _ctx._gb->getBits1(), IVI_MB_HUFF) ||
+ _ctx._blkVlc.ff_ivi_dec_huff_desc(&_ctx, _ctx._gb->getBits1(), IVI_BLK_HUFF))
return -1;
- _ctx.rvmap_sel = _ctx.gb->getBits1() ? _ctx.gb->getBits(3) : 8;
+ _ctx._rvmapSel = _ctx._gb->getBits1() ? _ctx._gb->getBits(3) : 8;
- _ctx.in_imf = _ctx.gb->getBits1();
- _ctx.in_q = _ctx.gb->getBits1();
+ _ctx._inImf = _ctx._gb->getBits1();
+ _ctx._inQ = _ctx._gb->getBits1();
- _ctx.pic_glob_quant = _ctx.gb->getBits(5);
+ _ctx._picGlobQuant = _ctx._gb->getBits(5);
// TODO: ignore this parameter if unused
- _ctx.unknown1 = _ctx.gb->getBits1() ? _ctx.gb->getBits(3) : 0;
+ _ctx._unknown1 = _ctx._gb->getBits1() ? _ctx._gb->getBits(3) : 0;
- _ctx.checksum = _ctx.gb->getBits1() ? _ctx.gb->getBits(16) : 0;
+ _ctx._checksum = _ctx._gb->getBits1() ? _ctx._gb->getBits(16) : 0;
// skip picture header extension if any
- while (_ctx.gb->getBits1()) {
- _ctx.gb->skipBits(8);
+ while (_ctx._gb->getBits1()) {
+ _ctx._gb->skipBits(8);
}
- if (_ctx.gb->getBits1()) {
+ if (_ctx._gb->getBits1()) {
warning("Bad blocks bits encountered!");
}
- _ctx.gb->alignGetBits();
+ _ctx._gb->alignGetBits();
return 0;
}
@@ -238,7 +238,7 @@ int Indeo4Decoder::decodePictureHeader() {
void Indeo4Decoder::switch_buffers() {
int is_prev_ref = 0, is_ref = 0;
- switch (_ctx.prev_frame_type) {
+ switch (_ctx._prevFrameType) {
case IVI4_FRAMETYPE_INTRA:
case IVI4_FRAMETYPE_INTRA1:
case IVI4_FRAMETYPE_INTER:
@@ -246,7 +246,7 @@ void Indeo4Decoder::switch_buffers() {
break;
}
- switch (_ctx.frame_type) {
+ switch (_ctx._frameType) {
case IVI4_FRAMETYPE_INTRA:
case IVI4_FRAMETYPE_INTRA1:
case IVI4_FRAMETYPE_INTER:
@@ -258,67 +258,67 @@ void Indeo4Decoder::switch_buffers() {
}
if (is_prev_ref && is_ref) {
- FFSWAP(int, _ctx.dst_buf, _ctx.ref_buf);
+ FFSWAP(int, _ctx._dstBuf, _ctx._refBuf);
} else if (is_prev_ref) {
- FFSWAP(int, _ctx.ref_buf, _ctx.b_ref_buf);
- FFSWAP(int, _ctx.dst_buf, _ctx.ref_buf);
+ FFSWAP(int, _ctx._refBuf, _ctx._bRefBuf);
+ FFSWAP(int, _ctx._dstBuf, _ctx._refBuf);
}
}
bool Indeo4Decoder::is_nonnull_frame() const {
- return _ctx.frame_type < IVI4_FRAMETYPE_NULL_FIRST;
+ return _ctx._frameType < IVI4_FRAMETYPE_NULL_FIRST;
}
int Indeo4Decoder::decode_band_hdr(IVIBandDesc *band) {
- int plane, band_num, indx, transform_id, scan_indx;
+ int plane, _bandNum, indx, transform_id, scan_indx;
int i;
- int quant_mat;
+ int _quantMat;
- plane = _ctx.gb->getBits(2);
- band_num = _ctx.gb->getBits(4);
- if (band->plane != plane || band->band_num != band_num) {
+ plane = _ctx._gb->getBits(2);
+ _bandNum = _ctx._gb->getBits(4);
+ if (band->_plane != plane || band->_bandNum != _bandNum) {
warning("Invalid band header sequence!");
return -1;
}
- band->is_empty = _ctx.gb->getBits1();
- if (!band->is_empty) {
- int old_blk_size = band->blk_size;
+ band->_isEmpty = _ctx._gb->getBits1();
+ if (!band->_isEmpty) {
+ int old_blk_size = band->_blkSize;
// skip header size
// If header size is not given, header size is 4 bytes.
- if (_ctx.gb->getBits1())
- _ctx.gb->skipBits(16);
+ if (_ctx._gb->getBits1())
+ _ctx._gb->skipBits(16);
- band->is_halfpel = _ctx.gb->getBits(2);
- if (band->is_halfpel >= 2) {
+ band->_isHalfpel = _ctx._gb->getBits(2);
+ if (band->_isHalfpel >= 2) {
warning("Invalid/unsupported mv resolution: %d!",
- band->is_halfpel);
+ band->_isHalfpel);
return -1;
}
- if (!band->is_halfpel)
- _ctx.uses_fullpel = 1;
+ if (!band->_isHalfpel)
+ _ctx._usesFullpel = true;
- band->checksum_present = _ctx.gb->getBits1();
- if (band->checksum_present)
- band->checksum = _ctx.gb->getBits(16);
+ band->_checksumPresent = _ctx._gb->getBits1();
+ if (band->_checksumPresent)
+ band->_checksum = _ctx._gb->getBits(16);
- indx = _ctx.gb->getBits(2);
+ indx = _ctx._gb->getBits(2);
if (indx == 3) {
warning("Invalid block size!");
return -1;
}
- band->mb_size = 16 >> indx;
- band->blk_size = 8 >> (indx >> 1);
+ band->_mbSize = 16 >> indx;
+ band->_blkSize = 8 >> (indx >> 1);
- band->inherit_mv = _ctx.gb->getBits1();
- band->inherit_qdelta = _ctx.gb->getBits1();
+ band->_inheritMv = _ctx._gb->getBits1();
+ band->_inheritQDelta = _ctx._gb->getBits1();
- band->glob_quant = _ctx.gb->getBits(5);
+ band->_globQuant = _ctx._gb->getBits(5);
- if (!_ctx.gb->getBits1() || _ctx.frame_type == IVI4_FRAMETYPE_INTRA) {
- transform_id = _ctx.gb->getBits(5);
+ if (!_ctx._gb->getBits1() || _ctx._frameType == IVI4_FRAMETYPE_INTRA) {
+ transform_id = _ctx._gb->getBits(5);
if ((uint)transform_id >= FF_ARRAY_ELEMS(_transforms) ||
- !_transforms[transform_id].inv_trans) {
+ !_transforms[transform_id]._invTrans) {
warning("Transform %d", transform_id);
return -3;
}
@@ -328,117 +328,117 @@ int Indeo4Decoder::decode_band_hdr(IVIBandDesc *band) {
return -3;
}
- if (transform_id < 10 && band->blk_size < 8) {
+ if (transform_id < 10 && band->_blkSize < 8) {
warning("wrong transform size!");
return -1;
}
if ((transform_id >= 0 && transform_id <= 2) || transform_id == 10)
- _ctx.uses_haar = 1;
+ _ctx._usesHaar = true;
- band->inv_transform = _transforms[transform_id].inv_trans;
- band->dc_transform = _transforms[transform_id].dc_trans;
- band->is_2d_trans = _transforms[transform_id].is_2d_trans;
+ band->_invTransform = _transforms[transform_id]._invTrans;
+ band->_dcTransform = _transforms[transform_id]._dcTrans;
+ band->_is2dTrans = _transforms[transform_id]._is2dTrans;
if (transform_id < 10)
- band->transform_size = 8;
+ band->_transformSize = 8;
else
- band->transform_size = 4;
+ band->_transformSize = 4;
- if (band->blk_size != band->transform_size) {
- warning("transform and block size mismatch (%d != %d)", band->transform_size, band->blk_size);
+ if (band->_blkSize != band->_transformSize) {
+ warning("transform and block size mismatch (%d != %d)", band->_transformSize, band->_blkSize);
return -1;
}
- scan_indx = _ctx.gb->getBits(4);
+ scan_indx = _ctx._gb->getBits(4);
if (scan_indx == 15) {
warning("Custom scan pattern encountered!");
return -1;
}
if (scan_indx > 4 && scan_indx < 10) {
- if (band->blk_size != 4) {
+ if (band->_blkSize != 4) {
warning("mismatching scan table!");
return -1;
}
- } else if (band->blk_size != 8) {
+ } else if (band->_blkSize != 8) {
warning("mismatching scan table!");
return -1;
}
- band->scan = _scan_index_to_tab[scan_indx];
- band->scan_size = band->blk_size;
+ band->_scan = _scan_index_to_tab[scan_indx];
+ band->_scanSize = band->_blkSize;
- quant_mat = _ctx.gb->getBits(5);
- if (quant_mat == 31) {
+ _quantMat = _ctx._gb->getBits(5);
+ if (_quantMat == 31) {
warning("Custom quant matrix encountered!");
return -1;
}
- if ((uint)quant_mat >= FF_ARRAY_ELEMS(_quant_index_to_tab)) {
- warning("Quantization matrix %d", quant_mat);
+ if ((uint)_quantMat >= FF_ARRAY_ELEMS(_quant_index_to_tab)) {
+ warning("Quantization matrix %d", _quantMat);
return -1;
}
- band->quant_mat = quant_mat;
+ band->_quantMat = _quantMat;
} else {
- if (old_blk_size != band->blk_size) {
+ if (old_blk_size != band->_blkSize) {
warning("The band block size does not match the configuration inherited");
return -1;
}
}
- if (_quant_index_to_tab[band->quant_mat] > 4 && band->blk_size == 4) {
+ if (_quant_index_to_tab[band->_quantMat] > 4 && band->_blkSize == 4) {
warning("Invalid quant matrix for 4x4 block encountered!");
- band->quant_mat = 0;
+ band->_quantMat = 0;
return -1;
}
- if (band->scan_size != band->blk_size) {
+ if (band->_scanSize != band->_blkSize) {
warning("mismatching scan table!");
return -1;
}
- if (band->transform_size == 8 && band->blk_size < 8) {
- warning("mismatching transform_size!");
+ if (band->_transformSize == 8 && band->_blkSize < 8) {
+ warning("mismatching _transformSize!");
return -1;
}
// decode block huffman codebook
- if (!_ctx.gb->getBits1())
- band->blk_vlc.tab = _ctx.blk_vlc.tab;
+ if (!_ctx._gb->getBits1())
+ band->_blkVlc._tab = _ctx._blkVlc._tab;
else
- if (band->blk_vlc.ff_ivi_dec_huff_desc(&_ctx, 1, IVI_BLK_HUFF))
+ if (band->_blkVlc.ff_ivi_dec_huff_desc(&_ctx, 1, IVI_BLK_HUFF))
return -1;
// select appropriate rvmap table for this band
- band->rvmap_sel = _ctx.gb->getBits1() ? _ctx.gb->getBits(3) : 8;
+ band->_rvmapSel = _ctx._gb->getBits1() ? _ctx._gb->getBits(3) : 8;
// decode rvmap probability corrections if any
- band->num_corr = 0; // there is no corrections
- if (_ctx.gb->getBits1()) {
- band->num_corr = _ctx.gb->getBits(8); // get number of correction pairs
- if (band->num_corr > 61) {
+ band->_numCorr = 0; // there is no corrections
+ if (_ctx._gb->getBits1()) {
+ band->_numCorr = _ctx._gb->getBits(8); // get number of correction pairs
+ if (band->_numCorr > 61) {
warning("Too many corrections: %d",
- band->num_corr);
+ band->_numCorr);
return -1;
}
// read correction pairs
- for (i = 0; i < band->num_corr * 2; i++)
- band->corr[i] = _ctx.gb->getBits(8);
+ for (i = 0; i < band->_numCorr * 2; i++)
+ band->_corr[i] = _ctx._gb->getBits(8);
}
}
- if (band->blk_size == 8) {
- band->intra_base = &_ivi4_quant_8x8_intra[_quant_index_to_tab[band->quant_mat]][0];
- band->inter_base = &_ivi4_quant_8x8_inter[_quant_index_to_tab[band->quant_mat]][0];
+ if (band->_blkSize == 8) {
+ band->_intraBase = &_ivi4_quant_8x8_intra[_quant_index_to_tab[band->_quantMat]][0];
+ band->_interBase = &_ivi4_quant_8x8_inter[_quant_index_to_tab[band->_quantMat]][0];
} else {
- band->intra_base = &_ivi4_quant_4x4_intra[_quant_index_to_tab[band->quant_mat]][0];
- band->inter_base = &_ivi4_quant_4x4_inter[_quant_index_to_tab[band->quant_mat]][0];
+ band->_intraBase = &_ivi4_quant_4x4_intra[_quant_index_to_tab[band->_quantMat]][0];
+ band->_interBase = &_ivi4_quant_4x4_inter[_quant_index_to_tab[band->_quantMat]][0];
}
// Indeo 4 doesn't use scale tables
- band->intra_scale = NULL;
- band->inter_scale = NULL;
+ band->_intraScale = NULL;
+ band->_interScale = NULL;
- _ctx.gb->alignGetBits();
+ _ctx._gb->alignGetBits();
- if (!band->scan) {
- warning("band->scan not set");
+ if (!band->_scan) {
+ warning("band->_scan not set");
return -1;
}
@@ -446,155 +446,154 @@ int Indeo4Decoder::decode_band_hdr(IVIBandDesc *band) {
}
int Indeo4Decoder::decode_mb_info(IVIBandDesc *band, IVITile *tile) {
- int x, y, mv_x, mv_y, mv_delta, offs, mb_offset, blks_per_mb,
+ int x, y, _mvX, _mvY, mv_delta, offs, mb_offset, blks_per_mb,
mv_scale, mb_type_bits, s;
IVIMbInfo *mb, *ref_mb;
- int row_offset = band->mb_size * band->pitch;
+ int row_offset = band->_mbSize * band->_pitch;
- mb = tile->mbs;
- ref_mb = tile->ref_mbs;
- offs = tile->ypos * band->pitch + tile->xpos;
+ mb = tile->_mbs;
+ ref_mb = tile->_refMbs;
+ offs = tile->_yPos * band->_pitch + tile->_xPos;
- blks_per_mb = band->mb_size != band->blk_size ? 4 : 1;
- mb_type_bits = _ctx.frame_type == IVI4_FRAMETYPE_BIDIR ? 2 : 1;
+ blks_per_mb = band->_mbSize != band->_blkSize ? 4 : 1;
+ mb_type_bits = _ctx._frameType == IVI4_FRAMETYPE_BIDIR ? 2 : 1;
/* scale factor for motion vectors */
- mv_scale = (_ctx.planes[0].bands[0].mb_size >> 3) - (band->mb_size >> 3);
- mv_x = mv_y = 0;
+ mv_scale = (_ctx._planes[0]._bands[0]._mbSize >> 3) - (band->_mbSize >> 3);
+ _mvX = _mvY = 0;
- if (((tile->width + band->mb_size - 1) / band->mb_size) * ((tile->height + band->mb_size - 1) / band->mb_size) != tile->num_MBs) {
- warning("num_MBs mismatch %d %d %d %d", tile->width, tile->height, band->mb_size, tile->num_MBs);
+ if (((tile->_width + band->_mbSize - 1) / band->_mbSize) * ((tile->_height + band->_mbSize - 1) / band->_mbSize) != tile->_numMBs) {
+ warning("_numMBs mismatch %d %d %d %d", tile->_width, tile->_height, band->_mbSize, tile->_numMBs);
return -1;
}
- for (y = tile->ypos; y < tile->ypos + tile->height; y += band->mb_size) {
+ for (y = tile->_yPos; y < tile->_yPos + tile->_height; y += band->_mbSize) {
mb_offset = offs;
- for (x = tile->xpos; x < tile->xpos + tile->width; x += band->mb_size) {
- mb->xpos = x;
- mb->ypos = y;
- mb->buf_offs = mb_offset;
- mb->b_mv_x =
- mb->b_mv_y = 0;
+ for (x = tile->_xPos; x < tile->_xPos + tile->_width; x += band->_mbSize) {
+ mb->_xPos = x;
+ mb->_yPos = y;
+ mb->_bufOffs = mb_offset;
+ mb->_bMvX = mb->_bMvY = 0;
- if (_ctx.gb->getBits1()) {
- if (_ctx.frame_type == IVI4_FRAMETYPE_INTRA) {
+ if (_ctx._gb->getBits1()) {
+ if (_ctx._frameType == IVI4_FRAMETYPE_INTRA) {
warning("Empty macroblock in an INTRA picture!");
return -1;
}
- mb->type = 1; // empty macroblocks are always INTER
- mb->cbp = 0; // all blocks are empty
+ mb->_type = 1; // empty macroblocks are always INTER
+ mb->_cbp = 0; // all blocks are empty
- mb->q_delta = 0;
- if (!band->plane && !band->band_num && _ctx.in_q) {
- mb->q_delta = _ctx.gb->getVLC2(_ctx.mb_vlc.tab->_table,
+ mb->_qDelta = 0;
+ if (!band->_plane && !band->_bandNum && _ctx._inQ) {
+ mb->_qDelta = _ctx._gb->getVLC2(_ctx._mbVlc._tab->_table,
IVI_VLC_BITS, 1);
- mb->q_delta = IVI_TOSIGNED(mb->q_delta);
+ mb->_qDelta = IVI_TOSIGNED(mb->_qDelta);
}
- mb->mv_x = mb->mv_y = 0; /* no motion vector coded */
- if (band->inherit_mv && ref_mb) {
- /* motion vector inheritance */
+ mb->_mvX = mb->_mvY = 0; // no motion vector coded
+ if (band->_inheritMv && ref_mb) {
+ // motion vector inheritance
if (mv_scale) {
- mb->mv_x = ivi_scale_mv(ref_mb->mv_x, mv_scale);
- mb->mv_y = ivi_scale_mv(ref_mb->mv_y, mv_scale);
+ mb->_mvX = ivi_scale_mv(ref_mb->_mvX, mv_scale);
+ mb->_mvY = ivi_scale_mv(ref_mb->_mvY, mv_scale);
} else {
- mb->mv_x = ref_mb->mv_x;
- mb->mv_y = ref_mb->mv_y;
+ mb->_mvX = ref_mb->_mvX;
+ mb->_mvY = ref_mb->_mvY;
}
}
} else {
- if (band->inherit_mv) {
+ if (band->_inheritMv) {
// copy mb_type from corresponding reference mb
if (!ref_mb) {
warning("ref_mb unavailable");
return -1;
}
- mb->type = ref_mb->type;
- } else if (_ctx.frame_type == IVI4_FRAMETYPE_INTRA ||
- _ctx.frame_type == IVI4_FRAMETYPE_INTRA1) {
- mb->type = 0; // mb_type is always INTRA for intra-frames
+ mb->_type = ref_mb->_type;
+ } else if (_ctx._frameType == IVI4_FRAMETYPE_INTRA ||
+ _ctx._frameType == IVI4_FRAMETYPE_INTRA1) {
+ mb->_type = 0; // mb_type is always INTRA for intra-frames
} else {
- mb->type = _ctx.gb->getBits(mb_type_bits);
+ mb->_type = _ctx._gb->getBits(mb_type_bits);
}
- mb->cbp = _ctx.gb->getBits(blks_per_mb);
+ mb->_cbp = _ctx._gb->getBits(blks_per_mb);
- mb->q_delta = 0;
- if (band->inherit_qdelta) {
- if (ref_mb) mb->q_delta = ref_mb->q_delta;
- } else if (mb->cbp || (!band->plane && !band->band_num &&
- _ctx.in_q)) {
- mb->q_delta = _ctx.gb->getVLC2(_ctx.mb_vlc.tab->_table,
+ mb->_qDelta = 0;
+ if (band->_inheritQDelta) {
+ if (ref_mb) mb->_qDelta = ref_mb->_qDelta;
+ } else if (mb->_cbp || (!band->_plane && !band->_bandNum &&
+ _ctx._inQ)) {
+ mb->_qDelta = _ctx._gb->getVLC2(_ctx._mbVlc._tab->_table,
IVI_VLC_BITS, 1);
- mb->q_delta = IVI_TOSIGNED(mb->q_delta);
+ mb->_qDelta = IVI_TOSIGNED(mb->_qDelta);
}
- if (!mb->type) {
- mb->mv_x = mb->mv_y = 0; // there is no motion vector in intra-macroblocks
+ if (!mb->_type) {
+ mb->_mvX = mb->_mvY = 0; // there is no motion vector in intra-macroblocks
} else {
- if (band->inherit_mv) {
+ if (band->_inheritMv) {
if (ref_mb) {
// motion vector inheritance
if (mv_scale) {
- mb->mv_x = ivi_scale_mv(ref_mb->mv_x, mv_scale);
- mb->mv_y = ivi_scale_mv(ref_mb->mv_y, mv_scale);
+ mb->_mvX = ivi_scale_mv(ref_mb->_mvX, mv_scale);
+ mb->_mvY = ivi_scale_mv(ref_mb->_mvY, mv_scale);
} else {
- mb->mv_x = ref_mb->mv_x;
- mb->mv_y = ref_mb->mv_y;
+ mb->_mvX = ref_mb->_mvX;
+ mb->_mvY = ref_mb->_mvY;
}
}
} else {
// decode motion vector deltas
- mv_delta = _ctx.gb->getVLC2(_ctx.mb_vlc.tab->_table,
+ mv_delta = _ctx._gb->getVLC2(_ctx._mbVlc._tab->_table,
IVI_VLC_BITS, 1);
- mv_y += IVI_TOSIGNED(mv_delta);
- mv_delta = _ctx.gb->getVLC2(_ctx.mb_vlc.tab->_table,
+ _mvY += IVI_TOSIGNED(mv_delta);
+ mv_delta = _ctx._gb->getVLC2(_ctx._mbVlc._tab->_table,
IVI_VLC_BITS, 1);
- mv_x += IVI_TOSIGNED(mv_delta);
- mb->mv_x = mv_x;
- mb->mv_y = mv_y;
- if (mb->type == 3) {
- mv_delta = _ctx.gb->getVLC2(
- _ctx.mb_vlc.tab->_table,
+ _mvX += IVI_TOSIGNED(mv_delta);
+ mb->_mvX = _mvX;
+ mb->_mvY = _mvY;
+ if (mb->_type == 3) {
+ mv_delta = _ctx._gb->getVLC2(
+ _ctx._mbVlc._tab->_table,
IVI_VLC_BITS, 1);
- mv_y += IVI_TOSIGNED(mv_delta);
- mv_delta = _ctx.gb->getVLC2(
- _ctx.mb_vlc.tab->_table,
+ _mvY += IVI_TOSIGNED(mv_delta);
+ mv_delta = _ctx._gb->getVLC2(
+ _ctx._mbVlc._tab->_table,
IVI_VLC_BITS, 1);
- mv_x += IVI_TOSIGNED(mv_delta);
- mb->b_mv_x = -mv_x;
- mb->b_mv_y = -mv_y;
+ _mvX += IVI_TOSIGNED(mv_delta);
+ mb->_bMvX = -_mvX;
+ mb->_bMvY = -_mvY;
}
}
- if (mb->type == 2) {
- mb->b_mv_x = -mb->mv_x;
- mb->b_mv_y = -mb->mv_y;
- mb->mv_x = 0;
- mb->mv_y = 0;
+ if (mb->_type == 2) {
+ mb->_bMvX = -mb->_mvX;
+ mb->_bMvY = -mb->_mvY;
+ mb->_mvX = 0;
+ mb->_mvY = 0;
}
}
}
- s = band->is_halfpel;
- if (mb->type)
- if (x + (mb->mv_x >> s) + (y + (mb->mv_y >> s))*band->pitch < 0 ||
- x + ((mb->mv_x + s) >> s) + band->mb_size - 1
- + (y + band->mb_size - 1 + ((mb->mv_y + s) >> s))*band->pitch > band->bufsize - 1) {
- warning("motion vector %d %d outside reference", x*s + mb->mv_x, y*s + mb->mv_y);
+ s = band->_isHalfpel;
+ if (mb->_type)
+ if (x + (mb->_mvX >> s) + (y + (mb->_mvY >> s))*band->_pitch < 0 ||
+ x + ((mb->_mvX + s) >> s) + band->_mbSize - 1
+ + (y + band->_mbSize - 1 + ((mb->_mvY + s) >> s))*band->_pitch > band->_bufSize - 1) {
+ warning("motion vector %d %d outside reference", x*s + mb->_mvX, y*s + mb->_mvY);
return -1;
}
mb++;
if (ref_mb)
ref_mb++;
- mb_offset += band->mb_size;
+ mb_offset += band->_mbSize;
}
offs += row_offset;
}
- _ctx.gb->alignGetBits();
+ _ctx._gb->alignGetBits();
return 0;
}
@@ -605,12 +604,12 @@ int Indeo4Decoder::scaleTileSize(int def_size, int size_factor) {
int Indeo4Decoder::decodePlaneSubdivision() {
int i;
- switch (_ctx.gb->getBits(2)) {
+ switch (_ctx._gb->getBits(2)) {
case 3:
return 1;
case 2:
for (i = 0; i < 4; i++)
- if (_ctx.gb->getBits(2) != 3)
+ if (_ctx._gb->getBits(2) != 3)
return 0;
return 4;
default:
diff --git a/image/codecs/indeo4.h b/image/codecs/indeo4.h
index 1034f18f0c..86e6020c43 100644
--- a/image/codecs/indeo4.h
+++ b/image/codecs/indeo4.h
@@ -52,9 +52,9 @@ using namespace Indeo;
*/
class Indeo4Decoder : public IndeoDecoderBase {
struct Transform {
- InvTransformPtr *inv_trans;
- DCTransformPtr *dc_trans;
- int is_2d_trans;
+ InvTransformPtr *_invTrans;
+ DCTransformPtr *_dcTrans;
+ bool _is2dTrans;
};
public:
Indeo4Decoder(uint16 width, uint16 height);
diff --git a/image/codecs/indeo5.cpp b/image/codecs/indeo5.cpp
index b2aebe98a8..5434e26cfa 100644
--- a/image/codecs/indeo5.cpp
+++ b/image/codecs/indeo5.cpp
@@ -52,10 +52,10 @@ enum {
#define IVI5_PIC_SIZE_ESC 15
Indeo5Decoder::Indeo5Decoder(uint16 width, uint16 height) : IndeoDecoderBase(width, height) {
- _ctx.is_indeo4 = true;
- _ctx.ref_buf = 1;
- _ctx.b_ref_buf = 3;
- _ctx.p_frame = new AVFrame();
+ _ctx._isIndeo4 = false;
+ _ctx._refBuf = 1;
+ _ctx._bRefBuf = 3;
+ _ctx._pFrame = new AVFrame();
}
bool Indeo5Decoder::isIndeo5(Common::SeekableReadStream &stream) {
@@ -83,21 +83,21 @@ const Graphics::Surface *Indeo5Decoder::decodeFrame(Common::SeekableReadStream &
// Set up the frame data buffer
byte *frameData = new byte[stream.size()];
stream.read(frameData, stream.size());
- _ctx.frame_data = frameData;
- _ctx.frame_size = stream.size();
+ _ctx._frameData = frameData;
+ _ctx._frameSize = stream.size();
// Set up the GetBits instance for reading the data
- _ctx.gb = new GetBits(_ctx.frame_data, _ctx.frame_size * 8);
+ _ctx._gb = new GetBits(_ctx._frameData, _ctx._frameSize * 8);
// Decode the frame
int err = decodeIndeoFrame();
// Free the bit reader and frame buffer
- delete _ctx.gb;
- _ctx.gb = nullptr;
+ delete _ctx._gb;
+ _ctx._gb = nullptr;
delete[] frameData;
- _ctx.frame_data = nullptr;
- _ctx.frame_size = 0;
+ _ctx._frameData = nullptr;
+ _ctx._frameSize = 0;
return (err < 0) ? nullptr : &_surface->rawSurface();
}
@@ -108,87 +108,87 @@ int Indeo5Decoder::decodePictureHeader() {
int ret;
- if (_ctx.gb->getBits(5) != 0x1F) {
+ if (_ctx._gb->getBits(5) != 0x1F) {
warning("Invalid picture start code!");
return -1;
}
- _ctx.prev_frame_type = _ctx.frame_type;
- _ctx.frame_type = _ctx.gb->getBits(3);
- if (_ctx.frame_type >= 5) {
- warning("Invalid frame type: %d", _ctx.frame_type);
+ _ctx._prevFrameType = _ctx._frameType;
+ _ctx._frameType = _ctx._gb->getBits(3);
+ if (_ctx._frameType >= 5) {
+ warning("Invalid frame type: %d", _ctx._frameType);
return -1;
}
- _ctx.frame_num = _ctx.gb->getBits(8);
+ _ctx._frameNum = _ctx._gb->getBits(8);
- if (_ctx.frame_type == FRAMETYPE_INTRA) {
+ if (_ctx._frameType == FRAMETYPE_INTRA) {
if ((ret = decode_gop_header()) < 0) {
warning("Invalid GOP header, skipping frames.");
- _ctx.gop_invalid = 1;
+ _ctx._gopInvalid = true;
return ret;
}
- _ctx.gop_invalid = 0;
+ _ctx._gopInvalid = false;
}
- if (_ctx.frame_type == FRAMETYPE_INTER_SCAL && !_ctx.is_scalable) {
+ if (_ctx._frameType == FRAMETYPE_INTER_SCAL && !_ctx._isScalable) {
warning("Scalable inter frame in non scalable stream");
- _ctx.frame_type = FRAMETYPE_INTER;
+ _ctx._frameType = FRAMETYPE_INTER;
return -1;
}
- if (_ctx.frame_type != FRAMETYPE_NULL) {
- _ctx.frame_flags = _ctx.gb->getBits(8);
+ if (_ctx._frameType != FRAMETYPE_NULL) {
+ _ctx._frameFlags = _ctx._gb->getBits(8);
- _ctx.pic_hdr_size = (_ctx.frame_flags & 1) ? _ctx.gb->getBitsLong(24) : 0;
+ _ctx._picHdrSize = (_ctx._frameFlags & 1) ? _ctx._gb->getBitsLong(24) : 0;
- _ctx.checksum = (_ctx.frame_flags & 0x10) ? _ctx.gb->getBits(16) : 0;
+ _ctx._checksum = (_ctx._frameFlags & 0x10) ? _ctx._gb->getBits(16) : 0;
// skip unknown extension if any
- if (_ctx.frame_flags & 0x20)
+ if (_ctx._frameFlags & 0x20)
skip_hdr_extension(); // XXX: untested
// decode macroblock huffman codebook
- ret = _ctx.mb_vlc.ff_ivi_dec_huff_desc(&_ctx, _ctx.frame_flags & 0x40,
+ ret = _ctx._mbVlc.ff_ivi_dec_huff_desc(&_ctx, _ctx._frameFlags & 0x40,
IVI_MB_HUFF);
if (ret < 0)
return ret;
- _ctx.gb->skipBits(3); // FIXME: unknown meaning!
+ _ctx._gb->skipBits(3); // FIXME: unknown meaning!
}
- _ctx.gb->alignGetBits();
+ _ctx._gb->alignGetBits();
return 0;
}
void Indeo5Decoder::switch_buffers() {
- switch (_ctx.prev_frame_type) {
+ switch (_ctx._prevFrameType) {
case FRAMETYPE_INTRA:
case FRAMETYPE_INTER:
- _ctx.buf_switch ^= 1;
- _ctx.dst_buf = _ctx.buf_switch;
- _ctx.ref_buf = _ctx.buf_switch ^ 1;
+ _ctx._bufSwitch ^= 1;
+ _ctx._dstBuf = _ctx._bufSwitch;
+ _ctx._refBuf = _ctx._bufSwitch ^ 1;
break;
case FRAMETYPE_INTER_SCAL:
- if (!_ctx.inter_scal) {
- _ctx.ref2_buf = 2;
- _ctx.inter_scal = 1;
+ if (!_ctx._interScal) {
+ _ctx._ref2Buf = 2;
+ _ctx._interScal = 1;
}
- FFSWAP(int, _ctx.dst_buf, _ctx.ref2_buf);
- _ctx.ref_buf = _ctx.ref2_buf;
+ FFSWAP(int, _ctx._dstBuf, _ctx._ref2Buf);
+ _ctx._refBuf = _ctx._ref2Buf;
break;
case FRAMETYPE_INTER_NOREF:
break;
}
- switch (_ctx.frame_type) {
+ switch (_ctx._frameType) {
case FRAMETYPE_INTRA:
- _ctx.buf_switch = 0;
+ _ctx._bufSwitch = 0;
// FALLTHROUGH
case FRAMETYPE_INTER:
- _ctx.inter_scal = 0;
- _ctx.dst_buf = _ctx.buf_switch;
- _ctx.ref_buf = _ctx.buf_switch ^ 1;
+ _ctx._interScal = 0;
+ _ctx._dstBuf = _ctx._bufSwitch;
+ _ctx._refBuf = _ctx._bufSwitch ^ 1;
break;
case FRAMETYPE_INTER_SCAL:
case FRAMETYPE_INTER_NOREF:
@@ -198,207 +198,209 @@ void Indeo5Decoder::switch_buffers() {
}
bool Indeo5Decoder::is_nonnull_frame() const {
- return _ctx.frame_type != FRAMETYPE_NULL;
+ return _ctx._frameType != FRAMETYPE_NULL;
}
int Indeo5Decoder::decode_band_hdr(IVIBandDesc *band) {
int i, ret;
uint8 band_flags;
- band_flags = _ctx.gb->getBits(8);
+ band_flags = _ctx._gb->getBits(8);
if (band_flags & 1) {
- band->is_empty = 1;
+ band->_isEmpty = true;
return 0;
}
- band->data_size = (_ctx.frame_flags & 0x80) ? _ctx.gb->getBitsLong(24) : 0;
+ band->_dataSize = (_ctx._frameFlags & 0x80) ? _ctx._gb->getBitsLong(24) : 0;
- band->inherit_mv = band_flags & 2;
- band->inherit_qdelta = band_flags & 8;
- band->qdelta_present = band_flags & 4;
- if (!band->qdelta_present) band->inherit_qdelta = 1;
+ band->_inheritMv = (band_flags & 2) != 0;
+ band->_inheritQDelta = (band_flags & 8) != 0;
+ band->_qdeltaPresent = (band_flags & 4) != 0;
+ if (!band->_qdeltaPresent)
+ band->_inheritQDelta = 1;
// decode rvmap probability corrections if any
- band->num_corr = 0; // there are no corrections
+ band->_numCorr = 0; // there are no corrections
if (band_flags & 0x10) {
- band->num_corr = _ctx.gb->getBits(8); // get number of correction pairs
- if (band->num_corr > 61) {
- warning("Too many corrections: %d", band->num_corr);
+ band->_numCorr = _ctx._gb->getBits(8); // get number of correction pairs
+ if (band->_numCorr > 61) {
+ warning("Too many corrections: %d", band->_numCorr);
return -1;
}
// read correction pairs
- for (i = 0; i < band->num_corr * 2; i++)
- band->corr[i] = _ctx.gb->getBits(8);
+ for (i = 0; i < band->_numCorr * 2; i++)
+ band->_corr[i] = _ctx._gb->getBits(8);
}
// select appropriate rvmap table for this band
- band->rvmap_sel = (band_flags & 0x40) ? _ctx.gb->getBits(3) : 8;
+ band->_rvmapSel = (band_flags & 0x40) ? _ctx._gb->getBits(3) : 8;
// decode block huffman codebook
- ret = band->blk_vlc.ff_ivi_dec_huff_desc(&_ctx, band_flags & 0x80, IVI_BLK_HUFF);
+ ret = band->_blkVlc.ff_ivi_dec_huff_desc(&_ctx, band_flags & 0x80, IVI_BLK_HUFF);
if (ret < 0)
return ret;
- band->checksum_present = _ctx.gb->getBits1();
- if (band->checksum_present)
- band->checksum = _ctx.gb->getBits(16);
+ band->_checksumPresent = _ctx._gb->getBits1();
+ if (band->_checksumPresent)
+ band->_checksum = _ctx._gb->getBits(16);
- band->glob_quant = _ctx.gb->getBits(5);
+ band->_globQuant = _ctx._gb->getBits(5);
// skip unknown extension if any
if (band_flags & 0x20) { // XXX: untested
- _ctx.gb->alignGetBits();
+ _ctx._gb->alignGetBits();
skip_hdr_extension();
}
- _ctx.gb->alignGetBits();
+ _ctx._gb->alignGetBits();
return 0;
}
int Indeo5Decoder::decode_mb_info(IVIBandDesc *band, IVITile *tile) {
- int x, y, mv_x, mv_y, mv_delta, offs, mb_offset,
+ int x, y, _mvX, _mvY, mv_delta, offs, mb_offset,
mv_scale, blks_per_mb, s;
IVIMbInfo *mb, *ref_mb;
- int row_offset = band->mb_size * band->pitch;
+ int row_offset = band->_mbSize * band->_pitch;
- mb = tile->mbs;
- ref_mb = tile->ref_mbs;
- offs = tile->ypos * band->pitch + tile->xpos;
+ mb = tile->_mbs;
+ ref_mb = tile->_refMbs;
+ offs = tile->_yPos * band->_pitch + tile->_xPos;
if (!ref_mb &&
- ((band->qdelta_present && band->inherit_qdelta) || band->inherit_mv))
+ ((band->_qdeltaPresent && band->_inheritQDelta) || band->_inheritMv))
return -1;
- if (tile->num_MBs != IVI_MBs_PER_TILE(tile->width, tile->height, band->mb_size)) {
+ if (tile->_numMBs != IVI_MBs_PER_TILE(tile->_width, tile->_height, band->_mbSize)) {
warning("Allocated tile size %d mismatches parameters %d",
- tile->num_MBs, IVI_MBs_PER_TILE(tile->width, tile->height, band->mb_size));
+ tile->_numMBs, IVI_MBs_PER_TILE(tile->_width, tile->_height, band->_mbSize));
return -1;
}
// scale factor for motion vectors
- mv_scale = (_ctx.planes[0].bands[0].mb_size >> 3) - (band->mb_size >> 3);
- mv_x = mv_y = 0;
+ mv_scale = (_ctx._planes[0]._bands[0]._mbSize >> 3) - (band->_mbSize >> 3);
+ _mvX = _mvY = 0;
- for (y = tile->ypos; y < (tile->ypos + tile->height); y += band->mb_size) {
+ for (y = tile->_yPos; y < (tile->_yPos + tile->_height); y += band->_mbSize) {
mb_offset = offs;
- for (x = tile->xpos; x < (tile->xpos + tile->width); x += band->mb_size) {
- mb->xpos = x;
- mb->ypos = y;
- mb->buf_offs = mb_offset;
+ for (x = tile->_xPos; x < (tile->_xPos + tile->_width); x += band->_mbSize) {
+ mb->_xPos = x;
+ mb->_yPos = y;
+ mb->_bufOffs = mb_offset;
- if (_ctx.gb->getBits1()) {
- if (_ctx.frame_type == FRAMETYPE_INTRA) {
+ if (_ctx._gb->getBits1()) {
+ if (_ctx._frameType == FRAMETYPE_INTRA) {
warning("Empty macroblock in an INTRA picture!");
return -1;
}
- mb->type = 1; // empty macroblocks are always INTER
- mb->cbp = 0; // all blocks are empty
+ mb->_type = 1; // empty macroblocks are always INTER
+ mb->_cbp = 0; // all blocks are empty
- mb->q_delta = 0;
- if (!band->plane && !band->band_num && (_ctx.frame_flags & 8)) {
- mb->q_delta = _ctx.gb->getVLC2(_ctx.mb_vlc.tab->_table, IVI_VLC_BITS, 1);
- mb->q_delta = IVI_TOSIGNED(mb->q_delta);
+ mb->_qDelta = 0;
+ if (!band->_plane && !band->_bandNum && (_ctx._frameFlags & 8)) {
+ mb->_qDelta = _ctx._gb->getVLC2(_ctx._mbVlc._tab->_table, IVI_VLC_BITS, 1);
+ mb->_qDelta = IVI_TOSIGNED(mb->_qDelta);
}
- mb->mv_x = mb->mv_y = 0; // no motion vector coded
- if (band->inherit_mv && ref_mb) {
+ mb->_mvX = mb->_mvY = 0; // no motion vector coded
+ if (band->_inheritMv && ref_mb) {
// motion vector inheritance
if (mv_scale) {
- mb->mv_x = ivi_scale_mv(ref_mb->mv_x, mv_scale);
- mb->mv_y = ivi_scale_mv(ref_mb->mv_y, mv_scale);
+ mb->_mvX = ivi_scale_mv(ref_mb->_mvX, mv_scale);
+ mb->_mvY = ivi_scale_mv(ref_mb->_mvY, mv_scale);
} else {
- mb->mv_x = ref_mb->mv_x;
- mb->mv_y = ref_mb->mv_y;
+ mb->_mvX = ref_mb->_mvX;
+ mb->_mvY = ref_mb->_mvY;
}
}
} else {
- if (band->inherit_mv && ref_mb) {
- mb->type = ref_mb->type; // copy mb_type from corresponding reference mb
- } else if (_ctx.frame_type == FRAMETYPE_INTRA) {
- mb->type = 0; // mb_type is always INTRA for intra-frames
+ if (band->_inheritMv && ref_mb) {
+ mb->_type = ref_mb->_type; // copy mb_type from corresponding reference mb
+ } else if (_ctx._frameType == FRAMETYPE_INTRA) {
+ mb->_type = 0; // mb_type is always INTRA for intra-frames
} else {
- mb->type = _ctx.gb->getBits1();
+ mb->_type = _ctx._gb->getBits1();
}
- blks_per_mb = band->mb_size != band->blk_size ? 4 : 1;
- mb->cbp = _ctx.gb->getBits(blks_per_mb);
-
- mb->q_delta = 0;
- if (band->qdelta_present) {
- if (band->inherit_qdelta) {
- if (ref_mb) mb->q_delta = ref_mb->q_delta;
- } else if (mb->cbp || (!band->plane && !band->band_num &&
- (_ctx.frame_flags & 8))) {
- mb->q_delta = _ctx.gb->getVLC2(_ctx.mb_vlc.tab->_table, IVI_VLC_BITS, 1);
- mb->q_delta = IVI_TOSIGNED(mb->q_delta);
+ blks_per_mb = band->_mbSize != band->_blkSize ? 4 : 1;
+ mb->_cbp = _ctx._gb->getBits(blks_per_mb);
+
+ mb->_qDelta = 0;
+ if (band->_qdeltaPresent) {
+ if (band->_inheritQDelta) {
+ if (ref_mb) mb->_qDelta = ref_mb->_qDelta;
+ } else if (mb->_cbp || (!band->_plane && !band->_bandNum &&
+ (_ctx._frameFlags & 8))) {
+ mb->_qDelta = _ctx._gb->getVLC2(_ctx._mbVlc._tab->_table, IVI_VLC_BITS, 1);
+ mb->_qDelta = IVI_TOSIGNED(mb->_qDelta);
}
}
- if (!mb->type) {
- mb->mv_x = mb->mv_y = 0; // there is no motion vector in intra-macroblocks
+ if (!mb->_type) {
+ mb->_mvX = mb->_mvY = 0; // there is no motion vector in intra-macroblocks
} else {
- if (band->inherit_mv && ref_mb) {
+ if (band->_inheritMv && ref_mb) {
// motion vector inheritance
if (mv_scale) {
- mb->mv_x = ivi_scale_mv(ref_mb->mv_x, mv_scale);
- mb->mv_y = ivi_scale_mv(ref_mb->mv_y, mv_scale);
+ mb->_mvX = ivi_scale_mv(ref_mb->_mvX, mv_scale);
+ mb->_mvY = ivi_scale_mv(ref_mb->_mvY, mv_scale);
} else {
- mb->mv_x = ref_mb->mv_x;
- mb->mv_y = ref_mb->mv_y;
+ mb->_mvX = ref_mb->_mvX;
+ mb->_mvY = ref_mb->_mvY;
}
} else {
// decode motion vector deltas
- mv_delta = _ctx.gb->getVLC2(_ctx.mb_vlc.tab->_table, IVI_VLC_BITS, 1);
- mv_y += IVI_TOSIGNED(mv_delta);
- mv_delta = _ctx.gb->getVLC2(_ctx.mb_vlc.tab->_table, IVI_VLC_BITS, 1);
- mv_x += IVI_TOSIGNED(mv_delta);
- mb->mv_x = mv_x;
- mb->mv_y = mv_y;
+ mv_delta = _ctx._gb->getVLC2(_ctx._mbVlc._tab->_table, IVI_VLC_BITS, 1);
+ _mvY += IVI_TOSIGNED(mv_delta);
+ mv_delta = _ctx._gb->getVLC2(_ctx._mbVlc._tab->_table, IVI_VLC_BITS, 1);
+ _mvX += IVI_TOSIGNED(mv_delta);
+ mb->_mvX = _mvX;
+ mb->_mvY = _mvY;
}
}
}
- s = band->is_halfpel;
- if (mb->type)
- if (x + (mb->mv_x >> s) + (y + (mb->mv_y >> s))*band->pitch < 0 ||
- x + ((mb->mv_x + s) >> s) + band->mb_size - 1
- + (y + band->mb_size - 1 + ((mb->mv_y + s) >> s))*band->pitch > band->bufsize - 1) {
- warning("motion vector %d %d outside reference", x*s + mb->mv_x, y*s + mb->mv_y);
+ s = band->_isHalfpel;
+ if (mb->_type)
+ if (x + (mb->_mvX >> s) + (y + (mb->_mvY >> s))*band->_pitch < 0 ||
+ x + ((mb->_mvX + s) >> s) + band->_mbSize - 1
+ + (y + band->_mbSize - 1 + ((mb->_mvY + s) >> s))*band->_pitch > band->_bufSize - 1) {
+ warning("motion vector %d %d outside reference", x*s + mb->_mvX, y*s + mb->_mvY);
return -1;
}
mb++;
if (ref_mb)
ref_mb++;
- mb_offset += band->mb_size;
+ mb_offset += band->_mbSize;
}
offs += row_offset;
}
- _ctx.gb->alignGetBits();
+ _ctx._gb->alignGetBits();
return 0;
}
int Indeo5Decoder::decode_gop_header() {
- int result, i, p, tile_size, pic_size_indx, mb_size, blk_size, is_scalable;
- int quant_mat, blk_size_changed = 0;
+ int result, i, p, tile_size, pic_size_indx, mbSize, blkSize, isScalable;
+ int quantMat;
+ bool blk_size_changed = false;
IVIBandDesc *band, *band1, *band2;
IVIPicConfig pic_conf;
- _ctx.gop_flags = _ctx.gb->getBits(8);
+ _ctx._gopFlags = _ctx._gb->getBits(8);
- _ctx.gop_hdr_size = (_ctx.gop_flags & 1) ? _ctx.gb->getBits(16) : 0;
+ _ctx._gopHdrSize = (_ctx._gopFlags & 1) ? _ctx._gb->getBits(16) : 0;
- if (_ctx.gop_flags & IVI5_IS_PROTECTED)
- _ctx.lock_word = _ctx.gb->getBitsLong(32);
+ if (_ctx._gopFlags & IVI5_IS_PROTECTED)
+ _ctx._lockWord = _ctx._gb->getBitsLong(32);
- tile_size = (_ctx.gop_flags & 0x40) ? 64 << _ctx.gb->getBits(2) : 0;
+ tile_size = (_ctx._gopFlags & 0x40) ? 64 << _ctx._gb->getBits(2) : 0;
if (tile_size > 256) {
warning("Invalid tile size: %d", tile_size);
return -1;
@@ -406,73 +408,73 @@ int Indeo5Decoder::decode_gop_header() {
// decode number of wavelet bands
// num_levels * 3 + 1
- pic_conf.luma_bands = _ctx.gb->getBits(2) * 3 + 1;
- pic_conf.chroma_bands = _ctx.gb->getBits1() * 3 + 1;
- is_scalable = pic_conf.luma_bands != 1 || pic_conf.chroma_bands != 1;
- if (is_scalable && (pic_conf.luma_bands != 4 || pic_conf.chroma_bands != 1)) {
+ pic_conf._lumaBands = _ctx._gb->getBits(2) * 3 + 1;
+ pic_conf._chromaBands = _ctx._gb->getBits1() * 3 + 1;
+ isScalable = pic_conf._lumaBands != 1 || pic_conf._chromaBands != 1;
+ if (isScalable && (pic_conf._lumaBands != 4 || pic_conf._chromaBands != 1)) {
warning("Scalability: unsupported subdivision! Luma bands: %d, chroma bands: %d",
- pic_conf.luma_bands, pic_conf.chroma_bands);
+ pic_conf._lumaBands, pic_conf._chromaBands);
return -1;
}
- pic_size_indx = _ctx.gb->getBits(4);
+ pic_size_indx = _ctx._gb->getBits(4);
if (pic_size_indx == IVI5_PIC_SIZE_ESC) {
- pic_conf.pic_height = _ctx.gb->getBits(13);
- pic_conf.pic_width = _ctx.gb->getBits(13);
+ pic_conf._picHeight = _ctx._gb->getBits(13);
+ pic_conf._picWidth = _ctx._gb->getBits(13);
} else {
- pic_conf.pic_height = _ivi5_common_pic_sizes[pic_size_indx * 2 + 1] << 2;
- pic_conf.pic_width = _ivi5_common_pic_sizes[pic_size_indx * 2] << 2;
+ pic_conf._picHeight = _ivi5_common_pic_sizes[pic_size_indx * 2 + 1] << 2;
+ pic_conf._picWidth = _ivi5_common_pic_sizes[pic_size_indx * 2] << 2;
}
- if (_ctx.gop_flags & 2) {
+ if (_ctx._gopFlags & 2) {
warning("YV12 picture format");
return -2;
}
- pic_conf.chroma_height = (pic_conf.pic_height + 3) >> 2;
- pic_conf.chroma_width = (pic_conf.pic_width + 3) >> 2;
+ pic_conf._chromaHeight = (pic_conf._picHeight + 3) >> 2;
+ pic_conf._chromaWidth = (pic_conf._picWidth + 3) >> 2;
if (!tile_size) {
- pic_conf.tile_height = pic_conf.pic_height;
- pic_conf.tile_width = pic_conf.pic_width;
+ pic_conf._tileHeight = pic_conf._picHeight;
+ pic_conf._tileWidth = pic_conf._picWidth;
} else {
- pic_conf.tile_height = pic_conf.tile_width = tile_size;
+ pic_conf._tileHeight = pic_conf._tileWidth = tile_size;
}
// check if picture layout was changed and reallocate buffers
- if (pic_conf.ivi_pic_config_cmp(_ctx.pic_conf) || _ctx.gop_invalid) {
- result = IVIPlaneDesc::ff_ivi_init_planes(_ctx.planes, &pic_conf, 0);
+ if (pic_conf.ivi_pic_config_cmp(_ctx._picConf) || _ctx._gopInvalid) {
+ result = IVIPlaneDesc::ff_ivi_init_planes(_ctx._planes, &pic_conf, 0);
if (result < 0) {
warning("Couldn't reallocate color planes!");
return result;
}
- _ctx.pic_conf = pic_conf;
- _ctx.is_scalable = is_scalable;
+ _ctx._picConf = pic_conf;
+ _ctx._isScalable = isScalable;
blk_size_changed = 1; // force reallocation of the internal structures
}
for (p = 0; p <= 1; p++) {
- for (i = 0; i < (!p ? pic_conf.luma_bands : pic_conf.chroma_bands); i++) {
- band = &_ctx.planes[p].bands[i];
+ for (i = 0; i < (!p ? pic_conf._lumaBands : pic_conf._chromaBands); i++) {
+ band = &_ctx._planes[p]._bands[i];
- band->is_halfpel = _ctx.gb->getBits1();
+ band->_isHalfpel = _ctx._gb->getBits1();
- mb_size = _ctx.gb->getBits1();
- blk_size = 8 >> _ctx.gb->getBits1();
- mb_size = blk_size << !mb_size;
+ mbSize = _ctx._gb->getBits1();
+ blkSize = 8 >> _ctx._gb->getBits1();
+ mbSize = blkSize << !mbSize;
- if (p == 0 && blk_size == 4) {
+ if (p == 0 && blkSize == 4) {
warning("4x4 luma blocks are unsupported!");
return -2;
}
- blk_size_changed = mb_size != band->mb_size || blk_size != band->blk_size;
+ blk_size_changed = mbSize != band->_mbSize || blkSize != band->_blkSize;
if (blk_size_changed) {
- band->mb_size = mb_size;
- band->blk_size = blk_size;
+ band->_mbSize = mbSize;
+ band->_blkSize = blkSize;
}
- if (_ctx.gb->getBits1()) {
+ if (_ctx._gb->getBits1()) {
warning("Extended transform info");
return -2;
}
@@ -480,73 +482,73 @@ int Indeo5Decoder::decode_gop_header() {
// select transform function and scan pattern according to plane and band number
switch ((p << 2) + i) {
case 0:
- band->inv_transform = IndeoDSP::ff_ivi_inverse_slant_8x8;
- band->dc_transform = IndeoDSP::ff_ivi_dc_slant_2d;
- band->scan = ff_zigzag_direct;
- band->transform_size = 8;
+ band->_invTransform = IndeoDSP::ff_ivi_inverse_slant_8x8;
+ band->_dcTransform = IndeoDSP::ff_ivi_dc_slant_2d;
+ band->_scan = ff_zigzag_direct;
+ band->_transformSize = 8;
break;
case 1:
- band->inv_transform = IndeoDSP::ff_ivi_row_slant8;
- band->dc_transform = IndeoDSP::ff_ivi_dc_row_slant;
- band->scan = _ff_ivi_vertical_scan_8x8;
- band->transform_size = 8;
+ band->_invTransform = IndeoDSP::ff_ivi_row_slant8;
+ band->_dcTransform = IndeoDSP::ff_ivi_dc_row_slant;
+ band->_scan = _ff_ivi_vertical_scan_8x8;
+ band->_transformSize = 8;
break;
case 2:
- band->inv_transform = IndeoDSP::ff_ivi_col_slant8;
- band->dc_transform = IndeoDSP::ff_ivi_dc_col_slant;
- band->scan = _ff_ivi_horizontal_scan_8x8;
- band->transform_size = 8;
+ band->_invTransform = IndeoDSP::ff_ivi_col_slant8;
+ band->_dcTransform = IndeoDSP::ff_ivi_dc_col_slant;
+ band->_scan = _ff_ivi_horizontal_scan_8x8;
+ band->_transformSize = 8;
break;
case 3:
- band->inv_transform = IndeoDSP::ff_ivi_put_pixels_8x8;
- band->dc_transform = IndeoDSP::ff_ivi_put_dc_pixel_8x8;
- band->scan = _ff_ivi_horizontal_scan_8x8;
- band->transform_size = 8;
+ band->_invTransform = IndeoDSP::ff_ivi_put_pixels_8x8;
+ band->_dcTransform = IndeoDSP::ff_ivi_put_dc_pixel_8x8;
+ band->_scan = _ff_ivi_horizontal_scan_8x8;
+ band->_transformSize = 8;
break;
case 4:
- band->inv_transform = IndeoDSP::ff_ivi_inverse_slant_4x4;
- band->dc_transform = IndeoDSP::ff_ivi_dc_slant_2d;
- band->scan = _ff_ivi_direct_scan_4x4;
- band->transform_size = 4;
+ band->_invTransform = IndeoDSP::ff_ivi_inverse_slant_4x4;
+ band->_dcTransform = IndeoDSP::ff_ivi_dc_slant_2d;
+ band->_scan = _ff_ivi_direct_scan_4x4;
+ band->_transformSize = 4;
break;
}
- band->is_2d_trans = band->inv_transform == IndeoDSP::ff_ivi_inverse_slant_8x8 ||
- band->inv_transform == IndeoDSP::ff_ivi_inverse_slant_4x4;
+ band->_is2dTrans = band->_invTransform == IndeoDSP::ff_ivi_inverse_slant_8x8 ||
+ band->_invTransform == IndeoDSP::ff_ivi_inverse_slant_4x4;
- if (band->transform_size != band->blk_size) {
- warning("transform and block size mismatch (%d != %d)", band->transform_size, band->blk_size);
+ if (band->_transformSize != band->_blkSize) {
+ warning("transform and block size mismatch (%d != %d)", band->_transformSize, band->_blkSize);
return -1;
}
// select dequant matrix according to plane and band number
if (!p) {
- quant_mat = (pic_conf.luma_bands > 1) ? i + 1 : 0;
+ quantMat = (pic_conf._lumaBands > 1) ? i + 1 : 0;
} else {
- quant_mat = 5;
+ quantMat = 5;
}
- if (band->blk_size == 8) {
- if (quant_mat >= 5) {
- warning("quant_mat %d too large!", quant_mat);
+ if (band->_blkSize == 8) {
+ if (quantMat >= 5) {
+ warning("_quantMat %d too large!", quantMat);
return -1;
}
- band->intra_base = &_ivi5_base_quant_8x8_intra[quant_mat][0];
- band->inter_base = &_ivi5_base_quant_8x8_inter[quant_mat][0];
- band->intra_scale = &_ivi5_scale_quant_8x8_intra[quant_mat][0];
- band->inter_scale = &_ivi5_scale_quant_8x8_inter[quant_mat][0];
+ band->_intraBase = &_ivi5_base_quant_8x8_intra[quantMat][0];
+ band->_interBase = &_ivi5_base_quant_8x8_inter[quantMat][0];
+ band->_intraScale = &_ivi5_scale_quant_8x8_intra[quantMat][0];
+ band->_interScale = &_ivi5_scale_quant_8x8_inter[quantMat][0];
} else {
- band->intra_base = _ivi5_base_quant_4x4_intra;
- band->inter_base = _ivi5_base_quant_4x4_inter;
- band->intra_scale = _ivi5_scale_quant_4x4_intra;
- band->inter_scale = _ivi5_scale_quant_4x4_inter;
+ band->_intraBase = _ivi5_base_quant_4x4_intra;
+ band->_interBase = _ivi5_base_quant_4x4_inter;
+ band->_intraScale = _ivi5_scale_quant_4x4_intra;
+ band->_interScale = _ivi5_scale_quant_4x4_inter;
}
- if (_ctx.gb->getBits(2)) {
+ if (_ctx._gb->getBits(2)) {
warning("End marker missing!");
return -1;
}
@@ -554,58 +556,58 @@ int Indeo5Decoder::decode_gop_header() {
}
// copy chroma parameters into the 2nd chroma plane
- for (i = 0; i < pic_conf.chroma_bands; i++) {
- band1 = &_ctx.planes[1].bands[i];
- band2 = &_ctx.planes[2].bands[i];
-
- band2->width = band1->width;
- band2->height = band1->height;
- band2->mb_size = band1->mb_size;
- band2->blk_size = band1->blk_size;
- band2->is_halfpel = band1->is_halfpel;
- band2->intra_base = band1->intra_base;
- band2->inter_base = band1->inter_base;
- band2->intra_scale = band1->intra_scale;
- band2->inter_scale = band1->inter_scale;
- band2->scan = band1->scan;
- band2->inv_transform = band1->inv_transform;
- band2->dc_transform = band1->dc_transform;
- band2->is_2d_trans = band1->is_2d_trans;
- band2->transform_size = band1->transform_size;
+ for (i = 0; i < pic_conf._chromaBands; i++) {
+ band1 = &_ctx._planes[1]._bands[i];
+ band2 = &_ctx._planes[2]._bands[i];
+
+ band2->_width = band1->_width;
+ band2->_height = band1->_height;
+ band2->_mbSize = band1->_mbSize;
+ band2->_blkSize = band1->_blkSize;
+ band2->_isHalfpel = band1->_isHalfpel;
+ band2->_intraBase = band1->_intraBase;
+ band2->_interBase = band1->_interBase;
+ band2->_intraScale = band1->_intraScale;
+ band2->_interScale = band1->_interScale;
+ band2->_scan = band1->_scan;
+ band2->_invTransform = band1->_invTransform;
+ band2->_dcTransform = band1->_dcTransform;
+ band2->_is2dTrans = band1->_is2dTrans;
+ band2->_transformSize = band1->_transformSize;
}
// reallocate internal structures if needed
if (blk_size_changed) {
- result = IVIPlaneDesc::ff_ivi_init_tiles(_ctx.planes, pic_conf.tile_width,
- pic_conf.tile_height);
+ result = IVIPlaneDesc::ff_ivi_init_tiles(_ctx._planes, pic_conf._tileWidth,
+ pic_conf._tileHeight);
if (result < 0) {
warning("Couldn't reallocate internal structures!");
return result;
}
}
- if (_ctx.gop_flags & 8) {
- if (_ctx.gb->getBits(3)) {
+ if (_ctx._gopFlags & 8) {
+ if (_ctx._gb->getBits(3)) {
warning("Alignment bits are not zero!");
return -1;
}
- if (_ctx.gb->getBits1())
- _ctx.gb->skipBitsLong(24); // skip transparency fill color
+ if (_ctx._gb->getBits1())
+ _ctx._gb->skipBitsLong(24); // skip transparency fill color
}
- _ctx.gb->alignGetBits();
+ _ctx._gb->alignGetBits();
- _ctx.gb->skipBits(23); // FIXME: unknown meaning
+ _ctx._gb->skipBits(23); // FIXME: unknown meaning
// skip GOP extension if any
- if (_ctx.gb->getBits1()) {
+ if (_ctx._gb->getBits1()) {
do {
- i = _ctx.gb->getBits(16);
+ i = _ctx._gb->getBits(16);
} while (i & 0x8000);
}
- _ctx.gb->alignGetBits();
+ _ctx._gb->alignGetBits();
return 0;
}
@@ -614,11 +616,11 @@ int Indeo5Decoder::skip_hdr_extension() {
int i, len;
do {
- len = _ctx.gb->getBits(8);
- if (8 * len > _ctx.gb->getBitsLeft())
+ len = _ctx._gb->getBits(8);
+ if (8 * len > _ctx._gb->getBitsLeft())
return -1;
for (i = 0; i < len; i++)
- _ctx.gb->skipBits(8);
+ _ctx._gb->skipBits(8);
} while (len);
return 0;