Use above/left (instead of previous in scan-order) as token context.
authorRonald S. Bultje <rbultje@google.com>
Tue, 26 Mar 2013 23:46:09 +0000 (16:46 -0700)
committerRonald S. Bultje <rbultje@google.com>
Tue, 26 Mar 2013 23:46:09 +0000 (16:46 -0700)
Pearson correlation for above or left is significantly higher than for
previous-in-scan-order (absolute values depend on position in scan, but
in general, we gain about 0.1-0.2 by using either above or left; using
both basically just makes this even better). For eob branch skipping,
we continue to use the previous token in scan order.

This helps about 0.9% on derf after re-training on a limited data set.
Full re-training and results on larger-resolution clips are pending.

Note that this commit breaks trellis, so we can probably get further
gains out of it by fixing trellis at some later point.

Change-Id: Iead68e296fc3a105cca746b5e3da9555d6010cfe

13 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_encodeframe.c
vp9/encoder/vp9_encodemb.c
vp9/encoder/vp9_rdopt.c
vp9/encoder/vp9_tokenize.c
vp9/encoder/vp9_tokenize.h
vp9/encoder/vp9_treewriter.c

index 455fb8c..26c857b 100644 (file)
@@ -19,169 +19,169 @@ static const vp9_coeff_probs default_coef_probs_4x4[BLOCK_TYPES] = {
   { /* block Type 0 */
     { /* Intra */
       { /* Coeff Band 0 */
-        { 208,  26, 124, 168, 135, 159, 164, 134, 213, 172, 169 },
-        { 112,  36, 114, 171, 139, 161, 165, 138, 208, 167, 168 },
-        {  21,  27,  55, 109, 115, 147, 126, 121, 190, 151, 167 }
+        { 201,  32, 166, 187, 155, 167, 175, 141, 211, 179, 126 },
+        {  96,  39, 117, 157, 143, 158, 146, 131, 196, 159, 160 },
+        {  13,  28,  54, 109, 114, 147, 133, 120, 205, 154, 188 }
       }, { /* Coeff Band 1 */
-        {   1,  94, 156, 203, 156, 169, 200, 154, 230, 184, 206 },
-        {  85,  91, 161, 202, 155, 170, 198, 151, 233, 184, 214 },
-        {  57,  78, 131, 203, 157, 169, 198, 152, 231, 184, 214 },
-        {  36,  68, 104, 191, 135, 164, 199, 153, 231, 183, 208 },
-        {  16,  51,  68, 154, 115, 150, 192, 140, 231, 184, 210 },
-        {   5,  31,  32,  83, 100, 140, 121, 115, 192, 153, 182 }
+        { 128,  91, 156, 207, 155, 169, 211, 156, 244, 198, 224 },
+        {  72,  84, 154, 208, 157, 170, 211, 156, 244, 198, 227 },
+        {  34,  68, 123, 203, 149, 169, 211, 157, 243, 199, 227 },
+        {  14,  53,  92, 187, 127, 159, 210, 156, 244, 198, 223 },
+        {   3,  35,  56, 140, 108, 145, 200, 134, 245, 200, 227 },
+        {   1,  15,  22,  68,  92, 136, 117, 107, 218, 158, 208 }
       }, { /* Coeff Band 2 */
-        {   1,  72, 146, 177, 149, 168, 157, 135, 200, 159, 184 },
-        {  68,  72, 148, 180, 153, 166, 157, 139, 198, 156, 187 },
-        {  29,  68, 112, 178, 150, 162, 159, 144, 191, 153, 183 },
-        {  12,  57,  83, 164, 125, 157, 162, 141, 186, 156, 178 },
-        {   4,  42,  52, 125, 108, 145, 161, 130, 190, 166, 170 },
-        {   1,  28,  25,  67,  98, 138,  99, 110, 175, 143, 167 }
+        {  24,  81, 164, 207, 158, 170, 205, 153, 241, 193, 221 },
+        {  48,  75, 154, 206, 157, 169, 206, 154, 241, 193, 226 },
+        {  18,  64, 123, 201, 150, 168, 205, 154, 240, 192, 225 },
+        {   6,  51,  90, 187, 130, 161, 204, 152, 239, 192, 221 },
+        {   1,  33,  52, 143, 106, 145, 195, 139, 239, 191, 220 },
+        {   1,  15,  19,  65,  89, 135, 117, 105, 214, 157, 202 }
       }, { /* Coeff Band 3 */
-        {   1, 113, 176, 199, 161, 171, 167, 146, 188, 154, 194 },
-        {  75,  97, 166, 206, 161, 172, 188, 156, 203, 164, 208 },
-        {  31,  83, 131, 200, 152, 168, 191, 157, 200, 169, 206 },
-        {  18,  70,  99, 185, 131, 162, 194, 153, 202, 177, 201 },
-        {   8,  55,  70, 146, 115, 150, 187, 136, 215, 188, 191 },
-        {   2,  46,  42,  87, 109, 144, 111, 117, 185, 148, 182 }
+        {  46, 119, 186, 221, 170, 176, 214, 161, 241, 193, 228 },
+        {  50, 100, 175, 224, 170, 177, 219, 165, 243, 197, 227 },
+        {  17,  77, 137, 217, 157, 174, 219, 166, 243, 200, 230 },
+        {   6,  58,  98, 195, 133, 162, 216, 160, 244, 201, 228 },
+        {   2,  38,  61, 149, 111, 147, 200, 138, 243, 199, 225 },
+        {   1,  17,  25,  76,  94, 138, 126, 109, 221, 161, 212 }
       }, { /* Coeff Band 4 */
-        {   1, 128, 191, 217, 169, 174, 203, 163, 201, 178, 196 },
-        {  73, 105, 177, 220, 168, 175, 212, 167, 222, 185, 212 },
-        {  22,  82, 135, 212, 157, 172, 212, 165, 220, 187, 213 },
-        {  10,  65,  95, 194, 133, 162, 210, 160, 223, 194, 208 },
-        {   5,  45,  59, 145, 108, 147, 196, 142, 230, 196, 197 },
-        {   2,  30,  29,  76,  98, 140, 119, 112, 205, 158, 185 }
+        {  56, 131, 201, 231, 179, 181, 227, 172, 248, 209, 235 },
+        {  52, 105, 187, 233, 179, 183, 229, 175, 248, 213, 240 },
+        {  12,  77, 142, 225, 162, 178, 229, 173, 250, 214, 247 },
+        {   3,  53,  93, 197, 133, 163, 222, 163, 250, 211, 240 },
+        {   1,  31,  50, 145, 104, 145, 203, 140, 247, 204, 233 },
+        {   1,  13,  19,  66,  85, 132, 129, 105, 228, 166, 217 }
       }, { /* Coeff Band 5 */
-        {   1, 101, 208, 232, 179, 179, 236, 181, 243, 216, 210 },
-        { 110,  84, 194, 231, 177, 180, 233, 177, 246, 213, 224 },
-        {  50,  68, 148, 224, 166, 177, 229, 173, 245, 209, 215 },
-        {  29,  55, 105, 207, 139, 168, 224, 167, 244, 207, 225 },
-        {  17,  38,  65, 157, 111, 148, 206, 148, 242, 202, 215 },
-        {   7,  18,  28,  76,  96, 138, 125, 111, 219, 162, 206 }
+        {  93,  99, 221, 242, 194, 189, 240, 187, 251, 227, 199 },
+        { 104,  81, 205, 242, 191, 190, 240, 187, 253, 227, 248 },
+        {  39,  60, 155, 234, 172, 183, 237, 182, 254, 224, 251 },
+        {  14,  42,  96, 203, 136, 166, 226, 166, 253, 216, 244 },
+        {   4,  25,  49, 144, 102, 144, 205, 141, 249, 207, 238 },
+        {   1,  10,  19,  65,  86, 131, 132, 103, 233, 171, 221 }
       }
     }, { /* Inter */
       { /* Coeff Band 0 */
-        { 221, 105, 211, 220, 170, 171, 233, 173, 241, 200, 201 },
-        { 144, 102, 184, 206, 160, 167, 209, 163, 227, 186, 193 },
-        {  51,  84, 132, 174, 146, 161, 165, 144, 190, 163, 175 }
+        { 218, 134, 212, 233, 187, 182, 227, 169, 250, 213, 211 },
+        { 137, 121, 176, 211, 169, 173, 200, 153, 236, 191, 201 },
+        {  43,  96, 132, 181, 150, 164, 177, 141, 224, 175, 197 }
       }, { /* Coeff Band 1 */
-        {   1, 167, 216, 217, 170, 171, 217, 178, 213, 176, 216 },
-        {  89, 146, 210, 227, 185, 182, 198, 165, 203, 166, 216 },
-        {  37, 117, 171, 232, 185, 185, 197, 175, 191, 159, 212 },
-        {  30,  99, 128, 224, 150, 177, 210, 179, 183, 162, 211 },
-        {  25,  84,  92, 173, 121, 150, 222, 161, 201, 199, 201 },
-        {   8,  56,  65, 121, 119, 148, 150, 124, 198, 170, 191 }
+        { 128, 178, 225, 239, 192, 188, 232, 178, 250, 216, 243 },
+        {  29, 147, 210, 239, 191, 189, 231, 176, 249, 215, 239 },
+        {  20, 101, 159, 236, 177, 189, 231, 178, 249, 214, 248 },
+        {   7,  69, 107, 219, 132, 168, 235, 185, 250, 214, 245 },
+        {   2,  40,  62, 150, 106, 142, 228, 146, 252, 223, 242 },
+        {   1,  18,  28,  74,  96, 139, 127, 103, 234, 175, 228 }
       }, { /* Coeff Band 2 */
-        {   1, 133, 198, 206, 166, 172, 188, 157, 211, 167, 206 },
-        {  62, 122, 178, 203, 170, 174, 160, 151, 193, 148, 203 },
-        {  19,  94, 126, 195, 156, 172, 156, 159, 172, 135, 199 },
-        {  15,  78,  89, 173, 122, 158, 163, 155, 153, 138, 191 },
-        {  13,  63,  61, 120, 109, 141, 167, 138, 159, 174, 174 },
-        {   1,  39,  44,  77, 113, 145,  92, 116, 162, 144, 166 }
+        {  38, 163, 224, 240, 192, 188, 234, 178, 251, 217, 233 },
+        {  34, 134, 206, 239, 189, 188, 233, 177, 251, 218, 248 },
+        {  14,  95, 156, 234, 171, 186, 234, 179, 251, 220, 238 },
+        {   6,  68, 110, 215, 133, 166, 236, 181, 251, 217, 235 },
+        {   2,  43,  68, 155, 111, 146, 223, 144, 252, 224, 239 },
+        {   1,  21,  32,  86,  98, 139, 136, 110, 235, 174, 221 }
       }, { /* Coeff Band 3 */
-        {   1, 157, 214, 222, 176, 176, 208, 168, 213, 174, 219 },
-        {  80, 134, 199, 223, 180, 181, 191, 162, 200, 161, 218 },
-        {  27, 104, 155, 219, 168, 177, 192, 168, 186, 154, 214 },
-        {  23,  87, 114, 203, 138, 166, 199, 165, 178, 163, 210 },
-        {  16,  74,  84, 153, 118, 150, 198, 144, 194, 189, 198 },
-        {   1,  50,  64, 110, 121, 149, 118, 125, 177, 149, 194 }
+        {  61, 173, 225, 241, 195, 190, 236, 181, 252, 221, 221 },
+        {  39, 134, 205, 241, 191, 191, 237, 182, 252, 220, 239 },
+        {   6,  82, 144, 233, 167, 183, 237, 182, 252, 220, 242 },
+        {   2,  53,  92, 207, 130, 165, 232, 172, 253, 220, 243 },
+        {   1,  28,  49, 146,  98, 141, 217, 146, 252, 216, 245 },
+        {   1,  12,  21,  68,  88, 132, 140, 101, 241, 182, 236 }
       }, { /* Coeff Band 4 */
-        {   1, 164, 216, 229, 181, 178, 223, 172, 228, 197, 221 },
-        {  86, 140, 196, 225, 176, 179, 215, 169, 220, 189, 222 },
-        {  30, 107, 149, 217, 160, 175, 216, 169, 212, 187, 219 },
-        {  24,  85, 109, 197, 133, 161, 215, 162, 211, 195, 214 },
-        {  17,  67,  76, 150, 114, 148, 202, 144, 222, 203, 204 },
-        {   3,  46,  55, 100, 111, 144, 140, 117, 215, 173, 197 }
+        {  83, 175, 229, 246, 201, 195, 241, 190, 253, 225, 249 },
+        {  49, 134, 211, 245, 195, 195, 242, 192, 254, 228, 252 },
+        {  12,  86, 154, 237, 169, 185, 242, 190, 254, 227, 252 },
+        {   4,  56, 100, 208, 134, 166, 235, 173, 254, 228, 247 },
+        {   1,  33,  57, 157, 104, 146, 217, 148, 253, 219, 250 },
+        {   1,  16,  27,  82,  89, 132, 156, 108, 245, 188, 241 }
       }, { /* Coeff Band 5 */
-        {   1, 120, 224, 237, 184, 181, 241, 188, 249, 228, 231 },
-        { 139,  95, 209, 236, 184, 184, 237, 182, 247, 224, 230 },
-        {  67,  79, 160, 232, 172, 181, 236, 182, 246, 219, 233 },
-        {  48,  65, 120, 216, 141, 168, 234, 177, 245, 219, 229 },
-        {  32,  52,  85, 171, 119, 151, 222, 156, 246, 216, 224 },
-        {  13,  39,  58, 112, 111, 144, 157, 121, 229, 182, 211 }
+        { 142, 137, 243, 252, 218, 207, 250, 205, 255, 241, 128 },
+        { 117, 102, 224, 250, 204, 202, 249, 204, 255, 238, 255 },
+        {  40,  69, 169, 242, 175, 190, 247, 198, 255, 238, 209 },
+        {  14,  47, 106, 213, 135, 168, 239, 177, 255, 233, 244 },
+        {   4,  26,  53, 152,  99, 143, 220, 147, 254, 224, 252 },
+        {   1,  14,  25,  79,  87, 130, 160, 105, 249, 195, 249 }
       }
     }
   }, { /* block Type 1 */
     { /* Intra */
       { /* Coeff Band 0 */
-        { 220,  21, 181, 217, 157, 178, 234, 145, 248, 236, 173 },
-        { 125,  26, 143, 206, 148, 172, 213, 151, 240, 207, 199 },
-        {  44,  28,  84, 150, 125, 154, 171, 133, 225, 179, 192 }
+        { 198,  34, 200, 220, 173, 177, 207, 161, 219, 190, 170 },
+        { 100,  41, 144, 187, 152, 166, 179, 145, 219, 175, 182 },
+        {  24,  38,  81, 143, 126, 153, 161, 131, 222, 169, 201 }
       }, { /* Coeff Band 1 */
-        {   1, 137, 209, 231, 181, 181, 223, 173, 245, 202, 236 },
-        { 147, 130, 214, 232, 181, 183, 224, 172, 245, 204, 220 },
-        { 111, 112, 183, 234, 188, 186, 223, 175, 246, 202, 237 },
-        {  89, 100, 159, 227, 163, 178, 222, 173, 246, 203, 220 },
-        {  55,  80, 124, 201, 142, 166, 219, 163, 246, 205, 223 },
-        {  23,  45,  70, 130, 119, 151, 157, 128, 224, 170, 207 }
+        { 128, 132, 197, 226, 174, 179, 225, 167, 250, 206, 238 },
+        { 116, 117, 189, 226, 173, 179, 224, 168, 250, 212, 210 },
+        {  58,  97, 162, 226, 170, 181, 225, 170, 250, 210, 255 },
+        {  29,  76, 128, 216, 147, 171, 226, 171, 249, 217, 232 },
+        {  13,  52,  84, 175, 121, 152, 223, 155, 251, 212, 241 },
+        {   6,  29,  44, 102, 105, 142, 153, 115, 236, 180, 223 }
       }, { /* Coeff Band 2 */
-        {   1,  62, 195, 228, 177, 179, 220, 170, 244, 201, 226 },
-        {  87,  84, 172, 218, 165, 176, 212, 163, 242, 199, 228 },
-        {  28,  87, 124, 206, 154, 168, 209, 159, 241, 195, 227 },
-        {  10,  72,  94, 181, 127, 159, 200, 150, 240, 193, 226 },
-        {   4,  47,  58, 129, 109, 145, 176, 132, 237, 183, 222 },
-        {   1,  24,  26,  65,  95, 137, 109, 104, 210, 151, 197 }
+        {  84,  90, 195, 230, 178, 181, 225, 171, 248, 204, 249 },
+        {  75,  85, 186, 227, 174, 179, 225, 170, 249, 213, 246 },
+        {  49,  75, 163, 224, 169, 179, 225, 171, 249, 211, 251 },
+        {  27,  63, 131, 216, 150, 171, 225, 168, 250, 211, 239 },
+        {  10,  47,  88, 181, 124, 155, 221, 156, 249, 211, 241 },
+        {   3,  29,  47, 105, 106, 141, 153, 118, 233, 176, 221 }
       }, { /* Coeff Band 3 */
-        {   1, 127, 206, 236, 183, 183, 230, 180, 247, 211, 234 },
-        { 113, 118, 195, 228, 174, 180, 225, 172, 248, 208, 231 },
-        {  43, 109, 162, 221, 166, 175, 220, 168, 248, 207, 232 },
-        {  17,  88, 126, 208, 152, 171, 214, 161, 247, 203, 236 },
-        {   5,  60,  84, 172, 125, 154, 199, 149, 244, 194, 237 },
-        {   1,  29,  41,  99, 104, 147, 146, 116, 227, 170, 223 }
+        {  98, 143, 209, 237, 187, 186, 233, 177, 251, 216, 255 },
+        {  81, 118, 204, 237, 186, 186, 232, 178, 252, 213, 255 },
+        {  30,  91, 172, 234, 179, 184, 235, 177, 252, 221, 248 },
+        {  10,  68, 124, 223, 153, 176, 232, 175, 252, 221, 253 },
+        {   2,  41,  73, 181, 115, 153, 226, 163, 252, 217, 240 },
+        {   1,  18,  30,  93,  94, 134, 168, 113, 245, 192, 242 }
       }, { /* Coeff Band 4 */
-        {   1, 151, 222, 239, 193, 188, 231, 177, 250, 218, 241 },
-        { 114, 126, 203, 230, 180, 181, 226, 171, 249, 212, 246 },
-        {  51,  97, 175, 218, 166, 176, 220, 165, 250, 211, 231 },
-        {  23,  77, 136, 204, 155, 169, 213, 157, 248, 205, 241 },
-        {   6,  50,  85, 169, 126, 158, 197, 146, 245, 197, 243 },
-        {   1,  21,  37,  97, 101, 146, 146, 119, 232, 169, 232 }
+        { 119, 172, 224, 244, 198, 193, 239, 185, 251, 222, 255 },
+        {  89, 126, 213, 245, 196, 195, 241, 192, 254, 226, 255 },
+        {  35,  94, 180, 239, 182, 187, 242, 192, 255, 232, 255 },
+        {  11,  68, 129, 222, 156, 174, 237, 177, 253, 226, 255 },
+        {   2,  42,  78, 184, 121, 156, 225, 159, 253, 215, 240 },
+        {   1,  20,  35, 104,  96, 137, 171, 120, 246, 194, 248 }
       }, { /* Coeff Band 5 */
-        {   1, 117, 230, 239, 194, 187, 233, 179, 252, 222, 248 },
-        { 148, 109, 210, 232, 184, 182, 227, 173, 252, 211, 244 },
-        {  80,  84, 162, 222, 168, 178, 225, 167, 252, 207, 244 },
-        {  43,  64, 122, 201, 142, 169, 218, 162, 251, 208, 254 },
-        {  17,  41,  76, 155, 120, 154, 200, 141, 249, 204, 248 },
-        {   5,  19,  35,  89,  99, 151, 140, 115, 241, 174, 244 }
+        { 150, 126, 240, 252, 218, 204, 248, 204, 255, 255, 128 },
+        { 126, 100, 224, 250, 207, 202, 249, 207, 255, 244, 128 },
+        {  49,  77, 183, 245, 188, 194, 248, 202, 255, 255, 255 },
+        {  15,  55, 125, 225, 152, 175, 242, 183, 255, 235, 255 },
+        {   3,  32,  64, 174, 109, 152, 229, 158, 255, 225, 255 },
+        {   1,  18,  33,  96,  89, 135, 179, 117, 252, 208, 255 }
       }
     }, { /* Inter */
       { /* Coeff Band 0 */
-        { 240,  71, 232, 234, 178, 179, 246, 180, 251, 225, 232 },
-        { 168,  71, 198, 225, 167, 173, 229, 173, 247, 211, 218 },
-        {  75,  63, 144, 195, 150, 164, 192, 147, 245, 202, 213 }
+        { 242, 100, 229, 235, 190, 184, 229, 172, 249, 219, 192 },
+        { 162, 103, 196, 217, 175, 175, 208, 157, 237, 198, 191 },
+        {  60, 109, 167, 206, 167, 172, 192, 150, 235, 185, 211 }
       }, { /* Coeff Band 1 */
-        {   1, 165, 237, 243, 186, 184, 247, 206, 255, 238, 255 },
-        { 159, 149, 229, 241, 192, 183, 244, 194, 255, 237, 239 },
-        { 110, 126, 195, 243, 196, 196, 239, 187, 255, 237, 242 },
-        {  89, 114, 170, 237, 168, 181, 239, 192, 254, 232, 241 },
-        {  54,  96, 145, 210, 151, 166, 237, 173, 253, 234, 249 },
-        {  17,  65, 108, 187, 140, 165, 194, 148, 244, 199, 227 }
+        { 128, 183, 242, 246, 208, 196, 237, 185, 254, 222, 255 },
+        { 105, 152, 229, 247, 209, 198, 239, 185, 252, 225, 255 },
+        {  43, 109, 183, 247, 200, 203, 237, 186, 254, 212, 171 },
+        {  17,  76, 124, 238, 149, 185, 241, 198, 252, 213, 255 },
+        {   7,  45,  71, 176, 108, 145, 242, 172, 253, 224, 248 },
+        {   4,  26,  39,  95, 100, 137, 165, 109, 244, 196, 228 }
       }, { /* Coeff Band 2 */
-        {   1, 124, 227, 239, 183, 184, 240, 195, 249, 224, 240 },
-        { 112, 132, 206, 235, 183, 184, 232, 180, 246, 220, 234 },
-        {  36, 116, 161, 228, 170, 180, 229, 176, 244, 218, 239 },
-        {  22, 107, 126, 210, 139, 167, 225, 169, 244, 218, 229 },
-        {   9,  82,  90, 163, 122, 151, 210, 149, 246, 212, 227 },
-        {   1,  43,  51, 102, 105, 144, 152, 117, 234, 182, 213 }
+        { 110, 129, 232, 252, 220, 211, 242, 190, 253, 217, 255 },
+        {  82, 121, 222, 250, 211, 204, 243, 194, 242, 225, 219 },
+        {  43,  97, 185, 247, 198, 201, 241, 193, 251, 221, 255 },
+        {  22,  75, 135, 238, 154, 184, 243, 200, 252, 214, 255 },
+        {   9,  51,  86, 187, 118, 151, 242, 173, 252, 226, 221 },
+        {   3,  31,  49, 112, 107, 141, 169, 118, 240, 192, 232 }
       }, { /* Coeff Band 3 */
-        {   1, 160, 234, 244, 195, 188, 244, 197, 251, 231, 250 },
-        { 119, 142, 220, 241, 192, 189, 241, 188, 251, 229, 243 },
-        {  38, 110, 180, 238, 183, 185, 238, 185, 251, 227, 246 },
-        {  27,  95, 130, 229, 164, 181, 234, 178, 251, 223, 233 },
-        {  13,  79,  97, 185, 125, 153, 223, 164, 250, 217, 238 },
-        {   1,  45,  57, 110, 111, 143, 164, 119, 235, 183, 220 }
+        { 127, 158, 236, 251, 219, 208, 244, 199, 255, 235, 255 },
+        {  91, 134, 226, 250, 214, 204, 244, 196, 252, 228, 183 },
+        {  23,  98, 182, 247, 196, 197, 245, 195, 255, 224, 255 },
+        {   8,  69, 125, 233, 157, 182, 241, 186, 254, 232, 255 },
+        {   2,  42,  72, 187, 113, 152, 233, 170, 253, 228, 249 },
+        {   1,  19,  32,  95,  94, 134, 172, 111, 249, 199, 248 }
       }, { /* Coeff Band 4 */
-        {   1, 166, 239, 247, 207, 196, 244, 198, 251, 225, 245 },
-        { 119, 146, 224, 244, 199, 192, 240, 192, 251, 223, 240 },
-        {  46, 108, 189, 237, 180, 191, 236, 186, 249, 218, 248 },
-        {  29,  89, 154, 223, 165, 177, 228, 173, 250, 213, 224 },
-        {   8,  63, 104, 189, 139, 163, 207, 154, 246, 200, 241 },
-        {   1,  27,  40, 103, 102, 144, 146, 118, 230, 165, 223 }
+        { 145, 182, 245, 253, 228, 210, 250, 209, 255, 235, 128 },
+        { 106, 140, 233, 252, 220, 209, 250, 209, 255, 238, 128 },
+        {  41, 103, 195, 248, 196, 199, 249, 209, 255, 239, 128 },
+        {  13,  76, 137, 231, 161, 181, 244, 187, 255, 239, 255 },
+        {   2,  45,  79, 193, 121, 158, 234, 168, 255, 231, 255 },
+        {   1,  20,  34, 110,  94, 135, 195, 124, 251, 203, 255 }
       }, { /* Coeff Band 5 */
-        {   1, 131, 242, 247, 207, 193, 244, 199, 251, 225, 248 },
-        { 150, 118, 231, 244, 202, 191, 239, 191, 252, 214, 241 },
-        {  79,  98, 188, 236, 185, 186, 232, 182, 251, 212, 249 },
-        {  55,  80, 145, 217, 154, 174, 222, 172, 250, 204, 253 },
-        {  27,  56,  94, 162, 128, 153, 198, 143, 248, 199, 240 },
-        {   4,  19,  33,  77,  98, 144, 129, 110, 237, 167, 241 }
+        { 182, 133, 250, 255, 234, 217, 255, 215, 128, 128, 128 },
+        { 158, 113, 240, 254, 223, 212, 254, 225, 255, 255, 128 },
+        {  68,  83, 196, 250, 200, 201, 253, 217, 255, 255, 128 },
+        {  18,  60, 130, 235, 158, 180, 247, 193, 255, 245, 128 },
+        {   3,  34,  66, 186, 108, 149, 239, 174, 255, 232, 128 },
+        {   1,  20,  36, 111,  94, 145, 195, 123, 250, 212, 255 }
       }
     }
   }
@@ -190,169 +190,169 @@ static const vp9_coeff_probs default_coef_probs_8x8[BLOCK_TYPES] = {
   { /* block Type 0 */
     { /* Intra */
       { /* Coeff Band 0 */
-        { 158,  29, 127, 187, 147, 164, 183, 146, 227, 188, 162 },
-        {  74,  36, 101, 162, 138, 162, 154, 134, 206, 165, 167 },
-        {  15,  28,  56, 109, 119, 151, 122, 120, 190, 151, 164 }
+        { 173,  27, 142, 173, 151, 161, 162, 140, 196, 179, 128 },
+        {  56,  32,  85, 136, 131, 154, 142, 123, 202, 161, 161 },
+        {   8,  26,  47, 104, 110, 146, 130, 119, 197, 153, 170 }
       }, { /* Coeff Band 1 */
-        {   1, 129, 178, 205, 163, 170, 200, 152, 236, 185, 215 },
-        {  61, 129, 178, 205, 162, 170, 201, 152, 237, 189, 212 },
-        {  42, 113, 161, 203, 159, 168, 200, 153, 237, 188, 212 },
-        {  30,  91, 129, 196, 149, 166, 201, 152, 236, 186, 213 },
-        {  12,  63,  86, 169, 126, 155, 195, 145, 236, 187, 213 },
-        {   6,  34,  33,  89, 100, 139, 132, 115, 206, 157, 183 }
+        { 128, 124, 161, 206, 156, 170, 210, 157, 241, 196, 214 },
+        {  56, 118, 160, 206, 157, 169, 208, 154, 241, 197, 218 },
+        {  33, 102, 144, 203, 153, 169, 210, 156, 241, 198, 237 },
+        {  17,  83, 121, 195, 143, 165, 206, 154, 241, 196, 219 },
+        {   6,  56,  86, 168, 125, 155, 200, 145, 242, 194, 221 },
+        {   1,  25,  37,  93, 103, 141, 132, 117, 211, 158, 195 }
       }, { /* Coeff Band 2 */
-        {   1,  75, 147, 182, 152, 162, 189, 141, 223, 179, 198 },
-        {  36,  71, 125, 184, 141, 161, 204, 147, 241, 200, 202 },
-        {  10,  56,  83, 163, 129, 153, 194, 140, 241, 194, 215 },
-        {   6,  44,  59, 139, 110, 146, 178, 131, 237, 186, 219 },
-        {   5,  35,  35,  96, 101, 140, 152, 117, 227, 170, 210 },
-        {   2,  25,  14,  46,  88, 129,  90,  99, 186, 138, 173 }
+        {  18,  89, 158, 208, 159, 170, 212, 158, 243, 205, 225 },
+        {  28,  86, 153, 207, 156, 170, 213, 156, 245, 200, 232 },
+        {  18,  77, 135, 202, 150, 167, 212, 156, 242, 207, 217 },
+        {  11,  65, 113, 192, 139, 161, 208, 151, 243, 202, 217 },
+        {   4,  46,  78, 163, 122, 153, 200, 142, 242, 196, 219 },
+        {   1,  22,  34,  90, 101, 140, 132, 114, 212, 159, 197 }
       }, { /* Coeff Band 3 */
-        {   1, 135, 179, 191, 161, 166, 198, 136, 234, 184, 215 },
-        {  55, 116, 171, 216, 163, 174, 214, 163, 232, 196, 201 },
-        {  17,  89, 134, 205, 153, 166, 214, 159, 241, 200, 209 },
-        {   9,  69,  98, 187, 132, 159, 206, 149, 243, 198, 215 },
-        {   9,  53,  58, 142, 113, 151, 189, 135, 240, 187, 219 },
-        {   3,  36,  23,  69,  90, 133, 121, 109, 206, 155, 183 }
+        {  29, 153, 186, 219, 167, 175, 214, 159, 243, 201, 228 },
+        {  37, 129, 180, 223, 170, 177, 219, 168, 243, 201, 222 },
+        {  12,  95, 149, 219, 161, 174, 219, 167, 241, 203, 234 },
+        {   3,  67, 108, 202, 140, 165, 218, 161, 246, 204, 223 },
+        {   1,  38,  61, 156, 112, 149, 201, 144, 242, 197, 220 },
+        {   1,  15,  22,  72,  91, 133, 126, 108, 218, 160, 206 }
       }, { /* Coeff Band 4 */
-        {   1, 163, 194, 208, 171, 171, 214, 140, 240, 191, 227 },
-        {  45, 129, 180, 226, 172, 180, 216, 169, 229, 186, 224 },
-        {  13,  94, 138, 216, 160, 171, 219, 167, 238, 198, 217 },
-        {  13,  72,  99, 196, 131, 160, 213, 156, 243, 201, 213 },
-        {  18,  62,  54, 136, 109, 149, 197, 132, 242, 193, 212 },
-        {   5,  40,  25,  60,  92, 133, 111, 105, 200, 150, 179 }
+        {  33, 182, 210, 231, 183, 184, 223, 169, 244, 207, 226 },
+        {  23, 137, 194, 236, 183, 187, 228, 176, 244, 204, 224 },
+        {   4,  89, 147, 228, 166, 179, 229, 176, 247, 208, 234 },
+        {   1,  56,  95, 200, 134, 164, 222, 164, 249, 209, 226 },
+        {   1,  28,  47, 141, 101, 144, 199, 139, 245, 199, 227 },
+        {   1,  11,  16,  58,  84, 131, 118, 101, 221, 160, 209 }
       }, { /* Coeff Band 5 */
-        {   1, 187, 223, 230, 197, 185, 216, 139, 241, 174, 241 },
-        {  58, 144, 205, 236, 189, 188, 209, 168, 231, 172, 234 },
-        {  18, 104, 160, 226, 171, 180, 211, 170, 234, 180, 230 },
-        {  11,  76, 115, 205, 143, 166, 205, 161, 234, 182, 218 },
-        {  14,  66,  66, 138, 116, 150, 192, 128, 231, 180, 204 },
-        {   1,  35,  32,  61, 104, 140,  89, 105, 187, 138, 171 }
+        {  58, 203, 233, 246, 208, 196, 233, 178, 251, 214, 255 },
+        {  37, 147, 214, 246, 201, 197, 238, 191, 249, 217, 213 },
+        {   7,  93, 160, 237, 175, 186, 239, 186, 251, 217, 240 },
+        {   1,  57,  98, 206, 136, 165, 229, 168, 252, 220, 235 },
+        {   1,  30,  51, 146, 103, 145, 206, 142, 249, 207, 229 },
+        {   1,  12,  20,  68,  87, 132, 133, 103, 231, 169, 214 }
       }
     }, { /* Inter */
       { /* Coeff Band 0 */
-        { 177, 107, 211, 210, 163, 167, 237, 156, 238, 209, 204 },
-        { 119, 101, 183, 200, 161, 168, 215, 148, 234, 191, 204 },
-        {  39,  81, 127, 173, 144, 162, 182, 137, 226, 176, 202 }
+        { 201, 133, 221, 227, 187, 180, 210, 161, 242, 194, 232 },
+        { 122, 113, 177, 201, 170, 170, 178, 146, 218, 175, 191 },
+        {  31,  85, 125, 175, 149, 163, 169, 138, 218, 171, 187 }
       }, { /* Coeff Band 1 */
-        {   1, 175, 199, 199, 161, 158, 242, 141, 254, 226, 249 },
-        {  89, 154, 205, 213, 178, 172, 235, 138, 254, 221, 245 },
-        {  32, 123, 180, 231, 183, 185, 229, 158, 253, 216, 237 },
-        {  23, 102, 134, 226, 155, 177, 231, 175, 253, 215, 244 },
-        {  20,  88,  95, 176, 119, 151, 228, 154, 253, 218, 240 },
-        {   7,  54,  64, 120, 115, 146, 168, 119, 238, 186, 212 }
+        { 128, 195, 224, 236, 188, 184, 230, 173, 249, 212, 245 },
+        {  41, 172, 213, 235, 185, 186, 230, 173, 250, 211, 235 },
+        {  31, 131, 178, 232, 175, 185, 229, 174, 250, 211, 236 },
+        {  14,  96, 134, 219, 146, 172, 230, 178, 251, 214, 239 },
+        {   5,  62,  87, 169, 120, 151, 223, 149, 250, 217, 239 },
+        {   1,  30,  41,  90, 105, 142, 131, 111, 224, 168, 199 }
       }, { /* Coeff Band 2 */
-        {   1, 151, 196, 204, 163, 163, 238, 144, 252, 219, 235 },
-        {  43, 128, 179, 218, 171, 175, 227, 152, 251, 214, 231 },
-        {  15,  94, 126, 216, 158, 174, 223, 165, 250, 211, 231 },
-        {  17,  82,  90, 190, 120, 157, 219, 160, 249, 209, 228 },
-        {  15,  87,  66, 123, 104, 139, 201, 130, 247, 202, 228 },
-        {   1,  43,  35,  70,  98, 134, 134, 105, 226, 168, 203 }
+        {  27, 178, 225, 238, 191, 187, 231, 175, 252, 213, 239 },
+        {  30, 159, 211, 237, 187, 186, 230, 177, 249, 217, 245 },
+        {  15, 123, 175, 233, 174, 183, 231, 177, 250, 215, 232 },
+        {   8,  93, 135, 219, 147, 171, 230, 176, 250, 216, 227 },
+        {   3,  63,  89, 171, 121, 152, 222, 150, 250, 216, 234 },
+        {   1,  33,  45,  97, 107, 143, 138, 113, 225, 169, 202 }
       }, { /* Coeff Band 3 */
-        {   1, 172, 203, 207, 167, 163, 242, 146, 254, 225, 243 },
-        {  52, 139, 194, 224, 179, 179, 232, 153, 253, 219, 237 },
-        {  19, 102, 148, 225, 166, 180, 227, 170, 252, 217, 236 },
-        {  24,  87, 105, 205, 132, 161, 225, 167, 252, 215, 235 },
-        {  23,  90,  76, 140, 108, 144, 213, 138, 251, 211, 235 },
-        {   2,  42,  39,  80,  97, 134, 151, 109, 236, 180, 216 }
+        {  40, 195, 228, 240, 193, 189, 233, 176, 250, 215, 235 },
+        {  28, 152, 205, 239, 188, 189, 232, 178, 250, 215, 223 },
+        {   3,  90, 147, 230, 166, 182, 232, 178, 249, 213, 224 },
+        {   1,  58,  96, 205, 131, 165, 228, 170, 249, 213, 209 },
+        {   1,  30,  50, 142, 100, 142, 211, 143, 246, 206, 216 },
+        {   1,  11,  19,  61,  87, 132, 123, 100, 225, 169, 206 }
       }, { /* Coeff Band 4 */
-        {   1, 183, 216, 216, 178, 168, 245, 145, 255, 226, 245 },
-        {  48, 149, 203, 231, 186, 185, 233, 155, 254, 220, 243 },
-        {  20, 108, 154, 227, 170, 181, 227, 169, 253, 219, 240 },
-        {  32,  87, 109, 205, 136, 163, 223, 166, 253, 217, 241 },
-        {  33,  91,  76, 139, 110, 144, 212, 135, 252, 212, 241 },
-        {   2,  39,  39,  83,  99, 136, 150, 108, 239, 181, 226 }
+        {  34, 200, 231, 244, 199, 193, 237, 182, 252, 220, 236 },
+        {  18, 153, 208, 244, 193, 193, 239, 187, 252, 222, 245 },
+        {   2,  87, 145, 233, 165, 183, 239, 186, 253, 224, 243 },
+        {   1,  52,  90, 201, 128, 163, 232, 169, 253, 222, 240 },
+        {   1,  25,  43, 136,  95, 140, 207, 140, 251, 213, 238 },
+        {   1,   9,  16,  57,  80, 128, 127,  99, 234, 170, 229 }
       }, { /* Coeff Band 5 */
-        {   1, 196, 231, 239, 202, 187, 244, 160, 254, 222, 242 },
-        {  60, 151, 213, 240, 193, 191, 236, 175, 254, 220, 242 },
-        {  13, 107, 164, 231, 173, 181, 232, 177, 253, 219, 240 },
-        {   9,  78, 118, 210, 145, 169, 227, 169, 253, 218, 242 },
-        {  18,  65,  76, 160, 117, 151, 210, 144, 251, 210, 239 },
-        {   1,  28,  38,  92, 101, 140, 148, 113, 237, 177, 227 }
+        {  58, 207, 238, 249, 211, 201, 243, 193, 253, 226, 240 },
+        {  33, 154, 218, 248, 201, 200, 246, 199, 254, 229, 252 },
+        {   5,  93, 158, 238, 170, 187, 245, 195, 254, 233, 253 },
+        {   1,  57,  99, 207, 131, 165, 236, 173, 254, 228, 251 },
+        {   1,  30,  52, 147,  99, 143, 213, 143, 253, 217, 245 },
+        {   1,  13,  22,  71,  84, 130, 145, 104, 243, 183, 239 }
       }
     }
   }, { /* block Type 1 */
     { /* Intra */
       { /* Coeff Band 0 */
-        { 210,  33, 210, 232, 185, 185, 210, 166, 207, 192, 146 },
-        { 118,  47, 169, 220, 170, 179, 201, 160, 231, 183, 211 },
-        {  40,  52, 119, 203, 146, 169, 207, 160, 242, 194, 222 }
+        { 190,  29, 192, 204, 171, 173, 162, 145, 175, 161, 147 },
+        {  90,  43, 136, 179, 150, 166, 167, 140, 220, 166, 201 },
+        {  21,  47,  90, 155, 132, 157, 164, 134, 229, 169, 216 }
       }, { /* Coeff Band 1 */
-        {   1, 158, 215, 239, 192, 188, 234, 174, 253, 219, 230 },
-        { 130, 149, 210, 238, 191, 188, 233, 174, 253, 221, 240 },
-        {  59, 123, 193, 237, 188, 187, 232, 174, 252, 220, 246 },
-        {  22,  89, 154, 232, 172, 183, 233, 173, 253, 219, 237 },
-        {   4,  49,  83, 193, 128, 160, 227, 161, 253, 219, 233 },
-        {   1,  18,  27,  87,  90, 133, 160, 112, 242, 185, 231 }
+        { 128, 156, 192, 220, 170, 177, 220, 162, 252, 214, 255 },
+        { 107, 138, 190, 218, 171, 176, 220, 161, 252, 208, 255 },
+        {  43, 115, 165, 215, 165, 174, 219, 163, 248, 208, 244 },
+        {  16,  84, 126, 204, 148, 169, 216, 156, 252, 210, 236 },
+        {   3,  44,  69, 160, 115, 149, 204, 143, 251, 203, 238 },
+        {   1,  15,  23,  67,  89, 133, 127, 103, 233, 165, 226 }
       }, { /* Coeff Band 2 */
-        {   1,  87, 205, 244, 192, 193, 239, 188, 252, 220, 217 },
-        {  64,  93, 169, 237, 175, 186, 237, 184, 253, 222, 235 },
-        {  19,  77, 130, 222, 154, 175, 231, 173, 253, 221, 223 },
-        {   6,  59,  95, 196, 132, 162, 223, 160, 251, 215, 240 },
-        {   1,  37,  57, 144, 109, 146, 201, 135, 250, 205, 238 },
-        {   1,  17,  26,  81,  94, 138, 135, 107, 232, 168, 223 }
+        {  41, 125, 196, 229, 177, 180, 230, 175, 252, 214, 255 },
+        {  56, 112, 187, 227, 171, 179, 228, 169, 249, 216, 205 },
+        {  31,  92, 163, 222, 165, 176, 227, 170, 253, 215, 171 },
+        {  12,  68, 124, 211, 147, 170, 225, 165, 249, 216, 229 },
+        {   2,  40,  68, 169, 115, 151, 215, 149, 250, 211, 235 },
+        {   1,  16,  24,  77,  88, 134, 144, 108, 233, 174, 222 }
       }, { /* Coeff Band 3 */
-        {   1, 150, 219, 243, 198, 192, 237, 182, 253, 227, 245 },
-        {  88, 130, 202, 239, 190, 188, 236, 180, 253, 224, 255 },
-        {  25, 103, 172, 231, 175, 182, 234, 174, 253, 227, 248 },
-        {   7,  78, 128, 215, 156, 172, 228, 166, 252, 222, 248 },
-        {   1,  48,  76, 175, 121, 155, 212, 149, 251, 213, 237 },
-        {   1,  22,  35, 101,  97, 141, 161, 120, 236, 181, 213 }
+        {  45, 175, 212, 232, 184, 183, 229, 174, 253, 222, 255 },
+        {  60, 135, 200, 232, 182, 182, 229, 170, 252, 213, 255 },
+        {  18,  96, 162, 227, 170, 179, 229, 171, 252, 216, 197 },
+        {   4,  65, 110, 210, 144, 170, 225, 167, 251, 216, 240 },
+        {   1,  37,  63, 165, 111, 148, 216, 151, 251, 211, 236 },
+        {   1,  16,  26,  86,  90, 133, 156, 111, 238, 182, 229 }
       }, { /* Coeff Band 4 */
-        {   1, 177, 228, 247, 206, 197, 243, 191, 255, 232, 255 },
-        {  76, 143, 205, 243, 192, 192, 241, 189, 253, 223, 255 },
-        {  17, 107, 163, 233, 170, 183, 239, 183, 253, 227, 218 },
-        {   3,  75, 118, 216, 147, 171, 234, 174, 253, 220, 249 },
-        {   1,  43,  71, 174, 118, 154, 217, 153, 250, 211, 240 },
-        {   1,  19,  31,  93,  93, 136, 154, 116, 235, 178, 228 }
+        {  46, 193, 216, 246, 203, 197, 239, 189, 255, 224, 255 },
+        {  40, 147, 204, 242, 190, 191, 242, 189, 255, 227, 255 },
+        {   8,  95, 160, 235, 172, 183, 240, 185, 253, 233, 255 },
+        {   1,  61, 104, 210, 141, 168, 233, 171, 254, 223, 255 },
+        {   1,  34,  58, 162, 107, 150, 216, 150, 252, 216, 253 },
+        {   1,  14,  24,  82,  88, 133, 157, 110, 242, 185, 239 }
       }, { /* Coeff Band 5 */
-        {   1, 192, 230, 251, 215, 205, 245, 201, 254, 229, 255 },
-        {  66, 142, 206, 248, 200, 202, 244, 197, 255, 224, 255 },
-        {  21, 107, 166, 241, 176, 191, 241, 192, 253, 230, 255 },
-        {   5,  79, 129, 221, 150, 173, 237, 178, 254, 226, 255 },
-        {   1,  43,  72, 173, 117, 151, 217, 150, 253, 216, 245 },
-        {   1,  17,  28,  93,  95, 139, 162, 114, 245, 187, 235 }
+        {  87, 208, 225, 251, 209, 210, 248, 204, 255, 210, 128 },
+        {  49, 147, 212, 248, 201, 200, 248, 204, 254, 239, 255 },
+        {  10, 102, 171, 241, 180, 189, 246, 196, 255, 236, 128 },
+        {   2,  66, 113, 217, 144, 170, 238, 177, 255, 229, 255 },
+        {   1,  36,  63, 167, 109, 149, 222, 152, 255, 223, 255 },
+        {   1,  17,  28,  92,  89, 133, 169, 112, 251, 193, 244 }
       }
     }, { /* Inter */
       { /* Coeff Band 0 */
-        { 235,  68, 250, 244, 206, 192, 229, 177, 248, 215, 237 },
-        { 169,  88, 225, 235, 191, 184, 222, 170, 246, 205, 237 },
-        {  65, 100, 171, 214, 166, 173, 216, 157, 249, 213, 215 }
+        { 226,  69, 242, 236, 199, 184, 218, 170, 242, 199, 238 },
+        { 133,  91, 206, 221, 182, 178, 202, 154, 240, 192, 232 },
+        {  40, 109, 163, 209, 167, 175, 190, 152, 231, 180, 205 }
       }, { /* Coeff Band 1 */
-        {   1, 191, 246, 250, 217, 202, 244, 195, 255, 226, 128 },
-        { 177, 169, 236, 250, 216, 201, 244, 194, 251, 228, 255 },
-        {  70, 132, 205, 250, 209, 205, 246, 193, 254, 246, 255 },
-        {  41, 108, 165, 244, 172, 194, 246, 202, 255, 229, 255 },
-        {  23,  84, 126, 207, 140, 162, 244, 179, 254, 237, 255 },
-        {  11,  57,  83, 149, 127, 156, 180, 126, 247, 202, 220 }
+        { 128, 201, 240, 246, 208, 196, 243, 181, 251, 219, 255 },
+        { 138, 176, 230, 245, 204, 195, 236, 186, 250, 209, 255 },
+        {  56, 141, 197, 244, 194, 195, 241, 186, 254, 221, 255 },
+        {  26, 108, 149, 233, 153, 179, 243, 194, 254, 227, 255 },
+        {  11,  66,  91, 176, 120, 149, 240, 160, 254, 231, 255 },
+        {   5,  31,  44, 102, 104, 143, 158, 113, 244, 193, 214 }
       }, { /* Coeff Band 2 */
-        {   1, 169, 240, 250, 212, 202, 242, 192, 252, 222, 255 },
-        { 105, 151, 215, 246, 200, 197, 240, 190, 253, 221, 255 },
-        {  24, 111, 166, 237, 177, 188, 236, 183, 252, 213, 255 },
-        {   9,  83, 122, 218, 148, 170, 233, 174, 250, 215, 242 },
-        {   1,  55,  77, 168, 118, 152, 215, 150, 248, 213, 226 },
-        {   1,  26,  36, 104,  98, 146, 149, 116, 235, 182, 225 }
+        {  77, 182, 236, 249, 212, 203, 244, 193, 251, 228, 255 },
+        {  63, 155, 225, 248, 207, 200, 241, 193, 251, 233, 255 },
+        {  33, 125, 192, 245, 193, 196, 242, 189, 255, 213, 128 },
+        {  18, 101, 151, 234, 158, 180, 242, 196, 254, 218, 255 },
+        {   7,  70,  98, 185, 126, 154, 236, 162, 254, 233, 255 },
+        {   2,  38,  50, 106, 109, 144, 156, 118, 238, 186, 236 }
       }, { /* Coeff Band 3 */
-        {   1, 191, 243, 251, 219, 204, 246, 196, 255, 230, 128 },
-        {  97, 168, 225, 248, 207, 198, 244, 193, 254, 225, 192 },
-        {  15, 122, 182, 241, 187, 188, 241, 190, 251, 231, 228 },
-        {   3,  83, 131, 226, 160, 178, 237, 180, 251, 222, 205 },
-        {   1,  49,  77, 184, 121, 155, 222, 159, 249, 216, 249 },
-        {   1,  21,  32,  98,  98, 140, 152, 113, 233, 173, 243 }
+        {  74, 203, 240, 249, 216, 199, 241, 183, 254, 223, 255 },
+        {  68, 160, 224, 248, 208, 199, 243, 188, 252, 220, 255 },
+        {  14, 106, 173, 242, 188, 192, 240, 187, 253, 218, 255 },
+        {   3,  68, 113, 226, 148, 179, 237, 182, 254, 227, 255 },
+        {   1,  36,  59, 171, 104, 145, 229, 164, 251, 215, 255 },
+        {   1,  15,  23,  80,  88, 134, 153, 109, 228, 173, 232 }
       }, { /* Coeff Band 4 */
-        {   1, 202, 242, 253, 226, 212, 245, 205, 254, 226, 255 },
-        {  83, 168, 219, 252, 212, 211, 244, 200, 250, 215, 255 },
-        {   9, 143, 174, 245, 183, 197, 241, 194, 254, 217, 255 },
-        {   1, 105, 129, 228, 154, 179, 233, 179, 253, 211, 255 },
-        {   1,  47,  72, 177, 116, 152, 214, 157, 251, 209, 255 },
-        {   1,  18,  26,  79,  94, 137, 150, 109, 246, 175, 248 }
+        {  59, 210, 234, 254, 223, 219, 244, 201, 255, 230, 128 },
+        {  46, 170, 222, 251, 208, 207, 246, 202, 252, 237, 255 },
+        {   8, 106, 172, 244, 186, 192, 247, 197, 254, 232, 255 },
+        {   1,  65, 108, 223, 147, 175, 238, 183, 255, 226, 255 },
+        {   1,  32,  55, 165, 102, 145, 223, 157, 254, 216, 255 },
+        {   1,  12,  19,  70,  86, 134, 139, 105, 236, 174, 240 }
       }, { /* Coeff Band 5 */
-        {   1, 205, 236, 254, 233, 221, 247, 201, 255, 220, 128 },
-        {  87, 149, 205, 254, 211, 219, 245, 207, 255, 239, 128 },
-        {  56, 122, 162, 248, 164, 195, 246, 211, 255, 231, 128 },
-        {  26, 108, 163, 224, 149, 169, 240, 187, 255, 238, 255 },
-        {   1,  54,  89, 171, 123, 152, 219, 148, 254, 226, 255 },
-        {   1,  21,  34,  99,  90, 140, 174, 112, 252, 210, 255 }
+        { 112, 212, 232, 255, 222, 218, 254, 227, 255, 217, 128 },
+        {  57, 156, 219, 253, 209, 208, 252, 219, 255, 250, 128 },
+        {  11, 107, 180, 247, 191, 198, 250, 199, 255, 247, 128 },
+        {   2,  75, 123, 222, 150, 172, 241, 182, 255, 241, 255 },
+        {   1,  34,  60, 166, 106, 148, 224, 151, 255, 228, 255 },
+        {   1,  15,  27,  90,  84, 133, 171, 118, 254, 206, 255 }
       }
     }
   }
@@ -361,169 +361,169 @@ static const vp9_coeff_probs default_coef_probs_16x16[BLOCK_TYPES] = {
   { /* block Type 0 */
     { /* Intra */
       { /* Coeff Band 0 */
-        {  22,  27,  75, 145, 125, 152, 158, 133, 203, 164, 150 },
-        {   6,  27,  63, 124, 120, 150, 135, 127, 190, 154, 152 },
-        {   1,  19,  36,  82, 107, 143, 101, 114, 176, 140, 152 }
+        {  12,  27,  83, 143, 133, 154, 129, 138, 141, 160,  80 },
+        {   1,  21,  47,  91, 116, 146,  97, 118, 147, 137, 121 },
+        {   1,  14,  24,  59, 101, 138,  82, 108, 147, 133, 128 }
       }, { /* Coeff Band 1 */
-        {   1, 104, 143, 189, 150, 164, 194, 146, 239, 191, 205 },
-        {  49, 105, 143, 188, 149, 164, 194, 146, 238, 191, 204 },
-        {  29,  96, 133, 186, 147, 163, 194, 146, 238, 192, 202 },
-        {  14,  79, 112, 178, 139, 160, 193, 144, 237, 191, 205 },
-        {   5,  50,  74, 151, 119, 150, 187, 137, 237, 190, 205 },
-        {   1,  20,  29,  76,  98, 138, 116, 111, 197, 153, 168 }
+        { 128,  87, 126, 176, 146, 159, 182, 142, 226, 174, 206 },
+        {  44,  85, 126, 177, 145, 162, 179, 142, 221, 171, 190 },
+        {  26,  79, 114, 172, 140, 159, 176, 138, 218, 177, 191 },
+        {   9,  64,  96, 163, 133, 157, 172, 138, 223, 173, 191 },
+        {   2,  41,  63, 138, 115, 149, 164, 133, 222, 174, 194 },
+        {   1,  13,  21,  55,  95, 135,  86, 104, 165, 136, 149 }
       }, { /* Coeff Band 2 */
-        {   1,  61, 124, 173, 145, 162, 176, 137, 234, 179, 218 },
-        {  22,  56,  98, 158, 134, 157, 171, 133, 234, 178, 216 },
-        {   7,  44,  70, 137, 122, 151, 162, 128, 232, 175, 214 },
-        {   2,  33,  50, 114, 110, 146, 149, 121, 229, 169, 213 },
-        {   1,  21,  32,  84, 100, 139, 127, 112, 220, 158, 207 },
-        {   1,  11,  16,  46,  91, 133,  79, 100, 175, 133, 163 }
+        {  13,  58, 117, 173, 141, 161, 177, 139, 223, 179, 208 },
+        {  21,  58, 113, 171, 140, 160, 177, 139, 224, 175, 195 },
+        {  14,  53, 100, 166, 134, 163, 172, 140, 227, 174, 189 },
+        {   8,  45,  81, 155, 125, 156, 171, 137, 225, 172, 201 },
+        {   2,  30,  51, 123, 109, 145, 160, 127, 223, 173, 197 },
+        {   1,  10,  16,  46,  91, 134,  77, 100, 164, 131, 157 }
       }, { /* Coeff Band 3 */
-        {   1, 121, 166, 205, 160, 170, 204, 153, 240, 195, 210 },
-        {  34, 101, 146, 198, 153, 167, 202, 152, 239, 193, 213 },
-        {   9,  78, 118, 187, 142, 163, 198, 148, 238, 192, 211 },
-        {   3,  60,  90, 170, 130, 157, 192, 143, 237, 190, 210 },
-        {   1,  39,  59, 138, 112, 148, 177, 132, 233, 183, 207 },
-        {   1,  18,  28,  75,  96, 137, 117, 110, 199, 153, 173 }
+        {  17, 128, 151, 184, 149, 164, 181, 141, 228, 178, 203 },
+        {  32, 110, 149, 187, 152, 165, 182, 145, 230, 184, 203 },
+        {  14,  86, 127, 184, 146, 163, 183, 145, 231, 179, 202 },
+        {   5,  63,  93, 166, 131, 157, 182, 141, 230, 182, 209 },
+        {   1,  35,  54, 124, 109, 146, 161, 127, 226, 173, 202 },
+        {   1,  11,  18,  52,  92, 134,  88, 102, 179, 137, 171 }
       }, { /* Coeff Band 4 */
-        {   1, 148, 183, 220, 169, 175, 217, 164, 244, 203, 216 },
-        {  24, 115, 157, 211, 159, 171, 214, 160, 243, 201, 217 },
-        {   3,  81, 120, 197, 145, 166, 209, 155, 243, 200, 216 },
-        {   1,  56,  88, 176, 129, 158, 200, 147, 241, 196, 216 },
-        {   1,  33,  53, 134, 108, 147, 178, 132, 236, 184, 213 },
-        {   1,  13,  20,  62,  91, 135, 107, 106, 197, 148, 179 }
+        {  21, 169, 177, 200, 162, 171, 192, 146, 234, 186, 205 },
+        {  15, 123, 165, 206, 161, 171, 198, 154, 236, 188, 205 },
+        {   2,  78, 122, 196, 147, 167, 200, 153, 238, 191, 218 },
+        {   1,  46,  76, 163, 122, 154, 192, 141, 240, 191, 219 },
+        {   1,  23,  39, 110,  99, 141, 163, 123, 233, 178, 217 },
+        {   1,   9,  14,  46,  88, 130,  89,  97, 193, 140, 188 }
       }, { /* Coeff Band 5 */
-        {   1, 195, 212, 238, 191, 187, 229, 176, 247, 210, 222 },
-        {  22, 136, 185, 230, 176, 182, 226, 173, 247, 208, 219 },
-        {   3,  88, 137, 215, 156, 173, 222, 167, 246, 207, 220 },
-        {   1,  57,  94, 190, 133, 162, 213, 157, 245, 204, 217 },
-        {   1,  30,  52, 138, 107, 147, 188, 135, 241, 193, 215 },
-        {   1,  11,  19,  61,  89, 136, 110, 104, 203, 153, 175 }
+        {  19, 207, 210, 228, 185, 182, 213, 164, 241, 198, 221 },
+        {   7, 137, 180, 229, 175, 181, 226, 173, 246, 207, 218 },
+        {   1,  77, 123, 213, 150, 171, 226, 168, 248, 212, 226 },
+        {   1,  43,  72, 169, 118, 153, 210, 148, 250, 210, 233 },
+        {   1,  22,  38, 113,  97, 139, 177, 124, 244, 193, 230 },
+        {   1,   9,  16,  52,  87, 130, 103,  98, 214, 151, 206 }
       }
     }, { /* Inter */
       { /* Coeff Band 0 */
-        {  27,  72, 214, 225, 182, 183, 188, 159, 196, 172, 138 },
-        {  13,  69, 175, 209, 167, 173, 188, 152, 216, 174, 171 },
-        {   5,  52, 103, 162, 138, 160, 159, 137, 202, 164, 167 }
+        {  13,  37, 232, 230, 195, 183, 193, 150, 215, 180, 165 },
+        {   6,  45, 178, 196, 172, 170, 165, 142, 206, 164, 162 },
+        {   2,  49, 101, 155, 142, 160, 144, 132, 196, 157, 160 }
       }, { /* Coeff Band 1 */
-        {   1, 174, 218, 237, 187, 186, 229, 176, 247, 212, 225 },
-        { 122, 158, 210, 236, 185, 185, 228, 174, 247, 210, 217 },
-        {  48, 133, 188, 234, 182, 184, 228, 173, 247, 210, 229 },
-        {  24, 109, 157, 227, 165, 179, 227, 172, 248, 211, 226 },
-        {  12,  82, 114, 198, 137, 162, 223, 162, 247, 209, 220 },
-        {   6,  49,  66, 127, 116, 148, 159, 125, 221, 175, 178 }
+        { 128, 182, 202, 226, 176, 180, 219, 163, 248, 207, 228 },
+        { 147, 171, 198, 223, 172, 177, 215, 164, 245, 200, 238 },
+        {  71, 141, 175, 219, 167, 175, 212, 161, 247, 204, 236 },
+        {  31, 109, 141, 207, 153, 170, 209, 160, 246, 197, 227 },
+        {  13,  72,  95, 167, 127, 155, 201, 143, 245, 198, 234 },
+        {   3,  33,  45,  92, 109, 144, 122, 114, 211, 155, 185 }
       }, { /* Coeff Band 2 */
-        {   1, 151, 207, 229, 180, 181, 223, 168, 247, 210, 211 },
-        {  40, 122, 175, 222, 170, 177, 220, 164, 245, 207, 209 },
-        {   4,  84, 125, 207, 151, 169, 215, 159, 244, 205, 209 },
-        {   1,  58,  89, 180, 129, 159, 206, 150, 243, 202, 204 },
-        {   1,  35,  53, 131, 108, 145, 181, 130, 238, 192, 198 },
-        {   1,  16,  24,  67,  95, 137, 109, 106, 192, 153, 155 }
+        {  28, 161, 205, 229, 178, 182, 221, 170, 245, 196, 205 },
+        {  42, 155, 197, 226, 174, 181, 216, 167, 244, 195, 234 },
+        {  23, 126, 172, 221, 165, 178, 215, 164, 245, 197, 246 },
+        {  12, 100, 137, 206, 149, 167, 211, 162, 246, 198, 234 },
+        {   6,  70,  93, 164, 126, 154, 199, 140, 245, 200, 227 },
+        {   1,  38,  47,  92, 110, 145, 121, 114, 203, 155, 163 }
       }, { /* Coeff Band 3 */
-        {   1, 172, 215, 238, 189, 187, 231, 178, 248, 213, 210 },
-        {  44, 136, 190, 233, 179, 183, 229, 175, 248, 212, 212 },
-        {   4,  94, 144, 222, 161, 176, 226, 170, 247, 211, 212 },
-        {   1,  66, 103, 201, 139, 165, 219, 161, 247, 208, 212 },
-        {   1,  39,  61, 153, 111, 149, 199, 142, 243, 200, 210 },
-        {   1,  16,  25,  74,  93, 136, 124, 109, 204, 160, 171 }
+        {  37, 193, 211, 230, 181, 183, 215, 168, 245, 203, 225 },
+        {  34, 143, 188, 229, 176, 182, 218, 167, 246, 202, 226 },
+        {   4,  88, 136, 217, 157, 174, 219, 166, 245, 204, 227 },
+        {   1,  57,  89, 187, 128, 160, 211, 153, 246, 202, 224 },
+        {   1,  28,  46, 128, 101, 142, 188, 132, 243, 194, 224 },
+        {   1,  10,  16,  52,  87, 131, 103,  98, 209, 153, 177 }
       }, { /* Coeff Band 4 */
-        {   1, 185, 218, 241, 192, 190, 231, 180, 248, 213, 213 },
-        {  32, 143, 191, 235, 181, 185, 229, 176, 248, 211, 215 },
-        {   2,  97, 144, 223, 162, 177, 226, 171, 248, 210, 222 },
-        {   1,  65, 102, 199, 138, 165, 218, 160, 247, 208, 214 },
-        {   1,  35,  56, 145, 109, 147, 193, 137, 243, 198, 213 },
-        {   1,  13,  21,  65,  91, 135, 115, 105, 205, 157, 179 }
+        {  26, 203, 213, 234, 185, 185, 225, 174, 248, 209, 226 },
+        {  15, 143, 186, 234, 179, 185, 227, 175, 249, 210, 245 },
+        {   1,  83, 130, 221, 155, 175, 227, 172, 250, 213, 240 },
+        {   1,  49,  79, 181, 123, 157, 214, 153, 250, 210, 235 },
+        {   1,  24,  39, 118,  97, 139, 186, 128, 246, 197, 234 },
+        {   1,   9,  15,  51,  85, 130, 103,  97, 214, 154, 192 }
       }, { /* Coeff Band 5 */
-        {   1, 209, 222, 243, 199, 192, 233, 181, 249, 215, 228 },
-        {  23, 147, 197, 237, 185, 187, 231, 177, 249, 214, 227 },
-        {   1,  94, 146, 224, 163, 178, 228, 172, 249, 213, 229 },
-        {   1,  60,  99, 197, 136, 164, 220, 161, 248, 210, 227 },
-        {   1,  31,  54, 141, 107, 147, 194, 136, 246, 201, 226 },
-        {   1,  12,  21,  65,  90, 135, 119, 104, 217, 159, 201 }
+        {  16, 214, 220, 243, 199, 193, 235, 183, 250, 214, 228 },
+        {   6, 147, 190, 242, 186, 191, 240, 190, 252, 222, 237 },
+        {   1,  86, 133, 227, 157, 178, 239, 183, 253, 225, 239 },
+        {   1,  49,  80, 187, 123, 157, 224, 160, 253, 219, 243 },
+        {   1,  25,  42, 124,  98, 140, 193, 130, 249, 204, 241 },
+        {   1,  11,  17,  57,  86, 130, 116,  99, 229, 162, 225 }
       }
     }
   }, { /* block Type 1 */
     { /* Intra */
       { /* Coeff Band 0 */
-        { 203,  35, 218, 235, 189, 187, 194, 174, 175, 150, 127 },
-        {  95,  50, 155, 211, 161, 173, 190, 163, 198, 161, 187 },
-        {  21,  46,  93, 178, 130, 157, 200, 151, 224, 186, 191 }
+        { 167,  42, 187, 172, 172, 174,  92, 141, 109, 109, 101 },
+        {  53,  53, 108, 159, 139, 160, 153, 136, 196, 156, 178 },
+        {   9,  61,  85, 142, 131, 158, 145, 128, 203, 161, 175 }
       }, { /* Coeff Band 1 */
-        {   1, 155, 198, 236, 183, 187, 223, 175, 250, 209, 255 },
-        { 115, 147, 192, 235, 182, 186, 222, 173, 244, 199, 222 },
-        {  43, 124, 174, 234, 178, 186, 222, 176, 249, 201, 255 },
-        {  13,  96, 143, 227, 164, 181, 223, 174, 248, 197, 237 },
-        {   2,  59,  91, 197, 131, 163, 213, 162, 246, 198, 241 },
-        {   1,  19,  29,  85,  96, 139, 128, 116, 215, 153, 204 }
+        { 128, 208, 190, 206, 165, 181, 204, 150, 236, 175, 255 },
+        {  84, 184, 186, 202, 157, 175, 198, 151, 215, 177, 242 },
+        {  35, 155, 170, 204, 159, 167, 194, 152, 237, 181, 228 },
+        {  13, 120, 142, 191, 152, 167, 198, 152, 242, 168, 219 },
+        {   2,  68,  91, 163, 131, 159, 181, 135, 233, 189, 239 },
+        {   1,  23,  34,  76, 102, 138, 106, 111, 195, 144, 185 }
       }, { /* Coeff Band 2 */
-        {   1,  91, 180, 231, 170, 180, 237, 181, 248, 213, 230 },
-        {  39,  83, 139, 220, 153, 173, 233, 179, 243, 200, 228 },
-        {  12,  63, 106, 203, 136, 163, 227, 170, 244, 200, 234 },
-        {   5,  48,  79, 178, 123, 154, 215, 155, 244, 197, 232 },
-        {   1,  32,  50, 125, 104, 144, 171, 130, 238, 181, 229 },
-        {   1,  12,  18,  54,  88, 131,  92,  99, 201, 142, 193 }
+        {  25, 180, 186, 213, 161, 173, 207, 164, 213, 197, 165 },
+        {  36, 145, 175, 211, 160, 170, 208, 158, 242, 193, 219 },
+        {  21, 116, 153, 207, 154, 166, 209, 165, 247, 193, 255 },
+        {  10,  79, 121, 197, 142, 163, 203, 159, 240, 189, 243 },
+        {   2,  42,  69, 149, 115, 149, 193, 143, 241, 192, 219 },
+        {   1,  16,  24,  64,  95, 134, 107, 100, 204, 154, 182 }
       }, { /* Coeff Band 3 */
-        {   1, 152, 202, 238, 186, 188, 227, 178, 248, 205, 229 },
-        {  63, 125, 183, 234, 178, 184, 225, 179, 248, 205, 228 },
-        {  15, 100, 153, 227, 166, 180, 223, 173, 244, 198, 229 },
-        {   4,  76, 119, 210, 149, 170, 215, 165, 245, 200, 221 },
-        {   1,  46,  73, 165, 120, 154, 192, 144, 241, 189, 225 },
-        {   1,  18,  27,  78,  95, 136, 124, 110, 219, 158, 207 }
+        {  27, 217, 204, 217, 173, 172, 204, 152, 253, 189, 255 },
+        {  45, 152, 188, 220, 173, 180, 205, 164, 236, 189, 216 },
+        {  16, 101, 151, 211, 163, 172, 203, 155, 238, 186, 230 },
+        {   7,  71, 110, 193, 136, 164, 201, 153, 240, 196, 245 },
+        {   1,  37,  58, 138, 112, 144, 188, 139, 236, 183, 210 },
+        {   1,  13,  21,  60,  92, 136, 112, 101, 205, 155, 187 }
       }, { /* Coeff Band 4 */
-        {   1, 181, 211, 243, 197, 195, 228, 180, 249, 211, 252 },
-        {  40, 138, 189, 237, 184, 189, 226, 178, 249, 208, 247 },
-        {   7, 103, 153, 226, 166, 179, 223, 171, 249, 209, 224 },
-        {   1,  71, 110, 200, 143, 166, 213, 159, 249, 206, 241 },
-        {   1,  37,  60, 144, 111, 150, 189, 135, 245, 196, 232 },
-        {   1,  15,  25,  75,  91, 134, 128, 108, 224, 163, 213 }
+        {  17, 221, 219, 231, 186, 181, 220, 161, 242, 212, 255 },
+        {  18, 153, 194, 229, 180, 181, 221, 168, 247, 212, 255 },
+        {   3,  89, 142, 219, 159, 176, 222, 167, 249, 208, 233 },
+        {   1,  53,  88, 185, 129, 162, 211, 152, 246, 201, 238 },
+        {   1,  25,  43, 128,  97, 139, 185, 137, 241, 190, 229 },
+        {   1,   9,  17,  54,  87, 131, 106,  99, 210, 153, 206 }
       }, { /* Coeff Band 5 */
-        {   1, 215, 219, 246, 205, 197, 236, 183, 252, 221, 235 },
-        {  32, 146, 197, 239, 187, 188, 234, 180, 252, 223, 247 },
-        {   6, 100, 150, 227, 167, 178, 233, 178, 252, 219, 233 },
-        {   1,  63, 102, 203, 138, 167, 225, 162, 252, 216, 240 },
-        {   1,  33,  56, 148, 109, 146, 202, 138, 250, 208, 237 },
-        {   1,  15,  25,  75,  90, 131, 138, 108, 236, 171, 235 }
+        {  30, 230, 209, 246, 189, 196, 239, 196, 251, 216, 255 },
+        {  11, 159, 191, 239, 183, 187, 240, 184, 253, 229, 255 },
+        {   1,  94, 141, 227, 162, 177, 235, 178, 253, 227, 255 },
+        {   1,  58,  90, 190, 130, 160, 220, 156, 252, 219, 249 },
+        {   1,  27,  46, 129, 100, 139, 191, 133, 249, 200, 246 },
+        {   1,  12,  19,  62,  89, 127, 120, 100, 228, 161, 229 }
       }
     }, { /* Inter */
       { /* Coeff Band 0 */
-        { 228,  37, 245, 229, 199, 183, 200, 146, 240, 188, 223 },
-        { 138,  62, 209, 217, 184, 177, 195, 148, 246, 186, 236 },
-        {  42,  79, 146, 185, 156, 167, 183, 137, 247, 189, 251 }
+        { 213,  63, 239, 223, 197, 181, 181, 153, 199, 154, 226 },
+        {  82, 106, 196, 220, 185, 180, 196, 150, 231, 189, 198 },
+        {  12, 143, 195, 219, 187, 180, 178, 148, 235, 167, 239 }
       }, { /* Coeff Band 1 */
-        {   1, 205, 242, 248, 210, 202, 245, 193, 233, 230, 255 },
-        { 191, 185, 234, 249, 210, 201, 245, 194, 255, 197, 128 },
-        { 112, 148, 214, 247, 208, 201, 246, 192, 255, 238, 128 },
-        {  76, 120, 182, 246, 190, 198, 246, 202, 255, 244, 128 },
-        {  51,  95, 145, 232, 156, 177, 246, 199, 255, 233, 128 },
-        {  47,  71, 104, 195, 129, 158, 230, 167, 253, 224, 255 }
+        { 128, 243, 247, 251, 209, 213, 255, 255, 128, 128, 128 },
+        { 136, 226, 244, 247, 208, 162, 224, 183, 255, 255, 128 },
+        {  88, 189, 230, 242, 208, 201, 236, 200, 255, 255, 128 },
+        {  66, 149, 198, 241, 193, 193, 230, 161, 255, 255, 128 },
+        {  41, 104, 142, 211, 145, 180, 236, 193, 255, 236, 128 },
+        {  24,  59,  76, 145, 114, 142, 188, 119, 255, 214, 128 }
       }, { /* Coeff Band 2 */
-        {   1, 182, 235, 247, 204, 195, 246, 202, 255, 227, 128 },
-        { 104, 145, 204, 243, 189, 191, 242, 199, 255, 229, 128 },
-        {  35, 107, 159, 234, 167, 181, 244, 188, 255, 221, 128 },
-        {  17,  87, 126, 216, 151, 168, 242, 179, 255, 242, 128 },
-        {   4,  68,  91, 182, 131, 154, 222, 153, 255, 228, 128 },
-        {   1,  55,  64, 126, 105, 137, 193, 121, 247, 194, 255 }
+        {  44, 230, 243, 250, 225, 193, 218, 151, 255, 255, 128 },
+        {  68, 203, 237, 252, 218, 212, 207, 166, 255, 255, 128 },
+        {  59, 156, 215, 251, 200, 210, 205, 160, 255, 255, 128 },
+        {  56, 122, 182, 245, 181, 196, 219, 176, 255, 213, 128 },
+        {  40, 105, 135, 210, 143, 166, 243, 190, 255, 224, 128 },
+        {  13,  90, 112, 157, 143, 154, 199, 139, 244, 201, 255 }
       }, { /* Coeff Band 3 */
-        {   1, 210, 239, 249, 209, 201, 249, 205, 255, 255, 128 },
-        {  91, 162, 218, 247, 200, 195, 250, 199, 255, 255, 128 },
-        {  16, 116, 173, 242, 184, 190, 251, 193, 255, 205, 128 },
-        {   5,  85, 133, 228, 156, 178, 244, 184, 255, 251, 128 },
-        {   1,  55,  83, 196, 125, 164, 236, 168, 249, 249, 255 },
-        {   1,  24,  39, 127,  92, 154, 183, 133, 255, 192, 128 }
+        {  46, 241, 247, 249, 212, 202, 226, 168, 255, 154, 128 },
+        {  49, 195, 233, 246, 213, 194, 218, 181, 255, 255, 128 },
+        {  14, 113, 176, 248, 198, 208, 240, 195, 255, 255, 128 },
+        {   6,  87, 125, 230, 157, 187, 240, 184, 255, 183, 128 },
+        {   1,  43,  74, 188, 118, 149, 229, 164, 242, 241, 255 },
+        {   1,  16,  47, 138,  88, 126, 210, 156, 236, 213, 255 }
       }, { /* Coeff Band 4 */
-        {   1, 225, 242, 252, 218, 205, 251, 207, 255, 255, 128 },
-        {  67, 174, 223, 249, 205, 199, 250, 210, 255, 234, 128 },
-        {  10, 119, 177, 243, 186, 187, 253, 199, 255, 255, 128 },
-        {   2,  81, 129, 228, 154, 177, 244, 193, 255, 251, 128 },
-        {   1,  48,  78, 193, 122, 152, 240, 171, 255, 240, 128 },
-        {   1,  19,  43, 116,  96, 128, 195, 135, 255, 234, 128 }
+        {  26, 244, 249, 252, 228, 214, 255, 212, 128, 128, 128 },
+        {  34, 199, 235, 249, 216, 197, 246, 198, 255, 255, 128 },
+        {   8, 106, 163, 244, 195, 193, 243, 176, 255, 255, 128 },
+        {   1,  65, 104, 222, 142, 174, 244, 181, 255, 255, 128 },
+        {   1,  36,  52, 147, 111, 136, 226, 136, 247, 238, 255 },
+        {   1,  26,  27,  68, 100, 110, 126, 107, 232, 194, 255 }
       }, { /* Coeff Band 5 */
-        {   1, 237, 210, 255, 213, 219, 255, 235, 255, 219, 128 },
-        {  49, 163, 203, 252, 182, 198, 255, 235, 255, 255, 128 },
-        {  23, 114, 156, 247, 196, 187, 255, 238, 255, 255, 128 },
-        {   6,  71, 124, 248, 163, 202, 253, 203, 255, 255, 128 },
-        {   1,  35,  74, 226, 160, 162, 246, 189, 255, 244, 128 },
-        {   1,  16,  19, 136,  92, 164, 237, 108, 255, 255, 128 }
+        {  62, 243, 199, 255, 213, 218, 255, 250, 255, 255, 128 },
+        {  26, 171, 191, 252, 194, 205, 255, 243, 255, 255, 128 },
+        {  14, 107, 167, 250, 188, 198, 255, 233, 255, 255, 128 },
+        {   7, 103, 144, 244, 171, 189, 252, 216, 255, 228, 128 },
+        {   1,  51,  74, 184, 124, 160, 238, 167, 255, 241, 128 },
+        {   1,  13,  13,  78, 105, 138, 169, 124, 241, 224, 255 }
       }
     }
   }
@@ -532,169 +532,169 @@ static const vp9_coeff_probs default_coef_probs_32x32[BLOCK_TYPES] = {
   { /* block Type 0 */
     { /* Intra */
       { /* Coeff Band 0 */
-        {  38,  32, 115, 163, 140, 164, 143, 139, 167, 157, 105 },
-        {  11,  27,  73, 131, 126, 154, 131, 129, 178, 151, 138 },
-        {   2,  19,  36,  83, 107, 144, 102, 116, 169, 140, 149 }
+        {  12,  16,  47,  79, 123, 148,  48, 154,  38, 139,  14 },
+        {   2,  12,  26,  59, 104, 136,  68, 115, 125, 120,  91 },
+        {   1,  10,  17,  44,  94, 133,  76,  98, 129, 139,  98 }
       }, { /* Coeff Band 1 */
-        {   1, 116, 150, 184, 149, 164, 180, 140, 230, 178, 199 },
-        {  71, 114, 149, 183, 150, 164, 181, 141, 229, 179, 203 },
-        {  39, 102, 139, 182, 148, 164, 181, 142, 229, 179, 197 },
-        {  16,  82, 117, 176, 143, 161, 180, 141, 230, 180, 200 },
-        {   3,  49,  72, 148, 120, 152, 175, 134, 230, 178, 200 },
-        {   1,  14,  21,  56,  94, 135,  92, 103, 179, 141, 158 }
+        { 128,  90, 111, 171, 128, 152, 183, 148, 211, 169, 180 },
+        {  34,  86, 117, 162, 128, 155, 178, 159, 212, 172, 149 },
+        {  17,  75, 114, 168, 133, 155, 171, 155, 209, 161, 179 },
+        {   5,  53,  92, 175, 138, 154, 180, 148, 209, 172, 170 },
+        {   1,  27,  48, 159,  96, 149, 187, 155, 213, 164, 162 },
+        {   8,  12,  18,  49,  92, 129,  92, 104, 150, 136, 125 }
       }, { /* Coeff Band 2 */
-        {   1,  56, 140, 180, 151, 164, 175, 140, 224, 175, 194 },
-        {  28,  51, 101, 162, 135, 158, 170, 136, 222, 175, 193 },
-        {   9,  38,  68, 137, 120, 151, 160, 129, 221, 172, 193 },
-        {   3,  28,  47, 111, 108, 145, 145, 121, 216, 165, 192 },
-        {   1,  17,  28,  76,  97, 137, 117, 110, 206, 152, 189 },
-        {   1,   7,  11,  34,  89, 131,  62,  96, 154, 123, 148 }
+        {   5,  52, 106, 140, 141, 159, 148, 130, 228, 201, 208 },
+        {  16,  52,  98, 140, 131, 161, 151, 125, 225, 194, 149 },
+        {  13,  47,  92, 138, 135, 158, 143, 127, 230, 190, 153 },
+        {   8,  43,  77, 136, 132, 158, 137, 121, 236, 195, 188 },
+        {   2,  33,  55, 118, 115, 152, 130, 120, 226, 175, 179 },
+        {   1,   8,  12,  34,  95, 134,  56,  94, 142, 129, 119 }
       }, { /* Coeff Band 3 */
-        {   1, 129, 170, 198, 160, 169, 186, 147, 231, 181, 201 },
-        {  45, 106, 147, 191, 152, 166, 186, 145, 228, 182, 197 },
-        {  14,  81, 117, 178, 141, 161, 183, 143, 227, 184, 187 },
-        {   4,  61,  89, 159, 129, 156, 178, 137, 226, 182, 174 },
-        {   1,  39,  59, 126, 113, 146, 161, 126, 227, 176, 186 },
-        {   1,  18,  26,  67,  98, 137, 103, 107, 190, 146, 166 }
+        {  14, 122, 145, 181, 153, 167, 171, 141, 217, 176, 176 },
+        {  29, 110, 149, 185, 156, 165, 169, 139, 214, 169, 191 },
+        {  12,  90, 135, 186, 154, 169, 168, 140, 217, 170, 185 },
+        {   5,  75, 107, 172, 145, 160, 171, 141, 215, 172, 182 },
+        {   1,  49,  71, 131, 121, 150, 153, 128, 211, 164, 177 },
+        {   1,  14,  21,  51, 101, 136,  81,  98, 150, 134, 133 }
       }, { /* Coeff Band 4 */
-        {   1, 152, 180, 211, 166, 173, 206, 154, 243, 197, 216 },
-        {  24, 112, 150, 202, 155, 169, 204, 152, 242, 196, 212 },
-        {   3,  76, 112, 186, 141, 163, 199, 148, 241, 195, 212 },
-        {   1,  51,  80, 164, 124, 155, 191, 141, 240, 192, 212 },
-        {   1,  30,  48, 123, 106, 144, 170, 127, 235, 182, 210 },
-        {   1,  13,  20,  60,  92, 134, 102, 105, 189, 146, 160 }
+        {  14, 179, 178, 193, 163, 170, 178, 143, 223, 176, 187 },
+        {  13, 139, 167, 198, 160, 172, 186, 147, 228, 175, 189 },
+        {   2,  90, 125, 187, 147, 164, 190, 148, 231, 186, 193 },
+        {   1,  54,  78, 154, 122, 154, 183, 135, 233, 187, 207 },
+        {   1,  22,  34,  94,  95, 139, 160, 111, 222, 173, 194 },
+        {   1,   7,  11,  35,  88, 132,  69,  93, 159, 131, 149 }
       }, { /* Coeff Band 5 */
-        {   1, 212, 207, 235, 190, 187, 220, 170, 240, 200, 207 },
-        {  11, 134, 179, 226, 175, 181, 214, 166, 236, 195, 201 },
-        {   1,  86, 133, 210, 155, 172, 210, 161, 236, 194, 201 },
-        {   1,  54,  88, 180, 129, 159, 200, 150, 235, 191, 200 },
-        {   1,  27,  46, 122, 104, 143, 170, 128, 230, 181, 198 },
-        {   1,   8,  15,  45,  88, 132,  81,  99, 171, 135, 154 }
+        {   6, 229, 210, 228, 186, 181, 211, 163, 238, 194, 217 },
+        {   2, 140, 169, 224, 170, 178, 222, 167, 244, 205, 214 },
+        {   1,  74, 112, 203, 143, 166, 220, 162, 247, 210, 220 },
+        {   1,  43,  64, 154, 113, 149, 198, 140, 246, 201, 229 },
+        {   1,  20,  32,  95,  95, 135, 167, 113, 237, 183, 222 },
+        {   1,   9,  14,  44,  88, 129,  87,  95, 197, 142, 190 }
       }
     }, { /* Inter */
       { /* Coeff Band 0 */
-        {  50,  51, 216, 230, 193, 186, 193, 156, 219, 181, 168 },
-        {  36,  44, 174, 210, 175, 174, 186, 149, 218, 179, 172 },
-        {  12,  32, 100, 161, 140, 159, 162, 135, 209, 168, 172 }
+        {  90,  25, 200, 240, 210, 196, 196, 160, 209, 175, 174 },
+        {  21,  29, 139, 218, 181, 181, 186, 146, 225, 177, 191 },
+        {  26,  35, 114, 203, 165, 176, 174, 142, 222, 174, 189 }
       }, { /* Coeff Band 1 */
-        {   1, 179, 230, 238, 191, 185, 229, 171, 250, 213, 200 },
-        { 167, 173, 225, 237, 190, 186, 231, 171, 245, 209, 223 },
-        { 115, 153, 208, 237, 187, 186, 229, 174, 247, 215, 216 },
-        {  71, 131, 182, 233, 176, 184, 228, 172, 247, 210, 238 },
-        {  41, 108, 145, 214, 151, 169, 228, 169, 246, 208, 210 },
-        {  19,  78,  95, 151, 128, 155, 168, 134, 218, 173, 175 }
+        { 128, 217, 229, 234, 186, 187, 215, 181, 224, 165, 255 },
+        { 154, 215, 234, 237, 179, 180, 226, 179, 255, 183, 128 },
+        { 125, 204, 225, 239, 185, 183, 230, 188, 233, 205,   1 },
+        {  74, 171, 200, 233, 180, 187, 222, 180, 249, 185,   1 },
+        {  39, 112, 154, 220, 154, 168, 219, 181, 247, 196, 255 },
+        {   9,  56,  81, 154, 124, 158, 177, 145, 227, 168, 207 }
       }, { /* Coeff Band 2 */
-        {   1, 147, 215, 231, 181, 181, 227, 171, 249, 212, 218 },
-        {  65, 122, 179, 222, 168, 175, 223, 166, 248, 213, 216 },
-        {  11,  85, 126, 204, 148, 167, 218, 159, 247, 208, 222 },
-        {   4,  61,  89, 177, 128, 158, 206, 147, 246, 204, 208 },
-        {   1,  38,  54, 130, 109, 145, 179, 128, 241, 191, 203 },
-        {   1,  18,  24,  68,  96, 137, 110, 107, 196, 153, 145 }
+        {  24, 153, 231, 245, 203, 194, 228, 187, 255, 158, 128 },
+        {  80, 153, 234, 242, 201, 192, 240, 195, 236, 171, 255 },
+        {  58, 153, 220, 242, 202, 194, 244, 178, 255, 205, 128 },
+        {  41, 132, 192, 237, 178, 194, 224, 185, 240, 221, 255 },
+        {  31, 104, 149, 213, 154, 166, 233, 172, 235, 206, 219 },
+        {  12,  82, 104, 157, 128, 153, 173, 133, 228, 185, 200 }
       }, { /* Coeff Band 3 */
-        {   1, 182, 227, 239, 193, 187, 231, 177, 250, 214, 189 },
-        {  73, 147, 202, 234, 182, 183, 230, 174, 248, 213, 219 },
-        {  12, 104, 154, 223, 164, 176, 228, 171, 248, 210, 225 },
-        {   3,  74, 113, 205, 143, 167, 222, 163, 246, 211, 214 },
-        {   1,  45,  69, 163, 116, 151, 205, 144, 244, 202, 205 },
-        {   1,  19,  30,  87,  96, 138, 134, 115, 199, 165, 133 }
+        {  64, 217, 240, 242, 198, 186, 238, 172, 243, 199, 255 },
+        {  74, 182, 225, 241, 190, 192, 234, 191, 255, 203, 128 },
+        {  21, 117, 176, 236, 176, 181, 238, 182, 248, 231, 255 },
+        {   7,  83, 126, 221, 153, 176, 232, 178, 250, 211, 128 },
+        {   1,  47,  74, 171, 116, 156, 208, 155, 243, 208, 238 },
+        {   1,  17,  31,  86,  83, 141, 135, 113, 220, 168, 190 }
       }, { /* Coeff Band 4 */
-        {   1, 198, 229, 242, 196, 190, 235, 182, 248, 216, 224 },
-        {  55, 154, 201, 236, 183, 185, 233, 179, 247, 214, 190 },
-        {   5, 101, 150, 225, 163, 177, 229, 172, 245, 210, 205 },
-        {   1,  68, 106, 203, 140, 165, 223, 165, 246, 209, 194 },
-        {   1,  38,  62, 154, 112, 149, 199, 143, 241, 198, 191 },
-        {   1,  14,  22,  66,  94, 133, 109, 107, 178, 154, 122 }
+        {  46, 236, 239, 243, 195, 192, 241, 189, 255, 195, 128 },
+        {  43, 189, 217, 242, 183, 185, 244, 196, 243, 208, 255 },
+        {   5, 101, 153, 234, 168, 181, 238, 201, 241, 224, 255 },
+        {   1,  64, 101, 212, 134, 165, 229, 175, 253, 202, 255 },
+        {   1,  32,  54, 149, 100, 140, 207, 145, 246, 198, 224 },
+        {   1,  12,  19,  51, 103, 140, 109,  98, 212, 157, 177 }
       }, { /* Coeff Band 5 */
-        {   1, 237, 226, 244, 205, 196, 225, 177, 243, 203, 210 },
-        {  24, 154, 200, 238, 189, 189, 221, 173, 240, 199, 210 },
-        {   2,  98, 150, 224, 167, 179, 217, 168, 240, 199, 207 },
-        {   1,  61,  99, 193, 137, 164, 207, 155, 239, 197, 208 },
-        {   1,  28,  49, 128, 105, 145, 177, 130, 234, 185, 206 },
-        {   1,   9,  16,  48,  89, 134,  89,  99, 183, 140, 169 }
+        {  25, 249, 228, 245, 205, 193, 241, 187, 252, 226, 219 },
+        {  12, 166, 186, 241, 183, 189, 246, 196, 254, 234, 199 },
+        {   1,  88, 130, 229, 156, 177, 245, 190, 255, 238, 255 },
+        {   1,  54,  84, 196, 124, 159, 237, 169, 255, 233, 237 },
+        {   1,  30,  49, 140, 102, 142, 211, 139, 251, 218, 225 },
+        {   1,  13,  21,  67,  89, 131, 130, 100, 229, 168, 233 }
       }
     }
   }, { /* block Type 1 */
     { /* Intra */
       { /* Coeff Band 0 */
-        { 176,  22, 201, 227, 185, 189, 160, 172, 115, 141, 105 },
-        {  64,  33, 120, 195, 149, 171, 170, 150, 182, 175, 139 },
-        {  12,  33,  68, 151, 118, 153, 172, 138, 202, 175, 153 }
+        {  77,  16,  83,  89, 131, 150,  46, 119,  43, 101,  50 },
+        {  15,  22,  42,  85, 105, 137, 110, 119, 153, 156, 117 },
+        {   4,  21,  34,  89,  98, 126, 120, 119, 149, 158, 105 }
       }, { /* Coeff Band 1 */
-        {   1, 125, 175, 228, 163, 176, 215, 171, 226, 193, 165 },
-        { 127, 126, 174, 224, 163, 177, 212, 167, 225, 175, 235 },
-        {  57, 114, 159, 223, 166, 175, 216, 167, 234, 182, 211 },
-        {  23,  93, 133, 215, 150, 174, 216, 171, 233, 174, 176 },
-        {   4,  56,  84, 178, 127, 157, 209, 149, 233, 197, 194 },
-        {   1,  19,  26,  70,  93, 136, 114, 108, 193, 150, 167 }
+        { 128, 129, 140, 212, 174, 179, 155, 105, 163, 146, 255 },
+        {  57, 121, 153, 189, 160, 191, 206, 148, 233, 230, 255 },
+        {  25, 105, 143, 193, 148, 174, 193, 134, 236, 213, 255 },
+        {   8,  95, 132, 197, 138, 174, 154, 165, 242, 161, 255 },
+        {   1,  67,  97, 165, 139, 143, 170, 143, 214, 188, 226 },
+        {   1,  22,  33,  65, 124, 144,  68, 123, 125, 118, 122 }
       }, { /* Coeff Band 2 */
-        {   1,  76, 172, 217, 161, 172, 216, 165, 240, 188, 226 },
-        {  41,  73, 136, 208, 152, 168, 214, 163, 233, 189, 248 },
-        {  14,  59, 102, 195, 137, 163, 209, 158, 227, 184, 204 },
-        {   4,  45,  75, 168, 122, 153, 197, 148, 231, 193, 178 },
-        {   1,  33,  48, 118, 106, 148, 154, 126, 221, 168, 211 },
-        {   1,  12,  16,  42,  90, 143,  61,  94, 159, 122, 167 }
+        {   9,  48, 113, 195, 136, 171, 209, 134, 255, 255, 128 },
+        {  15,  45, 110, 170, 139, 168, 209, 144, 219, 160, 255 },
+        {  16,  42,  92, 164, 131, 157, 210, 131, 247, 180,   1 },
+        {  14,  29,  78, 158, 117, 146, 191, 147, 229, 203, 192 },
+        {   2,  19,  36, 131,  94, 140, 185, 137, 232, 167, 216 },
+        {   1,   8,  14,  42,  95, 125,  89,  93, 163, 135, 145 }
       }, { /* Coeff Band 3 */
-        {   1, 134, 186, 226, 173, 180, 208, 172, 220, 179, 205 },
-        {  60, 114, 164, 219, 166, 177, 207, 166, 231, 176, 208 },
-        {  18,  90, 134, 208, 152, 175, 200, 164, 225, 181, 199 },
-        {   7,  67, 102, 189, 139, 164, 192, 155, 225, 172, 209 },
-        {   1,  39,  59, 137, 116, 151, 160, 132, 222, 166, 212 },
-        {   1,  12,  17,  50,  93, 134,  82, 102, 181, 131, 190 }
+        {  22, 137, 165, 202, 159, 183, 137, 133, 207, 136, 224 },
+        {  53, 123, 158, 206, 167, 176, 175, 178, 180, 171, 238 },
+        {  29, 103, 142, 187, 156, 167, 220, 170, 230, 142, 255 },
+        {  12,  75, 114, 182, 146, 168, 186, 132, 223, 191, 240 },
+        {   5,  42,  59, 140, 110, 149, 173, 138, 218, 173, 214 },
+        {   1,  13,  16,  42,  92, 122,  75,  99, 165, 133, 162 }
       }, { /* Coeff Band 4 */
-        {   1, 160, 195, 229, 180, 185, 204, 163, 243, 185, 223 },
-        {  31, 124, 170, 221, 170, 179, 201, 164, 240, 183, 223 },
-        {   5,  91, 134, 204, 154, 170, 191, 155, 236, 178, 232 },
-        {   1,  62,  95, 173, 135, 159, 180, 145, 234, 179, 225 },
-        {   1,  30,  48, 116, 109, 147, 152, 123, 231, 170, 224 },
-        {   1,  11,  17,  53,  90, 133,  93, 102, 201, 139, 202 }
+        {  14, 186, 183, 201, 164, 170, 198, 153, 233, 174, 205 },
+        {  13, 137, 172, 213, 169, 172, 187, 164, 235, 163, 228 },
+        {   2,  86, 128, 201, 151, 174, 198, 152, 221, 186, 192 },
+        {   1,  51,  79, 162, 125, 159, 190, 140, 237, 193, 198 },
+        {   1,  25,  37, 107, 107, 146, 141, 118, 223, 166, 212 },
+        {   1,   8,  11,  38,  85, 126,  78,  99, 180, 131, 190 }
       }, { /* Coeff Band 5 */
-        {   1, 215, 203, 233, 186, 183, 226, 170, 249, 213, 225 },
-        {  13, 133, 175, 224, 170, 178, 224, 167, 250, 212, 235 },
-        {   1,  83, 127, 209, 151, 169, 221, 162, 251, 212, 243 },
-        {   1,  53,  85, 182, 127, 157, 213, 153, 250, 210, 234 },
-        {   1,  30,  47, 131, 103, 143, 190, 132, 248, 200, 240 },
-        {   1,  14,  21,  67,  89, 129, 126, 104, 232, 167, 223 }
+        {   7, 224, 213, 235, 191, 183, 222, 170, 241, 212, 241 },
+        {   2, 142, 176, 232, 177, 181, 230, 175, 251, 215, 216 },
+        {   1,  79, 121, 214, 150, 170, 230, 171, 251, 220, 247 },
+        {   1,  44,  70, 168, 117, 151, 211, 148, 251, 211, 238 },
+        {   1,  25,  38, 113,  98, 137, 177, 123, 247, 192, 229 },
+        {   1,  12,  19,  56,  89, 128, 111,  99, 223, 156, 228 }
       }
     }, { /* Inter */
       { /* Coeff Band 0 */
-        { 193,  35, 239, 239, 206, 194, 195, 152, 244, 200, 255 },
-        {  77,  57, 198, 224, 192, 187, 181, 145, 242, 190, 248 },
-        {  21,  54, 149, 197, 172, 171, 169, 138, 238, 178, 241 }
+        { 113, 113, 206, 246, 197, 205, 228, 180, 255, 192, 128 },
+        {   8, 110, 179, 248, 197, 204, 215, 190, 245, 211, 255 },
+        {   1,  92, 181, 253, 212, 220, 197, 164, 255, 187, 128 }
       }, { /* Coeff Band 1 */
-        {   1, 227, 241, 247, 195, 195, 245, 199, 255, 255, 128 },
-        { 189, 223, 237, 249, 199, 200, 238, 198, 255, 255, 128 },
-        { 125, 204, 226, 247, 198, 199, 251, 213, 255, 255, 128 },
-        { 101, 167, 207, 246, 193, 201, 245, 168, 255, 255, 128 },
-        {  89, 121, 174, 237, 169, 184, 246, 204, 255, 255, 128 },
-        {  71,  79, 135, 216, 149, 170, 234, 168, 255, 226, 128 }
+        { 128, 250, 254, 255, 255, 128, 128, 128, 128, 128, 128 },
+        {  38, 247, 254, 255, 255, 128, 128, 128, 128, 128, 128 },
+        {  20, 239, 255, 255, 255, 128, 128, 128, 128, 128, 128 },
+        {  16, 221, 249, 255, 241, 255, 128, 128, 128, 128, 128 },
+        {  29, 121, 195, 240, 195, 209, 255, 255, 128, 128, 128 },
+        {  18,  48,  95, 175, 128, 146, 236, 149, 255, 255, 128 }
       }, { /* Coeff Band 2 */
-        {   1, 207, 235, 250, 220, 204, 250, 201, 255, 255, 128 },
-        { 103, 160, 210, 245, 195, 188, 249, 195, 255, 255, 128 },
-        {  33, 130, 165, 234, 168, 183, 253, 199, 255, 255, 128 },
-        {  10, 113, 138, 223, 146, 180, 248, 199, 255, 255, 128 },
-        {   1,  88, 104, 172, 112, 174, 221, 126, 255, 217, 128 },
-        {   1,  87,  70, 160,  68, 140, 171,  85, 255,  85, 128 }
+        {  14, 225, 235, 255, 236, 255, 128, 128, 128, 128, 128 },
+        {  23, 219, 238, 255, 242, 238, 128, 128, 128, 128, 128 },
+        {  14, 189, 228, 255, 239, 223, 128, 128, 128, 128, 128 },
+        {  20, 144, 194, 251, 206, 211, 255, 224, 128, 128, 128 },
+        {  22, 107, 164, 223, 160, 195, 255, 230, 128, 128, 128 },
+        {   4,  84, 155, 244, 166, 183, 255, 255, 128, 128, 128 }
       }, { /* Coeff Band 3 */
-        {   1, 230, 240, 249, 209, 200, 243, 199, 255, 228, 128 },
-        {  60, 178, 218, 247, 203, 200, 247, 198, 255, 255, 128 },
-        {   8, 119, 162, 241, 188, 185, 252, 202, 255, 255, 128 },
-        {   2,  78, 119, 218, 149, 162, 247, 184, 255, 255, 128 },
-        {   1,  48,  81, 172, 142, 148, 239, 140, 255, 239, 128 },
-        {   1,  29,  23,  82,  96, 102, 181, 149, 255, 255, 128 }
+        {   7, 244, 250, 255, 246, 238, 255,   1, 128, 128, 128 },
+        {   9, 201, 231, 255, 243, 245, 255, 255, 128, 128, 128 },
+        {   4,  79, 166, 255, 220, 243, 255, 255, 128, 128, 128 },
+        {   2,  40, 104, 254, 181, 214, 255, 255, 128, 128, 128 },
+        {   1,  29,  17, 221, 133, 149, 255, 255, 128, 128, 128 },
+        {   1,   1,   1,   1, 128, 128, 255, 255, 128, 128, 128 }
       }, { /* Coeff Band 4 */
-        {   1, 240, 241, 250, 216, 203, 248, 188, 255, 255, 128 },
-        {  60, 180, 222, 247, 202, 195, 247, 191, 255, 255, 128 },
-        {   9, 120, 169, 240, 190, 189, 249, 181, 255, 255, 128 },
-        {   2,  85, 126, 223, 154, 178, 240, 184, 255, 255, 128 },
-        {   1,  47,  90, 198, 132, 158, 233, 162, 255, 224, 128 },
-        {   1,  33,  34, 143, 116, 156, 217, 128, 255, 255, 128 }
+        {   7, 250, 251, 255, 251, 228, 128, 128, 128, 128, 128 },
+        {   6, 207, 237, 255, 246, 255, 128, 128, 128, 128, 128 },
+        {   1,  79, 158, 255, 229, 242, 128, 128, 128, 128, 128 },
+        {   1,  22,  89, 251, 183, 229, 255, 192, 128, 128, 128 },
+        {   1,  54, 102, 142, 255, 128, 192,   1, 255, 255, 128 },
+        {   1,   1,   1, 255,   1, 255, 128, 128, 128, 128, 128 }
       }, { /* Coeff Band 5 */
-        {   1, 250, 193, 249, 188, 193, 255, 236, 255, 255, 128 },
-        {  35, 187, 185, 247, 154, 184, 255, 247, 255, 171, 128 },
-        {  20, 132, 114, 223, 172, 165, 255, 229, 255, 255, 128 },
-        {   4,  97,  96, 218,  96, 162, 255, 164, 255, 253, 128 },
-        {   1,  57,  35, 197, 154, 173, 254, 215, 255, 255, 128 },
-        {   1,   8,   2, 161,  10,  57, 230, 228, 255, 171, 128 }
+        {  34, 251, 193, 247, 183, 192, 255, 225, 255, 255, 128 },
+        {  20, 187, 163, 240, 168, 180, 255, 222, 255, 255, 128 },
+        {   5, 100, 125, 237, 163, 179, 255, 214, 255, 255, 128 },
+        {   1,  90, 105, 232, 153, 178, 255, 204, 255, 255, 128 },
+        {   1,  79,  87, 219, 138, 168, 255, 210, 255, 255, 128 },
+        {   1,   1,   1, 255,   1,  64, 128, 128, 128, 128, 128 }
       }
     }
   }
index 8d9d4a5..ca55699 100644 (file)
@@ -1886,25 +1886,25 @@ vp9_extra_bit_struct vp9_extra_bits[12] = {
 // within the current block.
 //
 // For now it just returns the previously used context.
-int vp9_get_coef_context(int * recent_energy, int token) {
-  // int token_energy;
-  // int av_energy;
-
-  /*token_energy = ((token != DCT_EOB_TOKEN) ? token : 0);
-  if (!token_energy) {
-    if (!(*recent_energy)) {
-      av_energy = 0;
+#define MAX_NEIGHBORS 2
+int vp9_get_coef_context(const int *scan, const int *neighbors,
+                         int nb_pad, uint8_t *token_cache, int c, int l) {
+  int eob = l;
+  assert(nb_pad == MAX_NEIGHBORS);
+  if (c == eob - 1) {
+    return 0;
+  } else {
+    int ctx;
+    c++;
+    assert(neighbors[MAX_NEIGHBORS * c + 0] >= 0);
+    if (neighbors[MAX_NEIGHBORS * c + 1] >= 0) {
+      ctx = (1 + token_cache[neighbors[MAX_NEIGHBORS * c + 0]] +
+             token_cache[neighbors[MAX_NEIGHBORS * c + 1]]) >> 1;
     } else {
-      av_energy = 1;
+      ctx = token_cache[neighbors[MAX_NEIGHBORS * c + 0]];
     }
-  } else {
-    av_energy = ((token_energy + *recent_energy + 1) >> 1) + 1;
-    if (av_energy > DCT_VAL_CATEGORY6)
-      av_energy = DCT_VAL_CATEGORY6;
+    return vp9_pt_energy_class[ctx];
   }
-  *recent_energy = token_energy;*/
-
-  return vp9_pt_energy_class[token];
 };
 
 void vp9_default_coef_probs(VP9_COMMON *pc) {
@@ -2063,7 +2063,119 @@ void vp9_adjust_default_coef_probs(VP9_COMMON *cm) {
 }
 #endif
 
+// Neighborhood 5-tuples for various scans and blocksizes,
+// in {top, left, topleft, topright, bottomleft} order
+// for each position in raster scan order.
+// -1 indicates the neighbor does not exist.
+DECLARE_ALIGNED(16, int,
+                vp9_default_zig_zag1d_4x4_neighbors[16 * MAX_NEIGHBORS]);
+DECLARE_ALIGNED(16, int,
+                vp9_col_scan_4x4_neighbors[16 * MAX_NEIGHBORS]);
+DECLARE_ALIGNED(16, int,
+                vp9_row_scan_4x4_neighbors[16 * MAX_NEIGHBORS]);
+DECLARE_ALIGNED(16, int,
+                vp9_default_zig_zag1d_8x8_neighbors[64 * MAX_NEIGHBORS]);
+DECLARE_ALIGNED(16, int,
+                vp9_default_zig_zag1d_16x16_neighbors[256 * MAX_NEIGHBORS]);
+DECLARE_ALIGNED(16, int,
+                vp9_default_zig_zag1d_32x32_neighbors[1024 * MAX_NEIGHBORS]);
+
+static int find_in_scan(const int *scan, int l, int idx) {
+  int n, l2 = l * l;
+  for (n = 0; n < l2; n++) {
+    int rc = scan[n];
+    if (rc == idx)
+      return  n;
+  }
+  assert(0);
+  return -1;
+}
+static void init_scan_neighbors(const int *scan, int l, int *neighbors,
+                                int max_neighbors) {
+  int l2 = l * l;
+  int n, i, j;
+
+  for (n = 0; n < l2; n++) {
+    int rc = scan[n];
+    assert(max_neighbors == MAX_NEIGHBORS);
+    i = rc / l;
+    j = rc % l;
+    if (i > 0 && j > 0) {
+      // col/row scan is used for adst/dct, and generally means that
+      // energy decreases to zero much faster in the dimension in
+      // which ADST is used compared to the direction in which DCT
+      // is used. Likewise, we find much higher correlation between
+      // coefficients within the direction in which DCT is used.
+      // Therefore, if we use ADST/DCT, prefer the DCT neighbor coeff
+      // as a context. If ADST or DCT is used in both directions, we
+      // use the combination of the two as a context.
+      int a = find_in_scan(scan, l, (i - 1) * l + j);
+      int b = find_in_scan(scan, l,  i      * l + j - 1);
+      if (scan == vp9_col_scan_4x4 || scan == vp9_row_scan_4x4) {
+        neighbors[max_neighbors * n + 0] = MAX(a, b);
+        neighbors[max_neighbors * n + 1] = -1;
+      } else {
+        neighbors[max_neighbors * n + 0] = a;
+        neighbors[max_neighbors * n + 1] = b;
+      }
+    } else if (i > 0) {
+      neighbors[max_neighbors * n + 0] = find_in_scan(scan, l, (i - 1) * l + j);
+      neighbors[max_neighbors * n + 1] = -1;
+    } else if (j > 0) {
+      neighbors[max_neighbors * n + 0] =
+          find_in_scan(scan, l,  i      * l + j - 1);
+      neighbors[max_neighbors * n + 1] = -1;
+    } else {
+      assert(n == 0);
+      // dc predictor doesn't use previous tokens
+      neighbors[max_neighbors * n + 0] = -1;
+    }
+    assert(neighbors[max_neighbors * n + 0] < n);
+  }
+}
+
+void vp9_init_neighbors() {
+  init_scan_neighbors(vp9_default_zig_zag1d_4x4, 4,
+                      vp9_default_zig_zag1d_4x4_neighbors, MAX_NEIGHBORS);
+  init_scan_neighbors(vp9_row_scan_4x4, 4,
+                      vp9_row_scan_4x4_neighbors, MAX_NEIGHBORS);
+  init_scan_neighbors(vp9_col_scan_4x4, 4,
+                      vp9_col_scan_4x4_neighbors, MAX_NEIGHBORS);
+  init_scan_neighbors(vp9_default_zig_zag1d_8x8, 8,
+                      vp9_default_zig_zag1d_8x8_neighbors, MAX_NEIGHBORS);
+  init_scan_neighbors(vp9_default_zig_zag1d_16x16, 16,
+                      vp9_default_zig_zag1d_16x16_neighbors, MAX_NEIGHBORS);
+  init_scan_neighbors(vp9_default_zig_zag1d_32x32, 32,
+                      vp9_default_zig_zag1d_32x32_neighbors, MAX_NEIGHBORS);
+}
+
+const int *vp9_get_coef_neighbors_handle(const int *scan, int *pad) {
+  if (scan == vp9_default_zig_zag1d_4x4) {
+    *pad = MAX_NEIGHBORS;
+    return vp9_default_zig_zag1d_4x4_neighbors;
+  } else if (scan == vp9_row_scan_4x4) {
+    *pad = MAX_NEIGHBORS;
+    return vp9_row_scan_4x4_neighbors;
+  } else if (scan == vp9_col_scan_4x4) {
+    *pad = MAX_NEIGHBORS;
+    return vp9_col_scan_4x4_neighbors;
+  } else if (scan == vp9_default_zig_zag1d_8x8) {
+    *pad = MAX_NEIGHBORS;
+    return vp9_default_zig_zag1d_8x8_neighbors;
+  } else if (scan == vp9_default_zig_zag1d_16x16) {
+    *pad = MAX_NEIGHBORS;
+    return vp9_default_zig_zag1d_16x16_neighbors;
+  } else if (scan == vp9_default_zig_zag1d_32x32) {
+    *pad = MAX_NEIGHBORS;
+    return vp9_default_zig_zag1d_32x32_neighbors;
+  } else {
+    assert(0);
+    return NULL;
+  }
+}
+
 void vp9_coef_tree_initialize() {
+  vp9_init_neighbors();
   init_bit_trees();
   vp9_tokens_from_tree(vp9_coef_encodings, vp9_coef_tree);
 #if CONFIG_CODE_NONZEROCOUNT
@@ -3170,6 +3282,9 @@ void vp9_update_nzc_counts(VP9_COMMON *cm,
 static void adapt_coef_probs(vp9_coeff_probs *dst_coef_probs,
                              vp9_coeff_probs *pre_coef_probs,
                              int block_types, vp9_coeff_count *coef_counts,
+                             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];
@@ -3190,6 +3305,8 @@ static void adapt_coef_probs(vp9_coeff_probs *dst_coef_probs,
           vp9_tree_probs_from_distribution(vp9_coef_tree,
                                            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) {
             count = branch_ct[t][0] + branch_ct[t][1];
             count = count > count_sat ? count_sat : count;
@@ -3224,15 +3341,19 @@ void vp9_adapt_coef_probs(VP9_COMMON *cm) {
 
   adapt_coef_probs(cm->fc.coef_probs_4x4, cm->fc.pre_coef_probs_4x4,
                    BLOCK_TYPES, 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,
                    BLOCK_TYPES, 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,
                    BLOCK_TYPES, 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,
                    BLOCK_TYPES, cm->fc.coef_counts_32x32,
+                   cm->fc.eob_branch_counts[TX_32X32],
                    count_sat, update_factor);
 }
 
index e7fb501..45874e7 100644 (file)
@@ -139,7 +139,9 @@ static int get_coef_band(TX_SIZE tx_size, int coef_index) {
       return 5;
   }
 }
-extern int vp9_get_coef_context(int * recent_energy, int token);
+extern int vp9_get_coef_context(const int *scan, const int *neighbors,
+                                int nb_pad, uint8_t *token_cache, int c, int l);
+const int *vp9_get_coef_neighbors_handle(const int *scan, int *pad);
 
 #if CONFIG_MODELCOEFPROB
 #define COEFPROB_BITS               8
index a76f4c5..fdbabc5 100644 (file)
@@ -114,6 +114,9 @@ typedef struct frame_contexts {
   vp9_coeff_count coef_counts_8x8[BLOCK_TYPES];
   vp9_coeff_count coef_counts_16x16[BLOCK_TYPES];
   vp9_coeff_count coef_counts_32x32[BLOCK_TYPES];
+  unsigned int eob_branch_counts[TX_SIZE_MAX_SB][BLOCK_TYPES][REF_TYPES]
+                                [COEF_BANDS][PREV_COEF_CONTEXTS];
+
 #if CONFIG_CODE_NONZEROCOUNT
   unsigned int nzc_counts_4x4[MAX_NZC_CONTEXTS][REF_TYPES][BLOCK_TYPES]
                              [NZC4X4_TOKENS];
index 8023740..5028dfb 100644 (file)
@@ -1716,6 +1716,7 @@ int vp9_decode_frame(VP9D_COMP *pbi, const unsigned char **p_data_end) {
   vp9_zero(pbi->common.fc.coef_counts_8x8);
   vp9_zero(pbi->common.fc.coef_counts_16x16);
   vp9_zero(pbi->common.fc.coef_counts_32x32);
+  vp9_zero(pbi->common.fc.eob_branch_counts);
   vp9_zero(pbi->common.fc.ymode_counts);
   vp9_zero(pbi->common.fc.sb_ymode_counts);
   vp9_zero(pbi->common.fc.uv_mode_counts);
index 0a584d7..9c168e1 100644 (file)
@@ -66,7 +66,8 @@ static int get_signed(BOOL_DECODER *br, int value_to_sign) {
 #define INCREMENT_COUNT(token)               \
   do {                                       \
     coef_counts[type][ref][get_coef_band(txfm_size, c)][pt][token]++;     \
-    pt = vp9_get_coef_context(&recent_energy, token);         \
+    token_cache[c] = token; \
+    pt = vp9_get_coef_context(scan, nb, pad, token_cache, c, default_eob); \
   } while (0)
 
 #if CONFIG_CODE_NONZEROCOUNT
@@ -103,8 +104,7 @@ static int decode_coefs(VP9D_COMP *dx, const MACROBLOCKD *xd,
   int aidx, lidx;
   ENTROPY_CONTEXT above_ec, left_ec;
   FRAME_CONTEXT *const fc = &dx->common.fc;
-  int recent_energy = 0;
-  int pt, c = 0;
+  int pt, c = 0, pad, default_eob;
   vp9_coeff_probs *coef_probs;
   vp9_prob *prob;
   vp9_coeff_count *coef_counts;
@@ -113,7 +113,8 @@ static int decode_coefs(VP9D_COMP *dx, const MACROBLOCKD *xd,
   uint16_t nzc = 0;
   uint16_t nzc_expected = xd->mode_info_context->mbmi.nzcs[block_idx];
 #endif
-  const int *scan;
+  const int *scan, *nb;
+  uint8_t token_cache[1024];
 
   if (xd->mode_info_context->mbmi.sb_type == BLOCK_SIZE_SB64X64) {
     aidx = vp9_block2above_sb64[txfm_size][block_idx];
@@ -145,6 +146,7 @@ static int decode_coefs(VP9D_COMP *dx, const MACROBLOCKD *xd,
       left_ec = L0[lidx] != 0;
       coef_probs  = fc->coef_probs_4x4;
       coef_counts = fc->coef_counts_4x4;
+      default_eob = 16;
       break;
     }
     case TX_8X8:
@@ -153,6 +155,7 @@ static int decode_coefs(VP9D_COMP *dx, const MACROBLOCKD *xd,
       coef_counts = fc->coef_counts_8x8;
       above_ec = (A0[aidx] + A0[aidx + 1]) != 0;
       left_ec  = (L0[lidx] + L0[lidx + 1]) != 0;
+      default_eob = 64;
       break;
     case TX_16X16:
       scan = vp9_default_zig_zag1d_16x16;
@@ -167,6 +170,7 @@ static int decode_coefs(VP9D_COMP *dx, const MACROBLOCKD *xd,
         above_ec = (A0[aidx] + A0[aidx + 1] + A0[aidx + 2] + A0[aidx + 3]) != 0;
         left_ec  = (L0[lidx] + L0[lidx + 1] + L0[lidx + 2] + L0[lidx + 3]) != 0;
       }
+      default_eob = 256;
       break;
     case TX_32X32:
       scan = vp9_default_zig_zag1d_32x32;
@@ -191,10 +195,13 @@ static int decode_coefs(VP9D_COMP *dx, const MACROBLOCKD *xd,
         left_ec  = (L0[lidx] + L0[lidx + 1] + L0[lidx + 2] + L0[lidx + 3] +
                     L1[lidx] + L1[lidx + 1] + L1[lidx + 2] + L1[lidx + 3]) != 0;
       }
+      default_eob = 1024;
       break;
   }
 
   VP9_COMBINEENTROPYCONTEXTS(pt, above_ec, left_ec);
+  nb = vp9_get_coef_neighbors_handle(scan, &pad);
+
   while (1) {
     int val;
     const uint8_t *cat6 = cat6_prob;
@@ -207,6 +214,8 @@ static int decode_coefs(VP9D_COMP *dx, const MACROBLOCKD *xd,
 #endif
     prob = coef_probs[type][ref][get_coef_band(txfm_size, c)][pt];
 #if CONFIG_CODE_NONZEROCOUNT == 0
+    fc->eob_branch_counts[txfm_size][type][ref]
+                         [get_coef_band(txfm_size, c)][pt]++;
     if (!vp9_read(br, prob[EOB_CONTEXT_NODE]))
       break;
 #endif
index c0ae5ba..ec72923 100644 (file)
@@ -1758,6 +1758,9 @@ static void print_prob_tree(vp9_coeff_probs *coef_probs, int block_types) {
 
 static void build_tree_distribution(vp9_coeff_probs *coef_probs,
                                     vp9_coeff_count *coef_counts,
+                                    unsigned int (*eob_branch_ct)[REF_TYPES]
+                                                                 [COEF_BANDS]
+                                                          [PREV_COEF_CONTEXTS],
 #ifdef ENTROPY_STATS
                                     VP9_COMP *cpi,
                                     vp9_coeff_accum *context_counters,
@@ -1779,10 +1782,18 @@ static void build_tree_distribution(vp9_coeff_probs *coef_probs,
                                            coef_probs[i][j][k][l],
                                            coef_branch_ct[i][j][k][l],
                                            coef_counts[i][j][k][l], 0);
+          coef_branch_ct[i][j][k][l][0][1] = eob_branch_ct[i][j][k][l] -
+                                             coef_branch_ct[i][j][k][l][0][0];
+          coef_probs[i][j][k][l][0] =
+              get_binary_prob(coef_branch_ct[i][j][k][l][0][0],
+                              coef_branch_ct[i][j][k][l][0][1]);
 #ifdef ENTROPY_STATS
-        if (!cpi->dummy_packing)
-          for (t = 0; t < MAX_ENTROPY_TOKENS; ++t)
-            context_counters[i][j][k][l][t] += coef_counts[i][j][k][l][t];
+          if (!cpi->dummy_packing) {
+            for (t = 0; t < MAX_ENTROPY_TOKENS; ++t)
+              context_counters[i][j][k][l][t] += coef_counts[i][j][k][l][t];
+            context_counters[i][j][k][l][MAX_ENTROPY_TOKENS] +=
+                eob_branch_ct[i][j][k][l];
+          }
 #endif
         }
       }
@@ -1793,24 +1804,28 @@ static void build_tree_distribution(vp9_coeff_probs *coef_probs,
 static void build_coeff_contexts(VP9_COMP *cpi) {
   build_tree_distribution(cpi->frame_coef_probs_4x4,
                           cpi->coef_counts_4x4,
+                          cpi->common.fc.eob_branch_counts[TX_4X4],
 #ifdef ENTROPY_STATS
                           cpi, context_counters_4x4,
 #endif
                           cpi->frame_branch_ct_4x4, BLOCK_TYPES);
   build_tree_distribution(cpi->frame_coef_probs_8x8,
                           cpi->coef_counts_8x8,
+                          cpi->common.fc.eob_branch_counts[TX_8X8],
 #ifdef ENTROPY_STATS
                           cpi, context_counters_8x8,
 #endif
                           cpi->frame_branch_ct_8x8, BLOCK_TYPES);
   build_tree_distribution(cpi->frame_coef_probs_16x16,
                           cpi->coef_counts_16x16,
+                          cpi->common.fc.eob_branch_counts[TX_16X16],
 #ifdef ENTROPY_STATS
                           cpi, context_counters_16x16,
 #endif
                           cpi->frame_branch_ct_16x16, BLOCK_TYPES);
   build_tree_distribution(cpi->frame_coef_probs_32x32,
                           cpi->coef_counts_32x32,
+                          cpi->common.fc.eob_branch_counts[TX_32X32],
 #ifdef ENTROPY_STATS
                           cpi, context_counters_32x32,
 #endif
index 5e17c55..b195ba1 100644 (file)
@@ -1276,6 +1276,7 @@ static void encode_frame_internal(VP9_COMP *cpi) {
   vp9_zero(cpi->coef_counts_8x8);
   vp9_zero(cpi->coef_counts_16x16);
   vp9_zero(cpi->coef_counts_32x32);
+  vp9_zero(cm->fc.eob_branch_counts);
 #if CONFIG_CODE_NONZEROCOUNT
   vp9_zero(cm->fc.nzc_counts_4x4);
   vp9_zero(cm->fc.nzc_counts_8x8);
index dae177a..4ab8882 100644 (file)
@@ -528,9 +528,16 @@ static const int plane_rd_mult[4] = {
 
 // This function is a place holder for now but may ultimately need
 // to scan previous tokens to work out the correct context.
-static int trellis_get_coeff_context(int token) {
-  int recent_energy = 0;
-  return vp9_get_coef_context(&recent_energy, token);
+static int trellis_get_coeff_context(const int *scan,
+                                     const int *nb,
+                                     int idx, int token,
+                                     uint8_t *token_cache,
+                                     int pad, int l) {
+  int bak = token_cache[idx], pt;
+  token_cache[idx] = token;
+  pt = vp9_get_coef_context(scan, nb, pad, token_cache, idx + 1, l);
+  token_cache[idx] = bak;
+  return pt;
 }
 
 static void optimize_b(VP9_COMMON *const cm,
@@ -552,9 +559,10 @@ static void optimize_b(VP9_COMMON *const cm,
   int rate0, rate1, error0, error1, t0, t1;
   int best, band, pt;
   int err_mult = plane_rd_mult[type];
-  int default_eob;
-  int const *scan;
+  int default_eob, pad;
+  int const *scan, *nb;
   const int mul = 1 + (tx_size == TX_32X32);
+  uint8_t token_cache[1024];
 #if CONFIG_CODE_NONZEROCOUNT
   // TODO(debargha): the dynamic programming approach used in this function
   // is not compatible with the true rate cost when nzcs are used. Note
@@ -631,6 +639,10 @@ static void optimize_b(VP9_COMMON *const cm,
   tokens[eob][0].qc = 0;
   *(tokens[eob] + 1) = *(tokens[eob] + 0);
   next = eob;
+  for (i = 0; i < eob; i++)
+    token_cache[i] = vp9_dct_value_tokens_ptr[qcoeff_ptr[scan[i]]].Token;
+  nb = vp9_get_coef_neighbors_handle(scan, &pad);
+
   for (i = eob; i-- > i0;) {
     int base_bits, d2, dx;
 #if CONFIG_CODE_NONZEROCOUNT
@@ -651,7 +663,8 @@ static void optimize_b(VP9_COMMON *const cm,
       /* Consider both possible successor states. */
       if (next < default_eob) {
         band = get_coef_band(tx_size, i + 1);
-        pt = trellis_get_coeff_context(t0);
+        pt = trellis_get_coeff_context(scan, nb, i, t0, token_cache,
+                                       pad, default_eob);
         rate0 +=
           mb->token_costs[tx_size][type][ref][band][pt][tokens[next][0].token];
         rate1 +=
@@ -710,12 +723,14 @@ static void optimize_b(VP9_COMMON *const cm,
       if (next < default_eob) {
         band = get_coef_band(tx_size, i + 1);
         if (t0 != DCT_EOB_TOKEN) {
-          pt = trellis_get_coeff_context(t0);
+          pt = trellis_get_coeff_context(scan, nb, i, t0, token_cache,
+                                         pad, default_eob);
           rate0 += mb->token_costs[tx_size][type][ref][band][pt][
               tokens[next][0].token];
         }
         if (t1 != DCT_EOB_TOKEN) {
-          pt = trellis_get_coeff_context(t1);
+          pt = trellis_get_coeff_context(scan, nb, i, t1, token_cache,
+                                         pad, default_eob);
           rate1 += mb->token_costs[tx_size][type][ref][band][pt][
               tokens[next][1].token];
         }
index 04b732a..8ba2220 100644 (file)
@@ -156,21 +156,9 @@ static void fill_token_costs(vp9_coeff_count *c,
     for (j = 0; j < REF_TYPES; j++)
       for (k = 0; k < COEF_BANDS; k++)
         for (l = 0; l < PREV_COEF_CONTEXTS; l++) {
-#if CONFIG_CODE_NONZEROCOUNT
-          // All costs are without the EOB node
           vp9_cost_tokens_skip((int *)(c[i][j][k][l]),
                                p[i][j][k][l],
                                vp9_coef_tree);
-#else
-          if (l == 0 && k > 0)
-            vp9_cost_tokens_skip((int *)(c[i][j][k][l]),
-                                 p[i][j][k][l],
-                                 vp9_coef_tree);
-          else
-            vp9_cost_tokens((int *)(c[i][j][k][l]),
-                            p[i][j][k][l],
-                            vp9_coef_tree);
-#endif
         }
 }
 
@@ -448,8 +436,8 @@ static INLINE int cost_coeffs(VP9_COMMON *const cm, MACROBLOCK *mb,
   int pt;
   const int eob = xd->eobs[ib];
   int c = 0;
-  int cost = 0;
-  const int *scan;
+  int cost = 0, pad;
+  const int *scan, *nb;
   const int16_t *qcoeff_ptr = xd->qcoeff + ib * 16;
   const int ref = mbmi->ref_frame != INTRA_FRAME;
   unsigned int (*token_costs)[PREV_COEF_CONTEXTS][MAX_ENTROPY_TOKENS] =
@@ -464,9 +452,12 @@ static INLINE int cost_coeffs(VP9_COMMON *const cm, MACROBLOCK *mb,
   int nzc_context = vp9_get_nzc_context(cm, xd, ib);
   unsigned int *nzc_cost;
 #else
-  int seg_eob;
   const int segment_id = xd->mode_info_context->mbmi.segment_id;
+  vp9_prob (*coef_probs)[REF_TYPES][COEF_BANDS][PREV_COEF_CONTEXTS]
+                        [ENTROPY_NODES];
 #endif
+  int seg_eob, default_eob;
+  uint8_t token_cache[1024];
 
   // Check for consistency of tx_size with mode info
   if (type == PLANE_TYPE_Y_WITH_DC) {
@@ -485,8 +476,9 @@ static INLINE int cost_coeffs(VP9_COMMON *const cm, MACROBLOCK *mb,
 #if CONFIG_CODE_NONZEROCOUNT
       nzc_cost = mb->nzc_costs_4x4[nzc_context][ref][type];
 #else
-      seg_eob = 16;
+      coef_probs = cm->fc.coef_probs_4x4;
 #endif
+      seg_eob = 16;
       if (tx_type == ADST_DCT) {
         scan = vp9_row_scan_4x4;
       } else if (tx_type == DCT_ADST) {
@@ -503,16 +495,18 @@ static INLINE int cost_coeffs(VP9_COMMON *const cm, MACROBLOCK *mb,
 #if CONFIG_CODE_NONZEROCOUNT
       nzc_cost = mb->nzc_costs_8x8[nzc_context][ref][type];
 #else
-      seg_eob = 64;
+      coef_probs = cm->fc.coef_probs_8x8;
 #endif
+      seg_eob = 64;
       break;
     case TX_16X16:
       scan = vp9_default_zig_zag1d_16x16;
 #if CONFIG_CODE_NONZEROCOUNT
       nzc_cost = mb->nzc_costs_16x16[nzc_context][ref][type];
 #else
-      seg_eob = 256;
+      coef_probs = cm->fc.coef_probs_16x16;
 #endif
+      seg_eob = 256;
       if (type == PLANE_TYPE_UV) {
         a_ec = (a[0] + a[1] + a1[0] + a1[1]) != 0;
         l_ec = (l[0] + l[1] + l1[0] + l1[1]) != 0;
@@ -526,8 +520,9 @@ static INLINE int cost_coeffs(VP9_COMMON *const cm, MACROBLOCK *mb,
 #if CONFIG_CODE_NONZEROCOUNT
       nzc_cost = mb->nzc_costs_32x32[nzc_context][ref][type];
 #else
-      seg_eob = 1024;
+      coef_probs = cm->fc.coef_probs_32x32;
 #endif
+      seg_eob = 1024;
       if (type == PLANE_TYPE_UV) {
         ENTROPY_CONTEXT *a2, *a3, *l2, *l3;
         a2 = a1 + sizeof(ENTROPY_CONTEXT_PLANES) / sizeof(ENTROPY_CONTEXT);
@@ -551,6 +546,8 @@ static INLINE int cost_coeffs(VP9_COMMON *const cm, MACROBLOCK *mb,
   }
 
   VP9_COMBINEENTROPYCONTEXTS(pt, a_ec, l_ec);
+  nb = vp9_get_coef_neighbors_handle(scan, &pad);
+  default_eob = seg_eob;
 
 #if CONFIG_CODE_NONZEROCOUNT == 0
   if (vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP))
@@ -558,7 +555,6 @@ static INLINE int cost_coeffs(VP9_COMMON *const cm, MACROBLOCK *mb,
 #endif
 
   {
-    int recent_energy = 0;
 #if CONFIG_CODE_NONZEROCOUNT
     int nzc = 0;
 #endif
@@ -568,9 +564,16 @@ static INLINE int cost_coeffs(VP9_COMMON *const cm, MACROBLOCK *mb,
 #if CONFIG_CODE_NONZEROCOUNT
       nzc += (v != 0);
 #endif
+      token_cache[c] = t;
       cost += token_costs[get_coef_band(tx_size, c)][pt][t];
       cost += vp9_dct_value_cost_ptr[v];
-      pt = vp9_get_coef_context(&recent_energy, t);
+#if !CONFIG_CODE_NONZEROCOUNT
+      if (!c || token_cache[c - 1])
+        cost += vp9_cost_bit(coef_probs[type][ref]
+                                       [get_coef_band(tx_size, c)]
+                                       [pt][0], 1);
+#endif
+      pt = vp9_get_coef_context(scan, nb, pad, token_cache, c, default_eob);
     }
 #if CONFIG_CODE_NONZEROCOUNT
     cost += nzc_cost[nzc];
index cead2a6..c03970d 100644 (file)
@@ -109,6 +109,8 @@ static void fill_value_tokens() {
   vp9_dct_value_cost_ptr   = dct_value_cost + DCT_MAX_VALUE;
 }
 
+extern const int *vp9_get_coef_neighbors_handle(const int *scan, int *pad);
+
 static void tokenize_b(VP9_COMP *cpi,
                        MACROBLOCKD *xd,
                        const int ib,
@@ -119,18 +121,18 @@ static void tokenize_b(VP9_COMP *cpi,
   MB_MODE_INFO *mbmi = &xd->mode_info_context->mbmi;
   int pt; /* near block/prev token context index */
   int c = 0;
-  int recent_energy = 0;
   const int eob = xd->eobs[ib];     /* one beyond last nonzero coeff */
   TOKENEXTRA *t = *tp;        /* store tokens starting here */
   int16_t *qcoeff_ptr = xd->qcoeff + 16 * ib;
-  int seg_eob;
+  int seg_eob, default_eob, pad;
   const int segment_id = mbmi->segment_id;
   const BLOCK_SIZE_TYPE sb_type = mbmi->sb_type;
-  const int *scan;
+  const int *scan, *nb;
   vp9_coeff_count *counts;
   vp9_coeff_probs *probs;
   const int ref = mbmi->ref_frame != INTRA_FRAME;
   ENTROPY_CONTEXT *a, *l, *a1, *l1, *a2, *l2, *a3, *l3, a_ec, l_ec;
+  uint8_t token_cache[1024];
 #if CONFIG_CODE_NONZEROCOUNT
   int zerosleft, nzc = 0;
   if (eob == 0)
@@ -220,6 +222,8 @@ static void tokenize_b(VP9_COMP *cpi,
   }
 
   VP9_COMBINEENTROPYCONTEXTS(pt, a_ec, l_ec);
+  nb = vp9_get_coef_neighbors_handle(scan, &pad);
+  default_eob = seg_eob;
 
   if (vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP))
     seg_eob = 0;
@@ -252,17 +256,20 @@ static void tokenize_b(VP9_COMP *cpi,
     // Skip zero node if there are no zeros left
     t->skip_eob_node = 1 + (zerosleft == 0);
 #else
-    t->skip_eob_node = (pt == 0) && (band > 0);
+    t->skip_eob_node = (c > 0) && (token_cache[c - 1] == 0);
 #endif
     assert(vp9_coef_encodings[t->Token].Len - t->skip_eob_node > 0);
     if (!dry_run) {
       ++counts[type][ref][band][pt][token];
+      if (!t->skip_eob_node)
+        ++cpi->common.fc.eob_branch_counts[tx_size][type][ref][band][pt];
     }
 #if CONFIG_CODE_NONZEROCOUNT
     nzc += (v != 0);
 #endif
+    token_cache[c] = token;
 
-    pt = vp9_get_coef_context(&recent_energy, token);
+    pt = vp9_get_coef_context(scan, nb, pad, token_cache, c, default_eob);
     ++t;
   } while (c < eob && ++c < seg_eob);
 #if CONFIG_CODE_NONZEROCOUNT
@@ -833,7 +840,7 @@ static void print_counter(FILE *f, vp9_coeff_accum *context_counters,
 
             assert(x == (int64_t) y);  /* no overflow handling yet */
             fprintf(f, "%s %d", Comma(t), y);
-          } while (++t < MAX_ENTROPY_TOKENS);
+          } while (++t < 1 + MAX_ENTROPY_TOKENS);
           fprintf(f, "}");
         } while (++pt < PREV_COEF_CONTEXTS);
         fprintf(f, "\n      }");
@@ -867,13 +874,17 @@ static void print_probs(FILE *f, vp9_coeff_accum *context_counters,
         pt = 0;
         do {
           unsigned int branch_ct[ENTROPY_NODES][2];
-          unsigned int coef_counts[MAX_ENTROPY_TOKENS];
+          unsigned int coef_counts[MAX_ENTROPY_TOKENS + 1];
           vp9_prob coef_probs[ENTROPY_NODES];
 
-          for (t = 0; t < MAX_ENTROPY_TOKENS; ++t)
+          if (pt >= 3 && band == 0)
+            break;
+          for (t = 0; t < MAX_ENTROPY_TOKENS + 1; ++t)
             coef_counts[t] = context_counters[type][ref][band][pt][t];
           vp9_tree_probs_from_distribution(vp9_coef_tree, coef_probs,
                                            branch_ct, coef_counts, 0);
+          branch_ct[0][1] = coef_counts[MAX_ENTROPY_TOKENS] - branch_ct[0][0];
+          coef_probs[0] = get_binary_prob(branch_ct[0][0], branch_ct[0][1]);
           fprintf(f, "%s\n      {", Comma(pt));
 
           t = 0;
@@ -1025,7 +1036,7 @@ static void stuff_b(VP9_COMP *cpi,
 
 #if CONFIG_CODE_NONZEROCOUNT == 0
   VP9_COMBINEENTROPYCONTEXTS(pt, a_ec, l_ec);
-  band = get_coef_band(tx_size, 0);
+  band = 0;
   t->Token = DCT_EOB_TOKEN;
   t->context_tree = probs[type][ref][band][pt];
   t->skip_eob_node = 0;
index 464d7ca..907f814 100644 (file)
@@ -29,7 +29,7 @@ typedef struct {
 } TOKENEXTRA;
 
 typedef int64_t vp9_coeff_accum[REF_TYPES][COEF_BANDS][PREV_COEF_CONTEXTS]
-                               [MAX_ENTROPY_TOKENS];
+                               [MAX_ENTROPY_TOKENS + 1];
 
 int vp9_mby_is_skippable_4x4(MACROBLOCKD *xd);
 int vp9_mbuv_is_skippable_4x4(MACROBLOCKD *xd);
index 951ffa7..52da3c6 100644 (file)
@@ -10,6 +10,7 @@
 
 
 #include "vp9/encoder/vp9_treewriter.h"
+#include "vp9/common/vp9_common.h"
 
 static void cost(
   int *const C,
@@ -35,6 +36,7 @@ void vp9_cost_tokens(int *c, const vp9_prob *p, vp9_tree t) {
 }
 
 void vp9_cost_tokens_skip(int *c, const vp9_prob *p, vp9_tree t) {
-  c[0] = 0;
+  assert(t[1] > 0 && t[0] <= 0);
+  c[-t[0]] = vp9_cost_bit(p[0], 0);
   cost(c, t, p, 2, 0);
 }