Merge "Removing BLOCK_TYPES and adding PLANE_TYPES constant instead."

This commit is contained in:
Dmitry Kovalev 2013-12-07 02:20:41 -08:00 коммит произвёл Gerrit Code Review
Родитель 2341747805 d6b159d4a6
Коммит a19d694f09
10 изменённых файлов: 36 добавлений и 38 удалений

Просмотреть файл

@ -38,8 +38,9 @@
#define REF_CONTEXTS 5
typedef enum {
PLANE_TYPE_Y_WITH_DC,
PLANE_TYPE_UV,
PLANE_TYPE_Y = 0,
PLANE_TYPE_UV = 1,
PLANE_TYPES
} PLANE_TYPE;
typedef char ENTROPY_CONTEXT;
@ -265,37 +266,36 @@ static INLINE TX_TYPE get_tx_type_4x4(PLANE_TYPE plane_type,
const MODE_INFO *const mi = xd->mi_8x8[0];
const MB_MODE_INFO *const mbmi = &mi->mbmi;
if (plane_type != PLANE_TYPE_Y_WITH_DC ||
xd->lossless ||
is_inter_block(mbmi))
if (plane_type != PLANE_TYPE_Y || xd->lossless || is_inter_block(mbmi))
return DCT_DCT;
return mode2txfm_map[mbmi->sb_type < BLOCK_8X8 ?
mi->bmi[ib].as_mode : mbmi->mode];
return mode2txfm_map[mbmi->sb_type < BLOCK_8X8 ? mi->bmi[ib].as_mode
: mbmi->mode];
}
static INLINE TX_TYPE get_tx_type_8x8(PLANE_TYPE plane_type,
const MACROBLOCKD *xd) {
return plane_type == PLANE_TYPE_Y_WITH_DC ?
mode2txfm_map[xd->mi_8x8[0]->mbmi.mode] : DCT_DCT;
return plane_type == PLANE_TYPE_Y ? mode2txfm_map[xd->mi_8x8[0]->mbmi.mode]
: DCT_DCT;
}
static INLINE TX_TYPE get_tx_type_16x16(PLANE_TYPE plane_type,
const MACROBLOCKD *xd) {
return plane_type == PLANE_TYPE_Y_WITH_DC ?
mode2txfm_map[xd->mi_8x8[0]->mbmi.mode] : DCT_DCT;
return plane_type == PLANE_TYPE_Y ? mode2txfm_map[xd->mi_8x8[0]->mbmi.mode]
: DCT_DCT;
}
static void setup_block_dptrs(MACROBLOCKD *xd, int ss_x, int ss_y) {
int i;
for (i = 0; i < MAX_MB_PLANE; i++) {
xd->plane[i].plane_type = i ? PLANE_TYPE_UV : PLANE_TYPE_Y_WITH_DC;
xd->plane[i].plane_type = i ? PLANE_TYPE_UV : PLANE_TYPE_Y;
xd->plane[i].subsampling_x = i ? ss_x : 0;
xd->plane[i].subsampling_y = i ? ss_y : 0;
}
#if CONFIG_ALPHA
// TODO(jkoleszar): Using the Y w/h for now
xd->plane[3].plane_type = PLANE_TYPE_Y;
xd->plane[3].subsampling_x = 0;
xd->plane[3].subsampling_y = 0;
#endif

Просмотреть файл

@ -391,7 +391,7 @@ const vp9_prob vp9_pareto8_full[COEFF_PROB_MODELS][MODEL_NODES] = {
{255, 246, 247, 255, 239, 255, 253, 255},
};
static const vp9_coeff_probs_model default_coef_probs_4x4[BLOCK_TYPES] = {
static const vp9_coeff_probs_model default_coef_probs_4x4[PLANE_TYPES] = {
{ // Y plane
{ // Intra
{ // Band 0
@ -475,7 +475,7 @@ static const vp9_coeff_probs_model default_coef_probs_4x4[BLOCK_TYPES] = {
}
};
static const vp9_coeff_probs_model default_coef_probs_8x8[BLOCK_TYPES] = {
static const vp9_coeff_probs_model default_coef_probs_8x8[PLANE_TYPES] = {
{ // Y plane
{ // Intra
{ // Band 0
@ -559,7 +559,7 @@ static const vp9_coeff_probs_model default_coef_probs_8x8[BLOCK_TYPES] = {
}
};
static const vp9_coeff_probs_model default_coef_probs_16x16[BLOCK_TYPES] = {
static const vp9_coeff_probs_model default_coef_probs_16x16[PLANE_TYPES] = {
{ // Y plane
{ // Intra
{ // Band 0
@ -643,7 +643,7 @@ static const vp9_coeff_probs_model default_coef_probs_16x16[BLOCK_TYPES] = {
}
};
static const vp9_coeff_probs_model default_coef_probs_32x32[BLOCK_TYPES] = {
static const vp9_coeff_probs_model default_coef_probs_32x32[PLANE_TYPES] = {
{ // Y plane
{ // Intra
{ // Band 0
@ -763,7 +763,7 @@ static void adapt_coef_probs(VP9_COMMON *cm, TX_SIZE tx_size,
cm->counts.eob_branch[tx_size];
int i, j, k, l, m;
for (i = 0; i < BLOCK_TYPES; ++i)
for (i = 0; i < PLANE_TYPES; ++i)
for (j = 0; j < REF_TYPES; ++j)
for (k = 0; k < COEF_BANDS; ++k)
for (l = 0; l < BAND_COEFF_CONTEXTS(k); ++l) {

Просмотреть файл

@ -59,8 +59,6 @@ extern const vp9_extra_bit vp9_extra_bits[ENTROPY_TOKENS];
/* Coefficients are predicted via a 3-dimensional probability table. */
/* Outside dimension. 0 = Y with DC, 1 = UV */
#define BLOCK_TYPES 2
#define REF_TYPES 2 // intra=0, inter=1
/* Middle dimension reflects the coefficient position within the transform. */
@ -179,7 +177,7 @@ static const scan_order *get_scan(const MACROBLOCKD *xd, TX_SIZE tx_size,
const MODE_INFO *const mi = xd->mi_8x8[0];
const MB_MODE_INFO *const mbmi = &mi->mbmi;
if (is_inter_block(mbmi) || type != PLANE_TYPE_Y_WITH_DC || xd->lossless) {
if (is_inter_block(mbmi) || type != PLANE_TYPE_Y || xd->lossless) {
return &vp9_default_scan_orders[tx_size];
} else {
const MB_PREDICTION_MODE mode =

Просмотреть файл

@ -47,7 +47,7 @@ typedef struct frame_contexts {
vp9_prob y_mode_prob[BLOCK_SIZE_GROUPS][INTRA_MODES - 1];
vp9_prob uv_mode_prob[INTRA_MODES][INTRA_MODES - 1];
vp9_prob partition_prob[PARTITION_CONTEXTS][PARTITION_TYPES - 1];
vp9_coeff_probs_model coef_probs[TX_SIZES][BLOCK_TYPES];
vp9_coeff_probs_model coef_probs[TX_SIZES][PLANE_TYPES];
vp9_prob switchable_interp_prob[SWITCHABLE_FILTER_CONTEXTS]
[SWITCHABLE_FILTERS - 1];
vp9_prob inter_mode_probs[INTER_MODE_CONTEXTS][INTER_MODES - 1];
@ -64,8 +64,8 @@ typedef struct {
unsigned int y_mode[BLOCK_SIZE_GROUPS][INTRA_MODES];
unsigned int uv_mode[INTRA_MODES][INTRA_MODES];
unsigned int partition[PARTITION_CONTEXTS][PARTITION_TYPES];
vp9_coeff_count_model coef[TX_SIZES][BLOCK_TYPES];
unsigned int eob_branch[TX_SIZES][BLOCK_TYPES][REF_TYPES]
vp9_coeff_count_model coef[TX_SIZES][PLANE_TYPES];
unsigned int eob_branch[TX_SIZES][PLANE_TYPES][REF_TYPES]
[COEF_BANDS][COEFF_CONTEXTS];
unsigned int switchable_interp[SWITCHABLE_FILTER_CONTEXTS]
[SWITCHABLE_FILTERS];

Просмотреть файл

@ -537,7 +537,7 @@ static void read_coef_probs_common(vp9_coeff_probs_model *coef_probs,
int i, j, k, l, m;
if (vp9_read_bit(r))
for (i = 0; i < BLOCK_TYPES; ++i)
for (i = 0; i < PLANE_TYPES; ++i)
for (j = 0; j < REF_TYPES; ++j)
for (k = 0; k < COEF_BANDS; ++k)
for (l = 0; l < BAND_COEFF_CONTEXTS(k); ++l)

Просмотреть файл

@ -44,7 +44,7 @@ unsigned __int64 Sectionbits[500];
int intra_mode_stats[INTRA_MODES]
[INTRA_MODES]
[INTRA_MODES];
vp9_coeff_stats tree_update_hist[TX_SIZES][BLOCK_TYPES];
vp9_coeff_stats tree_update_hist[TX_SIZES][PLANE_TYPES];
extern unsigned int active_section;
#endif
@ -557,7 +557,7 @@ static void build_tree_distribution(VP9_COMP *cpi, TX_SIZE tx_size) {
vp9_coeff_stats *coef_branch_ct = cpi->frame_branch_ct[tx_size];
int i, j, k, l, m;
for (i = 0; i < BLOCK_TYPES; ++i) {
for (i = 0; i < PLANE_TYPES; ++i) {
for (j = 0; j < REF_TYPES; ++j) {
for (k = 0; k < COEF_BANDS; ++k) {
for (l = 0; l < BAND_COEFF_CONTEXTS(k); ++l) {
@ -600,7 +600,7 @@ static void update_coef_probs_common(vp9_writer* const bc, VP9_COMP *cpi,
/* dry run to see if there is any udpate at all needed */
int savings = 0;
int update[2] = {0, 0};
for (i = 0; i < BLOCK_TYPES; ++i) {
for (i = 0; i < PLANE_TYPES; ++i) {
for (j = 0; j < REF_TYPES; ++j) {
for (k = 0; k < COEF_BANDS; ++k) {
for (l = 0; l < BAND_COEFF_CONTEXTS(k); ++l) {
@ -636,7 +636,7 @@ static void update_coef_probs_common(vp9_writer* const bc, VP9_COMP *cpi,
return;
}
vp9_write_bit(bc, 1);
for (i = 0; i < BLOCK_TYPES; ++i) {
for (i = 0; i < PLANE_TYPES; ++i) {
for (j = 0; j < REF_TYPES; ++j) {
for (k = 0; k < COEF_BANDS; ++k) {
for (l = 0; l < BAND_COEFF_CONTEXTS(k); ++l) {
@ -685,7 +685,7 @@ static void update_coef_probs_common(vp9_writer* const bc, VP9_COMP *cpi,
: COEF_BANDS;
int updates = 0;
int noupdates_before_first = 0;
for (i = 0; i < BLOCK_TYPES; ++i) {
for (i = 0; i < PLANE_TYPES; ++i) {
for (j = 0; j < REF_TYPES; ++j) {
for (k = 0; k < COEF_BANDS; ++k) {
for (l = 0; l < BAND_COEFF_CONTEXTS(k); ++l) {

Просмотреть файл

@ -86,7 +86,7 @@ struct macroblock_plane {
/* The [2] dimension is for whether we skip the EOB node (i.e. if previous
* coefficient in this block was zero) or not. */
typedef unsigned int vp9_coeff_cost[BLOCK_TYPES][REF_TYPES][COEF_BANDS][2]
typedef unsigned int vp9_coeff_cost[PLANE_TYPES][REF_TYPES][COEF_BANDS][2]
[COEFF_CONTEXTS][ENTROPY_TOKENS];
typedef struct macroblock MACROBLOCK;

Просмотреть файл

@ -2596,7 +2596,7 @@ static void full_to_model_counts(vp9_coeff_count_model *model_count,
vp9_coeff_count *full_count) {
int i, j, k, l;
for (i = 0; i < BLOCK_TYPES; ++i)
for (i = 0; i < PLANE_TYPES; ++i)
for (j = 0; j < REF_TYPES; ++j)
for (k = 0; k < COEF_BANDS; ++k)
for (l = 0; l < BAND_COEFF_CONTEXTS(k); ++l)

Просмотреть файл

@ -469,9 +469,9 @@ typedef struct VP9_COMP {
nmv_context_counts NMVcount;
vp9_coeff_count coef_counts[TX_SIZES][BLOCK_TYPES];
vp9_coeff_probs_model frame_coef_probs[TX_SIZES][BLOCK_TYPES];
vp9_coeff_stats frame_branch_ct[TX_SIZES][BLOCK_TYPES];
vp9_coeff_count coef_counts[TX_SIZES][PLANE_TYPES];
vp9_coeff_probs_model frame_coef_probs[TX_SIZES][PLANE_TYPES];
vp9_coeff_stats frame_branch_ct[TX_SIZES][PLANE_TYPES];
int kf_zeromotion_pct;
int gf_zeromotion_pct;

Просмотреть файл

@ -151,11 +151,11 @@ static void fill_mode_costs(VP9_COMP *c) {
}
static void fill_token_costs(vp9_coeff_cost *c,
vp9_coeff_probs_model (*p)[BLOCK_TYPES]) {
vp9_coeff_probs_model (*p)[PLANE_TYPES]) {
int i, j, k, l;
TX_SIZE t;
for (t = TX_4X4; t <= TX_32X32; ++t)
for (i = 0; i < BLOCK_TYPES; ++i)
for (i = 0; i < PLANE_TYPES; ++i)
for (j = 0; j < REF_TYPES; ++j)
for (k = 0; k < COEF_BANDS; ++k)
for (l = 0; l < BAND_COEFF_CONTEXTS(k); ++l) {
@ -536,7 +536,7 @@ static INLINE int cost_coeffs(MACROBLOCK *x,
int c, cost;
// Check for consistency of tx_size with mode info
assert(type == PLANE_TYPE_Y_WITH_DC ? mbmi->tx_size == tx_size
assert(type == PLANE_TYPE_Y ? mbmi->tx_size == tx_size
: get_uv_tx_size(mbmi) == tx_size);
if (eob == 0) {
@ -1047,7 +1047,7 @@ static int64_t rd_pick_intra4x4block(VP9_COMP *cpi, MACROBLOCK *x, int ib,
src, src_stride,
dst, dst_stride);
tx_type = get_tx_type_4x4(PLANE_TYPE_Y_WITH_DC, xd, block);
tx_type = get_tx_type_4x4(PLANE_TYPE_Y, xd, block);
so = &vp9_scan_orders[TX_4X4][tx_type];
if (tx_type != DCT_DCT)