Merge "Rename highbitdepth functions to use highbd prefix"
diff --git a/vp8/encoder/denoising.h b/vp8/encoder/denoising.h
index fb7930b..6c1f9e2 100644
--- a/vp8/encoder/denoising.h
+++ b/vp8/encoder/denoising.h
@@ -27,6 +27,8 @@
#define SUM_DIFF_FROM_AVG_THRESH_UV (8 * 8 * 8)
#define MOTION_MAGNITUDE_THRESHOLD_UV (8*3)
+#define MAX_GF_ARF_DENOISE_RANGE (16)
+
enum vp8_denoiser_decision
{
COPY_BLOCK,
diff --git a/vp8/encoder/pickinter.c b/vp8/encoder/pickinter.c
index 43f8957..ea3b46e 100644
--- a/vp8/encoder/pickinter.c
+++ b/vp8/encoder/pickinter.c
@@ -1083,7 +1083,14 @@
{
/* Store for later use by denoiser. */
- if (this_mode == ZEROMV && sse < zero_mv_sse )
+ // Dont' denoise with GOLDEN OR ALTREF is they are old reference
+ // frames (greater than MAX_GF_ARF_DENOISE_RANGE frames in past).
+ int skip_old_reference = ((this_ref_frame != LAST_FRAME) &&
+ (cpi->common.current_video_frame -
+ cpi->current_ref_frames[this_ref_frame] >
+ MAX_GF_ARF_DENOISE_RANGE)) ? 1 : 0;
+ if (this_mode == ZEROMV && sse < zero_mv_sse &&
+ !skip_old_reference)
{
zero_mv_sse = sse;
x->best_zeromv_reference_frame =
@@ -1092,7 +1099,7 @@
/* Store the best NEWMV in x for later use in the denoiser. */
if (x->e_mbd.mode_info_context->mbmi.mode == NEWMV &&
- sse < best_sse)
+ sse < best_sse && !skip_old_reference)
{
best_sse = sse;
x->best_sse_inter_mode = NEWMV;
diff --git a/vp9/common/vp9_blockd.h b/vp9/common/vp9_blockd.h
index 9e79ba0..1234d54 100644
--- a/vp9/common/vp9_blockd.h
+++ b/vp9/common/vp9_blockd.h
@@ -17,14 +17,10 @@
#include "vpx_ports/mem.h"
#include "vpx_scale/yv12config.h"
-#include "vp9/common/vp9_common.h"
#include "vp9/common/vp9_common_data.h"
-#include "vp9/common/vp9_enums.h"
#include "vp9/common/vp9_filter.h"
-#include "vp9/common/vp9_idct.h"
#include "vp9/common/vp9_mv.h"
#include "vp9/common/vp9_scale.h"
-#include "vp9/common/vp9_seg_common.h"
#ifdef __cplusplus
extern "C" {
@@ -47,6 +43,8 @@
PLANE_TYPES
} PLANE_TYPE;
+#define MAX_MB_PLANE 3
+
typedef char ENTROPY_CONTEXT;
static INLINE int combine_entropy_contexts(ENTROPY_CONTEXT a,
@@ -160,8 +158,6 @@
MV_PRECISION_Q4
};
-enum { MAX_MB_PLANE = 3 };
-
struct buf_2d {
uint8_t *buf;
int stride;
diff --git a/vp9/common/vp9_entropy.h b/vp9/common/vp9_entropy.h
index 8cdfc5c..239c049 100644
--- a/vp9/common/vp9_entropy.h
+++ b/vp9/common/vp9_entropy.h
@@ -13,8 +13,8 @@
#include "vpx/vpx_integer.h"
-#include "vp9/common/vp9_blockd.h"
#include "vp9/common/vp9_common.h"
+#include "vp9/common/vp9_prob.h"
#include "vp9/common/vp9_scan.h"
#ifdef __cplusplus
diff --git a/vp9/common/vp9_quant_common.h b/vp9/common/vp9_quant_common.h
index b626605..4bae4a8 100644
--- a/vp9/common/vp9_quant_common.h
+++ b/vp9/common/vp9_quant_common.h
@@ -12,7 +12,7 @@
#define VP9_COMMON_VP9_QUANT_COMMON_H_
#include "vpx/vpx_codec.h"
-#include "vp9/common/vp9_blockd.h"
+#include "vp9/common/vp9_seg_common.h"
#ifdef __cplusplus
extern "C" {
diff --git a/vp9/common/vp9_rtcd_defs.pl b/vp9/common/vp9_rtcd_defs.pl
index 4904b33..c2a9181 100644
--- a/vp9/common/vp9_rtcd_defs.pl
+++ b/vp9/common/vp9_rtcd_defs.pl
@@ -1112,7 +1112,7 @@
specialize qw/vp9_get_mb_ss/, "$sse2_x86inc";
add_proto qw/unsigned int vp9_avg_8x8/, "const uint8_t *, int p";
-specialize qw/vp9_avg_8x8/, "$sse2_x86inc";
+specialize qw/vp9_avg_8x8 sse2/;
# ENCODEMB INVOKE
diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c
index da5d971..3bd1ee9 100644
--- a/vp9/encoder/vp9_encodeframe.c
+++ b/vp9/encoder/vp9_encodeframe.c
@@ -396,9 +396,10 @@
const int block_width = num_8x8_blocks_wide_lookup[bsize];
const int block_height = num_8x8_blocks_high_lookup[bsize];
// TODO(debargha): Choose this more intelligently.
- const int64_t threshold_multiplier = cm->frame_type == KEY_FRAME ? 64 : 4;
- int64_t threshold = threshold_multiplier *
- vp9_convert_qindex_to_q(cm->base_qindex, cm->bit_depth);
+ const int threshold_multiplier = cm->frame_type == KEY_FRAME ? 64 : 4;
+ int64_t threshold =
+ (int64_t)(threshold_multiplier *
+ vp9_convert_qindex_to_q(cm->base_qindex, cm->bit_depth));
assert(block_height == block_width);
tree_to_node(data, bsize, &vt);
@@ -771,7 +772,7 @@
int mi_row, int mi_col,
int *totalrate, int64_t *totaldist,
BLOCK_SIZE bsize, PICK_MODE_CONTEXT *ctx,
- int64_t best_rd, int block) {
+ int64_t best_rd) {
VP9_COMMON *const cm = &cpi->common;
MACROBLOCK *const x = &cpi->mb;
MACROBLOCKD *const xd = &x->e_mbd;
@@ -788,19 +789,6 @@
// Use the lower precision, but faster, 32x32 fdct for mode selection.
x->use_lp32x32fdct = 1;
- // TODO(JBB): Most other places in the code instead of calling the function
- // and then checking if its not the first 8x8 we put the check in the
- // calling function. Do that here.
- if (bsize < BLOCK_8X8) {
- // When ab_index = 0 all sub-blocks are handled, so for ab_index != 0
- // there is nothing to be done.
- if (block != 0) {
- *totalrate = 0;
- *totaldist = 0;
- return;
- }
- }
-
set_offsets(cpi, tile, mi_row, mi_col, bsize);
mbmi = &xd->mi[0].src_mi->mbmi;
mbmi->sb_type = bsize;
@@ -1584,7 +1572,7 @@
mi_col + (mi_step >> 1) < cm->mi_cols) {
pc_tree->partitioning = PARTITION_NONE;
rd_pick_sb_modes(cpi, tile, mi_row, mi_col, &none_rate, &none_dist, bsize,
- ctx, INT64_MAX, 0);
+ ctx, INT64_MAX);
pl = partition_plane_context(xd, mi_row, mi_col, bsize);
@@ -1602,12 +1590,12 @@
switch (partition) {
case PARTITION_NONE:
rd_pick_sb_modes(cpi, tile, mi_row, mi_col, &last_part_rate,
- &last_part_dist, bsize, ctx, INT64_MAX, 0);
+ &last_part_dist, bsize, ctx, INT64_MAX);
break;
case PARTITION_HORZ:
rd_pick_sb_modes(cpi, tile, mi_row, mi_col, &last_part_rate,
&last_part_dist, subsize, &pc_tree->horizontal[0],
- INT64_MAX, 0);
+ INT64_MAX);
if (last_part_rate != INT_MAX &&
bsize >= BLOCK_8X8 && mi_row + (mi_step >> 1) < cm->mi_rows) {
int rt = 0;
@@ -1616,7 +1604,7 @@
update_state(cpi, ctx, mi_row, mi_col, subsize, 0);
encode_superblock(cpi, tp, 0, mi_row, mi_col, subsize, ctx);
rd_pick_sb_modes(cpi, tile, mi_row + (mi_step >> 1), mi_col, &rt, &dt,
- subsize, &pc_tree->horizontal[1], INT64_MAX, 1);
+ subsize, &pc_tree->horizontal[1], INT64_MAX);
if (rt == INT_MAX || dt == INT64_MAX) {
last_part_rate = INT_MAX;
last_part_dist = INT64_MAX;
@@ -1630,7 +1618,7 @@
case PARTITION_VERT:
rd_pick_sb_modes(cpi, tile, mi_row, mi_col, &last_part_rate,
&last_part_dist, subsize, &pc_tree->vertical[0],
- INT64_MAX, 0);
+ INT64_MAX);
if (last_part_rate != INT_MAX &&
bsize >= BLOCK_8X8 && mi_col + (mi_step >> 1) < cm->mi_cols) {
int rt = 0;
@@ -1640,7 +1628,7 @@
encode_superblock(cpi, tp, 0, mi_row, mi_col, subsize, ctx);
rd_pick_sb_modes(cpi, tile, mi_row, mi_col + (mi_step >> 1), &rt, &dt,
subsize, &pc_tree->vertical[bsize > BLOCK_8X8],
- INT64_MAX, 1);
+ INT64_MAX);
if (rt == INT_MAX || dt == INT64_MAX) {
last_part_rate = INT_MAX;
last_part_dist = INT64_MAX;
@@ -1654,7 +1642,7 @@
if (bsize == BLOCK_8X8) {
rd_pick_sb_modes(cpi, tile, mi_row, mi_col, &last_part_rate,
&last_part_dist, subsize, pc_tree->leaf_split[0],
- INT64_MAX, 0);
+ INT64_MAX);
break;
}
last_part_rate = 0;
@@ -1722,7 +1710,7 @@
pc_tree->split[i]->partitioning = PARTITION_NONE;
rd_pick_sb_modes(cpi, tile, mi_row + y_idx, mi_col + x_idx, &rt, &dt,
split_subsize, &pc_tree->split[i]->none,
- INT64_MAX, i);
+ INT64_MAX);
restore_context(cpi, mi_row, mi_col, a, l, sa, sl, bsize);
@@ -2258,7 +2246,7 @@
// PARTITION_NONE
if (partition_none_allowed) {
rd_pick_sb_modes(cpi, tile, mi_row, mi_col, &this_rate, &this_dist, bsize,
- ctx, best_rd, 0);
+ ctx, best_rd);
if (this_rate != INT_MAX) {
if (bsize >= BLOCK_8X8) {
pl = partition_plane_context(xd, mi_row, mi_col, bsize);
@@ -2360,7 +2348,7 @@
pc_tree->leaf_split[0]->pred_interp_filter =
ctx->mic.mbmi.interp_filter;
rd_pick_sb_modes(cpi, tile, mi_row, mi_col, &sum_rate, &sum_dist, subsize,
- pc_tree->leaf_split[0], best_rd, 0);
+ pc_tree->leaf_split[0], best_rd);
if (sum_rate == INT_MAX)
sum_rd = INT64_MAX;
else
@@ -2421,10 +2409,11 @@
pc_tree->horizontal[0].pred_interp_filter =
ctx->mic.mbmi.interp_filter;
rd_pick_sb_modes(cpi, tile, mi_row, mi_col, &sum_rate, &sum_dist, subsize,
- &pc_tree->horizontal[0], best_rd, 0);
+ &pc_tree->horizontal[0], best_rd);
sum_rd = RDCOST(x->rdmult, x->rddiv, sum_rate, sum_dist);
- if (sum_rd < best_rd && mi_row + mi_step < cm->mi_rows) {
+ if (sum_rd < best_rd && mi_row + mi_step < cm->mi_rows &&
+ bsize > BLOCK_8X8) {
PICK_MODE_CONTEXT *ctx = &pc_tree->horizontal[0];
update_state(cpi, ctx, mi_row, mi_col, subsize, 0);
encode_superblock(cpi, tp, 0, mi_row, mi_col, subsize, ctx);
@@ -2437,7 +2426,7 @@
ctx->mic.mbmi.interp_filter;
rd_pick_sb_modes(cpi, tile, mi_row + mi_step, mi_col, &this_rate,
&this_dist, subsize, &pc_tree->horizontal[1],
- best_rd - sum_rd, 1);
+ best_rd - sum_rd);
if (this_rate == INT_MAX) {
sum_rd = INT64_MAX;
} else {
@@ -2470,9 +2459,10 @@
pc_tree->vertical[0].pred_interp_filter =
ctx->mic.mbmi.interp_filter;
rd_pick_sb_modes(cpi, tile, mi_row, mi_col, &sum_rate, &sum_dist, subsize,
- &pc_tree->vertical[0], best_rd, 0);
+ &pc_tree->vertical[0], best_rd);
sum_rd = RDCOST(x->rdmult, x->rddiv, sum_rate, sum_dist);
- if (sum_rd < best_rd && mi_col + mi_step < cm->mi_cols) {
+ if (sum_rd < best_rd && mi_col + mi_step < cm->mi_cols &&
+ bsize > BLOCK_8X8) {
update_state(cpi, &pc_tree->vertical[0], mi_row, mi_col, subsize, 0);
encode_superblock(cpi, tp, 0, mi_row, mi_col, subsize,
&pc_tree->vertical[0]);
@@ -2485,8 +2475,7 @@
ctx->mic.mbmi.interp_filter;
rd_pick_sb_modes(cpi, tile, mi_row, mi_col + mi_step, &this_rate,
&this_dist, subsize,
- &pc_tree->vertical[1], best_rd - sum_rd,
- 1);
+ &pc_tree->vertical[1], best_rd - sum_rd);
if (this_rate == INT_MAX) {
sum_rd = INT64_MAX;
} else {
diff --git a/vp9/encoder/vp9_encoder.h b/vp9/encoder/vp9_encoder.h
index fc6dfcd..6091ae2 100644
--- a/vp9/encoder/vp9_encoder.h
+++ b/vp9/encoder/vp9_encoder.h
@@ -529,8 +529,8 @@
return frame_index & 0x1;
}
-static INLINE int *cond_sad_list(const struct VP9_COMP *cpi, int *sad_list) {
- return cpi->sf.mv.subpel_search_method != SUBPEL_TREE ? sad_list : NULL;
+static INLINE int *cond_cost_list(const struct VP9_COMP *cpi, int *cost_list) {
+ return cpi->sf.mv.subpel_search_method != SUBPEL_TREE ? cost_list : NULL;
}
#ifdef __cplusplus
diff --git a/vp9/encoder/vp9_extend.c b/vp9/encoder/vp9_extend.c
index 5b01bc9..c9b2131 100644
--- a/vp9/encoder/vp9_extend.c
+++ b/vp9/encoder/vp9_extend.c
@@ -110,10 +110,10 @@
// Motion estimation may use src block variance with the block size up
// to 64x64, so the right and bottom need to be extended to 64 multiple
// or up to 16, whichever is greater.
- const int eb_y = MAX(ALIGN_POWER_OF_TWO(src->y_width, 6) - src->y_width,
- 16);
- const int er_y = MAX(ALIGN_POWER_OF_TWO(src->y_height, 6) - src->y_height,
- 16);
+ const int eb_y = MAX(src->y_width + 16, ALIGN_POWER_OF_TWO(src->y_width, 6))
+ - src->y_crop_width;
+ const int er_y = MAX(src->y_height + 16, ALIGN_POWER_OF_TWO(src->y_height, 6))
+ - src->y_crop_height;
const int uv_width_subsampling = (src->uv_width != src->y_width);
const int uv_height_subsampling = (src->uv_height != src->y_height);
const int et_uv = et_y >> uv_height_subsampling;
@@ -125,17 +125,17 @@
if (src->flags & YV12_FLAG_HIGHBITDEPTH) {
highbd_copy_and_extend_plane(src->y_buffer, src->y_stride,
dst->y_buffer, dst->y_stride,
- src->y_width, src->y_height,
+ src->y_crop_width, src->y_crop_height,
et_y, el_y, eb_y, er_y);
highbd_copy_and_extend_plane(src->u_buffer, src->uv_stride,
dst->u_buffer, dst->uv_stride,
- src->uv_width, src->uv_height,
+ src->uv_crop_width, src->uv_crop_height,
et_uv, el_uv, eb_uv, er_uv);
highbd_copy_and_extend_plane(src->v_buffer, src->uv_stride,
dst->v_buffer, dst->uv_stride,
- src->uv_width, src->uv_height,
+ src->uv_crop_width, src->uv_crop_height,
et_uv, el_uv, eb_uv, er_uv);
return;
}
@@ -143,17 +143,17 @@
copy_and_extend_plane(src->y_buffer, src->y_stride,
dst->y_buffer, dst->y_stride,
- src->y_width, src->y_height,
+ src->y_crop_width, src->y_crop_height,
et_y, el_y, eb_y, er_y);
copy_and_extend_plane(src->u_buffer, src->uv_stride,
dst->u_buffer, dst->uv_stride,
- src->uv_width, src->uv_height,
+ src->uv_crop_width, src->uv_crop_height,
et_uv, el_uv, eb_uv, er_uv);
copy_and_extend_plane(src->v_buffer, src->uv_stride,
dst->v_buffer, dst->uv_stride,
- src->uv_width, src->uv_height,
+ src->uv_crop_width, src->uv_crop_height,
et_uv, el_uv, eb_uv, er_uv);
}
diff --git a/vp9/encoder/vp9_firstpass.c b/vp9/encoder/vp9_firstpass.c
index c19120e..f887cd8 100644
--- a/vp9/encoder/vp9_firstpass.c
+++ b/vp9/encoder/vp9_firstpass.c
@@ -1815,8 +1815,6 @@
old_boost_score = boost_score;
}
- twopass->gf_zeromotion_pct = (int)(zero_motion_accumulator * 1000.0);
-
// Set the interval until the next gf.
if (cpi->common.frame_type == KEY_FRAME || rc->source_alt_ref_active)
rc->baseline_gf_interval = i - 1;
@@ -2398,16 +2396,6 @@
if (rc->frames_till_gf_update_due == 0) {
define_gf_group(cpi, &this_frame_copy);
- if (twopass->gf_zeromotion_pct > 995) {
- // As long as max_thresh for encode breakout is small enough, it is ok
- // to enable it for show frame, i.e. set allow_encode_breakout to
- // ENCODE_BREAKOUT_LIMITED.
- if (!cm->show_frame)
- cpi->allow_encode_breakout = ENCODE_BREAKOUT_DISABLED;
- else
- cpi->allow_encode_breakout = ENCODE_BREAKOUT_LIMITED;
- }
-
rc->frames_till_gf_update_due = rc->baseline_gf_interval;
if (lc != NULL)
cpi->refresh_golden_frame = 1;
diff --git a/vp9/encoder/vp9_firstpass.h b/vp9/encoder/vp9_firstpass.h
index 0b82d32..458cd9b 100644
--- a/vp9/encoder/vp9_firstpass.h
+++ b/vp9/encoder/vp9_firstpass.h
@@ -109,8 +109,6 @@
int kf_zeromotion_pct;
int last_kfgroup_zeromotion_pct;
- int gf_zeromotion_pct;
-
int active_worst_quality;
GF_GROUP gf_group;
diff --git a/vp9/encoder/vp9_mbgraph.c b/vp9/encoder/vp9_mbgraph.c
index 42981d8..bd04c56 100644
--- a/vp9/encoder/vp9_mbgraph.c
+++ b/vp9/encoder/vp9_mbgraph.c
@@ -34,7 +34,7 @@
const int tmp_row_min = x->mv_row_min;
const int tmp_row_max = x->mv_row_max;
MV ref_full;
- int sad_list[5];
+ int cost_list[5];
// Further step/diamond searches as necessary
int step_param = mv_sf->reduce_first_step_size;
@@ -47,7 +47,7 @@
/*cpi->sf.search_method == HEX*/
vp9_hex_search(x, &ref_full, step_param, x->errorperbit, 0,
- cond_sad_list(cpi, sad_list),
+ cond_cost_list(cpi, cost_list),
&v_fn_ptr, 0, ref_mv, dst_mv);
// Try sub-pixel MC
@@ -58,7 +58,7 @@
cpi->find_fractional_mv_step(
x, dst_mv, ref_mv, cpi->common.allow_high_precision_mv, x->errorperbit,
&v_fn_ptr, 0, mv_sf->subpel_iters_per_step,
- cond_sad_list(cpi, sad_list),
+ cond_cost_list(cpi, cost_list),
NULL, NULL,
&distortion, &sse, NULL, 0, 0);
}
diff --git a/vp9/encoder/vp9_mcomp.c b/vp9/encoder/vp9_mcomp.c
index 115cd20..69b4193 100644
--- a/vp9/encoder/vp9_mcomp.c
+++ b/vp9/encoder/vp9_mcomp.c
@@ -327,11 +327,11 @@
return ((n < 0) ^ (d < 0)) ? ((n - d / 2) / d) : ((n + d / 2) / d);
}
-static INLINE int is_sad_list_wellbehaved(int *sad_list) {
- return sad_list[0] >= sad_list[1] &&
- sad_list[0] >= sad_list[2] &&
- sad_list[0] >= sad_list[3] &&
- sad_list[0] >= sad_list[4];
+static INLINE int is_cost_list_wellbehaved(int *cost_list) {
+ return cost_list[0] < cost_list[1] &&
+ cost_list[0] < cost_list[2] &&
+ cost_list[0] < cost_list[3] &&
+ cost_list[0] < cost_list[4];
}
// Returns surface minima estimate at given precision in 1/2^n bits.
@@ -342,27 +342,28 @@
// x0 = 1/2 (S1 - S3)/(S1 + S3 - 2*S0),
// y0 = 1/2 (S4 - S2)/(S4 + S2 - 2*S0).
// The code below is an integerized version of that.
-static void get_cost_surf_min(int *sad_list, int *ir, int *ic,
+static void get_cost_surf_min(int *cost_list, int *ir, int *ic,
int bits) {
- *ic = divide_and_round((sad_list[1] - sad_list[3]) * (1 << (bits - 1)),
- (sad_list[1] - 2 * sad_list[0] + sad_list[3]));
- *ir = divide_and_round((sad_list[4] - sad_list[2]) * (1 << (bits - 1)),
- (sad_list[4] - 2 * sad_list[0] + sad_list[2]));
+ *ic = divide_and_round((cost_list[1] - cost_list[3]) * (1 << (bits - 1)),
+ (cost_list[1] - 2 * cost_list[0] + cost_list[3]));
+ *ir = divide_and_round((cost_list[4] - cost_list[2]) * (1 << (bits - 1)),
+ (cost_list[4] - 2 * cost_list[0] + cost_list[2]));
}
-int vp9_find_best_sub_pixel_surface_fit(const MACROBLOCK *x,
- MV *bestmv, const MV *ref_mv,
- int allow_hp,
- int error_per_bit,
- const vp9_variance_fn_ptr_t *vfp,
- int forced_stop,
- int iters_per_step,
- int *sad_list,
- int *mvjcost, int *mvcost[2],
- int *distortion,
- unsigned int *sse1,
- const uint8_t *second_pred,
- int w, int h) {
+int vp9_find_best_sub_pixel_tree_pruned_evenmore(
+ const MACROBLOCK *x,
+ MV *bestmv, const MV *ref_mv,
+ int allow_hp,
+ int error_per_bit,
+ const vp9_variance_fn_ptr_t *vfp,
+ int forced_stop,
+ int iters_per_step,
+ int *cost_list,
+ int *mvjcost, int *mvcost[2],
+ int *distortion,
+ unsigned int *sse1,
+ const uint8_t *second_pred,
+ int w, int h) {
SETUP_SUBPEL_SEARCH;
SETUP_CENTER_ERROR;
(void) halfiters;
@@ -373,16 +374,46 @@
(void) forced_stop;
(void) hstep;
- if (sad_list &&
- sad_list[0] != INT_MAX && sad_list[1] != INT_MAX &&
- sad_list[2] != INT_MAX && sad_list[3] != INT_MAX &&
- sad_list[4] != INT_MAX &&
- is_sad_list_wellbehaved(sad_list)) {
+ if (cost_list &&
+ cost_list[0] != INT_MAX && cost_list[1] != INT_MAX &&
+ cost_list[2] != INT_MAX && cost_list[3] != INT_MAX &&
+ cost_list[4] != INT_MAX &&
+ is_cost_list_wellbehaved(cost_list)) {
int ir, ic;
unsigned int minpt;
- get_cost_surf_min(sad_list, &ir, &ic, 3);
+ get_cost_surf_min(cost_list, &ir, &ic, 2);
if (ir != 0 || ic != 0) {
- CHECK_BETTER(minpt, tr + ir, tc + ic);
+ CHECK_BETTER(minpt, tr + 2 * ir, tc + 2 * ic);
+ }
+ } else {
+ FIRST_LEVEL_CHECKS;
+ if (halfiters > 1) {
+ SECOND_LEVEL_CHECKS;
+ }
+
+ tr = br;
+ tc = bc;
+
+ // Each subsequent iteration checks at least one point in common with
+ // the last iteration could be 2 ( if diag selected) 1/4 pel
+ // Note forced_stop: 0 - full, 1 - qtr only, 2 - half only
+ if (forced_stop != 2) {
+ hstep >>= 1;
+ FIRST_LEVEL_CHECKS;
+ if (quarteriters > 1) {
+ SECOND_LEVEL_CHECKS;
+ }
+ }
+ }
+
+ tr = br;
+ tc = bc;
+
+ if (allow_hp && vp9_use_mv_hp(ref_mv) && forced_stop == 0) {
+ hstep >>= 1;
+ FIRST_LEVEL_CHECKS;
+ if (eighthiters > 1) {
+ SECOND_LEVEL_CHECKS;
}
}
@@ -403,7 +434,7 @@
const vp9_variance_fn_ptr_t *vfp,
int forced_stop,
int iters_per_step,
- int *sad_list,
+ int *cost_list,
int *mvjcost, int *mvcost[2],
int *distortion,
unsigned int *sse1,
@@ -411,14 +442,14 @@
int w, int h) {
SETUP_SUBPEL_SEARCH;
SETUP_CENTER_ERROR;
- if (sad_list &&
- sad_list[0] != INT_MAX && sad_list[1] != INT_MAX &&
- sad_list[2] != INT_MAX && sad_list[3] != INT_MAX &&
- sad_list[4] != INT_MAX &&
- is_sad_list_wellbehaved(sad_list)) {
+ if (cost_list &&
+ cost_list[0] != INT_MAX && cost_list[1] != INT_MAX &&
+ cost_list[2] != INT_MAX && cost_list[3] != INT_MAX &&
+ cost_list[4] != INT_MAX &&
+ is_cost_list_wellbehaved(cost_list)) {
unsigned int minpt;
int ir, ic;
- get_cost_surf_min(sad_list, &ir, &ic, 1);
+ get_cost_surf_min(cost_list, &ir, &ic, 1);
if (ir != 0 || ic != 0) {
CHECK_BETTER(minpt, tr + ir * hstep, tc + ic * hstep);
}
@@ -429,31 +460,28 @@
}
}
- tr = br;
- tc = bc;
-
// Each subsequent iteration checks at least one point in common with
// the last iteration could be 2 ( if diag selected) 1/4 pel
// Note forced_stop: 0 - full, 1 - qtr only, 2 - half only
if (forced_stop != 2) {
+ tr = br;
+ tc = bc;
hstep >>= 1;
FIRST_LEVEL_CHECKS;
if (quarteriters > 1) {
SECOND_LEVEL_CHECKS;
}
- tr = br;
- tc = bc;
}
if (allow_hp && vp9_use_mv_hp(ref_mv) && forced_stop == 0) {
+ tr = br;
+ tc = bc;
hstep >>= 1;
FIRST_LEVEL_CHECKS;
if (eighthiters > 1) {
SECOND_LEVEL_CHECKS;
}
- tr = br;
- tc = bc;
}
// These lines insure static analysis doesn't warn that
// tr and tc aren't used after the above point.
@@ -477,7 +505,7 @@
const vp9_variance_fn_ptr_t *vfp,
int forced_stop,
int iters_per_step,
- int *sad_list,
+ int *cost_list,
int *mvjcost, int *mvcost[2],
int *distortion,
unsigned int *sse1,
@@ -485,13 +513,13 @@
int w, int h) {
SETUP_SUBPEL_SEARCH;
SETUP_CENTER_ERROR;
- if (sad_list &&
- sad_list[0] != INT_MAX && sad_list[1] != INT_MAX &&
- sad_list[2] != INT_MAX && sad_list[3] != INT_MAX &&
- sad_list[4] != INT_MAX) {
+ if (cost_list &&
+ cost_list[0] != INT_MAX && cost_list[1] != INT_MAX &&
+ cost_list[2] != INT_MAX && cost_list[3] != INT_MAX &&
+ cost_list[4] != INT_MAX) {
unsigned int left, right, up, down, diag;
- whichdir = (sad_list[1] < sad_list[3] ? 0 : 1) +
- (sad_list[2] < sad_list[4] ? 0 : 2);
+ whichdir = (cost_list[1] < cost_list[3] ? 0 : 1) +
+ (cost_list[2] < cost_list[4] ? 0 : 2);
switch (whichdir) {
case 0:
CHECK_BETTER(left, tr, tc - hstep);
@@ -569,7 +597,7 @@
const vp9_variance_fn_ptr_t *vfp,
int forced_stop,
int iters_per_step,
- int *sad_list,
+ int *cost_list,
int *mvjcost, int *mvcost[2],
int *distortion,
unsigned int *sse1,
@@ -577,7 +605,7 @@
int w, int h) {
SETUP_SUBPEL_SEARCH;
SETUP_CENTER_ERROR;
- (void) sad_list; // to silence compiler warning
+ (void) cost_list; // to silence compiler warning
// Each subsequent iteration checks at least one point in
// common with the last iteration could be 2 ( if diag selected)
@@ -661,12 +689,12 @@
#define PATTERN_CANDIDATES_REF 3 // number of refinement candidates
// Calculate and return a sad+mvcost list around an integer best pel.
-static INLINE void calc_int_sad_cost_list(MACROBLOCK *x,
- const MV *ref_mv,
- int sadpb,
- const vp9_variance_fn_ptr_t *fn_ptr,
- const MV *best_mv,
- int *cost_list) {
+static INLINE void calc_int_cost_list(const MACROBLOCK *x,
+ const MV *ref_mv,
+ int sadpb,
+ const vp9_variance_fn_ptr_t *fn_ptr,
+ const MV *best_mv,
+ int *cost_list) {
static const MV neighbors[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}};
const struct buf_2d *const what = &x->plane[0].src;
const struct buf_2d *const in_what = &x->e_mbd.plane[0].pre[0];
@@ -675,21 +703,24 @@
int bc = best_mv->col;
MV this_mv;
int i;
+ unsigned int sse;
this_mv.row = br;
this_mv.col = bc;
- cost_list[0] = fn_ptr->sdf(what->buf, what->stride,
- get_buf_from_mv(in_what, &this_mv),
- in_what->stride) +
+ cost_list[0] = fn_ptr->vf(what->buf, what->stride,
+ get_buf_from_mv(in_what, &this_mv),
+ in_what->stride, &sse) +
mvsad_err_cost(x, &this_mv, &fcenter_mv, sadpb);
if (check_bounds(x, br, bc, 1)) {
for (i = 0; i < 4; i++) {
const MV this_mv = {br + neighbors[i].row,
bc + neighbors[i].col};
- cost_list[i + 1] = fn_ptr->sdf(what->buf, what->stride,
- get_buf_from_mv(in_what, &this_mv),
- in_what->stride) +
- mvsad_err_cost(x, &this_mv, &fcenter_mv, sadpb);
+ cost_list[i + 1] = fn_ptr->vf(what->buf, what->stride,
+ get_buf_from_mv(in_what, &this_mv),
+ in_what->stride, &sse) +
+ // mvsad_err_cost(x, &this_mv, &fcenter_mv, sadpb);
+ mv_err_cost(&this_mv, &fcenter_mv, x->nmvjointcost, x->mvcost,
+ x->errorperbit);
}
} else {
for (i = 0; i < 4; i++) {
@@ -698,10 +729,12 @@
if (!is_mv_in(x, &this_mv))
cost_list[i + 1] = INT_MAX;
else
- cost_list[i + 1] = fn_ptr->sdf(what->buf, what->stride,
- get_buf_from_mv(in_what, &this_mv),
- in_what->stride) +
- mvsad_err_cost(x, &this_mv, &fcenter_mv, sadpb);
+ cost_list[i + 1] = fn_ptr->vf(what->buf, what->stride,
+ get_buf_from_mv(in_what, &this_mv),
+ in_what->stride, &sse) +
+ // mvsad_err_cost(x, &this_mv, &fcenter_mv, sadpb);
+ mv_err_cost(&this_mv, &fcenter_mv, x->nmvjointcost, x->mvcost,
+ x->errorperbit);
}
}
}
@@ -716,7 +749,7 @@
int search_param,
int sad_per_bit,
int do_init_search,
- int *sad_list,
+ int *cost_list,
const vp9_variance_fn_ptr_t *vfp,
int use_mvcost,
const MV *center_mv,
@@ -868,40 +901,14 @@
}
// Returns the one-away integer pel sad values around the best as follows:
- // sad_list[0]: sad at the best integer pel
- // sad_list[1]: sad at delta {0, -1} (left) from the best integer pel
- // sad_list[2]: sad at delta { 1, 0} (bottom) from the best integer pel
- // sad_list[3]: sad at delta { 0, 1} (right) from the best integer pel
- // sad_list[4]: sad at delta {-1, 0} (top) from the best integer pel
- if (sad_list) {
- static const MV neighbors[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}};
- sad_list[0] = bestsad;
- if (check_bounds(x, br, bc, 1)) {
- for (i = 0; i < 4; i++) {
- const MV this_mv = {br + neighbors[i].row,
- bc + neighbors[i].col};
- sad_list[i + 1] = vfp->sdf(what->buf, what->stride,
- get_buf_from_mv(in_what, &this_mv),
- in_what->stride) +
- (use_mvcost ?
- mvsad_err_cost(x, &this_mv, &fcenter_mv, sad_per_bit) :
- 0);
- }
- } else {
- for (i = 0; i < 4; i++) {
- const MV this_mv = {br + neighbors[i].row,
- bc + neighbors[i].col};
- if (!is_mv_in(x, &this_mv))
- sad_list[i + 1] = INT_MAX;
- else
- sad_list[i + 1] = vfp->sdf(what->buf, what->stride,
- get_buf_from_mv(in_what, &this_mv),
- in_what->stride) +
- (use_mvcost ?
- mvsad_err_cost(x, &this_mv, &fcenter_mv, sad_per_bit) :
- 0);
- }
- }
+ // cost_list[0]: cost at the best integer pel
+ // cost_list[1]: cost at delta {0, -1} (left) from the best integer pel
+ // cost_list[2]: cost at delta { 1, 0} (bottom) from the best integer pel
+ // cost_list[3]: cost at delta { 0, 1} (right) from the best integer pel
+ // cost_list[4]: cost at delta {-1, 0} (top) from the best integer pel
+ if (cost_list) {
+ const MV best_mv = { br, bc };
+ calc_int_cost_list(x, &fcenter_mv, sad_per_bit, vfp, &best_mv, cost_list);
}
best_mv->row = br;
best_mv->col = bc;
@@ -909,7 +916,7 @@
}
// A specialized function where the smallest scale search candidates
-// are 4 1-away neighbors, and sad_list is non-null
+// are 4 1-away neighbors, and cost_list is non-null
// TODO(debargha): Merge this function with the one above. Also remove
// use_mvcost option since it is always 1, to save unnecessary branches.
static int vp9_pattern_search_sad(const MACROBLOCK *x,
@@ -917,7 +924,7 @@
int search_param,
int sad_per_bit,
int do_init_search,
- int *sad_list,
+ int *cost_list,
const vp9_variance_fn_ptr_t *vfp,
int use_mvcost,
const MV *center_mv,
@@ -942,8 +949,8 @@
clamp_mv(ref_mv, x->mv_col_min, x->mv_col_max, x->mv_row_min, x->mv_row_max);
br = ref_mv->row;
bc = ref_mv->col;
- if (sad_list != NULL) {
- sad_list[0] = sad_list[1] = sad_list[2] = sad_list[3] = sad_list[4] =
+ if (cost_list != NULL) {
+ cost_list[0] = cost_list[1] = cost_list[2] = cost_list[3] = cost_list[4] =
INT_MAX;
}
@@ -997,7 +1004,7 @@
// If the center point is still the best, just skip this and move to
// the refinement step.
if (best_init_s != -1) {
- int do_sad = (num_candidates[0] == 4 && sad_list != NULL);
+ int do_sad = (num_candidates[0] == 4 && cost_list != NULL);
int best_site = -1;
s = best_init_s;
@@ -1071,15 +1078,15 @@
} while (best_site != -1);
}
- // Note: If we enter the if below, then sad_list must be non-NULL.
+ // Note: If we enter the if below, then cost_list must be non-NULL.
if (s == 0) {
- sad_list[0] = bestsad;
+ cost_list[0] = bestsad;
if (!do_init_search || s != best_init_s) {
if (check_bounds(x, br, bc, 1 << s)) {
for (i = 0; i < num_candidates[s]; i++) {
const MV this_mv = {br + candidates[s][i].row,
bc + candidates[s][i].col};
- sad_list[i + 1] =
+ cost_list[i + 1] =
thissad = vfp->sdf(what->buf, what->stride,
get_buf_from_mv(in_what, &this_mv),
in_what->stride);
@@ -1091,7 +1098,7 @@
bc + candidates[s][i].col};
if (!is_mv_in(x, &this_mv))
continue;
- sad_list[i + 1] =
+ cost_list[i + 1] =
thissad = vfp->sdf(what->buf, what->stride,
get_buf_from_mv(in_what, &this_mv),
in_what->stride);
@@ -1111,15 +1118,15 @@
next_chkpts_indices[0] = (k == 0) ? num_candidates[s] - 1 : k - 1;
next_chkpts_indices[1] = k;
next_chkpts_indices[2] = (k == num_candidates[s] - 1) ? 0 : k + 1;
- sad_list[1] = sad_list[2] = sad_list[3] = sad_list[4] = INT_MAX;
- sad_list[((k + 2) % 4) + 1] = sad_list[0];
- sad_list[0] = bestsad;
+ cost_list[1] = cost_list[2] = cost_list[3] = cost_list[4] = INT_MAX;
+ cost_list[((k + 2) % 4) + 1] = cost_list[0];
+ cost_list[0] = bestsad;
if (check_bounds(x, br, bc, 1 << s)) {
for (i = 0; i < PATTERN_CANDIDATES_REF; i++) {
const MV this_mv = {br + candidates[s][next_chkpts_indices[i]].row,
bc + candidates[s][next_chkpts_indices[i]].col};
- sad_list[next_chkpts_indices[i] + 1] =
+ cost_list[next_chkpts_indices[i] + 1] =
thissad = vfp->sdf(what->buf, what->stride,
get_buf_from_mv(in_what, &this_mv),
in_what->stride);
@@ -1130,10 +1137,10 @@
const MV this_mv = {br + candidates[s][next_chkpts_indices[i]].row,
bc + candidates[s][next_chkpts_indices[i]].col};
if (!is_mv_in(x, &this_mv)) {
- sad_list[next_chkpts_indices[i] + 1] = INT_MAX;
+ cost_list[next_chkpts_indices[i] + 1] = INT_MAX;
continue;
}
- sad_list[next_chkpts_indices[i] + 1] =
+ cost_list[next_chkpts_indices[i] + 1] =
thissad = vfp->sdf(what->buf, what->stride,
get_buf_from_mv(in_what, &this_mv),
in_what->stride);
@@ -1151,20 +1158,20 @@
}
// Returns the one-away integer pel sad values around the best as follows:
- // sad_list[0]: sad at the best integer pel
- // sad_list[1]: sad at delta {0, -1} (left) from the best integer pel
- // sad_list[2]: sad at delta { 1, 0} (bottom) from the best integer pel
- // sad_list[3]: sad at delta { 0, 1} (right) from the best integer pel
- // sad_list[4]: sad at delta {-1, 0} (top) from the best integer pel
- if (sad_list) {
+ // cost_list[0]: sad at the best integer pel
+ // cost_list[1]: sad at delta {0, -1} (left) from the best integer pel
+ // cost_list[2]: sad at delta { 1, 0} (bottom) from the best integer pel
+ // cost_list[3]: sad at delta { 0, 1} (right) from the best integer pel
+ // cost_list[4]: sad at delta {-1, 0} (top) from the best integer pel
+ if (cost_list) {
static const MV neighbors[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}};
- if (sad_list[0] == INT_MAX) {
- sad_list[0] = bestsad;
+ if (cost_list[0] == INT_MAX) {
+ cost_list[0] = bestsad;
if (check_bounds(x, br, bc, 1)) {
for (i = 0; i < 4; i++) {
- const MV this_mv = {br + neighbors[i].row,
- bc + neighbors[i].col};
- sad_list[i + 1] = vfp->sdf(what->buf, what->stride,
+ const MV this_mv = { br + neighbors[i].row,
+ bc + neighbors[i].col };
+ cost_list[i + 1] = vfp->sdf(what->buf, what->stride,
get_buf_from_mv(in_what, &this_mv),
in_what->stride);
}
@@ -1173,9 +1180,9 @@
const MV this_mv = {br + neighbors[i].row,
bc + neighbors[i].col};
if (!is_mv_in(x, &this_mv))
- sad_list[i + 1] = INT_MAX;
+ cost_list[i + 1] = INT_MAX;
else
- sad_list[i + 1] = vfp->sdf(what->buf, what->stride,
+ cost_list[i + 1] = vfp->sdf(what->buf, what->stride,
get_buf_from_mv(in_what, &this_mv),
in_what->stride);
}
@@ -1185,8 +1192,8 @@
for (i = 0; i < 4; i++) {
const MV this_mv = {br + neighbors[i].row,
bc + neighbors[i].col};
- if (sad_list[i + 1] != INT_MAX) {
- sad_list[i + 1] +=
+ if (cost_list[i + 1] != INT_MAX) {
+ cost_list[i + 1] +=
mvsad_err_cost(x, &this_mv, &fcenter_mv, sad_per_bit);
}
}
@@ -1236,7 +1243,7 @@
int search_param,
int sad_per_bit,
int do_init_search,
- int *sad_list,
+ int *cost_list,
const vp9_variance_fn_ptr_t *vfp,
int use_mvcost,
const MV *center_mv, MV *best_mv) {
@@ -1261,7 +1268,7 @@
{ -1024, 0}},
};
return vp9_pattern_search(x, ref_mv, search_param, sad_per_bit,
- do_init_search, sad_list, vfp, use_mvcost,
+ do_init_search, cost_list, vfp, use_mvcost,
center_mv, best_mv,
hex_num_candidates, hex_candidates);
}
@@ -1271,7 +1278,7 @@
int search_param,
int sad_per_bit,
int do_init_search,
- int *sad_list,
+ int *cost_list,
const vp9_variance_fn_ptr_t *vfp,
int use_mvcost,
const MV *center_mv,
@@ -1303,7 +1310,7 @@
{-512, 512}, {-1024, 0}},
};
return vp9_pattern_search_sad(x, ref_mv, search_param, sad_per_bit,
- do_init_search, sad_list, vfp, use_mvcost,
+ do_init_search, cost_list, vfp, use_mvcost,
center_mv, best_mv,
bigdia_num_candidates, bigdia_candidates);
}
@@ -1313,7 +1320,7 @@
int search_param,
int sad_per_bit,
int do_init_search,
- int *sad_list,
+ int *cost_list,
const vp9_variance_fn_ptr_t *vfp,
int use_mvcost,
const MV *center_mv,
@@ -1345,7 +1352,7 @@
{0, 1024}, {-1024, 1024}, {-1024, 0}},
};
return vp9_pattern_search(x, ref_mv, search_param, sad_per_bit,
- do_init_search, sad_list, vfp, use_mvcost,
+ do_init_search, cost_list, vfp, use_mvcost,
center_mv, best_mv,
square_num_candidates, square_candidates);
}
@@ -1355,13 +1362,13 @@
int search_param,
int sad_per_bit,
int do_init_search, // must be zero for fast_hex
- int *sad_list,
+ int *cost_list,
const vp9_variance_fn_ptr_t *vfp,
int use_mvcost,
const MV *center_mv,
MV *best_mv) {
return vp9_hex_search(x, ref_mv, MAX(MAX_MVSEARCH_STEPS - 2, search_param),
- sad_per_bit, do_init_search, sad_list, vfp, use_mvcost,
+ sad_per_bit, do_init_search, cost_list, vfp, use_mvcost,
center_mv, best_mv);
}
@@ -1370,13 +1377,13 @@
int search_param,
int sad_per_bit,
int do_init_search,
- int *sad_list,
+ int *cost_list,
const vp9_variance_fn_ptr_t *vfp,
int use_mvcost,
const MV *center_mv,
MV *best_mv) {
return vp9_bigdia_search(x, ref_mv, MAX(MAX_MVSEARCH_STEPS - 2, search_param),
- sad_per_bit, do_init_search, sad_list, vfp,
+ sad_per_bit, do_init_search, cost_list, vfp,
use_mvcost, center_mv, best_mv);
}
@@ -1659,7 +1666,7 @@
// Return cost list.
if (cost_list) {
- calc_int_sad_cost_list(x, ref_mv, sadpb, fn_ptr, dst_mv, cost_list);
+ calc_int_cost_list(x, ref_mv, sadpb, fn_ptr, dst_mv, cost_list);
}
return bestsme;
}
@@ -1980,46 +1987,46 @@
int vp9_full_pixel_search(VP9_COMP *cpi, MACROBLOCK *x,
BLOCK_SIZE bsize, MV *mvp_full,
int step_param, int error_per_bit,
- int *sad_list,
+ int *cost_list,
const MV *ref_mv, MV *tmp_mv,
int var_max, int rd) {
const SPEED_FEATURES *const sf = &cpi->sf;
const SEARCH_METHODS method = sf->mv.search_method;
vp9_variance_fn_ptr_t *fn_ptr = &cpi->fn_ptr[bsize];
int var = 0;
- if (sad_list) {
- sad_list[0] = INT_MAX;
- sad_list[1] = INT_MAX;
- sad_list[2] = INT_MAX;
- sad_list[3] = INT_MAX;
- sad_list[4] = INT_MAX;
+ if (cost_list) {
+ cost_list[0] = INT_MAX;
+ cost_list[1] = INT_MAX;
+ cost_list[2] = INT_MAX;
+ cost_list[3] = INT_MAX;
+ cost_list[4] = INT_MAX;
}
switch (method) {
case FAST_DIAMOND:
var = vp9_fast_dia_search(x, mvp_full, step_param, error_per_bit, 0,
- sad_list, fn_ptr, 1, ref_mv, tmp_mv);
+ cost_list, fn_ptr, 1, ref_mv, tmp_mv);
break;
case FAST_HEX:
var = vp9_fast_hex_search(x, mvp_full, step_param, error_per_bit, 0,
- sad_list, fn_ptr, 1, ref_mv, tmp_mv);
+ cost_list, fn_ptr, 1, ref_mv, tmp_mv);
break;
case HEX:
var = vp9_hex_search(x, mvp_full, step_param, error_per_bit, 1,
- sad_list, fn_ptr, 1, ref_mv, tmp_mv);
+ cost_list, fn_ptr, 1, ref_mv, tmp_mv);
break;
case SQUARE:
var = vp9_square_search(x, mvp_full, step_param, error_per_bit, 1,
- sad_list, fn_ptr, 1, ref_mv, tmp_mv);
+ cost_list, fn_ptr, 1, ref_mv, tmp_mv);
break;
case BIGDIA:
var = vp9_bigdia_search(x, mvp_full, step_param, error_per_bit, 1,
- sad_list, fn_ptr, 1, ref_mv, tmp_mv);
+ cost_list, fn_ptr, 1, ref_mv, tmp_mv);
break;
case NSTEP:
var = vp9_full_pixel_diamond(cpi, x, mvp_full, step_param, error_per_bit,
MAX_MVSEARCH_STEPS - 1 - step_param,
- 1, sad_list, fn_ptr, ref_mv, tmp_mv);
+ 1, cost_list, fn_ptr, ref_mv, tmp_mv);
break;
default:
assert(!"Invalid search method.");
diff --git a/vp9/encoder/vp9_mcomp.h b/vp9/encoder/vp9_mcomp.h
index 3156cb2..9ddca25 100644
--- a/vp9/encoder/vp9_mcomp.h
+++ b/vp9/encoder/vp9_mcomp.h
@@ -80,7 +80,7 @@
int search_param,
int error_per_bit,
int do_init_search,
- int *sad_list,
+ int *cost_list,
const vp9_variance_fn_ptr_t *vf,
int use_mvcost,
const MV *center_mv,
@@ -100,7 +100,7 @@
const vp9_variance_fn_ptr_t *vfp,
int forced_stop, // 0 - full, 1 - qtr only, 2 - half only
int iters_per_step,
- int *sad_list,
+ int *cost_list,
int *mvjcost, int *mvcost[2],
int *distortion, unsigned int *sse1,
const uint8_t *second_pred,
@@ -109,7 +109,7 @@
extern fractional_mv_step_fp vp9_find_best_sub_pixel_tree;
extern fractional_mv_step_fp vp9_find_best_sub_pixel_tree_pruned;
extern fractional_mv_step_fp vp9_find_best_sub_pixel_tree_pruned_more;
-extern fractional_mv_step_fp vp9_find_best_sub_pixel_surface_fit;
+extern fractional_mv_step_fp vp9_find_best_sub_pixel_tree_pruned_evenmore;
typedef int (*vp9_full_search_fn_t)(const MACROBLOCK *x,
const MV *ref_mv, int sad_per_bit,
@@ -142,7 +142,7 @@
int vp9_full_pixel_search(struct VP9_COMP *cpi, MACROBLOCK *x,
BLOCK_SIZE bsize, MV *mvp_full,
int step_param, int error_per_bit,
- int *sad_list,
+ int *cost_list,
const MV *ref_mv, MV *tmp_mv,
int var_max, int rd);
diff --git a/vp9/encoder/vp9_pickmode.c b/vp9/encoder/vp9_pickmode.c
index b4e199b..42f4691 100644
--- a/vp9/encoder/vp9_pickmode.c
+++ b/vp9/encoder/vp9_pickmode.c
@@ -132,7 +132,7 @@
const int tmp_row_min = x->mv_row_min;
const int tmp_row_max = x->mv_row_max;
int rv = 0;
- int sad_list[5];
+ int cost_list[5];
const YV12_BUFFER_CONFIG *scaled_ref_frame = vp9_get_scaled_ref_frame(cpi,
ref);
if (cpi->common.show_frame &&
@@ -160,7 +160,7 @@
mvp_full.row >>= 3;
vp9_full_pixel_search(cpi, x, bsize, &mvp_full, step_param, sadpb,
- cond_sad_list(cpi, sad_list),
+ cond_cost_list(cpi, cost_list),
&ref_mv, &tmp_mv->as_mv, INT_MAX, 0);
x->mv_col_min = tmp_col_min;
@@ -187,7 +187,7 @@
&cpi->fn_ptr[bsize],
cpi->sf.mv.subpel_force_stop,
cpi->sf.mv.subpel_iters_per_step,
- cond_sad_list(cpi, sad_list),
+ cond_cost_list(cpi, cost_list),
x->nmvjointcost, x->mvcost,
&dis, &x->pred_sse[ref], NULL, 0, 0);
x->pred_mv[ref] = tmp_mv->as_mv;
diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c
index 952f928..e667272 100644
--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -169,7 +169,8 @@
static void model_rd_for_sb(VP9_COMP *cpi, BLOCK_SIZE bsize,
MACROBLOCK *x, MACROBLOCKD *xd,
- int *out_rate_sum, int64_t *out_dist_sum) {
+ int *out_rate_sum, int64_t *out_dist_sum,
+ int *skip_txfm_sb, int64_t *skip_sse_sb) {
// Note our transform coeffs are 8 times an orthogonal transform.
// Hence quantizer step is also 8 times. To get effective quantizer
// we need to divide by 8 before sending to modeling function.
@@ -180,6 +181,8 @@
unsigned int sse;
unsigned int var = 0;
unsigned int sum_sse = 0;
+ int64_t total_sse = 0;
+ int skip_flag = 1;
const int shift = 6;
int rate;
int64_t dist;
@@ -192,6 +195,12 @@
const BLOCK_SIZE bs = get_plane_block_size(bsize, pd);
const TX_SIZE max_tx_size = max_txsize_lookup[bs];
const BLOCK_SIZE unit_size = txsize_to_bsize[max_tx_size];
+ const int64_t dc_thr = p->quant_thred[0] >> shift;
+ const int64_t ac_thr = p->quant_thred[1] >> shift;
+ // The low thresholds are used to measure if the prediction errors are
+ // low enough so that we can skip the mode search.
+ const int64_t low_dc_thr = MIN(50, dc_thr >> 2);
+ const int64_t low_ac_thr = MIN(80, ac_thr >> 2);
int bw = 1 << (b_width_log2_lookup[bs] - b_width_log2_lookup[unit_size]);
int bh = 1 << (b_height_log2_lookup[bs] - b_width_log2_lookup[unit_size]);
int idx, idy;
@@ -205,6 +214,7 @@
uint8_t *src = p->src.buf + (idy * p->src.stride << lh) + (idx << lw);
uint8_t *dst = pd->dst.buf + (idy * pd->dst.stride << lh) + (idx << lh);
int block_idx = (idy << 1) + idx;
+ int low_err_skip = 0;
var = cpi->fn_ptr[unit_size].vf(src, p->src.stride,
dst, pd->dst.stride, &sse);
@@ -214,20 +224,29 @@
x->skip_txfm[(i << 2) + block_idx] = 0;
if (!x->select_tx_size) {
// Check if all ac coefficients can be quantized to zero.
- if (var < p->quant_thred[1] >> shift) {
+ if (var < ac_thr || var == 0) {
x->skip_txfm[(i << 2) + block_idx] = 2;
// Check if dc coefficient can be quantized to zero.
- if (sse - var < p->quant_thred[0] >> shift)
+ if (sse - var < dc_thr || sse == var) {
x->skip_txfm[(i << 2) + block_idx] = 1;
+
+ if (!sse || (var < low_ac_thr && sse - var < low_dc_thr))
+ low_err_skip = 1;
+ }
}
}
+ if (skip_flag && !low_err_skip)
+ skip_flag = 0;
+
if (i == 0)
x->pred_sse[ref] += sse;
}
}
+ total_sse += sum_sse;
+
// Fast approximate the modelling function.
if (cpi->oxcf.speed > 4) {
int64_t rate;
@@ -265,6 +284,8 @@
}
}
+ *skip_txfm_sb = skip_flag;
+ *skip_sse_sb = total_sse << 4;
*out_rate_sum = (int)rate_sum;
*out_dist_sum = dist_sum << 4;
}
@@ -1607,7 +1628,7 @@
int sadpb = x->sadperbit4;
MV mvp_full;
int max_mv;
- int sad_list[5];
+ int cost_list[5];
/* Is the best so far sufficiently good that we cant justify doing
* and new motion search. */
@@ -1653,7 +1674,7 @@
bestsme = vp9_full_pixel_search(
cpi, x, bsize, &mvp_full, step_param, sadpb,
- cpi->sf.mv.subpel_search_method != SUBPEL_TREE ? sad_list : NULL,
+ cpi->sf.mv.subpel_search_method != SUBPEL_TREE ? cost_list : NULL,
&bsi->ref_mv[0]->as_mv, new_mv,
INT_MAX, 1);
@@ -1667,7 +1688,7 @@
sadpb, 16, &cpi->fn_ptr[bsize],
&bsi->ref_mv[0]->as_mv,
&best_mv->as_mv);
- sad_list[1] = sad_list[2] = sad_list[3] = sad_list[4] = INT_MAX;
+ cost_list[1] = cost_list[2] = cost_list[3] = cost_list[4] = INT_MAX;
if (thissme < bestsme) {
bestsme = thissme;
*new_mv = best_mv->as_mv;
@@ -1688,7 +1709,7 @@
x->errorperbit, &cpi->fn_ptr[bsize],
cpi->sf.mv.subpel_force_stop,
cpi->sf.mv.subpel_iters_per_step,
- cond_sad_list(cpi, sad_list),
+ cond_cost_list(cpi, cost_list),
x->nmvjointcost, x->mvcost,
&distortion,
&x->pred_sse[mbmi->ref_frame[0]],
@@ -1952,27 +1973,11 @@
int64_t best_filter_diff[SWITCHABLE_FILTER_CONTEXTS],
int skippable) {
MACROBLOCKD *const xd = &x->e_mbd;
- int plane, has_high_freq_coeff = 0;
- BLOCK_SIZE bsize = xd->mi[0].src_mi->mbmi.sb_type;
-
- if (bsize >= BLOCK_8X8) {
- int max_plane = is_inter_block(&xd->mi[0].src_mi->mbmi)
- ? MAX_MB_PLANE : 1;
- for (plane = 0; plane < max_plane; ++plane) {
- x->plane[plane].eobs = ctx->eobs_pbuf[plane][1];
- has_high_freq_coeff |= vp9_has_high_freq_in_plane(x, bsize, plane);
- }
-
- for (plane = max_plane; plane < MAX_MB_PLANE; ++plane) {
- x->plane[plane].eobs = ctx->eobs_pbuf[plane][2];
- has_high_freq_coeff |= vp9_has_high_freq_in_plane(x, bsize, plane);
- }
- }
// Take a snapshot of the coding context so it can be
// restored if we decide to encode this way
ctx->skip = x->skip;
- ctx->skippable = skippable || !has_high_freq_coeff;
+ ctx->skippable = skippable;
ctx->best_mode_index = mode_index;
ctx->mic = *xd->mi[0].src_mi;
ctx->single_pred_diff = (int)comp_pred_diff[SINGLE_REFERENCE];
@@ -2038,7 +2043,7 @@
int tmp_col_max = x->mv_col_max;
int tmp_row_min = x->mv_row_min;
int tmp_row_max = x->mv_row_max;
- int sad_list[5];
+ int cost_list[5];
const YV12_BUFFER_CONFIG *scaled_ref_frame = vp9_get_scaled_ref_frame(cpi,
ref);
@@ -2110,7 +2115,7 @@
mvp_full.row >>= 3;
bestsme = vp9_full_pixel_search(cpi, x, bsize, &mvp_full, step_param, sadpb,
- cond_sad_list(cpi, sad_list),
+ cond_cost_list(cpi, cost_list),
&ref_mv, &tmp_mv->as_mv, INT_MAX, 1);
x->mv_col_min = tmp_col_min;
@@ -2126,7 +2131,7 @@
&cpi->fn_ptr[bsize],
cpi->sf.mv.subpel_force_stop,
cpi->sf.mv.subpel_iters_per_step,
- cond_sad_list(cpi, sad_list),
+ cond_cost_list(cpi, cost_list),
x->nmvjointcost, x->mvcost,
&dis, &x->pred_sse[ref], NULL, 0, 0);
}
@@ -2337,107 +2342,12 @@
}
}
-static void rd_encode_breakout_test(VP9_COMP *cpi, MACROBLOCK *x,
- BLOCK_SIZE bsize, int *rate2,
- int64_t *distortion, int64_t *distortion_uv,
- int *disable_skip) {
- VP9_COMMON *cm = &cpi->common;
- MACROBLOCKD *xd = &x->e_mbd;
- const BLOCK_SIZE y_size = get_plane_block_size(bsize, &xd->plane[0]);
- const BLOCK_SIZE uv_size = get_plane_block_size(bsize, &xd->plane[1]);
- unsigned int var, sse;
- // Skipping threshold for ac.
- unsigned int thresh_ac;
- // Skipping threshold for dc
- unsigned int thresh_dc;
-
- var = cpi->fn_ptr[y_size].vf(x->plane[0].src.buf, x->plane[0].src.stride,
- xd->plane[0].dst.buf,
- xd->plane[0].dst.stride, &sse);
-
- if (x->encode_breakout > 0) {
- // Set a maximum for threshold to avoid big PSNR loss in low bitrate
- // case. Use extreme low threshold for static frames to limit skipping.
- const unsigned int max_thresh = (cpi->allow_encode_breakout ==
- ENCODE_BREAKOUT_LIMITED) ? 128 : 36000;
- // The encode_breakout input
- const unsigned int min_thresh =
- MIN(((unsigned int)x->encode_breakout << 4), max_thresh);
-
- // Calculate threshold according to dequant value.
- thresh_ac = (xd->plane[0].dequant[1] * xd->plane[0].dequant[1]) / 9;
-#if CONFIG_VP9_HIGHBITDEPTH
- if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
- const int shift = 2 * xd->bd - 16;
- if (shift > 0)
- thresh_ac = ROUND_POWER_OF_TWO(thresh_ac, shift);
- }
-#endif // CONFIG_VP9_HIGHBITDEPTH
- thresh_ac = clamp(thresh_ac, min_thresh, max_thresh);
-
- // Adjust threshold according to partition size.
- thresh_ac >>= 8 - (b_width_log2_lookup[bsize] +
- b_height_log2_lookup[bsize]);
- thresh_dc = (xd->plane[0].dequant[0] * xd->plane[0].dequant[0] >> 6);
-#if CONFIG_VP9_HIGHBITDEPTH
- if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
- const int shift = 2 * xd->bd - 16;
- if (shift > 0)
- thresh_dc = ROUND_POWER_OF_TWO(thresh_dc, shift);
- }
-#endif // CONFIG_VP9_HIGHBITDEPTH
- } else {
- thresh_ac = 0;
- thresh_dc = 0;
- }
-
- // Y skipping condition checking
- if (sse < thresh_ac || sse == 0) {
- // dc skipping checking
- if ((sse - var) < thresh_dc || sse == var) {
- unsigned int sse_u, sse_v;
- unsigned int var_u, var_v;
-
- var_u = cpi->fn_ptr[uv_size].vf(x->plane[1].src.buf,
- x->plane[1].src.stride,
- xd->plane[1].dst.buf,
- xd->plane[1].dst.stride, &sse_u);
-
- // U skipping condition checking
- if ((sse_u * 4 < thresh_ac || sse_u == 0) &&
- (sse_u - var_u < thresh_dc || sse_u == var_u)) {
- var_v = cpi->fn_ptr[uv_size].vf(x->plane[2].src.buf,
- x->plane[2].src.stride,
- xd->plane[2].dst.buf,
- xd->plane[2].dst.stride, &sse_v);
-
- // V skipping condition checking
- if ((sse_v * 4 < thresh_ac || sse_v == 0) &&
- (sse_v - var_v < thresh_dc || sse_v == var_v)) {
- x->skip = 1;
-
- // The cost of skip bit needs to be added.
- *rate2 += vp9_cost_bit(vp9_get_skip_prob(cm, xd), 1);
-
- // Scaling factor for SSE from spatial domain to frequency domain
- // is 16. Adjust distortion accordingly.
- *distortion_uv = (sse_u + sse_v) << 4;
- *distortion = (sse << 4) + *distortion_uv;
-
- *disable_skip = 1;
- }
- }
- }
- }
-}
-
static int64_t handle_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
BLOCK_SIZE bsize,
int64_t txfm_cache[],
int *rate2, int64_t *distortion,
int *skippable,
- int *rate_y, int64_t *distortion_y,
- int *rate_uv, int64_t *distortion_uv,
+ int *rate_y, int *rate_uv,
int *disable_skip,
int_mv (*mode_mv)[MAX_REF_FRAMES],
int mi_row, int mi_col,
@@ -2480,6 +2390,10 @@
(((mi_row + mi_col) >> bsl) +
get_chessboard_index(cm->current_video_frame)) & 0x1 : 0;
+ int skip_txfm_sb = 0;
+ int64_t skip_sse_sb = INT64_MAX;
+ int64_t distortion_y = 0, distortion_uv = 0;
+
#if CONFIG_VP9_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
tmp_buf = CONVERT_TO_BYTEPTR(tmp_buf16);
@@ -2597,6 +2511,9 @@
for (i = 0; i < SWITCHABLE_FILTERS; ++i) {
int j;
int64_t rs_rd;
+ int tmp_skip_sb = 0;
+ int64_t tmp_skip_sse = INT64_MAX;
+
mbmi->interp_filter = i;
rs = vp9_get_switchable_rate(cpi);
rs_rd = RDCOST(x->rdmult, x->rddiv, rs, 0);
@@ -2632,7 +2549,8 @@
}
}
vp9_build_inter_predictors_sb(xd, mi_row, mi_col, bsize);
- model_rd_for_sb(cpi, bsize, x, xd, &rate_sum, &dist_sum);
+ model_rd_for_sb(cpi, bsize, x, xd, &rate_sum, &dist_sum,
+ &tmp_skip_sb, &tmp_skip_sse);
rd = RDCOST(x->rdmult, x->rddiv, rate_sum, dist_sum);
rd_opt->filter_cache[i] = rd;
@@ -2669,6 +2587,8 @@
pred_exists = 1;
tmp_rd = best_rd;
+ skip_txfm_sb = tmp_skip_sb;
+ skip_sse_sb = tmp_skip_sse;
vpx_memcpy(skip_txfm, x->skip_txfm, sizeof(skip_txfm));
vpx_memcpy(bsse, x->bsse, sizeof(bsse));
}
@@ -2697,7 +2617,8 @@
// switchable list (ex. bilinear) is indicated at the frame level, or
// skip condition holds.
vp9_build_inter_predictors_sb(xd, mi_row, mi_col, bsize);
- model_rd_for_sb(cpi, bsize, x, xd, &tmp_rate, &tmp_dist);
+ model_rd_for_sb(cpi, bsize, x, xd, &tmp_rate, &tmp_dist,
+ &skip_txfm_sb, &skip_sse_sb);
rd = RDCOST(x->rdmult, x->rddiv, rs + tmp_rate, tmp_dist);
vpx_memcpy(skip_txfm, x->skip_txfm, sizeof(skip_txfm));
vpx_memcpy(bsse, x->bsse, sizeof(bsse));
@@ -2724,23 +2645,17 @@
if (cm->interp_filter == SWITCHABLE)
*rate2 += rs;
- if (!is_comp_pred) {
- if (cpi->allow_encode_breakout)
- rd_encode_breakout_test(cpi, x, bsize, rate2, distortion, distortion_uv,
- disable_skip);
- }
-
vpx_memcpy(x->skip_txfm, skip_txfm, sizeof(skip_txfm));
vpx_memcpy(x->bsse, bsse, sizeof(bsse));
- if (!x->skip) {
+ if (!skip_txfm_sb) {
int skippable_y, skippable_uv;
int64_t sseuv = INT64_MAX;
int64_t rdcosty = INT64_MAX;
// Y cost and distortion
vp9_subtract_plane(x, bsize, 0);
- super_block_yrd(cpi, x, rate_y, distortion_y, &skippable_y, psse,
+ super_block_yrd(cpi, x, rate_y, &distortion_y, &skippable_y, psse,
bsize, txfm_cache, ref_best_rd);
if (*rate_y == INT_MAX) {
@@ -2751,12 +2666,12 @@
}
*rate2 += *rate_y;
- *distortion += *distortion_y;
+ *distortion += distortion_y;
rdcosty = RDCOST(x->rdmult, x->rddiv, *rate2, *distortion);
rdcosty = MIN(rdcosty, RDCOST(x->rdmult, x->rddiv, 0, *psse));
- super_block_uvrd(cpi, x, rate_uv, distortion_uv, &skippable_uv, &sseuv,
+ super_block_uvrd(cpi, x, rate_uv, &distortion_uv, &skippable_uv, &sseuv,
bsize, ref_best_rd - rdcosty);
if (*rate_uv == INT_MAX) {
*rate2 = INT_MAX;
@@ -2767,8 +2682,16 @@
*psse += sseuv;
*rate2 += *rate_uv;
- *distortion += *distortion_uv;
+ *distortion += distortion_uv;
*skippable = skippable_y && skippable_uv;
+ } else {
+ x->skip = 1;
+ *disable_skip = 1;
+
+ // The cost of skip bit needs to be added.
+ *rate2 += vp9_cost_bit(vp9_get_skip_prob(cm, xd), 1);
+
+ *distortion = skip_sse_sb;
}
if (!is_comp_pred)
@@ -2871,7 +2794,6 @@
MACROBLOCKD *const xd = &x->e_mbd;
MB_MODE_INFO *const mbmi = &xd->mi[0].src_mi->mbmi;
const struct segmentation *const seg = &cm->seg;
- struct macroblockd_plane *const pd = xd->plane;
PREDICTION_MODE this_mode;
MV_REFERENCE_FRAME ref_frame, second_ref_frame;
unsigned char segment_id = mbmi->segment_id;
@@ -3225,16 +3147,15 @@
if (ref_frame == INTRA_FRAME) {
TX_SIZE uv_tx;
-
+ struct macroblockd_plane *const pd = &xd->plane[1];
vpx_memset(x->skip_txfm, 0, sizeof(x->skip_txfm));
super_block_yrd(cpi, x, &rate_y, &distortion_y, &skippable,
NULL, bsize, tx_cache, best_rd);
-
if (rate_y == INT_MAX)
continue;
- uv_tx = get_uv_tx_size_impl(mbmi->tx_size, bsize, pd[1].subsampling_x,
- pd[1].subsampling_y);
+ uv_tx = get_uv_tx_size_impl(mbmi->tx_size, bsize, pd->subsampling_x,
+ pd->subsampling_y);
if (rate_uv_intra[uv_tx] == INT_MAX) {
choose_intra_uv_mode(cpi, ctx, bsize, uv_tx,
&rate_uv_intra[uv_tx], &rate_uv_tokenonly[uv_tx],
@@ -3254,8 +3175,7 @@
this_rd = handle_inter_mode(cpi, x, bsize,
tx_cache,
&rate2, &distortion2, &skippable,
- &rate_y, &distortion_y,
- &rate_uv, &distortion_uv,
+ &rate_y, &rate_uv,
&disable_skip, frame_mv,
mi_row, mi_col,
single_newmv, single_inter_filter,
@@ -3528,6 +3448,24 @@
// updating code causes PSNR loss. Need to figure out the confliction.
x->skip |= best_mode_skippable;
+ if (!best_mode_skippable && !x->select_tx_size) {
+ int has_high_freq_coeff = 0;
+ int plane;
+ int max_plane = is_inter_block(&xd->mi[0].src_mi->mbmi)
+ ? MAX_MB_PLANE : 1;
+ for (plane = 0; plane < max_plane; ++plane) {
+ x->plane[plane].eobs = ctx->eobs_pbuf[plane][1];
+ has_high_freq_coeff |= vp9_has_high_freq_in_plane(x, bsize, plane);
+ }
+
+ for (plane = max_plane; plane < MAX_MB_PLANE; ++plane) {
+ x->plane[plane].eobs = ctx->eobs_pbuf[plane][2];
+ has_high_freq_coeff |= vp9_has_high_freq_in_plane(x, bsize, plane);
+ }
+
+ best_mode_skippable |= !has_high_freq_coeff;
+ }
+
store_coding_context(x, ctx, best_mode_index, best_pred_diff,
best_tx_diff, best_filter_diff, best_mode_skippable);
diff --git a/vp9/encoder/vp9_speed_features.c b/vp9/encoder/vp9_speed_features.c
index e45a07b..8788be6 100644
--- a/vp9/encoder/vp9_speed_features.c
+++ b/vp9/encoder/vp9_speed_features.c
@@ -124,7 +124,7 @@
sf->tx_size_search_method = USE_LARGESTALL;
sf->disable_split_mask = DISABLE_ALL_SPLIT;
sf->mv.search_method = BIGDIA;
- sf->mv.subpel_search_method = SUBPEL_TREE_PRUNED;
+ sf->mv.subpel_search_method = SUBPEL_TREE_PRUNED_MORE;
sf->adaptive_rd_thresh = 4;
sf->mode_search_skip_flags |= FLAG_EARLY_TERMINATE;
sf->disable_filter_search_var_thresh = 200;
@@ -151,7 +151,6 @@
sf->intra_y_mode_mask[i] = INTRA_DC;
sf->intra_uv_mode_mask[i] = INTRA_DC;
}
- cpi->allow_encode_breakout = ENCODE_BREAKOUT_ENABLED;
}
if (speed >= 6) {
sf->mv.reduce_first_step_size = 1;
@@ -431,8 +430,8 @@
cpi->find_fractional_mv_step = vp9_find_best_sub_pixel_tree_pruned;
} else if (sf->mv.subpel_search_method == SUBPEL_TREE_PRUNED_MORE) {
cpi->find_fractional_mv_step = vp9_find_best_sub_pixel_tree_pruned_more;
- } else if (sf->mv.subpel_search_method == SUBPEL_SURFACE_FIT) {
- cpi->find_fractional_mv_step = vp9_find_best_sub_pixel_surface_fit;
+ } else if (sf->mv.subpel_search_method == SUBPEL_TREE_PRUNED_EVENMORE) {
+ cpi->find_fractional_mv_step = vp9_find_best_sub_pixel_tree_pruned_evenmore;
}
cpi->mb.optimize = sf->optimize_coefficients == 1 && oxcf->pass != 1;
diff --git a/vp9/encoder/vp9_speed_features.h b/vp9/encoder/vp9_speed_features.h
index cee8ec2..cc6c2e5 100644
--- a/vp9/encoder/vp9_speed_features.h
+++ b/vp9/encoder/vp9_speed_features.h
@@ -81,9 +81,9 @@
typedef enum {
SUBPEL_TREE = 0,
- SUBPEL_TREE_PRUNED = 1,
- SUBPEL_TREE_PRUNED_MORE = 2,
- SUBPEL_SURFACE_FIT = 3,
+ SUBPEL_TREE_PRUNED = 1, // Prunes 1/2-pel searches
+ SUBPEL_TREE_PRUNED_MORE = 2, // Prunes 1/2-pel searches more aggressively
+ SUBPEL_TREE_PRUNED_EVENMORE = 3, // Prunes 1/2- and 1/4-pel searches
// Other methods to come
} SUBPEL_SEARCH_METHODS;
diff --git a/vp9/encoder/vp9_temporal_filter.c b/vp9/encoder/vp9_temporal_filter.c
index d54daec..9ae81e7 100644
--- a/vp9/encoder/vp9_temporal_filter.c
+++ b/vp9/encoder/vp9_temporal_filter.c
@@ -221,7 +221,7 @@
int bestsme = INT_MAX;
int distortion;
unsigned int sse;
- int sad_list[5];
+ int cost_list[5];
MV best_ref_mv1 = {0, 0};
MV best_ref_mv1_full; /* full-pixel value of best_ref_mv1 */
@@ -245,7 +245,7 @@
// Ignore mv costing by sending NULL pointer instead of cost arrays
vp9_hex_search(x, &best_ref_mv1_full, step_param, sadpb, 1,
- cond_sad_list(cpi, sad_list),
+ cond_cost_list(cpi, cost_list),
&cpi->fn_ptr[BLOCK_16X16], 0, &best_ref_mv1, ref_mv);
// Ignore mv costing by sending NULL pointer instead of cost array
@@ -255,7 +255,7 @@
x->errorperbit,
&cpi->fn_ptr[BLOCK_16X16],
0, mv_sf->subpel_iters_per_step,
- cond_sad_list(cpi, sad_list),
+ cond_cost_list(cpi, cost_list),
NULL, NULL,
&distortion, &sse, NULL, 0, 0);
diff --git a/vp9/vp9_iface_common.h b/vp9/vp9_iface_common.h
index 1ce87ef..00fbfdd 100644
--- a/vp9/vp9_iface_common.h
+++ b/vp9/vp9_iface_common.h
@@ -87,6 +87,8 @@
: yv12->y_width;
yv12->uv_height = img->y_chroma_shift == 1 ? (1 + yv12->y_height) / 2
: yv12->y_height;
+ yv12->uv_crop_width = yv12->uv_width;
+ yv12->uv_crop_height = yv12->uv_height;
yv12->y_stride = img->stride[VPX_PLANE_Y];
yv12->uv_stride = img->stride[VPX_PLANE_U];