Calculating has_second_ref only once for single_ref context.
Change-Id: Ib1253e0606426850f53060a4c5303af86bf1c093
This commit is contained in:
Родитель
c6a1ff223b
Коммит
118c8fb3fb
|
@ -217,26 +217,29 @@ int vp9_get_pred_context_single_ref_p1(const MACROBLOCKD *xd) {
|
||||||
pred_context = 1 + (edge_mbmi->ref_frame[0] == LAST_FRAME ||
|
pred_context = 1 + (edge_mbmi->ref_frame[0] == LAST_FRAME ||
|
||||||
edge_mbmi->ref_frame[1] == LAST_FRAME);
|
edge_mbmi->ref_frame[1] == LAST_FRAME);
|
||||||
} else { // inter/inter
|
} else { // inter/inter
|
||||||
if (!has_second_ref(above_mbmi) && !has_second_ref(left_mbmi)) {
|
const int above_has_second = has_second_ref(above_mbmi);
|
||||||
pred_context = 2 * (above_mbmi->ref_frame[0] == LAST_FRAME) +
|
const int left_has_second = has_second_ref(left_mbmi);
|
||||||
2 * (left_mbmi->ref_frame[0] == LAST_FRAME);
|
|
||||||
} else if (has_second_ref(above_mbmi) && has_second_ref(left_mbmi)) {
|
if (above_has_second && left_has_second) {
|
||||||
pred_context = 1 + (above_mbmi->ref_frame[0] == LAST_FRAME ||
|
pred_context = 1 + (above_mbmi->ref_frame[0] == LAST_FRAME ||
|
||||||
above_mbmi->ref_frame[1] == LAST_FRAME ||
|
above_mbmi->ref_frame[1] == LAST_FRAME ||
|
||||||
left_mbmi->ref_frame[0] == LAST_FRAME ||
|
left_mbmi->ref_frame[0] == LAST_FRAME ||
|
||||||
left_mbmi->ref_frame[1] == LAST_FRAME);
|
left_mbmi->ref_frame[1] == LAST_FRAME);
|
||||||
} else {
|
} else if (above_has_second || left_has_second) {
|
||||||
const MV_REFERENCE_FRAME rfs = !has_second_ref(above_mbmi) ?
|
const MV_REFERENCE_FRAME rfs = !above_has_second ?
|
||||||
above_mbmi->ref_frame[0] : left_mbmi->ref_frame[0];
|
above_mbmi->ref_frame[0] : left_mbmi->ref_frame[0];
|
||||||
const MV_REFERENCE_FRAME crf1 = has_second_ref(above_mbmi) ?
|
const MV_REFERENCE_FRAME crf1 = above_has_second ?
|
||||||
above_mbmi->ref_frame[0] : left_mbmi->ref_frame[0];
|
above_mbmi->ref_frame[0] : left_mbmi->ref_frame[0];
|
||||||
const MV_REFERENCE_FRAME crf2 = has_second_ref(above_mbmi) ?
|
const MV_REFERENCE_FRAME crf2 = above_has_second ?
|
||||||
above_mbmi->ref_frame[1] : left_mbmi->ref_frame[1];
|
above_mbmi->ref_frame[1] : left_mbmi->ref_frame[1];
|
||||||
|
|
||||||
if (rfs == LAST_FRAME)
|
if (rfs == LAST_FRAME)
|
||||||
pred_context = 3 + (crf1 == LAST_FRAME || crf2 == LAST_FRAME);
|
pred_context = 3 + (crf1 == LAST_FRAME || crf2 == LAST_FRAME);
|
||||||
else
|
else
|
||||||
pred_context = crf1 == LAST_FRAME || crf2 == LAST_FRAME;
|
pred_context = (crf1 == LAST_FRAME || crf2 == LAST_FRAME);
|
||||||
|
} else {
|
||||||
|
pred_context = 2 * (above_mbmi->ref_frame[0] == LAST_FRAME) +
|
||||||
|
2 * (left_mbmi->ref_frame[0] == LAST_FRAME);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (has_above || has_left) { // one edge available
|
} else if (has_above || has_left) { // one edge available
|
||||||
|
@ -287,21 +290,10 @@ int vp9_get_pred_context_single_ref_p2(const MACROBLOCKD *xd) {
|
||||||
edge_mbmi->ref_frame[1] == GOLDEN_FRAME);
|
edge_mbmi->ref_frame[1] == GOLDEN_FRAME);
|
||||||
}
|
}
|
||||||
} else { // inter/inter
|
} else { // inter/inter
|
||||||
if (!has_second_ref(above_mbmi) && !has_second_ref(left_mbmi)) {
|
const int above_has_second = has_second_ref(above_mbmi);
|
||||||
if (above_mbmi->ref_frame[0] == LAST_FRAME &&
|
const int left_has_second = has_second_ref(left_mbmi);
|
||||||
left_mbmi->ref_frame[0] == LAST_FRAME) {
|
|
||||||
pred_context = 3;
|
|
||||||
} else if (above_mbmi->ref_frame[0] == LAST_FRAME ||
|
|
||||||
left_mbmi->ref_frame[0] == LAST_FRAME) {
|
|
||||||
const MB_MODE_INFO *edge_mbmi =
|
|
||||||
above_mbmi->ref_frame[0] == LAST_FRAME ? left_mbmi : above_mbmi;
|
|
||||||
|
|
||||||
pred_context = 4 * (edge_mbmi->ref_frame[0] == GOLDEN_FRAME);
|
if (above_has_second && left_has_second) {
|
||||||
} else {
|
|
||||||
pred_context = 2 * (above_mbmi->ref_frame[0] == GOLDEN_FRAME) +
|
|
||||||
2 * (left_mbmi->ref_frame[0] == GOLDEN_FRAME);
|
|
||||||
}
|
|
||||||
} else if (has_second_ref(above_mbmi) && has_second_ref(left_mbmi)) {
|
|
||||||
if (above_mbmi->ref_frame[0] == left_mbmi->ref_frame[0] &&
|
if (above_mbmi->ref_frame[0] == left_mbmi->ref_frame[0] &&
|
||||||
above_mbmi->ref_frame[1] == left_mbmi->ref_frame[1])
|
above_mbmi->ref_frame[1] == left_mbmi->ref_frame[1])
|
||||||
pred_context = 3 * (above_mbmi->ref_frame[0] == GOLDEN_FRAME ||
|
pred_context = 3 * (above_mbmi->ref_frame[0] == GOLDEN_FRAME ||
|
||||||
|
@ -310,13 +302,13 @@ int vp9_get_pred_context_single_ref_p2(const MACROBLOCKD *xd) {
|
||||||
left_mbmi->ref_frame[1] == GOLDEN_FRAME);
|
left_mbmi->ref_frame[1] == GOLDEN_FRAME);
|
||||||
else
|
else
|
||||||
pred_context = 2;
|
pred_context = 2;
|
||||||
} else {
|
} else if (above_has_second || left_has_second) {
|
||||||
const MV_REFERENCE_FRAME rfs = !has_second_ref(above_mbmi) ?
|
const MV_REFERENCE_FRAME rfs = !above_has_second ?
|
||||||
above_mbmi->ref_frame[0] : left_mbmi->ref_frame[0];
|
above_mbmi->ref_frame[0] : left_mbmi->ref_frame[0];
|
||||||
const MV_REFERENCE_FRAME crf1 = has_second_ref(above_mbmi) ?
|
const MV_REFERENCE_FRAME crf1 = above_has_second ?
|
||||||
above_mbmi->ref_frame[0] : left_mbmi->ref_frame[0];
|
above_mbmi->ref_frame[0] : left_mbmi->ref_frame[0];
|
||||||
const MV_REFERENCE_FRAME crf2 = has_second_ref(above_mbmi) ?
|
const MV_REFERENCE_FRAME crf2 = above_has_second ?
|
||||||
above_mbmi->ref_frame[1] : left_mbmi->ref_frame[1];
|
above_mbmi->ref_frame[1] : left_mbmi->ref_frame[1];
|
||||||
|
|
||||||
if (rfs == GOLDEN_FRAME)
|
if (rfs == GOLDEN_FRAME)
|
||||||
pred_context = 3 + (crf1 == GOLDEN_FRAME || crf2 == GOLDEN_FRAME);
|
pred_context = 3 + (crf1 == GOLDEN_FRAME || crf2 == GOLDEN_FRAME);
|
||||||
|
@ -324,6 +316,19 @@ int vp9_get_pred_context_single_ref_p2(const MACROBLOCKD *xd) {
|
||||||
pred_context = crf1 == GOLDEN_FRAME || crf2 == GOLDEN_FRAME;
|
pred_context = crf1 == GOLDEN_FRAME || crf2 == GOLDEN_FRAME;
|
||||||
else
|
else
|
||||||
pred_context = 1 + 2 * (crf1 == GOLDEN_FRAME || crf2 == GOLDEN_FRAME);
|
pred_context = 1 + 2 * (crf1 == GOLDEN_FRAME || crf2 == GOLDEN_FRAME);
|
||||||
|
} else {
|
||||||
|
if (above_mbmi->ref_frame[0] == LAST_FRAME &&
|
||||||
|
left_mbmi->ref_frame[0] == LAST_FRAME) {
|
||||||
|
pred_context = 3;
|
||||||
|
} else if (above_mbmi->ref_frame[0] == LAST_FRAME ||
|
||||||
|
left_mbmi->ref_frame[0] == LAST_FRAME) {
|
||||||
|
const MB_MODE_INFO *edge_mbmi =
|
||||||
|
above_mbmi->ref_frame[0] == LAST_FRAME ? left_mbmi : above_mbmi;
|
||||||
|
pred_context = 4 * (edge_mbmi->ref_frame[0] == GOLDEN_FRAME);
|
||||||
|
} else {
|
||||||
|
pred_context = 2 * (above_mbmi->ref_frame[0] == GOLDEN_FRAME) +
|
||||||
|
2 * (left_mbmi->ref_frame[0] == GOLDEN_FRAME);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (has_above || has_left) { // one edge available
|
} else if (has_above || has_left) { // one edge available
|
||||||
|
|
Загрузка…
Ссылка в новой задаче