Commit bfdcccd8 authored by Jingning Han's avatar Jingning Han Committed by Gerrit Code Review

Merge "Rework the DRL syntax entropy coding system" into nextgenv2

parents cbfc15b1 5c9d3155
...@@ -186,7 +186,7 @@ static const vpx_prob default_refmv_prob[REFMV_MODE_CONTEXTS] = { ...@@ -186,7 +186,7 @@ static const vpx_prob default_refmv_prob[REFMV_MODE_CONTEXTS] = {
}; };
static const vpx_prob default_drl_prob[DRL_MODE_CONTEXTS] = { static const vpx_prob default_drl_prob[DRL_MODE_CONTEXTS] = {
128, 128, 128, 128, 160, 180, 128, 160
}; };
#if CONFIG_EXT_INTER #if CONFIG_EXT_INTER
...@@ -1119,8 +1119,7 @@ static void init_mode_probs(FRAME_CONTEXT *fc) { ...@@ -1119,8 +1119,7 @@ static void init_mode_probs(FRAME_CONTEXT *fc) {
vp10_copy(fc->newmv_prob, default_newmv_prob); vp10_copy(fc->newmv_prob, default_newmv_prob);
vp10_copy(fc->zeromv_prob, default_zeromv_prob); vp10_copy(fc->zeromv_prob, default_zeromv_prob);
vp10_copy(fc->refmv_prob, default_refmv_prob); vp10_copy(fc->refmv_prob, default_refmv_prob);
vp10_copy(fc->drl_prob0, default_drl_prob); vp10_copy(fc->drl_prob, default_drl_prob);
vp10_copy(fc->drl_prob1, default_drl_prob);
#if CONFIG_EXT_INTER #if CONFIG_EXT_INTER
fc->new2mv_prob = default_new2mv_prob; fc->new2mv_prob = default_new2mv_prob;
#endif // CONFIG_EXT_INTER #endif // CONFIG_EXT_INTER
...@@ -1204,12 +1203,8 @@ void vp10_adapt_inter_frame_probs(VP10_COMMON *cm) { ...@@ -1204,12 +1203,8 @@ void vp10_adapt_inter_frame_probs(VP10_COMMON *cm) {
counts->refmv_mode[i]); counts->refmv_mode[i]);
for (i = 0; i < DRL_MODE_CONTEXTS; ++i) for (i = 0; i < DRL_MODE_CONTEXTS; ++i)
fc->drl_prob0[i] = mode_mv_merge_probs(pre_fc->drl_prob0[i], fc->drl_prob[i] = mode_mv_merge_probs(pre_fc->drl_prob[i],
counts->drl_mode0[i]); counts->drl_mode[i]);
for (i = 0; i < DRL_MODE_CONTEXTS; ++i)
fc->drl_prob1[i] = mode_mv_merge_probs(pre_fc->drl_prob1[i],
counts->drl_mode1[i]);
#if CONFIG_EXT_INTER #if CONFIG_EXT_INTER
fc->new2mv_prob = mode_mv_merge_probs(pre_fc->new2mv_prob, fc->new2mv_prob = mode_mv_merge_probs(pre_fc->new2mv_prob,
counts->new2mv_mode); counts->new2mv_mode);
......
...@@ -55,8 +55,7 @@ typedef struct frame_contexts { ...@@ -55,8 +55,7 @@ typedef struct frame_contexts {
vpx_prob newmv_prob[NEWMV_MODE_CONTEXTS]; vpx_prob newmv_prob[NEWMV_MODE_CONTEXTS];
vpx_prob zeromv_prob[ZEROMV_MODE_CONTEXTS]; vpx_prob zeromv_prob[ZEROMV_MODE_CONTEXTS];
vpx_prob refmv_prob[REFMV_MODE_CONTEXTS]; vpx_prob refmv_prob[REFMV_MODE_CONTEXTS];
vpx_prob drl_prob0[DRL_MODE_CONTEXTS]; vpx_prob drl_prob[DRL_MODE_CONTEXTS];
vpx_prob drl_prob1[DRL_MODE_CONTEXTS];
#if CONFIG_EXT_INTER #if CONFIG_EXT_INTER
vpx_prob new2mv_prob; vpx_prob new2mv_prob;
...@@ -121,8 +120,7 @@ typedef struct FRAME_COUNTS { ...@@ -121,8 +120,7 @@ typedef struct FRAME_COUNTS {
unsigned int newmv_mode[NEWMV_MODE_CONTEXTS][2]; unsigned int newmv_mode[NEWMV_MODE_CONTEXTS][2];
unsigned int zeromv_mode[ZEROMV_MODE_CONTEXTS][2]; unsigned int zeromv_mode[ZEROMV_MODE_CONTEXTS][2];
unsigned int refmv_mode[REFMV_MODE_CONTEXTS][2]; unsigned int refmv_mode[REFMV_MODE_CONTEXTS][2];
unsigned int drl_mode0[DRL_MODE_CONTEXTS][2]; unsigned int drl_mode[DRL_MODE_CONTEXTS][2];
unsigned int drl_mode1[DRL_MODE_CONTEXTS][2];
#if CONFIG_EXT_INTER #if CONFIG_EXT_INTER
unsigned int new2mv_mode[2]; unsigned int new2mv_mode[2];
#endif // CONFIG_EXT_INTER #endif // CONFIG_EXT_INTER
......
...@@ -243,7 +243,7 @@ typedef enum { ...@@ -243,7 +243,7 @@ typedef enum {
#define NEWMV_MODE_CONTEXTS 7 #define NEWMV_MODE_CONTEXTS 7
#define ZEROMV_MODE_CONTEXTS 2 #define ZEROMV_MODE_CONTEXTS 2
#define REFMV_MODE_CONTEXTS 9 #define REFMV_MODE_CONTEXTS 9
#define DRL_MODE_CONTEXTS 3 #define DRL_MODE_CONTEXTS 5
#define ZEROMV_OFFSET 3 #define ZEROMV_OFFSET 3
#define REFMV_OFFSET 4 #define REFMV_OFFSET 4
......
...@@ -289,16 +289,24 @@ static INLINE int16_t vp10_mode_context_analyzer( ...@@ -289,16 +289,24 @@ static INLINE int16_t vp10_mode_context_analyzer(
static INLINE uint8_t vp10_drl_ctx(const CANDIDATE_MV *ref_mv_stack, static INLINE uint8_t vp10_drl_ctx(const CANDIDATE_MV *ref_mv_stack,
int ref_idx) { int ref_idx) {
if (ref_mv_stack[ref_idx].weight > REF_CAT_LEVEL && if (ref_mv_stack[ref_idx].weight > REF_CAT_LEVEL &&
ref_mv_stack[ref_idx + 1].weight > REF_CAT_LEVEL) ref_mv_stack[ref_idx + 1].weight > REF_CAT_LEVEL) {
return 0; if (ref_mv_stack[ref_idx].weight == ref_mv_stack[ref_idx + 1].weight)
return 0;
else
return 1;
}
if (ref_mv_stack[ref_idx].weight > REF_CAT_LEVEL && if (ref_mv_stack[ref_idx].weight > REF_CAT_LEVEL &&
ref_mv_stack[ref_idx + 1].weight < REF_CAT_LEVEL) ref_mv_stack[ref_idx + 1].weight < REF_CAT_LEVEL)
return 1; return 2;
if (ref_mv_stack[ref_idx].weight < REF_CAT_LEVEL && if (ref_mv_stack[ref_idx].weight < REF_CAT_LEVEL &&
ref_mv_stack[ref_idx + 1].weight < REF_CAT_LEVEL) ref_mv_stack[ref_idx + 1].weight < REF_CAT_LEVEL) {
return 2; if (ref_mv_stack[ref_idx].weight == ref_mv_stack[ref_idx + 1].weight)
return 3;
else
return 4;
}
assert(0); assert(0);
return 0; return 0;
......
...@@ -387,11 +387,7 @@ void vp10_accumulate_frame_counts(VP10_COMMON *cm, FRAME_COUNTS *counts, ...@@ -387,11 +387,7 @@ void vp10_accumulate_frame_counts(VP10_COMMON *cm, FRAME_COUNTS *counts,
for (i = 0; i < DRL_MODE_CONTEXTS; ++i) for (i = 0; i < DRL_MODE_CONTEXTS; ++i)
for (j = 0; j < 2; ++j) for (j = 0; j < 2; ++j)
cm->counts.drl_mode0[i][j] += counts->drl_mode0[i][j]; cm->counts.drl_mode[i][j] += counts->drl_mode[i][j];
for (i = 0; i < DRL_MODE_CONTEXTS; ++i)
for (j = 0; j < 2; ++j)
cm->counts.drl_mode1[i][j] += counts->drl_mode1[i][j];
#if CONFIG_EXT_INTER #if CONFIG_EXT_INTER
for (j = 0; j < 2; ++j) for (j = 0; j < 2; ++j)
......
...@@ -117,9 +117,7 @@ static void read_inter_mode_probs(FRAME_CONTEXT *fc, vpx_reader *r) { ...@@ -117,9 +117,7 @@ static void read_inter_mode_probs(FRAME_CONTEXT *fc, vpx_reader *r) {
for (i = 0; i < REFMV_MODE_CONTEXTS; ++i) for (i = 0; i < REFMV_MODE_CONTEXTS; ++i)
vp10_diff_update_prob(r, &fc->refmv_prob[i]); vp10_diff_update_prob(r, &fc->refmv_prob[i]);
for (i = 0; i < DRL_MODE_CONTEXTS; ++i) for (i = 0; i < DRL_MODE_CONTEXTS; ++i)
vp10_diff_update_prob(r, &fc->drl_prob0[i]); vp10_diff_update_prob(r, &fc->drl_prob[i]);
for (i = 0; i < DRL_MODE_CONTEXTS; ++i)
vp10_diff_update_prob(r, &fc->drl_prob1[i]);
#if CONFIG_EXT_INTER #if CONFIG_EXT_INTER
vp10_diff_update_prob(r, &fc->new2mv_prob); vp10_diff_update_prob(r, &fc->new2mv_prob);
#endif // CONFIG_EXT_INTER #endif // CONFIG_EXT_INTER
......
...@@ -155,55 +155,45 @@ static void read_drl_idx(const VP10_COMMON *cm, ...@@ -155,55 +155,45 @@ static void read_drl_idx(const VP10_COMMON *cm,
uint8_t ref_frame_type = vp10_ref_frame_type(mbmi->ref_frame); uint8_t ref_frame_type = vp10_ref_frame_type(mbmi->ref_frame);
mbmi->ref_mv_idx = 0; mbmi->ref_mv_idx = 0;
if (xd->ref_mv_count[ref_frame_type] > 1 && mbmi->mode == NEWMV) { if (mbmi->mode == NEWMV) {
uint8_t drl_ctx = vp10_drl_ctx(xd->ref_mv_stack[ref_frame_type], 0); int idx;
vpx_prob drl_prob = cm->fc->drl_prob0[drl_ctx]; for (idx = 0; idx < 2; ++idx) {
if (xd->ref_mv_count[ref_frame_type] > idx + 1) {
if (!vpx_read(r, drl_prob)) { uint8_t drl_ctx = vp10_drl_ctx(xd->ref_mv_stack[ref_frame_type], idx);
mbmi->ref_mv_idx = 0; vpx_prob drl_prob = cm->fc->drl_prob[drl_ctx];
return; if (!vpx_read(r, drl_prob)) {
} mbmi->ref_mv_idx = idx;
mbmi->ref_mv_idx = 1; if (xd->counts)
++xd->counts->drl_mode[drl_ctx][0];
if (xd->ref_mv_count[ref_frame_type] > 2) { return;
drl_ctx = vp10_drl_ctx(xd->ref_mv_stack[ref_frame_type], 1); }
drl_prob = cm->fc->drl_prob0[drl_ctx]; mbmi->ref_mv_idx = idx + 1;
if (!vpx_read(r, drl_prob)) { if (xd->counts)
mbmi->ref_mv_idx = 1; ++xd->counts->drl_mode[drl_ctx][1];
return;
} }
mbmi->ref_mv_idx = 2;
} }
return;
} }
if (xd->ref_mv_count[ref_frame_type] > 2 && mbmi->mode == NEARMV) { if (mbmi->mode == NEARMV) {
uint8_t drl0_ctx = vp10_drl_ctx(xd->ref_mv_stack[ref_frame_type], 1); int idx;
vpx_prob drl0_prob = cm->fc->drl_prob0[drl0_ctx]; // Offset the NEARESTMV mode.
if (vpx_read(r, drl0_prob)) { // TODO(jingning): Unify the two syntax decoding loops after the NEARESTMV
mbmi->ref_mv_idx = 1; // mode is factored in.
if (xd->counts) for (idx = 1; idx < 3; ++idx) {
++xd->counts->drl_mode0[drl0_ctx][1]; if (xd->ref_mv_count[ref_frame_type] > idx + 1) {
if (xd->ref_mv_count[ref_frame_type] > 3) { uint8_t drl_ctx = vp10_drl_ctx(xd->ref_mv_stack[ref_frame_type], idx);
uint8_t drl1_ctx = vpx_prob drl_prob = cm->fc->drl_prob[drl_ctx];
vp10_drl_ctx(xd->ref_mv_stack[ref_frame_type], 2); if (!vpx_read(r, drl_prob)) {
vpx_prob drl1_prob = cm->fc->drl_prob1[drl1_ctx]; mbmi->ref_mv_idx = idx - 1;
if (vpx_read(r, drl1_prob)) {
mbmi->ref_mv_idx = 2;
if (xd->counts) if (xd->counts)
++xd->counts->drl_mode1[drl1_ctx][1]; ++xd->counts->drl_mode[drl_ctx][0];
return; return;
} }
mbmi->ref_mv_idx = idx;
if (xd->counts) if (xd->counts)
++xd->counts->drl_mode1[drl1_ctx][0]; ++xd->counts->drl_mode[drl_ctx][1];
} }
return;
} }
if (xd->counts)
++xd->counts->drl_mode0[drl0_ctx][0];
} }
} }
#endif #endif
......
...@@ -197,39 +197,37 @@ static void write_drl_idx(const VP10_COMMON *cm, ...@@ -197,39 +197,37 @@ static void write_drl_idx(const VP10_COMMON *cm,
assert(mbmi->ref_mv_idx < 3); assert(mbmi->ref_mv_idx < 3);
if (mbmi_ext->ref_mv_count[ref_frame_type] > 1 && mbmi->mode == NEWMV) { if (mbmi->mode == NEWMV) {
uint8_t drl_ctx = int idx;
vp10_drl_ctx(mbmi_ext->ref_mv_stack[ref_frame_type], 0); for (idx = 0; idx < 2; ++idx) {
vpx_prob drl_prob = cm->fc->drl_prob0[drl_ctx]; if (mbmi_ext->ref_mv_count[ref_frame_type] > idx + 1) {
uint8_t drl_ctx =
vpx_write(w, mbmi->ref_mv_idx != 0, drl_prob); vp10_drl_ctx(mbmi_ext->ref_mv_stack[ref_frame_type], idx);
if (mbmi->ref_mv_idx == 0) vpx_prob drl_prob = cm->fc->drl_prob[drl_ctx];
return;
vpx_write(w, mbmi->ref_mv_idx != idx, drl_prob);
if (mbmi_ext->ref_mv_count[ref_frame_type] > 2) { if (mbmi->ref_mv_idx == idx)
drl_ctx = vp10_drl_ctx(mbmi_ext->ref_mv_stack[ref_frame_type], 1); return;
drl_prob = cm->fc->drl_prob0[drl_ctx]; }
vpx_write(w, mbmi->ref_mv_idx != 1, drl_prob);
} }
if (mbmi->ref_mv_idx == 1)
return;
assert(mbmi->ref_mv_idx == 2);
return; return;
} }
if (mbmi_ext->ref_mv_count[ref_frame_type] > 2 && mbmi->mode == NEARMV) { if (mbmi->mode == NEARMV) {
uint8_t drl0_ctx = int idx;
vp10_drl_ctx(mbmi_ext->ref_mv_stack[ref_frame_type], 1); // TODO(jingning): Temporary solution to compensate the NEARESTMV offset.
vpx_prob drl0_prob = cm->fc->drl_prob0[drl0_ctx]; for (idx = 1; idx < 3; ++idx) {
vpx_write(w, mbmi->ref_mv_idx != 0, drl0_prob); if (mbmi_ext->ref_mv_count[ref_frame_type] > idx + 1) {
if (mbmi_ext->ref_mv_count[ref_frame_type] > 3 && uint8_t drl_ctx =
mbmi->ref_mv_idx > 0) { vp10_drl_ctx(mbmi_ext->ref_mv_stack[ref_frame_type], idx);
uint8_t drl1_ctx = vpx_prob drl_prob = cm->fc->drl_prob[drl_ctx];
vp10_drl_ctx(mbmi_ext->ref_mv_stack[ref_frame_type], 2);
vpx_prob drl1_prob = cm->fc->drl_prob1[drl1_ctx]; vpx_write(w, mbmi->ref_mv_idx != (idx - 1), drl_prob);
vpx_write(w, mbmi->ref_mv_idx != 1, drl1_prob); if (mbmi->ref_mv_idx == (idx - 1))
return;
}
} }
return;
} }
} }
#endif #endif
...@@ -369,11 +367,8 @@ static void update_inter_mode_probs(VP10_COMMON *cm, vpx_writer *w, ...@@ -369,11 +367,8 @@ static void update_inter_mode_probs(VP10_COMMON *cm, vpx_writer *w,
vp10_cond_prob_diff_update(w, &cm->fc->refmv_prob[i], vp10_cond_prob_diff_update(w, &cm->fc->refmv_prob[i],
counts->refmv_mode[i]); counts->refmv_mode[i]);
for (i = 0; i < DRL_MODE_CONTEXTS; ++i) for (i = 0; i < DRL_MODE_CONTEXTS; ++i)
vp10_cond_prob_diff_update(w, &cm->fc->drl_prob0[i], vp10_cond_prob_diff_update(w, &cm->fc->drl_prob[i],
counts->drl_mode0[i]); counts->drl_mode[i]);
for (i = 0; i < DRL_MODE_CONTEXTS; ++i)
vp10_cond_prob_diff_update(w, &cm->fc->drl_prob1[i],
counts->drl_mode1[i]);
#if CONFIG_EXT_INTER #if CONFIG_EXT_INTER
vp10_cond_prob_diff_update(w, &cm->fc->new2mv_prob, counts->new2mv_mode); vp10_cond_prob_diff_update(w, &cm->fc->new2mv_prob, counts->new2mv_mode);
#endif // CONFIG_EXT_INTER #endif // CONFIG_EXT_INTER
......
...@@ -1912,24 +1912,34 @@ static void update_stats(VP10_COMMON *cm, ThreadData *td ...@@ -1912,24 +1912,34 @@ static void update_stats(VP10_COMMON *cm, ThreadData *td
#endif // CONFIG_EXT_INTER #endif // CONFIG_EXT_INTER
mode_ctx); mode_ctx);
if (mode == NEWMV) {
uint8_t ref_frame_type = vp10_ref_frame_type(mbmi->ref_frame);
int idx;
for (idx = 0; idx < 2; ++idx) {
if (mbmi_ext->ref_mv_count[ref_frame_type] > idx + 1) {
uint8_t drl_ctx =
vp10_drl_ctx(mbmi_ext->ref_mv_stack[ref_frame_type], idx);
++counts->drl_mode[drl_ctx][mbmi->ref_mv_idx != idx];
if (mbmi->ref_mv_idx == idx)
break;
}
}
}
if (mode == NEARMV) { if (mode == NEARMV) {
uint8_t ref_frame_type = vp10_ref_frame_type(mbmi->ref_frame); uint8_t ref_frame_type = vp10_ref_frame_type(mbmi->ref_frame);
if (mbmi_ext->ref_mv_count[ref_frame_type] > 2) { int idx;
uint8_t drl0_ctx =
vp10_drl_ctx(mbmi_ext->ref_mv_stack[ref_frame_type], 1); for (idx = 1; idx < 3; ++idx) {
if (mbmi->ref_mv_idx == 0) if (mbmi_ext->ref_mv_count[ref_frame_type] > idx + 1) {
++counts->drl_mode0[drl0_ctx][0]; uint8_t drl_ctx =
else vp10_drl_ctx(mbmi_ext->ref_mv_stack[ref_frame_type], idx);
++counts->drl_mode0[drl0_ctx][1]; ++counts->drl_mode[drl_ctx][mbmi->ref_mv_idx != idx - 1];
if (mbmi_ext->ref_mv_count[ref_frame_type] > 3 && if (mbmi->ref_mv_idx == idx - 1)
mbmi->ref_mv_idx > 0) { break;
uint8_t drl1_ctx =
vp10_drl_ctx(mbmi_ext->ref_mv_stack[ref_frame_type], 2);
if (mbmi->ref_mv_idx == 1)
++counts->drl_mode1[drl1_ctx][0];
else
++counts->drl_mode1[drl1_ctx][1];
} }
} }
} }
......
...@@ -487,7 +487,6 @@ typedef struct VP10_COMP { ...@@ -487,7 +487,6 @@ typedef struct VP10_COMP {
int zeromv_mode_cost[ZEROMV_MODE_CONTEXTS][2]; int zeromv_mode_cost[ZEROMV_MODE_CONTEXTS][2];
int refmv_mode_cost[REFMV_MODE_CONTEXTS][2]; int refmv_mode_cost[REFMV_MODE_CONTEXTS][2];
int drl_mode_cost0[DRL_MODE_CONTEXTS][2]; int drl_mode_cost0[DRL_MODE_CONTEXTS][2];
int drl_mode_cost1[DRL_MODE_CONTEXTS][2];
#if CONFIG_EXT_INTER #if CONFIG_EXT_INTER
int new2mv_mode_cost[2]; int new2mv_mode_cost[2];
#endif // CONFIG_EXT_INTER #endif // CONFIG_EXT_INTER
......
...@@ -418,13 +418,8 @@ void vp10_initialize_rd_consts(VP10_COMP *cpi) { ...@@ -418,13 +418,8 @@ void vp10_initialize_rd_consts(VP10_COMP *cpi) {
} }
for (i = 0; i < DRL_MODE_CONTEXTS; ++i) { for (i = 0; i < DRL_MODE_CONTEXTS; ++i) {
cpi->drl_mode_cost0[i][0] = vp10_cost_bit(cm->fc->drl_prob0[i], 0); cpi->drl_mode_cost0[i][0] = vp10_cost_bit(cm->fc->drl_prob[i], 0);
cpi->drl_mode_cost0[i][1] = vp10_cost_bit(cm->fc->drl_prob0[i], 1); cpi->drl_mode_cost0[i][1] = vp10_cost_bit(cm->fc->drl_prob[i], 1);
}
for (i = 0; i < DRL_MODE_CONTEXTS; ++i) {
cpi->drl_mode_cost1[i][0] = vp10_cost_bit(cm->fc->drl_prob1[i], 0);
cpi->drl_mode_cost1[i][1] = vp10_cost_bit(cm->fc->drl_prob1[i], 1);
} }
#if CONFIG_EXT_INTER #if CONFIG_EXT_INTER
cpi->new2mv_mode_cost[0] = vp10_cost_bit(cm->fc->new2mv_prob, 0); cpi->new2mv_mode_cost[0] = vp10_cost_bit(cm->fc->new2mv_prob, 0);
......
...@@ -8026,26 +8026,18 @@ void vp10_rd_pick_inter_mode_sb(VP10_COMP *cpi, ...@@ -8026,26 +8026,18 @@ void vp10_rd_pick_inter_mode_sb(VP10_COMP *cpi,
// TODO(jingning): This should be deprecated shortly. // TODO(jingning): This should be deprecated shortly.
int idx_offset = (mbmi->mode == NEARMV) ? 1 : 0; int idx_offset = (mbmi->mode == NEARMV) ? 1 : 0;
int ref_set = int ref_set =
VPXMIN(2, mbmi_ext->ref_mv_count[ref_frame_type] - 1 - idx_offset); VPXMIN(2, mbmi_ext->ref_mv_count[ref_frame_type] - 1 - idx_offset);
uint8_t drl0_ctx = 0; uint8_t drl_ctx = vp10_drl_ctx(mbmi_ext->ref_mv_stack[ref_frame_type],
uint8_t drl_ctx = 0; idx_offset);
// Dummy // Dummy
int_mv backup_fmv[2]; int_mv backup_fmv[2];
backup_fmv[0] = frame_mv[NEWMV][ref_frame]; backup_fmv[0] = frame_mv[NEWMV][ref_frame];
if (comp_pred) if (comp_pred)
backup_fmv[1] = frame_mv[NEWMV][second_ref_frame]; backup_fmv[1] = frame_mv[NEWMV][second_ref_frame];
if (mbmi->mode == NEARMV) { rate2 += cpi->drl_mode_cost0[drl_ctx][0];
drl0_ctx = vp10_drl_ctx(mbmi_ext->ref_mv_stack[ref_frame_type], 1);
rate2 += cpi->drl_mode_cost0[drl0_ctx][0];
} else {
drl_ctx = vp10_drl_ctx(mbmi_ext->ref_mv_stack[ref_frame_type], 0);
rate2 += cpi->drl_mode_cost0[drl_ctx][0];
}
if (this_rd < INT64_MAX) { if (this_rd < INT64_MAX) {
if (RDCOST(x->rdmult, x->rddiv, rate_y + rate_uv, distortion2) < if (RDCOST(x->rdmult, x->rddiv, rate_y + rate_uv, distortion2) <
...@@ -8131,23 +8123,20 @@ void vp10_rd_pick_inter_mode_sb(VP10_COMP *cpi, ...@@ -8131,23 +8123,20 @@ void vp10_rd_pick_inter_mode_sb(VP10_COMP *cpi,
&tmp_sse, best_rd); &tmp_sse, best_rd);
} }
if (this_mode == NEARMV) { for (i = 0; i < mbmi->ref_mv_idx; ++i) {
tmp_rate += cpi->drl_mode_cost0[drl0_ctx][1]; uint8_t drl1_ctx = 0;
if (mbmi_ext->ref_mv_count[ref_frame_type] > 3) { drl1_ctx = vp10_drl_ctx(mbmi_ext->ref_mv_stack[ref_frame_type],
uint8_t drl1_ctx = i + idx_offset);
vp10_drl_ctx(mbmi_ext->ref_mv_stack[ref_frame_type], 2); tmp_rate += cpi->drl_mode_cost0[drl1_ctx][1];
tmp_rate += cpi->drl_mode_cost1[drl1_ctx][ref_idx];
}
} }
if (this_mode == NEWMV) { if (mbmi_ext->ref_mv_count[ref_frame_type] >
tmp_rate += cpi->drl_mode_cost0[drl_ctx][1]; mbmi->ref_mv_idx + idx_offset + 1 &&
ref_idx < ref_set - 1) {
if (mbmi_ext->ref_mv_count[ref_frame_type] > 2) { uint8_t drl1_ctx =
uint8_t this_drl_ctx = vp10_drl_ctx(mbmi_ext->ref_mv_stack[ref_frame_type],
vp10_drl_ctx(mbmi_ext->ref_mv_stack[ref_frame_type], 1); mbmi->ref_mv_idx + idx_offset);
tmp_rate += cpi->drl_mode_cost0[this_drl_ctx][ref_idx]; tmp_rate += cpi->drl_mode_cost0[drl1_ctx][0];
}
} }
if (tmp_alt_rd < INT64_MAX) { if (tmp_alt_rd < INT64_MAX) {
......
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