shithub: libvpx

Download patch

ref: 0ebf548c752ef25ff8e9a65037fd9aee6420184e
parent: 5259744145fe4ff41d3c814514c0744444969ad3
author: Deb Mukherjee <debargha@google.com>
date: Fri Jul 27 13:46:33 EDT 2012

Merging and bug-fix in enhanced_interp experiment

Merged the enhanced_interp experiment.
Found and fixed a bug in the include files framework, whereby
certain encoder files were still using the old INTERP_EXTEND
value of 3 instead of 4. The thresholds for mv range mcomp.c
need a small adjustment to prevent crashes.

The results are more or less unchanged.

Change-Id: Iac5008390f1efc97ce1102fbb5f8989c847fb579

--- a/configure
+++ b/configure
@@ -215,13 +215,11 @@
 "
 EXPERIMENT_LIST="
     csm
-    enhanced_interp
     featureupdates
     high_precision_mv
     sixteenth_subpel_uv
     comp_intra_pred
     superblocks
-    newintramodes
     pred_filter
     lossless
     hybridtransform
--- a/vp8/common/blockd.h
+++ b/vp8/common/blockd.h
@@ -80,12 +80,10 @@
 {
   SIXTAP   = 0,
   BILINEAR = 1,
-#if CONFIG_ENHANCED_INTERP
   EIGHTTAP = 2,
   EIGHTTAP_SHARP = 3,
 #if CONFIG_SWITCHABLE_INTERP
   SWITCHABLE  /* should be the last one */
-#endif
 #endif
 } INTERPOLATIONFILTERTYPE;
 
--- a/vp8/common/filter.c
+++ b/vp8/common/filter.c
@@ -43,11 +43,10 @@
 #endif  /* SUBPEL_SHIFTS==16 */
 };
 
-#if CONFIG_ENHANCED_INTERP
-
 #define FILTER_ALPHA       0
 #define FILTER_ALPHA_SHARP 1
-DECLARE_ALIGNED(16, const short, vp8_sub_pel_filters_8[SUBPEL_SHIFTS][2 * INTERP_EXTEND]) = {
+DECLARE_ALIGNED(16, const short, vp8_sub_pel_filters_8[SUBPEL_SHIFTS][8]) = {
+
 #if SUBPEL_SHIFTS==16
 #if FILTER_ALPHA == 0
   /* Lagrangian interpolation filter */
@@ -116,7 +115,7 @@
 #endif  /* SUBPEL_SHIFTS==16 */
 };
 
-DECLARE_ALIGNED(16, const short, vp8_sub_pel_filters_8s[SUBPEL_SHIFTS][2 * INTERP_EXTEND]) = {
+DECLARE_ALIGNED(16, const short, vp8_sub_pel_filters_8s[SUBPEL_SHIFTS][8]) = {
 #if SUBPEL_SHIFTS==16
 #if FILTER_ALPHA_SHARP == 1
   /* dct based filter */
@@ -137,6 +136,7 @@
   {-1,   3,  -6,  17, 125, -13,   5, -2},
   {0,   1,  -3,   8, 127,  -7,   3, -1}
 #elif FILTER_ALPHA_SHARP == 75
+  /* alpha = 0.75 */
   {0,   0,   0, 128,   0,   0,   0, 0},
   {-1,   2,  -6, 126,   9,  -3,   2, -1},
   {-1,   4, -11, 123,  18,  -7,   3, -1},
@@ -174,6 +174,7 @@
 #endif  /* FILTER_ALPHA_SHARP */
 #else   /* SUBPEL_SHIFTS==16 */
 #if FILTER_ALPHA_SHARP == 1
+  /* dct based filter */
   {0,   0,   0, 128,   0,   0,   0, 0},
   {-2,   5, -13, 125,  17,  -6,   3, -1},
   {-4,   9, -20, 115,  37, -13,   6, -2},
@@ -183,6 +184,7 @@
   {-2,   6, -13,  37, 115, -20,   9, -4},
   {-1,   3,  -6,  17, 125, -13,   5, -2}
 #elif FILTER_ALPHA_SHARP == 75
+  /* alpha = 0.75 */
   {0,   0,   0, 128,   0,   0,   0, 0},
   {-1,   4, -11, 123,  18,  -7,   3, -1},
   {-2,   7, -19, 113,  38, -13,   6, -2},
@@ -205,8 +207,6 @@
 #endif  /* SUBPEL_SHIFTS==16 */
 };
 
-#endif  // CONFIG_ENHANCED_INTERP
-
 DECLARE_ALIGNED(16, const short, vp8_sub_pel_filters_6[SUBPEL_SHIFTS][6]) = {
 #if SUBPEL_SHIFTS==16
   {0,   0, 128,   0,   0, 0},
@@ -590,8 +590,6 @@
                                    16, 16, 16, 16, VFilter);
 }
 
-#if CONFIG_ENHANCED_INTERP
-
 #undef Interp_Extend
 #define Interp_Extend 4
 
@@ -1147,8 +1145,6 @@
   filter_block2d_second_pass_avg_8(FData + 16 * (Interp_Extend - 1), dst_ptr, dst_pitch,
                                    16, 16, 16, 16, VFilter);
 }
-
-#endif  /* CONFIG_ENHANCED_INTERP */
 
 /****************************************************************************
  *
--- a/vp8/common/generic/systemdependent.c
+++ b/vp8/common/generic/systemdependent.c
@@ -78,7 +78,6 @@
     vp8_comp_intra_uv4x4_predict;
 #endif
 
-#if CONFIG_ENHANCED_INTERP
   rtcd->subpix.eighttap16x16       = vp8_eighttap_predict16x16_c;
   rtcd->subpix.eighttap8x8         = vp8_eighttap_predict8x8_c;
   rtcd->subpix.eighttap_avg16x16   = vp8_eighttap_predict_avg16x16_c;
@@ -93,7 +92,7 @@
   rtcd->subpix.eighttap_avg4x4_sharp     = vp8_eighttap_predict_avg4x4_sharp_c;
   rtcd->subpix.eighttap8x4_sharp         = vp8_eighttap_predict8x4_sharp_c;
   rtcd->subpix.eighttap4x4_sharp         = vp8_eighttap_predict_sharp_c;
-#endif
+
   rtcd->subpix.sixtap16x16       = vp8_sixtap_predict16x16_c;
   rtcd->subpix.sixtap8x8         = vp8_sixtap_predict8x8_c;
   rtcd->subpix.sixtap_avg16x16   = vp8_sixtap_predict_avg16x16_c;
--- a/vp8/common/reconinter.c
+++ b/vp8/common/reconinter.c
@@ -38,7 +38,6 @@
     xd->subpixel_predict_avg16x16 = SUBPIX_INVOKE(
         &cm->rtcd.subpix, sixtap_avg16x16);
   }
-#if CONFIG_ENHANCED_INTERP
   else if (mcomp_filter_type == EIGHTTAP
 #if CONFIG_SWITCHABLE_INTERP
            ||
@@ -75,7 +74,6 @@
     xd->subpixel_predict_avg16x16 = SUBPIX_INVOKE(
         &cm->rtcd.subpix, eighttap_avg16x16_sharp);
   }
-#endif
   else {
     xd->subpixel_predict        = SUBPIX_INVOKE(
         &cm->rtcd.subpix, bilinear4x4);
--- a/vp8/common/subpixel.h
+++ b/vp8/common/subpixel.h
@@ -58,7 +58,6 @@
 #endif
 extern prototype_subpixel_predict(vp8_subpix_sixtap_avg4x4);
 
-#if CONFIG_ENHANCED_INTERP
 #ifndef vp8_subpix_eighttap16x16
 #define vp8_subpix_eighttap16x16 vp8_eighttap_predict16x16_c
 #endif
@@ -128,7 +127,6 @@
 #define vp8_subpix_eighttap_avg4x4_sharp vp8_eighttap_predict_avg4x4_sharp_c
 #endif
 extern prototype_subpixel_predict(vp8_subpix_eighttap_avg4x4_sharp);
-#endif  /* CONFIG_ENAHNCED_INTERP */
 
 #ifndef vp8_subpix_bilinear16x16
 #define vp8_subpix_bilinear16x16 vp8_bilinear_predict16x16_c
@@ -167,7 +165,6 @@
 
 typedef prototype_subpixel_predict((*vp8_subpix_fn_t));
 typedef struct {
-#if CONFIG_ENHANCED_INTERP
   vp8_subpix_fn_t  eighttap16x16;
   vp8_subpix_fn_t  eighttap8x8;
   vp8_subpix_fn_t  eighttap_avg16x16;
@@ -182,7 +179,6 @@
   vp8_subpix_fn_t  eighttap_avg4x4_sharp;
   vp8_subpix_fn_t  eighttap8x4_sharp;
   vp8_subpix_fn_t  eighttap4x4_sharp;
-#endif
   vp8_subpix_fn_t  sixtap16x16;
   vp8_subpix_fn_t  sixtap8x8;
   vp8_subpix_fn_t  sixtap_avg16x16;
--- a/vp8/common/x86/x86_systemdependent.c
+++ b/vp8/common/x86/x86_systemdependent.c
@@ -46,12 +46,12 @@
     rtcd->recon.copy8x4     = vp8_copy_mem8x4_mmx;
     rtcd->recon.copy16x16   = vp8_copy_mem16x16_mmx;
 
-#if CONFIG_ENHANCED_INTERP == 0 && CONFIG_HIGH_PRECISION_MV == 0 && CONFIG_SIXTEENTH_SUBPEL_UV == 0
+    /* Disabled due to unsupported enhanced interpolation/high_prec mv
     rtcd->subpix.sixtap16x16   = vp8_sixtap_predict16x16_mmx;
     rtcd->subpix.sixtap8x8     = vp8_sixtap_predict8x8_mmx;
     rtcd->subpix.sixtap8x4     = vp8_sixtap_predict8x4_mmx;
     rtcd->subpix.sixtap4x4     = vp8_sixtap_predict4x4_mmx;
-#endif
+    */
     rtcd->subpix.bilinear16x16 = vp8_bilinear_predict16x16_mmx;
     rtcd->subpix.bilinear8x8   = vp8_bilinear_predict8x8_mmx;
     rtcd->subpix.bilinear8x4   = vp8_bilinear_predict8x4_mmx;
@@ -91,11 +91,11 @@
 
     // rtcd->idct.iwalsh16     = vp8_short_inv_walsh4x4_sse2;
 
-#if CONFIG_ENHANCED_INTERP == 0 && CONFIG_HIGH_PRECISION_MV == 0 && CONFIG_SIXTEENTH_SUBPEL_UV == 0
+    /* Disabled due to unsupported enhanced interpolation/high_prec mv
     rtcd->subpix.sixtap16x16   = vp8_sixtap_predict16x16_sse2;
     rtcd->subpix.sixtap8x8     = vp8_sixtap_predict8x8_sse2;
     rtcd->subpix.sixtap8x4     = vp8_sixtap_predict8x4_sse2;
-#endif
+    */
     rtcd->subpix.bilinear16x16 = vp8_bilinear_predict16x16_sse2;
     rtcd->subpix.bilinear8x8   = vp8_bilinear_predict8x8_sse2;
 
@@ -121,7 +121,7 @@
 #if HAVE_SSSE3
 
   if (flags & HAS_SSSE3) {
-#if CONFIG_ENHANCED_INTERP == 0 && CONFIG_HIGH_PRECISION_MV == 0 && CONFIG_SIXTEENTH_SUBPEL_UV == 0
+    /* Disabled due to unsupported enhanced interpolation/high_prec mv
     rtcd->subpix.sixtap16x16   = vp8_sixtap_predict16x16_ssse3;
     rtcd->subpix.sixtap8x8     = vp8_sixtap_predict8x8_ssse3;
     rtcd->subpix.sixtap8x4     = vp8_sixtap_predict8x4_ssse3;
@@ -128,7 +128,7 @@
     rtcd->subpix.sixtap4x4     = vp8_sixtap_predict4x4_ssse3;
     rtcd->subpix.bilinear16x16 = vp8_bilinear_predict16x16_ssse3;
     rtcd->subpix.bilinear8x8   = vp8_bilinear_predict8x8_ssse3;
-#endif
+    */
 
     /* these are disable because of unsupported diagonal pred modes
     rtcd->recon.build_intra_predictors_mbuv =
--- a/vp8/decoder/decodframe.c
+++ b/vp8/decoder/decodframe.c
@@ -746,15 +746,11 @@
   } else {
 
     if (!pc->use_bilinear_mc_filter)
-#if CONFIG_ENHANCED_INTERP
       pc->mcomp_filter_type = EIGHTTAP;
-#else
-      pc->mcomp_filter_type = SIXTAP;
-#endif
     else
       pc->mcomp_filter_type = BILINEAR;
 
-    /* To enable choice of different interploation filters */
+    /* To enable choice of different interpolation filters */
     vp8_setup_interp_filters(xd, pc->mcomp_filter_type, pc);
   }
 
@@ -1226,7 +1222,6 @@
     /* Is high precision mv allowed */
     xd->allow_high_precision_mv = (unsigned char)vp8_read_bit(bc);
 #endif
-#if CONFIG_ENHANCED_INTERP
     // Read the type of subpel filter to use
 #if CONFIG_SWITCHABLE_INTERP
     if (vp8_read_bit(bc)) {
@@ -1238,7 +1233,6 @@
     }
     /* To enable choice of different interploation filters */
     vp8_setup_interp_filters(xd, pc->mcomp_filter_type, pc);
-#endif
   }
 
   pc->refresh_entropy_probs = vp8_read_bit(bc);
--- a/vp8/encoder/bitstream.c
+++ b/vp8/encoder/bitstream.c
@@ -2273,7 +2273,6 @@
     // Signal whether to allow high MV precision
     vp8_write_bit(bc, (xd->allow_high_precision_mv) ? 1 : 0);
 #endif
-#if CONFIG_ENHANCED_INTERP
 #if CONFIG_SWITCHABLE_INTERP
     if (pc->mcomp_filter_type == SWITCHABLE) {
       /* Check to see if only one of the filters is actually used */
@@ -2301,7 +2300,6 @@
     if (pc->mcomp_filter_type != SWITCHABLE)
 #endif  /* CONFIG_SWITCHABLE_INTERP */
       vp8_write_literal(bc, (pc->mcomp_filter_type), 2);
-#endif  /* CONFIG_ENHANCED_INTERP */
   }
 
   vp8_write_bit(bc, pc->refresh_entropy_probs);
--- a/vp8/encoder/mcomp.c
+++ b/vp8/encoder/mcomp.c
@@ -257,10 +257,14 @@
   int buf_r1, buf_r2, buf_c1, buf_c2;
 
   // Clamping to avoid out-of-range data access
-  buf_r1 = ((bestmv->as_mv.row - INTERP_EXTEND) < x->mv_row_min) ? (bestmv->as_mv.row - x->mv_row_min) : INTERP_EXTEND;
-  buf_r2 = ((bestmv->as_mv.row + INTERP_EXTEND) > x->mv_row_max) ? (x->mv_row_max - bestmv->as_mv.row) : INTERP_EXTEND;
-  buf_c1 = ((bestmv->as_mv.col - INTERP_EXTEND) < x->mv_col_min) ? (bestmv->as_mv.col - x->mv_col_min) : INTERP_EXTEND;
-  buf_c2 = ((bestmv->as_mv.col + INTERP_EXTEND) > x->mv_col_max) ? (x->mv_col_max - bestmv->as_mv.col) : INTERP_EXTEND;
+  buf_r1 = ((bestmv->as_mv.row - INTERP_EXTEND) < x->mv_row_min) ?
+      (bestmv->as_mv.row - x->mv_row_min) : INTERP_EXTEND - 1;
+  buf_r2 = ((bestmv->as_mv.row + INTERP_EXTEND) > x->mv_row_max) ?
+      (x->mv_row_max - bestmv->as_mv.row) : INTERP_EXTEND - 1;
+  buf_c1 = ((bestmv->as_mv.col - INTERP_EXTEND) < x->mv_col_min) ?
+      (bestmv->as_mv.col - x->mv_col_min) : INTERP_EXTEND - 1;
+  buf_c2 = ((bestmv->as_mv.col + INTERP_EXTEND) > x->mv_col_max) ?
+      (x->mv_col_max - bestmv->as_mv.col) : INTERP_EXTEND - 1;
   y_stride = 32;
 
   /* Copy to intermediate buffer before searching. */
--- a/vp8/encoder/onyx_if.c
+++ b/vp8/encoder/onyx_if.c
@@ -81,17 +81,19 @@
 
 extern const int vp8_gf_interval_table[101];
 
-#if CONFIG_ENHANCED_INTERP
-#define SEARCH_BEST_FILTER 0            /* to search for best filter */
+#define SEARCH_BEST_FILTER 0            /* to search exhaustively for
+                                           best filter */
 #define RESET_FOREACH_FILTER 0          /* whether to reset the encoder state
-                                         * before trying each new filter */
-#define SHARP_FILTER_QTHRESH 0         /* Q threshold for 8-tap sharp filter */
-#endif
+                                           before trying each new filter */
+#define SHARP_FILTER_QTHRESH 0          /* Q threshold for 8-tap sharp filter */
+
 #if CONFIG_HIGH_PRECISION_MV
-#define ALTREF_HIGH_PRECISION_MV 1      /* whether to use high precision mv for altref computation */
-#define HIGH_PRECISION_MV_QTHRESH 200   /* Q threshold for use of high precision mv
-                                         * Choose a very high value for now so
-                                         * that HIGH_PRECISION is always chosen */
+#define ALTREF_HIGH_PRECISION_MV 1      /* whether to use high precision mv
+                                           for altref computation */
+#define HIGH_PRECISION_MV_QTHRESH 200   /* Q threshold for use of high precision
+                                           mv. Choose a very high value for
+                                           now so that HIGH_PRECISION is always
+                                           chosen */
 #endif
 
 #if CONFIG_INTERNAL_STATS
@@ -778,9 +780,7 @@
 
       sf->first_step = 0;
       sf->max_step_search_steps = MAX_MVSEARCH_STEPS;
-#if CONFIG_ENHANCED_INTERP
       sf->search_best_filter = SEARCH_BEST_FILTER;
-#endif
       break;
     case 1:
 #if CONFIG_PRED_FILTER
@@ -1586,11 +1586,7 @@
   cpi->cq_target_quality = cpi->oxcf.cq_level;
 
   if (!cm->use_bilinear_mc_filter)
-#if CONFIG_ENHANCED_INTERP
     cm->mcomp_filter_type = EIGHTTAP;
-#else
-    cm->mcomp_filter_type = SIXTAP;
-#endif
   else
     cm->mcomp_filter_type = BILINEAR;
 
@@ -2895,7 +2891,6 @@
 
   int loop_size_estimate = 0;
 
-#if CONFIG_ENHANCED_INTERP
   SPEED_FEATURES *sf = &cpi->sf;
 #if RESET_FOREACH_FILTER
   int q_low0;
@@ -2921,7 +2916,6 @@
   int mcomp_filters = sizeof(mcomp_filters_to_search) / sizeof(*mcomp_filters_to_search);
   int mcomp_filter_index = 0;
   INT64 mcomp_filter_cost[4];
-#endif
 
   // Clear down mmx registers to allow floating point in what follows
   vp8_clear_system_state();
@@ -3137,9 +3131,7 @@
 
   loop_count = 0;
 
-#if CONFIG_HIGH_PRECISION_MV || CONFIG_ENHANCED_INTERP
   if (cm->frame_type != KEY_FRAME) {
-#if CONFIG_ENHANCED_INTERP
     /* TODO: Decide this more intelligently */
     if (sf->search_best_filter) {
       cm->mcomp_filter_type = mcomp_filters_to_search[0];
@@ -3152,13 +3144,11 @@
           (Q < SHARP_FILTER_QTHRESH ? EIGHTTAP_SHARP : EIGHTTAP);
 #endif
     }
-#endif
 #if CONFIG_HIGH_PRECISION_MV
     /* TODO: Decide this more intelligently */
     xd->allow_high_precision_mv = (Q < HIGH_PRECISION_MV_QTHRESH);
 #endif
   }
-#endif
 
 #if CONFIG_POSTPROC
 
@@ -3206,7 +3196,7 @@
   vp8_write_yuv_frame(cpi->Source);
 #endif
 
-#if CONFIG_ENHANCED_INTERP && RESET_FOREACH_FILTER
+#if RESET_FOREACH_FILTER
   if (sf->search_best_filter) {
     q_low0 = q_low;
     q_high0 = q_high;
@@ -3468,7 +3458,7 @@
     if (cpi->is_src_frame_alt_ref)
       Loop = FALSE;
 
-#if CONFIG_ENHANCED_INTERP && CONFIG_SWITCHABLE_INTERP
+#if CONFIG_SWITCHABLE_INTERP
     if (cm->frame_type != KEY_FRAME &&
         !sf->search_best_filter &&
         cm->mcomp_filter_type == SWITCHABLE) {
@@ -3502,7 +3492,6 @@
     }
 #endif
 
-#if CONFIG_ENHANCED_INTERP
     if (Loop == FALSE && cm->frame_type != KEY_FRAME && sf->search_best_filter) {
       if (mcomp_filter_index < mcomp_filters) {
         INT64 err = vp8_calc_ss_err(cpi->Source,
@@ -3555,7 +3544,6 @@
 #endif
       }
     }
-#endif  /* CONFIG_ENHANCED_INTERP */
 
     if (Loop == TRUE) {
       loop_count++;
--- a/vp8/encoder/onyx_int.h
+++ b/vp8/encoder/onyx_int.h
@@ -317,9 +317,7 @@
   int optimize_coefficients;
   int no_skip_block4x4_search;
   int improved_mv_pred;
-#if CONFIG_ENHANCED_INTERP
   int search_best_filter;
-#endif
 
 } SPEED_FEATURES;
 
--- a/vpx_scale/arm/scalesystemdependent.c
+++ b/vpx_scale/arm/scalesystemdependent.c
@@ -87,9 +87,11 @@
   if (flags & HAS_NEON)
 #endif
   {
+#if VP8BORDERINPIXELS == 32
     vp8_yv12_extend_frame_borders_ptr = vp8_yv12_extend_frame_borders_neon;
     vp8_yv12_copy_frame_yonly_ptr     = vp8_yv12_copy_frame_yonly_neon;
     vp8_yv12_copy_frame_ptr           = vp8_yv12_copy_frame_neon;
+#endif
   }
 #endif
 }
--- a/vpx_scale/yv12config.h
+++ b/vpx_scale/yv12config.h
@@ -11,6 +11,9 @@
 
 #ifndef YV12_CONFIG_H
 #define YV12_CONFIG_H
+
+#include "vpx_config.h"
+
 #ifdef __cplusplus
 extern "C"
 {
@@ -18,13 +21,8 @@
 
 #define VP7BORDERINPIXELS       48
 
-#if CONFIG_ENHANCED_INTERP
 #define VP8BORDERINPIXELS       64
 #define INTERP_EXTEND            4
-#else
-#define VP8BORDERINPIXELS       32
-#define INTERP_EXTEND            3
-#endif
 
   /*************************************
    For INT_YUV:
--