Updating the model coef experiment

Cleans up the experiment. Actually uses reduced counts for backward
updates, and reduced number of probabilities in the context.

No change in bitstream when the experiment is on.

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

Change-Id: I55285a049a0c22810bdb42914212ab5a4f8521b5
This commit is contained in:
Deb Mukherjee 2013-05-17 06:40:25 -07:00
parent da39272f5c
commit 39a90bc8e8
12 changed files with 1259 additions and 966 deletions

View File

@ -15,6 +15,692 @@
// 2 or 3 from each row is actually used depending on whether
// UNCONSTRAINDED_NODES is 2 or 3. If this experiment is merged
// the tables below should be shortened accordingly.
#if CONFIG_MODELCOEFPROB
static const vp9_coeff_probs_model default_coef_probs_4x4[BLOCK_TYPES] = {
{ /* block Type 0 */
{ /* Intra */
{ /* Coeff Band 0 */
{ 208, 32, 178,},
{ 102, 43, 132,},
{ 15, 36, 68,}
}, { /* Coeff Band 1 */
{ 71, 91, 178,},
{ 72, 88, 174,},
{ 40, 79, 154,},
{ 21, 68, 126,},
{ 7, 49, 84,},
{ 1, 20, 32,}
}, { /* Coeff Band 2 */
{ 108, 110, 206,},
{ 72, 98, 191,},
{ 26, 77, 152,},
{ 7, 57, 106,},
{ 1, 35, 60,},
{ 1, 14, 22,}
}, { /* Coeff Band 3 */
{ 105, 139, 222,},
{ 76, 118, 205,},
{ 21, 88, 164,},
{ 5, 63, 118,},
{ 1, 42, 74,},
{ 1, 18, 30,}
}, { /* Coeff Band 4 */
{ 143, 117, 233,},
{ 99, 104, 214,},
{ 26, 81, 170,},
{ 6, 60, 116,},
{ 1, 38, 65,},
{ 1, 15, 26,}
}, { /* Coeff Band 5 */
{ 155, 74, 238,},
{ 152, 64, 223,},
{ 67, 55, 182,},
{ 27, 44, 127,},
{ 9, 27, 69,},
{ 2, 11, 28,}
}
}, { /* Inter */
{ /* Coeff Band 0 */
{ 207, 112, 234,},
{ 145, 120, 212,},
{ 77, 114, 177,}
}, { /* Coeff Band 1 */
{ 93, 174, 243,},
{ 100, 144, 231,},
{ 28, 101, 186,},
{ 9, 73, 132,},
{ 2, 44, 76,},
{ 1, 19, 33,}
}, { /* Coeff Band 2 */
{ 116, 175, 246,},
{ 78, 142, 231,},
{ 14, 93, 177,},
{ 4, 65, 122,},
{ 1, 38, 69,},
{ 1, 18, 30,}
}, { /* Coeff Band 3 */
{ 138, 183, 249,},
{ 93, 147, 237,},
{ 21, 104, 187,},
{ 6, 73, 131,},
{ 1, 47, 83,},
{ 1, 26, 44,}
}, { /* Coeff Band 4 */
{ 188, 143, 252,},
{ 137, 124, 241,},
{ 32, 89, 188,},
{ 7, 61, 122,},
{ 1, 34, 66,},
{ 1, 18, 34,}
}, { /* Coeff Band 5 */
{ 198, 92, 253,},
{ 189, 79, 244,},
{ 78, 61, 200,},
{ 34, 50, 146,},
{ 11, 38, 93,},
{ 1, 31, 55,}
}
}
}, { /* block Type 1 */
{ /* Intra */
{ /* Coeff Band 0 */
{ 207, 35, 219,},
{ 126, 46, 182,},
{ 51, 47, 125,}
}, { /* Coeff Band 1 */
{ 114, 124, 220,},
{ 142, 116, 213,},
{ 81, 101, 190,},
{ 42, 83, 155,},
{ 16, 62, 104,},
{ 6, 40, 60,}
}, { /* Coeff Band 2 */
{ 139, 149, 228,},
{ 115, 127, 221,},
{ 43, 100, 189,},
{ 13, 77, 141,},
{ 3, 49, 88,},
{ 1, 23, 41,}
}, { /* Coeff Band 3 */
{ 119, 185, 236,},
{ 89, 140, 224,},
{ 34, 105, 189,},
{ 14, 78, 142,},
{ 5, 49, 90,},
{ 1, 22, 41,}
}, { /* Coeff Band 4 */
{ 162, 142, 244,},
{ 129, 120, 231,},
{ 44, 90, 189,},
{ 14, 65, 132,},
{ 3, 38, 72,},
{ 1, 17, 39,}
}, { /* Coeff Band 5 */
{ 167, 96, 247,},
{ 163, 84, 234,},
{ 70, 63, 185,},
{ 30, 44, 132,},
{ 13, 30, 80,},
{ 5, 13, 38,}
}
}, { /* Inter */
{ /* Coeff Band 0 */
{ 242, 90, 246,},
{ 186, 102, 228,},
{ 102, 108, 203,}
}, { /* Coeff Band 1 */
{ 152, 169, 250,},
{ 164, 149, 242,},
{ 63, 108, 204,},
{ 39, 83, 153,},
{ 31, 66, 108,},
{ 27, 65, 71,}
}, { /* Coeff Band 2 */
{ 161, 174, 250,},
{ 133, 150, 239,},
{ 32, 105, 197,},
{ 10, 78, 147,},
{ 2, 49, 99,},
{ 1, 26, 53,}
}, { /* Coeff Band 3 */
{ 160, 187, 251,},
{ 131, 155, 241,},
{ 42, 108, 198,},
{ 18, 81, 151,},
{ 9, 60, 112,},
{ 5, 35, 49,}
}, { /* Coeff Band 4 */
{ 195, 141, 253,},
{ 169, 128, 245,},
{ 62, 91, 204,},
{ 23, 70, 150,},
{ 2, 44, 78,},
{ 1, 1, 128,}
}, { /* Coeff Band 5 */
{ 195, 104, 253,},
{ 197, 92, 248,},
{ 88, 71, 214,},
{ 39, 56, 160,},
{ 18, 28, 90,},
{ 128, 128, 128,}
}
}
}
};
static const vp9_coeff_probs_model default_coef_probs_8x8[BLOCK_TYPES] = {
{ /* block Type 0 */
{ /* Intra */
{ /* Coeff Band 0 */
{ 196, 40, 199,},
{ 83, 38, 128,},
{ 10, 29, 55,}
}, { /* Coeff Band 1 */
{ 33, 114, 160,},
{ 69, 107, 155,},
{ 30, 91, 138,},
{ 12, 74, 115,},
{ 4, 52, 80,},
{ 1, 27, 40,}
}, { /* Coeff Band 2 */
{ 38, 159, 190,},
{ 34, 130, 182,},
{ 10, 97, 153,},
{ 3, 71, 115,},
{ 1, 41, 68,},
{ 1, 16, 27,}
}, { /* Coeff Band 3 */
{ 41, 184, 214,},
{ 24, 142, 199,},
{ 6, 97, 159,},
{ 1, 63, 110,},
{ 1, 32, 58,},
{ 1, 12, 21,}
}, { /* Coeff Band 4 */
{ 54, 207, 231,},
{ 32, 156, 213,},
{ 7, 98, 164,},
{ 2, 62, 108,},
{ 1, 32, 57,},
{ 1, 13, 22,}
}, { /* Coeff Band 5 */
{ 89, 208, 239,},
{ 53, 155, 223,},
{ 12, 102, 170,},
{ 3, 67, 111,},
{ 1, 38, 60,},
{ 1, 18, 26,}
}
}, { /* Inter */
{ /* Coeff Band 0 */
{ 205, 121, 244,},
{ 140, 120, 211,},
{ 51, 100, 152,}
}, { /* Coeff Band 1 */
{ 66, 196, 236,},
{ 99, 164, 223,},
{ 29, 122, 187,},
{ 14, 95, 145,},
{ 6, 68, 97,},
{ 3, 43, 50,}
}, { /* Coeff Band 2 */
{ 66, 202, 238,},
{ 45, 155, 218,},
{ 6, 96, 163,},
{ 2, 64, 110,},
{ 1, 34, 61,},
{ 1, 13, 24,}
}, { /* Coeff Band 3 */
{ 66, 204, 242,},
{ 38, 158, 222,},
{ 6, 95, 166,},
{ 2, 61, 111,},
{ 1, 31, 59,},
{ 1, 12, 22,}
}, { /* Coeff Band 4 */
{ 63, 214, 245,},
{ 38, 164, 228,},
{ 5, 101, 174,},
{ 1, 64, 116,},
{ 1, 34, 63,},
{ 1, 14, 26,}
}, { /* Coeff Band 5 */
{ 91, 214, 246,},
{ 55, 162, 233,},
{ 10, 104, 179,},
{ 2, 67, 119,},
{ 1, 37, 66,},
{ 1, 16, 30,}
}
}
}, { /* block Type 1 */
{ /* Intra */
{ /* Coeff Band 0 */
{ 211, 32, 212,},
{ 121, 47, 171,},
{ 40, 51, 118,}
}, { /* Coeff Band 1 */
{ 71, 129, 209,},
{ 118, 122, 206,},
{ 53, 104, 184,},
{ 20, 81, 148,},
{ 3, 47, 82,},
{ 1, 18, 28,}
}, { /* Coeff Band 2 */
{ 86, 162, 220,},
{ 84, 134, 216,},
{ 26, 102, 186,},
{ 7, 75, 135,},
{ 1, 46, 79,},
{ 1, 20, 35,}
}, { /* Coeff Band 3 */
{ 89, 191, 232,},
{ 67, 148, 223,},
{ 19, 105, 183,},
{ 5, 72, 127,},
{ 1, 44, 76,},
{ 1, 21, 36,}
}, { /* Coeff Band 4 */
{ 94, 210, 236,},
{ 68, 153, 224,},
{ 14, 103, 178,},
{ 2, 70, 122,},
{ 1, 42, 72,},
{ 1, 19, 34,}
}, { /* Coeff Band 5 */
{ 87, 200, 238,},
{ 55, 151, 225,},
{ 11, 106, 179,},
{ 2, 72, 124,},
{ 1, 42, 70,},
{ 1, 17, 28,}
}
}, { /* Inter */
{ /* Coeff Band 0 */
{ 238, 66, 250,},
{ 178, 84, 226,},
{ 76, 83, 168,}
}, { /* Coeff Band 1 */
{ 137, 176, 246,},
{ 176, 160, 237,},
{ 68, 128, 205,},
{ 40, 105, 167,},
{ 22, 84, 131,},
{ 11, 60, 91,}
}, { /* Coeff Band 2 */
{ 124, 192, 247,},
{ 103, 161, 234,},
{ 19, 108, 190,},
{ 6, 74, 131,},
{ 1, 41, 72,},
{ 1, 14, 24,}
}, { /* Coeff Band 3 */
{ 118, 200, 248,},
{ 91, 166, 235,},
{ 16, 110, 186,},
{ 3, 72, 124,},
{ 1, 39, 66,},
{ 1, 14, 19,}
}, { /* Coeff Band 4 */
{ 112, 213, 248,},
{ 80, 172, 234,},
{ 11, 112, 182,},
{ 2, 73, 126,},
{ 1, 40, 69,},
{ 1, 16, 24,}
}, { /* Coeff Band 5 */
{ 100, 209, 245,},
{ 65, 164, 232,},
{ 11, 117, 186,},
{ 2, 83, 136,},
{ 1, 55, 88,},
{ 1, 10, 38,}
}
}
}
};
static const vp9_coeff_probs_model default_coef_probs_16x16[BLOCK_TYPES] = {
{ /* block Type 0 */
{ /* Intra */
{ /* Coeff Band 0 */
{ 8, 26, 101,},
{ 2, 25, 67,},
{ 1, 15, 28,}
}, { /* Coeff Band 1 */
{ 22, 73, 118,},
{ 43, 73, 116,},
{ 24, 66, 105,},
{ 9, 54, 85,},
{ 2, 34, 54,},
{ 1, 14, 22,}
}, { /* Coeff Band 2 */
{ 34, 123, 149,},
{ 34, 106, 147,},
{ 10, 81, 123,},
{ 2, 56, 87,},
{ 1, 35, 56,},
{ 1, 17, 27,}
}, { /* Coeff Band 3 */
{ 27, 159, 171,},
{ 17, 119, 162,},
{ 3, 81, 128,},
{ 1, 53, 87,},
{ 1, 31, 52,},
{ 1, 14, 24,}
}, { /* Coeff Band 4 */
{ 24, 189, 200,},
{ 14, 136, 184,},
{ 2, 87, 140,},
{ 1, 54, 90,},
{ 1, 28, 49,},
{ 1, 12, 21,}
}, { /* Coeff Band 5 */
{ 32, 220, 227,},
{ 12, 155, 200,},
{ 1, 90, 144,},
{ 1, 53, 90,},
{ 1, 28, 50,},
{ 1, 13, 22,}
}
}, { /* Inter */
{ /* Coeff Band 0 */
{ 5, 61, 234,},
{ 3, 65, 184,},
{ 1, 56, 104,}
}, { /* Coeff Band 1 */
{ 46, 183, 210,},
{ 122, 166, 202,},
{ 49, 125, 177,},
{ 22, 99, 142,},
{ 8, 69, 95,},
{ 2, 38, 51,}
}, { /* Coeff Band 2 */
{ 56, 196, 218,},
{ 38, 141, 195,},
{ 7, 93, 147,},
{ 2, 63, 101,},
{ 1, 39, 61,},
{ 1, 20, 33,}
}, { /* Coeff Band 3 */
{ 44, 206, 223,},
{ 27, 147, 200,},
{ 4, 93, 147,},
{ 1, 58, 95,},
{ 1, 32, 52,},
{ 1, 14, 23,}
}, { /* Coeff Band 4 */
{ 39, 216, 227,},
{ 22, 152, 204,},
{ 2, 92, 148,},
{ 1, 55, 91,},
{ 1, 28, 47,},
{ 1, 13, 21,}
}, { /* Coeff Band 5 */
{ 34, 228, 234,},
{ 13, 161, 208,},
{ 1, 95, 148,},
{ 1, 55, 90,},
{ 1, 30, 51,},
{ 1, 16, 25,}
}
}
}, { /* block Type 1 */
{ /* Intra */
{ /* Coeff Band 0 */
{ 204, 33, 217,},
{ 93, 48, 151,},
{ 18, 43, 86,}
}, { /* Coeff Band 1 */
{ 43, 121, 184,},
{ 93, 117, 177,},
{ 33, 101, 158,},
{ 11, 81, 129,},
{ 2, 51, 82,},
{ 1, 18, 29,}
}, { /* Coeff Band 2 */
{ 63, 154, 199,},
{ 53, 128, 191,},
{ 14, 99, 160,},
{ 4, 75, 122,},
{ 1, 47, 77,},
{ 1, 18, 30,}
}, { /* Coeff Band 3 */
{ 48, 193, 210,},
{ 26, 145, 201,},
{ 6, 104, 165,},
{ 1, 73, 120,},
{ 1, 42, 69,},
{ 1, 16, 27,}
}, { /* Coeff Band 4 */
{ 47, 213, 225,},
{ 32, 153, 212,},
{ 6, 102, 168,},
{ 1, 66, 111,},
{ 1, 36, 60,},
{ 1, 16, 27,}
}, { /* Coeff Band 5 */
{ 46, 225, 232,},
{ 24, 162, 214,},
{ 3, 106, 165,},
{ 1, 66, 108,},
{ 1, 35, 59,},
{ 1, 16, 27,}
}
}, { /* Inter */
{ /* Coeff Band 0 */
{ 229, 28, 245,},
{ 151, 44, 210,},
{ 55, 48, 131,}
}, { /* Coeff Band 1 */
{ 126, 165, 239,},
{ 199, 158, 231,},
{ 102, 136, 209,},
{ 64, 116, 181,},
{ 44, 98, 151,},
{ 44, 81, 119,}
}, { /* Coeff Band 2 */
{ 108, 185, 239,},
{ 91, 155, 224,},
{ 20, 116, 185,},
{ 8, 86, 141,},
{ 3, 50, 92,},
{ 1, 21, 40,}
}, { /* Coeff Band 3 */
{ 94, 198, 243,},
{ 67, 164, 228,},
{ 14, 120, 185,},
{ 4, 83, 134,},
{ 1, 48, 82,},
{ 1, 26, 38,}
}, { /* Coeff Band 4 */
{ 82, 210, 245,},
{ 55, 170, 231,},
{ 8, 118, 184,},
{ 2, 78, 126,},
{ 1, 43, 68,},
{ 1, 34, 40,}
}, { /* Coeff Band 5 */
{ 65, 228, 241,},
{ 33, 173, 226,},
{ 5, 120, 180,},
{ 1, 81, 130,},
{ 1, 51, 78,},
{ 1, 18, 49,}
}
}
}
};
static const vp9_coeff_probs_model default_coef_probs_32x32[BLOCK_TYPES] = {
{ /* block Type 0 */
{ /* Intra */
{ /* Coeff Band 0 */
{ 37, 34, 137,},
{ 3, 26, 60,},
{ 1, 13, 23,}
}, { /* Coeff Band 1 */
{ 26, 77, 122,},
{ 43, 76, 123,},
{ 25, 67, 112,},
{ 9, 54, 90,},
{ 2, 32, 52,},
{ 1, 10, 15,}
}, { /* Coeff Band 2 */
{ 32, 122, 143,},
{ 46, 105, 143,},
{ 17, 79, 116,},
{ 4, 53, 78,},
{ 1, 29, 44,},
{ 1, 12, 18,}
}, { /* Coeff Band 3 */
{ 33, 157, 160,},
{ 20, 116, 152,},
{ 4, 74, 114,},
{ 1, 44, 69,},
{ 1, 25, 40,},
{ 1, 12, 18,}
}, { /* Coeff Band 4 */
{ 25, 183, 174,},
{ 13, 124, 159,},
{ 2, 75, 117,},
{ 1, 45, 73,},
{ 1, 26, 43,},
{ 1, 12, 19,}
}, { /* Coeff Band 5 */
{ 13, 232, 223,},
{ 4, 155, 187,},
{ 1, 86, 131,},
{ 1, 49, 79,},
{ 1, 26, 43,},
{ 1, 12, 20,}
}
}, { /* Inter */
{ /* Coeff Band 0 */
{ 51, 37, 227,},
{ 9, 36, 172,},
{ 21, 26, 112,}
}, { /* Coeff Band 1 */
{ 79, 169, 219,},
{ 177, 166, 216,},
{ 119, 141, 196,},
{ 63, 117, 165,},
{ 30, 87, 117,},
{ 14, 56, 60,}
}, { /* Coeff Band 2 */
{ 88, 195, 225,},
{ 66, 145, 202,},
{ 12, 97, 152,},
{ 3, 66, 103,},
{ 1, 38, 61,},
{ 1, 19, 30,}
}, { /* Coeff Band 3 */
{ 79, 211, 228,},
{ 50, 151, 205,},
{ 7, 95, 149,},
{ 1, 62, 98,},
{ 1, 35, 57,},
{ 1, 17, 26,}
}, { /* Coeff Band 4 */
{ 68, 225, 230,},
{ 39, 156, 206,},
{ 4, 94, 147,},
{ 1, 58, 94,},
{ 1, 32, 52,},
{ 1, 15, 24,}
}, { /* Coeff Band 5 */
{ 45, 248, 234,},
{ 19, 169, 204,},
{ 2, 98, 145,},
{ 1, 59, 92,},
{ 1, 33, 52,},
{ 1, 15, 24,}
}
}
}, { /* block Type 1 */
{ /* Intra */
{ /* Coeff Band 0 */
{ 179, 23, 200,},
{ 60, 33, 113,},
{ 8, 31, 59,}
}, { /* Coeff Band 1 */
{ 27, 103, 158,},
{ 90, 101, 159,},
{ 39, 91, 146,},
{ 16, 75, 120,},
{ 3, 48, 76,},
{ 1, 18, 26,}
}, { /* Coeff Band 2 */
{ 45, 137, 177,},
{ 47, 117, 167,},
{ 16, 90, 136,},
{ 6, 65, 100,},
{ 1, 37, 58,},
{ 1, 13, 19,}
}, { /* Coeff Band 3 */
{ 36, 171, 194,},
{ 19, 129, 178,},
{ 5, 90, 139,},
{ 1, 59, 93,},
{ 1, 31, 49,},
{ 1, 10, 18,}
}, { /* Coeff Band 4 */
{ 37, 197, 210,},
{ 20, 142, 191,},
{ 3, 93, 144,},
{ 1, 56, 88,},
{ 1, 29, 47,},
{ 1, 14, 22,}
}, { /* Coeff Band 5 */
{ 19, 227, 223,},
{ 6, 152, 192,},
{ 1, 89, 138,},
{ 1, 52, 84,},
{ 1, 29, 47,},
{ 1, 14, 23,}
}
}, { /* Inter */
{ /* Coeff Band 0 */
{ 205, 14, 245,},
{ 97, 19, 213,},
{ 31, 20, 144,}
}, { /* Coeff Band 1 */
{ 137, 182, 245,},
{ 231, 185, 242,},
{ 170, 175, 229,},
{ 107, 157, 213,},
{ 77, 126, 183,},
{ 69, 96, 149,}
}, { /* Coeff Band 2 */
{ 107, 196, 241,},
{ 92, 162, 221,},
{ 20, 108, 181,},
{ 7, 80, 132,},
{ 2, 43, 75,},
{ 1, 15, 48,}
}, { /* Coeff Band 3 */
{ 107, 202, 244,},
{ 77, 167, 224,},
{ 14, 117, 179,},
{ 3, 84, 134,},
{ 1, 57, 84,},
{ 1, 1, 1,}
}, { /* Coeff Band 4 */
{ 88, 219, 248,},
{ 61, 178, 234,},
{ 6, 127, 188,},
{ 1, 83, 130,},
{ 1, 61, 66,},
{ 128, 128, 128,}
}, { /* Coeff Band 5 */
{ 73, 243, 250,},
{ 42, 197, 242,},
{ 10, 137, 197,},
{ 2, 85, 134,},
{ 1, 70, 69,},
{ 1, 1, 1,}
}
}
}
};
#else
static const vp9_coeff_probs default_coef_probs_4x4[BLOCK_TYPES] = {
{ /* block Type 0 */
{ /* Intra */
@ -699,3 +1385,4 @@ static const vp9_coeff_probs default_coef_probs_32x32[BLOCK_TYPES] = {
}
}
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -38,6 +38,11 @@
extern const vp9_tree_index vp9_coef_tree[];
#if CONFIG_MODELCOEFPROB
#define DCT_EOB_MODEL_TOKEN 3 /* EOB Extra Bits 0+0 */
extern const vp9_tree_index vp9_coefmodel_tree[];
#endif
extern struct vp9_token vp9_coef_encodings[MAX_ENTROPY_TOKENS];
typedef struct {
@ -152,23 +157,32 @@ extern int vp9_get_coef_context(const int *scan, const int *neighbors,
const int *vp9_get_coef_neighbors_handle(const int *scan, int *pad);
#if CONFIG_MODELCOEFPROB
#define COEFPROB_BITS 8
#define COEFPROB_MODELS (1 << COEFPROB_BITS)
#define COEFPROB_MODELS 128 // 128 lists stored for probs 1, 3, ..., 255
// 2 => EOB and Zero nodes are unconstrained, rest are modeled
// 3 => EOB, Zero and One nodes are unconstrained, rest are modeled
#define UNCONSTRAINED_NODES 3 // Choose one of 2 or 3
// whether forward updates are model-based
#define MODEL_BASED_UPDATE 1
// if model-based how many nodes are unconstrained
#define UNCONSTRAINED_UPDATE_NODES 3
// whether backward updates are model-based
#define MODEL_BASED_ADAPT 1
#define UNCONSTRAINED_ADAPT_NODES 3
#define UNCONSTRAINED_NODES 3
#define MODEL_NODES (ENTROPY_NODES - UNCONSTRAINED_NODES)
#define PIVOT_NODE 2 // which node is pivot
typedef vp9_prob vp9_coeff_probs_model[REF_TYPES][COEF_BANDS]
[PREV_COEF_CONTEXTS][2];
[PREV_COEF_CONTEXTS]
[UNCONSTRAINED_NODES];
typedef unsigned int vp9_coeff_count_model[REF_TYPES][COEF_BANDS]
[PREV_COEF_CONTEXTS]
[UNCONSTRAINED_NODES + 1];
typedef unsigned int vp9_coeff_stats_model[REF_TYPES][COEF_BANDS]
[PREV_COEF_CONTEXTS]
[UNCONSTRAINED_NODES][2];
extern void vp9_full_to_model_counts(
vp9_coeff_count_model *model_count, vp9_coeff_count *full_count);
void vp9_model_to_full_probs(const vp9_prob *model, int b, int r, vp9_prob *full);
void vp9_model_to_full_probs_sb(
vp9_prob model[COEF_BANDS][PREV_COEF_CONTEXTS][UNCONSTRAINED_NODES],
int b, int r,
vp9_prob full[COEF_BANDS][PREV_COEF_CONTEXTS][ENTROPY_NODES]);
extern const vp9_prob vp9_modelcoefprobs[COEFPROB_MODELS][ENTROPY_NODES - 1];
void vp9_get_model_distribution(vp9_prob model, vp9_prob *tree_probs,
int b, int r);

View File

@ -58,11 +58,6 @@ typedef struct frame_contexts {
vp9_prob sub_mv_ref_prob[SUBMVREF_COUNT][VP9_SUBMVREFS - 1];
vp9_prob partition_prob[NUM_PARTITION_CONTEXTS][PARTITION_TYPES - 1];
vp9_coeff_probs coef_probs_4x4[BLOCK_TYPES];
vp9_coeff_probs coef_probs_8x8[BLOCK_TYPES];
vp9_coeff_probs coef_probs_16x16[BLOCK_TYPES];
vp9_coeff_probs coef_probs_32x32[BLOCK_TYPES];
nmv_context nmvc;
nmv_context pre_nmvc;
vp9_prob pre_bmode_prob[VP9_NKF_BINTRAMODES - 1];
@ -78,15 +73,33 @@ typedef struct frame_contexts {
unsigned int sub_mv_ref_counts[SUBMVREF_COUNT][VP9_SUBMVREFS];
unsigned int partition_counts[NUM_PARTITION_CONTEXTS][PARTITION_TYPES];
#if CONFIG_MODELCOEFPROB
vp9_coeff_probs_model coef_probs_4x4[BLOCK_TYPES];
vp9_coeff_probs_model coef_probs_8x8[BLOCK_TYPES];
vp9_coeff_probs_model coef_probs_16x16[BLOCK_TYPES];
vp9_coeff_probs_model coef_probs_32x32[BLOCK_TYPES];
vp9_coeff_probs_model pre_coef_probs_4x4[BLOCK_TYPES];
vp9_coeff_probs_model pre_coef_probs_8x8[BLOCK_TYPES];
vp9_coeff_probs_model pre_coef_probs_16x16[BLOCK_TYPES];
vp9_coeff_probs_model pre_coef_probs_32x32[BLOCK_TYPES];
vp9_coeff_count_model coef_counts_4x4[BLOCK_TYPES];
vp9_coeff_count_model coef_counts_8x8[BLOCK_TYPES];
vp9_coeff_count_model coef_counts_16x16[BLOCK_TYPES];
vp9_coeff_count_model coef_counts_32x32[BLOCK_TYPES];
#else
vp9_coeff_probs coef_probs_4x4[BLOCK_TYPES];
vp9_coeff_probs coef_probs_8x8[BLOCK_TYPES];
vp9_coeff_probs coef_probs_16x16[BLOCK_TYPES];
vp9_coeff_probs coef_probs_32x32[BLOCK_TYPES];
vp9_coeff_probs pre_coef_probs_4x4[BLOCK_TYPES];
vp9_coeff_probs pre_coef_probs_8x8[BLOCK_TYPES];
vp9_coeff_probs pre_coef_probs_16x16[BLOCK_TYPES];
vp9_coeff_probs pre_coef_probs_32x32[BLOCK_TYPES];
vp9_coeff_count coef_counts_4x4[BLOCK_TYPES];
vp9_coeff_count coef_counts_8x8[BLOCK_TYPES];
vp9_coeff_count coef_counts_16x16[BLOCK_TYPES];
vp9_coeff_count coef_counts_32x32[BLOCK_TYPES];
#endif
unsigned int eob_branch_counts[TX_SIZE_MAX_SB][BLOCK_TYPES][REF_TYPES]
[COEF_BANDS][PREV_COEF_CONTEXTS];

View File

@ -550,11 +550,16 @@ static void init_frame(VP9D_COMP *pbi) {
xd->mode_info_stride = pc->mode_info_stride;
}
static void read_coef_probs_common(vp9_coeff_probs *coef_probs,
TX_SIZE tx_size,
vp9_reader *r) {
#if CONFIG_MODELCOEFPROB && MODEL_BASED_UPDATE
const int entropy_nodes_update = UNCONSTRAINED_UPDATE_NODES;
static void read_coef_probs_common(
#if CONFIG_MODELCOEFPROB
vp9_coeff_probs_model *coef_probs,
#else
vp9_coeff_probs *coef_probs,
#endif
TX_SIZE tx_size,
vp9_reader *r) {
#if CONFIG_MODELCOEFPROB
const int entropy_nodes_update = UNCONSTRAINED_NODES;
#else
const int entropy_nodes_update = ENTROPY_NODES;
#endif
@ -575,10 +580,6 @@ static void read_coef_probs_common(vp9_coeff_probs *coef_probs,
if (vp9_read(r, vp9_coef_update_prob[m])) {
*p = read_prob_diff_update(r, *p);
#if CONFIG_MODELCOEFPROB && MODEL_BASED_UPDATE
if (m == UNCONSTRAINED_NODES - 1)
vp9_get_model_distribution(*p, coef_probs[i][j][k][l], i, j);
#endif
}
}
}

View File

@ -60,12 +60,23 @@ static const vp9_prob cat6_prob[15] = {
DECLARE_ALIGNED(16, extern const uint8_t, vp9_norm[256]);
#if CONFIG_MODELCOEFPROB
#define INCREMENT_COUNT(token) \
do { \
coef_counts[type][ref][band][pt] \
[token >= TWO_TOKEN ? \
(token == DCT_EOB_TOKEN ? DCT_EOB_MODEL_TOKEN : TWO_TOKEN) : \
token]++; \
token_cache[scan[c]] = token; \
} while (0)
#else
#define INCREMENT_COUNT(token) \
do { \
coef_counts[type][ref][band] \
[pt][token]++; \
token_cache[scan[c]] = token; \
} while (0)
#endif
#define WRITE_COEF_CONTINUE(val, token) \
{ \
@ -91,9 +102,27 @@ static int decode_coefs(VP9D_COMP *dx, const MACROBLOCKD *xd,
FRAME_CONTEXT *const fc = &dx->common.fc;
int pt, c = 0, pad, default_eob;
int band;
vp9_coeff_probs *coef_probs;
#if CONFIG_MODELCOEFPROB
vp9_prob (*coef_probs)[PREV_COEF_CONTEXTS][UNCONSTRAINED_NODES];
vp9_prob coef_probs_full[COEF_BANDS][PREV_COEF_CONTEXTS][ENTROPY_NODES];
uint8_t load_map[COEF_BANDS][PREV_COEF_CONTEXTS] = {
{0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0},
};
#else
vp9_prob (*coef_probs)[PREV_COEF_CONTEXTS][ENTROPY_NODES];
#endif
vp9_prob *prob;
#if CONFIG_MODELCOEFPROB
vp9_coeff_count_model *coef_counts;
#else
vp9_coeff_count *coef_counts;
#endif
const int ref = xd->mode_info_context->mbmi.ref_frame != INTRA_FRAME;
TX_TYPE tx_type = DCT_DCT;
const int *scan, *nb;
@ -108,7 +137,7 @@ static int decode_coefs(VP9D_COMP *dx, const MACROBLOCKD *xd,
scan = get_scan_4x4(tx_type);
above_ec = A[0] != 0;
left_ec = L[0] != 0;
coef_probs = fc->coef_probs_4x4;
coef_probs = fc->coef_probs_4x4[type][ref];
coef_counts = fc->coef_counts_4x4;
default_eob = 16;
band_translate = vp9_coefband_trans_4x4;
@ -122,7 +151,7 @@ static int decode_coefs(VP9D_COMP *dx, const MACROBLOCKD *xd,
tx_type = (type == PLANE_TYPE_Y_WITH_DC) ?
get_tx_type_8x8(xd, y + (x >> 1)) : DCT_DCT;
scan = get_scan_8x8(tx_type);
coef_probs = fc->coef_probs_8x8;
coef_probs = fc->coef_probs_8x8[type][ref];
coef_counts = fc->coef_counts_8x8;
above_ec = (A[0] + A[1]) != 0;
left_ec = (L[0] + L[1]) != 0;
@ -138,7 +167,7 @@ static int decode_coefs(VP9D_COMP *dx, const MACROBLOCKD *xd,
tx_type = (type == PLANE_TYPE_Y_WITH_DC) ?
get_tx_type_16x16(xd, y + (x >> 2)) : DCT_DCT;
scan = get_scan_16x16(tx_type);
coef_probs = fc->coef_probs_16x16;
coef_probs = fc->coef_probs_16x16[type][ref];
coef_counts = fc->coef_counts_16x16;
above_ec = (A[0] + A[1] + A[2] + A[3]) != 0;
left_ec = (L[0] + L[1] + L[2] + L[3]) != 0;
@ -148,7 +177,7 @@ static int decode_coefs(VP9D_COMP *dx, const MACROBLOCKD *xd,
}
case TX_32X32:
scan = vp9_default_zig_zag1d_32x32;
coef_probs = fc->coef_probs_32x32;
coef_probs = fc->coef_probs_32x32[type][ref];
coef_counts = fc->coef_counts_32x32;
above_ec = (A[0] + A[1] + A[2] + A[3] + A[4] + A[5] + A[6] + A[7]) != 0;
left_ec = (L[0] + L[1] + L[2] + L[3] + L[4] + L[5] + L[6] + L[7]) != 0;
@ -169,7 +198,7 @@ static int decode_coefs(VP9D_COMP *dx, const MACROBLOCKD *xd,
pt = vp9_get_coef_context(scan, nb, pad, token_cache,
c, default_eob);
band = get_coef_band(band_translate, c);
prob = coef_probs[type][ref][band][pt];
prob = coef_probs[band][pt];
fc->eob_branch_counts[txfm_size][type][ref][band][pt]++;
if (!vp9_read(r, prob[EOB_CONTEXT_NODE]))
break;
@ -181,7 +210,7 @@ SKIP_START:
pt = vp9_get_coef_context(scan, nb, pad, token_cache,
c, default_eob);
band = get_coef_band(band_translate, c);
prob = coef_probs[type][ref][band][pt];
prob = coef_probs[band][pt];
if (!vp9_read(r, prob[ZERO_CONTEXT_NODE])) {
INCREMENT_COUNT(ZERO_TOKEN);
@ -192,6 +221,15 @@ SKIP_START:
if (!vp9_read(r, prob[ONE_CONTEXT_NODE])) {
WRITE_COEF_CONTINUE(1, ONE_TOKEN);
}
#if CONFIG_MODELCOEFPROB
// Load full probabilities if not already loaded
if (!load_map[band][pt]) {
vp9_model_to_full_probs(coef_probs[band][pt], type, ref,
coef_probs_full[band][pt]);
load_map[band][pt] = 1;
}
prob = coef_probs_full[band][pt];
#endif
// LOW_VAL_CONTEXT_NODE_0_
if (!vp9_read(r, prob[LOW_VAL_CONTEXT_NODE])) {
if (!vp9_read(r, prob[TWO_CONTEXT_NODE])) {
@ -249,7 +287,11 @@ SKIP_START:
}
if (c < seg_eob)
#if CONFIG_MODELCOEFPROB
coef_counts[type][ref][band][pt][DCT_EOB_MODEL_TOKEN]++;
#else
coef_counts[type][ref][band][pt][DCT_EOB_TOKEN]++;
#endif
for (pt = 0; pt < (1 << txfm_size); pt++) {
A[pt] = L[pt] = c > 0;

View File

@ -53,7 +53,6 @@ extern unsigned int active_section;
#define vp9_cost_upd ((int)(vp9_cost_one(upd) - vp9_cost_zero(upd)) >> 8)
#define vp9_cost_upd256 ((int)(vp9_cost_one(upd) - vp9_cost_zero(upd)))
#define SEARCH_NEWP
static int update_bits[255];
static INLINE void write_le16(uint8_t *p, int value) {
@ -311,31 +310,33 @@ static int prob_diff_update_savings_search(const unsigned int *ct,
return bestsavings;
}
#if CONFIG_MODELCOEFPROB && MODEL_BASED_UPDATE
#if CONFIG_MODELCOEFPROB
static int prob_diff_update_savings_search_model(const unsigned int *ct,
const vp9_prob *oldp,
vp9_prob *bestp,
const vp9_prob upd,
int b, int r, int q) {
int b, int r) {
int i, old_b, new_b, update_b, savings, bestsavings, step;
int newp;
vp9_prob bestnewp, newplist[ENTROPY_NODES];
for (i = UNCONSTRAINED_NODES - 1, old_b = 0; i < ENTROPY_NODES; ++i)
old_b += cost_branch256(ct + 2 * i, oldp[i]);
vp9_prob bestnewp, newplist[ENTROPY_NODES], oldplist[ENTROPY_NODES];
vp9_model_to_full_probs(oldp, b, r, oldplist);
for (i = UNCONSTRAINED_NODES, old_b = 0; i < ENTROPY_NODES; ++i)
old_b += cost_branch256(ct + 2 * i, oldplist[i]);
old_b += cost_branch256(ct + 2 * PIVOT_NODE, oldplist[PIVOT_NODE]);
bestsavings = 0;
bestnewp = oldp[UNCONSTRAINED_NODES - 1];
bestnewp = oldp[PIVOT_NODE];
step = (*bestp > oldp[UNCONSTRAINED_NODES - 1] ? -1 : 1);
step = (*bestp > oldp[PIVOT_NODE] ? -1 : 1);
newp = *bestp;
// newp = *bestp - step * (abs(*bestp - oldp[UNCONSTRAINED_NODES - 1]) >> 1);
for (; newp != oldp[UNCONSTRAINED_NODES - 1]; newp += step) {
for (; newp != oldp[PIVOT_NODE]; newp += step) {
if (newp < 1 || newp > 255) continue;
newplist[UNCONSTRAINED_NODES - 1] = newp;
newplist[PIVOT_NODE] = newp;
vp9_get_model_distribution(newp, newplist, b, r);
for (i = UNCONSTRAINED_NODES - 1, new_b = 0; i < ENTROPY_NODES; ++i)
for (i = UNCONSTRAINED_NODES, new_b = 0; i < ENTROPY_NODES; ++i)
new_b += cost_branch256(ct + 2 * i, newplist[i]);
update_b = prob_diff_update_cost(newp, oldp[UNCONSTRAINED_NODES - 1]) +
new_b += cost_branch256(ct + 2 * PIVOT_NODE, newplist[PIVOT_NODE]);
update_b = prob_diff_update_cost(newp, oldp[PIVOT_NODE]) +
vp9_cost_upd256;
savings = old_b - new_b - update_b;
if (savings > bestsavings) {
@ -373,16 +374,29 @@ static void pack_mb_tokens(vp9_writer* const bc,
const struct vp9_token *const a = vp9_coef_encodings + t;
const vp9_extra_bit *const b = vp9_extra_bits + t;
int i = 0;
const unsigned char *pp = p->context_tree;
const vp9_prob *pp;
int v = a->value;
int n = a->len;
int ncount = n;
#if CONFIG_MODELCOEFPROB
vp9_prob probs[ENTROPY_NODES];
#endif
if (t == EOSB_TOKEN)
{
if (t == EOSB_TOKEN) {
++p;
break;
}
#if CONFIG_MODELCOEFPROB
if (t >= TWO_TOKEN) {
vp9_model_to_full_probs(p->context_tree,
p->block_type, p->ref_type, probs);
pp = probs;
} else {
pp = p->context_tree;
}
#else
pp = p->context_tree;
#endif
assert(pp != 0);
/* skip one or two nodes */
@ -399,19 +413,18 @@ static void pack_mb_tokens(vp9_writer* const bc,
ncount--;
} while (n && ncount);
if (b->base_val) {
const int e = p->extra, l = b->len;
if (l) {
const unsigned char *pp = b->prob;
const unsigned char *pb = b->prob;
int v = e >> 1;
int n = l; /* number of bits in v, assumed nonzero */
int i = 0;
do {
const int bb = (v >> --n) & 1;
vp9_write(bc, bb, pp[i >> 1]);
vp9_write(bc, bb, pb[i >> 1]);
i = b->tree[i + bb];
} while (n);
}
@ -1098,20 +1111,26 @@ static void build_coeff_contexts(VP9_COMP *cpi) {
cpi->frame_branch_ct_32x32, BLOCK_TYPES);
}
static void update_coef_probs_common(vp9_writer* const bc,
VP9_COMP *cpi,
static void update_coef_probs_common(
vp9_writer* const bc,
VP9_COMP *cpi,
#ifdef ENTROPY_STATS
vp9_coeff_stats *tree_update_hist,
vp9_coeff_stats *tree_update_hist,
#endif
vp9_coeff_probs *new_frame_coef_probs,
vp9_coeff_probs *old_frame_coef_probs,
vp9_coeff_stats *frame_branch_ct,
TX_SIZE tx_size) {
vp9_coeff_probs *new_frame_coef_probs,
#if CONFIG_MODELCOEFPROB
vp9_coeff_probs_model *old_frame_coef_probs,
#else
vp9_coeff_probs *old_frame_coef_probs,
#endif
vp9_coeff_stats *frame_branch_ct,
TX_SIZE tx_size) {
int i, j, k, l, t;
int update[2] = {0, 0};
int savings;
#if CONFIG_MODELCOEFPROB && MODEL_BASED_UPDATE
const int entropy_nodes_update = UNCONSTRAINED_UPDATE_NODES;
#if CONFIG_MODELCOEFPROB
const int entropy_nodes_update = UNCONSTRAINED_NODES;
#else
const int entropy_nodes_update = ENTROPY_NODES;
#endif
@ -1134,13 +1153,11 @@ static void update_coef_probs_common(vp9_writer* const bc,
if (l >= 3 && k == 0)
continue;
#if defined(SEARCH_NEWP)
#if CONFIG_MODELCOEFPROB && MODEL_BASED_UPDATE
if (t == UNCONSTRAINED_NODES - 1)
#if CONFIG_MODELCOEFPROB
if (t == PIVOT_NODE)
s = prob_diff_update_savings_search_model(
frame_branch_ct[i][j][k][l][0],
old_frame_coef_probs[i][j][k][l], &newp, upd, i, j,
cpi->common.base_qindex);
old_frame_coef_probs[i][j][k][l], &newp, upd, i, j);
else
#endif
s = prob_diff_update_savings_search(
@ -1151,15 +1168,6 @@ static void update_coef_probs_common(vp9_writer* const bc,
savings += s - (int)(vp9_cost_zero(upd));
else
savings -= (int)(vp9_cost_zero(upd));
#else
s = prob_update_savings(frame_branch_ct[i][j][k][l][t],
oldp, newp, upd);
if (s > 0)
u = 1;
if (u)
savings += s;
#endif
update[u]++;
}
}
@ -1189,13 +1197,11 @@ static void update_coef_probs_common(vp9_writer* const bc,
if (l >= 3 && k == 0)
continue;
#if defined(SEARCH_NEWP)
#if CONFIG_MODELCOEFPROB && MODEL_BASED_UPDATE
if (t == UNCONSTRAINED_NODES - 1)
#if CONFIG_MODELCOEFPROB
if (t == PIVOT_NODE)
s = prob_diff_update_savings_search_model(
frame_branch_ct[i][j][k][l][0],
old_frame_coef_probs[i][j][k][l], &newp, upd, i, j,
cpi->common.base_qindex);
old_frame_coef_probs[i][j][k][l], &newp, upd, i, j);
else
#endif
s = prob_diff_update_savings_search(
@ -1203,12 +1209,6 @@ static void update_coef_probs_common(vp9_writer* const bc,
*oldp, &newp, upd);
if (s > 0 && newp != *oldp)
u = 1;
#else
s = prob_update_savings(frame_branch_ct[i][j][k][l][t],
*oldp, newp, upd);
if (s > 0)
u = 1;
#endif
vp9_write(bc, u, upd);
#ifdef ENTROPY_STATS
if (!cpi->dummy_packing)
@ -1218,11 +1218,6 @@ static void update_coef_probs_common(vp9_writer* const bc,
/* send/use new probability */
write_prob_diff_update(bc, newp, *oldp);
*oldp = newp;
#if CONFIG_MODELCOEFPROB && MODEL_BASED_UPDATE
if (t == UNCONSTRAINED_NODES - 1)
vp9_get_model_distribution(
newp, old_frame_coef_probs[i][j][k][l], i, j);
#endif
}
}
}

View File

@ -3174,10 +3174,22 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi,
release_scaled_references(cpi);
update_reference_frames(cpi);
#if CONFIG_MODELCOEFPROB
vp9_full_to_model_counts(cpi->common.fc.coef_counts_4x4,
cpi->coef_counts_4x4);
vp9_full_to_model_counts(cpi->common.fc.coef_counts_8x8,
cpi->coef_counts_8x8);
vp9_full_to_model_counts(cpi->common.fc.coef_counts_16x16,
cpi->coef_counts_16x16);
vp9_full_to_model_counts(cpi->common.fc.coef_counts_32x32,
cpi->coef_counts_32x32);
#else
vp9_copy(cpi->common.fc.coef_counts_4x4, cpi->coef_counts_4x4);
vp9_copy(cpi->common.fc.coef_counts_8x8, cpi->coef_counts_8x8);
vp9_copy(cpi->common.fc.coef_counts_16x16, cpi->coef_counts_16x16);
vp9_copy(cpi->common.fc.coef_counts_32x32, cpi->coef_counts_32x32);
#endif
if (!cpi->common.error_resilient_mode &&
!cpi->common.frame_parallel_decoding_mode) {
vp9_adapt_coef_probs(&cpi->common);

View File

@ -76,10 +76,17 @@ typedef struct {
// 0 = I4X4_PRED, ZERO_MV, MV, SPLIT
signed char last_mode_lf_deltas[MAX_MODE_LF_DELTAS];
#if CONFIG_MODELCOEFPROB
vp9_coeff_probs_model coef_probs_4x4[BLOCK_TYPES];
vp9_coeff_probs_model coef_probs_8x8[BLOCK_TYPES];
vp9_coeff_probs_model coef_probs_16x16[BLOCK_TYPES];
vp9_coeff_probs_model coef_probs_32x32[BLOCK_TYPES];
#else
vp9_coeff_probs coef_probs_4x4[BLOCK_TYPES];
vp9_coeff_probs coef_probs_8x8[BLOCK_TYPES];
vp9_coeff_probs coef_probs_16x16[BLOCK_TYPES];
vp9_coeff_probs coef_probs_32x32[BLOCK_TYPES];
#endif
vp9_prob sb_ymode_prob[VP9_I32X32_MODES - 1];
vp9_prob ymode_prob[VP9_YMODES - 1]; /* interframe intra mode probs */

View File

@ -106,16 +106,28 @@ const MODE_DEFINITION vp9_mode_order[MAX_MODES] = {
};
static void fill_token_costs(vp9_coeff_count *c,
#if CONFIG_MODELCOEFPROB
vp9_coeff_probs_model *p,
#else
vp9_coeff_probs *p,
#endif
TX_SIZE tx_size) {
int i, j, k, l;
for (i = 0; i < BLOCK_TYPES; i++)
for (j = 0; j < REF_TYPES; j++)
for (k = 0; k < COEF_BANDS; k++)
for (l = 0; l < PREV_COEF_CONTEXTS; l++)
for (l = 0; l < PREV_COEF_CONTEXTS; l++) {
#if CONFIG_MODELCOEFPROB
vp9_prob probs[ENTROPY_NODES];
vp9_model_to_full_probs(p[i][j][k][l], i, j, probs);
vp9_cost_tokens_skip((int *)c[i][j][k][l], probs,
vp9_coef_tree);
#else
vp9_cost_tokens_skip((int *)c[i][j][k][l], p[i][j][k][l],
vp9_coef_tree);
#endif
}
}
static int rd_iifactor[32] = { 4, 4, 3, 2, 1, 0, 0, 0,
@ -268,8 +280,11 @@ static INLINE int cost_coeffs(VP9_COMMON *const cm, MACROBLOCK *mb,
TX_TYPE tx_type = DCT_DCT;
const int segment_id = xd->mode_info_context->mbmi.segment_id;
vp9_prob (*coef_probs)[REF_TYPES][COEF_BANDS][PREV_COEF_CONTEXTS]
[ENTROPY_NODES];
#if CONFIG_MODELCOEFPROB
vp9_prob coef_probs[COEF_BANDS][PREV_COEF_CONTEXTS][ENTROPY_NODES];
#else
vp9_prob (*coef_probs)[PREV_COEF_CONTEXTS][ENTROPY_NODES];
#endif
int seg_eob, default_eob;
uint8_t token_cache[1024];
const uint8_t * band_translate;
@ -289,7 +304,12 @@ static INLINE int cost_coeffs(VP9_COMMON *const cm, MACROBLOCK *mb,
get_tx_type_4x4(xd, block) : DCT_DCT;
above_ec = A[0] != 0;
left_ec = L[0] != 0;
coef_probs = cm->fc.coef_probs_4x4;
#if CONFIG_MODELCOEFPROB
vp9_model_to_full_probs_sb(cm->fc.coef_probs_4x4[type][ref],
type, ref, coef_probs);
#else
coef_probs = cm->fc.coef_probs_4x4[type][ref];
#endif
seg_eob = 16;
scan = get_scan_4x4(tx_type);
band_translate = vp9_coefband_trans_4x4;
@ -304,7 +324,12 @@ static INLINE int cost_coeffs(VP9_COMMON *const cm, MACROBLOCK *mb,
above_ec = (A[0] + A[1]) != 0;
left_ec = (L[0] + L[1]) != 0;
scan = get_scan_8x8(tx_type);
coef_probs = cm->fc.coef_probs_8x8;
#if CONFIG_MODELCOEFPROB
vp9_model_to_full_probs_sb(cm->fc.coef_probs_8x8[type][ref],
type, ref, coef_probs);
#else
coef_probs = cm->fc.coef_probs_8x8[type][ref];
#endif
seg_eob = 64;
band_translate = vp9_coefband_trans_8x8plus;
break;
@ -316,7 +341,12 @@ static INLINE int cost_coeffs(VP9_COMMON *const cm, MACROBLOCK *mb,
TX_TYPE tx_type = (type == PLANE_TYPE_Y_WITH_DC) ?
get_tx_type_16x16(xd, y + (x >> 2)) : DCT_DCT;
scan = get_scan_16x16(tx_type);
coef_probs = cm->fc.coef_probs_16x16;
#if CONFIG_MODELCOEFPROB
vp9_model_to_full_probs_sb(cm->fc.coef_probs_16x16[type][ref],
type, ref, coef_probs);
#else
coef_probs = cm->fc.coef_probs_16x16[type][ref];
#endif
seg_eob = 256;
above_ec = (A[0] + A[1] + A[2] + A[3]) != 0;
left_ec = (L[0] + L[1] + L[2] + L[3]) != 0;
@ -325,7 +355,12 @@ static INLINE int cost_coeffs(VP9_COMMON *const cm, MACROBLOCK *mb,
}
case TX_32X32:
scan = vp9_default_zig_zag1d_32x32;
coef_probs = cm->fc.coef_probs_32x32;
#if CONFIG_MODELCOEFPROB
vp9_model_to_full_probs_sb(cm->fc.coef_probs_32x32[type][ref],
type, ref, coef_probs);
#else
coef_probs = cm->fc.coef_probs_32x32[type][ref];
#endif
seg_eob = 1024;
above_ec = (A[0] + A[1] + A[2] + A[3] + A[4] + A[5] + A[6] + A[7]) != 0;
left_ec = (L[0] + L[1] + L[2] + L[3] + L[4] + L[5] + L[6] + L[7]) != 0;
@ -359,7 +394,7 @@ static INLINE int cost_coeffs(VP9_COMMON *const cm, MACROBLOCK *mb,
cost += token_costs[band][pt][t] + vp9_dct_value_cost_ptr[v];
if (!c || token_cache[scan[c - 1]])
cost += vp9_cost_bit(coef_probs[type][ref][band][pt][0], 1);
cost += vp9_cost_bit(coef_probs[band][pt][0], 1);
token_cache[scan[c]] = t;
}
if (c < seg_eob) {

View File

@ -136,7 +136,11 @@ static void tokenize_b(int plane, int block, BLOCK_SIZE_TYPE bsize,
const int segment_id = mbmi->segment_id;
const int *scan, *nb;
vp9_coeff_count *counts;
#if CONFIG_MODELCOEFPROB
vp9_coeff_probs_model *coef_probs;
#else
vp9_coeff_probs *coef_probs;
#endif
const int ref = mbmi->ref_frame != INTRA_FRAME;
ENTROPY_CONTEXT above_ec, left_ec;
uint8_t token_cache[1024];
@ -224,7 +228,11 @@ static void tokenize_b(int plane, int block, BLOCK_SIZE_TYPE bsize,
t->token = token;
t->context_tree = coef_probs[type][ref][band][pt];
t->skip_eob_node = (c > 0) && (token_cache[scan[c - 1]] == 0);
#if CONFIG_MODELCOEFPROB
t->block_type = type;
t->ref_type = ref;
#endif
t->skip_eob_node = (c > 0) && (token_cache[scan[c - 1]] == 0);
assert(vp9_coef_encodings[t->token].len - t->skip_eob_node > 0);
if (!dry_run) {

View File

@ -26,8 +26,9 @@ typedef struct {
int16_t extra;
uint8_t token;
uint8_t skip_eob_node;
#if CONFIG_CODE_ZEROGROUP
uint8_t skip_coef_val;
#if CONFIG_MODELCOEFPROB
uint8_t block_type;
uint8_t ref_type;
#endif
} TOKENEXTRA;