summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Kovalev <dkovalev@google.com>2013-10-21 10:12:14 -0700
committerDmitry Kovalev <dkovalev@google.com>2013-10-21 10:12:14 -0700
commitd1b65c6bda3ea8ccaf4e052c34a4723fa76d865d (patch)
tree2dd35f8c63e29f11aa00d03190aff778133d7733
parent41ff8d7aaadd6cddad99dbb36bc4be5fc165d7f9 (diff)
downloadlibvpx-d1b65c6bda3ea8ccaf4e052c34a4723fa76d865d.tar
libvpx-d1b65c6bda3ea8ccaf4e052c34a4723fa76d865d.tar.gz
libvpx-d1b65c6bda3ea8ccaf4e052c34a4723fa76d865d.tar.bz2
libvpx-d1b65c6bda3ea8ccaf4e052c34a4723fa76d865d.zip
Moving allow_high_precision_mv from MACROBLOCKD to VP9_COMMON.
This value is a global frame-level flag, not a macroblock-level. Change-Id: Ie8c5790a931150741c2167c00c3e3dd2cf26744d
-rw-r--r--vp9/common/vp9_blockd.h2
-rw-r--r--vp9/common/vp9_findnearmv.c8
-rw-r--r--vp9/common/vp9_findnearmv.h6
-rw-r--r--vp9/common/vp9_onyxc_int.h2
-rw-r--r--vp9/decoder/vp9_decodemv.c16
-rw-r--r--vp9/decoder/vp9_decodemv.h2
-rw-r--r--vp9/decoder/vp9_decodframe.c7
-rw-r--r--vp9/encoder/vp9_bitstream.c7
-rw-r--r--vp9/encoder/vp9_mbgraph.c2
-rw-r--r--vp9/encoder/vp9_onyx_if.c20
-rw-r--r--vp9/encoder/vp9_rdopt.c12
-rw-r--r--vp9/encoder/vp9_temporal_filter.c2
12 files changed, 40 insertions, 46 deletions
diff --git a/vp9/common/vp9_blockd.h b/vp9/common/vp9_blockd.h
index 36e7e8300..31959c150 100644
--- a/vp9/common/vp9_blockd.h
+++ b/vp9/common/vp9_blockd.h
@@ -222,8 +222,6 @@ typedef struct macroblockd {
struct subpix_fn_table subpix;
- int allow_high_precision_mv;
-
int corrupted;
unsigned char sb_index; // index of 32x32 block inside the 64x64 block
diff --git a/vp9/common/vp9_findnearmv.c b/vp9/common/vp9_findnearmv.c
index ed9e9823e..592ef6afa 100644
--- a/vp9/common/vp9_findnearmv.c
+++ b/vp9/common/vp9_findnearmv.c
@@ -22,14 +22,12 @@ static void lower_mv_precision(MV *mv, int allow_hp) {
}
-void vp9_find_best_ref_mvs(MACROBLOCKD *xd,
- int_mv *mvlist,
- int_mv *nearest,
- int_mv *near) {
+void vp9_find_best_ref_mvs(MACROBLOCKD *xd, int allow_hp,
+ int_mv *mvlist, int_mv *nearest, int_mv *near) {
int i;
// Make sure all the candidates are properly clamped etc
for (i = 0; i < MAX_MV_REF_CANDIDATES; ++i) {
- lower_mv_precision(&mvlist[i].as_mv, xd->allow_high_precision_mv);
+ lower_mv_precision(&mvlist[i].as_mv, allow_hp);
clamp_mv2(&mvlist[i].as_mv, xd);
}
*nearest = mvlist[0];
diff --git a/vp9/common/vp9_findnearmv.h b/vp9/common/vp9_findnearmv.h
index 50dfdc7fb..4746a8f64 100644
--- a/vp9/common/vp9_findnearmv.h
+++ b/vp9/common/vp9_findnearmv.h
@@ -23,10 +23,8 @@
// check a list of motion vectors by sad score using a number rows of pixels
// above and a number cols of pixels in the left to select the one with best
// score to use as ref motion vector
-void vp9_find_best_ref_mvs(MACROBLOCKD *xd,
- int_mv *mvlist,
- int_mv *nearest,
- int_mv *near);
+void vp9_find_best_ref_mvs(MACROBLOCKD *xd, int allow_hp,
+ int_mv *mvlist, int_mv *nearest, int_mv *near);
// TODO(jingning): this mv clamping function should be block size dependent.
static void clamp_mv2(MV *mv, const MACROBLOCKD *xd) {
diff --git a/vp9/common/vp9_onyxc_int.h b/vp9/common/vp9_onyxc_int.h
index 3111852ee..5fc180bb5 100644
--- a/vp9/common/vp9_onyxc_int.h
+++ b/vp9/common/vp9_onyxc_int.h
@@ -129,6 +129,8 @@ typedef struct VP9Common {
// Flag signaling that the frame is encoded using only INTRA modes.
int intra_only;
+ int allow_high_precision_mv;
+
// Flag signaling that the frame context should be reset to default values.
// 0 or 1 implies don't reset, 2 reset just the context specified in the
// frame header, 3 reset all contexts.
diff --git a/vp9/decoder/vp9_decodemv.c b/vp9/decoder/vp9_decodemv.c
index 6615530a4..5d7ca7762 100644
--- a/vp9/decoder/vp9_decodemv.c
+++ b/vp9/decoder/vp9_decodemv.c
@@ -487,7 +487,7 @@ static void read_inter_block_mode_info(VP9_COMMON *const cm,
int mi_row, int mi_col, vp9_reader *r) {
MB_MODE_INFO *const mbmi = &mi->mbmi;
const BLOCK_SIZE bsize = mbmi->sb_type;
- const int allow_hp = xd->allow_high_precision_mv;
+ const int allow_hp = cm->allow_high_precision_mv;
int_mv nearest[2], nearmv[2], best[2];
uint8_t inter_mode_ctx;
@@ -518,7 +518,8 @@ static void read_inter_block_mode_info(VP9_COMMON *const cm,
// nearest, nearby
if (bsize < BLOCK_8X8 || mbmi->mode != ZEROMV) {
- vp9_find_best_ref_mvs(xd, mbmi->ref_mvs[ref0], &nearest[0], &nearmv[0]);
+ vp9_find_best_ref_mvs(xd, allow_hp,
+ mbmi->ref_mvs[ref0], &nearest[0], &nearmv[0]);
best[0].as_int = nearest[0].as_int;
}
@@ -528,7 +529,8 @@ static void read_inter_block_mode_info(VP9_COMMON *const cm,
ref1, mbmi->ref_mvs[ref1], mi_row, mi_col);
if (bsize < BLOCK_8X8 || mbmi->mode != ZEROMV) {
- vp9_find_best_ref_mvs(xd, mbmi->ref_mvs[ref1], &nearest[1], &nearmv[1]);
+ vp9_find_best_ref_mvs(xd, allow_hp,
+ mbmi->ref_mvs[ref1], &nearest[1], &nearmv[1]);
best[1].as_int = nearest[1].as_int;
}
}
@@ -630,8 +632,7 @@ static void read_comp_pred(VP9_COMMON *cm, vp9_reader *r) {
vp9_diff_update_prob(r, &cm->fc.comp_ref_prob[i]);
}
-void vp9_prepare_read_mode_info(VP9D_COMP* pbi, vp9_reader *r) {
- VP9_COMMON *const cm = &pbi->common;
+void vp9_prepare_read_mode_info(VP9_COMMON *cm, vp9_reader *r) {
int k;
// TODO(jkoleszar): does this clear more than MBSKIP_CONTEXTS? Maybe remove.
@@ -640,8 +641,7 @@ void vp9_prepare_read_mode_info(VP9D_COMP* pbi, vp9_reader *r) {
vp9_diff_update_prob(r, &cm->fc.mbskip_probs[k]);
if (!frame_is_intra_only(cm)) {
- nmv_context *const nmvc = &pbi->common.fc.nmvc;
- MACROBLOCKD *const xd = &pbi->mb;
+ nmv_context *const nmvc = &cm->fc.nmvc;
int i, j;
read_inter_mode_probs(&cm->fc, r);
@@ -662,7 +662,7 @@ void vp9_prepare_read_mode_info(VP9D_COMP* pbi, vp9_reader *r) {
for (i = 0; i < PARTITION_TYPES - 1; ++i)
vp9_diff_update_prob(r, &cm->fc.partition_prob[INTER_FRAME][j][i]);
- read_mv_probs(r, nmvc, xd->allow_high_precision_mv);
+ read_mv_probs(r, nmvc, cm->allow_high_precision_mv);
}
}
diff --git a/vp9/decoder/vp9_decodemv.h b/vp9/decoder/vp9_decodemv.h
index 7f2517c5a..981e8fed2 100644
--- a/vp9/decoder/vp9_decodemv.h
+++ b/vp9/decoder/vp9_decodemv.h
@@ -14,7 +14,7 @@
#include "vp9/decoder/vp9_onyxd_int.h"
#include "vp9/decoder/vp9_dboolhuff.h"
-void vp9_prepare_read_mode_info(VP9D_COMP *pbi, vp9_reader *r);
+void vp9_prepare_read_mode_info(VP9_COMMON* cm, vp9_reader *r);
void vp9_read_mode_info(VP9_COMMON *cm, MACROBLOCKD *xd,
int mi_row, int mi_col, vp9_reader *r);
diff --git a/vp9/decoder/vp9_decodframe.c b/vp9/decoder/vp9_decodframe.c
index 698456282..5ac5c2be3 100644
--- a/vp9/decoder/vp9_decodframe.c
+++ b/vp9/decoder/vp9_decodframe.c
@@ -796,7 +796,6 @@ static void setup_inter_inter(VP9_COMMON *cm) {
static size_t read_uncompressed_header(VP9D_COMP *pbi,
struct vp9_read_bit_buffer *rb) {
VP9_COMMON *const cm = &pbi->common;
- MACROBLOCKD *const xd = &pbi->mb;
size_t sz;
int i;
@@ -875,7 +874,7 @@ static size_t read_uncompressed_header(VP9D_COMP *pbi,
setup_frame_size_with_refs(pbi, rb);
- xd->allow_high_precision_mv = vp9_rb_read_bit(rb);
+ cm->allow_high_precision_mv = vp9_rb_read_bit(rb);
cm->mcomp_filter_type = read_interp_filter_type(rb);
for (i = 0; i < ALLOWED_REFS_PER_FRAME; ++i)
@@ -925,7 +924,7 @@ static int read_compressed_header(VP9D_COMP *pbi, const uint8_t *data,
read_tx_probs(&cm->fc.tx_probs, &r);
read_coef_probs(&cm->fc, cm->tx_mode, &r);
- vp9_prepare_read_mode_info(pbi, &r);
+ vp9_prepare_read_mode_info(cm, &r);
return vp9_reader_has_error(&r);
}
@@ -1030,7 +1029,7 @@ int vp9_decode_frame(VP9D_COMP *pbi, const uint8_t **p_data_end) {
if (!frame_is_intra_only(cm)) {
vp9_adapt_mode_probs(cm);
- vp9_adapt_mv_probs(cm, xd->allow_high_precision_mv);
+ vp9_adapt_mv_probs(cm, cm->allow_high_precision_mv);
}
}
diff --git a/vp9/encoder/vp9_bitstream.c b/vp9/encoder/vp9_bitstream.c
index ed795f031..b2c6e0368 100644
--- a/vp9/encoder/vp9_bitstream.c
+++ b/vp9/encoder/vp9_bitstream.c
@@ -402,7 +402,7 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m, vp9_writer *bc) {
const int segment_id = mi->segment_id;
int skip_coeff;
const BLOCK_SIZE bsize = mi->sb_type;
- const int allow_hp = xd->allow_high_precision_mv;
+ const int allow_hp = cm->allow_high_precision_mv;
#ifdef ENTROPY_STATS
active_section = 9;
@@ -1309,7 +1309,6 @@ static void write_sync_code(struct vp9_write_bit_buffer *wb) {
static void write_uncompressed_header(VP9_COMP *cpi,
struct vp9_write_bit_buffer *wb) {
VP9_COMMON *const cm = &cpi->common;
- MACROBLOCKD *const xd = &cpi->mb.e_mbd;
// frame marker bits
vp9_wb_write_literal(wb, 0x2, 2);
@@ -1374,7 +1373,7 @@ static void write_uncompressed_header(VP9_COMP *cpi,
write_frame_size_with_refs(cpi, wb);
- vp9_wb_write_bit(wb, xd->allow_high_precision_mv);
+ vp9_wb_write_bit(wb, cm->allow_high_precision_mv);
fix_mcomp_filter_type(cpi);
write_interp_filter_type(cm->mcomp_filter_type, wb);
@@ -1472,7 +1471,7 @@ static size_t write_compressed_header(VP9_COMP *cpi, uint8_t *data) {
(unsigned int *)cpi->partition_count[i]);
}
- vp9_write_nmv_probs(cpi, xd->allow_high_precision_mv, &header_bc);
+ vp9_write_nmv_probs(cpi, cm->allow_high_precision_mv, &header_bc);
}
vp9_stop_encode(&header_bc);
diff --git a/vp9/encoder/vp9_mbgraph.c b/vp9/encoder/vp9_mbgraph.c
index ea4c9e8b2..644363158 100644
--- a/vp9/encoder/vp9_mbgraph.c
+++ b/vp9/encoder/vp9_mbgraph.c
@@ -61,7 +61,7 @@ static unsigned int do_16x16_motion_iteration(VP9_COMP *cpi,
best_err = cpi->find_fractional_mv_step(
x,
&dst_mv->as_mv, &ref_mv->as_mv,
- xd->allow_high_precision_mv,
+ cpi->common.allow_high_precision_mv,
x->errorperbit, &v_fn_ptr,
0, cpi->sf.subpel_iters_per_step, NULL, NULL,
& distortion, &sse);
diff --git a/vp9/encoder/vp9_onyx_if.c b/vp9/encoder/vp9_onyx_if.c
index 54b3d4392..2a85a4420 100644
--- a/vp9/encoder/vp9_onyx_if.c
+++ b/vp9/encoder/vp9_onyx_if.c
@@ -237,8 +237,9 @@ static int get_active_quality(int q,
return active_best_quality;
}
-static void set_mvcost(MACROBLOCK *mb) {
- if (mb->e_mbd.allow_high_precision_mv) {
+static void set_mvcost(VP9_COMP *cpi) {
+ MACROBLOCK *const mb = &cpi->mb;
+ if (cpi->common.allow_high_precision_mv) {
mb->mvcost = mb->nmvcost_hp;
mb->mvsadcost = mb->nmvsadcost_hp;
} else {
@@ -1261,8 +1262,8 @@ void vp9_change_config(VP9_PTR ptr, VP9_CONFIG *oxcf) {
cm->reset_frame_context = 0;
setup_features(cm);
- cpi->mb.e_mbd.allow_high_precision_mv = 0; // Default mv precision
- set_mvcost(&cpi->mb);
+ cpi->common.allow_high_precision_mv = 0; // Default mv precision
+ set_mvcost(cpi);
{
int i;
@@ -2818,7 +2819,6 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi,
unsigned char *dest,
unsigned int *frame_flags) {
VP9_COMMON *const cm = &cpi->common;
- MACROBLOCKD *const xd = &cpi->mb.e_mbd;
TX_SIZE t;
int q;
int frame_over_shoot_limit;
@@ -2987,8 +2987,8 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi,
if (!frame_is_intra_only(cm)) {
cm->mcomp_filter_type = DEFAULT_INTERP_FILTER;
/* TODO: Decide this more intelligently */
- xd->allow_high_precision_mv = q < HIGH_PRECISION_MV_QTHRESH;
- set_mvcost(&cpi->mb);
+ cm->allow_high_precision_mv = q < HIGH_PRECISION_MV_QTHRESH;
+ set_mvcost(cpi);
}
#if CONFIG_VP9_POSTPROC
@@ -3277,7 +3277,7 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi,
if (!cpi->common.error_resilient_mode &&
!cpi->common.frame_parallel_decoding_mode) {
vp9_adapt_mode_probs(&cpi->common);
- vp9_adapt_mv_probs(&cpi->common, cpi->mb.e_mbd.allow_high_precision_mv);
+ vp9_adapt_mv_probs(&cpi->common, cpi->common.allow_high_precision_mv);
}
}
@@ -3601,8 +3601,8 @@ int vp9_get_compressed_data(VP9_PTR ptr, unsigned int *frame_flags,
cpi->source = NULL;
- cpi->mb.e_mbd.allow_high_precision_mv = ALTREF_HIGH_PRECISION_MV;
- set_mvcost(&cpi->mb);
+ cpi->common.allow_high_precision_mv = ALTREF_HIGH_PRECISION_MV;
+ set_mvcost(cpi);
// Should we code an alternate reference frame.
if (cpi->oxcf.play_alternate && cpi->source_alt_ref_pending) {
diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c
index 30cdb3f3c..0fc715299 100644
--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -261,10 +261,10 @@ void vp9_initialize_rd_consts(VP9_COMP *cpi) {
if (!frame_is_intra_only(&cpi->common)) {
vp9_build_nmv_cost_table(
cpi->mb.nmvjointcost,
- cpi->mb.e_mbd.allow_high_precision_mv ?
+ cpi->common.allow_high_precision_mv ?
cpi->mb.nmvcost_hp : cpi->mb.nmvcost,
&cpi->common.fc.nmvc,
- cpi->mb.e_mbd.allow_high_precision_mv, 1, 1);
+ cpi->common.allow_high_precision_mv, 1, 1);
for (i = 0; i < INTER_MODE_CONTEXTS; i++) {
MB_PREDICTION_MODE m;
@@ -1860,7 +1860,7 @@ static void rd_check_segment_txsize(VP9_COMP *cpi, MACROBLOCK *x,
cpi->find_fractional_mv_step(x,
&mode_mv[NEWMV].as_mv,
&bsi->ref_mv->as_mv,
- x->e_mbd.allow_high_precision_mv,
+ cpi->common.allow_high_precision_mv,
x->errorperbit, v_fn_ptr,
0, cpi->sf.subpel_iters_per_step,
x->nmvjointcost, x->mvcost,
@@ -2293,7 +2293,7 @@ static void setup_buffer_inter(VP9_COMP *cpi, MACROBLOCK *x,
mbmi->ref_mvs[frame_type], mi_row, mi_col);
// Candidate refinement carried out at encoder and decoder
- vp9_find_best_ref_mvs(xd,
+ vp9_find_best_ref_mvs(xd, cm->allow_high_precision_mv,
mbmi->ref_mvs[frame_type],
&frame_nearest_mv[frame_type],
&frame_near_mv[frame_type]);
@@ -2441,7 +2441,7 @@ static void single_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
int dis; /* TODO: use dis in distortion calculation later. */
unsigned int sse;
cpi->find_fractional_mv_step(x, &tmp_mv->as_mv, &ref_mv.as_mv,
- xd->allow_high_precision_mv,
+ cm->allow_high_precision_mv,
x->errorperbit,
&cpi->fn_ptr[block_size],
0, cpi->sf.subpel_iters_per_step,
@@ -2577,7 +2577,7 @@ static void joint_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
bestsme = cpi->find_fractional_mv_step_comp(
x, &tmp_mv.as_mv,
&ref_mv[id].as_mv,
- xd->allow_high_precision_mv,
+ cpi->common.allow_high_precision_mv,
x->errorperbit,
&cpi->fn_ptr[block_size],
0, cpi->sf.subpel_iters_per_step,
diff --git a/vp9/encoder/vp9_temporal_filter.c b/vp9/encoder/vp9_temporal_filter.c
index 5cf8143fc..6ea05793d 100644
--- a/vp9/encoder/vp9_temporal_filter.c
+++ b/vp9/encoder/vp9_temporal_filter.c
@@ -166,7 +166,7 @@ static int temporal_filter_find_matching_mb_c(VP9_COMP *cpi,
// Ignore mv costing by sending NULL pointer instead of cost array
bestsme = cpi->find_fractional_mv_step(x, &ref_mv->as_mv,
&best_ref_mv1.as_mv,
- xd->allow_high_precision_mv,
+ cpi->common.allow_high_precision_mv,
x->errorperbit,
&cpi->fn_ptr[BLOCK_16X16],
0, cpi->sf.subpel_iters_per_step,