summaryrefslogtreecommitdiff
path: root/vp9/common
diff options
context:
space:
mode:
authorDmitry Kovalev <dkovalev@google.com>2013-12-11 14:30:44 -0800
committerGerrit Code Review <gerrit@gerrit.golo.chromium.org>2013-12-11 14:30:44 -0800
commite79103166f038d734c48369e44d41e163fba7552 (patch)
treeb20d718f99ba47f42966bda46267b7b00d87c117 /vp9/common
parent3897de6098ec0bb09ba551b5d1532a7e7cab1dc4 (diff)
parent3274fc30ee047b1fdc01bc083c434c851e20e09c (diff)
downloadlibvpx-e79103166f038d734c48369e44d41e163fba7552.tar
libvpx-e79103166f038d734c48369e44d41e163fba7552.tar.gz
libvpx-e79103166f038d734c48369e44d41e163fba7552.tar.bz2
libvpx-e79103166f038d734c48369e44d41e163fba7552.zip
Merge "Renames for consistency in vp9_pred_common.{c, h} files."
Diffstat (limited to 'vp9/common')
-rw-r--r--vp9/common/vp9_pred_common.c73
-rw-r--r--vp9/common/vp9_pred_common.h14
2 files changed, 41 insertions, 46 deletions
diff --git a/vp9/common/vp9_pred_common.c b/vp9/common/vp9_pred_common.c
index b16417d78..40cfc8146 100644
--- a/vp9/common/vp9_pred_common.c
+++ b/vp9/common/vp9_pred_common.c
@@ -52,10 +52,10 @@ int vp9_get_pred_context_switchable_interp(const MACROBLOCKD *xd) {
int vp9_get_intra_inter_context(const MACROBLOCKD *xd) {
const MB_MODE_INFO *const above_mbmi = get_above_mbmi(get_above_mi(xd));
const MB_MODE_INFO *const left_mbmi = get_left_mbmi(get_left_mi(xd));
- const int above_in_image = above_mbmi != NULL;
- const int left_in_image = left_mbmi != NULL;
- const int above_intra = above_in_image ? !is_inter_block(above_mbmi) : 1;
- const int left_intra = left_in_image ? !is_inter_block(left_mbmi) : 1;
+ const int has_above = above_mbmi != NULL;
+ const int has_left = left_mbmi != NULL;
+ const int above_intra = has_above ? !is_inter_block(above_mbmi) : 1;
+ const int left_intra = has_left ? !is_inter_block(left_mbmi) : 1;
// The mode info data structure has a one element border above and to the
// left of the entries corresponding to real macroblocks.
@@ -64,11 +64,11 @@ int vp9_get_intra_inter_context(const MACROBLOCKD *xd) {
// 1 - intra/inter, inter/intra
// 2 - intra/--, --/intra
// 3 - intra/intra
- if (above_in_image && left_in_image) // both edges available
+ if (has_above && has_left) // both edges available
return left_intra && above_intra ? 3
: left_intra || above_intra;
- else if (above_in_image || left_in_image) // one edge available
- return 2 * (above_in_image ? above_intra : left_intra);
+ else if (has_above || has_left) // one edge available
+ return 2 * (has_above ? above_intra : left_intra);
else
return 0;
}
@@ -78,13 +78,13 @@ int vp9_get_reference_mode_context(const VP9_COMMON *cm,
int ctx;
const MB_MODE_INFO *const above_mbmi = get_above_mbmi(get_above_mi(xd));
const MB_MODE_INFO *const left_mbmi = get_left_mbmi(get_left_mi(xd));
- const int above_in_image = above_mbmi != NULL;
- const int left_in_image = left_mbmi != NULL;
+ 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 (above_in_image && left_in_image) { // both edges available
+ if (has_above && has_left) { // both edges available
if (!has_second_ref(above_mbmi) && !has_second_ref(left_mbmi))
// neither edge uses comp pred (0/1)
ctx = (above_mbmi->ref_frame[0] == cm->comp_fixed_ref) ^
@@ -99,8 +99,8 @@ int vp9_get_reference_mode_context(const VP9_COMMON *cm,
!is_inter_block(left_mbmi));
else // both edges use comp pred (4)
ctx = 4;
- } else if (above_in_image || left_in_image) { // one edge available
- const MB_MODE_INFO *edge_mbmi = above_in_image ? above_mbmi : left_mbmi;
+ } else if (has_above || has_left) { // one edge available
+ const MB_MODE_INFO *edge_mbmi = has_above ? above_mbmi : left_mbmi;
if (!has_second_ref(edge_mbmi))
// edge does not use comp pred (0/1)
@@ -116,8 +116,8 @@ int vp9_get_reference_mode_context(const VP9_COMMON *cm,
}
// Returns a context number for the given MB prediction signal
-unsigned char vp9_get_pred_context_comp_ref_p(const VP9_COMMON *cm,
- const MACROBLOCKD *xd) {
+int vp9_get_pred_context_comp_ref_p(const VP9_COMMON *cm,
+ const MACROBLOCKD *xd) {
int pred_context;
const MODE_INFO *const above_mi = get_above_mi(xd);
const MODE_INFO *const left_mi = get_left_mi(xd);
@@ -197,21 +197,20 @@ unsigned char vp9_get_pred_context_comp_ref_p(const VP9_COMMON *cm,
return pred_context;
}
-unsigned char vp9_get_pred_context_single_ref_p1(const MACROBLOCKD *xd) {
+
+int vp9_get_pred_context_single_ref_p1(const MACROBLOCKD *xd) {
int pred_context;
- const MODE_INFO *const above_mi = get_above_mi(xd);
- const MODE_INFO *const left_mi = get_left_mi(xd);
- const MB_MODE_INFO *const above_mbmi = get_above_mbmi(above_mi);
- const MB_MODE_INFO *const left_mbmi = get_left_mbmi(left_mi);
- const int above_in_image = above_mi != NULL;
- const int left_in_image = left_mi != NULL;
- const int above_intra = above_in_image ? !is_inter_block(above_mbmi) : 1;
- const int left_intra = left_in_image ? !is_inter_block(left_mbmi) : 1;
+ const MB_MODE_INFO *const above_mbmi = get_above_mbmi(get_above_mi(xd));
+ const MB_MODE_INFO *const left_mbmi = get_left_mbmi(get_left_mi(xd));
+ const int has_above = above_mbmi != NULL;
+ const int has_left = left_mbmi != NULL;
+ const int above_intra = has_above ? !is_inter_block(above_mbmi) : 1;
+ const int left_intra = has_left ? !is_inter_block(left_mbmi) : 1;
// 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 (above_in_image && left_in_image) { // both edges available
+ if (has_above && has_left) { // both edges available
if (above_intra && left_intra) { // intra/intra
pred_context = 2;
} else if (above_intra || left_intra) { // intra/inter or inter/intra
@@ -244,8 +243,8 @@ unsigned char vp9_get_pred_context_single_ref_p1(const MACROBLOCKD *xd) {
pred_context = crf1 == LAST_FRAME || crf2 == LAST_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;
+ } 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
@@ -263,22 +262,20 @@ unsigned char vp9_get_pred_context_single_ref_p1(const MACROBLOCKD *xd) {
return pred_context;
}
-unsigned char vp9_get_pred_context_single_ref_p2(const MACROBLOCKD *xd) {
+int vp9_get_pred_context_single_ref_p2(const MACROBLOCKD *xd) {
int pred_context;
- const MODE_INFO *const above_mi = get_above_mi(xd);
- const MODE_INFO *const left_mi = get_left_mi(xd);
- const MB_MODE_INFO *const above_mbmi = get_above_mbmi(above_mi);
- const MB_MODE_INFO *const left_mbmi = get_left_mbmi(left_mi);
- const int above_in_image = above_mi != NULL;
- const int left_in_image = left_mi != NULL;
- const int above_intra = above_in_image ? !is_inter_block(above_mbmi) : 1;
- const int left_intra = left_in_image ? !is_inter_block(left_mbmi) : 1;
+ const MB_MODE_INFO *const above_mbmi = get_above_mbmi(get_above_mi(xd));
+ const MB_MODE_INFO *const left_mbmi = get_left_mbmi(get_left_mi(xd));
+ const int has_above = above_mbmi != NULL;
+ const int has_left = left_mbmi != NULL;
+ const int above_intra = has_above ? !is_inter_block(above_mbmi) : 1;
+ const int left_intra = has_left ? !is_inter_block(left_mbmi) : 1;
// 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 (above_in_image && left_in_image) { // both edges available
+ if (has_above && has_left) { // both edges available
if (above_intra && left_intra) { // intra/intra
pred_context = 2;
} else if (above_intra || left_intra) { // intra/inter or inter/intra
@@ -332,8 +329,8 @@ unsigned char vp9_get_pred_context_single_ref_p2(const MACROBLOCKD *xd) {
pred_context = 1 + 2 * (crf1 == GOLDEN_FRAME || crf2 == 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;
+ } 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) ||
(edge_mbmi->ref_frame[0] == LAST_FRAME && !has_second_ref(edge_mbmi)))
diff --git a/vp9/common/vp9_pred_common.h b/vp9/common/vp9_pred_common.h
index 9a8f85c09..66cd15143 100644
--- a/vp9/common/vp9_pred_common.h
+++ b/vp9/common/vp9_pred_common.h
@@ -69,8 +69,8 @@ static INLINE vp9_prob vp9_get_reference_mode_prob(const VP9_COMMON *cm,
return cm->fc.comp_inter_prob[vp9_get_reference_mode_context(cm, xd)];
}
-unsigned char vp9_get_pred_context_comp_ref_p(const VP9_COMMON *cm,
- const MACROBLOCKD *xd);
+int vp9_get_pred_context_comp_ref_p(const VP9_COMMON *cm,
+ const MACROBLOCKD *xd);
static INLINE vp9_prob vp9_get_pred_prob_comp_ref_p(const VP9_COMMON *cm,
const MACROBLOCKD *xd) {
@@ -78,20 +78,18 @@ static INLINE vp9_prob vp9_get_pred_prob_comp_ref_p(const VP9_COMMON *cm,
return cm->fc.comp_ref_prob[pred_context];
}
-unsigned char vp9_get_pred_context_single_ref_p1(const MACROBLOCKD *xd);
+int vp9_get_pred_context_single_ref_p1(const MACROBLOCKD *xd);
static INLINE vp9_prob vp9_get_pred_prob_single_ref_p1(const VP9_COMMON *cm,
const MACROBLOCKD *xd) {
- const int pred_context = vp9_get_pred_context_single_ref_p1(xd);
- return cm->fc.single_ref_prob[pred_context][0];
+ return cm->fc.single_ref_prob[vp9_get_pred_context_single_ref_p1(xd)][0];
}
-unsigned char vp9_get_pred_context_single_ref_p2(const MACROBLOCKD *xd);
+int vp9_get_pred_context_single_ref_p2(const MACROBLOCKD *xd);
static INLINE vp9_prob vp9_get_pred_prob_single_ref_p2(const VP9_COMMON *cm,
const MACROBLOCKD *xd) {
- const int pred_context = vp9_get_pred_context_single_ref_p2(xd);
- return cm->fc.single_ref_prob[pred_context][1];
+ return cm->fc.single_ref_prob[vp9_get_pred_context_single_ref_p2(xd)][1];
}
int vp9_get_tx_size_context(const MACROBLOCKD *xd);