From 6fd71e1b09eaa664030a3a3634322f253e6c6d26 Mon Sep 17 00:00:00 2001 From: Dmitry Kovalev Date: Thu, 5 Dec 2013 17:01:03 -0800 Subject: [PATCH] vp9_get_pred_context_intra_inter() clean up. Renaming: vp9_get_pred_context_intra_inter => vp9_get_intra_inter_context vp9_get_pred_prob_intra_inter => vp9_get_intra_inter_prob Change-Id: I2c1affea2e84f4e616137c6df82adb11c7845781 --- vp9/common/vp9_pred_common.c | 12 +++++------- vp9/common/vp9_pred_common.h | 9 ++++----- vp9/decoder/vp9_decodemv.c | 4 ++-- vp9/encoder/vp9_bitstream.c | 3 +-- vp9/encoder/vp9_encodeframe.c | 2 +- vp9/encoder/vp9_rdopt.c | 2 +- 6 files changed, 14 insertions(+), 18 deletions(-) diff --git a/vp9/common/vp9_pred_common.c b/vp9/common/vp9_pred_common.c index a367f0b5d..793117daa 100644 --- a/vp9/common/vp9_pred_common.c +++ b/vp9/common/vp9_pred_common.c @@ -60,13 +60,11 @@ unsigned char vp9_get_pred_context_switchable_interp(const MACROBLOCKD *xd) { return SWITCHABLE_FILTERS; } // Returns a context number for the given MB prediction signal -unsigned char vp9_get_pred_context_intra_inter(const MACROBLOCKD *xd) { - 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; +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; diff --git a/vp9/common/vp9_pred_common.h b/vp9/common/vp9_pred_common.h index b6f18e323..bd0b8d662 100644 --- a/vp9/common/vp9_pred_common.h +++ b/vp9/common/vp9_pred_common.h @@ -61,12 +61,11 @@ static INLINE unsigned char vp9_get_pred_flag_mbskip(const MACROBLOCKD *xd) { unsigned char vp9_get_pred_context_switchable_interp(const MACROBLOCKD *xd); -unsigned char vp9_get_pred_context_intra_inter(const MACROBLOCKD *xd); +int vp9_get_intra_inter_context(const MACROBLOCKD *xd); -static INLINE vp9_prob vp9_get_pred_prob_intra_inter(const VP9_COMMON *cm, - const MACROBLOCKD *xd) { - const int pred_context = vp9_get_pred_context_intra_inter(xd); - return cm->fc.intra_inter_prob[pred_context]; +static INLINE vp9_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)]; } unsigned char vp9_get_pred_context_comp_inter_inter(const VP9_COMMON *cm, diff --git a/vp9/decoder/vp9_decodemv.c b/vp9/decoder/vp9_decodemv.c index 327a9166c..7858e16c8 100644 --- a/vp9/decoder/vp9_decodemv.c +++ b/vp9/decoder/vp9_decodemv.c @@ -408,8 +408,8 @@ static int read_is_inter_block(VP9_COMMON *const cm, MACROBLOCKD *const xd, return vp9_get_segdata(&cm->seg, segment_id, SEG_LVL_REF_FRAME) != INTRA_FRAME; } else { - const int ctx = vp9_get_pred_context_intra_inter(xd); - const int is_inter = vp9_read(r, vp9_get_pred_prob_intra_inter(cm, xd)); + const int ctx = vp9_get_intra_inter_context(xd); + const int is_inter = vp9_read(r, cm->fc.intra_inter_prob[ctx]); if (!cm->frame_parallel_decoding_mode) ++cm->counts.intra_inter[ctx][is_inter]; return is_inter; diff --git a/vp9/encoder/vp9_bitstream.c b/vp9/encoder/vp9_bitstream.c index 97717fb9c..5a355c97a 100644 --- a/vp9/encoder/vp9_bitstream.c +++ b/vp9/encoder/vp9_bitstream.c @@ -292,8 +292,7 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m, vp9_writer *bc) { skip_coeff = write_skip_coeff(cpi, segment_id, m, bc); if (!vp9_segfeature_active(seg, segment_id, SEG_LVL_REF_FRAME)) - vp9_write(bc, rf != INTRA_FRAME, - vp9_get_pred_prob_intra_inter(cm, xd)); + vp9_write(bc, rf != INTRA_FRAME, vp9_get_intra_inter_prob(cm, xd)); if (bsize >= BLOCK_8X8 && cm->tx_mode == TX_MODE_SELECT && !(rf != INTRA_FRAME && diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c index bc71d0259..2fa9dcc6e 100644 --- a/vp9/encoder/vp9_encodeframe.c +++ b/vp9/encoder/vp9_encodeframe.c @@ -751,7 +751,7 @@ static void update_stats(VP9_COMP *cpi) { SEG_LVL_REF_FRAME); if (!seg_ref_active) - cpi->intra_inter_count[vp9_get_pred_context_intra_inter(xd)] + cpi->intra_inter_count[vp9_get_intra_inter_context(xd)] [is_inter_block(mbmi)]++; // If the segment reference feature is enabled we have only a single diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c index 71a3650fe..155e07f52 100644 --- a/vp9/encoder/vp9_rdopt.c +++ b/vp9/encoder/vp9_rdopt.c @@ -2145,7 +2145,7 @@ static void estimate_ref_frame_costs(VP9_COMP *cpi, int segment_id, vpx_memset(ref_costs_comp, 0, MAX_REF_FRAMES * sizeof(*ref_costs_comp)); *comp_mode_p = 128; } else { - vp9_prob intra_inter_p = vp9_get_pred_prob_intra_inter(cm, xd); + vp9_prob intra_inter_p = vp9_get_intra_inter_prob(cm, xd); vp9_prob comp_inter_p = 128; if (cm->comp_pred_mode == REFERENCE_MODE_SELECT) { -- 2.40.0