aboutsummaryrefslogtreecommitdiff
path: root/image/codecs
diff options
context:
space:
mode:
authorPaul Gilbert2016-09-10 10:43:23 -0400
committerPaul Gilbert2016-09-10 10:43:23 -0400
commit9c7b9e166746a903dc0b7e87967ec257967e1359 (patch)
tree4c7894550a9bb46d915cd3f22701041608b77100 /image/codecs
parenta6ffef9e26a10ddd23965fe2f6b5a7e7965fb22e (diff)
downloadscummvm-rg350-9c7b9e166746a903dc0b7e87967ec257967e1359.tar.gz
scummvm-rg350-9c7b9e166746a903dc0b7e87967ec257967e1359.tar.bz2
scummvm-rg350-9c7b9e166746a903dc0b7e87967ec257967e1359.zip
IMAGE: Compilation fixes for Indeo4 decoder
Diffstat (limited to 'image/codecs')
-rw-r--r--image/codecs/indeo/get_bits.cpp3
-rw-r--r--image/codecs/indeo/indeo.cpp4
-rw-r--r--image/codecs/indeo/indeo.h4
-rw-r--r--image/codecs/indeo/mem.cpp4
-rw-r--r--image/codecs/indeo/mem.h1
-rw-r--r--image/codecs/indeo4.cpp13
6 files changed, 15 insertions, 14 deletions
diff --git a/image/codecs/indeo/get_bits.cpp b/image/codecs/indeo/get_bits.cpp
index 60c82c4607..ade4baaa81 100644
--- a/image/codecs/indeo/get_bits.cpp
+++ b/image/codecs/indeo/get_bits.cpp
@@ -21,6 +21,7 @@
*/
#include "image/codecs/indeo/get_bits.h"
+#include "image/codecs/indeo/mem.h"
#include "common/algorithm.h"
#include "common/endian.h"
#include "common/textconsole.h"
@@ -158,7 +159,7 @@ static uint zeroExtend(uint val, uint bits) {
}
GetBits::GetBits(const byte *buffer, size_t totalBits) {
- assert(buffer && totalBits < (INT_MAX - 7));
+ assert(buffer && totalBits < (MAX_INTEGER - 7));
_buffer = buffer;
_sizeInBits = totalBits;
diff --git a/image/codecs/indeo/indeo.cpp b/image/codecs/indeo/indeo.cpp
index 69b9f4289b..2c11a09883 100644
--- a/image/codecs/indeo/indeo.cpp
+++ b/image/codecs/indeo/indeo.cpp
@@ -1304,7 +1304,7 @@ int IndeoDecoderBase::ivi_decode_coded_blocks(GetBits *gb, IVIBandDesc *band,
col_flags[pos & col_mask] |= !!val;
}
- if (scan_pos < 0 || scan_pos >= num_coeffs && sym != rvmap->eob_sym)
+ if (scan_pos < 0 || (scan_pos >= num_coeffs && sym != rvmap->eob_sym))
return -1; // corrupt block data
// undoing DC coeff prediction for intra-blocks
@@ -1348,7 +1348,7 @@ 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)) < (INT_MAX / 8))
+ if (((w + 128) * (uint64)(h + 128)) < (MAX_INTEGER / 8))
return 0;
error("Picture size %ux%u is invalid", w, h);
diff --git a/image/codecs/indeo/indeo.h b/image/codecs/indeo/indeo.h
index d9801202b4..a786995144 100644
--- a/image/codecs/indeo/indeo.h
+++ b/image/codecs/indeo/indeo.h
@@ -113,7 +113,7 @@ struct IVIHuffDesc {
void ivi_huff_desc_copy(const IVIHuffDesc *src);
};
-class IVI45DecContext;
+struct IVI45DecContext;
/**
* macroblock/block huffman table descriptor
@@ -341,7 +341,7 @@ struct AVFrame {
};
struct IVI45DecContext {
- friend class IVIHuffTab;
+ friend struct IVIHuffTab;
private:
VLC_TYPE table_data[8192 * 16][2];
VLC ivi_mb_vlc_tabs[8]; ///< static macroblock Huffman tables
diff --git a/image/codecs/indeo/mem.cpp b/image/codecs/indeo/mem.cpp
index 88085aebdf..9987415799 100644
--- a/image/codecs/indeo/mem.cpp
+++ b/image/codecs/indeo/mem.cpp
@@ -85,13 +85,13 @@ void *av_mallocz(size_t size) {
}
void *av_malloc_array(size_t nmemb, size_t size) {
- if (!size || nmemb >= INT_MAX / size)
+ if (!size || nmemb >= MAX_INTEGER / size)
return nullptr;
return malloc(nmemb * size);
}
void *av_mallocz_array(size_t nmemb, size_t size) {
- if (!size || nmemb >= INT_MAX / size)
+ if (!size || nmemb >= MAX_INTEGER / size)
return NULL;
return av_mallocz(nmemb * size);
diff --git a/image/codecs/indeo/mem.h b/image/codecs/indeo/mem.h
index d3755d652c..cc927e613a 100644
--- a/image/codecs/indeo/mem.h
+++ b/image/codecs/indeo/mem.h
@@ -38,6 +38,7 @@ namespace Indeo {
#define FFALIGN(x, a) (((x) + (a)-1) & ~((a)-1))
#define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0)
#define FFSIGN(a) ((a) > 0 ? 1 : -1)
+#define MAX_INTEGER 0x7ffffff
/**
* Allocate a memory block with alignment suitable for all memory accesses
diff --git a/image/codecs/indeo4.cpp b/image/codecs/indeo4.cpp
index 79874cd5a7..7e0a4516d1 100644
--- a/image/codecs/indeo4.cpp
+++ b/image/codecs/indeo4.cpp
@@ -317,7 +317,7 @@ int Indeo4Decoder::decode_band_hdr(IVIBandDesc *band) {
if (!_ctx.gb->getBits1() || _ctx.frame_type == IVI4_FRAMETYPE_INTRA) {
transform_id = _ctx.gb->getBits(5);
- if (transform_id >= FF_ARRAY_ELEMS(_transforms) ||
+ if ((uint)transform_id >= FF_ARRAY_ELEMS(_transforms) ||
!_transforms[transform_id].inv_trans) {
warning("Transform %d", transform_id);
return -3;
@@ -372,7 +372,7 @@ int Indeo4Decoder::decode_band_hdr(IVIBandDesc *band) {
warning("Custom quant matrix encountered!");
return -1;
}
- if (quant_mat >= FF_ARRAY_ELEMS(_quant_index_to_tab)) {
+ if ((uint)quant_mat >= FF_ARRAY_ELEMS(_quant_index_to_tab)) {
warning("Quantization matrix %d", quant_mat);
return -1;
}
@@ -523,8 +523,7 @@ int Indeo4Decoder::decode_mb_info(IVIBandDesc *band, IVITile *tile) {
mb->q_delta = 0;
if (band->inherit_qdelta) {
if (ref_mb) mb->q_delta = ref_mb->q_delta;
- }
- else if (mb->cbp || (!band->plane && !band->band_num &&
+ } else if (mb->cbp || (!band->plane && !band->band_num &&
_ctx.in_q)) {
mb->q_delta = _ctx.gb->getVLC2(_ctx.mb_vlc.tab->_table,
IVI_VLC_BITS, 1);
@@ -535,16 +534,16 @@ int Indeo4Decoder::decode_mb_info(IVIBandDesc *band, IVITile *tile) {
mb->mv_x = mb->mv_y = 0; // there is no motion vector in intra-macroblocks
} else {
if (band->inherit_mv) {
- if (ref_mb)
+ if (ref_mb) {
// motion vector inheritance
if (mv_scale) {
mb->mv_x = ivi_scale_mv(ref_mb->mv_x, mv_scale);
mb->mv_y = ivi_scale_mv(ref_mb->mv_y, mv_scale);
- }
- else {
+ } else {
mb->mv_x = ref_mb->mv_x;
mb->mv_y = ref_mb->mv_y;
}
+ }
} else {
// decode motion vector deltas
mv_delta = _ctx.gb->getVLC2(_ctx.mb_vlc.tab->_table,