Commit eb6ef241 authored by Deb Mukherjee's avatar Deb Mukherjee
Browse files

Coding con-zero count rather than EOB for coeffs

This patch revamps the entropy coding of coefficients to code first
a non-zero count per coded block and correspondingly remove the EOB
token from the token set.

STATUS:
Main encode/decode code achieving encode/decode sync - done.
Forward and backward probability updates to the nzcs - done.
Rd costing updates for nzcs - done.
Note: The dynamic progrmaming apporach used in trellis quantization
is not exactly compatible with nzcs. A suboptimal approach has been
used instead where branch costs are updated to account for changes
in the nzcs.

TODO:
Training the default probs/counts for nzcs

Change-Id: I951bc1e22f47885077a7453a09b0493daa77883d
parent a9961fa8
......@@ -245,6 +245,7 @@ EXPERIMENT_LIST="
comp_interintra_pred
enable_6tap
abovesprefmv
code_nonzerocount
"
CONFIG_LIST="
external_build
......
......@@ -250,6 +250,9 @@ 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 {
......@@ -295,6 +298,9 @@ typedef struct macroblockd {
DECLARE_ALIGNED(16, int16_t, qcoeff[64*64+32*32*2]);
DECLARE_ALIGNED(16, int16_t, dqcoeff[64*64+32*32*2]);
DECLARE_ALIGNED(16, uint16_t, eobs[256+64*2]);
#if CONFIG_CODE_NONZEROCOUNT
DECLARE_ALIGNED(16, uint16_t, nzcs[256+64*2]);
#endif
/* 16 Y blocks, 4 U, 4 V, each with 16 entries. */
BLOCKD block[24];
......@@ -592,4 +598,25 @@ static void update_blockd_bmi(MACROBLOCKD *xd) {
}
}
static TX_SIZE get_uv_tx_size(const MACROBLOCKD *xd) {
TX_SIZE tx_size_uv;
if (xd->mode_info_context->mbmi.sb_type == BLOCK_SIZE_SB64X64) {
tx_size_uv = xd->mode_info_context->mbmi.txfm_size;
} else if (xd->mode_info_context->mbmi.sb_type == BLOCK_SIZE_SB32X32) {
if (xd->mode_info_context->mbmi.txfm_size == TX_32X32)
tx_size_uv = TX_16X16;
else
tx_size_uv = xd->mode_info_context->mbmi.txfm_size;
} else {
if (xd->mode_info_context->mbmi.txfm_size == TX_16X16)
tx_size_uv = TX_8X8;
else if (xd->mode_info_context->mbmi.txfm_size == TX_8X8 &&
(xd->mode_info_context->mbmi.mode == I8X8_PRED ||
xd->mode_info_context->mbmi.mode == SPLITMV))
tx_size_uv = TX_4X4;
else
tx_size_uv = xd->mode_info_context->mbmi.txfm_size;
}
return tx_size_uv;
}
#endif // VP9_COMMON_VP9_BLOCKD_H_
......@@ -17,4 +17,11 @@
#define COEF_UPDATE_PROB_8X8 252
#define COEF_UPDATE_PROB_16X16 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
#endif
#endif // VP9_COMMON_VP9_COEFUPDATEPROBS_H__
......@@ -695,3 +695,130 @@ static const vp9_coeff_probs default_coef_probs_32x32[BLOCK_TYPES] = {
}
}
};
#if CONFIG_CODE_NONZEROCOUNT
// TODO(debargha): Replace with probabilities once the stats stabilize
static const unsigned int default_nzc4x4_counts[MAX_NZC_CONTEXTS]
[REF_TYPES]
[BLOCK_TYPES]
[NZC4X4_TOKENS] = {
{
{
{ 967652, 29023, 15039, 6952, 1568, 116 },
{ 789116, 22938, 4522, 1935, 520, 47 }
}, {
{ 967652, 29023, 15039, 6952, 1568, 116 },
{ 789116, 22938, 4522, 1935, 520, 47 }
},
}, {
{
{ 124684, 37167, 15270, 8483, 1777, 102 },
{ 10405, 12395, 3401, 3574, 2461, 771 }
}, {
{ 124684, 37167, 15270, 8483, 1777, 102 },
{ 10405, 12395, 3401, 3574, 2461, 771 }
}
}, {
{
{ 41100, 22976, 15627, 16137, 7982, 793 },
{ 4249, 3084, 2131, 4081, 6439, 1653 }
}, {
{ 41100, 22976, 15627, 16137, 7982, 793 },
{ 4249, 3084, 2131, 4081, 6439, 1653 }
}
}
};
static const unsigned int default_nzc8x8_counts[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 },
{ 72052, 30468, 6973, 3250, 1500, 750, 375, 5 },
}
}, {
{
{ 121533, 33527, 15655, 11920, 5723, 2009, 315, 7 },
{ 17772, 23120, 13127, 8115, 4000, 2000, 200, 6 },
}, {
{ 121533, 33527, 15655, 11920, 5723, 2009, 315, 7 },
{ 17772, 23120, 13127, 8115, 4000, 2000, 200, 6 },
}
}, {
{
{ 29408, 11758, 8023, 10123, 6705, 2468, 369, 17 },
{ 6612, 13874, 13329, 13022, 6500, 3250, 300, 12 },
}, {
{ 29408, 11758, 8023, 10123, 6705, 2468, 369, 17 },
{ 6612, 13874, 13329, 13022, 6500, 3250, 300, 12 },
}
}
};
static const unsigned int default_nzc16x16_counts[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 },
}, {
{ 372988, 62777, 19440, 11812, 5145, 1917, 439, 10, 5, 2 },
{ 72052, 30468, 6973, 3250, 1500, 750, 375, 50, 8, 1 },
}
}, {
{
{ 121533, 33527, 15655, 11920, 5723, 2009, 315, 7, 4, 2 },
{ 17772, 23120, 13127, 8115, 4000, 2000, 200, 6, 4, 2 },
}, {
{ 121533, 33527, 15655, 11920, 5723, 2009, 315, 7, 4, 2 },
{ 17772, 23120, 13127, 8115, 4000, 2000, 200, 6, 4, 2 },
}
}, {
{
{ 29408, 11758, 8023, 10123, 6705, 2468, 369, 17, 10, 5 },
{ 6612, 13874, 13329, 13022, 6500, 3250, 300, 12, 6, 3 },
}, {
{ 29408, 11758, 8023, 10123, 6705, 2468, 369, 17, 10, 5 },
{ 6612, 13874, 13329, 13022, 6500, 3250, 300, 12, 6, 3 },
}
}
};
static const unsigned int default_nzc32x32_counts[MAX_NZC_CONTEXTS]
[REF_TYPES]
[BLOCK_TYPES]
[NZC32X32_TOKENS] = {
{
{
{ 372988, 62777, 19440, 11812, 5145, 1917, 439, 10, 5, 2, 1, 0 },
{ 72052, 30468, 6973, 3250, 1500, 750, 375, 50, 8, 1 },
}, {
{ 372988, 62777, 19440, 11812, 5145, 1917, 439, 10, 5, 2, 1, 0 },
{ 72052, 30468, 6973, 3250, 1500, 750, 375, 50, 8, 1 },
}
}, {
{
{ 121533, 33527, 15655, 11920, 5723, 2009, 315, 7, 4, 2, 1, 0 },
{ 17772, 23120, 13127, 8115, 4000, 2000, 200, 6, 4, 2 },
}, {
{ 121533, 33527, 15655, 11920, 5723, 2009, 315, 7, 4, 2, 1, 0 },
{ 17772, 23120, 13127, 8115, 4000, 2000, 200, 6, 4, 2 },
}
}, {
{
{ 29408, 11758, 8023, 10123, 6705, 2468, 369, 17, 10, 5, 2, 1 },
{ 6612, 13874, 13329, 13022, 6500, 3250, 300, 12, 6, 3 },
}, {
{ 29408, 11758, 8023, 10123, 6705, 2468, 369, 17, 10, 5, 2, 1 },
{ 6612, 13874, 13329, 13022, 6500, 3250, 300, 12, 6, 3 },
}
}
};
#endif
/*
/*
* Copyright (c) 2010 The WebM project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
......@@ -186,6 +186,92 @@ 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_struct 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_struct 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_struct 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_struct vp9_nzc32x32_encodings[NZC32X32_TOKENS];
const vp9_prob Pcat_nzc[MAX_NZC_CONTEXTS]
[NZC_TOKENS_EXTRA][NZC_BITS_EXTRA] = { {
// Bit probabilities are in least to most significance order
{176, 0, 0, 0, 0, 0, 0, 0, 0}, // 3 - 4
{164, 192, 0, 0, 0, 0, 0, 0, 0}, // 5 - 8
{154, 184, 208, 0, 0, 0, 0, 0, 0}, // 9 - 16
{144, 176, 200, 216, 0, 0, 0, 0, 0}, // 17 - 32
{140, 172, 192, 208, 224, 0, 0, 0, 0}, // 33 - 64
{136, 168, 188, 200, 220, 232, 0, 0, 0}, // 65 - 128
{132, 164, 184, 196, 216, 228, 240, 0, 0}, // 129 - 256
{130, 162, 178, 194, 212, 226, 240, 248, 0}, // 257 - 512
{128, 160, 176, 192, 208, 224, 240, 248, 254}, // 513 - 1024
}, {
{168, 0, 0, 0, 0, 0, 0, 0, 0}, // 3 - 4
{152, 184, 0, 0, 0, 0, 0, 0, 0}, // 5 - 8
{152, 184, 208, 0, 0, 0, 0, 0, 0}, // 9 - 16
{144, 176, 200, 216, 0, 0, 0, 0, 0}, // 17 - 32
{140, 172, 192, 208, 224, 0, 0, 0, 0}, // 33 - 64
{136, 168, 188, 200, 220, 232, 0, 0, 0}, // 65 - 128
{132, 164, 184, 196, 216, 228, 240, 0, 0}, // 129 - 256
{130, 162, 178, 194, 212, 226, 240, 248, 0}, // 257 - 512
{128, 160, 176, 192, 208, 224, 240, 248, 254}, // 513 - 1024
}, {
{160, 0, 0, 0, 0, 0, 0, 0, 0}, // 3 - 4
{152, 176, 0, 0, 0, 0, 0, 0, 0}, // 5 - 8
{150, 184, 208, 0, 0, 0, 0, 0, 0}, // 9 - 16
{144, 176, 200, 216, 0, 0, 0, 0, 0}, // 17 - 32
{140, 172, 192, 208, 224, 0, 0, 0, 0}, // 33 - 64
{136, 168, 188, 200, 220, 232, 0, 0, 0}, // 65 - 128
{132, 164, 184, 196, 216, 228, 240, 0, 0}, // 129 - 256
{130, 162, 178, 194, 212, 226, 240, 248, 0}, // 257 - 512
{128, 160, 176, 192, 208, 224, 240, 248, 254}, // 513 - 1024
},
};
#endif // CONFIG_CODE_NONZEROCOUNT
static vp9_tree_index cat1[2], cat2[4], cat3[6], cat4[8], cat5[10], cat6[28];
static void init_bit_tree(vp9_tree_index *p, int n) {
......@@ -253,6 +339,9 @@ int vp9_get_coef_context(int * recent_energy, int token) {
};
void vp9_default_coef_probs(VP9_COMMON *pc) {
#if CONFIG_CODE_NONZEROCOUNT
int h, g;
#endif
vpx_memcpy(pc->fc.coef_probs_4x4, default_coef_probs_4x4,
sizeof(pc->fc.coef_probs_4x4));
vpx_memcpy(pc->fc.coef_probs_8x8, default_coef_probs_8x8,
......@@ -261,13 +350,1128 @@ void vp9_default_coef_probs(VP9_COMMON *pc) {
sizeof(pc->fc.coef_probs_16x16));
vpx_memcpy(pc->fc.coef_probs_32x32, default_coef_probs_32x32,
sizeof(pc->fc.coef_probs_32x32));
#if CONFIG_CODE_NONZEROCOUNT
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(
NZC4X4_TOKENS, vp9_nzc4x4_encodings, vp9_nzc4x4_tree,
pc->fc.nzc_probs_4x4[h][g][i], branch_ct4x4,
default_nzc4x4_counts[h][g][i]);
}
for (i = 0; i < BLOCK_TYPES; ++i) {
vp9_tree_probs_from_distribution(
NZC8X8_TOKENS, vp9_nzc8x8_encodings, vp9_nzc8x8_tree,
pc->fc.nzc_probs_8x8[h][g][i], branch_ct8x8,
default_nzc8x8_counts[h][g][i]);
}
for (i = 0; i < BLOCK_TYPES; ++i) {
vp9_tree_probs_from_distribution(
NZC16X16_TOKENS, vp9_nzc16x16_encodings, vp9_nzc16x16_tree,
pc->fc.nzc_probs_16x16[h][g][i], branch_ct16x16,
default_nzc16x16_counts[h][g][i]);
}
for (i = 0; i < BLOCK_TYPES; ++i) {
vp9_tree_probs_from_distribution(
NZC32X32_TOKENS, vp9_nzc32x32_encodings, vp9_nzc32x32_tree,
pc->fc.nzc_probs_32x32[h][g][i], branch_ct32x32,
default_nzc32x32_counts[h][g][i]);
}
}
}
#endif // CONFIG_CODE_NONZEROCOUNTyy
}
void vp9_coef_tree_initialize() {
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) << 6) ? 2 : (nzc_exp) >= ((t1) << 6) ? 1 : 0)
#define NZC_T2_32X32 32
#define NZC_T1_32X32 8
#define NZC_T2_16X16 16
#define NZC_T1_16X16 4
#define NZC_T2_8X8 8
#define NZC_T1_8X8 2
#define NZC_T2_4X4 4
#define NZC_T1_4X4 1
// 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);
b = block_to_txfm_index(block, mi->txfm_size, 4);
assert(b < 256);
return mi->nzcs[b] << (6 - 2 * mi->txfm_size);
}
static unsigned int get_nzc_4x4_y_sb32(MB_MODE_INFO *mi, int block) {
int b;
assert(block < 64);
b = block_to_txfm_index(block, mi->txfm_size, 3);
assert(b < 64);
return mi->nzcs[b] << (6 - 2 * mi->txfm_size);
}
static unsigned int get_nzc_4x4_y_mb16(MB_MODE_INFO *mi, int block) {
int b;
assert(block < 16);
b = block_to_txfm_index(block, mi->txfm_size, 2);
assert(b < 16);
return mi->nzcs[b] << (6 - 2 * mi->txfm_size);
}
/* END - Helper functions to get the y nzcs */
/* Function to get y nzc where block index is in mb16 terms */
static unsigned int get_nzc_4x4_y(VP9_COMMON *cm, MODE_INFO *m,
int mb_row, int mb_col, int block) {
// NOTE: All values returned are at 64 times the true value at 4x4 scale
MB_MODE_INFO *const mi = &m->mbmi;
const int mis = cm->mode_info_stride;
if (mi->mb_skip_coeff || !mb_in_cur_tile(cm, mb_row, mb_col))
return 0;
if (mi->sb_type == BLOCK_SIZE_SB64X64) {
int r = mb_row & 3;
int c = mb_col & 3;
m -= c + r * mis;
if (m->mbmi.mb_skip_coeff || !mb_in_cur_tile(cm, mb_row - r, mb_col - c))
return 0;
else
return get_nzc_4x4_y_sb64(
&m->mbmi, mb16_to_sb64_index(mb_row, mb_col, block));
} else if (mi->sb_type == BLOCK_SIZE_SB32X32) {
int r = mb_row & 1;
int c = mb_col & 1;
m -= c + r * mis;
if (m->mbmi.mb_skip_coeff || !mb_in_cur_tile(cm, mb_row - r, mb_col - c))
return 0;
else
return get_nzc_4x4_y_sb32(
&m->mbmi, mb16_to_sb32_index(mb_row, mb_col, block));
} else {
if (m->mbmi.mb_skip_coeff || !mb_in_cur_tile(cm, mb_row, mb_col))
return 0;
return get_nzc_4x4_y_mb16(mi, block);
}
}
/* BEGIN - Helper functions to get the uv nzcs */
static unsigned int get_nzc_4x4_uv_sb64(MB_MODE_INFO *mi, int block) {
int b;
int base, uvtxfm_size;
assert(block >= 256 && block < 384);
uvtxfm_size = mi->txfm_size;
base = 256 + (block & 64);
block -= base;
b = base + block_to_txfm_index(block, uvtxfm_size, 3);
assert(b >= 256 && b < 384);
return mi->nzcs[b] << (6 - 2 * uvtxfm_size);
}
static unsigned int get_nzc_4x4_uv_sb32(MB_MODE_INFO *mi, int block) {
int b;
int base, uvtxfm_size;
assert(block >= 64 && block < 96);
if (mi->txfm_size == TX_32X32)
uvtxfm_size = TX_16X16;
else
uvtxfm_size = mi->txfm_size;
base = 64 + (block & 16);
block -= base;
b = base + block_to_txfm_index(block, uvtxfm_size, 2);
assert(b >= 64 && b < 96);
return mi->nzcs[b] << (6 - 2 * uvtxfm_size);
}
static unsigned int get_nzc_4x4_uv_mb16(MB_MODE_INFO *mi, int block) {
int b;
int base, uvtxfm_size;
assert(block >= 16 && block < 24);
if (mi->txfm_size == TX_8X8 &&
(mi->mode == SPLITMV || mi->mode == I8X8_PRED))
uvtxfm_size = TX_4X4;
else if (mi->txfm_size == TX_16X16)
uvtxfm_size = TX_8X8;
else
uvtxfm_size = mi->txfm_size;
base = 16 + (block & 4);
block -= base;
b = base + block_to_txfm_index(block, uvtxfm_size, 1);
assert(b >= 16 && b < 24);
return mi->nzcs[b] << (6 - 2 * uvtxfm_size);
}
/* END - Helper functions to get the uv nzcs */
/* Function to get uv nzc where block index is in mb16 terms */
static unsigned int get_nzc_4x4_uv(VP9_COMMON *cm, MODE_INFO *m,
int mb_row, int mb_col, int block) {
// NOTE: All values returned are at 64 times the true value at 4x4 scale
MB_MODE_INFO *const mi = &m->mbmi;
const int mis = cm->mode_info_stride;
if (mi->mb_skip_coeff || !mb_in_cur_tile(cm, mb_row, mb_col))
return 0;
if (mi->sb_type == BLOCK_SIZE_SB64X64) {
int r = mb_row & 3;
int c = mb_col & 3;
m -= c + r * mis;
if (m->mbmi.mb_skip_coeff || !mb_in_cur_tile(cm, mb_row - r, mb_col - c))
return 0;
else
return get_nzc_4x4_uv_sb64(
&m->mbmi, mb16_to_sb64_index(mb_row, mb_col, block));
} else if (mi->sb_type == BLOCK_SIZE_SB32X32) {
int r = mb_row & 1;
int c = mb_col & 1;
m -= c + r * mis;
if (m->mbmi.mb_skip_coeff || !mb_in_cur_tile(cm, mb_row - r, mb_col - c))
return 0;
else
return get_nzc_4x4_uv_sb32(
&m->mbmi, mb16_to_sb32_index(mb_row, mb_col, block));
} else {
return get_nzc_4x4_uv_mb16(mi, block);
}
}
int vp9_get_nzc_context_y_sb64(VP9_COMMON *cm, MODE_INFO *cur,
int mb_row, int mb_col, int block) {
// returns an index in [0, MAX_NZC_CONTEXTS - 1] to reflect how busy
// neighboring blocks are
int mis = cm->mode_info_stride;
int nzc_exp = 0;
TX_SIZE txfm_size = cur->mbmi.txfm_size;
assert(block < 256);