aboutsummaryrefslogtreecommitdiff
path: root/image/codecs/indeo
diff options
context:
space:
mode:
authorPaul Gilbert2016-09-06 22:33:40 -0400
committerPaul Gilbert2016-09-10 10:08:15 -0400
commitc60a03019cb00649e19fa2c9baf289688237b90f (patch)
tree1da0bf5ade6ee80a636b47111b9d1a233fea28a2 /image/codecs/indeo
parent9e774af4d91cb3adddfb6acc2024653620e725db (diff)
downloadscummvm-rg350-c60a03019cb00649e19fa2c9baf289688237b90f.tar.gz
scummvm-rg350-c60a03019cb00649e19fa2c9baf289688237b90f.tar.bz2
scummvm-rg350-c60a03019cb00649e19fa2c9baf289688237b90f.zip
IMAGE: Cleanup and warning fixes for Indeo decoder
Diffstat (limited to 'image/codecs/indeo')
-rw-r--r--image/codecs/indeo/indeo.cpp32
-rw-r--r--image/codecs/indeo/indeo_dsp.cpp27
-rw-r--r--image/codecs/indeo/mem.cpp3
3 files changed, 36 insertions, 26 deletions
diff --git a/image/codecs/indeo/indeo.cpp b/image/codecs/indeo/indeo.cpp
index e530c5737a..f68609dc0d 100644
--- a/image/codecs/indeo/indeo.cpp
+++ b/image/codecs/indeo/indeo.cpp
@@ -396,6 +396,11 @@ IndeoDecoderBase::IndeoDecoderBase(uint16 width, uint16 height) : Codec() {
IndeoDecoderBase::~IndeoDecoderBase() {
delete _surface;
+ IVIPlaneDesc::ivi_free_buffers(_ctx.planes);
+ if (_ctx.mb_vlc.cust_tab.table)
+ _ctx.mb_vlc.cust_tab.ff_free_vlc();
+
+ delete _ctx.p_frame;
}
int IndeoDecoderBase::decodeIndeoFrame() {
@@ -512,8 +517,7 @@ int IndeoDecoderBase::decode_band(IVIBandDesc *band) {
if (_ctx.is_indeo4 && _ctx.frame_type == IVI4_FRAMETYPE_BIDIR) {
band->ref_buf = band->bufs[_ctx.b_ref_buf];
band->b_ref_buf = band->bufs[_ctx.ref_buf];
- }
- else {
+ } else {
band->ref_buf = band->bufs[_ctx.ref_buf];
band->b_ref_buf = 0;
}
@@ -533,7 +537,7 @@ int IndeoDecoderBase::decode_band(IVIBandDesc *band) {
band->rv_map = &_ctx.rvmap_tabs[band->rvmap_sel];
- /* apply corrections to the selected rvmap table if present */
+ // apply corrections to the selected rvmap table if present
for (i = 0; i < band->num_corr; i++) {
idx1 = band->corr[i * 2];
idx2 = band->corr[i * 2 + 1];
@@ -858,7 +862,7 @@ int IndeoDecoderBase::ivi_process_empty_tile(IVIBandDesc *band,
mb = tile->mbs;
ref_mb = tile->ref_mbs;
row_offset = band->mb_size * band->pitch;
- need_mc = 0; /* reset the mc tracking flag */
+ need_mc = 0; // reset the mc tracking flag
for (y = tile->ypos; y < (tile->ypos + tile->height); y += band->mb_size) {
mb_offset = offs;
@@ -868,8 +872,8 @@ int IndeoDecoderBase::ivi_process_empty_tile(IVIBandDesc *band,
mb->ypos = y;
mb->buf_offs = mb_offset;
- mb->type = 1; /* set the macroblocks type = INTER */
- mb->cbp = 0; /* all blocks are empty */
+ mb->type = 1; // set the macroblocks type = INTER
+ mb->cbp = 0; // all blocks are empty
if (!band->qdelta_present && !band->plane && !band->band_num) {
mb->q_delta = band->glob_quant;
@@ -881,7 +885,7 @@ int IndeoDecoderBase::ivi_process_empty_tile(IVIBandDesc *band,
mb->q_delta = ref_mb->q_delta;
if (band->inherit_mv && ref_mb) {
- /* motion vector inheritance */
+ // motion vector inheritance
if (mv_scale) {
mb->mv_x = ivi_scale_mv(ref_mb->mv_x, mv_scale);
mb->mv_y = ivi_scale_mv(ref_mb->mv_y, mv_scale);
@@ -889,7 +893,7 @@ int IndeoDecoderBase::ivi_process_empty_tile(IVIBandDesc *band,
mb->mv_x = ref_mb->mv_x;
mb->mv_y = ref_mb->mv_y;
}
- need_mc |= mb->mv_x || mb->mv_y; /* tracking non-zero motion vectors */
+ need_mc |= mb->mv_x || mb->mv_y; // tracking non-zero motion vectors
{
int dmv_x, dmv_y, cx, cy;
@@ -981,10 +985,10 @@ int IndeoDecoderBase::ivi_decode_blocks(GetBits *gb, IVIBandDesc *band, IVITile
ivi_mc_avg_func mc_avg_with_delta_func, mc_avg_no_delta_func;
const uint8 *scale_tab;
- /* init intra prediction for the DC coefficient */
+ // init intra prediction for the DC coefficient
prev_dc = 0;
blk_size = band->blk_size;
- /* number of blocks per mb */
+ // number of blocks per mb
num_blocks = (band->mb_size != blk_size) ? 4 : 1;
if (blk_size == 8) {
mc_with_delta_func = IndeoDSP::ff_ivi_mc_8x8_delta;
@@ -1024,7 +1028,7 @@ int IndeoDecoderBase::ivi_decode_blocks(GetBits *gb, IVIBandDesc *band, IVITile
mv_x >>= 1;
mv_y >>= 1;
mv_x2 >>= 1;
- mv_y2 >>= 1; /* convert halfpel vectors into fullpel ones */
+ mv_y2 >>= 1; // convert halfpel vectors into fullpel ones
}
if (mb->type == 2)
mc_type = -1;
@@ -1153,7 +1157,8 @@ int IndeoDecoderBase::ivi_decode_coded_blocks(GetBits *gb, IVIBandDesc *band,
RVMapDesc *rvmap = band->rv_map;
uint8 col_flags[8];
int32 trvec[64];
- uint32 sym = 0, lo, hi, q;
+ uint32 sym = 0, q;
+ int lo, hi;
int pos, run, val;
int blk_size = band->blk_size;
int num_coeffs = blk_size * blk_size;
@@ -1188,8 +1193,7 @@ int IndeoDecoderBase::ivi_decode_coded_blocks(GetBits *gb, IVIBandDesc *band,
hi = gb->getVLC2(band->blk_vlc.tab->table, IVI_VLC_BITS, 1);
// merge them and convert into signed val
val = IVI_TOSIGNED((hi << 6) | lo);
- }
- else {
+ } else {
if (sym >= 256U) {
warning("Invalid sym encountered");
return -1;
diff --git a/image/codecs/indeo/indeo_dsp.cpp b/image/codecs/indeo/indeo_dsp.cpp
index 88e078d5f1..f13ce91502 100644
--- a/image/codecs/indeo/indeo_dsp.cpp
+++ b/image/codecs/indeo/indeo_dsp.cpp
@@ -96,9 +96,10 @@ void IndeoDSP::ff_ivi_inverse_haar_8x8(const int32 *in, int16 *out, uint32 pitch
dst[ 0], dst[ 8], dst[16], dst[24],
dst[32], dst[40], dst[48], dst[56],
t0, t1, t2, t3, t4, t5, t6, t7, t8);
- } else
+ } else {
dst[ 0] = dst[ 8] = dst[16] = dst[24] =
dst[32] = dst[40] = dst[48] = dst[56] = 0;
+ }
src++;
dst++;
@@ -165,11 +166,12 @@ void IndeoDSP::ff_ivi_col_haar8(const int32 *in, int16 *out, uint32 pitch,
out[4 * pitch], out[5 * pitch],
out[6 * pitch], out[7 * pitch],
t0, t1, t2, t3, t4, t5, t6, t7, t8);
- } else
+ } else {
out[0 * pitch] = out[1 * pitch] =
out[2 * pitch] = out[3 * pitch] =
out[4 * pitch] = out[5 * pitch] =
out[6 * pitch] = out[7 * pitch] = 0;
+ }
in++;
out++;
@@ -198,8 +200,9 @@ void IndeoDSP::ff_ivi_inverse_haar_4x4(const int32 *in, int16 *out, uint32 pitch
INV_HAAR4( sp1, sp2, src[8], src[12],
dst[0], dst[4], dst[8], dst[12],
t0, t1, t2, t3, t4);
- } else
+ } else {
dst[0] = dst[4] = dst[8] = dst[12] = 0;
+ }
src++;
dst++;
@@ -257,9 +260,10 @@ void IndeoDSP::ff_ivi_col_haar4(const int32 *in, int16 *out, uint32 pitch,
out[0 * pitch], out[1 * pitch],
out[2 * pitch], out[3 * pitch],
t0, t1, t2, t3, t4);
- } else
+ } else {
out[0 * pitch] = out[1 * pitch] =
out[2 * pitch] = out[3 * pitch] = 0;
+ }
in++;
out++;
@@ -345,11 +349,12 @@ void IndeoDSP::ff_ivi_inverse_slant_8x8(const int32 *in, int16 *out, uint32 pitc
IVI_INV_SLANT8(src[0], src[8], src[16], src[24], src[32], src[40], src[48], src[56],
dst[0], dst[8], dst[16], dst[24], dst[32], dst[40], dst[48], dst[56],
t0, t1, t2, t3, t4, t5, t6, t7, t8);
- } else
+ } else {
dst[0] = dst[8] = dst[16] = dst[24] = dst[32] = dst[40] = dst[48] = dst[56] = 0;
+ }
- src++;
- dst++;
+ src++;
+ dst++;
}
#undef COMPENSATE
@@ -384,11 +389,11 @@ void IndeoDSP::ff_ivi_inverse_slant_4x4(const int32 *in, int16 *out, uint32 pitc
IVI_INV_SLANT4(src[0], src[4], src[8], src[12],
dst[0], dst[4], dst[8], dst[12],
t0, t1, t2, t3, t4);
- } else
+ } else {
dst[0] = dst[4] = dst[8] = dst[12] = 0;
-
- src++;
- dst++;
+ }
+ src++;
+ dst++;
}
#undef COMPENSATE
diff --git a/image/codecs/indeo/mem.cpp b/image/codecs/indeo/mem.cpp
index 53a3236cf6..88085aebdf 100644
--- a/image/codecs/indeo/mem.cpp
+++ b/image/codecs/indeo/mem.cpp
@@ -146,9 +146,10 @@ uint16 inv_bits(uint16 val, int nbits) {
if (nbits <= 8) {
res = ff_reverse[val] >> (8 - nbits);
- } else
+ } else {
res = ((ff_reverse[val & 0xFF] << 8) +
(ff_reverse[val >> 8])) >> (16 - nbits);
+ }
return res;
}