Commit 5de96b3c authored by Dmitry Kovalev's avatar Dmitry Kovalev Committed by Gerrit Code Review
Browse files

Merge "Rewriting vp9_set_pred_flag_{seg_id, mbskip}."

parents 85a0d8e8 863138a2
......@@ -16,21 +16,6 @@
#include "vp9/common/vp9_seg_common.h"
#include "vp9/common/vp9_treecoder.h"
void vp9_set_pred_flag_seg_id(MACROBLOCKD *xd, BLOCK_SIZE_TYPE bsize,
unsigned char pred_flag) {
const int mis = xd->mode_info_stride;
const int bh = 1 << mi_height_log2(bsize);
const int bw = 1 << mi_width_log2(bsize);
#define sub(a, b) (b) < 0 ? (a) + (b) : (a)
const int x_mis = sub(bw, xd->mb_to_right_edge >> (3 + LOG2_MI_SIZE));
const int y_mis = sub(bh, xd->mb_to_bottom_edge >> (3 + LOG2_MI_SIZE));
#undef sub
int x, y;
for (y = 0; y < y_mis; y++)
for (x = 0; x < x_mis; x++)
xd->mode_info_context[y * mis + x].mbmi.seg_id_predicted = pred_flag;
}
// Returns a context number for the given MB prediction signal
unsigned char vp9_get_pred_context_switchable_interp(const VP9_COMMON *cm,
const MACROBLOCKD *xd) {
......@@ -423,22 +408,32 @@ unsigned char vp9_get_pred_context_tx_size(const VP9_COMMON *cm,
return above_context + left_context > max_tx_size;
}
// This function sets the status of the given prediction signal.
// I.e. is the predicted value for the given signal correct.
void vp9_set_pred_flag_mbskip(MACROBLOCKD *xd, BLOCK_SIZE_TYPE bsize,
unsigned char pred_flag) {
const int mis = xd->mode_info_stride;
void vp9_set_pred_flag_seg_id(VP9_COMMON *cm, BLOCK_SIZE_TYPE 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_mbskip(VP9_COMMON *cm, BLOCK_SIZE_TYPE 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);
#define sub(a, b) (b) < 0 ? (a) + (b) : (a)
const int x_mis = sub(bw, xd->mb_to_right_edge >> (3 + LOG2_MI_SIZE));
const int y_mis = sub(bh, xd->mb_to_bottom_edge >> (3 + LOG2_MI_SIZE));
#undef sub
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 < y_mis; y++)
for (x = 0; x < x_mis; x++)
xd->mode_info_context[y * mis + x].mbmi.mb_skip_coeff = pred_flag;
for (y = 0; y < ymis; y++)
for (x = 0; x < xmis; x++)
mi[y * cm->mode_info_stride + x].mbmi.mb_skip_coeff = pred_flag;
}
int vp9_get_segment_id(VP9_COMMON *cm, const uint8_t *segment_ids,
......
......@@ -31,8 +31,8 @@ static INLINE vp9_prob vp9_get_pred_prob_seg_id(const MACROBLOCKD *xd) {
return xd->seg.pred_probs[vp9_get_pred_context_seg_id(xd)];
}
void vp9_set_pred_flag_seg_id(MACROBLOCKD *xd, BLOCK_SIZE_TYPE bsize,
unsigned char pred_flag);
void vp9_set_pred_flag_seg_id(VP9_COMMON *cm, BLOCK_SIZE_TYPE bsize,
int mi_row, int mi_col, uint8_t pred_flag);
static INLINE int vp9_get_pred_context_mbskip(const MACROBLOCKD *xd) {
const MODE_INFO *const mi = xd->mode_info_context;
......@@ -52,8 +52,8 @@ static INLINE unsigned char vp9_get_pred_flag_mbskip(const MACROBLOCKD *xd) {
return xd->mode_info_context->mbmi.mb_skip_coeff;
}
void vp9_set_pred_flag_mbskip(MACROBLOCKD *xd, BLOCK_SIZE_TYPE bsize,
unsigned char pred_flag);
void vp9_set_pred_flag_mbskip(VP9_COMMON *cm, BLOCK_SIZE_TYPE bsize,
int mi_row, int mi_col, uint8_t pred_flag);
unsigned char vp9_get_pred_context_switchable_interp(const VP9_COMMON *cm,
const MACROBLOCKD *xd);
......
......@@ -140,7 +140,7 @@ static int read_inter_segment_id(VP9D_COMP *pbi, int mi_row, int mi_col,
if (seg->temporal_update) {
const vp9_prob pred_prob = vp9_get_pred_prob_seg_id(xd);
const int pred_flag = vp9_read(r, pred_prob);
vp9_set_pred_flag_seg_id(xd, bsize, pred_flag);
vp9_set_pred_flag_seg_id(cm, bsize, mi_row, mi_col, pred_flag);
segment_id = pred_flag ? pred_segment_id
: read_segment_id(r, seg);
} else {
......
......@@ -262,7 +262,8 @@ static void decode_modes_b(VP9D_COMP *pbi, int mi_row, int mi_col,
} else {
assert(mbmi->sb_type == bsize);
if (eobtotal == 0)
vp9_set_pred_flag_mbskip(xd, bsize, 1); // skip loopfilter
// skip loopfilter
vp9_set_pred_flag_mbskip(cm, bsize, mi_row, mi_col, 1);
else if (eobtotal > 0)
foreach_transformed_block(xd, bsize, decode_block, xd);
}
......
......@@ -2377,7 +2377,7 @@ static void encode_superblock(VP9_COMP *cpi, TOKENEXTRA **t, int output_enabled,
// copy skip flag on all mb_mode_info contexts in this SB
// if this was a skip at this txfm size
vp9_set_pred_flag_mbskip(xd, bsize, mi->mbmi.mb_skip_coeff);
vp9_set_pred_flag_mbskip(cm, bsize, mi_row, mi_col, mi->mbmi.mb_skip_coeff);
if (output_enabled) {
if (cm->txfm_mode == TX_MODE_SELECT &&
......
......@@ -145,7 +145,7 @@ static void count_segs(VP9_COMP *cpi, MODE_INFO *mi,
// Store the prediction status for this mb and update counts
// as appropriate
vp9_set_pred_flag_seg_id(xd, bsize, pred_flag);
vp9_set_pred_flag_seg_id(cm, bsize, mi_row, mi_col, pred_flag);
temporal_predictor_count[pred_context][pred_flag]++;
if (!pred_flag)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment