Commit aa76bf3d authored by Paul Wilkins's avatar Paul Wilkins
Browse files

Removal of CONFIG_NEW_MVREF experiment.

This experiment has failed to give much benefit but
does add complexity so deprecated.

Change-Id: Ic7b929ba706390b9907ef0b4f965bd401ca799a4
parent ac0961b7
......@@ -239,7 +239,6 @@ HAVE_LIST="
"
EXPERIMENT_LIST="
csm
new_mvref
implicit_segmentation
newbintramodes
comp_interintra_pred
......
......@@ -261,9 +261,6 @@ typedef struct {
int_mv mv[2]; // for each reference frame used
int_mv ref_mvs[MAX_REF_FRAMES][MAX_MV_REF_CANDIDATES];
int_mv best_mv, best_second_mv;
#if CONFIG_NEW_MVREF
int best_index, best_second_index;
#endif
int mb_mode_context[MAX_REF_FRAMES];
......@@ -406,10 +403,6 @@ typedef struct macroblockd {
vp9_prob mb_segment_tree_probs[MB_FEATURE_TREE_PROBS];
vp9_prob mb_segment_mispred_tree_probs[MAX_MB_SEGMENTS];
#if CONFIG_NEW_MVREF
vp9_prob mb_mv_ref_probs[MAX_REF_FRAMES][MAX_MV_REF_CANDIDATES-1];
#endif
// Segment features
signed char segment_feature_data[MAX_MB_SEGMENTS][SEG_LVL_MAX];
unsigned int segment_feature_mask[MAX_MB_SEGMENTS];
......
......@@ -718,11 +718,6 @@ void vp9_setup_past_independence(VP9_COMMON *cm, MACROBLOCKD *xd) {
vp9_update_mode_info_border(cm, cm->mip);
vp9_update_mode_info_in_image(cm, cm->mi);
#if CONFIG_NEW_MVREF
// Defaults probabilities for encoding the MV ref id signal
vpx_memset(xd->mb_mv_ref_probs, VP9_DEFAULT_MV_REF_PROB,
sizeof(xd->mb_mv_ref_probs));
#endif
cm->ref_frame_sign_bias[GOLDEN_FRAME] = 0;
cm->ref_frame_sign_bias[ALTREF_FRAME] = 0;
......
......@@ -17,13 +17,8 @@
#define MV_COUNT_SAT 16
#define MV_MAX_UPDATE_FACTOR 160
#if CONFIG_NEW_MVREF
/* Integer pel reference mv threshold for use of high-precision 1/8 mv */
#define COMPANDED_MVREF_THRESH 1000000
#else
/* Integer pel reference mv threshold for use of high-precision 1/8 mv */
#define COMPANDED_MVREF_THRESH 8
#endif
/* Smooth or bias the mv-counts before prob computation */
/* #define SMOOTH_MV_COUNTS */
......
......@@ -26,12 +26,6 @@ int vp9_use_nmv_hp(const MV *ref);
#define VP9_NMV_UPDATE_PROB 255
#if CONFIG_NEW_MVREF
#define VP9_MVREF_UPDATE_PROB 252
#define VP9_DEFAULT_MV_REF_PROB 192
#define VP9_MV_REF_UPDATE_COST (14 << 8)
#endif
//#define MV_GROUP_UPDATE
#define LOW_PRECISION_MV_UPDATE /* Use 7 bit forward update */
......
......@@ -98,22 +98,6 @@ static int read_mb_segid_except(vp9_reader *r,
: (pred_seg_id >= 2 ? vp9_read(r, p[1]) : (pred_seg_id == 0));
}
#if CONFIG_NEW_MVREF
int vp9_read_mv_ref_id(vp9_reader *r, vp9_prob *ref_id_probs) {
int ref_index = 0;
if (vp9_read(r, ref_id_probs[0])) {
ref_index++;
if (vp9_read(r, ref_id_probs[1])) {
ref_index++;
if (vp9_read(r, ref_id_probs[2]))
ref_index++;
}
}
return ref_index;
}
#endif
extern const int vp9_i8x8_block[4];
static void kfread_modes(VP9D_COMP *pbi, MODE_INFO *m,
int mb_row, int mb_col,
......@@ -829,29 +813,6 @@ static void read_mb_modes_mv(VP9D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
#endif
}
#if CONFIG_NEW_MVREF
// if ((mbmi->mode == NEWMV) || (mbmi->mode == SPLITMV))
if (mbmi->mode == NEWMV) {
int best_index;
MV_REFERENCE_FRAME ref_frame = mbmi->ref_frame;
// Encode the index of the choice.
best_index =
vp9_read_mv_ref_id(r, xd->mb_mv_ref_probs[ref_frame]);
best_mv.as_int = mbmi->ref_mvs[ref_frame][best_index].as_int;
if (mbmi->second_ref_frame > 0) {
ref_frame = mbmi->second_ref_frame;
// Encode the index of the choice.
best_index =
vp9_read_mv_ref_id(r, xd->mb_mv_ref_probs[ref_frame]);
best_mv_second.as_int = mbmi->ref_mvs[ref_frame][best_index].as_int;
}
}
#endif
mbmi->uv_mode = DC_PRED;
switch (mbmi->mode) {
case SPLITMV: {
......
......@@ -1639,25 +1639,6 @@ int vp9_decode_frame(VP9D_COMP *pbi, const uint8_t **p_data_end) {
}
#endif
#if CONFIG_NEW_MVREF
// If Key frame reset mv ref id probabilities to defaults
if (pc->frame_type != KEY_FRAME) {
// Read any mv_ref index probability updates
int i, j;
for (i = 0; i < MAX_REF_FRAMES; ++i) {
// Skip the dummy entry for intra ref frame.
if (i == INTRA_FRAME)
continue;
// Read any updates to probabilities
for (j = 0; j < MAX_MV_REF_CANDIDATES - 1; ++j)
if (vp9_read(&header_bc, VP9_MVREF_UPDATE_PROB))
xd->mb_mv_ref_probs[i][j] = vp9_read_prob(&header_bc);
}
}
#endif
if (0) {
FILE *z = fopen("decodestats.stt", "a");
fprintf(z, "%6d F:%d,R:%d,Q:%d\n",
......
......@@ -277,55 +277,6 @@ static void update_inter_mode_probs(VP9_COMMON *cm,
}
}
#if CONFIG_NEW_MVREF
static void update_mv_ref_probs(VP9_COMP *cpi,
int mvref_probs[MAX_REF_FRAMES]
[MAX_MV_REF_CANDIDATES-1]) {
MACROBLOCKD *xd = &cpi->mb.e_mbd;
int rf; // Reference frame
int ref_c; // Motion reference candidate
int node; // Probability node index
for (rf = 0; rf < MAX_REF_FRAMES; ++rf) {
int count = 0;
// Skip the dummy entry for intra ref frame.
if (rf == INTRA_FRAME) {
continue;
}
// Sum the counts for all candidates
for (ref_c = 0; ref_c < MAX_MV_REF_CANDIDATES; ++ref_c) {
count += cpi->mb_mv_ref_count[rf][ref_c];
}
// Calculate the tree node probabilities
for (node = 0; node < MAX_MV_REF_CANDIDATES-1; ++node) {
int new_prob, old_cost, new_cost;
unsigned int branch_cnts[2];
// How many hits on each branch at this node
branch_cnts[0] = cpi->mb_mv_ref_count[rf][node];
branch_cnts[1] = count - cpi->mb_mv_ref_count[rf][node];
// Work out cost of coding branches with the old and optimal probability
old_cost = cost_branch256(branch_cnts, xd->mb_mv_ref_probs[rf][node]);
new_prob = get_prob(branch_cnts[0], count);
new_cost = cost_branch256(branch_cnts, new_prob);
// Take current 0 branch cases out of residual count
count -= cpi->mb_mv_ref_count[rf][node];
if ((new_cost + VP9_MV_REF_UPDATE_COST) <= old_cost) {
mvref_probs[rf][node] = new_prob;
} else {
mvref_probs[rf][node] = xd->mb_mv_ref_probs[rf][node];
}
}
}
}
#endif
static void write_ymode(vp9_writer *bc, int m, const vp9_prob *p) {
write_token(bc, vp9_ymode_tree, p, vp9_ymode_encodings + m);
}
......@@ -562,38 +513,6 @@ static void write_nmv(VP9_COMP *cpi, vp9_writer *bc,
vp9_encode_nmv_fp(bc, &e, &ref->as_mv, nmvc, usehp);
}
#if CONFIG_NEW_MVREF
static void vp9_write_mv_ref_id(vp9_writer *w,
vp9_prob * ref_id_probs,
int mv_ref_id) {
// Encode the index for the MV reference.
switch (mv_ref_id) {
case 0:
vp9_write(w, 0, ref_id_probs[0]);
break;
case 1:
vp9_write(w, 1, ref_id_probs[0]);
vp9_write(w, 0, ref_id_probs[1]);
break;
case 2:
vp9_write(w, 1, ref_id_probs[0]);
vp9_write(w, 1, ref_id_probs[1]);
vp9_write(w, 0, ref_id_probs[2]);
break;
case 3:
vp9_write(w, 1, ref_id_probs[0]);
vp9_write(w, 1, ref_id_probs[1]);
vp9_write(w, 1, ref_id_probs[2]);
break;
// TRAP.. This should not happen
default:
assert(0);
break;
}
}
#endif
// This function writes the current macro block's segnment id to the bitstream
// It should only be called if a segment map update is indicated.
static void write_mb_segid(vp9_writer *bc,
......@@ -901,22 +820,6 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m,
}
#endif
#if CONFIG_NEW_MVREF
// if ((mode == NEWMV) || (mode == SPLITMV)) {
if (mode == NEWMV) {
// Encode the index of the choice.
vp9_write_mv_ref_id(bc,
xd->mb_mv_ref_probs[rf], mi->best_index);
if (mi->second_ref_frame > 0) {
// Encode the index of the choice.
vp9_write_mv_ref_id(
bc, xd->mb_mv_ref_probs[mi->second_ref_frame],
mi->best_second_index);
}
}
#endif
switch (mode) { /* new, split require MVs */
case NEWMV:
#ifdef ENTROPY_STATS
......@@ -2757,37 +2660,6 @@ void vp9_pack_bitstream(VP9_COMP *cpi, unsigned char *dest,
}
}
#if CONFIG_NEW_MVREF
if ((pc->frame_type != KEY_FRAME)) {
int new_mvref_probs[MAX_REF_FRAMES][MAX_MV_REF_CANDIDATES-1];
int i, j;
update_mv_ref_probs(cpi, new_mvref_probs);
for (i = 0; i < MAX_REF_FRAMES; ++i) {
// Skip the dummy entry for intra ref frame.
if (i == INTRA_FRAME) {
continue;
}
// Encode any mandated updates to probabilities
for (j = 0; j < MAX_MV_REF_CANDIDATES - 1; ++j) {
if (new_mvref_probs[i][j] != xd->mb_mv_ref_probs[i][j]) {
vp9_write(&header_bc, 1, VP9_MVREF_UPDATE_PROB);
vp9_write_prob(&header_bc, new_mvref_probs[i][j]);
// Only update the persistent copy if this is the "real pack"
if (!cpi->dummy_packing) {
xd->mb_mv_ref_probs[i][j] = new_mvref_probs[i][j];
}
} else {
vp9_write(&header_bc, 0, VP9_MVREF_UPDATE_PROB);
}
}
}
}
#endif
vp9_clear_system_state(); // __asm emms;
vp9_copy(cpi->common.fc.pre_coef_probs_4x4,
......
......@@ -345,87 +345,6 @@ void vp9_activity_masking(VP9_COMP *cpi, MACROBLOCK *x) {
adjust_act_zbin(cpi, x);
}
#if CONFIG_NEW_MVREF
static int vp9_cost_mv_ref_id(vp9_prob * ref_id_probs, int mv_ref_id) {
int cost;
// Encode the index for the MV reference.
switch (mv_ref_id) {
case 0:
cost = vp9_cost_zero(ref_id_probs[0]);
break;
case 1:
cost = vp9_cost_one(ref_id_probs[0]);
cost += vp9_cost_zero(ref_id_probs[1]);
break;
case 2:
cost = vp9_cost_one(ref_id_probs[0]);
cost += vp9_cost_one(ref_id_probs[1]);
cost += vp9_cost_zero(ref_id_probs[2]);
break;
case 3:
cost = vp9_cost_one(ref_id_probs[0]);
cost += vp9_cost_one(ref_id_probs[1]);
cost += vp9_cost_one(ref_id_probs[2]);
break;
// TRAP.. This should not happen
default:
assert(0);
break;
}
return cost;
}
// Estimate the cost of each coding the vector using each reference candidate
static unsigned int pick_best_mv_ref(MACROBLOCK *x,
MV_REFERENCE_FRAME ref_frame,
int_mv target_mv,
int_mv * mv_ref_list,
int_mv * best_ref) {
int i;
int best_index = 0;
int cost, cost2;
int zero_seen = (mv_ref_list[0].as_int) ? 0 : 1;
MACROBLOCKD *xd = &x->e_mbd;
int max_mv = MV_MAX;
cost = vp9_cost_mv_ref_id(xd->mb_mv_ref_probs[ref_frame], 0) +
vp9_mv_bit_cost(&target_mv, &mv_ref_list[0], x->nmvjointcost,
x->mvcost, 96, xd->allow_high_precision_mv);
for (i = 1; i < MAX_MV_REF_CANDIDATES; ++i) {
// If we see a 0,0 reference vector for a second time we have reached
// the end of the list of valid candidate vectors.
if (!mv_ref_list[i].as_int) {
if (zero_seen)
break;
else
zero_seen = 1;
}
// Check for cases where the reference choice would give rise to an
// uncodable/out of range residual for row or col.
if ((abs(target_mv.as_mv.row - mv_ref_list[i].as_mv.row) > max_mv) ||
(abs(target_mv.as_mv.col - mv_ref_list[i].as_mv.col) > max_mv)) {
continue;
}
cost2 = vp9_cost_mv_ref_id(xd->mb_mv_ref_probs[ref_frame], i) +
vp9_mv_bit_cost(&target_mv, &mv_ref_list[i], x->nmvjointcost,
x->mvcost, 96, xd->allow_high_precision_mv);
if (cost2 < cost) {
cost = cost2;
best_index = i;
}
}
best_ref->as_int = mv_ref_list[best_index].as_int;
return best_index;
}
#endif
static void update_state(VP9_COMP *cpi,
PICK_MODE_CONTEXT *ctx,
BLOCK_SIZE_TYPE bsize,
......@@ -561,31 +480,11 @@ static void update_state(VP9_COMP *cpi,
if (mbmi->mode == SPLITMV || mbmi->mode == NEWMV) {
int_mv best_mv, best_second_mv;
MV_REFERENCE_FRAME rf = mbmi->ref_frame;
#if CONFIG_NEW_MVREF
unsigned int best_index;
MV_REFERENCE_FRAME sec_ref_frame = mbmi->second_ref_frame;
#endif
best_mv.as_int = ctx->best_ref_mv.as_int;
best_second_mv.as_int = ctx->second_best_ref_mv.as_int;
if (mbmi->mode == NEWMV) {
best_mv.as_int = mbmi->ref_mvs[rf][0].as_int;
best_second_mv.as_int = mbmi->ref_mvs[mbmi->second_ref_frame][0].as_int;
#if CONFIG_NEW_MVREF
best_index = pick_best_mv_ref(x, rf, mbmi->mv[0],
mbmi->ref_mvs[rf], &best_mv);
mbmi->best_index = best_index;
++cpi->mb_mv_ref_count[rf][best_index];
if (mbmi->second_ref_frame > 0) {
unsigned int best_index;
best_index =
pick_best_mv_ref(x, sec_ref_frame, mbmi->mv[1],
mbmi->ref_mvs[sec_ref_frame],
&best_second_mv);
mbmi->best_second_index = best_index;
++cpi->mb_mv_ref_count[sec_ref_frame][best_index];
}
#endif
}
mbmi->best_mv.as_int = best_mv.as_int;
mbmi->best_second_mv.as_int = best_second_mv.as_int;
......@@ -1451,9 +1350,6 @@ static void encode_frame_internal(VP9_COMP *cpi) {
vp9_zero(cm->fc.nzc_counts_32x32);
vp9_zero(cm->fc.nzc_pcat_counts);
#endif
#if CONFIG_NEW_MVREF
vp9_zero(cpi->mb_mv_ref_count);
#endif
cpi->mb.e_mbd.lossless = (cm->base_qindex == 0 &&
cm->y_dc_delta_q == 0 &&
......
......@@ -682,10 +682,6 @@ typedef struct VP9_COMP {
[VP9_SWITCHABLE_FILTERS];
unsigned int best_switchable_interp_count[VP9_SWITCHABLE_FILTERS];
#if CONFIG_NEW_MVREF
unsigned int mb_mv_ref_count[MAX_REF_FRAMES][MAX_MV_REF_CANDIDATES];
#endif
int initial_width;
int initial_height;
......
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