Commit 51545f57 authored by Dmitry Kovalev's avatar Dmitry Kovalev
Browse files

Moving PC_TREE from MACROBLOCK to VP9_COMP.

Because PC_TREE is encoder-level data, not MACROBLOCK-level data.

Change-Id: I4f620c0781acd3a2744860610117e74948e0b2b5
parent b334bfc3
...@@ -20,43 +20,6 @@ ...@@ -20,43 +20,6 @@
extern "C" { extern "C" {
#endif #endif
// Structure to hold snapshot of coding context during the mode picking process
typedef struct {
MODE_INFO mic;
uint8_t *zcoeff_blk;
int16_t *coeff[MAX_MB_PLANE][3];
int16_t *qcoeff[MAX_MB_PLANE][3];
int16_t *dqcoeff[MAX_MB_PLANE][3];
uint16_t *eobs[MAX_MB_PLANE][3];
// dual buffer pointers, 0: in use, 1: best in store
int16_t *coeff_pbuf[MAX_MB_PLANE][3];
int16_t *qcoeff_pbuf[MAX_MB_PLANE][3];
int16_t *dqcoeff_pbuf[MAX_MB_PLANE][3];
uint16_t *eobs_pbuf[MAX_MB_PLANE][3];
int is_coded;
int num_4x4_blk;
int skip;
int_mv best_ref_mv[2];
int_mv ref_mvs[MAX_REF_FRAMES][MAX_MV_REF_CANDIDATES];
int rate;
int distortion;
int best_mode_index;
int rddiv;
int rdmult;
int hybrid_pred_diff;
int comp_pred_diff;
int single_pred_diff;
int64_t tx_rd_diff[TX_MODES];
int64_t best_filter_diff[SWITCHABLE_FILTER_CONTEXTS];
// motion vector cache for adaptive motion search control in partition
// search loop
int_mv pred_mv[MAX_REF_FRAMES];
INTERP_FILTER pred_interp_filter;
} PICK_MODE_CONTEXT;
struct macroblock_plane { struct macroblock_plane {
DECLARE_ALIGNED(16, int16_t, src_diff[64 * 64]); DECLARE_ALIGNED(16, int16_t, src_diff[64 * 64]);
int16_t *qcoeff; int16_t *qcoeff;
...@@ -73,18 +36,6 @@ struct macroblock_plane { ...@@ -73,18 +36,6 @@ struct macroblock_plane {
// Zbin Over Quant value // Zbin Over Quant value
int16_t zbin_extra; int16_t zbin_extra;
}; };
typedef struct PC_TREE {
int index;
PARTITION_TYPE partitioning;
BLOCK_SIZE block_size;
PICK_MODE_CONTEXT none;
PICK_MODE_CONTEXT horizontal[2];
PICK_MODE_CONTEXT vertical[2];
union {
struct PC_TREE *split[4];
PICK_MODE_CONTEXT *leaf_split[4];
};
} PC_TREE;
/* The [2] dimension is for whether we skip the EOB node (i.e. if previous /* The [2] dimension is for whether we skip the EOB node (i.e. if previous
* coefficient in this block was zero) or not. */ * coefficient in this block was zero) or not. */
...@@ -157,15 +108,9 @@ struct macroblock { ...@@ -157,15 +108,9 @@ struct macroblock {
// Used to store sub partition's choices. // Used to store sub partition's choices.
int_mv pred_mv[MAX_REF_FRAMES]; int_mv pred_mv[MAX_REF_FRAMES];
PICK_MODE_CONTEXT *leaf_tree;
PC_TREE *pc_tree;
PC_TREE *pc_root;
int partition_cost[PARTITION_CONTEXTS][PARTITION_TYPES];
void (*fwd_txm4x4)(const int16_t *input, int16_t *output, int stride); void (*fwd_txm4x4)(const int16_t *input, int16_t *output, int stride);
}; };
#ifdef __cplusplus #ifdef __cplusplus
} // extern "C" } // extern "C"
#endif #endif
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
*/ */
#include "vp9/encoder/vp9_context_tree.h" #include "vp9/encoder/vp9_context_tree.h"
#include "vp9/encoder/vp9_encoder.h"
static const BLOCK_SIZE square[] = { static const BLOCK_SIZE square[] = {
BLOCK_8X8, BLOCK_8X8,
...@@ -86,7 +87,7 @@ static void free_tree_contexts(PC_TREE *tree) { ...@@ -86,7 +87,7 @@ static void free_tree_contexts(PC_TREE *tree) {
// partition level. There are contexts for none, horizontal, vertical, and // partition level. There are contexts for none, horizontal, vertical, and
// split. Along with a block_size value and a selected block_size which // split. Along with a block_size value and a selected block_size which
// represents the state of our search. // represents the state of our search.
void vp9_setup_pc_tree(VP9_COMMON *cm, MACROBLOCK *x) { void vp9_setup_pc_tree(VP9_COMMON *cm, VP9_COMP *cpi) {
int i, j; int i, j;
const int leaf_nodes = 64; const int leaf_nodes = 64;
const int tree_nodes = 64 + 16 + 4 + 1; const int tree_nodes = 64 + 16 + 4 + 1;
...@@ -96,23 +97,24 @@ void vp9_setup_pc_tree(VP9_COMMON *cm, MACROBLOCK *x) { ...@@ -96,23 +97,24 @@ void vp9_setup_pc_tree(VP9_COMMON *cm, MACROBLOCK *x) {
int square_index = 1; int square_index = 1;
int nodes; int nodes;
vpx_free(x->leaf_tree); vpx_free(cpi->leaf_tree);
CHECK_MEM_ERROR(cm, x->leaf_tree, vpx_calloc(leaf_nodes, CHECK_MEM_ERROR(cm, cpi->leaf_tree, vpx_calloc(leaf_nodes,
sizeof(*x->leaf_tree))); sizeof(*cpi->leaf_tree)));
vpx_free(x->pc_tree); vpx_free(cpi->pc_tree);
CHECK_MEM_ERROR(cm, x->pc_tree, vpx_calloc(tree_nodes, sizeof(*x->pc_tree))); CHECK_MEM_ERROR(cm, cpi->pc_tree, vpx_calloc(tree_nodes,
sizeof(*cpi->pc_tree)));
this_pc = &x->pc_tree[0]; this_pc = &cpi->pc_tree[0];
this_leaf = &x->leaf_tree[0]; this_leaf = &cpi->leaf_tree[0];
// 4x4 blocks smaller than 8x8 but in the same 8x8 block share the same // 4x4 blocks smaller than 8x8 but in the same 8x8 block share the same
// context so we only need to allocate 1 for each 8x8 block. // context so we only need to allocate 1 for each 8x8 block.
for (i = 0; i < leaf_nodes; ++i) for (i = 0; i < leaf_nodes; ++i)
alloc_mode_context(cm, 1, &x->leaf_tree[i]); alloc_mode_context(cm, 1, &cpi->leaf_tree[i]);
// Sets up all the leaf nodes in the tree. // Sets up all the leaf nodes in the tree.
for (pc_tree_index = 0; pc_tree_index < leaf_nodes; ++pc_tree_index) { for (pc_tree_index = 0; pc_tree_index < leaf_nodes; ++pc_tree_index) {
PC_TREE *const tree = &x->pc_tree[pc_tree_index]; PC_TREE *const tree = &cpi->pc_tree[pc_tree_index];
tree->block_size = square[0]; tree->block_size = square[0];
alloc_tree_contexts(cm, tree, 4); alloc_tree_contexts(cm, tree, 4);
tree->leaf_split[0] = this_leaf++; tree->leaf_split[0] = this_leaf++;
...@@ -124,7 +126,7 @@ void vp9_setup_pc_tree(VP9_COMMON *cm, MACROBLOCK *x) { ...@@ -124,7 +126,7 @@ void vp9_setup_pc_tree(VP9_COMMON *cm, MACROBLOCK *x) {
// from leafs to the root. // from leafs to the root.
for (nodes = 16; nodes > 0; nodes >>= 2) { for (nodes = 16; nodes > 0; nodes >>= 2) {
for (i = 0; i < nodes; ++i) { for (i = 0; i < nodes; ++i) {
PC_TREE *const tree = &x->pc_tree[pc_tree_index]; PC_TREE *const tree = &cpi->pc_tree[pc_tree_index];
alloc_tree_contexts(cm, tree, 4 << (2 * square_index)); alloc_tree_contexts(cm, tree, 4 << (2 * square_index));
tree->block_size = square[square_index]; tree->block_size = square[square_index];
for (j = 0; j < 4; j++) for (j = 0; j < 4; j++)
...@@ -133,24 +135,24 @@ void vp9_setup_pc_tree(VP9_COMMON *cm, MACROBLOCK *x) { ...@@ -133,24 +135,24 @@ void vp9_setup_pc_tree(VP9_COMMON *cm, MACROBLOCK *x) {
} }
++square_index; ++square_index;
} }
x->pc_root = &x->pc_tree[tree_nodes - 1]; cpi->pc_root = &cpi->pc_tree[tree_nodes - 1];
x->pc_root[0].none.best_mode_index = 2; cpi->pc_root[0].none.best_mode_index = 2;
} }
void vp9_free_pc_tree(MACROBLOCK *x) { void vp9_free_pc_tree(VP9_COMP *cpi) {
const int tree_nodes = 64 + 16 + 4 + 1; const int tree_nodes = 64 + 16 + 4 + 1;
int i; int i;
// Set up all 4x4 mode contexts // Set up all 4x4 mode contexts
for (i = 0; i < 64; ++i) for (i = 0; i < 64; ++i)
free_mode_context(&x->leaf_tree[i]); free_mode_context(&cpi->leaf_tree[i]);
// Sets up all the leaf nodes in the tree. // Sets up all the leaf nodes in the tree.
for (i = 0; i < tree_nodes; ++i) for (i = 0; i < tree_nodes; ++i)
free_tree_contexts(&x->pc_tree[i]); free_tree_contexts(&cpi->pc_tree[i]);
vpx_free(x->pc_tree); vpx_free(cpi->pc_tree);
x->pc_tree = NULL; cpi->pc_tree = NULL;
vpx_free(x->leaf_tree); vpx_free(cpi->leaf_tree);
x->leaf_tree = NULL; cpi->leaf_tree = NULL;
} }
...@@ -11,9 +11,61 @@ ...@@ -11,9 +11,61 @@
#ifndef VP9_ENCODER_VP9_CONTEXT_TREE_H_ #ifndef VP9_ENCODER_VP9_CONTEXT_TREE_H_
#define VP9_ENCODER_VP9_CONTEXT_TREE_H_ #define VP9_ENCODER_VP9_CONTEXT_TREE_H_
#include "vp9/encoder/vp9_encoder.h" #include "vp9/common/vp9_onyxc_int.h"
void vp9_setup_pc_tree(VP9_COMMON *cm, MACROBLOCK *x); struct VP9_COMP;
void vp9_free_pc_tree(MACROBLOCK *x);
// Structure to hold snapshot of coding context during the mode picking process
typedef struct {
MODE_INFO mic;
uint8_t *zcoeff_blk;
int16_t *coeff[MAX_MB_PLANE][3];
int16_t *qcoeff[MAX_MB_PLANE][3];
int16_t *dqcoeff[MAX_MB_PLANE][3];
uint16_t *eobs[MAX_MB_PLANE][3];
// dual buffer pointers, 0: in use, 1: best in store
int16_t *coeff_pbuf[MAX_MB_PLANE][3];
int16_t *qcoeff_pbuf[MAX_MB_PLANE][3];
int16_t *dqcoeff_pbuf[MAX_MB_PLANE][3];
uint16_t *eobs_pbuf[MAX_MB_PLANE][3];
int is_coded;
int num_4x4_blk;
int skip;
int_mv best_ref_mv[2];
int_mv ref_mvs[MAX_REF_FRAMES][MAX_MV_REF_CANDIDATES];
int rate;
int distortion;
int best_mode_index;
int rddiv;
int rdmult;
int hybrid_pred_diff;
int comp_pred_diff;
int single_pred_diff;
int64_t tx_rd_diff[TX_MODES];
int64_t best_filter_diff[SWITCHABLE_FILTER_CONTEXTS];
// motion vector cache for adaptive motion search control in partition
// search loop
int_mv pred_mv[MAX_REF_FRAMES];
INTERP_FILTER pred_interp_filter;
} PICK_MODE_CONTEXT;
typedef struct PC_TREE {
int index;
PARTITION_TYPE partitioning;
BLOCK_SIZE block_size;
PICK_MODE_CONTEXT none;
PICK_MODE_CONTEXT horizontal[2];
PICK_MODE_CONTEXT vertical[2];
union {
struct PC_TREE *split[4];
PICK_MODE_CONTEXT *leaf_split[4];
};
} PC_TREE;
void vp9_setup_pc_tree(struct VP9Common *cm, struct VP9_COMP *cpi);
void vp9_free_pc_tree(struct VP9_COMP *cpi);
#endif /* VP9_ENCODER_VP9_CONTEXT_TREE_H_ */ #endif /* VP9_ENCODER_VP9_CONTEXT_TREE_H_ */
...@@ -1538,7 +1538,7 @@ static void rd_use_partition(VP9_COMP *cpi, ...@@ -1538,7 +1538,7 @@ static void rd_use_partition(VP9_COMP *cpi,
pl = partition_plane_context(xd, mi_row, mi_col, bsize); pl = partition_plane_context(xd, mi_row, mi_col, bsize);
if (none_rate < INT_MAX) { if (none_rate < INT_MAX) {
none_rate += x->partition_cost[pl][PARTITION_NONE]; none_rate += cpi->partition_cost[pl][PARTITION_NONE];
none_rd = RDCOST(x->rdmult, x->rddiv, none_rate, none_dist); none_rd = RDCOST(x->rdmult, x->rddiv, none_rate, none_dist);
} }
...@@ -1636,7 +1636,7 @@ static void rd_use_partition(VP9_COMP *cpi, ...@@ -1636,7 +1636,7 @@ static void rd_use_partition(VP9_COMP *cpi,
pl = partition_plane_context(xd, mi_row, mi_col, bsize); pl = partition_plane_context(xd, mi_row, mi_col, bsize);
if (last_part_rate < INT_MAX) { if (last_part_rate < INT_MAX) {
last_part_rate += x->partition_cost[pl][partition]; last_part_rate += cpi->partition_cost[pl][partition];
last_part_rd = RDCOST(x->rdmult, x->rddiv, last_part_rate, last_part_dist); last_part_rd = RDCOST(x->rdmult, x->rddiv, last_part_rate, last_part_dist);
} }
...@@ -1689,11 +1689,11 @@ static void rd_use_partition(VP9_COMP *cpi, ...@@ -1689,11 +1689,11 @@ static void rd_use_partition(VP9_COMP *cpi,
pl = partition_plane_context(xd, mi_row + y_idx, mi_col + x_idx, pl = partition_plane_context(xd, mi_row + y_idx, mi_col + x_idx,
split_subsize); split_subsize);
chosen_rate += x->partition_cost[pl][PARTITION_NONE]; chosen_rate += cpi->partition_cost[pl][PARTITION_NONE];
} }
pl = partition_plane_context(xd, mi_row, mi_col, bsize); pl = partition_plane_context(xd, mi_row, mi_col, bsize);
if (chosen_rate < INT_MAX) { if (chosen_rate < INT_MAX) {
chosen_rate += x->partition_cost[pl][PARTITION_SPLIT]; chosen_rate += cpi->partition_cost[pl][PARTITION_SPLIT];
chosen_rd = RDCOST(x->rdmult, x->rddiv, chosen_rate, chosen_dist); chosen_rd = RDCOST(x->rdmult, x->rddiv, chosen_rate, chosen_dist);
} }
} }
...@@ -2015,7 +2015,7 @@ static void rd_pick_partition(VP9_COMP *cpi, const TileInfo *const tile, ...@@ -2015,7 +2015,7 @@ static void rd_pick_partition(VP9_COMP *cpi, const TileInfo *const tile,
if (this_rate != INT_MAX) { if (this_rate != INT_MAX) {
if (bsize >= BLOCK_8X8) { if (bsize >= BLOCK_8X8) {
pl = partition_plane_context(xd, mi_row, mi_col, bsize); pl = partition_plane_context(xd, mi_row, mi_col, bsize);
this_rate += x->partition_cost[pl][PARTITION_NONE]; this_rate += cpi->partition_cost[pl][PARTITION_NONE];
} }
sum_rd = RDCOST(x->rdmult, x->rddiv, this_rate, this_dist); sum_rd = RDCOST(x->rdmult, x->rddiv, this_rate, this_dist);
if (sum_rd < best_rd) { if (sum_rd < best_rd) {
...@@ -2103,7 +2103,7 @@ static void rd_pick_partition(VP9_COMP *cpi, const TileInfo *const tile, ...@@ -2103,7 +2103,7 @@ static void rd_pick_partition(VP9_COMP *cpi, const TileInfo *const tile,
if (sum_rd < best_rd && i == 4) { if (sum_rd < best_rd && i == 4) {
pl = partition_plane_context(xd, mi_row, mi_col, bsize); pl = partition_plane_context(xd, mi_row, mi_col, bsize);
sum_rate += x->partition_cost[pl][PARTITION_SPLIT]; sum_rate += cpi->partition_cost[pl][PARTITION_SPLIT];
sum_rd = RDCOST(x->rdmult, x->rddiv, sum_rate, sum_dist); sum_rd = RDCOST(x->rdmult, x->rddiv, sum_rate, sum_dist);
if (sum_rd < best_rd) { if (sum_rd < best_rd) {
best_rate = sum_rate; best_rate = sum_rate;
...@@ -2157,7 +2157,7 @@ static void rd_pick_partition(VP9_COMP *cpi, const TileInfo *const tile, ...@@ -2157,7 +2157,7 @@ static void rd_pick_partition(VP9_COMP *cpi, const TileInfo *const tile,
} }
if (sum_rd < best_rd) { if (sum_rd < best_rd) {
pl = partition_plane_context(xd, mi_row, mi_col, bsize); pl = partition_plane_context(xd, mi_row, mi_col, bsize);
sum_rate += x->partition_cost[pl][PARTITION_HORZ]; sum_rate += cpi->partition_cost[pl][PARTITION_HORZ];
sum_rd = RDCOST(x->rdmult, x->rddiv, sum_rate, sum_dist); sum_rd = RDCOST(x->rdmult, x->rddiv, sum_rate, sum_dist);
if (sum_rd < best_rd) { if (sum_rd < best_rd) {
best_rd = sum_rd; best_rd = sum_rd;
...@@ -2206,7 +2206,7 @@ static void rd_pick_partition(VP9_COMP *cpi, const TileInfo *const tile, ...@@ -2206,7 +2206,7 @@ static void rd_pick_partition(VP9_COMP *cpi, const TileInfo *const tile,
} }
if (sum_rd < best_rd) { if (sum_rd < best_rd) {
pl = partition_plane_context(xd, mi_row, mi_col, bsize); pl = partition_plane_context(xd, mi_row, mi_col, bsize);
sum_rate += x->partition_cost[pl][PARTITION_VERT]; sum_rate += cpi->partition_cost[pl][PARTITION_VERT];
sum_rd = RDCOST(x->rdmult, x->rddiv, sum_rate, sum_dist); sum_rd = RDCOST(x->rdmult, x->rddiv, sum_rate, sum_dist);
if (sum_rd < best_rd) { if (sum_rd < best_rd) {
best_rate = sum_rate; best_rate = sum_rate;
...@@ -2268,17 +2268,16 @@ static void encode_rd_sb_row(VP9_COMP *cpi, const TileInfo *const tile, ...@@ -2268,17 +2268,16 @@ static void encode_rd_sb_row(VP9_COMP *cpi, const TileInfo *const tile,
int64_t dummy_dist; int64_t dummy_dist;
int i; int i;
MACROBLOCK *x = &cpi->mb;
if (sf->adaptive_pred_interp_filter) { if (sf->adaptive_pred_interp_filter) {
for (i = 0; i < 64; ++i) for (i = 0; i < 64; ++i)
x->leaf_tree[i].pred_interp_filter = SWITCHABLE; cpi->leaf_tree[i].pred_interp_filter = SWITCHABLE;
for (i = 0; i < 64; ++i) { for (i = 0; i < 64; ++i) {
x->pc_tree[i].vertical[0].pred_interp_filter = SWITCHABLE; cpi->pc_tree[i].vertical[0].pred_interp_filter = SWITCHABLE;
x->pc_tree[i].vertical[1].pred_interp_filter = SWITCHABLE; cpi->pc_tree[i].vertical[1].pred_interp_filter = SWITCHABLE;
x->pc_tree[i].horizontal[0].pred_interp_filter = SWITCHABLE; cpi->pc_tree[i].horizontal[0].pred_interp_filter = SWITCHABLE;
x->pc_tree[i].horizontal[1].pred_interp_filter = SWITCHABLE; cpi->pc_tree[i].horizontal[1].pred_interp_filter = SWITCHABLE;
} }
} }
...@@ -2298,18 +2297,18 @@ static void encode_rd_sb_row(VP9_COMP *cpi, const TileInfo *const tile, ...@@ -2298,18 +2297,18 @@ static void encode_rd_sb_row(VP9_COMP *cpi, const TileInfo *const tile,
set_fixed_partitioning(cpi, tile, mi, mi_row, mi_col, set_fixed_partitioning(cpi, tile, mi, mi_row, mi_col,
sf->always_this_block_size); sf->always_this_block_size);
rd_use_partition(cpi, tile, mi, tp, mi_row, mi_col, BLOCK_64X64, rd_use_partition(cpi, tile, mi, tp, mi_row, mi_col, BLOCK_64X64,
&dummy_rate, &dummy_dist, 1, x->pc_root); &dummy_rate, &dummy_dist, 1, cpi->pc_root);
} else if (sf->partition_search_type == VAR_BASED_FIXED_PARTITION) { } else if (sf->partition_search_type == VAR_BASED_FIXED_PARTITION) {
BLOCK_SIZE bsize; BLOCK_SIZE bsize;
set_offsets(cpi, tile, mi_row, mi_col, BLOCK_64X64); set_offsets(cpi, tile, mi_row, mi_col, BLOCK_64X64);
bsize = get_rd_var_based_fixed_partition(cpi, mi_row, mi_col); bsize = get_rd_var_based_fixed_partition(cpi, mi_row, mi_col);
set_fixed_partitioning(cpi, tile, mi, mi_row, mi_col, bsize); set_fixed_partitioning(cpi, tile, mi, mi_row, mi_col, bsize);
rd_use_partition(cpi, tile, mi, tp, mi_row, mi_col, BLOCK_64X64, rd_use_partition(cpi, tile, mi, tp, mi_row, mi_col, BLOCK_64X64,
&dummy_rate, &dummy_dist, 1, x->pc_root); &dummy_rate, &dummy_dist, 1, cpi->pc_root);
} else if (sf->partition_search_type == VAR_BASED_PARTITION) { } else if (sf->partition_search_type == VAR_BASED_PARTITION) {
choose_partitioning(cpi, tile, mi_row, mi_col); choose_partitioning(cpi, tile, mi_row, mi_col);
rd_use_partition(cpi, tile, mi, tp, mi_row, mi_col, BLOCK_64X64, rd_use_partition(cpi, tile, mi, tp, mi_row, mi_col, BLOCK_64X64,
&dummy_rate, &dummy_dist, 1, x->pc_root); &dummy_rate, &dummy_dist, 1, cpi->pc_root);
} else { } else {
if ((cm->current_video_frame if ((cm->current_video_frame
% sf->last_partitioning_redo_frequency) == 0 % sf->last_partitioning_redo_frequency) == 0
...@@ -2328,7 +2327,8 @@ static void encode_rd_sb_row(VP9_COMP *cpi, const TileInfo *const tile, ...@@ -2328,7 +2327,8 @@ static void encode_rd_sb_row(VP9_COMP *cpi, const TileInfo *const tile,
&sf->max_partition_size); &sf->max_partition_size);
} }
rd_pick_partition(cpi, tile, tp, mi_row, mi_col, BLOCK_64X64, rd_pick_partition(cpi, tile, tp, mi_row, mi_col, BLOCK_64X64,
&dummy_rate, &dummy_dist, 1, INT64_MAX, x->pc_root); &dummy_rate, &dummy_dist, 1, INT64_MAX,
cpi->pc_root);
} else { } else {
if (sf->constrain_copy_partition && if (sf->constrain_copy_partition &&
sb_has_motion(cm, prev_mi)) sb_has_motion(cm, prev_mi))
...@@ -2337,7 +2337,7 @@ static void encode_rd_sb_row(VP9_COMP *cpi, const TileInfo *const tile, ...@@ -2337,7 +2337,7 @@ static void encode_rd_sb_row(VP9_COMP *cpi, const TileInfo *const tile,
else else
copy_partitioning(cm, mi, prev_mi); copy_partitioning(cm, mi, prev_mi);
rd_use_partition(cpi, tile, mi, tp, mi_row, mi_col, BLOCK_64X64, rd_use_partition(cpi, tile, mi, tp, mi_row, mi_col, BLOCK_64X64,
&dummy_rate, &dummy_dist, 1, x->pc_root); &dummy_rate, &dummy_dist, 1, cpi->pc_root);
} }
} }
} else { } else {
...@@ -2349,7 +2349,7 @@ static void encode_rd_sb_row(VP9_COMP *cpi, const TileInfo *const tile, ...@@ -2349,7 +2349,7 @@ static void encode_rd_sb_row(VP9_COMP *cpi, const TileInfo *const tile,
&sf->max_partition_size); &sf->max_partition_size);
} }
rd_pick_partition(cpi, tile, tp, mi_row, mi_col, BLOCK_64X64, rd_pick_partition(cpi, tile, tp, mi_row, mi_col, BLOCK_64X64,
&dummy_rate, &dummy_dist, 1, INT64_MAX, x->pc_root); &dummy_rate, &dummy_dist, 1, INT64_MAX, cpi->pc_root);
} }
} }
} }
...@@ -2627,7 +2627,7 @@ static void nonrd_pick_partition(VP9_COMP *cpi, const TileInfo *const tile, ...@@ -2627,7 +2627,7 @@ static void nonrd_pick_partition(VP9_COMP *cpi, const TileInfo *const tile,
if (this_rate != INT_MAX) { if (this_rate != INT_MAX) {
int pl = partition_plane_context(xd, mi_row, mi_col, bsize); int pl = partition_plane_context(xd, mi_row, mi_col, bsize);
this_rate += x->partition_cost[pl][PARTITION_NONE]; this_rate += cpi->partition_cost[pl][PARTITION_NONE];
sum_rd = RDCOST(x->rdmult, x->rddiv, this_rate, this_dist); sum_rd = RDCOST(x->rdmult, x->rddiv, this_rate, this_dist);
if (sum_rd < best_rd) { if (sum_rd < best_rd) {
int64_t stop_thresh = 4096; int64_t stop_thresh = 4096;
...@@ -2665,7 +2665,7 @@ static void nonrd_pick_partition(VP9_COMP *cpi, const TileInfo *const tile, ...@@ -2665,7 +2665,7 @@ static void nonrd_pick_partition(VP9_COMP *cpi, const TileInfo *const tile,
sum_rd = 0; sum_rd = 0;
if (do_split) { if (do_split) {
int pl = partition_plane_context(xd, mi_row, mi_col, bsize); int pl = partition_plane_context(xd, mi_row, mi_col, bsize);
sum_rate += x->partition_cost[pl][PARTITION_SPLIT]; sum_rate += cpi->partition_cost[pl][PARTITION_SPLIT];
subsize = get_subsize(bsize, PARTITION_SPLIT); subsize = get_subsize(bsize, PARTITION_SPLIT);
for (i = 0; i < 4 && sum_rd < best_rd; ++i) { for (i = 0; i < 4 && sum_rd < best_rd; ++i) {
const int x_idx = (i & 1) * ms; const int x_idx = (i & 1) * ms;
...@@ -2724,7 +2724,7 @@ static void nonrd_pick_partition(VP9_COMP *cpi, const TileInfo *const tile, ...@@ -2724,7 +2724,7 @@ static void nonrd_pick_partition(VP9_COMP *cpi, const TileInfo *const tile,
sum_rd = INT64_MAX; sum_rd = INT64_MAX;
} else { } else {
int pl = partition_plane_context(xd, mi_row, mi_col, bsize); int pl = partition_plane_context(xd, mi_row, mi_col, bsize);
this_rate += x->partition_cost[pl][PARTITION_HORZ]; this_rate += cpi->partition_cost[pl][PARTITION_HORZ];
sum_rate += this_rate; sum_rate += this_rate;
sum_dist += this_dist; sum_dist += this_dist;
sum_rd = RDCOST(x->rdmult, x->rddiv, sum_rate, sum_dist); sum_rd = RDCOST(x->rdmult, x->rddiv, sum_rate, sum_dist);
...@@ -2758,7 +2758,7 @@ static void nonrd_pick_partition(VP9_COMP *cpi, const TileInfo *const tile, ...@@ -2758,7 +2758,7 @@ static void nonrd_pick_partition(VP9_COMP *cpi, const TileInfo *const tile,
sum_rd = INT64_MAX; sum_rd = INT64_MAX;
} else { } else {
int pl = partition_plane_context(xd, mi_row, mi_col, bsize); int pl = partition_plane_context(xd, mi_row, mi_col, bsize);
this_rate += x->partition_cost[pl][PARTITION_VERT]; this_rate += cpi->partition_cost[pl][PARTITION_VERT];
sum_rate += this_rate; sum_rate += this_rate;
sum_dist += this_dist; sum_dist += this_dist;
sum_rd = RDCOST(x->rdmult, x->rddiv, sum_rate, sum_dist); sum_rd = RDCOST(x->rdmult, x->rddiv, sum_rate, sum_dist);
...@@ -2944,12 +2944,12 @@ static void encode_nonrd_sb_row(VP9_COMP *cpi, const TileInfo *const tile, ...@@ -2944,12 +2944,12 @@ static void encode_nonrd_sb_row(VP9_COMP *cpi, const TileInfo *const tile,
case VAR_BASED_PARTITION: case VAR_BASED_PARTITION:
choose_partitioning(cpi, tile, mi_row, mi_col); choose_partitioning(cpi, tile, mi_row, mi_col);
nonrd_use_partition(cpi, tile, mi, tp, mi_row, mi_col, BLOCK_64X64, nonrd_use_partition(cpi, tile, mi, tp, mi_row, mi_col, BLOCK_64X64,
1, &dummy_rate, &dummy_dist, x->pc_root); 1, &dummy_rate, &dummy_dist, cpi->pc_root);
break; break;
case SOURCE_VAR_BASED_PARTITION: case SOURCE_VAR_BASED_PARTITION:
set_source_var_based_partition(cpi, tile, mi, mi_row, mi_col); set_source_var_based_partition(cpi, tile, mi, mi_row, mi_col);
nonrd_use_partition(cpi, tile, mi, tp, mi_row, mi_col, BLOCK_64X64, nonrd_use_partition(cpi, tile, mi, tp, mi_row, mi_col, BLOCK_64X64,
1, &dummy_rate, &dummy_dist, x->pc_root); 1, &dummy_rate, &dummy_dist, cpi->pc_root);
break; break;
case VAR_BASED_FIXED_PARTITION: case VAR_BASED_FIXED_PARTITION:
case FIXED_PARTITION: case FIXED_PARTITION:
...@@ -2958,7 +2958,7 @@ static void encode_nonrd_sb_row(VP9_COMP *cpi, const TileInfo *const tile, ...@@ -2958,7 +2958,7 @@ static void encode_nonrd_sb_row(VP9_COMP *cpi, const TileInfo *const tile,
get_nonrd_var_based_fixed_partition(cpi, mi_row, mi_col); get_nonrd_var_based_fixed_partition(cpi, mi_row, mi_col);
set_fixed_partitioning(cpi, tile, mi, mi_row, mi_col, bsize); set_fixed_partitioning(cpi, tile, mi, mi_row, mi_col, bsize);
nonrd_use_partition(cpi, tile, mi, tp, mi_row, mi_col, BLOCK_64X64, nonrd_use_partition(cpi, tile, mi, tp, mi_row, mi_col, BLOCK_64X64,
1, &dummy_rate, &dummy_dist, x->pc_root); 1, &dummy_rate, &dummy_dist, cpi->pc_root);
break; break;
case REFERENCE_PARTITION: case REFERENCE_PARTITION:
if (cpi->sf.partition_check || if (cpi->sf.partition_check ||
...@@ -2969,12 +2969,12 @@ static void encode_nonrd_sb_row(VP9_COMP *cpi, const TileInfo *const tile, ...@@ -2969,12 +2969,12 @@ static void encode_nonrd_sb_row(VP9_COMP *cpi, const TileInfo *const tile,
&cpi->sf.max_partition_size); &cpi->sf.max_partition_size);
nonrd_pick_partition(cpi, tile, tp, mi_row, mi_col, BLOCK_64X64, nonrd_pick_partition(cpi, tile, tp, mi_row, mi_col, BLOCK_64X64,
&dummy_rate, &dummy_dist, 1, INT64_MAX, &dummy_rate, &dummy_dist, 1, INT64_MAX,
x->pc_root);