summaryrefslogtreecommitdiff
path: root/vp9
diff options
context:
space:
mode:
authorScott LaVarnway <slavarnway@google.com>2016-04-15 19:06:33 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2016-04-15 19:06:33 +0000
commit9faa0296b820173c97884483d9890761291a1b0a (patch)
tree6e54bec84c0a99192ada30e4e6c962cb7c359f9d /vp9
parentc59c5cbefff9d833158cc25d9f2ae33f27977cc7 (diff)
parentef98a8f61f81a488e59855eeca83711228047d12 (diff)
downloadlibvpx-9faa0296b820173c97884483d9890761291a1b0a.tar
libvpx-9faa0296b820173c97884483d9890761291a1b0a.tar.gz
libvpx-9faa0296b820173c97884483d9890761291a1b0a.tar.bz2
libvpx-9faa0296b820173c97884483d9890761291a1b0a.zip
Merge "VP9: inline vp9_get_intra_inter_context()"
Diffstat (limited to 'vp9')
-rw-r--r--vp9/common/vp9_pred_common.c25
-rw-r--r--vp9/common/vp9_pred_common.h25
-rw-r--r--vp9/decoder/vp9_decodemv.c2
-rw-r--r--vp9/encoder/vp9_encodeframe.c2
4 files changed, 25 insertions, 29 deletions
diff --git a/vp9/common/vp9_pred_common.c b/vp9/common/vp9_pred_common.c
index 92dc85ad4..b5751fc62 100644
--- a/vp9/common/vp9_pred_common.c
+++ b/vp9/common/vp9_pred_common.c
@@ -36,31 +36,6 @@ int vp9_get_pred_context_switchable_interp(const MACROBLOCKD *xd) {
return SWITCHABLE_FILTERS;
}
-// The mode info data structure has a one element border above and to the
-// left of the entries corresponding to real macroblocks.
-// The prediction flags in these dummy entries are initialized to 0.
-// 0 - inter/inter, inter/--, --/inter, --/--
-// 1 - intra/inter, inter/intra
-// 2 - intra/--, --/intra
-// 3 - intra/intra
-int vp9_get_intra_inter_context(const MACROBLOCKD *xd) {
- const MODE_INFO *const above_mi = xd->above_mi;
- const MODE_INFO *const left_mi = xd->left_mi;
- const int has_above = !!above_mi;
- const int has_left = !!left_mi;
-
- if (has_above && has_left) { // both edges available
- const int above_intra = !is_inter_block(above_mi);
- const int left_intra = !is_inter_block(left_mi);
- return left_intra && above_intra ? 3
- : left_intra || above_intra;
- } else if (has_above || has_left) { // one edge available
- return 2 * !is_inter_block(has_above ? above_mi : left_mi);
- } else {
- return 0;
- }
-}
-
int vp9_get_reference_mode_context(const VP9_COMMON *cm,
const MACROBLOCKD *xd) {
int ctx;
diff --git a/vp9/common/vp9_pred_common.h b/vp9/common/vp9_pred_common.h
index 494286226..f3c676e95 100644
--- a/vp9/common/vp9_pred_common.h
+++ b/vp9/common/vp9_pred_common.h
@@ -68,11 +68,32 @@ static INLINE vpx_prob vp9_get_skip_prob(const VP9_COMMON *cm,
int vp9_get_pred_context_switchable_interp(const MACROBLOCKD *xd);
-int vp9_get_intra_inter_context(const MACROBLOCKD *xd);
+// The mode info data structure has a one element border above and to the
+// left of the entries corresponding to real macroblocks.
+// The prediction flags in these dummy entries are initialized to 0.
+// 0 - inter/inter, inter/--, --/inter, --/--
+// 1 - intra/inter, inter/intra
+// 2 - intra/--, --/intra
+// 3 - intra/intra
+static INLINE int get_intra_inter_context(const MACROBLOCKD *xd) {
+ const MODE_INFO *const above_mi = xd->above_mi;
+ const MODE_INFO *const left_mi = xd->left_mi;
+ const int has_above = !!above_mi;
+ const int has_left = !!left_mi;
+
+ if (has_above && has_left) { // both edges available
+ const int above_intra = !is_inter_block(above_mi);
+ const int left_intra = !is_inter_block(left_mi);
+ return left_intra && above_intra ? 3 : left_intra || above_intra;
+ } else if (has_above || has_left) { // one edge available
+ return 2 * !is_inter_block(has_above ? above_mi : left_mi);
+ }
+ return 0;
+}
static INLINE vpx_prob vp9_get_intra_inter_prob(const VP9_COMMON *cm,
const MACROBLOCKD *xd) {
- return cm->fc->intra_inter_prob[vp9_get_intra_inter_context(xd)];
+ return cm->fc->intra_inter_prob[get_intra_inter_context(xd)];
}
int vp9_get_reference_mode_context(const VP9_COMMON *cm, const MACROBLOCKD *xd);
diff --git a/vp9/decoder/vp9_decodemv.c b/vp9/decoder/vp9_decodemv.c
index f304de3da..8831de9b1 100644
--- a/vp9/decoder/vp9_decodemv.c
+++ b/vp9/decoder/vp9_decodemv.c
@@ -483,7 +483,7 @@ static int read_is_inter_block(VP9_COMMON *const cm, MACROBLOCKD *const xd,
if (segfeature_active(&cm->seg, segment_id, SEG_LVL_REF_FRAME)) {
return get_segdata(&cm->seg, segment_id, SEG_LVL_REF_FRAME) != INTRA_FRAME;
} else {
- const int ctx = vp9_get_intra_inter_context(xd);
+ const int ctx = get_intra_inter_context(xd);
const int is_inter = vpx_read(r, cm->fc->intra_inter_prob[ctx]);
FRAME_COUNTS *counts = xd->counts;
if (counts)
diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c
index cdc58ea84..634e5cfe8 100644
--- a/vp9/encoder/vp9_encodeframe.c
+++ b/vp9/encoder/vp9_encodeframe.c
@@ -1404,7 +1404,7 @@ static void update_stats(VP9_COMMON *cm, ThreadData *td) {
const int seg_ref_active = segfeature_active(&cm->seg, mi->segment_id,
SEG_LVL_REF_FRAME);
if (!seg_ref_active) {
- counts->intra_inter[vp9_get_intra_inter_context(xd)][inter_block]++;
+ counts->intra_inter[get_intra_inter_context(xd)][inter_block]++;
// If the segment reference feature is enabled we have only a single
// reference frame allowed for the segment so exclude it from
// the reference frame counts used to work out probabilities.