Avoid the use of INT_MAX in rate computation
BUG=aomedia:676
Change-Id: I278e84de26d995419b85039f7b78b8324cadf3a3
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c
index f7432e0..b6a2637 100644
--- a/av1/encoder/encodeframe.c
+++ b/av1/encoder/encodeframe.c
@@ -3558,10 +3558,13 @@
bsize, ctx_none, best_rdc.rdcost);
if (this_rdc.rate != INT_MAX) {
if (bsize_at_least_8x8) {
- this_rdc.rate += partition_cost[PARTITION_NONE];
+ const int pt_cost = partition_cost[PARTITION_NONE] < INT_MAX
+ ? partition_cost[PARTITION_NONE]
+ : 0;
+ this_rdc.rate += pt_cost;
this_rdc.rdcost = RDCOST(x->rdmult, this_rdc.rate, this_rdc.dist);
#if CONFIG_SUPERTX
- this_rate_nocoef += partition_cost[PARTITION_NONE];
+ this_rate_nocoef += pt_cost;
#endif
}