]> granicus.if.org Git - libvpx/commitdiff
Unify the per directional filter type system for compound modes
authorJingning Han <jingning@google.com>
Tue, 3 May 2016 23:42:08 +0000 (16:42 -0700)
committerJingning Han <jingning@google.com>
Mon, 16 May 2016 21:41:08 +0000 (14:41 -0700)
For the current stage, we assume a single prediction filter type
per direction in the settings of compound inter prediction modes.

Change-Id: I12a1afdd364b93fcee870bd11ad01fc40ab48cff

vp10/decoder/decodemv.c
vp10/encoder/bitstream.c
vp10/encoder/encodeframe.c
vp10/encoder/rd.c
vp10/encoder/rdopt.c

index fd14ef5906b37417312bbf4da6906f4015984dd6..a92af27e9c5626f217b6bf41e3b876cc82b17587 100644 (file)
@@ -1617,15 +1617,20 @@ static void read_inter_block_mode_info(VP10Decoder *const pbi,
 #endif  // CONFIG_EXT_INTER
 
 #if CONFIG_DUAL_FILTER
-  for (ref = 0; ref < 4; ++ref) {
-    const int frame_idx = (ref >> 1);
+  for (ref = 0; ref < 2; ++ref) {
     mbmi->interp_filter[ref] = (cm->interp_filter == SWITCHABLE) ?
         EIGHTTAP_REGULAR : cm->interp_filter;
 
-    if (mbmi->ref_frame[frame_idx] > INTRA_FRAME &&
-        has_subpel_mv_component(xd, ref))
+    if (has_subpel_mv_component(xd, ref) ||
+        (mbmi->ref_frame[1] > INTRA_FRAME &&
+         has_subpel_mv_component(xd, ref + 2)))
       mbmi->interp_filter[ref] = read_interp_filter(cm, xd, ref, r);
   }
+  // The index system worsk as:
+  // (0, 1) -> (vertical, horizontal) filter types for the first ref frame.
+  // (2, 3) -> (vertical, horizontal) filter types for the second ref frame.
+  mbmi->interp_filter[2] = mbmi->interp_filter[0];
+  mbmi->interp_filter[3] = mbmi->interp_filter[1];
 #else
 #if CONFIG_EXT_INTERP
   mbmi->interp_filter = read_interp_filter(cm, xd, r);
index 4f8e89c5679734cca43e4d04389e39d63f36f7c3..9c07051afd0e52468966ce4cf00ab49df9c99910 100644 (file)
@@ -938,10 +938,10 @@ static void write_switchable_interp_filter(VP10_COMP *cpi,
 #endif  // CONFIG_DUAL_FILTER
 #endif  // CONFIG_EXT_INTERP
 #if CONFIG_DUAL_FILTER
-    for (dir = 0; dir < 4; ++dir) {
-      const int frame_idx = (dir >> 1);
-      if (mbmi->ref_frame[frame_idx] > INTRA_FRAME &&
-          has_subpel_mv_component(xd, dir)) {
+    for (dir = 0; dir < 2; ++dir) {
+      if (has_subpel_mv_component(xd, dir) ||
+          (mbmi->ref_frame[1] > INTRA_FRAME &&
+           has_subpel_mv_component(xd, dir + 2))) {
         const int ctx = vp10_get_pred_context_switchable_interp(xd, dir);
         vp10_write_token(w, vp10_switchable_interp_tree,
               cm->fc->switchable_interp_prob[ctx],
index ec8e9b30f3eb8e360275457164c19f729f86feb6..d78d19906d18d3b82e71ddd761ca2347a1a14390 100644 (file)
@@ -1023,12 +1023,13 @@ static void choose_partitioning(VP10_COMP *const cpi,
 static void reset_intmv_filter_type(VP10_COMMON *cm,
                                     MACROBLOCKD *xd, MB_MODE_INFO *mbmi) {
   int dir;
-  for (dir = 0; dir < 4; ++dir) {
-    const int frame_idx = (dir >> 1);
-    if (mbmi->ref_frame[frame_idx] > INTRA_FRAME &&
-        !has_subpel_mv_component(xd, dir))
+  for (dir = 0; dir < 2; ++dir) {
+    if (!has_subpel_mv_component(xd, dir) &&
+        (mbmi->ref_frame[1] == NONE ||
+         !has_subpel_mv_component(xd, dir + 2)))
       mbmi->interp_filter[dir] = (cm->interp_filter == SWITCHABLE) ?
           EIGHTTAP_REGULAR : cm->interp_filter;
+    mbmi->interp_filter[dir + 2] = mbmi->interp_filter[dir];
   }
 }
 
@@ -1036,10 +1037,10 @@ static void update_filter_type_count(FRAME_COUNTS *counts,
                                      const MACROBLOCKD *xd,
                                      const MB_MODE_INFO *mbmi) {
   int dir;
-  for (dir = 0; dir < 4; ++dir) {
-    const int frame_idx = (dir >> 1);
-    if (mbmi->ref_frame[frame_idx] > INTRA_FRAME &&
-        has_subpel_mv_component(xd, dir)) {
+  for (dir = 0; dir < 2; ++dir) {
+    if (has_subpel_mv_component(xd, dir) ||
+        (mbmi->ref_frame[1] > INTRA_FRAME &&
+         has_subpel_mv_component(xd, dir + 2))) {
       const int ctx = vp10_get_pred_context_switchable_interp(xd, dir);
       ++counts->switchable_interp[ctx][mbmi->interp_filter[dir]];
     }
index f935e3537d8489c4621225de86c59c7fc056d099..0d91fbd6c63a34dc790befcd5946d9e9130dafac 100644 (file)
@@ -729,10 +729,10 @@ int vp10_get_switchable_rate(const VP10_COMP *cpi,
   int inter_filter_cost = 0;
   int dir;
 
-  for (dir = 0; dir < 4; ++dir) {
-    const int frame_idx = (dir >> 1);
-    if (mbmi->ref_frame[frame_idx] > INTRA_FRAME &&
-        has_subpel_mv_component(xd, dir)) {
+  for (dir = 0; dir < 2; ++dir) {
+    if (has_subpel_mv_component(xd, dir) ||
+        (mbmi->ref_frame[1] > INTRA_FRAME &&
+         has_subpel_mv_component(xd, dir + 2))) {
       const int ctx = vp10_get_pred_context_switchable_interp(xd, dir);
       inter_filter_cost +=
           cpi->switchable_interp_costs[ctx][mbmi->interp_filter[dir]];
index d9bf8fea70c56a102117d39fecd0295f2b96a0a2..3fdee6d2ae51bab29eeacca3866e6cf1b9492f19 100644 (file)
@@ -10116,6 +10116,9 @@ void vp10_rd_pick_inter_mode_sub8x8(struct VP10_COMP *cpi,
       if (cm->interp_filter != BILINEAR) {
 #if CONFIG_DUAL_FILTER
         tmp_best_filter[0] = EIGHTTAP_REGULAR;
+        tmp_best_filter[1] = EIGHTTAP_REGULAR;
+        tmp_best_filter[2] = EIGHTTAP_REGULAR;
+        tmp_best_filter[3] = EIGHTTAP_REGULAR;
 #else
         tmp_best_filter = EIGHTTAP_REGULAR;
 #endif