]> granicus.if.org Git - libvpx/commitdiff
Fix rd threshold overflow issue
authorYunqing Wang <yunqingwang@google.com>
Wed, 2 Jul 2014 19:16:27 +0000 (12:16 -0700)
committerYunqing Wang <yunqingwang@google.com>
Wed, 2 Jul 2014 19:16:27 +0000 (12:16 -0700)
Moved the threshold adjustment before reference flag checking,
which could set the threshold to INT_MAX for disabled reference
frame, and cause overflow if the adjustment is done after that.

Change-Id: I85e94f8726d5e3ae93f65965aa978721dddc9957

vp9/encoder/vp9_rdopt.c

index e1a03a62fad2926537b4e5a6cc60991f696052b2..a4cdd33ecee45c80a3c982dc421937f366477598 100644 (file)
@@ -4289,6 +4289,10 @@ void vp9_set_rd_speed_thresholds(VP9_COMP *cpi) {
   rd->thresh_mult[THR_NEWA] += 1000;
   rd->thresh_mult[THR_NEWG] += 1000;
 
+  // Adjust threshold only in real time mode, which only use last reference
+  // frame.
+  rd->thresh_mult[THR_NEWMV] += sf->elevate_newmv_thresh;
+
   rd->thresh_mult[THR_NEARMV] += 1000;
   rd->thresh_mult[THR_NEARA] += 1000;
   rd->thresh_mult[THR_COMP_NEARESTLA] += 1000;
@@ -4351,10 +4355,6 @@ void vp9_set_rd_speed_thresholds(VP9_COMP *cpi) {
     rd->thresh_mult[THR_COMP_NEARGA   ] = INT_MAX;
     rd->thresh_mult[THR_COMP_NEWGA    ] = INT_MAX;
   }
-
-  // Adjust threshold only in real time mode, which only use last reference
-  // frame.
-  rd->thresh_mult[THR_NEWMV] += sf->elevate_newmv_thresh;
 }
 
 void vp9_set_rd_speed_thresholds_sub8x8(VP9_COMP *cpi) {