Commit 0aa79be7 authored by Deb Mukherjee's avatar Deb Mukherjee
Browse files

Removes the code_nonzerocount experiment

This patch does not seem to give any benefits.

Change-Id: I9d2b4091d6af3dfc0875f24db86c01e2de57f8db
parent 70d9f116
......@@ -243,7 +243,6 @@ EXPERIMENT_LIST="
newbintramodes
comp_interintra_pred
enable_6tap
code_nonzerocount
modelcoefprob
loop_dering
implicit_compoundinter_weight
......
......@@ -282,9 +282,6 @@ typedef struct {
INTERPOLATIONFILTERTYPE interp_filter;
BLOCK_SIZE_TYPE sb_type;
#if CONFIG_CODE_NONZEROCOUNT
uint16_t nzcs[256+64*2];
#endif
} MB_MODE_INFO;
typedef struct {
......@@ -363,9 +360,6 @@ struct mb_plane {
BLOCK_OFFSET((x)->plane[2].field, ((i) - 20), 16))
typedef struct macroblockd {
#if CONFIG_CODE_NONZEROCOUNT
DECLARE_ALIGNED(16, uint16_t, nzcs[256+64*2]);
#endif
struct mb_plane plane[MAX_MB_PLANE];
/* 16 Y blocks, 4 U, 4 V, each with 16 entries. */
......@@ -753,12 +747,6 @@ static TX_SIZE get_uv_tx_size(const MACROBLOCKD *xd) {
return size;
}
#if CONFIG_CODE_NONZEROCOUNT
static int get_nzc_used(TX_SIZE tx_size) {
return (tx_size >= TX_16X16);
}
#endif
struct plane_block_idx {
int plane;
int block;
......
......@@ -18,14 +18,6 @@ static const vp9_prob vp9_coef_update_prob[ENTROPY_NODES] = {
252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252
};
#if CONFIG_CODE_NONZEROCOUNT
#define NZC_UPDATE_PROB_4X4 252
#define NZC_UPDATE_PROB_8X8 252
#define NZC_UPDATE_PROB_16X16 252
#define NZC_UPDATE_PROB_32X32 252
#define NZC_UPDATE_PROB_PCAT 252
#endif
#if CONFIG_CODE_ZEROGROUP
#define ZPC_UPDATE_PROB 248
#endif
......
......@@ -700,302 +700,6 @@ static const vp9_coeff_probs default_coef_probs_32x32[BLOCK_TYPES] = {
}
};
#if CONFIG_CODE_NONZEROCOUNT
// TODO(debargha): Remove the macro and count tables after experimentation
#define NZC_DEFAULT_COUNTS /* Uncomment to use counts as defaults */
#ifdef NZC_DEFAULT_COUNTS
static const unsigned int default_nzc_counts_4x4[MAX_NZC_CONTEXTS]
[REF_TYPES]
[BLOCK_TYPES]
[NZC4X4_TOKENS] = {
{
{
{ 967652, 29023, 15039, 6952, 1568, 116 },
{ 289116, 22938, 4522, 1935, 520, 47 }
}, {
{ 967652, 29023, 15039, 6952, 1568, 116 },
{ 689116, 22938, 4522, 1935, 520, 47 }
},
}, {
{
{ 124684, 37167, 15270, 8483, 1777, 102 },
{ 10405, 12395, 3401, 3574, 2461, 771 }
}, {
{ 124684, 37167, 15270, 8483, 1777, 102 },
{ 20405, 12395, 3401, 3574, 2461, 771 }
}
}, {
{
{ 4100, 22976, 15627, 16137, 7982, 1793 },
{ 4249, 3084, 2131, 4081, 6439, 1653 }
}, {
{ 21100, 22976, 15627, 16137, 7982, 1793 },
{ 4249, 3084, 2131, 4081, 2439, 1653 }
}
}
};
static const unsigned int default_nzc_counts_8x8[MAX_NZC_CONTEXTS]
[REF_TYPES]
[BLOCK_TYPES]
[NZC8X8_TOKENS] = {
{
{
{ 372988, 62777, 19440, 11812, 5145, 1917, 439, 10 },
{ 72052, 30468, 6973, 3250, 1500, 750, 375, 5 },
}, {
{ 372988, 62777, 19440, 11812, 5145, 1917, 439, 10 },
{ 192052, 30468, 6973, 3250, 1500, 750, 375, 5 },
}
}, {
{
{ 121533, 33527, 15655, 11920, 5723, 2009, 315, 7 },
{ 23772, 23120, 13127, 8115, 4000, 2000, 200, 6 },
}, {
{ 121533, 33527, 15655, 11920, 5723, 2009, 315, 7 },
{ 23772, 23120, 13127, 8115, 4000, 2000, 200, 6 },
}
}, {
{
{ 29408, 11758, 8023, 10123, 6705, 2468, 369, 17 },
{ 11612, 13874, 13329, 13022, 6500, 3250, 300, 12 },
}, {
{ 29408, 11758, 8023, 10123, 6705, 2468, 369, 17 },
{ 11612, 13874, 13329, 13022, 6500, 3250, 300, 12 },
}
}
};
static const unsigned int default_nzc_counts_16x16[MAX_NZC_CONTEXTS]
[REF_TYPES]
[BLOCK_TYPES]
[NZC16X16_TOKENS] = {
{
{
{ 372988, 62777, 19440, 11812, 5145, 1917, 439, 10, 5, 2 },
{ 72052, 30468, 6973, 3250, 1500, 750, 375, 50, 8, 1 },
}, {
{ 32988, 62777, 19440, 11812, 5145, 1917, 439, 10, 5, 2 },
{ 92052, 30468, 6973, 3250, 1500, 750, 375, 50, 8, 1 },
}
}, {
{
{ 21533, 33527, 15655, 11920, 5723, 2009, 315, 7, 4, 2 },
{ 47772, 23120, 13127, 8115, 4000, 2000, 200, 6, 4, 2 },
}, {
{ 21533, 33527, 15655, 11920, 5723, 2009, 315, 7, 4, 2 },
{ 27772, 23120, 13127, 8115, 4000, 2000, 200, 6, 4, 2 },
}
}, {
{
{ 19408, 31758, 16023, 10123, 6705, 2468, 369, 17, 10, 5 },
{ 9612, 13874, 13329, 13022, 6500, 3250, 300, 12, 6, 3 },
}, {
{ 22408, 11758, 8023, 10123, 6705, 2468, 369, 17, 10, 5 },
{ 9612, 13874, 13329, 13022, 6500, 3250, 300, 12, 6, 3 },
}
}
};
static const unsigned int default_nzc_counts_32x32[MAX_NZC_CONTEXTS]
[REF_TYPES]
[BLOCK_TYPES]
[NZC32X32_TOKENS] = {
{
{
{ 72988, 62777, 19440, 11812, 5145, 1917, 439, 10, 5, 2, 1, 0 },
{ 52052, 30468, 6973, 3250, 1500, 750, 375, 50, 8, 1, 0, 0 },
}, {
{ 72988, 62777, 19440, 11812, 5145, 1917, 439, 10, 5, 2, 1, 0 },
{ 72052, 30468, 6973, 3250, 1500, 750, 375, 50, 8, 1, 0, 0 },
}
}, {
{
{ 21533, 33527, 15655, 11920, 5723, 2009, 315, 7, 4, 2, 1, 0 },
{ 27772, 23120, 13127, 8115, 4000, 2000, 200, 6, 4, 2, 1, 0 },
}, {
{ 21533, 33527, 15655, 11920, 5723, 2009, 315, 7, 4, 2, 1, 0 },
{ 27772, 23120, 13127, 8115, 4000, 2000, 200, 6, 4, 2, 1, 0 },
}
}, {
{
{ 19408, 11758, 8023, 10123, 6705, 2468, 369, 17, 10, 5, 2, 1 },
{ 9612, 13874, 13329, 13022, 6500, 3250, 300, 12, 6, 3, 2, 1 },
}, {
{ 29408, 11758, 8023, 10123, 6705, 2468, 369, 17, 10, 5, 2, 1 },
{ 9612, 13874, 13329, 13022, 6500, 3250, 300, 12, 6, 3, 2, 1 },
}
}
};
#else
static const vp9_prob default_nzc_probs_4x4[MAX_NZC_CONTEXTS]
[REF_TYPES]
[BLOCK_TYPES]
[NZC4X4_TOKENS] = {
{
{
{ 219, 162, 179, 142, 242, },
{ 214, 253, 228, 246, 255, },
}, {
{ 225, 236, 190, 229, 253, },
{ 251, 253, 240, 248, 255, },
},
}, {
{
{ 106, 126, 158, 126, 244, },
{ 118, 241, 201, 240, 255, },
}, {
{ 165, 179, 143, 189, 242, },
{ 173, 239, 192, 255, 128, },
},
}, {
{
{ 42 , 78 , 153, 92 , 223, },
{ 128, 128, 128, 128, 128, },
}, {
{ 76 , 68 , 126, 110, 216, },
{ 128, 128, 128, 128, 128, },
},
},
};
static const vp9_prob default_nzc_probs_8x8[MAX_NZC_CONTEXTS]
[REF_TYPES]
[BLOCK_TYPES]
[NZC8X8_TOKENS] = {
{
{
{ 134, 139, 170, 178, 142, 197, 255, },
{ 167, 224, 199, 252, 205, 255, 128, },
}, {
{ 181, 210, 180, 241, 190, 235, 255, },
{ 234, 251, 235, 252, 219, 255, 128, },
},
}, {
{
{ 33 , 64 , 155, 143, 86 , 216, 255, },
{ 73 , 160, 167, 251, 153, 255, 128, },
}, {
{ 79 , 104, 153, 195, 119, 246, 255, },
{ 149, 183, 186, 249, 203, 255, 128, },
},
}, {
{
{ 10 , 25 , 156, 61 , 69 , 156, 254, },
{ 32 , 1 , 128, 146, 64 , 255, 128, },
}, {
{ 37 , 48 , 143, 113, 81 , 202, 255, },
{ 1 , 255, 128, 128, 128, 128, 128, },
},
},
};
static const vp9_prob default_nzc_probs_16x16[MAX_NZC_CONTEXTS]
[REF_TYPES]
[BLOCK_TYPES]
[NZC16X16_TOKENS] = {
{
{
{ 11 , 188, 210, 167, 141, 143, 152, 255, 128, },
{ 171, 201, 203, 244, 207, 255, 255, 128, 128, },
}, {
{ 23 , 217, 207, 251, 198, 255, 219, 128, 128, },
{ 235, 249, 229, 255, 199, 128, 128, 128, 128, },
},
}, {
{
{ 9 , 45 , 168, 85 , 66 , 221, 139, 246, 255, },
{ 51 , 110, 163, 238, 94 , 255, 255, 128, 128, },
}, {
{ 4 , 149, 175, 240, 149, 255, 205, 128, 128, },
{ 141, 217, 186, 255, 128, 128, 128, 128, 128, },
},
}, {
{
{ 1 , 12 , 173, 6 , 68 , 145, 41 , 204, 255, },
{ 39 , 47 , 128, 199, 110, 255, 128, 128, 128, },
}, {
{ 1 , 121, 171, 149, 115, 242, 159, 255, 128, },
{ 1 , 255, 255, 128, 128, 128, 128, 128, 128, },
},
},
};
static const vp9_prob default_nzc_probs_32x32[MAX_NZC_CONTEXTS]
[REF_TYPES]
[BLOCK_TYPES]
[NZC32X32_TOKENS] = {
{
{
{ 11 , 216, 195, 201, 160, 247, 217, 255, 255, 128, 128, },
{ 177, 240, 239, 255, 192, 128, 128, 128, 128, 128, 128, },
}, {
{ 48 , 235, 213, 235, 199, 255, 255, 128, 128, 128, 128, },
{ 205, 255, 248, 128, 128, 128, 128, 128, 128, 128, 128, },
},
}, {
{
{ 6 , 96 , 138, 99 , 125, 248, 188, 255, 128, 128, 128, },
{ 17 , 53 , 43 , 189, 1 , 255, 171, 128, 128, 128, 128, },
}, {
{ 5 , 187, 235, 232, 117, 255, 219, 128, 128, 128, 128, },
{ 146, 255, 255, 128, 128, 128, 128, 128, 128, 128, 128, },
},
}, {
{
{ 1 , 7 , 93 , 14 , 100, 30 , 85 , 65 , 81 , 210, 255, },
{ 1 , 1 , 128, 26 , 1 , 218, 78 , 255, 255, 128, 128, },
}, {
{ 4 , 148, 206, 137, 160, 255, 255, 128, 128, 128, 128, },
{ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, },
},
},
};
#endif
static const vp9_prob default_nzc_pcat_probs[MAX_NZC_CONTEXTS]
[NZC_TOKENS_EXTRA]
[NZC_BITS_EXTRA] = {
// Bit probabilities are in least to most significance order
{
{176, 128, 128, 128, 128, 128, 128, 128, 128}, // 3 - 4
{164, 192, 128, 128, 128, 128, 128, 128, 128}, // 5 - 8
{154, 184, 208, 128, 128, 128, 128, 128, 128}, // 9 - 16
{144, 176, 200, 216, 128, 128, 128, 128, 128}, // 17 - 32
{140, 172, 192, 208, 224, 128, 128, 128, 128}, // 33 - 64
{136, 168, 188, 200, 220, 232, 128, 128, 128}, // 65 - 128
{132, 164, 184, 196, 216, 228, 240, 128, 128}, // 129 - 256
{130, 162, 178, 194, 212, 226, 240, 248, 128}, // 257 - 512
{128, 160, 176, 192, 208, 224, 240, 248, 254}, // 513 - 1024
}, {
{168, 128, 128, 128, 128, 128, 128, 128, 128}, // 3 - 4
{152, 184, 128, 128, 128, 128, 128, 128, 128}, // 5 - 8
{152, 184, 208, 128, 128, 128, 128, 128, 128}, // 9 - 16
{144, 176, 200, 216, 128, 128, 128, 128, 128}, // 17 - 32
{140, 172, 192, 208, 224, 128, 128, 128, 128}, // 33 - 64
{136, 168, 188, 200, 220, 232, 128, 128, 128}, // 65 - 128
{132, 164, 184, 196, 216, 228, 240, 128, 128}, // 129 - 256
{130, 162, 178, 194, 212, 226, 240, 248, 128}, // 257 - 512
{128, 160, 176, 192, 208, 224, 240, 248, 254}, // 513 - 1024
}, {
{160, 128, 128, 128, 128, 128, 128, 128, 128}, // 3 - 4
{152, 176, 128, 128, 128, 128, 128, 128, 128}, // 5 - 8
{150, 184, 208, 128, 128, 128, 128, 128, 128}, // 9 - 16
{144, 176, 200, 216, 128, 128, 128, 128, 128}, // 17 - 32
{140, 172, 192, 208, 224, 128, 128, 128, 128}, // 33 - 64
{136, 168, 188, 200, 220, 232, 128, 128, 128}, // 65 - 128
{132, 164, 184, 196, 216, 228, 240, 128, 128}, // 129 - 256
{130, 162, 178, 194, 212, 226, 240, 248, 128}, // 257 - 512
{128, 160, 176, 192, 208, 224, 240, 248, 254}, // 513 - 1024
},
};
#endif // CONFIG_CODE_NONZEROCOUNT
#if CONFIG_CODE_ZEROGROUP
// There are two probs: the first is the prob(0) of the isolated zero bit,
......
......@@ -400,65 +400,6 @@ static const vp9_prob Pcat6[] = {
254, 254, 254, 252, 249, 243, 230, 196, 177, 153, 140, 133, 130, 129
};
#if CONFIG_CODE_NONZEROCOUNT
const vp9_tree_index vp9_nzc4x4_tree[2 * NZC4X4_NODES] = {
-NZC_0, 2,
4, 6,
-NZC_1, -NZC_2,
-NZC_3TO4, 8,
-NZC_5TO8, -NZC_9TO16,
};
struct vp9_token vp9_nzc4x4_encodings[NZC4X4_TOKENS];
const vp9_tree_index vp9_nzc8x8_tree[2 * NZC8X8_NODES] = {
-NZC_0, 2,
4, 6,
-NZC_1, -NZC_2,
8, 10,
-NZC_3TO4, -NZC_5TO8,
-NZC_9TO16, 12,
-NZC_17TO32, -NZC_33TO64,
};
struct vp9_token vp9_nzc8x8_encodings[NZC8X8_TOKENS];
const vp9_tree_index vp9_nzc16x16_tree[2 * NZC16X16_NODES] = {
-NZC_0, 2,
4, 6,
-NZC_1, -NZC_2,
8, 10,
-NZC_3TO4, -NZC_5TO8,
12, 14,
-NZC_9TO16, -NZC_17TO32,
-NZC_33TO64, 16,
-NZC_65TO128, -NZC_129TO256,
};
struct vp9_token vp9_nzc16x16_encodings[NZC16X16_TOKENS];
const vp9_tree_index vp9_nzc32x32_tree[2 * NZC32X32_NODES] = {
-NZC_0, 2,
4, 6,
-NZC_1, -NZC_2,
8, 10,
-NZC_3TO4, -NZC_5TO8,
12, 14,
-NZC_9TO16, -NZC_17TO32,
16, 18,
-NZC_33TO64, -NZC_65TO128,
-NZC_129TO256, 20,
-NZC_257TO512, -NZC_513TO1024,
};
struct vp9_token vp9_nzc32x32_encodings[NZC32X32_TOKENS];
const int vp9_extranzcbits[NZC32X32_TOKENS] = {
0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
};
const int vp9_basenzcvalue[NZC32X32_TOKENS] = {
0, 1, 2, 3, 5, 9, 17, 33, 65, 129, 257, 513
};
#endif // CONFIG_CODE_NONZEROCOUNT
#if CONFIG_MODELCOEFPROB
#if UNCONSTRAINED_NODES == 2
......@@ -1357,55 +1298,6 @@ void vp9_default_coef_probs(VP9_COMMON *pc) {
#if CONFIG_MODELCOEFPROB
int b, r, c, p;
#endif
#if CONFIG_CODE_NONZEROCOUNT
#ifdef NZC_DEFAULT_COUNTS
int h, g;
for (h = 0; h < MAX_NZC_CONTEXTS; ++h) {
for (g = 0; g < REF_TYPES; ++g) {
int i;
unsigned int branch_ct4x4[NZC4X4_NODES][2];
unsigned int branch_ct8x8[NZC8X8_NODES][2];
unsigned int branch_ct16x16[NZC16X16_NODES][2];
unsigned int branch_ct32x32[NZC32X32_NODES][2];
for (i = 0; i < BLOCK_TYPES; ++i) {
vp9_tree_probs_from_distribution(
vp9_nzc4x4_tree,
pc->fc.nzc_probs_4x4[h][g][i], branch_ct4x4,
default_nzc_counts_4x4[h][g][i], 0);
}
for (i = 0; i < BLOCK_TYPES; ++i) {
vp9_tree_probs_from_distribution(
vp9_nzc8x8_tree,
pc->fc.nzc_probs_8x8[h][g][i], branch_ct8x8,
default_nzc_counts_8x8[h][g][i], 0);
}
for (i = 0; i < BLOCK_TYPES; ++i) {
vp9_tree_probs_from_distribution(
vp9_nzc16x16_tree,
pc->fc.nzc_probs_16x16[h][g][i], branch_ct16x16,
default_nzc_counts_16x16[h][g][i], 0);
}
for (i = 0; i < BLOCK_TYPES; ++i) {
vp9_tree_probs_from_distribution(
vp9_nzc32x32_tree,
pc->fc.nzc_probs_32x32[h][g][i], branch_ct32x32,
default_nzc_counts_32x32[h][g][i], 0);
}
}
}
#else
vpx_memcpy(pc->fc.nzc_probs_4x4, default_nzc_probs_4x4,
sizeof(pc->fc.nzc_probs_4x4));
vpx_memcpy(pc->fc.nzc_probs_8x8, default_nzc_probs_8x8,
sizeof(pc->fc.nzc_probs_8x8));
vpx_memcpy(pc->fc.nzc_probs_16x16, default_nzc_probs_16x16,
sizeof(pc->fc.nzc_probs_16x16));
vpx_memcpy(pc->fc.nzc_probs_32x32, default_nzc_probs_32x32,
sizeof(pc->fc.nzc_probs_32x32));
#endif
vpx_memcpy(pc->fc.nzc_pcat_probs, default_nzc_pcat_probs,
sizeof(pc->fc.nzc_pcat_probs));
#endif // CONFIG_CODE_NONZEROCOUNT
#if CONFIG_MODELCOEFPROB
for (b = 0; b < BLOCK_TYPES; ++b)
for (r = 0; r < REF_TYPES; ++r)
......@@ -1607,1099 +1499,8 @@ void vp9_coef_tree_initialize() {
vp9_init_neighbors();
init_bit_trees();
vp9_tokens_from_tree(vp9_coef_encodings, vp9_coef_tree);
#if CONFIG_CODE_NONZEROCOUNT
vp9_tokens_from_tree(vp9_nzc4x4_encodings, vp9_nzc4x4_tree);
vp9_tokens_from_tree(vp9_nzc8x8_encodings, vp9_nzc8x8_tree);
vp9_tokens_from_tree(vp9_nzc16x16_encodings, vp9_nzc16x16_tree);
vp9_tokens_from_tree(vp9_nzc32x32_encodings, vp9_nzc32x32_tree);
#endif
}
#if CONFIG_CODE_NONZEROCOUNT
#define mb_in_cur_tile(cm, mb_row, mb_col) \
((mb_col) >= (cm)->cur_tile_mb_col_start && \
(mb_col) <= (cm)->cur_tile_mb_col_end && \
(mb_row) >= 0)
#define choose_nzc_context(nzc_exp, t2, t1) \
((nzc_exp) >= (t2) ? 2 : (nzc_exp) >= (t1) ? 1 : 0)
#define NZC_T2_32X32 (16 << 6)
#define NZC_T1_32X32 (4 << 6)
#define NZC_T2_16X16 (12 << 6)
#define NZC_T1_16X16 (3 << 6)
#define NZC_T2_8X8 (8 << 6)
#define NZC_T1_8X8 (2 << 6)
#define NZC_T2_4X4 (4 << 6)
#define NZC_T1_4X4 (1 << 6)
// Transforms a mb16 block index to a sb64 block index
static inline int mb16_to_sb64_index(int mb_row, int mb_col, int block) {
int r = (mb_row & 3);
int c = (mb_col & 3);
int b;
if (block < 16) { // Y
int ib = block >> 2;
int jb = block & 3;
ib += r * 4;
jb += c * 4;
b = ib * 16 + jb;
assert(b < 256);
return b;
} else { // UV
int base = block - (block & 3);
int ib = (block - base) >> 1;
int jb = (block - base) & 1;
ib += r * 2;
jb += c * 2;
b = base * 16 + ib * 8 + jb;
assert(b >= 256 && b < 384);
return b;
}
}
// Transforms a mb16 block index to a sb32 block index
static inline int mb16_to_sb32_index(int mb_row, int mb_col, int block) {
int r = (mb_row & 1);
int c = (mb_col & 1);
int b;
if (block < 16) { // Y
int ib = block >> 2;
int jb = block & 3;
ib += r * 4;
jb += c * 4;
b = ib * 8 + jb;
assert(b < 64);
return b;
} else { // UV
int base = block - (block & 3);
int ib = (block - base) >> 1;
int jb = (block - base) & 1;
ib += r * 2;
jb += c * 2;
b = base * 4 + ib * 4 + jb;
assert(b >= 64 && b < 96);
return b;
}
}
static inline int block_to_txfm_index(int block, TX_SIZE tx_size, int s) {
// s is the log of the number of 4x4 blocks in each row/col of larger block
int b, ib, jb, nb;
ib = block >> s;
jb = block - (ib << s);
ib >>= tx_size;
jb >>= tx_size;
nb = 1 << (s - tx_size);
b = (ib * nb + jb) << (2 * tx_size);
return b;
}
/* BEGIN - Helper functions to get the y nzcs */
static unsigned int get_nzc_4x4_y_sb64(MB_MODE_INFO *mi, int block) {
int b;
assert(block < 256);