IMAGE: Cleanup of miscellaneous methods and arrays in Indeo decoders

This commit is contained in:
Paul Gilbert 2016-09-10 18:07:13 -04:00
parent e06442afb6
commit 9c6a55a2a6
10 changed files with 454 additions and 469 deletions

View File

@ -105,7 +105,7 @@ int IVIHuffDesc::createHuffFromDesc(VLC *vlc, bool flag) const {
if (bits[pos] > IVI_VLC_BITS)
return -1; // invalid descriptor
codewords[pos] = inv_bits((prefix | j), bits[pos]);
codewords[pos] = invertBits((prefix | j), bits[pos]);
if (!bits[pos])
bits[pos] = 1;
@ -227,8 +227,8 @@ int IVIBandDesc::initTiles(IVITile *refTile, int p, int b, int tHeight, int tWid
tile->_numMBs = IVI_MBs_PER_TILE(tile->_width, tile->_height,
_mbSize);
av_freep(&tile->_mbs);
tile->_mbs = (IVIMbInfo *)av_mallocz_array(tile->_numMBs, sizeof(IVIMbInfo));
avFreeP(&tile->_mbs);
tile->_mbs = (IVIMbInfo *)avMallocZArray(tile->_numMBs, sizeof(IVIMbInfo));
if (!tile->_mbs)
return -2;
@ -289,7 +289,7 @@ int IVIPlaneDesc::initPlanes(IVIPlaneDesc *planes, const IVIPicConfig *cfg, bool
planes[1]._numBands = planes[2]._numBands = cfg->_chromaBands;
for (p = 0; p < 3; p++) {
planes[p]._bands = (IVIBandDesc *)av_mallocz_array(planes[p]._numBands, sizeof(IVIBandDesc));
planes[p]._bands = (IVIBandDesc *)avMallocZArray(planes[p]._numBands, sizeof(IVIBandDesc));
if (!planes[p]._bands)
return -2;
@ -316,20 +316,20 @@ int IVIPlaneDesc::initPlanes(IVIPlaneDesc *planes, const IVIPicConfig *cfg, bool
band->_height = b_height;
band->_pitch = width_aligned;
band->_aHeight = height_aligned;
band->_bufs[0] = (int16 *)av_mallocz(bufSize);
band->_bufs[1] = (int16 *)av_mallocz(bufSize);
band->_bufs[0] = (int16 *)avMallocZ(bufSize);
band->_bufs[1] = (int16 *)avMallocZ(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(bufSize);
band->_bufs[2] = (int16 *)avMallocZ(bufSize);
if (!band->_bufs[2])
return -2;
}
if (isIndeo4) {
band->_bufs[3] = (int16 *)av_mallocz(bufSize);
band->_bufs[3] = (int16 *)avMallocZ(bufSize);
if (!band->_bufs[3])
return -2;
}
@ -362,8 +362,8 @@ int IVIPlaneDesc::initTiles(IVIPlaneDesc *planes, int tileWidth, int tileHeight)
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));
avFreeP(&band->_tiles);
band->_tiles = (IVITile *)avMallocZArray(band->_numTiles, sizeof(IVITile));
if (!band->_tiles)
return -2;
@ -385,18 +385,18 @@ void IVIPlaneDesc::freeBuffers(IVIPlaneDesc *planes) {
for (p = 0; p < 3; p++) {
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]);
avFreeP(&planes[p]._bands[b]._bufs[0]);
avFreeP(&planes[p]._bands[b]._bufs[1]);
avFreeP(&planes[p]._bands[b]._bufs[2]);
avFreeP(&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);
avFreeP(&planes[p]._bands[b]._tiles[t]._mbs);
avFreeP(&planes[p]._bands[b]._tiles);
}
av_freep(&planes[p]._bands);
avFreeP(&planes[p]._bands);
planes[p]._numBands = 0;
}
}
@ -427,11 +427,11 @@ int AVFrame::getBuffer(int flags) {
freeFrame();
// Luminance channel
_data[0] = (uint8 *)av_mallocz(_width * _height);
_data[0] = (uint8 *)avMallocZ(_width * _height);
// UV Chroma Channels
_data[1] = (uint8 *)av_malloc(_width * _height);
_data[2] = (uint8 *)av_malloc(_width * _height);
_data[1] = (uint8 *)avMalloc(_width * _height);
_data[2] = (uint8 *)avMalloc(_width * _height);
Common::fill(_data[1], _data[1] + _width * _height, 0x80);
Common::fill(_data[2], _data[2] + _width * _height, 0x80);
@ -439,9 +439,9 @@ int AVFrame::getBuffer(int flags) {
}
void AVFrame::freeFrame() {
av_freep(&_data[0]);
av_freep(&_data[1]);
av_freep(&_data[2]);
avFreeP(&_data[0]);
avFreeP(&_data[1]);
avFreeP(&_data[2]);
}
/*------------------------------------------------------------------------*/
@ -739,10 +739,10 @@ void IndeoDecoderBase::recomposeHaar(const IVIPlaneDesc *_plane,
p3 = (b0 - b1 - b2 + b3 + 2) >> 2;
// bias, convert and output four pixels
dst[x] = av_clip_uint8(p0 + 128);
dst[x + 1] = av_clip_uint8(p1 + 128);
dst[dstPitch + x] = av_clip_uint8(p2 + 128);
dst[dstPitch + x + 1] = av_clip_uint8(p3 + 128);
dst[x] = avClipUint8(p0 + 128);
dst[x + 1] = avClipUint8(p1 + 128);
dst[dstPitch + x] = avClipUint8(p2 + 128);
dst[dstPitch + x + 1] = avClipUint8(p3 + 128);
}// for x
dst += dstPitch << 1;
@ -893,10 +893,10 @@ void IndeoDecoderBase::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[dstPitch + x] = av_clip_uint8((p2 >> 6) + 128);
dst[dstPitch + x + 1] = av_clip_uint8((p3 >> 6) + 128);
dst[x] = avClipUint8((p0 >> 6) + 128);
dst[x + 1] = avClipUint8((p1 >> 6) + 128);
dst[dstPitch + x] = avClipUint8((p2 >> 6) + 128);
dst[dstPitch + x + 1] = avClipUint8((p3 >> 6) + 128);
}// for x
dst += dstPitch << 1;
@ -920,7 +920,7 @@ void IndeoDecoderBase::outputPlane(IVIPlaneDesc *_plane, uint8 *dst, int dstPitc
for (y = 0; y < _plane->_height; y++) {
for (x = 0; x < _plane->_width; x++)
dst[x] = av_clip_uint8(src[x] + 128);
dst[x] = avClipUint8(src[x] + 128);
src += pitch;
dst += dstPitch;
}
@ -1006,8 +1006,8 @@ int IndeoDecoderBase::processEmptyTile(IVIBandDesc *band,
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;
mcNoDeltaFunc = (band->_blkSize == 8) ? IndeoDSP::ffIviMc8x8NoDelta
: IndeoDSP::ffIviMc4x4NoDelta;
for (mbn = 0, mb = tile->_mbs; mbn < tile->_numMBs; mb++, mbn++) {
mvX = mb->_mvX;
@ -1075,15 +1075,15 @@ int IndeoDecoderBase::decodeBlocks(GetBits *_gb, IVIBandDesc *band, IVITile *til
// number of blocks per mb
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;
mcWithDeltaFunc = IndeoDSP::ffIviMc8x8Delta;
mcNoDeltaFunc = IndeoDSP::ffIviMc8x8NoDelta;
mcAvgWithDeltaFunc = IndeoDSP::ffIviMcAvg8x8Delta;
mcAvgNoDeltaFunc = IndeoDSP::ffIviMcAvg8x8NoDelta;
} else {
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;
mcWithDeltaFunc = IndeoDSP::ffIviMc4x4Delta;
mcNoDeltaFunc = IndeoDSP::ffIviMc4x4NoDelta;
mcAvgWithDeltaFunc = IndeoDSP::ffIviMcAvg4x4Delta;
mcAvgNoDeltaFunc = IndeoDSP::ffIviMcAvg4x4NoDelta;
}
for (mbn = 0, mb = tile->_mbs; mbn < tile->_numMBs; mb++, mbn++) {
@ -1093,7 +1093,7 @@ int IndeoDecoderBase::decodeBlocks(GetBits *_gb, IVIBandDesc *band, IVITile *til
quant = band->_globQuant + mb->_qDelta;
if (_ctx._isIndeo4)
quant = av_clip_uintp2(quant, 5);
quant = avClipUintp2(quant, 5);
else
quant = av_clip((int)quant, 0, 23);
@ -1346,7 +1346,7 @@ int IndeoDecoderBase::ivi_dc_transform(IVIBandDesc *band, int *prevDc,
/*------------------------------------------------------------------------*/
const uint8 IndeoDecoderBase::_ff_ivi_vertical_scan_8x8[64] = {
const uint8 IndeoDecoderBase::_ffIviVerticalScan8x8[64] = {
0, 8, 16, 24, 32, 40, 48, 56,
1, 9, 17, 25, 33, 41, 49, 57,
2, 10, 18, 26, 34, 42, 50, 58,
@ -1357,7 +1357,7 @@ const uint8 IndeoDecoderBase::_ff_ivi_vertical_scan_8x8[64] = {
7, 15, 23, 31, 39, 47, 55, 63
};
const uint8 IndeoDecoderBase::_ff_ivi_horizontal_scan_8x8[64] = {
const uint8 IndeoDecoderBase::_ffIviHorizontalScan8x8[64] = {
0, 1, 2, 3, 4, 5, 6, 7,
8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23,
@ -1368,7 +1368,7 @@ const uint8 IndeoDecoderBase::_ff_ivi_horizontal_scan_8x8[64] = {
56, 57, 58, 59, 60, 61, 62, 63
};
const uint8 IndeoDecoderBase::_ff_ivi_direct_scan_4x4[16] = {
const uint8 IndeoDecoderBase::_ffIviDirectScan4x4[16] = {
0, 1, 4, 8, 5, 2, 3, 6, 9, 12, 13, 10, 7, 11, 14, 15
};

View File

@ -523,9 +523,9 @@ protected:
/**
* Scan patterns shared between indeo4 and indeo5
*/
static const uint8 _ff_ivi_vertical_scan_8x8[64];
static const uint8 _ff_ivi_horizontal_scan_8x8[64];
static const uint8 _ff_ivi_direct_scan_4x4[16];
static const uint8 _ffIviVerticalScan8x8[64];
static const uint8 _ffIviHorizontalScan8x8[64];
static const uint8 _ffIviDirectScan4x4[16];
protected:
/**
* Returns the pixel format for the decoder's surface

View File

@ -71,13 +71,13 @@ namespace Indeo {
d3 = COMPENSATE(t2);\
d4 = COMPENSATE(t3); }
void IndeoDSP::ff_ivi_inverse_haar_8x8(const int32 *in, int16 *out, uint32 pitch,
void IndeoDSP::ffIviInverseHaar8x8(const int32 *in, int16 *out, uint32 pitch,
const uint8 *flags) {
int i, shift, sp1, sp2, sp3, sp4;
int i, shift, sp1, sp2, sp3, sp4;
const int32 *src;
int32 *dst;
int tmp[64];
int t0, t1, t2, t3, t4, t5, t6, t7, t8;
int32 * dst;
int tmp[64];
int t0, t1, t2, t3, t4, t5, t6, t7, t8;
// apply the InvHaar8 to all columns
#define COMPENSATE(x) (x)
@ -126,10 +126,10 @@ void IndeoDSP::ff_ivi_inverse_haar_8x8(const int32 *in, int16 *out, uint32 pitch
#undef COMPENSATE
}
void IndeoDSP::ff_ivi_row_haar8(const int32 *in, int16 *out, uint32 pitch,
void IndeoDSP::ffIviRowHaar8(const int32 *in, int16 *out, uint32 pitch,
const uint8 *flags) {
int i;
int t0, t1, t2, t3, t4, t5, t6, t7, t8;
int i;
int t0, t1, t2, t3, t4, t5, t6, t7, t8;
// apply the InvHaar8 to all rows
#define COMPENSATE(x) (x)
@ -150,10 +150,10 @@ void IndeoDSP::ff_ivi_row_haar8(const int32 *in, int16 *out, uint32 pitch,
#undef COMPENSATE
}
void IndeoDSP::ff_ivi_col_haar8(const int32 *in, int16 *out, uint32 pitch,
void IndeoDSP::ffIviColHaar8(const int32 *in, int16 *out, uint32 pitch,
const uint8 *flags) {
int i;
int t0, t1, t2, t3, t4, t5, t6, t7, t8;
int i;
int t0, t1, t2, t3, t4, t5, t6, t7, t8;
// apply the InvHaar8 to all columns
#define COMPENSATE(x) (x)
@ -179,13 +179,13 @@ void IndeoDSP::ff_ivi_col_haar8(const int32 *in, int16 *out, uint32 pitch,
#undef COMPENSATE
}
void IndeoDSP::ff_ivi_inverse_haar_4x4(const int32 *in, int16 *out, uint32 pitch,
void IndeoDSP::ffIviInverseHaar4x4(const int32 *in, int16 *out, uint32 pitch,
const uint8 *flags) {
int i, shift, sp1, sp2;
int i, shift, sp1, sp2;
const int32 *src;
int32 *dst;
int tmp[16];
int t0, t1, t2, t3, t4;
int32 * dst;
int tmp[16];
int t0, t1, t2, t3, t4;
// apply the InvHaar4 to all columns
#define COMPENSATE(x) (x)
@ -226,10 +226,10 @@ void IndeoDSP::ff_ivi_inverse_haar_4x4(const int32 *in, int16 *out, uint32 pitch
#undef COMPENSATE
}
void IndeoDSP::ff_ivi_row_haar4(const int32 *in, int16 *out, uint32 pitch,
void IndeoDSP::ffIviRowHaar4(const int32 *in, int16 *out, uint32 pitch,
const uint8 *flags) {
int i;
int t0, t1, t2, t3, t4;
int i;
int t0, t1, t2, t3, t4;
// apply the InvHaar4 to all rows
#define COMPENSATE(x) (x)
@ -247,10 +247,10 @@ void IndeoDSP::ff_ivi_row_haar4(const int32 *in, int16 *out, uint32 pitch,
#undef COMPENSATE
}
void IndeoDSP::ff_ivi_col_haar4(const int32 *in, int16 *out, uint32 pitch,
void IndeoDSP::ffIviColHaar4(const int32 *in, int16 *out, uint32 pitch,
const uint8 *flags) {
int i;
int t0, t1, t2, t3, t4;
int i;
int t0, t1, t2, t3, t4;
// apply the InvHaar8 to all columns
#define COMPENSATE(x) (x)
@ -271,16 +271,16 @@ void IndeoDSP::ff_ivi_col_haar4(const int32 *in, int16 *out, uint32 pitch,
#undef COMPENSATE
}
void IndeoDSP::ff_ivi_dc_haar_2d(const int32 *in, int16 *out, uint32 pitch,
int blk_size) {
int x, y;
int16 dc_coeff;
void IndeoDSP::ffIviDcHaar2d(const int32 *in, int16 *out, uint32 pitch,
int blkSize) {
int x, y;
int16 dcCoeff;
dc_coeff = (*in + 0) >> 3;
dcCoeff = (*in + 0) >> 3;
for (y = 0; y < blk_size; out += pitch, y++) {
for (x = 0; x < blk_size; x++)
out[x] = dc_coeff;
for (y = 0; y < blkSize; out += pitch, y++) {
for (x = 0; x < blkSize; x++)
out[x] = dcCoeff;
}
}
@ -334,12 +334,12 @@ void IndeoDSP::ff_ivi_dc_haar_2d(const int32 *in, int16 *out, uint32 pitch,
d3 = COMPENSATE(t3);\
d4 = COMPENSATE(t4);}
void IndeoDSP::ff_ivi_inverse_slant_8x8(const int32 *in, int16 *out, uint32 pitch, const uint8 *flags) {
int i;
void IndeoDSP::ffIviInverseSlant8x8(const int32 *in, int16 *out, uint32 pitch, const uint8 *flags) {
int i;
const int32 *src;
int32 *dst;
int tmp[64];
int t0, t1, t2, t3, t4, t5, t6, t7, t8;
int32 * dst;
int tmp[64];
int t0, t1, t2, t3, t4, t5, t6, t7, t8;
#define COMPENSATE(x) (x)
src = in;
@ -374,12 +374,12 @@ void IndeoDSP::ff_ivi_inverse_slant_8x8(const int32 *in, int16 *out, uint32 pitc
#undef COMPENSATE
}
void IndeoDSP::ff_ivi_inverse_slant_4x4(const int32 *in, int16 *out, uint32 pitch, const uint8 *flags) {
int i;
void IndeoDSP::ffIviInverseSlant4x4(const int32 *in, int16 *out, uint32 pitch, const uint8 *flags) {
int i;
const int32 *src;
int32 *dst;
int tmp[16];
int t0, t1, t2, t3, t4;
int32 * dst;
int tmp[16];
int t0, t1, t2, t3, t4;
#define COMPENSATE(x) (x)
src = in;
@ -413,23 +413,23 @@ void IndeoDSP::ff_ivi_inverse_slant_4x4(const int32 *in, int16 *out, uint32 pitc
#undef COMPENSATE
}
void IndeoDSP::ff_ivi_dc_slant_2d(const int32 *in, int16 *out, uint32 pitch,
int blk_size) {
int x, y;
int16 dc_coeff;
void IndeoDSP::ffIviDcSlant2d(const int32 *in, int16 *out, uint32 pitch,
int blkSize) {
int x, y;
int16 dcCoeff;
dc_coeff = (*in + 1) >> 1;
dcCoeff = (*in + 1) >> 1;
for (y = 0; y < blk_size; out += pitch, y++) {
for (x = 0; x < blk_size; x++)
out[x] = dc_coeff;
for (y = 0; y < blkSize; out += pitch, y++) {
for (x = 0; x < blkSize; x++)
out[x] = dcCoeff;
}
}
void IndeoDSP::ff_ivi_row_slant8(const int32 *in, int16 *out, uint32 pitch,
void IndeoDSP::ffIviRowSlant8(const int32 *in, int16 *out, uint32 pitch,
const uint8 *flags) {
int i;
int t0, t1, t2, t3, t4, t5, t6, t7, t8;
int i;
int t0, t1, t2, t3, t4, t5, t6, t7, t8;
#define COMPENSATE(x) (((x) + 1)>>1)
for (i = 0; i < 8; i++) {
@ -446,26 +446,26 @@ void IndeoDSP::ff_ivi_row_slant8(const int32 *in, int16 *out, uint32 pitch,
#undef COMPENSATE
}
void IndeoDSP::ff_ivi_dc_row_slant(const int32 *in, int16 *out, uint32 pitch, int blk_size) {
int x, y;
int16 dc_coeff;
void IndeoDSP::ffIviDcRowSlant(const int32 *in, int16 *out, uint32 pitch, int blkSize) {
int x, y;
int16 dcCoeff;
dc_coeff = (*in + 1) >> 1;
dcCoeff = (*in + 1) >> 1;
for (x = 0; x < blk_size; x++)
out[x] = dc_coeff;
for (x = 0; x < blkSize; x++)
out[x] = dcCoeff;
out += pitch;
for (y = 1; y < blk_size; out += pitch, y++) {
for (x = 0; x < blk_size; x++)
for (y = 1; y < blkSize; out += pitch, y++) {
for (x = 0; x < blkSize; x++)
out[x] = 0;
}
}
void IndeoDSP::ff_ivi_col_slant8(const int32 *in, int16 *out, uint32 pitch, const uint8 *flags) {
int i, row2, row4, row8;
int t0, t1, t2, t3, t4, t5, t6, t7, t8;
void IndeoDSP::ffIviColSlant8(const int32 *in, int16 *out, uint32 pitch, const uint8 *flags) {
int i, row2, row4, row8;
int t0, t1, t2, t3, t4, t5, t6, t7, t8;
row2 = pitch << 1;
row4 = pitch << 2;
@ -489,23 +489,23 @@ void IndeoDSP::ff_ivi_col_slant8(const int32 *in, int16 *out, uint32 pitch, cons
#undef COMPENSATE
}
void IndeoDSP::ff_ivi_dc_col_slant(const int32 *in, int16 *out, uint32 pitch, int blk_size) {
int x, y;
int16 dc_coeff;
void IndeoDSP::ffIviDcColSlant(const int32 *in, int16 *out, uint32 pitch, int blkSize) {
int x, y;
int16 dcCoeff;
dc_coeff = (*in + 1) >> 1;
dcCoeff = (*in + 1) >> 1;
for (y = 0; y < blk_size; out += pitch, y++) {
out[0] = dc_coeff;
for (x = 1; x < blk_size; x++)
for (y = 0; y < blkSize; out += pitch, y++) {
out[0] = dcCoeff;
for (x = 1; x < blkSize; x++)
out[x] = 0;
}
}
void IndeoDSP::ff_ivi_row_slant4(const int32 *in, int16 *out,
void IndeoDSP::ffIviRowSlant4(const int32 *in, int16 *out,
uint32 pitch, const uint8 *flags) {
int i;
int t0, t1, t2, t3, t4;
int i;
int t0, t1, t2, t3, t4;
#define COMPENSATE(x) (((x) + 1)>>1)
for (i = 0; i < 4; i++) {
@ -522,10 +522,10 @@ void IndeoDSP::ff_ivi_row_slant4(const int32 *in, int16 *out,
#undef COMPENSATE
}
void IndeoDSP::ff_ivi_col_slant4(const int32 *in, int16 *out, uint32 pitch,
void IndeoDSP::ffIviColSlant4(const int32 *in, int16 *out, uint32 pitch,
const uint8 *flags) {
int i, row2;
int t0, t1, t2, t3, t4;
int i, row2;
int t0, t1, t2, t3, t4;
row2 = pitch << 1;
@ -545,18 +545,18 @@ void IndeoDSP::ff_ivi_col_slant4(const int32 *in, int16 *out, uint32 pitch,
#undef COMPENSATE
}
void IndeoDSP::ff_ivi_put_pixels_8x8(const int32 *in, int16 *out, uint32 pitch,
void IndeoDSP::ffIviPutPixels8x8(const int32 *in, int16 *out, uint32 pitch,
const uint8 *flags) {
int x, y;
int x, y;
for (y = 0; y < 8; out += pitch, in += 8, y++)
for (x = 0; x < 8; x++)
out[x] = in[x];
}
void IndeoDSP::ff_ivi_put_dc_pixel_8x8(const int32 *in, int16 *out, uint32 pitch,
int blk_size) {
int y;
void IndeoDSP::ffIviPutDcPixel8x8(const int32 *in, int16 *out, uint32 pitch,
int blkSize) {
int y;
out[0] = in[0];
memset(out + 1, 0, 7*sizeof(out[0]));
@ -567,60 +567,60 @@ void IndeoDSP::ff_ivi_put_dc_pixel_8x8(const int32 *in, int16 *out, uint32 pitch
}
#define IVI_MC_TEMPLATE(size, suffix, OP) \
static void ivi_mc_ ## size ##x## size ## suffix(int16 *buf, \
static void iviMc ## size ##x## size ## suffix(int16 *buf, \
uint32 dpitch, \
const int16 *ref_buf, \
uint32 pitch, int mc_type) \
const int16 *refBuf, \
uint32 pitch, int mcType) \
{ \
int i, j; \
int i, j; \
const int16 *wptr; \
\
switch (mc_type) { \
switch (mcType) { \
case 0: /* fullpel (no interpolation) */ \
for (i = 0; i < size; i++, buf += dpitch, ref_buf += pitch) { \
for (i = 0; i < size; i++, buf += dpitch, refBuf += pitch) { \
for (j = 0; j < size; j++) {\
OP(buf[j], ref_buf[j]); \
OP(buf[j], refBuf[j]); \
} \
} \
break; \
case 1: /* horizontal halfpel interpolation */ \
for (i = 0; i < size; i++, buf += dpitch, ref_buf += pitch) \
for (i = 0; i < size; i++, buf += dpitch, refBuf += pitch) \
for (j = 0; j < size; j++) \
OP(buf[j], (ref_buf[j] + ref_buf[j+1]) >> 1); \
OP(buf[j], (refBuf[j] + refBuf[j+1]) >> 1); \
break; \
case 2: /* vertical halfpel interpolation */ \
wptr = ref_buf + pitch; \
for (i = 0; i < size; i++, buf += dpitch, wptr += pitch, ref_buf += pitch) \
wptr = refBuf + pitch; \
for (i = 0; i < size; i++, buf += dpitch, wptr += pitch, refBuf += pitch) \
for (j = 0; j < size; j++) \
OP(buf[j], (ref_buf[j] + wptr[j]) >> 1); \
OP(buf[j], (refBuf[j] + wptr[j]) >> 1); \
break; \
case 3: /* vertical and horizontal halfpel interpolation */ \
wptr = ref_buf + pitch; \
for (i = 0; i < size; i++, buf += dpitch, wptr += pitch, ref_buf += pitch) \
wptr = refBuf + pitch; \
for (i = 0; i < size; i++, buf += dpitch, wptr += pitch, refBuf += pitch) \
for (j = 0; j < size; j++) \
OP(buf[j], (ref_buf[j] + ref_buf[j+1] + wptr[j] + wptr[j+1]) >> 2); \
OP(buf[j], (refBuf[j] + refBuf[j+1] + wptr[j] + wptr[j+1]) >> 2); \
break; \
} \
} \
\
void IndeoDSP::ff_ivi_mc_ ## size ##x## size ## suffix(int16 *buf, const int16 *ref_buf, \
uint32 pitch, int mc_type) \
void IndeoDSP::ffIviMc ## size ##x## size ## suffix(int16 *buf, const int16 *refBuf, \
uint32 pitch, int mcType) \
{ \
ivi_mc_ ## size ##x## size ## suffix(buf, pitch, ref_buf, pitch, mc_type); \
iviMc ## size ##x## size ## suffix(buf, pitch, refBuf, pitch, mcType); \
}
#define IVI_MC_AVG_TEMPLATE(size, suffix, OP) \
void IndeoDSP::ff_ivi_mc_avg_ ## size ##x## size ## suffix(int16 *buf, \
const int16 *ref_buf, \
const int16 *ref_buf2, \
void IndeoDSP::ffIviMcAvg ## size ##x## size ## suffix(int16 *buf, \
const int16 *refBuf, \
const int16 *refBuf2, \
uint32 pitch, \
int mc_type, int mc_type2) \
int mcType, int mcType2) \
{ \
int16 tmp[size * size]; \
int i, j; \
\
ivi_mc_ ## size ##x## size ## _no_delta(tmp, size, ref_buf, pitch, mc_type); \
ivi_mc_ ## size ##x## size ## _delta(tmp, size, ref_buf2, pitch, mc_type2); \
iviMc ## size ##x## size ## NoDelta(tmp, size, refBuf, pitch, mcType); \
iviMc ## size ##x## size ## Delta(tmp, size, refBuf2, pitch, mcType2); \
for (i = 0; i < size; i++, buf += pitch) { \
for (j = 0; j < size; j++) {\
OP(buf[j], tmp[i * size + j] >> 1); \
@ -631,14 +631,14 @@ void IndeoDSP::ff_ivi_mc_avg_ ## size ##x## size ## suffix(int16 *buf, \
#define OP_PUT(a, b) (a) = (b)
#define OP_ADD(a, b) (a) += (b)
IVI_MC_TEMPLATE(8, _no_delta, OP_PUT)
IVI_MC_TEMPLATE(8, _delta, OP_ADD)
IVI_MC_TEMPLATE(4, _no_delta, OP_PUT)
IVI_MC_TEMPLATE(4, _delta, OP_ADD)
IVI_MC_AVG_TEMPLATE(8, _no_delta, OP_PUT)
IVI_MC_AVG_TEMPLATE(8, _delta, OP_ADD)
IVI_MC_AVG_TEMPLATE(4, _no_delta, OP_PUT)
IVI_MC_AVG_TEMPLATE(4, _delta, OP_ADD)
IVI_MC_TEMPLATE(8, NoDelta, OP_PUT)
IVI_MC_TEMPLATE(8, Delta, OP_ADD)
IVI_MC_TEMPLATE(4, NoDelta, OP_PUT)
IVI_MC_TEMPLATE(4, Delta, OP_ADD)
IVI_MC_AVG_TEMPLATE(8, NoDelta, OP_PUT)
IVI_MC_AVG_TEMPLATE(8, Delta, OP_ADD)
IVI_MC_AVG_TEMPLATE(4, NoDelta, OP_PUT)
IVI_MC_AVG_TEMPLATE(4, Delta, OP_ADD)
} // End of namespace Indeo
} // End of namespace Image

View File

@ -43,293 +43,293 @@ public:
/**
* two-dimensional inverse Haar 8x8 transform for Indeo 4
*
* @param[in] in pointer to the vector of transform coefficients
* @param[out] out pointer to the output buffer (frame)
* @param[in] pitch pitch to move to the next y line
* @param[in] flags pointer to the array of column flags:
* != 0 - non_empty column, 0 - empty one
* (this array must be filled by caller)
* @param[in] in Pointer to the vector of transform coefficients
* @param[out] out Pointer to the output buffer (frame)
* @param[in] pitch Pitch to move to the next y line
* @param[in] flags Pointer to the array of column flags:
* != 0 - non_empty column, 0 - empty one
* (this array must be filled by caller)
*/
static void ff_ivi_inverse_haar_8x8(const int32 *in, int16 *out, uint32 pitch,
const uint8 *flags);
static void ff_ivi_inverse_haar_8x1(const int32 *in, int16 *out, uint32 pitch,
const uint8 *flags);
static void ff_ivi_inverse_haar_1x8(const int32 *in, int16 *out, uint32 pitch,
const uint8 *flags);
static void ffIviInverseHaar8x8(const int32 *in, int16 *out, uint32 pitch,
const uint8 *flags);
static void ffIviInverseHaar8x1(const int32 *in, int16 *out, uint32 pitch,
const uint8 *flags);
static void ffIviInverseHaar1x8(const int32 *in, int16 *out, uint32 pitch,
const uint8 *flags);
/**
* one-dimensional inverse 8-point Haar transform on rows for Indeo 4
*
* @param[in] in pointer to the vector of transform coefficients
* @param[out] out pointer to the output buffer (frame)
* @param[in] pitch pitch to move to the next y line
* @param[in] flags pointer to the array of column flags:
* != 0 - non_empty column, 0 - empty one
* (this array must be filled by caller)
* @param[in] in Pointer to the vector of transform coefficients
* @param[out] out Pointer to the output buffer (frame)
* @param[in] pitch Pitch to move to the next y line
* @param[in] flags Pointer to the array of column flags:
* != 0 - non_empty column, 0 - empty one
* (this array must be filled by caller)
*/
static void ff_ivi_row_haar8(const int32 *in, int16 *out, uint32 pitch,
const uint8 *flags);
static void ffIviRowHaar8(const int32 *in, int16 *out, uint32 pitch,
const uint8 *flags);
/**
* one-dimensional inverse 8-point Haar transform on columns for Indeo 4
*
* @param[in] in pointer to the vector of transform coefficients
* @param[out] out pointer to the output buffer (frame)
* @param[in] pitch pitch to move to the next y line
* @param[in] flags pointer to the array of column flags:
* != 0 - non_empty column, 0 - empty one
* (this array must be filled by caller)
* @param[in] in Pointer to the vector of transform coefficients
* @param[out] out Pointer to the output buffer (frame)
* @param[in] pitch Pitch to move to the next y line
* @param[in] flags Pointer to the array of column flags:
* != 0 - non_empty column, 0 - empty one
* (this array must be filled by caller)
*/
static void ff_ivi_col_haar8(const int32 *in, int16 *out, uint32 pitch,
const uint8 *flags);
static void ffIviColHaar8(const int32 *in, int16 *out, uint32 pitch,
const uint8 *flags);
/**
* two-dimensional inverse Haar 4x4 transform for Indeo 4
*
* @param[in] in pointer to the vector of transform coefficients
* @param[out] out pointer to the output buffer (frame)
* @param[in] pitch pitch to move to the next y line
* @param[in] flags pointer to the array of column flags:
* != 0 - non_empty column, 0 - empty one
* (this array must be filled by caller)
* @param[in] in Pointer to the vector of transform coefficients
* @param[out] out Pointer to the output buffer (frame)
* @param[in] pitch Pitch to move to the next y line
* @param[in] flags Pointer to the array of column flags:
* != 0 - non_empty column, 0 - empty one
* (this array must be filled by caller)
*/
static void ff_ivi_inverse_haar_4x4(const int32 *in, int16 *out, uint32 pitch,
const uint8 *flags);
static void ffIviInverseHaar4x4(const int32 *in, int16 *out, uint32 pitch,
const uint8 *flags);
/**
* one-dimensional inverse 4-point Haar transform on rows for Indeo 4
*
* @param[in] in pointer to the vector of transform coefficients
* @param[out] out pointer to the output buffer (frame)
* @param[in] pitch pitch to move to the next y line
* @param[in] flags pointer to the array of column flags:
* != 0 - non_empty column, 0 - empty one
* (this array must be filled by caller)
* @param[in] in Pointer to the vector of transform coefficients
* @param[out] out Pointer to the output buffer (frame)
* @param[in] pitch Pitch to move to the next y line
* @param[in] flags Pointer to the array of column flags:
* != 0 - non_empty column, 0 - empty one
* (this array must be filled by caller)
*/
static void ff_ivi_row_haar4(const int32 *in, int16 *out, uint32 pitch,
const uint8 *flags);
static void ffIviRowHaar4(const int32 *in, int16 *out, uint32 pitch,
const uint8 *flags);
/**
* one-dimensional inverse 4-point Haar transform on columns for Indeo 4
*
* @param[in] in pointer to the vector of transform coefficients
* @param[out] out pointer to the output buffer (frame)
* @param[in] pitch pitch to move to the next y line
* @param[in] flags pointer to the array of column flags:
* != 0 - non_empty column, 0 - empty one
* (this array must be filled by caller)
* @param[in] in Pointer to the vector of transform coefficients
* @param[out] out Pointer to the output buffer (frame)
* @param[in] pitch Pitch to move to the next y line
* @param[in] flags Pointer to the array of column flags:
* != 0 - non_empty column, 0 - empty one
* (this array must be filled by caller)
*/
static void ff_ivi_col_haar4(const int32 *in, int16 *out, uint32 pitch,
static void ffIviColHaar4(const int32 *in, int16 *out, uint32 pitch,
const uint8 *flags);
/**
* DC-only two-dimensional inverse Haar transform for Indeo 4.
* Performing the inverse transform in this case is equivalent to
* spreading DC_coeff >> 3 over the whole block.
* spreading dcCoeff >> 3 over the whole block.
*
* @param[in] in pointer to the dc coefficient
* @param[out] out pointer to the output buffer (frame)
* @param[in] pitch pitch to move to the next y line
* @param[in] blk_size transform block size
* @param[in] in Pointer to the dc coefficient
* @param[out] out Pointer to the output buffer (frame)
* @param[in] pitch Pitch to move to the next y line
* @param[in] blkSize Transform block size
*/
static void ff_ivi_dc_haar_2d(const int32 *in, int16 *out, uint32 pitch,
int blk_size);
static void ffIviDcHaar2d(const int32 *in, int16 *out, uint32 pitch,
int blkSize);
/**
* two-dimensional inverse slant 8x8 transform
*
* @param[in] in pointer to the vector of transform coefficients
* @param[out] out pointer to the output buffer (frame)
* @param[in] pitch pitch to move to the next y line
* @param[in] flags pointer to the array of column flags:
* != 0 - non_empty column, 0 - empty one
* (this array must be filled by caller)
* @param[in] in Pointer to the vector of transform coefficients
* @param[out] out Pointer to the output buffer (frame)
* @param[in] pitch Pitch to move to the next y line
* @param[in] flags Pointer to the array of column flags:
* != 0 - non_empty column, 0 - empty one
* (this array must be filled by caller)
*/
static void ff_ivi_inverse_slant_8x8(const int32 *in, int16 *out, uint32 pitch,
const uint8 *flags);
static void ffIviInverseSlant8x8(const int32 *in, int16 *out, uint32 pitch,
const uint8 *flags);
/**
* two-dimensional inverse slant 4x4 transform
*
* @param[in] in pointer to the vector of transform coefficients
* @param[out] out pointer to the output buffer (frame)
* @param[in] pitch pitch to move to the next y line
* @param[in] flags pointer to the array of column flags:
* != 0 - non_empty column, 0 - empty one
* (this array must be filled by caller)
* @param[in] in Pointer to the vector of transform coefficients
* @param[out] out Pointer to the output buffer (frame)
* @param[in] pitch Pitch to move to the next y line
* @param[in] flags Pointer to the array of column flags:
* != 0 - non_empty column, 0 - empty one
* (this array must be filled by caller)
*/
static void ff_ivi_inverse_slant_4x4(const int32 *in, int16 *out, uint32 pitch,
const uint8 *flags);
static void ffIviInverseSlant4x4(const int32 *in, int16 *out, uint32 pitch,
const uint8 *flags);
/**
* DC-only two-dimensional inverse slant transform.
* Performing the inverse slant transform in this case is equivalent to
* spreading (DC_coeff + 1)/2 over the whole block.
* spreading (dcCoeff + 1)/2 over the whole block.
* It works much faster than performing the slant transform on a vector of zeroes.
*
* @param[in] in pointer to the dc coefficient
* @param[out] out pointer to the output buffer (frame)
* @param[in] pitch pitch to move to the next y line
* @param[in] blk_size transform block size
* @param[in] in Pointer to the dc coefficient
* @param[out] out Pointer to the output buffer (frame)
* @param[in] pitch Pitch to move to the next y line
* @param[in] blkSize Transform block size
*/
static void ff_ivi_dc_slant_2d(const int32 *in, int16 *out, uint32 pitch, int blk_size);
static void ffIviDcSlant2d(const int32 *in, int16 *out, uint32 pitch, int blkSize);
/**
* inverse 1D row slant transform
*
* @param[in] in pointer to the vector of transform coefficients
* @param[out] out pointer to the output buffer (frame)
* @param[in] pitch pitch to move to the next y line
* @param[in] flags pointer to the array of column flags (unused here)
* @param[in] in Pointer to the vector of transform coefficients
* @param[out] out Pointer to the output buffer (frame)
* @param[in] pitch Pitch to move to the next y line
* @param[in] flags Pointer to the array of column flags (unused here)
*/
static void ff_ivi_row_slant8(const int32 *in, int16 *out, uint32 pitch,
const uint8 *flags);
static void ffIviRowSlant8(const int32 *in, int16 *out, uint32 pitch,
const uint8 *flags);
/**
* inverse 1D column slant transform
*
* @param[in] in pointer to the vector of transform coefficients
* @param[out] out pointer to the output buffer (frame)
* @param[in] pitch pitch to move to the next y line
* @param[in] flags pointer to the array of column flags:
* != 0 - non_empty column, 0 - empty one
* (this array must be filled by caller)
* @param[in] in Pointer to the vector of transform coefficients
* @param[out] out Pointer to the output buffer (frame)
* @param[in] pitch Pitch to move to the next y line
* @param[in] flags Pointer to the array of column flags:
* != 0 - non_empty column, 0 - empty one
* (this array must be filled by caller)
*/
static void ff_ivi_col_slant8(const int32 *in, int16 *out, uint32 pitch,
const uint8 *flags);
static void ffIviColSlant8(const int32 *in, int16 *out, uint32 pitch,
const uint8 *flags);
/**
* inverse 1D row slant transform
*
* @param[in] in pointer to the vector of transform coefficients
* @param[out] out pointer to the output buffer (frame)
* @param[in] pitch pitch to move to the next y line
* @param[in] flags pointer to the array of column flags (unused here)
* @param[in] in Pointer to the vector of transform coefficients
* @param[out] out Pointer to the output buffer (frame)
* @param[in] pitch Pitch to move to the next y line
* @param[in] flags Pointer to the array of column flags (unused here)
*/
static void ff_ivi_row_slant4(const int32 *in, int16 *out, uint32 pitch,
const uint8 *flags);
static void ffIviRowSlant4(const int32 *in, int16 *out, uint32 pitch,
const uint8 *flags);
/**
* inverse 1D column slant transform
*
* @param[in] in pointer to the vector of transform coefficients
* @param[out] out pointer to the output buffer (frame)
* @param[in] pitch pitch to move to the next y line
* @param[in] flags pointer to the array of column flags:
* != 0 - non_empty column, 0 - empty one
* (this array must be filled by caller)
* @param[in] in Pointer to the vector of transform coefficients
* @param[out] out Pointer to the output buffer (frame)
* @param[in] pitch Pitch to move to the next y line
* @param[in] flags Pointer to the array of column flags:
* != 0 - non_empty column, 0 - empty one
* (this array must be filled by caller)
*/
static void ff_ivi_col_slant4(const int32 *in, int16 *out, uint32 pitch,
const uint8 *flags);
static void ffIviColSlant4(const int32 *in, int16 *out, uint32 pitch,
const uint8 *flags);
/**
* DC-only inverse row slant transform
*/
static void ff_ivi_dc_row_slant(const int32 *in, int16 *out, uint32 pitch, int blk_size);
static void ffIviDcRowSlant(const int32 *in, int16 *out, uint32 pitch, int blkSize);
/**
* DC-only inverse column slant transform
*/
static void ff_ivi_dc_col_slant(const int32 *in, int16 *out, uint32 pitch, int blk_size);
static void ffIviDcColSlant(const int32 *in, int16 *out, uint32 pitch, int blkSize);
/**
* Copy the pixels into the frame buffer.
*/
static void ff_ivi_put_pixels_8x8(const int32 *in, int16 *out, uint32 pitch, const uint8 *flags);
static void ffIviPutPixels8x8(const int32 *in, int16 *out, uint32 pitch, const uint8 *flags);
/**
* Copy the DC coefficient into the first pixel of the block and
* zero all others.
*/
static void ff_ivi_put_dc_pixel_8x8(const int32 *in, int16 *out, uint32 pitch, int blk_size);
static void ffIviPutDcPixel8x8(const int32 *in, int16 *out, uint32 pitch, int blkSize);
/**
* 8x8 block motion compensation with adding delta
*
* @param[in,out] buf pointer to the block in the current frame buffer containing delta
* @param[in] ref_buf pointer to the corresponding block in the reference frame
* @param[in] pitch pitch for moving to the next y line
* @param[in] mc_type interpolation type
* @param[in,out] buf Pointer to the block in the current frame buffer containing delta
* @param[in] refBuf Pointer to the corresponding block in the reference frame
* @param[in] pitch Pitch for moving to the next y line
* @param[in] mcType Interpolation type
*/
static void ff_ivi_mc_8x8_delta(int16 *buf, const int16 *ref_buf, uint32 pitch, int mc_type);
static void ffIviMc8x8Delta(int16 *buf, const int16 *refBuf, uint32 pitch, int mcType);
/**
* 4x4 block motion compensation with adding delta
*
* @param[in,out] buf pointer to the block in the current frame buffer containing delta
* @param[in] ref_buf pointer to the corresponding block in the reference frame
* @param[in] pitch pitch for moving to the next y line
* @param[in] mc_type interpolation type
* @param[in,out] buf Pointer to the block in the current frame buffer containing delta
* @param[in] refBuf Pointer to the corresponding block in the reference frame
* @param[in] pitch Pitch for moving to the next y line
* @param[in] mcType Interpolation type
*/
static void ff_ivi_mc_4x4_delta(int16 *buf, const int16 *ref_buf, uint32 pitch, int mc_type);
static void ffIviMc4x4Delta(int16 *buf, const int16 *refBuf, uint32 pitch, int mcType);
/**
* motion compensation without adding delta
*
* @param[in,out] buf pointer to the block in the current frame receiving the result
* @param[in] ref_buf pointer to the corresponding block in the reference frame
* @param[in] pitch pitch for moving to the next y line
* @param[in] mc_type interpolation type
* @param[in,out] buf Pointer to the block in the current frame buffer containing delta
* @param[in] refBuf Pointer to the corresponding block in the reference frame
* @param[in] pitch Pitch for moving to the next y line
* @param[in] mcType Interpolation type
*/
static void ff_ivi_mc_8x8_no_delta(int16 *buf, const int16 *ref_buf, uint32 pitch, int mc_type);
static void ffIviMc8x8NoDelta(int16 *buf, const int16 *refBuf, uint32 pitch, int mcType);
/**
* 4x4 block motion compensation without adding delta
*
* @param[in,out] buf pointer to the block in the current frame receiving the result
* @param[in] ref_buf pointer to the corresponding block in the reference frame
* @param[in] pitch pitch for moving to the next y line
* @param[in] mc_type interpolation type
* @param[in,out] buf Pointer to the block in the current frame receiving the result
* @param[in] refBuf Pointer to the corresponding block in the reference frame
* @param[in] pitch Pitch for moving to the next y line
* @param[in] mcType Interpolation type
*/
static void ff_ivi_mc_4x4_no_delta(int16 *buf, const int16 *ref_buf, uint32 pitch, int mc_type);
static void ffIviMc4x4NoDelta(int16 *buf, const int16 *refBuf, uint32 pitch, int mcType);
/**
* 8x8 block motion compensation with adding delta
*
* @param[in,out] buf pointer to the block in the current frame buffer containing delta
* @param[in] ref_buf pointer to the corresponding block in the backward reference frame
* @param[in] ref_buf2 pointer to the corresponding block in the forward reference frame
* @param[in] pitch pitch for moving to the next y line
* @param[in] mc_type interpolation type for backward reference
* @param[in] mc_type2 interpolation type for forward reference
* @param[in,out] buf Pointer to the block in the current frame buffer containing delta
* @param[in] refBuf Pointer to the corresponding block in the backward reference frame
* @param[in] refBuf2 Pointer to the corresponding block in the forward reference frame
* @param[in] pitch Pitch for moving to the next y line
* @param[in] mcType Interpolation type for backward reference
* @param[in] mcType2 Interpolation type for forward reference
*/
static void ff_ivi_mc_avg_8x8_delta(int16 *buf, const int16 *ref_buf, const int16 *ref_buf2, uint32 pitch, int mc_type, int mc_type2);
static void ffIviMcAvg8x8Delta(int16 *buf, const int16 *refBuf, const int16 *refBuf2, uint32 pitch, int mcType, int mcType2);
/**
* 4x4 block motion compensation with adding delta
*
* @param[in,out] buf pointer to the block in the current frame buffer containing delta
* @param[in] ref_buf pointer to the corresponding block in the backward reference frame
* @param[in] ref_buf2 pointer to the corresponding block in the forward reference frame
* @param[in] pitch pitch for moving to the next y line
* @param[in] mc_type interpolation type for backward reference
* @param[in] mc_type2 interpolation type for forward reference
* @param[in,out] buf Pointer to the block in the current frame buffer containing delta
* @param[in] refBuf Pointer to the corresponding block in the backward reference frame
* @param[in] refBuf2 Pointer to the corresponding block in the forward reference frame
* @param[in] pitch Pitch for moving to the next y line
* @param[in] mcType Interpolation type for backward reference
* @param[in] mcType2 Interpolation type for forward reference
*/
static void ff_ivi_mc_avg_4x4_delta(int16 *buf, const int16 *ref_buf, const int16 *ref_buf2, uint32 pitch, int mc_type, int mc_type2);
static void ffIviMcAvg4x4Delta(int16 *buf, const int16 *refBuf, const int16 *refBuf2, uint32 pitch, int mcType, int mcType2);
/**
* motion compensation without adding delta for B-frames
*
* @param[in,out] buf pointer to the block in the current frame receiving the result
* @param[in] ref_buf pointer to the corresponding block in the backward reference frame
* @param[in] ref_buf2 pointer to the corresponding block in the forward reference frame
* @param[in] pitch pitch for moving to the next y line
* @param[in] mc_type interpolation type for backward reference
* @param[in] mc_type2 interpolation type for forward reference
* @param[in,out] buf Pointer to the block in the current frame buffer containing delta
* @param[in] refBuf Pointer to the corresponding block in the backward reference frame
* @param[in] refBuf2 Pointer to the corresponding block in the forward reference frame
* @param[in] pitch Pitch for moving to the next y line
* @param[in] mcType Interpolation type for backward reference
* @param[in] mcType2 Interpolation type for forward reference
*/
static void ff_ivi_mc_avg_8x8_no_delta(int16 *buf, const int16 *ref_buf, const int16 *ref_buf2, uint32 pitch, int mc_type, int mc_type2);
static void ffIviMcAvg8x8NoDelta(int16 *buf, const int16 *refBuf, const int16 *refBuf2, uint32 pitch, int mcType, int mcType2);
/**
* 4x4 block motion compensation without adding delta for B-frames
*
* @param[in,out] buf pointer to the block in the current frame receiving the result
* @param[in] ref_buf pointer to the corresponding block in the backward reference frame
* @param[in] ref_buf2 pointer to the corresponding block in the forward reference frame
* @param[in] pitch pitch for moving to the next y line
* @param[in] mc_type interpolation type for backward reference
* @param[in] mc_type2 interpolation type for forward reference
* @param[in,out] buf Pointer to the block in the current frame buffer containing delta
* @param[in] refBuf Pointer to the corresponding block in the backward reference frame
* @param[in] refBuf2 Pointer to the corresponding block in the forward reference frame
* @param[in] pitch Pitch for moving to the next y line
* @param[in] mcType Interpolation type for backward reference
* @param[in] mcType2 Interpolation type for forward reference
*/
static void ff_ivi_mc_avg_4x4_no_delta(int16 *buf, const int16 *ref_buf, const int16 *ref_buf2, uint32 pitch, int mc_type, int mc_type2);
static void ffIviMcAvg4x4NoDelta(int16 *buf, const int16 *refBuf, const int16 *refBuf2, uint32 pitch, int mcType, int mcType2);
};
} // End of namespace Indeo

View File

@ -31,7 +31,7 @@
namespace Image {
namespace Indeo {
const uint8 ff_reverse[256] = {
const uint8 ffReverse[256] = {
0x00, 0x80, 0x40, 0xC0, 0x20, 0xA0, 0x60, 0xE0, 0x10, 0x90, 0x50, 0xD0, 0x30, 0xB0, 0x70, 0xF0,
0x08, 0x88, 0x48, 0xC8, 0x28, 0xA8, 0x68, 0xE8, 0x18, 0x98, 0x58, 0xD8, 0x38, 0xB8, 0x78, 0xF8,
0x04, 0x84, 0x44, 0xC4, 0x24, 0xA4, 0x64, 0xE4, 0x14, 0x94, 0x54, 0xD4, 0x34, 0xB4, 0x74, 0xF4,
@ -50,6 +50,17 @@ const uint8 ff_reverse[256] = {
0x0F, 0x8F, 0x4F, 0xCF, 0x2F, 0xAF, 0x6F, 0xEF, 0x1F, 0x9F, 0x5F, 0xDF, 0x3F, 0xBF, 0x7F, 0xFF,
};
const uint8 ffZigZagDirect[64] = {
0, 1, 8, 16, 9, 2, 3, 10,
17, 24, 32, 25, 18, 11, 4, 5,
12, 19, 26, 33, 40, 48, 41, 34,
27, 20, 13, 6, 7, 14, 21, 28,
35, 42, 49, 56, 57, 50, 43, 36,
29, 22, 15, 23, 30, 37, 44, 51,
58, 59, 52, 45, 38, 31, 39, 46,
53, 60, 61, 54, 47, 55, 62, 63
};
/*------------------------------------------------------------------------*/
/**
@ -59,7 +70,7 @@ const uint8 ff_reverse[256] = {
* @param[out] r Pointer to the result of the operation
* @return 0 on success, AVERROR(EINVAL) on overflow
*/
static inline int av_size_mult(size_t a, size_t b, size_t *r) {
static inline int avSizeMult(size_t a, size_t b, size_t *r) {
size_t t = a * b;
// Hack inspired from glibc: don't try the division if nelem and elsize
@ -72,56 +83,56 @@ static inline int av_size_mult(size_t a, size_t b, size_t *r) {
/*------------------------------------------------------------------------*/
void *av_malloc(size_t size) {
void *avMalloc(size_t size) {
return malloc(size);
}
void *av_mallocz(size_t size) {
void *ptr = av_malloc(size);
void *avMallocZ(size_t size) {
void *ptr = avMalloc(size);
if (ptr)
memset(ptr, 0, size);
return ptr;
}
void *av_malloc_array(size_t nmemb, size_t size) {
void *avMallocArray(size_t nmemb, size_t size) {
if (!size || nmemb >= MAX_INTEGER / size)
return nullptr;
return malloc(nmemb * size);
}
void *av_mallocz_array(size_t nmemb, size_t size) {
void *avMallocZArray(size_t nmemb, size_t size) {
if (!size || nmemb >= MAX_INTEGER / size)
return NULL;
return av_mallocz(nmemb * size);
return avMallocZ(nmemb * size);
}
void av_free(void *ptr) {
void avFree(void *ptr) {
free(ptr);
}
void av_freep(void *arg) {
void avFreeP(void *arg) {
void **ptr = (void **)arg;
free(*ptr);
*ptr = nullptr;
}
static void *av_realloc(void *ptr, size_t size) {
static void *avRealloc(void *ptr, size_t size) {
return realloc(ptr, size + !size);
}
void *av_realloc_f(void *ptr, size_t nelem, size_t elsize) {
void *avReallocF(void *ptr, size_t nelem, size_t elsize) {
size_t size;
void *r;
if (av_size_mult(elsize, nelem, &size)) {
av_free(ptr);
if (avSizeMult(elsize, nelem, &size)) {
avFree(ptr);
return nullptr;
}
r = av_realloc(ptr, size);
r = avRealloc(ptr, size);
if (!r)
av_free(ptr);
avFree(ptr);
return r;
}
@ -130,53 +141,39 @@ void *av_realloc_f(void *ptr, size_t nelem, size_t elsize) {
/**
* Swap the order of the bytes in the passed value
*/
uint32 bitswap_32(uint32 x) {
return (uint32)ff_reverse[x & 0xFF] << 24 |
(uint32)ff_reverse[(x >> 8) & 0xFF] << 16 |
(uint32)ff_reverse[(x >> 16) & 0xFF] << 8 |
(uint32)ff_reverse[x >> 24];
uint32 bitswap32(uint32 x) {
return (uint32)ffReverse[x & 0xFF] << 24 |
(uint32)ffReverse[(x >> 8) & 0xFF] << 16 |
(uint32)ffReverse[(x >> 16) & 0xFF] << 8 |
(uint32)ffReverse[x >> 24];
}
/**
* Reverse "nbits" bits of the value "val" and return the result
* in the least significant bits.
*/
uint16 inv_bits(uint16 val, int nbits) {
uint16 invertBits(uint16 val, int nbits) {
uint16 res;
if (nbits <= 8) {
res = ff_reverse[val] >> (8 - nbits);
res = ffReverse[val] >> (8 - nbits);
} else {
res = ((ff_reverse[val & 0xFF] << 8) +
(ff_reverse[val >> 8])) >> (16 - nbits);
res = ((ffReverse[val & 0xFF] << 8) +
(ffReverse[val >> 8])) >> (16 - nbits);
}
return res;
}
uint8 av_clip_uint8(int a) {
uint8 avClipUint8(int a) {
if (a&(~0xFF)) return (-a) >> 31;
else return a;
}
unsigned av_clip_uintp2(int a, int p) {
unsigned avClipUintp2(int a, int p) {
if (a & ~((1 << p) - 1)) return -a >> 31 & ((1 << p) - 1);
else return a;
}
/*------------------------------------------------------------------------*/
const uint8 ff_zigzag_direct[64] = {
0, 1, 8, 16, 9, 2, 3, 10,
17, 24, 32, 25, 18, 11, 4, 5,
12, 19, 26, 33, 40, 48, 41, 34,
27, 20, 13, 6, 7, 14, 21, 28,
35, 42, 49, 56, 57, 50, 43, 36,
29, 22, 15, 23, 30, 37, 44, 51,
58, 59, 52, 45, 38, 31, 39, 46,
53, 60, 61, 54, 47, 55, 62, 63
};
} // End of namespace Indeo
} // End of namespace Image

View File

@ -49,7 +49,7 @@ namespace Indeo {
* be allocated
* @see av_mallocz()
*/
extern void *av_malloc(size_t size);
extern void *avMalloc(size_t size);
/**
* Allocate a memory block with alignment suitable for all memory accesses
@ -60,7 +60,7 @@ extern void *av_malloc(size_t size);
* @return Pointer to the allocated block, or `NULL` if it cannot be allocated
* @see av_malloc()
*/
extern void *av_mallocz(size_t size);
extern void *avMallocZ(size_t size);
/**
* Allocate a memory block for an array with av_malloc().
@ -73,7 +73,7 @@ extern void *av_mallocz(size_t size);
* be allocated
* @see av_malloc()
*/
extern void *av_malloc_array(size_t nmemb, size_t size);
extern void *avMallocArray(size_t nmemb, size_t size);
/**
* Allocate a memory block for an array with av_mallocz().
@ -88,7 +88,7 @@ extern void *av_malloc_array(size_t nmemb, size_t size);
* @see av_mallocz()
* @see av_malloc_array()
*/
extern void *av_mallocz_array(size_t nmemb, size_t size);
extern void *avMallocZArray(size_t nmemb, size_t size);
/**
* Free a memory block which has been allocated with a function of av_malloc()
@ -101,7 +101,7 @@ extern void *av_mallocz_array(size_t nmemb, size_t size);
* behind dangling pointers.
* @see av_freep()
*/
extern void av_free(void *ptr);
extern void avFree(void *ptr);
/**
* Free a memory block which has been allocated with a function of av_malloc()
@ -110,7 +110,7 @@ extern void av_free(void *ptr);
* @param ptr Pointer to the pointer to the memory block which should be freed
* @note `*ptr = NULL` is safe and leads to no action.
*/
extern void av_freep(void *arg);
extern void avFreeP(void *arg);
/**
@ -128,25 +128,25 @@ extern void av_freep(void *arg);
* @endcode
* pattern.
*/
extern void *av_realloc_f(void *ptr, size_t nelem, size_t elsize);
extern void *avReallocF(void *ptr, size_t nelem, size_t elsize);
/**
* Reverse "nbits" bits of the value "val" and return the result
* in the least significant bits.
*/
extern uint16 inv_bits(uint16 val, int nbits);
extern uint16 invertBits(uint16 val, int nbits);
/**
* Swap the order of the bytes in the passed value
*/
extern uint32 bitswap_32(uint32 x);
extern uint32 bitswap32(uint32 x);
/**
* Clip a signed integer value into the 0-255 range.
* @param a value to clip
* @return clipped value
*/
extern uint8 av_clip_uint8(int a);
extern uint8 avClipUint8(int a);
/**
* Clip a signed integer to an unsigned power of two range.
@ -154,7 +154,7 @@ extern uint8 av_clip_uint8(int a);
* @param p bit position to clip at
* @return clipped value
*/
extern unsigned av_clip_uintp2(int a, int p);
extern unsigned avClipUintp2(int a, int p);
/**
* Clip a signed integer value into the amin-amax range.
@ -165,9 +165,7 @@ extern unsigned av_clip_uintp2(int a, int p);
*/
#define av_clip CLIP
/*------------------------------------------------------------------------*/
extern const uint8 ff_zigzag_direct[64];
extern const uint8 ffZigZagDirect[64];
} // End of namespace Indeo
} // End of namespace Image

View File

@ -123,7 +123,7 @@ namespace Image {
return -1; \
} \
if (flags & INIT_VLC_LE) \
buf[j].code = bitswap_32(buf[j].code); \
buf[j].code = bitswap32(buf[j].code); \
else \
buf[j].code <<= 32 - buf[j].bits; \
if (symbols) \
@ -165,7 +165,7 @@ int VLC::init_vlc(int nb_bits, int nb_codes, const void *p_bits, int bits_wrap,
vlc->_table_allocated = 0;
vlc->_table_size = 0;
buf = (VLCcode *)av_malloc_array((nb_codes + 1), sizeof(VLCcode));
buf = (VLCcode *)avMallocArray((nb_codes + 1), sizeof(VLCcode));
assert(buf);
}
@ -190,7 +190,7 @@ int VLC::init_vlc(int nb_bits, int nb_codes, const void *p_bits, int bits_wrap,
} else {
free(buf);
if (ret < 0) {
av_freep(&vlc->_table);
avFreeP(&vlc->_table);
return -1;
}
}
@ -237,7 +237,7 @@ int VLC::build_table(int table_nb_bits, int nb_codes,
nb = 1 << (table_nb_bits - n);
inc = 1;
if (flags & INIT_VLC_LE) {
j = bitswap_32(code);
j = bitswap32(code);
inc = 1 << n;
}
for (k = 0; k < nb; k++) {
@ -272,7 +272,7 @@ int VLC::build_table(int table_nb_bits, int nb_codes,
subtable_bits = MAX(subtable_bits, n);
}
subtable_bits = MIN(subtable_bits, table_nb_bits);
j = (flags & INIT_VLC_LE) ? bitswap_32(code_prefix) >> (32 - table_nb_bits) : code_prefix;
j = (flags & INIT_VLC_LE) ? bitswap32(code_prefix) >> (32 - table_nb_bits) : code_prefix;
table[j][1] = -subtable_bits;
//warning("%4x: n=%d (subtable)", j, codes[i].bits + table_nb_bits);
index = vlc->build_table(subtable_bits, k - i, codes + i, flags);
@ -304,7 +304,7 @@ int VLC::alloc_table(int size, int use_static) {
assert(!use_static);
vlc->_table_allocated += (1 << vlc->_bits);
vlc->_table = (int16(*)[2])av_realloc_f(vlc->_table, vlc->_table_allocated, sizeof(VLC_TYPE) * 2);
vlc->_table = (int16(*)[2])avReallocF(vlc->_table, vlc->_table_allocated, sizeof(VLC_TYPE) * 2);
if (!vlc->_table) {
vlc->_table_allocated = 0;
vlc->_table_size = 0;

View File

@ -624,22 +624,22 @@ int Indeo4Decoder::decodePlaneSubdivision() {
/**
* Indeo 4 8x8 scan (zigzag) patterns
*/
static const uint8 ivi4_alternate_scan_8x8[64] = {
static const uint8 ivi4AlternateScan8x8[64] = {
0, 8, 1, 9, 16, 24, 2, 3, 17, 25, 10, 11, 32, 40, 48, 56,
4, 5, 6, 7, 33, 41, 49, 57, 18, 19, 26, 27, 12, 13, 14, 15,
34, 35, 43, 42, 50, 51, 59, 58, 20, 21, 22, 23, 31, 30, 29, 28,
36, 37, 38, 39, 47, 46, 45, 44, 52, 53, 54, 55, 63, 62, 61, 60
};
static const uint8 ivi4_alternate_scan_4x4[16] = {
static const uint8 ivi4AlternateScan4x4[16] = {
0, 1, 4, 5, 8, 12, 2, 3, 9, 13, 6, 7, 10, 11, 14, 15
};
static const uint8 ivi4_vertical_scan_4x4[16] = {
static const uint8 ivi4VerticalScan4x4[16] = {
0, 4, 8, 12, 1, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15
};
static const uint8 ivi4_horizontal_scan_4x4[16] = {
static const uint8 ivi4HorizontalScan4x4[16] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
};
@ -648,47 +648,47 @@ const uint Indeo4Decoder::_ivi4_common_pic_sizes[14] = {
};
Indeo4Decoder::Transform Indeo4Decoder::_transforms[18] = {
{ IndeoDSP::ff_ivi_inverse_haar_8x8, IndeoDSP::ff_ivi_dc_haar_2d, 1 },
{ IndeoDSP::ff_ivi_row_haar8, IndeoDSP::ff_ivi_dc_haar_2d, 0 },
{ IndeoDSP::ff_ivi_col_haar8, IndeoDSP::ff_ivi_dc_haar_2d, 0 },
{ IndeoDSP::ff_ivi_put_pixels_8x8, IndeoDSP::ff_ivi_put_dc_pixel_8x8, 1 },
{ IndeoDSP::ff_ivi_inverse_slant_8x8, IndeoDSP::ff_ivi_dc_slant_2d, 1 },
{ IndeoDSP::ff_ivi_row_slant8, IndeoDSP::ff_ivi_dc_row_slant, 1 },
{ IndeoDSP::ff_ivi_col_slant8, IndeoDSP::ff_ivi_dc_col_slant, 1 },
{ IndeoDSP::ffIviInverseHaar8x8, IndeoDSP::ffIviDcHaar2d, 1 },
{ IndeoDSP::ffIviRowHaar8, IndeoDSP::ffIviDcHaar2d, 0 },
{ IndeoDSP::ffIviColHaar8, IndeoDSP::ffIviDcHaar2d, 0 },
{ IndeoDSP::ffIviPutPixels8x8, IndeoDSP::ffIviPutDcPixel8x8, 1 },
{ IndeoDSP::ffIviInverseSlant8x8, IndeoDSP::ffIviDcSlant2d, 1 },
{ IndeoDSP::ffIviRowSlant8, IndeoDSP::ffIviDcRowSlant, 1 },
{ IndeoDSP::ffIviColSlant8, IndeoDSP::ffIviDcColSlant, 1 },
{ NULL, NULL, 0 }, // inverse DCT 8x8
{ NULL, NULL, 0 }, // inverse DCT 8x1
{ NULL, NULL, 0 }, // inverse DCT 1x8
{ IndeoDSP::ff_ivi_inverse_haar_4x4, IndeoDSP::ff_ivi_dc_haar_2d, 1 },
{ IndeoDSP::ff_ivi_inverse_slant_4x4, IndeoDSP::ff_ivi_dc_slant_2d, 1 },
{ IndeoDSP::ffIviInverseHaar4x4, IndeoDSP::ffIviDcHaar2d, 1 },
{ IndeoDSP::ffIviInverseSlant4x4, IndeoDSP::ffIviDcSlant2d, 1 },
{ NULL, NULL, 0 }, // no transform 4x4
{ IndeoDSP::ff_ivi_row_haar4, IndeoDSP::ff_ivi_dc_haar_2d, 0 },
{ IndeoDSP::ff_ivi_col_haar4, IndeoDSP::ff_ivi_dc_haar_2d, 0 },
{ IndeoDSP::ff_ivi_row_slant4, IndeoDSP::ff_ivi_dc_row_slant, 0 },
{ IndeoDSP::ff_ivi_col_slant4, IndeoDSP::ff_ivi_dc_col_slant, 0 },
{ IndeoDSP::ffIviRowHaar4, IndeoDSP::ffIviDcHaar2d, 0 },
{ IndeoDSP::ffIviColHaar4, IndeoDSP::ffIviDcHaar2d, 0 },
{ IndeoDSP::ffIviRowSlant4, IndeoDSP::ffIviDcRowSlant, 0 },
{ IndeoDSP::ffIviColSlant4, IndeoDSP::ffIviDcColSlant, 0 },
{ NULL, NULL, 0 }, // inverse DCT 4x4
};
const uint8 *const Indeo4Decoder::_scan_index_to_tab[15] = {
// for 8x8 transforms
ff_zigzag_direct,
ivi4_alternate_scan_8x8,
_ff_ivi_horizontal_scan_8x8,
_ff_ivi_vertical_scan_8x8,
ff_zigzag_direct,
ffZigZagDirect,
ivi4AlternateScan8x8,
_ffIviHorizontalScan8x8,
_ffIviVerticalScan8x8,
ffZigZagDirect,
// for 4x4 transforms
_ff_ivi_direct_scan_4x4,
ivi4_alternate_scan_4x4,
ivi4_vertical_scan_4x4,
ivi4_horizontal_scan_4x4,
_ff_ivi_direct_scan_4x4,
_ffIviDirectScan4x4,
ivi4AlternateScan4x4,
ivi4VerticalScan4x4,
ivi4HorizontalScan4x4,
_ffIviDirectScan4x4,
// TODO: check if those are needed
_ff_ivi_horizontal_scan_8x8,
_ff_ivi_horizontal_scan_8x8,
_ff_ivi_horizontal_scan_8x8,
_ff_ivi_horizontal_scan_8x8,
_ff_ivi_horizontal_scan_8x8
_ffIviHorizontalScan8x8,
_ffIviHorizontalScan8x8,
_ffIviHorizontalScan8x8,
_ffIviHorizontalScan8x8,
_ffIviHorizontalScan8x8
};
/**

View File

@ -425,8 +425,8 @@ int Indeo5Decoder::decode_gop_header() {
picConf._picHeight = _ctx._gb->getBits(13);
picConf._picWidth = _ctx._gb->getBits(13);
} else {
picConf._picHeight = _ivi5_common_pic_sizes[picSizeIndx * 2 + 1] << 2;
picConf._picWidth = _ivi5_common_pic_sizes[picSizeIndx * 2] << 2;
picConf._picHeight = _commonPicSizes[picSizeIndx * 2 + 1] << 2;
picConf._picWidth = _commonPicSizes[picSizeIndx * 2] << 2;
}
if (_ctx._gopFlags & 2) {
@ -485,43 +485,43 @@ int Indeo5Decoder::decode_gop_header() {
// select transform function and scan pattern according to plane and band number
switch ((p << 2) + i) {
case 0:
band->_invTransform = IndeoDSP::ff_ivi_inverse_slant_8x8;
band->_dcTransform = IndeoDSP::ff_ivi_dc_slant_2d;
band->_scan = ff_zigzag_direct;
band->_invTransform = IndeoDSP::ffIviInverseSlant8x8;
band->_dcTransform = IndeoDSP::ffIviDcSlant2d;
band->_scan = ffZigZagDirect;
band->_transformSize = 8;
break;
case 1:
band->_invTransform = IndeoDSP::ff_ivi_row_slant8;
band->_dcTransform = IndeoDSP::ff_ivi_dc_row_slant;
band->_scan = _ff_ivi_vertical_scan_8x8;
band->_invTransform = IndeoDSP::ffIviRowSlant8;
band->_dcTransform = IndeoDSP::ffIviDcRowSlant;
band->_scan = _ffIviVerticalScan8x8;
band->_transformSize = 8;
break;
case 2:
band->_invTransform = IndeoDSP::ff_ivi_col_slant8;
band->_dcTransform = IndeoDSP::ff_ivi_dc_col_slant;
band->_scan = _ff_ivi_horizontal_scan_8x8;
band->_invTransform = IndeoDSP::ffIviColSlant8;
band->_dcTransform = IndeoDSP::ffIviDcColSlant;
band->_scan = _ffIviHorizontalScan8x8;
band->_transformSize = 8;
break;
case 3:
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->_invTransform = IndeoDSP::ffIviPutPixels8x8;
band->_dcTransform = IndeoDSP::ffIviPutDcPixel8x8;
band->_scan = _ffIviHorizontalScan8x8;
band->_transformSize = 8;
break;
case 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->_invTransform = IndeoDSP::ffIviInverseSlant4x4;
band->_dcTransform = IndeoDSP::ffIviDcSlant2d;
band->_scan = _ffIviDirectScan4x4;
band->_transformSize = 4;
break;
}
band->_is2dTrans = band->_invTransform == IndeoDSP::ff_ivi_inverse_slant_8x8 ||
band->_invTransform == IndeoDSP::ff_ivi_inverse_slant_4x4;
band->_is2dTrans = band->_invTransform == IndeoDSP::ffIviInverseSlant8x8 ||
band->_invTransform == IndeoDSP::ffIviInverseSlant4x4;
if (band->_transformSize != band->_blkSize) {
warning("transform and block size mismatch (%d != %d)", band->_transformSize, band->_blkSize);
@ -540,15 +540,15 @@ int Indeo5Decoder::decode_gop_header() {
warning("_quantMat %d too large!", quantMat);
return -1;
}
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];
band->_intraBase = &_baseQuant8x8Intra[quantMat][0];
band->_interBase = &_baseQuant8x8Inter[quantMat][0];
band->_intraScale = &_scaleQuant8x8Intra[quantMat][0];
band->_interScale = &_scaleQuant8x8Inter[quantMat][0];
} else {
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;
band->_intraBase = _baseQuant4x4Intra;
band->_interBase = _baseQuant4x4Inter;
band->_intraScale = _scaleQuant4x4Intra;
band->_interScale = _scaleQuant4x4Inter;
}
if (_ctx._gb->getBits(2)) {
@ -631,17 +631,12 @@ int Indeo5Decoder::skip_hdr_extension() {
/*------------------------------------------------------------------------*/
const uint8 Indeo5Decoder::_ivi5_common_pic_sizes[30] = {
const uint8 Indeo5Decoder::_commonPicSizes[30] = {
160, 120, 80, 60, 40, 30, 176, 120, 88, 60, 88, 72, 44, 36, 60, 45, 160, 60,
176, 60, 20, 15, 22, 18, 0, 0, 0, 0, 0, 0
};
const uint8 Indeo5Decoder::ivi5_common_pic_sizes[30] = {
160, 120, 80, 60, 40, 30, 176, 120, 88, 60, 88, 72, 44, 36, 60, 45, 160, 60,
176, 60, 20, 15, 22, 18, 0, 0, 0, 0, 0, 0
};
const uint16 Indeo5Decoder::_ivi5_base_quant_8x8_inter[5][64] = {
const uint16 Indeo5Decoder::_baseQuant8x8Inter[5][64] = {
{0x26, 0x3a, 0x3e, 0x46, 0x4a, 0x4e, 0x52, 0x5a, 0x3a, 0x3e, 0x42, 0x46, 0x4a, 0x4e, 0x56, 0x5e,
0x3e, 0x42, 0x46, 0x48, 0x4c, 0x52, 0x5a, 0x62, 0x46, 0x46, 0x48, 0x4a, 0x4e, 0x56, 0x5e, 0x66,
0x4a, 0x4a, 0x4c, 0x4e, 0x52, 0x5a, 0x62, 0x6a, 0x4e, 0x4e, 0x52, 0x56, 0x5a, 0x5e, 0x66, 0x6e,
@ -669,7 +664,7 @@ const uint16 Indeo5Decoder::_ivi5_base_quant_8x8_inter[5][64] = {
}
};
const uint16 Indeo5Decoder::_ivi5_base_quant_8x8_intra[5][64] = {
const uint16 Indeo5Decoder::_baseQuant8x8Intra[5][64] = {
{0x1a, 0x2e, 0x36, 0x42, 0x46, 0x4a, 0x4e, 0x5a, 0x2e, 0x32, 0x3e, 0x42, 0x46, 0x4e, 0x56, 0x6a,
0x36, 0x3e, 0x3e, 0x44, 0x4a, 0x54, 0x66, 0x72, 0x42, 0x42, 0x44, 0x4a, 0x52, 0x62, 0x6c, 0x7a,
0x46, 0x46, 0x4a, 0x52, 0x5e, 0x66, 0x72, 0x8e, 0x4a, 0x4e, 0x54, 0x62, 0x66, 0x6e, 0x86, 0xa6,
@ -697,16 +692,16 @@ const uint16 Indeo5Decoder::_ivi5_base_quant_8x8_intra[5][64] = {
}
};
const uint16 Indeo5Decoder::_ivi5_base_quant_4x4_inter[16] = {
const uint16 Indeo5Decoder::_baseQuant4x4Inter[16] = {
0x1e, 0x3e, 0x4a, 0x52, 0x3e, 0x4a, 0x52, 0x56, 0x4a, 0x52, 0x56, 0x5e, 0x52, 0x56, 0x5e, 0x66
};
const uint16 Indeo5Decoder::_ivi5_base_quant_4x4_intra[16] = {
const uint16 Indeo5Decoder::_baseQuant4x4Intra[16] = {
0x1e, 0x3e, 0x4a, 0x52, 0x3e, 0x4a, 0x52, 0x5e, 0x4a, 0x52, 0x5e, 0x7a, 0x52, 0x5e, 0x7a, 0x92
};
const uint8 Indeo5Decoder::_ivi5_scale_quant_8x8_inter[5][24] = {
const uint8 Indeo5Decoder::_scaleQuant8x8Inter[5][24] = {
{0x0b, 0x11, 0x13, 0x14, 0x15, 0x16, 0x18, 0x1a, 0x1b, 0x1d, 0x20, 0x22,
0x23, 0x25, 0x28, 0x2a, 0x2e, 0x32, 0x35, 0x39, 0x3d, 0x41, 0x44, 0x4a,
},
@ -724,7 +719,7 @@ const uint8 Indeo5Decoder::_ivi5_scale_quant_8x8_inter[5][24] = {
},
};
const uint8 Indeo5Decoder::_ivi5_scale_quant_8x8_intra[5][24] = {
const uint8 Indeo5Decoder::_scaleQuant8x8Intra[5][24] = {
{0x0b, 0x0e, 0x10, 0x12, 0x14, 0x16, 0x17, 0x18, 0x1a, 0x1c, 0x1e, 0x20,
0x22, 0x24, 0x27, 0x28, 0x2a, 0x2d, 0x2f, 0x31, 0x34, 0x37, 0x39, 0x3c,
},
@ -742,12 +737,12 @@ const uint8 Indeo5Decoder::_ivi5_scale_quant_8x8_intra[5][24] = {
}
};
const uint8 Indeo5Decoder::_ivi5_scale_quant_4x4_inter[24] = {
const uint8 Indeo5Decoder::_scaleQuant4x4Inter[24] = {
0x0b, 0x0d, 0x0d, 0x0e, 0x11, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23,
};
const uint8 Indeo5Decoder::_ivi5_scale_quant_4x4_intra[24] = {
const uint8 Indeo5Decoder::_scaleQuant4x4Intra[24] = {
0x01, 0x0b, 0x0b, 0x0d, 0x0d, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x13, 0x14,
0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20
};

View File

@ -112,12 +112,7 @@ private:
/**
* standard picture dimensions (width, height divided by 4)
*/
static const uint8 _ivi5_common_pic_sizes[30];
/**
* standard picture dimensions (width, height divided by 4)
*/
static const uint8 ivi5_common_pic_sizes[30];
static const uint8 _commonPicSizes[30];
/**
* Indeo5 dequantization matrixes consist of two tables: base table
@ -128,17 +123,17 @@ private:
* ivi5_base_quant_bbb_ttt - base tables for block size 'bbb' of type 'ttt'
* ivi5_scale_quant_bbb_ttt - scale tables for block size 'bbb' of type 'ttt'
*/
static const uint16 _ivi5_base_quant_8x8_inter[5][64];
static const uint16 _ivi5_base_quant_8x8_intra[5][64];
static const uint16 _baseQuant8x8Inter[5][64];
static const uint16 _baseQuant8x8Intra[5][64];
static const uint16 _ivi5_base_quant_4x4_inter[16];
static const uint16 _ivi5_base_quant_4x4_intra[16];
static const uint16 _baseQuant4x4Inter[16];
static const uint16 _baseQuant4x4Intra[16];
static const uint8 _ivi5_scale_quant_8x8_inter[5][24];
static const uint8 _ivi5_scale_quant_8x8_intra[5][24];
static const uint8 _scaleQuant8x8Inter[5][24];
static const uint8 _scaleQuant8x8Intra[5][24];
static const uint8 _ivi5_scale_quant_4x4_inter[24];
static const uint8 _ivi5_scale_quant_4x4_intra[24];
static const uint8 _scaleQuant4x4Inter[24];
static const uint8 _scaleQuant4x4Intra[24];
};
} // End of namespace Image