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

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,
......
This diff is collapsed.
......@@ -167,89 +167,6 @@ void vp9_get_model_distribution(vp9_prob model, vp9_prob *tree_probs,
int b, int r);
#endif // CONFIG_MODELCOEFPROB
#if CONFIG_CODE_NONZEROCOUNT
/* Alphabet for number of non-zero symbols in block */
#define NZC_0 0 /* Used for all blocks */
#define NZC_1 1 /* Used for all blocks */
#define NZC_2 2 /* Used for all blocks */
#define NZC_3TO4 3 /* Used for all blocks */
#define NZC_5TO8 4 /* Used for all blocks */
#define NZC_9TO16 5 /* Used for all blocks */
#define NZC_17TO32 6 /* Used for 8x8 and larger blocks */
#define NZC_33TO64 7 /* Used for 8x8 and larger blocks */
#define NZC_65TO128 8 /* Used for 16x16 and larger blocks */
#define NZC_129TO256 9 /* Used for 16x16 and larger blocks */
#define NZC_257TO512 10 /* Used for 32x32 and larger blocks */
#define NZC_513TO1024 11 /* Used for 32x32 and larger blocks */
/* Number of tokens for each block size */
#define NZC4X4_TOKENS 6
#define NZC8X8_TOKENS 8
#define NZC16X16_TOKENS 10
#define NZC32X32_TOKENS 12
/* Number of nodes for each block size */
#define NZC4X4_NODES 5
#define NZC8X8_NODES 7
#define NZC16X16_NODES 9
#define NZC32X32_NODES 11
/* Max number of tokens with extra bits */
#define NZC_TOKENS_EXTRA 9
/* Max number of extra bits */
#define NZC_BITS_EXTRA 9
/* Tokens without extra bits */
#define NZC_TOKENS_NOEXTRA (NZC32X32_TOKENS - NZC_TOKENS_EXTRA)
#define MAX_NZC_CONTEXTS 3
/* whether to update extra bit probabilities */
#define NZC_PCAT_UPDATE
/* nzc trees */
extern const vp9_tree_index vp9_nzc4x4_tree[];
extern const vp9_tree_index vp9_nzc8x8_tree[];
extern const vp9_tree_index vp9_nzc16x16_tree[];
extern const vp9_tree_index vp9_nzc32x32_tree[];
/* nzc encodings */
extern struct vp9_token vp9_nzc4x4_encodings[NZC4X4_TOKENS];
extern struct vp9_token vp9_nzc8x8_encodings[NZC8X8_TOKENS];
extern struct vp9_token vp9_nzc16x16_encodings[NZC16X16_TOKENS];
extern struct vp9_token vp9_nzc32x32_encodings[NZC32X32_TOKENS];
#define codenzc(x) (\
(x) <= 3 ? (x) : (x) <= 4 ? 3 : (x) <= 8 ? 4 : \
(x) <= 16 ? 5 : (x) <= 32 ? 6 : (x) <= 64 ? 7 :\
(x) <= 128 ? 8 : (x) <= 256 ? 9 : (x) <= 512 ? 10 : 11)
int vp9_get_nzc_context_y_sb64(struct VP9Common *cm, MODE_INFO *cur,
int mb_row, int mb_col, int block);
int vp9_get_nzc_context_y_sb32(struct VP9Common *cm, MODE_INFO *cur,
int mb_row, int mb_col, int block);
int vp9_get_nzc_context_y_mb16(struct VP9Common *cm, MODE_INFO *cur,
int mb_row, int mb_col, int block);
int vp9_get_nzc_context_uv_sb64(struct VP9Common *cm, MODE_INFO *cur,
int mb_row, int mb_col, int block);
int vp9_get_nzc_context_uv_sb32(struct VP9Common *cm, MODE_INFO *cur,
int mb_row, int mb_col, int block);
int vp9_get_nzc_context_uv_mb16(struct VP9Common *cm, MODE_INFO *cur,
int mb_row, int mb_col, int block);
int vp9_get_nzc_context(struct VP9Common *cm, MACROBLOCKD *xd, int block);
void vp9_update_nzc_counts(struct VP9Common *cm, MACROBLOCKD *xd,
int mb_row, int mb_col);
void vp9_adapt_nzc_probs(struct VP9Common *cm);
/* Extra bits array */
extern const int vp9_extranzcbits[NZC32X32_TOKENS];
/* Base nzc values */
extern const int vp9_basenzcvalue[NZC32X32_TOKENS];
#endif // CONFIG_CODE_NONZEROCOUNT
#if CONFIG_CODE_ZEROGROUP
#define ZPC_STATS
......
......@@ -74,18 +74,6 @@ typedef struct frame_contexts {
vp9_coeff_probs coef_probs_8x8[BLOCK_TYPES];
vp9_coeff_probs coef_probs_16x16[BLOCK_TYPES];
vp9_coeff_probs coef_probs_32x32[BLOCK_TYPES];
#if CONFIG_CODE_NONZEROCOUNT
vp9_prob nzc_probs_4x4[MAX_NZC_CONTEXTS][REF_TYPES][BLOCK_TYPES]
[NZC4X4_NODES];
vp9_prob nzc_probs_8x8[MAX_NZC_CONTEXTS][REF_TYPES][BLOCK_TYPES]
[NZC8X8_NODES];
vp9_prob nzc_probs_16x16[MAX_NZC_CONTEXTS][REF_TYPES][BLOCK_TYPES]
[NZC16X16_NODES];
vp9_prob nzc_probs_32x32[MAX_NZC_CONTEXTS][REF_TYPES][BLOCK_TYPES]
[NZC32X32_NODES];
vp9_prob nzc_pcat_probs[MAX_NZC_CONTEXTS]
[NZC_TOKENS_EXTRA][NZC_BITS_EXTRA];
#endif
#if CONFIG_CODE_ZEROGROUP
vp9_zpc_probs zpc_probs_4x4;
vp9_zpc_probs zpc_probs_8x8;
......@@ -116,18 +104,6 @@ typedef struct frame_contexts {
vp9_coeff_probs pre_coef_probs_8x8[BLOCK_TYPES];
vp9_coeff_probs pre_coef_probs_16x16[BLOCK_TYPES];
vp9_coeff_probs pre_coef_probs_32x32[BLOCK_TYPES];
#if CONFIG_CODE_NONZEROCOUNT
vp9_prob pre_nzc_probs_4x4[MAX_NZC_CONTEXTS][REF_TYPES][BLOCK_TYPES]
[NZC4X4_NODES];
vp9_prob pre_nzc_probs_8x8[MAX_NZC_CONTEXTS][REF_TYPES][BLOCK_TYPES]
[NZC8X8_NODES];
vp9_prob pre_nzc_probs_16x16[MAX_NZC_CONTEXTS][REF_TYPES][BLOCK_TYPES]
[NZC16X16_NODES];
vp9_prob pre_nzc_probs_32x32[MAX_NZC_CONTEXTS][REF_TYPES][BLOCK_TYPES]
[NZC32X32_NODES];
vp9_prob pre_nzc_pcat_probs[MAX_NZC_CONTEXTS]
[NZC_TOKENS_EXTRA][NZC_BITS_EXTRA];
#endif
#if CONFIG_CODE_ZEROGROUP
vp9_zpc_probs pre_zpc_probs_4x4;
vp9_zpc_probs pre_zpc_probs_8x8;
......@@ -142,18 +118,6 @@ typedef struct frame_contexts {
unsigned int eob_branch_counts[TX_SIZE_MAX_SB][BLOCK_TYPES][REF_TYPES]
[COEF_BANDS][PREV_COEF_CONTEXTS];
#if CONFIG_CODE_NONZEROCOUNT
unsigned int nzc_counts_4x4[MAX_NZC_CONTEXTS][REF_TYPES][BLOCK_TYPES]
[NZC4X4_TOKENS];
unsigned int nzc_counts_8x8[MAX_NZC_CONTEXTS][REF_TYPES][BLOCK_TYPES]
[NZC8X8_TOKENS];
unsigned int nzc_counts_16x16[MAX_NZC_CONTEXTS][REF_TYPES][BLOCK_TYPES]
[NZC16X16_TOKENS];
unsigned int nzc_counts_32x32[MAX_NZC_CONTEXTS][REF_TYPES][BLOCK_TYPES]
[NZC32X32_TOKENS];
unsigned int nzc_pcat_counts[MAX_NZC_CONTEXTS]
[NZC_TOKENS_EXTRA][NZC_BITS_EXTRA][2];
#endif
#if CONFIG_CODE_ZEROGROUP
vp9_zpc_count zpc_counts_4x4;
vp9_zpc_count zpc_counts_8x8;
......
......@@ -1018,258 +1018,6 @@ void vp9_decode_mode_mvs_init(VP9D_COMP* const pbi, vp9_reader *r) {
mb_mode_mv_init(pbi, r);
}
#if CONFIG_CODE_NONZEROCOUNT
static uint16_t read_nzc(VP9_COMMON *const cm,
int nzc_context,
TX_SIZE tx_size,
int ref,
int type,
vp9_reader *r) {
int c, e;
uint16_t nzc;
if (!get_nzc_used(tx_size)) return 0;
if (tx_size == TX_32X32) {
c = treed_read(r, vp9_nzc32x32_tree,
cm->fc.nzc_probs_32x32[nzc_context][ref][type]);
cm->fc.nzc_counts_32x32[nzc_context][ref][type][c]++;
} else if (tx_size == TX_16X16) {
c = treed_read(r, vp9_nzc16x16_tree,
cm->fc.nzc_probs_16x16[nzc_context][ref][type]);
cm->fc.nzc_counts_16x16[nzc_context][ref][type][c]++;
} else if (tx_size == TX_8X8) {
c = treed_read(r, vp9_nzc8x8_tree,
cm->fc.nzc_probs_8x8[nzc_context][ref][type]);
cm->fc.nzc_counts_8x8[nzc_context][ref][type][c]++;
} else if (tx_size == TX_4X4) {
c = treed_read(r, vp9_nzc4x4_tree,
cm->fc.nzc_probs_4x4[nzc_context][ref][type]);
cm->fc.nzc_counts_4x4[nzc_context][ref][type][c]++;
} else {
assert(0);
}
nzc = vp9_basenzcvalue[c];
if ((e = vp9_extranzcbits[c])) {
int x = 0;
while (e--) {
int b = vp9_read(
r, cm->fc.nzc_pcat_probs[nzc_context][c - NZC_TOKENS_NOEXTRA][e]);
x |= (b << e);
cm->fc.nzc_pcat_counts[nzc_context][c - NZC_TOKENS_NOEXTRA][e][b]++;
}
nzc += x;
}
if (tx_size == TX_32X32)
assert(nzc <= 1024);
else if (tx_size == TX_16X16)
assert(nzc <= 256);
else if (tx_size == TX_8X8)
assert(nzc <= 64);
else if (tx_size == TX_4X4)
assert(nzc <= 16);
return nzc;
}
static void read_nzcs_sb64(VP9_COMMON *const cm,
MACROBLOCKD* xd,
int mb_row,
int mb_col,
vp9_reader *r) {
MODE_INFO *m = xd->mode_info_context;
MB_MODE_INFO *const mi = &m->mbmi;
int j, nzc_context;
const int ref = m->mbmi.ref_frame != INTRA_FRAME;
assert(mb_col == get_mb_col(xd));
assert(mb_row == get_mb_row(xd));
vpx_memset(m->mbmi.nzcs, 0, 384 * sizeof(m->mbmi.nzcs[0]));
if (mi->mb_skip_coeff)
return;