Commit 8105ce6d authored by Dmitry Kovalev's avatar Dmitry Kovalev Committed by Gerrit Code Review
Browse files

Merge "Using is_inter_block() instead of repetitive code."

Showing with 17 additions and 18 deletions
...@@ -130,6 +130,9 @@ unsigned char vp9_get_pred_context_comp_ref_p(const VP9_COMMON *cm, ...@@ -130,6 +130,9 @@ unsigned char vp9_get_pred_context_comp_ref_p(const VP9_COMMON *cm,
const MB_MODE_INFO *const left_mbmi = &mi[-1].mbmi; const MB_MODE_INFO *const left_mbmi = &mi[-1].mbmi;
const int left_in_image = xd->left_available && left_mbmi->mb_in_image; const int left_in_image = xd->left_available && left_mbmi->mb_in_image;
const int above_in_image = xd->up_available && above_mbmi->mb_in_image; const int above_in_image = xd->up_available && above_mbmi->mb_in_image;
const int left_intra = !is_inter_block(left_mbmi);
const int above_intra = !is_inter_block(above_mbmi);
// Note: // Note:
// The mode info data structure has a one element border above and to the // The mode info data structure has a one element border above and to the
// left of the entries correpsonding to real macroblocks. // left of the entries correpsonding to real macroblocks.
...@@ -138,13 +141,10 @@ unsigned char vp9_get_pred_context_comp_ref_p(const VP9_COMMON *cm, ...@@ -138,13 +141,10 @@ unsigned char vp9_get_pred_context_comp_ref_p(const VP9_COMMON *cm,
const int var_ref_idx = !fix_ref_idx; const int var_ref_idx = !fix_ref_idx;
if (above_in_image && left_in_image) { // both edges available if (above_in_image && left_in_image) { // both edges available
if (above_mbmi->ref_frame[0] == INTRA_FRAME && if (above_intra && left_intra) { // intra/intra (2)
left_mbmi->ref_frame[0] == INTRA_FRAME) { // intra/intra (2)
pred_context = 2; pred_context = 2;
} else if (above_mbmi->ref_frame[0] == INTRA_FRAME || } else if (above_intra || left_intra) { // intra/inter
left_mbmi->ref_frame[0] == INTRA_FRAME) { // intra/inter const MB_MODE_INFO *edge_mbmi = above_intra ? left_mbmi : above_mbmi;
const MB_MODE_INFO *edge_mbmi = above_mbmi->ref_frame[0] == INTRA_FRAME ?
left_mbmi : above_mbmi;
if (edge_mbmi->ref_frame[1] <= INTRA_FRAME) // single pred (1/3) if (edge_mbmi->ref_frame[1] <= INTRA_FRAME) // single pred (1/3)
pred_context = 1 + 2 * (edge_mbmi->ref_frame[0] != cm->comp_var_ref[1]); pred_context = 1 + 2 * (edge_mbmi->ref_frame[0] != cm->comp_var_ref[1]);
...@@ -208,18 +208,18 @@ unsigned char vp9_get_pred_context_single_ref_p1(const MACROBLOCKD *xd) { ...@@ -208,18 +208,18 @@ unsigned char vp9_get_pred_context_single_ref_p1(const MACROBLOCKD *xd) {
const MB_MODE_INFO *const left_mbmi = &mi[-1].mbmi; const MB_MODE_INFO *const left_mbmi = &mi[-1].mbmi;
const int left_in_image = xd->left_available && left_mbmi->mb_in_image; const int left_in_image = xd->left_available && left_mbmi->mb_in_image;
const int above_in_image = xd->up_available && above_mbmi->mb_in_image; const int above_in_image = xd->up_available && above_mbmi->mb_in_image;
const int left_intra = !is_inter_block(left_mbmi);
const int above_intra = !is_inter_block(above_mbmi);
// Note: // Note:
// The mode info data structure has a one element border above and to the // The mode info data structure has a one element border above and to the
// left of the entries correpsonding to real macroblocks. // left of the entries correpsonding to real macroblocks.
// The prediction flags in these dummy entries are initialised to 0. // The prediction flags in these dummy entries are initialised to 0.
if (above_in_image && left_in_image) { // both edges available if (above_in_image && left_in_image) { // both edges available
if (above_mbmi->ref_frame[0] == INTRA_FRAME && if (above_intra && left_intra) {
left_mbmi->ref_frame[0] == INTRA_FRAME) {
pred_context = 2; pred_context = 2;
} else if (above_mbmi->ref_frame[0] == INTRA_FRAME || } else if (above_intra || left_intra) {
left_mbmi->ref_frame[0] == INTRA_FRAME) { const MB_MODE_INFO *edge_mbmi = above_intra ? left_mbmi : above_mbmi;
const MB_MODE_INFO *edge_mbmi = above_mbmi->ref_frame[0] == INTRA_FRAME ?
left_mbmi : above_mbmi;
if (edge_mbmi->ref_frame[1] <= INTRA_FRAME) if (edge_mbmi->ref_frame[1] <= INTRA_FRAME)
pred_context = 4 * (edge_mbmi->ref_frame[0] == LAST_FRAME); pred_context = 4 * (edge_mbmi->ref_frame[0] == LAST_FRAME);
...@@ -273,19 +273,18 @@ unsigned char vp9_get_pred_context_single_ref_p2(const MACROBLOCKD *xd) { ...@@ -273,19 +273,18 @@ unsigned char vp9_get_pred_context_single_ref_p2(const MACROBLOCKD *xd) {
const MB_MODE_INFO *const left_mbmi = &mi[-1].mbmi; const MB_MODE_INFO *const left_mbmi = &mi[-1].mbmi;
const int left_in_image = xd->left_available && left_mbmi->mb_in_image; const int left_in_image = xd->left_available && left_mbmi->mb_in_image;
const int above_in_image = xd->up_available && above_mbmi->mb_in_image; const int above_in_image = xd->up_available && above_mbmi->mb_in_image;
const int left_intra = !is_inter_block(left_mbmi);
const int above_intra = !is_inter_block(above_mbmi);
// Note: // Note:
// The mode info data structure has a one element border above and to the // The mode info data structure has a one element border above and to the
// left of the entries correpsonding to real macroblocks. // left of the entries correpsonding to real macroblocks.
// The prediction flags in these dummy entries are initialised to 0. // The prediction flags in these dummy entries are initialised to 0.
if (above_in_image && left_in_image) { // both edges available if (above_in_image && left_in_image) { // both edges available
if (above_mbmi->ref_frame[0] == INTRA_FRAME && if (above_intra && left_intra) {
left_mbmi->ref_frame[0] == INTRA_FRAME) {
pred_context = 2; pred_context = 2;
} else if (above_mbmi->ref_frame[0] == INTRA_FRAME || } else if (above_intra || left_intra) {
left_mbmi->ref_frame[0] == INTRA_FRAME) { const MB_MODE_INFO *edge_mbmi = above_intra ? left_mbmi : above_mbmi;
const MB_MODE_INFO *edge_mbmi = above_mbmi->ref_frame[0] == INTRA_FRAME ?
left_mbmi : above_mbmi;
if (edge_mbmi->ref_frame[1] <= INTRA_FRAME) { if (edge_mbmi->ref_frame[1] <= INTRA_FRAME) {
if (edge_mbmi->ref_frame[0] == LAST_FRAME) if (edge_mbmi->ref_frame[0] == LAST_FRAME)
......
Supports Markdown
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