Merge "Merged LAST2 and LAST3 to one experiment MULTI_REF" into nextgen

This commit is contained in:
Zoe Liu 2015-09-25 16:47:28 +00:00 committed by Gerrit Code Review
commit 90dede3f5b
19 changed files with 15 additions and 804 deletions

1
configure vendored
View File

@ -307,7 +307,6 @@ EXPERIMENT_LIST="
dst1
sr_mode
multi_ref
last3_ref
last4_ref
"
CONFIG_LIST="

View File

@ -68,8 +68,6 @@ extern "C" {
#if CONFIG_MULTI_REF
#if CONFIG_LAST3_REF
#if CONFIG_LAST4_REF
#define SINGLE_REFS 6
#define COMP_REFS 5
@ -78,13 +76,6 @@ extern "C" {
#define COMP_REFS 4
#endif // CONFIG_LAST4_REF
#else // LAST3_REF
#define SINGLE_REFS 4
#define COMP_REFS 3
#endif // CONFIG_LAST3_REF
#else // CONFIG_MULTI_REF
#define SINGLE_REFS 3
#define COMP_REFS 2
@ -232,21 +223,15 @@ typedef enum {
LAST_FRAME = 1,
#if CONFIG_MULTI_REF
LAST2_FRAME = 2,
#if CONFIG_LAST3_REF
#if CONFIG_LAST4_REF
LAST3_FRAME = 3,
#if CONFIG_LAST4_REF
LAST4_FRAME = 4,
GOLDEN_FRAME = 5,
ALTREF_FRAME = 6,
#else // CONFIG_LAST4_REF
LAST3_FRAME = 3,
GOLDEN_FRAME = 4,
ALTREF_FRAME = 5,
#endif // CONFIG_LAST4_REF
#else // CONFIG_LAST3_REF
GOLDEN_FRAME = 3,
ALTREF_FRAME = 4,
#endif // CONFIG_LAST3_REF
#else // CONFIG_MULTI_REF
GOLDEN_FRAME = 2,
ALTREF_FRAME = 3,

View File

@ -419,7 +419,6 @@ static const vp9_prob default_single_ref_probs[REF_CONTEXTS][SINGLE_REFS - 1] =
{
#if CONFIG_MULTI_REF
// TODO(zoeliu): To adjust the initial prob values.
#if CONFIG_LAST3_REF
#if CONFIG_LAST4_REF
{ 33, 16, 16, 16, 16 },
{ 77, 74, 74, 74, 74 },
@ -433,13 +432,6 @@ static const vp9_prob default_single_ref_probs[REF_CONTEXTS][SINGLE_REFS - 1] =
{ 172, 170, 170, 170 },
{ 238, 247, 247, 247 }
#endif // CONFIG_LAST4_REF
#else // CONFIG_LAST3_REF
{ 33, 16, 16 },
{ 77, 74, 74 },
{ 142, 142, 142 },
{ 172, 170, 170 },
{ 238, 247, 247 }
#endif // CONFIG_LAST3_REF
#else // CONFIG_MULTI_REF
{ 33, 16 },
{ 77, 74 },
@ -452,7 +444,6 @@ static const vp9_prob default_single_ref_probs[REF_CONTEXTS][SINGLE_REFS - 1] =
static const vp9_prob default_comp_ref_probs[REF_CONTEXTS][COMP_REFS - 1] = {
#if CONFIG_MULTI_REF
// TODO(zoeliu): To adjust the initial prob values.
#if CONFIG_LAST3_REF
#if CONFIG_LAST4_REF
{ 33, 16, 16, 16 },
{ 77, 74, 74, 74 },
@ -466,13 +457,6 @@ static const vp9_prob default_comp_ref_probs[REF_CONTEXTS][COMP_REFS - 1] = {
{ 172, 170, 170 },
{ 238, 247, 247 }
#endif // CONFIG_LAST4_REF
#else // CONFIG_LAST3_REF
{ 33, 16 },
{ 77, 74 },
{ 142, 142 },
{ 172, 170 },
{ 238, 247 }
#endif // CONFIG_LAST3_REF
#else // CONFIG_MULTI_REF
{ 50 }, { 126 }, { 123 }, { 221 }, { 226 }
#endif // CONFIG_MULTI_REF
@ -1347,12 +1331,10 @@ static void set_default_lf_deltas(struct loopfilter *lf) {
lf->ref_deltas[LAST_FRAME] = 0;
#if CONFIG_MULTI_REF
lf->ref_deltas[LAST2_FRAME] = lf->ref_deltas[LAST_FRAME];
#if CONFIG_LAST3_REF
lf->ref_deltas[LAST3_FRAME] = lf->ref_deltas[LAST_FRAME];
#if CONFIG_LAST4_REF
lf->ref_deltas[LAST4_FRAME] = lf->ref_deltas[LAST_FRAME];
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
lf->ref_deltas[GOLDEN_FRAME] = -1;
lf->ref_deltas[ALTREF_FRAME] = -1;

View File

@ -196,7 +196,6 @@ typedef enum {
VP9_LAST_FLAG = 1 << 0,
#if CONFIG_MULTI_REF
VP9_LAST2_FLAG = 1 << 1,
#if CONFIG_LAST3_REF
VP9_LAST3_FLAG = 1 << 2,
#if CONFIG_LAST4_REF
VP9_LAST4_FLAG = 1 << 3,
@ -206,10 +205,6 @@ typedef enum {
VP9_GOLD_FLAG = 1 << 3,
VP9_ALT_FLAG = 1 << 4,
#endif // CONFIG_LAST4_REF
#else // CONFIG_LAST3_REF
VP9_GOLD_FLAG = 1 << 2,
VP9_ALT_FLAG = 1 << 3,
#endif // CONFIG_LAST3_REF
#else // CONFIG_MULTI_REF
VP9_GOLD_FLAG = 1 << 1,
VP9_ALT_FLAG = 1 << 2,

View File

@ -27,15 +27,11 @@ extern "C" {
#define SIMD_WIDTH 16
#if CONFIG_MULTI_REF
#if CONFIG_LAST3_REF
#if CONFIG_LAST4_REF
#define MAX_REF_LF_DELTAS 7
#else // CONFIG_LAST4_REF
#define MAX_REF_LF_DELTAS 6
#endif // CONFIG_LAST4_REF
#else // CONFIG_LAST3_REF
#define MAX_REF_LF_DELTAS 5
#endif // CONFIG_LAST3_REF
#else // CONFIG_MULTI_REF
#define MAX_REF_LF_DELTAS 4
#endif // CONFIG_MULTI_REF
@ -116,8 +112,7 @@ struct loopfilter {
uint8_t mode_ref_delta_enabled;
uint8_t mode_ref_delta_update;
// 0 = Intra, Last, Last2(CONFIG_MULTI_REF),
// Last3(CONFIG_LAST3_REF),
// 0 = Intra, Last, Last2+Last3(CONFIG_MULTI_REF),
// Last4(CONFIG_LAST4_REF),
// GF, ARF
signed char ref_deltas[MAX_REF_LF_DELTAS];

View File

@ -31,15 +31,11 @@ extern "C" {
#endif
#if CONFIG_MULTI_REF
#if CONFIG_LAST3_REF
#if CONFIG_LAST4_REF
#define REFS_PER_FRAME 6
#else // CONFIG_LAST4_REF
#define REFS_PER_FRAME 5
#endif // CONFIG_LAST4_REF
#else // CONFIG_LAST3_REF
#define REFS_PER_FRAME 4
#endif // CONFIG_LAST3_REF
#else // CONFIG_MULTI_REF
#define REFS_PER_FRAME 3
#endif // CONFIG_MULTI_REF
@ -137,14 +133,14 @@ typedef struct VP9Common {
FRAME_TYPE last_frame_type; /* last frame's frame type for motion search.*/
FRAME_TYPE frame_type;
#if CONFIG_MULTI_REF && CONFIG_LAST3_REF
#if CONFIG_MULTI_REF
// frame type for the frame before the last
FRAME_TYPE last2_frame_type;
#if CONFIG_LAST4_REF
// frame type for the frame two frames before the last
FRAME_TYPE last3_frame_type;
#endif // CONFIG_LAST4_REF
#endif // CONFIG_MULTI_REF && CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
int show_frame;
int last_show_frame;
@ -206,15 +202,11 @@ typedef struct VP9Common {
int allow_comp_inter_inter;
MV_REFERENCE_FRAME comp_fixed_ref;
#if CONFIG_MULTI_REF
#if CONFIG_LAST3_REF
#if CONFIG_LAST4_REF
MV_REFERENCE_FRAME comp_var_ref[5];
#else // CONFIG_LAST4_REF
MV_REFERENCE_FRAME comp_var_ref[4];
#endif // CONFIG_LAST4_REF
#else // CONFIG_LAST3_REF
MV_REFERENCE_FRAME comp_var_ref[3];
#endif // CONFIG_LAST3_REF
#else // CONFIG_MULTI_REF
MV_REFERENCE_FRAME comp_var_ref[2];
#endif // CONFIG_MULTI_REF

View File

@ -114,8 +114,6 @@ int vp9_get_reference_mode_context(const VP9_COMMON *cm,
#define CHECK_LAST_OR_LAST2(ref_frame) \
((ref_frame == LAST_FRAME) || (ref_frame == LAST2_FRAME))
#if CONFIG_LAST3_REF
#define CHECK_GOLDEN_OR_LAST3(ref_frame) \
((ref_frame == GOLDEN_FRAME) || (ref_frame == LAST3_FRAME))
@ -824,193 +822,6 @@ int vp9_get_pred_context_comp_ref_p2(const VP9_COMMON *cm,
#endif // CONFIG_LAST4_REF
#else // CONFIG_LAST3_REF
// Returns a context number for the given MB prediction signal
// Signal the first reference frame for a compound mode is GOLDEN.
int vp9_get_pred_context_comp_ref_p(const VP9_COMMON *cm,
const MACROBLOCKD *xd) {
int pred_context;
const MB_MODE_INFO *const above_mbmi = get_mbmi(get_above_mi(xd));
const MB_MODE_INFO *const left_mbmi = get_mbmi(get_left_mi(xd));
const int above_in_image = above_mbmi != NULL;
const int left_in_image = left_mbmi != NULL;
// Note:
// The mode info data structure has a one element border above and to the
// left of the entries correpsonding to real macroblocks.
// The prediction flags in these dummy entries are initialised to 0.
const int fix_ref_idx = cm->ref_frame_sign_bias[cm->comp_fixed_ref];
const int var_ref_idx = !fix_ref_idx;
if (above_in_image && left_in_image) { // both edges available
const int above_intra = !is_inter_block(above_mbmi);
const int left_intra = !is_inter_block(left_mbmi);
if (above_intra && left_intra) { // intra/intra (2)
pred_context = 2;
} else if (above_intra || left_intra) { // intra/inter
const MB_MODE_INFO *edge_mbmi = above_intra ? left_mbmi : above_mbmi;
if (!has_second_ref(edge_mbmi)) // single pred (1/3)
pred_context = 1 + 2 * (edge_mbmi->ref_frame[0] != GOLDEN_FRAME);
else // comp pred (1/3)
pred_context = 1 + 2 * (edge_mbmi->ref_frame[var_ref_idx]
!= GOLDEN_FRAME);
} else { // inter/inter
const int l_sg = !has_second_ref(left_mbmi);
const int a_sg = !has_second_ref(above_mbmi);
const MV_REFERENCE_FRAME vrfa = a_sg ? above_mbmi->ref_frame[0]
: above_mbmi->ref_frame[var_ref_idx];
const MV_REFERENCE_FRAME vrfl = l_sg ? left_mbmi->ref_frame[0]
: left_mbmi->ref_frame[var_ref_idx];
if (vrfa == vrfl && vrfa == GOLDEN_FRAME) {
pred_context = 0;
} else if (l_sg && a_sg) { // single/single
if ((vrfa == ALTREF_FRAME && CHECK_LAST_OR_LAST2(vrfl)) ||
(vrfl == ALTREF_FRAME && CHECK_LAST_OR_LAST2(vrfa))) {
pred_context = 4;
} else if (vrfa == vrfl || (CHECK_LAST_OR_LAST2(vrfa) &&
CHECK_LAST_OR_LAST2(vrfl))) {
pred_context = 3;
} else { // either vrfa or vrfl == GOLDEN_FRAME
// NOTE(zoeliu): Following assert may be removed once confirmed.
assert(vrfa == GOLDEN_FRAME || vrfl == GOLDEN_FRAME);
pred_context = 1;
}
} else if (l_sg || a_sg) { // single/comp
const MV_REFERENCE_FRAME vrfc = l_sg ? vrfa : vrfl;
const MV_REFERENCE_FRAME rfs = a_sg ? vrfa : vrfl;
if (vrfc == GOLDEN_FRAME && rfs != GOLDEN_FRAME)
pred_context = 1;
else if (rfs == GOLDEN_FRAME && vrfc != GOLDEN_FRAME)
pred_context = 2;
else
pred_context = 4;
} else { // comp/comp
if ((CHECK_LAST_OR_LAST2(vrfa) && CHECK_LAST_OR_LAST2(vrfl))) {
pred_context = 4;
} else {
// NOTE(zoeliu): Following assert may be removed once confirmed.
assert(vrfa == GOLDEN_FRAME || vrfl == GOLDEN_FRAME);
pred_context = 2;
}
}
}
} else if (above_in_image || left_in_image) { // one edge available
const MB_MODE_INFO *edge_mbmi = above_in_image ? above_mbmi : left_mbmi;
if (!is_inter_block(edge_mbmi)) {
pred_context = 2;
} else {
if (has_second_ref(edge_mbmi))
pred_context = 4 * (edge_mbmi->ref_frame[var_ref_idx] != GOLDEN_FRAME);
else
pred_context = 3 * (edge_mbmi->ref_frame[0] != GOLDEN_FRAME);
}
} else { // no edges available (2)
pred_context = 2;
}
assert(pred_context >= 0 && pred_context < REF_CONTEXTS);
return pred_context;
}
// Returns a context number for the given MB prediction signal
// Signal the first reference frame for a compound mode is LAST,
// conditioning on that it is known not GOLDEN.
int vp9_get_pred_context_comp_ref_p1(const VP9_COMMON *cm,
const MACROBLOCKD *xd) {
int pred_context;
const MB_MODE_INFO *const above_mbmi = get_mbmi(get_above_mi(xd));
const MB_MODE_INFO *const left_mbmi = get_mbmi(get_left_mi(xd));
const int above_in_image = above_mbmi != NULL;
const int left_in_image = left_mbmi != NULL;
// Note:
// The mode info data structure has a one element border above and to the
// left of the entries correpsonding to real macroblocks.
// The prediction flags in these dummy entries are initialised to 0.
const int fix_ref_idx = cm->ref_frame_sign_bias[cm->comp_fixed_ref];
const int var_ref_idx = !fix_ref_idx;
if (above_in_image && left_in_image) { // both edges available
const int above_intra = !is_inter_block(above_mbmi);
const int left_intra = !is_inter_block(left_mbmi);
if (above_intra && left_intra) { // intra/intra (2)
pred_context = 2;
} else if (above_intra || left_intra) { // intra/inter
const MB_MODE_INFO *edge_mbmi = above_intra ? left_mbmi : above_mbmi;
if (!has_second_ref(edge_mbmi)) // single pred (1/3)
pred_context = 1 + 2 * (edge_mbmi->ref_frame[0] != LAST_FRAME);
else // comp pred (1/3)
pred_context = 1 + 2 * (edge_mbmi->ref_frame[var_ref_idx]
!= LAST_FRAME);
} else { // inter/inter
const int l_sg = !has_second_ref(left_mbmi);
const int a_sg = !has_second_ref(above_mbmi);
const MV_REFERENCE_FRAME vrfa = a_sg ? above_mbmi->ref_frame[0]
: above_mbmi->ref_frame[var_ref_idx];
const MV_REFERENCE_FRAME vrfl = l_sg ? left_mbmi->ref_frame[0]
: left_mbmi->ref_frame[var_ref_idx];
if (vrfa == vrfl && vrfa == LAST_FRAME)
pred_context = 0;
else if (l_sg && a_sg) { // single/single
if (vrfa == LAST_FRAME || vrfl == LAST_FRAME)
pred_context = 1;
else if (vrfa == GOLDEN_FRAME || vrfl == GOLDEN_FRAME)
pred_context = 2 + (vrfa != vrfl);
else if (vrfa == vrfl)
pred_context = 3;
else
pred_context = 4;
} else if (l_sg || a_sg) { // single/comp
const MV_REFERENCE_FRAME vrfc = l_sg ? vrfa : vrfl;
const MV_REFERENCE_FRAME rfs = a_sg ? vrfa : vrfl;
if (vrfc == LAST_FRAME && rfs != LAST_FRAME)
pred_context = 1;
else if (rfs == LAST_FRAME && vrfc != LAST_FRAME)
pred_context = 2;
else
pred_context = 3 + (vrfc == LAST2_FRAME || rfs != GOLDEN_FRAME);
} else { // comp/comp
if (vrfa == LAST_FRAME || vrfl == LAST_FRAME)
pred_context = 2;
else
pred_context = 3 + (vrfa != GOLDEN_FRAME || vrfl != GOLDEN_FRAME);
}
}
} else if (above_in_image || left_in_image) { // one edge available
const MB_MODE_INFO *edge_mbmi = above_in_image ? above_mbmi : left_mbmi;
if (!is_inter_block(edge_mbmi)) {
pred_context = 2;
} else {
if (has_second_ref(edge_mbmi)) {
pred_context = 4 * (edge_mbmi->ref_frame[var_ref_idx] != LAST_FRAME);
} else {
if (edge_mbmi->ref_frame[0] == LAST_FRAME)
pred_context = 0;
else
pred_context = 2 + (edge_mbmi->ref_frame[0] != GOLDEN_FRAME);
}
}
} else { // no edges available (2)
pred_context = 2;
}
assert(pred_context >= 0 && pred_context < REF_CONTEXTS);
return pred_context;
}
#endif // CONFIG_LAST3_REF
#else // CONFIG_MULTI_REF
// Returns a context number for the given MB prediction signal
@ -1100,17 +911,15 @@ int vp9_get_pred_context_comp_ref_p(const VP9_COMMON *cm,
#if CONFIG_MULTI_REF
#if CONFIG_LAST3_REF
#define CHECK_LAST_LAST2_LAST3(ref_frame) \
((ref_frame == LAST_FRAME) || (ref_frame == LAST2_FRAME) || \
(ref_frame == LAST3_FRAME))
#if CONFIG_LAST4_REF
#define CHECK_GOLDEN_OR_ALTREF(ref_frame) \
((ref_frame == GOLDEN_FRAME) || (ref_frame == ALTREF_FRAME))
#if CONFIG_LAST4_REF
// For the bit to signal whether the single reference is a ALTREF_FRAME
// or a GOLDEN_FRAME.
//
@ -1746,9 +1555,6 @@ int vp9_get_pred_context_single_ref_p2(const MACROBLOCKD *xd) {
return pred_context;
}
#define CHECK_GOLDEN_OR_ALTREF(ref_frame) \
((ref_frame == GOLDEN_FRAME) || (ref_frame == ALTREF_FRAME))
// For the bit to signal whether the single reference is LAST3_FRAME or
// LAST_FRAME/LAST2_FRAME, knowing that it shall be either of these 2 choices.
//
@ -1946,267 +1752,6 @@ int vp9_get_pred_context_single_ref_p4(const MACROBLOCKD *xd) {
#endif // CONFIG_LAST4_REF
#else // CONFIG_LAST3_REF
// For the bit to signal whether the single reference is a LAST_FRAME/
// LAST2_FRAME, or not.
int vp9_get_pred_context_single_ref_p1(const MACROBLOCKD *xd) {
int pred_context;
const MB_MODE_INFO *const above_mbmi = get_mbmi(get_above_mi(xd));
const MB_MODE_INFO *const left_mbmi = get_mbmi(get_left_mi(xd));
const int has_above = above_mbmi != NULL;
const int has_left = left_mbmi != NULL;
// Note:
// The mode info data structure has a one element border above and to the
// left of the entries correpsonding to real macroblocks.
// The prediction flags in these dummy entries are initialised to 0.
if (has_above && has_left) { // both edges available
const int above_intra = !is_inter_block(above_mbmi);
const int left_intra = !is_inter_block(left_mbmi);
if (above_intra && left_intra) { // intra/intra
pred_context = 2;
} else if (above_intra || left_intra) { // intra/inter or inter/intra
const MB_MODE_INFO *edge_mbmi = above_intra ? left_mbmi : above_mbmi;
if (!has_second_ref(edge_mbmi))
pred_context = 4 * CHECK_LAST_OR_LAST2(edge_mbmi->ref_frame[0]);
else
pred_context = 1 + (CHECK_LAST_OR_LAST2(edge_mbmi->ref_frame[0]) ||
CHECK_LAST_OR_LAST2(edge_mbmi->ref_frame[1]));
} else { // inter/inter
const int above_has_second = has_second_ref(above_mbmi);
const int left_has_second = has_second_ref(left_mbmi);
const MV_REFERENCE_FRAME above0 = above_mbmi->ref_frame[0];
const MV_REFERENCE_FRAME above1 = above_mbmi->ref_frame[1];
const MV_REFERENCE_FRAME left0 = left_mbmi->ref_frame[0];
const MV_REFERENCE_FRAME left1 = left_mbmi->ref_frame[1];
if (above_has_second && left_has_second) {
pred_context = 1 + (CHECK_LAST_OR_LAST2(above0) ||
CHECK_LAST_OR_LAST2(above1) ||
CHECK_LAST_OR_LAST2(left0) ||
CHECK_LAST_OR_LAST2(left1));
} else if (above_has_second || left_has_second) {
const MV_REFERENCE_FRAME rfs = !above_has_second ? above0 : left0;
const MV_REFERENCE_FRAME crf1 = above_has_second ? above0 : left0;
const MV_REFERENCE_FRAME crf2 = above_has_second ? above1 : left1;
if (CHECK_LAST_OR_LAST2(rfs))
pred_context = 3 + (CHECK_LAST_OR_LAST2(crf1) ||
CHECK_LAST_OR_LAST2(crf2));
else
pred_context = CHECK_LAST_OR_LAST2(crf1) || CHECK_LAST_OR_LAST2(crf2);
} else {
pred_context = 2 * CHECK_LAST_OR_LAST2(above0) +
2 * CHECK_LAST_OR_LAST2(left0);
}
}
} else if (has_above || has_left) { // one edge available
const MB_MODE_INFO *edge_mbmi = has_above ? above_mbmi : left_mbmi;
if (!is_inter_block(edge_mbmi)) { // intra
pred_context = 2;
} else { // inter
if (!has_second_ref(edge_mbmi))
pred_context = 4 * CHECK_LAST_OR_LAST2(edge_mbmi->ref_frame[0]);
else
pred_context = 1 + (CHECK_LAST_OR_LAST2(edge_mbmi->ref_frame[0]) ||
CHECK_LAST_OR_LAST2(edge_mbmi->ref_frame[1]));
}
} else { // no edges available
pred_context = 2;
}
assert(pred_context >= 0 && pred_context < REF_CONTEXTS);
return pred_context;
}
// For the bit to signal whether the single reference is a LAST_FRAME or a
// LAST2_FRAME, knowing that it shall be either of these 2 choices.
int vp9_get_pred_context_single_ref_p2(const MACROBLOCKD *xd) {
int pred_context;
const MB_MODE_INFO *const above_mbmi = get_mbmi(get_above_mi(xd));
const MB_MODE_INFO *const left_mbmi = get_mbmi(get_left_mi(xd));
const int has_above = above_mbmi != NULL;
const int has_left = left_mbmi != NULL;
// Note:
// The mode info data structure has a one element border above and to the
// left of the entries correpsonding to real macroblocks.
// The prediction flags in these dummy entries are initialised to 0.
if (has_above && has_left) { // both edges available
const int above_intra = !is_inter_block(above_mbmi);
const int left_intra = !is_inter_block(left_mbmi);
if (above_intra && left_intra) { // intra/intra
pred_context = 2;
} else if (above_intra || left_intra) { // intra/inter or inter/intra
const MB_MODE_INFO *edge_mbmi = above_intra ? left_mbmi : above_mbmi;
if (!has_second_ref(edge_mbmi)) {
if (CHECK_LAST_OR_LAST2(edge_mbmi->ref_frame[0]))
pred_context = 3;
else
pred_context = 4 * (edge_mbmi->ref_frame[0] == GOLDEN_FRAME);
} else {
pred_context = 1 + 2 * (edge_mbmi->ref_frame[0] == GOLDEN_FRAME ||
edge_mbmi->ref_frame[1] == GOLDEN_FRAME);
}
} else { // inter/inter
const int above_has_second = has_second_ref(above_mbmi);
const int left_has_second = has_second_ref(left_mbmi);
const MV_REFERENCE_FRAME above0 = above_mbmi->ref_frame[0];
const MV_REFERENCE_FRAME above1 = above_mbmi->ref_frame[1];
const MV_REFERENCE_FRAME left0 = left_mbmi->ref_frame[0];
const MV_REFERENCE_FRAME left1 = left_mbmi->ref_frame[1];
if (above_has_second && left_has_second) {
if (above0 == left0 && above1 == left1)
pred_context = 3 * (above0 == GOLDEN_FRAME ||
above1 == GOLDEN_FRAME ||
left0 == GOLDEN_FRAME ||
left1 == GOLDEN_FRAME);
else
pred_context = 2;
} else if (above_has_second || left_has_second) {
const MV_REFERENCE_FRAME rfs = !above_has_second ? above0 : left0;
const MV_REFERENCE_FRAME crf1 = above_has_second ? above0 : left0;
const MV_REFERENCE_FRAME crf2 = above_has_second ? above1 : left1;
if (rfs == GOLDEN_FRAME)
pred_context = 3 + (crf1 == GOLDEN_FRAME || crf2 == GOLDEN_FRAME);
else if (rfs == ALTREF_FRAME)
pred_context = (crf1 == GOLDEN_FRAME || crf2 == GOLDEN_FRAME);
else
pred_context = 1 + 2 * (crf1 == GOLDEN_FRAME || crf2 == GOLDEN_FRAME);
} else {
if (CHECK_LAST_OR_LAST2(above0) && CHECK_LAST_OR_LAST2(left0)) {
pred_context = 2 + (above0 == left0);
} else if (CHECK_LAST_OR_LAST2(above0) || CHECK_LAST_OR_LAST2(left0)) {
const MV_REFERENCE_FRAME edge0 = CHECK_LAST_OR_LAST2(above0) ? left0
: above0;
pred_context = 4 * (edge0 == GOLDEN_FRAME);
} else {
pred_context = 2 * (above0 == GOLDEN_FRAME) +
2 * (left0 == GOLDEN_FRAME);
}
}
}
} else if (has_above || has_left) { // one edge available
const MB_MODE_INFO *edge_mbmi = has_above ? above_mbmi : left_mbmi;
if (!is_inter_block(edge_mbmi) ||
(CHECK_LAST_OR_LAST2(edge_mbmi->ref_frame[0]) &&
!has_second_ref(edge_mbmi)))
pred_context = 2;
else if (!has_second_ref(edge_mbmi))
pred_context = 4 * (edge_mbmi->ref_frame[0] == GOLDEN_FRAME);
else
pred_context = 3 * (edge_mbmi->ref_frame[0] == GOLDEN_FRAME ||
edge_mbmi->ref_frame[1] == GOLDEN_FRAME);
} else { // no edges available (2)
pred_context = 2;
}
assert(pred_context >= 0 && pred_context < REF_CONTEXTS);
return pred_context;
}
#define CHECK_GOLDEN_OR_ALTREF(ref_frame) \
((ref_frame == GOLDEN_FRAME) || (ref_frame == ALTREF_FRAME))
// For the bit to signal whether the single reference is a GOLDEN_FRAME or an
// ALTREF_FRAME, knowing that it shall be either of these 2 choices.
int vp9_get_pred_context_single_ref_p3(const MACROBLOCKD *xd) {
int pred_context;
const MB_MODE_INFO *const above_mbmi = get_mbmi(get_above_mi(xd));
const MB_MODE_INFO *const left_mbmi = get_mbmi(get_left_mi(xd));
const int has_above = above_mbmi != NULL;
const int has_left = left_mbmi != NULL;
// Note:
// The mode info data structure has a one element border above and to the
// left of the entries correpsonding to real macroblocks.
// The prediction flags in these dummy entries are initialised to 0.
if (has_above && has_left) { // both edges available
const int above_intra = !is_inter_block(above_mbmi);
const int left_intra = !is_inter_block(left_mbmi);
if (above_intra && left_intra) { // intra/intra
pred_context = 2;
} else if (above_intra || left_intra) { // intra/inter or inter/intra
const MB_MODE_INFO *edge_mbmi = above_intra ? left_mbmi : above_mbmi;
if (!has_second_ref(edge_mbmi)) {
if (CHECK_GOLDEN_OR_ALTREF(edge_mbmi->ref_frame[0]))
pred_context = 3;
else
pred_context = 4 * (edge_mbmi->ref_frame[0] == LAST_FRAME);
} else {
pred_context = 1 + 2 * (edge_mbmi->ref_frame[0] == LAST_FRAME ||
edge_mbmi->ref_frame[1] == LAST_FRAME);
}
} else { // inter/inter
const int above_has_second = has_second_ref(above_mbmi);
const int left_has_second = has_second_ref(left_mbmi);
const MV_REFERENCE_FRAME above0 = above_mbmi->ref_frame[0];
const MV_REFERENCE_FRAME above1 = above_mbmi->ref_frame[1];
const MV_REFERENCE_FRAME left0 = left_mbmi->ref_frame[0];
const MV_REFERENCE_FRAME left1 = left_mbmi->ref_frame[1];
if (above_has_second && left_has_second) {
if (above0 == left0 && above1 == left1)
pred_context = 3 * (above0 == LAST_FRAME ||
above1 == LAST_FRAME ||
left0 == LAST_FRAME ||
left1 == LAST_FRAME);
else
pred_context = 2;
} else if (above_has_second || left_has_second) {
const MV_REFERENCE_FRAME rfs = !above_has_second ? above0 : left0;
const MV_REFERENCE_FRAME crf1 = above_has_second ? above0 : left0;
const MV_REFERENCE_FRAME crf2 = above_has_second ? above1 : left1;
if (rfs == LAST_FRAME)
pred_context = 3 + (crf1 == LAST_FRAME || crf2 == LAST_FRAME);
else if (rfs == LAST2_FRAME)
pred_context = (crf1 == LAST_FRAME || crf2 == LAST_FRAME);
else
pred_context = 1 + 2 * (crf1 == LAST_FRAME || crf2 == LAST_FRAME);
} else {
if (CHECK_GOLDEN_OR_ALTREF(above0) && CHECK_GOLDEN_OR_ALTREF(left0)) {
pred_context = 2 + (above0 == left0);
} else if (CHECK_GOLDEN_OR_ALTREF(above0) ||
CHECK_GOLDEN_OR_ALTREF(left0)) {
const MV_REFERENCE_FRAME edge0 =
CHECK_GOLDEN_OR_ALTREF(above0) ? left0 : above0;
pred_context = 4 * (edge0 == LAST_FRAME);
} else {
pred_context = 2 * (above0 == LAST_FRAME) +
2 * (left0 == LAST_FRAME);
}
}
}
} else if (has_above || has_left) { // one edge available
const MB_MODE_INFO *edge_mbmi = has_above ? above_mbmi : left_mbmi;
if (!is_inter_block(edge_mbmi) ||
(CHECK_GOLDEN_OR_ALTREF(edge_mbmi->ref_frame[0]) &&
!has_second_ref(edge_mbmi)))
pred_context = 2;
else if (!has_second_ref(edge_mbmi))
pred_context = 4 * (edge_mbmi->ref_frame[0] == LAST_FRAME);
else
pred_context = 3 * (edge_mbmi->ref_frame[0] == LAST_FRAME ||
edge_mbmi->ref_frame[1] == LAST_FRAME);
} else { // no edges available (2)
pred_context = 2;
}
assert(pred_context >= 0 && pred_context < REF_CONTEXTS);
return pred_context;
}
#endif // CONFIG_LAST3_REF
#else // CONFIG_MULTI_REF
int vp9_get_pred_context_single_ref_p1(const MACROBLOCKD *xd) {

View File

@ -140,7 +140,6 @@ static INLINE vp9_prob vp9_get_pred_prob_comp_ref_p1(const VP9_COMMON *cm,
return cm->fc.comp_ref_probs[pred_context][1];
}
#if CONFIG_LAST3_REF
int vp9_get_pred_context_comp_ref_p2(const VP9_COMMON *cm,
const MACROBLOCKD *xd);
@ -160,7 +159,6 @@ static INLINE vp9_prob vp9_get_pred_prob_comp_ref_p3(const VP9_COMMON *cm,
return cm->fc.comp_ref_probs[pred_context][3];
}
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
int vp9_get_pred_context_single_ref_p1(const MACROBLOCKD *xd);
@ -185,7 +183,6 @@ static INLINE vp9_prob vp9_get_pred_prob_single_ref_p3(const VP9_COMMON *cm,
return cm->fc.single_ref_probs[vp9_get_pred_context_single_ref_p3(xd)][2];
}
#if CONFIG_LAST3_REF
int vp9_get_pred_context_single_ref_p4(const MACROBLOCKD *xd);
static INLINE vp9_prob vp9_get_pred_prob_single_ref_p4(const VP9_COMMON *cm,
@ -201,7 +198,6 @@ static INLINE vp9_prob vp9_get_pred_prob_single_ref_p5(const VP9_COMMON *cm,
return cm->fc.single_ref_probs[vp9_get_pred_context_single_ref_p5(xd)][4];
}
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
int vp9_get_tx_size_context(const MACROBLOCKD *xd);

View File

@ -61,7 +61,6 @@ static void setup_compound_reference_mode(VP9_COMMON *cm) {
cm->comp_var_ref[0] = LAST_FRAME;
#if CONFIG_MULTI_REF
cm->comp_var_ref[1] = LAST2_FRAME;
#if CONFIG_LAST3_REF
cm->comp_var_ref[2] = LAST3_FRAME;
#if CONFIG_LAST4_REF
cm->comp_var_ref[3] = LAST4_FRAME;
@ -69,9 +68,6 @@ static void setup_compound_reference_mode(VP9_COMMON *cm) {
#else // CONFIG_LAST4_REF
cm->comp_var_ref[3] = GOLDEN_FRAME;
#endif // CONFIG_LAST4_REF
#else // CONFIG_LAST3_REF
cm->comp_var_ref[2] = GOLDEN_FRAME;
#endif // CONFIG_LAST3_REF
#else // CONFIG_MULTI_REF
cm->comp_var_ref[1] = GOLDEN_FRAME;
#endif // CONFIG_MULTI_REF
@ -3107,12 +3103,12 @@ static size_t read_uncompressed_header(VP9Decoder *pbi,
size_t sz;
int i;
#if CONFIG_MULTI_REF && CONFIG_LAST3_REF
#if CONFIG_MULTI_REF
#if CONFIG_LAST4_REF
cm->last3_frame_type = cm->last2_frame_type;
#endif // CONFIG_LAST4_REF
cm->last2_frame_type = cm->last_frame_type;
#endif // CONFIG_MULTI_REF && CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
cm->last_frame_type = cm->frame_type;
if (vp9_rb_read_literal(rb, 2) != VP9_FRAME_MARKER)

View File

@ -784,7 +784,6 @@ static void read_ref_frames(VP9_COMMON *const cm, MACROBLOCKD *const xd,
ref_frame[!idx] = cm->comp_var_ref[bit1 ? 0 : 1];
} else {
#if CONFIG_LAST3_REF
const int ctx2 = vp9_get_pred_context_comp_ref_p2(cm, xd);
const int bit2 = vp9_read(r, fc->comp_ref_probs[ctx2][2]);
@ -806,9 +805,6 @@ static void read_ref_frames(VP9_COMMON *const cm, MACROBLOCKD *const xd,
#else // CONFIG_LAST4_REF
ref_frame[!idx] = cm->comp_var_ref[bit2 ? 3 : 2];
#endif // CONFIG_LAST4_REF
#else // CONFIG_LAST3_REF
ref_frame[!idx] = cm->comp_var_ref[2];
#endif // CONFIG_LAST3_REF
}
#else // CONFIG_MULTI_REF
ref_frame[!idx] = cm->comp_var_ref[bit];
@ -836,7 +832,6 @@ static void read_ref_frames(VP9_COMMON *const cm, MACROBLOCKD *const xd,
if (!cm->frame_parallel_decoding_mode)
++counts->single_ref[ctx2][2][bit2];
#if CONFIG_LAST3_REF
if (bit2) {
#if CONFIG_LAST4_REF
const int ctx4 = vp9_get_pred_context_single_ref_p5(xd);
@ -858,9 +853,6 @@ static void read_ref_frames(VP9_COMMON *const cm, MACROBLOCKD *const xd,
ref_frame[0] = bit3 ? LAST2_FRAME : LAST_FRAME;
}
#else // CONFIG_LAST3_REF
ref_frame[0] = bit2 ? LAST2_FRAME : LAST_FRAME;
#endif // CONFIG_LAST3_REF
}
#else // CONFIG_MULTI_REF
const int ctx0 = vp9_get_pred_context_single_ref_p1(xd);

View File

@ -158,7 +158,6 @@ vpx_codec_err_t vp9_set_reference_dec(VP9_COMMON *cm,
#if CONFIG_MULTI_REF
} else if (ref_frame_flag == VP9_LAST2_FLAG) {
ref_buf = &cm->frame_refs[1];
#if CONFIG_LAST3_REF
} else if (ref_frame_flag == VP9_LAST3_FLAG) {
ref_buf = &cm->frame_refs[2];
#if CONFIG_LAST4_REF
@ -174,12 +173,6 @@ vpx_codec_err_t vp9_set_reference_dec(VP9_COMMON *cm,
} else if (ref_frame_flag == VP9_ALT_FLAG) {
ref_buf = &cm->frame_refs[4];
#endif // CONFIG_LAST4_REF
#else // CONFIG_LAST3_REF
} else if (ref_frame_flag == VP9_GOLD_FLAG) {
ref_buf = &cm->frame_refs[2];
} else if (ref_frame_flag == VP9_ALT_FLAG) {
ref_buf = &cm->frame_refs[3];
#endif // CONFIG_LAST3_REF
#else // CONFIG_MULTI_REF
} else if (ref_frame_flag == VP9_GOLD_FLAG) {
ref_buf = &cm->frame_refs[1];
@ -240,16 +233,12 @@ static void swap_frame_buffers(VP9Decoder *pbi) {
// (2) The only exception is that when current frame is a KEY_FRAME, where
// all the frames in the frame buffer (cm->frame_bufs) get refreshed.
if ((mask & 1) &&
#if CONFIG_LAST3_REF
#if CONFIG_LAST4_REF
(cm->frame_type == KEY_FRAME ||
(ref_index != 1 && ref_index != 2 && ref_index != 3))
#else // CONFIG_LAST4_REF
(cm->frame_type == KEY_FRAME || (ref_index != 1 && ref_index != 2))
#endif // CONFIG_LAST4_REF
#else // CONFIG_LAST3_REF
(cm->frame_type == KEY_FRAME || ref_index != 1)
#endif // CONFIG_LAST3_REF
) {
#else // CONFIG_MULTI_REF
if (mask & 1) {
@ -263,7 +252,6 @@ static void swap_frame_buffers(VP9Decoder *pbi) {
const int ref_index_last2 = ref_index + 1;
const int old_buf_idx_last2 = cm->ref_frame_map[ref_index_last2];
#if CONFIG_LAST3_REF
if (mask & 4) {
// If current is LAST_FRAME, and both LAST2_FRAME and LAST3_FRAME need
// to get refreshed as well, then LAST3_FRAME should get handled first
@ -301,7 +289,6 @@ static void swap_frame_buffers(VP9Decoder *pbi) {
&cm->frame_bufs[old_buf_idx_last3].raw_frame_buffer);
}
}
#endif // CONFIG_LAST3_REF
ref_cnt_fb(cm->frame_bufs,
&cm->ref_frame_map[ref_index_last2],

View File

@ -495,7 +495,7 @@ static void write_ref_frames(const VP9_COMMON *cm, const MACROBLOCKD *xd,
}
if (is_compound) {
#if CONFIG_MULTI_REF && CONFIG_LAST3_REF
#if CONFIG_MULTI_REF
#if CONFIG_LAST4_REF
const int bit = (mbmi->ref_frame[0] == GOLDEN_FRAME ||
mbmi->ref_frame[0] == LAST3_FRAME ||
@ -506,14 +506,13 @@ static void write_ref_frames(const VP9_COMMON *cm, const MACROBLOCKD *xd,
#endif // CONFIG_LAST4_REF
#else
const int bit = mbmi->ref_frame[0] == GOLDEN_FRAME;
#endif // CONFIG_MULTI_REF && CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
vp9_write(w, bit, vp9_get_pred_prob_comp_ref_p(cm, xd));
#if CONFIG_MULTI_REF
if (!bit) {
const int bit1 = mbmi->ref_frame[0] == LAST_FRAME;
vp9_write(w, bit1, vp9_get_pred_prob_comp_ref_p1(cm, xd));
#if CONFIG_LAST3_REF
} else {
const int bit2 = mbmi->ref_frame[0] == GOLDEN_FRAME;
vp9_write(w, bit2, vp9_get_pred_prob_comp_ref_p2(cm, xd));
@ -524,7 +523,6 @@ static void write_ref_frames(const VP9_COMMON *cm, const MACROBLOCKD *xd,
vp9_write(w, bit3, vp9_get_pred_prob_comp_ref_p3(cm, xd));
}
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
}
#endif // CONFIG_MULTI_REF
} else {
@ -537,19 +535,14 @@ static void write_ref_frames(const VP9_COMMON *cm, const MACROBLOCKD *xd,
const int bit1 = mbmi->ref_frame[0] != GOLDEN_FRAME;
vp9_write(w, bit1, vp9_get_pred_prob_single_ref_p2(cm, xd));
} else {
#if CONFIG_LAST3_REF
#if CONFIG_LAST4_REF
const int bit2 = (mbmi->ref_frame[0] == LAST3_FRAME ||
mbmi->ref_frame[0] == LAST4_FRAME);
#else // CONFIG_LAST4_REF
const int bit2 = mbmi->ref_frame[0] == LAST3_FRAME;
#endif // CONFIG_LAST4_REF
#else // CONFIG_LAST3_REF
const int bit2 = mbmi->ref_frame[0] != LAST_FRAME;
#endif // CONFIG_LAST3_REF
vp9_write(w, bit2, vp9_get_pred_prob_single_ref_p3(cm, xd));
#if CONFIG_LAST3_REF
if (!bit2) {
const int bit3 = mbmi->ref_frame[0] != LAST_FRAME;
vp9_write(w, bit3, vp9_get_pred_prob_single_ref_p4(cm, xd));
@ -559,7 +552,6 @@ static void write_ref_frames(const VP9_COMMON *cm, const MACROBLOCKD *xd,
vp9_write(w, bit4, vp9_get_pred_prob_single_ref_p5(cm, xd));
#endif // CONFIG_LAST4_REF
}
#endif // CONFIG_LAST3_REF
}
#else // CONFIG_MULTI_REF
const int bit0 = mbmi->ref_frame[0] != LAST_FRAME;
@ -2206,12 +2198,10 @@ static int get_refresh_mask(VP9_COMP *cpi) {
return (cpi->refresh_last_frame << cpi->lst_fb_idx) |
#if CONFIG_MULTI_REF
(cpi->refresh_last2_frame << cpi->lst2_fb_idx) |
#if CONFIG_LAST3_REF
(cpi->refresh_last3_frame << cpi->lst3_fb_idx) |
#if CONFIG_LAST4_REF
(cpi->refresh_last4_frame << cpi->lst4_fb_idx) |
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
(cpi->refresh_golden_frame << cpi->alt_fb_idx);
} else {
@ -2223,12 +2213,10 @@ static int get_refresh_mask(VP9_COMP *cpi) {
return (cpi->refresh_last_frame << cpi->lst_fb_idx) |
#if CONFIG_MULTI_REF
(cpi->refresh_last2_frame << cpi->lst2_fb_idx) |
#if CONFIG_LAST3_REF
(cpi->refresh_last3_frame << cpi->lst3_fb_idx) |
#if CONFIG_LAST4_REF
(cpi->refresh_last4_frame << cpi->lst4_fb_idx) |
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
(cpi->refresh_golden_frame << cpi->gld_fb_idx) |
(cpi->refresh_alt_ref_frame << arf_idx);
@ -2436,12 +2424,10 @@ static void write_uncompressed_header(VP9_COMP *cpi,
#if CONFIG_MULTI_REF
cpi->refresh_last2_frame =
(cm->frame_type == KEY_FRAME || cpi->refresh_last_frame) ? 1 : 0;
#if CONFIG_LAST3_REF
cpi->refresh_last3_frame = cpi->refresh_last2_frame ? 1 : 0;
#if CONFIG_LAST4_REF
cpi->refresh_last4_frame = cpi->refresh_last3_frame ? 1 : 0;
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
if (cm->frame_type == KEY_FRAME) {

View File

@ -401,14 +401,12 @@ void vp9_denoiser_update_frame_info(VP9_DENOISER *denoiser,
}
if (refresh_last_frame) {
#if CONFIG_MULTI_REF
#if CONFIG_LAST3_REF
#if CONFIG_LAST4_REF
copy_frame(denoiser->running_avg_y[LAST4_FRAME],
denoiser->running_avg_y[LAST3_FRAME]);
#endif // CONFIG_LAST4_REF
copy_frame(denoiser->running_avg_y[LAST3_FRAME],
denoiser->running_avg_y[LAST2_FRAME]);
#endif // CONFIG_LAST3_REF
copy_frame(denoiser->running_avg_y[LAST2_FRAME],
denoiser->running_avg_y[LAST_FRAME]);
#endif // CONFIG_MULTI_REF

View File

@ -1522,7 +1522,7 @@ static void update_stats(VP9_COMMON *cm, const MACROBLOCK *x) {
[has_second_ref(mbmi)]++;
if (has_second_ref(mbmi)) {
#if CONFIG_MULTI_REF && CONFIG_LAST3_REF
#if CONFIG_MULTI_REF
#if CONFIG_LAST4_REF
const int bit = (ref0 == GOLDEN_FRAME || ref0 == LAST3_FRAME ||
ref0 == LAST4_FRAME);
@ -1543,16 +1543,10 @@ static void update_stats(VP9_COMMON *cm, const MACROBLOCK *x) {
}
#endif // CONFIG_LAST4_REF
}
#else // CONFIG_MULTI_REF && CONFIG_LAST3_REF
#else // CONFIG_MULTI_REF
counts->comp_ref[vp9_get_pred_context_comp_ref_p(cm, xd)][0]
[ref0 == GOLDEN_FRAME]++;
#if CONFIG_MULTI_REF
if (ref0 != GOLDEN_FRAME) {
counts->comp_ref[vp9_get_pred_context_comp_ref_p1(cm, xd)][1]
[ref0 == LAST_FRAME]++;
}
#endif // CONFIG_MULTI_REF
#endif // CONFIG_MULTI_REF && CONFIG_LAST3_REF
} else {
#if CONFIG_MULTI_REF
const int bit = (ref0 == ALTREF_FRAME || ref0 == GOLDEN_FRAME);
@ -1561,7 +1555,6 @@ static void update_stats(VP9_COMMON *cm, const MACROBLOCK *x) {
counts->single_ref[vp9_get_pred_context_single_ref_p2(xd)][1]
[ref0 != GOLDEN_FRAME]++;
} else {
#if CONFIG_LAST3_REF
const int bit1 = !(ref0 == LAST2_FRAME || ref0 == LAST_FRAME);
counts->single_ref[vp9_get_pred_context_single_ref_p3(xd)][2]
[bit1]++;
@ -1574,10 +1567,6 @@ static void update_stats(VP9_COMMON *cm, const MACROBLOCK *x) {
[ref0 != LAST3_FRAME]++;
#endif // CONFIG_LAST4_REF
}
#else // CONFIG_LAST3_REF
counts->single_ref[vp9_get_pred_context_single_ref_p3(xd)][2]
[ref0 != LAST_FRAME]++;
#endif // CONFIG_LAST3_REF
}
#else // CONFIG_MULTI_REF
counts->single_ref[vp9_get_pred_context_single_ref_p1(xd)][0]
@ -3913,12 +3902,10 @@ static int check_dual_ref_flags(VP9_COMP *cpi) {
!!(ref_flags & VP9_LAST_FLAG) +
#if CONFIG_MULTI_REF
!!(ref_flags & VP9_LAST2_FLAG) +
#if CONFIG_LAST3_REF
!!(ref_flags & VP9_LAST3_FLAG) +
#if CONFIG_LAST4_REF
!!(ref_flags & VP9_LAST4_FLAG) +
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
!!(ref_flags & VP9_ALT_FLAG)) >= 2;
}
@ -4340,7 +4327,6 @@ void vp9_encode_frame(VP9_COMP *cpi) {
cm->comp_var_ref[0] = LAST_FRAME;
#if CONFIG_MULTI_REF
cm->comp_var_ref[1] = LAST2_FRAME;
#if CONFIG_LAST3_REF
cm->comp_var_ref[2] = LAST3_FRAME;
#if CONFIG_LAST4_REF
cm->comp_var_ref[3] = LAST4_FRAME;
@ -4348,9 +4334,6 @@ void vp9_encode_frame(VP9_COMP *cpi) {
#else // CONFIG_LAST4_REF
cm->comp_var_ref[3] = GOLDEN_FRAME;
#endif // CONFIG_LAST4_REF
#else // CONFIG_LAST3_REF
cm->comp_var_ref[2] = GOLDEN_FRAME;
#endif // CONFIG_LAST3_REF
#else // CONFIG_MULTI_REF
cm->comp_var_ref[1] = GOLDEN_FRAME;
#endif // CONFIG_MULTI_REF

View File

@ -580,8 +580,6 @@ static void init_buffer_indices(VP9_COMP *cpi) {
cpi->lst_fb_idx = 0;
#if CONFIG_MULTI_REF
cpi->lst2_fb_idx = 1;
#if CONFIG_LAST3_REF
cpi->lst3_fb_idx = 2;
#if CONFIG_LAST4_REF
@ -593,11 +591,6 @@ static void init_buffer_indices(VP9_COMP *cpi) {
cpi->alt_fb_idx = 4;
#endif // CONFIG_LAST4_REF
#else // CONFIG_LAST3_REF
cpi->gld_fb_idx = 2;
cpi->alt_fb_idx = 3;
#endif // CONFIG_LAST3_REF
#else // CONFIG_MULTI_REF
cpi->gld_fb_idx = 1;
cpi->alt_fb_idx = 2;
@ -1493,12 +1486,10 @@ void vp9_change_config(struct VP9_COMP *cpi, const VP9EncoderConfig *oxcf) {
cpi->refresh_last_frame = 1;
#if CONFIG_MULTI_REF
cpi->refresh_last2_frame = 0;
#if CONFIG_LAST3_REF
cpi->refresh_last3_frame = 0;
#if CONFIG_LAST4_REF
cpi->refresh_last4_frame = 0;
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
cm->refresh_frame_context = 1;
cm->reset_frame_context = 0;
@ -2274,12 +2265,10 @@ void vp9_update_reference(VP9_COMP *cpi, int ref_frame_flags) {
cpi->ext_refresh_last_frame = (ref_frame_flags & VP9_LAST_FLAG) != 0;
#if CONFIG_MULTI_REF
cpi->ext_refresh_last2_frame = (ref_frame_flags & VP9_LAST2_FLAG) != 0;
#if CONFIG_LAST3_REF
cpi->ext_refresh_last3_frame = (ref_frame_flags & VP9_LAST3_FLAG) != 0;
#if CONFIG_LAST4_REF
cpi->ext_refresh_last4_frame = (ref_frame_flags & VP9_LAST4_FLAG) != 0;
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
cpi->ext_refresh_frame_flags_pending = 1;
}
@ -2292,14 +2281,12 @@ static YV12_BUFFER_CONFIG *get_vp9_ref_frame_buffer(VP9_COMP *cpi,
#if CONFIG_MULTI_REF
else if (ref_frame_flag == VP9_LAST2_FLAG)
ref_frame = LAST2_FRAME;
#if CONFIG_LAST3_REF
else if (ref_frame_flag == VP9_LAST3_FLAG)
ref_frame = LAST3_FRAME;
#if CONFIG_LAST4_REF
else if (ref_frame_flag == VP9_LAST4_FLAG)
ref_frame = LAST4_FRAME;
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
else if (ref_frame_flag == VP9_GOLD_FLAG)
ref_frame = GOLDEN_FRAME;
@ -2624,7 +2611,6 @@ void vp9_update_reference_frames(VP9_COMP *cpi) {
if (cpi->refresh_last_frame) {
#if CONFIG_MULTI_REF
if (cpi->refresh_last2_frame) {
#if CONFIG_LAST3_REF
if (cpi->refresh_last3_frame) {
#if CONFIG_LAST4_REF
if (cpi->refresh_last4_frame) {
@ -2648,7 +2634,6 @@ void vp9_update_reference_frames(VP9_COMP *cpi) {
&cm->ref_frame_map[cpi->lst3_fb_idx],
cm->ref_frame_map[cpi->lst2_fb_idx]);
}
#endif // CONFIG_LAST3_REF
if (cm->frame_type == KEY_FRAME)
ref_cnt_fb(cm->frame_bufs,
@ -2666,7 +2651,6 @@ void vp9_update_reference_frames(VP9_COMP *cpi) {
if (!cpi->rc.is_src_frame_alt_ref) {
#if CONFIG_MULTI_REF
if (cpi->refresh_last2_frame) {
#if CONFIG_LAST3_REF
if (cpi->refresh_last3_frame) {
#if CONFIG_LAST4_REF
if (cpi->refresh_last4_frame) {
@ -2690,7 +2674,6 @@ void vp9_update_reference_frames(VP9_COMP *cpi) {
cpi->interp_filter_selected[LAST2_FRAME],
sizeof(cpi->interp_filter_selected[LAST2_FRAME]));
}
#endif // CONFIG_LAST3_REF
if (cm->frame_type == KEY_FRAME)
vpx_memcpy(cpi->interp_filter_selected[LAST2_FRAME],
@ -2759,12 +2742,10 @@ void vp9_scale_references(VP9_COMP *cpi) {
VP9_LAST_FLAG,
#if CONFIG_MULTI_REF
VP9_LAST2_FLAG,
#if CONFIG_LAST3_REF
VP9_LAST3_FLAG,
#if CONFIG_LAST4_REF
VP9_LAST4_FLAG,
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
VP9_GOLD_FLAG,
VP9_ALT_FLAG
@ -3166,7 +3147,6 @@ static int get_ref_frame_flags(const VP9_COMP *cpi) {
const int gld_is_last2 = map[cpi->gld_fb_idx] == map[cpi->lst2_fb_idx];
const int alt_is_last2 = map[cpi->alt_fb_idx] == map[cpi->lst2_fb_idx];
#if CONFIG_LAST3_REF
const int last3_is_last = map[cpi->lst3_fb_idx] == map[cpi->lst_fb_idx];
const int last3_is_last2 = map[cpi->lst3_fb_idx] == map[cpi->lst2_fb_idx];
const int gld_is_last3 = map[cpi->gld_fb_idx] == map[cpi->lst3_fb_idx];
@ -3179,18 +3159,15 @@ static int get_ref_frame_flags(const VP9_COMP *cpi) {
const int gld_is_last4 = map[cpi->gld_fb_idx] == map[cpi->lst4_fb_idx];
const int alt_is_last4 = map[cpi->alt_fb_idx] == map[cpi->lst4_fb_idx];
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
int flags = VP9_ALT_FLAG | VP9_GOLD_FLAG | VP9_LAST_FLAG;
#if CONFIG_MULTI_REF
flags |= VP9_LAST2_FLAG;
#if CONFIG_LAST3_REF
flags |= VP9_LAST3_FLAG;
#if CONFIG_LAST4_REF
flags |= VP9_LAST4_FLAG;
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
if (gold_is_last)
@ -3207,8 +3184,6 @@ static int get_ref_frame_flags(const VP9_COMP *cpi) {
#if CONFIG_MULTI_REF
#if CONFIG_LAST3_REF
#if CONFIG_LAST4_REF
if (last4_is_last || last4_is_last2 || last4_is_last3)
flags &= ~VP9_LAST4_FLAG;
@ -3228,7 +3203,6 @@ static int get_ref_frame_flags(const VP9_COMP *cpi) {
if (alt_is_last3)
flags &= ~VP9_ALT_FLAG;
#endif // CONFIG_LAST3_REF
if (last2_is_last)
flags &= ~VP9_LAST2_FLAG;
@ -3256,12 +3230,10 @@ static void set_ext_overrides(VP9_COMP *cpi) {
cpi->refresh_last_frame = cpi->ext_refresh_last_frame;
#if CONFIG_MULTI_REF
cpi->refresh_last2_frame = cpi->ext_refresh_last2_frame;
#if CONFIG_LAST3_REF
cpi->refresh_last3_frame = cpi->ext_refresh_last3_frame;
#if CONFIG_LAST4_REF
cpi->refresh_last4_frame = cpi->ext_refresh_last4_frame;
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
cpi->refresh_golden_frame = cpi->ext_refresh_golden_frame;
cpi->refresh_alt_ref_frame = cpi->ext_refresh_alt_ref_frame;
@ -3364,7 +3336,6 @@ int setup_interp_filter_search_mask(VP9_COMP *cpi) {
(ref_total[LAST2_FRAME] == 0 ||
cpi->interp_filter_selected[LAST2_FRAME][ifilter] * 50
< ref_total[LAST2_FRAME]) &&
#if CONFIG_LAST3_REF
(ref_total[LAST3_FRAME] == 0 ||
cpi->interp_filter_selected[LAST3_FRAME][ifilter] * 50
< ref_total[LAST3_FRAME]) &&
@ -3373,7 +3344,6 @@ int setup_interp_filter_search_mask(VP9_COMP *cpi) {
cpi->interp_filter_selected[LAST4_FRAME][ifilter] * 50
< ref_total[LAST4_FRAME]) &&
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
(ref_total[GOLDEN_FRAME] == 0 ||
cpi->interp_filter_selected[GOLDEN_FRAME][ifilter] * 50
@ -3608,12 +3578,12 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi,
cpi->ref_frame_flags = get_ref_frame_flags(cpi);
#if CONFIG_MULTI_REF && CONFIG_LAST3_REF
#if CONFIG_MULTI_REF
#if CONFIG_LAST4_REF
cm->last3_frame_type = cm->last2_frame_type;
#endif // CONFIG_LAST4_REF
cm->last2_frame_type = cm->last_frame_type;
#endif // CONFIG_MULTI_REF && CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
cm->last_frame_type = cm->frame_type;
#if CONFIG_LOOP_POSTFILTER
@ -3757,12 +3727,10 @@ static int frame_is_reference(const VP9_COMP *cpi) {
cpi->refresh_last_frame ||
#if CONFIG_MULTI_REF
cpi->refresh_last2_frame ||
#if CONFIG_LAST3_REF
cpi->refresh_last3_frame ||
#if CONFIG_LAST4_REF
cpi->refresh_last4_frame ||
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
cpi->refresh_golden_frame ||
cpi->refresh_alt_ref_frame ||
@ -3885,12 +3853,10 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags,
cpi->refresh_last_frame = 1;
#if CONFIG_MULTI_REF
cpi->refresh_last2_frame = 0;
#if CONFIG_LAST3_REF
cpi->refresh_last3_frame = 0;
#if CONFIG_LAST4_REF
cpi->refresh_last4_frame = 0;
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
cpi->refresh_golden_frame = 0;
cpi->refresh_alt_ref_frame = 0;
@ -3917,12 +3883,10 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags,
cpi->refresh_last_frame = 0;
#if CONFIG_MULTI_REF
cpi->refresh_last2_frame = 0;
#if CONFIG_LAST3_REF
cpi->refresh_last3_frame = 0;
#if CONFIG_LAST4_REF
cpi->refresh_last4_frame = 0;
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
rc->is_src_frame_alt_ref = 0;
rc->source_alt_ref_pending = 0;

View File

@ -239,12 +239,10 @@ typedef struct VP9_COMP {
int lst_fb_idx;
#if CONFIG_MULTI_REF
int lst2_fb_idx;
#if CONFIG_LAST3_REF
int lst3_fb_idx;
#if CONFIG_LAST4_REF
int lst4_fb_idx;
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
int gld_fb_idx;
int alt_fb_idx;
@ -252,12 +250,10 @@ typedef struct VP9_COMP {
int refresh_last_frame;
#if CONFIG_MULTI_REF
int refresh_last2_frame;
#if CONFIG_LAST3_REF
int refresh_last3_frame;
#if CONFIG_LAST4_REF
int refresh_last4_frame;
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
int refresh_golden_frame;
int refresh_alt_ref_frame;
@ -267,12 +263,10 @@ typedef struct VP9_COMP {
int ext_refresh_last_frame;
#if CONFIG_MULTI_REF
int ext_refresh_last2_frame;
#if CONFIG_LAST3_REF
int ext_refresh_last3_frame;
#if CONFIG_LAST4_REF
int ext_refresh_last4_frame;
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
int ext_refresh_golden_frame;
int ext_refresh_alt_ref_frame;
@ -513,14 +507,12 @@ static INLINE int get_ref_frame_idx(const VP9_COMP *cpi,
#if CONFIG_MULTI_REF
} else if (ref_frame == LAST2_FRAME) {
return cpi->lst2_fb_idx;
#if CONFIG_LAST3_REF
} else if (ref_frame == LAST3_FRAME) {
return cpi->lst3_fb_idx;
#if CONFIG_LAST4_REF
} else if (ref_frame == LAST4_FRAME) {
return cpi->lst4_fb_idx;
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
} else if (ref_frame == GOLDEN_FRAME) {
return cpi->gld_fb_idx;

View File

@ -629,12 +629,10 @@ void vp9_set_rd_speed_thresholds(VP9_COMP *cpi) {
rd->thresh_mult[THR_NEARESTMV] = 300;
#if CONFIG_MULTI_REF
rd->thresh_mult[THR_NEARESTL2] = 300;
#if CONFIG_LAST3_REF
rd->thresh_mult[THR_NEARESTL3] = 300;
#if CONFIG_LAST4_REF
rd->thresh_mult[THR_NEARESTL4] = 300;
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
rd->thresh_mult[THR_NEARESTG] = 300;
rd->thresh_mult[THR_NEARESTA] = 300;
@ -642,12 +640,10 @@ void vp9_set_rd_speed_thresholds(VP9_COMP *cpi) {
rd->thresh_mult[THR_NEARESTMV] = 0;
#if CONFIG_MULTI_REF
rd->thresh_mult[THR_NEARESTL2] = 0;
#if CONFIG_LAST3_REF
rd->thresh_mult[THR_NEARESTL3] = 0;
#if CONFIG_LAST4_REF
rd->thresh_mult[THR_NEARESTL4] = 0;
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
rd->thresh_mult[THR_NEARESTG] = 0;
rd->thresh_mult[THR_NEARESTA] = 0;
@ -658,12 +654,10 @@ void vp9_set_rd_speed_thresholds(VP9_COMP *cpi) {
rd->thresh_mult[THR_NEWMV] += 1000;
#if CONFIG_MULTI_REF
rd->thresh_mult[THR_NEWL2] += 1000;
#if CONFIG_LAST3_REF
rd->thresh_mult[THR_NEWL3] += 1000;
#if CONFIG_LAST4_REF
rd->thresh_mult[THR_NEWL4] += 1000;
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
rd->thresh_mult[THR_NEWG] += 1000;
rd->thresh_mult[THR_NEWA] += 1000;
@ -672,12 +666,10 @@ void vp9_set_rd_speed_thresholds(VP9_COMP *cpi) {
rd->thresh_mult[THR_NEW2MV] += 1000;
#if CONFIG_MULTI_REF
rd->thresh_mult[THR_NEW2L2] += 1000;
#if CONFIG_LAST3_REF
rd->thresh_mult[THR_NEW2L3] += 1000;
#if CONFIG_LAST4_REF
rd->thresh_mult[THR_NEW2L4] += 1000;
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
rd->thresh_mult[THR_NEW2G] += 1000;
rd->thresh_mult[THR_NEW2A] += 1000;
@ -686,12 +678,10 @@ void vp9_set_rd_speed_thresholds(VP9_COMP *cpi) {
rd->thresh_mult[THR_NEARMV] += 1000;
#if CONFIG_MULTI_REF
rd->thresh_mult[THR_NEARL2] += 1000;
#if CONFIG_LAST3_REF
rd->thresh_mult[THR_NEARL3] += 1000;
#if CONFIG_LAST4_REF
rd->thresh_mult[THR_NEARL4] += 1000;
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
rd->thresh_mult[THR_NEARG] += 1000;
rd->thresh_mult[THR_NEARA] += 1000;
@ -701,12 +691,10 @@ void vp9_set_rd_speed_thresholds(VP9_COMP *cpi) {
rd->thresh_mult[THR_ZEROMV] += 2000;
#if CONFIG_MULTI_REF
rd->thresh_mult[THR_ZEROL2] += 2000;
#if CONFIG_LAST3_REF
rd->thresh_mult[THR_ZEROL3] += 2000;
#if CONFIG_LAST4_REF
rd->thresh_mult[THR_ZEROL4] += 2000;
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
rd->thresh_mult[THR_ZEROG] += 2000;
rd->thresh_mult[THR_ZEROA] += 2000;
@ -742,7 +730,6 @@ void vp9_set_rd_speed_thresholds(VP9_COMP *cpi) {
rd->thresh_mult[THR_COMP_NEW_NEWL2A] += 2000;
rd->thresh_mult[THR_COMP_ZERO_ZEROL2A] += 2500;
#if CONFIG_LAST3_REF
rd->thresh_mult[THR_COMP_NEAREST_NEARESTL3A] += 1000;
rd->thresh_mult[THR_COMP_NEAREST_NEARL3A] += 1200;
rd->thresh_mult[THR_COMP_NEAR_NEARESTL3A] += 1200;
@ -765,7 +752,6 @@ void vp9_set_rd_speed_thresholds(VP9_COMP *cpi) {
rd->thresh_mult[THR_COMP_ZERO_ZEROL4A] += 2500;
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
#else // CONFIG_NEW_INTER
@ -784,7 +770,6 @@ void vp9_set_rd_speed_thresholds(VP9_COMP *cpi) {
rd->thresh_mult[THR_COMP_NEWL2A] += 2000;
rd->thresh_mult[THR_COMP_ZEROL2A] += 2500;
#if CONFIG_LAST3_REF
rd->thresh_mult[THR_COMP_NEARESTL3A] += 1000;
rd->thresh_mult[THR_COMP_NEARL3A] += 1500;
rd->thresh_mult[THR_COMP_NEWL3A] += 2000;
@ -797,7 +782,6 @@ void vp9_set_rd_speed_thresholds(VP9_COMP *cpi) {
rd->thresh_mult[THR_COMP_ZEROL4A] += 2500;
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
#endif // CONFIG_NEW_INTER
@ -815,12 +799,10 @@ void vp9_set_rd_speed_thresholds(VP9_COMP *cpi) {
rd->thresh_mult[THR_COMP_INTERINTRA_ZEROL ] += 1500;
#if CONFIG_MULTI_REF
rd->thresh_mult[THR_COMP_INTERINTRA_ZEROL2 ] += 1500;
#if CONFIG_LAST3_REF
rd->thresh_mult[THR_COMP_INTERINTRA_ZEROL3 ] += 1500;
#if CONFIG_LAST4_REF
rd->thresh_mult[THR_COMP_INTERINTRA_ZEROL4 ] += 1500;
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
rd->thresh_mult[THR_COMP_INTERINTRA_ZEROG ] += 1500;
rd->thresh_mult[THR_COMP_INTERINTRA_ZEROA ] += 1500;
@ -828,12 +810,10 @@ void vp9_set_rd_speed_thresholds(VP9_COMP *cpi) {
rd->thresh_mult[THR_COMP_INTERINTRA_NEARESTL] += 1500;
#if CONFIG_MULTI_REF
rd->thresh_mult[THR_COMP_INTERINTRA_NEARESTL2] += 1500;
#if CONFIG_LAST3_REF
rd->thresh_mult[THR_COMP_INTERINTRA_NEARESTL3] += 1500;
#if CONFIG_LAST4_REF
rd->thresh_mult[THR_COMP_INTERINTRA_NEARESTL4] += 1500;
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
rd->thresh_mult[THR_COMP_INTERINTRA_NEARESTG] += 1500;
rd->thresh_mult[THR_COMP_INTERINTRA_NEARESTA] += 1500;
@ -841,12 +821,10 @@ void vp9_set_rd_speed_thresholds(VP9_COMP *cpi) {
rd->thresh_mult[THR_COMP_INTERINTRA_NEARL ] += 1500;
#if CONFIG_MULTI_REF
rd->thresh_mult[THR_COMP_INTERINTRA_NEARL2 ] += 1500;
#if CONFIG_LAST3_REF
rd->thresh_mult[THR_COMP_INTERINTRA_NEARL3 ] += 1500;
#if CONFIG_LAST4_REF
rd->thresh_mult[THR_COMP_INTERINTRA_NEARL4 ] += 1500;
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
rd->thresh_mult[THR_COMP_INTERINTRA_NEARG ] += 1500;
rd->thresh_mult[THR_COMP_INTERINTRA_NEARA ] += 1500;
@ -854,12 +832,10 @@ void vp9_set_rd_speed_thresholds(VP9_COMP *cpi) {
rd->thresh_mult[THR_COMP_INTERINTRA_NEWL ] += 2000;
#if CONFIG_MULTI_REF
rd->thresh_mult[THR_COMP_INTERINTRA_NEWL2 ] += 2000;
#if CONFIG_LAST3_REF
rd->thresh_mult[THR_COMP_INTERINTRA_NEWL3 ] += 2000;
#if CONFIG_LAST4_REF
rd->thresh_mult[THR_COMP_INTERINTRA_NEWL4 ] += 2000;
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
rd->thresh_mult[THR_COMP_INTERINTRA_NEWG ] += 2000;
rd->thresh_mult[THR_COMP_INTERINTRA_NEWA ] += 2000;
@ -877,12 +853,10 @@ void vp9_set_rd_speed_thresholds_sub8x8(VP9_COMP *cpi) {
rd->thresh_mult_sub8x8[THR_LAST] += 2500;
#if CONFIG_MULTI_REF
rd->thresh_mult_sub8x8[THR_LAST2] += 2500;
#if CONFIG_LAST3_REF
rd->thresh_mult_sub8x8[THR_LAST3] += 2500;
#if CONFIG_LAST4_REF
rd->thresh_mult_sub8x8[THR_LAST4] += 2500;
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
rd->thresh_mult_sub8x8[THR_GOLD] += 2500;
rd->thresh_mult_sub8x8[THR_ALTR] += 2500;
@ -890,12 +864,10 @@ void vp9_set_rd_speed_thresholds_sub8x8(VP9_COMP *cpi) {
rd->thresh_mult_sub8x8[THR_COMP_LA] += 4500;
#if CONFIG_MULTI_REF
rd->thresh_mult_sub8x8[THR_COMP_L2A] += 4500;
#if CONFIG_LAST3_REF
rd->thresh_mult_sub8x8[THR_COMP_L3A] += 4500;
#if CONFIG_LAST4_REF
rd->thresh_mult_sub8x8[THR_COMP_L4A] += 4500;
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
rd->thresh_mult_sub8x8[THR_COMP_GA] += 4500;

View File

@ -39,8 +39,6 @@ extern "C" {
#if CONFIG_MULTI_REF
#if CONFIG_LAST3_REF
#if CONFIG_LAST4_REF
#if CONFIG_NEW_INTER
@ -83,28 +81,6 @@ extern "C" {
#endif // CONFIG_LAST4_REF
#else // CONFIG_LAST3_REF
#if CONFIG_NEW_INTER
#if CONFIG_INTERINTRA
#define MAX_MODES 73
#else // CONFIG_INTERINTRA
#define MAX_MODES 57
#endif // CONFIG_INTERINTRA
#else // CONFIG_NEW_INTER
#if CONFIG_INTERINTRA
#define MAX_MODES 54
#else // CONFIG_INTERINTRA
#define MAX_MODES 38
#endif // CONFIG_INTERINTRA
#endif // CONFIG_NEW_INTER
#endif // CONFIG_LAST3_REF
#else // CONFIG_MULTI_REF
#if CONFIG_NEW_INTER
@ -128,15 +104,11 @@ extern "C" {
#endif // CONFIG_MULTI_REF
#if CONFIG_MULTI_REF
#if CONFIG_LAST3_REF
#if CONFIG_LAST4_REF
#define MAX_REFS 12
#else // CONFIG_LAST4_REF
#define MAX_REFS 10
#endif // CONFIG_LAST4_REF
#else // CONFIG_LAST3_REF
#define MAX_REFS 8
#endif // CONFIG_LAST3_REF
#else // CONFIG_MULTI_REF
#define MAX_REFS 6
#endif // CONFIG_MULTI_REF
@ -147,12 +119,10 @@ typedef enum {
THR_NEARESTMV,
#if CONFIG_MULTI_REF
THR_NEARESTL2,
#if CONFIG_LAST3_REF
THR_NEARESTL3,
#if CONFIG_LAST4_REF
THR_NEARESTL4,
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
THR_NEARESTA,
THR_NEARESTG,
@ -162,12 +132,10 @@ typedef enum {
THR_NEWMV,
#if CONFIG_MULTI_REF
THR_NEWL2,
#if CONFIG_LAST3_REF
THR_NEWL3,
#if CONFIG_LAST4_REF
THR_NEWL4,
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
THR_NEWA,
THR_NEWG,
@ -176,12 +144,10 @@ typedef enum {
THR_NEW2MV,
#if CONFIG_MULTI_REF
THR_NEW2L2,
#if CONFIG_LAST3_REF
THR_NEW2L3,
#if CONFIG_LAST4_REF
THR_NEW2L4,
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
THR_NEW2A,
THR_NEW2G,
@ -190,12 +156,10 @@ typedef enum {
THR_NEARMV,
#if CONFIG_MULTI_REF
THR_NEARL2,
#if CONFIG_LAST3_REF
THR_NEARL3,
#if CONFIG_LAST4_REF
THR_NEARL4,
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
THR_NEARA,
THR_NEARG,
@ -203,12 +167,10 @@ typedef enum {
THR_ZEROMV,
#if CONFIG_MULTI_REF
THR_ZEROL2,
#if CONFIG_LAST3_REF
THR_ZEROL3,
#if CONFIG_LAST4_REF
THR_ZEROL4,
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
THR_ZEROG,
THR_ZEROA,
@ -217,24 +179,20 @@ typedef enum {
THR_COMP_NEAREST_NEARESTLA,
#if CONFIG_MULTI_REF
THR_COMP_NEAREST_NEARESTL2A,
#if CONFIG_LAST3_REF
THR_COMP_NEAREST_NEARESTL3A,
#if CONFIG_LAST4_REF
THR_COMP_NEAREST_NEARESTL4A,
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
THR_COMP_NEAREST_NEARESTGA,
#else // CONFIG_NEW_INTER
THR_COMP_NEARESTLA,
#if CONFIG_MULTI_REF
THR_COMP_NEARESTL2A,
#if CONFIG_LAST3_REF
THR_COMP_NEARESTL3A,
#if CONFIG_LAST4_REF
THR_COMP_NEARESTL4A,
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
THR_COMP_NEARESTGA,
#endif // CONFIG_NEW_INTER
@ -276,7 +234,6 @@ typedef enum {
THR_COMP_NEW_NEWL2A,
THR_COMP_ZERO_ZEROL2A,
#if CONFIG_LAST3_REF
THR_COMP_NEAR_NEARESTL3A,
THR_COMP_NEAREST_NEARL3A,
@ -303,7 +260,6 @@ typedef enum {
THR_COMP_ZERO_ZEROL4A,
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
#else // CONFIG_NEW_INTER
@ -320,7 +276,6 @@ typedef enum {
THR_COMP_NEWL2A,
THR_COMP_ZEROL2A,
#if CONFIG_LAST3_REF
THR_COMP_NEARL3A,
THR_COMP_NEWL3A,
THR_COMP_ZEROL3A,
@ -329,9 +284,8 @@ typedef enum {
THR_COMP_NEARL4A,
THR_COMP_NEWL4A,
THR_COMP_ZEROL4A,
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
#endif // CONFIG_NEW_INTER
@ -357,7 +311,6 @@ typedef enum {
THR_COMP_INTERINTRA_NEARL2,
THR_COMP_INTERINTRA_NEWL2,
#if CONFIG_LAST3_REF
THR_COMP_INTERINTRA_ZEROL3,
THR_COMP_INTERINTRA_NEARESTL3,
THR_COMP_INTERINTRA_NEARL3,
@ -370,7 +323,6 @@ typedef enum {
THR_COMP_INTERINTRA_NEWL4,
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
THR_COMP_INTERINTRA_ZEROG,
@ -389,24 +341,20 @@ typedef enum {
THR_LAST,
#if CONFIG_MULTI_REF
THR_LAST2,
#if CONFIG_LAST3_REF
THR_LAST3,
#if CONFIG_LAST4_REF
THR_LAST4,
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
THR_GOLD,
THR_ALTR,
THR_COMP_LA,
#if CONFIG_MULTI_REF
THR_COMP_L2A,
#if CONFIG_LAST3_REF
THR_COMP_L3A,
#if CONFIG_LAST4_REF
THR_COMP_L4A,
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
THR_COMP_GA,
THR_INTRA,

View File

@ -50,8 +50,6 @@
#if CONFIG_MULTI_REF
#if CONFIG_LAST3_REF
#if CONFIG_LAST4_REF
#define LAST_FRAME_MODE_MASK ((1 << GOLDEN_FRAME) | (1 << ALTREF_FRAME) | \
@ -93,19 +91,6 @@
#endif // CONFIG_LAST4_REF
#else // CONFIG_LAST3_REF
#define LAST_FRAME_MODE_MASK ((1 << GOLDEN_FRAME) | (1 << ALTREF_FRAME) | \
(1 << LAST2_FRAME) | (1 << INTRA_FRAME))
#define LAST2_FRAME_MODE_MASK ((1 << GOLDEN_FRAME) | (1 << ALTREF_FRAME) | \
(1 << LAST_FRAME) | (1 << INTRA_FRAME))
#define GOLDEN_FRAME_MODE_MASK ((1 << LAST_FRAME) | (1 << ALTREF_FRAME) | \
(1 << LAST2_FRAME) | (1 << INTRA_FRAME))
#define ALT_REF_MODE_MASK ((1 << LAST_FRAME) | (1 << GOLDEN_FRAME) | \
(1 << LAST2_FRAME) | (1 << INTRA_FRAME))
#endif // CONFIG_LAST3_REF
#else // CONFIG_MULTI_REF
#define LAST_FRAME_MODE_MASK ((1 << GOLDEN_FRAME) | (1 << ALTREF_FRAME) | \
@ -155,12 +140,10 @@ static const MODE_DEFINITION vp9_mode_order[MAX_MODES] = {
{NEARESTMV, {LAST_FRAME, NONE}},
#if CONFIG_MULTI_REF
{NEARESTMV, {LAST2_FRAME, NONE}},
#if CONFIG_LAST3_REF
{NEARESTMV, {LAST3_FRAME, NONE}},
#if CONFIG_LAST4_REF
{NEARESTMV, {LAST4_FRAME, NONE}},
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
{NEARESTMV, {ALTREF_FRAME, NONE}},
{NEARESTMV, {GOLDEN_FRAME, NONE}},
@ -170,12 +153,10 @@ static const MODE_DEFINITION vp9_mode_order[MAX_MODES] = {
{NEWMV, {LAST_FRAME, NONE}},
#if CONFIG_MULTI_REF
{NEWMV, {LAST2_FRAME, NONE}},
#if CONFIG_LAST3_REF
{NEWMV, {LAST3_FRAME, NONE}},
#if CONFIG_LAST4_REF
{NEWMV, {LAST4_FRAME, NONE}},
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
{NEWMV, {ALTREF_FRAME, NONE}},
{NEWMV, {GOLDEN_FRAME, NONE}},
@ -184,12 +165,10 @@ static const MODE_DEFINITION vp9_mode_order[MAX_MODES] = {
{NEW2MV, {LAST_FRAME, NONE}},
#if CONFIG_MULTI_REF
{NEW2MV, {LAST2_FRAME, NONE}},
#if CONFIG_LAST3_REF
{NEW2MV, {LAST3_FRAME, NONE}},
#if CONFIG_LAST4_REF
{NEW2MV, {LAST4_FRAME, NONE}},
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
{NEW2MV, {ALTREF_FRAME, NONE}},
{NEW2MV, {GOLDEN_FRAME, NONE}},
@ -198,12 +177,10 @@ static const MODE_DEFINITION vp9_mode_order[MAX_MODES] = {
{NEARMV, {LAST_FRAME, NONE}},
#if CONFIG_MULTI_REF
{NEARMV, {LAST2_FRAME, NONE}},
#if CONFIG_LAST3_REF
{NEARMV, {LAST3_FRAME, NONE}},
#if CONFIG_LAST4_REF
{NEARMV, {LAST4_FRAME, NONE}},
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
{NEARMV, {ALTREF_FRAME, NONE}},
{NEARMV, {GOLDEN_FRAME, NONE}},
@ -211,12 +188,10 @@ static const MODE_DEFINITION vp9_mode_order[MAX_MODES] = {
{ZEROMV, {LAST_FRAME, NONE}},
#if CONFIG_MULTI_REF
{ZEROMV, {LAST2_FRAME, NONE}},
#if CONFIG_LAST3_REF
{ZEROMV, {LAST3_FRAME, NONE}},
#if CONFIG_LAST4_REF
{ZEROMV, {LAST4_FRAME, NONE}},
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
{ZEROMV, {GOLDEN_FRAME, NONE}},
{ZEROMV, {ALTREF_FRAME, NONE}},
@ -225,12 +200,10 @@ static const MODE_DEFINITION vp9_mode_order[MAX_MODES] = {
{NEAREST_NEARESTMV, {LAST_FRAME, ALTREF_FRAME}},
#if CONFIG_MULTI_REF
{NEAREST_NEARESTMV, {LAST2_FRAME, ALTREF_FRAME}},
#if CONFIG_LAST3_REF
{NEAREST_NEARESTMV, {LAST3_FRAME, ALTREF_FRAME}},
#if CONFIG_LAST4_REF
{NEAREST_NEARESTMV, {LAST4_FRAME, ALTREF_FRAME}},
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
{NEAREST_NEARESTMV, {GOLDEN_FRAME, ALTREF_FRAME}},
@ -238,12 +211,10 @@ static const MODE_DEFINITION vp9_mode_order[MAX_MODES] = {
{NEARESTMV, {LAST_FRAME, ALTREF_FRAME}},
#if CONFIG_MULTI_REF
{NEARESTMV, {LAST2_FRAME, ALTREF_FRAME}},
#if CONFIG_LAST3_REF
{NEARESTMV, {LAST3_FRAME, ALTREF_FRAME}},
#if CONFIG_LAST4_REF
{NEARESTMV, {LAST4_FRAME, ALTREF_FRAME}},
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
{NEARESTMV, {GOLDEN_FRAME, ALTREF_FRAME}},
@ -285,7 +256,6 @@ static const MODE_DEFINITION vp9_mode_order[MAX_MODES] = {
{NEW_NEWMV, {LAST2_FRAME, ALTREF_FRAME}},
{ZERO_ZEROMV, {LAST2_FRAME, ALTREF_FRAME}},
#if CONFIG_LAST3_REF
{NEAR_NEARESTMV, {LAST3_FRAME, ALTREF_FRAME}},
{NEAREST_NEARMV, {LAST3_FRAME, ALTREF_FRAME}},
@ -312,8 +282,6 @@ static const MODE_DEFINITION vp9_mode_order[MAX_MODES] = {
{ZERO_ZEROMV, {LAST4_FRAME, ALTREF_FRAME}},
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
#else /// CONFIG_NEW_INTER
@ -330,7 +298,6 @@ static const MODE_DEFINITION vp9_mode_order[MAX_MODES] = {
{NEWMV, {LAST2_FRAME, ALTREF_FRAME}},
{ZEROMV, {LAST2_FRAME, ALTREF_FRAME}},
#if CONFIG_LAST3_REF
{NEARMV, {LAST3_FRAME, ALTREF_FRAME}},
{NEWMV, {LAST3_FRAME, ALTREF_FRAME}},
{ZEROMV, {LAST3_FRAME, ALTREF_FRAME}},
@ -340,7 +307,6 @@ static const MODE_DEFINITION vp9_mode_order[MAX_MODES] = {
{NEWMV, {LAST4_FRAME, ALTREF_FRAME}},
{ZEROMV, {LAST4_FRAME, ALTREF_FRAME}},
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
#endif // CONFIG_NEW_INTER
@ -366,7 +332,6 @@ static const MODE_DEFINITION vp9_mode_order[MAX_MODES] = {
{NEARMV, {LAST2_FRAME, INTRA_FRAME}},
{NEWMV, {LAST2_FRAME, INTRA_FRAME}},
#if CONFIG_LAST3_REF
{ZEROMV, {LAST3_FRAME, INTRA_FRAME}},
{NEARESTMV, {LAST3_FRAME, INTRA_FRAME}},
{NEARMV, {LAST3_FRAME, INTRA_FRAME}},
@ -378,7 +343,6 @@ static const MODE_DEFINITION vp9_mode_order[MAX_MODES] = {
{NEARMV, {LAST4_FRAME, INTRA_FRAME}},
{NEWMV, {LAST4_FRAME, INTRA_FRAME}},
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
{ZEROMV, {GOLDEN_FRAME, INTRA_FRAME}},
@ -397,24 +361,20 @@ static const REF_DEFINITION vp9_ref_order[MAX_REFS] = {
{{LAST_FRAME, NONE}},
#if CONFIG_MULTI_REF
{{LAST2_FRAME, NONE}},
#if CONFIG_LAST3_REF
{{LAST3_FRAME, NONE}},
#if CONFIG_LAST4_REF
{{LAST4_FRAME, NONE}},
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
{{GOLDEN_FRAME, NONE}},
{{ALTREF_FRAME, NONE}},
{{LAST_FRAME, ALTREF_FRAME}},
#if CONFIG_MULTI_REF
{{LAST2_FRAME, ALTREF_FRAME}},
#if CONFIG_LAST3_REF
{{LAST3_FRAME, ALTREF_FRAME}},
#if CONFIG_LAST4_REF
{{LAST4_FRAME, ALTREF_FRAME}},
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
{{GOLDEN_FRAME, ALTREF_FRAME}},
{{INTRA_FRAME, NONE}},
@ -4544,12 +4504,10 @@ static void estimate_ref_frame_costs(const VP9_COMMON *cm,
vp9_prob ref_single_p2 = vp9_get_pred_prob_single_ref_p2(cm, xd);
#if CONFIG_MULTI_REF
vp9_prob ref_single_p3 = vp9_get_pred_prob_single_ref_p3(cm, xd);
#if CONFIG_LAST3_REF
vp9_prob ref_single_p4 = vp9_get_pred_prob_single_ref_p4(cm, xd);
#if CONFIG_LAST4_REF
vp9_prob ref_single_p5 = vp9_get_pred_prob_single_ref_p5(cm, xd);
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
unsigned int base_cost = vp9_cost_bit(intra_inter_p, 1);
@ -4559,18 +4517,15 @@ static void estimate_ref_frame_costs(const VP9_COMMON *cm,
ref_costs_single[LAST_FRAME] =
#if CONFIG_MULTI_REF
ref_costs_single[LAST2_FRAME] =
#if CONFIG_LAST3_REF
ref_costs_single[LAST3_FRAME] =
#if CONFIG_LAST4_REF
ref_costs_single[LAST4_FRAME] =
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
ref_costs_single[GOLDEN_FRAME] =
ref_costs_single[ALTREF_FRAME] = base_cost;
#if CONFIG_MULTI_REF
#if CONFIG_LAST3_REF
#if CONFIG_LAST4_REF
ref_costs_single[LAST_FRAME] += vp9_cost_bit(ref_single_p1, 0);
ref_costs_single[LAST2_FRAME] += vp9_cost_bit(ref_single_p1, 0);
@ -4606,16 +4561,6 @@ static void estimate_ref_frame_costs(const VP9_COMMON *cm,
ref_costs_single[LAST_FRAME] += vp9_cost_bit(ref_single_p4, 0);
ref_costs_single[LAST2_FRAME] += vp9_cost_bit(ref_single_p4, 1);
#endif // CONFIG_LAST4_REF
#else // CONFIG_LAST3_REF
ref_costs_single[LAST_FRAME] += vp9_cost_bit(ref_single_p1, 0);
ref_costs_single[LAST2_FRAME] += vp9_cost_bit(ref_single_p1, 0);
ref_costs_single[GOLDEN_FRAME] += vp9_cost_bit(ref_single_p1, 1);
ref_costs_single[ALTREF_FRAME] += vp9_cost_bit(ref_single_p1, 1);
ref_costs_single[LAST_FRAME] += vp9_cost_bit(ref_single_p3, 0);
ref_costs_single[LAST2_FRAME] += vp9_cost_bit(ref_single_p3, 1);
ref_costs_single[GOLDEN_FRAME] += vp9_cost_bit(ref_single_p2, 0);
ref_costs_single[ALTREF_FRAME] += vp9_cost_bit(ref_single_p2, 1);
#endif // CONFIG_LAST3_REF
#else // CONFIG_MULTI_REF
ref_costs_single[LAST_FRAME] += vp9_cost_bit(ref_single_p1, 0);
ref_costs_single[GOLDEN_FRAME] += vp9_cost_bit(ref_single_p1, 1);
@ -4627,12 +4572,10 @@ static void estimate_ref_frame_costs(const VP9_COMMON *cm,
ref_costs_single[LAST_FRAME] = 512;
#if CONFIG_MULTI_REF
ref_costs_single[LAST2_FRAME] = 512;
#if CONFIG_LAST3_REF
ref_costs_single[LAST3_FRAME] = 512;
#if CONFIG_LAST4_REF
ref_costs_single[LAST4_FRAME] = 512;
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
ref_costs_single[GOLDEN_FRAME] = 512;
ref_costs_single[ALTREF_FRAME] = 512;
@ -4642,12 +4585,10 @@ static void estimate_ref_frame_costs(const VP9_COMMON *cm,
vp9_prob ref_comp_p = vp9_get_pred_prob_comp_ref_p(cm, xd);
#if CONFIG_MULTI_REF
vp9_prob ref_comp_p1 = vp9_get_pred_prob_comp_ref_p1(cm, xd);
#if CONFIG_LAST3_REF
vp9_prob ref_comp_p2 = vp9_get_pred_prob_comp_ref_p2(cm, xd);
#if CONFIG_LAST4_REF
vp9_prob ref_comp_p3 = vp9_get_pred_prob_comp_ref_p3(cm, xd);
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
unsigned int base_cost = vp9_cost_bit(intra_inter_p, 1);
@ -4657,18 +4598,15 @@ static void estimate_ref_frame_costs(const VP9_COMMON *cm,
ref_costs_comp[LAST_FRAME] =
#if CONFIG_MULTI_REF
ref_costs_comp[LAST2_FRAME] =
#if CONFIG_LAST3_REF
ref_costs_comp[LAST3_FRAME] =
#if CONFIG_LAST4_REF
ref_costs_comp[LAST4_FRAME] =
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
ref_costs_comp[GOLDEN_FRAME] =
ref_costs_comp[ALTREF_FRAME] = base_cost;
#if CONFIG_MULTI_REF
#if CONFIG_LAST3_REF
#if CONFIG_LAST4_REF
ref_costs_comp[LAST_FRAME] += vp9_cost_bit(ref_comp_p, 0);
ref_costs_comp[LAST2_FRAME] += vp9_cost_bit(ref_comp_p, 0);
@ -4695,14 +4633,6 @@ static void estimate_ref_frame_costs(const VP9_COMMON *cm,
ref_costs_comp[LAST3_FRAME] += vp9_cost_bit(ref_comp_p2, 0);
ref_costs_comp[GOLDEN_FRAME] += vp9_cost_bit(ref_comp_p2, 1);
#endif // CONFIG_LAST4_REF
#else // CONFIG_LAST3_REF
ref_costs_comp[LAST_FRAME] += vp9_cost_bit(ref_comp_p, 0);
ref_costs_comp[LAST2_FRAME] += vp9_cost_bit(ref_comp_p, 0);
ref_costs_comp[GOLDEN_FRAME] += vp9_cost_bit(ref_comp_p, 1);
ref_costs_comp[LAST_FRAME] += vp9_cost_bit(ref_comp_p1, 1);
ref_costs_comp[LAST2_FRAME] += vp9_cost_bit(ref_comp_p1, 0);
#endif // CONFIG_LAST3_REF
#else // CONFIG_MULTI_REF
ref_costs_comp[LAST_FRAME] += vp9_cost_bit(ref_comp_p, 0);
ref_costs_comp[GOLDEN_FRAME] += vp9_cost_bit(ref_comp_p, 1);
@ -4711,12 +4641,10 @@ static void estimate_ref_frame_costs(const VP9_COMMON *cm,
ref_costs_comp[LAST_FRAME] = 512;
#if CONFIG_MULTI_REF
ref_costs_comp[LAST2_FRAME] = 512;
#if CONFIG_LAST3_REF
ref_costs_comp[LAST3_FRAME] = 512;
#if CONFIG_LAST4_REF
ref_costs_comp[LAST4_FRAME] = 512;
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
ref_costs_comp[GOLDEN_FRAME] = 512;
}
@ -6798,12 +6726,10 @@ void vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
VP9_LAST_FLAG,
#if CONFIG_MULTI_REF
VP9_LAST2_FLAG,
#if CONFIG_LAST3_REF
VP9_LAST3_FLAG,
#if CONFIG_LAST4_REF
VP9_LAST4_FLAG,
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
VP9_GOLD_FLAG,
VP9_ALT_FLAG
@ -6985,12 +6911,10 @@ void vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
ref_frame_skip_mask[0] = (1 << LAST_FRAME) |
#if CONFIG_MULTI_REF
(1 << LAST2_FRAME) |
#if CONFIG_LAST3_REF
(1 << LAST3_FRAME) |
#if CONFIG_LAST4_REF
(1 << LAST4_FRAME) |
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
(1 << GOLDEN_FRAME);
ref_frame_skip_mask[1] = SECOND_REF_FRAME_MASK;
@ -7145,7 +7069,6 @@ void vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
ref_frame_skip_mask[0] |= LAST2_FRAME_MODE_MASK;
ref_frame_skip_mask[1] |= SECOND_REF_FRAME_MASK;
break;
#if CONFIG_LAST3_REF
case LAST3_FRAME:
ref_frame_skip_mask[0] |= LAST3_FRAME_MODE_MASK;
ref_frame_skip_mask[1] |= SECOND_REF_FRAME_MASK;
@ -7156,7 +7079,6 @@ void vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
ref_frame_skip_mask[1] |= SECOND_REF_FRAME_MASK;
break;
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
case GOLDEN_FRAME:
ref_frame_skip_mask[0] |= GOLDEN_FRAME_MODE_MASK;
@ -7183,7 +7105,6 @@ void vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
if (cm->last_frame_type == KEY_FRAME && ref_frame == LAST2_FRAME)
continue;
#if CONFIG_LAST3_REF
if ((cm->last2_frame_type == KEY_FRAME ||
cm->last_frame_type == KEY_FRAME) && ref_frame == LAST3_FRAME)
continue;
@ -7194,7 +7115,6 @@ void vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
cm->last_frame_type == KEY_FRAME) && ref_frame == LAST4_FRAME)
continue;
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
// Test best rd so far against threshold for trying this mode.
@ -8557,12 +8477,10 @@ void vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x,
VP9_LAST_FLAG,
#if CONFIG_MULTI_REF
VP9_LAST2_FLAG,
#if CONFIG_LAST3_REF
VP9_LAST3_FLAG,
#if CONFIG_LAST4_REF
VP9_LAST4_FLAG,
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
VP9_GOLD_FLAG,
VP9_ALT_FLAG
@ -8697,7 +8615,6 @@ void vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x,
if (cm->last_frame_type == KEY_FRAME && ref_frame == LAST2_FRAME)
continue;
#if CONFIG_LAST3_REF
if ((cm->last2_frame_type == KEY_FRAME ||
cm->last_frame_type == KEY_FRAME) && ref_frame == LAST3_FRAME)
continue;
@ -8708,7 +8625,6 @@ void vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x,
cm->last_frame_type == KEY_FRAME) && ref_frame == LAST4_FRAME)
continue;
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
// Look at the reference frame of the best mode so far and set the
@ -8722,12 +8638,10 @@ void vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x,
ref_frame_skip_mask[0] |= (1 << GOLDEN_FRAME) |
#if CONFIG_MULTI_REF
(1 << LAST2_FRAME) |
#if CONFIG_LAST3_REF
(1 << LAST3_FRAME) |
#if CONFIG_LAST4_REF
(1 << LAST4_FRAME) |
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
(1 << ALTREF_FRAME);
ref_frame_skip_mask[1] |= SECOND_REF_FRAME_MASK;
@ -8736,18 +8650,15 @@ void vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x,
#if CONFIG_MULTI_REF
case LAST2_FRAME:
ref_frame_skip_mask[0] |= (1 << LAST_FRAME) |
#if CONFIG_LAST3_REF
(1 << LAST3_FRAME) |
#if CONFIG_LAST4_REF
(1 << LAST4_FRAME) |
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
(1 << GOLDEN_FRAME) |
(1 << ALTREF_FRAME);
ref_frame_skip_mask[1] |= SECOND_REF_FRAME_MASK;
break;
#if CONFIG_LAST3_REF
case LAST3_FRAME:
ref_frame_skip_mask[0] |= (1 << LAST_FRAME) |
(1 << LAST2_FRAME) |
@ -8769,19 +8680,16 @@ void vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x,
ref_frame_skip_mask[1] |= SECOND_REF_FRAME_MASK;
break;
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
case GOLDEN_FRAME:
ref_frame_skip_mask[0] |= (1 << LAST_FRAME) |
#if CONFIG_MULTI_REF
(1 << LAST2_FRAME) |
#if CONFIG_LAST3_REF
(1 << LAST3_FRAME) |
#if CONFIG_LAST4_REF
(1 << LAST4_FRAME) |
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
(1 << ALTREF_FRAME);
ref_frame_skip_mask[1] |= SECOND_REF_FRAME_MASK;
@ -8791,12 +8699,10 @@ void vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x,
ref_frame_skip_mask[0] |= (1 << LAST_FRAME) |
#if CONFIG_MULTI_REF
(1 << LAST2_FRAME) |
#if CONFIG_LAST3_REF
(1 << LAST3_FRAME) |
#if CONFIG_LAST4_REF
(1 << LAST4_FRAME) |
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
(1 << GOLDEN_FRAME);
break;
@ -8936,14 +8842,12 @@ void vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x,
#if CONFIG_MULTI_REF
this_rd_thresh = (ref_frame == LAST2_FRAME) ?
rd_opt->threshes[segment_id][bsize][THR_LAST2] : this_rd_thresh;
#if CONFIG_LAST3_REF
this_rd_thresh = (ref_frame == LAST3_FRAME) ?
rd_opt->threshes[segment_id][bsize][THR_LAST3] : this_rd_thresh;
#if CONFIG_LAST4_REF
this_rd_thresh = (ref_frame == LAST4_FRAME) ?
rd_opt->threshes[segment_id][bsize][THR_LAST4] : this_rd_thresh;
#endif // CONFIG_LAST4_REF
#endif // CONFIG_LAST3_REF
#endif // CONFIG_MULTI_REF
this_rd_thresh = (ref_frame == GOLDEN_FRAME) ?
rd_opt->threshes[segment_id][bsize][THR_GOLD] : this_rd_thresh;