]> granicus.if.org Git - libvpx/commitdiff
Fix a few mis-use cases of MAX_MV_REF_CANDIDATES
authorJingning Han <jingning@google.com>
Wed, 13 Apr 2016 22:14:30 +0000 (15:14 -0700)
committerJingning Han <jingning@google.com>
Wed, 13 Apr 2016 22:16:55 +0000 (15:16 -0700)
Fix several use cases where MAX_MV_REF_CANDIDATES is mixed up with
is_compound flag to avoid potential coding interruption.

Change-Id: Ifdee1ef8a81ef6d1c155315c6c6a3074aa7a8b5e

vp10/decoder/decodemv.c
vp10/encoder/rdopt.c

index b52696d1348b6c76253ec4d22a7a2c1a36e31bfe..728ec9f7f49c4e54feaa5b90c6ca07e253b0f9b7 100644 (file)
@@ -1317,7 +1317,7 @@ static void read_inter_block_mode_info(VP10Decoder *const pbi,
       nearestmv[0] = xd->ref_mv_stack[ref_frame_type][0].this_mv;
       nearestmv[1] = xd->ref_mv_stack[ref_frame_type][0].comp_mv;
 
-      for (i = 0; i < MAX_MV_REF_CANDIDATES; ++i)
+      for (i = 0; i < 1 + is_compound; ++i)
         lower_mv_precision(&nearestmv[i].as_mv, allow_hp);
 #if CONFIG_EXT_INTER
       } else if (mbmi->mode == NEAREST_NEWMV || mbmi->mode == NEAREST_NEARMV) {
@@ -1351,7 +1351,7 @@ static void read_inter_block_mode_info(VP10Decoder *const pbi,
       nearmv[0] = xd->ref_mv_stack[ref_frame_type][ref_mv_idx].this_mv;
       nearmv[1] = xd->ref_mv_stack[ref_frame_type][ref_mv_idx].comp_mv;
 
-      for (i = 0; i < MAX_MV_REF_CANDIDATES; ++i) {
+      for (i = 0; i < 1 + is_compound; ++i) {
         lower_mv_precision(&nearestmv[i].as_mv, allow_hp);
         lower_mv_precision(&nearmv[i].as_mv, allow_hp);
       }
index 05cb75c06d0f8e6907f21f2d86f50a189c7f0abb..a986c4b3a899a082cd6dbe68dbd5619b1cc88cec 100644 (file)
@@ -8832,7 +8832,7 @@ void vp10_rd_pick_inter_mode_sb(VP10_COMP *cpi,
         nearestmv[1] = mbmi_ext->ref_mv_stack[rf_type][0].comp_mv;
       }
 
-      for (i = 0; i < MAX_MV_REF_CANDIDATES; ++i) {
+      for (i = 0; i < 2; ++i) {
         lower_mv_precision(&nearestmv[i].as_mv, allow_hp);
         lower_mv_precision(&nearmv[i].as_mv, allow_hp);
       }