Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Unified Diff: source/libvpx/vp9/common/vp9_pred_common.c

Issue 23530058: libvpx: Pull from upstream (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « source/libvpx/vp9/common/vp9_pred_common.h ('k') | source/libvpx/vp9/common/vp9_reconinter.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: source/libvpx/vp9/common/vp9_pred_common.c
===================================================================
--- source/libvpx/vp9/common/vp9_pred_common.c (revision 223100)
+++ source/libvpx/vp9/common/vp9_pred_common.c (working copy)
@@ -18,28 +18,28 @@
// Returns a context number for the given MB prediction signal
unsigned char vp9_get_pred_context_switchable_interp(const MACROBLOCKD *xd) {
- const MODE_INFO *const mi = xd->mode_info_context;
- const MB_MODE_INFO *const above_mbmi = &mi[-xd->mode_info_stride].mbmi;
- const MB_MODE_INFO *const left_mbmi = &mi[-1].mbmi;
- const int left_in_image = xd->left_available && left_mbmi->in_image;
- const int above_in_image = xd->up_available && above_mbmi->in_image;
+ const MODE_INFO * const above_mi = xd->mi_8x8[-xd->mode_info_stride];
+ const MODE_INFO * const left_mi = xd->mi_8x8[-1];
+ const int left_in_image = xd->left_available && left_mi;
+ const int above_in_image = xd->up_available && above_mi;
// 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.
// left
- const int left_mv_pred = is_inter_mode(left_mbmi->mode);
+ const int left_mv_pred = left_in_image ? is_inter_mode(left_mi->mbmi.mode)
+ : 0;
const int left_interp = left_in_image && left_mv_pred
- ? left_mbmi->interp_filter
+ ? left_mi->mbmi.interp_filter
: SWITCHABLE_FILTERS;
// above
- const int above_mv_pred = is_inter_mode(above_mbmi->mode);
+ const int above_mv_pred = above_in_image ? is_inter_mode(above_mi->mbmi.mode)
+ : 0;
const int above_interp = above_in_image && above_mv_pred
- ? above_mbmi->interp_filter
+ ? above_mi->mbmi.interp_filter
: SWITCHABLE_FILTERS;
-
if (left_interp == above_interp)
return left_interp;
else if (left_interp == SWITCHABLE_FILTERS &&
@@ -53,13 +53,14 @@
}
// 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 mi = xd->mode_info_context;
- const MB_MODE_INFO *const above_mbmi = &mi[-xd->mode_info_stride].mbmi;
- const MB_MODE_INFO *const left_mbmi = &mi[-1].mbmi;
- const int left_in_image = xd->left_available && left_mbmi->in_image;
- const int above_in_image = xd->up_available && above_mbmi->in_image;
- const int left_intra = !is_inter_block(left_mbmi);
- const int above_intra = !is_inter_block(above_mbmi);
+ const MODE_INFO * const above_mi = xd->mi_8x8[-xd->mode_info_stride];
+ const MODE_INFO * const left_mi = xd->mi_8x8[-1];
+ const MB_MODE_INFO *const above_mbmi = above_mi ? &above_mi->mbmi : 0;
+ const MB_MODE_INFO *const left_mbmi = left_mi ? &left_mi->mbmi : 0;
+ const int left_in_image = xd->left_available && left_mi;
+ const int above_in_image = xd->up_available && above_mi;
+ const int left_intra = left_in_image ? !is_inter_block(left_mbmi) : 1;
+ const int above_intra = above_in_image ? !is_inter_block(above_mbmi) : 1;
// The mode info data structure has a one element border above and to the
// left of the entries corresponding to real macroblocks.
@@ -80,11 +81,12 @@
unsigned char vp9_get_pred_context_comp_inter_inter(const VP9_COMMON *cm,
const MACROBLOCKD *xd) {
int pred_context;
- const MODE_INFO *const mi = xd->mode_info_context;
- const MB_MODE_INFO *const above_mbmi = &mi[-cm->mode_info_stride].mbmi;
- const MB_MODE_INFO *const left_mbmi = &mi[-1].mbmi;
- const int left_in_image = xd->left_available && left_mbmi->in_image;
- const int above_in_image = xd->up_available && above_mbmi->in_image;
+ const MODE_INFO * const above_mi = xd->mi_8x8[-xd->mode_info_stride];
+ const MODE_INFO * const left_mi = xd->mi_8x8[-1];
+ const MB_MODE_INFO *const above_mbmi = above_mi ? &above_mi->mbmi : 0;
+ const MB_MODE_INFO *const left_mbmi = left_mi ? &left_mi->mbmi : 0;
+ const int left_in_image = xd->left_available && left_mi;
+ const int above_in_image = xd->up_available && above_mi;
// Note:
// The mode info data structure has a one element border above and to the
// left of the entries correpsonding to real macroblocks.
@@ -124,14 +126,14 @@
unsigned char vp9_get_pred_context_comp_ref_p(const VP9_COMMON *cm,
const MACROBLOCKD *xd) {
int pred_context;
- const MODE_INFO *const mi = xd->mode_info_context;
- const MB_MODE_INFO *const above_mbmi = &mi[-cm->mode_info_stride].mbmi;
- const MB_MODE_INFO *const left_mbmi = &mi[-1].mbmi;
- const int left_in_image = xd->left_available && left_mbmi->in_image;
- const int above_in_image = xd->up_available && above_mbmi->in_image;
- const int left_intra = !is_inter_block(left_mbmi);
- const int above_intra = !is_inter_block(above_mbmi);
-
+ const MODE_INFO * const above_mi = xd->mi_8x8[-cm->mode_info_stride];
+ const MODE_INFO * const left_mi = xd->mi_8x8[-1];
+ const MB_MODE_INFO *const above_mbmi = above_mi ? &above_mi->mbmi : 0;
+ const MB_MODE_INFO *const left_mbmi = left_mi ? &left_mi->mbmi : 0;
+ const int left_in_image = xd->left_available && left_mi;
+ const int above_in_image = xd->up_available && above_mi;
+ const int left_intra = left_in_image ? !is_inter_block(left_mbmi) : 1;
+ const int above_intra = above_in_image ? !is_inter_block(above_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.
@@ -204,14 +206,14 @@
}
unsigned char vp9_get_pred_context_single_ref_p1(const MACROBLOCKD *xd) {
int pred_context;
- const MODE_INFO *const mi = xd->mode_info_context;
- const MB_MODE_INFO *const above_mbmi = &mi[-xd->mode_info_stride].mbmi;
- const MB_MODE_INFO *const left_mbmi = &mi[-1].mbmi;
- const int left_in_image = xd->left_available && left_mbmi->in_image;
- const int above_in_image = xd->up_available && above_mbmi->in_image;
- const int left_intra = !is_inter_block(left_mbmi);
- const int above_intra = !is_inter_block(above_mbmi);
-
+ const MODE_INFO * const above_mi = xd->mi_8x8[-xd->mode_info_stride];
+ const MODE_INFO * const left_mi = xd->mi_8x8[-1];
+ const MB_MODE_INFO *const above_mbmi = above_mi ? &above_mi->mbmi : 0;
+ const MB_MODE_INFO *const left_mbmi = left_mi ? &left_mi->mbmi : 0;
+ const int left_in_image = xd->left_available && left_mi;
+ const int above_in_image = xd->up_available && above_mi;
+ const int left_intra = left_in_image ? !is_inter_block(left_mbmi) : 1;
+ const int above_intra = above_in_image ? !is_inter_block(above_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.
@@ -270,13 +272,14 @@
unsigned char vp9_get_pred_context_single_ref_p2(const MACROBLOCKD *xd) {
int pred_context;
- const MODE_INFO *const mi = xd->mode_info_context;
- const MB_MODE_INFO *const above_mbmi = &mi[-xd->mode_info_stride].mbmi;
- const MB_MODE_INFO *const left_mbmi = &mi[-1].mbmi;
- const int left_in_image = xd->left_available && left_mbmi->in_image;
- const int above_in_image = xd->up_available && above_mbmi->in_image;
- const int left_intra = !is_inter_block(left_mbmi);
- const int above_intra = !is_inter_block(above_mbmi);
+ const MODE_INFO * const above_mi = xd->mi_8x8[-xd->mode_info_stride];
+ const MODE_INFO * const left_mi = xd->mi_8x8[-1];
+ const MB_MODE_INFO *const above_mbmi = above_mi ? &above_mi->mbmi : 0;
+ const MB_MODE_INFO *const left_mbmi = left_mi ? &left_mi->mbmi : 0;
+ const int left_in_image = xd->left_available && left_mi;
+ const int above_in_image = xd->up_available && above_mi;
+ const int left_intra = left_in_image ? !is_inter_block(left_mbmi) : 1;
+ const int above_intra = above_in_image ? !is_inter_block(above_mbmi) : 1;
// Note:
// The mode info data structure has a one element border above and to the
@@ -358,22 +361,23 @@
// left of the entries corresponding to real blocks.
// The prediction flags in these dummy entries are initialized to 0.
unsigned char vp9_get_pred_context_tx_size(const MACROBLOCKD *xd) {
- const MODE_INFO *const mi = xd->mode_info_context;
- const MB_MODE_INFO *const above_mbmi = &mi[-xd->mode_info_stride].mbmi;
- const MB_MODE_INFO *const left_mbmi = &mi[-1].mbmi;
- const int left_in_image = xd->left_available && left_mbmi->in_image;
- const int above_in_image = xd->up_available && above_mbmi->in_image;
- const int max_tx_size = max_txsize_lookup[mi->mbmi.sb_type];
+ const MODE_INFO * const above_mi = xd->mi_8x8[-xd->mode_info_stride];
+ const MODE_INFO * const left_mi = xd->mi_8x8[-1];
+ const MB_MODE_INFO *const above_mbmi = above_mi ? &above_mi->mbmi : 0;
+ const MB_MODE_INFO *const left_mbmi = left_mi ? &left_mi->mbmi : 0;
+ const int left_in_image = xd->left_available && left_mi;
+ const int above_in_image = xd->up_available && above_mi;
+ const int max_tx_size = max_txsize_lookup[xd->mi_8x8[0]->mbmi.sb_type];
int above_context = max_tx_size;
int left_context = max_tx_size;
if (above_in_image)
above_context = above_mbmi->skip_coeff ? max_tx_size
- : above_mbmi->txfm_size;
+ : above_mbmi->tx_size;
if (left_in_image)
left_context = left_mbmi->skip_coeff ? max_tx_size
- : left_mbmi->txfm_size;
+ : left_mbmi->tx_size;
if (!left_in_image)
left_context = above_context;
@@ -384,32 +388,13 @@
return above_context + left_context > max_tx_size;
}
-void vp9_set_pred_flag_seg_id(VP9_COMMON *cm, BLOCK_SIZE bsize,
- int mi_row, int mi_col, uint8_t pred_flag) {
- MODE_INFO *mi = &cm->mi[mi_row * cm->mode_info_stride + mi_col];
- const int bw = 1 << mi_width_log2(bsize);
- const int bh = 1 << mi_height_log2(bsize);
- const int xmis = MIN(cm->mi_cols - mi_col, bw);
- const int ymis = MIN(cm->mi_rows - mi_row, bh);
- int x, y;
-
- for (y = 0; y < ymis; y++)
- for (x = 0; x < xmis; x++)
- mi[y * cm->mode_info_stride + x].mbmi.seg_id_predicted = pred_flag;
+void vp9_set_pred_flag_seg_id(MACROBLOCKD *xd, uint8_t pred_flag) {
+ xd->this_mi->mbmi.seg_id_predicted = pred_flag;
}
-void vp9_set_pred_flag_mbskip(VP9_COMMON *cm, BLOCK_SIZE bsize,
- int mi_row, int mi_col, uint8_t pred_flag) {
- MODE_INFO *mi = &cm->mi[mi_row * cm->mode_info_stride + mi_col];
- const int bw = 1 << mi_width_log2(bsize);
- const int bh = 1 << mi_height_log2(bsize);
- const int xmis = MIN(cm->mi_cols - mi_col, bw);
- const int ymis = MIN(cm->mi_rows - mi_row, bh);
- int x, y;
-
- for (y = 0; y < ymis; y++)
- for (x = 0; x < xmis; x++)
- mi[y * cm->mode_info_stride + x].mbmi.skip_coeff = pred_flag;
+void vp9_set_pred_flag_mbskip(MACROBLOCKD *xd, BLOCK_SIZE bsize,
+ uint8_t pred_flag) {
+ xd->this_mi->mbmi.skip_coeff = pred_flag;
}
int vp9_get_segment_id(VP9_COMMON *cm, const uint8_t *segment_ids,
« no previous file with comments | « source/libvpx/vp9/common/vp9_pred_common.h ('k') | source/libvpx/vp9/common/vp9_reconinter.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698