Commit 5fe0e55c authored by Scott LaVarnway's avatar Scott LaVarnway Committed by Gerrit Code Review

Merge "Eliminated frame_type check in get_partition_probs()"

parents a41fe749 b2658ec3
...@@ -161,6 +161,8 @@ typedef struct macroblockd { ...@@ -161,6 +161,8 @@ typedef struct macroblockd {
int up_available; int up_available;
int left_available; int left_available;
const vp9_prob (*partition_probs)[PARTITION_TYPES - 1];
/* Distance of MB away from frame edges */ /* Distance of MB away from frame edges */
int mb_to_left_edge; int mb_to_left_edge;
int mb_to_right_edge; int mb_to_right_edge;
......
...@@ -336,6 +336,18 @@ static INLINE int mi_cols_aligned_to_sb(int n_mis) { ...@@ -336,6 +336,18 @@ static INLINE int mi_cols_aligned_to_sb(int n_mis) {
return ALIGN_POWER_OF_TWO(n_mis, MI_BLOCK_SIZE_LOG2); return ALIGN_POWER_OF_TWO(n_mis, MI_BLOCK_SIZE_LOG2);
} }
static INLINE int frame_is_intra_only(const VP9_COMMON *const cm) {
return cm->frame_type == KEY_FRAME || cm->intra_only;
}
static INLINE void set_partition_probs(const VP9_COMMON *const cm,
MACROBLOCKD *const xd) {
xd->partition_probs =
frame_is_intra_only(cm) ?
&vp9_kf_partition_probs[0] :
(const vp9_prob (*)[PARTITION_TYPES - 1])cm->fc->partition_prob;
}
static INLINE void init_macroblockd(VP9_COMMON *cm, MACROBLOCKD *xd) { static INLINE void init_macroblockd(VP9_COMMON *cm, MACROBLOCKD *xd) {
int i; int i;
...@@ -356,16 +368,13 @@ static INLINE void init_macroblockd(VP9_COMMON *cm, MACROBLOCKD *xd) { ...@@ -356,16 +368,13 @@ static INLINE void init_macroblockd(VP9_COMMON *cm, MACROBLOCKD *xd) {
xd->above_seg_context = cm->above_seg_context; xd->above_seg_context = cm->above_seg_context;
xd->mi_stride = cm->mi_stride; xd->mi_stride = cm->mi_stride;
xd->error_info = &cm->error; xd->error_info = &cm->error;
}
static INLINE int frame_is_intra_only(const VP9_COMMON *const cm) { set_partition_probs(cm, xd);
return cm->frame_type == KEY_FRAME || cm->intra_only;
} }
static INLINE const vp9_prob* get_partition_probs(const VP9_COMMON *cm, static INLINE const vp9_prob* get_partition_probs(const MACROBLOCKD *xd,
int ctx) { int ctx) {
return frame_is_intra_only(cm) ? vp9_kf_partition_probs[ctx] return xd->partition_probs[ctx];
: cm->fc->partition_prob[ctx];
} }
static INLINE void set_skip_context(MACROBLOCKD *xd, int mi_row, int mi_col) { static INLINE void set_skip_context(MACROBLOCKD *xd, int mi_row, int mi_col) {
......
...@@ -776,7 +776,7 @@ static PARTITION_TYPE read_partition(VP9_COMMON *cm, MACROBLOCKD *xd, ...@@ -776,7 +776,7 @@ static PARTITION_TYPE read_partition(VP9_COMMON *cm, MACROBLOCKD *xd,
int mi_row, int mi_col, BLOCK_SIZE bsize, int mi_row, int mi_col, BLOCK_SIZE bsize,
vp9_reader *r) { vp9_reader *r) {
const int ctx = partition_plane_context(xd, mi_row, mi_col, bsize); const int ctx = partition_plane_context(xd, mi_row, mi_col, bsize);
const vp9_prob *const probs = get_partition_probs(cm, ctx); const vp9_prob *const probs = get_partition_probs(xd, ctx);
const int has_rows = (mi_row + hbs) < cm->mi_rows; const int has_rows = (mi_row + hbs) < cm->mi_rows;
const int has_cols = (mi_col + hbs) < cm->mi_cols; const int has_cols = (mi_col + hbs) < cm->mi_cols;
FRAME_COUNTS *counts = xd->counts; FRAME_COUNTS *counts = xd->counts;
......
...@@ -403,7 +403,7 @@ static void write_partition(const VP9_COMMON *const cm, ...@@ -403,7 +403,7 @@ static void write_partition(const VP9_COMMON *const cm,
int hbs, int mi_row, int mi_col, int hbs, int mi_row, int mi_col,
PARTITION_TYPE p, BLOCK_SIZE bsize, vp9_writer *w) { PARTITION_TYPE p, BLOCK_SIZE bsize, vp9_writer *w) {
const int ctx = partition_plane_context(xd, mi_row, mi_col, bsize); const int ctx = partition_plane_context(xd, mi_row, mi_col, bsize);
const vp9_prob *const probs = get_partition_probs(cm, ctx); const vp9_prob *const probs = xd->partition_probs[ctx];
const int has_rows = (mi_row + hbs) < cm->mi_rows; const int has_rows = (mi_row + hbs) < cm->mi_rows;
const int has_cols = (mi_col + hbs) < cm->mi_cols; const int has_cols = (mi_col + hbs) < cm->mi_cols;
...@@ -481,9 +481,12 @@ static void write_modes_sb(VP9_COMP *cpi, ...@@ -481,9 +481,12 @@ static void write_modes_sb(VP9_COMP *cpi,
static void write_modes(VP9_COMP *cpi, static void write_modes(VP9_COMP *cpi,
const TileInfo *const tile, vp9_writer *w, const TileInfo *const tile, vp9_writer *w,
TOKENEXTRA **tok, const TOKENEXTRA *const tok_end) { TOKENEXTRA **tok, const TOKENEXTRA *const tok_end) {
const VP9_COMMON *const cm = &cpi->common;
MACROBLOCKD *const xd = &cpi->td.mb.e_mbd; MACROBLOCKD *const xd = &cpi->td.mb.e_mbd;
int mi_row, mi_col; int mi_row, mi_col;
set_partition_probs(cm, xd);
for (mi_row = tile->mi_row_start; mi_row < tile->mi_row_end; for (mi_row = tile->mi_row_start; mi_row < tile->mi_row_end;
mi_row += MI_BLOCK_SIZE) { mi_row += MI_BLOCK_SIZE) {
vp9_zero(xd->left_seg_context); vp9_zero(xd->left_seg_context);
......
...@@ -265,6 +265,7 @@ static void set_block_thresholds(const VP9_COMMON *cm, RD_OPT *rd) { ...@@ -265,6 +265,7 @@ static void set_block_thresholds(const VP9_COMMON *cm, RD_OPT *rd) {
void vp9_initialize_rd_consts(VP9_COMP *cpi) { void vp9_initialize_rd_consts(VP9_COMP *cpi) {
VP9_COMMON *const cm = &cpi->common; VP9_COMMON *const cm = &cpi->common;
MACROBLOCK *const x = &cpi->td.mb; MACROBLOCK *const x = &cpi->td.mb;
MACROBLOCKD *const xd = &cpi->td.mb.e_mbd;
RD_OPT *const rd = &cpi->rd; RD_OPT *const rd = &cpi->rd;
int i; int i;
...@@ -280,6 +281,7 @@ void vp9_initialize_rd_consts(VP9_COMP *cpi) { ...@@ -280,6 +281,7 @@ void vp9_initialize_rd_consts(VP9_COMP *cpi) {
cm->frame_type != KEY_FRAME) ? 0 : 1; cm->frame_type != KEY_FRAME) ? 0 : 1;
set_block_thresholds(cm, rd); set_block_thresholds(cm, rd);
set_partition_probs(cm, xd);
if (!cpi->sf.use_nonrd_pick_mode || cm->frame_type == KEY_FRAME) if (!cpi->sf.use_nonrd_pick_mode || cm->frame_type == KEY_FRAME)
fill_token_costs(x->token_costs, cm->fc->coef_probs); fill_token_costs(x->token_costs, cm->fc->coef_probs);
...@@ -287,7 +289,7 @@ void vp9_initialize_rd_consts(VP9_COMP *cpi) { ...@@ -287,7 +289,7 @@ void vp9_initialize_rd_consts(VP9_COMP *cpi) {
if (cpi->sf.partition_search_type != VAR_BASED_PARTITION || if (cpi->sf.partition_search_type != VAR_BASED_PARTITION ||
cm->frame_type == KEY_FRAME) { cm->frame_type == KEY_FRAME) {
for (i = 0; i < PARTITION_CONTEXTS; ++i) for (i = 0; i < PARTITION_CONTEXTS; ++i)
vp9_cost_tokens(cpi->partition_cost[i], get_partition_probs(cm, i), vp9_cost_tokens(cpi->partition_cost[i], get_partition_probs(xd, i),
vp9_partition_tree); vp9_partition_tree);
} }
......
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