Commit a24a6900 authored by Jingning Han's avatar Jingning Han
Browse files

Account for rectangular transform block sizes in lv-map ctx

Account for the rectangular transform block sizes in the non-zero
map context model.

Change-Id: I16cf21a4120c10c213df10950aeb4ef0ea40c477
parent bdd6ca81
...@@ -71,7 +71,7 @@ extern "C" { ...@@ -71,7 +71,7 @@ extern "C" {
#endif // CONFIG_CTX1D #endif // CONFIG_CTX1D
#if CONFIG_EXT_TX #if CONFIG_EXT_TX
#define SIG_COEF_CONTEXTS_2D 16 #define SIG_COEF_CONTEXTS_2D 26
#define SIG_COEF_CONTEXTS_1D 16 #define SIG_COEF_CONTEXTS_1D 16
#define SIG_COEF_CONTEXTS \ #define SIG_COEF_CONTEXTS \
(SIG_COEF_CONTEXTS_2D + SIG_COEF_CONTEXTS_1D + SIG_COEF_CONTEXTS_1D) (SIG_COEF_CONTEXTS_2D + SIG_COEF_CONTEXTS_1D + SIG_COEF_CONTEXTS_1D)
......
...@@ -143,39 +143,45 @@ const aom_prob default_coeff_base ...@@ -143,39 +143,45 @@ const aom_prob default_coeff_base
}, },
}; };
const aom_prob default_nz_map[TX_SIZES][PLANE_TYPES][SIG_COEF_CONTEXTS] = static const aom_prob default_nz_map[TX_SIZES][PLANE_TYPES][SIG_COEF_CONTEXTS] =
{ { { 42, 58, 129, 82, 37, 16, 117, 117, 66, 31, 17, 63, { { { 40, 157, 108, 70, 34, 19, 168, 98, 60, 32, 20, 128,
98, 40, 128, 128, 136, 130, 95, 43, 128, 154, 143, 98, 128, 128, 128, 128, 128, 128, 128, 128, 128, 125, 80, 41,
41, 128, 103, 141, 69, 128, 128, 128, 130, 131, 95, 39, 128, 128, 173, 120, 81, 36, 128, 188, 127, 84, 35, 128,
128, 147, 146, 94, 38, 128, 102, 143, 63, 128, 128, 128 }, 183, 128, 60, 128, 128, 128, 170, 122, 82, 35, 128, 186,
{ 57, 90, 143, 80, 44, 24, 132, 144, 77, 45, 28, 93, 129, 84, 34, 128, 183, 128, 56, 128, 128, 128 },
152, 74, 128, 128, 152, 179, 119, 70, 128, 162, 189, 127, { 67, 176, 120, 77, 44, 26, 182, 124, 77, 47, 32, 128,
70, 128, 131, 193, 112, 128, 128, 128, 143, 164, 93, 56, 128, 128, 128, 128, 128, 128, 128, 128, 128, 163, 127, 74,
128, 140, 166, 102, 67, 128, 124, 186, 108, 128, 128, 128 } }, 128, 128, 203, 167, 122, 70, 128, 202, 171, 125, 72, 128,
{ { 48, 101, 138, 91, 44, 18, 156, 148, 100, 53, 23, 173, 198, 176, 105, 128, 128, 128, 192, 160, 108, 67, 128, 186,
154, 106, 60, 29, 183, 135, 95, 53, 26, 204, 157, 105, 160, 113, 74, 128, 188, 173, 121, 128, 128, 128 } },
61, 32, 187, 161, 110, 67, 38, 128, 175, 139, 100, 58, { { 55, 192, 143, 93, 43, 17, 201, 155, 101, 50, 22, 171, 124, 76, 38,
27, 196, 160, 112, 67, 32, 182, 163, 112, 65, 34, 128 }, 17, 176, 123, 77, 40, 19, 205, 148, 99, 53, 26, 200, 140, 94, 52,
{ 71, 138, 167, 108, 75, 47, 179, 173, 108, 71, 45, 193, 24, 218, 157, 103, 58, 28, 221, 161, 109, 63, 34, 128, 194, 144, 96,
189, 123, 72, 43, 184, 186, 121, 67, 38, 206, 201, 139, 52, 24, 212, 160, 104, 59, 26, 216, 161, 105, 57, 27, 128 },
90, 19, 197, 210, 149, 93, 80, 128, 179, 174, 116, 84, { 84, 190, 149, 102, 59, 29, 204, 159, 111, 69, 41, 200,
62, 182, 163, 93, 60, 50, 175, 187, 121, 84, 52, 128 } }, 151, 98, 54, 32, 193, 143, 98, 69, 46, 216, 167, 111,
{ { 48, 132, 133, 88, 46, 21, 189, 156, 103, 55, 25, 221, 65, 37, 211, 174, 123, 62, 23, 222, 184, 137, 79, 43,
175, 121, 70, 35, 209, 127, 89, 52, 24, 228, 160, 108, 222, 195, 148, 87, 128, 128, 199, 160, 119, 92, 55, 185,
65, 32, 229, 179, 126, 79, 39, 128, 195, 130, 89, 54, 147, 98, 70, 57, 197, 169, 122, 82, 68, 128 } },
27, 214, 155, 105, 62, 31, 217, 173, 117, 73, 39, 128 }, { { 56, 204, 126, 80, 41, 16, 218, 157, 100, 50, 22, 211, 142, 92, 47,
{ 54, 172, 175, 122, 73, 32, 217, 191, 139, 88, 55, 238, 21, 212, 150, 98, 50, 22, 230, 172, 118, 65, 32, 223, 134, 91, 50,
204, 146, 106, 52, 141, 95, 36, 37, 128, 210, 201, 135, 22, 237, 167, 109, 60, 31, 239, 182, 128, 78, 40, 128, 209, 138, 90,
85, 128, 242, 212, 172, 128, 128, 128, 192, 172, 133, 85, 52, 25, 223, 160, 105, 62, 30, 228, 173, 119, 72, 36, 128 },
48, 203, 171, 141, 116, 80, 206, 173, 103, 68, 28, 128 } }, { 79, 201, 140, 99, 64, 37, 225, 175, 128, 78, 35, 215,
{ { 24, 102, 110, 73, 41, 22, 183, 148, 94, 54, 27, 239, 151, 108, 49, 24, 211, 173, 138, 100, 44, 241, 185, 136,
177, 120, 82, 45, 217, 102, 58, 34, 28, 244, 166, 91, 95, 39, 210, 109, 89, 43, 128, 234, 144, 73, 85, 128,
61, 22, 251, 209, 128, 81, 48, 128, 226, 128, 80, 48, 252, 212, 121, 64, 128, 128, 216, 167, 127, 99, 102, 211,
25, 237, 165, 96, 54, 27, 238, 185, 106, 57, 31, 128 }, 182, 168, 129, 110, 202, 157, 101, 66, 42, 128 } },
{ 72, 215, 186, 137, 72, 43, 239, 209, 164, 136, 64, 251, { { 41, 177, 92, 53, 29, 14, 218, 137, 87, 47, 20, 201,
215, 173, 130, 17, 128, 128, 128, 128, 128, 128, 128, 128, 124, 80, 50, 29, 208, 151, 104, 59, 27, 244, 173, 113,
66, 36, 233, 105, 76, 53, 23, 249, 163, 97, 98, 128,
254, 192, 136, 97, 47, 128, 237, 137, 86, 54, 31, 244,
157, 100, 60, 33, 241, 177, 115, 68, 33, 128 },
{ 73, 231, 149, 83, 63, 64, 242, 192, 132, 113, 114, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 252, 204, 160,
114, 36, 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, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 } } }; 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 } } };
#if CONFIG_CTX1D #if CONFIG_CTX1D
const aom_prob default_eob_flag[TX_SIZES][PLANE_TYPES][EOB_COEF_CONTEXTS] = { const aom_prob default_eob_flag[TX_SIZES][PLANE_TYPES][EOB_COEF_CONTEXTS] = {
......
...@@ -329,6 +329,8 @@ static INLINE int get_nz_map_ctx_from_count(int count, ...@@ -329,6 +329,8 @@ static INLINE int get_nz_map_ctx_from_count(int count,
(void)tx_type; (void)tx_type;
const int row = coeff_idx >> bwl; const int row = coeff_idx >> bwl;
const int col = coeff_idx - (row << bwl); const int col = coeff_idx - (row << bwl);
const int width = 1 << bwl;
int ctx = 0; int ctx = 0;
#if CONFIG_EXT_TX #if CONFIG_EXT_TX
int tx_class = get_tx_class(tx_type); int tx_class = get_tx_class(tx_type);
...@@ -350,11 +352,16 @@ static INLINE int get_nz_map_ctx_from_count(int count, ...@@ -350,11 +352,16 @@ static INLINE int get_nz_map_ctx_from_count(int count,
{ {
if (row == 0 && col == 0) return offset + 0; if (row == 0 && col == 0) return offset + 0;
if (row + col < 2) return offset + ctx + 1; if (width < height)
if (row < 2) return offset + 11 + ctx;
if (width > height)
if (col < 2) return offset + 16 + ctx;
if (row + col < 2) return offset + ctx + 1;
if (row + col < 4) return offset + 5 + ctx + 1; if (row + col < 4) return offset + 5 + ctx + 1;
return offset + 11 + AOMMIN(ctx, 4); return offset + 21 + AOMMIN(ctx, 4);
} }
} else { } else {
if (tx_class == TX_CLASS_VERT) { if (tx_class == TX_CLASS_VERT) {
......
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