aboutsummaryrefslogtreecommitdiff
path: root/image/codecs
diff options
context:
space:
mode:
authorPaul Gilbert2016-09-10 17:00:06 -0400
committerPaul Gilbert2016-09-10 17:00:06 -0400
commite06442afb6b154f749c4d839fd2a23e434e08dda (patch)
tree93d50a764b6f72c6cf2ec9a348b3b39b176e4d52 /image/codecs
parent58ad70f351caa6f7791bf5ff62b0166e37dadf47 (diff)
downloadscummvm-rg350-e06442afb6b154f749c4d839fd2a23e434e08dda.tar.gz
scummvm-rg350-e06442afb6b154f749c4d839fd2a23e434e08dda.tar.bz2
scummvm-rg350-e06442afb6b154f749c4d839fd2a23e434e08dda.zip
IMAGE: Cleanup of method parameters and locals in Indeo decoders
Diffstat (limited to 'image/codecs')
-rw-r--r--image/codecs/indeo/indeo.cpp633
-rw-r--r--image/codecs/indeo/indeo.h156
-rw-r--r--image/codecs/indeo4.cpp138
-rw-r--r--image/codecs/indeo4.h14
-rw-r--r--image/codecs/indeo5.cpp173
-rw-r--r--image/codecs/indeo5.h8
6 files changed, 563 insertions, 559 deletions
diff --git a/image/codecs/indeo/indeo.cpp b/image/codecs/indeo/indeo.cpp
index 632e39ea7b..4f290160ed 100644
--- a/image/codecs/indeo/indeo.cpp
+++ b/image/codecs/indeo/indeo.cpp
@@ -81,27 +81,27 @@ static const IVIHuffDesc ivi_blk_huff_desc[8] = {
/**
* calculate number of _tiles in a stride
*/
-#define IVI_NUM_TILES(stride, tile_size) (((stride) + (tile_size) - 1) / (tile_size))
+#define IVI_NUM_TILES(stride, tileSize) (((stride) + (tileSize) - 1) / (tileSize))
/*------------------------------------------------------------------------*/
-int IVIHuffDesc::ivi_create_huff_from_desc(VLC *vlc, int flag) const {
- int pos, i, j, codes_per_row, prefix, not_last_row;
+int IVIHuffDesc::createHuffFromDesc(VLC *vlc, bool flag) const {
+ int pos, i, j, codesPerRow, prefix, notLastRow;
uint16 codewords[256];
uint8 bits[256];
pos = 0; // current position = 0
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);
+ codesPerRow = 1 << _xBits[i];
+ notLastRow = (i != _numRows - 1);
+ prefix = ((1 << i) - 1) << (_xBits[i] + notLastRow);
- for (j = 0; j < codes_per_row; j++) {
+ for (j = 0; j < codesPerRow; 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] + notLastRow;
if (bits[pos] > IVI_VLC_BITS)
return -1; // invalid descriptor
@@ -120,12 +120,11 @@ int IVIHuffDesc::ivi_create_huff_from_desc(VLC *vlc, int flag) const {
/*------------------------------------------------------------------------*/
-bool IVIHuffDesc::ivi_huff_desc_cmp(const IVIHuffDesc *desc2) const {
- return _numRows != desc2->_numRows ||
- memcmp(_xBits, desc2->_xBits, _numRows);
+bool IVIHuffDesc::huffDescCompare(const IVIHuffDesc *desc2) const {
+ return _numRows != desc2->_numRows || memcmp(_xBits, desc2->_xBits, _numRows);
}
-void IVIHuffDesc::ivi_huff_desc_copy(const IVIHuffDesc *src) {
+void IVIHuffDesc::huffDescCopy(const IVIHuffDesc *src) {
_numRows = src->_numRows;
memcpy(_xBits, src->_xBits, src->_numRows);
}
@@ -135,13 +134,13 @@ void IVIHuffDesc::ivi_huff_desc_copy(const IVIHuffDesc *src) {
IVIHuffTab::IVIHuffTab() : _tab(nullptr) {
}
-int IVIHuffTab::ff_ivi_dec_huff_desc(IVI45DecContext *ctx, int desc_coded, int which_tab) {
+int IVIHuffTab::decodeHuffDesc(IVI45DecContext *ctx, int descCoded, int whichTab) {
int i, result;
- IVIHuffDesc new_huff;
+ IVIHuffDesc newHuff;
- if (!desc_coded) {
+ if (!descCoded) {
// select default table
- _tab = (which_tab) ? &ctx->_iviBlkVlcTabs[7]
+ _tab = (whichTab) ? &ctx->_iviBlkVlcTabs[7]
: &ctx->_iviMbVlcTabs[7];
return 0;
}
@@ -149,22 +148,22 @@ int IVIHuffTab::ff_ivi_dec_huff_desc(IVI45DecContext *ctx, int desc_coded, int w
_tabSel = ctx->_gb->getBits(3);
if (_tabSel == 7) {
// custom huffman table (explicitly encoded)
- new_huff._numRows = ctx->_gb->getBits(4);
- if (!new_huff._numRows) {
+ newHuff._numRows = ctx->_gb->getBits(4);
+ if (!newHuff._numRows) {
warning("Empty custom Huffman table!");
return -1;
}
- for (i = 0; i < new_huff._numRows; i++)
- new_huff._xBits[i] = ctx->_gb->getBits(4);
+ for (i = 0; i < newHuff._numRows; i++)
+ newHuff._xBits[i] = ctx->_gb->getBits(4);
// Have we got the same custom table? Rebuild if not.
- if (new_huff.ivi_huff_desc_cmp(&_custDesc) || !_custTab._table) {
- _custDesc.ivi_huff_desc_copy(&new_huff);
+ if (newHuff.huffDescCompare(&_custDesc) || !_custTab._table) {
+ _custDesc.huffDescCopy(&newHuff);
if (_custTab._table)
_custTab.ff_free_vlc();
- result = _custDesc.ivi_create_huff_from_desc(&_custTab, 0);
+ result = _custDesc.createHuffFromDesc(&_custTab, false);
if (result) {
// reset faulty description
_custDesc._numRows = 0;
@@ -175,7 +174,7 @@ int IVIHuffTab::ff_ivi_dec_huff_desc(IVI45DecContext *ctx, int desc_coded, int w
_tab = &_custTab;
} else {
// select one of predefined tables
- _tab = (which_tab) ? &ctx->_iviBlkVlcTabs[_tabSel]
+ _tab = (whichTab) ? &ctx->_iviBlkVlcTabs[_tabSel]
: &ctx->_iviMbVlcTabs[_tabSel];
}
@@ -210,17 +209,17 @@ IVIBandDesc::IVIBandDesc() : _plane(0), _bandNum(0), _width(0), _height(0),
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 IVIBandDesc::initTiles(IVITile *refTile, int p, int b, int tHeight, int tWidth) {
int x, y;
IVITile *tile = _tiles;
- for (y = 0; y < _height; y += t_height) {
- for (x = 0; x < _width; x += t_width) {
+ for (y = 0; y < _height; y += tHeight) {
+ for (x = 0; x < _width; x += tWidth) {
tile->_xPos = x;
tile->_yPos = y;
tile->_mbSize = _mbSize;
- tile->_width = MIN(_width - x, t_width);
- tile->_height = MIN(_height - y, t_height);
+ tile->_width = MIN(_width - x, tWidth);
+ tile->_height = MIN(_height - y, tHeight);
tile->_dataSize = 0;
tile->_isEmpty = false;
@@ -235,12 +234,12 @@ int IVIBandDesc::ivi_init_tiles(IVITile *ref_tile, int p, int b, int t_height, i
tile->_refMbs = 0;
if (p || b) {
- if (tile->_numMBs != ref_tile->_numMBs) {
- warning("ref_tile mismatch");
+ if (tile->_numMBs != refTile->_numMBs) {
+ warning("refTile mismatch");
return -1;
}
- tile->_refMbs = ref_tile->_mbs;
- ref_tile++;
+ tile->_refMbs = refTile->_mbs;
+ refTile++;
}
tile++;
}
@@ -267,15 +266,15 @@ bool IVIPicConfig::ivi_pic_config_cmp(const IVIPicConfig &cfg2) {
IVIPlaneDesc::IVIPlaneDesc() : _width(0), _height(0), _numBands(0), _bands(nullptr) {
}
-int IVIPlaneDesc::ff_ivi_init_planes(IVIPlaneDesc *planes, const IVIPicConfig *cfg, bool _isIndeo4) {
+int IVIPlaneDesc::initPlanes(IVIPlaneDesc *planes, const IVIPicConfig *cfg, bool isIndeo4) {
int p, b;
uint32 b_width, b_height, align_fac, width_aligned,
- height_aligned, buf_size;
+ height_aligned, bufSize;
IVIBandDesc *band;
- ivi_free_buffers(planes);
+ freeBuffers(planes);
- if (av_image_check_size(cfg->_picWidth, cfg->_picHeight, 0, NULL) < 0 ||
+ if (checkImageSize(cfg->_picWidth, cfg->_picHeight, 0) < 0 ||
cfg->_lumaBands < 1 || cfg->_chromaBands < 1)
return -1;
@@ -307,7 +306,7 @@ int IVIPlaneDesc::ff_ivi_init_planes(IVIPlaneDesc *planes, const IVIPicConfig *c
align_fac = p ? 8 : 16;
width_aligned = FFALIGN(b_width, align_fac);
height_aligned = FFALIGN(b_height, align_fac);
- buf_size = width_aligned * height_aligned * sizeof(int16);
+ bufSize = width_aligned * height_aligned * sizeof(int16);
for (b = 0; b < planes[p]._numBands; b++) {
band = &planes[p]._bands[b]; // select appropriate _plane/band
@@ -317,20 +316,20 @@ int IVIPlaneDesc::ff_ivi_init_planes(IVIPlaneDesc *planes, const IVIPicConfig *c
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;
+ band->_bufs[0] = (int16 *)av_mallocz(bufSize);
+ band->_bufs[1] = (int16 *)av_mallocz(bufSize);
+ band->_bufSize = bufSize / 2;
if (!band->_bufs[0] || !band->_bufs[1])
return -2;
// allocate the 3rd band buffer for scalability mode
if (cfg->_lumaBands > 1) {
- band->_bufs[2] = (int16 *)av_mallocz(buf_size);
+ band->_bufs[2] = (int16 *)av_mallocz(bufSize);
if (!band->_bufs[2])
return -2;
}
- if (_isIndeo4) {
- band->_bufs[3] = (int16 *)av_mallocz(buf_size);
+ if (isIndeo4) {
+ band->_bufs[3] = (int16 *)av_mallocz(bufSize);
if (!band->_bufs[3])
return -2;
}
@@ -342,27 +341,26 @@ int IVIPlaneDesc::ff_ivi_init_planes(IVIPlaneDesc *planes, const IVIPicConfig *c
return 0;
}
-int IVIPlaneDesc::ff_ivi_init_tiles(IVIPlaneDesc *planes,
- int _tileWidth, int _tileHeight) {
- int p, b, x_tiles, y_tiles, t_width, t_height, ret;
+int IVIPlaneDesc::initTiles(IVIPlaneDesc *planes, int tileWidth, int tileHeight) {
+ int p, b, xTiles, yTiles, tWidth, tHeight, ret;
IVIBandDesc *band;
for (p = 0; p < 3; p++) {
- t_width = !p ? _tileWidth : (_tileWidth + 3) >> 2;
- t_height = !p ? _tileHeight : (_tileHeight + 3) >> 2;
+ tWidth = !p ? tileWidth : (tileWidth + 3) >> 2;
+ tHeight = !p ? tileHeight : (tileHeight + 3) >> 2;
if (!p && planes[0]._numBands == 4) {
- t_width >>= 1;
- t_height >>= 1;
+ tWidth >>= 1;
+ tHeight >>= 1;
}
- if (t_width <= 0 || t_height <= 0)
+ if (tWidth <= 0 || tHeight <= 0)
return -3;
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;
+ xTiles = IVI_NUM_TILES(band->_width, tWidth);
+ yTiles = IVI_NUM_TILES(band->_height, tHeight);
+ band->_numTiles = xTiles * yTiles;
av_freep(&band->_tiles);
band->_tiles = (IVITile *)av_mallocz_array(band->_numTiles, sizeof(IVITile));
@@ -371,8 +369,8 @@ int IVIPlaneDesc::ff_ivi_init_tiles(IVIPlaneDesc *planes,
// use the first luma band as reference for motion vectors
// and quant
- ret = band->ivi_init_tiles(planes[0]._bands[0]._tiles,
- p, b, t_height, t_width);
+ ret = band->initTiles(planes[0]._bands[0]._tiles,
+ p, b, tHeight, tWidth);
if (ret < 0)
return ret;
}
@@ -381,7 +379,7 @@ int IVIPlaneDesc::ff_ivi_init_tiles(IVIPlaneDesc *planes,
return 0;
}
-void IVIPlaneDesc::ivi_free_buffers(IVIPlaneDesc *planes) {
+void IVIPlaneDesc::freeBuffers(IVIPlaneDesc *planes) {
int p, b, t;
for (p = 0; p < 3; p++) {
@@ -403,6 +401,13 @@ void IVIPlaneDesc::ivi_free_buffers(IVIPlaneDesc *planes) {
}
}
+int IVIPlaneDesc::checkImageSize(unsigned int w, unsigned int h, int log_offset) {
+ if (((w + 128) * (uint64)(h + 128)) < (MAX_INTEGER / 8))
+ return 0;
+
+ error("Picture size %ux%u is invalid", w, h);
+}
+
/*------------------------------------------------------------------------*/
AVFrame::AVFrame() {
@@ -410,7 +415,7 @@ AVFrame::AVFrame() {
Common::fill(&_linesize[0], &_linesize[AV_NUM_DATA_POINTERS], 0);
}
-int AVFrame::ff_set_dimensions(uint16 width, uint16 height) {
+int AVFrame::setDimensions(uint16 width, uint16 height) {
_width = width;
_height = height;
_linesize[0] = _linesize[1] = _linesize[2] = width;
@@ -418,8 +423,8 @@ int AVFrame::ff_set_dimensions(uint16 width, uint16 height) {
return 0;
}
-int AVFrame::ff_get_buffer(int flags) {
- av_frame_free();
+int AVFrame::getBuffer(int flags) {
+ freeFrame();
// Luminance channel
_data[0] = (uint8 *)av_mallocz(_width * _height);
@@ -433,7 +438,7 @@ int AVFrame::ff_get_buffer(int flags) {
return 0;
}
-void AVFrame::av_frame_free() {
+void AVFrame::freeFrame() {
av_freep(&_data[0]);
av_freep(&_data[1]);
av_freep(&_data[2]);
@@ -458,27 +463,27 @@ IVI45DecContext::IVI45DecContext() : _gb(nullptr), _frameNum(0), _frameType(0),
for (int i = 0; i < 8; i++) {
_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);
+ ivi_mb_huff_desc[i].createHuffFromDesc(&_iviMbVlcTabs[i], true);
_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);
+ ivi_blk_huff_desc[i].createHuffFromDesc(&_iviBlkVlcTabs[i], true);
}
}
/*------------------------------------------------------------------------*/
-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);
+ _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);
+ IVIPlaneDesc::freeBuffers(_ctx._planes);
if (_ctx._mbVlc._custTab._table)
_ctx._mbVlc._custTab.ff_free_vlc();
@@ -512,11 +517,11 @@ int IndeoDecoderBase::decodeIndeoFrame() {
return -1;
}
- switch_buffers();
+ switchBuffers();
//{ START_TIMER;
- if (is_nonnull_frame()) {
+ if (isNonNullFrame()) {
_ctx._bufInvalid[_ctx._dstBuf] = 1;
for (p = 0; p < 3; p++) {
for (b = 0; b < _ctx._planes[p]._numBands; b++) {
@@ -542,28 +547,28 @@ int IndeoDecoderBase::decodeIndeoFrame() {
//STOP_TIMER("decode_planes"); }
- if (!is_nonnull_frame())
+ if (!isNonNullFrame())
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);
+ result = frame->setDimensions(_ctx._planes[0]._width, _ctx._planes[0]._height);
if (result < 0)
return result;
- if ((result = frame->ff_get_buffer(0)) < 0)
+ if ((result = frame->getBuffer(0)) < 0)
return result;
if (_ctx._isScalable) {
if (_ctx._isIndeo4)
- ff_ivi_recompose_haar(&_ctx._planes[0], frame->_data[0], frame->_linesize[0]);
+ recomposeHaar(&_ctx._planes[0], frame->_data[0], frame->_linesize[0]);
else
- ff_ivi_recompose53(&_ctx._planes[0], frame->_data[0], frame->_linesize[0]);
+ recompose53(&_ctx._planes[0], frame->_data[0], frame->_linesize[0]);
} else {
- ivi_output_plane(&_ctx._planes[0], frame->_data[0], frame->_linesize[0]);
+ outputPlane(&_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]);
+ outputPlane(&_ctx._planes[2], frame->_data[1], frame->_linesize[1]);
+ outputPlane(&_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
@@ -592,7 +597,7 @@ int IndeoDecoderBase::decodeIndeoFrame() {
frame->_width, frame->_width);
// Free the now un-needed frame data
- frame->av_frame_free();
+ frame->freeFrame();
return 0;
}
@@ -615,7 +620,7 @@ int IndeoDecoderBase::decode_band(IVIBandDesc *band) {
}
band->_dataPtr = _ctx._frameData + (_ctx._gb->getBitsCount() >> 3);
- result = decode_band_hdr(band);
+ result = decodeBandHeader(band);
if (result) {
warning("Error while decoding band header: %d",
result);
@@ -653,24 +658,24 @@ int IndeoDecoderBase::decode_band(IVIBandDesc *band) {
}
tile->_isEmpty = _ctx._gb->getBits1();
if (tile->_isEmpty) {
- result = ivi_process_empty_tile(band, tile,
+ result = processEmptyTile(band, tile,
(_ctx._planes[0]._bands[0]._mbSize >> 3) - (band->_mbSize >> 3));
if (result < 0)
break;
warning("Empty tile encountered!");
} else {
- tile->_dataSize = ivi_dec_tile_data_size(_ctx._gb);
+ tile->_dataSize = decodeTileDataSize(_ctx._gb);
if (!tile->_dataSize) {
warning("Tile data size is zero!");
result = -1;
break;
}
- result = decode_mb_info(band, tile);
+ result = decodeMbInfo(band, tile);
if (result < 0)
break;
- result = ivi_decode_blocks(_ctx._gb, band, tile);
+ result = decodeBlocks(_ctx._gb, band, tile);
if (result < 0) {
warning("Corrupted tile data encountered!");
break;
@@ -704,28 +709,28 @@ int IndeoDecoderBase::decode_band(IVIBandDesc *band) {
return result;
}
-void IndeoDecoderBase::ff_ivi_recompose_haar(const IVIPlaneDesc *_plane,
- uint8 *dst, const int dst_pitch) {
+void IndeoDecoderBase::recomposeHaar(const IVIPlaneDesc *_plane,
+ uint8 *dst, const int dstPitch) {
int x, y, indx, b0, b1, b2, b3, p0, p1, p2, p3;
- const short * b0_ptr, *b1_ptr, *b2_ptr, *b3_ptr;
+ const short * b0Ptr, *b1Ptr, *b2Ptr, *b3Ptr;
int32 _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;
+ b0Ptr = _plane->_bands[0]._buf;
+ b1Ptr = _plane->_bands[1]._buf;
+ b2Ptr = _plane->_bands[2]._buf;
+ b3Ptr = _plane->_bands[3]._buf;
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 = (_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;
+ b0 = b0Ptr[indx]; //should be: b0 = (_numBands > 0) ? b0Ptr[indx] : 0;
+ b1 = b1Ptr[indx]; //should be: b1 = (_numBands > 1) ? b1Ptr[indx] : 0;
+ b2 = b2Ptr[indx]; //should be: b2 = (_numBands > 2) ? b2Ptr[indx] : 0;
+ b3 = b3Ptr[indx]; //should be: b3 = (_numBands > 3) ? b3Ptr[indx] : 0;
// haar wavelet recomposition
p0 = (b0 + b1 + b2 + b3 + 2) >> 2;
@@ -736,28 +741,27 @@ void IndeoDecoderBase::ff_ivi_recompose_haar(const IVIPlaneDesc *_plane,
// bias, convert and output four pixels
dst[x] = av_clip_uint8(p0 + 128);
dst[x + 1] = av_clip_uint8(p1 + 128);
- dst[dst_pitch + x] = av_clip_uint8(p2 + 128);
- dst[dst_pitch + x + 1] = av_clip_uint8(p3 + 128);
+ dst[dstPitch + x] = av_clip_uint8(p2 + 128);
+ dst[dstPitch + x + 1] = av_clip_uint8(p3 + 128);
}// for x
- dst += dst_pitch << 1;
+ dst += dstPitch << 1;
- b0_ptr += _pitch;
- b1_ptr += _pitch;
- b2_ptr += _pitch;
- b3_ptr += _pitch;
+ b0Ptr += _pitch;
+ b1Ptr += _pitch;
+ b2Ptr += _pitch;
+ b3Ptr += _pitch;
}// for y
}
-
-void IndeoDecoderBase::ff_ivi_recompose53(const IVIPlaneDesc *_plane,
- uint8 *dst, const int dst_pitch) {
+void IndeoDecoderBase::recompose53(const IVIPlaneDesc *_plane,
+ uint8 *dst, const int dstPitch) {
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;
- const short * b0_ptr, *b1_ptr, *b2_ptr, *b3_ptr;
+ const short * b0Ptr, *b1Ptr, *b2Ptr, *b3Ptr;
const int _numBands = 4;
// all bands should have the same _pitch
@@ -767,10 +771,10 @@ void IndeoDecoderBase::ff_ivi_recompose53(const IVIPlaneDesc *_plane,
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;
+ b0Ptr = _plane->_bands[0]._buf;
+ b1Ptr = _plane->_bands[1]._buf;
+ b2Ptr = _plane->_bands[2]._buf;
+ b3Ptr = _plane->_bands[3]._buf;
for (y = 0; y < _plane->_height; y += 2) {
@@ -778,38 +782,38 @@ void IndeoDecoderBase::ff_ivi_recompose53(const IVIPlaneDesc *_plane,
_pitch = 0;
// load storage variables with values
if (_numBands > 0) {
- b0_1 = b0_ptr[0];
- b0_2 = b0_ptr[_pitch];
+ b0_1 = b0Ptr[0];
+ b0_2 = b0Ptr[_pitch];
}
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_1 = b1Ptr[back_pitch];
+ b1_2 = b1Ptr[0];
+ b1_3 = b1_1 - b1_2 * 6 + b1Ptr[_pitch];
}
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_6 = b2_5; // b2[x+1,y+1] = b2[x,y+1]
+ b2_2 = b2Ptr[0]; // b2[x, y ]
+ b2_3 = b2_2; // b2[x+1,y ] = b2[x,y]
+ b2_5 = b2Ptr[_pitch]; // b2[x ,y+1]
+ b2_6 = b2_5; // b2[x+1,y+1] = b2[x,y+1]
}
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_2 = b3Ptr[back_pitch]; // b3[x ,y-1]
+ b3_3 = b3_2; // b3[x+1,y-1] = b3[x ,y-1]
+ b3_5 = b3Ptr[0]; // b3[x ,y ]
+ b3_6 = b3_5; // b3[x+1,y ] = b3[x ,y ]
+ b3_8 = b3_2 - b3_5 * 6 + b3Ptr[_pitch];
b3_9 = b3_8;
}
for (x = 0, indx = 0; x < _plane->_width; x += 2, indx++) {
if (x + 2 >= _plane->_width) {
- b0_ptr--;
- b1_ptr--;
- b2_ptr--;
- b3_ptr--;
+ b0Ptr--;
+ b1Ptr--;
+ b2Ptr--;
+ b3Ptr--;
}
// some values calculated in the previous iterations can
@@ -831,8 +835,8 @@ void IndeoDecoderBase::ff_ivi_recompose53(const IVIPlaneDesc *_plane,
if (_numBands > 0) {
tmp0 = b0_1;
tmp2 = b0_2;
- b0_1 = b0_ptr[indx + 1];
- b0_2 = b0_ptr[_pitch + indx + 1];
+ b0_1 = b0Ptr[indx + 1];
+ b0_2 = b0Ptr[_pitch + indx + 1];
tmp1 = tmp0 + b0_1;
p0 = tmp0 << 4;
@@ -845,11 +849,11 @@ void IndeoDecoderBase::ff_ivi_recompose53(const IVIPlaneDesc *_plane,
if (_numBands > 1) {
tmp0 = b1_2;
tmp1 = b1_1;
- b1_2 = b1_ptr[indx + 1];
- b1_1 = b1_ptr[back_pitch + indx + 1];
+ b1_2 = b1Ptr[indx + 1];
+ b1_1 = b1Ptr[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 + b1Ptr[_pitch + indx + 1];
p0 += (tmp0 + tmp1) << 3;
p1 += (tmp0 + tmp1 + b1_1 + b1_2) << 2;
@@ -859,8 +863,8 @@ void IndeoDecoderBase::ff_ivi_recompose53(const IVIPlaneDesc *_plane,
// process the LH-band by applying LPF vertically and HPF horizontally
if (_numBands > 2) {
- b2_3 = b2_ptr[indx + 1];
- b2_6 = b2_ptr[_pitch + indx + 1];
+ b2_3 = b2Ptr[indx + 1];
+ b2_6 = b2Ptr[_pitch + indx + 1];
tmp0 = b2_1 + b2_2;
tmp1 = b2_1 - b2_2 * 6 + b2_3;
@@ -873,14 +877,14 @@ void IndeoDecoderBase::ff_ivi_recompose53(const IVIPlaneDesc *_plane,
// process the HH-band by applying HPF both vertically and horizontally
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]
+ b3_6 = b3Ptr[indx + 1]; // b3[x+1,y ]
+ b3_3 = b3Ptr[back_pitch + indx + 1]; // b3[x+1,y-1]
tmp0 = b3_1 + b3_4;
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 + b3Ptr[_pitch + indx + 1];
p0 += (tmp0 + tmp1) << 2;
p1 += (tmp0 - tmp1 * 6 + tmp2) << 1;
@@ -891,25 +895,25 @@ void IndeoDecoderBase::ff_ivi_recompose53(const IVIPlaneDesc *_plane,
// output four pixels
dst[x] = av_clip_uint8((p0 >> 6) + 128);
dst[x + 1] = av_clip_uint8((p1 >> 6) + 128);
- dst[dst_pitch + x] = av_clip_uint8((p2 >> 6) + 128);
- dst[dst_pitch + x + 1] = av_clip_uint8((p3 >> 6) + 128);
+ dst[dstPitch + x] = av_clip_uint8((p2 >> 6) + 128);
+ dst[dstPitch + x + 1] = av_clip_uint8((p3 >> 6) + 128);
}// for x
- dst += dst_pitch << 1;
+ dst += dstPitch << 1;
back_pitch = -_pitch;
- b0_ptr += _pitch + 1;
- b1_ptr += _pitch + 1;
- b2_ptr += _pitch + 1;
- b3_ptr += _pitch + 1;
+ b0Ptr += _pitch + 1;
+ b1Ptr += _pitch + 1;
+ b2Ptr += _pitch + 1;
+ b3Ptr += _pitch + 1;
}
}
-void IndeoDecoderBase::ivi_output_plane(IVIPlaneDesc *_plane, uint8 *dst, int dst_pitch) {
+void IndeoDecoderBase::outputPlane(IVIPlaneDesc *_plane, uint8 *dst, int dstPitch) {
int x, y;
const int16 * src = _plane->_bands[0]._buf;
- uint32 _pitch = _plane->_bands[0]._pitch;
+ uint32 pitch = _plane->_bands[0]._pitch;
if (!src)
return;
@@ -917,40 +921,40 @@ void IndeoDecoderBase::ivi_output_plane(IVIPlaneDesc *_plane, uint8 *dst, int ds
for (y = 0; y < _plane->_height; y++) {
for (x = 0; x < _plane->_width; x++)
dst[x] = av_clip_uint8(src[x] + 128);
- src += _pitch;
- dst += dst_pitch;
+ src += pitch;
+ dst += dstPitch;
}
}
-int IndeoDecoderBase::ivi_process_empty_tile(IVIBandDesc *band,
- IVITile *tile, int32 mv_scale) {
- int x, y, need_mc, mbn, blk, num_blocks, _mvX, _mvY, mc_type;
- int offs, mb_offset, row_offset, ret;
- IVIMbInfo *mb, *ref_mb;
+int IndeoDecoderBase::processEmptyTile(IVIBandDesc *band,
+ IVITile *tile, int32 mvScale) {
+ int x, y, needMc, mbn, blk, numBlocks, mvX, mvY, mcType;
+ int offs, mbOffset, rowOffset, ret;
+ IVIMbInfo *mb, *refMb;
const int16 * src;
int16 * dst;
- IviMCFunc mc_no_delta_func;
+ IviMCFunc mcNoDeltaFunc;
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()",
+ "parameters %d in processEmptyTile()",
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->_refMbs;
- row_offset = band->_mbSize * band->_pitch;
- need_mc = 0; // reset the mc tracking flag
+ refMb = tile->_refMbs;
+ rowOffset = band->_mbSize * band->_pitch;
+ needMc = 0; // reset the mc tracking flag
for (y = tile->_yPos; y < (tile->_yPos + tile->_height); y += band->_mbSize) {
- mb_offset = offs;
+ mbOffset = offs;
for (x = tile->_xPos; x < (tile->_xPos + tile->_width); x += band->_mbSize) {
mb->_xPos = x;
mb->_yPos = y;
- mb->_bufOffs = mb_offset;
+ mb->_bufOffs = mbOffset;
mb->_type = 1; // set the macroblocks _type = INTER
mb->_cbp = 0; // all blocks are empty
@@ -961,19 +965,19 @@ int IndeoDecoderBase::ivi_process_empty_tile(IVIBandDesc *band,
mb->_mvY = 0;
}
- if (band->_inheritQDelta && ref_mb)
- mb->_qDelta = ref_mb->_qDelta;
+ if (band->_inheritQDelta && refMb)
+ mb->_qDelta = refMb->_qDelta;
- if (band->_inheritMv && ref_mb) {
+ if (band->_inheritMv && refMb) {
// motion vector inheritance
- if (mv_scale) {
- mb->_mvX = ivi_scale_mv(ref_mb->_mvX, mv_scale);
- mb->_mvY = ivi_scale_mv(ref_mb->_mvY, mv_scale);
+ if (mvScale) {
+ mb->_mvX = scaleMV(refMb->_mvX, mvScale);
+ mb->_mvY = scaleMV(refMb->_mvY, mvScale);
} else {
- mb->_mvX = ref_mb->_mvX;
- mb->_mvY = ref_mb->_mvY;
+ mb->_mvX = refMb->_mvX;
+ mb->_mvY = refMb->_mvY;
}
- need_mc |= mb->_mvX || mb->_mvY; // tracking non-zero motion vectors
+ needMc |= mb->_mvX || mb->_mvY; // tracking non-zero motion vectors
{
int dmv_x, dmv_y, cx, cy;
@@ -993,34 +997,34 @@ int IndeoDecoderBase::ivi_process_empty_tile(IVIBandDesc *band,
}
mb++;
- if (ref_mb)
- ref_mb++;
- mb_offset += band->_mbSize;
+ if (refMb)
+ refMb++;
+ mbOffset += band->_mbSize;
} // for x
- offs += row_offset;
+ offs += rowOffset;
} // for y
- 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
+ if (band->_inheritMv && needMc) { // apply motion compensation if there is at least one non-zero motion vector
+ numBlocks = (band->_mbSize != band->_blkSize) ? 4 : 1; // number of blocks per mb
+ mcNoDeltaFunc = (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->_numMBs; mb++, mbn++) {
- _mvX = mb->_mvX;
- _mvY = mb->_mvY;
+ mvX = mb->_mvX;
+ mvY = mb->_mvY;
if (!band->_isHalfpel) {
- mc_type = 0; // we have only fullpel vectors
+ mcType = 0; // we have only fullpel vectors
} else {
- mc_type = ((_mvY & 1) << 1) | (_mvX & 1);
- _mvX >>= 1;
- _mvY >>= 1; // convert halfpel vectors into fullpel ones
+ mcType = ((mvY & 1) << 1) | (mvX & 1);
+ mvX >>= 1;
+ mvY >>= 1; // convert halfpel vectors into fullpel ones
}
- for (blk = 0; blk < num_blocks; blk++) {
+ for (blk = 0; blk < numBlocks; blk++) {
// adjust block position in the buffer according with its number
offs = mb->_bufOffs + band->_blkSize * ((blk & 1) + !!(blk & 2) * band->_pitch);
- ret = ivi_mc(band, mc_no_delta_func, nullptr, offs,
- _mvX, _mvY, 0, 0, mc_type, -1);
+ ret = iviMc(band, mcNoDeltaFunc, nullptr, offs,
+ mvX, mvY, 0, 0, mcType, -1);
if (ret < 0)
return ret;
}
@@ -1039,53 +1043,53 @@ int IndeoDecoderBase::ivi_process_empty_tile(IVIBandDesc *band,
return 0;
}
-int IndeoDecoderBase::ivi_dec_tile_data_size(GetBits *_gb) {
+int IndeoDecoderBase::decodeTileDataSize(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, _blkSize, ret, is_intra;
- int mc_type = 0, mc_type2 = -1;
- int _mvX = 0, _mvY = 0, mv_x2 = 0, mv_y2 = 0;
- int32 prev_dc;
- uint32 _cbp, quant, _bufOffs;
+int IndeoDecoderBase::decodeBlocks(GetBits *_gb, IVIBandDesc *band, IVITile *tile) {
+ int mbn, blk, numBlocks, blkSize, ret, isIntra;
+ int mcType = 0, mcType2 = -1;
+ int mvX = 0, mvY = 0, mvX2 = 0, mvY2 = 0;
+ int32 prevDc;
+ uint32 cbp, quant, bufOffs;
IVIMbInfo *mb;
- IviMCFunc mc_with_delta_func, mc_no_delta_func;
- IviMCAvgFunc mc_avg_with_delta_func, mc_avg_no_delta_func;
- const uint8 *scale_tab;
+ IviMCFunc mcWithDeltaFunc, mcNoDeltaFunc;
+ IviMCAvgFunc mcAvgWithDeltaFunc, mcAvgNoDeltaFunc;
+ const uint8 *scaleTab;
// init intra prediction for the DC coefficient
- prev_dc = 0;
- _blkSize = band->_blkSize;
+ prevDc = 0;
+ blkSize = band->_blkSize;
// number of blocks per mb
- 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;
- mc_avg_no_delta_func = IndeoDSP::ff_ivi_mc_avg_8x8_no_delta;
+ numBlocks = (band->_mbSize != blkSize) ? 4 : 1;
+ if (blkSize == 8) {
+ mcWithDeltaFunc = IndeoDSP::ff_ivi_mc_8x8_delta;
+ mcNoDeltaFunc = IndeoDSP::ff_ivi_mc_8x8_no_delta;
+ mcAvgWithDeltaFunc = IndeoDSP::ff_ivi_mc_avg_8x8_delta;
+ mcAvgNoDeltaFunc = IndeoDSP::ff_ivi_mc_avg_8x8_no_delta;
} else {
- mc_with_delta_func = IndeoDSP::ff_ivi_mc_4x4_delta;
- mc_no_delta_func = IndeoDSP::ff_ivi_mc_4x4_no_delta;
- mc_avg_with_delta_func = IndeoDSP::ff_ivi_mc_avg_4x4_delta;
- mc_avg_no_delta_func = IndeoDSP::ff_ivi_mc_avg_4x4_no_delta;
+ mcWithDeltaFunc = IndeoDSP::ff_ivi_mc_4x4_delta;
+ mcNoDeltaFunc = IndeoDSP::ff_ivi_mc_4x4_no_delta;
+ mcAvgWithDeltaFunc = IndeoDSP::ff_ivi_mc_avg_4x4_delta;
+ mcAvgNoDeltaFunc = IndeoDSP::ff_ivi_mc_avg_4x4_no_delta;
}
for (mbn = 0, mb = tile->_mbs; mbn < tile->_numMBs; mb++, mbn++) {
- is_intra = !mb->_type;
- _cbp = mb->_cbp;
- _bufOffs = mb->_bufOffs;
+ isIntra = !mb->_type;
+ cbp = mb->_cbp;
+ bufOffs = mb->_bufOffs;
quant = band->_globQuant + mb->_qDelta;
if (_ctx._isIndeo4)
@@ -1093,27 +1097,27 @@ int IndeoDecoderBase::ivi_decode_blocks(GetBits *_gb, IVIBandDesc *band, IVITile
else
quant = av_clip((int)quant, 0, 23);
- scale_tab = is_intra ? band->_intraScale : band->_interScale;
- if (scale_tab)
- quant = scale_tab[quant];
+ scaleTab = isIntra ? band->_intraScale : band->_interScale;
+ if (scaleTab)
+ quant = scaleTab[quant];
- if (!is_intra) {
- _mvX = mb->_mvX;
- _mvY = mb->_mvY;
- mv_x2 = mb->_bMvX;
- mv_y2 = mb->_bMvY;
+ if (!isIntra) {
+ mvX = mb->_mvX;
+ mvY = mb->_mvY;
+ mvX2 = mb->_bMvX;
+ mvY2 = mb->_bMvY;
if (band->_isHalfpel) {
- mc_type = ((_mvY & 1) << 1) | (_mvX & 1);
- mc_type2 = ((mv_y2 & 1) << 1) | (mv_x2 & 1);
- _mvX >>= 1;
- _mvY >>= 1;
- mv_x2 >>= 1;
- mv_y2 >>= 1; // convert halfpel vectors into fullpel ones
+ mcType = ((mvY & 1) << 1) | (mvX & 1);
+ mcType2 = ((mvY2 & 1) << 1) | (mvX2 & 1);
+ mvX >>= 1;
+ mvY >>= 1;
+ mvX2 >>= 1;
+ mvY2 >>= 1; // convert halfpel vectors into fullpel ones
}
if (mb->_type == 2)
- mc_type = -1;
+ mcType = -1;
if (mb->_type != 2 && mb->_type != 3)
- mc_type2 = -1;
+ mcType2 = -1;
if (mb->_type) {
int dmv_x, dmv_y, cx, cy;
@@ -1146,42 +1150,42 @@ int IndeoDecoderBase::ivi_decode_blocks(GetBits *_gb, IVIBandDesc *band, IVITile
}
}
- for (blk = 0; blk < num_blocks; blk++) {
+ for (blk = 0; blk < numBlocks; blk++) {
// adjust block position in the buffer according to its number
if (blk & 1) {
- _bufOffs += _blkSize;
+ bufOffs += blkSize;
} else if (blk == 2) {
- _bufOffs -= _blkSize;
- _bufOffs += _blkSize * band->_pitch;
+ bufOffs -= blkSize;
+ bufOffs += blkSize * band->_pitch;
}
- if (_cbp & 1) { // block coded ?
- ret = ivi_decode_coded_blocks(_gb, band, mc_with_delta_func,
- mc_avg_with_delta_func,
- _mvX, _mvY, mv_x2, mv_y2,
- &prev_dc, is_intra,
- mc_type, mc_type2, quant,
- _bufOffs);
+ if (cbp & 1) { // block coded ?
+ ret = ivi_decode_coded_blocks(_gb, band, mcWithDeltaFunc,
+ mcAvgWithDeltaFunc,
+ mvX, mvY, mvX2, mvY2,
+ &prevDc, isIntra,
+ mcType, mcType2, quant,
+ bufOffs);
if (ret < 0)
return ret;
} else {
// block not coded
// 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, _bufOffs, _blkSize);
+ if (isIntra) {
+ ret = ivi_dc_transform(band, &prevDc, bufOffs, blkSize);
if (ret < 0)
return ret;
} else {
- ret = ivi_mc(band, mc_no_delta_func, mc_avg_no_delta_func,
- _bufOffs, _mvX, _mvY, mv_x2, mv_y2,
- mc_type, mc_type2);
+ ret = iviMc(band, mcNoDeltaFunc, mcAvgNoDeltaFunc,
+ bufOffs, mvX, mvY, mvX2, mvY2,
+ mcType, mcType2);
if (ret < 0)
return ret;
}
}
- _cbp >>= 1;
+ cbp >>= 1;
}// for blk
}// for mbn
@@ -1189,66 +1193,66 @@ int IndeoDecoderBase::ivi_decode_blocks(GetBits *_gb, IVIBandDesc *band, IVITile
return 0;
}
-int IndeoDecoderBase::ivi_scale_mv(int mv, int mv_scale){
- return (mv + (mv > 0) + (mv_scale - 1)) >> mv_scale;
+int IndeoDecoderBase::scaleMV(int mv, int mvScale) {
+ return (mv + (mv > 0) + (mvScale - 1)) >> mvScale;
}
-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 + _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->_refBuf);
- assert(buf_size - min_size >= offs);
- assert(buf_size - min_size - ref_size >= ref_offs);
+int IndeoDecoderBase::iviMc(IVIBandDesc *band, IviMCFunc mc, IviMCAvgFunc mcAvg,
+ int offs, int mvX, int mvY, int mvX2, int mvY2,
+ int mcType, int mcType2) {
+ int refOffs = offs + mvY * band->_pitch + mvX;
+ int bufSize = band->_pitch * band->_aHeight;
+ int minSize = band->_pitch * (band->_blkSize - 1) + band->_blkSize;
+ int refSize = (mcType > 1) * band->_pitch + (mcType & 1);
+
+ if (mcType != -1) {
+ assert(offs >= 0 && refOffs >= 0 && band->_refBuf);
+ assert(bufSize - minSize >= offs);
+ assert(bufSize - minSize - refSize >= refOffs);
}
- if (mc_type2 == -1) {
- mc(band->_buf + offs, band->_refBuf + ref_offs, band->_pitch, mc_type);
+ if (mcType2 == -1) {
+ mc(band->_buf + offs, band->_refBuf + refOffs, band->_pitch, mcType);
} else {
- int ref_offs2 = offs + mv_y2 * band->_pitch + mv_x2;
- int ref_size2 = (mc_type2 > 1) * band->_pitch + (mc_type2 & 1);
+ int ref_offs2 = offs + mvY2 * band->_pitch + mvX2;
+ int ref_size2 = (mcType2 > 1) * band->_pitch + (mcType2 & 1);
if (offs < 0 || ref_offs2 < 0 || !band->_bRefBuf)
return -1;
- if (buf_size - min_size - ref_size2 < ref_offs2)
+ if (bufSize - minSize - ref_size2 < ref_offs2)
return -1;
- if (mc_type == -1)
+ if (mcType == -1)
mc(band->_buf + offs, band->_bRefBuf + ref_offs2,
- band->_pitch, mc_type2);
+ band->_pitch, mcType2);
else
- mc_avg(band->_buf + offs, band->_refBuf + ref_offs,
+ mcAvg(band->_buf + offs, band->_refBuf + refOffs,
band->_bRefBuf + ref_offs2, band->_pitch,
- mc_type, mc_type2);
+ mcType, mcType2);
}
return 0;
}
-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->_intraBase : band->_interBase;
+int IndeoDecoderBase::ivi_decode_coded_blocks(GetBits *gb, IVIBandDesc *band,
+ IviMCFunc mc, IviMCAvgFunc mcAvg, int mvX, int mvY,
+ int mvX2, int mvY2, int *prevDc, int isIntra,
+ int mcType, int mcType2, uint32 quant, int offs) {
+ const uint16 *base_tab = isIntra ? band->_intraBase : band->_interBase;
RVMapDesc *rvmap = band->_rvMap;
- uint8 col_flags[8];
+ uint8 colFlags[8];
int32 trvec[64];
uint32 sym = 0, q;
int lo, hi;
int pos, run, val;
- int _blkSize = band->_blkSize;
- int num_coeffs = _blkSize * _blkSize;
- int col_mask = _blkSize - 1;
- int scan_pos = -1;
- int min_size = band->_pitch * (band->_transformSize - 1) +
+ int blkSize = band->_blkSize;
+ int numCoeffs = blkSize * blkSize;
+ int colMask = blkSize - 1;
+ int scanPos = -1;
+ int minSize = band->_pitch * (band->_transformSize - 1) +
band->_transformSize;
- int buf_size = band->_pitch * band->_aHeight - offs;
+ int bufSize = band->_pitch * band->_aHeight - offs;
- if (min_size > buf_size)
+ if (minSize > bufSize)
return -1;
if (!band->_scan) {
@@ -1257,20 +1261,20 @@ int IndeoDecoderBase::ivi_decode_coded_blocks(GetBits *_gb, IVIBandDesc *band,
}
// zero transform vector
- memset(trvec, 0, num_coeffs * sizeof(trvec[0]));
+ memset(trvec, 0, numCoeffs * sizeof(trvec[0]));
// zero column flags
- memset(col_flags, 0, sizeof(col_flags));
- while (scan_pos <= num_coeffs) {
- sym = _gb->getVLC2(band->_blkVlc._tab->_table,
+ memset(colFlags, 0, sizeof(colFlags));
+ while (scanPos <= numCoeffs) {
+ sym = gb->getVLC2(band->_blkVlc._tab->_table,
IVI_VLC_BITS, 1);
if (sym == rvmap->_eobSym)
break; // End of block
- // Escape - run/val explicitly coded using 3 vlc codes
+ // Escape - run/val explicitly coded using 3 vlc codes
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);
+ 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 {
@@ -1283,10 +1287,10 @@ int IndeoDecoderBase::ivi_decode_coded_blocks(GetBits *_gb, IVIBandDesc *band,
}
// de-zigzag and dequantize
- scan_pos += run;
- if (scan_pos >= num_coeffs || scan_pos < 0)
+ scanPos += run;
+ if (scanPos >= numCoeffs || scanPos < 0)
break;
- pos = band->_scan[scan_pos];
+ pos = band->_scan[scanPos];
if (!val)
warning("Val = 0 encountered!");
@@ -1296,17 +1300,17 @@ int IndeoDecoderBase::ivi_decode_coded_blocks(GetBits *_gb, IVIBandDesc *band,
val = val * q + FFSIGN(val) * (((q ^ 1) - 1) >> 1);
trvec[pos] = val;
// track columns containing non-zero coeffs
- col_flags[pos & col_mask] |= !!val;
+ colFlags[pos & colMask] |= !!val;
}
- if (scan_pos < 0 || (scan_pos >= num_coeffs && sym != rvmap->_eobSym))
+ if (scanPos < 0 || (scanPos >= numCoeffs && sym != rvmap->_eobSym))
return -1; // corrupt block data
// undoing DC coeff prediction for intra-blocks
- if (is_intra && band->_is2dTrans) {
- *prev_dc += trvec[0];
- trvec[0] = *prev_dc;
- col_flags[0] |= !!*prev_dc;
+ if (isIntra && band->_is2dTrans) {
+ *prevDc += trvec[0];
+ trvec[0] = *prevDc;
+ colFlags[0] |= !!*prevDc;
}
if (band->_transformSize > band->_blkSize) {
@@ -1316,25 +1320,25 @@ int IndeoDecoderBase::ivi_decode_coded_blocks(GetBits *_gb, IVIBandDesc *band,
// apply inverse transform
band->_invTransform(trvec, band->_buf + offs,
- band->_pitch, col_flags);
+ band->_pitch, colFlags);
// apply motion compensation
- if (!is_intra)
- return ivi_mc(band, mc, mc_avg, offs, _mvX, _mvY, mv_x2, mv_y2,
- mc_type, mc_type2);
+ if (!isIntra)
+ return iviMc(band, mc, mcAvg, offs, mvX, mvY, mvX2, mvY2,
+ mcType, mcType2);
return 0;
}
-int IndeoDecoderBase::ivi_dc_transform(IVIBandDesc *band, int *prev_dc,
+int IndeoDecoderBase::ivi_dc_transform(IVIBandDesc *band, int *prevDc,
int bufOffs, int blkSize) {
- int buf_size = band->_pitch * band->_aHeight - bufOffs;
- int min_size = (blkSize - 1) * band->_pitch + blkSize;
+ int bufSize = band->_pitch * band->_aHeight - bufOffs;
+ int minSize = (blkSize - 1) * band->_pitch + blkSize;
- if (min_size > buf_size)
+ if (minSize > bufSize)
return -1;
- band->_dcTransform(prev_dc, band->_buf + bufOffs,
+ band->_dcTransform(prevDc, band->_buf + bufOffs,
band->_pitch, blkSize);
return 0;
@@ -1342,15 +1346,6 @@ int IndeoDecoderBase::ivi_dc_transform(IVIBandDesc *band, int *prev_dc,
/*------------------------------------------------------------------------*/
-int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx) {
- if (((w + 128) * (uint64)(h + 128)) < (MAX_INTEGER / 8))
- return 0;
-
- error("Picture size %ux%u is invalid", w, h);
-}
-
-/*------------------------------------------------------------------------*/
-
const uint8 IndeoDecoderBase::_ff_ivi_vertical_scan_8x8[64] = {
0, 8, 16, 24, 32, 40, 48, 56,
1, 9, 17, 25, 33, 41, 49, 57,
diff --git a/image/codecs/indeo/indeo.h b/image/codecs/indeo/indeo.h
index b9e46931b0..5f6d67f34f 100644
--- a/image/codecs/indeo/indeo.h
+++ b/image/codecs/indeo/indeo.h
@@ -66,7 +66,7 @@ enum {
typedef void (InvTransformPtr)(const int32 *in, int16 *out, uint32 pitch, const uint8 *flags);
typedef void (DCTransformPtr) (const int32 *in, int16 *out, uint32 pitch, int blkSize);
-typedef void(*IviMCFunc) (int16 *buf, const int16 *refBuf, uint32 pitch, int mc_type);
+typedef void(*IviMCFunc) (int16 *buf, const int16 *refBuf, uint32 pitch, int mcType);
typedef void(*IviMCAvgFunc) (int16 *buf, const int16 *refBuf1, const int16 *refBuf2,
uint32 pitch, int mcType, int mcType2);
@@ -82,8 +82,8 @@ typedef void(*IviMCAvgFunc) (int16 *buf, const int16 *refBuf1, const int16 *refB
/**
* calculate number of macroblocks in a tile
*/
-#define IVI_MBs_PER_TILE(_tileWidth, _tileHeight, _mbSize) \
- ((((_tileWidth) + (_mbSize) - 1) / (_mbSize)) * (((_tileHeight) + (_mbSize) - 1) / (_mbSize)))
+#define IVI_MBs_PER_TILE(tileWidth, tileHeight, mbSize) \
+ ((((tileWidth) + (mbSize) - 1) / (mbSize)) * (((tileHeight) + (mbSize) - 1) / (mbSize)))
/**
* huffman codebook descriptor
@@ -96,32 +96,32 @@ struct IVIHuffDesc {
* Generate a huffman codebook from the given descriptor
* and convert it into the FFmpeg VLC table.
*
- * @param[out] vlc where to place the generated VLC table
- * @param[in] flag flag: 1 - for static or 0 for dynamic tables
- * @return result code: 0 - OK, -1 = error (invalid codebook descriptor)
+ * @param[out] vlc Where to place the generated VLC table
+ * @param[in] flag Flag: true - for static or false for dynamic tables
+ * @returns result code: 0 - OK, -1 = error (invalid codebook descriptor)
*/
- int ivi_create_huff_from_desc(VLC *vlc, int flag) const;
+ int createHuffFromDesc(VLC *vlc, bool flag) const;
/*
* Compare two huffman codebook descriptors.
*
- * @param[in] desc2 ptr to the 2nd descriptor to compare
- * @return comparison result: 0 - equal, 1 - not equal
+ * @param[in] desc2 Ptr to the 2nd descriptor to compare
+ * @returns comparison result: 0 - equal, 1 - not equal
*/
- bool ivi_huff_desc_cmp(const IVIHuffDesc *desc2) const;
+ bool huffDescCompare(const IVIHuffDesc *desc2) const;
/*
* Copy huffman codebook descriptors.
*
- * @param[in] src ptr to the source descriptor
+ * @param[in] src ptr to the source descriptor
*/
- void ivi_huff_desc_copy(const IVIHuffDesc *src);
+ void huffDescCopy(const IVIHuffDesc *src);
};
struct IVI45DecContext;
/**
- * macroblock/block huffman table descriptor
+ * Macroblock/block huffman table descriptor
*/
struct IVIHuffTab {
public:
@@ -138,7 +138,16 @@ public:
*/
IVIHuffTab();
- int ff_ivi_dec_huff_desc(IVI45DecContext *ctx, int desc_coded, int which_tab);
+ /**
+ * Decode a huffman codebook descriptor from the bitstream
+ * and select specified huffman table.
+ *
+ * @param[in] ctx Decoder context
+ * @param[in] descCoded Flag signalling if table descriptor was coded
+ * @param[in] whichTab Codebook purpose (IVI_MB_HUFF or IVI_BLK_HUFF)
+ * @returns Zero on success, negative value otherwise
+ */
+ int decodeHuffDesc(IVI45DecContext *ctx, int descCoded, int whichTab);
};
/**
@@ -237,7 +246,7 @@ struct IVIBandDesc {
IVIBandDesc();
- int ivi_init_tiles(IVITile *ref_tile, int p, int b, int t_height, int t_width);
+ int initTiles(IVITile *refTile, int p, int b, int tHeight, int tWidth);
};
struct IVIPicConfig {
@@ -269,16 +278,27 @@ struct IVIPlaneDesc {
IVIPlaneDesc();
- static int ff_ivi_init_planes(IVIPlaneDesc *planes, const IVIPicConfig *cfg, bool _isIndeo4);
+ static int initPlanes(IVIPlaneDesc *planes, const IVIPicConfig *cfg, bool isIndeo4);
- static int ff_ivi_init_tiles(IVIPlaneDesc *planes, int _tileWidth, int _tileHeight);
+ static int initTiles(IVIPlaneDesc *planes, int tileWidth, int tileHeight);
/*
* Free planes, bands and macroblocks buffers.
*
* @param[in] planes pointer to the array of the plane descriptors
*/
- static void ivi_free_buffers(IVIPlaneDesc *planes);
+ static void freeBuffers(IVIPlaneDesc *planes);
+
+ /**
+ * Check if the given dimension of an image is valid, meaning that all
+ * bytes of the image can be addressed with a signed int.
+ *
+ * @param w the width of the picture
+ * @param h the height of the picture
+ * @param log_offset the offset to sum to the log level for logging with log_ctx
+ * @returns >= 0 if valid, a negative error code otherwise
+ */
+ static int checkImageSize(unsigned int w, unsigned int h, int logOffset);
};
struct AVFrame {
@@ -327,22 +347,22 @@ struct AVFrame {
/**
* Destructor
*/
- ~AVFrame() { av_frame_free(); }
+ ~AVFrame() { freeFrame(); }
/**
* Sets the frame dimensions
*/
- int ff_set_dimensions(uint16 width, uint16 height);
+ int setDimensions(uint16 width, uint16 height);
/**
* Get a buffer for a frame
*/
- int ff_get_buffer(int flags);
+ int getBuffer(int flags);
/**
* Frees any data loaded for the frame
*/
- void av_frame_free();
+ void freeFrame();
};
struct IVI45DecContext {
@@ -424,43 +444,41 @@ private:
/**
* Haar wavelet recomposition filter for Indeo 4
*
- * @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] plane Pointer to the descriptor of the plane being processed
+ * @param[out] dst pointer to the destination buffer
+ * @param[in] dstPitch Pitch of the destination buffer
*/
- void ff_ivi_recompose_haar(const IVIPlaneDesc *plane, uint8 *dst,
- const int dst_pitch);
+ void recomposeHaar(const IVIPlaneDesc *plane, uint8 *dst, const int dstPitch);
/**
* 5/3 wavelet recomposition filter for Indeo5
*
- * @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] plane Pointer to the descriptor of the plane being processed
+ * @param[out] dst Pointer to the destination buffer
+ * @param[in] dstPitch Pitch of the destination buffer
*/
- void ff_ivi_recompose53(const IVIPlaneDesc *plane,
- uint8 *dst, const int dst_pitch);
+ void recompose53(const IVIPlaneDesc *plane, uint8 *dst, const int dstPitch);
/*
* Convert and output the current plane.
* This conversion is done by adding back the bias value of 128
* (subtracted in the encoder) and clipping the result.
*
- * @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] plane Pointer to the descriptor of the plane being processed
+ * @param[out] dst Pointer to the buffer receiving converted pixels
+ * @param[in] dstPitch Pitch for moving to the next y line
*/
- void ivi_output_plane(IVIPlaneDesc *plane, uint8 *dst, int dst_pitch);
+ void outputPlane(IVIPlaneDesc *plane, uint8 *dst, int dstPitch);
/**
* Handle empty tiles by performing data copying and motion
* compensation respectively.
*
- * @param[in] band pointer to the band descriptor
- * @param[in] tile pointer to the tile descriptor
- * @param[in] mv_scale scaling factor for motion vectors
+ * @param[in] band Pointer to the band descriptor
+ * @param[in] tile Pointer to the tile descriptor
+ * @param[in] mvScale Scaling factor for motion vectors
*/
- int ivi_process_empty_tile(IVIBandDesc *band, IVITile *tile, int32 mv_scale);
+ int processEmptyTile(IVIBandDesc *band, IVITile *tile, int32 mvScale);
/*
* Decode size of the tile data.
@@ -470,9 +488,9 @@ private:
* where X1-X3 is size of the tile data
*
* @param[in,out] gb the GetBit context
- * @return size of the tile data in bytes
+ * @returns Size of the tile data in bytes
*/
- int ivi_dec_tile_data_size(GetBits *gb);
+ int decodeTileDataSize(GetBits *gb);
/*
* Decode block data:
@@ -480,21 +498,20 @@ private:
* dequantize them, apply inverse transform and motion compensation
* in order to reconstruct the picture.
*
- * @param[in,out] gb the GetBit context
- * @param[in] band pointer to the band descriptor
- * @param[in] tile pointer to the tile descriptor
- * @return result code: 0 - OK, -1 = error (corrupted blocks data)
+ * @param[in,out] gb The GetBit context
+ * @param[in] band Pointer to the band descriptor
+ * @param[in] tile Pointer to the tile descriptor
+ * @returns Result code: 0 - OK, -1 = error (corrupted blocks data)
*/
- int ivi_decode_blocks(GetBits *gb, IVIBandDesc *band, IVITile *tile);
+ int decodeBlocks(GetBits *gb, IVIBandDesc *band, IVITile *tile);
- 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 iviMc(IVIBandDesc *band, IviMCFunc mc, IviMCAvgFunc mcAvg,
+ int offs, int mvX, int mvY, int mvX2, int mvY2, int mcType, int mcType2);
int 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);
+ IviMCFunc mc, IviMCAvgFunc mcAvg, int mvX, int mvY,
+ int mvX2, int mvY2, int *prevDc, int isIntra,
+ int mcType, int mcType2, uint32 quant, int offs);
int ivi_dc_transform(IVIBandDesc *band, int *prevDc, int bufOffs,
int blkSize);
@@ -524,27 +541,27 @@ protected:
/**
* Rearrange decoding and reference buffers.
*/
- virtual void switch_buffers() = 0;
+ virtual void switchBuffers() = 0;
- virtual bool is_nonnull_frame() const = 0;
+ virtual bool isNonNullFrame() const = 0;
/**
* Decode Indeo band header.
*
- * @param[in,out] band pointer to the band descriptor
- * @return result code: 0 = OK, negative number = error
+ * @param[in,out] band Pointer to the band descriptor
+ * @returns Result code: 0 = OK, negative number = error
*/
- virtual int decode_band_hdr(IVIBandDesc *band) = 0;
+ virtual int decodeBandHeader(IVIBandDesc *band) = 0;
/**
* 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
- * @param[in,out] tile pointer to the tile descriptor
- * @return result code: 0 = OK, negative number = error
+ * @param[in,out] band Pointer to the band descriptor
+ * @param[in,out] tile Pointer to the tile descriptor
+ * @returns Result code: 0 = OK, negative number = error
*/
- virtual int decode_mb_info(IVIBandDesc *band, IVITile *tile)= 0;
+ virtual int decodeMbInfo(IVIBandDesc *band, IVITile *tile) = 0;
/**
* Decodes the Indeo frame from the bit reader already
@@ -555,25 +572,12 @@ protected:
/**
* scale motion vector
*/
- int ivi_scale_mv(int mv, int mv_scale);
+ int scaleMV(int mv, int mvScale);
public:
IndeoDecoderBase(uint16 width, uint16 height);
virtual ~IndeoDecoderBase();
};
-/*------------------------------------------------------------------------*/
-
-/**
- * Check if the given dimension of an image is valid, meaning that all
- * bytes of the image can be addressed with a signed int.
- *
- * @param w the width of the picture
- * @param h the height of the picture
- * @param log_offset the offset to sum to the log level for logging with log_ctx
- * @returns >= 0 if valid, a negative error code otherwise
- */
-extern int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx);
-
} // End of namespace Indeo
} // End of namespace Image
diff --git a/image/codecs/indeo4.cpp b/image/codecs/indeo4.cpp
index 12ab988bda..caefab2eab 100644
--- a/image/codecs/indeo4.cpp
+++ b/image/codecs/indeo4.cpp
@@ -175,7 +175,7 @@ int Indeo4Decoder::decodePictureHeader() {
// check if picture layout was changed and reallocate buffers
if (_picConf.ivi_pic_config_cmp(_ctx._picConf)) {
- if (IVIPlaneDesc::ff_ivi_init_planes(_ctx._planes, &_picConf, 1)) {
+ if (IVIPlaneDesc::initPlanes(_ctx._planes, &_picConf, 1)) {
warning("Couldn't reallocate color planes!");
_ctx._picConf._lumaBands = 0;
return -2;
@@ -191,7 +191,7 @@ int Indeo4Decoder::decodePictureHeader() {
}
}
- if (IVIPlaneDesc::ff_ivi_init_tiles(_ctx._planes, _ctx._picConf._tileWidth,
+ if (IVIPlaneDesc::initTiles(_ctx._planes, _ctx._picConf._tileWidth,
_ctx._picConf._tileHeight)) {
warning("Couldn't reallocate internal structures!");
return -2;
@@ -205,8 +205,8 @@ int Indeo4Decoder::decodePictureHeader() {
_ctx._gb->skipBits(8);
// decode macroblock and block huffman codebooks
- 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))
+ if (_ctx._mbVlc.decodeHuffDesc(&_ctx, _ctx._gb->getBits1(), IVI_MB_HUFF) ||
+ _ctx._blkVlc.decodeHuffDesc(&_ctx, _ctx._gb->getBits1(), IVI_BLK_HUFF))
return -1;
_ctx._rvmapSel = _ctx._gb->getBits1() ? _ctx._gb->getBits(3) : 8;
@@ -235,7 +235,7 @@ int Indeo4Decoder::decodePictureHeader() {
return 0;
}
-void Indeo4Decoder::switch_buffers() {
+void Indeo4Decoder::switchBuffers() {
int is_prev_ref = 0, is_ref = 0;
switch (_ctx._prevFrameType) {
@@ -265,18 +265,18 @@ void Indeo4Decoder::switch_buffers() {
}
}
-bool Indeo4Decoder::is_nonnull_frame() const {
+bool Indeo4Decoder::isNonNullFrame() const {
return _ctx._frameType < IVI4_FRAMETYPE_NULL_FIRST;
}
-int Indeo4Decoder::decode_band_hdr(IVIBandDesc *band) {
- int plane, _bandNum, indx, transform_id, scan_indx;
+int Indeo4Decoder::decodeBandHeader(IVIBandDesc *band) {
+ int plane, bandNum, indx, transformId, scanIndx;
int i;
- int _quantMat;
+ int quantMat;
plane = _ctx._gb->getBits(2);
- _bandNum = _ctx._gb->getBits(4);
- if (band->_plane != plane || band->_bandNum != _bandNum) {
+ bandNum = _ctx._gb->getBits(4);
+ if (band->_plane != plane || band->_bandNum != bandNum) {
warning("Invalid band header sequence!");
return -1;
}
@@ -316,30 +316,30 @@ int Indeo4Decoder::decode_band_hdr(IVIBandDesc *band) {
band->_globQuant = _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]._invTrans) {
- warning("Transform %d", transform_id);
+ transformId = _ctx._gb->getBits(5);
+ if ((uint)transformId >= FF_ARRAY_ELEMS(_transforms) ||
+ !_transforms[transformId]._invTrans) {
+ warning("Transform %d", transformId);
return -3;
}
- if ((transform_id >= 7 && transform_id <= 9) ||
- transform_id == 17) {
+ if ((transformId >= 7 && transformId <= 9) ||
+ transformId == 17) {
warning("DCT transform");
return -3;
}
- if (transform_id < 10 && band->_blkSize < 8) {
+ if (transformId < 10 && band->_blkSize < 8) {
warning("wrong transform size!");
return -1;
}
- if ((transform_id >= 0 && transform_id <= 2) || transform_id == 10)
+ if ((transformId >= 0 && transformId <= 2) || transformId == 10)
_ctx._usesHaar = true;
- band->_invTransform = _transforms[transform_id]._invTrans;
- band->_dcTransform = _transforms[transform_id]._dcTrans;
- band->_is2dTrans = _transforms[transform_id]._is2dTrans;
+ band->_invTransform = _transforms[transformId]._invTrans;
+ band->_dcTransform = _transforms[transformId]._dcTrans;
+ band->_is2dTrans = _transforms[transformId]._is2dTrans;
- if (transform_id < 10)
+ if (transformId < 10)
band->_transformSize = 8;
else
band->_transformSize = 4;
@@ -349,12 +349,12 @@ int Indeo4Decoder::decode_band_hdr(IVIBandDesc *band) {
return -1;
}
- scan_indx = _ctx._gb->getBits(4);
- if (scan_indx == 15) {
+ scanIndx = _ctx._gb->getBits(4);
+ if (scanIndx == 15) {
warning("Custom scan pattern encountered!");
return -1;
}
- if (scan_indx > 4 && scan_indx < 10) {
+ if (scanIndx > 4 && scanIndx < 10) {
if (band->_blkSize != 4) {
warning("mismatching scan table!");
return -1;
@@ -364,19 +364,19 @@ int Indeo4Decoder::decode_band_hdr(IVIBandDesc *band) {
return -1;
}
- band->_scan = _scan_index_to_tab[scan_indx];
+ band->_scan = _scan_index_to_tab[scanIndx];
band->_scanSize = band->_blkSize;
- _quantMat = _ctx._gb->getBits(5);
- if (_quantMat == 31) {
+ quantMat = _ctx._gb->getBits(5);
+ if (quantMat == 31) {
warning("Custom quant matrix encountered!");
return -1;
}
- if ((uint)_quantMat >= FF_ARRAY_ELEMS(_quant_index_to_tab)) {
- warning("Quantization matrix %d", _quantMat);
+ if ((uint)quantMat >= FF_ARRAY_ELEMS(_quant_index_to_tab)) {
+ warning("Quantization matrix %d", quantMat);
return -1;
}
- band->_quantMat = _quantMat;
+ band->_quantMat = quantMat;
} else {
if (old_blk_size != band->_blkSize) {
warning("The band block size does not match the configuration inherited");
@@ -401,7 +401,7 @@ int Indeo4Decoder::decode_band_hdr(IVIBandDesc *band) {
if (!_ctx._gb->getBits1())
band->_blkVlc._tab = _ctx._blkVlc._tab;
else
- if (band->_blkVlc.ff_ivi_dec_huff_desc(&_ctx, 1, IVI_BLK_HUFF))
+ if (band->_blkVlc.decodeHuffDesc(&_ctx, 1, IVI_BLK_HUFF))
return -1;
// select appropriate rvmap table for this band
@@ -445,35 +445,35 @@ int Indeo4Decoder::decode_band_hdr(IVIBandDesc *band) {
return 0;
}
-int Indeo4Decoder::decode_mb_info(IVIBandDesc *band, IVITile *tile) {
- 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->_mbSize * band->_pitch;
+int Indeo4Decoder::decodeMbInfo(IVIBandDesc *band, IVITile *tile) {
+ int x, y, mvX, mvY, mvDelta, offs, mbOffset, blksPerMb,
+ mvScale, mbTypeBits, s;
+ IVIMbInfo *mb, *ref_mb;
+ int row_offset = band->_mbSize * band->_pitch;
mb = tile->_mbs;
ref_mb = tile->_refMbs;
offs = tile->_yPos * band->_pitch + tile->_xPos;
- blks_per_mb = band->_mbSize != band->_blkSize ? 4 : 1;
- mb_type_bits = _ctx._frameType == IVI4_FRAMETYPE_BIDIR ? 2 : 1;
+ blksPerMb = band->_mbSize != band->_blkSize ? 4 : 1;
+ mbTypeBits = _ctx._frameType == IVI4_FRAMETYPE_BIDIR ? 2 : 1;
/* scale factor for motion vectors */
- mv_scale = (_ctx._planes[0]._bands[0]._mbSize >> 3) - (band->_mbSize >> 3);
- _mvX = _mvY = 0;
+ mvScale = (_ctx._planes[0]._bands[0]._mbSize >> 3) - (band->_mbSize >> 3);
+ mvX = mvY = 0;
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);
+ 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->_mbSize) {
- mb_offset = offs;
+ mbOffset = offs;
for (x = tile->_xPos; x < tile->_xPos + tile->_width; x += band->_mbSize) {
mb->_xPos = x;
mb->_yPos = y;
- mb->_bufOffs = mb_offset;
+ mb->_bufOffs = mbOffset;
mb->_bMvX = mb->_bMvY = 0;
if (_ctx._gb->getBits1()) {
@@ -494,9 +494,9 @@ int Indeo4Decoder::decode_mb_info(IVIBandDesc *band, IVITile *tile) {
mb->_mvX = mb->_mvY = 0; // no motion vector coded
if (band->_inheritMv && ref_mb) {
// motion vector inheritance
- if (mv_scale) {
- mb->_mvX = ivi_scale_mv(ref_mb->_mvX, mv_scale);
- mb->_mvY = ivi_scale_mv(ref_mb->_mvY, mv_scale);
+ if (mvScale) {
+ mb->_mvX = scaleMV(ref_mb->_mvX, mvScale);
+ mb->_mvY = scaleMV(ref_mb->_mvY, mvScale);
} else {
mb->_mvX = ref_mb->_mvX;
mb->_mvY = ref_mb->_mvY;
@@ -514,10 +514,10 @@ int Indeo4Decoder::decode_mb_info(IVIBandDesc *band, IVITile *tile) {
_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(mbTypeBits);
}
- mb->_cbp = _ctx._gb->getBits(blks_per_mb);
+ mb->_cbp = _ctx._gb->getBits(blksPerMb);
mb->_qDelta = 0;
if (band->_inheritQDelta) {
@@ -535,9 +535,9 @@ int Indeo4Decoder::decode_mb_info(IVIBandDesc *band, IVITile *tile) {
if (band->_inheritMv) {
if (ref_mb) {
// motion vector inheritance
- if (mv_scale) {
- mb->_mvX = ivi_scale_mv(ref_mb->_mvX, mv_scale);
- mb->_mvY = ivi_scale_mv(ref_mb->_mvY, mv_scale);
+ if (mvScale) {
+ mb->_mvX = scaleMV(ref_mb->_mvX, mvScale);
+ mb->_mvY = scaleMV(ref_mb->_mvY, mvScale);
} else {
mb->_mvX = ref_mb->_mvX;
mb->_mvY = ref_mb->_mvY;
@@ -545,25 +545,25 @@ int Indeo4Decoder::decode_mb_info(IVIBandDesc *band, IVITile *tile) {
}
} else {
// decode motion vector deltas
- mv_delta = _ctx._gb->getVLC2(_ctx._mbVlc._tab->_table,
+ mvDelta = _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,
+ mvY += IVI_TOSIGNED(mvDelta);
+ mvDelta = _ctx._gb->getVLC2(_ctx._mbVlc._tab->_table,
IVI_VLC_BITS, 1);
- _mvX += IVI_TOSIGNED(mv_delta);
- mb->_mvX = _mvX;
- mb->_mvY = _mvY;
+ mvX += IVI_TOSIGNED(mvDelta);
+ mb->_mvX = mvX;
+ mb->_mvY = mvY;
if (mb->_type == 3) {
- mv_delta = _ctx._gb->getVLC2(
+ mvDelta = _ctx._gb->getVLC2(
_ctx._mbVlc._tab->_table,
IVI_VLC_BITS, 1);
- _mvY += IVI_TOSIGNED(mv_delta);
- mv_delta = _ctx._gb->getVLC2(
+ mvY += IVI_TOSIGNED(mvDelta);
+ mvDelta = _ctx._gb->getVLC2(
_ctx._mbVlc._tab->_table,
IVI_VLC_BITS, 1);
- _mvX += IVI_TOSIGNED(mv_delta);
- mb->_bMvX = -_mvX;
- mb->_bMvY = -_mvY;
+ mvX += IVI_TOSIGNED(mvDelta);
+ mb->_bMvX = -mvX;
+ mb->_bMvY = -mvY;
}
}
if (mb->_type == 2) {
@@ -587,7 +587,7 @@ int Indeo4Decoder::decode_mb_info(IVIBandDesc *band, IVITile *tile) {
mb++;
if (ref_mb)
ref_mb++;
- mb_offset += band->_mbSize;
+ mbOffset += band->_mbSize;
}
offs += row_offset;
@@ -597,8 +597,8 @@ int Indeo4Decoder::decode_mb_info(IVIBandDesc *band, IVITile *tile) {
return 0;
}
-int Indeo4Decoder::scaleTileSize(int def_size, int size_factor) {
- return size_factor == 15 ? def_size : (size_factor + 1) << 5;
+int Indeo4Decoder::scaleTileSize(int defSize, int sizeFactor) {
+ return sizeFactor == 15 ? defSize : (sizeFactor + 1) << 5;
}
int Indeo4Decoder::decodePlaneSubdivision() {
@@ -607,11 +607,13 @@ int Indeo4Decoder::decodePlaneSubdivision() {
switch (_ctx._gb->getBits(2)) {
case 3:
return 1;
+
case 2:
for (i = 0; i < 4; i++)
if (_ctx._gb->getBits(2) != 3)
return 0;
return 4;
+
default:
return 0;
}
diff --git a/image/codecs/indeo4.h b/image/codecs/indeo4.h
index 86e6020c43..26bddaa4b3 100644
--- a/image/codecs/indeo4.h
+++ b/image/codecs/indeo4.h
@@ -73,9 +73,9 @@ protected:
/**
* Rearrange decoding and reference buffers.
*/
- virtual void switch_buffers();
+ virtual void switchBuffers();
- virtual bool is_nonnull_frame() const;
+ virtual bool isNonNullFrame() const;
/**
* Decode Indeo 4 band header.
@@ -83,7 +83,7 @@ protected:
* @param[in,out] band pointer to the band descriptor
* @return result code: 0 = OK, negative number = error
*/
- virtual int decode_band_hdr(IVIBandDesc *band);
+ virtual int decodeBandHeader(IVIBandDesc *band);
/**
* Decode information (block type, cbp, quant delta, motion vector)
@@ -93,9 +93,9 @@ protected:
* @param[in,out] tile pointer to the tile descriptor
* @return result code: 0 = OK, negative number = error
*/
- virtual int decode_mb_info(IVIBandDesc *band, IVITile *tile);
+ virtual int decodeMbInfo(IVIBandDesc *band, IVITile *tile);
private:
- int scaleTileSize(int def_size, int size_factor);
+ int scaleTileSize(int defSize, int sizeFactor);
/**
* Decode subdivision of a plane.
@@ -104,8 +104,8 @@ private:
* - 4 wavelet bands per plane, size factor 1:4, code pattern: 2,3,3,3,3
* Anything else is either unsupported or corrupt.
*
- * @param[in,out] gb the GetBit context
- * @return number of wavelet bands or 0 on error
+ * @param[in,out] gb The GetBit context
+ * @returns Number of wavelet bands or 0 on error
*/
int decodePlaneSubdivision();
diff --git a/image/codecs/indeo5.cpp b/image/codecs/indeo5.cpp
index 5434e26cfa..6eacbb80f7 100644
--- a/image/codecs/indeo5.cpp
+++ b/image/codecs/indeo5.cpp
@@ -103,8 +103,8 @@ const Graphics::Surface *Indeo5Decoder::decodeFrame(Common::SeekableReadStream &
}
int Indeo5Decoder::decodePictureHeader() {
- int pic_size_indx, i, p;
- IVIPicConfig pic_conf;
+ int picSizeIndx, i, p;
+ IVIPicConfig picConf;
int ret;
@@ -149,7 +149,7 @@ int Indeo5Decoder::decodePictureHeader() {
skip_hdr_extension(); // XXX: untested
// decode macroblock huffman codebook
- ret = _ctx._mbVlc.ff_ivi_dec_huff_desc(&_ctx, _ctx._frameFlags & 0x40,
+ ret = _ctx._mbVlc.decodeHuffDesc(&_ctx, _ctx._frameFlags & 0x40,
IVI_MB_HUFF);
if (ret < 0)
return ret;
@@ -161,7 +161,7 @@ int Indeo5Decoder::decodePictureHeader() {
return 0;
}
-void Indeo5Decoder::switch_buffers() {
+void Indeo5Decoder::switchBuffers() {
switch (_ctx._prevFrameType) {
case FRAMETYPE_INTRA:
case FRAMETYPE_INTER:
@@ -169,6 +169,7 @@ void Indeo5Decoder::switch_buffers() {
_ctx._dstBuf = _ctx._bufSwitch;
_ctx._refBuf = _ctx._bufSwitch ^ 1;
break;
+
case FRAMETYPE_INTER_SCAL:
if (!_ctx._interScal) {
_ctx._ref2Buf = 2;
@@ -177,6 +178,7 @@ void Indeo5Decoder::switch_buffers() {
FFSWAP(int, _ctx._dstBuf, _ctx._ref2Buf);
_ctx._refBuf = _ctx._ref2Buf;
break;
+
case FRAMETYPE_INTER_NOREF:
break;
}
@@ -190,6 +192,7 @@ void Indeo5Decoder::switch_buffers() {
_ctx._dstBuf = _ctx._bufSwitch;
_ctx._refBuf = _ctx._bufSwitch ^ 1;
break;
+
case FRAMETYPE_INTER_SCAL:
case FRAMETYPE_INTER_NOREF:
case FRAMETYPE_NULL:
@@ -197,32 +200,32 @@ void Indeo5Decoder::switch_buffers() {
}
}
-bool Indeo5Decoder::is_nonnull_frame() const {
+bool Indeo5Decoder::isNonNullFrame() const {
return _ctx._frameType != FRAMETYPE_NULL;
}
-int Indeo5Decoder::decode_band_hdr(IVIBandDesc *band) {
+int Indeo5Decoder::decodeBandHeader(IVIBandDesc *band) {
int i, ret;
- uint8 band_flags;
+ uint8 bandFlags;
- band_flags = _ctx._gb->getBits(8);
+ bandFlags = _ctx._gb->getBits(8);
- if (band_flags & 1) {
+ if (bandFlags & 1) {
band->_isEmpty = true;
return 0;
}
band->_dataSize = (_ctx._frameFlags & 0x80) ? _ctx._gb->getBitsLong(24) : 0;
- band->_inheritMv = (band_flags & 2) != 0;
- band->_inheritQDelta = (band_flags & 8) != 0;
- band->_qdeltaPresent = (band_flags & 4) != 0;
+ band->_inheritMv = (bandFlags & 2) != 0;
+ band->_inheritQDelta = (bandFlags & 8) != 0;
+ band->_qdeltaPresent = (bandFlags & 4) != 0;
if (!band->_qdeltaPresent)
band->_inheritQDelta = 1;
// decode rvmap probability corrections if any
band->_numCorr = 0; // there are no corrections
- if (band_flags & 0x10) {
+ if (bandFlags & 0x10) {
band->_numCorr = _ctx._gb->getBits(8); // get number of correction pairs
if (band->_numCorr > 61) {
warning("Too many corrections: %d", band->_numCorr);
@@ -235,10 +238,10 @@ int Indeo5Decoder::decode_band_hdr(IVIBandDesc *band) {
}
// select appropriate rvmap table for this band
- band->_rvmapSel = (band_flags & 0x40) ? _ctx._gb->getBits(3) : 8;
+ band->_rvmapSel = (bandFlags & 0x40) ? _ctx._gb->getBits(3) : 8;
// decode block huffman codebook
- ret = band->_blkVlc.ff_ivi_dec_huff_desc(&_ctx, band_flags & 0x80, IVI_BLK_HUFF);
+ ret = band->_blkVlc.decodeHuffDesc(&_ctx, bandFlags & 0x80, IVI_BLK_HUFF);
if (ret < 0)
return ret;
@@ -249,7 +252,7 @@ int Indeo5Decoder::decode_band_hdr(IVIBandDesc *band) {
band->_globQuant = _ctx._gb->getBits(5);
// skip unknown extension if any
- if (band_flags & 0x20) { // XXX: untested
+ if (bandFlags & 0x20) { // XXX: untested
_ctx._gb->alignGetBits();
skip_hdr_extension();
}
@@ -259,17 +262,17 @@ int Indeo5Decoder::decode_band_hdr(IVIBandDesc *band) {
return 0;
}
-int Indeo5Decoder::decode_mb_info(IVIBandDesc *band, IVITile *tile) {
- int x, y, _mvX, _mvY, mv_delta, offs, mb_offset,
- mv_scale, blks_per_mb, s;
- IVIMbInfo *mb, *ref_mb;
- int row_offset = band->_mbSize * band->_pitch;
+int Indeo5Decoder::decodeMbInfo(IVIBandDesc *band, IVITile *tile) {
+ int x, y, mvX, mvY, mvDelta, offs, mbOffset,
+ mvScale, blksPerMb, s;
+ IVIMbInfo *mb, *refMb;
+ int rowOffset = band->_mbSize * band->_pitch;
mb = tile->_mbs;
- ref_mb = tile->_refMbs;
+ refMb = tile->_refMbs;
offs = tile->_yPos * band->_pitch + tile->_xPos;
- if (!ref_mb &&
+ if (!refMb &&
((band->_qdeltaPresent && band->_inheritQDelta) || band->_inheritMv))
return -1;
@@ -280,16 +283,16 @@ int Indeo5Decoder::decode_mb_info(IVIBandDesc *band, IVITile *tile) {
}
// scale factor for motion vectors
- mv_scale = (_ctx._planes[0]._bands[0]._mbSize >> 3) - (band->_mbSize >> 3);
- _mvX = _mvY = 0;
+ mvScale = (_ctx._planes[0]._bands[0]._mbSize >> 3) - (band->_mbSize >> 3);
+ mvX = mvY = 0;
for (y = tile->_yPos; y < (tile->_yPos + tile->_height); y += band->_mbSize) {
- mb_offset = offs;
+ mbOffset = offs;
for (x = tile->_xPos; x < (tile->_xPos + tile->_width); x += band->_mbSize) {
mb->_xPos = x;
mb->_yPos = y;
- mb->_bufOffs = mb_offset;
+ mb->_bufOffs = mbOffset;
if (_ctx._gb->getBits1()) {
if (_ctx._frameType == FRAMETYPE_INTRA) {
@@ -306,32 +309,32 @@ int Indeo5Decoder::decode_mb_info(IVIBandDesc *band, IVITile *tile) {
}
mb->_mvX = mb->_mvY = 0; // no motion vector coded
- if (band->_inheritMv && ref_mb) {
+ if (band->_inheritMv && refMb) {
// motion vector inheritance
- if (mv_scale) {
- mb->_mvX = ivi_scale_mv(ref_mb->_mvX, mv_scale);
- mb->_mvY = ivi_scale_mv(ref_mb->_mvY, mv_scale);
+ if (mvScale) {
+ mb->_mvX = scaleMV(refMb->_mvX, mvScale);
+ mb->_mvY = scaleMV(refMb->_mvY, mvScale);
} else {
- mb->_mvX = ref_mb->_mvX;
- mb->_mvY = ref_mb->_mvY;
+ mb->_mvX = refMb->_mvX;
+ mb->_mvY = refMb->_mvY;
}
}
} else {
- if (band->_inheritMv && ref_mb) {
- mb->_type = ref_mb->_type; // copy mb_type from corresponding reference mb
+ if (band->_inheritMv && refMb) {
+ mb->_type = refMb->_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();
}
- blks_per_mb = band->_mbSize != band->_blkSize ? 4 : 1;
- mb->_cbp = _ctx._gb->getBits(blks_per_mb);
+ blksPerMb = band->_mbSize != band->_blkSize ? 4 : 1;
+ mb->_cbp = _ctx._gb->getBits(blksPerMb);
mb->_qDelta = 0;
if (band->_qdeltaPresent) {
if (band->_inheritQDelta) {
- if (ref_mb) mb->_qDelta = ref_mb->_qDelta;
+ if (refMb) mb->_qDelta = refMb->_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);
@@ -342,23 +345,23 @@ int Indeo5Decoder::decode_mb_info(IVIBandDesc *band, IVITile *tile) {
if (!mb->_type) {
mb->_mvX = mb->_mvY = 0; // there is no motion vector in intra-macroblocks
} else {
- if (band->_inheritMv && ref_mb) {
+ if (band->_inheritMv && refMb) {
// motion vector inheritance
- if (mv_scale) {
- mb->_mvX = ivi_scale_mv(ref_mb->_mvX, mv_scale);
- mb->_mvY = ivi_scale_mv(ref_mb->_mvY, mv_scale);
+ if (mvScale) {
+ mb->_mvX = scaleMV(refMb->_mvX, mvScale);
+ mb->_mvY = scaleMV(refMb->_mvY, mvScale);
} else {
- mb->_mvX = ref_mb->_mvX;
- mb->_mvY = ref_mb->_mvY;
+ mb->_mvX = refMb->_mvX;
+ mb->_mvY = refMb->_mvY;
}
} else {
// decode motion vector deltas
- 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;
+ mvDelta = _ctx._gb->getVLC2(_ctx._mbVlc._tab->_table, IVI_VLC_BITS, 1);
+ mvY += IVI_TOSIGNED(mvDelta);
+ mvDelta = _ctx._gb->getVLC2(_ctx._mbVlc._tab->_table, IVI_VLC_BITS, 1);
+ mvX += IVI_TOSIGNED(mvDelta);
+ mb->_mvX = mvX;
+ mb->_mvY = mvY;
}
}
}
@@ -373,12 +376,12 @@ int Indeo5Decoder::decode_mb_info(IVIBandDesc *band, IVITile *tile) {
}
mb++;
- if (ref_mb)
- ref_mb++;
- mb_offset += band->_mbSize;
+ if (refMb)
+ refMb++;
+ mbOffset += band->_mbSize;
}
- offs += row_offset;
+ offs += rowOffset;
}
_ctx._gb->alignGetBits();
@@ -387,11 +390,11 @@ int Indeo5Decoder::decode_mb_info(IVIBandDesc *band, IVITile *tile) {
}
int Indeo5Decoder::decode_gop_header() {
- int result, i, p, tile_size, pic_size_indx, mbSize, blkSize, isScalable;
+ int result, i, p, tile_size, picSizeIndx, mbSize, blkSize, isScalable;
int quantMat;
- bool blk_size_changed = false;
+ bool blkSizeChanged = false;
IVIBandDesc *band, *band1, *band2;
- IVIPicConfig pic_conf;
+ IVIPicConfig picConf;
_ctx._gopFlags = _ctx._gb->getBits(8);
@@ -408,22 +411,22 @@ int Indeo5Decoder::decode_gop_header() {
// decode number of wavelet bands
// num_levels * 3 + 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)) {
+ picConf._lumaBands = _ctx._gb->getBits(2) * 3 + 1;
+ picConf._chromaBands = _ctx._gb->getBits1() * 3 + 1;
+ isScalable = picConf._lumaBands != 1 || picConf._chromaBands != 1;
+ if (isScalable && (picConf._lumaBands != 4 || picConf._chromaBands != 1)) {
warning("Scalability: unsupported subdivision! Luma bands: %d, chroma bands: %d",
- pic_conf._lumaBands, pic_conf._chromaBands);
+ picConf._lumaBands, picConf._chromaBands);
return -1;
}
- pic_size_indx = _ctx._gb->getBits(4);
- if (pic_size_indx == IVI5_PIC_SIZE_ESC) {
- pic_conf._picHeight = _ctx._gb->getBits(13);
- pic_conf._picWidth = _ctx._gb->getBits(13);
+ picSizeIndx = _ctx._gb->getBits(4);
+ if (picSizeIndx == IVI5_PIC_SIZE_ESC) {
+ picConf._picHeight = _ctx._gb->getBits(13);
+ picConf._picWidth = _ctx._gb->getBits(13);
} else {
- 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;
+ picConf._picHeight = _ivi5_common_pic_sizes[picSizeIndx * 2 + 1] << 2;
+ picConf._picWidth = _ivi5_common_pic_sizes[picSizeIndx * 2] << 2;
}
if (_ctx._gopFlags & 2) {
@@ -431,30 +434,30 @@ int Indeo5Decoder::decode_gop_header() {
return -2;
}
- pic_conf._chromaHeight = (pic_conf._picHeight + 3) >> 2;
- pic_conf._chromaWidth = (pic_conf._picWidth + 3) >> 2;
+ picConf._chromaHeight = (picConf._picHeight + 3) >> 2;
+ picConf._chromaWidth = (picConf._picWidth + 3) >> 2;
if (!tile_size) {
- pic_conf._tileHeight = pic_conf._picHeight;
- pic_conf._tileWidth = pic_conf._picWidth;
+ picConf._tileHeight = picConf._picHeight;
+ picConf._tileWidth = picConf._picWidth;
} else {
- pic_conf._tileHeight = pic_conf._tileWidth = tile_size;
+ picConf._tileHeight = picConf._tileWidth = tile_size;
}
// check if picture layout was changed and reallocate buffers
- if (pic_conf.ivi_pic_config_cmp(_ctx._picConf) || _ctx._gopInvalid) {
- result = IVIPlaneDesc::ff_ivi_init_planes(_ctx._planes, &pic_conf, 0);
+ if (picConf.ivi_pic_config_cmp(_ctx._picConf) || _ctx._gopInvalid) {
+ result = IVIPlaneDesc::initPlanes(_ctx._planes, &picConf, 0);
if (result < 0) {
warning("Couldn't reallocate color planes!");
return result;
}
- _ctx._picConf = pic_conf;
+ _ctx._picConf = picConf;
_ctx._isScalable = isScalable;
- blk_size_changed = 1; // force reallocation of the internal structures
+ blkSizeChanged = 1; // force reallocation of the internal structures
}
for (p = 0; p <= 1; p++) {
- for (i = 0; i < (!p ? pic_conf._lumaBands : pic_conf._chromaBands); i++) {
+ for (i = 0; i < (!p ? picConf._lumaBands : picConf._chromaBands); i++) {
band = &_ctx._planes[p]._bands[i];
band->_isHalfpel = _ctx._gb->getBits1();
@@ -468,8 +471,8 @@ int Indeo5Decoder::decode_gop_header() {
return -2;
}
- blk_size_changed = mbSize != band->_mbSize || blkSize != band->_blkSize;
- if (blk_size_changed) {
+ blkSizeChanged = mbSize != band->_mbSize || blkSize != band->_blkSize;
+ if (blkSizeChanged) {
band->_mbSize = mbSize;
band->_blkSize = blkSize;
}
@@ -527,7 +530,7 @@ int Indeo5Decoder::decode_gop_header() {
// select dequant matrix according to plane and band number
if (!p) {
- quantMat = (pic_conf._lumaBands > 1) ? i + 1 : 0;
+ quantMat = (picConf._lumaBands > 1) ? i + 1 : 0;
} else {
quantMat = 5;
}
@@ -556,7 +559,7 @@ int Indeo5Decoder::decode_gop_header() {
}
// copy chroma parameters into the 2nd chroma plane
- for (i = 0; i < pic_conf._chromaBands; i++) {
+ for (i = 0; i < picConf._chromaBands; i++) {
band1 = &_ctx._planes[1]._bands[i];
band2 = &_ctx._planes[2]._bands[i];
@@ -577,9 +580,9 @@ int Indeo5Decoder::decode_gop_header() {
}
// reallocate internal structures if needed
- if (blk_size_changed) {
- result = IVIPlaneDesc::ff_ivi_init_tiles(_ctx._planes, pic_conf._tileWidth,
- pic_conf._tileHeight);
+ if (blkSizeChanged) {
+ result = IVIPlaneDesc::initTiles(_ctx._planes, picConf._tileWidth,
+ picConf._tileHeight);
if (result < 0) {
warning("Couldn't reallocate internal structures!");
return result;
diff --git a/image/codecs/indeo5.h b/image/codecs/indeo5.h
index 102c610be8..9832967d5d 100644
--- a/image/codecs/indeo5.h
+++ b/image/codecs/indeo5.h
@@ -73,9 +73,9 @@ protected:
/**
* Rearrange decoding and reference buffers.
*/
- virtual void switch_buffers();
+ virtual void switchBuffers();
- virtual bool is_nonnull_frame() const;
+ virtual bool isNonNullFrame() const;
/**
* Decode Indeo 4 band header.
@@ -83,7 +83,7 @@ protected:
* @param[in,out] band pointer to the band descriptor
* @return result code: 0 = OK, negative number = error
*/
- virtual int decode_band_hdr(IVIBandDesc *band);
+ virtual int decodeBandHeader(IVIBandDesc *band);
/**
* Decode information (block type, cbp, quant delta, motion vector)
@@ -93,7 +93,7 @@ protected:
* @param[in,out] tile pointer to the tile descriptor
* @return result code: 0 = OK, negative number = error
*/
- virtual int decode_mb_info(IVIBandDesc *band, IVITile *tile);
+ virtual int decodeMbInfo(IVIBandDesc *band, IVITile *tile);
private:
/**
* Decode Indeo5 GOP (Group of pictures) header.