Commit a47cd6c0 authored by Dake He's avatar Dake He Committed by Yaowu Xu
Browse files

[eob first] code eob first

This commit makes the following changes to level-map coding
	1. Encode and decode eob position first
	2. Context derivation for non-zero flags
	3. Single pass in optimize-txb

lowres 0.33% gain

Change-Id: Ia2b6cfd70425f49ac021454d42d5950bfcfab50a
parent 2e868abe
......@@ -143,121 +143,157 @@ const aom_prob default_coeff_base
},
};
const aom_prob default_nz_map[TX_SIZES][PLANE_TYPES][SIG_COEF_CONTEXTS] = {
const aom_prob default_nz_map[TX_SIZES][PLANE_TYPES][SIG_COEF_CONTEXTS] =
{
#if CONFIG_EOB_FIRST
{ { 42, 58, 129, 82, 37, 16, 117, 117, 66, 31, 17, 63,
98, 40, 128, 128, 136, 130, 95, 43, 128, 154, 143, 98,
41, 128, 103, 141, 69, 128, 128, 128, 130, 131, 95, 39,
128, 147, 146, 94, 38, 128, 102, 143, 63, 128, 128, 128 },
{ 57, 90, 143, 80, 44, 24, 132, 144, 77, 45, 28, 93,
152, 74, 128, 128, 152, 179, 119, 70, 128, 162, 189, 127,
70, 128, 131, 193, 112, 128, 128, 128, 143, 164, 93, 56,
128, 140, 166, 102, 67, 128, 124, 186, 108, 128, 128, 128 } },
{ { 48, 101, 138, 91, 44, 18, 156, 148, 100, 53, 23, 173,
154, 106, 60, 29, 183, 135, 95, 53, 26, 204, 157, 105,
61, 32, 187, 161, 110, 67, 38, 128, 175, 139, 100, 58,
27, 196, 160, 112, 67, 32, 182, 163, 112, 65, 34, 128 },
{ 71, 138, 167, 108, 75, 47, 179, 173, 108, 71, 45, 193,
189, 123, 72, 43, 184, 186, 121, 67, 38, 206, 201, 139,
90, 19, 197, 210, 149, 93, 80, 128, 179, 174, 116, 84,
62, 182, 163, 93, 60, 50, 175, 187, 121, 84, 52, 128 } },
{ { 48, 132, 133, 88, 46, 21, 189, 156, 103, 55, 25, 221,
175, 121, 70, 35, 209, 127, 89, 52, 24, 228, 160, 108,
65, 32, 229, 179, 126, 79, 39, 128, 195, 130, 89, 54,
27, 214, 155, 105, 62, 31, 217, 173, 117, 73, 39, 128 },
{ 54, 172, 175, 122, 73, 32, 217, 191, 139, 88, 55, 238,
204, 146, 106, 52, 141, 95, 36, 37, 128, 210, 201, 135,
85, 128, 242, 212, 172, 128, 128, 128, 192, 172, 133, 85,
48, 203, 171, 141, 116, 80, 206, 173, 103, 68, 28, 128 } },
{ { 24, 102, 110, 73, 41, 22, 183, 148, 94, 54, 27, 239,
177, 120, 82, 45, 217, 102, 58, 34, 28, 244, 166, 91,
61, 22, 251, 209, 128, 81, 48, 128, 226, 128, 80, 48,
25, 237, 165, 96, 54, 27, 238, 185, 106, 57, 31, 128 },
{ 72, 215, 186, 137, 72, 43, 239, 209, 164, 136, 64, 251,
215, 173, 130, 17, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 } }
#else
#if CONFIG_EXT_TX
{ { 56, 137, 82, 136, 83, 187, 124, 65,
215, 118, 155, 97, 160, 111, 71, 55,
{ { 56, 137, 82, 136, 83, 187, 124, 65,
215, 118, 155, 97, 160, 111, 71, 55,
142, 156, 91, 226, 107, 231, 146, 65,
105, 91, 232, 97, 185, 121, 90, 74,
142, 156, 91, 226, 107, 231, 146, 65,
105, 91, 232, 97, 185, 121, 90, 74,
153, 195, 123, 154, 106, 196, 143, 67,
232, 125, 121, 105, 159, 113, 88, 66 },
{ 50, 124, 89, 135, 116, 189, 150, 81,
202, 126, 130, 107, 149, 110, 85, 67,
153, 195, 123, 154, 106, 196, 143, 67,
232, 125, 121, 105, 159, 113, 88, 66 },
{ 50, 124, 89, 135, 116, 189, 150, 81,
202, 126, 130, 107, 149, 110, 85, 67,
139, 174, 112, 200, 94, 206, 146, 71,
163, 164, 212, 99, 177, 143, 125, 85,
139, 174, 112, 200, 94, 206, 146, 71,
163, 164, 212, 99, 177, 143, 125, 85,
151, 181, 126, 168, 135, 186, 143, 94,
207, 129, 142, 135, 145, 112, 98, 81 } },
{ { 57, 156, 91, 162, 99, 212, 149, 81,
223, 128, 182, 121, 216, 163, 119, 94,
151, 181, 126, 168, 135, 186, 143, 94,
207, 129, 142, 135, 145, 112, 98, 81 } },
{ { 57, 156, 91, 162, 99, 212, 149, 81,
223, 128, 182, 121, 216, 163, 119, 94,
139, 183, 100, 206, 98, 242, 163, 79,
200, 127, 234, 112, 230, 169, 115, 90,
139, 183, 100, 206, 98, 242, 163, 79,
200, 127, 234, 112, 230, 169, 115, 90,
156, 190, 130, 172, 117, 209, 163, 80,
217, 145, 182, 135, 204, 163, 120, 88 },
{ 48, 133, 102, 143, 119, 190, 170, 109,
197, 127, 176, 137, 214, 168, 130, 119,
156, 190, 130, 172, 117, 209, 163, 80,
217, 145, 182, 135, 204, 163, 120, 88 },
{ 48, 133, 102, 143, 119, 190, 170, 109,
197, 127, 176, 137, 214, 168, 130, 119,
139, 185, 129, 210, 84, 237, 177, 75,
182, 165, 216, 121, 206, 177, 147, 102,
139, 185, 129, 210, 84, 237, 177, 75,
182, 165, 216, 121, 206, 177, 147, 102,
159, 192, 153, 182, 139, 203, 160, 125,
193, 161, 176, 142, 173, 145, 131, 114 } },
{ { 33, 148, 81, 149, 84, 219, 152, 76,
229, 127, 205, 120, 234, 170, 123, 88,
159, 192, 153, 182, 139, 203, 160, 125,
193, 161, 176, 142, 173, 145, 131, 114 } },
{ { 33, 148, 81, 149, 84, 219, 152, 76,
229, 127, 205, 120, 234, 170, 123, 88,
134, 197, 101, 213, 91, 244, 169, 85,
220, 141, 234, 123, 242, 183, 130, 94,
134, 197, 101, 213, 91, 244, 169, 85,
220, 141, 234, 123, 242, 183, 130, 94,
141, 184, 121, 173, 98, 213, 156, 85,
204, 156, 197, 119, 212, 174, 127, 92 },
{ 14, 75, 45, 98, 83, 197, 150, 90,
235, 124, 242, 155, 246, 187, 143, 103,
141, 184, 121, 173, 98, 213, 156, 85,
204, 156, 197, 119, 212, 174, 127, 92 },
{ 14, 75, 45, 98, 83, 197, 150, 90,
235, 124, 242, 155, 246, 187, 143, 103,
78, 185, 111, 255, 116, 255, 224, 171,
185, 157, 255, 85, 219, 122, 128, 128,
78, 185, 111, 255, 116, 255, 224, 171,
185, 157, 255, 85, 219, 122, 128, 128,
117, 187, 102, 181, 132, 233, 197, 93,
207, 135, 191, 107, 222, 175, 130, 47 } },
{
{ 14, 79, 44, 86, 59, 178, 124, 63,
244, 106, 233, 117, 252, 185, 132, 92,
117, 187, 102, 181, 132, 233, 197, 93,
207, 135, 191, 107, 222, 175, 130, 47 } },
{
{ 14, 79, 44, 86, 59, 178, 124, 63,
244, 106, 233, 117, 252, 185, 132, 92,
85, 225, 47, 236, 103, 255, 190, 116,
235, 114, 247, 123, 250, 174, 122, 110,
85, 225, 47, 236, 103, 255, 190, 116,
235, 114, 247, 123, 250, 174, 122, 110,
109, 197, 78, 177, 76, 242, 148, 68,
236, 123, 231, 103, 247, 171, 122, 91 },
{ 11, 40, 27, 92, 78, 183, 171, 70,
216, 74, 251, 146, 252, 213, 171, 148,
109, 197, 78, 177, 76, 242, 148, 68,
236, 123, 231, 103, 247, 171, 122, 91 },
{ 11, 40, 27, 92, 78, 183, 171, 70,
216, 74, 251, 146, 252, 213, 171, 148,
85, 225, 47, 236, 103, 255, 190, 116,
235, 114, 247, 123, 250, 174, 122, 110,
85, 225, 47, 236, 103, 255, 190, 116,
235, 114, 247, 123, 250, 174, 122, 110,
109, 197, 78, 177, 76, 242, 148, 68,
236, 123, 231, 103, 247, 171, 122, 91 },
},
109, 197, 78, 177, 76, 242, 148, 68,
236, 123, 231, 103, 247, 171, 122, 91 },
},
#else // CONFIG_EXT_TX
{
{
34, 103, 61, 106, 62, 160, 112, 54, 173, 121, 157, 92, 157, 129, 94,
65,
},
{
34, 103, 61, 106, 62, 160, 112, 54, 173, 121, 157, 92, 157, 129,
94, 65,
},
{
52, 124, 84, 136, 107, 197, 161, 82, 183, 151, 153, 140, 152, 134,
109, 81,
{
52, 124, 84, 136, 107, 197, 161, 82, 183, 151, 153, 140, 152, 134,
109, 81,
},
},
},
{
{
34, 127, 74, 124, 74, 204, 153, 76, 226, 162, 207, 126, 227, 192, 149,
108,
},
{
34, 127, 74, 124, 74, 204, 153, 76, 226, 162, 207, 126, 227, 192,
149, 108,
},
{
43, 136, 115, 158, 130, 212, 187, 112, 231, 180, 202, 164, 236, 204,
168, 139,
{
43, 136, 115, 158, 130, 212, 187, 112, 231, 180, 202, 164, 236,
204, 168, 139,
},
},
},
{
{
25, 117, 70, 120, 77, 215, 171, 102, 234, 156, 235, 155, 247, 220,
176, 127,
},
{
25, 117, 70, 120, 77, 215, 171, 102, 234, 156, 235, 155, 247, 220,
176, 127,
},
{
24, 88, 49, 100, 62, 202, 148, 62, 237, 178, 233, 168, 244, 198, 162,
127,
{
24, 88, 49, 100, 62, 202, 148, 62, 237, 178, 233, 168, 244, 198,
162, 127,
},
},
},
{
{
11, 54, 17, 69, 26, 128, 125, 56, 232, 130, 237, 121, 250, 168, 134,
114,
},
{
11, 54, 17, 69, 26, 128, 125, 56, 232, 130, 237, 121, 250, 168,
134, 114,
},
{
21, 52, 32, 95, 64, 171, 152, 70, 247, 159, 252, 177, 252, 221, 192,
143,
{
21, 52, 32, 95, 64, 171, 152, 70, 247, 159, 252, 177, 252, 221,
192, 143,
},
},
},
#endif // CONFIG_EXT_TX
};
#endif // CONFIG_EOB_FIRST
};
#if CONFIG_CTX1D
const aom_prob default_eob_flag[TX_SIZES][PLANE_TYPES][EOB_COEF_CONTEXTS] = {
......@@ -330,7 +366,28 @@ const aom_prob default_eob_flag[TX_SIZES][PLANE_TYPES][EOB_COEF_CONTEXTS] = {
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 } },
};
#else // CONFIG_CTX1D
#else // CONFIG_CTX1D
#if CONFIG_EOB_FIRST
static const aom_prob
default_eob_flag[TX_SIZES][PLANE_TYPES][EOB_COEF_CONTEXTS] = {
{ { 221, 233, 232, 221, 231, 233, 216, 196, 233, 226, 200, 133, 227,
206, 157, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 },
{ 167, 197, 190, 182, 201, 199, 170, 145, 200, 183, 147, 84, 198,
166, 106, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 } },
{ { 236, 244, 246, 243, 232, 244, 247, 243, 241, 231, 212, 250, 248,
236, 206, 244, 236, 215, 158, 128, 128, 128, 128, 128, 128 },
{ 146, 204, 212, 194, 176, 206, 220, 208, 201, 174, 139, 227, 221,
185, 149, 210, 190, 152, 93, 128, 128, 128, 128, 128, 128 } },
{ { 231, 242, 243, 248, 248, 249, 251, 251, 249, 246, 250, 247, 242,
226, 252, 252, 248, 233, 249, 246, 240, 213, 128, 128, 128 },
{ 95, 187, 199, 228, 231, 230, 245, 243, 231, 241, 238, 235, 220,
192, 244, 240, 230, 210, 217, 208, 170, 134, 128, 128, 128 } },
{ { 181, 218, 219, 232, 234, 235, 243, 245, 247, 251, 251, 248, 253,
250, 252, 252, 250, 252, 253, 250, 233, 249, 247, 232, 202 },
{ 92, 181, 200, 233, 232, 235, 249, 253, 253, 255, 254, 238, 228,
255, 251, 240, 128, 242, 233, 211, 171, 214, 179, 46, 128 } }
};
#else
const aom_prob default_eob_flag[TX_SIZES][PLANE_TYPES][EOB_COEF_CONTEXTS] = {
{
{ 229, 236, 231, 222, 239, 236, 214, 201, 236, 226, 195, 134, 228,
......@@ -357,6 +414,7 @@ const aom_prob default_eob_flag[TX_SIZES][PLANE_TYPES][EOB_COEF_CONTEXTS] = {
236, 186, 182, 57, 209, 140, 128, 85, 184, 110, 128, 128 },
},
};
#endif
#endif // CONFIG_CTX1D
const aom_prob default_coeff_lps[TX_SIZES][PLANE_TYPES][LEVEL_CONTEXTS] = {
......
......@@ -320,3 +320,49 @@ void av1_init_lv_map(AV1_COMMON *cm) {
}
}
}
#if CONFIG_EOB_FIRST
const int16_t k_eob_group_start[12] = { 0, 1, 2, 3, 5, 9,
17, 33, 65, 129, 257, 513 };
const int16_t k_eob_offset_bits[12] = { 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
int get_eob_pos_ctx(int eob_token) { return eob_token - 1; }
int16_t get_eob_pos_token(int eob, int16_t *extra) {
int16_t t;
if (eob < 3) {
t = eob;
} else {
t = 3;
if (eob > 4) {
t++;
}
if (eob > 8) {
t++;
}
if (eob > 16) {
t++;
}
if (eob > 32) {
t++;
}
if (eob > 64) {
t++;
}
if (eob > 128) {
t++;
}
if (eob > 256) {
t++;
}
if (eob > 512) {
t++;
}
}
*extra = eob - k_eob_group_start[t];
return t;
}
#endif
......@@ -15,6 +15,13 @@
#define REDUCE_CONTEXT_DEPENDENCY 0
#define MIN_SCAN_IDX_REDUCE_CONTEXT_DEPENDENCY 0
#if CONFIG_EOB_FIRST
extern const int16_t k_eob_group_start[12];
extern const int16_t k_eob_offset_bits[12];
int16_t get_eob_pos_token(int eob, int16_t *extra);
int get_eob_pos_ctx(int eob_token);
#endif
extern const int16_t av1_coeff_band_4x4[16];
extern const int16_t av1_coeff_band_8x8[64];
......@@ -193,12 +200,21 @@ static INLINE int get_base_ctx(const uint8_t *const levels,
}
#define BR_CONTEXT_POSITION_NUM 8 // Base range coefficient context
#if CONFIG_EOB_FIRST
static const int br_ref_offset[BR_CONTEXT_POSITION_NUM][2] = {
/* clang-format off*/
{ -1, -1 }, { -1, 0 }, { -1, 1 }, { 0, -1 },
{ 0, 1 }, { 1, -1 }, { 1, 0 }, { 1, 1 },
/* clang-format on*/
};
#else
static const int br_ref_offset[BR_CONTEXT_POSITION_NUM][2] = {
/* clang-format off*/
{ -1, -1 }, { -1, 0 }, { -1, 1 }, { 0, -1 },
{ 0, 1 }, { 1, -1 }, { 1, 0 }, { 1, 1 },
/* clang-format on*/
};
#endif
static const int br_level_map[9] = {
0, 0, 1, 1, 2, 2, 3, 3, 3,
......@@ -303,6 +319,45 @@ static INLINE int get_br_ctx_coeff(const tran_low_t *const tcoeffs,
}
#define SIG_REF_OFFSET_NUM 7
#if CONFIG_EOB_FIRST
static int sig_ref_offset[SIG_REF_OFFSET_NUM][2] = {
{ 2, 1 }, { 2, 0 }, { 1, 2 }, { 1, 1 }, { 1, 0 }, { 0, 2 }, { 0, 1 },
};
static int sig_ref_offset_vert[SIG_REF_OFFSET_NUM][2] = {
{ 2, 1 }, { 2, 0 }, { 3, 0 }, { 1, 1 }, { 1, 0 }, { 4, 0 }, { 0, 1 },
};
static int sig_ref_offset_horiz[SIG_REF_OFFSET_NUM][2] = {
{ 0, 3 }, { 0, 4 }, { 1, 2 }, { 1, 1 }, { 1, 0 }, { 0, 2 }, { 0, 1 },
};
static INLINE int get_nz_count(const tran_low_t *tcoeffs, int bwl, int height,
int row, int col, TX_CLASS tx_class,
const int coeff_is_byte_flag) {
int count = 0;
for (int idx = 0; idx < SIG_REF_OFFSET_NUM; ++idx) {
const int ref_row = row + ((tx_class == TX_CLASS_2D)
? sig_ref_offset[idx][0]
: ((tx_class == TX_CLASS_VERT)
? sig_ref_offset_vert[idx][0]
: sig_ref_offset_horiz[idx][0]));
const int ref_col = col + ((tx_class == TX_CLASS_2D)
? sig_ref_offset[idx][1]
: ((tx_class == TX_CLASS_VERT)
? sig_ref_offset_vert[idx][1]
: sig_ref_offset_horiz[idx][1]));
if (ref_row < 0 || ref_col < 0 || ref_row >= height ||
ref_col >= (1 << bwl))
continue;
const int nb_pos = (ref_row << bwl) + ref_col;
count +=
((coeff_is_byte_flag ? ((const uint8_t *)tcoeffs)[nb_pos]
: ((const tran_low_t *)tcoeffs)[nb_pos]) != 0);
}
return count;
}
#else
static int sig_ref_offset[SIG_REF_OFFSET_NUM][2] = {
{ -2, -1 }, { -2, 0 }, { -1, -2 }, { -1, -1 },
{ -1, 0 }, { 0, -2 }, { 0, -1 },
......@@ -347,6 +402,8 @@ static INLINE int get_nz_count(const void *const tcoeffs, const int bwl,
}
#endif
#endif
static INLINE TX_CLASS get_tx_class(TX_TYPE tx_type) {
switch (tx_type) {
#if CONFIG_EXT_TX
......@@ -365,7 +422,11 @@ static INLINE TX_CLASS get_tx_class(TX_TYPE tx_type) {
// count to ctx
static INLINE int get_nz_map_ctx_from_count(int count,
int coeff_idx, // raster order
int bwl, TX_TYPE tx_type) {
int bwl,
#if CONFIG_EOB_FIRST
int height,
#endif
TX_TYPE tx_type) {
(void)tx_type;
const int row = coeff_idx >> bwl;
const int col = coeff_idx - (row << bwl);
......@@ -383,6 +444,32 @@ static INLINE int get_nz_map_ctx_from_count(int count,
int offset = 0;
#endif
#if CONFIG_EOB_FIRST
(void)height;
ctx = (count + 1) >> 1;
if (tx_class == TX_CLASS_2D) {
{
if (row == 0 && col == 0) return offset + 0;
if (row + col < 2) return offset + ctx + 1;
if (row + col < 4) return offset + 5 + ctx + 1;
return offset + 11 + AOMMIN(ctx, 4);
}
} else {
if (tx_class == TX_CLASS_VERT) {
if (row == 0) return offset + ctx;
if (row < 2) return offset + 5 + ctx;
return offset + 10 + ctx;
} else {
if (col == 0) return offset + ctx;
if (col < 2) return offset + 5 + ctx;
return offset + 10 + ctx;
}
}
#else
if (row == 0 && col == 0) return offset + 0;
if (row == 0 && col == 1) return offset + 1 + count;
......@@ -416,6 +503,7 @@ static INLINE int get_nz_map_ctx_from_count(int count,
assert(12 + ctx < 16);
return offset + 12 + ctx;
#endif
}
static INLINE int get_nz_map_ctx(const void *const tcoeffs, const int scan_idx,
......@@ -441,10 +529,19 @@ static INLINE int get_nz_map_ctx(const void *const tcoeffs, const int scan_idx,
const int count = get_nz_count(tcoeffs, bwl, height, row, col,
coeff_is_byte_flag, prev_row, prev_col);
#else
const int count =
get_nz_count(tcoeffs, bwl, height, row, col, coeff_is_byte_flag);
#if CONFIG_EOB_FIRST
int tx_class = get_tx_class(tx_type);
int count = get_nz_count(tcoeffs, bwl, height, row, col, tx_class,
coeff_is_byte_flag);
#else
int count = get_nz_count(tcoeffs, bwl, height, row, col, coeff_is_byte_flag);
#endif
#endif
return get_nz_map_ctx_from_count(count, coeff_idx, bwl,
#if CONFIG_EOB_FIRST
height,
#endif
return get_nz_map_ctx_from_count(count, coeff_idx, bwl, tx_type);
tx_type);
}
static INLINE int get_eob_ctx(const int coeff_idx, // raster order
......
......@@ -267,6 +267,16 @@ static INLINE int read_nz_map_horiz(aom_reader *r, uint8_t *levels, int plane,
}
#endif
#if CONFIG_EOB_FIRST
static INLINE int rec_eob_pos(int16_t eob_token, int16_t extra) {
int eob = k_eob_group_start[eob_token];
if (eob > 2) {
eob += extra;
}
return eob;
}
#endif
uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
aom_reader *r, int blk_row, int blk_col, int block,
int plane, tran_low_t *tcoeffs, TXB_CTX *txb_ctx,
......@@ -327,6 +337,76 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
const SCAN_ORDER *const scan_order = get_scan(cm, tx_size, tx_type, mbmi);
const int16_t *scan = scan_order->scan;
#if CONFIG_EOB_FIRST
unsigned int(*nz_map_count)[SIG_COEF_CONTEXTS][2] =
(counts) ? &counts->nz_map[txs_ctx][plane_type] : NULL;
int16_t dummy;
int16_t max_eob_pt = get_eob_pos_token(seg_eob, &dummy);
int16_t eob_extra = 0;
int16_t eob_pt = 0;
int is_equal = 0;
for (int i = 1; i < max_eob_pt; i++) {
int eob_pos_ctx = get_eob_pos_ctx(i);
is_equal = av1_read_record_bin(
counts, r, ec_ctx->eob_flag_cdf[txs_ctx][plane_type][eob_pos_ctx], 2,
ACCT_STR);
// aom_read_symbol(r,
// ec_ctx->eob_flag_cdf[AOMMIN(txs_ctx,3)][plane_type][eob_pos_ctx], 2,
// ACCT_STR);
if (counts) ++counts->eob_flag[txs_ctx][plane_type][eob_pos_ctx][is_equal];
if (is_equal) {
eob_pt = i;
break;
}
}
if (is_equal == 0) {
eob_pt = max_eob_pt;
}
// printf("Dec: ");
if (k_eob_offset_bits[eob_pt] > 0) {
for (int i = 0; i < k_eob_offset_bits[eob_pt]; i++) {
int eob_shift = k_eob_offset_bits[eob_pt] - 1 - i;
int bit = av1_read_record_bit(counts, r, ACCT_STR);
if (bit) {
eob_extra += (1 << eob_shift);
}
// printf("%d ", bit);
}
}
*eob = rec_eob_pos(eob_pt, eob_extra);
// printf("=>[%d, %d], (%d, %d)\n", seg_eob, *eob, eob_pt, eob_extra);
for (int i = 0; i < *eob; ++i) {
c = *eob - 1 - i;
int is_nz;
int coeff_ctx = get_nz_map_ctx(levels, c, scan, bwl, height, tx_type, 1);
// int eob_ctx = get_eob_ctx(tcoeffs, scan[c], txs_ctx, tx_type);
if (c < *eob - 1) {
#if LV_MAP_PROB
is_nz = av1_read_record_bin(
counts, r, ec_ctx->nz_map_cdf[txs_ctx][plane_type][coeff_ctx], 2,
ACCT_STR);
#else
is_nz = aom_read(r, nz_map[coeff_ctx], ACCT_STR);
#endif
} else {
is_nz = 1;
}
// set non-zero coefficient map.
levels[scan[c]] = is_nz;
if (counts) ++(*nz_map_count)[coeff_ctx][is_nz];
}
#else
#if CONFIG_CTX1D
const int16_t *iscan = scan_order->iscan;
TX_CLASS tx_class = get_tx_class(tx_type);
......@@ -358,6 +438,8 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
}
#else
*eob = read_nz_map(r, levels, plane, scan, tx_size, tx_type, ec_ctx, counts);
#endif
#endif
*max_scan_line = *eob;
......
......@@ -165,6 +165,7 @@ static int optimize_b_greedy(const AV1_COMMON *cm, MACROBLOCK *mb, int plane,
mb->token_head_costs[txsize_sqr_map[tx_size]][plane_type][ref];
int(*tail_token_costs)[COEFF_CONTEXTS][TAIL_TOKENS] =
mb->token_tail_costs[txsize_sqr_map[tx_size]][plane_type][ref];
const int64_t rdmult = (mb->rdmult * plane_rd_mult[ref][plane_type]) >> 1;
int64_t rate0, rate1;
int64_t eob_cost0, eob_cost1;
......
This diff is collapsed.
......@@ -133,6 +133,7 @@ set(CONFIG_DEPENDENT_HORZTILES 0 CACHE NUMBER "AV1 experiment flag.")