]> granicus.if.org Git - libvpx/commitdiff
Resolve -Wshorten-64-to-32 warnings in prob.h.
authorAlex Converse <aconverse@google.com>
Thu, 28 Jul 2016 16:53:23 +0000 (09:53 -0700)
committerAlex Converse <aconverse@google.com>
Tue, 2 Aug 2016 22:40:23 +0000 (15:40 -0700)
Change-Id: I1244ee908d81467f0fc8a8fce979fc8077a325b4

vpx_dsp/prob.h

index 148116ed08994e5c0db84cd47f7a8acc51ea0077..3127a00bb9798f488d27991aa8c0d8a1a5f8b7cd 100644 (file)
@@ -47,11 +47,12 @@ static INLINE vpx_prob clip_prob(int p) {
   return (p > 255) ? 255 : (p < 1) ? 1 : p;
 }
 
-static INLINE vpx_prob get_prob(int num, int den) {
-  return (den == 0) ? 128u : clip_prob(((int64_t)num * 256 + (den >> 1)) / den);
+static INLINE vpx_prob get_prob(unsigned int num, unsigned int den) {
+  if (den == 0) return 128u;
+  return clip_prob((int)(((int64_t)num * 256 + (den >> 1)) / den));
 }
 
-static INLINE vpx_prob get_binary_prob(int n0, int n1) {
+static INLINE vpx_prob get_binary_prob(unsigned int n0, unsigned int n1) {
   return get_prob(n0, n0 + n1);
 }
 
@@ -83,8 +84,7 @@ static INLINE vpx_prob mode_mv_merge_probs(vpx_prob pre_prob,
   } else {
     const unsigned int count = VPXMIN(den, MODE_MV_COUNT_SAT);
     const unsigned int factor = count_to_update_factor[count];
-    const vpx_prob prob =
-        clip_prob(((int64_t)(ct[0]) * 256 + (den >> 1)) / den);
+    const vpx_prob prob = get_prob(ct[0], den);
     return weighted_prob(pre_prob, prob, factor);
   }
 }