shithub: libvpx

Download patch

ref: d26b6b5b9a5964f526e55bc1887dcf10ea4430ec
parent: f4e6bf6e052d7cf212903e5281f31066388c6e74
parent: 3e3ca7faa6c9e68be3058e175187f382f050f8da
author: Jingning Han <jingning@google.com>
date: Fri Jun 29 00:18:08 EDT 2018

Merge "Avoid operation on INT64_MAX value"

--- a/vp9/encoder/vp9_encodeframe.c
+++ b/vp9/encoder/vp9_encodeframe.c
@@ -1967,13 +1967,14 @@
     vp9_caq_select_segment(cpi, x, bsize, mi_row, mi_col, rd_cost->rate);
   }
 
-  rd_cost->rdcost = RDCOST(x->rdmult, x->rddiv, rd_cost->rate, rd_cost->dist);
-
   x->rdmult = orig_rdmult;
 
   // TODO(jingning) The rate-distortion optimization flow needs to be
   // refactored to provide proper exit/return handle.
-  if (rd_cost->rate == INT_MAX) rd_cost->rdcost = INT64_MAX;
+  if (rd_cost->rate == INT_MAX)
+    rd_cost->rdcost = INT64_MAX;
+  else
+    rd_cost->rdcost = RDCOST(x->rdmult, x->rddiv, rd_cost->rate, rd_cost->dist);
 
   ctx->rate = rd_cost->rate;
   ctx->dist = rd_cost->dist;