VP9: inline vp9_get_intra_inter_context()
Change-Id: I71366140799b9b39474b9b459082cdb250bd1905
This commit is contained in:
parent
9c2ed00c8c
commit
ef98a8f61f
@ -36,31 +36,6 @@ int vp9_get_pred_context_switchable_interp(const MACROBLOCKD *xd) {
|
|||||||
return SWITCHABLE_FILTERS;
|
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,
|
int vp9_get_reference_mode_context(const VP9_COMMON *cm,
|
||||||
const MACROBLOCKD *xd) {
|
const MACROBLOCKD *xd) {
|
||||||
int ctx;
|
int ctx;
|
||||||
|
@ -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_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,
|
static INLINE vpx_prob vp9_get_intra_inter_prob(const VP9_COMMON *cm,
|
||||||
const MACROBLOCKD *xd) {
|
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);
|
int vp9_get_reference_mode_context(const VP9_COMMON *cm, const MACROBLOCKD *xd);
|
||||||
|
@ -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)) {
|
if (segfeature_active(&cm->seg, segment_id, SEG_LVL_REF_FRAME)) {
|
||||||
return get_segdata(&cm->seg, segment_id, SEG_LVL_REF_FRAME) != INTRA_FRAME;
|
return get_segdata(&cm->seg, segment_id, SEG_LVL_REF_FRAME) != INTRA_FRAME;
|
||||||
} else {
|
} 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]);
|
const int is_inter = vpx_read(r, cm->fc->intra_inter_prob[ctx]);
|
||||||
FRAME_COUNTS *counts = xd->counts;
|
FRAME_COUNTS *counts = xd->counts;
|
||||||
if (counts)
|
if (counts)
|
||||||
|
@ -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,
|
const int seg_ref_active = segfeature_active(&cm->seg, mi->segment_id,
|
||||||
SEG_LVL_REF_FRAME);
|
SEG_LVL_REF_FRAME);
|
||||||
if (!seg_ref_active) {
|
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
|
// If the segment reference feature is enabled we have only a single
|
||||||
// reference frame allowed for the segment so exclude it from
|
// reference frame allowed for the segment so exclude it from
|
||||||
// the reference frame counts used to work out probabilities.
|
// the reference frame counts used to work out probabilities.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user