]> granicus.if.org Git - libvpx/commitdiff
vp9-svc: Set num_inter_modes in non-rd pickmode.
authorMarco <marpan@google.com>
Fri, 1 Dec 2017 18:30:45 +0000 (10:30 -0800)
committerMarco <marpan@google.com>
Fri, 1 Dec 2017 18:30:45 +0000 (10:30 -0800)
Set num_inter_modes based on ref_mode_set_svc, which is
smaller set than ref_mode_set (which may use alt-ref).

No change in behavior.

Change-Id: I31169bb09028db230552c6fca0a86959d1ade692

vp9/encoder/vp9_pickmode.c

index 925ac7634c4f9a9e43f80d6d530f10972243a402..99776f1bd59da08910fcc20057aaf7edfab5fec2 100644 (file)
@@ -1176,7 +1176,9 @@ static const REF_MODE ref_mode_set[RT_INTER_MODES] = {
   { ALTREF_FRAME, ZEROMV }, { ALTREF_FRAME, NEARESTMV },
   { ALTREF_FRAME, NEARMV }, { ALTREF_FRAME, NEWMV }
 };
-static const REF_MODE ref_mode_set_svc[RT_INTER_MODES] = {
+
+#define RT_INTER_MODES_SVC 8
+static const REF_MODE ref_mode_set_svc[RT_INTER_MODES_SVC] = {
   { LAST_FRAME, ZEROMV },      { LAST_FRAME, NEARESTMV },
   { LAST_FRAME, NEARMV },      { GOLDEN_FRAME, ZEROMV },
   { GOLDEN_FRAME, NEARESTMV }, { GOLDEN_FRAME, NEARMV },
@@ -1495,6 +1497,7 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, TileDataEnc *tile_data,
   INTERP_FILTER filter_gf_svc = EIGHTTAP;
   MV_REFERENCE_FRAME best_second_ref_frame = NONE;
   int comp_modes = 0;
+  int num_inter_modes = (cpi->use_svc) ? RT_INTER_MODES_SVC : RT_INTER_MODES;
 
   init_ref_frame_cost(cm, xd, ref_frame_cost);
 
@@ -1644,7 +1647,7 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, TileDataEnc *tile_data,
   if (cpi->use_svc || cpi->oxcf.speed <= 7 || bsize < BLOCK_32X32)
     x->sb_use_mv_part = 0;
 
-  for (idx = 0; idx < RT_INTER_MODES + comp_modes; ++idx) {
+  for (idx = 0; idx < num_inter_modes + comp_modes; ++idx) {
     int rate_mv = 0;
     int mode_rd_thresh;
     int mode_index;
@@ -1660,7 +1663,7 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, TileDataEnc *tile_data,
     PREDICTION_MODE this_mode;
     second_ref_frame = NONE;
 
-    if (idx < RT_INTER_MODES) {
+    if (idx < num_inter_modes) {
       this_mode = ref_mode_set[idx].pred_mode;
       ref_frame = ref_mode_set[idx].ref_frame;
 
@@ -1672,7 +1675,7 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, TileDataEnc *tile_data,
       // Add (0,0) compound modes.
       this_mode = ZEROMV;
       ref_frame = LAST_FRAME;
-      if (idx == RT_INTER_MODES + comp_modes - 1) ref_frame = GOLDEN_FRAME;
+      if (idx == num_inter_modes + comp_modes - 1) ref_frame = GOLDEN_FRAME;
       second_ref_frame = ALTREF_FRAME;
       comp_pred = 1;
     }