ref: 3f5d60b38442e7f0ba37883c4b636150305dfae0
parent: 70e21afb3fac6bb5cdfa4c8063521f5b634c0379
author: Deb Mukherjee <debargha@google.com>
date: Sun Sep 9 18:42:35 EDT 2012
Entropy coding for hybrid transform Separates the entropy coding context models for 4x4, 8x8 and 16x16 ADST variants. There is a small improvement for HD (hd/std-hd) by about 0.1-0.2%. Results on derf/yt are about the same, probably because there is not enough statistics. Results may improve somewhat once the initial probability tables are updated for the hybrid transforms which is coming soon. Change-Id: Ic7c0c62dacc68ef551054fdb575be8b8507d32a8
--- a/vp8/common/default_coef_probs.h
+++ b/vp8/common/default_coef_probs.h
@@ -253,8 +253,253 @@
}
}
};
+
+#if CONFIG_HYBRIDTRANSFORM
+static const vp8_prob default_hybrid_coef_probs [BLOCK_TYPES]
+[COEF_BANDS]
+[PREV_COEF_CONTEXTS]
+[ENTROPY_NODES] = {
+ {
+ /* Block Type ( 0 ) */
+ {
+ /* Coeff Band ( 0 )*/
+ { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 },
+ { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 },
+ { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 },
+ { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 },
+ },
+ {
+ /* Coeff Band ( 1 )*/
+ { 253, 136, 254, 255, 228, 219, 128, 128, 128, 128, 128 },
+ { 189, 129, 242, 255, 227, 213, 255, 219, 128, 128, 128 },
+ { 106, 126, 227, 252, 214, 209, 255, 255, 128, 128, 128 },
+ { 90, 116, 227, 252, 214, 209, 255, 255, 128, 128, 128 },
+ },
+ {
+ /* Coeff Band ( 2 )*/
+ { 1, 98, 248, 255, 236, 226, 255, 255, 128, 128, 128 },
+ { 181, 133, 238, 254, 221, 234, 255, 154, 128, 128, 128 },
+ { 78, 134, 202, 247, 198, 180, 255, 219, 128, 128, 128 },
+ { 64, 128, 202, 247, 198, 180, 255, 219, 128, 128, 128 },
+ },
+ {
+ /* Coeff Band ( 3 )*/
+ { 1, 185, 249, 255, 243, 255, 128, 128, 128, 128, 128 },
+ { 184, 150, 247, 255, 236, 224, 128, 128, 128, 128, 128 },
+ { 77, 110, 216, 255, 236, 230, 128, 128, 128, 128, 128 },
+ { 64, 100, 216, 255, 236, 230, 128, 128, 128, 128, 128 },
+ },
+ {
+ /* Coeff Band ( 4 )*/
+ { 1, 101, 251, 255, 241, 255, 128, 128, 128, 128, 128 },
+ { 170, 139, 241, 252, 236, 209, 255, 255, 128, 128, 128 },
+ { 37, 116, 196, 243, 228, 255, 255, 255, 128, 128, 128 },
+ { 28, 110, 196, 243, 228, 255, 255, 255, 128, 128, 128 },
+ },
+ {
+ /* Coeff Band ( 5 )*/
+ { 1, 204, 254, 255, 245, 255, 128, 128, 128, 128, 128 },
+ { 207, 160, 250, 255, 238, 128, 128, 128, 128, 128, 128 },
+ { 102, 103, 231, 255, 211, 171, 128, 128, 128, 128, 128 },
+ { 90, 90, 231, 255, 211, 171, 128, 128, 128, 128, 128 },
+ },
+ {
+ /* Coeff Band ( 6 )*/
+ { 1, 152, 252, 255, 240, 255, 128, 128, 128, 128, 128 },
+ { 177, 135, 243, 255, 234, 225, 128, 128, 128, 128, 128 },
+ { 80, 129, 211, 255, 194, 224, 128, 128, 128, 128, 128 },
+ { 64, 120, 211, 255, 194, 224, 128, 128, 128, 128, 128 },
+ },
+ {
+ /* Coeff Band ( 7 )*/
+ { 1, 1, 255, 128, 128, 128, 128, 128, 128, 128, 128 },
+ { 246, 1, 255, 128, 128, 128, 128, 128, 128, 128, 128 },
+ { 255, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 },
+ { 255, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 },
+ }
+ },
+ {
+ /* Block Type ( 1 ) */
+ {
+ /* Coeff Band ( 0 )*/
+ { 198, 35, 237, 223, 193, 187, 162, 160, 145, 155, 62 },
+ { 131, 45, 198, 221, 172, 176, 220, 157, 252, 221, 1 },
+ { 68, 47, 146, 208, 149, 167, 221, 162, 255, 223, 128 },
+ { 48, 32, 146, 208, 149, 167, 221, 162, 255, 223, 128 },
+ },
+ {
+ /* Coeff Band ( 1 )*/
+ { 1, 149, 241, 255, 221, 224, 255, 255, 128, 128, 128 },
+ { 184, 141, 234, 253, 222, 220, 255, 199, 128, 128, 128 },
+ { 81, 99, 181, 242, 176, 190, 249, 202, 255, 255, 128 },
+ { 66, 90, 181, 242, 176, 190, 249, 202, 255, 255, 128 },
+ },
+ {
+ /* Coeff Band ( 2 )*/
+ { 1, 129, 232, 253, 214, 197, 242, 196, 255, 255, 128 },
+ { 99, 121, 210, 250, 201, 198, 255, 202, 128, 128, 128 },
+ { 23, 91, 163, 242, 170, 187, 247, 210, 255, 255, 128 },
+ { 18, 80, 163, 242, 170, 187, 247, 210, 255, 255, 128 },
+ },
+ {
+ /* Coeff Band ( 3 )*/
+ { 1, 200, 246, 255, 234, 255, 128, 128, 128, 128, 128 },
+ { 109, 178, 241, 255, 231, 245, 255, 255, 128, 128, 128 },
+ { 44, 130, 201, 253, 205, 192, 255, 255, 128, 128, 128 },
+ { 36, 120, 201, 253, 205, 192, 255, 255, 128, 128, 128 },
+ },
+ {
+ /* Coeff Band ( 4 )*/
+ { 1, 132, 239, 251, 219, 209, 255, 165, 128, 128, 128 },
+ { 94, 136, 225, 251, 218, 190, 255, 255, 128, 128, 128 },
+ { 22, 100, 174, 245, 186, 161, 255, 199, 128, 128, 128 },
+ { 18, 90, 174, 245, 186, 161, 255, 199, 128, 128, 128 },
+ },
+ {
+ /* Coeff Band ( 5 )*/
+ { 1, 182, 249, 255, 232, 235, 128, 128, 128, 128, 128 },
+ { 124, 143, 241, 255, 227, 234, 128, 128, 128, 128, 128 },
+ { 35, 77, 181, 251, 193, 211, 255, 205, 128, 128, 128 },
+ { 28, 70, 181, 251, 193, 211, 255, 205, 128, 128, 128 },
+ },
+ {
+ /* Coeff Band ( 6 )*/
+ { 1, 157, 247, 255, 236, 231, 255, 255, 128, 128, 128 },
+ { 121, 141, 235, 255, 225, 227, 255, 255, 128, 128, 128 },
+ { 45, 99, 188, 251, 195, 217, 255, 224, 128, 128, 128 },
+ { 40, 90, 188, 251, 195, 217, 255, 224, 128, 128, 128 },
+ },
+ {
+ /* Coeff Band ( 7 )*/
+ { 1, 1, 251, 255, 213, 255, 128, 128, 128, 128, 128 },
+ { 203, 1, 248, 255, 255, 128, 128, 128, 128, 128, 128 },
+ { 137, 1, 177, 255, 224, 255, 128, 128, 128, 128, 128 },
+ { 137, 1, 177, 255, 224, 255, 128, 128, 128, 128, 128 },
+ }
+ },
+ {
+ /* Block Type ( 2 ) */
+ {
+ /* Coeff Band ( 0 )*/
+ { 253, 9, 248, 251, 207, 208, 255, 192, 128, 128, 128 },
+ { 175, 13, 224, 243, 193, 185, 249, 198, 255, 255, 128 },
+ { 73, 17, 171, 221, 161, 179, 236, 167, 255, 234, 128 },
+ { 64, 17, 171, 221, 161, 179, 236, 167, 255, 234, 128 },
+ },
+ {
+ /* Coeff Band ( 1 )*/
+ { 1, 95, 247, 253, 212, 183, 255, 255, 128, 128, 128 },
+ { 239, 90, 244, 250, 211, 209, 255, 255, 128, 128, 128 },
+ { 155, 77, 195, 248, 188, 195, 255, 255, 128, 128, 128 },
+ { 140, 70, 195, 248, 188, 195, 255, 255, 128, 128, 128 },
+ },
+ {
+ /* Coeff Band ( 2 )*/
+ { 1, 24, 239, 251, 218, 219, 255, 205, 128, 128, 128 },
+ { 201, 51, 219, 255, 196, 186, 128, 128, 128, 128, 128 },
+ { 69, 46, 190, 239, 201, 218, 255, 228, 128, 128, 128 },
+ { 60, 40, 190, 239, 201, 218, 255, 228, 128, 128, 128 },
+ },
+ {
+ /* Coeff Band ( 3 )*/
+ { 1, 191, 251, 255, 255, 128, 128, 128, 128, 128, 128 },
+ { 223, 165, 249, 255, 213, 255, 128, 128, 128, 128, 128 },
+ { 141, 124, 248, 255, 255, 128, 128, 128, 128, 128, 128 },
+ { 132, 118, 248, 255, 255, 128, 128, 128, 128, 128, 128 },
+ },
+ {
+ /* Coeff Band ( 4 )*/
+ { 1, 16, 248, 255, 255, 128, 128, 128, 128, 128, 128 },
+ { 190, 36, 230, 255, 236, 255, 128, 128, 128, 128, 128 },
+ { 149, 1, 255, 128, 128, 128, 128, 128, 128, 128, 128 },
+ { 149, 1, 255, 128, 128, 128, 128, 128, 128, 128, 128 },
+ },
+ {
+ /* Coeff Band ( 5 )*/
+ { 1, 226, 255, 128, 128, 128, 128, 128, 128, 128, 128 },
+ { 247, 192, 255, 128, 128, 128, 128, 128, 128, 128, 128 },
+ { 240, 128, 255, 128, 128, 128, 128, 128, 128, 128, 128 },
+ { 240, 128, 255, 128, 128, 128, 128, 128, 128, 128, 128 },
+ },
+ {
+ /* Coeff Band ( 6 )*/
+ { 1, 134, 252, 255, 255, 128, 128, 128, 128, 128, 128 },
+ { 213, 62, 250, 255, 255, 128, 128, 128, 128, 128, 128 },
+ { 55, 93, 255, 128, 128, 128, 128, 128, 128, 128, 128 },
+ { 48, 85, 255, 128, 128, 128, 128, 128, 128, 128, 128 },
+ },
+ {
+ /* Coeff Band ( 7 )*/
+ { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 },
+ { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 },
+ { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 },
+ { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 },
+ }
+ },
+ {
+ /* Block Type ( 3 ) */
+ {
+ /* Coeff Band ( 0 )*/
+ { 202, 24, 213, 235, 186, 191, 220, 160, 240, 175, 255 },
+ { 126, 38, 182, 232, 169, 184, 228, 174, 255, 187, 128 },
+ { 63, 48, 138, 219, 151, 178, 240, 170, 255, 216, 128 },
+ { 54, 40, 138, 219, 151, 178, 240, 170, 255, 216, 128 },
+ },
+ {
+ /* Coeff Band ( 1 )*/
+ { 1, 112, 230, 250, 199, 191, 247, 159, 255, 255, 128 },
+ { 166, 109, 228, 252, 211, 215, 255, 174, 128, 128, 128 },
+ { 44, 84, 162, 232, 172, 180, 245, 178, 255, 255, 128 },
+ { 32, 70, 162, 232, 172, 180, 245, 178, 255, 255, 128 },
+ },
+ {
+ /* Coeff Band ( 2 )*/
+ { 1, 52, 220, 246, 198, 199, 249, 220, 255, 255, 128 },
+ { 124, 74, 191, 243, 183, 193, 250, 221, 255, 255, 128 },
+ { 24, 71, 130, 219, 154, 170, 243, 182, 255, 255, 128 },
+ { 24, 71, 130, 219, 154, 170, 243, 182, 255, 255, 128 },
+ },
+ {
+ /* Coeff Band ( 3 )*/
+ { 1, 182, 225, 249, 219, 240, 255, 224, 128, 128, 128 },
+ { 149, 150, 226, 252, 216, 205, 255, 171, 128, 128, 128 },
+ { 28, 108, 170, 242, 183, 194, 254, 223, 255, 255, 128 },
+ { 26, 104, 170, 242, 183, 194, 254, 223, 255, 255, 128 },
+ },
+ {
+ /* Coeff Band ( 4 )*/
+ { 1, 81, 230, 252, 204, 203, 255, 192, 128, 128, 128 },
+ { 123, 102, 209, 247, 188, 196, 255, 233, 128, 128, 128 },
+ { 20, 95, 153, 243, 164, 173, 255, 203, 128, 128, 128 },
+ { 20, 95, 153, 243, 164, 173, 255, 203, 128, 128, 128 },
+ },
+ {
+ /* Coeff Band ( 5 )*/
+ { 1, 222, 248, 255, 216, 213, 128, 128, 128, 128, 128 },
+ { 168, 175, 246, 252, 235, 205, 255, 255, 128, 128, 128 },
+ { 47, 116, 215, 255, 211, 212, 255, 255, 128, 128, 128 },
+ { 47, 116, 215, 255, 211, 212, 255, 255, 128, 128, 128 },
+ },
+ {
+ /* Coeff Band ( 6 )*/
+ { 1, 121, 236, 253, 212, 214, 255, 255, 128, 128, 128 },
+ { 141, 84, 213, 252, 201, 202, 255, 219, 128, 128, 128 },
+ { 42, 80, 160, 240, 162, 185, 255, 205, 128, 128, 128 },
+ { 42, 80, 160, 240, 162, 185, 255, 205, 128, 128, 128 },
+ },
+ {
+ /* Coeff Band ( 7 )*/
+ { 1, 1, 255, 128, 128, 128, 128, 128, 128, 128, 128 },
+ { 244, 1, 255, 128, 128, 128, 128, 128, 128, 128, 128 },
+ { 238, 1, 255, 128, 128, 128, 128, 128, 128, 128, 128 },
+ { 238, 1, 255, 128, 128, 128, 128, 128, 128, 128, 128 },
+ }
+ }
+};
+#endif
+
static const vp8_prob
-vp8_default_coef_probs_8x8[BLOCK_TYPES_8X8]
+default_coef_probs_8x8[BLOCK_TYPES_8X8]
[COEF_BANDS]
[PREV_COEF_CONTEXTS]
[ENTROPY_NODES] = {
@@ -433,9 +678,243 @@
{ 6, 117, 180, 254, 199, 216, 255, 251, 128, 128, 128},
{ 6, 117, 180, 254, 199, 216, 255, 251, 128, 128, 128}
}
+ },
+#if CONFIG_HYBRIDTRANSFORM8X8
+ { /* block Type 3 */
+ { /* Coeff Band 0 */
+ { 192, 18, 155, 172, 145, 164, 192, 135, 246, 223, 255},
+ { 94, 29, 97, 131, 131, 153, 171, 121, 250, 190, 255},
+ { 25, 29, 63, 128, 119, 147, 168, 124, 251, 183, 255},
+ { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128}
+ },
+ { /* Coeff Band 1 */
+ { 1, 108, 192, 220, 186, 173, 255, 194, 255, 255, 128},
+ { 123, 104, 188, 221, 165, 171, 247, 180, 255, 255, 128},
+ { 23, 76, 152, 216, 154, 166, 226, 182, 255, 209, 128},
+ { 1, 26, 52, 162, 109, 152, 208, 144, 255, 231, 128}
+ },
+ { /* Coeff Band 2 */
+ { 1, 57, 179, 220, 156, 175, 210, 158, 255, 223, 128},
+ { 48, 57, 134, 212, 151, 170, 219, 185, 255, 248, 128},
+ { 4, 35, 63, 189, 120, 156, 221, 159, 255, 241, 128},
+ { 1, 17, 23, 110, 97, 143, 187, 120, 255, 234, 128}
+ },
+ { /* Coeff Band 3 */
+ { 1, 115, 205, 243, 182, 187, 254, 218, 255, 255, 128},
+ { 80, 101, 186, 241, 183, 186, 249, 182, 255, 255, 128},
+ { 10, 81, 144, 229, 164, 175, 241, 185, 255, 255, 128},
+ { 1, 44, 81, 192, 130, 148, 240, 180, 255, 255, 128}
+ },
+ { /* Coeff Band 4 */
+ { 1, 161, 207, 249, 187, 176, 255, 180, 128, 128, 128},
+ { 79, 148, 196, 240, 186, 182, 253, 171, 255, 255, 128},
+ { 14, 111, 171, 233, 170, 178, 235, 204, 255, 255, 128},
+ { 1, 63, 103, 202, 143, 162, 240, 178, 255, 255, 128}
+ },
+ { /* Coeff Band 5 */
+ { 1, 101, 202, 239, 185, 184, 252, 186, 255, 255, 128},
+ { 43, 67, 166, 237, 178, 190, 246, 194, 255, 255, 128},
+ { 4, 49, 85, 220, 140, 168, 253, 182, 255, 255, 128},
+ { 1, 24, 35, 144, 93, 135, 239, 159, 255, 253, 128}
+ },
+ { /* Coeff Band 6 */
+ { 1, 212, 243, 255, 240, 234, 255, 255, 128, 128, 128},
+ { 98, 168, 234, 255, 229, 234, 255, 255, 128, 128, 128},
+ { 19, 127, 199, 255, 212, 198, 255, 255, 128, 128, 128},
+ { 1, 103, 162, 253, 186, 151, 255, 255, 128, 128, 128}
+ },
+ { /* Coeff Band 7 */
+ { 1, 188, 253, 255, 255, 128, 128, 128, 128, 128, 128},
+ { 191, 68, 242, 255, 255, 128, 128, 128, 128, 128, 128},
+ { 8, 132, 255, 128, 128, 128, 128, 128, 128, 128, 128},
+ { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128}
+ }
}
+#endif
+};
+
#if CONFIG_HYBRIDTRANSFORM8X8
- ,
+static const vp8_prob
+default_hybrid_coef_probs_8x8[BLOCK_TYPES_8X8]
+ [COEF_BANDS]
+ [PREV_COEF_CONTEXTS]
+ [ENTROPY_NODES] = {
+ {
+ /* block Type 0 */
+ {
+ /* Coeff Band 0 */
+ { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128},
+ { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128},
+ { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128},
+ { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128}
+ },
+ {
+ /* Coeff Band 1 */
+ { 60, 140, 195, 255, 212, 214, 128, 128, 128, 128, 128},
+ { 75, 221, 231, 255, 203, 255, 128, 128, 128, 128, 128},
+ { 9, 212, 196, 251, 197, 207, 255, 185, 128, 128, 128},
+ { 9, 212, 196, 251, 197, 207, 255, 185, 128, 128, 128}
+ },
+ {
+ /* Coeff Band 2 */
+ { 1, 227, 226, 255, 215, 215, 128, 128, 128, 128, 128},
+ { 5, 163, 209, 255, 212, 212, 255, 255, 128, 128, 128},
+ { 1, 133, 203, 255, 210, 220, 255, 255, 128, 128, 128},
+ { 1, 133, 203, 255, 210, 220, 255, 255, 128, 128, 128}
+ },
+ {
+ /* Coeff Band 3 */
+ { 1, 226, 225, 255, 228, 236, 128, 128, 128, 128, 128},
+ { 6, 163, 208, 255, 224, 234, 255, 255, 128, 128, 128},
+ { 1, 122, 196, 253, 212, 248, 255, 255, 128, 128, 128},
+ { 1, 122, 196, 253, 212, 248, 255, 255, 128, 128, 128}
+ },
+ {
+ /* Coeff Band 4 */
+ { 1, 222, 197, 254, 193, 216, 255, 236, 128, 128, 128},
+ { 7, 140, 163, 251, 195, 211, 255, 238, 128, 128, 128},
+ { 1, 91, 152, 249, 181, 197, 255, 239, 128, 128, 128},
+ { 1, 91, 152, 249, 181, 197, 255, 239, 128, 128, 128}
+ },
+ {
+ /* Coeff Band 5 */
+ { 1, 226, 218, 255, 216, 241, 255, 255, 128, 128, 128},
+ { 6, 154, 191, 255, 218, 240, 255, 255, 128, 128, 128},
+ { 1, 110, 171, 252, 191, 204, 255, 236, 128, 128, 128},
+ { 1, 110, 171, 252, 191, 204, 255, 236, 128, 128, 128}
+ },
+ {
+ /* Coeff Band 6 */
+ { 1, 221, 217, 255, 208, 217, 255, 232, 128, 128, 128},
+ { 11, 155, 189, 254, 203, 211, 255, 249, 128, 128, 128},
+ { 1, 110, 171, 252, 191, 204, 255, 236, 128, 128, 128},
+ { 1, 110, 171, 252, 191, 204, 255, 236, 128, 128, 128}
+ },
+ {
+ /* Coeff Band 7 */
+ { 1, 207, 235, 255, 232, 240, 128, 128, 128, 128, 128},
+ { 58, 161, 216, 255, 229, 235, 255, 255, 128, 128, 128},
+ { 8, 133, 204, 255, 219, 231, 255, 255, 128, 128, 128},
+ { 8, 133, 204, 255, 219, 231, 255, 255, 128, 128, 128}
+ }
+ },
+ {
+ /* block Type 1 */
+ {
+ /* Coeff Band 0 */
+ { 134, 152, 233, 224, 234, 52, 255, 166, 128, 128, 128},
+ { 97, 132, 185, 234, 186, 189, 197, 171, 255, 212, 128},
+ { 84, 110, 185, 237, 182, 182, 145, 145, 255, 255, 128}
+ },
+ {
+ /* Coeff Band 1 */
+ { 1, 124, 213, 247, 192, 212, 255, 255, 128, 128, 128},
+ { 88, 111, 178, 254, 189, 211, 255, 255, 128, 128, 128},
+ { 12, 59, 129, 236, 150, 179, 239, 195, 255, 255, 128},
+ { 12, 59, 129, 236, 150, 179, 239, 195, 255, 255, 128}
+ },
+ {
+ /* Coeff Band 2 */
+ { 1, 102, 225, 255, 210, 240, 128, 128, 128, 128, 128},
+ { 110, 78, 195, 254, 200, 191, 255, 255, 128, 128, 128},
+ { 37, 63, 177, 255, 194, 195, 128, 128, 128, 128, 128},
+ { 37, 63, 177, 255, 194, 195, 128, 128, 128, 128, 128}
+ },
+ {
+ /* Coeff Band 3 */
+ { 1, 1, 229, 255, 202, 224, 128, 128, 128, 128, 128},
+ { 150, 1, 192, 255, 206, 226, 128, 128, 128, 128, 128},
+ { 75, 1, 138, 255, 172, 228, 128, 128, 128, 128, 128},
+ { 75, 1, 138, 255, 172, 228, 128, 128, 128, 128, 128}
+ },
+ {
+ /* Coeff Band 4 */
+ { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128},
+ { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128},
+ { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128},
+ { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128}
+ },
+ {
+ /* Coeff Band 5 */
+ { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128},
+ { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128},
+ { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128},
+ { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128}
+ },
+ {
+ /* Coeff Band 6 */
+ { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128},
+ { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128},
+ { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128},
+ { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128}
+ },
+ {
+ /* Coeff Band 7 */
+ { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128},
+ { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128},
+ { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128},
+ { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128}
+ }
+ },
+ {
+ /* block Type 2 */
+ {
+ /* Coeff Band 0 */
+ { 11, 181, 226, 199, 183, 255, 255, 255, 128, 128, 128},
+ { 2, 147, 185, 248, 163, 180, 255, 236, 128, 128, 128},
+ { 1, 123, 157, 238, 154, 176, 255, 226, 255, 255, 128},
+ { 1, 123, 157, 238, 154, 176, 255, 226, 255, 255, 128}
+ },
+ {
+ /* Coeff Band 1 */
+ { 1, 150, 191, 246, 174, 188, 255, 235, 128, 128, 128},
+ { 1, 125, 166, 245, 165, 185, 255, 234, 128, 128, 128},
+ { 1, 79, 125, 240, 148, 179, 255, 234, 255, 255, 128},
+ { 1, 79, 125, 240, 148, 179, 255, 234, 255, 255, 128}
+ },
+ {
+ /* Coeff Band 2 */
+ { 1, 146, 184, 242, 167, 183, 255, 230, 255, 255, 128},
+ { 1, 119, 160, 239, 156, 178, 255, 231, 255, 255, 128},
+ { 1, 75, 115, 234, 142, 173, 255, 225, 255, 255, 128},
+ { 1, 75, 115, 234, 142, 173, 255, 225, 255, 255, 128}
+ },
+ {
+ /* Coeff Band 3 */
+ { 1, 150, 188, 244, 169, 183, 255, 233, 255, 255, 128},
+ { 1, 123, 162, 243, 161, 180, 255, 233, 128, 128, 128},
+ { 1, 76, 120, 238, 148, 178, 255, 230, 255, 255, 128},
+ { 1, 76, 120, 238, 148, 178, 255, 230, 255, 255, 128}
+ },
+ {
+ /* Coeff Band 4 */
+ { 1, 163, 202, 252, 188, 204, 255, 248, 128, 128, 128},
+ { 1, 136, 180, 251, 181, 201, 255, 246, 128, 128, 128},
+ { 1, 92, 146, 249, 170, 197, 255, 245, 128, 128, 128},
+ { 1, 92, 146, 249, 170, 197, 255, 245, 128, 128, 128}
+ },
+ {
+ /* Coeff Band 5 */
+ { 1, 156, 195, 249, 179, 193, 255, 241, 255, 255, 128},
+ { 1, 128, 169, 248, 171, 192, 255, 242, 255, 255, 128},
+ { 1, 84, 132, 245, 158, 187, 255, 240, 255, 255, 128},
+ { 1, 84, 132, 245, 158, 187, 255, 240, 255, 255, 128}
+ },
+ {
+ /* Coeff Band 6 */
+ { 1, 36, 71, 251, 192, 201, 255, 243, 255, 255, 128},
+ { 1, 49, 185, 250, 184, 199, 255, 242, 128, 128, 128},
+ { 1, 95, 147, 247, 168, 190, 255, 239, 255, 255, 128},
+ { 1, 95, 147, 247, 168, 190, 255, 239, 255, 255, 128}
+ },
+ {
+ /* Coeff Band 7 */
+ { 1, 19, 98, 255, 218, 222, 255, 255, 128, 128, 128},
+ { 36, 50, 210, 255, 212, 221, 255, 255, 128, 128, 128},
+ { 6, 117, 180, 254, 199, 216, 255, 251, 128, 128, 128},
+ { 6, 117, 180, 254, 199, 216, 255, 251, 128, 128, 128}
+ }
+ },
{ /* block Type 3 */
{ /* Coeff Band 0 */
{ 192, 18, 155, 172, 145, 164, 192, 135, 246, 223, 255},
@@ -486,15 +965,223 @@
{ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128}
}
}
+};
#endif
+
+#if CONFIG_TX16X16
+static const vp8_prob
+ default_coef_probs_16x16[BLOCK_TYPES_16X16]
+ [COEF_BANDS]
+ [PREV_COEF_CONTEXTS]
+ [ENTROPY_NODES] = {
+ { /* block Type 0 */
+ { /* Coeff Band 0 */
+ { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128},
+ { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128},
+ { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128},
+ { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128}
+ },
+ { /* Coeff Band 1 */
+ { 60, 140, 195, 255, 212, 214, 128, 128, 128, 128, 128},
+ { 75, 221, 231, 255, 203, 255, 128, 128, 128, 128, 128},
+ { 9, 212, 196, 251, 197, 207, 255, 185, 128, 128, 128},
+ { 9, 212, 196, 251, 197, 207, 255, 185, 128, 128, 128}
+ },
+ { /* Coeff Band 2 */
+ { 1, 227, 226, 255, 215, 215, 128, 128, 128, 128, 128},
+ { 5, 163, 209, 255, 212, 212, 255, 255, 128, 128, 128},
+ { 1, 133, 203, 255, 210, 220, 255, 255, 128, 128, 128},
+ { 1, 133, 203, 255, 210, 220, 255, 255, 128, 128, 128}
+ },
+ { /* Coeff Band 3 */
+ { 1, 226, 225, 255, 228, 236, 128, 128, 128, 128, 128},
+ { 6, 163, 208, 255, 224, 234, 255, 255, 128, 128, 128},
+ { 1, 122, 196, 253, 212, 248, 255, 255, 128, 128, 128},
+ { 1, 122, 196, 253, 212, 248, 255, 255, 128, 128, 128}
+ },
+ { /* Coeff Band 4 */
+ { 1, 222, 197, 254, 193, 216, 255, 236, 128, 128, 128},
+ { 7, 140, 163, 251, 195, 211, 255, 238, 128, 128, 128},
+ { 1, 91, 152, 249, 181, 197, 255, 239, 128, 128, 128},
+ { 1, 91, 152, 249, 181, 197, 255, 239, 128, 128, 128}
+ },
+ { /* Coeff Band 5 */
+ { 1, 226, 218, 255, 216, 241, 255, 255, 128, 128, 128},
+ { 6, 154, 191, 255, 218, 240, 255, 255, 128, 128, 128},
+ { 1, 110, 171, 252, 191, 204, 255, 236, 128, 128, 128},
+ { 1, 110, 171, 252, 191, 204, 255, 236, 128, 128, 128}
+ },
+ { /* Coeff Band 6 */
+ { 1, 221, 217, 255, 208, 217, 255, 232, 128, 128, 128},
+ { 11, 155, 189, 254, 203, 211, 255, 249, 128, 128, 128},
+ { 1, 110, 171, 252, 191, 204, 255, 236, 128, 128, 128},
+ { 1, 110, 171, 252, 191, 204, 255, 236, 128, 128, 128}
+ },
+ { /* Coeff Band 7 */
+ { 1, 207, 235, 255, 232, 240, 128, 128, 128, 128, 128},
+ { 58, 161, 216, 255, 229, 235, 255, 255, 128, 128, 128},
+ { 8, 133, 204, 255, 219, 231, 255, 255, 128, 128, 128},
+ { 8, 133, 204, 255, 219, 231, 255, 255, 128, 128, 128}
+ }
+ },
+ { /* block Type 1 */
+ { /* Coeff Band 0 */
+ { 1, 30, 103, 204, 142, 168, 235, 161, 255, 228, 128},
+ { 1, 35, 90, 192, 130, 161, 227, 158, 255, 226, 255},
+ { 1, 36, 78, 180, 122, 156, 221, 153, 255, 222, 255},
+ { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128}
+ },
+ { /* Coeff Band 1 */
+ { 1, 163, 228, 253, 212, 194, 255, 205, 128, 128, 128},
+ { 67, 160, 226, 253, 210, 202, 245, 172, 255, 255, 128},
+ { 51, 147, 219, 251, 207, 207, 255, 217, 128, 128, 128},
+ { 25, 107, 175, 245, 183, 190, 254, 209, 255, 255, 128}
+ },
+ { /* Coeff Band 2 */
+ { 1, 66, 170, 240, 177, 186, 252, 203, 255, 245, 128},
+ { 23, 64, 145, 230, 161, 177, 252, 198, 255, 255, 128},
+ { 6, 51, 99, 208, 135, 163, 249, 178, 255, 248, 128},
+ { 1, 33, 59, 161, 104, 151, 238, 164, 255, 237, 128}
+ },
+ { /* Coeff Band 3 */
+ { 1, 76, 216, 250, 198, 199, 255, 226, 255, 255, 128},
+ { 86, 83, 200, 247, 189, 193, 255, 224, 255, 255, 128},
+ { 30, 75, 164, 242, 172, 184, 254, 218, 255, 255, 128},
+ { 3, 54, 103, 227, 140, 172, 253, 201, 255, 255, 128}
+ },
+ { /* Coeff Band 4 */
+ { 1, 241, 247, 255, 233, 223, 255, 255, 128, 128, 128},
+ { 78, 212, 242, 255, 226, 230, 255, 255, 128, 128, 128},
+ { 10, 167, 224, 255, 217, 225, 255, 128, 128, 128, 128},
+ { 1, 104, 176, 250, 166, 219, 255, 255, 128, 128, 128}
+ },
+ { /* Coeff Band 5 */
+ { 1, 194, 241, 254, 228, 214, 248, 237, 255, 255, 128},
+ { 95, 133, 228, 254, 218, 215, 255, 229, 128, 128, 128},
+ { 24, 119, 201, 252, 202, 205, 255, 229, 128, 128, 128},
+ { 1, 88, 155, 246, 183, 193, 255, 205, 128, 128, 128}
+ },
+ { /* Coeff Band 6 */
+ { 1, 204, 236, 255, 222, 220, 255, 239, 128, 128, 128},
+ { 126, 105, 225, 254, 214, 217, 255, 254, 128, 128, 128},
+ { 44, 86, 190, 251, 197, 204, 255, 233, 128, 128, 128},
+ { 6, 71, 130, 240, 164, 188, 255, 246, 128, 128, 128}
+ },
+ { /* Coeff Band 7 */
+ { 1, 195, 250, 255, 239, 197, 128, 128, 128, 128, 128},
+ { 167, 102, 249, 255, 234, 255, 128, 128, 128, 128, 128},
+ { 65, 91, 222, 255, 217, 255, 128, 128, 128, 128, 128},
+ { 1, 59, 128, 255, 154, 255, 128, 128, 128, 128, 128}
+ }
+ },
+ { /* block Type 2 */
+ { /* Coeff Band 0 */
+ { 1, 30, 103, 204, 142, 168, 235, 161, 255, 228, 128},
+ { 1, 35, 90, 192, 130, 161, 227, 158, 255, 226, 255},
+ { 1, 36, 78, 180, 122, 156, 221, 153, 255, 222, 255},
+ { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128}
+ },
+ { /* Coeff Band 1 */
+ { 1, 163, 228, 253, 212, 194, 255, 205, 128, 128, 128},
+ { 67, 160, 226, 253, 210, 202, 245, 172, 255, 255, 128},
+ { 51, 147, 219, 251, 207, 207, 255, 217, 128, 128, 128},
+ { 25, 107, 175, 245, 183, 190, 254, 209, 255, 255, 128}
+ },
+ { /* Coeff Band 2 */
+ { 1, 66, 170, 240, 177, 186, 252, 203, 255, 245, 128},
+ { 23, 64, 145, 230, 161, 177, 252, 198, 255, 255, 128},
+ { 6, 51, 99, 208, 135, 163, 249, 178, 255, 248, 128},
+ { 1, 33, 59, 161, 104, 151, 238, 164, 255, 237, 128}
+ },
+ { /* Coeff Band 3 */
+ { 1, 76, 216, 250, 198, 199, 255, 226, 255, 255, 128},
+ { 86, 83, 200, 247, 189, 193, 255, 224, 255, 255, 128},
+ { 30, 75, 164, 242, 172, 184, 254, 218, 255, 255, 128},
+ { 3, 54, 103, 227, 140, 172, 253, 201, 255, 255, 128}
+ },
+ { /* Coeff Band 4 */
+ { 1, 241, 247, 255, 233, 223, 255, 255, 128, 128, 128},
+ { 78, 212, 242, 255, 226, 230, 255, 255, 128, 128, 128},
+ { 10, 167, 224, 255, 217, 225, 255, 128, 128, 128, 128},
+ { 1, 104, 176, 250, 166, 219, 255, 255, 128, 128, 128}
+ },
+ { /* Coeff Band 5 */
+ { 1, 194, 241, 254, 228, 214, 248, 237, 255, 255, 128},
+ { 95, 133, 228, 254, 218, 215, 255, 229, 128, 128, 128},
+ { 24, 119, 201, 252, 202, 205, 255, 229, 128, 128, 128},
+ { 1, 88, 155, 246, 183, 193, 255, 205, 128, 128, 128}
+ },
+ { /* Coeff Band 6 */
+ { 1, 204, 236, 255, 222, 220, 255, 239, 128, 128, 128},
+ { 126, 105, 225, 254, 214, 217, 255, 254, 128, 128, 128},
+ { 44, 86, 190, 251, 197, 204, 255, 233, 128, 128, 128},
+ { 6, 71, 130, 240, 164, 188, 255, 246, 128, 128, 128}
+ },
+ { /* Coeff Band 7 */
+ { 1, 195, 250, 255, 239, 197, 128, 128, 128, 128, 128},
+ { 167, 102, 249, 255, 234, 255, 128, 128, 128, 128, 128},
+ { 65, 91, 222, 255, 217, 255, 128, 128, 128, 128, 128},
+ { 1, 59, 128, 255, 154, 255, 128, 128, 128, 128, 128}
+ }
+ },
+ { /* block Type 3 */
+ { /* Coeff Band 0 */
+ { 17, 105, 227, 195, 164, 170, 168, 137, 221, 160, 184},
+ { 6, 92, 166, 193, 158, 169, 179, 142, 236, 175, 200},
+ { 2, 68, 118, 193, 147, 168, 187, 149, 241, 178, 247},
+ { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128}
+ },
+ { /* Coeff Band 1 */
+ { 1, 193, 221, 246, 198, 194, 244, 176, 255, 192, 128},
+ { 112, 160, 209, 244, 196, 194, 243, 175, 255, 209, 128},
+ { 45, 123, 175, 240, 184, 195, 239, 178, 255, 218, 255},
+ { 16, 53, 75, 169, 119, 152, 209, 146, 255, 219, 255}
+ },
+ { /* Coeff Band 2 */
+ { 1, 141, 183, 240, 176, 187, 246, 198, 255, 218, 128},
+ { 36, 97, 150, 231, 161, 180, 243, 191, 255, 217, 255},
+ { 8, 65, 111, 210, 143, 166, 230, 167, 255, 224, 255},
+ { 2, 35, 61, 157, 113, 149, 208, 142, 255, 217, 255}
+ },
+ { /* Coeff Band 3 */
+ { 1, 173, 196, 245, 184, 191, 252, 211, 255, 240, 128},
+ { 35, 119, 175, 242, 177, 187, 252, 209, 255, 235, 128},
+ { 4, 88, 141, 234, 161, 180, 249, 200, 255, 228, 128},
+ { 1, 57, 95, 203, 133, 161, 235, 167, 255, 231, 255}
+ },
+ { /* Coeff Band 4 */
+ { 1, 208, 227, 249, 209, 204, 248, 188, 255, 248, 128},
+ { 28, 162, 211, 247, 203, 200, 252, 188, 255, 232, 128},
+ { 5, 114, 174, 238, 182, 189, 245, 184, 255, 238, 128},
+ { 1, 61, 100, 205, 136, 164, 235, 163, 255, 239, 128}
+ },
+ { /* Coeff Band 5 */
+ { 1, 195, 218, 252, 208, 207, 250, 205, 255, 245, 128},
+ { 22, 141, 196, 249, 198, 201, 250, 202, 255, 244, 128},
+ { 2, 105, 163, 240, 178, 189, 246, 191, 255, 246, 128},
+ { 1, 70, 112, 206, 144, 167, 232, 162, 255, 239, 128}
+ },
+ { /* Coeff Band 6 */
+ { 1, 204, 215, 251, 204, 203, 255, 222, 255, 225, 128},
+ { 15, 140, 194, 249, 194, 199, 254, 221, 255, 253, 128},
+ { 1, 95, 153, 243, 172, 188, 254, 213, 255, 248, 128},
+ { 1, 59, 99, 216, 135, 166, 247, 190, 255, 237, 255}
+ },
+ { /* Coeff Band 7 */
+ { 1, 7, 231, 255, 227, 223, 255, 240, 255, 255, 128},
+ { 15, 157, 217, 255, 218, 219, 255, 239, 255, 255, 128},
+ { 1, 114, 182, 252, 198, 207, 255, 235, 255, 255, 128},
+ { 1, 71, 122, 238, 154, 181, 255, 216, 255, 255, 128}
+ }
+ }
};
-#if CONFIG_TX16X16 || CONFIG_HYBRIDTRANSFORM16X16
+
+#if CONFIG_HYBRIDTRANSFORM16X16
static const vp8_prob
-vp8_default_coef_probs_16x16[BLOCK_TYPES_16X16]
- [COEF_BANDS]
- [PREV_COEF_CONTEXTS]
- [ENTROPY_NODES] =
-{
+ default_hybrid_coef_probs_16x16[BLOCK_TYPES_16X16]
+ [COEF_BANDS]
+ [PREV_COEF_CONTEXTS]
+ [ENTROPY_NODES] = {
{ /* block Type 0 */
{ /* Coeff Band 0 */
{ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128},
@@ -696,4 +1383,5 @@
}
}
};
+#endif
#endif
--- a/vp8/common/entropy.c
+++ b/vp8/common/entropy.c
@@ -28,6 +28,8 @@
#include "coefupdateprobs.h"
+const int vp8_i8x8_block[4] = {0, 2, 8, 10};
+
DECLARE_ALIGNED(16, const unsigned char, vp8_norm[256]) = {
0, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
@@ -208,14 +210,27 @@
void vp8_default_coef_probs(VP8_COMMON *pc) {
vpx_memcpy(pc->fc.coef_probs, default_coef_probs,
sizeof(pc->fc.coef_probs));
+#if CONFIG_HYBRIDTRANSFORM
+ vpx_memcpy(pc->fc.hybrid_coef_probs, default_hybrid_coef_probs,
+ sizeof(pc->fc.hybrid_coef_probs));
+#endif
- vpx_memcpy(pc->fc.coef_probs_8x8, vp8_default_coef_probs_8x8,
+ vpx_memcpy(pc->fc.coef_probs_8x8, default_coef_probs_8x8,
sizeof(pc->fc.coef_probs_8x8));
+#if CONFIG_HYBRIDTRANSFORM8X8
+ vpx_memcpy(pc->fc.hybrid_coef_probs_8x8, default_hybrid_coef_probs_8x8,
+ sizeof(pc->fc.hybrid_coef_probs_8x8));
+#endif
-#if CONFIG_TX16X16 || CONFIG_HYBRIDTRANSFORM16X16
- vpx_memcpy(pc->fc.coef_probs_16x16, vp8_default_coef_probs_16x16,
+#if CONFIG_TX16X16
+ vpx_memcpy(pc->fc.coef_probs_16x16, default_coef_probs_16x16,
sizeof(pc->fc.coef_probs_16x16));
+#if CONFIG_HYBRIDTRANSFORM16X16
+ vpx_memcpy(pc->fc.hybrid_coef_probs_16x16,
+ default_hybrid_coef_probs_16x16,
+ sizeof(pc->fc.hybrid_coef_probs_16x16));
#endif
+#endif
}
void vp8_coef_tree_initialize() {
@@ -263,7 +278,8 @@
printf(" {\n");
for (k = 0; k < PREV_COEF_CONTEXTS; ++k) {
printf(" {");
- for (t = 0; t < MAX_ENTROPY_TOKENS; ++t) printf("%d, ", cm->fc.coef_counts[i][j][k][t]);
+ for (t = 0; t < MAX_ENTROPY_TOKENS; ++t)
+ printf("%d, ", cm->fc.coef_counts[i][j][k][t]);
printf("},\n");
}
printf(" },\n");
@@ -280,7 +296,8 @@
printf(" {\n");
for (k = 0; k < PREV_COEF_CONTEXTS; ++k) {
printf(" {");
- for (t = 0; t < MAX_ENTROPY_TOKENS; ++t) printf("%d, ", cm->fc.coef_counts_8x8[i][j][k][t]);
+ for (t = 0; t < MAX_ENTROPY_TOKENS; ++t)
+ printf("%d, ", cm->fc.coef_counts_8x8[i][j][k][t]);
printf("},\n");
}
printf(" },\n");
@@ -288,6 +305,24 @@
printf(" },\n");
}
printf("};\n");
+ printf("static const unsigned int\nhybrid_coef_counts"
+ "[BLOCK_TYPES] [COEF_BANDS]"
+ "[PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS] = {\n");
+ for (i = 0; i < BLOCK_TYPES; ++i) {
+ printf(" {\n");
+ for (j = 0; j < COEF_BANDS; ++j) {
+ printf(" {\n");
+ for (k = 0; k < PREV_COEF_CONTEXTS; ++k) {
+ printf(" {");
+ for (t = 0; t < MAX_ENTROPY_TOKENS; ++t)
+ printf("%d, ", cm->fc.hybrid_coef_counts[i][j][k][t]);
+ printf("},\n");
+ }
+ printf(" },\n");
+ }
+ printf(" },\n");
+ }
+ printf("};\n");
}
#endif
@@ -313,6 +348,30 @@
}
}
+#if CONFIG_HYBRIDTRANSFORM
+ for (i = 0; i < BLOCK_TYPES; ++i)
+ for (j = 0; j < COEF_BANDS; ++j)
+ for (k = 0; k < PREV_COEF_CONTEXTS; ++k) {
+ if (k >= 3 && ((i == 0 && j == 1) || (i > 0 && j == 0)))
+ continue;
+ vp8_tree_probs_from_distribution(
+ MAX_ENTROPY_TOKENS, vp8_coef_encodings, vp8_coef_tree,
+ coef_probs, branch_ct, cm->fc.hybrid_coef_counts [i][j][k],
+ 256, 1);
+ for (t = 0; t < ENTROPY_NODES; ++t) {
+ int prob;
+ count = branch_ct[t][0] + branch_ct[t][1];
+ count = count > count_sat ? count_sat : count;
+ factor = (update_factor * count / count_sat);
+ prob = ((int)cm->fc.pre_hybrid_coef_probs[i][j][k][t] * (256 - factor) +
+ (int)coef_probs[t] * factor + 128) >> 8;
+ if (prob <= 0) cm->fc.hybrid_coef_probs[i][j][k][t] = 1;
+ else if (prob > 255) cm->fc.hybrid_coef_probs[i][j][k][t] = 255;
+ else cm->fc.hybrid_coef_probs[i][j][k][t] = prob;
+ }
+ }
+#endif
+
for (i = 0; i < BLOCK_TYPES_8X8; ++i)
for (j = 0; j < COEF_BANDS; ++j)
for (k = 0; k < PREV_COEF_CONTEXTS; ++k) {
@@ -335,7 +394,32 @@
}
}
-#if CONFIG_TX16X16 || CONFIG_HYBRIDTRANSFORM16X16
+#if CONFIG_HYBRIDTRANSFORM8X8
+ for (i = 0; i < BLOCK_TYPES_8X8; ++i)
+ for (j = 0; j < COEF_BANDS; ++j)
+ for (k = 0; k < PREV_COEF_CONTEXTS; ++k) {
+ if (k >= 3 && ((i == 0 && j == 1) || (i > 0 && j == 0)))
+ continue;
+ vp8_tree_probs_from_distribution(
+ MAX_ENTROPY_TOKENS, vp8_coef_encodings, vp8_coef_tree,
+ coef_probs, branch_ct, cm->fc.hybrid_coef_counts_8x8 [i][j][k],
+ 256, 1);
+ for (t = 0; t < ENTROPY_NODES; ++t) {
+ int prob;
+ count = branch_ct[t][0] + branch_ct[t][1];
+ count = count > count_sat ? count_sat : count;
+ factor = (update_factor * count / count_sat);
+ prob = ((int)cm->fc.pre_hybrid_coef_probs_8x8[i][j][k][t] *
+ (256 - factor) +
+ (int)coef_probs[t] * factor + 128) >> 8;
+ if (prob <= 0) cm->fc.hybrid_coef_probs_8x8[i][j][k][t] = 1;
+ else if (prob > 255) cm->fc.hybrid_coef_probs_8x8[i][j][k][t] = 255;
+ else cm->fc.hybrid_coef_probs_8x8[i][j][k][t] = prob;
+ }
+ }
+#endif
+
+#if CONFIG_TX16X16
for (i = 0; i < BLOCK_TYPES_16X16; ++i)
for (j = 0; j < COEF_BANDS; ++j)
for (k = 0; k < PREV_COEF_CONTEXTS; ++k) {
@@ -349,7 +433,8 @@
count = branch_ct[t][0] + branch_ct[t][1];
count = count > count_sat ? count_sat : count;
factor = (update_factor * count / count_sat);
- prob = ((int)cm->fc.pre_coef_probs_16x16[i][j][k][t] * (256 - factor) +
+ prob = ((int)cm->fc.pre_coef_probs_16x16[i][j][k][t] *
+ (256 - factor) +
(int)coef_probs[t] * factor + 128) >> 8;
if (prob <= 0) cm->fc.coef_probs_16x16[i][j][k][t] = 1;
else if (prob > 255) cm->fc.coef_probs_16x16[i][j][k][t] = 255;
@@ -356,5 +441,28 @@
else cm->fc.coef_probs_16x16[i][j][k][t] = prob;
}
}
+
+#if CONFIG_HYBRIDTRANSFORM16X16
+ for (i = 0; i < BLOCK_TYPES_16X16; ++i)
+ for (j = 0; j < COEF_BANDS; ++j)
+ for (k = 0; k < PREV_COEF_CONTEXTS; ++k) {
+ if (k >= 3 && ((i == 0 && j == 1) || (i > 0 && j == 0)))
+ continue;
+ vp8_tree_probs_from_distribution(
+ MAX_ENTROPY_TOKENS, vp8_coef_encodings, vp8_coef_tree,
+ coef_probs, branch_ct, cm->fc.hybrid_coef_counts_16x16[i][j][k], 256, 1);
+ for (t = 0; t < ENTROPY_NODES; ++t) {
+ int prob;
+ count = branch_ct[t][0] + branch_ct[t][1];
+ count = count > count_sat ? count_sat : count;
+ factor = (update_factor * count / count_sat);
+ prob = ((int)cm->fc.pre_hybrid_coef_probs_16x16[i][j][k][t] * (256 - factor) +
+ (int)coef_probs[t] * factor + 128) >> 8;
+ if (prob <= 0) cm->fc.hybrid_coef_probs_16x16[i][j][k][t] = 1;
+ else if (prob > 255) cm->fc.hybrid_coef_probs_16x16[i][j][k][t] = 255;
+ else cm->fc.hybrid_coef_probs_16x16[i][j][k][t] = prob;
+ }
+ }
+#endif
#endif
}
--- a/vp8/common/entropy.h
+++ b/vp8/common/entropy.h
@@ -21,6 +21,8 @@
//#define SUBMVREF_COUNT 5
//#define VP8_NUMMBSPLITS 4
+extern const int vp8_i8x8_block[4];
+
/* Coefficient token alphabet */
#define ZERO_TOKEN 0 /* 0 Extra Bits 0+0 */
@@ -97,8 +99,6 @@
#define SUBEXP_PARAM 4 /* Subexponential code parameter */
#define MODULUS_PARAM 13 /* Modulus parameter */
-#define COEFUPDATETYPE 1 /* coef update type to use (1/2) */
-
extern DECLARE_ALIGNED(16, const unsigned char, vp8_prev_token_class[MAX_ENTROPY_TOKENS]);
--- a/vp8/common/onyxc_int.h
+++ b/vp8/common/onyxc_int.h
@@ -51,10 +51,20 @@
vp8_prob sub_mv_ref_prob [SUBMVREF_COUNT][VP8_SUBMVREFS - 1];
vp8_prob mbsplit_prob [VP8_NUMMBSPLITS - 1];
vp8_prob coef_probs [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
+#if CONFIG_HYBRIDTRANSFORM
+ vp8_prob hybrid_coef_probs [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
+#endif
vp8_prob coef_probs_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
-#if CONFIG_TX16X16 || CONFIG_HYBRIDTRANSFORM16X16
+#if CONFIG_HYBRIDTRANSFORM8X8
+ vp8_prob hybrid_coef_probs_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
+#endif
+#if CONFIG_TX16X16
vp8_prob coef_probs_16x16 [BLOCK_TYPES_16X16] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
+#if CONFIG_HYBRIDTRANSFORM16X16
+ vp8_prob hybrid_coef_probs_16x16 [BLOCK_TYPES_16X16] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
#endif
+#endif
+
#if CONFIG_NEWMVENTROPY
nmv_context nmvc;
nmv_context pre_nmvc;
@@ -79,20 +89,50 @@
vp8_prob pre_coef_probs [BLOCK_TYPES] [COEF_BANDS]
[PREV_COEF_CONTEXTS] [ENTROPY_NODES];
+#if CONFIG_HYBRIDTRANSFORM
+ vp8_prob pre_hybrid_coef_probs [BLOCK_TYPES] [COEF_BANDS]
+ [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
+#endif
+
vp8_prob pre_coef_probs_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS]
[PREV_COEF_CONTEXTS] [ENTROPY_NODES];
-#if CONFIG_TX16X16 || CONFIG_HYBRIDTRANSFORM16X16
+#if CONFIG_HYBRIDTRANSFORM8X8
+ vp8_prob pre_hybrid_coef_probs_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS]
+ [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
+#endif
+
+#if CONFIG_TX16X16
vp8_prob pre_coef_probs_16x16 [BLOCK_TYPES_16X16] [COEF_BANDS]
[PREV_COEF_CONTEXTS] [ENTROPY_NODES];
+#if CONFIG_HYBRIDTRANSFORM16X16
+ vp8_prob pre_hybrid_coef_probs_16x16 [BLOCK_TYPES_16X16] [COEF_BANDS]
+ [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
#endif
+#endif
+
unsigned int coef_counts [BLOCK_TYPES] [COEF_BANDS]
[PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];
+#if CONFIG_HYBRIDTRANSFORM
+ unsigned int hybrid_coef_counts [BLOCK_TYPES] [COEF_BANDS]
+ [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];
+#endif
+
unsigned int coef_counts_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS]
[PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];
-#if CONFIG_TX16X16 || CONFIG_HYBRIDTRANSFORM16X16
+#if CONFIG_HYBRIDTRANSFORM8X8
+ unsigned int hybrid_coef_counts_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS]
+ [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];
+#endif
+
+#if CONFIG_TX16X16
unsigned int coef_counts_16x16 [BLOCK_TYPES_16X16] [COEF_BANDS]
[PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];
+#if CONFIG_HYBRIDTRANSFORM16X16
+ unsigned int hybrid_coef_counts_16x16 [BLOCK_TYPES_16X16] [COEF_BANDS]
+ [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];
#endif
+#endif
+
#if CONFIG_NEWMVENTROPY
nmv_context_counts NMVcount;
#else
--- a/vp8/decoder/decodframe.c
+++ b/vp8/decoder/decodframe.c
@@ -207,7 +207,6 @@
}
}
-extern const int vp8_i8x8_block[4];
static void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd,
unsigned int mb_col) {
int eobtotal = 0;
@@ -931,6 +930,7 @@
}
+#if 0
static void read_coef_probs2(VP8D_COMP *pbi) {
const vp8_prob grpupd = 192;
int i, j, k, l;
@@ -973,6 +973,7 @@
}
}
}
+#endif
static void read_coef_probs(VP8D_COMP *pbi) {
int i, j, k, l;
@@ -998,7 +999,28 @@
}
}
}
+#if CONFIG_HYBRIDTRANSFORM
+ {
+ if (vp8_read_bit(bc)) {
+ /* read coef probability tree */
+ for (i = 0; i < BLOCK_TYPES; i++)
+ for (j = !i; j < COEF_BANDS; j++)
+ for (k = 0; k < PREV_COEF_CONTEXTS; k++) {
+ if (k >= 3 && ((i == 0 && j == 1) ||
+ (i > 0 && j == 0)))
+ continue;
+ for (l = 0; l < ENTROPY_NODES; l++) {
+ vp8_prob *const p = pc->fc.hybrid_coef_probs [i][j][k] + l;
+ if (vp8_read(bc, COEF_UPDATE_PROB)) {
+ *p = read_prob_diff_update(bc, *p);
+ }
+ }
+ }
+ }
+ }
+#endif
+
if (pbi->common.txfm_mode == ALLOW_8X8 && vp8_read_bit(bc)) {
// read coef probability tree
for (i = 0; i < BLOCK_TYPES_8X8; i++)
@@ -1017,8 +1039,28 @@
}
}
}
+#if CONFIG_HYBRIDTRANSFORM8X8
+ if (pbi->common.txfm_mode == ALLOW_8X8 && vp8_read_bit(bc)) {
+ // read coef probability tree
+ for (i = 0; i < BLOCK_TYPES_8X8; i++)
+ for (j = !i; j < COEF_BANDS; j++)
+ for (k = 0; k < PREV_COEF_CONTEXTS; k++) {
+ if (k >= 3 && ((i == 0 && j == 1) ||
+ (i > 0 && j == 0)))
+ continue;
+ for (l = 0; l < ENTROPY_NODES; l++) {
-#if CONFIG_TX16X16 || CONFIG_HYBRIDTRANSFORM16X16
+ vp8_prob *const p = pc->fc.hybrid_coef_probs_8x8 [i][j][k] + l;
+
+ if (vp8_read(bc, COEF_UPDATE_PROB_8X8)) {
+ *p = read_prob_diff_update(bc, *p);
+ }
+ }
+ }
+ }
+#endif
+
+#if CONFIG_TX16X16
// 16x16
if (vp8_read_bit(bc)) {
// read coef probability tree
@@ -1038,7 +1080,27 @@
}
}
}
+#if CONFIG_HYBRIDTRANSFORM16X16
+ if (vp8_read_bit(bc)) {
+ // read coef probability tree
+ for (i = 0; i < BLOCK_TYPES_16X16; ++i)
+ for (j = !i; j < COEF_BANDS; ++j)
+ for (k = 0; k < PREV_COEF_CONTEXTS; ++k) {
+ if (k >= 3 && ((i == 0 && j == 1) ||
+ (i > 0 && j == 0)))
+ continue;
+ for (l = 0; l < ENTROPY_NODES; ++l) {
+
+ vp8_prob *const p = pc->fc.hybrid_coef_probs_16x16[i][j][k] + l;
+
+ if (vp8_read(bc, COEF_UPDATE_PROB_16X16)) {
+ *p = read_prob_diff_update(bc, *p);
+ }
+ }
+ }
+ }
#endif
+#endif
}
int vp8_decode_frame(VP8D_COMP *pbi) {
@@ -1399,11 +1461,26 @@
fclose(z);
}
- vp8_copy(pbi->common.fc.pre_coef_probs, pbi->common.fc.coef_probs);
- vp8_copy(pbi->common.fc.pre_coef_probs_8x8, pbi->common.fc.coef_probs_8x8);
-#if CONFIG_TX16X16 || CONFIG_HYBRIDTRANSFORM16X16
- vp8_copy(pbi->common.fc.pre_coef_probs_16x16, pbi->common.fc.coef_probs_16x16);
+ vp8_copy(pbi->common.fc.pre_coef_probs,
+ pbi->common.fc.coef_probs);
+#if CONFIG_HYBRIDTRANSFORM
+ vp8_copy(pbi->common.fc.pre_hybrid_coef_probs,
+ pbi->common.fc.hybrid_coef_probs);
#endif
+ vp8_copy(pbi->common.fc.pre_coef_probs_8x8,
+ pbi->common.fc.coef_probs_8x8);
+#if CONFIG_HYBRIDTRANSFORM8X8
+ vp8_copy(pbi->common.fc.pre_hybrid_coef_probs_8x8,
+ pbi->common.fc.hybrid_coef_probs_8x8);
+#endif
+#if CONFIG_TX16X16
+ vp8_copy(pbi->common.fc.pre_coef_probs_16x16,
+ pbi->common.fc.coef_probs_16x16);
+#if CONFIG_HYBRIDTRANSFORM16X16
+ vp8_copy(pbi->common.fc.pre_hybrid_coef_probs_16x16,
+ pbi->common.fc.hybrid_coef_probs_16x16);
+#endif
+#endif
vp8_copy(pbi->common.fc.pre_ymode_prob, pbi->common.fc.ymode_prob);
vp8_copy(pbi->common.fc.pre_uv_mode_prob, pbi->common.fc.uv_mode_prob);
vp8_copy(pbi->common.fc.pre_bmode_prob, pbi->common.fc.bmode_prob);
@@ -1417,10 +1494,19 @@
vp8_copy(pbi->common.fc.pre_mvc_hp, pbi->common.fc.mvc_hp);
#endif
vp8_zero(pbi->common.fc.coef_counts);
+#if CONFIG_HYBRIDTRANSFORM
+ vp8_zero(pbi->common.fc.hybrid_coef_counts);
+#endif
vp8_zero(pbi->common.fc.coef_counts_8x8);
-#if CONFIG_TX16X16 || CONFIG_HYBRIDTRANSFORM16X16
+#if CONFIG_HYBRIDTRANSFORM8X8
+ vp8_zero(pbi->common.fc.hybrid_coef_counts_8x8);
+#endif
+#if CONFIG_TX16X16
vp8_zero(pbi->common.fc.coef_counts_16x16);
+#if CONFIG_HYBRIDTRANSFORM16X16
+ vp8_zero(pbi->common.fc.hybrid_coef_counts_16x16);
#endif
+#endif
vp8_zero(pbi->common.fc.ymode_counts);
vp8_zero(pbi->common.fc.uv_mode_counts);
vp8_zero(pbi->common.fc.bmode_counts);
@@ -1435,11 +1521,8 @@
#endif
vp8_zero(pbi->common.fc.mv_ref_ct);
vp8_zero(pbi->common.fc.mv_ref_ct_a);
-#if COEFUPDATETYPE == 2
- read_coef_probs2(pbi);
-#else
+
read_coef_probs(pbi);
-#endif
vpx_memcpy(&xd->pre, &pc->yv12_fb[pc->lst_fb_idx], sizeof(YV12_BUFFER_CONFIG));
vpx_memcpy(&xd->dst, &pc->yv12_fb[pc->new_fb_idx], sizeof(YV12_BUFFER_CONFIG));
--- a/vp8/decoder/detokenize.c
+++ b/vp8/decoder/detokenize.c
@@ -141,33 +141,26 @@
#if CONFIG_HYBRIDTRANSFORM
void static count_tokens_adaptive_scan(const MACROBLOCKD *xd, INT16 *qcoeff_ptr,
- int block, int type, ENTROPY_CONTEXT *a,
- ENTROPY_CONTEXT *l, int eob, int seg_eob,
+ int block, int type,
+ TX_TYPE tx_type,
+ ENTROPY_CONTEXT *a, ENTROPY_CONTEXT *l,
+ int eob, int seg_eob,
FRAME_CONTEXT *fc) {
int c, pt, token, band;
const int *scan;
- int QIndex = xd->q_index;
- int active_ht = (QIndex < ACTIVE_HT) &&
- (xd->mode_info_context->mbmi.mode == B_PRED) &&
- (type == PLANE_TYPE_Y_WITH_DC);
+ switch(tx_type) {
+ case ADST_DCT :
+ scan = vp8_row_scan;
+ break;
- if(active_ht) {
- switch(xd->block[block].bmi.as_mode.tx_type) {
- case ADST_DCT :
- scan = vp8_row_scan;
- break;
+ case DCT_ADST :
+ scan = vp8_col_scan;
+ break;
- case DCT_ADST :
- scan = vp8_col_scan;
- break;
-
- default :
- scan = vp8_default_zig_zag1d;
- break;
- }
- } else {
- scan = vp8_default_zig_zag1d;
+ default :
+ scan = vp8_default_zig_zag1d;
+ break;
}
VP8_COMBINEENTROPYCONTEXTS(pt, *a, *l);
@@ -176,13 +169,19 @@
int v = qcoeff_ptr[rc];
band = vp8_coef_bands[c];
token = get_token(v);
- fc->coef_counts[type][band][pt][token]++;
+ if (tx_type != DCT_DCT)
+ fc->hybrid_coef_counts[type][band][pt][token]++;
+ else
+ fc->coef_counts[type][band][pt][token]++;
pt = vp8_prev_token_class[token];
}
if (eob < seg_eob) {
band = vp8_coef_bands[c];
- fc->coef_counts[type][band][pt][DCT_EOB_TOKEN]++;
+ if (tx_type != DCT_DCT)
+ fc->hybrid_coef_counts[type][band][pt][DCT_EOB_TOKEN]++;
+ else
+ fc->coef_counts[type][band][pt][DCT_EOB_TOKEN]++;
}
}
#endif
@@ -207,6 +206,9 @@
}
void static count_tokens_8x8(INT16 *qcoeff_ptr, int block, int type,
+#if CONFIG_HYBRIDTRANSFORM8X8
+ TX_TYPE tx_type,
+#endif
ENTROPY_CONTEXT *a, ENTROPY_CONTEXT *l,
int eob, int seg_eob, FRAME_CONTEXT *fc) {
int c, pt, token, band;
@@ -216,17 +218,30 @@
int v = qcoeff_ptr[rc];
band = (type == 1 ? vp8_coef_bands[c] : vp8_coef_bands_8x8[c]);
token = get_token(v);
- fc->coef_counts_8x8[type][band][pt][token]++;
+#if CONFIG_HYBRIDTRANSFORM8X8
+ if (tx_type != DCT_DCT)
+ fc->hybrid_coef_counts_8x8[type][band][pt][token]++;
+ else
+#endif
+ fc->coef_counts_8x8[type][band][pt][token]++;
pt = vp8_prev_token_class[token];
}
if (eob < seg_eob) {
band = (type == 1 ? vp8_coef_bands[c] : vp8_coef_bands_8x8[c]);
- fc->coef_counts_8x8[type][band][pt][DCT_EOB_TOKEN]++;
+#if CONFIG_HYBRIDTRANSFORM8X8
+ if (tx_type != DCT_DCT)
+ fc->hybrid_coef_counts_8x8[type][band][pt][DCT_EOB_TOKEN]++;
+ else
+#endif
+ fc->coef_counts_8x8[type][band][pt][DCT_EOB_TOKEN]++;
}
}
-#if CONFIG_TX16X16 || CONFIG_HYBRIDTRANSFORM16X16
+#if CONFIG_TX16X16
void static count_tokens_16x16(INT16 *qcoeff_ptr, int block, int type,
+#if CONFIG_HYBRIDTRANSFORM16X16
+ TX_TYPE tx_type,
+#endif
ENTROPY_CONTEXT *a, ENTROPY_CONTEXT *l,
int eob, int seg_eob, FRAME_CONTEXT *fc) {
int c, pt, token;
@@ -236,12 +251,22 @@
int v = qcoeff_ptr[rc];
int band = vp8_coef_bands_16x16[c];
token = get_token(v);
- fc->coef_counts_16x16[type][band][pt][token]++;
+#if CONFIG_HYBRIDTRANSFORM16X16
+ if (tx_type != DCT_DCT)
+ fc->hybrid_coef_counts_16x16[type][band][pt][token]++;
+ else
+#endif
+ fc->coef_counts_16x16[type][band][pt][token]++;
pt = vp8_prev_token_class[token];
}
if (eob < seg_eob) {
int band = vp8_coef_bands_16x16[c];
- fc->coef_counts_16x16[type][band][pt][DCT_EOB_TOKEN]++;
+#if CONFIG_HYBRIDTRANSFORM16X16
+ if (tx_type != DCT_DCT)
+ fc->hybrid_coef_counts_16x16[type][band][pt][DCT_EOB_TOKEN]++;
+ else
+#endif
+ fc->coef_counts_16x16[type][band][pt][DCT_EOB_TOKEN]++;
}
}
#endif
@@ -286,6 +311,9 @@
static int vp8_decode_coefs(VP8D_COMP *dx, const MACROBLOCKD *xd,
ENTROPY_CONTEXT *a, ENTROPY_CONTEXT *l, int type,
+#if CONFIG_HYBRIDTRANSFORM8X8 || CONFIG_HYBRIDTRANSFORM || CONFIG_HYBRIDTRANSFORM16X16
+ TX_TYPE tx_type,
+#endif
int seg_eob, INT16 *qcoeff_ptr, int i,
const int *const scan, int block_type,
const int *coef_bands) {
@@ -297,14 +325,26 @@
switch (block_type) {
default:
case TX_4X4:
- coef_probs = fc->coef_probs[type][0][0];
+ coef_probs =
+#if CONFIG_HYBRIDTRANSFORM
+ tx_type != DCT_DCT ? fc->hybrid_coef_probs[type][0][0] :
+#endif
+ fc->coef_probs[type][0][0];
break;
case TX_8X8:
- coef_probs = fc->coef_probs_8x8[type][0][0];
+ coef_probs =
+#if CONFIG_HYBRIDTRANSFORM8X8
+ tx_type != DCT_DCT ? fc->hybrid_coef_probs_8x8[type][0][0] :
+#endif
+ fc->coef_probs_8x8[type][0][0];
break;
-#if CONFIG_TX16X16 || CONFIG_HYBRIDTRANSFORM16X16
+#if CONFIG_TX16X16
case TX_16X16:
- coef_probs = fc->coef_probs_16x16[type][0][0];
+ coef_probs =
+#if CONFIG_HYBRIDTRANSFORM16X16
+ tx_type != DCT_DCT ? fc->hybrid_coef_probs_16x16[type][0][0] :
+#endif
+ fc->coef_probs_16x16[type][0][0];
break;
#endif
}
@@ -391,17 +431,28 @@
if (block_type == TX_4X4) {
#if CONFIG_HYBRIDTRANSFORM
- count_tokens_adaptive_scan(xd, qcoeff_ptr, i, type, a, l, c, seg_eob, fc);
+ count_tokens_adaptive_scan(xd, qcoeff_ptr, i, type,
+ tx_type,
+ a, l, c, seg_eob, fc);
#else
- count_tokens(qcoeff_ptr, i, type, a, l, c, seg_eob, fc);
+ count_tokens(qcoeff_ptr, i, type,
+ a, l, c, seg_eob, fc);
#endif
}
else if (block_type == TX_8X8)
- count_tokens_8x8(qcoeff_ptr, i, type, a, l, c, seg_eob, fc);
-#if CONFIG_TX16X16 || CONFIG_HYBRIDTRANSFORM16X16
+ count_tokens_8x8(qcoeff_ptr, i, type,
+#if CONFIG_HYBRIDTRANSFORM8X8
+ tx_type,
+#endif
+ a, l, c, seg_eob, fc);
+#if CONFIG_TX16X16
else
- count_tokens_16x16(qcoeff_ptr, i, type, a, l, c, seg_eob, fc);
+ count_tokens_16x16(qcoeff_ptr, i, type,
+#if CONFIG_HYBRIDTRANSFORM16X16
+ tx_type,
#endif
+ a, l, c, seg_eob, fc);
+#endif
return c;
}
@@ -415,6 +466,12 @@
const int segment_id = xd->mode_info_context->mbmi.segment_id;
const int seg_active = segfeature_active(xd, segment_id, SEG_LVL_EOB);
INT16 *qcoeff_ptr = &xd->qcoeff[0];
+#if CONFIG_HYBRIDTRANSFORM8X8 || CONFIG_HYBRIDTRANSFORM || CONFIG_HYBRIDTRANSFORM16X16
+ TX_TYPE tx_type = DCT_DCT;
+#endif
+#if CONFIG_HYBRIDTRANSFORM16X16
+ tx_type = get_tx_type(xd, &xd->block[0]);
+#endif
type = PLANE_TYPE_Y_WITH_DC;
@@ -426,7 +483,12 @@
// Luma block
{
const int* const scan = vp8_default_zig_zag1d_16x16;
- c = vp8_decode_coefs(pbi, xd, A, L, type, seg_eob, qcoeff_ptr,
+ //printf("16: %d\n", tx_type);
+ c = vp8_decode_coefs(pbi, xd, A, L, type,
+#if CONFIG_HYBRIDTRANSFORM8X8 || CONFIG_HYBRIDTRANSFORM || CONFIG_HYBRIDTRANSFORM16X16
+ tx_type,
+#endif
+ seg_eob, qcoeff_ptr,
0, scan, TX_16X16, coef_bands_x_16x16);
eobs[0] = c;
*A = *L = (c != !type);
@@ -440,6 +502,9 @@
// 8x8 chroma blocks
qcoeff_ptr += 256;
type = PLANE_TYPE_UV;
+#if CONFIG_HYBRIDTRANSFORM8X8 || CONFIG_HYBRIDTRANSFORM || CONFIG_HYBRIDTRANSFORM16X16
+ tx_type = DCT_DCT;
+#endif
if (seg_active)
seg_eob = get_segdata(xd, segment_id, SEG_LVL_EOB);
else
@@ -449,7 +514,12 @@
ENTROPY_CONTEXT* const l = L + vp8_block2left_8x8[i];
const int* const scan = vp8_default_zig_zag1d_8x8;
- c = vp8_decode_coefs(pbi, xd, a, l, type, seg_eob, qcoeff_ptr,
+ //printf("8: %d\n", tx_type);
+ c = vp8_decode_coefs(pbi, xd, a, l, type,
+#if CONFIG_HYBRIDTRANSFORM8X8 || CONFIG_HYBRIDTRANSFORM || CONFIG_HYBRIDTRANSFORM16X16
+ tx_type,
+#endif
+ seg_eob, qcoeff_ptr,
i, scan, TX_8X8, coef_bands_x_8x8);
a[0] = l[0] = ((eobs[i] = c) != !type);
a[1] = a[0];
@@ -474,6 +544,9 @@
const int segment_id = xd->mode_info_context->mbmi.segment_id;
const int seg_active = segfeature_active(xd, segment_id, SEG_LVL_EOB);
INT16 *qcoeff_ptr = &xd->qcoeff[0];
+#if CONFIG_HYBRIDTRANSFORM8X8 || CONFIG_HYBRIDTRANSFORM || CONFIG_HYBRIDTRANSFORM16X16
+ TX_TYPE tx_type = DCT_DCT;
+#endif
#if CONFIG_HYBRIDTRANSFORM8X8
int bufthred = (xd->mode_info_context->mbmi.mode == I8X8_PRED) ? 16 : 24;
@@ -493,7 +566,11 @@
seg_eob = get_segdata(xd, segment_id, SEG_LVL_EOB);
else
seg_eob = 4;
- c = vp8_decode_coefs(pbi, xd, a, l, type, seg_eob, qcoeff_ptr + 24 * 16,
+ c = vp8_decode_coefs(pbi, xd, a, l, type,
+#if CONFIG_HYBRIDTRANSFORM8X8 || CONFIG_HYBRIDTRANSFORM || CONFIG_HYBRIDTRANSFORM16X16
+ tx_type,
+#endif
+ seg_eob, qcoeff_ptr + 24 * 16,
24, scan, TX_8X8, coef_bands_x);
a[0] = l[0] = ((eobs[24] = c) != !type);
@@ -516,11 +593,25 @@
ENTROPY_CONTEXT *const a = A + vp8_block2above_8x8[i];
ENTROPY_CONTEXT *const l = L + vp8_block2left_8x8[i];
const int *const scan = vp8_default_zig_zag1d_8x8;
+#if CONFIG_HYBRIDTRANSFORM8X8 || CONFIG_HYBRIDTRANSFORM || CONFIG_HYBRIDTRANSFORM16X16
+ tx_type = DCT_DCT;
+#endif
if (i == 16)
type = PLANE_TYPE_UV;
+#if CONFIG_HYBRIDTRANSFORM8X8
+ if (type == PLANE_TYPE_Y_WITH_DC &&
+ xd->mode_info_context->mbmi.mode == I8X8_PRED) {
+ tx_type = get_tx_type(xd, xd->block + i);
+ }
+#endif
- c = vp8_decode_coefs(pbi, xd, a, l, type, seg_eob, qcoeff_ptr,
+ //printf("8: %d\n", tx_type);
+ c = vp8_decode_coefs(pbi, xd, a, l, type,
+#if CONFIG_HYBRIDTRANSFORM8X8 || CONFIG_HYBRIDTRANSFORM || CONFIG_HYBRIDTRANSFORM16X16
+ tx_type,
+#endif
+ seg_eob, qcoeff_ptr,
i, scan, TX_8X8, coef_bands_x_8x8);
a[0] = l[0] = ((eobs[i] = c) != !type);
a[1] = a[0];
@@ -533,6 +624,7 @@
#if CONFIG_HYBRIDTRANSFORM8X8
if (xd->mode_info_context->mbmi.mode == I8X8_PRED) {
type = PLANE_TYPE_UV;
+ tx_type = DCT_DCT;
seg_eob = 16;
// use 4x4 transform for U, V components in I8X8 prediction mode
@@ -541,7 +633,11 @@
ENTROPY_CONTEXT *const l = L + vp8_block2left[i];
const int *scan = vp8_default_zig_zag1d;
- c = vp8_decode_coefs(pbi, xd, a, l, type, seg_eob, qcoeff_ptr,
+ c = vp8_decode_coefs(pbi, xd, a, l, type,
+#if CONFIG_HYBRIDTRANSFORM8X8 || CONFIG_HYBRIDTRANSFORM || CONFIG_HYBRIDTRANSFORM16X16
+ tx_type,
+#endif
+ seg_eob, qcoeff_ptr,
i, scan, TX_4X4, coef_bands_x);
a[0] = l[0] = ((eobs[i] = c) != !type);
@@ -560,14 +656,7 @@
ENTROPY_CONTEXT *const L = (ENTROPY_CONTEXT *)xd->left_context;
char *const eobs = xd->eobs;
-#if CONFIG_HYBRIDTRANSFORM
const int *scan = vp8_default_zig_zag1d;
- int QIndex = xd->q_index;
- int active_ht = (QIndex < ACTIVE_HT) &&
- (xd->mode_info_context->mbmi.mode == B_PRED);
-#else
- const int *const scan = vp8_default_zig_zag1d;
-#endif
int c, i, type, eobtotal = 0, seg_eob = 16;
INT16 *qcoeff_ptr = &xd->qcoeff[0];
@@ -583,7 +672,11 @@
ENTROPY_CONTEXT *const l = L + vp8_block2left[24];
type = PLANE_TYPE_Y2;
- c = vp8_decode_coefs(dx, xd, a, l, type, seg_eob, qcoeff_ptr + 24 * 16, 24,
+ c = vp8_decode_coefs(dx, xd, a, l, type,
+#if CONFIG_HYBRIDTRANSFORM8X8 || CONFIG_HYBRIDTRANSFORM || CONFIG_HYBRIDTRANSFORM16X16
+ DCT_DCT,
+#endif
+ seg_eob, qcoeff_ptr + 24 * 16, 24,
scan, TX_4X4, coef_bands_x);
a[0] = l[0] = ((eobs[24] = c) != !type);
eobtotal += c - 16;
@@ -596,45 +689,37 @@
for (i = 0; i < 24; ++i) {
ENTROPY_CONTEXT *const a = A + vp8_block2above[i];
ENTROPY_CONTEXT *const l = L + vp8_block2left[i];
+#if CONFIG_HYBRIDTRANSFORM8X8 || CONFIG_HYBRIDTRANSFORM || CONFIG_HYBRIDTRANSFORM16X16
+ TX_TYPE tx_type = DCT_DCT;
+#endif
if (i == 16)
type = PLANE_TYPE_UV;
#if CONFIG_HYBRIDTRANSFORM
- if (type == PLANE_TYPE_Y_WITH_DC &&
- xd->mode_info_context->mbmi.mode == B_PRED &&
- active_ht) {
- BLOCKD *b = &xd->block[i];
- switch(b->bmi.as_mode.first) {
- case B_TM_PRED :
- case B_RD_PRED :
- b->bmi.as_mode.tx_type = ADST_ADST;
- scan = vp8_default_zig_zag1d;
- break;
+ if (type == PLANE_TYPE_Y_WITH_DC)
+ tx_type = get_tx_type(xd, &xd->block[i]);
+#endif
+#if CONFIG_HYBRIDTRANSFORM
+ switch(tx_type) {
+ case ADST_DCT :
+ scan = vp8_row_scan;
+ break;
- case B_VE_PRED :
- case B_VR_PRED :
- b->bmi.as_mode.tx_type = ADST_DCT;
- scan = vp8_row_scan;
- break ;
+ case DCT_ADST :
+ scan = vp8_col_scan;
+ break;
- case B_HE_PRED :
- case B_HD_PRED :
- case B_HU_PRED :
- b->bmi.as_mode.tx_type = DCT_ADST;
- scan = vp8_col_scan;
- break;
-
- default :
- b->bmi.as_mode.tx_type = DCT_DCT;
- scan = vp8_default_zig_zag1d;
- break;
- }
+ default :
+ scan = vp8_default_zig_zag1d;
+ break;
}
- if (type == PLANE_TYPE_UV) {
- scan = vp8_default_zig_zag1d;
- }
#endif
- c = vp8_decode_coefs(dx, xd, a, l, type, seg_eob, qcoeff_ptr,
+
+ c = vp8_decode_coefs(dx, xd, a, l, type,
+#if CONFIG_HYBRIDTRANSFORM8X8 || CONFIG_HYBRIDTRANSFORM || CONFIG_HYBRIDTRANSFORM16X16
+ tx_type,
+#endif
+ seg_eob, qcoeff_ptr,
i, scan, TX_4X4, coef_bands_x);
a[0] = l[0] = ((eobs[i] = c) != !type);
--- a/vp8/encoder/bitstream.c
+++ b/vp8/encoder/bitstream.c
@@ -45,16 +45,34 @@
[COEF_BANDS]
[PREV_COEF_CONTEXTS]
[ENTROPY_NODES][2];
+#if CONFIG_HYBRIDTRANSFORM
+unsigned int hybrid_tree_update_hist [BLOCK_TYPES]
+ [COEF_BANDS]
+ [PREV_COEF_CONTEXTS]
+ [ENTROPY_NODES][2];
+#endif
unsigned int tree_update_hist_8x8 [BLOCK_TYPES_8X8]
[COEF_BANDS]
[PREV_COEF_CONTEXTS]
[ENTROPY_NODES] [2];
-#if CONFIG_TX16X16 || CONFIG_HYBRIDTRANSFORM16X16
+#if CONFIG_HYBRIDTRANSFORM8X8
+unsigned int hybrid_tree_update_hist_8x8 [BLOCK_TYPES_8X8]
+ [COEF_BANDS]
+ [PREV_COEF_CONTEXTS]
+ [ENTROPY_NODES] [2];
+#endif
+#if CONFIG_TX16X16
unsigned int tree_update_hist_16x16 [BLOCK_TYPES_16X16]
[COEF_BANDS]
[PREV_COEF_CONTEXTS]
[ENTROPY_NODES] [2];
+#if CONFIG_HYBRIDTRANSFORM16X16
+unsigned int hybrid_tree_update_hist_16x16 [BLOCK_TYPES_16X16]
+ [COEF_BANDS]
+ [PREV_COEF_CONTEXTS]
+ [ENTROPY_NODES] [2];
#endif
+#endif
extern unsigned int active_section;
#endif
@@ -1522,6 +1540,28 @@
}
}
}
+#if CONFIG_HYBRIDTRANSFORM
+ for (i = 0; i < BLOCK_TYPES; ++i) {
+ for (j = 0; j < COEF_BANDS; ++j) {
+ for (k = 0; k < PREV_COEF_CONTEXTS; ++k) {
+ if (k >= 3 && ((i == 0 && j == 1) || (i > 0 && j == 0)))
+ continue;
+ vp8_tree_probs_from_distribution(
+ MAX_ENTROPY_TOKENS, vp8_coef_encodings, vp8_coef_tree,
+ cpi->frame_hybrid_coef_probs [i][j][k],
+ cpi->frame_hybrid_branch_ct [i][j][k],
+ cpi->hybrid_coef_counts [i][j][k],
+ 256, 1
+ );
+#ifdef ENTROPY_STATS
+ if (!cpi->dummy_packing)
+ for (t = 0; t < MAX_ENTROPY_TOKENS; ++t)
+ hybrid_context_counters[i][j][k][t] += cpi->hybrid_coef_counts[i][j][k][t];
+#endif
+ }
+ }
+ }
+#endif
if (cpi->common.txfm_mode == ALLOW_8X8) {
@@ -1549,9 +1589,35 @@
}
}
}
+#if CONFIG_HYBRIDTRANSFORM8X8
+ for (i = 0; i < BLOCK_TYPES_8X8; ++i) {
+ for (j = 0; j < COEF_BANDS; ++j) {
+ for (k = 0; k < PREV_COEF_CONTEXTS; ++k) {
+ /* at every context */
+ /* calc probs and branch cts for this frame only */
+ // vp8_prob new_p [ENTROPY_NODES];
+ // unsigned int branch_ct [ENTROPY_NODES] [2];
+ if (k >= 3 && ((i == 0 && j == 1) || (i > 0 && j == 0)))
+ continue;
+ vp8_tree_probs_from_distribution(
+ MAX_ENTROPY_TOKENS, vp8_coef_encodings, vp8_coef_tree,
+ cpi->frame_hybrid_coef_probs_8x8 [i][j][k],
+ cpi->frame_hybrid_branch_ct_8x8 [i][j][k],
+ cpi->hybrid_coef_counts_8x8 [i][j][k],
+ 256, 1
+ );
+#ifdef ENTROPY_STATS
+ if (!cpi->dummy_packing)
+ for (t = 0; t < MAX_ENTROPY_TOKENS; ++t)
+ hybrid_context_counters_8x8[i][j][k][t] += cpi->hybrid_coef_counts_8x8[i][j][k][t];
+#endif
+ }
+ }
+ }
+#endif
}
-#if CONFIG_TX16X16 || CONFIG_HYBRIDTRANSFORM16X16
+#if CONFIG_TX16X16
//16x16
for (i = 0; i < BLOCK_TYPES_16X16; ++i) {
for (j = 0; j < COEF_BANDS; ++j) {
@@ -1571,9 +1637,30 @@
}
}
}
+#if CONFIG_HYBRIDTRANSFORM16X16
+ for (i = 0; i < BLOCK_TYPES_16X16; ++i) {
+ for (j = 0; j < COEF_BANDS; ++j) {
+ for (k = 0; k < PREV_COEF_CONTEXTS; ++k) {
+ if (k >= 3 && ((i == 0 && j == 1) || (i > 0 && j == 0)))
+ continue;
+ vp8_tree_probs_from_distribution(
+ MAX_ENTROPY_TOKENS, vp8_coef_encodings, vp8_coef_tree,
+ cpi->frame_hybrid_coef_probs_16x16[i][j][k],
+ cpi->frame_hybrid_branch_ct_16x16[i][j][k],
+ cpi->hybrid_coef_counts_16x16[i][j][k], 256, 1);
+#ifdef ENTROPY_STATS
+ if (!cpi->dummy_packing)
+ for (t = 0; t < MAX_ENTROPY_TOKENS; ++t)
+ hybrid_context_counters_16x16[i][j][k][t] += cpi->hybrid_coef_counts_16x16[i][j][k][t];
#endif
+ }
+ }
+ }
+#endif
+#endif
}
+#if 0
static void update_coef_probs2(VP8_COMP *cpi) {
const vp8_prob grpupd = 192;
int i, j, k, t;
@@ -1741,6 +1828,7 @@
}
}
}
+#endif
static void update_coef_probs(VP8_COMP *cpi) {
int i, j, k, t;
@@ -1844,7 +1932,97 @@
}
}
+#if CONFIG_HYBRIDTRANSFORM
+ savings = 0;
+ update[0] = update[1] = 0;
+ for (i = 0; i < BLOCK_TYPES; ++i) {
+ for (j = !i; j < COEF_BANDS; ++j) {
+ int prev_coef_savings[ENTROPY_NODES] = {0};
+ for (k = 0; k < PREV_COEF_CONTEXTS; ++k) {
+ for (t = 0; t < ENTROPY_NODES; ++t) {
+ vp8_prob newp = cpi->frame_hybrid_coef_probs [i][j][k][t];
+ vp8_prob *Pold = cpi->common.fc.hybrid_coef_probs [i][j][k] + t;
+ const vp8_prob upd = COEF_UPDATE_PROB;
+ int s = prev_coef_savings[t];
+ int u = 0;
+ if (k >= 3 && ((i == 0 && j == 1) || (i > 0 && j == 0)))
+ continue;
+#if defined(SEARCH_NEWP)
+ s = prob_diff_update_savings_search(
+ cpi->frame_hybrid_branch_ct [i][j][k][t],
+ *Pold, &newp, upd);
+ if (s > 0 && newp != *Pold)
+ u = 1;
+ if (u)
+ savings += s - (int)(vp8_cost_zero(upd));
+ else
+ savings -= (int)(vp8_cost_zero(upd));
+#else
+ s = prob_update_savings(
+ cpi->frame_hybrid_branch_ct [i][j][k][t],
+ *Pold, newp, upd);
+ if (s > 0)
+ u = 1;
+ if (u)
+ savings += s;
+#endif
+ update[u]++;
+ }
+ }
+ }
+ }
+
+ // printf("Update %d %d, savings %d\n", update[0], update[1], savings);
+ /* Is coef updated at all */
+ if (update[1] == 0 || savings < 0)
+ vp8_write_bit(w, 0);
+ else {
+ vp8_write_bit(w, 1);
+ for (i = 0; i < BLOCK_TYPES; ++i) {
+ for (j = !i; j < COEF_BANDS; ++j) {
+ int prev_coef_savings[ENTROPY_NODES] = {0};
+ for (k = 0; k < PREV_COEF_CONTEXTS; ++k) {
+ // calc probs and branch cts for this frame only
+ for (t = 0; t < ENTROPY_NODES; ++t) {
+ vp8_prob newp = cpi->frame_hybrid_coef_probs [i][j][k][t];
+ vp8_prob *Pold = cpi->common.fc.hybrid_coef_probs [i][j][k] + t;
+ const vp8_prob upd = COEF_UPDATE_PROB;
+ int s = prev_coef_savings[t];
+ int u = 0;
+ if (k >= 3 && ((i == 0 && j == 1) || (i > 0 && j == 0)))
+ continue;
+
+#if defined(SEARCH_NEWP)
+ s = prob_diff_update_savings_search(
+ cpi->frame_hybrid_branch_ct [i][j][k][t],
+ *Pold, &newp, upd);
+ if (s > 0 && newp != *Pold)
+ u = 1;
+#else
+ s = prob_update_savings(
+ cpi->frame_hybrid_branch_ct [i][j][k][t],
+ *Pold, newp, upd);
+ if (s > 0)
+ u = 1;
+#endif
+ vp8_write(w, u, upd);
+#ifdef ENTROPY_STATS
+ if (!cpi->dummy_packing)
+ ++ hybrid_tree_update_hist [i][j][k][t] [u];
+#endif
+ if (u) {
+ /* send/use new probability */
+ write_prob_diff_update(w, newp, *Pold);
+ *Pold = newp;
+ }
+ }
+ }
+ }
+ }
+ }
+#endif
+
/* do not do this if not even allowed */
if (cpi->common.txfm_mode == ALLOW_8X8) {
/* dry run to see if update is necessary */
@@ -1921,9 +2099,84 @@
}
}
}
+#if CONFIG_HYBRIDTRANSFORM8X8
+ update[0] = update[1] = 0;
+ savings = 0;
+ for (i = 0; i < BLOCK_TYPES_8X8; ++i) {
+ for (j = !i; j < COEF_BANDS; ++j) {
+ for (k = 0; k < PREV_COEF_CONTEXTS; ++k) {
+ // calc probs and branch cts for this frame only
+ for (t = 0; t < ENTROPY_NODES; ++t) {
+ const unsigned int *ct = cpi->frame_hybrid_branch_ct_8x8 [i][j][k][t];
+ vp8_prob newp = cpi->frame_hybrid_coef_probs_8x8 [i][j][k][t];
+ vp8_prob *Pold = cpi->common.fc.hybrid_coef_probs_8x8 [i][j][k] + t;
+ const vp8_prob oldp = *Pold;
+ int s, u;
+ const vp8_prob upd = COEF_UPDATE_PROB_8X8;
+ if (k >= 3 && ((i == 0 && j == 1) || (i > 0 && j == 0)))
+ continue;
+#if defined(SEARCH_NEWP)
+ s = prob_diff_update_savings_search(ct, oldp, &newp, upd);
+ u = s > 0 && newp != oldp ? 1 : 0;
+ if (u)
+ savings += s - (int)(vp8_cost_zero(upd));
+ else
+ savings -= (int)(vp8_cost_zero(upd));
+#else
+ s = prob_update_savings(ct, oldp, newp, upd);
+ u = s > 0 ? 1 : 0;
+ if (u)
+ savings += s;
+#endif
+ update[u]++;
+ }
+ }
+ }
+ }
+
+ if (update[1] == 0 || savings < 0)
+ vp8_write_bit(w, 0);
+ else {
+ vp8_write_bit(w, 1);
+ for (i = 0; i < BLOCK_TYPES_8X8; ++i) {
+ for (j = !i; j < COEF_BANDS; ++j) {
+ for (k = 0; k < PREV_COEF_CONTEXTS; ++k) {
+ for (t = 0; t < ENTROPY_NODES; ++t) {
+ const unsigned int *ct = cpi->frame_hybrid_branch_ct_8x8 [i][j][k][t];
+ vp8_prob newp = cpi->frame_hybrid_coef_probs_8x8 [i][j][k][t];
+ vp8_prob *Pold = cpi->common.fc.hybrid_coef_probs_8x8 [i][j][k] + t;
+ const vp8_prob oldp = *Pold;
+ const vp8_prob upd = COEF_UPDATE_PROB_8X8;
+ int s, u;
+ if (k >= 3 && ((i == 0 && j == 1) ||
+ (i > 0 && j == 0)))
+ continue;
+#if defined(SEARCH_NEWP)
+ s = prob_diff_update_savings_search(ct, oldp, &newp, upd);
+ u = s > 0 && newp != oldp ? 1 : 0;
+#else
+ s = prob_update_savings(ct, oldp, newp, upd);
+ u = s > 0 ? 1 : 0;
+#endif
+ vp8_write(w, u, upd);
+#ifdef ENTROPY_STATS
+ if (!cpi->dummy_packing)
+ ++ hybrid_tree_update_hist_8x8 [i][j][k][t] [u];
+#endif
+ if (u) {
+ /* send/use new probability */
+ write_prob_diff_update(w, newp, oldp);
+ *Pold = newp;
+ }
+ }
+ }
+ }
+ }
+ }
+#endif
}
-#if CONFIG_TX16X16 || CONFIG_HYBRIDTRANSFORM16X16
+#if CONFIG_TX16X16
// 16x16
/* dry run to see if update is necessary */
update[0] = update[1] = 0;
@@ -1999,7 +2252,82 @@
}
}
}
+#if CONFIG_HYBRIDTRANSFORM16X16
+ update[0] = update[1] = 0;
+ savings = 0;
+ for (i = 0; i < BLOCK_TYPES_16X16; ++i) {
+ for (j = !i; j < COEF_BANDS; ++j) {
+ for (k = 0; k < PREV_COEF_CONTEXTS; ++k) {
+ // calc probs and branch cts for this frame only
+ for (t = 0; t < ENTROPY_NODES; ++t) {
+ const unsigned int *ct = cpi->frame_hybrid_branch_ct_16x16[i][j][k][t];
+ vp8_prob newp = cpi->frame_hybrid_coef_probs_16x16[i][j][k][t];
+ vp8_prob *Pold = cpi->common.fc.hybrid_coef_probs_16x16[i][j][k] + t;
+ const vp8_prob oldp = *Pold;
+ int s, u;
+ const vp8_prob upd = COEF_UPDATE_PROB_16X16;
+ if (k >= 3 && ((i == 0 && j == 1) || (i > 0 && j == 0)))
+ continue;
+#if defined(SEARCH_NEWP)
+ s = prob_diff_update_savings_search(ct, oldp, &newp, upd);
+ u = s > 0 && newp != oldp ? 1 : 0;
+ if (u)
+ savings += s - (int)(vp8_cost_zero(upd));
+ else
+ savings -= (int)(vp8_cost_zero(upd));
+#else
+ s = prob_update_savings(ct, oldp, newp, upd);
+ u = s > 0 ? 1 : 0;
+ if (u)
+ savings += s;
#endif
+ update[u]++;
+ }
+ }
+ }
+ }
+
+ if (update[1] == 0 || savings < 0)
+ vp8_write_bit(w, 0);
+ else {
+ vp8_write_bit(w, 1);
+ for (i = 0; i < BLOCK_TYPES_16X16; ++i) {
+ for (j = !i; j < COEF_BANDS; ++j) {
+ for (k = 0; k < PREV_COEF_CONTEXTS; ++k) {
+ for (t = 0; t < ENTROPY_NODES; ++t) {
+ const unsigned int *ct = cpi->frame_hybrid_branch_ct_16x16[i][j][k][t];
+ vp8_prob newp = cpi->frame_hybrid_coef_probs_16x16[i][j][k][t];
+ vp8_prob *Pold = cpi->common.fc.hybrid_coef_probs_16x16[i][j][k] + t;
+ const vp8_prob oldp = *Pold;
+ const vp8_prob upd = COEF_UPDATE_PROB_16X16;
+ int s, u;
+ if (k >= 3 && ((i == 0 && j == 1) ||
+ (i > 0 && j == 0)))
+ continue;
+#if defined(SEARCH_NEWP)
+ s = prob_diff_update_savings_search(ct, oldp, &newp, upd);
+ u = s > 0 && newp != oldp ? 1 : 0;
+#else
+ s = prob_update_savings(ct, oldp, newp, upd);
+ u = s > 0 ? 1 : 0;
+#endif
+ vp8_write(w, u, upd);
+#ifdef ENTROPY_STATS
+ if (!cpi->dummy_packing)
+ ++hybrid_tree_update_hist_16x16[i][j][k][t][u];
+#endif
+ if (u) {
+ /* send/use new probability */
+ write_prob_diff_update(w, newp, oldp);
+ *Pold = newp;
+ }
+ }
+ }
+ }
+ }
+ }
+#endif
+#endif
}
#ifdef PACKET_TESTING
@@ -2432,10 +2760,19 @@
vp8_clear_system_state(); // __asm emms;
vp8_copy(cpi->common.fc.pre_coef_probs, cpi->common.fc.coef_probs);
+#if CONFIG_HYBRIDTRANSFORM
+ vp8_copy(cpi->common.fc.pre_hybrid_coef_probs, cpi->common.fc.hybrid_coef_probs);
+#endif
vp8_copy(cpi->common.fc.pre_coef_probs_8x8, cpi->common.fc.coef_probs_8x8);
-#if CONFIG_TX16X16 || CONFIG_HYBRIDTRANSFORM16X16
+#if CONFIG_HYBRIDTRANSFORM8X8
+ vp8_copy(cpi->common.fc.pre_hybrid_coef_probs_8x8, cpi->common.fc.hybrid_coef_probs_8x8);
+#endif
+#if CONFIG_TX16X16
vp8_copy(cpi->common.fc.pre_coef_probs_16x16, cpi->common.fc.coef_probs_16x16);
+#if CONFIG_HYBRIDTRANSFORM16X16
+ vp8_copy(cpi->common.fc.pre_hybrid_coef_probs_16x16, cpi->common.fc.hybrid_coef_probs_16x16);
#endif
+#endif
vp8_copy(cpi->common.fc.pre_ymode_prob, cpi->common.fc.ymode_prob);
vp8_copy(cpi->common.fc.pre_uv_mode_prob, cpi->common.fc.uv_mode_prob);
vp8_copy(cpi->common.fc.pre_bmode_prob, cpi->common.fc.bmode_prob);
@@ -2452,11 +2789,8 @@
vp8_zero(cpi->mbsplit_count);
vp8_zero(cpi->common.fc.mv_ref_ct)
vp8_zero(cpi->common.fc.mv_ref_ct_a)
-#if COEFUPDATETYPE == 2
- update_coef_probs2(cpi);
-#else
+
update_coef_probs(cpi);
-#endif
#ifdef ENTROPY_STATS
active_section = 2;
--- a/vp8/encoder/block.h
+++ b/vp8/encoder/block.h
@@ -167,6 +167,10 @@
unsigned int token_costs[TX_SIZE_MAX][BLOCK_TYPES][COEF_BANDS]
[PREV_COEF_CONTEXTS][MAX_ENTROPY_TOKENS];
+#if CONFIG_HYBRIDTRANSFORM || CONFIG_HYBRIDTRANSFORM8X8 || CONFIG_HYBRIDTRANSFORM16X16
+ unsigned int hybrid_token_costs[TX_SIZE_MAX][BLOCK_TYPES][COEF_BANDS]
+ [PREV_COEF_CONTEXTS][MAX_ENTROPY_TOKENS];
+#endif
int optimize;
int q_index;
--- a/vp8/encoder/dct.c
+++ b/vp8/encoder/dct.c
@@ -478,10 +478,11 @@
pfa[i] += pfb[k] * pth[k];
}
pth += tx_dim;
- }
+ }
pfa += tx_dim;
pfb += tx_dim;
+ // pth -= tx_dim * tx_dim;
switch(tx_type) {
case ADST_ADST :
--- a/vp8/encoder/encodeframe.c
+++ b/vp8/encoder/encodeframe.c
@@ -1297,6 +1297,8 @@
TOKENEXTRA *tp = cpi->tok;
int totalrate;
+ //printf("encode_frame_internal\n");
+
// Compute a modified set of reference frame probabilities to use when
// prediction fails. These are based on the current general estimates for
// this frame which may be updated with each iteration of the recode loop.
@@ -1360,9 +1362,18 @@
vp8_zero(cpi->MVcount_hp);
#endif
vp8_zero(cpi->coef_counts);
+#if CONFIG_HYBRIDTRANSFORM
+ vp8_zero(cpi->hybrid_coef_counts);
+#endif
vp8_zero(cpi->coef_counts_8x8);
-#if CONFIG_TX16X16 || CONFIG_HYBRIDTRANSFORM16X16
+#if CONFIG_HYBRIDTRANSFORM8X8
+ vp8_zero(cpi->hybrid_coef_counts_8x8);
+#endif
+#if CONFIG_TX16X16
vp8_zero(cpi->coef_counts_16x16);
+#if CONFIG_HYBRIDTRANSFORM16X16
+ vp8_zero(cpi->hybrid_coef_counts_16x16);
+#endif
#endif
vp8cx_frame_init_quantizer(cpi);
--- a/vp8/encoder/encodeintra.c
+++ b/vp8/encoder/encodeintra.c
@@ -85,21 +85,21 @@
ENCODEMB_INVOKE(&rtcd->encodemb, subb)(be, b, 16);
#if CONFIG_HYBRIDTRANSFORM
- if(active_ht) {
- b->bmi.as_mode.test = b->bmi.as_mode.first;
- txfm_map(b, b->bmi.as_mode.first);
- vp8_fht_c(be->src_diff, be->coeff, 32, b->bmi.as_mode.tx_type, 4);
- vp8_ht_quantize_b(be, b);
- vp8_inverse_htransform_b(IF_RTCD(&rtcd->common->idct), b, 32) ;
- } else {
- x->vp8_short_fdct4x4(be->src_diff, be->coeff, 32) ;
- x->quantize_b(be, b) ;
- vp8_inverse_transform_b(IF_RTCD(&rtcd->common->idct), b, 32) ;
- }
+ if (active_ht) {
+ b->bmi.as_mode.test = b->bmi.as_mode.first;
+ txfm_map(b, b->bmi.as_mode.first);
+ vp8_fht_c(be->src_diff, be->coeff, 32, b->bmi.as_mode.tx_type, 4);
+ vp8_ht_quantize_b(be, b);
+ vp8_inverse_htransform_b(IF_RTCD(&rtcd->common->idct), b, 32) ;
+ } else {
+ x->vp8_short_fdct4x4(be->src_diff, be->coeff, 32) ;
+ x->quantize_b(be, b) ;
+ vp8_inverse_transform_b(IF_RTCD(&rtcd->common->idct), b, 32) ;
+ }
#else
- x->vp8_short_fdct4x4(be->src_diff, be->coeff, 32);
- x->quantize_b(be, b);
- vp8_inverse_transform_b(IF_RTCD(&rtcd->common->idct), b, 32);
+ x->vp8_short_fdct4x4(be->src_diff, be->coeff, 32);
+ x->quantize_b(be, b);
+ vp8_inverse_transform_b(IF_RTCD(&rtcd->common->idct), b, 32);
#endif
RECON_INVOKE(&rtcd->common->recon, recon)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
@@ -298,7 +298,6 @@
}
}
-extern const int vp8_i8x8_block[4];
void vp8_encode_intra8x8mby(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *x) {
int i, ib;
--- a/vp8/encoder/encodemb.c
+++ b/vp8/encoder/encodemb.c
@@ -1239,4 +1239,3 @@
RECON_INVOKE(&rtcd->common->recon, recon_mby)
(IF_RTCD(&rtcd->common->recon), &x->e_mbd);
}
-
--- a/vp8/encoder/onyx_if.c
+++ b/vp8/encoder/onyx_if.c
@@ -3048,6 +3048,7 @@
// Clear down mmx registers to allow floating point in what follows
vp8_clear_system_state();
+
// For an alt ref frame in 2 pass we skip the call to the second
// pass function that sets the target bandwidth so must set it here
if (cpi->common.refresh_alt_ref_frame) {
@@ -3758,10 +3759,20 @@
update_reference_frames(cm);
vp8_copy(cpi->common.fc.coef_counts, cpi->coef_counts);
+#if CONFIG_HYBRIDTRANSFORM
+ vp8_copy(cpi->common.fc.hybrid_coef_counts, cpi->hybrid_coef_counts);
+#endif
vp8_copy(cpi->common.fc.coef_counts_8x8, cpi->coef_counts_8x8);
-#if CONFIG_TX16X16 || CONFIG_HYBRIDTRANSFORM16X16
+#if CONFIG_HYBRIDTRANSFORM8X8
+ vp8_copy(cpi->common.fc.hybrid_coef_counts_8x8, cpi->hybrid_coef_counts_8x8);
+#endif
+#if CONFIG_TX16X16
vp8_copy(cpi->common.fc.coef_counts_16x16, cpi->coef_counts_16x16);
+#if CONFIG_HYBRIDTRANSFORM16X16
+ vp8_copy(cpi->common.fc.hybrid_coef_counts_16x16,
+ cpi->hybrid_coef_counts_16x16);
#endif
+#endif
vp8_adapt_coef_probs(&cpi->common);
if (cpi->common.frame_type != KEY_FRAME) {
vp8_copy(cpi->common.fc.ymode_counts, cpi->ymode_count);
@@ -4330,8 +4341,9 @@
Pass1Encode(cpi, size, dest, frame_flags);
} else if (cpi->pass == 2) {
Pass2Encode(cpi, size, dest, frame_flags);
- } else
+ } else {
encode_frame_to_data_rate(cpi, size, dest, frame_flags);
+ }
if (cm->refresh_entropy_probs) {
if (cm->refresh_alt_ref_frame)
--- a/vp8/encoder/onyx_int.h
+++ b/vp8/encoder/onyx_int.h
@@ -97,12 +97,26 @@
vp8_prob coef_probs[BLOCK_TYPES]
[COEF_BANDS][PREV_COEF_CONTEXTS][ENTROPY_NODES];
+#if CONFIG_HYBRIDTRANSFORM
+ vp8_prob hybrid_coef_probs[BLOCK_TYPES]
+ [COEF_BANDS][PREV_COEF_CONTEXTS][ENTROPY_NODES];
+#endif
+
vp8_prob coef_probs_8x8[BLOCK_TYPES_8X8]
[COEF_BANDS][PREV_COEF_CONTEXTS][ENTROPY_NODES];
-#if CONFIG_TX16X16 || CONFIG_HYBRIDTRANSFORM16X16
+#if CONFIG_HYBRIDTRANSFORM8X8
+ vp8_prob hybrid_coef_probs_8x8[BLOCK_TYPES_8X8]
+ [COEF_BANDS][PREV_COEF_CONTEXTS][ENTROPY_NODES];
+#endif
+
+#if CONFIG_TX16X16
vp8_prob coef_probs_16x16[BLOCK_TYPES_16X16]
[COEF_BANDS][PREV_COEF_CONTEXTS][ENTROPY_NODES];
+#if CONFIG_HYBRIDTRANSFORM16X16
+ vp8_prob hybrid_coef_probs_16x16[BLOCK_TYPES_16X16]
+ [COEF_BANDS][PREV_COEF_CONTEXTS][ENTROPY_NODES];
#endif
+#endif
vp8_prob ymode_prob [VP8_YMODES - 1]; /* interframe intra mode probs */
vp8_prob uv_mode_prob [VP8_YMODES][VP8_UV_MODES - 1];
@@ -557,17 +571,32 @@
#endif
unsigned int coef_counts [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS]; /* for this frame */
- // DECLARE_ALIGNED(16, int, coef_counts_backup [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS]); //not used any more
- // save vp8_tree_probs_from_distribution result for each frame to avoid repeat calculation
vp8_prob frame_coef_probs [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
unsigned int frame_branch_ct [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES][2];
+#if CONFIG_HYBRIDTRANSFORM
+ unsigned int hybrid_coef_counts [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS]; /* for this frame */
+ vp8_prob frame_hybrid_coef_probs [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
+ unsigned int frame_hybrid_branch_ct [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES][2];
+#endif
+
unsigned int coef_counts_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS]; /* for this frame */
vp8_prob frame_coef_probs_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
unsigned int frame_branch_ct_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES][2];
-#if CONFIG_TX16X16 || CONFIG_HYBRIDTRANSFORM16X16
+#if CONFIG_HYBRIDTRANSFORM8X8
+ unsigned int hybrid_coef_counts_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS]; /* for this frame */
+ vp8_prob frame_hybrid_coef_probs_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
+ unsigned int frame_hybrid_branch_ct_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES][2];
+#endif
+
+#if CONFIG_TX16X16
unsigned int coef_counts_16x16 [BLOCK_TYPES_16X16] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS]; /* for this frame */
vp8_prob frame_coef_probs_16x16 [BLOCK_TYPES_16X16] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
unsigned int frame_branch_ct_16x16 [BLOCK_TYPES_16X16] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES][2];
+#if CONFIG_HYBRIDTRANSFORM16X16
+ unsigned int hybrid_coef_counts_16x16 [BLOCK_TYPES_16X16] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS]; /* for this frame */
+ vp8_prob frame_hybrid_coef_probs_16x16 [BLOCK_TYPES_16X16] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
+ unsigned int frame_hybrid_branch_ct_16x16 [BLOCK_TYPES_16X16] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES][2];
+#endif
#endif
int gfu_boost;
--- a/vp8/encoder/ratectrl.c
+++ b/vp8/encoder/ratectrl.c
@@ -178,13 +178,22 @@
vp8_copy(cc->last_mode_lf_deltas, xd->last_mode_lf_deltas);
vp8_copy(cc->coef_probs, cm->fc.coef_probs);
+#if CONFIG_HYBRIDTRANSFORM
+ vp8_copy(cc->hybrid_coef_probs, cm->fc.hybrid_coef_probs);
+#endif
vp8_copy(cc->coef_probs_8x8, cm->fc.coef_probs_8x8);
-#if CONFIG_SWITCHABLE_INTERP
- vp8_copy(cc->switchable_interp_prob, cm->fc.switchable_interp_prob);
+#if CONFIG_HYBRIDTRANSFORM8X8
+ vp8_copy(cc->hybrid_coef_probs_8x8, cm->fc.hybrid_coef_probs_8x8);
#endif
-#if CONFIG_TX16X16 || CONFIG_HYBRIDTRANSFORM16X16
+#if CONFIG_TX16X16
vp8_copy(cc->coef_probs_16x16, cm->fc.coef_probs_16x16);
+#if CONFIG_HYBRIDTRANSFORM16X16
+ vp8_copy(cc->hybrid_coef_probs_16x16, cm->fc.hybrid_coef_probs_16x16);
#endif
+#endif
+#if CONFIG_SWITCHABLE_INTERP
+ vp8_copy(cc->switchable_interp_prob, cm->fc.switchable_interp_prob);
+#endif
}
void vp8_restore_coding_context(VP8_COMP *cpi) {
@@ -242,12 +251,21 @@
vp8_copy(xd->last_mode_lf_deltas, cc->last_mode_lf_deltas);
vp8_copy(cm->fc.coef_probs, cc->coef_probs);
+#if CONFIG_HYBRIDTRANSFORM
+ vp8_copy(cm->fc.hybrid_coef_probs, cc->hybrid_coef_probs);
+#endif
vp8_copy(cm->fc.coef_probs_8x8, cc->coef_probs_8x8);
-#if CONFIG_SWITCHABLE_INTERP
- vp8_copy(cm->fc.switchable_interp_prob, cc->switchable_interp_prob);
+#if CONFIG_HYBRIDTRANSFORM8X8
+ vp8_copy(cm->fc.hybrid_coef_probs_8x8, cc->hybrid_coef_probs_8x8);
#endif
-#if CONFIG_TX16X16 || CONFIG_HYBRIDTRANSFORM16X16
+#if CONFIG_TX16X16
vp8_copy(cm->fc.coef_probs_16x16, cc->coef_probs_16x16);
+#if CONFIG_HYBRIDTRANSFORM16X16
+ vp8_copy(cm->fc.hybrid_coef_probs_16x16, cc->hybrid_coef_probs_16x16);
+#endif
+#endif
+#if CONFIG_SWITCHABLE_INTERP
+ vp8_copy(cm->fc.switchable_interp_prob, cc->switchable_interp_prob);
#endif
}
--- a/vp8/encoder/rdopt.c
+++ b/vp8/encoder/rdopt.c
@@ -41,6 +41,7 @@
#include "vp8/common/seg_common.h"
#include "vp8/common/pred_common.h"
+#include "vp8/common/entropy.h"
#if CONFIG_NEWBESTREFMV
#include "vp8/common/mvref_common.h"
@@ -358,18 +359,39 @@
cpi->mb.token_costs[TX_4X4],
(const vp8_prob( *)[8][PREV_COEF_CONTEXTS][11]) cpi->common.fc.coef_probs,
BLOCK_TYPES);
+#if CONFIG_HYBRIDTRANSFORM
+ fill_token_costs(
+ cpi->mb.hybrid_token_costs[TX_4X4],
+ (const vp8_prob( *)[8][PREV_COEF_CONTEXTS][11])
+ cpi->common.fc.hybrid_coef_probs,
+ BLOCK_TYPES);
+#endif
fill_token_costs(
cpi->mb.token_costs[TX_8X8],
(const vp8_prob( *)[8][PREV_COEF_CONTEXTS][11]) cpi->common.fc.coef_probs_8x8,
BLOCK_TYPES_8X8);
+#if CONFIG_HYBRIDTRANSFORM8X8
+ fill_token_costs(
+ cpi->mb.hybrid_token_costs[TX_8X8],
+ (const vp8_prob( *)[8][PREV_COEF_CONTEXTS][11])
+ cpi->common.fc.hybrid_coef_probs_8x8,
+ BLOCK_TYPES_8X8);
+#endif
-#if CONFIG_TX16X16 || CONFIG_HYBRIDTRANSFORM16X16
+#if CONFIG_TX16X16
fill_token_costs(
cpi->mb.token_costs[TX_16X16],
(const vp8_prob(*)[8][PREV_COEF_CONTEXTS][11]) cpi->common.fc.coef_probs_16x16,
BLOCK_TYPES_16X16);
+#if CONFIG_HYBRIDTRANSFORM16X16
+ fill_token_costs(
+ cpi->mb.hybrid_token_costs[TX_16X16],
+ (const vp8_prob(*)[8][PREV_COEF_CONTEXTS][11])
+ cpi->common.fc.hybrid_coef_probs_16x16,
+ BLOCK_TYPES_16X16);
#endif
+#endif
/*rough estimate for costing*/
cpi->common.kf_ymode_probs_index = cpi->common.base_qindex >> 4;
@@ -582,7 +604,7 @@
static int cost_coeffs(MACROBLOCK *mb, BLOCKD *b, int type,
ENTROPY_CONTEXT *a, ENTROPY_CONTEXT *l,
- int tx_type) {
+ int tx_size) {
const int eob = b->eob;
int c = !type; /* start at coef 0, unless Y with Y2 */
int cost = 0, default_eob, seg_eob;
@@ -589,37 +611,37 @@
int pt; /* surrounding block/prev coef predictor */
int const *scan, *band;
short *qcoeff_ptr = b->qcoeff;
- MB_MODE_INFO * mbmi = &mb->e_mbd.mode_info_context->mbmi;
-
+ MACROBLOCKD *xd = &mb->e_mbd;
+ MB_MODE_INFO *mbmi = &mb->e_mbd.mode_info_context->mbmi;
+#if CONFIG_HYBRIDTRANSFORM || CONFIG_HYBRIDTRANSFORM8X8 || CONFIG_HYBRIDTRANSFORM16X16
+ TX_TYPE tx_type = DCT_DCT;
+#endif
int segment_id = mbmi->segment_id;
- switch (tx_type) {
+ switch (tx_size) {
case TX_4X4:
scan = vp8_default_zig_zag1d;
band = vp8_coef_bands;
default_eob = 16;
#if CONFIG_HYBRIDTRANSFORM
- {
- int active_ht = (mb->q_index < ACTIVE_HT) &&
- (mbmi->mode_rdopt == B_PRED);
+ if (type == PLANE_TYPE_Y_WITH_DC &&
+ mb->q_index < ACTIVE_HT &&
+ mbmi->mode_rdopt == B_PRED) {
+ tx_type = b->bmi.as_mode.tx_type;
+ switch (tx_type) {
+ case ADST_DCT:
+ scan = vp8_row_scan;
+ break;
- if((type == PLANE_TYPE_Y_WITH_DC) && active_ht) {
- switch (b->bmi.as_mode.tx_type) {
- case ADST_DCT:
- scan = vp8_row_scan;
- break;
+ case DCT_ADST:
+ scan = vp8_col_scan;
+ break;
- case DCT_ADST:
- scan = vp8_col_scan;
- break;
+ default:
+ scan = vp8_default_zig_zag1d;
+ break;
+ }
- default:
- scan = vp8_default_zig_zag1d;
- break;
- }
-
- } else
- scan = vp8_default_zig_zag1d;
}
#endif
break;
@@ -627,6 +649,17 @@
scan = vp8_default_zig_zag1d_8x8;
band = vp8_coef_bands_8x8;
default_eob = 64;
+#if CONFIG_HYBRIDTRANSFORM8X8
+ {
+ BLOCKD *bb;
+ int ib = (b - xd->block);
+ if (ib >= 16) tx_type = DCT_DCT;
+ ib = (ib & 8) + ((ib & 4) >> 1);
+ bb = xd->block + ib;
+ if (mbmi->mode_rdopt == I8X8_PRED)
+ tx_type = bb->bmi.as_mode.tx_type;
+ }
+#endif
break;
#if CONFIG_TX16X16 || CONFIG_HYBRIDTRANSFORM16X16
case TX_16X16:
@@ -633,6 +666,12 @@
scan = vp8_default_zig_zag1d_16x16;
band = vp8_coef_bands_16x16;
default_eob = 256;
+#if CONFIG_HYBRIDTRANSFORM16X16
+ if (type == PLANE_TYPE_Y_WITH_DC &&
+ mbmi->mode_rdopt < I8X8_PRED &&
+ mb->q_index < ACTIVE_HT16)
+ tx_type = b->bmi.as_mode.tx_type;
+#endif
break;
#endif
default:
@@ -643,21 +682,37 @@
else
seg_eob = default_eob;
+ //mbmi->mode = mode;
VP8_COMBINEENTROPYCONTEXTS(pt, *a, *l);
- for (; c < eob; c++) {
- int v = qcoeff_ptr[scan[c]];
- int t = vp8_dct_value_tokens_ptr[v].Token;
- cost += mb->token_costs[tx_type][type][band[c]][pt][t];
- cost += vp8_dct_value_cost_ptr[v];
- pt = vp8_prev_token_class[t];
+#if CONFIG_HYBRIDTRANSFORM || CONFIG_HYBRIDTRANSFORM8X8 || CONFIG_HYBRIDTRANSFORM16X16
+ if (tx_type != DCT_DCT) {
+ for (; c < eob; c++) {
+ int v = qcoeff_ptr[scan[c]];
+ int t = vp8_dct_value_tokens_ptr[v].Token;
+ cost += mb->hybrid_token_costs[tx_size][type][band[c]][pt][t];
+ cost += vp8_dct_value_cost_ptr[v];
+ pt = vp8_prev_token_class[t];
+ }
+ if (c < seg_eob)
+ cost += mb->hybrid_token_costs[tx_size][type][band[c]]
+ [pt][DCT_EOB_TOKEN];
+ } else
+#endif
+ {
+ for (; c < eob; c++) {
+ int v = qcoeff_ptr[scan[c]];
+ int t = vp8_dct_value_tokens_ptr[v].Token;
+ cost += mb->token_costs[tx_size][type][band[c]][pt][t];
+ cost += vp8_dct_value_cost_ptr[v];
+ pt = vp8_prev_token_class[t];
+ }
+ if (c < seg_eob)
+ cost += mb->token_costs[tx_size][type][band[c]]
+ [pt][DCT_EOB_TOKEN];
}
- if (c < seg_eob)
- cost += mb->token_costs[tx_type][type][band[c]]
- [pt][DCT_EOB_TOKEN];
-
pt = (c != !type); // is eob first coefficient;
*a = *l = pt;
return cost;
@@ -816,6 +871,7 @@
cost = cost_coeffs(mb, xd->block, PLANE_TYPE_Y_WITH_DC, ta, tl, TX_16X16);
return cost;
}
+
static void macro_block_yrd_16x16(MACROBLOCK *mb, int *Rate, int *Distortion,
const VP8_ENCODER_RTCD *rtcd) {
int d;
@@ -1427,7 +1483,6 @@
return best_rd;
}
-const int vp8_i8x8_block[4] = {0, 2, 8, 10};
int64_t rd_pick_intra8x8mby_modes(VP8_COMP *cpi, MACROBLOCK *mb,
int *Rate, int *rate_y,
int *Distortion, int64_t best_rd) {
--- a/vp8/encoder/tokenize.c
+++ b/vp8/encoder/tokenize.c
@@ -19,6 +19,7 @@
#include "vp8/common/pred_common.h"
#include "vp8/common/seg_common.h"
+#include "vp8/common/entropy.h"
/* Global event counters used for accumulating statistics across several
compressions, then generating context.c = initial stats. */
@@ -25,19 +26,43 @@
#ifdef ENTROPY_STATS
INT64 context_counters[BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];
+#if CONFIG_HYBRIDTRANSFORM
+INT64 hybrid_context_counters[BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];
+#endif
+
INT64 context_counters_8x8[BLOCK_TYPES_8X8] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];
-#if CONFIG_TX16X16 || CONFIG_HYBRIDTRANSFORM16X16
+#if CONFIG_HYBRIDTRANSFORM8X8
+INT64 hybrid_context_counters_8x8[BLOCK_TYPES_8X8] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];
+#endif
+
+#if CONFIG_TX16X16
INT64 context_counters_16x16[BLOCK_TYPES_16X16] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];
+#if CONFIG_HYBRIDTRANSFORM16X16
+INT64 hybrid_context_counters_16x16[BLOCK_TYPES_16X16] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];
#endif
+#endif
+
extern unsigned int tree_update_hist[BLOCK_TYPES][COEF_BANDS]
[PREV_COEF_CONTEXTS][ENTROPY_NODES][2];
+#if CONFIG_HYBRIDTRANSFORM
+extern unsigned int hybrid_tree_update_hist[BLOCK_TYPES][COEF_BANDS]
+ [PREV_COEF_CONTEXTS][ENTROPY_NODES][2];
+#endif
extern unsigned int tree_update_hist_8x8[BLOCK_TYPES_8X8][COEF_BANDS]
[PREV_COEF_CONTEXTS][ENTROPY_NODES] [2];
-#if CONFIG_TX16X16 || CONFIG_HYBRIDTRANSFORM16X16
+#if CONFIG_HYBRIDTRANSFORM8X8
+extern unsigned int hybrid_tree_update_hist_8x8[BLOCK_TYPES_8X8][COEF_BANDS]
+ [PREV_COEF_CONTEXTS][ENTROPY_NODES] [2];
+#endif
+#if CONFIG_TX16X16
extern unsigned int tree_update_hist_16x16[BLOCK_TYPES_16X16][COEF_BANDS]
[PREV_COEF_CONTEXTS][ENTROPY_NODES] [2];
+#if CONFIG_HYBRIDTRANSFORM16X16
+extern unsigned int hybrid_tree_update_hist_16x16[BLOCK_TYPES_16X16][COEF_BANDS]
+ [PREV_COEF_CONTEXTS][ENTROPY_NODES] [2];
#endif
#endif
+#endif
void vp8_stuff_mb(VP8_COMP *cpi,
MACROBLOCKD *xd, TOKENEXTRA **t, int dry_run);
void vp8_stuff_mb_8x8(VP8_COMP *cpi,
@@ -44,7 +69,7 @@
MACROBLOCKD *xd, TOKENEXTRA **t, int dry_run);
void vp8_stuff_mb_8x8_4x4uv(VP8_COMP *cpi,
MACROBLOCKD *xd, TOKENEXTRA **t, int dry_run);
-#if CONFIG_TX16X16 || CONFIG_HYBRIDTRANSFORM16X16
+#if CONFIG_TX16X16
void vp8_stuff_mb_16x16(VP8_COMP *cpi, MACROBLOCKD *xd,
TOKENEXTRA **t, int dry_run);
#endif
@@ -108,7 +133,7 @@
vp8_dct_value_cost_ptr = dct_value_cost + DCT_MAX_VALUE;
}
-#if CONFIG_TX16X16 || CONFIG_HYBRIDTRANSFORM16X16
+#if CONFIG_TX16X16
static void tokenize1st_order_b_16x16(MACROBLOCKD *xd,
const BLOCKD *const b,
TOKENEXTRA **tp,
@@ -124,10 +149,15 @@
TOKENEXTRA *t = *tp; /* store tokens starting here */
int x;
const short *qcoeff_ptr = b->qcoeff;
+#if CONFIG_HYBRIDTRANSFORM16X16
+ TX_TYPE tx_type = get_tx_type(xd, b);
+#endif
int seg_eob = 256;
int segment_id = xd->mode_info_context->mbmi.segment_id;
+ //if (!dry_run) printf("16: %d\n", tx_type);
+
if (segfeature_active(xd, segment_id, SEG_LVL_EOB))
seg_eob = get_segdata(xd, segment_id, SEG_LVL_EOB);
@@ -149,11 +179,22 @@
}
t->Token = x;
- t->context_tree = cpi->common.fc.coef_probs_16x16[type][band][pt];
+#if CONFIG_HYBRIDTRANSFORM16X16
+ if (tx_type != DCT_DCT)
+ t->context_tree = cpi->common.fc.hybrid_coef_probs_16x16[type][band][pt];
+ else
+#endif
+ t->context_tree = cpi->common.fc.coef_probs_16x16[type][band][pt];
t->skip_eob_node = pt == 0 && ((band > 0 && type > 0) || (band > 1 && type == 0));
- if (!dry_run)
- ++cpi->coef_counts_16x16[type][band][pt][x];
+ if (!dry_run) {
+#if CONFIG_HYBRIDTRANSFORM16X16
+ if (tx_type != DCT_DCT)
+ ++cpi->hybrid_coef_counts_16x16[type][band][pt][x];
+ else
+#endif
+ ++cpi->coef_counts_16x16[type][band][pt][x];
+ }
} while (pt = vp8_prev_token_class[x], ++t, c < eob && ++c < seg_eob);
*tp = t;
@@ -304,6 +345,9 @@
int c = type ? 0 : 1; /* start at DC unless type 0 */
TOKENEXTRA *t = *tp; /* store tokens starting here */
const short *qcoeff_ptr = b->qcoeff;
+#if CONFIG_HYBRIDTRANSFORM8X8
+ TX_TYPE tx_type = type == 3 ? get_tx_type(xd, b) : DCT_DCT;
+#endif
int seg_eob = 64;
int segment_id = xd->mode_info_context->mbmi.segment_id;
@@ -313,6 +357,7 @@
VP8_COMBINEENTROPYCONTEXTS(pt, *a, *l);
+ //if (!dry_run) printf("8: %d\n", tx_type);
for (; c < b->eob; ++c) {
const int band = vp8_coef_bands_8x8[c];
int rc = vp8_default_zig_zag1d_8x8[c];
@@ -324,12 +369,23 @@
x = vp8_dct_value_tokens_ptr[v].Token;
t->Token = x;
- t->context_tree = cpi->common.fc.coef_probs_8x8[type][band][pt];
+#if CONFIG_HYBRIDTRANSFORM8X8
+ if (tx_type != DCT_DCT)
+ t->context_tree = cpi->common.fc.hybrid_coef_probs_8x8[type][band][pt];
+ else
+#endif
+ t->context_tree = cpi->common.fc.coef_probs_8x8[type][band][pt];
t->skip_eob_node = pt == 0 && ((band > 0 && type > 0) || (band > 1 && type == 0));
- if (!dry_run)
- ++cpi->coef_counts_8x8[type][band][pt][x];
+ if (!dry_run) {
+#if CONFIG_HYBRIDTRANSFORM8X8
+ if (tx_type != DCT_DCT)
+ ++cpi->hybrid_coef_counts_8x8[type][band][pt][x];
+ else
+#endif
+ ++cpi->coef_counts_8x8[type][band][pt][x];
+ }
pt = vp8_prev_token_class[x];
++t;
@@ -339,11 +395,23 @@
const int band = vp8_coef_bands_8x8[c];
t->Token = DCT_EOB_TOKEN;
- t->context_tree = cpi->common.fc.coef_probs_8x8 [type] [band] [pt];
+#if CONFIG_HYBRIDTRANSFORM8X8
+ if (tx_type != DCT_DCT)
+ t->context_tree = cpi->common.fc.hybrid_coef_probs_8x8 [type] [band] [pt];
+ else
+#endif
+ t->context_tree = cpi->common.fc.coef_probs_8x8 [type] [band] [pt];
+
t->skip_eob_node = pt == 0 && ((band > 0 && type > 0) || (band > 1 && type == 0));
- if (!dry_run)
- ++cpi->coef_counts_8x8[type][band][pt][DCT_EOB_TOKEN];
+ if (!dry_run) {
+#if CONFIG_HYBRIDTRANSFORM8X8
+ if (tx_type != DCT_DCT)
+ ++cpi->hybrid_coef_counts_8x8[type][band][pt][DCT_EOB_TOKEN];
+ else
+#endif
+ ++cpi->coef_counts_8x8[type][band][pt][DCT_EOB_TOKEN];
+ }
++t;
}
@@ -384,10 +452,13 @@
/* Luma */
for (block = 0; block < 16; block++, b++) {
B_PREDICTION_MODE b_mode;
+ TX_TYPE tx_type = DCT_DCT;
if( xd->mode_info_context->mbmi.mode == B_PRED ) {
b_mode = b->bmi.as_mode.first;
+ tx_type = get_tx_type(xd, b);
}
+ //if (!dry_run) printf("4: %d\n", tx_type);
// assign scanning order for luma components coded in intra4x4 mode
if( (xd->mode_info_context->mbmi.mode == B_PRED) &&
@@ -430,13 +501,20 @@
token = vp8_dct_value_tokens_ptr[v].Token;
t->Token = token;
- t->context_tree = cpi->common.fc.coef_probs [type] [band] [pt];
+ if (tx_type != DCT_DCT)
+ t->context_tree = cpi->common.fc.hybrid_coef_probs [type] [band] [pt];
+ else
+ t->context_tree = cpi->common.fc.coef_probs [type] [band] [pt];
t->skip_eob_node = pt == 0 &&
((band > 0 && type > 0) || (band > 1 && type == 0));
- if (!dry_run)
- ++cpi->coef_counts [type] [band] [pt] [token];
+ if (!dry_run) {
+ if (tx_type != DCT_DCT)
+ ++cpi->hybrid_coef_counts[type] [band] [pt] [token];
+ else
+ ++cpi->coef_counts [type] [band] [pt] [token];
+ }
pt = vp8_prev_token_class[token];
t++;
@@ -445,12 +523,19 @@
if (c < seg_eob) {
band = vp8_coef_bands[c];
t->Token = DCT_EOB_TOKEN;
- t->context_tree = cpi->common.fc.coef_probs [type] [band] [pt];
+ if (tx_type != DCT_DCT)
+ t->context_tree = cpi->common.fc.hybrid_coef_probs [type] [band] [pt];
+ else
+ t->context_tree = cpi->common.fc.coef_probs [type] [band] [pt];
t->skip_eob_node = pt == 0 &&
((band > 0 && type > 0) || (band > 1 && type == 0));
- if (!dry_run)
- ++cpi->coef_counts [type] [band] [pt] [DCT_EOB_TOKEN];
+ if (!dry_run) {
+ if (tx_type != DCT_DCT)
+ ++cpi->hybrid_coef_counts[type] [band] [pt] [DCT_EOB_TOKEN];
+ else
+ ++cpi->coef_counts [type] [band] [pt] [DCT_EOB_TOKEN];
+ }
t++;
}
@@ -787,7 +872,7 @@
int plane_type;
int has_y2_block;
int b;
- int tx_type = xd->mode_info_context->mbmi.txfm_size;
+ int tx_size = xd->mode_info_context->mbmi.txfm_size;
int mb_skip_context = get_pred_context(&cpi->common, xd, PRED_MBSKIP);
TOKENEXTRA *t_backup = *t;
@@ -813,10 +898,10 @@
&& xd->mode_info_context->mbmi.mode != I8X8_PRED
&& xd->mode_info_context->mbmi.mode != SPLITMV);
#if CONFIG_TX16X16 || CONFIG_HYBRIDTRANSFORM16X16
- if (tx_type == TX_16X16) has_y2_block = 0; // Because of inter frames
+ if (tx_size == TX_16X16) has_y2_block = 0; // Because of inter frames
#endif
- switch (tx_type) {
+ switch (tx_size) {
#if CONFIG_TX16X16 || CONFIG_HYBRIDTRANSFORM16X16
case TX_16X16:
xd->mode_info_context->mbmi.mb_skip_coeff = mb_is_skippable_16x16(xd);
@@ -840,12 +925,12 @@
if (!dry_run)
cpi->skip_true_count[mb_skip_context] += skip_inc;
if (!cpi->common.mb_no_coeff_skip) {
-#if CONFIG_TX16X16 || CONFIG_HYBRIDTRANSFORM16X16
- if (tx_type == TX_16X16)
+#if CONFIG_TX16X16 && CONFIG_HYBRIDTRANSFORM16X16
+ if (tx_size == TX_16X16)
vp8_stuff_mb_16x16(cpi, xd, t, dry_run);
else
#endif
- if (tx_type == TX_8X8) {
+ if (tx_size == TX_8X8) {
#if CONFIG_HYBRIDTRANSFORM8X8
if (xd->mode_info_context->mbmi.mode == I8X8_PRED)
vp8_stuff_mb_8x8_4x4uv(cpi, xd, t, dry_run);
@@ -867,7 +952,7 @@
plane_type = 3;
if (has_y2_block) {
- if (tx_type == TX_8X8) {
+ if (tx_size == TX_8X8) {
ENTROPY_CONTEXT *A = (ENTROPY_CONTEXT *)xd->above_context;
ENTROPY_CONTEXT *L = (ENTROPY_CONTEXT *)xd->left_context;
tokenize2nd_order_b_8x8(xd,
@@ -881,8 +966,8 @@
plane_type = 0;
}
-#if CONFIG_TX16X16 || CONFIG_HYBRIDTRANSFORM16X16
- if (tx_type == TX_16X16) {
+#if CONFIG_TX16X16
+ if (tx_size == TX_16X16) {
ENTROPY_CONTEXT * A = (ENTROPY_CONTEXT *)xd->above_context;
ENTROPY_CONTEXT * L = (ENTROPY_CONTEXT *)xd->left_context;
@@ -904,7 +989,7 @@
}
else
#endif
- if (tx_type == TX_8X8) {
+ if (tx_size == TX_8X8) {
ENTROPY_CONTEXT *A = (ENTROPY_CONTEXT *)xd->above_context;
ENTROPY_CONTEXT *L = (ENTROPY_CONTEXT *)xd->left_context;
#if CONFIG_HYBRIDTRANSFORM8X8
@@ -914,7 +999,8 @@
#endif
for (b = 0; b < 16; b += 4) {
tokenize1st_order_b_8x8(xd,
- xd->block + b, t, plane_type, xd->frame_type,
+ xd->block + b,
+ t, plane_type, xd->frame_type,
A + vp8_block2above_8x8[b],
L + vp8_block2left_8x8[b],
cpi, dry_run);
@@ -945,7 +1031,6 @@
#endif
tokenize1st_order_b(xd, t, plane_type, cpi, dry_run);
}
-
if (dry_run)
*t = t_backup;
}
@@ -1214,6 +1299,7 @@
static __inline void stuff2nd_order_b_8x8(
+ MACROBLOCKD *xd,
const BLOCKD *const b,
TOKENEXTRA **tp,
const int type, /* which plane: 0=Y no DC, 1=Y2, 2=UV, 3=Y with DC */
@@ -1245,6 +1331,7 @@
static __inline void stuff1st_order_b_8x8
(
+ MACROBLOCKD *xd,
const BLOCKD *const b,
TOKENEXTRA **tp,
const int type, /* which plane: 0=Y no DC, 1=Y2, 2=UV, 3=Y with DC */
@@ -1255,6 +1342,10 @@
int dry_run) {
int pt; /* near block/prev token context index */
TOKENEXTRA *t = *tp; /* store tokens starting here */
+#if CONFIG_HYBRIDTRANSFORM8X8
+ TX_TYPE tx_type = type == 3 ? get_tx_type(xd, b) : DCT_DCT;
+#endif
+
VP8_COMBINEENTROPYCONTEXTS(pt, *a, *l);
(void) frametype;
(void) type;
@@ -1261,13 +1352,24 @@
(void) b;
t->Token = DCT_EOB_TOKEN;
- t->context_tree = cpi->common.fc.coef_probs_8x8 [0] [1] [pt];
+#if CONFIG_HYBRIDTRANSFORM8X8
+ if (tx_type != DCT_DCT)
+ t->context_tree = cpi->common.fc.hybrid_coef_probs_8x8 [0] [1] [pt];
+ else
+#endif
+ t->context_tree = cpi->common.fc.coef_probs_8x8 [0] [1] [pt];
// t->section = 8;
t->skip_eob_node = 0;
++t;
*tp = t;
- if (!dry_run)
- ++cpi->coef_counts_8x8[0] [1] [pt] [DCT_EOB_TOKEN];
+ if (!dry_run) {
+#if CONFIG_HYBRIDTRANSFORM8X8
+ if (tx_type == DCT_DCT)
+ ++cpi->hybrid_coef_counts_8x8[0] [1] [pt] [DCT_EOB_TOKEN];
+ else
+#endif
+ ++cpi->coef_counts_8x8[0] [1] [pt] [DCT_EOB_TOKEN];
+ }
pt = 0; /* 0 <-> all coeff data is zero */
*a = *l = pt;
@@ -1277,6 +1379,7 @@
static __inline
void stuff1st_order_buv_8x8
(
+ MACROBLOCKD *xd,
const BLOCKD *const b,
TOKENEXTRA **tp,
const int type, /* which plane: 0=Y no DC, 1=Y2, 2=UV, 3=Y with DC */
@@ -1315,13 +1418,13 @@
int b;
TOKENEXTRA *t_backup = *t;
- stuff2nd_order_b_8x8(xd->block + 24, t, 1, xd->frame_type,
+ stuff2nd_order_b_8x8(xd, xd->block + 24, t, 1, xd->frame_type,
A + vp8_block2above_8x8[24],
L + vp8_block2left_8x8[24], cpi, dry_run);
plane_type = 0;
for (b = 0; b < 16; b += 4) {
- stuff1st_order_b_8x8(xd->block + b, t, plane_type, xd->frame_type,
+ stuff1st_order_b_8x8(xd, xd->block + b, t, plane_type, xd->frame_type,
A + vp8_block2above_8x8[b],
L + vp8_block2left_8x8[b],
cpi, dry_run);
@@ -1330,7 +1433,7 @@
}
for (b = 16; b < 24; b += 4) {
- stuff1st_order_buv_8x8(xd->block + b, t, 2, xd->frame_type,
+ stuff1st_order_buv_8x8(xd, xd->block + b, t, 2, xd->frame_type,
A + vp8_block2above[b],
L + vp8_block2left[b],
cpi, dry_run);
@@ -1341,9 +1444,10 @@
*t = t_backup;
}
-#if CONFIG_TX16X16 || CONFIG_HYBRIDTRANSFORM16X16
+#if CONFIG_TX16X16
static __inline
-void stuff1st_order_b_16x16(const BLOCKD *const b,
+void stuff1st_order_b_16x16(MACROBLOCKD *xd,
+ const BLOCKD *const b,
TOKENEXTRA **tp,
const FRAME_TYPE frametype,
ENTROPY_CONTEXT *a,
@@ -1352,17 +1456,31 @@
int dry_run){
int pt; /* near block/prev token context index */
TOKENEXTRA *t = *tp; /* store tokens starting here */
+#if CONFIG_HYBRIDTRANSFORM16X16
+ TX_TYPE tx_type = get_tx_type(xd, b);
+#endif
VP8_COMBINEENTROPYCONTEXTS(pt, *a, *l);
(void) frametype;
(void) b;
t->Token = DCT_EOB_TOKEN;
+#if CONFIG_HYBRIDTRANSFORM16X16
+ if (tx_type != DCT_DCT)
+ t->context_tree = cpi->common.fc.hybrid_coef_probs_16x16[3][1][pt];
+ else
+#endif
t->context_tree = cpi->common.fc.coef_probs_16x16[3][1][pt];
t->skip_eob_node = 0;
++t;
*tp = t;
- if (!dry_run)
+ if (!dry_run) {
+#if CONFIG_HYBRIDTRANSFORM16X16
+ if (tx_type != DCT_DCT)
+ ++cpi->hybrid_coef_counts_16x16[3][1][pt][DCT_EOB_TOKEN];
+ else
+#endif
++cpi->coef_counts_16x16[3][1][pt][DCT_EOB_TOKEN];
+ }
pt = 0; /* 0 <-> all coeff data is zero */
*a = *l = pt;
}
@@ -1376,13 +1494,13 @@
int b, i;
TOKENEXTRA *t_backup = *t;
- stuff1st_order_b_16x16(xd->block, t, xd->frame_type, A, L, cpi, dry_run);
+ stuff1st_order_b_16x16(xd, xd->block, t, xd->frame_type, A, L, cpi, dry_run);
for (i = 1; i < 16; i++) {
*(A + vp8_block2above[i]) = *(A);
*(L + vp8_block2left[i]) = *(L);
}
for (b = 16; b < 24; b += 4) {
- stuff1st_order_buv_8x8(xd->block + b, t, 2, xd->frame_type,
+ stuff1st_order_buv_8x8(xd, xd->block + b, t, 2, xd->frame_type,
A + vp8_block2above[b],
L + vp8_block2left[b],
cpi, dry_run);
@@ -1398,6 +1516,8 @@
static __inline void stuff2nd_order_b
(
+ MACROBLOCKD *xd,
+ const BLOCKD *const b,
TOKENEXTRA **tp,
ENTROPY_CONTEXT *a,
ENTROPY_CONTEXT *l,
@@ -1420,7 +1540,9 @@
}
-static __inline void stuff1st_order_b(TOKENEXTRA **tp,
+static __inline void stuff1st_order_b(MACROBLOCKD *xd,
+ const BLOCKD *const b,
+ TOKENEXTRA **tp,
ENTROPY_CONTEXT *a,
ENTROPY_CONTEXT *l,
VP8_COMP *cpi,
@@ -1427,15 +1549,29 @@
int dry_run) {
int pt; /* near block/prev token context index */
TOKENEXTRA *t = *tp; /* store tokens starting here */
+#if CONFIG_HYBRIDTRANSFORM
+ TX_TYPE tx_type = get_tx_type(xd, b);
+#endif
VP8_COMBINEENTROPYCONTEXTS(pt, *a, *l);
t->Token = DCT_EOB_TOKEN;
- t->context_tree = cpi->common.fc.coef_probs [0] [1] [pt];
+#if CONFIG_HYBRIDTRANSFORM
+ if (tx_type != DCT_DCT)
+ t->context_tree = cpi->common.fc.hybrid_coef_probs [0] [1] [pt];
+ else
+#endif
+ t->context_tree = cpi->common.fc.coef_probs [0] [1] [pt];
t->skip_eob_node = 0;
++t;
*tp = t;
- if (!dry_run)
- ++cpi->coef_counts[0] [1] [pt] [DCT_EOB_TOKEN];
+ if (!dry_run) {
+#if CONFIG_HYBRIDTRANSFORM
+ if (tx_type != DCT_DCT)
+ ++cpi->hybrid_coef_counts[0] [1] [pt] [DCT_EOB_TOKEN];
+ else
+#endif
+ ++cpi->coef_counts[0] [1] [pt] [DCT_EOB_TOKEN];
+ }
pt = 0; /* 0 <-> all coeff data is zero */
*a = *l = pt;
@@ -1443,6 +1579,8 @@
static __inline
void stuff1st_order_buv
(
+ MACROBLOCKD *xd,
+ const BLOCKD *const b,
TOKENEXTRA **tp,
ENTROPY_CONTEXT *a,
ENTROPY_CONTEXT *l,
@@ -1467,23 +1605,22 @@
TOKENEXTRA **t, int dry_run) {
ENTROPY_CONTEXT *A = (ENTROPY_CONTEXT *)xd->above_context;
ENTROPY_CONTEXT *L = (ENTROPY_CONTEXT *)xd->left_context;
- int plane_type;
int b;
TOKENEXTRA *t_backup = *t;
- stuff2nd_order_b(t,
+ stuff2nd_order_b(xd, xd->block + 24, t,
A + vp8_block2above[24],
L + vp8_block2left[24],
cpi, dry_run);
for (b = 0; b < 16; b++)
- stuff1st_order_b(t,
+ stuff1st_order_b(xd, xd->block + b, t,
A + vp8_block2above[b],
L + vp8_block2left[b],
cpi, dry_run);
for (b = 16; b < 24; b++)
- stuff1st_order_buv(t,
+ stuff1st_order_buv(xd, xd->block + b, t,
A + vp8_block2above[b],
L + vp8_block2left[b],
cpi, dry_run);
@@ -1502,13 +1639,13 @@
int b;
TOKENEXTRA *t_backup = *t;
- stuff2nd_order_b_8x8(xd->block + 24, t, 1, xd->frame_type,
+ stuff2nd_order_b_8x8(xd, xd->block + 24, t, 1, xd->frame_type,
A + vp8_block2above_8x8[24],
L + vp8_block2left_8x8[24], cpi, dry_run);
plane_type = 3;
for (b = 0; b < 16; b += 4) {
- stuff1st_order_b_8x8(xd->block + b, t, plane_type, xd->frame_type,
+ stuff1st_order_b_8x8(xd, xd->block + b, t, plane_type, xd->frame_type,
A + vp8_block2above_8x8[b],
L + vp8_block2left_8x8[b],
cpi, dry_run);
@@ -1517,7 +1654,7 @@
}
for (b = 16; b < 24; b++)
- stuff1st_order_buv(t,
+ stuff1st_order_buv(xd, xd->block + b, t,
A + vp8_block2above[b],
L + vp8_block2left[b],
cpi, dry_run);
--
⑨