From 40e374bbae97d7f3cf70aedb1390c0e896b8d555 Mon Sep 17 00:00:00 2001 From: Paul Wilkins Date: Thu, 13 Feb 2014 16:04:39 +0000 Subject: [PATCH] vp9_rdopt.c : Silence more V.S. compiler warnings. Change-Id: I151c6c9396b8ea1ce2e05b80359f60f0d38af138 --- vp9/encoder/vp9_rdopt.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c index f0a861d60..5fa3a3bc8 100644 --- a/vp9/encoder/vp9_rdopt.c +++ b/vp9/encoder/vp9_rdopt.c @@ -415,9 +415,10 @@ static void model_rd_from_var_lapndz(unsigned int var, unsigned int n, *dist = 0; } else { int d_q10, r_q10; - uint64_t xsq_q10_64 = + const uint64_t xsq_q10_64 = ((((uint64_t)qstep * qstep * n) << 10) + (var >> 1)) / var; - int xsq_q10 = xsq_q10_64 > MAX_XSQ_Q10 ? MAX_XSQ_Q10 : xsq_q10_64; + const int xsq_q10 = xsq_q10_64 > MAX_XSQ_Q10 ? + MAX_XSQ_Q10 : (int)xsq_q10_64; model_rd_norm(xsq_q10, &r_q10, &d_q10); *rate = (n * r_q10 + 2) >> 2; *dist = (var * (int64_t)d_q10 + 512) >> 10; @@ -844,6 +845,11 @@ static void choose_txfm_size_from_rd(VP9_COMP *cpi, MACROBLOCK *x, } } +static int64_t scaled_rd_cost(int rdmult, int rddiv, + int rate, int64_t dist, double scale) { + return (int64_t) (RDCOST(rdmult, rddiv, rate, dist) * scale); +} + static void choose_txfm_size_from_modelrd(VP9_COMP *cpi, MACROBLOCK *x, int (*r)[2], int *rate, int64_t *d, int64_t *distortion, @@ -881,10 +887,13 @@ static void choose_txfm_size_from_modelrd(VP9_COMP *cpi, MACROBLOCK *x, r[n][1] += vp9_cost_one(tx_probs[m]); } if (s[n]) { - rd[n][0] = rd[n][1] = RDCOST(x->rdmult, x->rddiv, s1, d[n]) * scale; + rd[n][0] = rd[n][1] = scaled_rd_cost(x->rdmult, x->rddiv, s1, d[n], + scale); } else { - rd[n][0] = RDCOST(x->rdmult, x->rddiv, r[n][0] + s0, d[n]) * scale; - rd[n][1] = RDCOST(x->rdmult, x->rddiv, r[n][1] + s0, d[n]) * scale; + rd[n][0] = scaled_rd_cost(x->rdmult, x->rddiv, r[n][0] + s0, d[n], + scale); + rd[n][1] = scaled_rd_cost(x->rdmult, x->rddiv, r[n][1] + s0, d[n], + scale); } if (rd[n][1] < best_rd) { best_rd = rd[n][1]; @@ -2905,8 +2914,8 @@ static int64_t handle_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, const unsigned int max_thresh = (cpi->allow_encode_breakout == ENCODE_BREAKOUT_LIMITED) ? 128 : 36000; // The encode_breakout input - const unsigned int min_thresh = ((x->encode_breakout << 4) > max_thresh) ? - max_thresh : (x->encode_breakout << 4); + const unsigned int min_thresh = + MIN(((unsigned int)x->encode_breakout << 4), max_thresh); // Calculate threshold according to dequant value. thresh_ac = (xd->plane[0].dequant[1] * xd->plane[0].dequant[1]) / 9;