entropymode.c 324 KB
Newer Older
Jingning Han's avatar
Jingning Han committed
1
/*
Yaowu Xu's avatar
Yaowu Xu committed
2
 * Copyright (c) 2016, Alliance for Open Media. All rights reserved
Jingning Han's avatar
Jingning Han committed
3
 *
Yaowu Xu's avatar
Yaowu Xu committed
4 5 6 7 8 9
 * This source code is subject to the terms of the BSD 2 Clause License and
 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
 * was not distributed with this source code in the LICENSE file, you can
 * obtain it at www.aomedia.org/license/software. If the Alliance for Open
 * Media Patent License 1.0 was not distributed with this source code in the
 * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
Jingning Han's avatar
Jingning Han committed
10 11
 */

Yaowu Xu's avatar
Yaowu Xu committed
12
#include "aom_mem/aom_mem.h"
Jingning Han's avatar
Jingning Han committed
13

14
#include "av1/common/reconinter.h"
Angie Chiang's avatar
Angie Chiang committed
15
#include "av1/common/scan.h"
16 17
#include "av1/common/onyxc_int.h"
#include "av1/common/seg_common.h"
18 19 20
#if CONFIG_LV_MAP
#include "av1/common/txb_common.h"
#endif
Jingning Han's avatar
Jingning Han committed
21

22
#if CONFIG_LV_MAP
23
#include "av1/common/txb_common.h"
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
const aom_prob default_txb_skip[TX_SIZES][TXB_SKIP_CONTEXTS] = {
  { 252, 71, 126, 184, 178, 218, 251, 49, 133, 221, 27, 92, 197 },
  { 252, 71, 126, 184, 178, 218, 251, 49, 133, 221, 27, 92, 197 },
  { 252, 71, 126, 184, 178, 218, 251, 49, 133, 221, 27, 92, 197 },
  { 252, 71, 126, 184, 178, 218, 251, 49, 133, 221, 27, 92, 197 },
};
const aom_prob default_dc_sign[PLANE_TYPES][DC_SIGN_CONTEXTS] = {
  { 125, 102, 147 }, { 119, 101, 135 },
};

const aom_prob default_coeff_base
    [TX_SIZES][PLANE_TYPES][NUM_BASE_LEVELS][COEFF_BASE_CONTEXTS] = {
      { // TX_4X4
        {
            // PLANE_Y
            { 73,  128, 131, 204, 165, 226, 169, 236, 18,  128, 51,
              153, 97,  179, 123, 201, 145, 226, 20,  128, 59,  153,
              107, 181, 129, 201, 142, 226, 3,   128, 19,  99,  46,
              135, 92,  166, 129, 190, 157, 217, 128, 128 },

            { 128, 128, 178, 218, 192, 236, 186, 243, 55,  128, 110,
              183, 151, 205, 168, 221, 180, 238, 65,  128, 116, 178,
              157, 206, 172, 222, 183, 238, 24,  128, 65,  127, 104,
              164, 154, 195, 187, 216, 205, 230, 128, 128 },
        },
        {
            // PLANE_UV
            { 47,  128, 100, 176, 140, 207, 150, 223, 11,  128, 35,
              133, 79,  165, 115, 186, 129, 210, 8,   128, 30,  114,
              80,  159, 116, 187, 146, 214, 2,   128, 9,   59,  28,
              86,  71,  131, 117, 165, 149, 188, 128, 128 },

            { 83,  128, 152, 205, 168, 227, 192, 238, 42,  128, 92,
              169, 138, 193, 165, 209, 128, 206, 36,  128, 86,  159,
              141, 198, 181, 213, 102, 223, 18,  128, 50,  132, 90,
              144, 141, 169, 180, 191, 128, 217, 128, 128 },
        } },
      {
          // TX_8X8
          {
              // PLANE_Y
              { 82,  128, 143, 203, 177, 225, 186, 237, 7,   128, 37,
                109, 78,  151, 110, 182, 139, 213, 25,  128, 51,  115,
                86,  146, 111, 175, 125, 205, 3,   128, 12,  55,  32,
                78,  63,  111, 96,  148, 123, 185, 146, 206 },

              { 136, 128, 182, 220, 201, 236, 205, 243, 46,  128, 101,
                164, 147, 194, 170, 218, 177, 234, 62,  128, 104, 146,
                143, 183, 165, 207, 183, 228, 30,  128, 60,  95,  95,
                128, 135, 163, 166, 196, 175, 219, 192, 231 },
          },
          {
              // PLANE_UV
              { 47,  128, 112, 189, 164, 202, 163, 218, 8,   128, 32,
                110, 68,  151, 102, 179, 134, 195, 5,   128, 22,  76,
                54,  103, 80,  146, 101, 182, 1,   128, 5,   39,  17,
                53,  46,  93,  79,  127, 112, 161, 64,  195 },

              { 90,  128, 156, 210, 183, 225, 128, 236, 39,  128, 98,
                164, 146, 201, 209, 219, 171, 208, 32,  128, 68,  123,
                119, 169, 154, 184, 128, 213, 15,  128, 38,  111, 83,
                112, 120, 163, 180, 170, 154, 213, 128, 205 },
          },
      },

      {
          // TX_16X16
          {
              // PLANE_Y
              { 96,  128, 169, 218, 208, 233, 187, 244, 10,  128, 34,
                101, 82,  153, 113, 184, 137, 212, 6,   128, 34,  104,
                81,  145, 109, 176, 147, 202, 1,   128, 3,   43,  15,
                53,  43,  89,  79,  129, 108, 168, 110, 194 },

              { 156, 128, 206, 232, 218, 240, 128, 251, 39,  128, 108,
                161, 156, 202, 187, 216, 179, 234, 40,  128, 103, 152,
                144, 185, 159, 208, 205, 227, 14,  128, 39,  84,  76,
                110, 121, 151, 157, 187, 201, 206, 64,  216 },
          },
          {
              // PLANE_UV
              { 42, 128, 139, 211, 180, 230, 199, 238, 3,   128, 32,
                96, 69,  145, 102, 186, 117, 212, 4,   128, 25,  72,
                55, 111, 81,  159, 116, 198, 1,   128, 4,   22,  16,
                34, 35,  68,  63,  116, 89,  165, 102, 199 },

              { 135, 128, 193, 227, 182, 239, 128, 246, 42,  128, 115,
                156, 146, 203, 188, 216, 128, 229, 32,  128, 82,  127,
                120, 178, 165, 203, 213, 229, 11,  128, 32,  73,  79,
                111, 129, 158, 162, 187, 156, 209, 85,  222 },
          },
      },

      {
          // TX_32X32
          {
              // PLANE_Y
              { 97,  128, 163, 232, 191, 246, 219, 252, 3,   128, 41,
                108, 91,  147, 104, 183, 118, 225, 6,   128, 45,  91,
                83,  125, 92,  160, 99,  215, 1,   128, 11,  36,  28,
                46,  43,  59,  57,  86,  73,  145, 91,  210 },

              { 127, 128, 201, 239, 247, 248, 128, 254, 40,  128, 103,
                152, 158, 199, 186, 225, 181, 242, 38,  128, 92,  112,
                146, 189, 162, 217, 112, 239, 17,  128, 30,  47,  63,
                89,  113, 146, 147, 187, 168, 217, 150, 233 },
          },
          {
              // PLANE_UV
              { 65,  128, 155, 223, 166, 235, 154, 244, 15,  128, 57,
                154, 110, 199, 159, 224, 149, 239, 9,   128, 57,  140,
                97,  185, 148, 218, 176, 236, 1,   128, 3,   43,  19,
                42,  64,  98,  117, 167, 154, 199, 128, 158 },

              { 130, 128, 189, 231, 171, 247, 128, 246, 63,  128, 132,
                222, 186, 224, 199, 244, 128, 247, 55,  128, 113, 211,
                164, 230, 225, 243, 128, 239, 7,   128, 31,  102, 106,
                138, 147, 183, 171, 223, 171, 224, 128, 128 },
          },
      },
    };

Dake He's avatar
Dake He committed
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181
const aom_prob default_nz_map[TX_SIZES][PLANE_TYPES][SIG_COEF_CONTEXTS] =
    {
#if CONFIG_EOB_FIRST
      { { 42,  58,  129, 82,  37,  16,  117, 117, 66,  31,  17,  63,
          98,  40,  128, 128, 136, 130, 95,  43,  128, 154, 143, 98,
          41,  128, 103, 141, 69,  128, 128, 128, 130, 131, 95,  39,
          128, 147, 146, 94,  38,  128, 102, 143, 63,  128, 128, 128 },
        { 57,  90,  143, 80,  44,  24,  132, 144, 77,  45,  28,  93,
          152, 74,  128, 128, 152, 179, 119, 70,  128, 162, 189, 127,
          70,  128, 131, 193, 112, 128, 128, 128, 143, 164, 93,  56,
          128, 140, 166, 102, 67,  128, 124, 186, 108, 128, 128, 128 } },
      { { 48,  101, 138, 91,  44,  18,  156, 148, 100, 53,  23,  173,
          154, 106, 60,  29,  183, 135, 95,  53,  26,  204, 157, 105,
          61,  32,  187, 161, 110, 67,  38,  128, 175, 139, 100, 58,
          27,  196, 160, 112, 67,  32,  182, 163, 112, 65,  34,  128 },
        { 71,  138, 167, 108, 75,  47,  179, 173, 108, 71,  45,  193,
          189, 123, 72,  43,  184, 186, 121, 67,  38,  206, 201, 139,
          90,  19,  197, 210, 149, 93,  80,  128, 179, 174, 116, 84,
          62,  182, 163, 93,  60,  50,  175, 187, 121, 84,  52,  128 } },
      { { 48,  132, 133, 88,  46,  21,  189, 156, 103, 55,  25,  221,
          175, 121, 70,  35,  209, 127, 89,  52,  24,  228, 160, 108,
          65,  32,  229, 179, 126, 79,  39,  128, 195, 130, 89,  54,
          27,  214, 155, 105, 62,  31,  217, 173, 117, 73,  39,  128 },
        { 54,  172, 175, 122, 73,  32,  217, 191, 139, 88,  55,  238,
          204, 146, 106, 52,  141, 95,  36,  37,  128, 210, 201, 135,
          85,  128, 242, 212, 172, 128, 128, 128, 192, 172, 133, 85,
          48,  203, 171, 141, 116, 80,  206, 173, 103, 68,  28,  128 } },
      { { 24,  102, 110, 73,  41,  22,  183, 148, 94,  54,  27,  239,
          177, 120, 82,  45,  217, 102, 58,  34,  28,  244, 166, 91,
          61,  22,  251, 209, 128, 81,  48,  128, 226, 128, 80,  48,
          25,  237, 165, 96,  54,  27,  238, 185, 106, 57,  31,  128 },
        { 72,  215, 186, 137, 72,  43,  239, 209, 164, 136, 64,  251,
          215, 173, 130, 17,  128, 128, 128, 128, 128, 128, 128, 128,
          128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
          128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 } }
#else
182
#if CONFIG_EXT_TX
Dake He's avatar
Dake He committed
183 184
      { { 56,  137, 82,  136, 83,  187, 124, 65,
          215, 118, 155, 97,  160, 111, 71,  55,
185

Dake He's avatar
Dake He committed
186 187
          142, 156, 91,  226, 107, 231, 146, 65,
          105, 91,  232, 97,  185, 121, 90,  74,
188

Dake He's avatar
Dake He committed
189 190 191 192
          153, 195, 123, 154, 106, 196, 143, 67,
          232, 125, 121, 105, 159, 113, 88,  66 },
        { 50,  124, 89,  135, 116, 189, 150, 81,
          202, 126, 130, 107, 149, 110, 85,  67,
193

Dake He's avatar
Dake He committed
194 195
          139, 174, 112, 200, 94,  206, 146, 71,
          163, 164, 212, 99,  177, 143, 125, 85,
196

Dake He's avatar
Dake He committed
197 198 199 200
          151, 181, 126, 168, 135, 186, 143, 94,
          207, 129, 142, 135, 145, 112, 98,  81 } },
      { { 57,  156, 91,  162, 99,  212, 149, 81,
          223, 128, 182, 121, 216, 163, 119, 94,
201

Dake He's avatar
Dake He committed
202 203
          139, 183, 100, 206, 98,  242, 163, 79,
          200, 127, 234, 112, 230, 169, 115, 90,
204

Dake He's avatar
Dake He committed
205 206 207 208
          156, 190, 130, 172, 117, 209, 163, 80,
          217, 145, 182, 135, 204, 163, 120, 88 },
        { 48,  133, 102, 143, 119, 190, 170, 109,
          197, 127, 176, 137, 214, 168, 130, 119,
209

Dake He's avatar
Dake He committed
210 211
          139, 185, 129, 210, 84,  237, 177, 75,
          182, 165, 216, 121, 206, 177, 147, 102,
212

Dake He's avatar
Dake He committed
213 214 215 216
          159, 192, 153, 182, 139, 203, 160, 125,
          193, 161, 176, 142, 173, 145, 131, 114 } },
      { { 33,  148, 81,  149, 84,  219, 152, 76,
          229, 127, 205, 120, 234, 170, 123, 88,
217

Dake He's avatar
Dake He committed
218 219
          134, 197, 101, 213, 91,  244, 169, 85,
          220, 141, 234, 123, 242, 183, 130, 94,
220

Dake He's avatar
Dake He committed
221 222 223 224
          141, 184, 121, 173, 98,  213, 156, 85,
          204, 156, 197, 119, 212, 174, 127, 92 },
        { 14,  75,  45,  98,  83,  197, 150, 90,
          235, 124, 242, 155, 246, 187, 143, 103,
225

Dake He's avatar
Dake He committed
226 227
          78,  185, 111, 255, 116, 255, 224, 171,
          185, 157, 255, 85,  219, 122, 128, 128,
228

Dake He's avatar
Dake He committed
229 230 231 232 233
          117, 187, 102, 181, 132, 233, 197, 93,
          207, 135, 191, 107, 222, 175, 130, 47 } },
      {
          { 14,  79,  44,  86,  59,  178, 124, 63,
            244, 106, 233, 117, 252, 185, 132, 92,
234

Dake He's avatar
Dake He committed
235 236
            85,  225, 47,  236, 103, 255, 190, 116,
            235, 114, 247, 123, 250, 174, 122, 110,
237

Dake He's avatar
Dake He committed
238 239 240 241
            109, 197, 78,  177, 76,  242, 148, 68,
            236, 123, 231, 103, 247, 171, 122, 91 },
          { 11,  40,  27,  92,  78,  183, 171, 70,
            216, 74,  251, 146, 252, 213, 171, 148,
242

Dake He's avatar
Dake He committed
243 244
            85,  225, 47,  236, 103, 255, 190, 116,
            235, 114, 247, 123, 250, 174, 122, 110,
245

Dake He's avatar
Dake He committed
246 247 248
            109, 197, 78,  177, 76,  242, 148, 68,
            236, 123, 231, 103, 247, 171, 122, 91 },
      },
249
#else   // CONFIG_EXT_TX
Angie Chiang's avatar
Angie Chiang committed
250
      {
Dake He's avatar
Dake He committed
251 252 253 254
          {
              34, 103, 61, 106, 62, 160, 112, 54, 173, 121, 157, 92, 157, 129,
              94, 65,
          },
Angie Chiang's avatar
Angie Chiang committed
255

Dake He's avatar
Dake He committed
256 257 258 259
          {
              52, 124, 84, 136, 107, 197, 161, 82, 183, 151, 153, 140, 152, 134,
              109, 81,
          },
Angie Chiang's avatar
Angie Chiang committed
260 261
      },
      {
Dake He's avatar
Dake He committed
262 263 264 265
          {
              34, 127, 74, 124, 74, 204, 153, 76, 226, 162, 207, 126, 227, 192,
              149, 108,
          },
Angie Chiang's avatar
Angie Chiang committed
266

Dake He's avatar
Dake He committed
267 268 269 270
          {
              43, 136, 115, 158, 130, 212, 187, 112, 231, 180, 202, 164, 236,
              204, 168, 139,
          },
Angie Chiang's avatar
Angie Chiang committed
271 272
      },
      {
Dake He's avatar
Dake He committed
273 274 275 276
          {
              25, 117, 70, 120, 77, 215, 171, 102, 234, 156, 235, 155, 247, 220,
              176, 127,
          },
Angie Chiang's avatar
Angie Chiang committed
277

Dake He's avatar
Dake He committed
278 279 280 281
          {
              24, 88, 49, 100, 62, 202, 148, 62, 237, 178, 233, 168, 244, 198,
              162, 127,
          },
Angie Chiang's avatar
Angie Chiang committed
282 283
      },
      {
Dake He's avatar
Dake He committed
284 285 286 287
          {
              11, 54, 17, 69, 26, 128, 125, 56, 232, 130, 237, 121, 250, 168,
              134, 114,
          },
Angie Chiang's avatar
Angie Chiang committed
288

Dake He's avatar
Dake He committed
289 290 291 292
          {
              21, 52, 32, 95, 64, 171, 152, 70, 247, 159, 252, 177, 252, 221,
              192, 143,
          },
Angie Chiang's avatar
Angie Chiang committed
293
      },
294
#endif  // CONFIG_EXT_TX
Dake He's avatar
Dake He committed
295 296
#endif  // CONFIG_EOB_FIRST
    };
297

298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368
#if CONFIG_CTX1D
const aom_prob default_eob_flag[TX_SIZES][PLANE_TYPES][EOB_COEF_CONTEXTS] = {
  { { 220, 225, 220, 216, 233, 225, 189, 178, 222, 199, 164, 112, 207,
      171, 115, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,

      147, 125, 104, 36,  117, 107, 26,  128, 128, 128, 128, 128, 128,
      128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,

      156, 124, 128, 128, 146, 68,  128, 128, 131, 17,  128, 128, 64,
      128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 },

    { 146, 150, 142, 144, 178, 167, 131, 116, 150, 123, 107, 63,  119,
      89,  74,  128, 128, 128, 128, 128, 128, 128, 128, 128, 128,

      117, 127, 105, 69,  53,  56,  30,  128, 128, 128, 128, 128, 128,
      128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,

      128, 86,  128, 128, 140, 72,  128, 128, 120, 44,  128, 128, 80,
      128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 } },
  { { 237, 242, 242, 219, 192, 246, 246, 243, 233, 184, 155, 234, 217,
      188, 152, 195, 167, 114, 89,  128, 128, 128, 128, 128, 128,

      180, 173, 154, 133, 112, 147, 145, 142, 102, 128, 128, 128, 128,
      128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,

      198, 173, 130, 200, 128, 208, 182, 160, 106, 171, 128, 144, 128,
      128, 128, 124, 128, 128, 128, 128, 128, 128, 128, 128, 128 },

    { 140, 170, 162, 111, 94,  182, 195, 165, 153, 110, 81,  178, 169,
      158, 83,  133, 85,  85,  38,  128, 128, 128, 128, 128, 128,

      112, 127, 107, 87,  31,  57,  49,  128, 128, 128, 128, 128, 128,
      128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,

      160, 143, 99,  126, 128, 164, 133, 126, 59,  71,  128, 138, 128,
      128, 128, 99,  128, 128, 128, 128, 128, 128, 128, 128, 128 } },
  { { 229, 241, 243, 245, 247, 247, 251, 248, 235, 210, 247, 235, 208,
      166, 245, 247, 244, 182, 236, 229, 180, 136, 128, 128, 128,

      191, 197, 96,  70,  199, 128, 128, 191, 174, 117, 128, 128, 128,
      128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,

      211, 183, 215, 188, 138, 209, 136, 128, 170, 128, 191, 128, 161,
      128, 182, 128, 128, 128, 164, 128, 128, 128, 128, 128, 128 },

    { 106, 153, 182, 191, 186, 202, 211, 203, 166, 147, 205, 205, 195,
      128, 206, 212, 182, 109, 192, 154, 139, 79,  128, 128, 128,

      112, 133, 128, 255, 128, 128, 128, 130, 154, 98,  128, 128, 128,
      128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,

      144, 185, 169, 199, 85,  183, 128, 128, 64,  128, 146, 128, 128,
      128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 } },
  { { 169, 203, 224, 222, 220, 228, 229, 223, 234, 247, 242, 230, 222,
      238, 246, 234, 196, 245, 249, 245, 192, 240, 235, 199, 161,

      176, 148, 158, 77,  178, 128, 128, 158, 128, 128, 196, 208, 155,
      128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,

      232, 187, 191, 221, 116, 217, 154, 128, 203, 128, 128, 192, 128,
      201, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 },

    { 133, 182, 215, 204, 176, 220, 182, 168, 187, 197, 181, 145, 75,
      164, 136, 51,  57,  156, 128, 128, 128, 85,  128, 128, 128,

      128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
      128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,

      128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
      128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 } },
};
Dake He's avatar
Dake He committed
369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390
#else  // CONFIG_CTX1D
#if CONFIG_EOB_FIRST
static const aom_prob
    default_eob_flag[TX_SIZES][PLANE_TYPES][EOB_COEF_CONTEXTS] = {
      { { 221, 233, 232, 221, 231, 233, 216, 196, 233, 226, 200, 133, 227,
          206, 157, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 },
        { 167, 197, 190, 182, 201, 199, 170, 145, 200, 183, 147, 84, 198,
          166, 106, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 } },
      { { 236, 244, 246, 243, 232, 244, 247, 243, 241, 231, 212, 250, 248,
          236, 206, 244, 236, 215, 158, 128, 128, 128, 128, 128, 128 },
        { 146, 204, 212, 194, 176, 206, 220, 208, 201, 174, 139, 227, 221,
          185, 149, 210, 190, 152, 93,  128, 128, 128, 128, 128, 128 } },
      { { 231, 242, 243, 248, 248, 249, 251, 251, 249, 246, 250, 247, 242,
          226, 252, 252, 248, 233, 249, 246, 240, 213, 128, 128, 128 },
        { 95,  187, 199, 228, 231, 230, 245, 243, 231, 241, 238, 235, 220,
          192, 244, 240, 230, 210, 217, 208, 170, 134, 128, 128, 128 } },
      { { 181, 218, 219, 232, 234, 235, 243, 245, 247, 251, 251, 248, 253,
          250, 252, 252, 250, 252, 253, 250, 233, 249, 247, 232, 202 },
        { 92,  181, 200, 233, 232, 235, 249, 253, 253, 255, 254, 238, 228,
          255, 251, 240, 128, 242, 233, 211, 171, 214, 179, 46,  128 } }
    };
#else
391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416
const aom_prob default_eob_flag[TX_SIZES][PLANE_TYPES][EOB_COEF_CONTEXTS] = {
  {
      { 229, 236, 231, 222, 239, 236, 214, 201, 236, 226, 195, 134, 228,
        210, 150, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 },
      { 182, 186, 172, 176, 207, 213, 152, 122, 187, 171, 131, 65, 170,
        134, 101, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 },
  },
  {
      { 225, 234, 244, 236, 205, 242, 246, 247, 246, 234, 191, 242, 237,
        215, 142, 224, 206, 142, 73,  128, 128, 128, 128, 128, 128 },
      { 154, 171, 187, 175, 62,  199, 202, 206, 215, 200, 111, 197, 199,
        174, 100, 135, 105, 104, 45,  128, 128, 128, 128, 128, 128 },
  },
  {
      { 180, 213, 216, 229, 233, 232, 240, 235, 220, 178, 239, 238, 225,
        187, 229, 214, 226, 200, 183, 141, 158, 179, 128, 128, 128 },
      { 190, 225, 234, 248, 249, 248, 253, 251, 232, 110, 254, 252, 236,
        57,  253, 248, 232, 85,  244, 189, 112, 64,  128, 128, 128 },
  },
  {
      { 248, 224, 246, 244, 239, 245, 251, 246, 251, 255, 255, 255, 249,
        255, 255, 255, 229, 255, 255, 255, 228, 255, 255, 247, 137 },
      { 204, 207, 233, 215, 193, 228, 239, 221, 227, 250, 236, 207, 135,
        236, 186, 182, 57,  209, 140, 128, 85,  184, 110, 128, 128 },
  },
};
Dake He's avatar
Dake He committed
417
#endif
418
#endif  // CONFIG_CTX1D
419

420
const aom_prob default_coeff_lps[TX_SIZES][PLANE_TYPES][LEVEL_CONTEXTS] = {
421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452
  { { 96,  128, 86,  122, 128, 84,  125, 128, 88,  99,  126, 128,
      135, 159, 99,  130, 134, 100, 128, 144, 70,  97,  128, 139,
      157, 168, 127, 148, 162, 121, 149, 157, 118, 127, 143, 157,
      178, 186, 168, 171, 183, 165, 169, 180, 180, 169, 166, 177 },
    { 81,  128, 72,  95,  128, 64,  98,  128, 42,  66,  101, 128,
      129, 163, 97,  122, 130, 91,  119, 141, 70,  94,  118, 166,
      157, 168, 117, 143, 151, 111, 144, 154, 76,  113, 128, 158,
      177, 185, 165, 167, 179, 155, 166, 179, 110, 137, 115, 165 } },
  { { 102, 128, 79,  125, 128, 74,  121, 128, 61,  98,  128, 128,
      141, 164, 96,  132, 150, 90,  128, 153, 62,  100, 128, 153,
      162, 172, 120, 146, 162, 113, 142, 154, 96,  113, 138, 155,
      181, 188, 151, 170, 179, 147, 167, 181, 158, 157, 163, 176 },
    { 103, 128, 80,  116, 128, 66,  94,  128, 35,  65,  109, 128,
      134, 163, 104, 137, 154, 92,  128, 104, 58,  94,  129, 132,
      156, 173, 137, 149, 165, 104, 143, 143, 112, 101, 133, 159,
      176, 186, 134, 172, 175, 155, 169, 177, 255, 107, 137, 168 } },
  { { 125, 128, 85,  157, 128, 82,  155, 128, 42,  83,  116, 128,
      155, 174, 101, 144, 155, 93,  140, 155, 57,  92,  124, 149,
      173, 178, 114, 148, 161, 111, 145, 161, 77,  101, 131, 153,
      190, 191, 140, 169, 183, 140, 169, 179, 108, 122, 150, 171 },
    { 136, 128, 108, 163, 128, 96,  140, 128, 48,  90,  85,  128,
      144, 164, 113, 158, 179, 107, 159, 128, 43,  75,  133, 160,
      157, 184, 144, 160, 189, 154, 152, 184, 128, 124, 137, 140,
      188, 196, 148, 170, 178, 128, 177, 159, 128, 179, 135, 135 } },
  { { 133, 128, 110, 153, 128, 101, 157, 128, 49,  91,  134, 128,
      151, 168, 129, 158, 162, 112, 154, 168, 63,  99,  130, 158,
      171, 178, 128, 160, 173, 111, 155, 171, 86,  108, 143, 159,
      194, 196, 162, 177, 185, 123, 172, 181, 101, 132, 156, 178 },
    { 133, 128, 129, 144, 128, 116, 135, 128, 43,  101, 100, 128,
      140, 163, 158, 173, 205, 128, 165, 171, 128, 128, 210, 163,
      172, 184, 192, 176, 201, 183, 177, 190, 128, 192, 199, 144,
      192, 192, 1,   196, 192, 255, 171, 178, 255, 128, 171, 179 } }
453
};
454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554
#if BR_NODE
const aom_prob
    default_coeff_br[TX_SIZES][PLANE_TYPES][BASE_RANGE_SETS][LEVEL_CONTEXTS] = {
      { { { 62,  128, 54,  116, 128, 51,  97,  128, 59,  68,  107, 128,
            119, 158, 68,  115, 131, 65,  112, 138, 34,  71,  118, 137,
            171, 184, 110, 152, 178, 105, 146, 172, 89,  111, 145, 173,
            214, 226, 201, 198, 214, 196, 193, 210, 239, 196, 186, 202 },
          { 41,  128, 58,  52,  128, 51,  61,  128, 92,  54,  48,  128,
            67,  113, 36,  55,  75,  30,  56,  72,  12,  25,  50,  79,
            94,  131, 37,  75,  108, 42,  78,  103, 5,   31,  67,  103,
            172, 192, 131, 135, 167, 129, 136, 165, 149, 144, 120, 149 },
          { 35, 128, 74, 50, 128, 63, 59, 128, 87,  74,  38, 128,
            32, 53,  23, 34, 50,  18, 30, 41,  15,  13,  18, 18,
            52, 74,  18, 29, 36,  18, 31, 47,  51,  9,   15, 27,
            96, 134, 85, 70, 93,  96, 79, 100, 108, 100, 55, 65 } },
        { { 52,  128, 35,  79,  128, 29,  66,  128, 12,  30, 57,  128,
            113, 156, 64,  107, 172, 54,  103, 145, 23,  57, 96,  110,
            165, 184, 95,  138, 166, 95,  141, 184, 55,  80, 133, 165,
            212, 222, 134, 175, 206, 158, 177, 197, 102, 61, 154, 190 },
          { 36,  128, 18, 26,  128, 15, 29,  128, 4, 6,  30, 128,
            63,  113, 25, 44,  66,  22, 40,  67,  9, 14, 34, 55,
            90,  125, 26, 66,  82,  29, 73,  88,  1, 26, 34, 67,
            158, 179, 70, 121, 134, 69, 111, 129, 1, 85, 54, 105 },
          { 24, 128, 8,  31, 128, 15, 16, 128, 1,   1, 1,  128,
            32, 39,  16, 18, 43,  5,  17, 13,  1,   1, 22, 1,
            37, 65,  26, 20, 28,  16, 15, 24,  128, 1, 1,  1,
            83, 107, 57, 56, 74,  34, 29, 73,  128, 1, 37, 47 } } },
      { { { 72,  128, 45,  113, 128, 38,  100, 128, 26,  63,  112, 128,
            134, 177, 65,  121, 148, 57,  111, 143, 27,  68,  116, 152,
            181, 198, 98,  148, 173, 84,  136, 168, 53,  89,  134, 170,
            218, 230, 173, 194, 216, 160, 188, 213, 199, 177, 183, 204 },
          { 54,  128, 34,  55,  128, 32,  53,  128, 66,  45,  54,  128,
            81,  128, 33,  59,  102, 26,  55,  80,  7,   23,  49,  91,
            116, 145, 36,  79,  107, 35,  73,  102, 12,  28,  57,  95,
            170, 201, 102, 133, 173, 105, 127, 173, 166, 132, 114, 149 },
          { 40,  128, 25, 30, 128, 21, 31, 128, 24, 17, 24, 128,
            51,  67,  19, 28, 40,  17, 25, 42,  15, 13, 19, 19,
            61,  77,  19, 30, 48,  13, 33, 50,  11, 15, 21, 30,
            103, 147, 37, 69, 111, 37, 66, 105, 18, 18, 36, 76 } },
        { { 74,  128, 42,  99,  128, 32,  57,  128, 9,  28, 76,  128,
            115, 187, 70,  118, 120, 52,  109, 128, 19, 60, 93,  100,
            178, 197, 119, 147, 179, 92,  137, 178, 37, 87, 110, 158,
            216, 227, 169, 186, 201, 128, 178, 204, 1,  96, 155, 217 },
          { 59,  128, 26, 34,  128, 11, 20,  128, 7,   8, 24, 128,
            73,  125, 38, 74,  96,  23, 61,  79,  15,  9, 23, 110,
            96,  151, 49, 79,  164, 22, 70,  65,  1,   1, 9,  69,
            156, 196, 73, 105, 181, 17, 126, 155, 128, 1, 90, 111 },
          { 42, 128, 10, 11, 128, 13, 1,  128, 1,   1,   1, 128,
            55, 63,  13, 17, 85,  1,  16, 64,  1,   1,   1, 1,
            62, 58,  32, 21, 53,  1,  37, 91,  128, 128, 1, 1,
            81, 133, 51, 48, 79,  1,  25, 81,  128, 128, 1, 54 } } },
      { { { 103, 128, 52,  163, 128, 46,  155, 128, 12, 45,  97,  128,
            162, 196, 69,  140, 170, 60,  130, 158, 21, 58,  109, 150,
            205, 214, 93,  149, 178, 79,  143, 179, 38, 71,  120, 159,
            231, 240, 150, 192, 218, 140, 188, 220, 84, 112, 159, 196 },
          { 93,  128, 42, 143, 128, 41, 132, 128, 6,  15, 40, 128,
            113, 172, 39, 99,  113, 33, 91,  94,  5,  15, 42, 83,
            148, 172, 37, 91,  130, 28, 81,  121, 9,  20, 47, 87,
            201, 223, 75, 139, 183, 77, 132, 176, 23, 41, 82, 147 },
          { 92,  128, 45, 123, 128, 28, 88, 128, 1,  8,  20, 128,
            85,  94,  39, 95,  83,  33, 81, 61,  4,  5,  17, 25,
            84,  109, 17, 59,  76,  11, 46, 62,  1,  4,  13, 35,
            139, 184, 25, 86,  129, 25, 71, 123, 26, 13, 31, 84 } },
        { { 123, 128, 82,  169, 128, 62,  139, 128, 1,   28,  77,  128,
            139, 167, 92,  170, 146, 76,  149, 255, 19,  68,  160, 73,
            190, 209, 171, 165, 218, 57,  152, 209, 128, 61,  122, 164,
            237, 240, 146, 210, 227, 128, 224, 220, 128, 128, 196, 199 },
          { 130, 128, 52,  141, 128, 32,  101, 128, 128, 1,  85,  128,
            94,  155, 71,  121, 255, 30,  116, 85,  1,   8,  58,  255,
            105, 169, 110, 101, 132, 1,   77,  142, 128, 1,  54,  96,
            166, 214, 224, 154, 198, 255, 153, 230, 128, 85, 100, 146 },
          { 103, 128, 26, 83, 128, 20,  47,  128, 128, 128, 1,  128,
            91,  90,  19, 76, 128, 1,   42,  1,   128, 255, 64, 128,
            74,  77,  1,  72, 68,  128, 13,  77,  128, 128, 64, 1,
            71,  147, 37, 99, 171, 1,   104, 151, 128, 1,   1,  96 } } },
      { { { 113, 128, 79,  165, 128, 69,  149, 128, 14, 55,  116, 128,
            163, 202, 104, 169, 205, 82,  159, 180, 22, 64,  121, 165,
            207, 216, 113, 177, 215, 95,  166, 195, 35, 77,  132, 179,
            241, 244, 173, 207, 233, 128, 202, 227, 92, 121, 169, 209 },
          { 114, 128, 67, 136, 128, 54, 132, 128, 6,  26, 62,  128,
            85,  129, 85, 146, 173, 64, 129, 140, 7,  19, 65,  92,
            139, 169, 42, 147, 186, 40, 129, 170, 18, 18, 65,  117,
            213, 230, 74, 172, 213, 69, 165, 196, 1,  40, 103, 170 },
          { 101, 128, 61, 134, 128, 52, 97,  128, 1,   14, 26, 128,
            79,  72,  71, 135, 152, 56, 114, 117, 1,   10, 24, 58,
            64,  66,  60, 133, 148, 16, 126, 123, 1,   32, 26, 56,
            143, 197, 51, 141, 176, 59, 132, 162, 128, 17, 47, 106 } },
        { { 115, 128, 112, 135, 128, 89,  130, 128, 15,  49,  89,  128,
            143, 238, 154, 203, 255, 138, 172, 255, 1,   98,  196, 255,
            185, 203, 255, 211, 255, 192, 217, 235, 128, 128, 171, 255,
            233, 233, 255, 247, 255, 1,   239, 245, 1,   128, 255, 255 },
          { 75,  128, 76,  118, 128, 35,  74,  128, 1,   13,  23,  128,
            63,  138, 114, 164, 140, 91,  128, 128, 128, 1,   138, 64,
            96,  128, 255, 175, 236, 85,  166, 209, 128, 1,   128, 146,
            196, 217, 1,   204, 206, 128, 212, 221, 128, 128, 128, 219 },
          { 49,  128, 36,  62,  128, 37,  56, 128, 128, 1,   1,   128,
            45,  37,  68,  102, 128, 90,  56, 1,   128, 128, 37,  1,
            26,  27,  128, 126, 128, 255, 63, 142, 128, 128, 1,   1,
            125, 159, 128, 173, 212, 128, 85, 189, 128, 128, 255, 171 } } }
    };
#endif  // BR_NODE
555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640
#if CONFIG_CTX1D
static const aom_prob default_eob_mode[TX_SIZES][PLANE_TYPES][TX_CLASSES] = {
  { { 128, 176, 157 }, { 128, 222, 198 } },
  { { 128, 35, 56 }, { 128, 203, 225 } },
  { { 128, 55, 136 }, { 128, 230, 253 } },
  { { 128, 101, 188 }, { 128, 128, 128 } }
};
static const aom_prob default_empty_line[TX_SIZES][PLANE_TYPES][TX_CLASSES]
                                        [EMPTY_LINE_CONTEXTS] = {
                                          { { { 128, 128, 128, 128, 128 },
                                              { 142, 153, 211, 205, 128 },
                                              { 162, 142, 203, 197, 128 } },
                                            { { 128, 128, 128, 128, 128 },
                                              { 133, 116, 178, 123, 128 },
                                              { 139, 109, 159, 115, 128 } } },
                                          { { { 128, 128, 128, 128, 128 },
                                              { 185, 130, 183, 204, 227 },
                                              { 171, 81, 177, 200, 221 } },
                                            { { 128, 128, 128, 128, 128 },
                                              { 180, 127, 175, 189, 213 },
                                              { 120, 74, 129, 134, 156 } } },
                                          { { { 128, 128, 128, 128, 128 },
                                              { 202, 82, 183, 214, 248 },
                                              { 144, 41, 163, 185, 203 } },
                                            { { 128, 128, 128, 128, 128 },
                                              { 151, 93, 171, 224, 160 },
                                              { 128, 51, 171, 128, 1 } } },
                                          { { { 128, 128, 128, 128, 128 },
                                              { 154, 48, 174, 210, 233 },
                                              { 123, 16, 148, 189, 197 } },
                                            { { 128, 128, 128, 128, 128 },
                                              { 128, 128, 128, 128, 128 },
                                              { 128, 128, 128, 128, 128 } } }
                                        };
static const aom_prob
    default_hv_eob[TX_SIZES][PLANE_TYPES][TX_CLASSES][HV_EOB_CONTEXTS] = {
      { { { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
            128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 },
          { 151, 173, 114, 128, 128, 128, 128, 128, 128, 162, 198, 128,
            128, 128, 128, 128, 182, 198, 109, 128, 128, 128, 128, 128 },
          { 152, 173, 119, 128, 128, 128, 128, 128, 128, 164, 193, 128,
            128, 128, 128, 128, 198, 209, 121, 128, 128, 128, 128, 128 } },
        { { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
            128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 },
          { 123, 143, 70,  128, 128, 128, 128, 128, 128, 127, 154, 128,
            128, 128, 128, 128, 176, 148, 36,  128, 128, 128, 128, 128 },
          { 132, 152, 73,  128, 128, 128, 128, 128, 128, 127, 159, 128,
            128, 128, 128, 128, 186, 181, 48,  128, 128, 128, 128, 128 } } },
      { { { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
            128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 },
          { 109, 105, 78,  44,  128, 128, 128, 128, 128, 146, 185, 221,
            128, 128, 128, 128, 199, 188, 134, 69,  128, 128, 128, 128 },
          { 124, 127, 115, 82,  128, 128, 128, 128, 128, 162, 198, 224,
            128, 128, 128, 128, 206, 214, 177, 135, 128, 128, 128, 128 } },
        { { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
            128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 },
          { 95,  102, 65,  14,  128, 128, 128, 128, 128, 132, 164, 199,
            128, 128, 128, 128, 162, 163, 66,  27,  128, 128, 128, 128 },
          { 83,  141, 97,  38,  128, 128, 128, 128, 128, 154, 132, 184,
            128, 128, 128, 128, 194, 218, 112, 63,  128, 128, 128, 128 } } },
      { { { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
            128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 },
          { 117, 107, 86,  61,  51,  104, 128, 128, 128, 160, 198, 238,
            252, 251, 128, 128, 221, 223, 209, 186, 99,  81,  128, 128 },
          { 118, 122, 121, 100, 91,  97,  128, 128, 128, 168, 190, 214,
            233, 235, 128, 128, 197, 216, 177, 165, 147, 126, 128, 128 } },
        { { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
            128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 },
          { 109, 102, 63,  51,  255, 85,  128, 128, 128, 163, 131, 175,
            128, 128, 128, 128, 183, 102, 40,  1,   128, 128, 128, 128 },
          { 255, 255, 1,   1,   128, 1, 128, 128, 128, 1,   128, 128,
            128, 128, 128, 128, 255, 1, 128, 128, 128, 128, 128, 128 } } },
      { { { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
            128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 },
          { 114, 108, 83,  61,  53,  28,  77,  177, 128, 161, 187, 218,
            240, 237, 228, 234, 200, 207, 167, 136, 98,  78,  183, 128 },
          { 117, 138, 116, 77,  75,  85,  26,  1,   128, 197, 162, 200,
            184, 212, 225, 236, 189, 225, 168, 124, 144, 171, 128, 128 } },
        { { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
            128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 },
          { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
            128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 },
          { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
            128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 } } }
    };
#endif  // CONFIG_CTX1D
641 642
#endif  // CONFIG_LV_MAP

643
#if CONFIG_EXT_PARTITION_TYPES
Yaowu Xu's avatar
Yaowu Xu committed
644
static const aom_prob
clang-format's avatar
clang-format committed
645 646
    default_partition_probs[PARTITION_CONTEXTS][EXT_PARTITION_TYPES - 1] = {
      // 8x8 -> 4x4
647 648 649 650
      { 199, 122, 141, 128, 128, 128, 255, 128, 255 },  // a/l both not split
      { 147, 63, 159, 128, 128, 128, 255, 128, 255 },   // a split, l not split
      { 148, 133, 118, 128, 128, 128, 255, 128, 255 },  // l split, a not split
      { 121, 104, 114, 128, 128, 128, 255, 128, 255 },  // a/l both split
clang-format's avatar
clang-format committed
651
      // 16x16 -> 8x8
652 653 654 655
      { 174, 73, 87, 128, 128, 128, 255, 128, 255 },  // a/l both not split
      { 92, 41, 83, 128, 128, 128, 255, 128, 255 },   // a split, l not split
      { 82, 99, 50, 128, 128, 128, 255, 128, 255 },   // l split, a not split
      { 53, 39, 39, 128, 128, 128, 255, 128, 255 },   // a/l both split
clang-format's avatar
clang-format committed
656
      // 32x32 -> 16x16
657 658 659 660
      { 177, 58, 59, 128, 128, 85, 128, 85, 128 },  // a/l both not split
      { 68, 26, 63, 128, 128, 85, 128, 85, 128 },   // a split, l not split
      { 52, 79, 25, 128, 128, 85, 128, 85, 128 },   // l split, a not split
      { 17, 14, 12, 128, 128, 85, 128, 85, 128 },   // a/l both split
clang-format's avatar
clang-format committed
661
      // 64x64 -> 32x32
662 663 664 665
      { 222, 34, 30, 128, 128, 85, 128, 85, 128 },  // a/l both not split
      { 72, 16, 44, 128, 128, 85, 128, 85, 128 },   // a split, l not split
      { 58, 32, 12, 128, 128, 85, 128, 85, 128 },   // l split, a not split
      { 10, 7, 6, 128, 128, 85, 128, 85, 128 },     // a/l both split
666
#if CONFIG_EXT_PARTITION
clang-format's avatar
clang-format committed
667
      // 128x128 -> 64x64
668 669 670 671 672
      { 222, 34, 30, 128, 128, 128, 255, 128, 255 },  // a/l both not split
      { 72, 16, 44, 128, 128, 128, 255, 128, 255 },   // a split, l not split
      { 58, 32, 12, 128, 128, 128, 255, 128, 255 },   // l split, a not split
      { 10, 7, 6, 128, 128, 128, 255, 128, 255 },     // a/l both split
#endif                                                // CONFIG_EXT_PARTITION
673
#if CONFIG_UNPOISON_PARTITION_CTX
674 675 676 677
      { 0, 0, 141, 0, 0, 0, 0, 0, 0 },  // 8x8 -> 4x4
      { 0, 0, 87, 0, 0, 0, 0, 0, 0 },   // 16x16 -> 8x8
      { 0, 0, 59, 0, 0, 0, 0, 0, 0 },   // 32x32 -> 16x16
      { 0, 0, 30, 0, 0, 0, 0, 0, 0 },   // 64x64 -> 32x32
678
#if CONFIG_EXT_PARTITION
679 680 681 682 683 684
      { 0, 0, 30, 0, 0, 0, 0, 0, 0 },   // 128x128 -> 64x64
#endif                                  // CONFIG_EXT_PARTITION
      { 0, 122, 0, 0, 0, 0, 0, 0, 0 },  // 8x8 -> 4x4
      { 0, 73, 0, 0, 0, 0, 0, 0, 0 },   // 16x16 -> 8x8
      { 0, 58, 0, 0, 0, 0, 0, 0, 0 },   // 32x32 -> 16x16
      { 0, 34, 0, 0, 0, 0, 0, 0, 0 },   // 64x64 -> 32x32
685
#if CONFIG_EXT_PARTITION
686 687 688
      { 0, 34, 0, 0, 0, 0, 0, 0, 0 },  // 128x128 -> 64x64
#endif                                 // CONFIG_EXT_PARTITION
#endif                                 // CONFIG_UNPOISON_PARTITION_CTX
clang-format's avatar
clang-format committed
689
    };
690
#else
Yaowu Xu's avatar
Yaowu Xu committed
691
static const aom_prob
clang-format's avatar
clang-format committed
692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712
    default_partition_probs[PARTITION_CONTEXTS][PARTITION_TYPES - 1] = {
      // 8x8 -> 4x4
      { 199, 122, 141 },  // a/l both not split
      { 147, 63, 159 },   // a split, l not split
      { 148, 133, 118 },  // l split, a not split
      { 121, 104, 114 },  // a/l both split
      // 16x16 -> 8x8
      { 174, 73, 87 },  // a/l both not split
      { 92, 41, 83 },   // a split, l not split
      { 82, 99, 50 },   // l split, a not split
      { 53, 39, 39 },   // a/l both split
      // 32x32 -> 16x16
      { 177, 58, 59 },  // a/l both not split
      { 68, 26, 63 },   // a split, l not split
      { 52, 79, 25 },   // l split, a not split
      { 17, 14, 12 },   // a/l both split
      // 64x64 -> 32x32
      { 222, 34, 30 },  // a/l both not split
      { 72, 16, 44 },   // a split, l not split
      { 58, 32, 12 },   // l split, a not split
      { 10, 7, 6 },     // a/l both split
713
#if CONFIG_EXT_PARTITION
clang-format's avatar
clang-format committed
714 715 716 717 718
      // 128x128 -> 64x64
      { 222, 34, 30 },  // a/l both not split
      { 72, 16, 44 },   // a split, l not split
      { 58, 32, 12 },   // l split, a not split
      { 10, 7, 6 },     // a/l both split
719
#endif  // CONFIG_EXT_PARTITION
720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735
#if CONFIG_UNPOISON_PARTITION_CTX
      { 0, 0, 141 },    // 8x8 -> 4x4
      { 0, 0, 87 },     // 16x16 -> 8x8
      { 0, 0, 59 },     // 32x32 -> 16x16
      { 0, 0, 30 },     // 64x64 -> 32x32
#if CONFIG_EXT_PARTITION
      { 0, 0, 30 },     // 128x128 -> 64x64
#endif  // CONFIG_EXT_PARTITION
      { 0, 122, 0 },    // 8x8 -> 4x4
      { 0, 73, 0 },     // 16x16 -> 8x8
      { 0, 58, 0 },     // 32x32 -> 16x16
      { 0, 34, 0 },     // 64x64 -> 32x32
#if CONFIG_EXT_PARTITION
      { 0, 34, 0 },     // 128x128 -> 64x64
#endif  // CONFIG_EXT_PARTITION
#endif  // CONFIG_UNPOISON_PARTITION_CTX
clang-format's avatar
clang-format committed
736
    };
737
#endif  // CONFIG_EXT_PARTITION_TYPES
Jingning Han's avatar
Jingning Han committed
738

Yaowu Xu's avatar
Yaowu Xu committed
739
static const aom_prob default_newmv_prob[NEWMV_MODE_CONTEXTS] = {
740
  155, 116, 94, 32, 96, 56, 30,
741 742
};

Yaowu Xu's avatar
Yaowu Xu committed
743
static const aom_prob default_zeromv_prob[ZEROMV_MODE_CONTEXTS] = {
744
  45, 13,
745 746
};

Yaowu Xu's avatar
Yaowu Xu committed
747
static const aom_prob default_refmv_prob[REFMV_MODE_CONTEXTS] = {
748
  178, 212, 135, 244, 203, 122, 128, 128, 128,
749
};
Yue Chen's avatar
Yue Chen committed
750

751 752 753
static const aom_prob default_drl_prob[DRL_MODE_CONTEXTS] = {
  119, 128, 189, 134, 128,
};
754 755
#if CONFIG_NEW_MULTISYMBOL
static const aom_cdf_prob default_newmv_cdf[NEWMV_MODE_CONTEXTS][CDF_SIZE(2)] =
756 757 758 759 760 761 762
    { { AOM_ICDF(128 * 155), AOM_ICDF(32768), 0 },
      { AOM_ICDF(128 * 116), AOM_ICDF(32768), 0 },
      { AOM_ICDF(128 * 94), AOM_ICDF(32768), 0 },
      { AOM_ICDF(128 * 32), AOM_ICDF(32768), 0 },
      { AOM_ICDF(128 * 96), AOM_ICDF(32768), 0 },
      { AOM_ICDF(128 * 56), AOM_ICDF(32768), 0 },
      { AOM_ICDF(128 * 30), AOM_ICDF(32768), 0 } };
763
static const aom_cdf_prob default_zeromv_cdf[ZEROMV_MODE_CONTEXTS][CDF_SIZE(
764 765
    2)] = { { AOM_ICDF(128 * 45), AOM_ICDF(32768), 0 },
            { AOM_ICDF(128 * 13), AOM_ICDF(32768), 0 } };
766
static const aom_cdf_prob default_refmv_cdf[REFMV_MODE_CONTEXTS][CDF_SIZE(2)] =
767 768 769 770 771 772
    { { AOM_ICDF(128 * 178), AOM_ICDF(32768), 0 },
      { AOM_ICDF(128 * 212), AOM_ICDF(32768), 0 },
      { AOM_ICDF(128 * 135), AOM_ICDF(32768), 0 },
      { AOM_ICDF(128 * 244), AOM_ICDF(32768), 0 },
      { AOM_ICDF(128 * 203), AOM_ICDF(32768), 0 },
      { AOM_ICDF(128 * 122), AOM_ICDF(32768), 0 },
773
      { AOM_ICDF(128 * 128), AOM_ICDF(32768), 0 },
774 775
      { AOM_ICDF(128 * 128), AOM_ICDF(32768), 0 },
      { AOM_ICDF(128 * 128), AOM_ICDF(32768), 0 } };
776
static const aom_cdf_prob default_drl_cdf[DRL_MODE_CONTEXTS][CDF_SIZE(2)] = {
777
  { AOM_ICDF(128 * 119), AOM_ICDF(32768), 0 },
778
  { AOM_ICDF(128 * 128), AOM_ICDF(32768), 0 },
779 780 781
  { AOM_ICDF(128 * 189), AOM_ICDF(32768), 0 },
  { AOM_ICDF(128 * 134), AOM_ICDF(32768), 0 },
  { AOM_ICDF(128 * 128), AOM_ICDF(32768), 0 }
782 783
};
#endif
784

Yaowu Xu's avatar
Yaowu Xu committed
785
static const aom_prob default_inter_compound_mode_probs
clang-format's avatar
clang-format committed
786
    [INTER_MODE_CONTEXTS][INTER_COMPOUND_MODES - 1] = {
787 788 789 790 791 792 793
      { 154, 167, 233, 165, 143, 170, 167 },  // 0 = both zero mv
      { 75, 168, 237, 155, 135, 176, 172 },   // 1 = 1 zero + 1 predicted
      { 7, 173, 227, 128, 153, 188, 189 },    // 2 = two predicted mvs
      { 8, 120, 214, 113, 154, 178, 174 },    // 3 = 1 pred/zero, 1 new
      { 4, 85, 194, 94, 155, 173, 167 },      // 4 = two new mvs
      { 23, 89, 180, 73, 157, 151, 155 },     // 5 = one intra neighbour
      { 27, 49, 152, 91, 134, 153, 142 },     // 6 = two intra neighbours
clang-format's avatar
clang-format committed
794
    };
795

796 797 798
static const aom_cdf_prob
    default_inter_compound_mode_cdf[INTER_MODE_CONTEXTS][CDF_SIZE(
        INTER_COMPOUND_MODES)] = {
799 800 801 802 803 804 805 806 807 808 809 810 811 812
      { AOM_ICDF(19712), AOM_ICDF(28229), AOM_ICDF(30892), AOM_ICDF(31437),
        AOM_ICDF(31712), AOM_ICDF(32135), AOM_ICDF(32360), AOM_ICDF(32768), 0 },
      { AOM_ICDF(9600), AOM_ICDF(24804), AOM_ICDF(29268), AOM_ICDF(30323),
        AOM_ICDF(30802), AOM_ICDF(31726), AOM_ICDF(32177), AOM_ICDF(32768), 0 },
      { AOM_ICDF(896), AOM_ICDF(22434), AOM_ICDF(27015), AOM_ICDF(29026),
        AOM_ICDF(29753), AOM_ICDF(31114), AOM_ICDF(31597), AOM_ICDF(32768), 0 },
      { AOM_ICDF(1024), AOM_ICDF(15904), AOM_ICDF(22127), AOM_ICDF(25421),
        AOM_ICDF(26864), AOM_ICDF(28996), AOM_ICDF(30001), AOM_ICDF(32768), 0 },
      { AOM_ICDF(512), AOM_ICDF(11222), AOM_ICDF(17217), AOM_ICDF(21445),
        AOM_ICDF(23473), AOM_ICDF(26133), AOM_ICDF(27550), AOM_ICDF(32768), 0 },
      { AOM_ICDF(2944), AOM_ICDF(13313), AOM_ICDF(17214), AOM_ICDF(20751),
        AOM_ICDF(23211), AOM_ICDF(25500), AOM_ICDF(26992), AOM_ICDF(32768), 0 },
      { AOM_ICDF(3456), AOM_ICDF(9067), AOM_ICDF(14069), AOM_ICDF(16907),
        AOM_ICDF(18817), AOM_ICDF(21214), AOM_ICDF(23139), AOM_ICDF(32768), 0 }
813 814
    };

815 816 817
#if CONFIG_COMPOUND_SINGLEREF
// TODO(zoeliu): Default values to be further adjusted based on the collected
//               stats.
818
/*
819 820 821 822 823 824 825 826 827
static const aom_prob default_inter_singleref_comp_mode_probs
    [INTER_MODE_CONTEXTS][INTER_SINGLEREF_COMP_MODES - 1] = {
      { 2, 173, 68, 180 },   // 0 = both zero mv
      { 7, 145, 160, 180 },  // 1 = 1 zero + 1 predicted
      { 7, 166, 126, 180 },  // 2 = two predicted mvs
      { 7, 94, 132, 180 },   // 3 = 1 pred/zero, 1 new
      { 8, 64, 64, 180 },    // 4 = two new mvs
      { 17, 81, 52, 180 },   // 5 = one intra neighbour
      { 25, 29, 50, 180 },   // 6 = two intra neighbours
828 829 830 831 832 833 834 835 836 837
    };*/
static const aom_prob default_inter_singleref_comp_mode_probs
    [INTER_MODE_CONTEXTS][INTER_SINGLEREF_COMP_MODES - 1] = {
      { 2, 173, 68 },   // 0 = both zero mv
      { 7, 145, 160 },  // 1 = 1 zero + 1 predicted
      { 7, 166, 126 },  // 2 = two predicted mvs
      { 7, 94, 132 },   // 3 = 1 pred/zero, 1 new
      { 8, 64, 64 },    // 4 = two new mvs
      { 17, 81, 52 },   // 5 = one intra neighbour
      { 25, 29, 50 },   // 6 = two intra neighbours
838
    };
839 840 841 842 843 844 845 846 847 848 849 850

static const aom_cdf_prob
    default_inter_singleref_comp_mode_cdf[INTER_MODE_CONTEXTS][CDF_SIZE(
        INTER_SINGLEREF_COMP_MODES)] = {
      { AOM_ICDF(21971), AOM_ICDF(24771), AOM_ICDF(25027), AOM_ICDF(32768), 0 },
      { AOM_ICDF(18053), AOM_ICDF(26690), AOM_ICDF(27586), AOM_ICDF(32768), 0 },
      { AOM_ICDF(20667), AOM_ICDF(26182), AOM_ICDF(27078), AOM_ICDF(32768), 0 },
      { AOM_ICDF(11703), AOM_ICDF(22103), AOM_ICDF(22999), AOM_ICDF(32768), 0 },
      { AOM_ICDF(7936), AOM_ICDF(13888), AOM_ICDF(14912), AOM_ICDF(32768), 0 },
      { AOM_ICDF(9679), AOM_ICDF(13927), AOM_ICDF(16103), AOM_ICDF(32768), 0 },
      { AOM_ICDF(3349), AOM_ICDF(8470), AOM_ICDF(11670), AOM_ICDF(32768), 0 }
    };
851 852
#endif  // CONFIG_COMPOUND_SINGLEREF

853
#if CONFIG_COMPOUND_SEGMENT && CONFIG_WEDGE
854
static const aom_prob
855
    default_compound_type_probs[BLOCK_SIZES_ALL][COMPOUND_TYPES - 1] = {
856
#if CONFIG_CHROMA_SUB8X8
857
      { 128, 128 }, { 128, 128 }, { 128, 128 },
858
#endif
859 860
      { 128, 128 }, { 255, 128 }, { 255, 128 }, { 66, 51 },   { 72, 35 },
      { 79, 29 },   { 71, 18 },   { 81, 29 },   { 81, 26 },   { 69, 19 },
861
      { 104, 1 },   { 99, 1 },    { 75, 1 },
862
#if CONFIG_EXT_PARTITION
863
      { 255, 1 },   { 255, 1 },   { 255, 1 },
864
#endif  // CONFIG_EXT_PARTITION
865 866 867 868 869
      { 208, 128 }, { 208, 128 }, { 208, 128 }, { 208, 128 }, { 208, 1 },
      { 208, 1 },
#if CONFIG_EXT_PARTITION
      { 208, 1 },   { 208, 1 }
#endif  // CONFIG_EXT_PARTITION
870
    };
871
#elif !CONFIG_COMPOUND_SEGMENT && CONFIG_WEDGE
clang-format's avatar
clang-format committed
872
static const aom_prob
873
    default_compound_type_probs[BLOCK_SIZES_ALL][COMPOUND_TYPES - 1] = {
874
#if CONFIG_CHROMA_SUB8X8
875
      { 255 }, { 255 }, { 255 },
876
#endif
clang-format's avatar
clang-format committed
877 878
      { 208 }, { 208 }, { 208 }, { 208 }, { 208 }, { 208 }, { 216 },
      { 216 }, { 216 }, { 224 }, { 224 }, { 240 }, { 240 },
879
#if CONFIG_EXT_PARTITION
clang-format's avatar
clang-format committed
880
      { 255 }, { 255 }, { 255 },
881
#endif  // CONFIG_EXT_PARTITION
882 883 884 885
      { 208 }, { 208 }, { 208 }, { 208 }, { 255 }, { 255 },
#if CONFIG_EXT_PARTITION
      { 255 }, { 255 }
#endif  // CONFIG_EXT_PARTITION
clang-format's avatar
clang-format committed
886
    };
887 888
#elif CONFIG_COMPOUND_SEGMENT && !CONFIG_WEDGE
static const aom_prob
889
    default_compound_type_probs[BLOCK_SIZES_ALL][COMPOUND_TYPES - 1] = {
890
#if CONFIG_CHROMA_SUB8X8
891
      { 255 }, { 255 }, { 255 },
892 893 894 895 896 897
#endif
      { 208 }, { 208 }, { 208 }, { 208 }, { 208 }, { 208 }, { 216 },
      { 216 }, { 216 }, { 224 }, { 224 }, { 240 }, { 240 },
#if CONFIG_EXT_PARTITION
      { 255 }, { 255 }, { 255 },
#endif  // CONFIG_EXT_PARTITION
898
      { 208 }, { 208 }, { 208 }, { 208 }, { 208 }, { 208 },
899 900 901
#if CONFIG_EXT_PARTITION
      { 208 }, { 208 }
#endif  // CONFIG_EXT_PARTITION
902 903
    };
#else
904
static const aom_prob default_compound_type_probs[BLOCK_SIZES_ALL]
905 906
                                                 [COMPOUND_TYPES - 1];
#endif  // CONFIG_COMPOUND_SEGMENT && CONFIG_WEDGE
907

908 909
#if CONFIG_COMPOUND_SEGMENT && CONFIG_WEDGE
static const aom_cdf_prob
910
    default_compound_type_cdf[BLOCK_SIZES_ALL][CDF_SIZE(COMPOUND_TYPES)] = {
911
#if CONFIG_CHROMA_SUB8X8
912 913 914
      { AOM_ICDF(16384), AOM_ICDF(24576), AOM_ICDF(32768), 0 },
      { AOM_ICDF(16384), AOM_ICDF(24576), AOM_ICDF(32768), 0 },
      { AOM_ICDF(16384), AOM_ICDF(24576), AOM_ICDF(32768), 0 },
915
#endif
916 917 918 919 920 921 922 923 924 925 926 927 928
      { AOM_ICDF(16384), AOM_ICDF(24576), AOM_ICDF(32768), 0 },
      { AOM_ICDF(32640), AOM_ICDF(32704), AOM_ICDF(32768), 0 },
      { AOM_ICDF(32640), AOM_ICDF(32704), AOM_ICDF(32768), 0 },
      { AOM_ICDF(8448), AOM_ICDF(13293), AOM_ICDF(32768), 0 },
      { AOM_ICDF(9216), AOM_ICDF(12436), AOM_ICDF(32768), 0 },
      { AOM_ICDF(10112), AOM_ICDF(12679), AOM_ICDF(32768), 0 },
      { AOM_ICDF(9088), AOM_ICDF(10753), AOM_ICDF(32768), 0 },
      { AOM_ICDF(10368), AOM_ICDF(12906), AOM_ICDF(32768), 0 },
      { AOM_ICDF(10368), AOM_ICDF(12643), AOM_ICDF(32768), 0 },
      { AOM_ICDF(8832), AOM_ICDF(10609), AOM_ICDF(32768), 0 },
      { AOM_ICDF(13312), AOM_ICDF(13388), AOM_ICDF(32768), 0 },
      { AOM_ICDF(12672), AOM_ICDF(12751), AOM_ICDF(32768), 0 },
      { AOM_ICDF(9600), AOM_ICDF(9691), AOM_ICDF(32768), 0 },
929 930 931 932 933
#if CONFIG_EXT_PARTITION
      { AOM_ICDF(32640), AOM_ICDF(32641), AOM_ICDF(32768), 0 },  // 255, 1
      { AOM_ICDF(32640), AOM_ICDF(32641), AOM_ICDF(32768), 0 },
      { AOM_ICDF(32640), AOM_ICDF(32641), AOM_ICDF(32768), 0 },
#endif  // CONFIG_EXT_PARTITION
934 935 936 937
      { AOM_ICDF(16384), AOM_ICDF(24576), AOM_ICDF(32768), 0 },
      { AOM_ICDF(16384), AOM_ICDF(24576), AOM_ICDF(32768), 0 },
      { AOM_ICDF(16384), AOM_ICDF(24576), AOM_ICDF(32768), 0 },
      { AOM_ICDF(16384), AOM_ICDF(24576), AOM_ICDF(32768), 0 },
938 939 940 941 942 943
      { AOM_ICDF(26624), AOM_ICDF(26648), AOM_ICDF(32768), 0 },  // 208, 1
      { AOM_ICDF(26624), AOM_ICDF(26648), AOM_ICDF(32768), 0 },
#if CONFIG_EXT_PARTITION
      { AOM_ICDF(26624), AOM_ICDF(26648), AOM_ICDF(32768), 0 },
      { AOM_ICDF(26624), AOM_ICDF(26648), AOM_ICDF(32768), 0 },
#endif
944 945 946
    };
#elif !CONFIG_COMPOUND_SEGMENT && CONFIG_WEDGE
static const aom_cdf_prob
947
    default_compound_type_cdf[BLOCK_SIZES_ALL][CDF_SIZE(COMPOUND_TYPES)] = {
948
#if CONFIG_CHROMA_SUB8X8
949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970
      { AOM_ICDF(32640), AOM_ICDF(32768), 0 },  // 255
      { AOM_ICDF(32640), AOM_ICDF(32768), 0 },
      { AOM_ICDF(32640), AOM_ICDF(32768), 0 },
#endif
      { AOM_ICDF(26624), AOM_ICDF(32768), 0 },  // 208
      { AOM_ICDF(26624), AOM_ICDF(32768), 0 },
      { AOM_ICDF(26624), AOM_ICDF(32768), 0 },
      { AOM_ICDF(26624), AOM_ICDF(32768), 0 },
      { AOM_ICDF(26624), AOM_ICDF(32768), 0 },
      { AOM_ICDF(26624), AOM_ICDF(32768), 0 },
      { AOM_ICDF(27648), AOM_ICDF(32768), 0 },  // 216
      { AOM_ICDF(27648), AOM_ICDF(32768), 0 },
      { AOM_ICDF(27648), AOM_ICDF(32768), 0 },
      { AOM_ICDF(28672), AOM_ICDF(32768), 0 },  // 224
      { AOM_ICDF(28672), AOM_ICDF(32768), 0 },
      { AOM_ICDF(30720), AOM_ICDF(32768), 0 },  // 240
      { AOM_ICDF(30720), AOM_ICDF(32768), 0 },
#if CONFIG_EXT_PARTITION
      { AOM_ICDF(32640), AOM_ICDF(32768), 0 },  // 255
      { AOM_ICDF(32640), AOM_ICDF(32768), 0 },
      { AOM_ICDF(32640), AOM_ICDF(32768), 0 },
#endif  // CONFIG_EXT_PARTITION
971 972 973 974
      { AOM_ICDF(32640), AOM_ICDF(32768), 0 },
      { AOM_ICDF(32640), AOM_ICDF(32768), 0 },
      { AOM_ICDF(32640), AOM_ICDF(32768), 0 },
      { AOM_ICDF(32640), AOM_ICDF(32768), 0 },
975 976
      { AOM_ICDF(32640), AOM_ICDF(32768), 0 },
      { AOM_ICDF(32640), AOM_ICDF(32768), 0 },
977 978 979 980
#if CONFIG_EXT_PARTITION
      { AOM_ICDF(32640), AOM_ICDF(32768), 0 },
      { AOM_ICDF(32640), AOM_ICDF(32768), 0 },
#endif  // CONFIG_EXT_PARTITION
981 982 983
    };
#elif CONFIG_COMPOUND_SEGMENT && !CONFIG_WEDGE
static const aom_cdf_prob
984
    default_compound_type_cdf[BLOCK_SIZES_ALL][CDF_SIZE(COMPOUND_TYPES)] = {
985
#if CONFIG_CHROMA_SUB8X8
986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007
      { AOM_ICDF(32640), AOM_ICDF(32768), 0 },  // 255
      { AOM_ICDF(32640), AOM_ICDF(32768), 0 },
      { AOM_ICDF(32640), AOM_ICDF(32768), 0 },
#endif
      { AOM_ICDF(26624), AOM_ICDF(32768), 0 },  // 208
      { AOM_ICDF(26624), AOM_ICDF(32768), 0 },
      { AOM_ICDF(26624), AOM_ICDF(32768), 0 },
      { AOM_ICDF(26624), AOM_ICDF(32768), 0 },
      { AOM_ICDF(26624), AOM_ICDF(32768), 0 },
      { AOM_ICDF(26624), AOM_ICDF(32768), 0 },
      { AOM_ICDF(27648), AOM_ICDF(32768), 0 },  // 216
      { AOM_ICDF(27648), AOM_ICDF(32768), 0 },
      { AOM_ICDF(27648), AOM_ICDF(32768), 0 },
      { AOM_ICDF(28672), AOM_ICDF(32768), 0 },  // 224
      { AOM_ICDF(28672), AOM_ICDF(32768), 0 },
      { AOM_ICDF(30720), AOM_ICDF(32768), 0 },  // 240
      { AOM_ICDF(30720), AOM_ICDF(32768), 0 },
#if CONFIG_EXT_PARTITION
      { AOM_ICDF(32640), AOM_ICDF(32768), 0 },  // 255
      { AOM_ICDF(32640), AOM_ICDF(32768), 0 },
      { AOM_ICDF(32640), AOM_ICDF(32768), 0 },
#endif  // CONFIG_EXT_PARTITION
1008 1009 1010 1011 1012 1013 1014 1015 1016 1017
      { AOM_ICDF(26624), AOM_ICDF(32768), 0 },  // 208
      { AOM_ICDF(26624), AOM_ICDF(32768), 0 },
      { AOM_ICDF(26624), AOM_ICDF(32768), 0 },
      { AOM_ICDF(26624), AOM_ICDF(32768), 0 },
      { AOM_ICDF(26624), AOM_ICDF(32768), 0 },
      { AOM_ICDF(26624), AOM_ICDF(32768), 0 },
#if CONFIG_EXT_PARTITION
      { AOM_ICDF(26624), AOM_ICDF(32768), 0 },
      { AOM_ICDF(26624), AOM_ICDF(32768), 0 },
#endif  // CONFIG_EXT_PARTITION
1018 1019 1020
    };
#endif  // CONFIG_COMPOUND_SEGMENT && CONFIG_WEDGE

1021
#if CONFIG_INTERINTRA
Yaowu Xu's avatar
Yaowu Xu committed
1022
static const aom_prob default_interintra_prob[BLOCK_SIZE_GROUPS] = {
1023
  128, 226, 244, 254,
1024
};
1025 1026
#if CONFIG_NEW_MULTISYMBOL
static const aom_cdf_prob default_interintra_cdf[BLOCK_SIZE_GROUPS][CDF_SIZE(
1027 1028 1029 1030
    2)] = { { AOM_ICDF(128 * 128), AOM_ICDF(32768), 0 },
            { AOM_ICDF(226 * 128), AOM_ICDF(32768), 0 },
            { AOM_ICDF(244 * 128), AOM_ICDF(32768), 0 },
            { AOM_ICDF(254 * 128), AOM_ICDF(32768), 0 } };
1031 1032
#endif

1033 1034
static const aom_prob
    default_interintra_mode_prob[BLOCK_SIZE_GROUPS][INTERINTRA_MODES - 1] = {
1035 1036 1037 1038
      { 128, 128, 128 },  // block_size < 8x8
      { 24, 34, 119 },    // block_size < 16x16
      { 38, 33, 95 },     // block_size < 32x32
      { 51, 21, 110 },    // block_size >= 32x32
1039
    };
1040
static const aom_cdf_prob
1041 1042 1043 1044 1045 1046 1047
    default_interintra_mode_cdf[BLOCK_SIZE_GROUPS][CDF_SIZE(
        INTERINTRA_MODES)] = {
      { AOM_ICDF(16384), AOM_ICDF(24576), AOM_ICDF(28672), AOM_ICDF(32768), 0 },
      { AOM_ICDF(3072), AOM_ICDF(7016), AOM_ICDF(18987), AOM_ICDF(32768), 0 },
      { AOM_ICDF(4864), AOM_ICDF(8461), AOM_ICDF(17481), AOM_ICDF(32768), 0 },
      { AOM_ICDF(6528), AOM_ICDF(8681), AOM_ICDF(19031), AOM_ICDF(32768), 0 }
    };
1048

1049
static const aom_prob default_wedge_interintra_prob[BLOCK_SIZES_ALL] = {
1050
#if CONFIG_CHROMA_SUB8X8
1051
  128, 128, 128,
1052
#endif
1053
  128, 128, 128, 194, 213, 217, 222, 224, 226, 220, 128, 128, 128,
1054
#if CONFIG_EXT_PARTITION
1055 1056 1057 1058 1059
  255, 255, 255,
#endif  // CONFIG_EXT_PARTITION
  208, 208, 208, 208, 255, 255,
#if CONFIG_EXT_PARTITION
  255, 255
1060
#endif  // CONFIG_EXT_PARTITION
1061
};
1062

1063 1064
#if CONFIG_NEW_MULTISYMBOL
static const aom_cdf_prob
1065
    default_wedge_interintra_cdf[BLOCK_SIZES_ALL][CDF_SIZE(2)] = {
1066
#if CONFIG_CHROMA_SUB8X8
1067 1068 1069
      { AOM_ICDF(128 * 128), AOM_ICDF(32768), 0 },
      { AOM_ICDF(128 * 128), AOM_ICDF(32768), 0 },
      { AOM_ICDF(128 * 128), AOM_ICDF(32768), 0 },
1070
#endif
1071 1072 1073 1074 1075 1076 1077
      { AOM_ICDF(128 * 128), AOM_ICDF(32768), 0 },
      { AOM_ICDF(128 * 128), AOM_ICDF(32768), 0 },
      { AOM_ICDF(128 * 128), AOM_ICDF(32768), 0 },
      { AOM_ICDF(194 * 128), AOM_ICDF(32768), 0 },
      { AOM_ICDF(213 * 128), AOM_ICDF(32768), 0 },
      { AOM_ICDF(217 * 128), AOM_ICDF(32768), 0 },
      { AOM_ICDF(222 * 128), AOM_ICDF(32768), 0 },
1078
      { AOM_ICDF(224 * 128), AOM_ICDF(32768), 0 },
1079 1080 1081 1082 1083
      { AOM_ICDF(226 * 128), AOM_ICDF(32768), 0 },
      { AOM_ICDF(220 * 128), AOM_ICDF(32768), 0 },
      { AOM_ICDF(128 * 128), AOM_ICDF(32768), 0 },
      { AOM_ICDF(128 * 128), AOM_ICDF(32768), 0 },
      { AOM_ICDF(128 * 128), AOM_ICDF(32768), 0 },
1084
#if CONFIG_EXT_PARTITION
1085 1086 1087
      { AOM_ICDF(255 * 128), AOM_ICDF(32768), 0 },
      { AOM_ICDF(255 * 128), AOM_ICDF(32768), 0 },
      { AOM_ICDF(255 * 128), AOM_ICDF(32768), 0 },
1088
#endif  // CONFIG_EXT_PARTITION
1089 1090 1091 1092
      { AOM_ICDF(208 * 128), AOM_ICDF(32768), 0 },
      { AOM_ICDF(208 * 128), AOM_ICDF(32768), 0 },
      { AOM_ICDF(208 * 128), AOM_ICDF(32768), 0 },
      { AOM_ICDF(208 * 128), AOM_ICDF(32768), 0 },
1093 1094 1095 1096 1097 1098
      { AOM_ICDF(255 * 128), AOM_ICDF(32768), 0 },
      { AOM_ICDF(255 * 128), AOM_ICDF(32768), 0 },
#if CONFIG_EXT_PARTITION
      { AOM_ICDF(255 * 128), AOM_ICDF(32768), 0 },
      { AOM_ICDF(255 * 128), AOM_ICDF(32768), 0 },
#endif  // CONFIG_EXT_PARTITION
1099 1100 1101
    };
#endif  // CONFIG_NEW_MULTISYMBOL

1102
#endif  // CONFIG_INTERINTRA
1103

1104
#if CONFIG_NCOBMC_ADAPT_WEIGHT
1105
#ifdef TWO_MODE
1106
const aom_tree_index av1_ncobmc_mode_tree[TREE_SIZE(MAX_NCOBMC_MODES)] = {
1107
  -NCOBMC_MODE_0, -NCOBMC_MODE_1
1108
};
1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119
#else
const aom_tree_index av1_ncobmc_mode_tree[TREE_SIZE(MAX_NCOBMC_MODES)] = {
  -NCOBMC_MODE_0, 2,
  -NCOBMC_MODE_1, 4,
  -NCOBMC_MODE_2, 6,
  -NCOBMC_MODE_3, 8,
  -NCOBMC_MODE_4, 10,
  -NCOBMC_MODE_5, 12,
  -NCOBMC_MODE_6, -NCOBMC_MODE_7
};
#endif  // TWO_MODE
1120 1121

// TODO(weitinglin): find default prob
1122 1123
//                   right now setting the first mode with probability 1/255,
//                   the last eight modes with equal probabilities
1124 1125
static const aom_prob
    default_ncobmc_mode_prob[ADAPT_OVERLAP_BLOCKS][MAX_NCOBMC_MODES - 1] = {
1126 1127 1128 1129 1130 1131 1132 1133
#ifdef TWO_MODE
      { 127 }, { 127 }, { 127 }, { 127 }
#else
      { 32, 36, 43, 51, 64, 85, 128 },  // 8x8
      { 32, 36, 43, 51, 64, 85, 128 },  // 16X16
      { 32, 36, 43, 51, 64, 85, 128 },  // 32X32
      { 32, 36, 43, 51, 64, 85, 128 }   // 64X64
#endif  // TWO_MODE
1134
    };
1135 1136
static const aom_cdf_prob
    default_ncobmc_mode_cdf[ADAPT_OVERLAP_BLOCKS][CDF_SIZE(MAX_NCOBMC_MODES)] =
1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155
#ifdef TWO_MODE
        { { AOM_ICDF(16256), AOM_ICDF(32768), 0 },
          { AOM_ICDF(16256), AOM_ICDF(32768), 0 },
          { AOM_ICDF(16256), AOM_ICDF(32768), 0 },
          { AOM_ICDF(16256), AOM_ICDF(32768), 0 } };
#else
        { { AOM_ICDF(4096), AOM_ICDF(8192), AOM_ICDF(12288), AOM_ICDF(16384),
            AOM_ICDF(20480), AOM_ICDF(24576), AOM_ICDF(28672), AOM_ICDF(32768),
            0 },
          { AOM_ICDF(4096), AOM_ICDF(8192), AOM_ICDF(12288), AOM_ICDF(16384),
            AOM_ICDF(20480), AOM_ICDF(24576), AOM_ICDF(28672), AOM_ICDF(32768),
            0 },
          { AOM_ICDF(4096), AOM_ICDF(8192), AOM_ICDF(12288), AOM_ICDF(16384),
            AOM_ICDF(20480), AOM_ICDF(24576), AOM_ICDF(28672), AOM_ICDF(32768),
            0 },
          { AOM_ICDF(4096), AOM_ICDF(8192), AOM_ICDF(12288), AOM_ICDF(16384),
            AOM_ICDF(20480), AOM_ICDF(24576), AOM_ICDF(28672), AOM_ICDF(32768),
            0 } };
#endif  // TWO_MODEE
1156
#endif  // CONFIG_NCOBMC_ADAPT_WEIGHT
1157
// Change this section appropriately once warped motion is supported
Yue Chen's avatar
Yue Chen committed
1158
#if CONFIG_MOTION_VAR && !CONFIG_WARPED_MOTION
1159 1160 1161 1162 1163 1164
#if CONFIG_NCOBMC_ADAPT_WEIGHT
const aom_tree_index av1_motion_mode_tree[TREE_SIZE(MOTION_MODES)] = {
  -SIMPLE_TRANSLATION, 2, -OBMC_CAUSAL, -NCOBMC_ADAPT_WEIGHT,
};
static const aom_prob
    default_motion_mode_prob[BLOCK_SIZES_ALL][MOTION_MODES - 1] = {
1165
#if CONFIG_CHROMA_SUB8X8
1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193
      { 255, 255 },
      { 255, 255 },
      { 255, 255 },
#endif
      { 255, 255 },
      { 255, 255 },
      { 255, 255 },
      /** Only these nine block sizes allow ncobmc_adapt_weight **/
      { 45, 207 },
      { 42, 211 },
      { 34, 207 },
      { 181, 123 },
      { 129, 141 },
      { 15, 209 },
      { 231, 122 },
      { 195, 190 },
      { 168, 190 },
      /** ----------------------------------------------------- **/
      { 244, 255 },
#if CONFIG_EXT_PARTITION
      { 252, 255 },
      { 252, 255 },
      { 252, 255 },
#endif  // CONFIG_EXT_PARTITION
      { 255, 200 },
      { 255, 200 },
      { 255, 200 },
      { 255, 200 },
1194 1195 1196 1197 1198
#if CONFIG_EXT_PARTITION
      { 252, 255 },
      { 252, 200 },
      { 252, 200 },
#endif  // CONFIG_EXT_PARTITION
1199 1200 1201
    };
static const aom_cdf_prob
    default_motion_mode_cdf[BLOCK_SIZES_ALL][CDF_SIZE(MOTION_MODES)] = {
1202
#if CONFIG_CHROMA_SUB8X8
1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232
      { AOM_ICDF(255 * 128), AOM_ICDF(32768), 0, 0 },
      { AOM_ICDF(255 * 128), AOM_ICDF(32768), 0, 0 },
      { AOM_ICDF(255 * 128), AOM_ICDF(32768), 0, 0 },
#endif
      { AOM_ICDF(255 * 128), AOM_ICDF(32768), 0, 0 },
      { AOM_ICDF(255 * 128), AOM_ICDF(32768), 0, 0 },
      { AOM_ICDF(255 * 128), AOM_ICDF(32768), 0, 0 },
      /** Only these seven block sizes allow ncobmc_adapt_weight **/
      { AOM_ICDF(5702), AOM_ICDF(27555), AOM_ICDF(32768), 0 },
      { AOM_ICDF(5408), AOM_ICDF(27964), AOM_ICDF(32768), 0 },
      { AOM_ICDF(4330), AOM_ICDF(27298), AOM_ICDF(32768), 0 },
      { AOM_ICDF(23107), AOM_ICDF(27760), AOM_ICDF(32768), 0 },
      { AOM_ICDF(16490), AOM_ICDF(25461), AOM_ICDF(32768), 0 },
      { AOM_ICDF(1959), AOM_ICDF(27153), AOM_ICDF(32768), 0 },
      { AOM_ICDF(29530), AOM_ICDF(31073), AOM_ICDF(32768), 0 },
      { AOM_ICDF(25057), AOM_ICDF(30840), AOM_ICDF(32768), 0 },
      { AOM_ICDF(21588), AOM_ICDF(29940), AOM_ICDF(32768), 0 },
      /** ----------------------------------------------------- **/
      { AOM_ICDF(244 * 128), AOM_ICDF(32768), AOM_ICDF(32768), 0 },
#if CONFIG_EXT_PARTITION
      { AOM_ICDF(32256), AOM_ICDF(32768), AOM_ICDF(32768), 0 },
      { AOM_ICDF(32256), AOM_ICDF(32768), AOM_ICDF(32768), 0 },
      { AOM_ICDF(32256), AOM_ICDF(32768), AOM_ICDF(32768), 0 },
#endif
      { AOM_ICDF(32640), AOM_ICDF(32740), AOM_ICDF(32768), 0 },
      { AOM_ICDF(32640), AOM_ICDF(32740), AOM_ICDF(32768), 0 },
      { AOM_ICDF(32640), AOM_ICDF(32740), AOM_ICDF(32768), 0 },
      { AOM_ICDF(32640), AOM_ICDF(32740), AOM_ICDF(32768), 0 },
      { AOM_ICDF(32640), AOM_ICDF(32740), AOM_ICDF(32768), 0 },
      { AOM_ICDF(32640), AOM_ICDF(32740), AOM_ICDF(32768), 0 }
1233 1234 1235 1236
#if CONFIG_EXT_PARTITION
      { AOM_ICDF(32640), AOM_ICDF(32740), AOM_ICDF(32768), 0 },
      { AOM_ICDF(32640), AOM_ICDF(32740), AOM_ICDF(32768), 0 },
#endif
1237 1238
    };
#else  // CONFIG_NCOBMC_ADAPT_WEIGHT
Yue Chen's avatar
Yue Chen committed
1239
const aom_tree_index av1_motion_mode_tree[TREE_SIZE(MOTION_MODES)] = {
1240 1241
  -SIMPLE_TRANSLATION, -OBMC_CAUSAL
};
1242

1243 1244
static const aom_prob
    default_motion_mode_prob[BLOCK_SIZES_ALL][MOTION_MODES - 1] = {
1245
#if CONFIG_CHROMA_SUB8X8
clang-format's avatar
clang-format committed
1246
      { 255 }, { 255 }, { 255 },
1247
#endif
clang-format's avatar
clang-format committed
1248 1249
      { 255 }, { 255 }, { 255 }, { 151 }, { 153 }, { 144 }, { 178 },
      { 165 }, { 160 }, { 207 }, { 195 }, { 168 }, { 244 },
1250
#if CONFIG_EXT_PARTITION
clang-format's avatar
clang-format committed
1251
      { 252 }, { 252 }, { 252 },
1252
#endif  // CONFIG_EXT_PARTITION
1253
      { 208 }, { 208 }, { 208 }, { 208 }, { 208 }, { 208 },
1254 1255 1256
#if CONFIG_EXT_PARTITION
      { 208 }, { 208 }
#endif  // CONFIG_EXT_PARTITION
clang-format's avatar
clang-format committed
1257
    };
1258

Thomas Davies's avatar
Thomas Davies committed
1259
static const aom_cdf_prob
1260
    default_motion_mode_cdf[BLOCK_SIZES_ALL][CDF_SIZE(MOTION_MODES)] = {
1261
#if CONFIG_CHROMA_SUB8X8
Thomas Davies's avatar
Thomas Davies committed
1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283
      { AOM_ICDF(255 * 128), AOM_ICDF(32768), 0 },
      { AOM_ICDF(255 * 128), AOM_ICDF(32768), 0 },
      { AOM_ICDF(255 * 128), AOM_ICDF(32768), 0 },
#endif
      { AOM_ICDF(255 * 128), AOM_ICDF(32768), 0 },
      { AOM_ICDF(255 * 128), AOM_ICDF(32768), 0 },
      { AOM_ICDF(255 * 128), AOM_ICDF(32768), 0 },
      { AOM_ICDF(151 * 128), AOM_ICDF(32768), 0 },
      { AOM_ICDF(153 * 128), AOM_ICDF(32768), 0 },
      { AOM_ICDF(144 * 128), AOM_ICDF(32768), 0 },
      { AOM_ICDF(178 * 128), AOM_ICDF(32768), 0 },
      { AOM_ICDF(165 * 128), AOM_ICDF(32768), 0 },
      { AOM_ICDF(160 * 128), AOM_ICDF(32768), 0 },
      { AOM_ICDF(207 * 128), AOM_ICDF(32768), 0 },
      { AOM_ICDF(195 * 128), AOM_ICDF(32768), 0 },
      { AOM_ICDF(168 * 128), AOM_ICDF(32768), 0 },
      { AOM_ICDF(244 * 128), AOM_ICDF(32768), 0 },
#if CONFIG_EXT_PARTITION
      { AOM_ICDF(252 * 128), AOM_ICDF(32768), 0 },
      { AOM_ICDF(252 * 128), AOM_ICDF(32768), 0 },
      { AOM_ICDF(252 * 128), AOM_ICDF(32768), 0 },
#endif  // CONFIG_EXT_PARTITION
1284 1285 1286 1287
      { AOM_ICDF(255 * 128), AOM_ICDF(32768), 0 },
      { AOM_ICDF(255 * 128), AOM_ICDF(32768), 0 },
      { AOM_ICDF(255 * 128), AOM_ICDF(32768), 0 },
      { AOM_ICDF(255 * 128), AOM_ICDF(32768), 0 },
1288 1289
      { AOM_ICDF(255 * 128), AOM_ICDF(32768), 0 },
      { AOM_ICDF(255 * 128), AOM_ICDF(32768), 0 },
1290 1291 1292 1293
#if CONFIG_EXT_PARTITION
      { AOM_ICDF(255 * 128), AOM_ICDF(32768), 0 },
      { AOM_ICDF(255 * 128), AOM_ICDF(32768), 0 },
#endif  // CONFIG_EXT_PARTITION
Thomas Davies's avatar
Thomas Davies committed
1294
    };
1295
#endif  // CONFIG_NCOBMC_ADAPT_WEIGHT
Yue Chen's avatar
Yue Chen committed
1296
#elif !CONFIG_MOTION_VAR && CONFIG_WARPED_MOTION
1297

Yue Chen's avatar
Yue Chen committed
1298
const aom_tree_index av1_motion_mode_tree[TREE_SIZE(MOTION_MODES)] = {
1299 1300
  -SIMPLE_TRANSLATION, -WARPED_CAUSAL
};
Yue Chen's avatar
Yue Chen committed
1301

1302 1303
static const aom_prob
    default_motion_mode_prob[BLOCK_SIZES_ALL][MOTION_MODES - 1] = {
1304
#if CONFIG_CHROMA_SUB8X8
clang-format's avatar
clang-format committed
1305
      { 255 }, { 255 }, { 255 },
1306
#endif
clang-format's avatar
clang-format committed
1307 1308
      { 255 }, { 255 }, { 255 }, { 151 }, { 153 }, { 144 }, { 178 },
      { 165 }, { 160 }, { 207 }, { 195 }, { 168 }, { 244 },
1309
#if CONFIG_EXT_PARTITION
clang-format's avatar
clang-format committed
1310
      { 252 }, { 252 }, { 252 },
1311
#endif  // CONFIG_EXT_PARTITION
1312
      { 208 }, { 208 }, { 208 }, { 208 }, { 208 }, { 208 },
1313 1314 1315
#if CONFIG_EXT_PARTITION
      { 252 }, { 252 }
#endif  // CONFIG_EXT_PARTITION
clang-format's avatar
clang-format committed
1316
    };
1317

Thomas Davies's avatar
Thomas Davies committed
1318
static const aom_cdf_prob
1319
    default_motion_mode_cdf[BLOCK_SIZES_ALL][CDF_SIZE(MOTION_MODES)] = {
1320
#if CONFIG_CHROMA_SUB8X8
Thomas Davies's avatar
Thomas Davies committed
1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337