diff options
author | Vignesh Venkatasubramanian <vigneshv@google.com> | 2016-01-19 11:05:09 -0800 |
---|---|---|
committer | The Android Automerger <android-build@android.com> | 2016-01-22 14:46:43 -0800 |
commit | 5a9753fca56f0eeb9f61e342b2fccffc364f9426 (patch) | |
tree | dd33d82febff9fba67a61b711a30504b7f8a827b /libvpx/vp9/common/vp9_pred_common.c | |
parent | e8544063f08d093e211247d09d74e5bf86976dd5 (diff) | |
download | android_external_libvpx-5a9753fca56f0eeb9f61e342b2fccffc364f9426.tar.gz android_external_libvpx-5a9753fca56f0eeb9f61e342b2fccffc364f9426.tar.bz2 android_external_libvpx-5a9753fca56f0eeb9f61e342b2fccffc364f9426.zip |
Merge Conflict Fix CL to lmp-mr1-release for ag/849478
DO NOT MERGE - libvpx: Pull from upstream
Current HEAD: 7105df53d7dc13d5e575bc8df714ec8d1da36b06
BUG=23452792
Change-Id: Ic78176fc369e0bacc71d423e0e2e6075d004aaec
Diffstat (limited to 'libvpx/vp9/common/vp9_pred_common.c')
-rw-r--r-- | libvpx/vp9/common/vp9_pred_common.c | 96 |
1 files changed, 25 insertions, 71 deletions
diff --git a/libvpx/vp9/common/vp9_pred_common.c b/libvpx/vp9/common/vp9_pred_common.c index bc9d6ef..1f16325 100644 --- a/libvpx/vp9/common/vp9_pred_common.c +++ b/libvpx/vp9/common/vp9_pred_common.c @@ -9,27 +9,21 @@ * be found in the AUTHORS file in the root of the source tree. */ -#include <limits.h> - #include "vp9/common/vp9_common.h" #include "vp9/common/vp9_pred_common.h" #include "vp9/common/vp9_seg_common.h" -static INLINE const MB_MODE_INFO *get_mbmi(const MODE_INFO *const mi) { - return (mi != NULL) ? &mi->mbmi : NULL; -} - // Returns a context number for the given MB prediction signal int vp9_get_pred_context_switchable_interp(const MACROBLOCKD *xd) { // 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. - const MB_MODE_INFO *const left_mbmi = get_mbmi(get_left_mi(xd)); - const int left_type = left_mbmi != NULL && is_inter_block(left_mbmi) ? - left_mbmi->interp_filter : SWITCHABLE_FILTERS; - const MB_MODE_INFO *const above_mbmi = get_mbmi(get_above_mi(xd)); - const int above_type = above_mbmi != NULL && is_inter_block(above_mbmi) ? + const MB_MODE_INFO *const left_mbmi = xd->left_mbmi; + const int left_type = xd->left_available && is_inter_block(left_mbmi) ? + left_mbmi->interp_filter : SWITCHABLE_FILTERS; + const MB_MODE_INFO *const above_mbmi = xd->above_mbmi; + const int above_type = xd->up_available && is_inter_block(above_mbmi) ? above_mbmi->interp_filter : SWITCHABLE_FILTERS; if (left_type == above_type) @@ -50,10 +44,10 @@ int vp9_get_pred_context_switchable_interp(const MACROBLOCKD *xd) { // 2 - intra/--, --/intra // 3 - intra/intra int vp9_get_intra_inter_context(const MACROBLOCKD *xd) { - const MB_MODE_INFO *const above_mbmi = get_mbmi(get_above_mi(xd)); - const MB_MODE_INFO *const left_mbmi = get_mbmi(get_left_mi(xd)); - const int has_above = above_mbmi != NULL; - const int has_left = left_mbmi != NULL; + const MB_MODE_INFO *const above_mbmi = xd->above_mbmi; + const MB_MODE_INFO *const left_mbmi = xd->left_mbmi; + const int has_above = xd->up_available; + const int has_left = xd->left_available; if (has_above && has_left) { // both edges available const int above_intra = !is_inter_block(above_mbmi); @@ -70,10 +64,10 @@ int vp9_get_intra_inter_context(const MACROBLOCKD *xd) { int vp9_get_reference_mode_context(const VP9_COMMON *cm, const MACROBLOCKD *xd) { int ctx; - const MB_MODE_INFO *const above_mbmi = get_mbmi(get_above_mi(xd)); - const MB_MODE_INFO *const left_mbmi = get_mbmi(get_left_mi(xd)); - const int has_above = above_mbmi != NULL; - const int has_left = left_mbmi != NULL; + const MB_MODE_INFO *const above_mbmi = xd->above_mbmi; + const MB_MODE_INFO *const left_mbmi = xd->left_mbmi; + const int has_above = xd->up_available; + const int has_left = xd->left_available; // Note: // The mode info data structure has a one element border above and to the // left of the entries correpsonding to real macroblocks. @@ -113,10 +107,10 @@ int vp9_get_reference_mode_context(const VP9_COMMON *cm, int vp9_get_pred_context_comp_ref_p(const VP9_COMMON *cm, const MACROBLOCKD *xd) { int pred_context; - const MB_MODE_INFO *const above_mbmi = get_mbmi(get_above_mi(xd)); - const MB_MODE_INFO *const left_mbmi = get_mbmi(get_left_mi(xd)); - const int above_in_image = above_mbmi != NULL; - const int left_in_image = left_mbmi != NULL; + const MB_MODE_INFO *const above_mbmi = xd->above_mbmi; + const MB_MODE_INFO *const left_mbmi = xd->left_mbmi; + const int above_in_image = xd->up_available; + const int left_in_image = xd->left_available; // Note: // The mode info data structure has a one element border above and to the @@ -194,10 +188,10 @@ int vp9_get_pred_context_comp_ref_p(const VP9_COMMON *cm, int vp9_get_pred_context_single_ref_p1(const MACROBLOCKD *xd) { int pred_context; - const MB_MODE_INFO *const above_mbmi = get_mbmi(get_above_mi(xd)); - const MB_MODE_INFO *const left_mbmi = get_mbmi(get_left_mi(xd)); - const int has_above = above_mbmi != NULL; - const int has_left = left_mbmi != NULL; + const MB_MODE_INFO *const above_mbmi = xd->above_mbmi; + const MB_MODE_INFO *const left_mbmi = xd->left_mbmi; + const int has_above = xd->up_available; + const int has_left = xd->left_available; // Note: // The mode info data structure has a one element border above and to the // left of the entries correpsonding to real macroblocks. @@ -260,10 +254,10 @@ int vp9_get_pred_context_single_ref_p1(const MACROBLOCKD *xd) { int vp9_get_pred_context_single_ref_p2(const MACROBLOCKD *xd) { int pred_context; - const MB_MODE_INFO *const above_mbmi = get_mbmi(get_above_mi(xd)); - const MB_MODE_INFO *const left_mbmi = get_mbmi(get_left_mi(xd)); - const int has_above = above_mbmi != NULL; - const int has_left = left_mbmi != NULL; + const MB_MODE_INFO *const above_mbmi = xd->above_mbmi; + const MB_MODE_INFO *const left_mbmi = xd->left_mbmi; + const int has_above = xd->up_available; + const int has_left = xd->left_available; // Note: // The mode info data structure has a one element border above and to the @@ -343,43 +337,3 @@ int vp9_get_pred_context_single_ref_p2(const MACROBLOCKD *xd) { assert(pred_context >= 0 && pred_context < REF_CONTEXTS); return pred_context; } -// Returns a context number for the given MB prediction signal -// The mode info data structure has a one element border above and to the -// left of the entries corresponding to real blocks. -// The prediction flags in these dummy entries are initialized to 0. -int vp9_get_tx_size_context(const MACROBLOCKD *xd) { - const int max_tx_size = max_txsize_lookup[xd->mi[0]->mbmi.sb_type]; - const MB_MODE_INFO *const above_mbmi = get_mbmi(get_above_mi(xd)); - const MB_MODE_INFO *const left_mbmi = get_mbmi(get_left_mi(xd)); - const int has_above = above_mbmi != NULL; - const int has_left = left_mbmi != NULL; - int above_ctx = (has_above && !above_mbmi->skip) ? above_mbmi->tx_size - : max_tx_size; - int left_ctx = (has_left && !left_mbmi->skip) ? left_mbmi->tx_size - : max_tx_size; - if (!has_left) - left_ctx = above_ctx; - - if (!has_above) - above_ctx = left_ctx; - - return (above_ctx + left_ctx) > max_tx_size; -} - -int vp9_get_segment_id(VP9_COMMON *cm, const uint8_t *segment_ids, - BLOCK_SIZE bsize, int mi_row, int mi_col) { - const int mi_offset = mi_row * cm->mi_cols + mi_col; - const int bw = num_8x8_blocks_wide_lookup[bsize]; - const int bh = num_8x8_blocks_high_lookup[bsize]; - const int xmis = MIN(cm->mi_cols - mi_col, bw); - const int ymis = MIN(cm->mi_rows - mi_row, bh); - int x, y, segment_id = INT_MAX; - - for (y = 0; y < ymis; y++) - for (x = 0; x < xmis; x++) - segment_id = MIN(segment_id, - segment_ids[mi_offset + y * cm->mi_cols + x]); - - assert(segment_id >= 0 && segment_id < MAX_SEGMENTS); - return segment_id; -} |