From 42f6df9da363dcca84ec55fb6bdd43e80db0ac6e Mon Sep 17 00:00:00 2001 From: James Zern Date: Mon, 4 Jun 2012 18:36:02 -0700 Subject: [PATCH] fix some implicit type conversion warnings Change-Id: I0653d10410c0d46f91fedad4c4dffa9c1de402cb --- src/dsp/lossless.c | 2 +- src/enc/alpha.c | 2 +- src/enc/vp8l.c | 16 ++++++++-------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/dsp/lossless.c b/src/dsp/lossless.c index e5a51ca7..3fab2630 100644 --- a/src/dsp/lossless.c +++ b/src/dsp/lossless.c @@ -132,7 +132,7 @@ float VP8LFastLog(int v) { } return kLogTable[v] + (log_cnt * LOG_2_BASE_E); } - return log(v); + return (float)log(v); } #endif diff --git a/src/enc/alpha.c b/src/enc/alpha.c index b7e4ce16..f6ddedef 100644 --- a/src/enc/alpha.c +++ b/src/enc/alpha.c @@ -86,7 +86,7 @@ static int EncodeLossless(const uint8_t* data, int width, int height, config.method = effort_level; // impact is very small // quality below 50 doesn't change things much (in speed and size). // quality above 80 can be very very slow. - config.quality = 40 + 10 * effort_level; + config.quality = 40 + 10.f * effort_level; VP8LBitWriterInit(&tmp_bw, (width * height) >> 3); ok = (VP8LEncodeStream(&config, &picture, &tmp_bw) == VP8_ENC_OK); diff --git a/src/enc/vp8l.c b/src/enc/vp8l.c index ee113273..9c72886e 100644 --- a/src/enc/vp8l.c +++ b/src/enc/vp8l.c @@ -97,7 +97,7 @@ static int AnalyzeAndCreatePalette(const uint32_t* const argb, int num_pix, return 1; } -static int AnalyzeEntropy(const uint32_t const *argb, int xsize, int ysize, +static int AnalyzeEntropy(const uint32_t* const argb, int xsize, int ysize, double* const nonpredicted_bits, double* const predicted_bits) { int i; @@ -707,12 +707,12 @@ static WebPEncodingError WriteImage(const WebPPicture* const pic, static WebPEncodingError AllocateTransformBuffer(VP8LEncoder* const enc, int width, int height) { WebPEncodingError err = VP8_ENC_OK; - const size_t tile_size = 1 << enc->transform_bits_; - const size_t image_size = height * width; - const size_t argb_scratch_size = (tile_size + 1) * width; + const int tile_size = 1 << enc->transform_bits_; + const size_t image_size = width * height; + const size_t argb_scratch_size = tile_size * width + width; const size_t transform_data_size = - VP8LSubSampleSize(height, enc->transform_bits_) * - VP8LSubSampleSize(width, enc->transform_bits_); + VP8LSubSampleSize(width, enc->transform_bits_) * + VP8LSubSampleSize(height, enc->transform_bits_); const size_t total_size = image_size + argb_scratch_size + transform_data_size; uint32_t* mem = (uint32_t*)malloc(total_size * sizeof(*mem)); @@ -865,7 +865,7 @@ WebPEncodingError VP8LEncodeStream(const WebPConfig* const config, const WebPPicture* const picture, VP8LBitWriter* const bw) { WebPEncodingError err = VP8_ENC_OK; - const int quality = config->quality; + const int quality = (int)config->quality; const int width = picture->width; const int height = picture->height; VP8LEncoder* const enc = VP8LEncoderNew(config, picture); @@ -997,7 +997,7 @@ int VP8LEncodeImage(const WebPConfig* const config, stats->PSNR[1] = 99.; stats->PSNR[2] = 99.; stats->PSNR[3] = 99.; - stats->coded_size = coded_size; + stats->coded_size = (int)coded_size; } if (picture->extra_info != NULL) {