Merge VP9_YMODES, VP9_UV_MODES, INTRA_MODE_COUNT and cousins.

These are now merged in a new define called VP9_INTRA_MODES.

Change-Id: I0890f895756a7395d84c92f98f43e43f4cf9050d
This commit is contained in:
Ronald S. Bultje 2013-05-30 16:21:48 -07:00
parent 4d3d00b195
commit a433abbcad
12 changed files with 61 additions and 65 deletions

View File

@ -89,8 +89,6 @@ static INLINE int is_inter_mode(MB_PREDICTION_MODE mode) {
return mode >= NEARESTMV && mode <= NEWMV;
}
#define INTRA_MODE_COUNT (TM_PRED + 1)
// Segment level features.
typedef enum {
SEG_LVL_ALT_Q = 0, // Use alternate Quantizer ....
@ -116,16 +114,12 @@ typedef enum {
ADST_ADST = 3 // ADST in both directions
} TX_TYPE;
#define VP9_YMODES (TM_PRED + 1)
#define VP9_UV_MODES (TM_PRED + 1)
#define VP9_I32X32_MODES (TM_PRED + 1)
#define VP9_INTRA_MODES (TM_PRED + 1)
#define VP9_MVREFS (1 + NEWMV - NEARESTMV)
#define WHT_UPSCALE_FACTOR 2
#define VP9_BINTRAMODES INTRA_MODE_COUNT
/* For keyframes, intra block modes are predicted by the (already decoded)
modes for the Y blocks to the left and above us; for interframes, there
is a single probability table. */

View File

@ -15,12 +15,12 @@
#include "vp9/common/vp9_alloccommon.h"
#include "vpx_mem/vpx_mem.h"
static const unsigned int y_mode_cts[VP9_BINTRAMODES] = {
static const unsigned int y_mode_cts[VP9_INTRA_MODES] = {
/* DC V H D45 D135 D117 D153 D27 D63 TM */
98, 19, 15, 14, 14, 14, 14, 12, 12, 13,
};
static const unsigned int uv_mode_cts[VP9_YMODES][VP9_UV_MODES] = {
static const unsigned int uv_mode_cts[VP9_INTRA_MODES][VP9_INTRA_MODES] = {
/* DC V H D45 135 117 153 D27 D63 TM */
{ 200, 15, 15, 10, 10, 10, 10, 10, 10, 6}, /* DC */
{ 130, 75, 10, 10, 10, 10, 10, 10, 10, 6}, /* V */
@ -34,7 +34,7 @@ static const unsigned int uv_mode_cts[VP9_YMODES][VP9_UV_MODES] = {
{ 160, 30, 30, 10, 10, 10, 10, 10, 10, 16}, /* TM */
};
static const unsigned int kf_uv_mode_cts[VP9_YMODES][VP9_UV_MODES] = {
static const unsigned int kf_uv_mode_cts[VP9_INTRA_MODES][VP9_INTRA_MODES] = {
// DC V H D45 135 117 153 D27 D63 TM
{ 160, 24, 24, 20, 20, 20, 20, 20, 20, 8}, /* DC */
{ 102, 64, 30, 20, 20, 20, 20, 20, 20, 10}, /* V */
@ -70,7 +70,7 @@ const vp9_prob vp9_partition_probs[NUM_PARTITION_CONTEXTS]
};
/* Array indices are identical to previously-existing INTRAMODECONTEXTNODES. */
const vp9_tree_index vp9_intra_mode_tree[VP9_BINTRAMODES * 2 - 2] = {
const vp9_tree_index vp9_intra_mode_tree[VP9_INTRA_MODES * 2 - 2] = {
-DC_PRED, 2, /* 0 = DC_NODE */
-TM_PRED, 4, /* 1 = TM_NODE */
-V_PRED, 6, /* 2 = V_NODE */
@ -94,20 +94,20 @@ const vp9_tree_index vp9_partition_tree[6] = {
-PARTITION_VERT, -PARTITION_SPLIT
};
struct vp9_token vp9_intra_mode_encodings[VP9_BINTRAMODES];
struct vp9_token vp9_intra_mode_encodings[VP9_INTRA_MODES];
struct vp9_token vp9_sb_mv_ref_encoding_array[VP9_MVREFS];
struct vp9_token vp9_partition_encodings[PARTITION_TYPES];
void vp9_init_mbmode_probs(VP9_COMMON *x) {
unsigned int bct[VP9_YMODES][2]; // num Ymodes > num UV modes
unsigned int bct[VP9_INTRA_MODES][2]; // num Ymodes > num UV modes
int i;
vp9_tree_probs_from_distribution(vp9_intra_mode_tree, x->fc.y_mode_prob,
bct, y_mode_cts, 0);
for (i = 0; i < VP9_YMODES; i++) {
for (i = 0; i < VP9_INTRA_MODES; i++) {
vp9_tree_probs_from_distribution(vp9_intra_mode_tree, x->kf_uv_mode_prob[i],
bct, kf_uv_mode_cts[i], 0);
vp9_tree_probs_from_distribution(vp9_intra_mode_tree, x->fc.uv_mode_prob[i],
@ -247,15 +247,15 @@ void vp9_adapt_mode_probs(VP9_COMMON *cm) {
int t;
printf("static const unsigned int\nymode_counts"
"[VP9_YMODES] = {\n");
for (t = 0; t < VP9_YMODES; ++t)
"[VP9_INTRA_MODES] = {\n");
for (t = 0; t < VP9_INTRA_MODES; ++t)
printf("%d, ", fc->ymode_counts[t]);
printf("};\n");
printf("static const unsigned int\nuv_mode_counts"
"[VP9_YMODES] [VP9_UV_MODES] = {\n");
for (i = 0; i < VP9_YMODES; ++i) {
"[VP9_INTRA_MODES] [VP9_INTRA_MODES] = {\n");
for (i = 0; i < VP9_INTRA_MODES; ++i) {
printf(" {");
for (t = 0; t < VP9_UV_MODES; ++t)
for (t = 0; t < VP9_INTRA_MODES; ++t)
printf("%d, ", fc->uv_mode_counts[i][t]);
printf("},\n");
}
@ -277,12 +277,12 @@ void vp9_adapt_mode_probs(VP9_COMMON *cm) {
printf("};\n");
#endif
update_mode_probs(VP9_YMODES, vp9_intra_mode_tree,
update_mode_probs(VP9_INTRA_MODES, vp9_intra_mode_tree,
fc->y_mode_counts, fc->pre_y_mode_prob,
fc->y_mode_prob, 0);
for (i = 0; i < VP9_YMODES; ++i)
update_mode_probs(VP9_UV_MODES, vp9_intra_mode_tree,
for (i = 0; i < VP9_INTRA_MODES; ++i)
update_mode_probs(VP9_INTRA_MODES, vp9_intra_mode_tree,
fc->uv_mode_counts[i], fc->pre_uv_mode_prob[i],
fc->uv_mode_prob[i], 0);

View File

@ -19,14 +19,14 @@
extern int vp9_mv_cont(const int_mv *l, const int_mv *a);
extern const vp9_prob vp9_kf_default_bmode_probs[VP9_BINTRAMODES]
[VP9_BINTRAMODES]
[VP9_BINTRAMODES -1 ];
extern const vp9_prob vp9_kf_default_bmode_probs[VP9_INTRA_MODES]
[VP9_INTRA_MODES]
[VP9_INTRA_MODES -1 ];
extern const vp9_tree_index vp9_intra_mode_tree[];
extern const vp9_tree_index vp9_sb_mv_ref_tree[];
extern struct vp9_token vp9_intra_mode_encodings[VP9_BINTRAMODES];
extern struct vp9_token vp9_intra_mode_encodings[VP9_INTRA_MODES];
/* Inter mode values do not start at zero */

View File

@ -11,9 +11,9 @@
#include "vp9/common/vp9_entropymode.h"
const vp9_prob vp9_kf_default_bmode_probs[VP9_BINTRAMODES]
[VP9_BINTRAMODES]
[VP9_BINTRAMODES-1] = {
const vp9_prob vp9_kf_default_bmode_probs[VP9_INTRA_MODES]
[VP9_INTRA_MODES]
[VP9_INTRA_MODES-1] = {
{ // Above 0
{ 231, 9, 124, 138, 96, 200, 76, 42, 88, }, // left 0
{ 152, 11, 187, 112, 170, 139, 130, 91, 113, }, // left 1

View File

@ -47,17 +47,19 @@ void vp9_initialize_common(void);
#define MAX_LAG_BUFFERS 25
typedef struct frame_contexts {
vp9_prob y_mode_prob[VP9_YMODES - 1]; /* interframe intra mode probs */
vp9_prob uv_mode_prob[VP9_YMODES][VP9_UV_MODES - 1];
vp9_prob y_mode_prob[VP9_INTRA_MODES - 1]; /* interframe intra mode probs */
vp9_prob uv_mode_prob[VP9_INTRA_MODES][VP9_INTRA_MODES - 1];
vp9_prob partition_prob[NUM_PARTITION_CONTEXTS][PARTITION_TYPES - 1];
nmv_context nmvc;
nmv_context pre_nmvc;
vp9_prob pre_y_mode_prob[VP9_YMODES - 1]; /* interframe intra mode probs */
vp9_prob pre_uv_mode_prob[VP9_YMODES][VP9_UV_MODES - 1];
/* interframe intra mode probs */
vp9_prob pre_y_mode_prob[VP9_INTRA_MODES - 1];
vp9_prob pre_uv_mode_prob[VP9_INTRA_MODES][VP9_INTRA_MODES - 1];
vp9_prob pre_partition_prob[NUM_PARTITION_CONTEXTS][PARTITION_TYPES - 1];
unsigned int y_mode_counts[VP9_YMODES]; /* interframe intra mode probs */
unsigned int uv_mode_counts[VP9_YMODES][VP9_UV_MODES];
/* interframe intra mode probs */
unsigned int y_mode_counts[VP9_INTRA_MODES];
unsigned int uv_mode_counts[VP9_INTRA_MODES][VP9_INTRA_MODES];
unsigned int partition_counts[NUM_PARTITION_CONTEXTS][PARTITION_TYPES];
vp9_coeff_probs_model coef_probs_4x4[BLOCK_TYPES];
@ -211,10 +213,10 @@ typedef struct VP9Common {
/* keyframe block modes are predicted by their above, left neighbors */
vp9_prob kf_y_mode_prob[VP9_BINTRAMODES]
[VP9_BINTRAMODES]
[VP9_BINTRAMODES - 1];
vp9_prob kf_uv_mode_prob[VP9_YMODES] [VP9_UV_MODES - 1];
vp9_prob kf_y_mode_prob[VP9_INTRA_MODES]
[VP9_INTRA_MODES]
[VP9_INTRA_MODES - 1];
vp9_prob kf_uv_mode_prob[VP9_INTRA_MODES] [VP9_INTRA_MODES - 1];
vp9_prob prob_intra_coded;
vp9_prob prob_last_coded;

View File

@ -53,7 +53,7 @@ static const unsigned char MB_PREDICTION_MODE_colors[MB_MODE_COUNT][3] = {
{ RGB_TO_YUV(0xCC33FF) }, /* Magenta */
};
static const unsigned char B_PREDICTION_MODE_colors[INTRA_MODE_COUNT][3] = {
static const unsigned char B_PREDICTION_MODE_colors[VP9_INTRA_MODES][3] = {
{ RGB_TO_YUV(0x6633ff) }, /* Purple */
{ RGB_TO_YUV(0xcc33ff) }, /* Magenta */
{ RGB_TO_YUV(0xff33cc) }, /* Pink */

View File

@ -384,9 +384,9 @@ static void mb_mode_mv_init(VP9D_COMP *pbi, vp9_reader *r) {
for (i = 0; i < COMP_PRED_CONTEXTS; i++)
cm->prob_comppred[i] = vp9_read_prob(r);
// VP9_YMODES
// VP9_INTRA_MODES
if (vp9_read_bit(r))
for (i = 0; i < VP9_YMODES - 1; ++i)
for (i = 0; i < VP9_INTRA_MODES - 1; ++i)
cm->fc.y_mode_prob[i] = vp9_read_prob(r);
for (j = 0; j < NUM_PARTITION_CONTEXTS; ++j)

View File

@ -40,9 +40,9 @@ unsigned __int64 Sectionbits[500];
#endif
#ifdef ENTROPY_STATS
int intra_mode_stats[VP9_BINTRAMODES]
[VP9_BINTRAMODES]
[VP9_BINTRAMODES];
int intra_mode_stats[VP9_INTRA_MODES]
[VP9_INTRA_MODES]
[VP9_INTRA_MODES];
vp9_coeff_stats tree_update_hist_4x4[BLOCK_TYPES];
vp9_coeff_stats tree_update_hist_8x8[BLOCK_TYPES];
vp9_coeff_stats tree_update_hist_16x16[BLOCK_TYPES];
@ -245,10 +245,10 @@ static void update_mbintra_mode_probs(VP9_COMP* const cpi,
vp9_writer* const bc) {
VP9_COMMON *const cm = &cpi->common;
vp9_prob pnew[VP9_YMODES - 1];
unsigned int bct[VP9_YMODES - 1][2];
vp9_prob pnew[VP9_INTRA_MODES - 1];
unsigned int bct[VP9_INTRA_MODES - 1][2];
update_mode(bc, VP9_YMODES, vp9_intra_mode_encodings,
update_mode(bc, VP9_INTRA_MODES, vp9_intra_mode_encodings,
vp9_intra_mode_tree, pnew,
cm->fc.y_mode_prob, bct, (unsigned int *)cpi->y_mode_count);
}

View File

@ -116,7 +116,7 @@ struct macroblock {
int mbmode_cost[MB_MODE_COUNT];
int intra_uv_mode_cost[2][MB_MODE_COUNT];
int y_mode_costs[VP9_BINTRAMODES][VP9_BINTRAMODES][VP9_BINTRAMODES];
int y_mode_costs[VP9_INTRA_MODES][VP9_INTRA_MODES][VP9_INTRA_MODES];
int switchable_interp_costs[VP9_SWITCHABLE_FILTERS + 1]
[VP9_SWITCHABLE_FILTERS];

View File

@ -20,8 +20,8 @@ void vp9_init_mode_costs(VP9_COMP *c) {
const vp9_tree_p KT = vp9_intra_mode_tree;
int i, j;
for (i = 0; i < VP9_BINTRAMODES; i++) {
for (j = 0; j < VP9_BINTRAMODES; j++) {
for (i = 0; i < VP9_INTRA_MODES; i++) {
for (j = 0; j < VP9_INTRA_MODES; j++) {
vp9_cost_tokens((int *)c->mb.y_mode_costs[i][j],
x->kf_y_mode_prob[i][j], KT);
}
@ -31,9 +31,9 @@ void vp9_init_mode_costs(VP9_COMP *c) {
vp9_cost_tokens(c->mb.mbmode_cost, x->fc.y_mode_prob,
vp9_intra_mode_tree);
vp9_cost_tokens(c->mb.intra_uv_mode_cost[1],
x->fc.uv_mode_prob[VP9_YMODES - 1], vp9_intra_mode_tree);
x->fc.uv_mode_prob[VP9_INTRA_MODES - 1], vp9_intra_mode_tree);
vp9_cost_tokens(c->mb.intra_uv_mode_cost[0],
x->kf_uv_mode_prob[VP9_YMODES - 1], vp9_intra_mode_tree);
x->kf_uv_mode_prob[VP9_INTRA_MODES - 1], vp9_intra_mode_tree);
for (i = 0; i <= VP9_SWITCHABLE_FILTERS; ++i)
vp9_cost_tokens((int *)c->mb.switchable_interp_costs[i],

View File

@ -103,9 +103,9 @@ extern int skip_false_count;
#ifdef ENTROPY_STATS
extern int intra_mode_stats[VP9_BINTRAMODES]
[VP9_BINTRAMODES]
[VP9_BINTRAMODES];
extern int intra_mode_stats[VP9_INTRA_MODES]
[VP9_INTRA_MODES]
[VP9_INTRA_MODES];
#endif
#ifdef NMV_STATS
@ -1753,18 +1753,18 @@ void vp9_remove_compressor(VP9_PTR *ptr) {
fprintf(fmode, "\n#include \"vp9_entropymode.h\"\n\n");
fprintf(fmode, "const unsigned int vp9_kf_default_bmode_counts ");
fprintf(fmode, "[VP9_BINTRAMODES][VP9_BINTRAMODES]"
"[VP9_BINTRAMODES] =\n{\n");
fprintf(fmode, "[VP9_INTRA_MODES][VP9_INTRA_MODES]"
"[VP9_INTRA_MODES] =\n{\n");
for (i = 0; i < VP9_BINTRAMODES; i++) {
for (i = 0; i < VP9_INTRA_MODES; i++) {
fprintf(fmode, " { // Above Mode : %d\n", i);
for (j = 0; j < VP9_BINTRAMODES; j++) {
for (j = 0; j < VP9_INTRA_MODES; j++) {
fprintf(fmode, " {");
for (k = 0; k < VP9_BINTRAMODES; k++) {
for (k = 0; k < VP9_INTRA_MODES; k++) {
if (!intra_mode_stats[i][j][k])
fprintf(fmode, " %5d, ", 1);
else

View File

@ -81,8 +81,8 @@ typedef struct {
vp9_coeff_probs_model coef_probs_16x16[BLOCK_TYPES];
vp9_coeff_probs_model coef_probs_32x32[BLOCK_TYPES];
vp9_prob y_mode_prob[VP9_YMODES - 1]; /* interframe intra mode probs */
vp9_prob uv_mode_prob[VP9_YMODES][VP9_UV_MODES - 1];
vp9_prob y_mode_prob[VP9_INTRA_MODES - 1]; /* interframe intra mode probs */
vp9_prob uv_mode_prob[VP9_INTRA_MODES][VP9_INTRA_MODES - 1];
vp9_prob partition_prob[NUM_PARTITION_CONTEXTS][PARTITION_TYPES - 1];
vp9_prob switchable_interp_prob[VP9_SWITCHABLE_FILTERS + 1]
@ -411,8 +411,8 @@ typedef struct VP9_COMP {
int cq_target_quality;
int y_mode_count[VP9_YMODES];
int y_uv_mode_count[VP9_YMODES][VP9_UV_MODES];
int y_mode_count[VP9_INTRA_MODES];
int y_uv_mode_count[VP9_INTRA_MODES][VP9_INTRA_MODES];
unsigned int partition_count[NUM_PARTITION_CONTEXTS][PARTITION_TYPES];
nmv_context_counts NMVcount;