]> granicus.if.org Git - libvpx/commitdiff
Updating the model coef experiment
authorDeb Mukherjee <debargha@google.com>
Fri, 17 May 2013 13:40:25 +0000 (06:40 -0700)
committerDeb Mukherjee <debargha@google.com>
Mon, 20 May 2013 19:46:36 +0000 (12:46 -0700)
Cleans up the experiment. Actually uses reduced counts for backward
updates, and reduced number of probabilities in the context.

No change in bitstream when the experiment is on.

Between expt on and off:
derfraw300 is down only -0.062% (which is better than when expts
were run previously).

Change-Id: I55285a049a0c22810bdb42914212ab5a4f8521b5

12 files changed:
vp9/common/vp9_default_coef_probs.h
vp9/common/vp9_entropy.c
vp9/common/vp9_entropy.h
vp9/common/vp9_onyxc_int.h
vp9/decoder/vp9_decodframe.c
vp9/decoder/vp9_detokenize.c
vp9/encoder/vp9_bitstream.c
vp9/encoder/vp9_onyx_if.c
vp9/encoder/vp9_onyx_int.h
vp9/encoder/vp9_rdopt.c
vp9/encoder/vp9_tokenize.c
vp9/encoder/vp9_tokenize.h

index 9e373331eb0c63159f8f995cbe30f4e95923dc6a..5ce966407b0fb6aa9102bdd38fa0e603abe52ed5 100644 (file)
 // 2 or 3 from each row is actually used depending on whether
 // UNCONSTRAINDED_NODES is 2 or 3. If this experiment is merged
 // the tables below should be shortened accordingly.
+#if CONFIG_MODELCOEFPROB
+static const vp9_coeff_probs_model default_coef_probs_4x4[BLOCK_TYPES] = {
+  { /* block Type 0 */
+    { /* Intra */
+      { /* Coeff Band 0 */
+        { 208,  32, 178,},
+        { 102,  43, 132,},
+        {  15,  36,  68,}
+      }, { /* Coeff Band 1 */
+        {  71,  91, 178,},
+        {  72,  88, 174,},
+        {  40,  79, 154,},
+        {  21,  68, 126,},
+        {   7,  49,  84,},
+        {   1,  20,  32,}
+      }, { /* Coeff Band 2 */
+        { 108, 110, 206,},
+        {  72,  98, 191,},
+        {  26,  77, 152,},
+        {   7,  57, 106,},
+        {   1,  35,  60,},
+        {   1,  14,  22,}
+      }, { /* Coeff Band 3 */
+        { 105, 139, 222,},
+        {  76, 118, 205,},
+        {  21,  88, 164,},
+        {   5,  63, 118,},
+        {   1,  42,  74,},
+        {   1,  18,  30,}
+      }, { /* Coeff Band 4 */
+        { 143, 117, 233,},
+        {  99, 104, 214,},
+        {  26,  81, 170,},
+        {   6,  60, 116,},
+        {   1,  38,  65,},
+        {   1,  15,  26,}
+      }, { /* Coeff Band 5 */
+        { 155,  74, 238,},
+        { 152,  64, 223,},
+        {  67,  55, 182,},
+        {  27,  44, 127,},
+        {   9,  27,  69,},
+        {   2,  11,  28,}
+      }
+    }, { /* Inter */
+      { /* Coeff Band 0 */
+        { 207, 112, 234,},
+        { 145, 120, 212,},
+        {  77, 114, 177,}
+      }, { /* Coeff Band 1 */
+        {  93, 174, 243,},
+        { 100, 144, 231,},
+        {  28, 101, 186,},
+        {   9,  73, 132,},
+        {   2,  44,  76,},
+        {   1,  19,  33,}
+      }, { /* Coeff Band 2 */
+        { 116, 175, 246,},
+        {  78, 142, 231,},
+        {  14,  93, 177,},
+        {   4,  65, 122,},
+        {   1,  38,  69,},
+        {   1,  18,  30,}
+      }, { /* Coeff Band 3 */
+        { 138, 183, 249,},
+        {  93, 147, 237,},
+        {  21, 104, 187,},
+        {   6,  73, 131,},
+        {   1,  47,  83,},
+        {   1,  26,  44,}
+      }, { /* Coeff Band 4 */
+        { 188, 143, 252,},
+        { 137, 124, 241,},
+        {  32,  89, 188,},
+        {   7,  61, 122,},
+        {   1,  34,  66,},
+        {   1,  18,  34,}
+      }, { /* Coeff Band 5 */
+        { 198,  92, 253,},
+        { 189,  79, 244,},
+        {  78,  61, 200,},
+        {  34,  50, 146,},
+        {  11,  38,  93,},
+        {   1,  31,  55,}
+      }
+    }
+  }, { /* block Type 1 */
+    { /* Intra */
+      { /* Coeff Band 0 */
+        { 207,  35, 219,},
+        { 126,  46, 182,},
+        {  51,  47, 125,}
+      }, { /* Coeff Band 1 */
+        { 114, 124, 220,},
+        { 142, 116, 213,},
+        {  81, 101, 190,},
+        {  42,  83, 155,},
+        {  16,  62, 104,},
+        {   6,  40,  60,}
+      }, { /* Coeff Band 2 */
+        { 139, 149, 228,},
+        { 115, 127, 221,},
+        {  43, 100, 189,},
+        {  13,  77, 141,},
+        {   3,  49,  88,},
+        {   1,  23,  41,}
+      }, { /* Coeff Band 3 */
+        { 119, 185, 236,},
+        {  89, 140, 224,},
+        {  34, 105, 189,},
+        {  14,  78, 142,},
+        {   5,  49,  90,},
+        {   1,  22,  41,}
+      }, { /* Coeff Band 4 */
+        { 162, 142, 244,},
+        { 129, 120, 231,},
+        {  44,  90, 189,},
+        {  14,  65, 132,},
+        {   3,  38,  72,},
+        {   1,  17,  39,}
+      }, { /* Coeff Band 5 */
+        { 167,  96, 247,},
+        { 163,  84, 234,},
+        {  70,  63, 185,},
+        {  30,  44, 132,},
+        {  13,  30,  80,},
+        {   5,  13,  38,}
+      }
+    }, { /* Inter */
+      { /* Coeff Band 0 */
+        { 242,  90, 246,},
+        { 186, 102, 228,},
+        { 102, 108, 203,}
+      }, { /* Coeff Band 1 */
+        { 152, 169, 250,},
+        { 164, 149, 242,},
+        {  63, 108, 204,},
+        {  39,  83, 153,},
+        {  31,  66, 108,},
+        {  27,  65,  71,}
+      }, { /* Coeff Band 2 */
+        { 161, 174, 250,},
+        { 133, 150, 239,},
+        {  32, 105, 197,},
+        {  10,  78, 147,},
+        {   2,  49,  99,},
+        {   1,  26,  53,}
+      }, { /* Coeff Band 3 */
+        { 160, 187, 251,},
+        { 131, 155, 241,},
+        {  42, 108, 198,},
+        {  18,  81, 151,},
+        {   9,  60, 112,},
+        {   5,  35,  49,}
+      }, { /* Coeff Band 4 */
+        { 195, 141, 253,},
+        { 169, 128, 245,},
+        {  62,  91, 204,},
+        {  23,  70, 150,},
+        {   2,  44,  78,},
+        {   1,   1, 128,}
+      }, { /* Coeff Band 5 */
+        { 195, 104, 253,},
+        { 197,  92, 248,},
+        {  88,  71, 214,},
+        {  39,  56, 160,},
+        {  18,  28,  90,},
+        { 128, 128, 128,}
+      }
+    }
+  }
+};
+static const vp9_coeff_probs_model default_coef_probs_8x8[BLOCK_TYPES] = {
+  { /* block Type 0 */
+    { /* Intra */
+      { /* Coeff Band 0 */
+        { 196,  40, 199,},
+        {  83,  38, 128,},
+        {  10,  29,  55,}
+      }, { /* Coeff Band 1 */
+        {  33, 114, 160,},
+        {  69, 107, 155,},
+        {  30,  91, 138,},
+        {  12,  74, 115,},
+        {   4,  52,  80,},
+        {   1,  27,  40,}
+      }, { /* Coeff Band 2 */
+        {  38, 159, 190,},
+        {  34, 130, 182,},
+        {  10,  97, 153,},
+        {   3,  71, 115,},
+        {   1,  41,  68,},
+        {   1,  16,  27,}
+      }, { /* Coeff Band 3 */
+        {  41, 184, 214,},
+        {  24, 142, 199,},
+        {   6,  97, 159,},
+        {   1,  63, 110,},
+        {   1,  32,  58,},
+        {   1,  12,  21,}
+      }, { /* Coeff Band 4 */
+        {  54, 207, 231,},
+        {  32, 156, 213,},
+        {   7,  98, 164,},
+        {   2,  62, 108,},
+        {   1,  32,  57,},
+        {   1,  13,  22,}
+      }, { /* Coeff Band 5 */
+        {  89, 208, 239,},
+        {  53, 155, 223,},
+        {  12, 102, 170,},
+        {   3,  67, 111,},
+        {   1,  38,  60,},
+        {   1,  18,  26,}
+      }
+    }, { /* Inter */
+      { /* Coeff Band 0 */
+        { 205, 121, 244,},
+        { 140, 120, 211,},
+        {  51, 100, 152,}
+      }, { /* Coeff Band 1 */
+        {  66, 196, 236,},
+        {  99, 164, 223,},
+        {  29, 122, 187,},
+        {  14,  95, 145,},
+        {   6,  68,  97,},
+        {   3,  43,  50,}
+      }, { /* Coeff Band 2 */
+        {  66, 202, 238,},
+        {  45, 155, 218,},
+        {   6,  96, 163,},
+        {   2,  64, 110,},
+        {   1,  34,  61,},
+        {   1,  13,  24,}
+      }, { /* Coeff Band 3 */
+        {  66, 204, 242,},
+        {  38, 158, 222,},
+        {   6,  95, 166,},
+        {   2,  61, 111,},
+        {   1,  31,  59,},
+        {   1,  12,  22,}
+      }, { /* Coeff Band 4 */
+        {  63, 214, 245,},
+        {  38, 164, 228,},
+        {   5, 101, 174,},
+        {   1,  64, 116,},
+        {   1,  34,  63,},
+        {   1,  14,  26,}
+      }, { /* Coeff Band 5 */
+        {  91, 214, 246,},
+        {  55, 162, 233,},
+        {  10, 104, 179,},
+        {   2,  67, 119,},
+        {   1,  37,  66,},
+        {   1,  16,  30,}
+      }
+    }
+  }, { /* block Type 1 */
+    { /* Intra */
+      { /* Coeff Band 0 */
+        { 211,  32, 212,},
+        { 121,  47, 171,},
+        {  40,  51, 118,}
+      }, { /* Coeff Band 1 */
+        {  71, 129, 209,},
+        { 118, 122, 206,},
+        {  53, 104, 184,},
+        {  20,  81, 148,},
+        {   3,  47,  82,},
+        {   1,  18,  28,}
+      }, { /* Coeff Band 2 */
+        {  86, 162, 220,},
+        {  84, 134, 216,},
+        {  26, 102, 186,},
+        {   7,  75, 135,},
+        {   1,  46,  79,},
+        {   1,  20,  35,}
+      }, { /* Coeff Band 3 */
+        {  89, 191, 232,},
+        {  67, 148, 223,},
+        {  19, 105, 183,},
+        {   5,  72, 127,},
+        {   1,  44,  76,},
+        {   1,  21,  36,}
+      }, { /* Coeff Band 4 */
+        {  94, 210, 236,},
+        {  68, 153, 224,},
+        {  14, 103, 178,},
+        {   2,  70, 122,},
+        {   1,  42,  72,},
+        {   1,  19,  34,}
+      }, { /* Coeff Band 5 */
+        {  87, 200, 238,},
+        {  55, 151, 225,},
+        {  11, 106, 179,},
+        {   2,  72, 124,},
+        {   1,  42,  70,},
+        {   1,  17,  28,}
+      }
+    }, { /* Inter */
+      { /* Coeff Band 0 */
+        { 238,  66, 250,},
+        { 178,  84, 226,},
+        {  76,  83, 168,}
+      }, { /* Coeff Band 1 */
+        { 137, 176, 246,},
+        { 176, 160, 237,},
+        {  68, 128, 205,},
+        {  40, 105, 167,},
+        {  22,  84, 131,},
+        {  11,  60,  91,}
+      }, { /* Coeff Band 2 */
+        { 124, 192, 247,},
+        { 103, 161, 234,},
+        {  19, 108, 190,},
+        {   6,  74, 131,},
+        {   1,  41,  72,},
+        {   1,  14,  24,}
+      }, { /* Coeff Band 3 */
+        { 118, 200, 248,},
+        {  91, 166, 235,},
+        {  16, 110, 186,},
+        {   3,  72, 124,},
+        {   1,  39,  66,},
+        {   1,  14,  19,}
+      }, { /* Coeff Band 4 */
+        { 112, 213, 248,},
+        {  80, 172, 234,},
+        {  11, 112, 182,},
+        {   2,  73, 126,},
+        {   1,  40,  69,},
+        {   1,  16,  24,}
+      }, { /* Coeff Band 5 */
+        { 100, 209, 245,},
+        {  65, 164, 232,},
+        {  11, 117, 186,},
+        {   2,  83, 136,},
+        {   1,  55,  88,},
+        {   1,  10,  38,}
+      }
+    }
+  }
+};
+static const vp9_coeff_probs_model default_coef_probs_16x16[BLOCK_TYPES] = {
+  { /* block Type 0 */
+    { /* Intra */
+      { /* Coeff Band 0 */
+        {   8,  26, 101,},
+        {   2,  25,  67,},
+        {   1,  15,  28,}
+      }, { /* Coeff Band 1 */
+        {  22,  73, 118,},
+        {  43,  73, 116,},
+        {  24,  66, 105,},
+        {   9,  54,  85,},
+        {   2,  34,  54,},
+        {   1,  14,  22,}
+      }, { /* Coeff Band 2 */
+        {  34, 123, 149,},
+        {  34, 106, 147,},
+        {  10,  81, 123,},
+        {   2,  56,  87,},
+        {   1,  35,  56,},
+        {   1,  17,  27,}
+      }, { /* Coeff Band 3 */
+        {  27, 159, 171,},
+        {  17, 119, 162,},
+        {   3,  81, 128,},
+        {   1,  53,  87,},
+        {   1,  31,  52,},
+        {   1,  14,  24,}
+      }, { /* Coeff Band 4 */
+        {  24, 189, 200,},
+        {  14, 136, 184,},
+        {   2,  87, 140,},
+        {   1,  54,  90,},
+        {   1,  28,  49,},
+        {   1,  12,  21,}
+      }, { /* Coeff Band 5 */
+        {  32, 220, 227,},
+        {  12, 155, 200,},
+        {   1,  90, 144,},
+        {   1,  53,  90,},
+        {   1,  28,  50,},
+        {   1,  13,  22,}
+      }
+    }, { /* Inter */
+      { /* Coeff Band 0 */
+        {   5,  61, 234,},
+        {   3,  65, 184,},
+        {   1,  56, 104,}
+      }, { /* Coeff Band 1 */
+        {  46, 183, 210,},
+        { 122, 166, 202,},
+        {  49, 125, 177,},
+        {  22,  99, 142,},
+        {   8,  69,  95,},
+        {   2,  38,  51,}
+      }, { /* Coeff Band 2 */
+        {  56, 196, 218,},
+        {  38, 141, 195,},
+        {   7,  93, 147,},
+        {   2,  63, 101,},
+        {   1,  39,  61,},
+        {   1,  20,  33,}
+      }, { /* Coeff Band 3 */
+        {  44, 206, 223,},
+        {  27, 147, 200,},
+        {   4,  93, 147,},
+        {   1,  58,  95,},
+        {   1,  32,  52,},
+        {   1,  14,  23,}
+      }, { /* Coeff Band 4 */
+        {  39, 216, 227,},
+        {  22, 152, 204,},
+        {   2,  92, 148,},
+        {   1,  55,  91,},
+        {   1,  28,  47,},
+        {   1,  13,  21,}
+      }, { /* Coeff Band 5 */
+        {  34, 228, 234,},
+        {  13, 161, 208,},
+        {   1,  95, 148,},
+        {   1,  55,  90,},
+        {   1,  30,  51,},
+        {   1,  16,  25,}
+      }
+    }
+  }, { /* block Type 1 */
+    { /* Intra */
+      { /* Coeff Band 0 */
+        { 204,  33, 217,},
+        {  93,  48, 151,},
+        {  18,  43,  86,}
+      }, { /* Coeff Band 1 */
+        {  43, 121, 184,},
+        {  93, 117, 177,},
+        {  33, 101, 158,},
+        {  11,  81, 129,},
+        {   2,  51,  82,},
+        {   1,  18,  29,}
+      }, { /* Coeff Band 2 */
+        {  63, 154, 199,},
+        {  53, 128, 191,},
+        {  14,  99, 160,},
+        {   4,  75, 122,},
+        {   1,  47,  77,},
+        {   1,  18,  30,}
+      }, { /* Coeff Band 3 */
+        {  48, 193, 210,},
+        {  26, 145, 201,},
+        {   6, 104, 165,},
+        {   1,  73, 120,},
+        {   1,  42,  69,},
+        {   1,  16,  27,}
+      }, { /* Coeff Band 4 */
+        {  47, 213, 225,},
+        {  32, 153, 212,},
+        {   6, 102, 168,},
+        {   1,  66, 111,},
+        {   1,  36,  60,},
+        {   1,  16,  27,}
+      }, { /* Coeff Band 5 */
+        {  46, 225, 232,},
+        {  24, 162, 214,},
+        {   3, 106, 165,},
+        {   1,  66, 108,},
+        {   1,  35,  59,},
+        {   1,  16,  27,}
+      }
+    }, { /* Inter */
+      { /* Coeff Band 0 */
+        { 229,  28, 245,},
+        { 151,  44, 210,},
+        {  55,  48, 131,}
+      }, { /* Coeff Band 1 */
+        { 126, 165, 239,},
+        { 199, 158, 231,},
+        { 102, 136, 209,},
+        {  64, 116, 181,},
+        {  44,  98, 151,},
+        {  44,  81, 119,}
+      }, { /* Coeff Band 2 */
+        { 108, 185, 239,},
+        {  91, 155, 224,},
+        {  20, 116, 185,},
+        {   8,  86, 141,},
+        {   3,  50,  92,},
+        {   1,  21,  40,}
+      }, { /* Coeff Band 3 */
+        {  94, 198, 243,},
+        {  67, 164, 228,},
+        {  14, 120, 185,},
+        {   4,  83, 134,},
+        {   1,  48,  82,},
+        {   1,  26,  38,}
+      }, { /* Coeff Band 4 */
+        {  82, 210, 245,},
+        {  55, 170, 231,},
+        {   8, 118, 184,},
+        {   2,  78, 126,},
+        {   1,  43,  68,},
+        {   1,  34,  40,}
+      }, { /* Coeff Band 5 */
+        {  65, 228, 241,},
+        {  33, 173, 226,},
+        {   5, 120, 180,},
+        {   1,  81, 130,},
+        {   1,  51,  78,},
+        {   1,  18,  49,}
+      }
+    }
+  }
+};
+static const vp9_coeff_probs_model default_coef_probs_32x32[BLOCK_TYPES] = {
+  { /* block Type 0 */
+    { /* Intra */
+      { /* Coeff Band 0 */
+        {  37,  34, 137,},
+        {   3,  26,  60,},
+        {   1,  13,  23,}
+      }, { /* Coeff Band 1 */
+        {  26,  77, 122,},
+        {  43,  76, 123,},
+        {  25,  67, 112,},
+        {   9,  54,  90,},
+        {   2,  32,  52,},
+        {   1,  10,  15,}
+      }, { /* Coeff Band 2 */
+        {  32, 122, 143,},
+        {  46, 105, 143,},
+        {  17,  79, 116,},
+        {   4,  53,  78,},
+        {   1,  29,  44,},
+        {   1,  12,  18,}
+      }, { /* Coeff Band 3 */
+        {  33, 157, 160,},
+        {  20, 116, 152,},
+        {   4,  74, 114,},
+        {   1,  44,  69,},
+        {   1,  25,  40,},
+        {   1,  12,  18,}
+      }, { /* Coeff Band 4 */
+        {  25, 183, 174,},
+        {  13, 124, 159,},
+        {   2,  75, 117,},
+        {   1,  45,  73,},
+        {   1,  26,  43,},
+        {   1,  12,  19,}
+      }, { /* Coeff Band 5 */
+        {  13, 232, 223,},
+        {   4, 155, 187,},
+        {   1,  86, 131,},
+        {   1,  49,  79,},
+        {   1,  26,  43,},
+        {   1,  12,  20,}
+      }
+    }, { /* Inter */
+      { /* Coeff Band 0 */
+        {  51,  37, 227,},
+        {   9,  36, 172,},
+        {  21,  26, 112,}
+      }, { /* Coeff Band 1 */
+        {  79, 169, 219,},
+        { 177, 166, 216,},
+        { 119, 141, 196,},
+        {  63, 117, 165,},
+        {  30,  87, 117,},
+        {  14,  56,  60,}
+      }, { /* Coeff Band 2 */
+        {  88, 195, 225,},
+        {  66, 145, 202,},
+        {  12,  97, 152,},
+        {   3,  66, 103,},
+        {   1,  38,  61,},
+        {   1,  19,  30,}
+      }, { /* Coeff Band 3 */
+        {  79, 211, 228,},
+        {  50, 151, 205,},
+        {   7,  95, 149,},
+        {   1,  62,  98,},
+        {   1,  35,  57,},
+        {   1,  17,  26,}
+      }, { /* Coeff Band 4 */
+        {  68, 225, 230,},
+        {  39, 156, 206,},
+        {   4,  94, 147,},
+        {   1,  58,  94,},
+        {   1,  32,  52,},
+        {   1,  15,  24,}
+      }, { /* Coeff Band 5 */
+        {  45, 248, 234,},
+        {  19, 169, 204,},
+        {   2,  98, 145,},
+        {   1,  59,  92,},
+        {   1,  33,  52,},
+        {   1,  15,  24,}
+      }
+    }
+  }, { /* block Type 1 */
+    { /* Intra */
+      { /* Coeff Band 0 */
+        { 179,  23, 200,},
+        {  60,  33, 113,},
+        {   8,  31,  59,}
+      }, { /* Coeff Band 1 */
+        {  27, 103, 158,},
+        {  90, 101, 159,},
+        {  39,  91, 146,},
+        {  16,  75, 120,},
+        {   3,  48,  76,},
+        {   1,  18,  26,}
+      }, { /* Coeff Band 2 */
+        {  45, 137, 177,},
+        {  47, 117, 167,},
+        {  16,  90, 136,},
+        {   6,  65, 100,},
+        {   1,  37,  58,},
+        {   1,  13,  19,}
+      }, { /* Coeff Band 3 */
+        {  36, 171, 194,},
+        {  19, 129, 178,},
+        {   5,  90, 139,},
+        {   1,  59,  93,},
+        {   1,  31,  49,},
+        {   1,  10,  18,}
+      }, { /* Coeff Band 4 */
+        {  37, 197, 210,},
+        {  20, 142, 191,},
+        {   3,  93, 144,},
+        {   1,  56,  88,},
+        {   1,  29,  47,},
+        {   1,  14,  22,}
+      }, { /* Coeff Band 5 */
+        {  19, 227, 223,},
+        {   6, 152, 192,},
+        {   1,  89, 138,},
+        {   1,  52,  84,},
+        {   1,  29,  47,},
+        {   1,  14,  23,}
+      }
+    }, { /* Inter */
+      { /* Coeff Band 0 */
+        { 205,  14, 245,},
+        {  97,  19, 213,},
+        {  31,  20, 144,}
+      }, { /* Coeff Band 1 */
+        { 137, 182, 245,},
+        { 231, 185, 242,},
+        { 170, 175, 229,},
+        { 107, 157, 213,},
+        {  77, 126, 183,},
+        {  69,  96, 149,}
+      }, { /* Coeff Band 2 */
+        { 107, 196, 241,},
+        {  92, 162, 221,},
+        {  20, 108, 181,},
+        {   7,  80, 132,},
+        {   2,  43,  75,},
+        {   1,  15,  48,}
+      }, { /* Coeff Band 3 */
+        { 107, 202, 244,},
+        {  77, 167, 224,},
+        {  14, 117, 179,},
+        {   3,  84, 134,},
+        {   1,  57,  84,},
+        {   1,   1,   1,}
+      }, { /* Coeff Band 4 */
+        {  88, 219, 248,},
+        {  61, 178, 234,},
+        {   6, 127, 188,},
+        {   1,  83, 130,},
+        {   1,  61,  66,},
+        { 128, 128, 128,}
+      }, { /* Coeff Band 5 */
+        {  73, 243, 250,},
+        {  42, 197, 242,},
+        {  10, 137, 197,},
+        {   2,  85, 134,},
+        {   1,  70,  69,},
+        {   1,   1,   1,}
+      }
+    }
+  }
+};
+#else
 static const vp9_coeff_probs default_coef_probs_4x4[BLOCK_TYPES] = {
   { /* block Type 0 */
     { /* Intra */
@@ -699,3 +1385,4 @@ static const vp9_coeff_probs default_coef_probs_32x32[BLOCK_TYPES] = {
     }
   }
 };
+#endif
index 532e5d3516926e442c9f3a3ff01b4e0d66d817ea..1b1d3421a107c5dc92c04cfcb2c5b0d93f903128 100644 (file)
@@ -408,812 +408,281 @@ static const vp9_prob Pcat6[] = {
 };
 
 #if CONFIG_MODELCOEFPROB
-
-#if UNCONSTRAINED_NODES == 2
-const vp9_prob vp9_modelcoefprobs_gg75[COEFPROB_MODELS][ENTROPY_NODES - 1] = {
-  // Probs generated with a Generalized Gaussian (with shape parameter 0.75)
-  // source model with varying quantizer step size for a uniform quantizer
-  {0,   0,   0,   0,   0,   0,   0,   0,   0,   0,},  // do not use
-  {1,   2,   6,  87, 129,  11,  88,  39,  93,  47,},
-  {2,   4,  11,  88, 130,  21,  89,  68,  98,  79,},
-  {3,   6,  16,  89, 131,  30,  91,  92, 103, 105,},
-  {4,   8,  21,  90, 131,  38,  92, 112, 107, 126,},
-  {5,  10,  26,  90, 132,  46,  94, 129, 111, 143,},
-  {6,  11,  31,  91, 133,  54,  95, 143, 115, 157,},
-  {7,  13,  35,  92, 133,  61,  96, 156, 119, 170,},
-  {8,  15,  40,  93, 134,  68,  97, 167, 123, 180,},
-  {9,  17,  44,  94, 134,  74,  98, 177, 126, 189,},
-  {10,  19,  48,  94, 135,  80, 100, 185, 130, 197,},
-  {11,  20,  52,  95, 135,  86, 101, 192, 133, 204,},
-  {12,  22,  56,  96, 136,  92, 102, 199, 137, 210,},
-  {13,  24,  60,  96, 136,  97, 103, 205, 140, 215,},
-  {14,  26,  64,  97, 137, 103, 104, 210, 143, 219,},
-  {15,  27,  68,  98, 137, 108, 105, 215, 146, 223,},
-  {16,  29,  71,  98, 138, 112, 106, 219, 149, 227,},
-  {17,  31,  75,  99, 138, 117, 107, 223, 152, 230,},
-  {18,  32,  78, 100, 139, 121, 108, 226, 155, 233,},
-  {19,  34,  82, 100, 139, 126, 109, 229, 158, 235,},
-  {20,  36,  85, 101, 140, 130, 110, 231, 161, 238,},
-  {21,  37,  88, 102, 140, 134, 111, 234, 164, 239,},
-  {22,  39,  91, 102, 141, 138, 112, 236, 167, 241,},
-  {23,  40,  94, 103, 141, 141, 113, 238, 169, 243,},
-  {24,  42,  97, 104, 142, 145, 114, 240, 172, 244,},
-  {25,  44, 100, 104, 142, 149, 115, 241, 174, 245,},
-  {26,  45, 103, 105, 143, 152, 116, 243, 177, 246,},
-  {27,  47, 106, 105, 143, 155, 117, 244, 179, 247,},
-  {28,  48, 109, 106, 143, 158, 118, 245, 182, 248,},
-  {29,  50, 112, 107, 144, 161, 119, 246, 184, 249,},
-  {30,  52, 115, 107, 144, 164, 120, 247, 186, 250,},
-  {31,  53, 117, 108, 145, 167, 121, 248, 188, 250,},
-  {32,  55, 120, 109, 145, 170, 122, 249, 190, 251,},
-  {33,  56, 122, 109, 146, 173, 123, 249, 192, 252,},
-  {34,  58, 125, 110, 146, 175, 124, 250, 194, 252,},
-  {35,  59, 127, 110, 147, 178, 125, 251, 196, 252,},
-  {36,  61, 130, 111, 147, 180, 126, 251, 198, 253,},
-  {37,  62, 132, 112, 147, 183, 127, 251, 200, 253,},
-  {38,  64, 135, 112, 148, 185, 128, 252, 202, 253,},
-  {39,  65, 137, 113, 148, 187, 129, 252, 204, 254,},
-  {40,  67, 139, 114, 149, 189, 130, 253, 205, 254,},
-  {41,  68, 141, 114, 149, 191, 131, 253, 207, 254,},
-  {42,  70, 144, 115, 150, 193, 132, 253, 209, 254,},
-  {43,  71, 146, 115, 150, 195, 133, 254, 210, 254,},
-  {44,  72, 148, 116, 151, 197, 134, 254, 212, 255,},
-  {45,  74, 150, 117, 151, 199, 135, 254, 213, 255,},
-  {46,  75, 152, 117, 151, 201, 136, 254, 215, 255,},
-  {47,  77, 154, 118, 152, 202, 137, 254, 216, 255,},
-  {48,  78, 156, 119, 152, 204, 138, 254, 217, 255,},
-  {49,  80, 158, 119, 153, 206, 139, 255, 219, 255,},
-  {50,  81, 160, 120, 153, 207, 140, 255, 220, 255,},
-  {51,  82, 162, 120, 154, 209, 141, 255, 221, 255,},
-  {52,  84, 164, 121, 154, 210, 142, 255, 222, 255,},
-  {53,  85, 165, 122, 155, 212, 143, 255, 224, 255,},
-  {54,  87, 167, 122, 155, 213, 144, 255, 225, 255,},
-  {55,  88, 169, 123, 155, 215, 145, 255, 226, 255,},
-  {56,  89, 171, 124, 156, 216, 146, 255, 227, 255,},
-  {57,  91, 172, 124, 156, 217, 146, 255, 228, 255,},
-  {58,  92, 174, 125, 157, 218, 147, 255, 229, 255,},
-  {59,  93, 176, 126, 157, 220, 148, 255, 230, 255,},
-  {60,  95, 177, 126, 158, 221, 149, 255, 231, 255,},
-  {61,  96, 179, 127, 158, 222, 150, 255, 232, 255,},
-  {62,  97, 180, 127, 159, 223, 151, 255, 232, 255,},
-  {63,  99, 182, 128, 159, 224, 152, 255, 233, 255,},
-  {64, 100, 183, 129, 159, 225, 153, 255, 234, 255,},
-  {65, 101, 185, 129, 160, 226, 154, 255, 235, 255,},
-  {66, 103, 186, 130, 160, 227, 155, 255, 236, 255,},
-  {67, 104, 188, 131, 161, 228, 156, 255, 236, 255,},
-  {68, 105, 189, 131, 161, 229, 157, 255, 237, 255,},
-  {69, 106, 190, 132, 162, 230, 158, 255, 238, 255,},
-  {70, 108, 192, 133, 162, 231, 159, 255, 238, 255,},
-  {71, 109, 193, 133, 162, 231, 159, 255, 239, 255,},
-  {72, 110, 194, 134, 163, 232, 160, 255, 240, 255,},
-  {73, 111, 196, 134, 163, 233, 161, 255, 240, 255,},
-  {74, 113, 197, 135, 164, 234, 162, 255, 241, 255,},
-  {75, 114, 198, 136, 164, 235, 163, 255, 241, 255,},
-  {76, 115, 199, 136, 165, 235, 164, 255, 242, 255,},
-  {77, 116, 200, 137, 165, 236, 165, 255, 243, 255,},
-  {78, 118, 202, 138, 166, 237, 166, 255, 243, 255,},
-  {79, 119, 203, 138, 166, 237, 167, 255, 244, 255,},
-  {80, 120, 204, 139, 167, 238, 168, 255, 244, 255,},
-  {81, 121, 205, 140, 167, 239, 168, 255, 244, 255,},
-  {82, 123, 206, 140, 167, 239, 169, 255, 245, 255,},
-  {83, 124, 207, 141, 168, 240, 170, 255, 245, 255,},
-  {84, 125, 208, 142, 168, 240, 171, 255, 246, 255,},
-  {85, 126, 209, 142, 169, 241, 172, 255, 246, 255,},
-  {86, 127, 210, 143, 169, 241, 173, 255, 247, 255,},
-  {87, 129, 211, 144, 170, 242, 174, 255, 247, 255,},
-  {88, 130, 212, 144, 170, 242, 175, 255, 247, 255,},
-  {89, 131, 213, 145, 171, 243, 175, 255, 248, 255,},
-  {90, 132, 214, 146, 171, 243, 176, 255, 248, 255,},
-  {91, 133, 215, 146, 171, 244, 177, 255, 248, 255,},
-  {92, 134, 216, 147, 172, 244, 178, 255, 249, 255,},
-  {93, 136, 217, 148, 172, 245, 179, 255, 249, 255,},
-  {94, 137, 218, 148, 173, 245, 180, 255, 249, 255,},
-  {95, 138, 219, 149, 173, 245, 181, 255, 249, 255,},
-  {96, 139, 220, 150, 174, 246, 181, 255, 250, 255,},
-  {97, 140, 220, 150, 174, 246, 182, 255, 250, 255,},
-  {98, 141, 221, 151, 175, 247, 183, 255, 250, 255,},
-  {99, 142, 222, 152, 175, 247, 184, 255, 250, 255,},
-  {100, 144, 223, 152, 176, 247, 185, 255, 251, 255,},
-  {101, 145, 224, 153, 176, 248, 186, 255, 251, 255,},
-  {102, 146, 224, 154, 177, 248, 186, 255, 251, 255,},
-  {103, 147, 225, 154, 177, 248, 187, 255, 251, 255,},
-  {104, 148, 226, 155, 177, 248, 188, 255, 252, 255,},
-  {105, 149, 226, 156, 178, 249, 189, 255, 252, 255,},
-  {106, 150, 227, 156, 178, 249, 190, 255, 252, 255,},
-  {107, 151, 228, 157, 179, 249, 191, 255, 252, 255,},
-  {108, 152, 229, 158, 179, 250, 191, 255, 252, 255,},
-  {109, 153, 229, 158, 180, 250, 192, 255, 252, 255,},
-  {110, 154, 230, 159, 180, 250, 193, 255, 253, 255,},
-  {111, 155, 231, 160, 181, 250, 194, 255, 253, 255,},
-  {112, 157, 231, 160, 181, 251, 195, 255, 253, 255,},
-  {113, 158, 232, 161, 182, 251, 195, 255, 253, 255,},
-  {114, 159, 232, 162, 182, 251, 196, 255, 253, 255,},
-  {115, 160, 233, 162, 183, 251, 197, 255, 253, 255,},
-  {116, 161, 234, 163, 183, 251, 198, 255, 253, 255,},
-  {117, 162, 234, 164, 184, 252, 198, 255, 254, 255,},
-  {118, 163, 235, 165, 184, 252, 199, 255, 254, 255,},
-  {119, 164, 235, 165, 185, 252, 200, 255, 254, 255,},
-  {120, 165, 236, 166, 185, 252, 201, 255, 254, 255,},
-  {121, 166, 236, 167, 186, 252, 201, 255, 254, 255,},
-  {122, 167, 237, 167, 186, 252, 202, 255, 254, 255,},
-  {123, 168, 237, 168, 186, 253, 203, 255, 254, 255,},
-  {124, 169, 238, 169, 187, 253, 204, 255, 254, 255,},
-  {125, 170, 238, 169, 187, 253, 204, 255, 254, 255,},
-  {126, 171, 239, 170, 188, 253, 205, 255, 254, 255,},
-  {127, 172, 239, 171, 188, 253, 206, 255, 254, 255,},
-  {128, 173, 240, 171, 189, 253, 207, 255, 255, 255,},
-  {129, 174, 240, 172, 189, 253, 207, 255, 255, 255,},
-  {130, 175, 241, 173, 190, 253, 208, 255, 255, 255,},
-  {131, 176, 241, 174, 190, 254, 209, 255, 255, 255,},
-  {132, 177, 241, 174, 191, 254, 209, 255, 255, 255,},
-  {133, 178, 242, 175, 191, 254, 210, 255, 255, 255,},
-  {134, 179, 242, 176, 192, 254, 211, 255, 255, 255,},
-  {135, 180, 243, 176, 192, 254, 212, 255, 255, 255,},
-  {136, 180, 243, 177, 193, 254, 212, 255, 255, 255,},
-  {137, 181, 243, 178, 193, 254, 213, 255, 255, 255,},
-  {138, 182, 244, 179, 194, 254, 214, 255, 255, 255,},
-  {139, 183, 244, 179, 194, 254, 214, 255, 255, 255,},
-  {140, 184, 244, 180, 195, 254, 215, 255, 255, 255,},
-  {141, 185, 245, 181, 195, 254, 216, 255, 255, 255,},
-  {142, 186, 245, 181, 196, 255, 216, 255, 255, 255,},
-  {143, 187, 245, 182, 196, 255, 217, 255, 255, 255,},
-  {144, 188, 246, 183, 197, 255, 218, 255, 255, 255,},
-  {145, 189, 246, 183, 197, 255, 218, 255, 255, 255,},
-  {146, 190, 246, 184, 198, 255, 219, 255, 255, 255,},
-  {147, 191, 247, 185, 198, 255, 220, 255, 255, 255,},
-  {148, 191, 247, 186, 199, 255, 220, 255, 255, 255,},
-  {149, 192, 247, 186, 199, 255, 221, 255, 255, 255,},
-  {150, 193, 248, 187, 200, 255, 221, 255, 255, 255,},
-  {151, 194, 248, 188, 200, 255, 222, 255, 255, 255,},
-  {152, 195, 248, 188, 201, 255, 223, 255, 255, 255,},
-  {153, 196, 248, 189, 201, 255, 223, 255, 255, 255,},
-  {154, 197, 249, 190, 202, 255, 224, 255, 255, 255,},
-  {155, 198, 249, 191, 202, 255, 224, 255, 255, 255,},
-  {156, 198, 249, 191, 203, 255, 225, 255, 255, 255,},
-  {157, 199, 249, 192, 203, 255, 226, 255, 255, 255,},
-  {158, 200, 250, 193, 204, 255, 226, 255, 255, 255,},
-  {159, 201, 250, 193, 204, 255, 227, 255, 255, 255,},
-  {160, 202, 250, 194, 205, 255, 227, 255, 255, 255,},
-  {161, 203, 250, 195, 206, 255, 228, 255, 255, 255,},
-  {162, 203, 250, 196, 206, 255, 228, 255, 255, 255,},
-  {163, 204, 251, 196, 207, 255, 229, 255, 255, 255,},
-  {164, 205, 251, 197, 207, 255, 229, 255, 255, 255,},
-  {165, 206, 251, 198, 208, 255, 230, 255, 255, 255,},
-  {166, 207, 251, 198, 208, 255, 231, 255, 255, 255,},
-  {167, 207, 251, 199, 209, 255, 231, 255, 255, 255,},
-  {168, 208, 252, 200, 209, 255, 232, 255, 255, 255,},
-  {169, 209, 252, 201, 210, 255, 232, 255, 255, 255,},
-  {170, 210, 252, 201, 210, 255, 233, 255, 255, 255,},
-  {171, 211, 252, 202, 211, 255, 233, 255, 255, 255,},
-  {172, 211, 252, 203, 211, 255, 234, 255, 255, 255,},
-  {173, 212, 252, 203, 212, 255, 234, 255, 255, 255,},
-  {174, 213, 252, 204, 212, 255, 235, 255, 255, 255,},
-  {175, 214, 253, 205, 213, 255, 235, 255, 255, 255,},
-  {176, 214, 253, 206, 213, 255, 236, 255, 255, 255,},
-  {177, 215, 253, 206, 214, 255, 236, 255, 255, 255,},
-  {178, 216, 253, 207, 214, 255, 237, 255, 255, 255,},
-  {179, 217, 253, 208, 215, 255, 237, 255, 255, 255,},
-  {180, 217, 253, 208, 216, 255, 237, 255, 255, 255,},
-  {181, 218, 253, 209, 216, 255, 238, 255, 255, 255,},
-  {182, 219, 254, 210, 217, 255, 238, 255, 255, 255,},
-  {183, 220, 254, 211, 217, 255, 239, 255, 255, 255,},
-  {184, 220, 254, 211, 218, 255, 239, 255, 255, 255,},
-  {185, 221, 254, 212, 218, 255, 240, 255, 255, 255,},
-  {186, 222, 254, 213, 219, 255, 240, 255, 255, 255,},
-  {187, 222, 254, 213, 219, 255, 241, 255, 255, 255,},
-  {188, 223, 254, 214, 220, 255, 241, 255, 255, 255,},
-  {189, 224, 254, 215, 220, 255, 241, 255, 255, 255,},
-  {190, 225, 254, 215, 221, 255, 242, 255, 255, 255,},
-  {191, 225, 254, 216, 221, 255, 242, 255, 255, 255,},
-  {192, 226, 254, 217, 222, 255, 243, 255, 255, 255,},
-  {193, 227, 255, 218, 223, 255, 243, 255, 255, 255,},
-  {194, 227, 255, 218, 223, 255, 243, 255, 255, 255,},
-  {195, 228, 255, 219, 224, 255, 244, 255, 255, 255,},
-  {196, 229, 255, 220, 224, 255, 244, 255, 255, 255,},
-  {197, 229, 255, 220, 225, 255, 244, 255, 255, 255,},
-  {198, 230, 255, 221, 225, 255, 245, 255, 255, 255,},
-  {199, 230, 255, 222, 226, 255, 245, 255, 255, 255,},
-  {200, 231, 255, 222, 226, 255, 246, 255, 255, 255,},
-  {201, 232, 255, 223, 227, 255, 246, 255, 255, 255,},
-  {202, 232, 255, 224, 228, 255, 246, 255, 255, 255,},
-  {203, 233, 255, 224, 228, 255, 247, 255, 255, 255,},
-  {204, 234, 255, 225, 229, 255, 247, 255, 255, 255,},
-  {205, 234, 255, 226, 229, 255, 247, 255, 255, 255,},
-  {206, 235, 255, 227, 230, 255, 248, 255, 255, 255,},
-  {207, 235, 255, 227, 230, 255, 248, 255, 255, 255,},
-  {208, 236, 255, 228, 231, 255, 248, 255, 255, 255,},
-  {209, 237, 255, 229, 231, 255, 248, 255, 255, 255,},
-  {210, 237, 255, 229, 232, 255, 249, 255, 255, 255,},
-  {211, 238, 255, 230, 233, 255, 249, 255, 255, 255,},
-  {212, 238, 255, 231, 233, 255, 249, 255, 255, 255,},
-  {213, 239, 255, 231, 234, 255, 250, 255, 255, 255,},
-  {214, 239, 255, 232, 234, 255, 250, 255, 255, 255,},
-  {215, 240, 255, 233, 235, 255, 250, 255, 255, 255,},
-  {216, 241, 255, 233, 235, 255, 250, 255, 255, 255,},
-  {217, 241, 255, 234, 236, 255, 251, 255, 255, 255,},
-  {218, 242, 255, 235, 236, 255, 251, 255, 255, 255,},
-  {219, 242, 255, 235, 237, 255, 251, 255, 255, 255,},
-  {220, 243, 255, 236, 237, 255, 251, 255, 255, 255,},
-  {221, 243, 255, 236, 238, 255, 252, 255, 255, 255,},
-  {222, 244, 255, 237, 239, 255, 252, 255, 255, 255,},
-  {223, 244, 255, 238, 239, 255, 252, 255, 255, 255,},
-  {224, 245, 255, 238, 240, 255, 252, 255, 255, 255,},
-  {225, 245, 255, 239, 240, 255, 252, 255, 255, 255,},
-  {226, 246, 255, 240, 241, 255, 253, 255, 255, 255,},
-  {227, 246, 255, 240, 241, 255, 253, 255, 255, 255,},
-  {228, 247, 255, 241, 242, 255, 253, 255, 255, 255,},
-  {229, 247, 255, 242, 242, 255, 253, 255, 255, 255,},
-  {230, 248, 255, 242, 243, 255, 253, 255, 255, 255,},
-  {231, 248, 255, 243, 244, 255, 254, 255, 255, 255,},
-  {232, 248, 255, 243, 244, 255, 254, 255, 255, 255,},
-  {233, 249, 255, 244, 245, 255, 254, 255, 255, 255,},
-  {234, 249, 255, 245, 245, 255, 254, 255, 255, 255,},
-  {235, 250, 255, 245, 246, 255, 254, 255, 255, 255,},
-  {236, 250, 255, 246, 246, 255, 254, 255, 255, 255,},
-  {237, 251, 255, 246, 247, 255, 255, 255, 255, 255,},
-  {238, 251, 255, 247, 247, 255, 255, 255, 255, 255,},
-  {239, 251, 255, 248, 248, 255, 255, 255, 255, 255,},
-  {240, 252, 255, 248, 248, 255, 255, 255, 255, 255,},
-  {241, 252, 255, 249, 249, 255, 255, 255, 255, 255,},
-  {242, 252, 255, 249, 249, 255, 255, 255, 255, 255,},
-  {243, 253, 255, 250, 250, 255, 255, 255, 255, 255,},
-  {244, 253, 255, 250, 250, 255, 255, 255, 255, 255,},
-  {245, 253, 255, 251, 251, 255, 255, 255, 255, 255,},
-  {246, 254, 255, 251, 251, 255, 255, 255, 255, 255,},
-  {247, 254, 255, 252, 252, 255, 255, 255, 255, 255,},
-  {248, 254, 255, 252, 252, 255, 255, 255, 255, 255,},
-  {249, 255, 255, 253, 253, 255, 255, 255, 255, 255,},
-  {250, 255, 255, 253, 253, 255, 255, 255, 255, 255,},
-  {251, 255, 255, 254, 254, 255, 255, 255, 255, 255,},
-  {252, 255, 255, 254, 254, 255, 255, 255, 255, 255,},
-  {253, 255, 255, 255, 255, 255, 255, 255, 255, 255,},
-  {254, 255, 255, 255, 255, 255, 255, 255, 255, 255,},
-  {255, 255, 255, 255, 255, 255, 255, 255, 255, 255,}
-};
-
-const vp9_prob vp9_modelcoefprobs_gg625[COEFPROB_MODELS][ENTROPY_NODES - 1] = {
-  // Probs generated with a Generalized Gaussian (with shape parameter 0.625)
-  // source model with varying quantizer step size for a uniform quantizer
-  {0,   0,   0,   0,   0,   0,   0,   0,   0,   0,},  // do not use
-  {1,   2,   6,  88, 130,  10,  88,  35,  94,  40,},
-  {2,   4,  11,  89, 131,  19,  90,  60,  99,  67,},
-  {3,   6,  15,  90, 132,  27,  92,  80, 103,  88,},
-  {4,   7,  20,  91, 132,  34,  93,  97, 107, 105,},
-  {5,   9,  24,  92, 133,  41,  94, 112, 110, 120,},
-  {6,  11,  28,  93, 134,  48,  95, 125, 113, 132,},
-  {7,  13,  33,  93, 134,  54,  97, 136, 116, 143,},
-  {8,  14,  36,  94, 135,  60,  98, 146, 119, 152,},
-  {9,  16,  40,  95, 135,  65,  99, 155, 122, 161,},
-  {10,  18,  44,  95, 136,  70, 100, 163, 125, 168,},
-  {11,  19,  48,  96, 136,  75, 101, 170, 127, 175,},
-  {12,  21,  51,  97, 137,  80, 102, 176, 130, 181,},
-  {13,  23,  55,  97, 137,  85, 102, 182, 132, 187,},
-  {14,  24,  58,  98, 138,  89, 103, 188, 135, 192,},
-  {15,  26,  61,  99, 138,  94, 104, 193, 137, 196,},
-  {16,  27,  64,  99, 139,  98, 105, 197, 140, 201,},
-  {17,  29,  67, 100, 139, 102, 106, 201, 142, 205,},
-  {18,  30,  70, 101, 140, 106, 107, 205, 144, 208,},
-  {19,  32,  73, 101, 140, 109, 108, 209, 146, 211,},
-  {20,  34,  76, 102, 140, 113, 109, 212, 148, 214,},
-  {21,  35,  79, 102, 141, 116, 109, 215, 151, 217,},
-  {22,  37,  82, 103, 141, 120, 110, 218, 153, 220,},
-  {23,  38,  85, 103, 142, 123, 111, 220, 155, 222,},
-  {24,  40,  87, 104, 142, 126, 112, 223, 157, 224,},
-  {25,  41,  90, 105, 143, 129, 113, 225, 159, 226,},
-  {26,  42,  93, 105, 143, 132, 113, 227, 161, 228,},
-  {27,  44,  95, 106, 143, 135, 114, 229, 162, 230,},
-  {28,  45,  98, 106, 144, 138, 115, 230, 164, 232,},
-  {29,  47, 100, 107, 144, 141, 116, 232, 166, 233,},
-  {30,  48, 103, 107, 145, 144, 117, 234, 168, 235,},
-  {31,  50, 105, 108, 145, 146, 117, 235, 170, 236,},
-  {32,  51, 107, 108, 145, 149, 118, 236, 171, 237,},
-  {33,  52, 110, 109, 146, 151, 119, 238, 173, 238,},
-  {34,  54, 112, 110, 146, 154, 120, 239, 175, 239,},
-  {35,  55, 114, 110, 147, 156, 120, 240, 176, 240,},
-  {36,  57, 116, 111, 147, 158, 121, 241, 178, 241,},
-  {37,  58, 119, 111, 147, 161, 122, 242, 180, 242,},
-  {38,  59, 121, 112, 148, 163, 123, 243, 181, 243,},
-  {39,  61, 123, 112, 148, 165, 123, 244, 183, 244,},
-  {40,  62, 125, 113, 148, 167, 124, 244, 184, 245,},
-  {41,  63, 127, 113, 149, 169, 125, 245, 186, 245,},
-  {42,  65, 129, 114, 149, 171, 126, 246, 187, 246,},
-  {43,  66, 131, 114, 150, 173, 126, 246, 188, 247,},
-  {44,  67, 133, 115, 150, 175, 127, 247, 190, 247,},
-  {45,  69, 135, 115, 150, 177, 128, 247, 191, 248,},
-  {46,  70, 136, 116, 151, 178, 129, 248, 193, 248,},
-  {47,  71, 138, 116, 151, 180, 129, 248, 194, 249,},
-  {48,  73, 140, 117, 151, 182, 130, 249, 195, 249,},
-  {49,  74, 142, 118, 152, 184, 131, 249, 197, 250,},
-  {50,  75, 144, 118, 152, 185, 131, 250, 198, 250,},
-  {51,  76, 145, 119, 153, 187, 132, 250, 199, 250,},
-  {52,  78, 147, 119, 153, 188, 133, 251, 200, 251,},
-  {53,  79, 149, 120, 153, 190, 134, 251, 201, 251,},
-  {54,  80, 151, 120, 154, 192, 134, 251, 203, 251,},
-  {55,  82, 152, 121, 154, 193, 135, 251, 204, 252,},
-  {56,  83, 154, 121, 154, 194, 136, 252, 205, 252,},
-  {57,  84, 155, 122, 155, 196, 136, 252, 206, 252,},
-  {58,  85, 157, 122, 155, 197, 137, 252, 207, 252,},
-  {59,  86, 158, 123, 156, 199, 138, 252, 208, 252,},
-  {60,  88, 160, 123, 156, 200, 139, 253, 209, 253,},
-  {61,  89, 162, 124, 156, 201, 139, 253, 210, 253,},
-  {62,  90, 163, 124, 157, 202, 140, 253, 211, 253,},
-  {63,  91, 164, 125, 157, 204, 141, 253, 212, 253,},
-  {64,  93, 166, 125, 157, 205, 141, 253, 213, 253,},
-  {65,  94, 167, 126, 158, 206, 142, 254, 214, 254,},
-  {66,  95, 169, 126, 158, 207, 143, 254, 215, 254,},
-  {67,  96, 170, 127, 158, 208, 143, 254, 216, 254,},
-  {68,  97, 172, 127, 159, 209, 144, 254, 217, 254,},
-  {69,  98, 173, 128, 159, 210, 145, 254, 218, 254,},
-  {70, 100, 174, 128, 160, 212, 146, 254, 219, 254,},
-  {71, 101, 176, 129, 160, 213, 146, 254, 220, 254,},
-  {72, 102, 177, 130, 160, 214, 147, 254, 220, 254,},
-  {73, 103, 178, 130, 161, 215, 148, 255, 221, 255,},
-  {74, 104, 179, 131, 161, 216, 148, 255, 222, 255,},
-  {75, 105, 181, 131, 161, 217, 149, 255, 223, 255,},
-  {76, 107, 182, 132, 162, 217, 150, 255, 224, 255,},
-  {77, 108, 183, 132, 162, 218, 150, 255, 224, 255,},
-  {78, 109, 184, 133, 163, 219, 151, 255, 225, 255,},
-  {79, 110, 185, 133, 163, 220, 152, 255, 226, 255,},
-  {80, 111, 187, 134, 163, 221, 153, 255, 227, 255,},
-  {81, 112, 188, 134, 164, 222, 153, 255, 227, 255,},
-  {82, 113, 189, 135, 164, 223, 154, 255, 228, 255,},
-  {83, 115, 190, 135, 164, 223, 155, 255, 229, 255,},
-  {84, 116, 191, 136, 165, 224, 155, 255, 229, 255,},
-  {85, 117, 192, 136, 165, 225, 156, 255, 230, 255,},
-  {86, 118, 193, 137, 165, 226, 157, 255, 231, 255,},
-  {87, 119, 194, 137, 166, 226, 157, 255, 231, 255,},
-  {88, 120, 195, 138, 166, 227, 158, 255, 232, 255,},
-  {89, 121, 196, 139, 167, 228, 159, 255, 232, 255,},
-  {90, 122, 197, 139, 167, 229, 159, 255, 233, 255,},
-  {91, 123, 198, 140, 167, 229, 160, 255, 234, 255,},
-  {92, 124, 199, 140, 168, 230, 161, 255, 234, 255,},
-  {93, 125, 200, 141, 168, 231, 162, 255, 235, 255,},
-  {94, 127, 201, 141, 168, 231, 162, 255, 235, 255,},
-  {95, 128, 202, 142, 169, 232, 163, 255, 236, 255,},
-  {96, 129, 203, 142, 169, 232, 164, 255, 236, 255,},
-  {97, 130, 204, 143, 170, 233, 164, 255, 237, 255,},
-  {98, 131, 205, 143, 170, 234, 165, 255, 237, 255,},
-  {99, 132, 206, 144, 170, 234, 166, 255, 238, 255,},
-  {100, 133, 207, 144, 171, 235, 166, 255, 238, 255,},
-  {101, 134, 208, 145, 171, 235, 167, 255, 239, 255,},
-  {102, 135, 209, 146, 171, 236, 168, 255, 239, 255,},
-  {103, 136, 209, 146, 172, 236, 168, 255, 240, 255,},
-  {104, 137, 210, 147, 172, 237, 169, 255, 240, 255,},
-  {105, 138, 211, 147, 173, 237, 170, 255, 240, 255,},
-  {106, 139, 212, 148, 173, 238, 170, 255, 241, 255,},
-  {107, 140, 213, 148, 173, 238, 171, 255, 241, 255,},
-  {108, 141, 213, 149, 174, 239, 172, 255, 242, 255,},
-  {109, 142, 214, 149, 174, 239, 172, 255, 242, 255,},
-  {110, 143, 215, 150, 175, 240, 173, 255, 242, 255,},
-  {111, 144, 216, 151, 175, 240, 174, 255, 243, 255,},
-  {112, 145, 217, 151, 175, 240, 174, 255, 243, 255,},
-  {113, 146, 217, 152, 176, 241, 175, 255, 244, 255,},
-  {114, 147, 218, 152, 176, 241, 176, 255, 244, 255,},
-  {115, 148, 219, 153, 176, 242, 177, 255, 244, 255,},
-  {116, 149, 219, 153, 177, 242, 177, 255, 245, 255,},
-  {117, 150, 220, 154, 177, 242, 178, 255, 245, 255,},
-  {118, 151, 221, 155, 178, 243, 179, 255, 245, 255,},
-  {119, 152, 222, 155, 178, 243, 179, 255, 245, 255,},
-  {120, 153, 222, 156, 178, 244, 180, 255, 246, 255,},
-  {121, 154, 223, 156, 179, 244, 181, 255, 246, 255,},
-  {122, 155, 224, 157, 179, 244, 181, 255, 246, 255,},
-  {123, 156, 224, 157, 180, 245, 182, 255, 247, 255,},
-  {124, 157, 225, 158, 180, 245, 183, 255, 247, 255,},
-  {125, 158, 225, 159, 180, 245, 183, 255, 247, 255,},
-  {126, 159, 226, 159, 181, 246, 184, 255, 247, 255,},
-  {127, 160, 227, 160, 181, 246, 185, 255, 248, 255,},
-  {128, 161, 227, 160, 182, 246, 185, 255, 248, 255,},
-  {129, 162, 228, 161, 182, 246, 186, 255, 248, 255,},
-  {130, 163, 228, 161, 182, 247, 187, 255, 248, 255,},
-  {131, 164, 229, 162, 183, 247, 187, 255, 249, 255,},
-  {132, 165, 230, 163, 183, 247, 188, 255, 249, 255,},
-  {133, 166, 230, 163, 184, 248, 189, 255, 249, 255,},
-  {134, 166, 231, 164, 184, 248, 189, 255, 249, 255,},
-  {135, 167, 231, 164, 184, 248, 190, 255, 250, 255,},
-  {136, 168, 232, 165, 185, 248, 191, 255, 250, 255,},
-  {137, 169, 232, 166, 185, 248, 191, 255, 250, 255,},
-  {138, 170, 233, 166, 186, 249, 192, 255, 250, 255,},
-  {139, 171, 233, 167, 186, 249, 192, 255, 250, 255,},
-  {140, 172, 234, 167, 187, 249, 193, 255, 251, 255,},
-  {141, 173, 234, 168, 187, 249, 194, 255, 251, 255,},
-  {142, 174, 235, 169, 187, 250, 194, 255, 251, 255,},
-  {143, 175, 235, 169, 188, 250, 195, 255, 251, 255,},
-  {144, 176, 236, 170, 188, 250, 196, 255, 251, 255,},
-  {145, 177, 236, 170, 189, 250, 196, 255, 251, 255,},
-  {146, 177, 237, 171, 189, 250, 197, 255, 252, 255,},
-  {147, 178, 237, 172, 189, 251, 198, 255, 252, 255,},
-  {148, 179, 238, 172, 190, 251, 198, 255, 252, 255,},
-  {149, 180, 238, 173, 190, 251, 199, 255, 252, 255,},
-  {150, 181, 238, 173, 191, 251, 200, 255, 252, 255,},
-  {151, 182, 239, 174, 191, 251, 200, 255, 252, 255,},
-  {152, 183, 239, 175, 192, 251, 201, 255, 252, 255,},
-  {153, 184, 240, 175, 192, 252, 202, 255, 252, 255,},
-  {154, 184, 240, 176, 193, 252, 202, 255, 253, 255,},
-  {155, 185, 240, 177, 193, 252, 203, 255, 253, 255,},
-  {156, 186, 241, 177, 193, 252, 203, 255, 253, 255,},
-  {157, 187, 241, 178, 194, 252, 204, 255, 253, 255,},
-  {158, 188, 242, 178, 194, 252, 205, 255, 253, 255,},
-  {159, 189, 242, 179, 195, 252, 205, 255, 253, 255,},
-  {160, 190, 242, 180, 195, 253, 206, 255, 253, 255,},
-  {161, 190, 243, 180, 196, 253, 207, 255, 253, 255,},
-  {162, 191, 243, 181, 196, 253, 207, 255, 254, 255,},
-  {163, 192, 243, 182, 197, 253, 208, 255, 254, 255,},
-  {164, 193, 244, 182, 197, 253, 209, 255, 254, 255,},
-  {165, 194, 244, 183, 197, 253, 209, 255, 254, 255,},
-  {166, 195, 244, 184, 198, 253, 210, 255, 254, 255,},
-  {167, 196, 245, 184, 198, 253, 210, 255, 254, 255,},
-  {168, 196, 245, 185, 199, 253, 211, 255, 254, 255,},
-  {169, 197, 245, 186, 199, 254, 212, 255, 254, 255,},
-  {170, 198, 246, 186, 200, 254, 212, 255, 254, 255,},
-  {171, 199, 246, 187, 200, 254, 213, 255, 254, 255,},
-  {172, 200, 246, 188, 201, 254, 214, 255, 254, 255,},
-  {173, 200, 246, 188, 201, 254, 214, 255, 254, 255,},
-  {174, 201, 247, 189, 202, 254, 215, 255, 254, 255,},
-  {175, 202, 247, 189, 202, 254, 215, 255, 255, 255,},
-  {176, 203, 247, 190, 203, 254, 216, 255, 255, 255,},
-  {177, 204, 248, 191, 203, 254, 217, 255, 255, 255,},
-  {178, 204, 248, 191, 204, 254, 217, 255, 255, 255,},
-  {179, 205, 248, 192, 204, 254, 218, 255, 255, 255,},
-  {180, 206, 248, 193, 204, 254, 218, 255, 255, 255,},
-  {181, 207, 249, 194, 205, 255, 219, 255, 255, 255,},
-  {182, 208, 249, 194, 205, 255, 220, 255, 255, 255,},
-  {183, 208, 249, 195, 206, 255, 220, 255, 255, 255,},
-  {184, 209, 249, 196, 206, 255, 221, 255, 255, 255,},
-  {185, 210, 250, 196, 207, 255, 221, 255, 255, 255,},
-  {186, 211, 250, 197, 207, 255, 222, 255, 255, 255,},
-  {187, 211, 250, 198, 208, 255, 223, 255, 255, 255,},
-  {188, 212, 250, 198, 208, 255, 223, 255, 255, 255,},
-  {189, 213, 250, 199, 209, 255, 224, 255, 255, 255,},
-  {190, 214, 251, 200, 209, 255, 224, 255, 255, 255,},
-  {191, 215, 251, 200, 210, 255, 225, 255, 255, 255,},
-  {192, 215, 251, 201, 211, 255, 225, 255, 255, 255,},
-  {193, 216, 251, 202, 211, 255, 226, 255, 255, 255,},
-  {194, 217, 251, 203, 212, 255, 227, 255, 255, 255,},
-  {195, 218, 252, 203, 212, 255, 227, 255, 255, 255,},
-  {196, 218, 252, 204, 213, 255, 228, 255, 255, 255,},
-  {197, 219, 252, 205, 213, 255, 228, 255, 255, 255,},
-  {198, 220, 252, 205, 214, 255, 229, 255, 255, 255,},
-  {199, 221, 252, 206, 214, 255, 229, 255, 255, 255,},
-  {200, 221, 252, 207, 215, 255, 230, 255, 255, 255,},
-  {201, 222, 252, 208, 215, 255, 231, 255, 255, 255,},
-  {202, 223, 253, 208, 216, 255, 231, 255, 255, 255,},
-  {203, 223, 253, 209, 216, 255, 232, 255, 255, 255,},
-  {204, 224, 253, 210, 217, 255, 232, 255, 255, 255,},
-  {205, 225, 253, 211, 218, 255, 233, 255, 255, 255,},
-  {206, 226, 253, 211, 218, 255, 233, 255, 255, 255,},
-  {207, 226, 253, 212, 219, 255, 234, 255, 255, 255,},
-  {208, 227, 253, 213, 219, 255, 234, 255, 255, 255,},
-  {209, 228, 254, 214, 220, 255, 235, 255, 255, 255,},
-  {210, 228, 254, 214, 220, 255, 236, 255, 255, 255,},
-  {211, 229, 254, 215, 221, 255, 236, 255, 255, 255,},
-  {212, 230, 254, 216, 222, 255, 237, 255, 255, 255,},
-  {213, 230, 254, 217, 222, 255, 237, 255, 255, 255,},
-  {214, 231, 254, 217, 223, 255, 238, 255, 255, 255,},
-  {215, 232, 254, 218, 223, 255, 238, 255, 255, 255,},
-  {216, 233, 254, 219, 224, 255, 239, 255, 255, 255,},
-  {217, 233, 254, 220, 225, 255, 239, 255, 255, 255,},
-  {218, 234, 255, 220, 225, 255, 240, 255, 255, 255,},
-  {219, 235, 255, 221, 226, 255, 240, 255, 255, 255,},
-  {220, 235, 255, 222, 226, 255, 241, 255, 255, 255,},
-  {221, 236, 255, 223, 227, 255, 241, 255, 255, 255,},
-  {222, 237, 255, 224, 228, 255, 242, 255, 255, 255,},
-  {223, 237, 255, 224, 228, 255, 242, 255, 255, 255,},
-  {224, 238, 255, 225, 229, 255, 243, 255, 255, 255,},
-  {225, 238, 255, 226, 230, 255, 243, 255, 255, 255,},
-  {226, 239, 255, 227, 230, 255, 244, 255, 255, 255,},
-  {227, 240, 255, 228, 231, 255, 244, 255, 255, 255,},
-  {228, 240, 255, 228, 232, 255, 245, 255, 255, 255,},
-  {229, 241, 255, 229, 232, 255, 245, 255, 255, 255,},
-  {230, 242, 255, 230, 233, 255, 246, 255, 255, 255,},
-  {231, 242, 255, 231, 234, 255, 246, 255, 255, 255,},
-  {232, 243, 255, 232, 234, 255, 247, 255, 255, 255,},
-  {233, 243, 255, 233, 235, 255, 247, 255, 255, 255,},
-  {234, 244, 255, 233, 236, 255, 247, 255, 255, 255,},
-  {235, 245, 255, 234, 236, 255, 248, 255, 255, 255,},
-  {236, 245, 255, 235, 237, 255, 248, 255, 255, 255,},
-  {237, 246, 255, 236, 238, 255, 249, 255, 255, 255,},
-  {238, 247, 255, 237, 239, 255, 249, 255, 255, 255,},
-  {239, 247, 255, 238, 239, 255, 250, 255, 255, 255,},
-  {240, 248, 255, 239, 240, 255, 250, 255, 255, 255,},
-  {241, 248, 255, 240, 241, 255, 251, 255, 255, 255,},
-  {242, 249, 255, 241, 242, 255, 251, 255, 255, 255,},
-  {243, 249, 255, 241, 243, 255, 251, 255, 255, 255,},
-  {244, 250, 255, 242, 243, 255, 252, 255, 255, 255,},
-  {245, 251, 255, 243, 244, 255, 252, 255, 255, 255,},
-  {246, 251, 255, 244, 245, 255, 253, 255, 255, 255,},
-  {247, 252, 255, 245, 246, 255, 253, 255, 255, 255,},
-  {248, 252, 255, 246, 247, 255, 253, 255, 255, 255,},
-  {249, 253, 255, 247, 248, 255, 254, 255, 255, 255,},
-  {250, 253, 255, 248, 249, 255, 254, 255, 255, 255,},
-  {251, 254, 255, 249, 250, 255, 254, 255, 255, 255,},
-  {252, 254, 255, 251, 251, 255, 255, 255, 255, 255,},
-  {253, 255, 255, 252, 252, 255, 255, 255, 255, 255,},
-  {254, 255, 255, 253, 253, 255, 255, 255, 255, 255,},
-  {255, 255, 255, 254, 254, 255, 255, 255, 255, 255,},
+const vp9_tree_index vp9_coefmodel_tree[6] = {
+  -DCT_EOB_MODEL_TOKEN, 2,                      /* 0 = EOB */
+  -ZERO_TOKEN, 4,                               /* 1 = ZERO */
+  -ONE_TOKEN, -TWO_TOKEN,                       /* 2 = ONE */
 };
 
-#else
-
-const vp9_prob vp9_modelcoefprobs_gg75p1[COEFPROB_MODELS][ENTROPY_NODES - 1] = {
+const vp9_prob vp9_modelcoefprobs_gg75p1[COEFPROB_MODELS][MODEL_NODES] = {
   // Probs generated with a Generalized Gaussian (with shape parameter 0.75)
   // source model with varying quantizer step size for a uniform quantizer
-  {1,   1,   3,  86, 129,   6,  87,  21,  90,  26,},
-  {2,   3,   9,  87, 130,  16,  89,  55,  96,  65,},
-  {3,   5,  14,  88, 130,  26,  90,  82, 101,  95,},
-  {4,   7,  20,  89, 131,  35,  92, 105, 105, 119,},
-  {5,   9,  25,  90, 132,  44,  93, 124, 110, 138,},
-  {6,  11,  30,  91, 132,  52,  95, 141, 114, 155,},
-  {7,  13,  35,  92, 133,  60,  96, 155, 118, 168,},
-  {8,  15,  40,  93, 134,  68,  97, 167, 123, 180,},
-  {9,  17,  44,  94, 134,  75,  99, 178, 127, 190,},
-  {10,  19,  49,  94, 135,  82, 100, 187, 131, 199,},
-  {11,  21,  54,  95, 135,  88, 101, 195, 135, 206,},
-  {13,  23,  58,  96, 136,  95, 102, 202, 138, 213,},
-  {14,  25,  63,  97, 137, 101, 104, 209, 142, 218,},
-  {15,  27,  67,  98, 137, 107, 105, 214, 146, 223,},
-  {16,  29,  71,  98, 138, 113, 106, 219, 150, 227,},
-  {17,  31,  76,  99, 138, 118, 107, 223, 153, 231,},
-  {18,  33,  80, 100, 139, 123, 109, 227, 157, 234,},
-  {20,  35,  84, 101, 140, 128, 110, 231, 160, 237,},
-  {21,  37,  88, 102, 140, 133, 111, 234, 164, 239,},
-  {22,  39,  92, 102, 141, 138, 112, 236, 167, 241,},
-  {23,  41,  95, 103, 141, 143, 114, 238, 170, 243,},
-  {25,  43,  99, 104, 142, 147, 115, 241, 173, 245,},
-  {26,  45, 103, 105, 142, 151, 116, 242, 176, 246,},
-  {27,  47, 107, 105, 143, 156, 117, 244, 180, 248,},
-  {28,  49, 110, 106, 144, 159, 119, 245, 182, 249,},
-  {30,  51, 114, 107, 144, 163, 120, 247, 185, 250,},
-  {31,  53, 117, 108, 145, 167, 121, 248, 188, 250,},
-  {32,  55, 121, 109, 145, 171, 123, 249, 191, 251,},
-  {34,  57, 124, 110, 146, 174, 124, 250, 194, 252,},
-  {35,  59, 127, 110, 147, 177, 125, 250, 196, 252,},
-  {36,  61, 130, 111, 147, 181, 127, 251, 199, 253,},
-  {38,  63, 134, 112, 148, 184, 128, 252, 201, 253,},
-  {39,  65, 137, 113, 148, 187, 129, 252, 204, 254,},
-  {40,  67, 140, 114, 149, 190, 130, 253, 206, 254,},
-  {42,  69, 143, 115, 150, 192, 132, 253, 208, 254,},
-  {43,  71, 146, 115, 150, 195, 133, 254, 210, 254,},
-  {44,  73, 149, 116, 151, 198, 134, 254, 212, 255,},
-  {46,  75, 152, 117, 151, 200, 136, 254, 214, 255,},
-  {47,  77, 154, 118, 152, 203, 137, 254, 216, 255,},
-  {49,  79, 157, 119, 153, 205, 139, 255, 218, 255,},
-  {50,  81, 160, 120, 153, 207, 140, 255, 220, 255,},
-  {51,  83, 163, 121, 154, 210, 141, 255, 222, 255,},
-  {53,  85, 165, 122, 154, 212, 143, 255, 223, 255,},
-  {54,  87, 168, 123, 155, 214, 144, 255, 225, 255,},
-  {56,  89, 170, 123, 156, 216, 145, 255, 227, 255,},
-  {57,  91, 173, 124, 156, 218, 147, 255, 228, 255,},
-  {59,  93, 175, 125, 157, 219, 148, 255, 230, 255,},
-  {60,  95, 178, 126, 158, 221, 150, 255, 231, 255,},
-  {62,  97, 180, 127, 158, 223, 151, 255, 232, 255,},
-  {63,  99, 182, 128, 159, 224, 152, 255, 234, 255,},
-  {65, 101, 184, 129, 160, 226, 154, 255, 235, 255,},
-  {66, 103, 187, 130, 160, 227, 155, 255, 236, 255,},
-  {68, 105, 189, 131, 161, 229, 157, 255, 237, 255,},
-  {69, 107, 191, 132, 162, 230, 158, 255, 238, 255,},
-  {71, 109, 193, 133, 163, 232, 159, 255, 239, 255,},
-  {73, 111, 195, 134, 163, 233, 161, 255, 240, 255,},
-  {74, 113, 197, 135, 164, 234, 162, 255, 241, 255,},
-  {76, 115, 199, 136, 165, 235, 164, 255, 242, 255,},
-  {77, 117, 201, 137, 165, 236, 165, 255, 243, 255,},
-  {79, 119, 203, 138, 166, 237, 167, 255, 244, 255,},
-  {81, 121, 205, 139, 167, 238, 168, 255, 244, 255,},
-  {82, 123, 206, 141, 168, 239, 170, 255, 245, 255,},
-  {84, 125, 208, 142, 168, 240, 171, 255, 246, 255,},
-  {86, 127, 210, 143, 169, 241, 173, 255, 246, 255,},
-  {87, 129, 212, 144, 170, 242, 174, 255, 247, 255,},
-  {89, 131, 213, 145, 171, 243, 176, 255, 248, 255,},
-  {91, 133, 215, 146, 171, 244, 177, 255, 248, 255,},
-  {93, 135, 216, 147, 172, 244, 179, 255, 249, 255,},
-  {94, 137, 218, 148, 173, 245, 180, 255, 249, 255,},
-  {96, 139, 220, 150, 174, 246, 181, 255, 250, 255,},
-  {98, 141, 221, 151, 175, 246, 183, 255, 250, 255,},
-  {100, 143, 222, 152, 175, 247, 184, 255, 251, 255,},
-  {101, 145, 224, 153, 176, 248, 186, 255, 251, 255,},
-  {103, 147, 225, 154, 177, 248, 187, 255, 251, 255,},
-  {105, 149, 226, 156, 178, 249, 189, 255, 252, 255,},
-  {107, 151, 228, 157, 179, 249, 190, 255, 252, 255,},
-  {109, 153, 229, 158, 180, 250, 192, 255, 252, 255,},
-  {111, 155, 230, 159, 181, 250, 193, 255, 253, 255,},
-  {112, 157, 231, 161, 181, 251, 195, 255, 253, 255,},
-  {114, 159, 233, 162, 182, 251, 196, 255, 253, 255,},
-  {116, 161, 234, 163, 183, 251, 198, 255, 253, 255,},
-  {118, 163, 235, 165, 184, 252, 199, 255, 254, 255,},
-  {120, 165, 236, 166, 185, 252, 201, 255, 254, 255,},
-  {122, 167, 237, 167, 186, 252, 202, 255, 254, 255,},
-  {124, 169, 238, 169, 187, 253, 204, 255, 254, 255,},
-  {126, 171, 239, 170, 188, 253, 205, 255, 254, 255,},
-  {128, 173, 240, 172, 189, 253, 207, 255, 255, 255,},
-  {130, 175, 241, 173, 190, 253, 208, 255, 255, 255,},
-  {132, 177, 242, 175, 191, 254, 210, 255, 255, 255,},
-  {134, 179, 242, 176, 192, 254, 211, 255, 255, 255,},
-  {137, 181, 243, 177, 193, 254, 213, 255, 255, 255,},
-  {139, 183, 244, 179, 194, 254, 214, 255, 255, 255,},
-  {141, 185, 245, 181, 195, 254, 216, 255, 255, 255,},
-  {143, 187, 245, 182, 196, 255, 217, 255, 255, 255,},
-  {145, 189, 246, 184, 197, 255, 218, 255, 255, 255,},
-  {147, 191, 247, 185, 199, 255, 220, 255, 255, 255,},
-  {150, 193, 247, 187, 200, 255, 221, 255, 255, 255,},
-  {152, 195, 248, 188, 201, 255, 223, 255, 255, 255,},
-  {154, 197, 249, 190, 202, 255, 224, 255, 255, 255,},
-  {157, 199, 249, 192, 203, 255, 225, 255, 255, 255,},
-  {159, 201, 250, 193, 205, 255, 227, 255, 255, 255,},
-  {162, 203, 250, 195, 206, 255, 228, 255, 255, 255,},
-  {164, 205, 251, 197, 207, 255, 229, 255, 255, 255,},
-  {166, 207, 251, 199, 208, 255, 231, 255, 255, 255,},
-  {169, 209, 252, 201, 210, 255, 232, 255, 255, 255,},
-  {172, 211, 252, 202, 211, 255, 233, 255, 255, 255,},
-  {174, 213, 252, 204, 212, 255, 235, 255, 255, 255,},
-  {177, 215, 253, 206, 214, 255, 236, 255, 255, 255,},
-  {179, 217, 253, 208, 215, 255, 237, 255, 255, 255,},
-  {182, 219, 254, 210, 217, 255, 238, 255, 255, 255,},
-  {185, 221, 254, 212, 218, 255, 240, 255, 255, 255,},
-  {188, 223, 254, 214, 220, 255, 241, 255, 255, 255,},
-  {191, 225, 254, 216, 221, 255, 242, 255, 255, 255,},
-  {194, 227, 255, 218, 223, 255, 243, 255, 255, 255,},
-  {197, 229, 255, 220, 225, 255, 244, 255, 255, 255,},
-  {200, 231, 255, 222, 226, 255, 245, 255, 255, 255,},
-  {203, 233, 255, 224, 228, 255, 247, 255, 255, 255,},
-  {206, 235, 255, 227, 230, 255, 248, 255, 255, 255,},
-  {210, 237, 255, 229, 232, 255, 249, 255, 255, 255,},
-  {213, 239, 255, 231, 234, 255, 250, 255, 255, 255,},
-  {217, 241, 255, 234, 236, 255, 251, 255, 255, 255,},
-  {221, 243, 255, 236, 238, 255, 252, 255, 255, 255,},
-  {225, 245, 255, 239, 240, 255, 252, 255, 255, 255,},
-  {229, 247, 255, 241, 242, 255, 253, 255, 255, 255,},
-  {233, 249, 255, 244, 245, 255, 254, 255, 255, 255,},
-  {238, 251, 255, 247, 247, 255, 255, 255, 255, 255,},
-  {244, 253, 255, 250, 250, 255, 255, 255, 255, 255,},
-  {251, 255, 255, 254, 254, 255, 255, 255, 255, 255,},
+  {   3,  86, 129,   6,  87,  21,  90,  26,},
+  {   9,  87, 130,  16,  89,  55,  96,  65,},
+  {  14,  88, 130,  26,  90,  82, 101,  95,},
+  {  20,  89, 131,  35,  92, 105, 105, 119,},
+  {  25,  90, 132,  44,  93, 124, 110, 138,},
+  {  30,  91, 132,  52,  95, 141, 114, 155,},
+  {  35,  92, 133,  60,  96, 155, 118, 168,},
+  {  40,  93, 134,  68,  97, 167, 123, 180,},
+  {  44,  94, 134,  75,  99, 178, 127, 190,},
+  {  49,  94, 135,  82, 100, 187, 131, 199,},
+  {  54,  95, 135,  88, 101, 195, 135, 206,},
+  {  58,  96, 136,  95, 102, 202, 138, 213,},
+  {  63,  97, 137, 101, 104, 209, 142, 218,},
+  {  67,  98, 137, 107, 105, 214, 146, 223,},
+  {  71,  98, 138, 113, 106, 219, 150, 227,},
+  {  76,  99, 138, 118, 107, 223, 153, 231,},
+  {  80, 100, 139, 123, 109, 227, 157, 234,},
+  {  84, 101, 140, 128, 110, 231, 160, 237,},
+  {  88, 102, 140, 133, 111, 234, 164, 239,},
+  {  92, 102, 141, 138, 112, 236, 167, 241,},
+  {  95, 103, 141, 143, 114, 238, 170, 243,},
+  {  99, 104, 142, 147, 115, 241, 173, 245,},
+  { 103, 105, 142, 151, 116, 242, 176, 246,},
+  { 107, 105, 143, 156, 117, 244, 180, 248,},
+  { 110, 106, 144, 159, 119, 245, 182, 249,},
+  { 114, 107, 144, 163, 120, 247, 185, 250,},
+  { 117, 108, 145, 167, 121, 248, 188, 250,},
+  { 121, 109, 145, 171, 123, 249, 191, 251,},
+  { 124, 110, 146, 174, 124, 250, 194, 252,},
+  { 127, 110, 147, 177, 125, 250, 196, 252,},
+  { 130, 111, 147, 181, 127, 251, 199, 253,},
+  { 134, 112, 148, 184, 128, 252, 201, 253,},
+  { 137, 113, 148, 187, 129, 252, 204, 254,},
+  { 140, 114, 149, 190, 130, 253, 206, 254,},
+  { 143, 115, 150, 192, 132, 253, 208, 254,},
+  { 146, 115, 150, 195, 133, 254, 210, 254,},
+  { 149, 116, 151, 198, 134, 254, 212, 255,},
+  { 152, 117, 151, 200, 136, 254, 214, 255,},
+  { 154, 118, 152, 203, 137, 254, 216, 255,},
+  { 157, 119, 153, 205, 139, 255, 218, 255,},
+  { 160, 120, 153, 207, 140, 255, 220, 255,},
+  { 163, 121, 154, 210, 141, 255, 222, 255,},
+  { 165, 122, 154, 212, 143, 255, 223, 255,},
+  { 168, 123, 155, 214, 144, 255, 225, 255,},
+  { 170, 123, 156, 216, 145, 255, 227, 255,},
+  { 173, 124, 156, 218, 147, 255, 228, 255,},
+  { 175, 125, 157, 219, 148, 255, 230, 255,},
+  { 178, 126, 158, 221, 150, 255, 231, 255,},
+  { 180, 127, 158, 223, 151, 255, 232, 255,},
+  { 182, 128, 159, 224, 152, 255, 234, 255,},
+  { 184, 129, 160, 226, 154, 255, 235, 255,},
+  { 187, 130, 160, 227, 155, 255, 236, 255,},
+  { 189, 131, 161, 229, 157, 255, 237, 255,},
+  { 191, 132, 162, 230, 158, 255, 238, 255,},
+  { 193, 133, 163, 232, 159, 255, 239, 255,},
+  { 195, 134, 163, 233, 161, 255, 240, 255,},
+  { 197, 135, 164, 234, 162, 255, 241, 255,},
+  { 199, 136, 165, 235, 164, 255, 242, 255,},
+  { 201, 137, 165, 236, 165, 255, 243, 255,},
+  { 203, 138, 166, 237, 167, 255, 244, 255,},
+  { 205, 139, 167, 238, 168, 255, 244, 255,},
+  { 206, 141, 168, 239, 170, 255, 245, 255,},
+  { 208, 142, 168, 240, 171, 255, 246, 255,},
+  { 210, 143, 169, 241, 173, 255, 246, 255,},
+  { 212, 144, 170, 242, 174, 255, 247, 255,},
+  { 213, 145, 171, 243, 176, 255, 248, 255,},
+  { 215, 146, 171, 244, 177, 255, 248, 255,},
+  { 216, 147, 172, 244, 179, 255, 249, 255,},
+  { 218, 148, 173, 245, 180, 255, 249, 255,},
+  { 220, 150, 174, 246, 181, 255, 250, 255,},
+  { 221, 151, 175, 246, 183, 255, 250, 255,},
+  { 222, 152, 175, 247, 184, 255, 251, 255,},
+  { 224, 153, 176, 248, 186, 255, 251, 255,},
+  { 225, 154, 177, 248, 187, 255, 251, 255,},
+  { 226, 156, 178, 249, 189, 255, 252, 255,},
+  { 228, 157, 179, 249, 190, 255, 252, 255,},
+  { 229, 158, 180, 250, 192, 255, 252, 255,},
+  { 230, 159, 181, 250, 193, 255, 253, 255,},
+  { 231, 161, 181, 251, 195, 255, 253, 255,},
+  { 233, 162, 182, 251, 196, 255, 253, 255,},
+  { 234, 163, 183, 251, 198, 255, 253, 255,},
+  { 235, 165, 184, 252, 199, 255, 254, 255,},
+  { 236, 166, 185, 252, 201, 255, 254, 255,},
+  { 237, 167, 186, 252, 202, 255, 254, 255,},
+  { 238, 169, 187, 253, 204, 255, 254, 255,},
+  { 239, 170, 188, 253, 205, 255, 254, 255,},
+  { 240, 172, 189, 253, 207, 255, 255, 255,},
+  { 241, 173, 190, 253, 208, 255, 255, 255,},
+  { 242, 175, 191, 254, 210, 255, 255, 255,},
+  { 242, 176, 192, 254, 211, 255, 255, 255,},
+  { 243, 177, 193, 254, 213, 255, 255, 255,},
+  { 244, 179, 194, 254, 214, 255, 255, 255,},
+  { 245, 181, 195, 254, 216, 255, 255, 255,},
+  { 245, 182, 196, 255, 217, 255, 255, 255,},
+  { 246, 184, 197, 255, 218, 255, 255, 255,},
+  { 247, 185, 199, 255, 220, 255, 255, 255,},
+  { 247, 187, 200, 255, 221, 255, 255, 255,},
+  { 248, 188, 201, 255, 223, 255, 255, 255,},
+  { 249, 190, 202, 255, 224, 255, 255, 255,},
+  { 249, 192, 203, 255, 225, 255, 255, 255,},
+  { 250, 193, 205, 255, 227, 255, 255, 255,},
+  { 250, 195, 206, 255, 228, 255, 255, 255,},
+  { 251, 197, 207, 255, 229, 255, 255, 255,},
+  { 251, 199, 208, 255, 231, 255, 255, 255,},
+  { 252, 201, 210, 255, 232, 255, 255, 255,},
+  { 252, 202, 211, 255, 233, 255, 255, 255,},
+  { 252, 204, 212, 255, 235, 255, 255, 255,},
+  { 253, 206, 214, 255, 236, 255, 255, 255,},
+  { 253, 208, 215, 255, 237, 255, 255, 255,},
+  { 254, 210, 217, 255, 238, 255, 255, 255,},
+  { 254, 212, 218, 255, 240, 255, 255, 255,},
+  { 254, 214, 220, 255, 241, 255, 255, 255,},
+  { 254, 216, 221, 255, 242, 255, 255, 255,},
+  { 255, 218, 223, 255, 243, 255, 255, 255,},
+  { 255, 220, 225, 255, 244, 255, 255, 255,},
+  { 255, 222, 226, 255, 245, 255, 255, 255,},
+  { 255, 224, 228, 255, 247, 255, 255, 255,},
+  { 255, 227, 230, 255, 248, 255, 255, 255,},
+  { 255, 229, 232, 255, 249, 255, 255, 255,},
+  { 255, 231, 234, 255, 250, 255, 255, 255,},
+  { 255, 234, 236, 255, 251, 255, 255, 255,},
+  { 255, 236, 238, 255, 252, 255, 255, 255,},
+  { 255, 239, 240, 255, 252, 255, 255, 255,},
+  { 255, 241, 242, 255, 253, 255, 255, 255,},
+  { 255, 244, 245, 255, 254, 255, 255, 255,},
+  { 255, 247, 247, 255, 255, 255, 255, 255,},
+  { 255, 250, 250, 255, 255, 255, 255, 255,},
+  { 255, 254, 254, 255, 255, 255, 255, 255,},
 };
 
-const vp9_prob vp9_modelcoefprobs_gg625p1[COEFPROB_MODELS][ENTROPY_NODES - 1] = {
+const vp9_prob vp9_modelcoefprobs_gg625p1[COEFPROB_MODELS][MODEL_NODES] = {
   // Probs generated with a Generalized Gaussian (with shape parameter 0.625)
   // source model with varying quantizer step size for a uniform quantizer
-  {1,   1,   3,  87, 129,   6,  87,  20,  91,  24,},
-  {2,   3,   8,  88, 130,  15,  90,  50,  97,  56,},
-  {3,   5,  14,  90, 131,  24,  91,  74, 102,  81,},
-  {4,   7,  19,  91, 132,  33,  93,  93, 106, 101,},
-  {5,   9,  24,  92, 133,  40,  94, 110, 110, 118,},
-  {6,  11,  29,  93, 134,  48,  96, 125, 113, 132,},
-  {7,  13,  33,  93, 134,  55,  97, 138, 117, 145,},
-  {8,  15,  38,  94, 135,  62,  98, 149, 120, 155,},
-  {10,  17,  42,  95, 136,  68,  99, 159, 124, 165,},
-  {11,  19,  47,  96, 136,  74, 100, 168, 127, 174,},
-  {12,  21,  51,  97, 137,  80, 102, 176, 130, 181,},
-  {13,  23,  55,  98, 137,  86, 103, 184, 133, 188,},
-  {14,  25,  59,  98, 138,  91, 104, 190, 136, 194,},
-  {16,  27,  64,  99, 139,  97, 105, 196, 139, 200,},
-  {17,  29,  68, 100, 139, 102, 106, 201, 142, 205,},
-  {18,  31,  71, 101, 140, 107, 107, 206, 145, 209,},
-  {20,  33,  75, 102, 140, 112, 108, 211, 148, 213,},
-  {21,  35,  79, 102, 141, 116, 109, 215, 150, 217,},
-  {22,  37,  83, 103, 141, 121, 110, 218, 153, 220,},
-  {24,  39,  87, 104, 142, 125, 112, 222, 156, 224,},
-  {25,  41,  90, 105, 143, 129, 113, 225, 159, 226,},
-  {26,  43,  94, 105, 143, 133, 114, 227, 161, 229,},
-  {28,  45,  97, 106, 144, 137, 115, 230, 164, 231,},
-  {29,  47, 101, 107, 144, 141, 116, 232, 166, 233,},
-  {31,  49, 104, 108, 145, 145, 117, 234, 169, 235,},
-  {32,  51, 107, 108, 145, 149, 118, 236, 171, 237,},
-  {33,  53, 111, 109, 146, 152, 119, 238, 174, 239,},
-  {35,  55, 114, 110, 146, 156, 120, 240, 176, 240,},
-  {36,  57, 117, 111, 147, 159, 121, 241, 178, 242,},
-  {38,  59, 120, 112, 148, 162, 122, 242, 181, 243,},
-  {39,  61, 123, 112, 148, 165, 124, 244, 183, 244,},
-  {41,  63, 126, 113, 149, 168, 125, 245, 185, 245,},
-  {42,  65, 129, 114, 149, 171, 126, 246, 187, 246,},
-  {44,  67, 132, 115, 150, 174, 127, 247, 189, 247,},
-  {45,  69, 135, 116, 150, 177, 128, 248, 192, 248,},
-  {47,  71, 138, 116, 151, 180, 129, 248, 194, 249,},
-  {48,  73, 141, 117, 152, 183, 130, 249, 196, 249,},
-  {50,  75, 143, 118, 152, 185, 131, 250, 198, 250,},
-  {51,  77, 146, 119, 153, 188, 132, 250, 200, 250,},
-  {53,  79, 149, 120, 153, 190, 134, 251, 201, 251,},
-  {55,  81, 151, 120, 154, 192, 135, 251, 203, 251,},
-  {56,  83, 154, 121, 155, 195, 136, 252, 205, 252,},
-  {58,  85, 157, 122, 155, 197, 137, 252, 207, 252,},
-  {59,  87, 159, 123, 156, 199, 138, 253, 209, 253,},
-  {61,  89, 162, 124, 156, 201, 139, 253, 210, 253,},
-  {63,  91, 164, 125, 157, 203, 140, 253, 212, 253,},
-  {64,  93, 166, 126, 158, 205, 142, 254, 214, 253,},
-  {66,  95, 169, 126, 158, 207, 143, 254, 215, 254,},
-  {68,  97, 171, 127, 159, 209, 144, 254, 217, 254,},
-  {69,  99, 173, 128, 159, 211, 145, 254, 218, 254,},
-  {71, 101, 176, 129, 160, 213, 146, 254, 220, 254,},
-  {73, 103, 178, 130, 161, 214, 148, 255, 221, 255,},
-  {75, 105, 180, 131, 161, 216, 149, 255, 223, 255,},
-  {76, 107, 182, 132, 162, 218, 150, 255, 224, 255,},
-  {78, 109, 184, 133, 163, 219, 151, 255, 225, 255,},
-  {80, 111, 186, 134, 163, 221, 152, 255, 226, 255,},
-  {82, 113, 188, 135, 164, 222, 154, 255, 228, 255,},
-  {83, 115, 190, 136, 165, 224, 155, 255, 229, 255,},
-  {85, 117, 192, 137, 165, 225, 156, 255, 230, 255,},
-  {87, 119, 194, 137, 166, 226, 157, 255, 231, 255,},
-  {89, 121, 196, 138, 167, 228, 159, 255, 232, 255,},
-  {91, 123, 198, 139, 167, 229, 160, 255, 233, 255,},
-  {93, 125, 200, 140, 168, 230, 161, 255, 234, 255,},
-  {94, 127, 202, 141, 169, 231, 163, 255, 235, 255,},
-  {96, 129, 203, 142, 169, 233, 164, 255, 236, 255,},
-  {98, 131, 205, 143, 170, 234, 165, 255, 237, 255,},
-  {100, 133, 207, 145, 171, 235, 166, 255, 238, 255,},
-  {102, 135, 209, 146, 171, 236, 168, 255, 239, 255,},
-  {104, 137, 210, 147, 172, 237, 169, 255, 240, 255,},
-  {106, 139, 212, 148, 173, 238, 170, 255, 241, 255,},
-  {108, 141, 213, 149, 174, 239, 172, 255, 242, 255,},
-  {110, 143, 215, 150, 174, 240, 173, 255, 242, 255,},
-  {112, 145, 216, 151, 175, 240, 174, 255, 243, 255,},
-  {114, 147, 218, 152, 176, 241, 176, 255, 244, 255,},
-  {116, 149, 219, 153, 177, 242, 177, 255, 244, 255,},
-  {118, 151, 221, 154, 178, 243, 178, 255, 245, 255,},
-  {120, 153, 222, 156, 178, 244, 180, 255, 246, 255,},
-  {122, 155, 223, 157, 179, 244, 181, 255, 246, 255,},
-  {124, 157, 225, 158, 180, 245, 183, 255, 247, 255,},
-  {126, 159, 226, 159, 181, 246, 184, 255, 247, 255,},
-  {128, 161, 227, 160, 182, 246, 185, 255, 248, 255,},
-  {130, 163, 229, 162, 183, 247, 187, 255, 248, 255,},
-  {132, 165, 230, 163, 183, 247, 188, 255, 249, 255,},
-  {135, 167, 231, 164, 184, 248, 190, 255, 249, 255,},
-  {137, 169, 232, 165, 185, 248, 191, 255, 250, 255,},
-  {139, 171, 233, 167, 186, 249, 192, 255, 250, 255,},
-  {141, 173, 234, 168, 187, 249, 194, 255, 251, 255,},
-  {143, 175, 235, 169, 188, 250, 195, 255, 251, 255,},
-  {146, 177, 236, 171, 189, 250, 197, 255, 251, 255,},
-  {148, 179, 237, 172, 190, 251, 198, 255, 252, 255,},
-  {150, 181, 238, 173, 191, 251, 200, 255, 252, 255,},
-  {152, 183, 239, 175, 192, 251, 201, 255, 252, 255,},
-  {155, 185, 240, 176, 193, 252, 203, 255, 253, 255,},
-  {157, 187, 241, 178, 194, 252, 204, 255, 253, 255,},
-  {159, 189, 242, 179, 195, 252, 206, 255, 253, 255,},
-  {162, 191, 243, 181, 196, 253, 207, 255, 253, 255,},
-  {164, 193, 244, 182, 197, 253, 209, 255, 254, 255,},
-  {166, 195, 244, 184, 198, 253, 210, 255, 254, 255,},
-  {169, 197, 245, 185, 199, 254, 212, 255, 254, 255,},
-  {171, 199, 246, 187, 200, 254, 213, 255, 254, 255,},
-  {174, 201, 247, 189, 201, 254, 215, 255, 254, 255,},
-  {176, 203, 247, 190, 203, 254, 216, 255, 255, 255,},
-  {179, 205, 248, 192, 204, 254, 218, 255, 255, 255,},
-  {181, 207, 249, 194, 205, 255, 219, 255, 255, 255,},
-  {184, 209, 249, 195, 206, 255, 221, 255, 255, 255,},
-  {186, 211, 250, 197, 208, 255, 222, 255, 255, 255,},
-  {189, 213, 250, 199, 209, 255, 224, 255, 255, 255,},
-  {192, 215, 251, 201, 210, 255, 225, 255, 255, 255,},
-  {194, 217, 251, 203, 212, 255, 227, 255, 255, 255,},
-  {197, 219, 252, 205, 213, 255, 228, 255, 255, 255,},
-  {200, 221, 252, 207, 215, 255, 230, 255, 255, 255,},
-  {202, 223, 253, 209, 216, 255, 231, 255, 255, 255,},
-  {205, 225, 253, 211, 218, 255, 233, 255, 255, 255,},
-  {208, 227, 253, 213, 219, 255, 234, 255, 255, 255,},
-  {211, 229, 254, 215, 221, 255, 236, 255, 255, 255,},
-  {214, 231, 254, 217, 223, 255, 238, 255, 255, 255,},
-  {217, 233, 254, 219, 224, 255, 239, 255, 255, 255,},
-  {220, 235, 255, 222, 226, 255, 241, 255, 255, 255,},
-  {223, 237, 255, 224, 228, 255, 242, 255, 255, 255,},
-  {226, 239, 255, 227, 230, 255, 244, 255, 255, 255,},
-  {229, 241, 255, 229, 232, 255, 245, 255, 255, 255,},
-  {232, 243, 255, 232, 234, 255, 247, 255, 255, 255,},
-  {235, 245, 255, 235, 237, 255, 248, 255, 255, 255,},
-  {239, 247, 255, 238, 239, 255, 250, 255, 255, 255,},
-  {242, 249, 255, 241, 242, 255, 251, 255, 255, 255,},
-  {246, 251, 255, 244, 245, 255, 253, 255, 255, 255,},
-  {250, 253, 255, 248, 248, 255, 254, 255, 255, 255,},
-  {254, 255, 255, 253, 253, 255, 255, 255, 255, 255,},
+  {   3,  87, 129,   6,  87,  20,  91,  24,},
+  {   8,  88, 130,  15,  90,  50,  97,  56,},
+  {  14,  90, 131,  24,  91,  74, 102,  81,},
+  {  19,  91, 132,  33,  93,  93, 106, 101,},
+  {  24,  92, 133,  40,  94, 110, 110, 118,},
+  {  29,  93, 134,  48,  96, 125, 113, 132,},
+  {  33,  93, 134,  55,  97, 138, 117, 145,},
+  {  38,  94, 135,  62,  98, 149, 120, 155,},
+  {  42,  95, 136,  68,  99, 159, 124, 165,},
+  {  47,  96, 136,  74, 100, 168, 127, 174,},
+  {  51,  97, 137,  80, 102, 176, 130, 181,},
+  {  55,  98, 137,  86, 103, 184, 133, 188,},
+  {  59,  98, 138,  91, 104, 190, 136, 194,},
+  {  64,  99, 139,  97, 105, 196, 139, 200,},
+  {  68, 100, 139, 102, 106, 201, 142, 205,},
+  {  71, 101, 140, 107, 107, 206, 145, 209,},
+  {  75, 102, 140, 112, 108, 211, 148, 213,},
+  {  79, 102, 141, 116, 109, 215, 150, 217,},
+  {  83, 103, 141, 121, 110, 218, 153, 220,},
+  {  87, 104, 142, 125, 112, 222, 156, 224,},
+  {  90, 105, 143, 129, 113, 225, 159, 226,},
+  {  94, 105, 143, 133, 114, 227, 161, 229,},
+  {  97, 106, 144, 137, 115, 230, 164, 231,},
+  { 101, 107, 144, 141, 116, 232, 166, 233,},
+  { 104, 108, 145, 145, 117, 234, 169, 235,},
+  { 107, 108, 145, 149, 118, 236, 171, 237,},
+  { 111, 109, 146, 152, 119, 238, 174, 239,},
+  { 114, 110, 146, 156, 120, 240, 176, 240,},
+  { 117, 111, 147, 159, 121, 241, 178, 242,},
+  { 120, 112, 148, 162, 122, 242, 181, 243,},
+  { 123, 112, 148, 165, 124, 244, 183, 244,},
+  { 126, 113, 149, 168, 125, 245, 185, 245,},
+  { 129, 114, 149, 171, 126, 246, 187, 246,},
+  { 132, 115, 150, 174, 127, 247, 189, 247,},
+  { 135, 116, 150, 177, 128, 248, 192, 248,},
+  { 138, 116, 151, 180, 129, 248, 194, 249,},
+  { 141, 117, 152, 183, 130, 249, 196, 249,},
+  { 143, 118, 152, 185, 131, 250, 198, 250,},
+  { 146, 119, 153, 188, 132, 250, 200, 250,},
+  { 149, 120, 153, 190, 134, 251, 201, 251,},
+  { 151, 120, 154, 192, 135, 251, 203, 251,},
+  { 154, 121, 155, 195, 136, 252, 205, 252,},
+  { 157, 122, 155, 197, 137, 252, 207, 252,},
+  { 159, 123, 156, 199, 138, 253, 209, 253,},
+  { 162, 124, 156, 201, 139, 253, 210, 253,},
+  { 164, 125, 157, 203, 140, 253, 212, 253,},
+  { 166, 126, 158, 205, 142, 254, 214, 253,},
+  { 169, 126, 158, 207, 143, 254, 215, 254,},
+  { 171, 127, 159, 209, 144, 254, 217, 254,},
+  { 173, 128, 159, 211, 145, 254, 218, 254,},
+  { 176, 129, 160, 213, 146, 254, 220, 254,},
+  { 178, 130, 161, 214, 148, 255, 221, 255,},
+  { 180, 131, 161, 216, 149, 255, 223, 255,},
+  { 182, 132, 162, 218, 150, 255, 224, 255,},
+  { 184, 133, 163, 219, 151, 255, 225, 255,},
+  { 186, 134, 163, 221, 152, 255, 226, 255,},
+  { 188, 135, 164, 222, 154, 255, 228, 255,},
+  { 190, 136, 165, 224, 155, 255, 229, 255,},
+  { 192, 137, 165, 225, 156, 255, 230, 255,},
+  { 194, 137, 166, 226, 157, 255, 231, 255,},
+  { 196, 138, 167, 228, 159, 255, 232, 255,},
+  { 198, 139, 167, 229, 160, 255, 233, 255,},
+  { 200, 140, 168, 230, 161, 255, 234, 255,},
+  { 202, 141, 169, 231, 163, 255, 235, 255,},
+  { 203, 142, 169, 233, 164, 255, 236, 255,},
+  { 205, 143, 170, 234, 165, 255, 237, 255,},
+  { 207, 145, 171, 235, 166, 255, 238, 255,},
+  { 209, 146, 171, 236, 168, 255, 239, 255,},
+  { 210, 147, 172, 237, 169, 255, 240, 255,},
+  { 212, 148, 173, 238, 170, 255, 241, 255,},
+  { 213, 149, 174, 239, 172, 255, 242, 255,},
+  { 215, 150, 174, 240, 173, 255, 242, 255,},
+  { 216, 151, 175, 240, 174, 255, 243, 255,},
+  { 218, 152, 176, 241, 176, 255, 244, 255,},
+  { 219, 153, 177, 242, 177, 255, 244, 255,},
+  { 221, 154, 178, 243, 178, 255, 245, 255,},
+  { 222, 156, 178, 244, 180, 255, 246, 255,},
+  { 223, 157, 179, 244, 181, 255, 246, 255,},
+  { 225, 158, 180, 245, 183, 255, 247, 255,},
+  { 226, 159, 181, 246, 184, 255, 247, 255,},
+  { 227, 160, 182, 246, 185, 255, 248, 255,},
+  { 229, 162, 183, 247, 187, 255, 248, 255,},
+  { 230, 163, 183, 247, 188, 255, 249, 255,},
+  { 231, 164, 184, 248, 190, 255, 249, 255,},
+  { 232, 165, 185, 248, 191, 255, 250, 255,},
+  { 233, 167, 186, 249, 192, 255, 250, 255,},
+  { 234, 168, 187, 249, 194, 255, 251, 255,},
+  { 235, 169, 188, 250, 195, 255, 251, 255,},
+  { 236, 171, 189, 250, 197, 255, 251, 255,},
+  { 237, 172, 190, 251, 198, 255, 252, 255,},
+  { 238, 173, 191, 251, 200, 255, 252, 255,},
+  { 239, 175, 192, 251, 201, 255, 252, 255,},
+  { 240, 176, 193, 252, 203, 255, 253, 255,},
+  { 241, 178, 194, 252, 204, 255, 253, 255,},
+  { 242, 179, 195, 252, 206, 255, 253, 255,},
+  { 243, 181, 196, 253, 207, 255, 253, 255,},
+  { 244, 182, 197, 253, 209, 255, 254, 255,},
+  { 244, 184, 198, 253, 210, 255, 254, 255,},
+  { 245, 185, 199, 254, 212, 255, 254, 255,},
+  { 246, 187, 200, 254, 213, 255, 254, 255,},
+  { 247, 189, 201, 254, 215, 255, 254, 255,},
+  { 247, 190, 203, 254, 216, 255, 255, 255,},
+  { 248, 192, 204, 254, 218, 255, 255, 255,},
+  { 249, 194, 205, 255, 219, 255, 255, 255,},
+  { 249, 195, 206, 255, 221, 255, 255, 255,},
+  { 250, 197, 208, 255, 222, 255, 255, 255,},
+  { 250, 199, 209, 255, 224, 255, 255, 255,},
+  { 251, 201, 210, 255, 225, 255, 255, 255,},
+  { 251, 203, 212, 255, 227, 255, 255, 255,},
+  { 252, 205, 213, 255, 228, 255, 255, 255,},
+  { 252, 207, 215, 255, 230, 255, 255, 255,},
+  { 253, 209, 216, 255, 231, 255, 255, 255,},
+  { 253, 211, 218, 255, 233, 255, 255, 255,},
+  { 253, 213, 219, 255, 234, 255, 255, 255,},
+  { 254, 215, 221, 255, 236, 255, 255, 255,},
+  { 254, 217, 223, 255, 238, 255, 255, 255,},
+  { 254, 219, 224, 255, 239, 255, 255, 255,},
+  { 255, 222, 226, 255, 241, 255, 255, 255,},
+  { 255, 224, 228, 255, 242, 255, 255, 255,},
+  { 255, 227, 230, 255, 244, 255, 255, 255,},
+  { 255, 229, 232, 255, 245, 255, 255, 255,},
+  { 255, 232, 234, 255, 247, 255, 255, 255,},
+  { 255, 235, 237, 255, 248, 255, 255, 255,},
+  { 255, 238, 239, 255, 250, 255, 255, 255,},
+  { 255, 241, 242, 255, 251, 255, 255, 255,},
+  { 255, 244, 245, 255, 253, 255, 255, 255,},
+  { 255, 248, 248, 255, 254, 255, 255, 255,},
+  { 255, 253, 253, 255, 255, 255, 255, 255,},
 };
-#endif
 
 void vp9_get_model_distribution(vp9_prob p, vp9_prob *tree_probs,
                                 int b, int r) {
-  const vp9_prob (*model)[ENTROPY_NODES - 1];
-#if UNCONSTRAINED_NODES == 2
-  if (r != INTRA_FRAME && b == PLANE_TYPE_UV)
-    model = vp9_modelcoefprobs_gg75;
-  else if (r == INTRA_FRAME && b == PLANE_TYPE_UV)
-    model = vp9_modelcoefprobs_gg75;
-  else if (r != INTRA_FRAME && b == PLANE_TYPE_Y_WITH_DC)
-    model = vp9_modelcoefprobs_gg75;
-  else
-    model = vp9_modelcoefprobs_gg75;
-#else
+  const vp9_prob (*model)[MODEL_NODES];
   if (r != INTRA_FRAME && b == PLANE_TYPE_UV)
     model = vp9_modelcoefprobs_gg75p1;
   else if (r == INTRA_FRAME && b == PLANE_TYPE_UV)
@@ -1222,18 +691,34 @@ void vp9_get_model_distribution(vp9_prob p, vp9_prob *tree_probs,
     model = vp9_modelcoefprobs_gg75p1;
   else
     model = vp9_modelcoefprobs_gg625p1;
-#endif
   if (p & 1) {  // odd
     vpx_memcpy(tree_probs + UNCONSTRAINED_NODES,
-               model[(p - 1) / 2] + UNCONSTRAINED_NODES - 1,
+               model[(p - 1) / 2],
                (ENTROPY_NODES - UNCONSTRAINED_NODES) * sizeof(vp9_prob));
   } else {
     // interpolate
     int i;
     for (i = UNCONSTRAINED_NODES; i < ENTROPY_NODES; ++i)
-      tree_probs[i] = (model[p / 2 - 1][i - 1] + model[p / 2][i - 1]) >> 1;
+      tree_probs[i] = (model[p / 2 - 1][i - UNCONSTRAINED_NODES] +
+                       model[p / 2][i - UNCONSTRAINED_NODES]) >> 1;
   }
 }
+
+void vp9_model_to_full_probs(const vp9_prob *model, int b, int r, vp9_prob *full) {
+  vpx_memcpy(full, model, sizeof(vp9_prob) * UNCONSTRAINED_NODES);
+  vp9_get_model_distribution(model[PIVOT_NODE], full, b, r);
+}
+
+void vp9_model_to_full_probs_sb(
+    vp9_prob model[COEF_BANDS][PREV_COEF_CONTEXTS][UNCONSTRAINED_NODES],
+    int b, int r,
+    vp9_prob full[COEF_BANDS][PREV_COEF_CONTEXTS][ENTROPY_NODES]) {
+  int c, p;
+  for (c = 0; c < COEF_BANDS; ++c)
+    for (p = 0; p < PREV_COEF_CONTEXTS; ++p) {
+      vp9_model_to_full_probs(model[c][p], b, r, full[c][p]);
+    }
+}
 #endif
 
 static vp9_tree_index cat1[2], cat2[4], cat3[6], cat4[8], cat5[10], cat6[28];
@@ -1302,41 +787,6 @@ int vp9_get_coef_context(const int *scan, const int *neighbors,
 };
 
 void vp9_default_coef_probs(VP9_COMMON *pc) {
-#if CONFIG_MODELCOEFPROB
-  int b, r, c, p;
-#endif
-#if CONFIG_MODELCOEFPROB
-  for (b = 0; b < BLOCK_TYPES; ++b)
-    for (r = 0; r < REF_TYPES; ++r)
-      for (c = 0; c < COEF_BANDS; ++c)
-        for (p = 0; p < PREV_COEF_CONTEXTS; ++p) {
-          int t;
-          for (t = 0; t < UNCONSTRAINED_NODES; t++)
-            pc->fc.coef_probs_4x4[b][r][c][p][t] =
-                default_coef_probs_4x4[b][r][c][p][t];
-          vp9_get_model_distribution(
-              default_coef_probs_4x4[b][r][c][p][UNCONSTRAINED_NODES - 1],
-              pc->fc.coef_probs_4x4[b][r][c][p], b, r);
-          for (t = 0; t < UNCONSTRAINED_NODES; t++)
-            pc->fc.coef_probs_8x8[b][r][c][p][t] =
-                default_coef_probs_8x8[b][r][c][p][t];
-          vp9_get_model_distribution(
-              default_coef_probs_8x8[b][r][c][p][UNCONSTRAINED_NODES - 1],
-              pc->fc.coef_probs_8x8[b][r][c][p], b, r);
-          for (t = 0; t < UNCONSTRAINED_NODES; t++)
-            pc->fc.coef_probs_16x16[b][r][c][p][t] =
-                default_coef_probs_16x16[b][r][c][p][t];
-          vp9_get_model_distribution(
-              default_coef_probs_16x16[b][r][c][p][UNCONSTRAINED_NODES - 1],
-              pc->fc.coef_probs_16x16[b][r][c][p], b, r);
-          for (t = 0; t < UNCONSTRAINED_NODES; t++)
-            pc->fc.coef_probs_32x32[b][r][c][p][t] =
-                default_coef_probs_32x32[b][r][c][p][t];
-          vp9_get_model_distribution(
-              default_coef_probs_32x32[b][r][c][p][UNCONSTRAINED_NODES - 1],
-              pc->fc.coef_probs_32x32[b][r][c][p], b, r);
-        }
-#else
   vpx_memcpy(pc->fc.coef_probs_4x4, default_coef_probs_4x4,
              sizeof(pc->fc.coef_probs_4x4));
   vpx_memcpy(pc->fc.coef_probs_8x8, default_coef_probs_8x8,
@@ -1345,7 +795,6 @@ void vp9_default_coef_probs(VP9_COMMON *pc) {
              sizeof(pc->fc.coef_probs_16x16));
   vpx_memcpy(pc->fc.coef_probs_32x32, default_coef_probs_32x32,
              sizeof(pc->fc.coef_probs_32x32));
-#endif
 }
 
 // Neighborhood 5-tuples for various scans and blocksizes,
@@ -1507,20 +956,53 @@ void vp9_coef_tree_initialize() {
 #define COEF_COUNT_SAT_AFTER_KEY 24
 #define COEF_MAX_UPDATE_FACTOR_AFTER_KEY 128
 
-static void adapt_coef_probs(vp9_coeff_probs *dst_coef_probs,
-                             vp9_coeff_probs *pre_coef_probs,
-                             int qindex, vp9_coeff_count *coef_counts,
-                             unsigned int (*eob_branch_count)[REF_TYPES]
-                                                             [COEF_BANDS]
-                                                      [PREV_COEF_CONTEXTS],
-                             int count_sat, int update_factor) {
+#if CONFIG_MODELCOEFPROB
+void vp9_full_to_model_counts(
+    vp9_coeff_count_model *model_count, vp9_coeff_count *full_count) {
+  int i, j, k, l;
+  for (i = 0; i < BLOCK_TYPES; ++i)
+    for (j = 0; j < REF_TYPES; ++j)
+      for (k = 0; k < COEF_BANDS; ++k)
+        for (l = 0; l < PREV_COEF_CONTEXTS; ++l) {
+          int n;
+          if (l >= 3 && k == 0)
+            continue;
+          model_count[i][j][k][l][ZERO_TOKEN] =
+              full_count[i][j][k][l][ZERO_TOKEN];
+          model_count[i][j][k][l][ONE_TOKEN] =
+              full_count[i][j][k][l][ONE_TOKEN];
+          model_count[i][j][k][l][TWO_TOKEN] =
+              full_count[i][j][k][l][TWO_TOKEN];
+          for (n = THREE_TOKEN; n < DCT_EOB_TOKEN; ++n)
+            model_count[i][j][k][l][TWO_TOKEN] += full_count[i][j][k][l][n];
+          model_count[i][j][k][l][DCT_EOB_MODEL_TOKEN] =
+              full_count[i][j][k][l][DCT_EOB_TOKEN];
+        }
+}
+#endif
+
+static void adapt_coef_probs(
+#if CONFIG_MODELCOEFPROB
+    vp9_coeff_probs_model *dst_coef_probs,
+    vp9_coeff_probs_model *pre_coef_probs,
+    vp9_coeff_count_model *coef_counts,
+#else
+    vp9_coeff_probs *dst_coef_probs,
+    vp9_coeff_probs *pre_coef_probs,
+    vp9_coeff_count *coef_counts,
+#endif
+    unsigned int (*eob_branch_count)[REF_TYPES][COEF_BANDS][PREV_COEF_CONTEXTS],
+    int count_sat,
+    int update_factor) {
   int t, i, j, k, l, count;
-  unsigned int branch_ct[ENTROPY_NODES][2];
-  vp9_prob coef_probs[ENTROPY_NODES];
   int factor;
-#if CONFIG_MODELCOEFPROB && MODEL_BASED_ADAPT
-  int entropy_nodes_adapt = UNCONSTRAINED_ADAPT_NODES;
+#if CONFIG_MODELCOEFPROB
+  unsigned int branch_ct[UNCONSTRAINED_NODES][2];
+  vp9_prob coef_probs[UNCONSTRAINED_NODES];
+  int entropy_nodes_adapt = UNCONSTRAINED_NODES;
 #else
+  unsigned int branch_ct[ENTROPY_NODES][2];
+  vp9_prob coef_probs[ENTROPY_NODES];
   int entropy_nodes_adapt = ENTROPY_NODES;
 #endif
 
@@ -1530,9 +1012,14 @@ static void adapt_coef_probs(vp9_coeff_probs *dst_coef_probs,
         for (l = 0; l < PREV_COEF_CONTEXTS; ++l) {
           if (l >= 3 && k == 0)
             continue;
-          vp9_tree_probs_from_distribution(vp9_coef_tree,
-                                           coef_probs, branch_ct,
-                                           coef_counts[i][j][k][l], 0);
+          vp9_tree_probs_from_distribution(
+#if CONFIG_MODELCOEFPROB
+              vp9_coefmodel_tree,
+#else
+              vp9_coef_tree,
+#endif
+              coef_probs, branch_ct,
+              coef_counts[i][j][k][l], 0);
           branch_ct[0][1] = eob_branch_count[i][j][k][l] - branch_ct[0][0];
           coef_probs[0] = get_binary_prob(branch_ct[0][0], branch_ct[0][1]);
           for (t = 0; t < entropy_nodes_adapt; ++t) {
@@ -1542,18 +1029,11 @@ static void adapt_coef_probs(vp9_coeff_probs *dst_coef_probs,
             dst_coef_probs[i][j][k][l][t] =
                 weighted_prob(pre_coef_probs[i][j][k][l][t],
                               coef_probs[t], factor);
-#if CONFIG_MODELCOEFPROB && MODEL_BASED_ADAPT
-            if (t == UNCONSTRAINED_NODES - 1)
-              vp9_get_model_distribution(
-                  dst_coef_probs[i][j][k][l][UNCONSTRAINED_NODES - 1],
-                  dst_coef_probs[i][j][k][l], i, j);
-#endif
           }
         }
 }
 
 void vp9_adapt_coef_probs(VP9_COMMON *cm) {
-#ifndef DISABLE_COEF_ADAPT
   int count_sat;
   int update_factor; /* denominator 256 */
 
@@ -1567,22 +1047,20 @@ void vp9_adapt_coef_probs(VP9_COMMON *cm) {
     update_factor = COEF_MAX_UPDATE_FACTOR;
     count_sat = COEF_COUNT_SAT;
   }
-
   adapt_coef_probs(cm->fc.coef_probs_4x4, cm->fc.pre_coef_probs_4x4,
-                   cm->base_qindex, cm->fc.coef_counts_4x4,
+                   cm->fc.coef_counts_4x4,
                    cm->fc.eob_branch_counts[TX_4X4],
                    count_sat, update_factor);
   adapt_coef_probs(cm->fc.coef_probs_8x8, cm->fc.pre_coef_probs_8x8,
-                   cm->base_qindex, cm->fc.coef_counts_8x8,
+                   cm->fc.coef_counts_8x8,
                    cm->fc.eob_branch_counts[TX_8X8],
                    count_sat, update_factor);
   adapt_coef_probs(cm->fc.coef_probs_16x16, cm->fc.pre_coef_probs_16x16,
-                   cm->base_qindex, cm->fc.coef_counts_16x16,
+                   cm->fc.coef_counts_16x16,
                    cm->fc.eob_branch_counts[TX_16X16],
                    count_sat, update_factor);
   adapt_coef_probs(cm->fc.coef_probs_32x32, cm->fc.pre_coef_probs_32x32,
-                   cm->base_qindex, cm->fc.coef_counts_32x32,
+                   cm->fc.coef_counts_32x32,
                    cm->fc.eob_branch_counts[TX_32X32],
                    count_sat, update_factor);
-#endif
 }
index 9352bf66c229480e2e7e75f444041fb674e30b19..d5f6002bc3981b08547f4d68f17eb061a72869c7 100644 (file)
 
 extern const vp9_tree_index vp9_coef_tree[];
 
+#if CONFIG_MODELCOEFPROB
+#define DCT_EOB_MODEL_TOKEN     3      /* EOB       Extra Bits 0+0 */
+extern const vp9_tree_index vp9_coefmodel_tree[];
+#endif
+
 extern struct vp9_token vp9_coef_encodings[MAX_ENTROPY_TOKENS];
 
 typedef struct {
@@ -152,23 +157,32 @@ extern int vp9_get_coef_context(const int *scan, const int *neighbors,
 const int *vp9_get_coef_neighbors_handle(const int *scan, int *pad);
 
 #if CONFIG_MODELCOEFPROB
-#define COEFPROB_BITS               8
-#define COEFPROB_MODELS             (1 << COEFPROB_BITS)
+#define COEFPROB_MODELS             128  // 128 lists stored for probs 1, 3, ..., 255
 
-// 2 => EOB and Zero nodes are unconstrained, rest are modeled
-// 3 => EOB, Zero and One nodes are unconstrained, rest are modeled
-#define UNCONSTRAINED_NODES         3   // Choose one of 2 or 3
-
-// whether forward updates are model-based
-#define MODEL_BASED_UPDATE          1
-// if model-based how many nodes are unconstrained
-#define UNCONSTRAINED_UPDATE_NODES  3
-// whether backward updates are model-based
-#define MODEL_BASED_ADAPT           1
-#define UNCONSTRAINED_ADAPT_NODES   3
+#define UNCONSTRAINED_NODES         3
+#define MODEL_NODES                 (ENTROPY_NODES - UNCONSTRAINED_NODES)
+#define PIVOT_NODE                  2   // which node is pivot
 
 typedef vp9_prob vp9_coeff_probs_model[REF_TYPES][COEF_BANDS]
-                                      [PREV_COEF_CONTEXTS][2];
+                                      [PREV_COEF_CONTEXTS]
+                                      [UNCONSTRAINED_NODES];
+
+typedef unsigned int vp9_coeff_count_model[REF_TYPES][COEF_BANDS]
+                                          [PREV_COEF_CONTEXTS]
+                                          [UNCONSTRAINED_NODES + 1];
+typedef unsigned int vp9_coeff_stats_model[REF_TYPES][COEF_BANDS]
+                                          [PREV_COEF_CONTEXTS]
+                                          [UNCONSTRAINED_NODES][2];
+extern void vp9_full_to_model_counts(
+    vp9_coeff_count_model *model_count, vp9_coeff_count *full_count);
+
+void vp9_model_to_full_probs(const vp9_prob *model, int b, int r, vp9_prob *full);
+
+void vp9_model_to_full_probs_sb(
+    vp9_prob model[COEF_BANDS][PREV_COEF_CONTEXTS][UNCONSTRAINED_NODES],
+    int b, int r,
+    vp9_prob full[COEF_BANDS][PREV_COEF_CONTEXTS][ENTROPY_NODES]);
+
 extern const vp9_prob vp9_modelcoefprobs[COEFPROB_MODELS][ENTROPY_NODES - 1];
 void vp9_get_model_distribution(vp9_prob model, vp9_prob *tree_probs,
                                 int b, int r);
index 2d4cd30ccd446f0b70be24815522b5a36c5d2204..a39694ae5bc21f0a8c2dfe06866b8e96e736b47a 100644 (file)
@@ -58,11 +58,6 @@ typedef struct frame_contexts {
   vp9_prob sub_mv_ref_prob[SUBMVREF_COUNT][VP9_SUBMVREFS - 1];
   vp9_prob partition_prob[NUM_PARTITION_CONTEXTS][PARTITION_TYPES - 1];
 
-  vp9_coeff_probs coef_probs_4x4[BLOCK_TYPES];
-  vp9_coeff_probs coef_probs_8x8[BLOCK_TYPES];
-  vp9_coeff_probs coef_probs_16x16[BLOCK_TYPES];
-  vp9_coeff_probs coef_probs_32x32[BLOCK_TYPES];
-
   nmv_context nmvc;
   nmv_context pre_nmvc;
   vp9_prob pre_bmode_prob[VP9_NKF_BINTRAMODES - 1];
@@ -78,15 +73,33 @@ typedef struct frame_contexts {
   unsigned int sub_mv_ref_counts[SUBMVREF_COUNT][VP9_SUBMVREFS];
   unsigned int partition_counts[NUM_PARTITION_CONTEXTS][PARTITION_TYPES];
 
+#if CONFIG_MODELCOEFPROB
+  vp9_coeff_probs_model coef_probs_4x4[BLOCK_TYPES];
+  vp9_coeff_probs_model coef_probs_8x8[BLOCK_TYPES];
+  vp9_coeff_probs_model coef_probs_16x16[BLOCK_TYPES];
+  vp9_coeff_probs_model coef_probs_32x32[BLOCK_TYPES];
+  vp9_coeff_probs_model pre_coef_probs_4x4[BLOCK_TYPES];
+  vp9_coeff_probs_model pre_coef_probs_8x8[BLOCK_TYPES];
+  vp9_coeff_probs_model pre_coef_probs_16x16[BLOCK_TYPES];
+  vp9_coeff_probs_model pre_coef_probs_32x32[BLOCK_TYPES];
+  vp9_coeff_count_model coef_counts_4x4[BLOCK_TYPES];
+  vp9_coeff_count_model coef_counts_8x8[BLOCK_TYPES];
+  vp9_coeff_count_model coef_counts_16x16[BLOCK_TYPES];
+  vp9_coeff_count_model coef_counts_32x32[BLOCK_TYPES];
+#else
+  vp9_coeff_probs coef_probs_4x4[BLOCK_TYPES];
+  vp9_coeff_probs coef_probs_8x8[BLOCK_TYPES];
+  vp9_coeff_probs coef_probs_16x16[BLOCK_TYPES];
+  vp9_coeff_probs coef_probs_32x32[BLOCK_TYPES];
   vp9_coeff_probs pre_coef_probs_4x4[BLOCK_TYPES];
   vp9_coeff_probs pre_coef_probs_8x8[BLOCK_TYPES];
   vp9_coeff_probs pre_coef_probs_16x16[BLOCK_TYPES];
   vp9_coeff_probs pre_coef_probs_32x32[BLOCK_TYPES];
-
   vp9_coeff_count coef_counts_4x4[BLOCK_TYPES];
   vp9_coeff_count coef_counts_8x8[BLOCK_TYPES];
   vp9_coeff_count coef_counts_16x16[BLOCK_TYPES];
   vp9_coeff_count coef_counts_32x32[BLOCK_TYPES];
+#endif
   unsigned int eob_branch_counts[TX_SIZE_MAX_SB][BLOCK_TYPES][REF_TYPES]
                                 [COEF_BANDS][PREV_COEF_CONTEXTS];
 
index 8b6c267d2e9bb40c1a03f942490a9089e3f644d0..348961bec14fa0b283a37bd8d1bf39341f54ce06 100644 (file)
@@ -550,11 +550,16 @@ static void init_frame(VP9D_COMP *pbi) {
   xd->mode_info_stride = pc->mode_info_stride;
 }
 
-static void read_coef_probs_common(vp9_coeff_probs *coef_probs,
-                                   TX_SIZE tx_size,
-                                   vp9_reader *r) {
-#if CONFIG_MODELCOEFPROB && MODEL_BASED_UPDATE
-  const int entropy_nodes_update = UNCONSTRAINED_UPDATE_NODES;
+static void read_coef_probs_common(
+#if CONFIG_MODELCOEFPROB
+    vp9_coeff_probs_model *coef_probs,
+#else
+    vp9_coeff_probs *coef_probs,
+#endif
+    TX_SIZE tx_size,
+    vp9_reader *r) {
+#if CONFIG_MODELCOEFPROB
+  const int entropy_nodes_update = UNCONSTRAINED_NODES;
 #else
   const int entropy_nodes_update = ENTROPY_NODES;
 #endif
@@ -575,10 +580,6 @@ static void read_coef_probs_common(vp9_coeff_probs *coef_probs,
 
               if (vp9_read(r, vp9_coef_update_prob[m])) {
                 *p = read_prob_diff_update(r, *p);
-#if CONFIG_MODELCOEFPROB && MODEL_BASED_UPDATE
-                if (m == UNCONSTRAINED_NODES - 1)
-                  vp9_get_model_distribution(*p, coef_probs[i][j][k][l], i, j);
-#endif
               }
             }
           }
index 22d3cf8ca81283764c84f670ef00ec049f9aad1f..076f4a89c606221cfb5eeeaa980fab681ec37dab 100644 (file)
@@ -60,12 +60,23 @@ static const vp9_prob cat6_prob[15] = {
 
 DECLARE_ALIGNED(16, extern const uint8_t, vp9_norm[256]);
 
+#if CONFIG_MODELCOEFPROB
+#define INCREMENT_COUNT(token)               \
+  do {                                       \
+    coef_counts[type][ref][band][pt]         \
+               [token >= TWO_TOKEN ?     \
+                (token == DCT_EOB_TOKEN ? DCT_EOB_MODEL_TOKEN : TWO_TOKEN) : \
+                token]++;     \
+    token_cache[scan[c]] = token; \
+  } while (0)
+#else
 #define INCREMENT_COUNT(token)               \
   do {                                       \
     coef_counts[type][ref][band] \
                [pt][token]++;     \
     token_cache[scan[c]] = token; \
   } while (0)
+#endif
 
 #define WRITE_COEF_CONTINUE(val, token)                  \
   {                                                      \
@@ -91,9 +102,27 @@ static int decode_coefs(VP9D_COMP *dx, const MACROBLOCKD *xd,
   FRAME_CONTEXT *const fc = &dx->common.fc;
   int pt, c = 0, pad, default_eob;
   int band;
-  vp9_coeff_probs *coef_probs;
+#if CONFIG_MODELCOEFPROB
+  vp9_prob (*coef_probs)[PREV_COEF_CONTEXTS][UNCONSTRAINED_NODES];
+  vp9_prob coef_probs_full[COEF_BANDS][PREV_COEF_CONTEXTS][ENTROPY_NODES];
+  uint8_t load_map[COEF_BANDS][PREV_COEF_CONTEXTS] = {
+    {0, 0, 0, 0, 0, 0},
+    {0, 0, 0, 0, 0, 0},
+    {0, 0, 0, 0, 0, 0},
+    {0, 0, 0, 0, 0, 0},
+    {0, 0, 0, 0, 0, 0},
+    {0, 0, 0, 0, 0, 0},
+  };
+#else
+  vp9_prob (*coef_probs)[PREV_COEF_CONTEXTS][ENTROPY_NODES];
+#endif
+
   vp9_prob *prob;
+#if CONFIG_MODELCOEFPROB
+  vp9_coeff_count_model *coef_counts;
+#else
   vp9_coeff_count *coef_counts;
+#endif
   const int ref = xd->mode_info_context->mbmi.ref_frame != INTRA_FRAME;
   TX_TYPE tx_type = DCT_DCT;
   const int *scan, *nb;
@@ -108,7 +137,7 @@ static int decode_coefs(VP9D_COMP *dx, const MACROBLOCKD *xd,
       scan = get_scan_4x4(tx_type);
       above_ec = A[0] != 0;
       left_ec = L[0] != 0;
-      coef_probs  = fc->coef_probs_4x4;
+      coef_probs  = fc->coef_probs_4x4[type][ref];
       coef_counts = fc->coef_counts_4x4;
       default_eob = 16;
       band_translate = vp9_coefband_trans_4x4;
@@ -122,7 +151,7 @@ static int decode_coefs(VP9D_COMP *dx, const MACROBLOCKD *xd,
       tx_type = (type == PLANE_TYPE_Y_WITH_DC) ?
           get_tx_type_8x8(xd, y + (x >> 1)) : DCT_DCT;
       scan = get_scan_8x8(tx_type);
-      coef_probs  = fc->coef_probs_8x8;
+      coef_probs  = fc->coef_probs_8x8[type][ref];
       coef_counts = fc->coef_counts_8x8;
       above_ec = (A[0] + A[1]) != 0;
       left_ec = (L[0] + L[1]) != 0;
@@ -138,7 +167,7 @@ static int decode_coefs(VP9D_COMP *dx, const MACROBLOCKD *xd,
       tx_type = (type == PLANE_TYPE_Y_WITH_DC) ?
           get_tx_type_16x16(xd, y + (x >> 2)) : DCT_DCT;
       scan = get_scan_16x16(tx_type);
-      coef_probs  = fc->coef_probs_16x16;
+      coef_probs  = fc->coef_probs_16x16[type][ref];
       coef_counts = fc->coef_counts_16x16;
       above_ec = (A[0] + A[1] + A[2] + A[3]) != 0;
       left_ec = (L[0] + L[1] + L[2] + L[3]) != 0;
@@ -148,7 +177,7 @@ static int decode_coefs(VP9D_COMP *dx, const MACROBLOCKD *xd,
     }
     case TX_32X32:
       scan = vp9_default_zig_zag1d_32x32;
-      coef_probs = fc->coef_probs_32x32;
+      coef_probs = fc->coef_probs_32x32[type][ref];
       coef_counts = fc->coef_counts_32x32;
       above_ec = (A[0] + A[1] + A[2] + A[3] + A[4] + A[5] + A[6] + A[7]) != 0;
       left_ec = (L[0] + L[1] + L[2] + L[3] + L[4] + L[5] + L[6] + L[7]) != 0;
@@ -169,7 +198,7 @@ static int decode_coefs(VP9D_COMP *dx, const MACROBLOCKD *xd,
       pt = vp9_get_coef_context(scan, nb, pad, token_cache,
                                 c, default_eob);
     band = get_coef_band(band_translate, c);
-    prob = coef_probs[type][ref][band][pt];
+    prob = coef_probs[band][pt];
     fc->eob_branch_counts[txfm_size][type][ref][band][pt]++;
     if (!vp9_read(r, prob[EOB_CONTEXT_NODE]))
       break;
@@ -181,7 +210,7 @@ SKIP_START:
       pt = vp9_get_coef_context(scan, nb, pad, token_cache,
                                 c, default_eob);
     band = get_coef_band(band_translate, c);
-    prob = coef_probs[type][ref][band][pt];
+    prob = coef_probs[band][pt];
 
     if (!vp9_read(r, prob[ZERO_CONTEXT_NODE])) {
       INCREMENT_COUNT(ZERO_TOKEN);
@@ -192,6 +221,15 @@ SKIP_START:
     if (!vp9_read(r, prob[ONE_CONTEXT_NODE])) {
       WRITE_COEF_CONTINUE(1, ONE_TOKEN);
     }
+#if CONFIG_MODELCOEFPROB
+    // Load full probabilities if not already loaded
+    if (!load_map[band][pt]) {
+      vp9_model_to_full_probs(coef_probs[band][pt], type, ref,
+                              coef_probs_full[band][pt]);
+      load_map[band][pt] = 1;
+    }
+    prob = coef_probs_full[band][pt];
+#endif
     // LOW_VAL_CONTEXT_NODE_0_
     if (!vp9_read(r, prob[LOW_VAL_CONTEXT_NODE])) {
       if (!vp9_read(r, prob[TWO_CONTEXT_NODE])) {
@@ -249,7 +287,11 @@ SKIP_START:
   }
 
   if (c < seg_eob)
+#if CONFIG_MODELCOEFPROB
+    coef_counts[type][ref][band][pt][DCT_EOB_MODEL_TOKEN]++;
+#else
     coef_counts[type][ref][band][pt][DCT_EOB_TOKEN]++;
+#endif
 
   for (pt = 0; pt < (1 << txfm_size); pt++) {
     A[pt] = L[pt] = c > 0;
index b400e3aa7332e7bdaa84e349d80a152e07cabcae..70b2333429fb1462386b353aaa4efe9c5f0cf870 100644 (file)
@@ -53,7 +53,6 @@ extern unsigned int active_section;
 #define vp9_cost_upd  ((int)(vp9_cost_one(upd) - vp9_cost_zero(upd)) >> 8)
 #define vp9_cost_upd256  ((int)(vp9_cost_one(upd) - vp9_cost_zero(upd)))
 
-#define SEARCH_NEWP
 static int update_bits[255];
 
 static INLINE void write_le16(uint8_t *p, int value) {
@@ -311,31 +310,33 @@ static int prob_diff_update_savings_search(const unsigned int *ct,
   return bestsavings;
 }
 
-#if CONFIG_MODELCOEFPROB && MODEL_BASED_UPDATE
+#if CONFIG_MODELCOEFPROB
 static int prob_diff_update_savings_search_model(const unsigned int *ct,
                                                  const vp9_prob *oldp,
                                                  vp9_prob *bestp,
                                                  const vp9_prob upd,
-                                                 int b, int r, int q) {
+                                                 int b, int r) {
   int i, old_b, new_b, update_b, savings, bestsavings, step;
   int newp;
-  vp9_prob bestnewp, newplist[ENTROPY_NODES];
-  for (i = UNCONSTRAINED_NODES - 1, old_b = 0; i < ENTROPY_NODES; ++i)
-    old_b += cost_branch256(ct + 2 * i, oldp[i]);
+  vp9_prob bestnewp, newplist[ENTROPY_NODES], oldplist[ENTROPY_NODES];
+  vp9_model_to_full_probs(oldp, b, r, oldplist);
+  for (i = UNCONSTRAINED_NODES, old_b = 0; i < ENTROPY_NODES; ++i)
+    old_b += cost_branch256(ct + 2 * i, oldplist[i]);
+  old_b += cost_branch256(ct + 2 * PIVOT_NODE, oldplist[PIVOT_NODE]);
 
   bestsavings = 0;
-  bestnewp = oldp[UNCONSTRAINED_NODES - 1];
+  bestnewp = oldp[PIVOT_NODE];
 
-  step = (*bestp > oldp[UNCONSTRAINED_NODES - 1] ? -1 : 1);
+  step = (*bestp > oldp[PIVOT_NODE] ? -1 : 1);
   newp = *bestp;
-  // newp = *bestp - step * (abs(*bestp - oldp[UNCONSTRAINED_NODES - 1]) >> 1);
-  for (; newp != oldp[UNCONSTRAINED_NODES - 1]; newp += step) {
+  for (; newp != oldp[PIVOT_NODE]; newp += step) {
     if (newp < 1 || newp > 255) continue;
-    newplist[UNCONSTRAINED_NODES - 1] = newp;
+    newplist[PIVOT_NODE] = newp;
     vp9_get_model_distribution(newp, newplist, b, r);
-    for (i = UNCONSTRAINED_NODES - 1, new_b = 0; i < ENTROPY_NODES; ++i)
+    for (i = UNCONSTRAINED_NODES, new_b = 0; i < ENTROPY_NODES; ++i)
       new_b += cost_branch256(ct + 2 * i, newplist[i]);
-    update_b = prob_diff_update_cost(newp, oldp[UNCONSTRAINED_NODES - 1]) +
+    new_b += cost_branch256(ct + 2 * PIVOT_NODE, newplist[PIVOT_NODE]);
+    update_b = prob_diff_update_cost(newp, oldp[PIVOT_NODE]) +
         vp9_cost_upd256;
     savings = old_b - new_b - update_b;
     if (savings > bestsavings) {
@@ -373,16 +374,29 @@ static void pack_mb_tokens(vp9_writer* const bc,
     const struct vp9_token *const a = vp9_coef_encodings + t;
     const vp9_extra_bit *const b = vp9_extra_bits + t;
     int i = 0;
-    const unsigned char *pp = p->context_tree;
+    const vp9_prob *pp;
     int v = a->value;
     int n = a->len;
     int ncount = n;
+#if CONFIG_MODELCOEFPROB
+    vp9_prob probs[ENTROPY_NODES];
+#endif
 
-    if (t == EOSB_TOKEN)
-    {
+    if (t == EOSB_TOKEN) {
       ++p;
       break;
     }
+#if CONFIG_MODELCOEFPROB
+    if (t >= TWO_TOKEN) {
+      vp9_model_to_full_probs(p->context_tree,
+                              p->block_type, p->ref_type, probs);
+      pp = probs;
+    } else {
+      pp = p->context_tree;
+    }
+#else
+    pp = p->context_tree;
+#endif
     assert(pp != 0);
 
     /* skip one or two nodes */
@@ -399,19 +413,18 @@ static void pack_mb_tokens(vp9_writer* const bc,
       ncount--;
     } while (n && ncount);
 
-
     if (b->base_val) {
       const int e = p->extra, l = b->len;
 
       if (l) {
-        const unsigned char *pp = b->prob;
+        const unsigned char *pb = b->prob;
         int v = e >> 1;
         int n = l;              /* number of bits in v, assumed nonzero */
         int i = 0;
 
         do {
           const int bb = (v >> --n) & 1;
-          vp9_write(bc, bb, pp[i >> 1]);
+          vp9_write(bc, bb, pb[i >> 1]);
           i = b->tree[i + bb];
         } while (n);
       }
@@ -1098,20 +1111,26 @@ static void build_coeff_contexts(VP9_COMP *cpi) {
                           cpi->frame_branch_ct_32x32, BLOCK_TYPES);
 }
 
-static void update_coef_probs_common(vp9_writer* const bc,
-                                     VP9_COMP *cpi,
+static void update_coef_probs_common(
+    vp9_writer* const bc,
+    VP9_COMP *cpi,
 #ifdef ENTROPY_STATS
-                                     vp9_coeff_stats *tree_update_hist,
+    vp9_coeff_stats *tree_update_hist,
 #endif
-                                     vp9_coeff_probs *new_frame_coef_probs,
-                                     vp9_coeff_probs *old_frame_coef_probs,
-                                     vp9_coeff_stats *frame_branch_ct,
-                                     TX_SIZE tx_size) {
+    vp9_coeff_probs *new_frame_coef_probs,
+#if CONFIG_MODELCOEFPROB
+    vp9_coeff_probs_model *old_frame_coef_probs,
+#else
+    vp9_coeff_probs *old_frame_coef_probs,
+#endif
+    vp9_coeff_stats *frame_branch_ct,
+    TX_SIZE tx_size) {
   int i, j, k, l, t;
   int update[2] = {0, 0};
   int savings;
-#if CONFIG_MODELCOEFPROB && MODEL_BASED_UPDATE
-  const int entropy_nodes_update = UNCONSTRAINED_UPDATE_NODES;
+
+#if CONFIG_MODELCOEFPROB
+  const int entropy_nodes_update = UNCONSTRAINED_NODES;
 #else
   const int entropy_nodes_update = ENTROPY_NODES;
 #endif
@@ -1134,13 +1153,11 @@ static void update_coef_probs_common(vp9_writer* const bc,
 
             if (l >= 3 && k == 0)
               continue;
-#if defined(SEARCH_NEWP)
-#if CONFIG_MODELCOEFPROB && MODEL_BASED_UPDATE
-            if (t == UNCONSTRAINED_NODES - 1)
+#if CONFIG_MODELCOEFPROB
+            if (t == PIVOT_NODE)
               s = prob_diff_update_savings_search_model(
                   frame_branch_ct[i][j][k][l][0],
-                  old_frame_coef_probs[i][j][k][l], &newp, upd, i, j,
-                  cpi->common.base_qindex);
+                  old_frame_coef_probs[i][j][k][l], &newp, upd, i, j);
             else
 #endif
               s = prob_diff_update_savings_search(
@@ -1151,15 +1168,6 @@ static void update_coef_probs_common(vp9_writer* const bc,
               savings += s - (int)(vp9_cost_zero(upd));
             else
               savings -= (int)(vp9_cost_zero(upd));
-#else
-            s = prob_update_savings(frame_branch_ct[i][j][k][l][t],
-                                    oldp, newp, upd);
-            if (s > 0)
-              u = 1;
-            if (u)
-              savings += s;
-#endif
-
             update[u]++;
           }
         }
@@ -1189,13 +1197,11 @@ static void update_coef_probs_common(vp9_writer* const bc,
             if (l >= 3 && k == 0)
               continue;
 
-#if defined(SEARCH_NEWP)
-#if CONFIG_MODELCOEFPROB && MODEL_BASED_UPDATE
-            if (t == UNCONSTRAINED_NODES - 1)
+#if CONFIG_MODELCOEFPROB
+            if (t == PIVOT_NODE)
               s = prob_diff_update_savings_search_model(
                   frame_branch_ct[i][j][k][l][0],
-                  old_frame_coef_probs[i][j][k][l], &newp, upd, i, j,
-                  cpi->common.base_qindex);
+                  old_frame_coef_probs[i][j][k][l], &newp, upd, i, j);
             else
 #endif
               s = prob_diff_update_savings_search(
@@ -1203,12 +1209,6 @@ static void update_coef_probs_common(vp9_writer* const bc,
                   *oldp, &newp, upd);
             if (s > 0 && newp != *oldp)
               u = 1;
-#else
-            s = prob_update_savings(frame_branch_ct[i][j][k][l][t],
-                                    *oldp, newp, upd);
-            if (s > 0)
-              u = 1;
-#endif
             vp9_write(bc, u, upd);
 #ifdef ENTROPY_STATS
             if (!cpi->dummy_packing)
@@ -1218,11 +1218,6 @@ static void update_coef_probs_common(vp9_writer* const bc,
               /* send/use new probability */
               write_prob_diff_update(bc, newp, *oldp);
               *oldp = newp;
-#if CONFIG_MODELCOEFPROB && MODEL_BASED_UPDATE
-              if (t == UNCONSTRAINED_NODES - 1)
-                vp9_get_model_distribution(
-                    newp, old_frame_coef_probs[i][j][k][l], i, j);
-#endif
             }
           }
         }
index 1aefa2c01d851ec9ba86fc4789092d2ebd937e88..a144c1bd42ef09a7d53803498ff505472fbe67a9 100644 (file)
@@ -3174,10 +3174,22 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi,
 
   release_scaled_references(cpi);
   update_reference_frames(cpi);
+
+#if CONFIG_MODELCOEFPROB
+  vp9_full_to_model_counts(cpi->common.fc.coef_counts_4x4,
+                           cpi->coef_counts_4x4);
+  vp9_full_to_model_counts(cpi->common.fc.coef_counts_8x8,
+                           cpi->coef_counts_8x8);
+  vp9_full_to_model_counts(cpi->common.fc.coef_counts_16x16,
+                           cpi->coef_counts_16x16);
+  vp9_full_to_model_counts(cpi->common.fc.coef_counts_32x32,
+                           cpi->coef_counts_32x32);
+#else
   vp9_copy(cpi->common.fc.coef_counts_4x4, cpi->coef_counts_4x4);
   vp9_copy(cpi->common.fc.coef_counts_8x8, cpi->coef_counts_8x8);
   vp9_copy(cpi->common.fc.coef_counts_16x16, cpi->coef_counts_16x16);
   vp9_copy(cpi->common.fc.coef_counts_32x32, cpi->coef_counts_32x32);
+#endif
   if (!cpi->common.error_resilient_mode &&
       !cpi->common.frame_parallel_decoding_mode) {
     vp9_adapt_coef_probs(&cpi->common);
index 54caf1d1ad869e4095d8deff8cd92211a2fc6a35..b61472f4f7fcf249cf6ddc328a37225e200e0feb 100644 (file)
@@ -76,10 +76,17 @@ typedef struct {
   // 0 = I4X4_PRED, ZERO_MV, MV, SPLIT
   signed char last_mode_lf_deltas[MAX_MODE_LF_DELTAS];
 
+#if CONFIG_MODELCOEFPROB
+  vp9_coeff_probs_model coef_probs_4x4[BLOCK_TYPES];
+  vp9_coeff_probs_model coef_probs_8x8[BLOCK_TYPES];
+  vp9_coeff_probs_model coef_probs_16x16[BLOCK_TYPES];
+  vp9_coeff_probs_model coef_probs_32x32[BLOCK_TYPES];
+#else
   vp9_coeff_probs coef_probs_4x4[BLOCK_TYPES];
   vp9_coeff_probs coef_probs_8x8[BLOCK_TYPES];
   vp9_coeff_probs coef_probs_16x16[BLOCK_TYPES];
   vp9_coeff_probs coef_probs_32x32[BLOCK_TYPES];
+#endif
 
   vp9_prob sb_ymode_prob[VP9_I32X32_MODES - 1];
   vp9_prob ymode_prob[VP9_YMODES - 1]; /* interframe intra mode probs */
index ff437c18e99a34538616acf6858bb436426803d0..e6330047ef1d04ea0951ee2de275a650a850777d 100644 (file)
@@ -106,16 +106,28 @@ const MODE_DEFINITION vp9_mode_order[MAX_MODES] = {
 };
 
 static void fill_token_costs(vp9_coeff_count *c,
+#if CONFIG_MODELCOEFPROB
+                             vp9_coeff_probs_model *p,
+#else
                              vp9_coeff_probs *p,
+#endif
                              TX_SIZE tx_size) {
   int i, j, k, l;
 
   for (i = 0; i < BLOCK_TYPES; i++)
     for (j = 0; j < REF_TYPES; j++)
       for (k = 0; k < COEF_BANDS; k++)
-        for (l = 0; l < PREV_COEF_CONTEXTS; l++)
+        for (l = 0; l < PREV_COEF_CONTEXTS; l++) {
+#if CONFIG_MODELCOEFPROB
+          vp9_prob probs[ENTROPY_NODES];
+          vp9_model_to_full_probs(p[i][j][k][l], i, j, probs);
+          vp9_cost_tokens_skip((int *)c[i][j][k][l], probs,
+                               vp9_coef_tree);
+#else
           vp9_cost_tokens_skip((int *)c[i][j][k][l], p[i][j][k][l],
                                vp9_coef_tree);
+#endif
+        }
 }
 
 static int rd_iifactor[32] =  { 4, 4, 3, 2, 1, 0, 0, 0,
@@ -268,8 +280,11 @@ static INLINE int cost_coeffs(VP9_COMMON *const cm, MACROBLOCK *mb,
   TX_TYPE tx_type = DCT_DCT;
 
   const int segment_id = xd->mode_info_context->mbmi.segment_id;
-  vp9_prob (*coef_probs)[REF_TYPES][COEF_BANDS][PREV_COEF_CONTEXTS]
-                        [ENTROPY_NODES];
+#if CONFIG_MODELCOEFPROB
+  vp9_prob coef_probs[COEF_BANDS][PREV_COEF_CONTEXTS][ENTROPY_NODES];
+#else
+  vp9_prob (*coef_probs)[PREV_COEF_CONTEXTS][ENTROPY_NODES];
+#endif
   int seg_eob, default_eob;
   uint8_t token_cache[1024];
   const uint8_t * band_translate;
@@ -289,7 +304,12 @@ static INLINE int cost_coeffs(VP9_COMMON *const cm, MACROBLOCK *mb,
           get_tx_type_4x4(xd, block) : DCT_DCT;
       above_ec = A[0] != 0;
       left_ec = L[0] != 0;
-      coef_probs = cm->fc.coef_probs_4x4;
+#if CONFIG_MODELCOEFPROB
+      vp9_model_to_full_probs_sb(cm->fc.coef_probs_4x4[type][ref],
+                                 type, ref, coef_probs);
+#else
+      coef_probs = cm->fc.coef_probs_4x4[type][ref];
+#endif
       seg_eob = 16;
       scan = get_scan_4x4(tx_type);
       band_translate = vp9_coefband_trans_4x4;
@@ -304,7 +324,12 @@ static INLINE int cost_coeffs(VP9_COMMON *const cm, MACROBLOCK *mb,
       above_ec = (A[0] + A[1]) != 0;
       left_ec = (L[0] + L[1]) != 0;
       scan = get_scan_8x8(tx_type);
-      coef_probs = cm->fc.coef_probs_8x8;
+#if CONFIG_MODELCOEFPROB
+      vp9_model_to_full_probs_sb(cm->fc.coef_probs_8x8[type][ref],
+                                 type, ref, coef_probs);
+#else
+      coef_probs = cm->fc.coef_probs_8x8[type][ref];
+#endif
       seg_eob = 64;
       band_translate = vp9_coefband_trans_8x8plus;
       break;
@@ -316,7 +341,12 @@ static INLINE int cost_coeffs(VP9_COMMON *const cm, MACROBLOCK *mb,
       TX_TYPE tx_type = (type == PLANE_TYPE_Y_WITH_DC) ?
           get_tx_type_16x16(xd, y + (x >> 2)) : DCT_DCT;
       scan = get_scan_16x16(tx_type);
-      coef_probs = cm->fc.coef_probs_16x16;
+#if CONFIG_MODELCOEFPROB
+      vp9_model_to_full_probs_sb(cm->fc.coef_probs_16x16[type][ref],
+                                 type, ref, coef_probs);
+#else
+      coef_probs = cm->fc.coef_probs_16x16[type][ref];
+#endif
       seg_eob = 256;
       above_ec = (A[0] + A[1] + A[2] + A[3]) != 0;
       left_ec = (L[0] + L[1] + L[2] + L[3]) != 0;
@@ -325,7 +355,12 @@ static INLINE int cost_coeffs(VP9_COMMON *const cm, MACROBLOCK *mb,
     }
     case TX_32X32:
       scan = vp9_default_zig_zag1d_32x32;
-      coef_probs = cm->fc.coef_probs_32x32;
+#if CONFIG_MODELCOEFPROB
+      vp9_model_to_full_probs_sb(cm->fc.coef_probs_32x32[type][ref],
+                                 type, ref, coef_probs);
+#else
+      coef_probs = cm->fc.coef_probs_32x32[type][ref];
+#endif
       seg_eob = 1024;
       above_ec = (A[0] + A[1] + A[2] + A[3] + A[4] + A[5] + A[6] + A[7]) != 0;
       left_ec = (L[0] + L[1] + L[2] + L[3] + L[4] + L[5] + L[6] + L[7]) != 0;
@@ -359,7 +394,7 @@ static INLINE int cost_coeffs(VP9_COMMON *const cm, MACROBLOCK *mb,
       cost += token_costs[band][pt][t] + vp9_dct_value_cost_ptr[v];
 
       if (!c || token_cache[scan[c - 1]])
-        cost += vp9_cost_bit(coef_probs[type][ref][band][pt][0], 1);
+        cost += vp9_cost_bit(coef_probs[band][pt][0], 1);
       token_cache[scan[c]] = t;
     }
     if (c < seg_eob) {
index 50d849d41e209b7f54c83a126522d6ef9db9609c..9ed16ffc38f80b968eb3682b664e2add67f845ff 100644 (file)
@@ -136,7 +136,11 @@ static void tokenize_b(int plane, int block, BLOCK_SIZE_TYPE bsize,
   const int segment_id = mbmi->segment_id;
   const int *scan, *nb;
   vp9_coeff_count *counts;
+#if CONFIG_MODELCOEFPROB
+  vp9_coeff_probs_model *coef_probs;
+#else
   vp9_coeff_probs *coef_probs;
+#endif
   const int ref = mbmi->ref_frame != INTRA_FRAME;
   ENTROPY_CONTEXT above_ec, left_ec;
   uint8_t token_cache[1024];
@@ -224,7 +228,11 @@ static void tokenize_b(int plane, int block, BLOCK_SIZE_TYPE bsize,
 
     t->token = token;
     t->context_tree = coef_probs[type][ref][band][pt];
-      t->skip_eob_node = (c > 0) && (token_cache[scan[c - 1]] == 0);
+#if CONFIG_MODELCOEFPROB
+    t->block_type = type;
+    t->ref_type = ref;
+#endif
+    t->skip_eob_node = (c > 0) && (token_cache[scan[c - 1]] == 0);
     assert(vp9_coef_encodings[t->token].len - t->skip_eob_node > 0);
 
     if (!dry_run) {
index bff5cfd4b7837999bafff404cc67ab26dec86616..2a56da8d1deaa30b440db73b843492633a2039e3 100644 (file)
@@ -26,8 +26,9 @@ typedef struct {
   int16_t         extra;
   uint8_t         token;
   uint8_t         skip_eob_node;
-#if CONFIG_CODE_ZEROGROUP
-  uint8_t         skip_coef_val;
+#if CONFIG_MODELCOEFPROB
+  uint8_t         block_type;
+  uint8_t         ref_type;
 #endif
 } TOKENEXTRA;