entropymode.c 264 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
const aom_prob default_txb_skip[TX_SIZES][TXB_SKIP_CONTEXTS] = {
25
#if CONFIG_CHROMA_2X2
26 27
  { 252, 71, 126, 184, 178, 218, 251, 49, 133, 221, 27, 92, 197 },
#endif
28 29 30 31 32 33 34 35 36 37 38
  { 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] = {
39
#if CONFIG_CHROMA_2X2
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
      { // TX_2X2
        {
            { 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 },
        },
        {
            { 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 },
        } },
#endif
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 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
      { // 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 },
          },
      },
    };

const aom_prob default_nz_map[TX_SIZES][PLANE_TYPES][SIG_COEF_CONTEXTS] = {
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273
#if CONFIG_EXT_TX
#if CONFIG_CHROMA_2X2
  {
      { 34, 103, 61, 106, 62,  160, 112, 54, 173, 121,
        75, 157, 92, 75,  157, 129, 94,  65, 52,  37,

        34, 103, 61, 106, 62,  160, 112, 54, 173, 121,
        75, 157, 92, 75,  157, 129, 94,  65, 52,  37,

        34, 103, 61, 106, 62,  160, 112, 54, 173, 121,
        75, 157, 92, 75,  157, 129, 94,  65, 52,  37 },

      { 52,  124, 84,  136, 107, 197, 161, 82, 183, 151,
        109, 153, 140, 103, 152, 134, 109, 81, 69,  50,

        52,  124, 84,  136, 107, 197, 161, 82, 183, 151,
        109, 153, 140, 103, 152, 134, 109, 81, 69,  50,

        52,  124, 84,  136, 107, 197, 161, 82, 183, 151,
        109, 153, 140, 103, 152, 134, 109, 81, 69,  50 },
  },
#endif
  {
      { 34, 103, 61, 106, 62,  160, 112, 54, 173, 121,
        75, 157, 92, 75,  157, 129, 94,  65, 52,  37,

        34, 103, 61, 106, 62,  160, 112, 54, 173, 121,
        75, 157, 92, 75,  157, 129, 94,  65, 52,  37,

        34, 103, 61, 106, 62,  160, 112, 54, 173, 121,
        75, 157, 92, 75,  157, 129, 94,  65, 52,  37 },

      { 52,  124, 84,  136, 107, 197, 161, 82, 183, 151,
        109, 153, 140, 103, 152, 134, 109, 81, 69,  50,

        52,  124, 84,  136, 107, 197, 161, 82, 183, 151,
        109, 153, 140, 103, 152, 134, 109, 81, 69,  50,

        52,  124, 84,  136, 107, 197, 161, 82, 183, 151,
        109, 153, 140, 103, 152, 134, 109, 81, 69,  50 },
  },
  {
      { 34, 127, 74,  124, 74,  204, 153, 76,  226, 162,
        92, 207, 126, 91,  227, 192, 149, 108, 85,  55,

        34, 127, 74,  124, 74,  204, 153, 76,  226, 162,
        92, 207, 126, 91,  227, 192, 149, 108, 85,  55,

        34, 127, 74,  124, 74,  204, 153, 76,  226, 162,
        92, 207, 126, 91,  227, 192, 149, 108, 85,  55 },

      { 43,  136, 115, 158, 130, 212, 187, 112, 231, 180,
        130, 202, 164, 130, 236, 204, 168, 139, 112, 114,

        43,  136, 115, 158, 130, 212, 187, 112, 231, 180,
        130, 202, 164, 130, 236, 204, 168, 139, 112, 114,

        43,  136, 115, 158, 130, 212, 187, 112, 231, 180,
        130, 202, 164, 130, 236, 204, 168, 139, 112, 114 },
  },
  {
      { 25,  117, 70,  120, 77,  215, 171, 102, 234, 156,
        105, 235, 155, 109, 247, 220, 176, 127, 92,  72,

        25,  117, 70,  120, 77,  215, 171, 102, 234, 156,
        105, 235, 155, 109, 247, 220, 176, 127, 92,  72,

        25,  117, 70,  120, 77,  215, 171, 102, 234, 156,
        105, 235, 155, 109, 247, 220, 176, 127, 92,  72 },

      { 24,  88,  49,  100, 62,  202, 148, 62,  237, 178,
        102, 233, 168, 105, 244, 198, 162, 127, 103, 71,

        24,  88,  49,  100, 62,  202, 148, 62,  237, 178,
        102, 233, 168, 105, 244, 198, 162, 127, 103, 71,

        24,  88,  49,  100, 62,  202, 148, 62,  237, 178,
        102, 233, 168, 105, 244, 198, 162, 127, 103, 71 },
  },
  {
      { 11, 54,  17,  69, 26,  128, 125, 56,  232, 130,
        60, 237, 121, 66, 250, 168, 134, 114, 93,  53,

        11, 54,  17,  69, 26,  128, 125, 56,  232, 130,
        60, 237, 121, 66, 250, 168, 134, 114, 93,  53,

        11, 54,  17,  69, 26,  128, 125, 56,  232, 130,
        60, 237, 121, 66, 250, 168, 134, 114, 93,  53 },

      { 21, 52,  32,  95,  64,  171, 152, 70,  247, 159,
        81, 252, 177, 100, 252, 221, 192, 143, 195, 146,

        21, 52,  32,  95,  64,  171, 152, 70,  247, 159,
        81, 252, 177, 100, 252, 221, 192, 143, 195, 146,

        21, 52,  32,  95,  64,  171, 152, 70,  247, 159,
        81, 252, 177, 100, 252, 221, 192, 143, 195, 146 },
  },
#else  // CONFIG_EXT_TX
274
#if CONFIG_CHROMA_2X2
275 276 277 278 279 280 281
  {
      { 34, 103, 61, 106, 62,  160, 112, 54, 173, 121,
        75, 157, 92, 75,  157, 129, 94,  65, 52,  37 },
      { 52,  124, 84,  136, 107, 197, 161, 82, 183, 151,
        109, 153, 140, 103, 152, 134, 109, 81, 69,  50 },
  },
#endif
282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305
  {
      { 34, 103, 61, 106, 62,  160, 112, 54, 173, 121,
        75, 157, 92, 75,  157, 129, 94,  65, 52,  37 },
      { 52,  124, 84,  136, 107, 197, 161, 82, 183, 151,
        109, 153, 140, 103, 152, 134, 109, 81, 69,  50 },
  },
  {
      { 34, 127, 74,  124, 74,  204, 153, 76,  226, 162,
        92, 207, 126, 91,  227, 192, 149, 108, 85,  55 },
      { 43,  136, 115, 158, 130, 212, 187, 112, 231, 180,
        130, 202, 164, 130, 236, 204, 168, 139, 112, 114 },
  },
  {
      { 25,  117, 70,  120, 77,  215, 171, 102, 234, 156,
        105, 235, 155, 109, 247, 220, 176, 127, 92,  72 },
      { 24,  88,  49,  100, 62,  202, 148, 62,  237, 178,
        102, 233, 168, 105, 244, 198, 162, 127, 103, 71 },
  },
  {
      { 11, 54,  17,  69, 26,  128, 125, 56,  232, 130,
        60, 237, 121, 66, 250, 168, 134, 114, 93,  53 },
      { 21, 52,  32,  95,  64,  171, 152, 70,  247, 159,
        81, 252, 177, 100, 252, 221, 192, 143, 195, 146 },
  },
306
#endif  // CONFIG_EXT_TX
307
};
308

309
const aom_prob default_eob_flag[TX_SIZES][PLANE_TYPES][EOB_COEF_CONTEXTS] = {
310
#if CONFIG_CHROMA_2X2
311 312 313 314 315 316 317
  {
      { 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 },
  },
#endif
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
  {
      { 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 },
  },
};
343

344
const aom_prob default_coeff_lps[TX_SIZES][PLANE_TYPES][LEVEL_CONTEXTS] = {
345
#if CONFIG_CHROMA_2X2
346 347 348 349 350 351 352 353 354 355 356
  {
      { 164, 128, 134, 165, 128, 137, 168, 128, 97,  136, 167, 128,
        182, 205, 143, 172, 200, 145, 173, 193, 103, 137, 170, 191,
        198, 214, 162, 187, 209, 162, 187, 207, 128, 156, 183, 201,
        219, 230, 204, 210, 225, 201, 209, 225, 187, 190, 203, 214 },
      { 106, 128, 98,  126, 128, 87,  122, 128, 54,  89,  131, 128,
        142, 180, 123, 154, 189, 115, 149, 175, 79,  115, 157, 182,
        175, 197, 147, 174, 199, 145, 174, 201, 89,  135, 173, 194,
        212, 222, 206, 203, 223, 188, 201, 220, 128, 144, 202, 206 },
  },
#endif
357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399
  {
      { 164, 128, 134, 165, 128, 137, 168, 128, 97,  136, 167, 128,
        182, 205, 143, 172, 200, 145, 173, 193, 103, 137, 170, 191,
        198, 214, 162, 187, 209, 162, 187, 207, 128, 156, 183, 201,
        219, 230, 204, 210, 225, 201, 209, 225, 187, 190, 203, 214 },
      { 106, 128, 98,  126, 128, 87,  122, 128, 54,  89,  131, 128,
        142, 180, 123, 154, 189, 115, 149, 175, 79,  115, 157, 182,
        175, 197, 147, 174, 199, 145, 174, 201, 89,  135, 173, 194,
        212, 222, 206, 203, 223, 188, 201, 220, 128, 144, 202, 206 },
  },
  {
      { 171, 128, 123, 169, 128, 121, 165, 128, 82,  125, 168, 128,
        191, 213, 143, 177, 199, 136, 170, 194, 95,  135, 171, 195,
        206, 222, 166, 191, 212, 154, 184, 207, 115, 149, 180, 204,
        223, 237, 196, 215, 231, 186, 209, 228, 158, 178, 201, 222 },
      { 115, 128, 115, 146, 128, 91,  147, 128, 55,  93,  139, 128,
        147, 190, 141, 176, 201, 123, 156, 173, 68,  114, 156, 195,
        186, 205, 153, 191, 214, 141, 179, 205, 107, 132, 166, 184,
        215, 225, 200, 212, 230, 102, 207, 222, 128, 119, 200, 212 },
  },
  {
      { 185, 128, 134, 198, 128, 128, 195, 128, 58,  110, 162, 128,
        208, 227, 154, 196, 206, 144, 188, 209, 83,  130, 168, 198,
        219, 232, 167, 205, 222, 158, 196, 216, 107, 143, 178, 204,
        233, 244, 202, 226, 238, 191, 217, 234, 153, 178, 200, 223 },
      { 160, 128, 154, 197, 128, 129, 178, 128, 53,  112, 157, 128,
        185, 214, 169, 196, 221, 134, 179, 186, 82,  131, 168, 194,
        204, 220, 176, 209, 221, 173, 194, 209, 107, 154, 181, 203,
        230, 241, 202, 226, 237, 185, 223, 234, 162, 187, 203, 222 },
  },
  {
      { 177, 128, 165, 226, 128, 152, 219, 128, 45,  129, 188, 128,
        198, 218, 179, 220, 228, 163, 214, 220, 72,  134, 181, 206,
        216, 225, 177, 218, 231, 158, 213, 223, 112, 150, 185, 210,
        245, 251, 204, 234, 247, 195, 231, 243, 163, 186, 213, 235 },
      { 161, 128, 174, 205, 128, 146, 182, 128, 59,  125, 179, 128,
        183, 208, 199, 220, 239, 184, 213, 217, 71,  141, 196, 217,
        213, 219, 215, 230, 237, 171, 224, 238, 112, 173, 193, 221,
        239, 246, 168, 243, 249, 93,  241, 247, 128, 195, 216, 233 },
  },
};
#endif  // CONFIG_LV_MAP

400
#if CONFIG_EXT_PARTITION_TYPES
Yaowu Xu's avatar
Yaowu Xu committed
401
static const aom_prob
clang-format's avatar
clang-format committed
402 403
    default_partition_probs[PARTITION_CONTEXTS][EXT_PARTITION_TYPES - 1] = {
      // 8x8 -> 4x4
404 405 406 407
      { 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
408
      // 16x16 -> 8x8
409 410 411 412
      { 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
413
      // 32x32 -> 16x16
414 415 416 417
      { 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
418
      // 64x64 -> 32x32
419 420 421 422
      { 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
423
#if CONFIG_EXT_PARTITION
clang-format's avatar
clang-format committed
424
      // 128x128 -> 64x64
425 426 427 428 429
      { 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
430
#if CONFIG_UNPOISON_PARTITION_CTX
431 432 433 434
      { 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
435
#if CONFIG_EXT_PARTITION
436 437 438 439 440 441
      { 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
442
#if CONFIG_EXT_PARTITION
443 444 445
      { 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
446
    };
447
#else
Yaowu Xu's avatar
Yaowu Xu committed
448
static const aom_prob
clang-format's avatar
clang-format committed
449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469
    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
470
#if CONFIG_EXT_PARTITION
clang-format's avatar
clang-format committed
471 472 473 474 475
      // 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
476
#endif  // CONFIG_EXT_PARTITION
477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492
#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
493
    };
494
#endif  // CONFIG_EXT_PARTITION_TYPES
Jingning Han's avatar
Jingning Han committed
495

Yaowu Xu's avatar
Yaowu Xu committed
496
static const aom_prob default_newmv_prob[NEWMV_MODE_CONTEXTS] = {
497
  155, 116, 94, 32, 96, 56, 30,
498 499
};

Yaowu Xu's avatar
Yaowu Xu committed
500
static const aom_prob default_zeromv_prob[ZEROMV_MODE_CONTEXTS] = {
501
  45, 13,
502 503
};

Yaowu Xu's avatar
Yaowu Xu committed
504
static const aom_prob default_refmv_prob[REFMV_MODE_CONTEXTS] = {
505
  178, 212, 135, 244, 203, 122, 128, 128, 128,
506
};
Yue Chen's avatar
Yue Chen committed
507

508 509 510
static const aom_prob default_drl_prob[DRL_MODE_CONTEXTS] = {
  119, 128, 189, 134, 128,
};
511 512
#if CONFIG_NEW_MULTISYMBOL
static const aom_cdf_prob default_newmv_cdf[NEWMV_MODE_CONTEXTS][CDF_SIZE(2)] =
513 514 515 516 517 518 519
    { { 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 } };
520
static const aom_cdf_prob default_zeromv_cdf[ZEROMV_MODE_CONTEXTS][CDF_SIZE(
521 522
    2)] = { { AOM_ICDF(128 * 45), AOM_ICDF(32768), 0 },
            { AOM_ICDF(128 * 13), AOM_ICDF(32768), 0 } };
523
static const aom_cdf_prob default_refmv_cdf[REFMV_MODE_CONTEXTS][CDF_SIZE(2)] =
524 525 526 527 528 529
    { { 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 },
530
      { AOM_ICDF(128 * 128), AOM_ICDF(32768), 0 },
531 532
      { AOM_ICDF(128 * 128), AOM_ICDF(32768), 0 },
      { AOM_ICDF(128 * 128), AOM_ICDF(32768), 0 } };
533
static const aom_cdf_prob default_drl_cdf[DRL_MODE_CONTEXTS][CDF_SIZE(2)] = {
534
  { AOM_ICDF(128 * 119), AOM_ICDF(32768), 0 },
535
  { AOM_ICDF(128 * 128), AOM_ICDF(32768), 0 },
536 537 538
  { AOM_ICDF(128 * 189), AOM_ICDF(32768), 0 },
  { AOM_ICDF(128 * 134), AOM_ICDF(32768), 0 },
  { AOM_ICDF(128 * 128), AOM_ICDF(32768), 0 }
539 540
};
#endif
541

542
#if CONFIG_EXT_INTER
Yaowu Xu's avatar
Yaowu Xu committed
543
static const aom_prob default_inter_compound_mode_probs
clang-format's avatar
clang-format committed
544
    [INTER_MODE_CONTEXTS][INTER_COMPOUND_MODES - 1] = {
545 546 547 548 549 550 551
      { 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
552
    };
553

554 555 556
static const aom_cdf_prob
    default_inter_compound_mode_cdf[INTER_MODE_CONTEXTS][CDF_SIZE(
        INTER_COMPOUND_MODES)] = {
557 558 559 560 561 562 563 564 565 566 567 568 569 570
      { 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 }
571 572
    };

573 574 575
#if CONFIG_COMPOUND_SINGLEREF
// TODO(zoeliu): Default values to be further adjusted based on the collected
//               stats.
576
/*
577 578 579 580 581 582 583 584 585
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
586 587 588 589 590 591 592 593 594 595
    };*/
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
596
    };
597 598 599 600 601 602 603 604 605 606 607 608

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 }
    };
609 610
#endif  // CONFIG_COMPOUND_SINGLEREF

611
#if CONFIG_COMPOUND_SEGMENT && CONFIG_WEDGE
612
static const aom_prob
613
    default_compound_type_probs[BLOCK_SIZES_ALL][COMPOUND_TYPES - 1] = {
614
#if CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8
615
      { 128, 128 }, { 128, 128 }, { 128, 128 },
616
#endif
617 618
      { 128, 128 }, { 255, 128 }, { 255, 128 }, { 66, 51 },   { 72, 35 },
      { 79, 29 },   { 71, 18 },   { 81, 29 },   { 81, 26 },   { 69, 19 },
619
      { 104, 1 },   { 99, 1 },    { 75, 1 },
620
#if CONFIG_EXT_PARTITION
621
      { 255, 1 },   { 255, 1 },   { 255, 1 },
622
#endif  // CONFIG_EXT_PARTITION
623 624
      { 208, 128 }, { 208, 128 }, { 208, 128 }, { 208, 128 }, { 208, 128 },
      { 208, 128 },
625
    };
626
#elif !CONFIG_COMPOUND_SEGMENT && CONFIG_WEDGE
clang-format's avatar
clang-format committed
627
static const aom_prob
628
    default_compound_type_probs[BLOCK_SIZES_ALL][COMPOUND_TYPES - 1] = {
629
#if CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8
630
      { 255 }, { 255 }, { 255 },
631
#endif
clang-format's avatar
clang-format committed
632 633
      { 208 }, { 208 }, { 208 }, { 208 }, { 208 }, { 208 }, { 216 },
      { 216 }, { 216 }, { 224 }, { 224 }, { 240 }, { 240 },
634
#if CONFIG_EXT_PARTITION
clang-format's avatar
clang-format committed
635
      { 255 }, { 255 }, { 255 },
636
#endif  // CONFIG_EXT_PARTITION
637
      { 208 }, { 208 }, { 208 }, { 208 }, { 208 }, { 208 },
clang-format's avatar
clang-format committed
638
    };
639 640
#elif CONFIG_COMPOUND_SEGMENT && !CONFIG_WEDGE
static const aom_prob
641
    default_compound_type_probs[BLOCK_SIZES_ALL][COMPOUND_TYPES - 1] = {
642
#if CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8
643
      { 255 }, { 255 }, { 255 },
644 645 646 647 648 649
#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
650
      { 208 }, { 208 }, { 208 }, { 208 }, { 208 }, { 208 },
651 652
    };
#else
653
static const aom_prob default_compound_type_probs[BLOCK_SIZES_ALL]
654 655
                                                 [COMPOUND_TYPES - 1];
#endif  // CONFIG_COMPOUND_SEGMENT && CONFIG_WEDGE
656

657 658
#if CONFIG_COMPOUND_SEGMENT && CONFIG_WEDGE
static const aom_cdf_prob
659
    default_compound_type_cdf[BLOCK_SIZES_ALL][CDF_SIZE(COMPOUND_TYPES)] = {
660
#if CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8
661 662 663
      { 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 },
664
#endif
665 666 667 668 669 670 671 672 673 674 675 676 677
      { 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 },
678 679 680 681 682
#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
683 684 685 686 687 688
      { 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 },
      { AOM_ICDF(16384), AOM_ICDF(24576), AOM_ICDF(32768), 0 },
      { AOM_ICDF(16384), AOM_ICDF(24576), AOM_ICDF(32768), 0 },
689 690 691
    };
#elif !CONFIG_COMPOUND_SEGMENT && CONFIG_WEDGE
static const aom_cdf_prob
692
    default_compound_type_cdf[BLOCK_SIZES_ALL][CDF_SIZE(COMPOUND_TYPES)] = {
693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715
#if CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8
      { 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
716 717 718 719
      { 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 },
720 721
      { AOM_ICDF(32640), AOM_ICDF(32768), 0 },
      { AOM_ICDF(32640), AOM_ICDF(32768), 0 },
722 723 724
    };
#elif CONFIG_COMPOUND_SEGMENT && !CONFIG_WEDGE
static const aom_cdf_prob
725
    default_compound_type_cdf[BLOCK_SIZES_ALL][CDF_SIZE(COMPOUND_TYPES)] = {
726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748
#if CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8
      { 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
749 750 751 752
      { 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 },
753 754
      { AOM_ICDF(32640), AOM_ICDF(32768), 0 },
      { AOM_ICDF(32640), AOM_ICDF(32768), 0 },
755 756 757
    };
#endif  // CONFIG_COMPOUND_SEGMENT && CONFIG_WEDGE

758
#if CONFIG_INTERINTRA
Yaowu Xu's avatar
Yaowu Xu committed
759
static const aom_prob default_interintra_prob[BLOCK_SIZE_GROUPS] = {
760
  128, 226, 244, 254,
761
};
762 763
#if CONFIG_NEW_MULTISYMBOL
static const aom_cdf_prob default_interintra_cdf[BLOCK_SIZE_GROUPS][CDF_SIZE(
764 765 766 767
    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 } };
768 769
#endif

770 771
static const aom_prob
    default_interintra_mode_prob[BLOCK_SIZE_GROUPS][INTERINTRA_MODES - 1] = {
772 773 774 775
      { 128, 128, 128 },  // block_size < 8x8
      { 24, 34, 119 },    // block_size < 16x16
      { 38, 33, 95 },     // block_size < 32x32
      { 51, 21, 110 },    // block_size >= 32x32
776
    };
777
static const aom_cdf_prob
778 779 780 781 782 783 784
    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 }
    };
785

786
static const aom_prob default_wedge_interintra_prob[BLOCK_SIZES_ALL] = {
787
#if CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8
788
  128, 128, 128,
789
#endif
790
  128, 128, 128, 194, 213, 217, 222, 224, 226, 220, 128, 128, 128,
791
#if CONFIG_EXT_PARTITION
792
  208, 208, 208,
793
#endif  // CONFIG_EXT_PARTITION
794
  208, 208, 208, 208, 208, 208,
795
};
796

797 798
#if CONFIG_NEW_MULTISYMBOL
static const aom_cdf_prob
799
    default_wedge_interintra_cdf[BLOCK_SIZES_ALL][CDF_SIZE(2)] = {
800
#if CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8
801 802 803
      { AOM_ICDF(128 * 128), AOM_ICDF(32768), 0 },
      { AOM_ICDF(128 * 128), AOM_ICDF(32768), 0 },
      { AOM_ICDF(128 * 128), AOM_ICDF(32768), 0 },
804
#endif
805 806 807 808 809 810 811
      { 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 },
812
      { AOM_ICDF(224 * 128), AOM_ICDF(32768), 0 },
813 814 815 816 817
      { 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 },
818 819 820 821 822
#if CONFIG_EXT_PARTITION
      { AOM_ICDF(208 * 128), AOM_ICDF(32768), 0 },
      { AOM_ICDF(208 * 128), AOM_ICDF(32768), 0 },
      { AOM_ICDF(208 * 128), AOM_ICDF(32768), 0 },
#endif  // CONFIG_EXT_PARTITION
823 824 825 826
      { 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 },
827 828
      { AOM_ICDF(208 * 128), AOM_ICDF(32768), 0 },
      { AOM_ICDF(208 * 128), AOM_ICDF(32768), 0 },
829 830 831
    };
#endif  // CONFIG_NEW_MULTISYMBOL

832
#endif  // CONFIG_INTERINTRA
833 834
#endif  // CONFIG_EXT_INTER

835
#if CONFIG_NCOBMC_ADAPT_WEIGHT
836
#ifdef TWO_MODE
837
const aom_tree_index av1_ncobmc_mode_tree[TREE_SIZE(MAX_NCOBMC_MODES)] = {
838
  -NCOBMC_MODE_0, -NCOBMC_MODE_1
839
};
840 841 842 843 844 845 846 847 848 849 850
#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
851 852

// TODO(weitinglin): find default prob
853 854
//                   right now setting the first mode with probability 1/255,
//                   the last eight modes with equal probabilities
855 856
static const aom_prob
    default_ncobmc_mode_prob[ADAPT_OVERLAP_BLOCKS][MAX_NCOBMC_MODES - 1] = {
857 858 859 860 861 862 863 864
#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
865
    };
866 867
static const aom_cdf_prob
    default_ncobmc_mode_cdf[ADAPT_OVERLAP_BLOCKS][CDF_SIZE(MAX_NCOBMC_MODES)] =
868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886
#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
887
#endif  // CONFIG_NCOBMC_ADAPT_WEIGHT
888
// Change this section appropriately once warped motion is supported
Yue Chen's avatar
Yue Chen committed
889
#if CONFIG_MOTION_VAR && !CONFIG_WARPED_MOTION
890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960
#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] = {
#if CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8
      { 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 },
    };
static const aom_cdf_prob
    default_motion_mode_cdf[BLOCK_SIZES_ALL][CDF_SIZE(MOTION_MODES)] = {
#if CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8
      { 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 }
    };
#else  // CONFIG_NCOBMC_ADAPT_WEIGHT
Yue Chen's avatar
Yue Chen committed
961
const aom_tree_index av1_motion_mode_tree[TREE_SIZE(MOTION_MODES)] = {
962 963
  -SIMPLE_TRANSLATION, -OBMC_CAUSAL
};
964

965 966
static const aom_prob
    default_motion_mode_prob[BLOCK_SIZES_ALL][MOTION_MODES - 1] = {
967
#if CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8
clang-format's avatar
clang-format committed
968
      { 255 }, { 255 }, { 255 },
969
#endif
clang-format's avatar
clang-format committed
970 971
      { 255 }, { 255 }, { 255 }, { 151 }, { 153 }, { 144 }, { 178 },
      { 165 }, { 160 }, { 207 }, { 195 }, { 168 }, { 244 },
972
#if CONFIG_EXT_PARTITION
clang-format's avatar
clang-format committed
973
      { 252 }, { 252 }, { 252 },
974
#endif  // CONFIG_EXT_PARTITION
975
      { 208 }, { 208 }, { 208 }, { 208 }, { 208 }, { 208 },
clang-format's avatar
clang-format committed
976
    };
977

Thomas Davies's avatar
Thomas Davies committed
978
static const aom_cdf_prob
979
    default_motion_mode_cdf[BLOCK_SIZES_ALL][CDF_SIZE(MOTION_MODES)] = {
Thomas Davies's avatar
Thomas Davies committed
980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002
#if CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8
      { 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
1003 1004 1005 1006
      { 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 },
1007 1008
      { AOM_ICDF(255 * 128), AOM_ICDF(32768), 0 },
      { AOM_ICDF(255 * 128), AOM_ICDF(32768), 0 },
Thomas Davies's avatar
Thomas Davies committed
1009
    };
1010
#endif  // CONFIG_NCOBMC_ADAPT_WEIGHT