Commit 0ebf548c authored by Deb Mukherjee's avatar Deb Mukherjee
Browse files

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
parent 52597441
......@@ -215,13 +215,11 @@ HAVE_LIST="
"
EXPERIMENT_LIST="
csm
enhanced_interp
featureupdates
high_precision_mv
sixteenth_subpel_uv
comp_intra_pred
superblocks
newintramodes
pred_filter
lossless
hybridtransform
......
......@@ -80,13 +80,11 @@ typedef enum
{
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;
#if 0//CONFIG_SWITCHABLE_INTERP
......
......@@ -43,11 +43,10 @@ DECLARE_ALIGNED(16, const short, vp8_bilinear_filters[SUBPEL_SHIFTS][2]) = {
#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 @@ DECLARE_ALIGNED(16, const short, vp8_sub_pel_filters_8[SUBPEL_SHIFTS][2 * INTERP
#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 @@ DECLARE_ALIGNED(16, const short, vp8_sub_pel_filters_8s[SUBPEL_SHIFTS][2 * INTER
{-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 @@ DECLARE_ALIGNED(16, const short, vp8_sub_pel_filters_8s[SUBPEL_SHIFTS][2 * INTER
#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 @@ DECLARE_ALIGNED(16, const short, vp8_sub_pel_filters_8s[SUBPEL_SHIFTS][2 * INTER
{-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 @@ DECLARE_ALIGNED(16, const short, vp8_sub_pel_filters_8s[SUBPEL_SHIFTS][2 * INTER
#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 @@ void vp8_sixtap_predict_avg16x16_c
16, 16, 16, 16, VFilter);
}
#if CONFIG_ENHANCED_INTERP
#undef Interp_Extend
#define Interp_Extend 4
......@@ -1148,8 +1146,6 @@ void vp8_eighttap_predict_avg16x16_sharp_c
16, 16, 16, 16, VFilter);
}
#endif /* CONFIG_ENHANCED_INTERP */
/****************************************************************************
*
* ROUTINE : filter_block2d_bil_first_pass
......
......@@ -78,7 +78,6 @@ void vp8_machine_specific_config(VP8_COMMON *ctx) {
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 @@ void vp8_machine_specific_config(VP8_COMMON *ctx) {
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;
......
......@@ -38,7 +38,6 @@ void vp8_setup_interp_filters(MACROBLOCKD *xd,
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 @@ void vp8_setup_interp_filters(MACROBLOCKD *xd,
xd->subpixel_predict_avg16x16 = SUBPIX_INVOKE(
&cm->rtcd.subpix, eighttap_avg16x16_sharp);
}
#endif
else {
xd->subpixel_predict = SUBPIX_INVOKE(
&cm->rtcd.subpix, bilinear4x4);
......
......@@ -58,7 +58,6 @@ extern prototype_subpixel_predict(vp8_subpix_sixtap4x4);
#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 @@ extern prototype_subpixel_predict(vp8_subpix_eighttap4x4_sharp);
#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 @@ extern prototype_subpixel_predict(vp8_subpix_bilinear_avg4x4);
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 @@ typedef struct {
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;
......
......@@ -46,12 +46,12 @@ void vp8_arch_x86_common_init(VP8_COMMON *ctx) {
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 @@ void vp8_arch_x86_common_init(VP8_COMMON *ctx) {
// 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,14 +121,14 @@ void vp8_arch_x86_common_init(VP8_COMMON *ctx) {
#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;
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 =
......
......@@ -746,15 +746,11 @@ static void init_frame(VP8D_COMP *pbi) {
} 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 @@ int vp8_decode_frame(VP8D_COMP *pbi) {
/* 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 @@ int vp8_decode_frame(VP8D_COMP *pbi) {
}
/* 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);
......
......@@ -2273,7 +2273,6 @@ void vp8_pack_bitstream(VP8_COMP *cpi, unsigned char *dest, unsigned long *size)
// 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 @@ void vp8_pack_bitstream(VP8_COMP *cpi, unsigned char *dest, unsigned long *size)
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);
......
......@@ -257,10 +257,14 @@ int vp8_find_best_sub_pixel_step_iteratively(MACROBLOCK *x, BLOCK *b, BLOCKD *d,
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. */
......
......@@ -81,17 +81,19 @@ static void set_default_lf_deltas(VP8_COMP *cpi);
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 @@ void vp8_set_speed_features(VP8_COMP *cpi) {
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 @@ void vp8_change_config(VP8_PTR ptr, VP8_CONFIG *oxcf) {
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 @@ static void encode_frame_to_data_rate
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 @@ static void encode_frame_to_data_rate
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 @@ static void encode_frame_to_data_rate
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 @@ static void encode_frame_to_data_rate
(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 @@ static void encode_frame_to_data_rate
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 @@ static void encode_frame_to_data_rate
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 @@ static void encode_frame_to_data_rate
}
#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 @@ static void encode_frame_to_data_rate
#endif
}
}
#endif /* CONFIG_ENHANCED_INTERP */
if (Loop == TRUE) {
loop_count++;
......
......@@ -317,9 +317,7 @@ typedef struct {
int optimize_coefficients;
int no_skip_block4x4_search;
int improved_mv_pred;
#if CONFIG_ENHANCED_INTERP
int search_best_filter;
#endif
} SPEED_FEATURES;
......
......@@ -87,9 +87,11 @@ void vp8_scale_machine_specific_config() {
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
}
......@@ -11,6 +11,9 @@
#ifndef YV12_CONFIG_H
#define YV12_CONFIG_H
#include "vpx_config.h"
#ifdef __cplusplus
extern "C"
{
......@@ -18,13 +21,8 @@ extern "C"
#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:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment