Commit 5988177c authored by Dake He's avatar Dake He
Browse files

[lv_map_multi] add counters in multisymbol mode

Add counters and newly trained initial probabilities for coefficient
coding.

Change-Id: I2647303c639b60018b8caacfefce77be26cae92c
parent f518f147
......@@ -37,63 +37,63 @@ const aom_prob default_dc_sign[PLANE_TYPES][DC_SIGN_CONTEXTS] = {
#if CONFIG_LV_MAP_MULTI || TRAIN_INIT_PROB
const aom_prob default_coeff_base
[TX_SIZES][PLANE_TYPES][NUM_BASE_LEVELS][COEFF_BASE_CONTEXTS] = {
{ { { 109, 232, 199, 135, 87, 52, 239, 210, 142, 92, 63, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 233, 205, 112,
75, 62, 226, 200, 122, 60, 29, 241, 204, 126, 70, 42,
238, 204, 119, 57, 128, 128, 203, 244, 246, 247 },
{ 107, 223, 197, 147, 102, 62, 227, 205, 156, 112, 74, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 212, 200, 138,
99, 64, 198, 184, 129, 78, 38, 219, 186, 131, 84, 56,
204, 184, 127, 77, 128, 128, 191, 226, 222, 223 } },
{ { 163, 241, 224, 174, 109, 58, 248, 236, 200, 130, 75, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 249, 244, 213,
128, 51, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 228, 248, 252, 254 },
{ 153, 231, 211, 165, 113, 66, 236, 221, 180, 127, 88, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 243, 238, 191,
111, 154, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 209, 237, 239, 248 } } },
{ { { 91, 228, 196, 134, 88, 48, 242, 213, 157, 107, 63, 239,
202, 139, 92, 54, 236, 201, 138, 90, 53, 248, 229, 176,
121, 76, 231, 202, 140, 80, 37, 246, 222, 168, 110, 61,
248, 221, 151, 97, 60, 128, 199, 249, 252, 252 },
{ 85, 196, 181, 138, 98, 55, 230, 206, 164, 121, 73, 219,
193, 144, 104, 62, 218, 192, 143, 101, 61, 237, 218, 182,
140, 90, 213, 191, 140, 94, 44, 224, 200, 159, 115, 68,
220, 199, 151, 107, 69, 128, 183, 229, 226, 230 } },
{ { 139, 235, 211, 159, 107, 66, 247, 231, 184, 127, 79, 246,
226, 170, 103, 61, 236, 212, 161, 119, 76, 253, 245, 215,
156, 96, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 227, 249, 253, 255 },
{ 128, 195, 197, 162, 121, 73, 236, 220, 184, 138, 86, 223,
208, 158, 107, 64, 222, 204, 167, 132, 86, 246, 234, 205,
161, 108, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 198, 228, 239, 244 } } },
{ { { 73, 224, 186, 123, 79, 39, 240, 205, 146, 98, 53, 243,
209, 147, 98, 52, 241, 207, 145, 93, 44, 252, 236, 188,
134, 82, 227, 193, 125, 72, 32, 241, 218, 168, 112, 52,
251, 233, 179, 114, 62, 128, 179, 250, 254, 255 },
{ 69, 200, 171, 127, 86, 41, 224, 193, 150, 107, 58, 218,
194, 150, 107, 58, 220, 193, 147, 102, 47, 239, 222, 188,
147, 92, 204, 183, 127, 80, 36, 211, 194, 158, 114, 57,
231, 209, 167, 120, 70, 128, 171, 226, 235, 232 } },
{ { 117, 225, 196, 146, 107, 68, 246, 225, 177, 128, 81, 243,
217, 163, 105, 60, 247, 225, 180, 131, 84, 253, 241, 202,
148, 97, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 219, 251, 255, 255 },
{ 103, 189, 166, 141, 116, 70, 234, 216, 184, 145, 92, 208,
195, 155, 110, 79, 226, 214, 184, 144, 90, 245, 229, 202,
164, 113, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 182, 221, 236, 243 } } },
{ { { 72, 212, 172, 113, 74, 33, 238, 200, 139, 91, 44, 240,
208, 147, 98, 51, 244, 214, 157, 107, 51, 253, 233, 184,
{ { { 109, 233, 200, 134, 86, 51, 240, 211, 142, 91, 60, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 233, 208, 116,
74, 58, 227, 200, 121, 58, 28, 241, 203, 122, 68, 41,
238, 204, 116, 56, 128, 128, 207, 247, 248, 248 },
{ 108, 226, 198, 145, 100, 58, 224, 205, 153, 107, 69, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 205, 196, 130,
93, 66, 199, 183, 126, 76, 35, 216, 186, 129, 81, 53,
202, 185, 124, 79, 128, 128, 205, 234, 229, 216 } },
{ { 162, 242, 224, 173, 108, 56, 248, 237, 200, 130, 75, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 249, 244, 214,
125, 64, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 229, 249, 253, 254 },
{ 153, 231, 212, 164, 112, 66, 233, 221, 179, 125, 88, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 241, 235, 200,
110, 192, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 213, 240, 244, 248 } } },
{ { { 87, 227, 194, 132, 87, 47, 242, 213, 156, 106, 61, 240,
201, 138, 90, 52, 237, 200, 136, 89, 51, 248, 228, 173,
118, 73, 232, 202, 139, 78, 35, 245, 220, 166, 108, 58,
247, 220, 150, 95, 58, 128, 200, 251, 253, 252 },
{ 82, 196, 182, 137, 97, 53, 229, 208, 164, 119, 70, 219,
194, 144, 101, 58, 220, 194, 143, 99, 57, 233, 218, 183,
140, 88, 214, 190, 138, 91, 43, 223, 200, 157, 112, 64,
217, 199, 149, 105, 67, 128, 197, 237, 239, 233 } },
{ { 138, 234, 211, 157, 108, 66, 247, 231, 185, 129, 77, 246,
227, 173, 108, 56, 237, 213, 162, 118, 76, 253, 246, 216,
159, 87, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 228, 250, 253, 255 },
{ 128, 192, 200, 161, 121, 75, 236, 222, 184, 137, 85, 221,
211, 164, 103, 63, 221, 206, 167, 132, 84, 244, 232, 205,
159, 104, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 204, 230, 245, 247 } } },
{ { { 75, 226, 186, 123, 79, 38, 241, 206, 146, 97, 53, 244,
209, 146, 96, 51, 242, 208, 145, 92, 43, 252, 236, 190,
135, 82, 228, 193, 125, 70, 30, 243, 219, 169, 110, 49,
251, 234, 180, 114, 61, 128, 191, 252, 255, 255 },
{ 69, 201, 172, 126, 86, 41, 222, 195, 151, 107, 57, 213,
196, 149, 105, 56, 218, 195, 147, 100, 46, 235, 222, 189,
148, 92, 206, 183, 126, 79, 35, 209, 194, 158, 110, 53,
231, 209, 167, 120, 68, 128, 194, 233, 240, 240 } },
{ { 114, 226, 196, 145, 107, 66, 246, 225, 176, 128, 80, 245,
217, 161, 105, 61, 247, 225, 179, 130, 83, 253, 241, 202,
150, 96, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 221, 252, 255, 255 },
{ 102, 185, 164, 140, 112, 69, 229, 218, 183, 142, 86, 197,
194, 154, 114, 73, 229, 213, 180, 144, 90, 243, 229, 203,
164, 111, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 184, 222, 224, 246 } } },
{ { { 69, 212, 170, 112, 74, 32, 238, 199, 137, 90, 43, 241,
208, 145, 97, 51, 244, 213, 156, 106, 50, 252, 233, 183,
132, 74, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 201, 250, 254, 255 },
{ 68, 187, 154, 116, 80, 34, 217, 186, 142, 101, 47, 205,
187, 148, 106, 56, 218, 201, 163, 118, 55, 236, 215, 181,
141, 79, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 192, 219, 246, 244 } },
{ { 80, 217, 179, 140, 106, 60, 237, 208, 165, 129, 94, 128,
128, 128, 128, 128, 128, 128, 209, 251, 254, 255 },
{ 65, 187, 151, 114, 78, 33, 217, 186, 140, 99, 46, 203,
185, 147, 105, 53, 215, 200, 162, 116, 54, 234, 215, 181,
140, 79, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 207, 222, 245, 244 } },
{ { 79, 216, 181, 139, 106, 60, 236, 208, 166, 127, 91, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 253, 240, 205,
158, 111, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 205, 250, 255, 254 },
......@@ -122,32 +122,32 @@ const aom_prob default_coeff_base
};
const aom_prob default_nz_map[TX_SIZES][PLANE_TYPES][SIG_COEF_CONTEXTS] = {
{ { 59, 183, 130, 76, 47, 29, 203, 154, 85, 55, 35, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 202, 165, 86,
70, 42, 183, 132, 70, 28, 13, 212, 158, 77, 34, 22,
222, 172, 74, 30, 128, 128, 1, 1, 1, 1 },
{ 97, 210, 172, 111, 61, 29, 223, 188, 131, 77, 33, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 214, 192, 137,
63, 51, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
{ { 59, 183, 130, 75, 46, 27, 203, 154, 83, 52, 34, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 202, 165, 81,
67, 39, 184, 132, 70, 27, 12, 213, 158, 76, 32, 21,
222, 171, 73, 28, 128, 128, 1, 1, 1, 1 },
{ 97, 210, 172, 111, 60, 28, 223, 188, 130, 74, 32, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 214, 191, 139,
56, 64, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 1, 1, 1, 1 } },
{ { 50, 194, 130, 72, 45, 25, 208, 150, 89, 55, 32, 206,
142, 80, 49, 28, 191, 137, 79, 47, 27, 224, 180, 108,
63, 37, 206, 137, 81, 40, 18, 229, 170, 106, 58, 30,
233, 180, 96, 49, 29, 128, 1, 1, 1, 1 },
{ 84, 210, 159, 89, 55, 33, 223, 181, 114, 67, 36, 227,
180, 112, 58, 31, 218, 161, 95, 63, 40, 237, 208, 146,
88, 50, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
{ { 49, 193, 128, 72, 45, 24, 207, 149, 88, 54, 31, 206,
141, 79, 49, 27, 191, 136, 78, 47, 26, 223, 179, 108,
65, 37, 206, 137, 81, 39, 17, 228, 169, 106, 56, 29,
232, 178, 95, 47, 28, 128, 1, 1, 1, 1 },
{ 85, 209, 158, 90, 56, 32, 223, 182, 115, 67, 37, 228,
181, 112, 58, 26, 218, 162, 97, 62, 40, 237, 208, 147,
88, 47, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 1, 1, 1, 1 } },
{ { 40, 187, 118, 65, 39, 20, 211, 142, 80, 49, 26, 226,
150, 83, 49, 26, 213, 146, 82, 47, 22, 237, 191, 116,
68, 39, 204, 124, 68, 35, 15, 226, 167, 104, 58, 26,
{ { 42, 189, 120, 65, 40, 19, 212, 143, 80, 49, 26, 226,
150, 82, 48, 25, 213, 146, 82, 46, 22, 237, 191, 117,
68, 39, 204, 126, 69, 35, 15, 227, 168, 105, 58, 25,
236, 195, 117, 59, 30, 128, 1, 1, 1, 1 },
{ 69, 207, 145, 80, 53, 36, 226, 167, 98, 64, 38, 238,
174, 95, 54, 32, 228, 169, 103, 67, 41, 243, 201, 123,
{ 69, 207, 145, 81, 54, 33, 225, 166, 99, 62, 38, 237,
173, 94, 54, 34, 228, 169, 103, 67, 41, 243, 201, 124,
77, 48, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 1, 1, 1, 1 } },
{ { 39, 175, 107, 58, 38, 16, 214, 135, 73, 44, 21, 235,
145, 80, 48, 26, 227, 149, 84, 52, 25, 247, 195, 108,
{ { 38, 174, 105, 57, 37, 16, 213, 134, 72, 44, 21, 235,
144, 79, 48, 25, 227, 148, 83, 52, 24, 247, 195, 107,
65, 35, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 1, 1, 1, 1 },
{ 44, 206, 151, 90, 60, 30, 214, 148, 92, 62, 40, 128,
......@@ -507,60 +507,48 @@ static const aom_prob
};
const aom_prob default_coeff_lps[TX_SIZES][PLANE_TYPES][LEVEL_CONTEXTS] = {
{ { 96, 128, 86, 122, 128, 84, 125, 128, 88, 99, 126, 128,
135, 159, 99, 130, 134, 100, 128, 144, 70, 97, 128, 139,
157, 168, 127, 148, 162, 121, 149, 157, 118, 127, 143, 157,
178, 186, 168, 171, 183, 165, 169, 180, 180, 169, 166, 177 },
{ 81, 128, 72, 95, 128, 64, 98, 128, 42, 66, 101, 128,
129, 163, 97, 122, 130, 91, 119, 141, 70, 94, 118, 166,
157, 168, 117, 143, 151, 111, 144, 154, 76, 113, 128, 158,
177, 185, 165, 167, 179, 155, 166, 179, 110, 137, 115, 165 } },
{ { 102, 128, 79, 125, 128, 74, 121, 128, 61, 98, 128, 128,
141, 164, 96, 132, 150, 90, 128, 153, 62, 100, 128, 153,
162, 172, 120, 146, 162, 113, 142, 154, 96, 113, 138, 155,
181, 188, 151, 170, 179, 147, 167, 181, 158, 157, 163, 176 },
{ 103, 128, 80, 116, 128, 66, 94, 128, 35, 65, 109, 128,
134, 163, 104, 137, 154, 92, 128, 104, 58, 94, 129, 132,
156, 173, 137, 149, 165, 104, 143, 143, 112, 101, 133, 159,
176, 186, 134, 172, 175, 155, 169, 177, 255, 107, 137, 168 } },
{ { 125, 128, 85, 157, 128, 82, 155, 128, 42, 83, 116, 128,
155, 174, 101, 144, 155, 93, 140, 155, 57, 92, 124, 149,
173, 178, 114, 148, 161, 111, 145, 161, 77, 101, 131, 153,
190, 191, 140, 169, 183, 140, 169, 179, 108, 122, 150, 171 },
{ 136, 128, 108, 163, 128, 96, 140, 128, 48, 90, 85, 128,
144, 164, 113, 158, 179, 107, 159, 128, 43, 75, 133, 160,
157, 184, 144, 160, 189, 154, 152, 184, 128, 124, 137, 140,
188, 196, 148, 170, 178, 128, 177, 159, 128, 179, 135, 135 } },
{ { 133, 128, 110, 153, 128, 101, 157, 128, 49, 91, 134, 128,
151, 168, 129, 158, 162, 112, 154, 168, 63, 99, 130, 158,
171, 178, 128, 160, 173, 111, 155, 171, 86, 108, 143, 159,
194, 196, 162, 177, 185, 123, 172, 181, 101, 132, 156, 178 },
{ 133, 128, 129, 144, 128, 116, 135, 128, 43, 101, 100, 128, 140, 163, 158,
173, 205, 128, 165, 171, 128, 128, 210, 163, 172, 184, 192, 176, 201, 183,
177, 190, 128, 192, 199, 144,
#if CONFIG_LV_MAP_MULTI
// TODO(olah): The 1 causes an assert in av1_cost_tokens_from_cdf.
// Changing to 10 is a temporary fix until the root cause is found.
192, 192, 10, 196, 192, 255, 171, 178, 255, 128, 171, 179 } },
#else
192, 192, 1, 196, 192, 255, 171, 178, 255, 128, 171, 179 } },
#endif
{ { 115, 128, 87, 119, 128, 128, 128, 128, 62, 94, 125, 128,
151, 164, 113, 140, 147, 128, 128, 128, 80, 111, 137, 142,
167, 173, 135, 154, 162, 128, 128, 128, 113, 131, 148, 157,
177, 181, 161, 167, 173, 128, 128, 128, 153, 151, 159, 167 },
{ 97, 128, 70, 103, 128, 128, 128, 128, 37, 77, 109, 128,
146, 168, 103, 137, 150, 128, 128, 128, 69, 106, 130, 128,
167, 173, 130, 152, 159, 128, 128, 128, 110, 129, 140, 144,
178, 181, 159, 166, 172, 128, 128, 128, 128, 147, 142, 168 } },
{ { 125, 128, 95, 136, 128, 128, 128, 128, 55, 98, 132, 128,
160, 169, 119, 146, 156, 128, 128, 128, 78, 115, 140, 153,
171, 176, 135, 156, 165, 128, 128, 128, 106, 129, 149, 159,
179, 184, 156, 169, 176, 128, 128, 128, 140, 149, 162, 170 },
{ 110, 128, 76, 119, 128, 128, 128, 128, 34, 76, 125, 128,
146, 163, 106, 137, 154, 128, 128, 128, 64, 103, 137, 145,
163, 172, 132, 150, 165, 128, 128, 128, 80, 126, 144, 162,
175, 182, 157, 167, 176, 128, 128, 128, 102, 154, 151, 167 } },
{ { 132, 128, 102, 159, 128, 128, 128, 128, 55, 103, 140, 128,
163, 173, 125, 155, 164, 128, 128, 128, 78, 118, 146, 160,
174, 179, 138, 162, 170, 128, 128, 128, 102, 129, 151, 164,
182, 186, 157, 174, 181, 128, 128, 128, 132, 147, 163, 174 },
{ 131, 128, 105, 160, 128, 128, 128, 128, 43, 88, 129, 128,
159, 168, 110, 148, 151, 128, 128, 128, 66, 106, 132, 152,
170, 176, 130, 151, 161, 128, 128, 128, 101, 122, 143, 158,
180, 184, 152, 165, 173, 128, 128, 128, 110, 143, 155, 166 } },
{ { 130, 128, 114, 160, 128, 128, 128, 128, 60, 109, 149, 128,
159, 170, 128, 159, 167, 128, 128, 128, 83, 122, 149, 162,
172, 176, 140, 164, 172, 128, 128, 128, 103, 131, 153, 166,
183, 187, 161, 175, 182, 128, 128, 128, 126, 149, 165, 177 },
{ 154, 128, 130, 153, 128, 128, 128, 128, 49, 101, 151, 128,
170, 174, 136, 166, 172, 128, 128, 128, 72, 112, 151, 155,
174, 177, 143, 169, 181, 128, 128, 128, 99, 127, 142, 157,
185, 187, 146, 181, 185, 128, 128, 128, 101, 129, 157, 170 } },
#if CONFIG_TX64X64
{ { 133, 128, 110, 153, 128, 101, 157, 128, 49, 91, 134, 128,
151, 168, 129, 158, 162, 112, 154, 168, 63, 99, 130, 158,
171, 178, 128, 160, 173, 111, 155, 171, 86, 108, 143, 159,
194, 196, 162, 177, 185, 123, 172, 181, 101, 132, 156, 178 },
{ 133, 128, 129, 144, 128, 116, 135, 128, 43, 101, 100, 128, 140, 163, 158,
173, 205, 128, 165, 171, 128, 128, 210, 163, 172, 184, 192, 176, 201, 183,
177, 190, 128, 192, 199, 144,
#if CONFIG_LV_MAP_MULTI
// TODO(olah): The 1 causes an assert in av1_cost_tokens_from_cdf.
// Changing to 10 is a temporary fix until the root cause is found.
192, 192, 10, 196, 192, 255, 171, 178, 255, 128, 171, 179 } },
#else
192, 192, 1, 196, 192, 255, 171, 178, 255, 128, 171, 179 } },
{ { 130, 128, 114, 160, 128, 128, 128, 128, 60, 109, 149, 128,
159, 170, 128, 159, 167, 128, 128, 128, 83, 122, 149, 162,
172, 176, 140, 164, 172, 128, 128, 128, 103, 131, 153, 166,
183, 187, 161, 175, 182, 128, 128, 128, 126, 149, 165, 177 },
{ 154, 128, 130, 153, 128, 128, 128, 128, 49, 101, 151, 128,
170, 174, 136, 166, 172, 128, 128, 128, 72, 112, 151, 155,
174, 177, 143, 169, 181, 128, 128, 128, 99, 127, 142, 157,
185, 187, 146, 181, 185, 128, 128, 128, 101, 129, 157, 170 } }
#endif
#endif // CONFIG_TX64X64
};
#if !CONFIG_LV_MAP_MULTI
......
......@@ -185,6 +185,18 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *const xd,
}
const int level = av1_read_record_symbol(counts, r, cdf, nsymbs, ACCT_STR) +
(c == *eob - 1);
if (counts) {
if (c < *eob - 1) {
++counts->nz_map[txs_ctx][plane_type][coeff_ctx][level != 0];
}
if (level != 0) {
for (int k = 0; k < NUM_BASE_LEVELS; ++k) {
++counts
->coeff_base[txs_ctx][plane_type][k][coeff_ctx][level > k + 1];
if (level == k + 1) break;
}
}
}
#else
const int level = av1_read_record_symbol(
counts, r, ec_ctx->coeff_base_cdf[txs_ctx][plane_type][coeff_ctx], 4,
......@@ -326,6 +338,12 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *const xd,
counts, r, ec_ctx->coeff_br_cdf[txs_ctx][plane_type][ctx],
BR_CDF_SIZE, ACCT_STR);
*level += k;
if (counts) {
for (int lps = 0; lps < BR_CDF_SIZE; lps++) {
++counts->coeff_lps[txs_ctx][plane_type][ctx][lps == k];
if (lps == k) break;
}
}
if (k < BR_CDF_SIZE - 1) break;
}
if (*level <= NUM_BASE_LEVELS + COEFF_BASE_RANGE) {
......
......@@ -1817,7 +1817,7 @@ static int optimize_txb(TxbInfo *txb_info, const LV_MAP_COEFF_COST *txb_costs,
(void)fast_mode;
(void)txb_cache;
int update = 0;
// return update; //TODO: training only.
// return update; // TODO(DKHE): training only.
if (txb_info->eob == 0) return update;
const int max_eob = av1_get_max_eob(txb_info->tx_size);
......@@ -2258,6 +2258,19 @@ void av1_update_and_record_txb_context(int plane, int block, int blk_row,
update_cdf(ec_ctx->coeff_base_cdf[txsize_ctx][plane_type][coeff_ctx],
AOMMIN(abs(v), 3), 4);
}
{
if (c < eob - 1) {
++(*nz_map_count)[coeff_ctx][is_nz];
}
if (is_nz) {
for (int k = 0; k < NUM_BASE_LEVELS; ++k) {
int is_k = (abs(v) > (k + 1));
++td->counts->coeff_base[txsize_ctx][plane_type][k][coeff_ctx][is_k];
if (is_k == 0) break;
}
}
}
#else
update_cdf(ec_ctx->coeff_base_cdf[txsize_ctx][plane_type][coeff_ctx],
AOMMIN(abs(v), 3), 4);
......@@ -2358,6 +2371,11 @@ void av1_update_and_record_txb_context(int plane, int block, int blk_row,
// base_range, k);
update_cdf(ec_ctx->coeff_br_cdf[txsize_ctx][plane_type][ctx], k,
BR_CDF_SIZE);
for (int lps = 0; lps < BR_CDF_SIZE; lps++) {
++td->counts->coeff_lps[txsize_ctx][plane_type][ctx][lps == k];
if (lps == k) break;
}
if (k < BR_CDF_SIZE - 1) break;
}
#else
......
......@@ -686,7 +686,7 @@ int main(int argc, const char **argv) {
"static const aom_cdf_prob "
"default_coeff_lps_cdf[TX_SIZES][PLANE_TYPES][LEVEL_"
"CONTEXTS][CDF_SIZE(2)]");
#if !CONFIG_LV_MAP_MULTI
cts_each_dim[0] = TX_SIZES;
cts_each_dim[1] = PLANE_TYPES;
cts_each_dim[2] = BASE_RANGE_SETS;
......@@ -701,6 +701,7 @@ int main(int argc, const char **argv) {
"static const aom_cdf_prob "
"default_coeff_br_cdf[TX_SIZES][PLANE_TYPES][BASE_RANGE_"
"SETS][LEVEL_CONTEXTS][CDF_SIZE(2)]");
#endif
#endif // CONFIG_LV_MAP
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment