Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1 | /* |
Yaowu Xu | 2ab7ff0 | 2016-09-02 12:04:54 -0700 | [diff] [blame] | 2 | * Copyright (c) 2016, Alliance for Open Media. All rights reserved |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 3 | * |
Yaowu Xu | 2ab7ff0 | 2016-09-02 12:04:54 -0700 | [diff] [blame] | 4 | * This source code is subject to the terms of the BSD 2 Clause License and |
| 5 | * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License |
| 6 | * was not distributed with this source code in the LICENSE file, you can |
| 7 | * obtain it at www.aomedia.org/license/software. If the Alliance for Open |
| 8 | * Media Patent License 1.0 was not distributed with this source code in the |
| 9 | * PATENTS file, you can obtain it at www.aomedia.org/license/patent. |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 10 | */ |
| 11 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 12 | #include "aom_mem/aom_mem.h" |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 13 | |
| 14 | #include "av1/common/reconinter.h" |
Angie Chiang | ed8cd9a | 2016-10-21 16:44:47 -0700 | [diff] [blame] | 15 | #include "av1/common/scan.h" |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 16 | #include "av1/common/onyxc_int.h" |
| 17 | #include "av1/common/seg_common.h" |
| 18 | |
Urvang Joshi | 6be4a54 | 2016-11-03 15:24:05 -0700 | [diff] [blame^] | 19 | #if CONFIG_DAALA_EC |
| 20 | aom_cdf_prob av1_kf_y_mode_cdf[INTRA_MODES][INTRA_MODES][INTRA_MODES]; |
| 21 | #endif |
| 22 | |
| 23 | #if CONFIG_ALT_INTRA |
| 24 | |
| 25 | const aom_prob av1_kf_y_mode_prob[INTRA_MODES][INTRA_MODES][INTRA_MODES - 1] = { |
| 26 | { |
| 27 | // above = dc |
| 28 | { 121, 30, 54, 128, 164, 158, 45, 41, 57, 91 }, // left = dc |
| 29 | { 91, 38, 101, 102, 124, 141, 49, 48, 45, 73 }, // left = v |
| 30 | { 66, 28, 27, 177, 225, 178, 32, 27, 52, 114 }, // left = h |
| 31 | { 106, 23, 50, 101, 134, 148, 64, 50, 49, 107 }, // left = d45 |
| 32 | { 75, 24, 32, 118, 66, 143, 42, 28, 57, 74 }, // left = d135 |
| 33 | { 95, 24, 40, 142, 56, 141, 72, 121, 129, 255 }, // left = d117 |
| 34 | { 71, 14, 25, 126, 117, 201, 28, 21, 117, 89 }, // left = d153 |
| 35 | { 85, 16, 37, 110, 163, 178, 41, 28, 48, 134 }, // left = d207 |
| 36 | { 86, 25, 32, 83, 105, 133, 58, 81, 46, 95 }, // left = d63 |
| 37 | { 79, 25, 38, 75, 150, 255, 30, 49, 34, 51 }, // left = smooth |
| 38 | { 68, 59, 48, 122, 193, 158, 43, 46, 46, 112 }, // left = paeth |
| 39 | }, |
| 40 | { |
| 41 | // above = v |
| 42 | { 66, 21, 118, 111, 145, 107, 27, 50, 27, 54 }, // left = dc |
| 43 | { 52, 25, 167, 81, 120, 101, 34, 55, 19, 32 }, // left = v |
| 44 | { 56, 18, 72, 134, 208, 139, 31, 34, 27, 89 }, // left = h |
| 45 | { 75, 21, 94, 88, 134, 123, 49, 57, 30, 68 }, // left = d45 |
| 46 | { 54, 18, 95, 96, 78, 107, 33, 49, 28, 65 }, // left = d135 |
| 47 | { 61, 19, 121, 131, 58, 101, 56, 143, 120, 255 }, // left = d117 |
| 48 | { 53, 13, 78, 103, 110, 147, 31, 41, 64, 77 }, // left = d153 |
| 49 | { 69, 14, 78, 93, 167, 121, 31, 39, 25, 113 }, // left = d207 |
| 50 | { 64, 18, 103, 79, 90, 108, 34, 73, 27, 69 }, // left = d63 |
| 51 | { 52, 20, 103, 61, 161, 255, 22, 42, 16, 35 }, // left = smooth |
| 52 | { 50, 31, 124, 92, 161, 120, 50, 53, 23, 60 }, // left = paeth |
| 53 | }, |
| 54 | { |
| 55 | // above = h |
| 56 | { 94, 29, 31, 158, 214, 178, 35, 31, 72, 111 }, // left = dc |
| 57 | { 72, 37, 72, 149, 184, 177, 43, 40, 53, 105 }, // left = v |
| 58 | { 53, 21, 14, 196, 242, 209, 29, 19, 55, 145 }, // left = h |
| 59 | { 93, 36, 36, 104, 176, 166, 56, 37, 49, 141 }, // left = d45 |
| 60 | { 84, 32, 27, 124, 108, 143, 38, 36, 76, 134 }, // left = d135 |
| 61 | { 82, 31, 47, 142, 122, 161, 83, 73, 126, 255 }, // left = d117 |
| 62 | { 66, 16, 20, 133, 148, 210, 30, 17, 113, 104 }, // left = d153 |
| 63 | { 76, 16, 17, 129, 207, 181, 41, 20, 46, 163 }, // left = d207 |
| 64 | { 72, 38, 21, 100, 142, 171, 37, 70, 49, 111 }, // left = d63 |
| 65 | { 61, 30, 27, 115, 208, 255, 27, 31, 44, 63 }, // left = smooth |
| 66 | { 53, 45, 29, 157, 222, 185, 49, 37, 55, 102 }, // left = paeth |
| 67 | }, |
| 68 | { |
| 69 | // above = d45 |
| 70 | { 96, 18, 37, 98, 138, 154, 68, 56, 59, 96 }, // left = dc |
| 71 | { 73, 18, 92, 81, 125, 132, 75, 64, 27, 67 }, // left = v |
| 72 | { 73, 17, 27, 128, 213, 154, 56, 44, 32, 105 }, // left = h |
| 73 | { 101, 20, 21, 75, 138, 138, 82, 56, 23, 154 }, // left = d45 |
| 74 | { 71, 15, 33, 91, 70, 150, 62, 55, 38, 118 }, // left = d135 |
| 75 | { 80, 19, 38, 116, 69, 122, 88, 132, 92, 255 }, // left = d117 |
| 76 | { 68, 11, 22, 101, 116, 179, 52, 44, 85, 96 }, // left = d153 |
| 77 | { 101, 8, 59, 77, 151, 170, 53, 41, 35, 172 }, // left = d207 |
| 78 | { 82, 19, 24, 81, 172, 129, 82, 128, 43, 108 }, // left = d63 |
| 79 | { 66, 18, 42, 64, 143, 255, 52, 52, 25, 83 }, // left = smooth |
| 80 | { 57, 24, 42, 85, 169, 145, 104, 71, 34, 86 }, // left = paeth |
| 81 | }, |
| 82 | { |
| 83 | // above = d135 |
| 84 | { 85, 15, 29, 113, 83, 176, 26, 29, 70, 110 }, // left = dc |
| 85 | { 78, 28, 49, 111, 91, 141, 30, 42, 48, 75 }, // left = v |
| 86 | { 56, 21, 16, 146, 190, 178, 23, 31, 49, 92 }, // left = h |
| 87 | { 70, 19, 20, 65, 90, 173, 97, 36, 57, 98 }, // left = d45 |
| 88 | { 77, 14, 26, 110, 51, 156, 34, 35, 54, 74 }, // left = d135 |
| 89 | { 78, 18, 36, 153, 47, 131, 62, 102, 155, 255 }, // left = d117 |
| 90 | { 56, 11, 15, 115, 85, 196, 32, 45, 81, 96 }, // left = d153 |
| 91 | { 90, 18, 24, 95, 126, 159, 34, 31, 46, 136 }, // left = d207 |
| 92 | { 80, 23, 28, 90, 75, 141, 39, 50, 46, 87 }, // left = d63 |
| 93 | { 63, 22, 31, 91, 110, 255, 26, 43, 51, 51 }, // left = smooth |
| 94 | { 66, 32, 31, 122, 145, 165, 40, 43, 56, 79 }, // left = paeth |
| 95 | }, |
| 96 | { |
| 97 | // above = d117 |
| 98 | { 81, 16, 61, 170, 74, 105, 54, 105, 113, 255 }, // left = dc |
| 99 | { 74, 20, 86, 163, 64, 97, 65, 129, 101, 255 }, // left = v |
| 100 | { 63, 15, 47, 168, 141, 176, 69, 77, 77, 255 }, // left = h |
| 101 | { 70, 17, 59, 97, 78, 114, 74, 122, 80, 255 }, // left = d45 |
| 102 | { 78, 13, 50, 153, 34, 126, 75, 114, 120, 255 }, // left = d135 |
| 103 | { 72, 16, 69, 159, 28, 108, 63, 134, 107, 255 }, // left = d117 |
| 104 | { 66, 9, 47, 131, 79, 148, 41, 88, 105, 255 }, // left = d153 |
| 105 | { 78, 12, 60, 119, 105, 133, 47, 95, 63, 255 }, // left = d207 |
| 106 | { 82, 21, 58, 128, 61, 98, 64, 136, 91, 255 }, // left = d63 |
| 107 | { 23, 26, 28, 96, 85, 128, 51, 64, 85, 128 }, // left = smooth |
| 108 | { 58, 27, 62, 162, 109, 151, 75, 106, 78, 255 }, // left = paeth |
| 109 | }, |
| 110 | { |
| 111 | // above = d153 |
| 112 | { 91, 18, 25, 121, 166, 173, 25, 25, 128, 102 }, // left = dc |
| 113 | { 80, 27, 51, 111, 141, 147, 45, 38, 70, 85 }, // left = v |
| 114 | { 53, 12, 11, 154, 197, 225, 17, 17, 74, 145 }, // left = h |
| 115 | { 93, 27, 23, 111, 143, 188, 43, 39, 69, 112 }, // left = d45 |
| 116 | { 83, 15, 21, 118, 67, 178, 40, 33, 73, 92 }, // left = d135 |
| 117 | { 94, 13, 31, 132, 66, 110, 61, 82, 148, 255 }, // left = d117 |
| 118 | { 76, 9, 11, 96, 105, 201, 16, 13, 157, 97 }, // left = d153 |
| 119 | { 70, 10, 12, 100, 172, 201, 23, 17, 53, 158 }, // left = d207 |
| 120 | { 114, 25, 21, 104, 108, 163, 30, 47, 53, 111 }, // left = d63 |
| 121 | { 70, 16, 21, 80, 157, 255, 25, 30, 81, 69 }, // left = smooth |
| 122 | { 87, 32, 26, 120, 191, 168, 32, 33, 70, 118 }, // left = paeth |
| 123 | }, |
| 124 | { |
| 125 | // above = d207 |
| 126 | { 98, 20, 39, 122, 168, 188, 38, 36, 54, 132 }, // left = dc |
| 127 | { 81, 37, 62, 97, 122, 153, 38, 43, 36, 118 }, // left = v |
| 128 | { 71, 21, 22, 154, 227, 183, 37, 31, 46, 140 }, // left = h |
| 129 | { 90, 34, 19, 93, 144, 194, 65, 47, 41, 163 }, // left = d45 |
| 130 | { 78, 20, 27, 91, 93, 173, 57, 52, 49, 113 }, // left = d135 |
| 131 | { 79, 25, 45, 121, 101, 147, 69, 56, 122, 255 }, // left = d117 |
| 132 | { 73, 13, 19, 105, 122, 206, 40, 28, 91, 126 }, // left = d153 |
| 133 | { 101, 14, 22, 87, 153, 169, 33, 25, 26, 175 }, // left = d207 |
| 134 | { 81, 28, 23, 86, 115, 169, 48, 56, 41, 111 }, // left = d63 |
| 135 | { 70, 24, 30, 90, 180, 255, 38, 26, 36, 82 }, // left = smooth |
| 136 | { 61, 37, 30, 94, 189, 163, 76, 50, 36, 127 }, // left = paeth |
| 137 | }, |
| 138 | { |
| 139 | // above = d63 |
| 140 | { 77, 13, 46, 86, 138, 117, 55, 88, 34, 68 }, // left = dc |
| 141 | { 68, 17, 80, 64, 105, 108, 66, 115, 32, 45 }, // left = v |
| 142 | { 62, 13, 37, 124, 210, 131, 46, 57, 28, 103 }, // left = h |
| 143 | { 88, 15, 45, 73, 134, 145, 73, 101, 37, 87 }, // left = d45 |
| 144 | { 68, 16, 35, 78, 81, 133, 54, 71, 33, 67 }, // left = d135 |
| 145 | { 71, 16, 57, 108, 61, 135, 71, 184, 113, 255 }, // left = d117 |
| 146 | { 55, 10, 27, 69, 107, 158, 39, 76, 82, 95 }, // left = d153 |
| 147 | { 80, 9, 38, 78, 153, 145, 50, 63, 28, 123 }, // left = d207 |
| 148 | { 86, 12, 33, 49, 107, 135, 64, 134, 57, 89 }, // left = d63 |
| 149 | { 56, 19, 55, 60, 163, 255, 38, 84, 22, 36 }, // left = smooth |
| 150 | { 53, 17, 60, 69, 151, 126, 73, 113, 26, 80 }, // left = paeth |
| 151 | }, |
| 152 | { |
| 153 | // above = smooth |
| 154 | { 79, 16, 46, 89, 167, 255, 22, 36, 29, 42 }, // left = dc |
| 155 | { 63, 22, 88, 71, 131, 255, 26, 41, 21, 35 }, // left = v |
| 156 | { 51, 18, 28, 142, 232, 255, 26, 25, 25, 75 }, // left = h |
| 157 | { 75, 18, 43, 70, 140, 255, 37, 49, 34, 89 }, // left = d45 |
| 158 | { 70, 14, 35, 87, 83, 255, 30, 36, 34, 50 }, // left = d135 |
| 159 | { 23, 26, 28, 96, 85, 128, 51, 64, 85, 128 }, // left = d117 |
| 160 | { 74, 12, 33, 83, 128, 255, 27, 33, 58, 68 }, // left = d153 |
| 161 | { 66, 11, 30, 77, 179, 255, 21, 27, 23, 113 }, // left = d207 |
| 162 | { 68, 22, 40, 65, 118, 255, 28, 61, 30, 50 }, // left = d63 |
| 163 | { 60, 18, 44, 69, 141, 255, 18, 32, 22, 40 }, // left = smooth |
| 164 | { 52, 32, 54, 96, 194, 255, 33, 37, 25, 53 }, // left = paeth |
| 165 | }, |
| 166 | { |
| 167 | // above = paeth |
| 168 | { 76, 47, 67, 123, 182, 150, 41, 52, 55, 97 }, // left = dc |
| 169 | { 69, 40, 125, 102, 138, 138, 42, 55, 32, 70 }, // left = v |
| 170 | { 46, 28, 27, 160, 232, 169, 34, 21, 32, 122 }, // left = h |
| 171 | { 78, 35, 41, 99, 128, 124, 49, 43, 35, 111 }, // left = d45 |
| 172 | { 66, 28, 47, 100, 113, 145, 37, 40, 72, 93 }, // left = d135 |
| 173 | { 77, 37, 76, 134, 124, 124, 65, 122, 88, 255 }, // left = d117 |
| 174 | { 53, 23, 38, 108, 128, 204, 26, 32, 115, 114 }, // left = d153 |
| 175 | { 65, 20, 29, 101, 202, 186, 29, 24, 29, 188 }, // left = d207 |
| 176 | { 71, 24, 49, 81, 126, 151, 36, 65, 28, 93 }, // left = d63 |
| 177 | { 54, 36, 53, 94, 193, 255, 25, 38, 20, 64 }, // left = smooth |
| 178 | { 52, 54, 60, 108, 176, 168, 47, 44, 50, 105 }, // left = paeth |
| 179 | }, |
| 180 | }; |
| 181 | |
| 182 | static const aom_prob default_if_y_probs[BLOCK_SIZE_GROUPS][INTRA_MODES - 1] = { |
| 183 | { 88, 16, 47, 133, 143, 150, 70, 48, 84, 122 }, // block_size < 8x8 |
| 184 | { 75, 26, 51, 120, 158, 157, 44, 45, 56, 102 }, // block_size < 16x16 |
| 185 | { 73, 24, 60, 115, 184, 164, 26, 36, 32, 63 }, // block_size < 32x32 |
| 186 | { 96, 27, 50, 107, 221, 148, 16, 22, 14, 39 }, // block_size >= 32x32 |
| 187 | }; |
| 188 | |
| 189 | static const aom_prob default_uv_probs[INTRA_MODES][INTRA_MODES - 1] = { |
| 190 | { 199, 3, 79, 179, 220, 109, 38, 50, 68, 138 }, // y = dc |
| 191 | { 17, 2, 219, 136, 131, 58, 21, 106, 23, 41 }, // y = v |
| 192 | { 26, 1, 5, 244, 253, 138, 16, 21, 68, 205 }, // y = h |
| 193 | { 183, 3, 66, 94, 195, 97, 101, 104, 41, 178 }, // y = d45 |
| 194 | { 178, 2, 36, 158, 99, 175, 21, 29, 105, 77 }, // y = d135 |
| 195 | { 154, 3, 65, 219, 40, 48, 45, 95, 146, 255 }, // y = d117 |
| 196 | { 167, 1, 16, 160, 214, 187, 10, 10, 200, 155 }, // y = d153 |
| 197 | { 154, 2, 18, 178, 238, 132, 25, 21, 34, 221 }, // y = d207 |
| 198 | { 153, 4, 76, 85, 157, 90, 38, 165, 46, 104 }, // y = d63 |
| 199 | { 163, 3, 68, 87, 190, 255, 19, 27, 25, 46 }, // y = smooth |
| 200 | { 185, 7, 113, 171, 203, 57, 18, 69, 49, 104 }, // y = paeth |
| 201 | }; |
| 202 | |
| 203 | #else |
| 204 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 205 | const aom_prob av1_kf_y_mode_prob[INTRA_MODES][INTRA_MODES][INTRA_MODES - 1] = { |
| 206 | { |
| 207 | // above = dc |
| 208 | { 137, 30, 42, 148, 151, 207, 70, 52, 91 }, // left = dc |
| 209 | { 92, 45, 102, 136, 116, 180, 74, 90, 100 }, // left = v |
| 210 | { 73, 32, 19, 187, 222, 215, 46, 34, 100 }, // left = h |
| 211 | { 91, 30, 32, 116, 121, 186, 93, 86, 94 }, // left = d45 |
| 212 | { 72, 35, 36, 149, 68, 206, 68, 63, 105 }, // left = d135 |
| 213 | { 73, 31, 28, 138, 57, 124, 55, 122, 151 }, // left = d117 |
| 214 | { 67, 23, 21, 140, 126, 197, 40, 37, 171 }, // left = d153 |
| 215 | { 86, 27, 28, 128, 154, 212, 45, 43, 53 }, // left = d207 |
| 216 | { 74, 32, 27, 107, 86, 160, 63, 134, 102 }, // left = d63 |
| 217 | { 59, 67, 44, 140, 161, 202, 78, 67, 119 } // left = tm |
| 218 | }, |
| 219 | { |
| 220 | // above = v |
| 221 | { 63, 36, 126, 146, 123, 158, 60, 90, 96 }, // left = dc |
| 222 | { 43, 46, 168, 134, 107, 128, 69, 142, 92 }, // left = v |
| 223 | { 44, 29, 68, 159, 201, 177, 50, 57, 77 }, // left = h |
| 224 | { 58, 38, 76, 114, 97, 172, 78, 133, 92 }, // left = d45 |
| 225 | { 46, 41, 76, 140, 63, 184, 69, 112, 57 }, // left = d135 |
| 226 | { 38, 32, 85, 140, 46, 112, 54, 151, 133 }, // left = d117 |
| 227 | { 39, 27, 61, 131, 110, 175, 44, 75, 136 }, // left = d153 |
| 228 | { 52, 30, 74, 113, 130, 175, 51, 64, 58 }, // left = d207 |
| 229 | { 47, 35, 80, 100, 74, 143, 64, 163, 74 }, // left = d63 |
| 230 | { 36, 61, 116, 114, 128, 162, 80, 125, 82 } // left = tm |
| 231 | }, |
| 232 | { |
| 233 | // above = h |
| 234 | { 82, 26, 26, 171, 208, 204, 44, 32, 105 }, // left = dc |
| 235 | { 55, 44, 68, 166, 179, 192, 57, 57, 108 }, // left = v |
| 236 | { 42, 26, 11, 199, 241, 228, 23, 15, 85 }, // left = h |
| 237 | { 68, 42, 19, 131, 160, 199, 55, 52, 83 }, // left = d45 |
| 238 | { 58, 50, 25, 139, 115, 232, 39, 52, 118 }, // left = d135 |
| 239 | { 50, 35, 33, 153, 104, 162, 64, 59, 131 }, // left = d117 |
| 240 | { 44, 24, 16, 150, 177, 202, 33, 19, 156 }, // left = d153 |
| 241 | { 55, 27, 12, 153, 203, 218, 26, 27, 49 }, // left = d207 |
| 242 | { 53, 49, 21, 110, 116, 168, 59, 80, 76 }, // left = d63 |
| 243 | { 38, 72, 19, 168, 203, 212, 50, 50, 107 } // left = tm |
| 244 | }, |
| 245 | { |
| 246 | // above = d45 |
| 247 | { 103, 26, 36, 129, 132, 201, 83, 80, 93 }, // left = dc |
| 248 | { 59, 38, 83, 112, 103, 162, 98, 136, 90 }, // left = v |
| 249 | { 62, 30, 23, 158, 200, 207, 59, 57, 50 }, // left = h |
| 250 | { 67, 30, 29, 84, 86, 191, 102, 91, 59 }, // left = d45 |
| 251 | { 60, 32, 33, 112, 71, 220, 64, 89, 104 }, // left = d135 |
| 252 | { 53, 26, 34, 130, 56, 149, 84, 120, 103 }, // left = d117 |
| 253 | { 53, 21, 23, 133, 109, 210, 56, 77, 172 }, // left = d153 |
| 254 | { 77, 19, 29, 112, 142, 228, 55, 66, 36 }, // left = d207 |
| 255 | { 61, 29, 29, 93, 97, 165, 83, 175, 162 }, // left = d63 |
| 256 | { 47, 47, 43, 114, 137, 181, 100, 99, 95 } // left = tm |
| 257 | }, |
| 258 | { |
| 259 | // above = d135 |
| 260 | { 69, 23, 29, 128, 83, 199, 46, 44, 101 }, // left = dc |
| 261 | { 53, 40, 55, 139, 69, 183, 61, 80, 110 }, // left = v |
| 262 | { 40, 29, 19, 161, 180, 207, 43, 24, 91 }, // left = h |
| 263 | { 60, 34, 19, 105, 61, 198, 53, 64, 89 }, // left = d45 |
| 264 | { 52, 31, 22, 158, 40, 209, 58, 62, 89 }, // left = d135 |
| 265 | { 44, 31, 29, 147, 46, 158, 56, 102, 198 }, // left = d117 |
| 266 | { 35, 19, 12, 135, 87, 209, 41, 45, 167 }, // left = d153 |
| 267 | { 55, 25, 21, 118, 95, 215, 38, 39, 66 }, // left = d207 |
| 268 | { 51, 38, 25, 113, 58, 164, 70, 93, 97 }, // left = d63 |
| 269 | { 47, 54, 34, 146, 108, 203, 72, 103, 151 } // left = tm |
| 270 | }, |
| 271 | { |
| 272 | // above = d117 |
| 273 | { 64, 19, 37, 156, 66, 138, 49, 95, 133 }, // left = dc |
| 274 | { 46, 27, 80, 150, 55, 124, 55, 121, 135 }, // left = v |
| 275 | { 36, 23, 27, 165, 149, 166, 54, 64, 118 }, // left = h |
| 276 | { 53, 21, 36, 131, 63, 163, 60, 109, 81 }, // left = d45 |
| 277 | { 40, 26, 35, 154, 40, 185, 51, 97, 123 }, // left = d135 |
| 278 | { 35, 19, 34, 179, 19, 97, 48, 129, 124 }, // left = d117 |
| 279 | { 36, 20, 26, 136, 62, 164, 33, 77, 154 }, // left = d153 |
| 280 | { 45, 18, 32, 130, 90, 157, 40, 79, 91 }, // left = d207 |
| 281 | { 45, 26, 28, 129, 45, 129, 49, 147, 123 }, // left = d63 |
| 282 | { 38, 44, 51, 136, 74, 162, 57, 97, 121 } // left = tm |
| 283 | }, |
| 284 | { |
| 285 | // above = d153 |
| 286 | { 75, 17, 22, 136, 138, 185, 32, 34, 166 }, // left = dc |
| 287 | { 56, 39, 58, 133, 117, 173, 48, 53, 187 }, // left = v |
| 288 | { 35, 21, 12, 161, 212, 207, 20, 23, 145 }, // left = h |
| 289 | { 56, 29, 19, 117, 109, 181, 55, 68, 112 }, // left = d45 |
| 290 | { 47, 29, 17, 153, 64, 220, 59, 51, 114 }, // left = d135 |
| 291 | { 46, 16, 24, 136, 76, 147, 41, 64, 172 }, // left = d117 |
| 292 | { 34, 17, 11, 108, 152, 187, 13, 15, 209 }, // left = d153 |
| 293 | { 51, 24, 14, 115, 133, 209, 32, 26, 104 }, // left = d207 |
| 294 | { 55, 30, 18, 122, 79, 179, 44, 88, 116 }, // left = d63 |
| 295 | { 37, 49, 25, 129, 168, 164, 41, 54, 148 } // left = tm |
| 296 | }, |
| 297 | { |
| 298 | // above = d207 |
| 299 | { 82, 22, 32, 127, 143, 213, 39, 41, 70 }, // left = dc |
| 300 | { 62, 44, 61, 123, 105, 189, 48, 57, 64 }, // left = v |
| 301 | { 47, 25, 17, 175, 222, 220, 24, 30, 86 }, // left = h |
| 302 | { 68, 36, 17, 106, 102, 206, 59, 74, 74 }, // left = d45 |
| 303 | { 57, 39, 23, 151, 68, 216, 55, 63, 58 }, // left = d135 |
| 304 | { 49, 30, 35, 141, 70, 168, 82, 40, 115 }, // left = d117 |
| 305 | { 51, 25, 15, 136, 129, 202, 38, 35, 139 }, // left = d153 |
| 306 | { 68, 26, 16, 111, 141, 215, 29, 28, 28 }, // left = d207 |
| 307 | { 59, 39, 19, 114, 75, 180, 77, 104, 42 }, // left = d63 |
| 308 | { 40, 61, 26, 126, 152, 206, 61, 59, 93 } // left = tm |
| 309 | }, |
| 310 | { |
| 311 | // above = d63 |
| 312 | { 78, 23, 39, 111, 117, 170, 74, 124, 94 }, // left = dc |
| 313 | { 48, 34, 86, 101, 92, 146, 78, 179, 134 }, // left = v |
| 314 | { 47, 22, 24, 138, 187, 178, 68, 69, 59 }, // left = h |
| 315 | { 56, 25, 33, 105, 112, 187, 95, 177, 129 }, // left = d45 |
| 316 | { 48, 31, 27, 114, 63, 183, 82, 116, 56 }, // left = d135 |
| 317 | { 43, 28, 37, 121, 63, 123, 61, 192, 169 }, // left = d117 |
| 318 | { 42, 17, 24, 109, 97, 177, 56, 76, 122 }, // left = d153 |
| 319 | { 58, 18, 28, 105, 139, 182, 70, 92, 63 }, // left = d207 |
| 320 | { 46, 23, 32, 74, 86, 150, 67, 183, 88 }, // left = d63 |
| 321 | { 36, 38, 48, 92, 122, 165, 88, 137, 91 } // left = tm |
| 322 | }, |
| 323 | { |
| 324 | // above = tm |
| 325 | { 65, 70, 60, 155, 159, 199, 61, 60, 81 }, // left = dc |
| 326 | { 44, 78, 115, 132, 119, 173, 71, 112, 93 }, // left = v |
| 327 | { 39, 38, 21, 184, 227, 206, 42, 32, 64 }, // left = h |
| 328 | { 58, 47, 36, 124, 137, 193, 80, 82, 78 }, // left = d45 |
| 329 | { 49, 50, 35, 144, 95, 205, 63, 78, 59 }, // left = d135 |
| 330 | { 41, 53, 52, 148, 71, 142, 65, 128, 51 }, // left = d117 |
| 331 | { 40, 36, 28, 143, 143, 202, 40, 55, 137 }, // left = d153 |
| 332 | { 52, 34, 29, 129, 183, 227, 42, 35, 43 }, // left = d207 |
| 333 | { 42, 44, 44, 104, 105, 164, 64, 130, 80 }, // left = d63 |
| 334 | { 43, 81, 53, 140, 169, 204, 68, 84, 72 } // left = tm |
| 335 | } |
| 336 | }; |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 337 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 338 | static const aom_prob default_if_y_probs[BLOCK_SIZE_GROUPS][INTRA_MODES - 1] = { |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 339 | { 65, 32, 18, 144, 162, 194, 41, 51, 98 }, // block_size < 8x8 |
| 340 | { 132, 68, 18, 165, 217, 196, 45, 40, 78 }, // block_size < 16x16 |
| 341 | { 173, 80, 19, 176, 240, 193, 64, 35, 46 }, // block_size < 32x32 |
| 342 | { 221, 135, 38, 194, 248, 121, 96, 85, 29 } // block_size >= 32x32 |
| 343 | }; |
| 344 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 345 | static const aom_prob default_uv_probs[INTRA_MODES][INTRA_MODES - 1] = { |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 346 | { 120, 7, 76, 176, 208, 126, 28, 54, 103 }, // y = dc |
| 347 | { 48, 12, 154, 155, 139, 90, 34, 117, 119 }, // y = v |
| 348 | { 67, 6, 25, 204, 243, 158, 13, 21, 96 }, // y = h |
| 349 | { 97, 5, 44, 131, 176, 139, 48, 68, 97 }, // y = d45 |
| 350 | { 83, 5, 42, 156, 111, 152, 26, 49, 152 }, // y = d135 |
| 351 | { 80, 5, 58, 178, 74, 83, 33, 62, 145 }, // y = d117 |
| 352 | { 86, 5, 32, 154, 192, 168, 14, 22, 163 }, // y = d153 |
| 353 | { 85, 5, 32, 156, 216, 148, 19, 29, 73 }, // y = d207 |
| 354 | { 77, 7, 64, 116, 132, 122, 37, 126, 120 }, // y = d63 |
| 355 | { 101, 21, 107, 181, 192, 103, 19, 67, 125 } // y = tm |
| 356 | }; |
| 357 | |
Urvang Joshi | 6be4a54 | 2016-11-03 15:24:05 -0700 | [diff] [blame^] | 358 | #endif // CONFIG_ALT_INTRA |
| 359 | |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 360 | #if CONFIG_EXT_PARTITION_TYPES |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 361 | static const aom_prob |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 362 | default_partition_probs[PARTITION_CONTEXTS][EXT_PARTITION_TYPES - 1] = { |
| 363 | // 8x8 -> 4x4 |
| 364 | { 199, 122, 141, 128, 128, 128, 128 }, // a/l both not split |
| 365 | { 147, 63, 159, 128, 128, 128, 128 }, // a split, l not split |
| 366 | { 148, 133, 118, 128, 128, 128, 128 }, // l split, a not split |
| 367 | { 121, 104, 114, 128, 128, 128, 128 }, // a/l both split |
| 368 | // 16x16 -> 8x8 |
| 369 | { 174, 73, 87, 128, 128, 128, 128 }, // a/l both not split |
| 370 | { 92, 41, 83, 128, 128, 128, 128 }, // a split, l not split |
| 371 | { 82, 99, 50, 128, 128, 128, 128 }, // l split, a not split |
| 372 | { 53, 39, 39, 128, 128, 128, 128 }, // a/l both split |
| 373 | // 32x32 -> 16x16 |
| 374 | { 177, 58, 59, 128, 128, 128, 128 }, // a/l both not split |
| 375 | { 68, 26, 63, 128, 128, 128, 128 }, // a split, l not split |
| 376 | { 52, 79, 25, 128, 128, 128, 128 }, // l split, a not split |
| 377 | { 17, 14, 12, 128, 128, 128, 128 }, // a/l both split |
| 378 | // 64x64 -> 32x32 |
| 379 | { 222, 34, 30, 128, 128, 128, 128 }, // a/l both not split |
| 380 | { 72, 16, 44, 128, 128, 128, 128 }, // a split, l not split |
| 381 | { 58, 32, 12, 128, 128, 128, 128 }, // l split, a not split |
| 382 | { 10, 7, 6, 128, 128, 128, 128 }, // a/l both split |
| 383 | #if CONFIG_EXT_PARTITION |
| 384 | // 128x128 -> 64x64 |
| 385 | { 222, 34, 30, 128, 128, 128, 128 }, // a/l both not split |
| 386 | { 72, 16, 44, 128, 128, 128, 128 }, // a split, l not split |
| 387 | { 58, 32, 12, 128, 128, 128, 128 }, // l split, a not split |
| 388 | { 10, 7, 6, 128, 128, 128, 128 }, // a/l both split |
| 389 | #endif // CONFIG_EXT_PARTITION |
| 390 | }; |
| 391 | #else |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 392 | static const aom_prob |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 393 | default_partition_probs[PARTITION_CONTEXTS][PARTITION_TYPES - 1] = { |
| 394 | // 8x8 -> 4x4 |
| 395 | { 199, 122, 141 }, // a/l both not split |
| 396 | { 147, 63, 159 }, // a split, l not split |
| 397 | { 148, 133, 118 }, // l split, a not split |
| 398 | { 121, 104, 114 }, // a/l both split |
| 399 | // 16x16 -> 8x8 |
| 400 | { 174, 73, 87 }, // a/l both not split |
| 401 | { 92, 41, 83 }, // a split, l not split |
| 402 | { 82, 99, 50 }, // l split, a not split |
| 403 | { 53, 39, 39 }, // a/l both split |
| 404 | // 32x32 -> 16x16 |
| 405 | { 177, 58, 59 }, // a/l both not split |
| 406 | { 68, 26, 63 }, // a split, l not split |
| 407 | { 52, 79, 25 }, // l split, a not split |
| 408 | { 17, 14, 12 }, // a/l both split |
| 409 | // 64x64 -> 32x32 |
| 410 | { 222, 34, 30 }, // a/l both not split |
| 411 | { 72, 16, 44 }, // a split, l not split |
| 412 | { 58, 32, 12 }, // l split, a not split |
| 413 | { 10, 7, 6 }, // a/l both split |
| 414 | #if CONFIG_EXT_PARTITION |
| 415 | // 128x128 -> 64x64 |
| 416 | { 222, 34, 30 }, // a/l both not split |
| 417 | { 72, 16, 44 }, // a split, l not split |
| 418 | { 58, 32, 12 }, // l split, a not split |
| 419 | { 10, 7, 6 }, // a/l both split |
| 420 | #endif // CONFIG_EXT_PARTITION |
| 421 | }; |
| 422 | #endif // CONFIG_EXT_PARTITION_TYPES |
| 423 | |
| 424 | #if CONFIG_REF_MV |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 425 | static const aom_prob default_newmv_prob[NEWMV_MODE_CONTEXTS] = { |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 426 | 200, 180, 150, 150, 110, 70, 60, |
| 427 | }; |
| 428 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 429 | static const aom_prob default_zeromv_prob[ZEROMV_MODE_CONTEXTS] = { |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 430 | 192, 64, |
| 431 | }; |
| 432 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 433 | static const aom_prob default_refmv_prob[REFMV_MODE_CONTEXTS] = { |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 434 | 220, 220, 200, 200, 180, 128, 30, 220, 30, |
| 435 | }; |
| 436 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 437 | static const aom_prob default_drl_prob[DRL_MODE_CONTEXTS] = { 128, 160, 180, |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 438 | 128, 160 }; |
| 439 | |
| 440 | #if CONFIG_EXT_INTER |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 441 | static const aom_prob default_new2mv_prob = 180; |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 442 | #endif // CONFIG_EXT_INTER |
| 443 | #endif // CONFIG_REF_MV |
| 444 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 445 | static const aom_prob |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 446 | default_inter_mode_probs[INTER_MODE_CONTEXTS][INTER_MODES - 1] = { |
| 447 | #if CONFIG_EXT_INTER |
| 448 | // TODO(zoeliu): To adjust the initial default probs |
| 449 | { 2, 173, 34, 173 }, // 0 = both zero mv |
| 450 | { 7, 145, 85, 145 }, // 1 = one zero mv + one a predicted mv |
| 451 | { 7, 166, 63, 166 }, // 2 = two predicted mvs |
| 452 | { 7, 94, 66, 128 }, // 3 = one predicted/zero and one new mv |
| 453 | { 8, 64, 46, 128 }, // 4 = two new mvs |
| 454 | { 17, 81, 31, 128 }, // 5 = one intra neighbour + x |
| 455 | { 25, 29, 30, 96 }, // 6 = two intra neighbours |
| 456 | #else |
| 457 | { 2, 173, 34 }, // 0 = both zero mv |
| 458 | { 7, 145, 85 }, // 1 = one zero mv + one a predicted mv |
| 459 | { 7, 166, 63 }, // 2 = two predicted mvs |
| 460 | { 7, 94, 66 }, // 3 = one predicted/zero and one new mv |
| 461 | { 8, 64, 46 }, // 4 = two new mvs |
| 462 | { 17, 81, 31 }, // 5 = one intra neighbour + x |
| 463 | { 25, 29, 30 }, // 6 = two intra neighbours |
| 464 | #endif // CONFIG_EXT_INTER |
| 465 | }; |
| 466 | |
| 467 | #if CONFIG_EXT_INTER |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 468 | static const aom_prob default_inter_compound_mode_probs |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 469 | [INTER_MODE_CONTEXTS][INTER_COMPOUND_MODES - 1] = { |
| 470 | { 2, 173, 68, 192, 64, 192, 128, 180, 180 }, // 0 = both zero mv |
| 471 | { 7, 145, 160, 192, 64, 192, 128, 180, 180 }, // 1 = 1 zero + 1 predicted |
| 472 | { 7, 166, 126, 192, 64, 192, 128, 180, 180 }, // 2 = two predicted mvs |
| 473 | { 7, 94, 132, 192, 64, 192, 128, 180, 180 }, // 3 = 1 pred/zero, 1 new |
| 474 | { 8, 64, 64, 192, 64, 192, 128, 180, 180 }, // 4 = two new mvs |
| 475 | { 17, 81, 52, 192, 64, 192, 128, 180, 180 }, // 5 = one intra neighbour |
| 476 | { 25, 29, 50, 192, 64, 192, 128, 180, 180 }, // 6 = two intra neighbours |
| 477 | }; |
| 478 | |
Sarah Parker | 6fddd18 | 2016-11-10 20:57:20 -0800 | [diff] [blame] | 479 | static const aom_prob default_compound_type_probs[BLOCK_SIZES] |
| 480 | [COMPOUND_TYPES - 1] = { |
| 481 | { 208 }, { 208 }, { 208 }, |
| 482 | { 208 }, { 208 }, { 208 }, |
| 483 | { 216 }, { 216 }, { 216 }, |
| 484 | { 224 }, { 224 }, { 240 }, |
| 485 | { 240 }, |
| 486 | #if CONFIG_EXT_PARTITION |
| 487 | { 255 }, { 255 }, { 255 }, |
| 488 | #endif // CONFIG_EXT_PARTITION |
| 489 | }; |
| 490 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 491 | static const aom_prob default_interintra_prob[BLOCK_SIZE_GROUPS] = { |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 492 | 208, 208, 208, 208, |
| 493 | }; |
| 494 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 495 | static const aom_prob |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 496 | default_interintra_mode_prob[BLOCK_SIZE_GROUPS][INTERINTRA_MODES - 1] = { |
| 497 | { 65, 32, 18, 144, 162, 194, 41, 51, 98 }, // block_size < 8x8 |
| 498 | { 132, 68, 18, 165, 217, 196, 45, 40, 78 }, // block_size < 16x16 |
| 499 | { 173, 80, 19, 176, 240, 193, 64, 35, 46 }, // block_size < 32x32 |
| 500 | { 221, 135, 38, 194, 248, 121, 96, 85, 29 } // block_size >= 32x32 |
| 501 | }; |
| 502 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 503 | static const aom_prob default_wedge_interintra_prob[BLOCK_SIZES] = { |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 504 | 208, 208, 208, 208, 208, 208, 216, 216, 216, 224, 224, 224, 240, |
| 505 | #if CONFIG_EXT_PARTITION |
| 506 | 208, 208, 208 |
| 507 | #endif // CONFIG_EXT_PARTITION |
| 508 | }; |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 509 | #endif // CONFIG_EXT_INTER |
| 510 | |
| 511 | // Change this section appropriately once warped motion is supported |
Yue Chen | cb60b18 | 2016-10-13 15:18:22 -0700 | [diff] [blame] | 512 | #if CONFIG_MOTION_VAR && !CONFIG_WARPED_MOTION |
| 513 | const aom_tree_index av1_motion_mode_tree[TREE_SIZE(MOTION_MODES)] = { |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 514 | -SIMPLE_TRANSLATION, -OBMC_CAUSAL |
| 515 | }; |
Yue Chen | cb60b18 | 2016-10-13 15:18:22 -0700 | [diff] [blame] | 516 | static const aom_prob default_motion_mode_prob[BLOCK_SIZES] |
| 517 | [MOTION_MODES - 1] = { |
| 518 | { 255 }, { 255 }, { 255 }, |
| 519 | { 151 }, { 153 }, { 144 }, |
| 520 | { 178 }, { 165 }, { 160 }, |
| 521 | { 207 }, { 195 }, { 168 }, |
| 522 | { 244 }, |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 523 | #if CONFIG_EXT_PARTITION |
Yue Chen | cb60b18 | 2016-10-13 15:18:22 -0700 | [diff] [blame] | 524 | { 252 }, { 252 }, { 252 }, |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 525 | #endif // CONFIG_EXT_PARTITION |
Yue Chen | cb60b18 | 2016-10-13 15:18:22 -0700 | [diff] [blame] | 526 | }; |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 527 | |
Yue Chen | cb60b18 | 2016-10-13 15:18:22 -0700 | [diff] [blame] | 528 | #elif !CONFIG_MOTION_VAR && CONFIG_WARPED_MOTION |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 529 | |
Yue Chen | cb60b18 | 2016-10-13 15:18:22 -0700 | [diff] [blame] | 530 | const aom_tree_index av1_motion_mode_tree[TREE_SIZE(MOTION_MODES)] = { |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 531 | -SIMPLE_TRANSLATION, -WARPED_CAUSAL |
| 532 | }; |
Yue Chen | cb60b18 | 2016-10-13 15:18:22 -0700 | [diff] [blame] | 533 | static const aom_prob default_motion_mode_prob[BLOCK_SIZES] |
| 534 | [MOTION_MODES - 1] = { |
| 535 | { 255 }, { 255 }, { 255 }, |
| 536 | { 151 }, { 153 }, { 144 }, |
| 537 | { 178 }, { 165 }, { 160 }, |
| 538 | { 207 }, { 195 }, { 168 }, |
| 539 | { 244 }, |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 540 | #if CONFIG_EXT_PARTITION |
Yue Chen | cb60b18 | 2016-10-13 15:18:22 -0700 | [diff] [blame] | 541 | { 252 }, { 252 }, { 252 }, |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 542 | #endif // CONFIG_EXT_PARTITION |
Yue Chen | cb60b18 | 2016-10-13 15:18:22 -0700 | [diff] [blame] | 543 | }; |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 544 | |
Yue Chen | cb60b18 | 2016-10-13 15:18:22 -0700 | [diff] [blame] | 545 | #elif CONFIG_MOTION_VAR && CONFIG_WARPED_MOTION |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 546 | |
Yue Chen | cb60b18 | 2016-10-13 15:18:22 -0700 | [diff] [blame] | 547 | const aom_tree_index av1_motion_mode_tree[TREE_SIZE(MOTION_MODES)] = { |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 548 | -SIMPLE_TRANSLATION, 2, -OBMC_CAUSAL, -WARPED_CAUSAL, |
| 549 | }; |
Yue Chen | cb60b18 | 2016-10-13 15:18:22 -0700 | [diff] [blame] | 550 | static const aom_prob default_motion_mode_prob[BLOCK_SIZES][MOTION_MODES - 1] = |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 551 | { |
| 552 | { 255, 200 }, { 255, 200 }, { 255, 200 }, { 151, 200 }, { 153, 200 }, |
| 553 | { 144, 200 }, { 178, 200 }, { 165, 200 }, { 160, 200 }, { 207, 200 }, |
| 554 | { 195, 200 }, { 168, 200 }, { 244, 200 }, |
| 555 | #if CONFIG_EXT_PARTITION |
| 556 | { 252, 200 }, { 252, 200 }, { 252, 200 }, |
| 557 | #endif // CONFIG_EXT_PARTITION |
| 558 | }; |
Yue Chen | cb60b18 | 2016-10-13 15:18:22 -0700 | [diff] [blame] | 559 | #endif // CONFIG_MOTION_VAR || !CONFIG_WARPED_MOTION |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 560 | |
Thomas Davies | f693610 | 2016-09-05 16:51:31 +0100 | [diff] [blame] | 561 | #if CONFIG_DELTA_Q |
| 562 | static const aom_prob default_delta_q_probs[DELTA_Q_CONTEXTS] = { 220, 220, |
| 563 | 220 }; |
| 564 | #endif |
Nathan E. Egge | 3ef926e | 2016-09-07 18:20:41 -0400 | [diff] [blame] | 565 | int av1_intra_mode_ind[INTRA_MODES]; |
| 566 | int av1_intra_mode_inv[INTRA_MODES]; |
Nathan E. Egge | 6ec4d10 | 2016-09-08 10:41:20 -0400 | [diff] [blame] | 567 | int av1_inter_mode_ind[INTER_MODES]; |
| 568 | int av1_inter_mode_inv[INTER_MODES]; |
Thomas Davies | f693610 | 2016-09-05 16:51:31 +0100 | [diff] [blame] | 569 | |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 570 | /* Array indices are identical to previously-existing INTRAMODECONTEXTNODES. */ |
Urvang Joshi | 6be4a54 | 2016-11-03 15:24:05 -0700 | [diff] [blame^] | 571 | #if CONFIG_ALT_INTRA |
| 572 | const aom_tree_index av1_intra_mode_tree[TREE_SIZE(INTRA_MODES)] = { |
| 573 | -DC_PRED, 2, /* 0 = DC_NODE */ |
| 574 | -TM_PRED, 4, /* 1 = TM_NODE */ |
| 575 | -V_PRED, 6, /* 2 = V_NODE */ |
| 576 | 8, 12, /* 3 = COM_NODE */ |
| 577 | -H_PRED, 10, /* 4 = H_NODE */ |
| 578 | -D135_PRED, -D117_PRED, /* 5 = D135_NODE */ |
| 579 | -D45_PRED, 14, /* 6 = D45_NODE */ |
| 580 | -D63_PRED, 16, /* 7 = D63_NODE */ |
| 581 | -D153_PRED, 18, /* 8 = D153_NODE */ |
| 582 | -D207_PRED, -SMOOTH_PRED, /* 9 = D207_NODE */ |
| 583 | }; |
| 584 | #else |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 585 | const aom_tree_index av1_intra_mode_tree[TREE_SIZE(INTRA_MODES)] = { |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 586 | -DC_PRED, 2, /* 0 = DC_NODE */ |
| 587 | -TM_PRED, 4, /* 1 = TM_NODE */ |
| 588 | -V_PRED, 6, /* 2 = V_NODE */ |
| 589 | 8, 12, /* 3 = COM_NODE */ |
| 590 | -H_PRED, 10, /* 4 = H_NODE */ |
| 591 | -D135_PRED, -D117_PRED, /* 5 = D135_NODE */ |
| 592 | -D45_PRED, 14, /* 6 = D45_NODE */ |
| 593 | -D63_PRED, 16, /* 7 = D63_NODE */ |
| 594 | -D153_PRED, -D207_PRED /* 8 = D153_NODE */ |
| 595 | }; |
Urvang Joshi | 6be4a54 | 2016-11-03 15:24:05 -0700 | [diff] [blame^] | 596 | #endif // CONFIG_ALT_INTRA |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 597 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 598 | const aom_tree_index av1_inter_mode_tree[TREE_SIZE(INTER_MODES)] = { |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 599 | -INTER_OFFSET(ZEROMV), 2, |
| 600 | -INTER_OFFSET(NEARESTMV), 4, |
| 601 | #if CONFIG_EXT_INTER |
| 602 | -INTER_OFFSET(NEARMV), 6, |
| 603 | -INTER_OFFSET(NEWMV), -INTER_OFFSET(NEWFROMNEARMV) |
| 604 | #else |
| 605 | -INTER_OFFSET(NEARMV), -INTER_OFFSET(NEWMV) |
| 606 | #endif // CONFIG_EXT_INTER |
| 607 | }; |
| 608 | |
| 609 | #if CONFIG_EXT_INTER |
| 610 | /* clang-format off */ |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 611 | const aom_tree_index av1_interintra_mode_tree[TREE_SIZE(INTERINTRA_MODES)] = { |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 612 | -II_DC_PRED, 2, /* 0 = II_DC_NODE */ |
| 613 | -II_TM_PRED, 4, /* 1 = II_TM_NODE */ |
| 614 | -II_V_PRED, 6, /* 2 = II_V_NODE */ |
| 615 | 8, 12, /* 3 = II_COM_NODE */ |
| 616 | -II_H_PRED, 10, /* 4 = II_H_NODE */ |
| 617 | -II_D135_PRED, -II_D117_PRED, /* 5 = II_D135_NODE */ |
| 618 | -II_D45_PRED, 14, /* 6 = II_D45_NODE */ |
| 619 | -II_D63_PRED, 16, /* 7 = II_D63_NODE */ |
| 620 | -II_D153_PRED, -II_D207_PRED /* 8 = II_D153_NODE */ |
| 621 | }; |
| 622 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 623 | const aom_tree_index av1_inter_compound_mode_tree |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 624 | [TREE_SIZE(INTER_COMPOUND_MODES)] = { |
| 625 | -INTER_COMPOUND_OFFSET(ZERO_ZEROMV), 2, |
| 626 | -INTER_COMPOUND_OFFSET(NEAREST_NEARESTMV), 4, |
| 627 | 6, -INTER_COMPOUND_OFFSET(NEW_NEWMV), |
| 628 | 8, 12, |
| 629 | -INTER_COMPOUND_OFFSET(NEAR_NEARMV), 10, |
| 630 | -INTER_COMPOUND_OFFSET(NEAREST_NEARMV), |
| 631 | -INTER_COMPOUND_OFFSET(NEAR_NEARESTMV), |
| 632 | 14, 16, |
| 633 | -INTER_COMPOUND_OFFSET(NEAREST_NEWMV), -INTER_COMPOUND_OFFSET(NEW_NEARESTMV), |
| 634 | -INTER_COMPOUND_OFFSET(NEAR_NEWMV), -INTER_COMPOUND_OFFSET(NEW_NEARMV) |
| 635 | }; |
Sarah Parker | 6fddd18 | 2016-11-10 20:57:20 -0800 | [diff] [blame] | 636 | |
| 637 | const aom_tree_index av1_compound_type_tree[TREE_SIZE(COMPOUND_TYPES)] = { |
| 638 | -COMPOUND_AVERAGE, -COMPOUND_WEDGE |
| 639 | }; |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 640 | /* clang-format on */ |
| 641 | #endif // CONFIG_EXT_INTER |
| 642 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 643 | const aom_tree_index av1_partition_tree[TREE_SIZE(PARTITION_TYPES)] = { |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 644 | -PARTITION_NONE, 2, -PARTITION_HORZ, 4, -PARTITION_VERT, -PARTITION_SPLIT |
| 645 | }; |
| 646 | |
| 647 | #if CONFIG_EXT_PARTITION_TYPES |
| 648 | /* clang-format off */ |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 649 | const aom_tree_index av1_ext_partition_tree[TREE_SIZE(EXT_PARTITION_TYPES)] = { |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 650 | -PARTITION_NONE, 2, |
| 651 | 6, 4, |
| 652 | 8, -PARTITION_SPLIT, |
| 653 | -PARTITION_HORZ, 10, |
| 654 | -PARTITION_VERT, 12, |
| 655 | -PARTITION_HORZ_A, -PARTITION_HORZ_B, |
| 656 | -PARTITION_VERT_A, -PARTITION_VERT_B |
| 657 | }; |
| 658 | /* clang-format on */ |
| 659 | #endif // CONFIG_EXT_PARTITION_TYPES |
| 660 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 661 | static const aom_prob default_intra_inter_p[INTRA_INTER_CONTEXTS] = { |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 662 | 9, 102, 187, 225 |
| 663 | }; |
| 664 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 665 | static const aom_prob default_comp_inter_p[COMP_INTER_CONTEXTS] = { |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 666 | 239, 183, 119, 96, 41 |
| 667 | }; |
| 668 | |
| 669 | #if CONFIG_EXT_REFS |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 670 | static const aom_prob default_comp_ref_p[REF_CONTEXTS][FWD_REFS - 1] = { |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 671 | // TODO(zoeliu): To adjust the initial prob values. |
| 672 | { 33, 16, 16 }, |
| 673 | { 77, 74, 74 }, |
| 674 | { 142, 142, 142 }, |
| 675 | { 172, 170, 170 }, |
| 676 | { 238, 247, 247 } |
| 677 | }; |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 678 | static const aom_prob default_comp_bwdref_p[REF_CONTEXTS][BWD_REFS - 1] = { |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 679 | { 16 }, { 74 }, { 142 }, { 170 }, { 247 } |
| 680 | }; |
| 681 | #else |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 682 | static const aom_prob default_comp_ref_p[REF_CONTEXTS][COMP_REFS - 1] = { |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 683 | { 50 }, { 126 }, { 123 }, { 221 }, { 226 } |
| 684 | }; |
| 685 | #endif // CONFIG_EXT_REFS |
| 686 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 687 | static const aom_prob default_single_ref_p[REF_CONTEXTS][SINGLE_REFS - 1] = { |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 688 | #if CONFIG_EXT_REFS |
| 689 | { 33, 16, 16, 16, 16 }, |
| 690 | { 77, 74, 74, 74, 74 }, |
| 691 | { 142, 142, 142, 142, 142 }, |
| 692 | { 172, 170, 170, 170, 170 }, |
| 693 | { 238, 247, 247, 247, 247 } |
| 694 | #else |
| 695 | { 33, 16 }, { 77, 74 }, { 142, 142 }, { 172, 170 }, { 238, 247 } |
| 696 | #endif // CONFIG_EXT_REFS |
| 697 | }; |
| 698 | |
Urvang Joshi | b100db7 | 2016-10-12 16:28:56 -0700 | [diff] [blame] | 699 | #if CONFIG_PALETTE |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 700 | const aom_tree_index av1_palette_size_tree[TREE_SIZE(PALETTE_SIZES)] = { |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 701 | -TWO_COLORS, 2, -THREE_COLORS, 4, -FOUR_COLORS, 6, |
| 702 | -FIVE_COLORS, 8, -SIX_COLORS, 10, -SEVEN_COLORS, -EIGHT_COLORS, |
| 703 | }; |
| 704 | |
| 705 | // TODO(huisu): tune these probs |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 706 | const aom_prob |
| 707 | av1_default_palette_y_size_prob[PALETTE_BLOCK_SIZES][PALETTE_SIZES - 1] = { |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 708 | { 96, 89, 100, 64, 77, 130 }, { 22, 15, 44, 16, 34, 82 }, |
| 709 | { 30, 19, 57, 18, 38, 86 }, { 94, 36, 104, 23, 43, 92 }, |
| 710 | { 116, 76, 107, 46, 65, 105 }, { 112, 82, 94, 40, 70, 112 }, |
| 711 | { 147, 124, 123, 58, 69, 103 }, { 180, 113, 136, 49, 45, 114 }, |
| 712 | { 107, 70, 87, 49, 154, 156 }, { 98, 105, 142, 63, 64, 152 }, |
| 713 | #if CONFIG_EXT_PARTITION |
| 714 | { 98, 105, 142, 63, 64, 152 }, { 98, 105, 142, 63, 64, 152 }, |
| 715 | { 98, 105, 142, 63, 64, 152 }, |
| 716 | #endif // CONFIG_EXT_PARTITION |
| 717 | }; |
| 718 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 719 | const aom_prob |
| 720 | av1_default_palette_uv_size_prob[PALETTE_BLOCK_SIZES][PALETTE_SIZES - 1] = { |
| 721 | { 160, 196, 228, 213, 175, 230 }, { 87, 148, 208, 141, 166, 163 }, |
| 722 | { 72, 151, 204, 139, 155, 161 }, { 78, 135, 171, 104, 120, 173 }, |
| 723 | { 59, 92, 131, 78, 92, 142 }, { 75, 118, 149, 84, 90, 128 }, |
| 724 | { 89, 87, 92, 66, 66, 128 }, { 67, 53, 54, 55, 66, 93 }, |
| 725 | { 120, 130, 83, 171, 75, 214 }, { 72, 55, 66, 68, 79, 107 }, |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 726 | #if CONFIG_EXT_PARTITION |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 727 | { 72, 55, 66, 68, 79, 107 }, { 72, 55, 66, 68, 79, 107 }, |
| 728 | { 72, 55, 66, 68, 79, 107 }, |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 729 | #endif // CONFIG_EXT_PARTITION |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 730 | }; |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 731 | |
clang-format | 67948d3 | 2016-09-07 22:40:40 -0700 | [diff] [blame] | 732 | const aom_prob |
| 733 | av1_default_palette_y_mode_prob[PALETTE_BLOCK_SIZES] |
| 734 | [PALETTE_Y_MODE_CONTEXTS] = { |
| 735 | { 240, 180, 100 }, { 240, 180, 100 }, |
| 736 | { 240, 180, 100 }, { 240, 180, 100 }, |
| 737 | { 240, 180, 100 }, { 240, 180, 100 }, |
| 738 | { 240, 180, 100 }, { 240, 180, 100 }, |
| 739 | { 240, 180, 100 }, { 240, 180, 100 }, |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 740 | #if CONFIG_EXT_PARTITION |
clang-format | 67948d3 | 2016-09-07 22:40:40 -0700 | [diff] [blame] | 741 | { 240, 180, 100 }, { 240, 180, 100 }, |
| 742 | { 240, 180, 100 }, |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 743 | #endif // CONFIG_EXT_PARTITION |
clang-format | 67948d3 | 2016-09-07 22:40:40 -0700 | [diff] [blame] | 744 | }; |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 745 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 746 | const aom_prob av1_default_palette_uv_mode_prob[2] = { 253, 229 }; |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 747 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 748 | const aom_tree_index |
| 749 | av1_palette_color_tree[PALETTE_MAX_SIZE - 1][TREE_SIZE(PALETTE_COLORS)] = { |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 750 | { // 2 colors |
| 751 | -PALETTE_COLOR_ONE, -PALETTE_COLOR_TWO }, |
| 752 | { // 3 colors |
| 753 | -PALETTE_COLOR_ONE, 2, -PALETTE_COLOR_TWO, -PALETTE_COLOR_THREE }, |
| 754 | { // 4 colors |
| 755 | -PALETTE_COLOR_ONE, 2, -PALETTE_COLOR_TWO, 4, -PALETTE_COLOR_THREE, |
| 756 | -PALETTE_COLOR_FOUR }, |
| 757 | { // 5 colors |
| 758 | -PALETTE_COLOR_ONE, 2, -PALETTE_COLOR_TWO, 4, -PALETTE_COLOR_THREE, 6, |
| 759 | -PALETTE_COLOR_FOUR, -PALETTE_COLOR_FIVE }, |
| 760 | { // 6 colors |
| 761 | -PALETTE_COLOR_ONE, 2, -PALETTE_COLOR_TWO, 4, -PALETTE_COLOR_THREE, 6, |
| 762 | -PALETTE_COLOR_FOUR, 8, -PALETTE_COLOR_FIVE, -PALETTE_COLOR_SIX }, |
| 763 | { // 7 colors |
| 764 | -PALETTE_COLOR_ONE, 2, -PALETTE_COLOR_TWO, 4, -PALETTE_COLOR_THREE, 6, |
| 765 | -PALETTE_COLOR_FOUR, 8, -PALETTE_COLOR_FIVE, 10, -PALETTE_COLOR_SIX, |
| 766 | -PALETTE_COLOR_SEVEN }, |
| 767 | { // 8 colors |
| 768 | -PALETTE_COLOR_ONE, 2, -PALETTE_COLOR_TWO, 4, -PALETTE_COLOR_THREE, 6, |
| 769 | -PALETTE_COLOR_FOUR, 8, -PALETTE_COLOR_FIVE, 10, -PALETTE_COLOR_SIX, 12, |
| 770 | -PALETTE_COLOR_SEVEN, -PALETTE_COLOR_EIGHT }, |
| 771 | }; |
| 772 | |
Urvang Joshi | eb54e0c | 2016-11-01 15:25:57 -0700 | [diff] [blame] | 773 | // Note: Has to be non-zero to avoid any asserts triggering. |
| 774 | #define UNUSED_PROB 128 |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 775 | |
Urvang Joshi | eb54e0c | 2016-11-01 15:25:57 -0700 | [diff] [blame] | 776 | const aom_prob av1_default_palette_y_color_prob |
| 777 | [PALETTE_MAX_SIZE - 1][PALETTE_COLOR_CONTEXTS][PALETTE_COLORS - 1] = { |
| 778 | { |
| 779 | // 2 colors |
| 780 | { 230, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 781 | UNUSED_PROB, UNUSED_PROB }, |
| 782 | { 214, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 783 | UNUSED_PROB, UNUSED_PROB }, |
| 784 | { UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 785 | UNUSED_PROB, UNUSED_PROB }, |
| 786 | { UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 787 | UNUSED_PROB, UNUSED_PROB }, |
| 788 | { UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 789 | UNUSED_PROB, UNUSED_PROB }, |
| 790 | { 240, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 791 | UNUSED_PROB, UNUSED_PROB }, |
| 792 | { 73, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 793 | UNUSED_PROB }, |
| 794 | { UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 795 | UNUSED_PROB, UNUSED_PROB }, |
| 796 | { 130, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 797 | UNUSED_PROB, UNUSED_PROB }, |
| 798 | { 227, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 799 | UNUSED_PROB, UNUSED_PROB }, |
| 800 | { UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 801 | UNUSED_PROB, UNUSED_PROB }, |
| 802 | { 188, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 803 | UNUSED_PROB, UNUSED_PROB }, |
| 804 | { 75, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 805 | UNUSED_PROB }, |
| 806 | { 250, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 807 | UNUSED_PROB, UNUSED_PROB }, |
| 808 | { 223, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 809 | UNUSED_PROB, UNUSED_PROB }, |
| 810 | { 252, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 811 | UNUSED_PROB, UNUSED_PROB }, |
| 812 | }, |
| 813 | { |
| 814 | // 3 colors |
| 815 | { 229, 137, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 816 | UNUSED_PROB }, |
| 817 | { 197, 120, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 818 | UNUSED_PROB }, |
| 819 | { 107, 195, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 820 | UNUSED_PROB }, |
| 821 | { UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 822 | UNUSED_PROB, UNUSED_PROB }, |
| 823 | { 27, 151, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 824 | UNUSED_PROB }, |
| 825 | { 230, 130, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 826 | UNUSED_PROB }, |
| 827 | { 37, 230, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 828 | UNUSED_PROB }, |
| 829 | { 67, 221, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 830 | UNUSED_PROB }, |
| 831 | { 124, 230, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 832 | UNUSED_PROB }, |
| 833 | { 195, 109, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 834 | UNUSED_PROB }, |
| 835 | { 99, 122, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 836 | UNUSED_PROB }, |
| 837 | { 205, 208, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 838 | UNUSED_PROB }, |
| 839 | { 40, 235, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 840 | UNUSED_PROB }, |
| 841 | { 251, 132, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 842 | UNUSED_PROB }, |
| 843 | { 237, 186, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 844 | UNUSED_PROB }, |
| 845 | { 253, 112, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 846 | UNUSED_PROB }, |
| 847 | }, |
| 848 | { |
| 849 | // 4 colors |
| 850 | { 195, 87, 128, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 851 | { 143, 100, 123, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 852 | { 94, 124, 119, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 853 | { 77, 91, 130, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 854 | { 39, 114, 178, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 855 | { 222, 94, 125, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 856 | { 44, 203, 132, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 857 | { 68, 175, 122, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 858 | { 110, 187, 124, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 859 | { 152, 91, 128, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 860 | { 70, 109, 181, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 861 | { 133, 113, 164, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 862 | { 47, 205, 133, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 863 | { 247, 94, 136, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 864 | { 205, 122, 146, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 865 | { 251, 100, 141, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 866 | }, |
| 867 | { |
| 868 | // 5 colors |
| 869 | { 195, 65, 84, 125, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 870 | { 150, 76, 84, 121, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 871 | { 94, 110, 81, 117, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 872 | { 79, 85, 91, 139, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 873 | { 26, 102, 139, 127, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 874 | { 220, 73, 91, 119, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 875 | { 38, 203, 86, 127, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 876 | { 61, 186, 72, 124, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 877 | { 132, 199, 84, 128, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 878 | { 172, 52, 62, 120, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 879 | { 102, 89, 121, 122, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 880 | { 182, 48, 69, 186, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 881 | { 36, 206, 87, 126, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 882 | { 249, 55, 67, 122, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 883 | { 218, 88, 75, 122, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 884 | { 253, 64, 80, 119, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 885 | }, |
| 886 | { |
| 887 | // 6 colors |
| 888 | { 182, 54, 64, 75, 118, UNUSED_PROB, UNUSED_PROB }, |
| 889 | { 126, 67, 70, 76, 116, UNUSED_PROB, UNUSED_PROB }, |
| 890 | { 79, 92, 67, 85, 120, UNUSED_PROB, UNUSED_PROB }, |
| 891 | { 63, 61, 81, 118, 132, UNUSED_PROB, UNUSED_PROB }, |
| 892 | { 21, 80, 105, 83, 119, UNUSED_PROB, UNUSED_PROB }, |
| 893 | { 215, 72, 74, 74, 111, UNUSED_PROB, UNUSED_PROB }, |
| 894 | { 50, 176, 63, 79, 120, UNUSED_PROB, UNUSED_PROB }, |
| 895 | { 72, 148, 66, 77, 120, UNUSED_PROB, UNUSED_PROB }, |
| 896 | { 105, 177, 57, 78, 130, UNUSED_PROB, UNUSED_PROB }, |
| 897 | { 150, 66, 66, 80, 127, UNUSED_PROB, UNUSED_PROB }, |
| 898 | { 81, 76, 109, 85, 116, UNUSED_PROB, UNUSED_PROB }, |
| 899 | { 113, 81, 62, 96, 148, UNUSED_PROB, UNUSED_PROB }, |
| 900 | { 54, 179, 69, 82, 121, UNUSED_PROB, UNUSED_PROB }, |
| 901 | { 244, 47, 48, 67, 118, UNUSED_PROB, UNUSED_PROB }, |
| 902 | { 198, 83, 53, 65, 121, UNUSED_PROB, UNUSED_PROB }, |
| 903 | { 250, 42, 51, 69, 110, UNUSED_PROB, UNUSED_PROB }, |
| 904 | }, |
| 905 | { |
| 906 | // 7 colors |
| 907 | { 182, 45, 54, 62, 74, 113, UNUSED_PROB }, |
| 908 | { 124, 63, 57, 62, 77, 114, UNUSED_PROB }, |
| 909 | { 77, 80, 56, 66, 76, 117, UNUSED_PROB }, |
| 910 | { 63, 57, 69, 98, 85, 131, UNUSED_PROB }, |
| 911 | { 19, 81, 98, 63, 80, 116, UNUSED_PROB }, |
| 912 | { 215, 56, 60, 63, 68, 105, UNUSED_PROB }, |
| 913 | { 50, 174, 50, 60, 79, 118, UNUSED_PROB }, |
| 914 | { 68, 151, 50, 58, 73, 117, UNUSED_PROB }, |
| 915 | { 104, 182, 53, 57, 79, 127, UNUSED_PROB }, |
| 916 | { 156, 50, 51, 63, 77, 111, UNUSED_PROB }, |
| 917 | { 88, 67, 97, 59, 82, 120, UNUSED_PROB }, |
| 918 | { 114, 81, 46, 65, 103, 132, UNUSED_PROB }, |
| 919 | { 55, 166, 57, 66, 82, 120, UNUSED_PROB }, |
| 920 | { 245, 34, 38, 43, 63, 114, UNUSED_PROB }, |
| 921 | { 203, 68, 45, 47, 60, 118, UNUSED_PROB }, |
| 922 | { 250, 35, 37, 47, 66, 110, UNUSED_PROB }, |
| 923 | }, |
| 924 | { |
| 925 | // 8 colors |
| 926 | { 180, 43, 46, 50, 56, 69, 109 }, |
| 927 | { 116, 53, 51, 49, 57, 73, 115 }, |
| 928 | { 79, 70, 49, 50, 59, 74, 117 }, |
| 929 | { 60, 54, 57, 70, 62, 83, 129 }, |
| 930 | { 20, 73, 85, 52, 66, 81, 119 }, |
| 931 | { 213, 56, 52, 49, 53, 62, 104 }, |
| 932 | { 48, 161, 41, 45, 56, 77, 116 }, |
| 933 | { 68, 139, 40, 47, 54, 71, 116 }, |
| 934 | { 123, 166, 42, 43, 52, 76, 130 }, |
| 935 | { 153, 44, 44, 47, 54, 79, 129 }, |
| 936 | { 87, 64, 83, 49, 60, 75, 127 }, |
| 937 | { 131, 68, 43, 48, 73, 96, 130 }, |
| 938 | { 55, 152, 45, 51, 64, 77, 113 }, |
| 939 | { 243, 30, 28, 33, 41, 65, 114 }, |
| 940 | { 202, 56, 35, 36, 42, 63, 123 }, |
| 941 | { 249, 31, 29, 32, 45, 68, 111 }, |
| 942 | } |
| 943 | }; |
| 944 | |
| 945 | const aom_prob av1_default_palette_uv_color_prob |
| 946 | [PALETTE_MAX_SIZE - 1][PALETTE_COLOR_CONTEXTS][PALETTE_COLORS - 1] = { |
| 947 | { |
| 948 | // 2 colors |
| 949 | { 228, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 950 | UNUSED_PROB, UNUSED_PROB }, |
| 951 | { 195, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 952 | UNUSED_PROB, UNUSED_PROB }, |
| 953 | { UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 954 | UNUSED_PROB, UNUSED_PROB }, |
| 955 | { UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 956 | UNUSED_PROB, UNUSED_PROB }, |
| 957 | { UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 958 | UNUSED_PROB, UNUSED_PROB }, |
| 959 | { 228, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 960 | UNUSED_PROB, UNUSED_PROB }, |
| 961 | { 71, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 962 | UNUSED_PROB }, |
| 963 | { UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 964 | UNUSED_PROB, UNUSED_PROB }, |
| 965 | { 129, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 966 | UNUSED_PROB, UNUSED_PROB }, |
| 967 | { 206, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 968 | UNUSED_PROB, UNUSED_PROB }, |
| 969 | { UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 970 | UNUSED_PROB, UNUSED_PROB }, |
| 971 | { 136, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 972 | UNUSED_PROB, UNUSED_PROB }, |
| 973 | { 98, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 974 | UNUSED_PROB }, |
| 975 | { 236, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 976 | UNUSED_PROB, UNUSED_PROB }, |
| 977 | { 222, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 978 | UNUSED_PROB, UNUSED_PROB }, |
| 979 | { 249, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 980 | UNUSED_PROB, UNUSED_PROB }, |
| 981 | }, |
| 982 | { |
| 983 | // 3 colors |
| 984 | { 198, 136, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 985 | UNUSED_PROB }, |
| 986 | { 178, 105, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 987 | UNUSED_PROB }, |
| 988 | { 100, 206, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 989 | UNUSED_PROB }, |
| 990 | { UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 991 | UNUSED_PROB, UNUSED_PROB }, |
| 992 | { 12, 136, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 993 | UNUSED_PROB }, |
| 994 | { 219, 134, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 995 | UNUSED_PROB }, |
| 996 | { 50, 198, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 997 | UNUSED_PROB }, |
| 998 | { 61, 231, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 999 | UNUSED_PROB }, |
| 1000 | { 110, 209, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 1001 | UNUSED_PROB }, |
| 1002 | { 173, 106, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 1003 | UNUSED_PROB }, |
| 1004 | { 145, 166, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 1005 | UNUSED_PROB }, |
| 1006 | { 156, 175, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 1007 | UNUSED_PROB }, |
| 1008 | { 69, 183, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 1009 | UNUSED_PROB }, |
| 1010 | { 241, 163, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 1011 | UNUSED_PROB }, |
| 1012 | { 224, 160, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 1013 | UNUSED_PROB }, |
| 1014 | { 246, 154, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, |
| 1015 | UNUSED_PROB }, |
| 1016 | }, |
| 1017 | { |
| 1018 | // 4 colors |
| 1019 | { 173, 88, 143, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 1020 | { 146, 81, 127, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 1021 | { 84, 134, 102, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 1022 | { 69, 138, 140, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 1023 | { 31, 103, 200, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 1024 | { 217, 101, 139, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 1025 | { 51, 174, 121, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 1026 | { 64, 177, 109, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 1027 | { 96, 179, 145, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 1028 | { 164, 77, 114, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 1029 | { 87, 94, 156, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 1030 | { 105, 57, 173, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 1031 | { 63, 158, 137, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 1032 | { 236, 102, 156, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 1033 | { 197, 115, 153, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 1034 | { 245, 106, 154, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 1035 | }, |
| 1036 | { |
| 1037 | // 5 colors |
| 1038 | { 179, 64, 97, 129, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 1039 | { 137, 56, 88, 125, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 1040 | { 82, 107, 61, 118, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 1041 | { 59, 113, 86, 115, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 1042 | { 23, 88, 118, 130, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 1043 | { 213, 66, 90, 125, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 1044 | { 37, 181, 103, 121, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 1045 | { 47, 188, 61, 131, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 1046 | { 104, 185, 103, 144, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 1047 | { 163, 39, 76, 112, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 1048 | { 94, 74, 131, 126, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 1049 | { 142, 42, 103, 163, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 1050 | { 53, 162, 99, 149, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 1051 | { 239, 54, 84, 108, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 1052 | { 203, 84, 110, 147, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 1053 | { 248, 70, 105, 151, UNUSED_PROB, UNUSED_PROB, UNUSED_PROB }, |
| 1054 | }, |
| 1055 | { |
| 1056 | // 6 colors |
| 1057 | { 189, 50, 67, 90, 130, UNUSED_PROB, UNUSED_PROB }, |
| 1058 | { 114, 50, 55, 90, 123, UNUSED_PROB, UNUSED_PROB }, |
| 1059 | { 66, 76, 54, 82, 128, UNUSED_PROB, UNUSED_PROB }, |
| 1060 | { 43, 69, 69, 80, 129, UNUSED_PROB, UNUSED_PROB }, |
| 1061 | { 22, 59, 87, 88, 141, UNUSED_PROB, UNUSED_PROB }, |
| 1062 | { 203, 49, 68, 87, 122, UNUSED_PROB, UNUSED_PROB }, |
| 1063 | { 43, 157, 74, 104, 146, UNUSED_PROB, UNUSED_PROB }, |
| 1064 | { 54, 138, 51, 95, 138, UNUSED_PROB, UNUSED_PROB }, |
| 1065 | { 82, 171, 58, 102, 146, UNUSED_PROB, UNUSED_PROB }, |
| 1066 | { 129, 38, 59, 64, 168, UNUSED_PROB, UNUSED_PROB }, |
| 1067 | { 56, 67, 119, 92, 112, UNUSED_PROB, UNUSED_PROB }, |
| 1068 | { 96, 62, 53, 132, 82, UNUSED_PROB, UNUSED_PROB }, |
| 1069 | { 60, 147, 77, 108, 145, UNUSED_PROB, UNUSED_PROB }, |
| 1070 | { 238, 76, 73, 93, 148, UNUSED_PROB, UNUSED_PROB }, |
| 1071 | { 189, 86, 73, 103, 157, UNUSED_PROB, UNUSED_PROB }, |
| 1072 | { 246, 62, 75, 83, 167, UNUSED_PROB, UNUSED_PROB }, |
| 1073 | }, |
| 1074 | { |
| 1075 | // 7 colors |
| 1076 | { 179, 42, 51, 73, 99, 134, UNUSED_PROB }, |
| 1077 | { 119, 52, 52, 61, 64, 114, UNUSED_PROB }, |
| 1078 | { 53, 77, 35, 65, 71, 131, UNUSED_PROB }, |
| 1079 | { 38, 70, 51, 68, 89, 144, UNUSED_PROB }, |
| 1080 | { 23, 65, 128, 73, 97, 131, UNUSED_PROB }, |
| 1081 | { 210, 47, 52, 63, 81, 143, UNUSED_PROB }, |
| 1082 | { 42, 159, 57, 68, 98, 143, UNUSED_PROB }, |
| 1083 | { 49, 153, 45, 82, 93, 143, UNUSED_PROB }, |
| 1084 | { 81, 169, 52, 72, 113, 151, UNUSED_PROB }, |
| 1085 | { 136, 46, 35, 56, 75, 96, UNUSED_PROB }, |
| 1086 | { 57, 84, 109, 47, 107, 131, UNUSED_PROB }, |
| 1087 | { 128, 78, 57, 36, 128, 85, UNUSED_PROB }, |
| 1088 | { 54, 149, 68, 77, 94, 153, UNUSED_PROB }, |
| 1089 | { 243, 58, 50, 71, 81, 167, UNUSED_PROB }, |
| 1090 | { 189, 92, 64, 70, 121, 173, UNUSED_PROB }, |
| 1091 | { 248, 35, 38, 51, 82, 201, UNUSED_PROB }, |
| 1092 | }, |
| 1093 | { |
| 1094 | // 8 colors |
| 1095 | { 201, 40, 36, 42, 64, 92, 123 }, |
| 1096 | { 116, 43, 33, 43, 73, 102, 128 }, |
| 1097 | { 46, 77, 37, 69, 62, 78, 150 }, |
| 1098 | { 40, 65, 52, 50, 76, 89, 133 }, |
| 1099 | { 28, 48, 91, 17, 64, 77, 133 }, |
| 1100 | { 218, 43, 43, 37, 56, 72, 163 }, |
| 1101 | { 41, 155, 44, 83, 82, 129, 180 }, |
| 1102 | { 44, 141, 29, 55, 64, 89, 147 }, |
| 1103 | { 92, 166, 48, 45, 59, 126, 179 }, |
| 1104 | { 169, 35, 49, 41, 36, 99, 139 }, |
| 1105 | { 55, 77, 77, 56, 60, 75, 156 }, |
| 1106 | { 155, 81, 51, 64, 57, 182, 255 }, |
| 1107 | { 60, 134, 49, 49, 93, 128, 174 }, |
| 1108 | { 244, 98, 51, 46, 22, 73, 238 }, |
| 1109 | { 189, 70, 40, 87, 93, 79, 201 }, |
| 1110 | { 248, 54, 49, 40, 29, 42, 227 }, |
| 1111 | } |
| 1112 | }; |
| 1113 | |
| 1114 | #undef UNUSED_PROB |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1115 | |
| 1116 | static const int palette_color_context_lookup[PALETTE_COLOR_CONTEXTS] = { |
| 1117 | // (3, 0, 0, 0), (3, 2, 0, 0), (3, 3, 2, 0), (3, 3, 2, 2), |
| 1118 | 3993, 4235, 4378, 4380, |
| 1119 | // (4, 3, 3, 0), (5, 0, 0, 0), (5, 3, 0, 0), (5, 3, 2, 0), |
| 1120 | 5720, 6655, 7018, 7040, |
| 1121 | // (5, 5, 0, 0), (6, 2, 0, 0), (6, 2, 2, 0), (6, 4, 0, 0), |
| 1122 | 7260, 8228, 8250, 8470, |
| 1123 | // (7, 3, 0, 0), (8, 0, 0, 0), (8, 2, 0, 0), (10, 0, 0, 0) |
| 1124 | 9680, 10648, 10890, 13310 |
| 1125 | }; |
Urvang Joshi | b100db7 | 2016-10-12 16:28:56 -0700 | [diff] [blame] | 1126 | #endif // CONFIG_PALETTE |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1127 | |
Jingning Han | b4329a2 | 2016-11-22 16:20:13 -0800 | [diff] [blame] | 1128 | // The transform size is coded as an offset to the smallest transform |
| 1129 | // block size. |
Jingning Han | 607fa6a | 2016-10-26 10:46:28 -0700 | [diff] [blame] | 1130 | const aom_tree_index av1_tx_size_tree[MAX_TX_DEPTH][TREE_SIZE(TX_SIZES)] = { |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1131 | { |
| 1132 | // Max tx_size is 8X8 |
Jingning Han | b4329a2 | 2016-11-22 16:20:13 -0800 | [diff] [blame] | 1133 | -0, -1, |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1134 | }, |
| 1135 | { |
| 1136 | // Max tx_size is 16X16 |
Jingning Han | b4329a2 | 2016-11-22 16:20:13 -0800 | [diff] [blame] | 1137 | -0, 2, -1, -2, |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1138 | }, |
| 1139 | { |
| 1140 | // Max tx_size is 32X32 |
Jingning Han | b4329a2 | 2016-11-22 16:20:13 -0800 | [diff] [blame] | 1141 | -0, 2, -1, 4, -2, -3, |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1142 | }, |
Debargha Mukherjee | 18d38f6 | 2016-11-17 20:30:16 -0800 | [diff] [blame] | 1143 | #if CONFIG_TX64X64 |
Debargha Mukherjee | 25ed530 | 2016-11-22 12:13:41 -0800 | [diff] [blame] | 1144 | { |
| 1145 | // Max tx_size is 64X64 |
Jingning Han | b4329a2 | 2016-11-22 16:20:13 -0800 | [diff] [blame] | 1146 | -0, 2, -1, 4, -2, 6, -3, -4, |
Debargha Mukherjee | 25ed530 | 2016-11-22 12:13:41 -0800 | [diff] [blame] | 1147 | }, |
Debargha Mukherjee | 18d38f6 | 2016-11-17 20:30:16 -0800 | [diff] [blame] | 1148 | #endif // CONFIG_TX64X64 |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1149 | }; |
| 1150 | |
Jingning Han | aae72a6 | 2016-10-25 15:35:29 -0700 | [diff] [blame] | 1151 | static const aom_prob default_tx_size_prob[MAX_TX_DEPTH][TX_SIZE_CONTEXTS] |
| 1152 | [MAX_TX_DEPTH] = { |
clang-format | 67948d3 | 2016-09-07 22:40:40 -0700 | [diff] [blame] | 1153 | { |
| 1154 | // Max tx_size is 8X8 |
| 1155 | { 100 }, |
| 1156 | { 66 }, |
| 1157 | }, |
| 1158 | { |
| 1159 | // Max tx_size is 16X16 |
| 1160 | { 20, 152 }, |
| 1161 | { 15, 101 }, |
| 1162 | }, |
| 1163 | { |
| 1164 | // Max tx_size is 32X32 |
| 1165 | { 3, 136, 37 }, |
| 1166 | { 5, 52, 13 }, |
| 1167 | }, |
Debargha Mukherjee | 18d38f6 | 2016-11-17 20:30:16 -0800 | [diff] [blame] | 1168 | #if CONFIG_TX64X64 |
| 1169 | { |
| 1170 | // Max tx_size is 64X64 |
| 1171 | { 1, 64, 136, 127 }, |
| 1172 | { 1, 32, 52, 67 }, |
| 1173 | }, |
| 1174 | #endif // CONFIG_TX64X64 |
clang-format | 67948d3 | 2016-09-07 22:40:40 -0700 | [diff] [blame] | 1175 | }; |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1176 | |
Debargha Mukherjee | 5cd2ab9 | 2016-09-08 15:15:17 -0700 | [diff] [blame] | 1177 | #if CONFIG_LOOP_RESTORATION |
Debargha Mukherjee | 8f209a8 | 2016-10-12 10:47:01 -0700 | [diff] [blame] | 1178 | const aom_tree_index av1_switchable_restore_tree[TREE_SIZE( |
| 1179 | RESTORE_SWITCHABLE_TYPES)] = { |
| 1180 | -RESTORE_NONE, 2, -RESTORE_SGRPROJ, 4, -RESTORE_BILATERAL, -RESTORE_WIENER, |
| 1181 | }; |
Debargha Mukherjee | 5cd2ab9 | 2016-09-08 15:15:17 -0700 | [diff] [blame] | 1182 | |
Debargha Mukherjee | 8f209a8 | 2016-10-12 10:47:01 -0700 | [diff] [blame] | 1183 | static const aom_prob default_switchable_restore_prob[RESTORE_SWITCHABLE_TYPES - |
| 1184 | 1] = { 32, 85, 128 }; |
Debargha Mukherjee | 5cd2ab9 | 2016-09-08 15:15:17 -0700 | [diff] [blame] | 1185 | #endif // CONFIG_LOOP_RESTORATION |
| 1186 | |
Urvang Joshi | b100db7 | 2016-10-12 16:28:56 -0700 | [diff] [blame] | 1187 | #if CONFIG_PALETTE |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 1188 | int av1_get_palette_color_context(const uint8_t *color_map, int cols, int r, |
Urvang Joshi | 967ff39 | 2016-09-07 14:57:49 -0700 | [diff] [blame] | 1189 | int c, int n, uint8_t *color_order, |
| 1190 | int *color_idx) { |
Urvang Joshi | 4f4b68e | 2016-10-24 17:11:10 -0700 | [diff] [blame] | 1191 | int i; |
| 1192 | // The +10 below should not be needed. But we get a warning "array subscript |
| 1193 | // is above array bounds [-Werror=array-bounds]" without it, possibly due to |
| 1194 | // this (or similar) bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59124 |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1195 | int scores[PALETTE_MAX_SIZE + 10]; |
Urvang Joshi | 4f4b68e | 2016-10-24 17:11:10 -0700 | [diff] [blame] | 1196 | const int weights[4] = { 3, 2, 3, 2 }; |
Urvang Joshi | 79f4fc4 | 2016-10-26 09:40:35 -0700 | [diff] [blame] | 1197 | int color_ctx_hash; |
| 1198 | int color_ctx; |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1199 | int color_neighbors[4]; |
Urvang Joshi | 967ff39 | 2016-09-07 14:57:49 -0700 | [diff] [blame] | 1200 | int inverse_color_order[PALETTE_MAX_SIZE]; |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1201 | assert(n <= PALETTE_MAX_SIZE); |
| 1202 | |
Urvang Joshi | 79f4fc4 | 2016-10-26 09:40:35 -0700 | [diff] [blame] | 1203 | // Get color indices of neighbors. |
Urvang Joshi | 4f4b68e | 2016-10-24 17:11:10 -0700 | [diff] [blame] | 1204 | color_neighbors[0] = (c - 1 >= 0) ? color_map[r * cols + c - 1] : -1; |
| 1205 | color_neighbors[1] = |
| 1206 | (c - 1 >= 0 && r - 1 >= 0) ? color_map[(r - 1) * cols + c - 1] : -1; |
| 1207 | color_neighbors[2] = (r - 1 >= 0) ? color_map[(r - 1) * cols + c] : -1; |
| 1208 | color_neighbors[3] = (r - 1 >= 0 && c + 1 <= cols - 1) |
| 1209 | ? color_map[(r - 1) * cols + c + 1] |
| 1210 | : -1; |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1211 | |
Urvang Joshi | 967ff39 | 2016-09-07 14:57:49 -0700 | [diff] [blame] | 1212 | for (i = 0; i < PALETTE_MAX_SIZE; ++i) { |
| 1213 | color_order[i] = i; |
| 1214 | inverse_color_order[i] = i; |
| 1215 | } |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1216 | memset(scores, 0, PALETTE_MAX_SIZE * sizeof(scores[0])); |
| 1217 | for (i = 0; i < 4; ++i) { |
Urvang Joshi | 4f4b68e | 2016-10-24 17:11:10 -0700 | [diff] [blame] | 1218 | if (color_neighbors[i] >= 0) { |
| 1219 | scores[color_neighbors[i]] += weights[i]; |
| 1220 | } |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1221 | } |
| 1222 | |
Urvang Joshi | 4f4b68e | 2016-10-24 17:11:10 -0700 | [diff] [blame] | 1223 | // Get the top 4 scores (sorted from large to small). |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1224 | for (i = 0; i < 4; ++i) { |
Urvang Joshi | 4f4b68e | 2016-10-24 17:11:10 -0700 | [diff] [blame] | 1225 | int max = scores[i]; |
| 1226 | int max_idx = i; |
| 1227 | int j; |
| 1228 | for (j = i + 1; j < n; ++j) { |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1229 | if (scores[j] > max) { |
| 1230 | max = scores[j]; |
| 1231 | max_idx = j; |
| 1232 | } |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1233 | } |
| 1234 | |
| 1235 | if (max_idx != i) { |
Urvang Joshi | 4f4b68e | 2016-10-24 17:11:10 -0700 | [diff] [blame] | 1236 | int temp = scores[i]; |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1237 | scores[i] = scores[max_idx]; |
| 1238 | scores[max_idx] = temp; |
| 1239 | |
| 1240 | temp = color_order[i]; |
| 1241 | color_order[i] = color_order[max_idx]; |
| 1242 | color_order[max_idx] = temp; |
Urvang Joshi | 967ff39 | 2016-09-07 14:57:49 -0700 | [diff] [blame] | 1243 | inverse_color_order[color_order[i]] = i; |
| 1244 | inverse_color_order[color_order[max_idx]] = max_idx; |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1245 | } |
| 1246 | } |
| 1247 | |
Urvang Joshi | 79f4fc4 | 2016-10-26 09:40:35 -0700 | [diff] [blame] | 1248 | // Get hash value of context. |
| 1249 | color_ctx_hash = 0; |
| 1250 | for (i = 0; i < 4; ++i) color_ctx_hash = color_ctx_hash * 11 + scores[i]; |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1251 | |
Urvang Joshi | 79f4fc4 | 2016-10-26 09:40:35 -0700 | [diff] [blame] | 1252 | // Lookup context from hash. |
| 1253 | color_ctx = 0; // Default. |
| 1254 | for (i = 0; i < PALETTE_COLOR_CONTEXTS; ++i) { |
| 1255 | if (color_ctx_hash == palette_color_context_lookup[i]) { |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1256 | color_ctx = i; |
| 1257 | break; |
| 1258 | } |
Urvang Joshi | 79f4fc4 | 2016-10-26 09:40:35 -0700 | [diff] [blame] | 1259 | } |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1260 | |
Urvang Joshi | 967ff39 | 2016-09-07 14:57:49 -0700 | [diff] [blame] | 1261 | if (color_idx != NULL) { |
| 1262 | *color_idx = inverse_color_order[color_map[r * cols + c]]; |
| 1263 | } |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1264 | return color_ctx; |
| 1265 | } |
Urvang Joshi | b100db7 | 2016-10-12 16:28:56 -0700 | [diff] [blame] | 1266 | #endif // CONFIG_PALETTE |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1267 | |
| 1268 | #if CONFIG_VAR_TX |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 1269 | static const aom_prob default_txfm_partition_probs[TXFM_PARTITION_CONTEXTS] = { |
Jingning Han | c8b8936 | 2016-11-01 10:28:53 -0700 | [diff] [blame] | 1270 | 250, 231, 212, 241, 166, 66, 241, 230, 135, 243, 154, 64, 248, 161, 63, 128, |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1271 | }; |
| 1272 | #endif |
| 1273 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 1274 | static const aom_prob default_skip_probs[SKIP_CONTEXTS] = { 192, 128, 64 }; |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1275 | |
| 1276 | #if CONFIG_EXT_INTERP |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 1277 | static const aom_prob default_switchable_interp_prob |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1278 | [SWITCHABLE_FILTER_CONTEXTS][SWITCHABLE_FILTERS - 1] = { |
| 1279 | #if CONFIG_DUAL_FILTER |
| 1280 | { 235, 192, 128, 128 }, { 36, 243, 208, 128 }, { 34, 16, 128, 128 }, |
| 1281 | { 36, 243, 48, 128 }, { 34, 16, 128, 128 }, { 149, 160, 128, 128 }, |
| 1282 | |
| 1283 | { 235, 192, 128, 128 }, { 36, 243, 208, 128 }, { 34, 16, 128, 128 }, |
| 1284 | { 36, 243, 48, 128 }, { 34, 16, 128, 128 }, { 149, 160, 128, 128 }, |
| 1285 | |
| 1286 | { 235, 192, 128, 128 }, { 36, 243, 208, 128 }, { 34, 16, 128, 128 }, |
| 1287 | { 36, 243, 48, 128 }, { 34, 16, 128, 128 }, { 149, 160, 128, 128 }, |
| 1288 | |
| 1289 | { 235, 192, 128, 128 }, { 36, 243, 208, 128 }, { 34, 16, 128, 128 }, |
| 1290 | { 36, 243, 48, 128 }, { 34, 16, 128, 128 }, { 149, 160, 128, 128 }, |
| 1291 | #else |
| 1292 | { 235, 192, 128, 128 }, { 36, 243, 208, 128 }, { 34, 16, 128, 128 }, |
| 1293 | { 36, 243, 48, 128 }, { 34, 16, 128, 128 }, { 149, 160, 128, 128 }, |
| 1294 | #endif |
| 1295 | }; |
| 1296 | #else // CONFIG_EXT_INTERP |
| 1297 | #if CONFIG_DUAL_FILTER |
clang-format | 67948d3 | 2016-09-07 22:40:40 -0700 | [diff] [blame] | 1298 | static const aom_prob |
| 1299 | default_switchable_interp_prob[SWITCHABLE_FILTER_CONTEXTS] |
| 1300 | [SWITCHABLE_FILTERS - 1] = { |
| 1301 | { 235, 162 }, { 36, 255 }, |
| 1302 | { 34, 3 }, { 149, 144 }, |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1303 | |
clang-format | 67948d3 | 2016-09-07 22:40:40 -0700 | [diff] [blame] | 1304 | { 235, 162 }, { 36, 255 }, |
| 1305 | { 34, 3 }, { 10, 3 }, |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1306 | |
clang-format | 67948d3 | 2016-09-07 22:40:40 -0700 | [diff] [blame] | 1307 | { 235, 162 }, { 36, 255 }, |
| 1308 | { 34, 3 }, { 149, 144 }, |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1309 | |
clang-format | 67948d3 | 2016-09-07 22:40:40 -0700 | [diff] [blame] | 1310 | { 235, 162 }, { 36, 255 }, |
| 1311 | { 34, 3 }, { 10, 3 }, |
| 1312 | }; |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1313 | #else |
clang-format | 67948d3 | 2016-09-07 22:40:40 -0700 | [diff] [blame] | 1314 | static const aom_prob default_switchable_interp_prob[SWITCHABLE_FILTER_CONTEXTS] |
| 1315 | [SWITCHABLE_FILTERS - 1] = { |
| 1316 | { 235, 162 }, |
| 1317 | { 36, 255 }, |
| 1318 | { 34, 3 }, |
| 1319 | { 149, 144 }, |
| 1320 | }; |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1321 | #endif |
| 1322 | #endif // CONFIG_EXT_INTERP |
| 1323 | |
| 1324 | #if CONFIG_EXT_TX |
| 1325 | /* clang-format off */ |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 1326 | const aom_tree_index av1_ext_tx_inter_tree[EXT_TX_SETS_INTER] |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1327 | [TREE_SIZE(TX_TYPES)] = { |
| 1328 | { // ToDo(yaowu): remove used entry 0. |
| 1329 | 0 |
| 1330 | }, { |
| 1331 | -IDTX, 2, |
| 1332 | 4, 14, |
| 1333 | 6, 8, |
| 1334 | -V_DCT, -H_DCT, |
| 1335 | 10, 12, |
| 1336 | -V_ADST, -H_ADST, |
| 1337 | -V_FLIPADST, -H_FLIPADST, |
| 1338 | -DCT_DCT, 16, |
| 1339 | 18, 24, |
| 1340 | 20, 22, |
| 1341 | -ADST_DCT, -DCT_ADST, |
| 1342 | -FLIPADST_DCT, -DCT_FLIPADST, |
| 1343 | 26, 28, |
| 1344 | -ADST_ADST, -FLIPADST_FLIPADST, |
| 1345 | -ADST_FLIPADST, -FLIPADST_ADST |
| 1346 | }, { |
| 1347 | -IDTX, 2, |
| 1348 | 4, 6, |
| 1349 | -V_DCT, -H_DCT, |
| 1350 | -DCT_DCT, 8, |
| 1351 | 10, 16, |
| 1352 | 12, 14, |
| 1353 | -ADST_DCT, -DCT_ADST, |
| 1354 | -FLIPADST_DCT, -DCT_FLIPADST, |
| 1355 | 18, 20, |
| 1356 | -ADST_ADST, -FLIPADST_FLIPADST, |
| 1357 | -ADST_FLIPADST, -FLIPADST_ADST |
| 1358 | }, { |
| 1359 | -IDTX, -DCT_DCT, |
| 1360 | } |
| 1361 | }; |
| 1362 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 1363 | const aom_tree_index av1_ext_tx_intra_tree[EXT_TX_SETS_INTRA] |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1364 | [TREE_SIZE(TX_TYPES)] = { |
| 1365 | { // ToDo(yaowu): remove unused entry 0. |
| 1366 | 0 |
| 1367 | }, { |
| 1368 | -IDTX, 2, |
| 1369 | -DCT_DCT, 4, |
| 1370 | 6, 8, |
| 1371 | -V_DCT, -H_DCT, |
| 1372 | -ADST_ADST, 10, |
| 1373 | -ADST_DCT, -DCT_ADST, |
| 1374 | }, { |
| 1375 | -IDTX, 2, |
| 1376 | -DCT_DCT, 4, |
| 1377 | -ADST_ADST, 6, |
| 1378 | -ADST_DCT, -DCT_ADST, |
| 1379 | } |
| 1380 | }; |
| 1381 | /* clang-format on */ |
| 1382 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 1383 | static const aom_prob |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1384 | default_inter_ext_tx_prob[EXT_TX_SETS_INTER][EXT_TX_SIZES][TX_TYPES - 1] = { |
| 1385 | { |
| 1386 | // ToDo(yaowu): remove unused entry 0. |
| 1387 | { 0 }, |
| 1388 | { 0 }, |
| 1389 | { 0 }, |
| 1390 | #if EXT_TX_SIZES == 4 |
| 1391 | { 0 }, |
| 1392 | #endif |
| 1393 | }, |
| 1394 | { |
| 1395 | { 10, 24, 30, 128, 128, 128, 128, 112, 160, 128, 128, 128, 128, 128, |
| 1396 | 128 }, |
| 1397 | { 10, 24, 30, 128, 128, 128, 128, 112, 160, 128, 128, 128, 128, 128, |
| 1398 | 128 }, |
| 1399 | { 10, 24, 30, 128, 128, 128, 128, 112, 160, 128, 128, 128, 128, 128, |
| 1400 | 128 }, |
| 1401 | #if EXT_TX_SIZES == 4 |
| 1402 | { 10, 24, 30, 128, 128, 128, 128, 112, 160, 128, 128, 128, 128, 128, |
| 1403 | 128 }, |
| 1404 | #endif |
| 1405 | }, |
| 1406 | { |
| 1407 | { 10, 30, 128, 112, 160, 128, 128, 128, 128, 128, 128 }, |
| 1408 | { 10, 30, 128, 112, 160, 128, 128, 128, 128, 128, 128 }, |
| 1409 | { 10, 30, 128, 112, 160, 128, 128, 128, 128, 128, 128 }, |
| 1410 | #if EXT_TX_SIZES == 4 |
| 1411 | { 10, 30, 128, 112, 160, 128, 128, 128, 128, 128, 128 }, |
| 1412 | #endif |
| 1413 | }, |
| 1414 | { |
| 1415 | { 12 }, |
| 1416 | { 12 }, |
| 1417 | { 12 }, |
| 1418 | #if EXT_TX_SIZES == 4 |
| 1419 | { 12 }, |
| 1420 | #endif |
| 1421 | } |
| 1422 | }; |
| 1423 | |
clang-format | 67948d3 | 2016-09-07 22:40:40 -0700 | [diff] [blame] | 1424 | static const aom_prob |
| 1425 | default_intra_ext_tx_prob[EXT_TX_SETS_INTRA][EXT_TX_SIZES][INTRA_MODES] |
| 1426 | [TX_TYPES - 1] = { |
| 1427 | { |
| 1428 | // ToDo(yaowu): remove unused entry 0. |
| 1429 | { |
| 1430 | { 0 }, |
| 1431 | { 0 }, |
| 1432 | { 0 }, |
| 1433 | { 0 }, |
| 1434 | { 0 }, |
| 1435 | { 0 }, |
| 1436 | { 0 }, |
| 1437 | { 0 }, |
| 1438 | { 0 }, |
| 1439 | { 0 }, |
| 1440 | }, |
| 1441 | { |
| 1442 | { 0 }, |
| 1443 | { 0 }, |
| 1444 | { 0 }, |
| 1445 | { 0 }, |
| 1446 | { 0 }, |
| 1447 | { 0 }, |
| 1448 | { 0 }, |
| 1449 | { 0 }, |
| 1450 | { 0 }, |
| 1451 | { 0 }, |
| 1452 | }, |
| 1453 | { |
| 1454 | { 0 }, |
| 1455 | { 0 }, |
| 1456 | { 0 }, |
| 1457 | { 0 }, |
| 1458 | { 0 }, |
| 1459 | { 0 }, |
| 1460 | { 0 }, |
| 1461 | { 0 }, |
| 1462 | { 0 }, |
| 1463 | { 0 }, |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1464 | #if EXT_TX_SIZES == 4 |
clang-format | 67948d3 | 2016-09-07 22:40:40 -0700 | [diff] [blame] | 1465 | }, |
| 1466 | { |
| 1467 | { 0 }, |
| 1468 | { 0 }, |
| 1469 | { 0 }, |
| 1470 | { 0 }, |
| 1471 | { 0 }, |
| 1472 | { 0 }, |
| 1473 | { 0 }, |
| 1474 | { 0 }, |
| 1475 | { 0 }, |
| 1476 | { 0 }, |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1477 | #endif |
clang-format | 67948d3 | 2016-09-07 22:40:40 -0700 | [diff] [blame] | 1478 | }, |
| 1479 | }, |
| 1480 | { |
| 1481 | { |
| 1482 | { 8, 224, 32, 128, 64, 128 }, |
| 1483 | { 10, 32, 32, 128, 16, 192 }, |
| 1484 | { 10, 32, 32, 128, 16, 64 }, |
| 1485 | { 9, 200, 32, 128, 64, 128 }, |
| 1486 | { 8, 8, 32, 128, 224, 128 }, |
| 1487 | { 10, 32, 32, 128, 16, 192 }, |
| 1488 | { 10, 32, 32, 128, 16, 64 }, |
| 1489 | { 10, 23, 32, 128, 80, 176 }, |
| 1490 | { 10, 23, 32, 128, 80, 176 }, |
| 1491 | { 10, 32, 32, 128, 16, 64 }, |
| 1492 | }, |
| 1493 | { |
| 1494 | { 8, 224, 32, 128, 64, 128 }, |
| 1495 | { 10, 32, 32, 128, 16, 192 }, |
| 1496 | { 10, 32, 32, 128, 16, 64 }, |
| 1497 | { 9, 200, 32, 128, 64, 128 }, |
| 1498 | { 8, 8, 32, 128, 224, 128 }, |
| 1499 | { 10, 32, 32, 128, 16, 192 }, |
| 1500 | { 10, 32, 32, 128, 16, 64 }, |
| 1501 | { 10, 23, 32, 128, 80, 176 }, |
| 1502 | { 10, 23, 32, 128, 80, 176 }, |
| 1503 | { 10, 32, 32, 128, 16, 64 }, |
| 1504 | }, |
| 1505 | { |
| 1506 | { 8, 224, 32, 128, 64, 128 }, |
| 1507 | { 10, 32, 32, 128, 16, 192 }, |
| 1508 | { 10, 32, 32, 128, 16, 64 }, |
| 1509 | { 9, 200, 32, 128, 64, 128 }, |
| 1510 | { 8, 8, 32, 128, 224, 128 }, |
| 1511 | { 10, 32, 32, 128, 16, 192 }, |
| 1512 | { 10, 32, 32, 128, 16, 64 }, |
| 1513 | { 10, 23, 32, 128, 80, 176 }, |
| 1514 | { 10, 23, 32, 128, 80, 176 }, |
| 1515 | { 10, 32, 32, 128, 16, 64 }, |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1516 | #if EXT_TX_SIZES == 4 |
clang-format | 67948d3 | 2016-09-07 22:40:40 -0700 | [diff] [blame] | 1517 | }, |
| 1518 | { |
| 1519 | { 8, 224, 32, 128, 64, 128 }, |
| 1520 | { 10, 32, 32, 128, 16, 192 }, |
| 1521 | { 10, 32, 32, 128, 16, 64 }, |
| 1522 | { 9, 200, 32, 128, 64, 128 }, |
| 1523 | { 8, 8, 32, 128, 224, 128 }, |
| 1524 | { 10, 32, 32, 128, 16, 192 }, |
| 1525 | { 10, 32, 32, 128, 16, 64 }, |
| 1526 | { 10, 23, 32, 128, 80, 176 }, |
| 1527 | { 10, 23, 32, 128, 80, 176 }, |
| 1528 | { 10, 32, 32, 128, 16, 64 }, |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1529 | #endif |
clang-format | 67948d3 | 2016-09-07 22:40:40 -0700 | [diff] [blame] | 1530 | }, |
| 1531 | }, |
| 1532 | { |
| 1533 | { |
| 1534 | { 8, 224, 64, 128 }, |
| 1535 | { 10, 32, 16, 192 }, |
| 1536 | { 10, 32, 16, 64 }, |
| 1537 | { 9, 200, 64, 128 }, |
| 1538 | { 8, 8, 224, 128 }, |
| 1539 | { 10, 32, 16, 192 }, |
| 1540 | { 10, 32, 16, 64 }, |
| 1541 | { 10, 23, 80, 176 }, |
| 1542 | { 10, 23, 80, 176 }, |
| 1543 | { 10, 32, 16, 64 }, |
| 1544 | }, |
| 1545 | { |
| 1546 | { 8, 224, 64, 128 }, |
| 1547 | { 10, 32, 16, 192 }, |
| 1548 | { 10, 32, 16, 64 }, |
| 1549 | { 9, 200, 64, 128 }, |
| 1550 | { 8, 8, 224, 128 }, |
| 1551 | { 10, 32, 16, 192 }, |
| 1552 | { 10, 32, 16, 64 }, |
| 1553 | { 10, 23, 80, 176 }, |
| 1554 | { 10, 23, 80, 176 }, |
| 1555 | { 10, 32, 16, 64 }, |
| 1556 | }, |
| 1557 | { |
| 1558 | { 8, 224, 64, 128 }, |
| 1559 | { 10, 32, 16, 192 }, |
| 1560 | { 10, 32, 16, 64 }, |
| 1561 | { 9, 200, 64, 128 }, |
| 1562 | { 8, 8, 224, 128 }, |
| 1563 | { 10, 32, 16, 192 }, |
| 1564 | { 10, 32, 16, 64 }, |
| 1565 | { 10, 23, 80, 176 }, |
| 1566 | { 10, 23, 80, 176 }, |
| 1567 | { 10, 32, 16, 64 }, |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1568 | #if EXT_TX_SIZES == 4 |
clang-format | 67948d3 | 2016-09-07 22:40:40 -0700 | [diff] [blame] | 1569 | }, |
| 1570 | { |
| 1571 | { 8, 224, 64, 128 }, |
| 1572 | { 10, 32, 16, 192 }, |
| 1573 | { 10, 32, 16, 64 }, |
| 1574 | { 9, 200, 64, 128 }, |
| 1575 | { 8, 8, 224, 128 }, |
| 1576 | { 10, 32, 16, 192 }, |
| 1577 | { 10, 32, 16, 64 }, |
| 1578 | { 10, 23, 80, 176 }, |
| 1579 | { 10, 23, 80, 176 }, |
| 1580 | { 10, 32, 16, 64 }, |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1581 | #endif |
clang-format | 67948d3 | 2016-09-07 22:40:40 -0700 | [diff] [blame] | 1582 | }, |
| 1583 | }, |
| 1584 | }; |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1585 | |
| 1586 | #else |
| 1587 | |
| 1588 | /* clang-format off */ |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 1589 | const aom_tree_index av1_ext_tx_tree[TREE_SIZE(TX_TYPES)] = { |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1590 | -DCT_DCT, 2, |
| 1591 | -ADST_ADST, 4, |
| 1592 | -ADST_DCT, -DCT_ADST |
| 1593 | }; |
| 1594 | /* clang-format on */ |
| 1595 | |
Nathan E. Egge | 7c5b4c1 | 2016-04-26 12:31:14 -0400 | [diff] [blame] | 1596 | int av1_ext_tx_ind[TX_TYPES]; |
| 1597 | int av1_ext_tx_inv[TX_TYPES]; |
| 1598 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 1599 | static const aom_prob |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1600 | default_intra_ext_tx_prob[EXT_TX_SIZES][TX_TYPES][TX_TYPES - 1] = { |
Jingning Han | 607fa6a | 2016-10-26 10:46:28 -0700 | [diff] [blame] | 1601 | #if CONFIG_CB4X4 |
| 1602 | { { 240, 85, 128 }, { 4, 1, 248 }, { 4, 1, 8 }, { 4, 248, 128 } }, |
| 1603 | #endif |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1604 | { { 240, 85, 128 }, { 4, 1, 248 }, { 4, 1, 8 }, { 4, 248, 128 } }, |
| 1605 | { { 244, 85, 128 }, { 8, 2, 248 }, { 8, 2, 8 }, { 8, 248, 128 } }, |
| 1606 | { { 248, 85, 128 }, { 16, 4, 248 }, { 16, 4, 8 }, { 16, 248, 128 } }, |
| 1607 | }; |
| 1608 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 1609 | static const aom_prob default_inter_ext_tx_prob[EXT_TX_SIZES][TX_TYPES - 1] = { |
Jingning Han | 607fa6a | 2016-10-26 10:46:28 -0700 | [diff] [blame] | 1610 | #if CONFIG_CB4X4 |
| 1611 | { 160, 85, 128 }, |
| 1612 | #endif |
| 1613 | { 160, 85, 128 }, |
| 1614 | { 176, 85, 128 }, |
| 1615 | { 192, 85, 128 }, |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1616 | }; |
| 1617 | #endif // CONFIG_EXT_TX |
| 1618 | |
| 1619 | #if CONFIG_EXT_INTRA |
clang-format | 67948d3 | 2016-09-07 22:40:40 -0700 | [diff] [blame] | 1620 | static const aom_prob default_intra_filter_probs[INTRA_FILTERS + 1] |
| 1621 | [INTRA_FILTERS - 1] = { |
| 1622 | { 98, 63, 60 }, |
| 1623 | { 98, 82, 80 }, |
| 1624 | { 94, 65, 103 }, |
| 1625 | { 49, 25, 24 }, |
| 1626 | { 72, 38, 50 }, |
| 1627 | }; |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 1628 | const aom_tree_index av1_intra_filter_tree[TREE_SIZE(INTRA_FILTERS)] = { |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1629 | -INTRA_FILTER_LINEAR, 2, -INTRA_FILTER_8TAP, 4, -INTRA_FILTER_8TAP_SHARP, |
| 1630 | -INTRA_FILTER_8TAP_SMOOTH, |
| 1631 | }; |
| 1632 | #endif // CONFIG_EXT_INTRA |
| 1633 | |
hui su | 5db9743 | 2016-10-14 16:10:14 -0700 | [diff] [blame] | 1634 | #if CONFIG_FILTER_INTRA |
| 1635 | static const aom_prob default_filter_intra_probs[2] = { 230, 230 }; |
| 1636 | #endif // CONFIG_FILTER_INTRA |
| 1637 | |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1638 | #if CONFIG_SUPERTX |
clang-format | 67948d3 | 2016-09-07 22:40:40 -0700 | [diff] [blame] | 1639 | static const aom_prob default_supertx_prob[PARTITION_SUPERTX_CONTEXTS] |
| 1640 | [TX_SIZES] = { |
Debargha Mukherjee | 5a488a6 | 2016-11-22 22:24:10 -0800 | [diff] [blame] | 1641 | #if CONFIG_TX64X64 |
| 1642 | { 1, 160, 160, 170, 180 }, |
| 1643 | { 1, 200, 200, 210, 220 }, |
| 1644 | #else |
clang-format | 67948d3 | 2016-09-07 22:40:40 -0700 | [diff] [blame] | 1645 | { 1, 160, 160, 170 }, |
| 1646 | { 1, 200, 200, 210 }, |
Debargha Mukherjee | 5a488a6 | 2016-11-22 22:24:10 -0800 | [diff] [blame] | 1647 | #endif // CONFIG_TX64X64 |
clang-format | 67948d3 | 2016-09-07 22:40:40 -0700 | [diff] [blame] | 1648 | }; |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1649 | #endif // CONFIG_SUPERTX |
| 1650 | |
| 1651 | // FIXME(someone) need real defaults here |
Nathan E. Egge | f627e58 | 2016-08-19 20:06:51 -0400 | [diff] [blame] | 1652 | static const aom_prob default_segment_tree_probs[SEG_TREE_PROBS] = { |
| 1653 | 128, 128, 128, 128, 128, 128, 128 |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1654 | }; |
Nathan E. Egge | f627e58 | 2016-08-19 20:06:51 -0400 | [diff] [blame] | 1655 | // clang-format off |
| 1656 | static const aom_prob default_segment_pred_probs[PREDICTION_PROBS] = { |
| 1657 | 128, 128, 128 |
| 1658 | }; |
| 1659 | // clang-format on |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1660 | |
| 1661 | static void init_mode_probs(FRAME_CONTEXT *fc) { |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 1662 | av1_copy(fc->uv_mode_prob, default_uv_probs); |
| 1663 | av1_copy(fc->y_mode_prob, default_if_y_probs); |
| 1664 | av1_copy(fc->switchable_interp_prob, default_switchable_interp_prob); |
| 1665 | av1_copy(fc->partition_prob, default_partition_probs); |
| 1666 | av1_copy(fc->intra_inter_prob, default_intra_inter_p); |
| 1667 | av1_copy(fc->comp_inter_prob, default_comp_inter_p); |
| 1668 | av1_copy(fc->comp_ref_prob, default_comp_ref_p); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1669 | #if CONFIG_EXT_REFS |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 1670 | av1_copy(fc->comp_bwdref_prob, default_comp_bwdref_p); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1671 | #endif // CONFIG_EXT_REFS |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 1672 | av1_copy(fc->single_ref_prob, default_single_ref_p); |
| 1673 | av1_copy(fc->tx_size_probs, default_tx_size_prob); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1674 | #if CONFIG_VAR_TX |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 1675 | av1_copy(fc->txfm_partition_prob, default_txfm_partition_probs); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1676 | #endif |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 1677 | av1_copy(fc->skip_probs, default_skip_probs); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1678 | #if CONFIG_REF_MV |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 1679 | av1_copy(fc->newmv_prob, default_newmv_prob); |
| 1680 | av1_copy(fc->zeromv_prob, default_zeromv_prob); |
| 1681 | av1_copy(fc->refmv_prob, default_refmv_prob); |
| 1682 | av1_copy(fc->drl_prob, default_drl_prob); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1683 | #if CONFIG_EXT_INTER |
| 1684 | fc->new2mv_prob = default_new2mv_prob; |
| 1685 | #endif // CONFIG_EXT_INTER |
| 1686 | #endif // CONFIG_REF_MV |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 1687 | av1_copy(fc->inter_mode_probs, default_inter_mode_probs); |
Yue Chen | cb60b18 | 2016-10-13 15:18:22 -0700 | [diff] [blame] | 1688 | #if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION |
| 1689 | av1_copy(fc->motion_mode_prob, default_motion_mode_prob); |
| 1690 | #endif // CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1691 | #if CONFIG_EXT_INTER |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 1692 | av1_copy(fc->inter_compound_mode_probs, default_inter_compound_mode_probs); |
Sarah Parker | 6fddd18 | 2016-11-10 20:57:20 -0800 | [diff] [blame] | 1693 | av1_copy(fc->compound_type_prob, default_compound_type_probs); |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 1694 | av1_copy(fc->interintra_prob, default_interintra_prob); |
| 1695 | av1_copy(fc->interintra_mode_prob, default_interintra_mode_prob); |
| 1696 | av1_copy(fc->wedge_interintra_prob, default_wedge_interintra_prob); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1697 | #endif // CONFIG_EXT_INTER |
| 1698 | #if CONFIG_SUPERTX |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 1699 | av1_copy(fc->supertx_prob, default_supertx_prob); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1700 | #endif // CONFIG_SUPERTX |
Nathan E. Egge | f627e58 | 2016-08-19 20:06:51 -0400 | [diff] [blame] | 1701 | av1_copy(fc->seg.tree_probs, default_segment_tree_probs); |
| 1702 | av1_copy(fc->seg.pred_probs, default_segment_pred_probs); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1703 | #if CONFIG_EXT_INTRA |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 1704 | av1_copy(fc->intra_filter_probs, default_intra_filter_probs); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1705 | #endif // CONFIG_EXT_INTRA |
hui su | 5db9743 | 2016-10-14 16:10:14 -0700 | [diff] [blame] | 1706 | #if CONFIG_FILTER_INTRA |
| 1707 | av1_copy(fc->filter_intra_probs, default_filter_intra_probs); |
| 1708 | #endif // CONFIG_FILTER_INTRA |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 1709 | av1_copy(fc->inter_ext_tx_prob, default_inter_ext_tx_prob); |
| 1710 | av1_copy(fc->intra_ext_tx_prob, default_intra_ext_tx_prob); |
Debargha Mukherjee | 5cd2ab9 | 2016-09-08 15:15:17 -0700 | [diff] [blame] | 1711 | #if CONFIG_LOOP_RESTORATION |
| 1712 | av1_copy(fc->switchable_restore_prob, default_switchable_restore_prob); |
| 1713 | #endif // CONFIG_LOOP_RESTORATION |
Nathan E. Egge | 4947c29 | 2016-04-26 11:37:06 -0400 | [diff] [blame] | 1714 | #if CONFIG_DAALA_EC |
Nathan E. Egge | 5710c72 | 2016-09-08 10:01:16 -0400 | [diff] [blame] | 1715 | av1_tree_to_cdf_1D(av1_intra_mode_tree, fc->y_mode_prob, fc->y_mode_cdf, |
| 1716 | BLOCK_SIZE_GROUPS); |
Nathan E. Egge | 380cb1a | 2016-09-08 10:13:42 -0400 | [diff] [blame] | 1717 | av1_tree_to_cdf_1D(av1_intra_mode_tree, fc->uv_mode_prob, fc->uv_mode_cdf, |
| 1718 | INTRA_MODES); |
Nathan E. Egge | 4947c29 | 2016-04-26 11:37:06 -0400 | [diff] [blame] | 1719 | av1_tree_to_cdf_1D(av1_switchable_interp_tree, fc->switchable_interp_prob, |
| 1720 | fc->switchable_interp_cdf, SWITCHABLE_FILTER_CONTEXTS); |
Nathan E. Egge | 6ec4d10 | 2016-09-08 10:41:20 -0400 | [diff] [blame] | 1721 | av1_tree_to_cdf_1D(av1_partition_tree, fc->partition_prob, fc->partition_cdf, |
| 1722 | PARTITION_CONTEXTS); |
| 1723 | av1_tree_to_cdf_1D(av1_inter_mode_tree, fc->inter_mode_probs, |
| 1724 | fc->inter_mode_cdf, INTER_MODE_CONTEXTS); |
David Barker | f541932 | 2016-11-10 12:04:21 +0000 | [diff] [blame] | 1725 | #if !CONFIG_EXT_TX |
Nathan E. Egge | 7c5b4c1 | 2016-04-26 12:31:14 -0400 | [diff] [blame] | 1726 | av1_tree_to_cdf_2D(av1_ext_tx_tree, fc->intra_ext_tx_prob, |
| 1727 | fc->intra_ext_tx_cdf, EXT_TX_SIZES, TX_TYPES); |
Nathan E. Egge | 93878c4 | 2016-05-03 10:01:32 -0400 | [diff] [blame] | 1728 | av1_tree_to_cdf_1D(av1_ext_tx_tree, fc->inter_ext_tx_prob, |
| 1729 | fc->inter_ext_tx_cdf, EXT_TX_SIZES); |
David Barker | f541932 | 2016-11-10 12:04:21 +0000 | [diff] [blame] | 1730 | #endif |
Nathan E. Egge | 3ef926e | 2016-09-07 18:20:41 -0400 | [diff] [blame] | 1731 | av1_tree_to_cdf_2D(av1_intra_mode_tree, av1_kf_y_mode_prob, av1_kf_y_mode_cdf, |
| 1732 | INTRA_MODES, INTRA_MODES); |
Nathan E. Egge | f627e58 | 2016-08-19 20:06:51 -0400 | [diff] [blame] | 1733 | av1_tree_to_cdf(av1_segment_tree, fc->seg.tree_probs, fc->seg.tree_cdf); |
Nathan E. Egge | 4947c29 | 2016-04-26 11:37:06 -0400 | [diff] [blame] | 1734 | #endif |
Thomas Davies | f693610 | 2016-09-05 16:51:31 +0100 | [diff] [blame] | 1735 | #if CONFIG_DELTA_Q |
| 1736 | av1_copy(fc->delta_q_prob, default_delta_q_probs); |
| 1737 | #endif |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1738 | } |
| 1739 | |
Nathan E. Egge | 4947c29 | 2016-04-26 11:37:06 -0400 | [diff] [blame] | 1740 | #if CONFIG_DAALA_EC |
| 1741 | int av1_switchable_interp_ind[SWITCHABLE_FILTERS]; |
| 1742 | int av1_switchable_interp_inv[SWITCHABLE_FILTERS]; |
Thomas Davies | 6519beb | 2016-10-19 14:46:07 +0100 | [diff] [blame] | 1743 | |
| 1744 | void av1_set_mode_cdfs(struct AV1Common *cm) { |
| 1745 | FRAME_CONTEXT *fc = cm->fc; |
| 1746 | int i, j; |
| 1747 | if (cm->seg.enabled && cm->seg.update_map) { |
| 1748 | av1_tree_to_cdf(av1_segment_tree, cm->fc->seg.tree_probs, |
| 1749 | cm->fc->seg.tree_cdf); |
| 1750 | } |
| 1751 | |
| 1752 | for (i = 0; i < INTRA_MODES; ++i) |
Yaowu Xu | 6043bfd | 2016-11-01 09:54:05 -0700 | [diff] [blame] | 1753 | av1_tree_to_cdf(av1_intra_mode_tree, fc->uv_mode_prob[i], |
| 1754 | fc->uv_mode_cdf[i]); |
Thomas Davies | 6519beb | 2016-10-19 14:46:07 +0100 | [diff] [blame] | 1755 | |
| 1756 | for (i = 0; i < PARTITION_CONTEXTS; ++i) |
| 1757 | av1_tree_to_cdf(av1_partition_tree, fc->partition_prob[i], |
| 1758 | fc->partition_cdf[i]); |
| 1759 | |
| 1760 | for (i = 0; i < INTRA_MODES; ++i) |
| 1761 | for (j = 0; j < INTRA_MODES; ++j) |
| 1762 | av1_tree_to_cdf(av1_intra_mode_tree, cm->kf_y_prob[i][j], |
| 1763 | cm->kf_y_cdf[i][j]); |
| 1764 | |
| 1765 | for (j = 0; j < SWITCHABLE_FILTER_CONTEXTS; ++j) |
| 1766 | av1_tree_to_cdf(av1_switchable_interp_tree, fc->switchable_interp_prob[j], |
| 1767 | fc->switchable_interp_cdf[j]); |
| 1768 | |
| 1769 | for (i = 0; i < INTER_MODE_CONTEXTS; ++i) |
| 1770 | av1_tree_to_cdf(av1_inter_mode_tree, fc->inter_mode_probs[i], |
| 1771 | fc->inter_mode_cdf[i]); |
| 1772 | |
| 1773 | for (i = 0; i < BLOCK_SIZE_GROUPS; ++i) |
| 1774 | av1_tree_to_cdf(av1_intra_mode_tree, fc->y_mode_prob[i], fc->y_mode_cdf[i]); |
| 1775 | |
David Barker | f541932 | 2016-11-10 12:04:21 +0000 | [diff] [blame] | 1776 | #if !CONFIG_EXT_TX |
Thomas Davies | 6519beb | 2016-10-19 14:46:07 +0100 | [diff] [blame] | 1777 | for (i = TX_4X4; i < EXT_TX_SIZES; ++i) |
| 1778 | for (j = 0; j < TX_TYPES; ++j) |
| 1779 | av1_tree_to_cdf(av1_ext_tx_tree, fc->intra_ext_tx_prob[i][j], |
| 1780 | fc->intra_ext_tx_cdf[i][j]); |
| 1781 | |
| 1782 | for (i = TX_4X4; i < EXT_TX_SIZES; ++i) |
| 1783 | av1_tree_to_cdf(av1_ext_tx_tree, fc->inter_ext_tx_prob[i], |
| 1784 | fc->inter_ext_tx_cdf[i]); |
David Barker | f541932 | 2016-11-10 12:04:21 +0000 | [diff] [blame] | 1785 | #endif |
Thomas Davies | 6519beb | 2016-10-19 14:46:07 +0100 | [diff] [blame] | 1786 | } |
Nathan E. Egge | 4947c29 | 2016-04-26 11:37:06 -0400 | [diff] [blame] | 1787 | #endif |
| 1788 | |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1789 | #if CONFIG_EXT_INTERP |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 1790 | const aom_tree_index av1_switchable_interp_tree[TREE_SIZE(SWITCHABLE_FILTERS)] = |
| 1791 | { |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1792 | -EIGHTTAP_REGULAR, |
| 1793 | 2, |
| 1794 | 4, |
| 1795 | 6, |
| 1796 | -EIGHTTAP_SMOOTH, |
| 1797 | -EIGHTTAP_SMOOTH2, |
| 1798 | -MULTITAP_SHARP, |
| 1799 | -MULTITAP_SHARP2, |
| 1800 | }; |
| 1801 | #else |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 1802 | const aom_tree_index av1_switchable_interp_tree[TREE_SIZE(SWITCHABLE_FILTERS)] = |
| 1803 | { -EIGHTTAP_REGULAR, 2, -EIGHTTAP_SMOOTH, -MULTITAP_SHARP }; |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1804 | #endif // CONFIG_EXT_INTERP |
| 1805 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 1806 | void av1_adapt_inter_frame_probs(AV1_COMMON *cm) { |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1807 | int i, j; |
| 1808 | FRAME_CONTEXT *fc = cm->fc; |
| 1809 | const FRAME_CONTEXT *pre_fc = &cm->frame_contexts[cm->frame_context_idx]; |
| 1810 | const FRAME_COUNTS *counts = &cm->counts; |
| 1811 | |
| 1812 | for (i = 0; i < INTRA_INTER_CONTEXTS; i++) |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 1813 | fc->intra_inter_prob[i] = av1_mode_mv_merge_probs( |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1814 | pre_fc->intra_inter_prob[i], counts->intra_inter[i]); |
| 1815 | for (i = 0; i < COMP_INTER_CONTEXTS; i++) |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 1816 | fc->comp_inter_prob[i] = av1_mode_mv_merge_probs(pre_fc->comp_inter_prob[i], |
| 1817 | counts->comp_inter[i]); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1818 | |
| 1819 | #if CONFIG_EXT_REFS |
| 1820 | for (i = 0; i < REF_CONTEXTS; i++) |
| 1821 | for (j = 0; j < (FWD_REFS - 1); j++) |
| 1822 | fc->comp_ref_prob[i][j] = mode_mv_merge_probs(pre_fc->comp_ref_prob[i][j], |
| 1823 | counts->comp_ref[i][j]); |
| 1824 | for (i = 0; i < REF_CONTEXTS; i++) |
| 1825 | for (j = 0; j < (BWD_REFS - 1); j++) |
| 1826 | fc->comp_bwdref_prob[i][j] = mode_mv_merge_probs( |
| 1827 | pre_fc->comp_bwdref_prob[i][j], counts->comp_bwdref[i][j]); |
| 1828 | #else |
| 1829 | for (i = 0; i < REF_CONTEXTS; i++) |
| 1830 | for (j = 0; j < (COMP_REFS - 1); j++) |
| 1831 | fc->comp_ref_prob[i][j] = mode_mv_merge_probs(pre_fc->comp_ref_prob[i][j], |
| 1832 | counts->comp_ref[i][j]); |
| 1833 | #endif // CONFIG_EXT_REFS |
| 1834 | |
| 1835 | for (i = 0; i < REF_CONTEXTS; i++) |
| 1836 | for (j = 0; j < (SINGLE_REFS - 1); j++) |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 1837 | fc->single_ref_prob[i][j] = av1_mode_mv_merge_probs( |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1838 | pre_fc->single_ref_prob[i][j], counts->single_ref[i][j]); |
| 1839 | |
| 1840 | #if CONFIG_REF_MV |
| 1841 | for (i = 0; i < NEWMV_MODE_CONTEXTS; ++i) |
| 1842 | fc->newmv_prob[i] = |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 1843 | av1_mode_mv_merge_probs(pre_fc->newmv_prob[i], counts->newmv_mode[i]); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1844 | for (i = 0; i < ZEROMV_MODE_CONTEXTS; ++i) |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 1845 | fc->zeromv_prob[i] = |
| 1846 | av1_mode_mv_merge_probs(pre_fc->zeromv_prob[i], counts->zeromv_mode[i]); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1847 | for (i = 0; i < REFMV_MODE_CONTEXTS; ++i) |
| 1848 | fc->refmv_prob[i] = |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 1849 | av1_mode_mv_merge_probs(pre_fc->refmv_prob[i], counts->refmv_mode[i]); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1850 | |
| 1851 | for (i = 0; i < DRL_MODE_CONTEXTS; ++i) |
| 1852 | fc->drl_prob[i] = |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 1853 | av1_mode_mv_merge_probs(pre_fc->drl_prob[i], counts->drl_mode[i]); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1854 | #if CONFIG_EXT_INTER |
| 1855 | fc->new2mv_prob = |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 1856 | av1_mode_mv_merge_probs(pre_fc->new2mv_prob, counts->new2mv_mode); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1857 | #endif // CONFIG_EXT_INTER |
| 1858 | #else |
| 1859 | for (i = 0; i < INTER_MODE_CONTEXTS; i++) |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 1860 | aom_tree_merge_probs(av1_inter_mode_tree, pre_fc->inter_mode_probs[i], |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1861 | counts->inter_mode[i], fc->inter_mode_probs[i]); |
| 1862 | #endif |
| 1863 | |
Yue Chen | cb60b18 | 2016-10-13 15:18:22 -0700 | [diff] [blame] | 1864 | #if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1865 | for (i = BLOCK_8X8; i < BLOCK_SIZES; ++i) |
Yue Chen | cb60b18 | 2016-10-13 15:18:22 -0700 | [diff] [blame] | 1866 | aom_tree_merge_probs(av1_motion_mode_tree, pre_fc->motion_mode_prob[i], |
| 1867 | counts->motion_mode[i], fc->motion_mode_prob[i]); |
| 1868 | #endif // CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1869 | |
| 1870 | #if CONFIG_SUPERTX |
| 1871 | for (i = 0; i < PARTITION_SUPERTX_CONTEXTS; ++i) { |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1872 | for (j = 1; j < TX_SIZES; ++j) { |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 1873 | fc->supertx_prob[i][j] = av1_mode_mv_merge_probs( |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1874 | pre_fc->supertx_prob[i][j], counts->supertx[i][j]); |
| 1875 | } |
| 1876 | } |
| 1877 | #endif // CONFIG_SUPERTX |
| 1878 | |
| 1879 | #if CONFIG_EXT_INTER |
| 1880 | for (i = 0; i < INTER_MODE_CONTEXTS; i++) |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 1881 | aom_tree_merge_probs( |
| 1882 | av1_inter_compound_mode_tree, pre_fc->inter_compound_mode_probs[i], |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1883 | counts->inter_compound_mode[i], fc->inter_compound_mode_probs[i]); |
| 1884 | for (i = 0; i < BLOCK_SIZE_GROUPS; ++i) { |
| 1885 | if (is_interintra_allowed_bsize_group(i)) |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 1886 | fc->interintra_prob[i] = av1_mode_mv_merge_probs( |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1887 | pre_fc->interintra_prob[i], counts->interintra[i]); |
| 1888 | } |
| 1889 | for (i = 0; i < BLOCK_SIZE_GROUPS; i++) { |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 1890 | aom_tree_merge_probs( |
| 1891 | av1_interintra_mode_tree, pre_fc->interintra_mode_prob[i], |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1892 | counts->interintra_mode[i], fc->interintra_mode_prob[i]); |
| 1893 | } |
| 1894 | for (i = 0; i < BLOCK_SIZES; ++i) { |
| 1895 | if (is_interintra_allowed_bsize(i) && is_interintra_wedge_used(i)) |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 1896 | fc->wedge_interintra_prob[i] = av1_mode_mv_merge_probs( |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1897 | pre_fc->wedge_interintra_prob[i], counts->wedge_interintra[i]); |
| 1898 | } |
Sarah Parker | 6fddd18 | 2016-11-10 20:57:20 -0800 | [diff] [blame] | 1899 | |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1900 | for (i = 0; i < BLOCK_SIZES; ++i) { |
| 1901 | if (is_interinter_wedge_used(i)) |
Sarah Parker | 6fddd18 | 2016-11-10 20:57:20 -0800 | [diff] [blame] | 1902 | aom_tree_merge_probs( |
| 1903 | av1_compound_type_tree, pre_fc->compound_type_prob[i], |
| 1904 | counts->compound_interinter[i], fc->compound_type_prob[i]); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1905 | } |
| 1906 | #endif // CONFIG_EXT_INTER |
| 1907 | |
| 1908 | for (i = 0; i < BLOCK_SIZE_GROUPS; i++) |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 1909 | aom_tree_merge_probs(av1_intra_mode_tree, pre_fc->y_mode_prob[i], |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1910 | counts->y_mode[i], fc->y_mode_prob[i]); |
| 1911 | |
| 1912 | if (cm->interp_filter == SWITCHABLE) { |
| 1913 | for (i = 0; i < SWITCHABLE_FILTER_CONTEXTS; i++) |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 1914 | aom_tree_merge_probs( |
| 1915 | av1_switchable_interp_tree, pre_fc->switchable_interp_prob[i], |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1916 | counts->switchable_interp[i], fc->switchable_interp_prob[i]); |
| 1917 | } |
Thomas Davies | f693610 | 2016-09-05 16:51:31 +0100 | [diff] [blame] | 1918 | |
| 1919 | #if CONFIG_DELTA_Q |
| 1920 | for (i = 0; i < DELTA_Q_CONTEXTS; ++i) |
| 1921 | fc->delta_q_prob[i] = |
| 1922 | mode_mv_merge_probs(pre_fc->delta_q_prob[i], counts->delta_q[i]); |
| 1923 | #endif |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1924 | } |
| 1925 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 1926 | void av1_adapt_intra_frame_probs(AV1_COMMON *cm) { |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1927 | int i, j; |
| 1928 | FRAME_CONTEXT *fc = cm->fc; |
| 1929 | const FRAME_CONTEXT *pre_fc = &cm->frame_contexts[cm->frame_context_idx]; |
| 1930 | const FRAME_COUNTS *counts = &cm->counts; |
| 1931 | |
| 1932 | if (cm->tx_mode == TX_MODE_SELECT) { |
Jingning Han | aae72a6 | 2016-10-25 15:35:29 -0700 | [diff] [blame] | 1933 | for (i = 0; i < MAX_TX_DEPTH; ++i) { |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1934 | for (j = 0; j < TX_SIZE_CONTEXTS; ++j) |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 1935 | aom_tree_merge_probs(av1_tx_size_tree[i], pre_fc->tx_size_probs[i][j], |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1936 | counts->tx_size[i][j], fc->tx_size_probs[i][j]); |
| 1937 | } |
| 1938 | } |
| 1939 | |
| 1940 | #if CONFIG_VAR_TX |
Yue Chen | a1e48dc | 2016-08-29 17:29:33 -0700 | [diff] [blame] | 1941 | if (cm->tx_mode == TX_MODE_SELECT) { |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1942 | for (i = 0; i < TXFM_PARTITION_CONTEXTS; ++i) |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 1943 | fc->txfm_partition_prob[i] = av1_mode_mv_merge_probs( |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1944 | pre_fc->txfm_partition_prob[i], counts->txfm_partition[i]); |
Yue Chen | a1e48dc | 2016-08-29 17:29:33 -0700 | [diff] [blame] | 1945 | } |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1946 | #endif |
| 1947 | |
| 1948 | for (i = 0; i < SKIP_CONTEXTS; ++i) |
| 1949 | fc->skip_probs[i] = |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 1950 | av1_mode_mv_merge_probs(pre_fc->skip_probs[i], counts->skip[i]); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1951 | |
| 1952 | #if CONFIG_EXT_TX |
| 1953 | for (i = TX_4X4; i < EXT_TX_SIZES; ++i) { |
| 1954 | int s; |
| 1955 | for (s = 1; s < EXT_TX_SETS_INTER; ++s) { |
| 1956 | if (use_inter_ext_tx_for_txsize[s][i]) { |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 1957 | aom_tree_merge_probs( |
| 1958 | av1_ext_tx_inter_tree[s], pre_fc->inter_ext_tx_prob[s][i], |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1959 | counts->inter_ext_tx[s][i], fc->inter_ext_tx_prob[s][i]); |
| 1960 | } |
| 1961 | } |
| 1962 | for (s = 1; s < EXT_TX_SETS_INTRA; ++s) { |
| 1963 | if (use_intra_ext_tx_for_txsize[s][i]) { |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1964 | for (j = 0; j < INTRA_MODES; ++j) |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 1965 | aom_tree_merge_probs( |
| 1966 | av1_ext_tx_intra_tree[s], pre_fc->intra_ext_tx_prob[s][i][j], |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1967 | counts->intra_ext_tx[s][i][j], fc->intra_ext_tx_prob[s][i][j]); |
| 1968 | } |
| 1969 | } |
| 1970 | } |
| 1971 | #else |
| 1972 | for (i = TX_4X4; i < EXT_TX_SIZES; ++i) { |
Nathan E. Egge | 7c5b4c1 | 2016-04-26 12:31:14 -0400 | [diff] [blame] | 1973 | for (j = 0; j < TX_TYPES; ++j) { |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 1974 | aom_tree_merge_probs(av1_ext_tx_tree, pre_fc->intra_ext_tx_prob[i][j], |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1975 | counts->intra_ext_tx[i][j], |
| 1976 | fc->intra_ext_tx_prob[i][j]); |
Nathan E. Egge | 7c5b4c1 | 2016-04-26 12:31:14 -0400 | [diff] [blame] | 1977 | } |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1978 | } |
| 1979 | for (i = TX_4X4; i < EXT_TX_SIZES; ++i) { |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 1980 | aom_tree_merge_probs(av1_ext_tx_tree, pre_fc->inter_ext_tx_prob[i], |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1981 | counts->inter_ext_tx[i], fc->inter_ext_tx_prob[i]); |
| 1982 | } |
| 1983 | #endif // CONFIG_EXT_TX |
| 1984 | |
| 1985 | if (cm->seg.temporal_update) { |
| 1986 | for (i = 0; i < PREDICTION_PROBS; i++) |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 1987 | fc->seg.pred_probs[i] = av1_mode_mv_merge_probs(pre_fc->seg.pred_probs[i], |
| 1988 | counts->seg.pred[i]); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1989 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 1990 | aom_tree_merge_probs(av1_segment_tree, pre_fc->seg.tree_probs, |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1991 | counts->seg.tree_mispred, fc->seg.tree_probs); |
| 1992 | } else { |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 1993 | aom_tree_merge_probs(av1_segment_tree, pre_fc->seg.tree_probs, |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1994 | counts->seg.tree_total, fc->seg.tree_probs); |
| 1995 | } |
| 1996 | |
| 1997 | for (i = 0; i < INTRA_MODES; ++i) |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 1998 | aom_tree_merge_probs(av1_intra_mode_tree, pre_fc->uv_mode_prob[i], |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1999 | counts->uv_mode[i], fc->uv_mode_prob[i]); |
| 2000 | |
| 2001 | #if CONFIG_EXT_PARTITION_TYPES |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 2002 | aom_tree_merge_probs(av1_partition_tree, pre_fc->partition_prob[0], |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 2003 | counts->partition[0], fc->partition_prob[0]); |
| 2004 | for (i = 1; i < PARTITION_CONTEXTS; i++) |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 2005 | aom_tree_merge_probs(av1_ext_partition_tree, pre_fc->partition_prob[i], |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 2006 | counts->partition[i], fc->partition_prob[i]); |
| 2007 | #else |
Nathan E. Egge | fba2be6 | 2016-05-03 09:48:54 -0400 | [diff] [blame] | 2008 | for (i = 0; i < PARTITION_CONTEXTS; i++) { |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 2009 | aom_tree_merge_probs(av1_partition_tree, pre_fc->partition_prob[i], |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 2010 | counts->partition[i], fc->partition_prob[i]); |
Nathan E. Egge | fba2be6 | 2016-05-03 09:48:54 -0400 | [diff] [blame] | 2011 | } |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 2012 | #endif // CONFIG_EXT_PARTITION_TYPES |
Thomas Davies | f693610 | 2016-09-05 16:51:31 +0100 | [diff] [blame] | 2013 | #if CONFIG_DELTA_Q |
| 2014 | for (i = 0; i < DELTA_Q_CONTEXTS; ++i) |
| 2015 | fc->delta_q_prob[i] = |
| 2016 | mode_mv_merge_probs(pre_fc->delta_q_prob[i], counts->delta_q[i]); |
| 2017 | #endif |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 2018 | #if CONFIG_EXT_INTRA |
hui su | 5db9743 | 2016-10-14 16:10:14 -0700 | [diff] [blame] | 2019 | for (i = 0; i < INTRA_FILTERS + 1; ++i) { |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 2020 | aom_tree_merge_probs(av1_intra_filter_tree, pre_fc->intra_filter_probs[i], |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 2021 | counts->intra_filter[i], fc->intra_filter_probs[i]); |
hui su | 5db9743 | 2016-10-14 16:10:14 -0700 | [diff] [blame] | 2022 | } |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 2023 | #endif // CONFIG_EXT_INTRA |
hui su | 5db9743 | 2016-10-14 16:10:14 -0700 | [diff] [blame] | 2024 | #if CONFIG_FILTER_INTRA |
| 2025 | for (i = 0; i < PLANE_TYPES; ++i) { |
| 2026 | fc->filter_intra_probs[i] = av1_mode_mv_merge_probs( |
| 2027 | pre_fc->filter_intra_probs[i], counts->filter_intra[i]); |
| 2028 | } |
| 2029 | #endif // CONFIG_FILTER_INTRA |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 2030 | } |
| 2031 | |
| 2032 | static void set_default_lf_deltas(struct loopfilter *lf) { |
| 2033 | lf->mode_ref_delta_enabled = 1; |
| 2034 | lf->mode_ref_delta_update = 1; |
| 2035 | |
| 2036 | lf->ref_deltas[INTRA_FRAME] = 1; |
| 2037 | lf->ref_deltas[LAST_FRAME] = 0; |
| 2038 | #if CONFIG_EXT_REFS |
| 2039 | lf->ref_deltas[LAST2_FRAME] = lf->ref_deltas[LAST_FRAME]; |
| 2040 | lf->ref_deltas[LAST3_FRAME] = lf->ref_deltas[LAST_FRAME]; |
| 2041 | lf->ref_deltas[BWDREF_FRAME] = lf->ref_deltas[LAST_FRAME]; |
| 2042 | #endif // CONFIG_EXT_REFS |
| 2043 | lf->ref_deltas[GOLDEN_FRAME] = -1; |
| 2044 | lf->ref_deltas[ALTREF_FRAME] = -1; |
| 2045 | |
| 2046 | lf->mode_deltas[0] = 0; |
| 2047 | lf->mode_deltas[1] = 0; |
| 2048 | } |
| 2049 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 2050 | void av1_setup_past_independence(AV1_COMMON *cm) { |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 2051 | // Reset the segment feature data to the default stats: |
| 2052 | // Features disabled, 0, with delta coding (Default state). |
| 2053 | struct loopfilter *const lf = &cm->lf; |
| 2054 | |
| 2055 | int i; |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 2056 | av1_clearall_segfeatures(&cm->seg); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 2057 | cm->seg.abs_delta = SEGMENT_DELTADATA; |
| 2058 | |
| 2059 | if (cm->last_frame_seg_map && !cm->frame_parallel_decode) |
| 2060 | memset(cm->last_frame_seg_map, 0, (cm->mi_rows * cm->mi_cols)); |
| 2061 | |
| 2062 | if (cm->current_frame_seg_map) |
| 2063 | memset(cm->current_frame_seg_map, 0, (cm->mi_rows * cm->mi_cols)); |
| 2064 | |
| 2065 | // Reset the mode ref deltas for loop filter |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 2066 | av1_zero(lf->last_ref_deltas); |
| 2067 | av1_zero(lf->last_mode_deltas); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 2068 | set_default_lf_deltas(lf); |
| 2069 | |
| 2070 | // To force update of the sharpness |
| 2071 | lf->last_sharpness_level = -1; |
| 2072 | #if CONFIG_LOOP_RESTORATION |
Debargha Mukherjee | 5d89a63 | 2016-09-17 13:16:58 -0700 | [diff] [blame] | 2073 | if (cm->rst_info.bilateral_info) { |
| 2074 | int s; |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 2075 | for (i = 0; i < cm->rst_internal.ntiles; ++i) |
Debargha Mukherjee | 5d89a63 | 2016-09-17 13:16:58 -0700 | [diff] [blame] | 2076 | for (s = 0; s < BILATERAL_SUBTILES; ++s) |
| 2077 | cm->rst_info.bilateral_info[i].level[s] = -1; |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 2078 | } |
| 2079 | #endif // CONFIG_LOOP_RESTORATION |
| 2080 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 2081 | av1_default_coef_probs(cm); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 2082 | init_mode_probs(cm->fc); |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 2083 | av1_init_mv_probs(cm); |
Angie Chiang | ed8cd9a | 2016-10-21 16:44:47 -0700 | [diff] [blame] | 2084 | #if CONFIG_ADAPT_SCAN |
| 2085 | av1_init_scan_order(cm); |
| 2086 | #endif |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 2087 | cm->fc->initialized = 1; |
| 2088 | |
| 2089 | if (cm->frame_type == KEY_FRAME || cm->error_resilient_mode || |
| 2090 | cm->reset_frame_context == RESET_FRAME_CONTEXT_ALL) { |
| 2091 | // Reset all frame contexts. |
| 2092 | for (i = 0; i < FRAME_CONTEXTS; ++i) cm->frame_contexts[i] = *cm->fc; |
| 2093 | } else if (cm->reset_frame_context == RESET_FRAME_CONTEXT_CURRENT) { |
| 2094 | // Reset only the frame context specified in the frame header. |
| 2095 | cm->frame_contexts[cm->frame_context_idx] = *cm->fc; |
| 2096 | } |
| 2097 | |
| 2098 | // prev_mip will only be allocated in encoder. |
| 2099 | if (frame_is_intra_only(cm) && cm->prev_mip && !cm->frame_parallel_decode) |
| 2100 | memset(cm->prev_mip, 0, |
| 2101 | cm->mi_stride * (cm->mi_rows + 1) * sizeof(*cm->prev_mip)); |
| 2102 | |
| 2103 | cm->frame_context_idx = 0; |
| 2104 | } |