Fix msvc compiler warnings
There were a number of compiler warnings:
1. int16_t to uint8_t in recon_intra.c;
2. double to float conversions in psnrhvs.c
3. intptr_t to int in quantize.c
4. size_t to int32_t in decoder.c
Change-Id: Id95423b17779dcfa6cf39d9a90fe8cb8b910f5df
diff --git a/vp10/common/reconintra.c b/vp10/common/reconintra.c
index a942aa0..f257200 100644
--- a/vp10/common/reconintra.c
+++ b/vp10/common/reconintra.c
@@ -1240,14 +1240,16 @@
dst16[r * dst_stride + c] =
palette[map[(r + y) * stride + c + x]];
} else {
-#endif // CONFIG_VP9_HIGHBITDEPTH
for (r = 0; r < bs; ++r)
for (c = 0; c < bs; ++c)
- dst[r * dst_stride + c] = palette[map[(r + y) * stride + c + x]];
-#if CONFIG_VP9_HIGHBITDEPTH
+ dst[r * dst_stride + c] =
+ (uint8_t)(palette[map[(r + y) * stride + c + x]]);
}
+#else
+ for (r = 0; r < bs; ++r)
+ for (c = 0; c < bs; ++c)
+ dst[r * dst_stride + c] = palette[map[(r + y) * stride + c + x]];
#endif // CONFIG_VP9_HIGHBITDEPTH
-
return;
}
diff --git a/vp10/decoder/decoder.c b/vp10/decoder/decoder.c
index 90365a8..05a2539 100644
--- a/vp10/decoder/decoder.c
+++ b/vp10/decoder/decoder.c
@@ -526,7 +526,7 @@
sizes[i] = this_sz;
frame_sz_sum += this_sz;
}
- sizes[i] = data_sz - index_sz - frame_sz_sum;
+ sizes[i] = (uint32_t)(data_sz - index_sz - frame_sz_sum);
*count = frames;
}
}
diff --git a/vp10/encoder/quantize.c b/vp10/encoder/quantize.c
index 739a06d..66db396 100644
--- a/vp10/encoder/quantize.c
+++ b/vp10/encoder/quantize.c
@@ -62,11 +62,10 @@
const scan_order *sc) {
// obsolete skip_block
const int skip_block = 0;
-
(void)sc;
-
- vpx_quantize_dc(coeff_ptr, n_coeffs, skip_block, p->round, p->quant_fp[0],
- qcoeff_ptr, dqcoeff_ptr, pd->dequant[0], eob_ptr);
+ vpx_quantize_dc(coeff_ptr, (int)n_coeffs, skip_block, p->round,
+ p->quant_fp[0], qcoeff_ptr, dqcoeff_ptr, pd->dequant[0],
+ eob_ptr);
}
#if CONFIG_VP9_HIGHBITDEPTH
@@ -105,7 +104,7 @@
(void)sc;
- vpx_highbd_quantize_dc(coeff_ptr, n_coeffs, skip_block, p->round,
+ vpx_highbd_quantize_dc(coeff_ptr, (int)n_coeffs, skip_block, p->round,
p->quant_fp[0], qcoeff_ptr, dqcoeff_ptr,
pd->dequant[0], eob_ptr);
}
diff --git a/vp10/encoder/rdopt.c b/vp10/encoder/rdopt.c
index 3a1e89f..f83e50d 100644
--- a/vp10/encoder/rdopt.c
+++ b/vp10/encoder/rdopt.c
@@ -1350,8 +1350,8 @@
#if CONFIG_VP9_HIGHBITDEPTH
if (cpi->common.use_highbitdepth)
for (i = 0; i < k; ++i)
- mic->mbmi.palette_mode_info.palette_colors[i] =
- clip_pixel_highbd(round(centroids[i]), cpi->common.bit_depth);
+ pmi->palette_colors[i] = clip_pixel_highbd((int)round(centroids[i]),
+ cpi->common.bit_depth);
else
#endif // CONFIG_VP9_HIGHBITDEPTH
for (i = 0; i < k; ++i)
diff --git a/vpx_dsp/psnrhvs.c b/vpx_dsp/psnrhvs.c
index 9d1f6ee..b10f9f3 100644
--- a/vpx_dsp/psnrhvs.c
+++ b/vpx_dsp/psnrhvs.c
@@ -37,7 +37,7 @@
/* Normalized inverse quantization matrix for 8x8 DCT at the point of
* transparency. This is not the JPEG based matrix from the paper,
this one gives a slightly higher MOS agreement.*/
-static const float csf_y[8][8] = {
+static const double csf_y[8][8] = {
{1.6193873005, 2.2901594831, 2.08509755623, 1.48366094411, 1.00227514334,
0.678296995242, 0.466224900598, 0.3265091542},
{2.2901594831, 1.94321815382, 2.04793073064, 1.68731108984, 1.2305666963,
@@ -54,7 +54,7 @@
0.283006984131, 0.215017739696, 0.168869545842, 0.136153931001},
{0.3265091542, 0.436405793551, 0.372504254596, 0.295774038565,
0.226951348204, 0.17408067321, 0.136153931001, 0.109083846276}};
-static const float csf_cb420[8][8] = {
+static const double csf_cb420[8][8] = {
{1.91113096927, 2.46074210438, 1.18284184739, 1.14982565193, 1.05017074788,
0.898018824055, 0.74725392039, 0.615105596242},
{2.46074210438, 1.58529308355, 1.21363250036, 1.38190029285, 1.33100189972,
@@ -71,7 +71,7 @@
0.55002013668, 0.454353482512, 0.389234902883, 0.342353999733},
{0.615105596242, 0.830890433625, 0.731221236837, 0.608694761374,
0.495804539034, 0.407050308965, 0.342353999733, 0.295530605237}};
-static const float csf_cr420[8][8] = {
+static const double csf_cr420[8][8] = {
{2.03871978502, 2.62502345193, 1.26180942886, 1.11019789803, 1.01397751469,
0.867069376285, 0.721500455585, 0.593906509971},
{2.62502345193, 1.69112867013, 1.17180569821, 1.3342742857, 1.28513006198,
@@ -96,11 +96,11 @@
static double calc_psnrhvs(const unsigned char *_src, int _systride,
const unsigned char *_dst, int _dystride,
double _par, int _w, int _h, int _step,
- const float _csf[8][8]) {
- float ret;
+ const double _csf[8][8]) {
+ double ret;
int16_t dct_s[8 * 8], dct_d[8 * 8];
tran_low_t dct_s_coef[8 * 8], dct_d_coef[8 * 8];
- float mask[8][8];
+ double mask[8][8];
int pixels;
int x;
int y;
@@ -130,16 +130,16 @@
for (x = 0; x < _w - 7; x += _step) {
int i;
int j;
- float s_means[4];
- float d_means[4];
- float s_vars[4];
- float d_vars[4];
- float s_gmean = 0;
- float d_gmean = 0;
- float s_gvar = 0;
- float d_gvar = 0;
- float s_mask = 0;
- float d_mask = 0;
+ double s_means[4];
+ double d_means[4];
+ double s_vars[4];
+ double d_vars[4];
+ double s_gmean = 0;
+ double d_gmean = 0;
+ double s_gvar = 0;
+ double d_gvar = 0;
+ double s_mask = 0;
+ double d_mask = 0;
for (i = 0; i < 4; i++)
s_means[i] = d_means[i] = s_vars[i] = d_vars[i] = 0;
for (i = 0; i < 8; i++) {
@@ -194,7 +194,7 @@
s_mask = d_mask;
for (i = 0; i < 8; i++) {
for (j = 0; j < 8; j++) {
- float err;
+ double err;
err = fabs((float)(dct_s_coef[i * 8 + j] - dct_d_coef[i * 8 + j]));
if (i != 0 || j != 0)
err = err < s_mask / mask[i][j] ? 0 : err - s_mask / mask[i][j];