From 0c9e2e9a1ddca6e120c4afa7f225968a9ab989bf Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Tue, 19 Feb 2013 13:36:38 -0800 Subject: [PATCH] Split coefficient token tables intra vs. inter. Change-Id: I5416455f8f129ca0f450d00e48358d2012605072 --- vp9/common/vp9_default_coef_probs.h | 1015 ++++++++++++++++++++--------------- vp9/common/vp9_entropy.c | 120 +---- vp9/common/vp9_entropy.h | 17 +- vp9/common/vp9_onyxc_int.h | 27 +- vp9/decoder/vp9_decodemv.c | 2 + vp9/decoder/vp9_decodframe.c | 44 +- vp9/decoder/vp9_detokenize.c | 36 +- vp9/encoder/vp9_bitstream.c | 284 ++++------ vp9/encoder/vp9_block.h | 3 +- vp9/encoder/vp9_encodeframe.c | 3 - vp9/encoder/vp9_encodemb.c | 19 +- vp9/encoder/vp9_onyx_if.c | 6 - vp9/encoder/vp9_onyx_int.h | 40 +- vp9/encoder/vp9_ratectrl.c | 6 - vp9/encoder/vp9_rdopt.c | 63 +-- vp9/encoder/vp9_tokenize.c | 227 +++----- vp9/encoder/vp9_tokenize.h | 12 +- 17 files changed, 882 insertions(+), 1042 deletions(-) diff --git a/vp9/common/vp9_default_coef_probs.h b/vp9/common/vp9_default_coef_probs.h index 3e78c0b..6309566 100644 --- a/vp9/common/vp9_default_coef_probs.h +++ b/vp9/common/vp9_default_coef_probs.h @@ -11,464 +11,603 @@ /*Generated file, included by vp9_entropy.c*/ -static const vp9_coeff_probs default_coef_probs_4x4[BLOCK_TYPES_4X4] = { +static const vp9_coeff_probs default_coef_probs_4x4[BLOCK_TYPES] = { { /* block Type 0 */ - { /* Coeff Band 0 */ - { 217, 106, 221, 236, 184, 182, 233, 176, 236, 225, 152 }, - { 132, 100, 186, 213, 166, 172, 206, 155, 227, 192, 183 }, - { 39, 86, 136, 179, 147, 163, 179, 140, 228, 177, 201 }, - { 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 */ - { 1, 166, 224, 238, 190, 184, 229, 172, 249, 215, 255 }, - { 69, 139, 208, 238, 190, 185, 231, 174, 250, 216, 249 }, - { 21, 96, 157, 236, 178, 187, 232, 175, 251, 216, 228 }, - { 9, 68, 106, 220, 133, 168, 235, 182, 251, 213, 235 }, - { 2, 41, 62, 153, 109, 143, 230, 146, 251, 222, 228 }, - { 1, 19, 29, 80, 97, 137, 134, 105, 237, 181, 222 } - }, { /* Coeff Band 2 */ - { 1, 142, 214, 234, 184, 184, 224, 171, 246, 210, 209 }, - { 43, 127, 183, 227, 173, 178, 223, 169, 246, 205, 216 }, - { 6, 91, 132, 212, 152, 170, 219, 162, 246, 203, 229 }, - { 2, 66, 96, 189, 130, 159, 214, 155, 246, 203, 222 }, - { 1, 43, 62, 143, 111, 146, 194, 135, 244, 198, 223 }, - { 1, 24, 34, 87, 101, 140, 133, 111, 226, 163, 214 } - }, { /* Coeff Band 3 */ - { 1, 153, 215, 237, 188, 185, 234, 176, 252, 221, 244 }, - { 46, 130, 190, 232, 177, 181, 233, 174, 253, 220, 241 }, - { 6, 90, 140, 220, 159, 173, 230, 169, 252, 218, 241 }, - { 2, 62, 99, 200, 136, 164, 225, 161, 252, 216, 239 }, - { 1, 36, 58, 155, 109, 147, 208, 144, 250, 207, 235 }, - { 1, 17, 27, 81, 93, 136, 146, 109, 237, 175, 221 } - }, { /* Coeff Band 4 */ - { 1, 157, 218, 243, 194, 190, 241, 186, 252, 224, 228 }, - { 66, 129, 194, 237, 180, 185, 239, 182, 253, 225, 248 }, - { 14, 95, 152, 226, 162, 177, 237, 177, 253, 224, 249 }, - { 5, 69, 112, 210, 143, 168, 231, 168, 253, 221, 240 }, - { 1, 42, 68, 172, 115, 153, 217, 153, 253, 215, 246 }, - { 1, 20, 31, 96, 93, 133, 169, 118, 243, 191, 224 } - }, { /* Coeff Band 5 */ - { 1, 113, 226, 247, 200, 195, 245, 192, 255, 233, 128 }, - { 125, 90, 208, 243, 191, 190, 244, 190, 254, 233, 238 }, - { 55, 74, 164, 236, 174, 184, 242, 185, 254, 232, 255 }, - { 28, 58, 122, 221, 148, 172, 238, 178, 254, 229, 225 }, - { 11, 39, 75, 178, 118, 154, 225, 158, 254, 225, 246 }, - { 5, 21, 38, 105, 97, 140, 171, 119, 247, 193, 246 } + { /* Intra */ + { /* Coeff Band 0 */ + { 208, 26, 124, 168, 135, 159, 164, 134, 213, 172, 169 }, + { 112, 36, 114, 171, 139, 161, 165, 138, 208, 167, 168 }, + { 21, 27, 55, 109, 115, 147, 126, 121, 190, 151, 167 } + }, { /* Coeff Band 1 */ + { 1, 94, 156, 203, 156, 169, 200, 154, 230, 184, 206 }, + { 85, 91, 161, 202, 155, 170, 198, 151, 233, 184, 214 }, + { 57, 78, 131, 203, 157, 169, 198, 152, 231, 184, 214 }, + { 36, 68, 104, 191, 135, 164, 199, 153, 231, 183, 208 }, + { 16, 51, 68, 154, 115, 150, 192, 140, 231, 184, 210 }, + { 5, 31, 32, 83, 100, 140, 121, 115, 192, 153, 182 } + }, { /* Coeff Band 2 */ + { 1, 72, 146, 177, 149, 168, 157, 135, 200, 159, 184 }, + { 68, 72, 148, 180, 153, 166, 157, 139, 198, 156, 187 }, + { 29, 68, 112, 178, 150, 162, 159, 144, 191, 153, 183 }, + { 12, 57, 83, 164, 125, 157, 162, 141, 186, 156, 178 }, + { 4, 42, 52, 125, 108, 145, 161, 130, 190, 166, 170 }, + { 1, 28, 25, 67, 98, 138, 99, 110, 175, 143, 167 } + }, { /* Coeff Band 3 */ + { 1, 113, 176, 199, 161, 171, 167, 146, 188, 154, 194 }, + { 75, 97, 166, 206, 161, 172, 188, 156, 203, 164, 208 }, + { 31, 83, 131, 200, 152, 168, 191, 157, 200, 169, 206 }, + { 18, 70, 99, 185, 131, 162, 194, 153, 202, 177, 201 }, + { 8, 55, 70, 146, 115, 150, 187, 136, 215, 188, 191 }, + { 2, 46, 42, 87, 109, 144, 111, 117, 185, 148, 182 } + }, { /* Coeff Band 4 */ + { 1, 128, 191, 217, 169, 174, 203, 163, 201, 178, 196 }, + { 73, 105, 177, 220, 168, 175, 212, 167, 222, 185, 212 }, + { 22, 82, 135, 212, 157, 172, 212, 165, 220, 187, 213 }, + { 10, 65, 95, 194, 133, 162, 210, 160, 223, 194, 208 }, + { 5, 45, 59, 145, 108, 147, 196, 142, 230, 196, 197 }, + { 2, 30, 29, 76, 98, 140, 119, 112, 205, 158, 185 } + }, { /* Coeff Band 5 */ + { 1, 101, 208, 232, 179, 179, 236, 181, 243, 216, 210 }, + { 110, 84, 194, 231, 177, 180, 233, 177, 246, 213, 224 }, + { 50, 68, 148, 224, 166, 177, 229, 173, 245, 209, 215 }, + { 29, 55, 105, 207, 139, 168, 224, 167, 244, 207, 225 }, + { 17, 38, 65, 157, 111, 148, 206, 148, 242, 202, 215 }, + { 7, 18, 28, 76, 96, 138, 125, 111, 219, 162, 206 } + } + }, { /* Inter */ + { /* Coeff Band 0 */ + { 221, 105, 211, 220, 170, 171, 233, 173, 241, 200, 201 }, + { 144, 102, 184, 206, 160, 167, 209, 163, 227, 186, 193 }, + { 51, 84, 132, 174, 146, 161, 165, 144, 190, 163, 175 } + }, { /* Coeff Band 1 */ + { 1, 167, 216, 217, 170, 171, 217, 178, 213, 176, 216 }, + { 89, 146, 210, 227, 185, 182, 198, 165, 203, 166, 216 }, + { 37, 117, 171, 232, 185, 185, 197, 175, 191, 159, 212 }, + { 30, 99, 128, 224, 150, 177, 210, 179, 183, 162, 211 }, + { 25, 84, 92, 173, 121, 150, 222, 161, 201, 199, 201 }, + { 8, 56, 65, 121, 119, 148, 150, 124, 198, 170, 191 } + }, { /* Coeff Band 2 */ + { 1, 133, 198, 206, 166, 172, 188, 157, 211, 167, 206 }, + { 62, 122, 178, 203, 170, 174, 160, 151, 193, 148, 203 }, + { 19, 94, 126, 195, 156, 172, 156, 159, 172, 135, 199 }, + { 15, 78, 89, 173, 122, 158, 163, 155, 153, 138, 191 }, + { 13, 63, 61, 120, 109, 141, 167, 138, 159, 174, 174 }, + { 1, 39, 44, 77, 113, 145, 92, 116, 162, 144, 166 } + }, { /* Coeff Band 3 */ + { 1, 157, 214, 222, 176, 176, 208, 168, 213, 174, 219 }, + { 80, 134, 199, 223, 180, 181, 191, 162, 200, 161, 218 }, + { 27, 104, 155, 219, 168, 177, 192, 168, 186, 154, 214 }, + { 23, 87, 114, 203, 138, 166, 199, 165, 178, 163, 210 }, + { 16, 74, 84, 153, 118, 150, 198, 144, 194, 189, 198 }, + { 1, 50, 64, 110, 121, 149, 118, 125, 177, 149, 194 } + }, { /* Coeff Band 4 */ + { 1, 164, 216, 229, 181, 178, 223, 172, 228, 197, 221 }, + { 86, 140, 196, 225, 176, 179, 215, 169, 220, 189, 222 }, + { 30, 107, 149, 217, 160, 175, 216, 169, 212, 187, 219 }, + { 24, 85, 109, 197, 133, 161, 215, 162, 211, 195, 214 }, + { 17, 67, 76, 150, 114, 148, 202, 144, 222, 203, 204 }, + { 3, 46, 55, 100, 111, 144, 140, 117, 215, 173, 197 } + }, { /* Coeff Band 5 */ + { 1, 120, 224, 237, 184, 181, 241, 188, 249, 228, 231 }, + { 139, 95, 209, 236, 184, 184, 237, 182, 247, 224, 230 }, + { 67, 79, 160, 232, 172, 181, 236, 182, 246, 219, 233 }, + { 48, 65, 120, 216, 141, 168, 234, 177, 245, 219, 229 }, + { 32, 52, 85, 171, 119, 151, 222, 156, 246, 216, 224 }, + { 13, 39, 58, 112, 111, 144, 157, 121, 229, 182, 211 } + } } }, { /* block Type 1 */ - { /* Coeff Band 0 */ - { 240, 66, 234, 234, 188, 182, 224, 172, 242, 204, 186 }, - { 153, 73, 194, 210, 169, 173, 196, 152, 229, 184, 196 }, - { 55, 61, 125, 168, 144, 161, 169, 136, 227, 173, 210 }, - { 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 */ - { 1, 150, 232, 235, 190, 182, 228, 174, 250, 212, 255 }, - { 144, 131, 216, 235, 191, 187, 225, 171, 249, 215, 249 }, - { 58, 101, 175, 235, 184, 188, 227, 173, 251, 218, 255 }, - { 26, 75, 127, 225, 149, 177, 229, 179, 251, 215, 246 }, - { 11, 48, 80, 177, 117, 150, 229, 159, 251, 215, 243 }, - { 5, 28, 42, 103, 104, 141, 161, 115, 240, 186, 229 } - }, { /* Coeff Band 2 */ - { 1, 114, 220, 232, 186, 184, 221, 169, 245, 199, 251 }, - { 94, 110, 185, 224, 173, 178, 222, 166, 245, 211, 224 }, - { 22, 80, 132, 211, 154, 171, 218, 162, 249, 208, 242 }, - { 7, 59, 95, 189, 130, 160, 213, 154, 248, 210, 244 }, - { 1, 37, 58, 141, 109, 146, 197, 136, 247, 199, 237 }, - { 1, 20, 31, 82, 96, 135, 137, 112, 235, 166, 228 } - }, { /* Coeff Band 3 */ - { 1, 145, 223, 238, 191, 186, 233, 178, 253, 221, 255 }, - { 102, 126, 196, 232, 178, 182, 232, 176, 253, 217, 241 }, - { 27, 96, 155, 221, 161, 174, 230, 172, 252, 220, 255 }, - { 7, 71, 116, 205, 146, 167, 226, 164, 251, 216, 239 }, - { 1, 46, 74, 171, 118, 153, 209, 149, 252, 213, 234 }, - { 1, 22, 35, 102, 97, 136, 171, 117, 244, 194, 233 } - }, { /* Coeff Band 4 */ - { 1, 152, 227, 244, 198, 192, 241, 189, 255, 241, 128 }, - { 103, 137, 204, 239, 185, 187, 242, 185, 255, 234, 128 }, - { 29, 106, 166, 231, 169, 179, 239, 181, 255, 236, 128 }, - { 10, 79, 129, 217, 152, 171, 235, 173, 255, 233, 128 }, - { 2, 50, 84, 187, 125, 159, 224, 158, 255, 223, 255 }, - { 1, 26, 45, 122, 101, 139, 194, 130, 249, 205, 255 } - }, { /* Coeff Band 5 */ - { 1, 122, 234, 249, 208, 201, 249, 200, 255, 253, 128 }, - { 133, 107, 213, 246, 197, 194, 248, 197, 255, 246, 128 }, - { 56, 86, 170, 240, 179, 187, 249, 192, 255, 239, 128 }, - { 25, 67, 129, 225, 150, 175, 245, 186, 255, 240, 128 }, - { 10, 47, 87, 190, 124, 155, 237, 168, 255, 231, 128 }, - { 13, 32, 57, 133, 95, 159, 193, 141, 254, 207, 128 } + { /* Intra */ + { /* Coeff Band 0 */ + { 220, 21, 181, 217, 157, 178, 234, 145, 248, 236, 173 }, + { 125, 26, 143, 206, 148, 172, 213, 151, 240, 207, 199 }, + { 44, 28, 84, 150, 125, 154, 171, 133, 225, 179, 192 } + }, { /* Coeff Band 1 */ + { 1, 137, 209, 231, 181, 181, 223, 173, 245, 202, 236 }, + { 147, 130, 214, 232, 181, 183, 224, 172, 245, 204, 220 }, + { 111, 112, 183, 234, 188, 186, 223, 175, 246, 202, 237 }, + { 89, 100, 159, 227, 163, 178, 222, 173, 246, 203, 220 }, + { 55, 80, 124, 201, 142, 166, 219, 163, 246, 205, 223 }, + { 23, 45, 70, 130, 119, 151, 157, 128, 224, 170, 207 } + }, { /* Coeff Band 2 */ + { 1, 62, 195, 228, 177, 179, 220, 170, 244, 201, 226 }, + { 87, 84, 172, 218, 165, 176, 212, 163, 242, 199, 228 }, + { 28, 87, 124, 206, 154, 168, 209, 159, 241, 195, 227 }, + { 10, 72, 94, 181, 127, 159, 200, 150, 240, 193, 226 }, + { 4, 47, 58, 129, 109, 145, 176, 132, 237, 183, 222 }, + { 1, 24, 26, 65, 95, 137, 109, 104, 210, 151, 197 } + }, { /* Coeff Band 3 */ + { 1, 127, 206, 236, 183, 183, 230, 180, 247, 211, 234 }, + { 113, 118, 195, 228, 174, 180, 225, 172, 248, 208, 231 }, + { 43, 109, 162, 221, 166, 175, 220, 168, 248, 207, 232 }, + { 17, 88, 126, 208, 152, 171, 214, 161, 247, 203, 236 }, + { 5, 60, 84, 172, 125, 154, 199, 149, 244, 194, 237 }, + { 1, 29, 41, 99, 104, 147, 146, 116, 227, 170, 223 } + }, { /* Coeff Band 4 */ + { 1, 151, 222, 239, 193, 188, 231, 177, 250, 218, 241 }, + { 114, 126, 203, 230, 180, 181, 226, 171, 249, 212, 246 }, + { 51, 97, 175, 218, 166, 176, 220, 165, 250, 211, 231 }, + { 23, 77, 136, 204, 155, 169, 213, 157, 248, 205, 241 }, + { 6, 50, 85, 169, 126, 158, 197, 146, 245, 197, 243 }, + { 1, 21, 37, 97, 101, 146, 146, 119, 232, 169, 232 } + }, { /* Coeff Band 5 */ + { 1, 117, 230, 239, 194, 187, 233, 179, 252, 222, 248 }, + { 148, 109, 210, 232, 184, 182, 227, 173, 252, 211, 244 }, + { 80, 84, 162, 222, 168, 178, 225, 167, 252, 207, 244 }, + { 43, 64, 122, 201, 142, 169, 218, 162, 251, 208, 254 }, + { 17, 41, 76, 155, 120, 154, 200, 141, 249, 204, 248 }, + { 5, 19, 35, 89, 99, 151, 140, 115, 241, 174, 244 } + } + }, { /* Inter */ + { /* Coeff Band 0 */ + { 240, 71, 232, 234, 178, 179, 246, 180, 251, 225, 232 }, + { 168, 71, 198, 225, 167, 173, 229, 173, 247, 211, 218 }, + { 75, 63, 144, 195, 150, 164, 192, 147, 245, 202, 213 } + }, { /* Coeff Band 1 */ + { 1, 165, 237, 243, 186, 184, 247, 206, 255, 238, 255 }, + { 159, 149, 229, 241, 192, 183, 244, 194, 255, 237, 239 }, + { 110, 126, 195, 243, 196, 196, 239, 187, 255, 237, 242 }, + { 89, 114, 170, 237, 168, 181, 239, 192, 254, 232, 241 }, + { 54, 96, 145, 210, 151, 166, 237, 173, 253, 234, 249 }, + { 17, 65, 108, 187, 140, 165, 194, 148, 244, 199, 227 } + }, { /* Coeff Band 2 */ + { 1, 124, 227, 239, 183, 184, 240, 195, 249, 224, 240 }, + { 112, 132, 206, 235, 183, 184, 232, 180, 246, 220, 234 }, + { 36, 116, 161, 228, 170, 180, 229, 176, 244, 218, 239 }, + { 22, 107, 126, 210, 139, 167, 225, 169, 244, 218, 229 }, + { 9, 82, 90, 163, 122, 151, 210, 149, 246, 212, 227 }, + { 1, 43, 51, 102, 105, 144, 152, 117, 234, 182, 213 } + }, { /* Coeff Band 3 */ + { 1, 160, 234, 244, 195, 188, 244, 197, 251, 231, 250 }, + { 119, 142, 220, 241, 192, 189, 241, 188, 251, 229, 243 }, + { 38, 110, 180, 238, 183, 185, 238, 185, 251, 227, 246 }, + { 27, 95, 130, 229, 164, 181, 234, 178, 251, 223, 233 }, + { 13, 79, 97, 185, 125, 153, 223, 164, 250, 217, 238 }, + { 1, 45, 57, 110, 111, 143, 164, 119, 235, 183, 220 } + }, { /* Coeff Band 4 */ + { 1, 166, 239, 247, 207, 196, 244, 198, 251, 225, 245 }, + { 119, 146, 224, 244, 199, 192, 240, 192, 251, 223, 240 }, + { 46, 108, 189, 237, 180, 191, 236, 186, 249, 218, 248 }, + { 29, 89, 154, 223, 165, 177, 228, 173, 250, 213, 224 }, + { 8, 63, 104, 189, 139, 163, 207, 154, 246, 200, 241 }, + { 1, 27, 40, 103, 102, 144, 146, 118, 230, 165, 223 } + }, { /* Coeff Band 5 */ + { 1, 131, 242, 247, 207, 193, 244, 199, 251, 225, 248 }, + { 150, 118, 231, 244, 202, 191, 239, 191, 252, 214, 241 }, + { 79, 98, 188, 236, 185, 186, 232, 182, 251, 212, 249 }, + { 55, 80, 145, 217, 154, 174, 222, 172, 250, 204, 253 }, + { 27, 56, 94, 162, 128, 153, 198, 143, 248, 199, 240 }, + { 4, 19, 33, 77, 98, 144, 129, 110, 237, 167, 241 } + } } } }; -static const vp9_coeff_probs default_hybrid_coef_probs_4x4[BLOCK_TYPES_4X4_HYBRID] = { +static const vp9_coeff_probs default_coef_probs_8x8[BLOCK_TYPES] = { { /* block Type 0 */ - { /* Coeff Band 0 */ - { 168, 42, 163, 192, 156, 165, 188, 147, 237, 185, 167 }, - { 68, 38, 98, 154, 135, 155, 155, 133, 216, 162, 190 }, - { 7, 25, 45, 101, 108, 143, 134, 117, 216, 159, 200 }, - { 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 */ - { 1, 71, 142, 195, 149, 164, 206, 149, 244, 198, 226 }, - { 56, 66, 133, 195, 148, 162, 205, 148, 244, 196, 236 }, - { 32, 57, 111, 193, 140, 162, 205, 147, 245, 197, 237 }, - { 15, 47, 87, 178, 122, 154, 208, 151, 245, 198, 233 }, - { 4, 34, 57, 138, 109, 144, 198, 131, 248, 203, 231 }, - { 1, 16, 23, 74, 93, 136, 125, 107, 226, 163, 216 } - }, { /* Coeff Band 2 */ - { 1, 69, 154, 204, 155, 166, 212, 150, 248, 203, 239 }, - { 47, 67, 137, 201, 150, 165, 212, 151, 246, 202, 236 }, - { 13, 56, 105, 190, 140, 161, 209, 148, 246, 202, 227 }, - { 3, 43, 74, 172, 122, 154, 205, 146, 246, 201, 230 }, - { 1, 26, 41, 126, 99, 141, 190, 131, 246, 195, 229 }, - { 1, 11, 17, 60, 85, 130, 122, 100, 226, 163, 214 } - }, { /* Coeff Band 3 */ - { 1, 92, 165, 213, 159, 170, 220, 161, 247, 208, 225 }, - { 44, 84, 147, 208, 154, 169, 219, 159, 248, 207, 229 }, - { 13, 66, 113, 198, 141, 166, 215, 154, 248, 207, 234 }, - { 4, 49, 82, 179, 124, 157, 211, 153, 247, 203, 227 }, - { 1, 30, 49, 139, 105, 145, 195, 135, 247, 201, 225 }, - { 1, 14, 22, 73, 89, 134, 137, 109, 234, 172, 212 } - }, { /* Coeff Band 4 */ - { 1, 105, 186, 226, 170, 177, 228, 170, 249, 214, 200 }, - { 53, 92, 164, 222, 165, 175, 228, 168, 251, 217, 222 }, - { 12, 71, 124, 213, 151, 172, 225, 166, 251, 215, 242 }, - { 3, 53, 89, 194, 129, 160, 222, 162, 251, 214, 237 }, - { 1, 32, 52, 149, 106, 146, 208, 142, 251, 212, 233 }, - { 1, 14, 23, 79, 89, 136, 149, 111, 238, 184, 222 } - }, { /* Coeff Band 5 */ - { 1, 83, 206, 238, 184, 184, 237, 179, 248, 225, 206 }, - { 103, 73, 187, 235, 178, 183, 237, 178, 250, 224, 246 }, - { 41, 61, 146, 228, 162, 176, 236, 177, 252, 223, 222 }, - { 17, 49, 105, 210, 139, 168, 233, 172, 253, 222, 242 }, - { 5, 33, 61, 167, 111, 150, 221, 152, 252, 220, 231 }, - { 1, 16, 28, 92, 90, 137, 168, 119, 244, 193, 231 } - } - } -}; -static const vp9_coeff_probs default_coef_probs_8x8[BLOCK_TYPES_8X8] = { - { /* block Type 0 */ - { /* Coeff Band 0 */ - { 166, 99, 221, 217, 170, 176, 208, 164, 239, 192, 168 }, - { 99, 92, 179, 196, 159, 166, 180, 144, 220, 173, 193 }, - { 25, 74, 122, 166, 142, 159, 167, 136, 219, 171, 197 }, - { 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 */ - { 1, 179, 220, 233, 183, 182, 224, 169, 251, 219, 255 }, - { 77, 156, 208, 233, 182, 180, 224, 171, 250, 216, 255 }, - { 29, 116, 174, 230, 174, 179, 226, 169, 250, 217, 247 }, - { 16, 87, 132, 219, 150, 171, 228, 171, 250, 214, 251 }, - { 6, 58, 86, 174, 122, 153, 223, 151, 251, 217, 247 }, - { 2, 29, 42, 97, 105, 142, 144, 113, 233, 173, 217 } - }, { /* Coeff Band 2 */ - { 1, 160, 212, 230, 181, 179, 220, 167, 246, 207, 246 }, - { 26, 134, 178, 222, 169, 175, 218, 163, 244, 202, 236 }, - { 4, 87, 128, 205, 150, 165, 214, 157, 246, 202, 240 }, - { 1, 61, 91, 180, 128, 157, 206, 147, 245, 199, 237 }, - { 1, 38, 56, 135, 108, 146, 184, 132, 242, 190, 235 }, - { 1, 20, 29, 77, 98, 138, 124, 108, 226, 159, 211 } - }, { /* Coeff Band 3 */ - { 1, 177, 218, 239, 191, 187, 231, 177, 249, 212, 244 }, - { 40, 138, 193, 234, 180, 183, 231, 175, 250, 213, 246 }, - { 6, 93, 144, 222, 160, 175, 228, 170, 250, 213, 230 }, - { 1, 63, 101, 200, 136, 164, 223, 162, 250, 210, 241 }, - { 1, 36, 59, 151, 109, 148, 204, 142, 249, 208, 235 }, - { 1, 17, 27, 82, 93, 136, 142, 110, 236, 177, 227 } - }, { /* Coeff Band 4 */ - { 1, 182, 219, 238, 190, 186, 233, 175, 251, 223, 247 }, - { 23, 142, 192, 232, 179, 182, 233, 173, 252, 220, 244 }, - { 2, 90, 139, 220, 158, 173, 230, 170, 252, 220, 245 }, - { 1, 59, 95, 196, 133, 162, 225, 161, 252, 218, 253 }, - { 1, 34, 55, 147, 106, 146, 208, 139, 251, 212, 239 }, - { 1, 17, 27, 79, 94, 135, 143, 109, 239, 181, 228 } - }, { /* Coeff Band 5 */ - { 1, 186, 221, 243, 195, 190, 241, 186, 254, 227, 245 }, - { 36, 141, 196, 237, 182, 185, 240, 184, 254, 226, 252 }, - { 5, 94, 147, 226, 161, 176, 238, 178, 254, 224, 239 }, - { 1, 63, 103, 205, 137, 165, 233, 168, 254, 226, 246 }, - { 1, 37, 61, 160, 110, 149, 215, 146, 253, 220, 247 }, - { 1, 18, 29, 87, 93, 134, 157, 112, 246, 187, 244 } + { /* Intra */ + { /* Coeff Band 0 */ + { 158, 29, 127, 187, 147, 164, 183, 146, 227, 188, 162 }, + { 74, 36, 101, 162, 138, 162, 154, 134, 206, 165, 167 }, + { 15, 28, 56, 109, 119, 151, 122, 120, 190, 151, 164 } + }, { /* Coeff Band 1 */ + { 1, 129, 178, 205, 163, 170, 200, 152, 236, 185, 215 }, + { 61, 129, 178, 205, 162, 170, 201, 152, 237, 189, 212 }, + { 42, 113, 161, 203, 159, 168, 200, 153, 237, 188, 212 }, + { 30, 91, 129, 196, 149, 166, 201, 152, 236, 186, 213 }, + { 12, 63, 86, 169, 126, 155, 195, 145, 236, 187, 213 }, + { 6, 34, 33, 89, 100, 139, 132, 115, 206, 157, 183 } + }, { /* Coeff Band 2 */ + { 1, 75, 147, 182, 152, 162, 189, 141, 223, 179, 198 }, + { 36, 71, 125, 184, 141, 161, 204, 147, 241, 200, 202 }, + { 10, 56, 83, 163, 129, 153, 194, 140, 241, 194, 215 }, + { 6, 44, 59, 139, 110, 146, 178, 131, 237, 186, 219 }, + { 5, 35, 35, 96, 101, 140, 152, 117, 227, 170, 210 }, + { 2, 25, 14, 46, 88, 129, 90, 99, 186, 138, 173 } + }, { /* Coeff Band 3 */ + { 1, 135, 179, 191, 161, 166, 198, 136, 234, 184, 215 }, + { 55, 116, 171, 216, 163, 174, 214, 163, 232, 196, 201 }, + { 17, 89, 134, 205, 153, 166, 214, 159, 241, 200, 209 }, + { 9, 69, 98, 187, 132, 159, 206, 149, 243, 198, 215 }, + { 9, 53, 58, 142, 113, 151, 189, 135, 240, 187, 219 }, + { 3, 36, 23, 69, 90, 133, 121, 109, 206, 155, 183 } + }, { /* Coeff Band 4 */ + { 1, 163, 194, 208, 171, 171, 214, 140, 240, 191, 227 }, + { 45, 129, 180, 226, 172, 180, 216, 169, 229, 186, 224 }, + { 13, 94, 138, 216, 160, 171, 219, 167, 238, 198, 217 }, + { 13, 72, 99, 196, 131, 160, 213, 156, 243, 201, 213 }, + { 18, 62, 54, 136, 109, 149, 197, 132, 242, 193, 212 }, + { 5, 40, 25, 60, 92, 133, 111, 105, 200, 150, 179 } + }, { /* Coeff Band 5 */ + { 1, 187, 223, 230, 197, 185, 216, 139, 241, 174, 241 }, + { 58, 144, 205, 236, 189, 188, 209, 168, 231, 172, 234 }, + { 18, 104, 160, 226, 171, 180, 211, 170, 234, 180, 230 }, + { 11, 76, 115, 205, 143, 166, 205, 161, 234, 182, 218 }, + { 14, 66, 66, 138, 116, 150, 192, 128, 231, 180, 204 }, + { 1, 35, 32, 61, 104, 140, 89, 105, 187, 138, 171 } + } + }, { /* Inter */ + { /* Coeff Band 0 */ + { 177, 107, 211, 210, 163, 167, 237, 156, 238, 209, 204 }, + { 119, 101, 183, 200, 161, 168, 215, 148, 234, 191, 204 }, + { 39, 81, 127, 173, 144, 162, 182, 137, 226, 176, 202 } + }, { /* Coeff Band 1 */ + { 1, 175, 199, 199, 161, 158, 242, 141, 254, 226, 249 }, + { 89, 154, 205, 213, 178, 172, 235, 138, 254, 221, 245 }, + { 32, 123, 180, 231, 183, 185, 229, 158, 253, 216, 237 }, + { 23, 102, 134, 226, 155, 177, 231, 175, 253, 215, 244 }, + { 20, 88, 95, 176, 119, 151, 228, 154, 253, 218, 240 }, + { 7, 54, 64, 120, 115, 146, 168, 119, 238, 186, 212 } + }, { /* Coeff Band 2 */ + { 1, 151, 196, 204, 163, 163, 238, 144, 252, 219, 235 }, + { 43, 128, 179, 218, 171, 175, 227, 152, 251, 214, 231 }, + { 15, 94, 126, 216, 158, 174, 223, 165, 250, 211, 231 }, + { 17, 82, 90, 190, 120, 157, 219, 160, 249, 209, 228 }, + { 15, 87, 66, 123, 104, 139, 201, 130, 247, 202, 228 }, + { 1, 43, 35, 70, 98, 134, 134, 105, 226, 168, 203 } + }, { /* Coeff Band 3 */ + { 1, 172, 203, 207, 167, 163, 242, 146, 254, 225, 243 }, + { 52, 139, 194, 224, 179, 179, 232, 153, 253, 219, 237 }, + { 19, 102, 148, 225, 166, 180, 227, 170, 252, 217, 236 }, + { 24, 87, 105, 205, 132, 161, 225, 167, 252, 215, 235 }, + { 23, 90, 76, 140, 108, 144, 213, 138, 251, 211, 235 }, + { 2, 42, 39, 80, 97, 134, 151, 109, 236, 180, 216 } + }, { /* Coeff Band 4 */ + { 1, 183, 216, 216, 178, 168, 245, 145, 255, 226, 245 }, + { 48, 149, 203, 231, 186, 185, 233, 155, 254, 220, 243 }, + { 20, 108, 154, 227, 170, 181, 227, 169, 253, 219, 240 }, + { 32, 87, 109, 205, 136, 163, 223, 166, 253, 217, 241 }, + { 33, 91, 76, 139, 110, 144, 212, 135, 252, 212, 241 }, + { 2, 39, 39, 83, 99, 136, 150, 108, 239, 181, 226 } + }, { /* Coeff Band 5 */ + { 1, 196, 231, 239, 202, 187, 244, 160, 254, 222, 242 }, + { 60, 151, 213, 240, 193, 191, 236, 175, 254, 220, 242 }, + { 13, 107, 164, 231, 173, 181, 232, 177, 253, 219, 240 }, + { 9, 78, 118, 210, 145, 169, 227, 169, 253, 218, 242 }, + { 18, 65, 76, 160, 117, 151, 210, 144, 251, 210, 239 }, + { 1, 28, 38, 92, 101, 140, 148, 113, 237, 177, 227 } + } } }, { /* block Type 1 */ - { /* Coeff Band 0 */ - { 217, 55, 235, 221, 182, 179, 198, 159, 228, 177, 165 }, - { 121, 67, 195, 209, 172, 172, 193, 148, 231, 185, 202 }, - { 42, 71, 146, 205, 161, 174, 189, 150, 231, 182, 206 }, - { 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 */ - { 1, 171, 234, 242, 204, 191, 227, 172, 248, 204, 128 }, - { 152, 158, 225, 241, 202, 189, 224, 173, 245, 203, 255 }, - { 54, 133, 198, 239, 193, 188, 228, 178, 239, 218, 255 }, - { 24, 104, 156, 229, 163, 181, 227, 176, 253, 212, 255 }, - { 12, 62, 93, 185, 127, 156, 224, 162, 250, 213, 201 }, - { 6, 28, 41, 99, 100, 141, 151, 111, 229, 175, 197 } - }, { /* Coeff Band 2 */ - { 1, 126, 218, 245, 199, 196, 231, 180, 253, 218, 128 }, - { 71, 117, 186, 237, 185, 189, 225, 173, 253, 213, 255 }, - { 13, 90, 137, 218, 158, 175, 221, 165, 250, 213, 255 }, - { 4, 66, 96, 189, 132, 158, 215, 161, 250, 206, 244 }, - { 1, 41, 58, 137, 115, 143, 188, 132, 247, 198, 236 }, - { 1, 17, 27, 75, 100, 136, 118, 105, 215, 153, 188 } - }, { /* Coeff Band 3 */ - { 1, 171, 230, 245, 204, 193, 237, 183, 253, 214, 128 }, - { 84, 144, 210, 241, 193, 189, 234, 178, 249, 215, 255 }, - { 18, 111, 171, 230, 175, 180, 227, 173, 249, 212, 224 }, - { 4, 79, 123, 211, 151, 171, 223, 165, 249, 219, 236 }, - { 1, 43, 70, 167, 118, 152, 204, 150, 245, 202, 229 }, - { 1, 18, 28, 87, 95, 137, 138, 113, 222, 167, 185 } - }, { /* Coeff Band 4 */ - { 1, 181, 235, 247, 211, 196, 237, 183, 255, 215, 128 }, - { 74, 152, 213, 241, 196, 192, 233, 181, 246, 217, 239 }, - { 13, 107, 162, 230, 172, 180, 228, 173, 251, 209, 255 }, - { 2, 71, 112, 208, 141, 167, 222, 168, 245, 215, 239 }, - { 1, 40, 61, 160, 110, 150, 204, 146, 247, 197, 235 }, - { 1, 15, 25, 76, 92, 138, 134, 106, 226, 167, 209 } - }, { /* Coeff Band 5 */ - { 1, 195, 238, 246, 208, 196, 239, 186, 252, 215, 128 }, - { 78, 156, 217, 241, 194, 191, 236, 181, 254, 219, 128 }, - { 14, 108, 164, 229, 170, 180, 232, 173, 251, 225, 255 }, - { 2, 70, 111, 206, 143, 165, 226, 166, 251, 220, 255 }, - { 1, 37, 61, 155, 110, 148, 208, 143, 250, 211, 255 }, - { 1, 16, 26, 80, 88, 138, 144, 108, 238, 183, 226 } - } - } -}; -static const vp9_coeff_probs default_hybrid_coef_probs_8x8[BLOCK_TYPES_8X8_HYBRID] = { - { /* block Type 0 */ - { /* Coeff Band 0 */ - { 93, 40, 105, 152, 129, 148, 184, 131, 233, 185, 181 }, - { 30, 34, 68, 124, 118, 145, 154, 121, 222, 174, 179 }, - { 5, 23, 40, 94, 105, 141, 128, 115, 209, 155, 183 }, - { 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 */ - { 1, 106, 149, 201, 153, 167, 216, 163, 249, 198, 192 }, - { 48, 100, 142, 200, 153, 168, 214, 156, 243, 199, 213 }, - { 26, 88, 131, 201, 147, 167, 211, 155, 244, 211, 171 }, - { 13, 74, 113, 192, 136, 161, 212, 159, 237, 194, 214 }, - { 3, 54, 84, 170, 121, 151, 207, 149, 243, 198, 214 }, - { 1, 27, 41, 105, 103, 142, 151, 122, 219, 169, 189 } - }, { /* Coeff Band 2 */ - { 1, 79, 131, 195, 143, 162, 211, 156, 245, 203, 215 }, - { 22, 76, 110, 183, 133, 159, 205, 147, 246, 206, 232 }, - { 7, 65, 92, 165, 128, 150, 197, 139, 243, 198, 208 }, - { 2, 53, 75, 151, 124, 150, 187, 135, 242, 186, 223 }, - { 1, 36, 55, 124, 112, 147, 164, 125, 232, 174, 214 }, - { 1, 17, 25, 72, 91, 134, 108, 110, 197, 149, 169 } - }, { /* Coeff Band 3 */ - { 1, 154, 188, 221, 170, 174, 218, 163, 244, 204, 206 }, - { 39, 112, 161, 213, 159, 172, 216, 160, 244, 204, 224 }, - { 7, 83, 125, 200, 147, 164, 210, 156, 243, 198, 212 }, - { 2, 59, 94, 182, 131, 157, 205, 149, 240, 194, 217 }, - { 1, 36, 58, 143, 112, 148, 187, 137, 237, 186, 212 }, - { 1, 15, 24, 73, 93, 134, 121, 109, 206, 156, 180 } - }, { /* Coeff Band 4 */ - { 1, 154, 179, 223, 168, 176, 220, 166, 244, 205, 215 }, - { 21, 111, 156, 215, 160, 171, 218, 164, 244, 201, 208 }, - { 4, 79, 121, 202, 147, 167, 213, 160, 244, 202, 213 }, - { 1, 57, 90, 181, 131, 159, 202, 152, 241, 199, 204 }, - { 1, 34, 54, 136, 108, 146, 182, 134, 237, 188, 205 }, - { 1, 14, 21, 65, 91, 138, 110, 106, 200, 154, 174 } - }, { /* Coeff Band 5 */ - { 1, 175, 204, 235, 184, 182, 228, 171, 247, 214, 232 }, - { 38, 122, 178, 227, 172, 179, 227, 171, 248, 207, 216 }, - { 9, 86, 136, 214, 154, 170, 222, 165, 247, 206, 244 }, - { 2, 60, 98, 192, 134, 160, 214, 157, 245, 206, 218 }, - { 1, 34, 58, 145, 110, 148, 191, 138, 242, 194, 220 }, - { 1, 13, 22, 69, 89, 136, 121, 110, 212, 159, 192 } + { /* Intra */ + { /* Coeff Band 0 */ + { 202, 29, 181, 221, 168, 177, 217, 162, 235, 202, 157 }, + { 117, 39, 146, 207, 155, 172, 203, 155, 236, 192, 208 }, + { 46, 40, 99, 171, 136, 161, 176, 140, 229, 177, 208 } + }, { /* Coeff Band 1 */ + { 1, 138, 204, 227, 179, 181, 224, 161, 249, 203, 237 }, + { 116, 138, 209, 227, 179, 180, 222, 165, 248, 204, 241 }, + { 63, 112, 184, 227, 183, 178, 223, 167, 248, 206, 237 }, + { 47, 84, 140, 219, 163, 177, 223, 160, 249, 207, 241 }, + { 25, 53, 76, 179, 120, 156, 217, 152, 248, 205, 232 }, + { 10, 23, 29, 76, 91, 132, 145, 109, 228, 169, 214 } + }, { /* Coeff Band 2 */ + { 1, 69, 198, 223, 179, 177, 225, 154, 251, 208, 227 }, + { 78, 78, 170, 223, 170, 179, 218, 162, 248, 203, 245 }, + { 26, 69, 117, 209, 154, 170, 215, 160, 249, 205, 239 }, + { 16, 54, 79, 180, 119, 156, 208, 151, 248, 201, 238 }, + { 12, 43, 45, 119, 102, 142, 186, 126, 245, 193, 236 }, + { 1, 24, 22, 60, 92, 133, 114, 99, 221, 154, 210 } + }, { /* Coeff Band 3 */ + { 1, 135, 214, 222, 183, 178, 230, 144, 252, 208, 241 }, + { 107, 122, 201, 229, 181, 182, 221, 165, 250, 202, 243 }, + { 38, 100, 168, 221, 168, 176, 220, 166, 250, 208, 240 }, + { 21, 83, 125, 206, 149, 167, 217, 160, 250, 209, 238 }, + { 16, 65, 80, 164, 122, 156, 208, 139, 250, 206, 246 }, + { 3, 37, 43, 104, 103, 143, 156, 118, 237, 173, 227 } + }, { /* Coeff Band 4 */ + { 1, 169, 223, 233, 193, 184, 234, 150, 254, 206, 243 }, + { 83, 140, 201, 233, 184, 185, 228, 168, 252, 203, 223 }, + { 19, 104, 158, 225, 168, 179, 228, 169, 253, 207, 248 }, + { 10, 76, 117, 209, 145, 168, 223, 166, 252, 210, 243 }, + { 8, 59, 79, 163, 119, 153, 213, 142, 250, 205, 230 }, + { 1, 31, 43, 100, 103, 144, 149, 116, 240, 171, 221 } + }, { /* Coeff Band 5 */ + { 1, 190, 234, 247, 211, 197, 239, 172, 255, 208, 236 }, + { 65, 152, 218, 244, 199, 194, 236, 184, 252, 199, 249 }, + { 17, 109, 173, 237, 179, 186, 235, 183, 250, 205, 255 }, + { 6, 78, 127, 219, 153, 173, 231, 177, 251, 210, 249 }, + { 3, 56, 77, 172, 121, 157, 215, 152, 249, 209, 247 }, + { 1, 29, 38, 96, 97, 144, 152, 114, 239, 169, 243 } + } + }, { /* Inter */ + { /* Coeff Band 0 */ + { 223, 71, 225, 221, 176, 169, 242, 165, 248, 216, 201 }, + { 147, 79, 197, 215, 175, 172, 230, 154, 243, 203, 184 }, + { 69, 75, 152, 197, 158, 168, 203, 144, 231, 187, 177 } + }, { /* Coeff Band 1 */ + { 1, 168, 219, 195, 168, 151, 249, 131, 255, 221, 255 }, + { 152, 156, 226, 210, 189, 173, 240, 121, 255, 215, 238 }, + { 82, 128, 198, 239, 201, 194, 220, 151, 254, 202, 251 }, + { 74, 107, 150, 236, 163, 187, 222, 177, 255, 204, 255 }, + { 59, 103, 120, 181, 125, 148, 232, 157, 255, 219, 245 }, + { 21, 63, 84, 129, 122, 150, 171, 118, 246, 196, 226 } + }, { /* Coeff Band 2 */ + { 1, 133, 219, 202, 174, 158, 244, 133, 255, 214, 237 }, + { 101, 132, 204, 221, 187, 183, 225, 131, 253, 201, 247 }, + { 41, 107, 147, 228, 174, 187, 211, 162, 252, 201, 246 }, + { 40, 107, 107, 205, 129, 162, 213, 164, 252, 206, 232 }, + { 24, 140, 90, 122, 111, 141, 210, 127, 251, 208, 239 }, + { 1, 59, 55, 91, 111, 141, 144, 109, 241, 180, 226 } + }, { /* Coeff Band 3 */ + { 1, 170, 226, 200, 179, 153, 245, 138, 255, 214, 241 }, + { 111, 149, 217, 226, 194, 186, 223, 137, 255, 211, 253 }, + { 40, 113, 174, 228, 180, 183, 211, 165, 255, 212, 247 }, + { 44, 101, 126, 210, 151, 167, 212, 161, 255, 217, 241 }, + { 43, 131, 103, 146, 119, 148, 211, 136, 254, 216, 250 }, + { 1, 57, 63, 112, 116, 145, 158, 115, 249, 193, 236 } + }, { /* Coeff Band 4 */ + { 1, 186, 233, 216, 191, 163, 241, 143, 255, 210, 255 }, + { 91, 161, 214, 225, 190, 181, 224, 150, 255, 212, 253 }, + { 26, 117, 163, 220, 172, 180, 218, 148, 255, 215, 252 }, + { 27, 90, 122, 203, 143, 167, 212, 159, 255, 213, 255 }, + { 21, 98, 113, 163, 130, 153, 208, 141, 255, 215, 248 }, + { 1, 47, 66, 130, 118, 151, 167, 123, 252, 199, 235 } + }, { /* Coeff Band 5 */ + { 1, 195, 236, 245, 211, 195, 238, 171, 255, 209, 248 }, + { 65, 156, 218, 245, 200, 196, 230, 185, 255, 212, 248 }, + { 13, 112, 172, 238, 180, 189, 231, 185, 255, 213, 250 }, + { 6, 83, 130, 224, 155, 177, 227, 180, 255, 214, 244 }, + { 5, 71, 91, 185, 133, 160, 214, 154, 254, 212, 248 }, + { 1, 45, 63, 128, 112, 147, 169, 129, 248, 190, 236 } + } } } }; -static const vp9_coeff_probs default_coef_probs_16x16[BLOCK_TYPES_16X16] = { +static const vp9_coeff_probs default_coef_probs_16x16[BLOCK_TYPES] = { { /* block Type 0 */ - { /* Coeff Band 0 */ - { 53, 59, 216, 198, 162, 169, 182, 147, 210, 176, 132 }, - { 19, 55, 157, 175, 153, 162, 156, 136, 198, 163, 161 }, - { 5, 45, 93, 140, 136, 156, 136, 126, 194, 154, 163 }, - { 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 */ - { 1, 180, 204, 215, 172, 178, 207, 155, 238, 193, 241 }, - { 140, 160, 195, 214, 169, 177, 203, 158, 235, 191, 190 }, - { 65, 129, 172, 211, 163, 174, 206, 155, 238, 195, 240 }, - { 36, 96, 137, 199, 148, 167, 204, 155, 240, 195, 216 }, - { 15, 62, 88, 161, 125, 153, 193, 138, 239, 192, 216 }, - { 3, 25, 37, 81, 104, 141, 114, 112, 200, 151, 176 } - }, { /* Coeff Band 2 */ - { 1, 152, 202, 213, 171, 172, 198, 157, 239, 193, 205 }, - { 41, 116, 158, 200, 158, 169, 193, 148, 235, 190, 213 }, - { 8, 79, 111, 179, 140, 165, 184, 144, 233, 178, 212 }, - { 2, 55, 80, 154, 123, 155, 176, 138, 231, 181, 203 }, - { 1, 32, 48, 111, 107, 140, 154, 120, 223, 170, 208 }, - { 1, 14, 21, 54, 96, 134, 88, 101, 182, 137, 170 } - }, { /* Coeff Band 3 */ - { 1, 198, 204, 232, 183, 182, 227, 172, 249, 213, 217 }, - { 13, 133, 174, 224, 169, 177, 227, 169, 249, 213, 220 }, - { 1, 82, 126, 210, 149, 169, 223, 165, 249, 211, 223 }, - { 1, 54, 87, 185, 128, 159, 216, 155, 249, 210, 228 }, - { 1, 31, 51, 136, 105, 144, 193, 134, 246, 201, 225 }, - { 1, 14, 22, 68, 91, 135, 122, 104, 219, 162, 194 } - }, { /* Coeff Band 4 */ - { 1, 193, 208, 224, 179, 178, 212, 160, 242, 198, 211 }, - { 23, 135, 175, 216, 166, 174, 211, 157, 244, 198, 214 }, - { 2, 83, 123, 199, 148, 166, 206, 153, 243, 196, 228 }, - { 1, 53, 83, 173, 126, 157, 199, 144, 242, 195, 214 }, - { 1, 29, 46, 123, 103, 143, 175, 127, 238, 186, 222 }, - { 1, 12, 19, 57, 92, 133, 104, 101, 205, 149, 190 } - }, { /* Coeff Band 5 */ - { 1, 207, 207, 231, 182, 182, 224, 169, 249, 209, 231 }, - { 13, 136, 176, 223, 169, 177, 223, 167, 249, 209, 226 }, - { 1, 82, 125, 208, 149, 169, 220, 163, 248, 208, 231 }, - { 1, 53, 85, 182, 126, 158, 212, 153, 248, 205, 230 }, - { 1, 29, 48, 131, 104, 143, 188, 131, 245, 197, 230 }, - { 1, 13, 20, 63, 90, 133, 116, 102, 221, 160, 204 } + { /* Intra */ + { /* Coeff Band 0 */ + { 22, 27, 75, 145, 125, 152, 158, 133, 203, 164, 150 }, + { 6, 27, 63, 124, 120, 150, 135, 127, 190, 154, 152 }, + { 1, 19, 36, 82, 107, 143, 101, 114, 176, 140, 152 } + }, { /* Coeff Band 1 */ + { 1, 104, 143, 189, 150, 164, 194, 146, 239, 191, 205 }, + { 49, 105, 143, 188, 149, 164, 194, 146, 238, 191, 204 }, + { 29, 96, 133, 186, 147, 163, 194, 146, 238, 192, 202 }, + { 14, 79, 112, 178, 139, 160, 193, 144, 237, 191, 205 }, + { 5, 50, 74, 151, 119, 150, 187, 137, 237, 190, 205 }, + { 1, 20, 29, 76, 98, 138, 116, 111, 197, 153, 168 } + }, { /* Coeff Band 2 */ + { 1, 61, 124, 173, 145, 162, 176, 137, 234, 179, 218 }, + { 22, 56, 98, 158, 134, 157, 171, 133, 234, 178, 216 }, + { 7, 44, 70, 137, 122, 151, 162, 128, 232, 175, 214 }, + { 2, 33, 50, 114, 110, 146, 149, 121, 229, 169, 213 }, + { 1, 21, 32, 84, 100, 139, 127, 112, 220, 158, 207 }, + { 1, 11, 16, 46, 91, 133, 79, 100, 175, 133, 163 } + }, { /* Coeff Band 3 */ + { 1, 121, 166, 205, 160, 170, 204, 153, 240, 195, 210 }, + { 34, 101, 146, 198, 153, 167, 202, 152, 239, 193, 213 }, + { 9, 78, 118, 187, 142, 163, 198, 148, 238, 192, 211 }, + { 3, 60, 90, 170, 130, 157, 192, 143, 237, 190, 210 }, + { 1, 39, 59, 138, 112, 148, 177, 132, 233, 183, 207 }, + { 1, 18, 28, 75, 96, 137, 117, 110, 199, 153, 173 } + }, { /* Coeff Band 4 */ + { 1, 148, 183, 220, 169, 175, 217, 164, 244, 203, 216 }, + { 24, 115, 157, 211, 159, 171, 214, 160, 243, 201, 217 }, + { 3, 81, 120, 197, 145, 166, 209, 155, 243, 200, 216 }, + { 1, 56, 88, 176, 129, 158, 200, 147, 241, 196, 216 }, + { 1, 33, 53, 134, 108, 147, 178, 132, 236, 184, 213 }, + { 1, 13, 20, 62, 91, 135, 107, 106, 197, 148, 179 } + }, { /* Coeff Band 5 */ + { 1, 195, 212, 238, 191, 187, 229, 176, 247, 210, 222 }, + { 22, 136, 185, 230, 176, 182, 226, 173, 247, 208, 219 }, + { 3, 88, 137, 215, 156, 173, 222, 167, 246, 207, 220 }, + { 1, 57, 94, 190, 133, 162, 213, 157, 245, 204, 217 }, + { 1, 30, 52, 138, 107, 147, 188, 135, 241, 193, 215 }, + { 1, 11, 19, 61, 89, 136, 110, 104, 203, 153, 175 } + } + }, { /* Inter */ + { /* Coeff Band 0 */ + { 27, 72, 214, 225, 182, 183, 188, 159, 196, 172, 138 }, + { 13, 69, 175, 209, 167, 173, 188, 152, 216, 174, 171 }, + { 5, 52, 103, 162, 138, 160, 159, 137, 202, 164, 167 } + }, { /* Coeff Band 1 */ + { 1, 174, 218, 237, 187, 186, 229, 176, 247, 212, 225 }, + { 122, 158, 210, 236, 185, 185, 228, 174, 247, 210, 217 }, + { 48, 133, 188, 234, 182, 184, 228, 173, 247, 210, 229 }, + { 24, 109, 157, 227, 165, 179, 227, 172, 248, 211, 226 }, + { 12, 82, 114, 198, 137, 162, 223, 162, 247, 209, 220 }, + { 6, 49, 66, 127, 116, 148, 159, 125, 221, 175, 178 } + }, { /* Coeff Band 2 */ + { 1, 151, 207, 229, 180, 181, 223, 168, 247, 210, 211 }, + { 40, 122, 175, 222, 170, 177, 220, 164, 245, 207, 209 }, + { 4, 84, 125, 207, 151, 169, 215, 159, 244, 205, 209 }, + { 1, 58, 89, 180, 129, 159, 206, 150, 243, 202, 204 }, + { 1, 35, 53, 131, 108, 145, 181, 130, 238, 192, 198 }, + { 1, 16, 24, 67, 95, 137, 109, 106, 192, 153, 155 } + }, { /* Coeff Band 3 */ + { 1, 172, 215, 238, 189, 187, 231, 178, 248, 213, 210 }, + { 44, 136, 190, 233, 179, 183, 229, 175, 248, 212, 212 }, + { 4, 94, 144, 222, 161, 176, 226, 170, 247, 211, 212 }, + { 1, 66, 103, 201, 139, 165, 219, 161, 247, 208, 212 }, + { 1, 39, 61, 153, 111, 149, 199, 142, 243, 200, 210 }, + { 1, 16, 25, 74, 93, 136, 124, 109, 204, 160, 171 } + }, { /* Coeff Band 4 */ + { 1, 185, 218, 241, 192, 190, 231, 180, 248, 213, 213 }, + { 32, 143, 191, 235, 181, 185, 229, 176, 248, 211, 215 }, + { 2, 97, 144, 223, 162, 177, 226, 171, 248, 210, 222 }, + { 1, 65, 102, 199, 138, 165, 218, 160, 247, 208, 214 }, + { 1, 35, 56, 145, 109, 147, 193, 137, 243, 198, 213 }, + { 1, 13, 21, 65, 91, 135, 115, 105, 205, 157, 179 } + }, { /* Coeff Band 5 */ + { 1, 209, 222, 243, 199, 192, 233, 181, 249, 215, 228 }, + { 23, 147, 197, 237, 185, 187, 231, 177, 249, 214, 227 }, + { 1, 94, 146, 224, 163, 178, 228, 172, 249, 213, 229 }, + { 1, 60, 99, 197, 136, 164, 220, 161, 248, 210, 227 }, + { 1, 31, 54, 141, 107, 147, 194, 136, 246, 201, 226 }, + { 1, 12, 21, 65, 90, 135, 119, 104, 217, 159, 201 } + } } }, { /* block Type 1 */ - { /* Coeff Band 0 */ - { 216, 35, 225, 222, 187, 173, 172, 156, 169, 181, 120 }, - { 104, 42, 176, 202, 167, 168, 169, 151, 194, 171, 133 }, - { 37, 44, 117, 169, 149, 166, 142, 132, 189, 161, 143 }, - { 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 */ - { 1, 177, 232, 220, 177, 171, 206, 159, 213, 137, 128 }, - { 197, 169, 225, 208, 177, 161, 214, 151, 192, 228, 255 }, - { 117, 147, 210, 211, 171, 174, 190, 165, 216, 190, 51 }, - { 66, 118, 169, 200, 172, 180, 189, 146, 226, 134, 255 }, - { 31, 77, 99, 166, 129, 165, 172, 141, 213, 184, 231 }, - { 8, 28, 33, 70, 107, 128, 107, 120, 181, 142, 165 } - }, { /* Coeff Band 2 */ - { 1, 109, 219, 228, 185, 169, 213, 167, 230, 190, 255 }, - { 98, 113, 171, 208, 167, 169, 189, 132, 242, 141, 255 }, - { 21, 81, 108, 181, 138, 148, 181, 140, 248, 169, 128 }, - { 6, 59, 72, 154, 114, 158, 176, 140, 237, 181, 230 }, - { 1, 43, 50, 98, 110, 148, 135, 126, 225, 151, 175 }, - { 1, 11, 14, 41, 100, 158, 72, 97, 157, 122, 144 } - }, { /* Coeff Band 3 */ - { 1, 198, 210, 228, 183, 181, 222, 165, 244, 216, 224 }, - { 35, 133, 177, 219, 167, 173, 220, 160, 245, 207, 200 }, - { 5, 83, 128, 204, 148, 169, 216, 157, 241, 196, 213 }, - { 1, 53, 87, 177, 123, 155, 209, 149, 247, 197, 219 }, - { 1, 29, 49, 127, 102, 144, 182, 127, 234, 192, 224 }, - { 1, 12, 19, 54, 86, 127, 103, 101, 201, 151, 179 } - }, { /* Coeff Band 4 */ - { 1, 185, 218, 226, 181, 183, 200, 162, 233, 177, 163 }, - { 65, 138, 177, 210, 171, 174, 194, 138, 233, 183, 243 }, - { 6, 84, 125, 193, 147, 171, 183, 147, 230, 174, 189 }, - { 1, 52, 77, 159, 128, 154, 176, 149, 228, 198, 234 }, - { 1, 25, 39, 106, 99, 141, 156, 128, 231, 166, 224 }, - { 1, 10, 15, 45, 99, 137, 83, 99, 186, 139, 175 } - }, { /* Coeff Band 5 */ - { 1, 197, 206, 224, 182, 179, 220, 162, 247, 215, 255 }, - { 23, 129, 170, 214, 164, 172, 211, 158, 247, 206, 219 }, - { 2, 78, 120, 196, 145, 165, 211, 155, 247, 195, 209 }, - { 1, 48, 80, 171, 118, 154, 200, 145, 240, 191, 235 }, - { 1, 25, 45, 120, 101, 146, 176, 127, 237, 183, 225 }, - { 1, 10, 19, 53, 89, 133, 105, 98, 203, 148, 204 } - } - } -}; -static const vp9_coeff_probs default_hybrid_coef_probs_16x16[BLOCK_TYPES_16X16_HYBRID] = { - { /* block Type 0 */ - { /* Coeff Band 0 */ - { 93, 40, 105, 152, 129, 148, 184, 131, 233, 185, 181 }, - { 30, 34, 68, 124, 118, 145, 154, 121, 222, 174, 179 }, - { 5, 23, 40, 94, 105, 141, 128, 115, 209, 155, 183 }, - { 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 */ - { 1, 106, 149, 201, 153, 167, 216, 163, 249, 198, 192 }, - { 48, 100, 142, 200, 153, 168, 214, 156, 243, 199, 213 }, - { 26, 88, 131, 201, 147, 167, 211, 155, 244, 211, 171 }, - { 13, 74, 113, 192, 136, 161, 212, 159, 237, 194, 214 }, - { 3, 54, 84, 170, 121, 151, 207, 149, 243, 198, 214 }, - { 1, 27, 41, 105, 103, 142, 151, 122, 219, 169, 189 } - }, { /* Coeff Band 2 */ - { 1, 79, 131, 195, 143, 162, 211, 156, 245, 203, 215 }, - { 22, 76, 110, 183, 133, 159, 205, 147, 246, 206, 232 }, - { 7, 65, 92, 165, 128, 150, 197, 139, 243, 198, 208 }, - { 2, 53, 75, 151, 124, 150, 187, 135, 242, 186, 223 }, - { 1, 36, 55, 124, 112, 147, 164, 125, 232, 174, 214 }, - { 1, 17, 25, 72, 91, 134, 108, 110, 197, 149, 169 } - }, { /* Coeff Band 3 */ - { 1, 154, 188, 221, 170, 174, 218, 163, 244, 204, 206 }, - { 39, 112, 161, 213, 159, 172, 216, 160, 244, 204, 224 }, - { 7, 83, 125, 200, 147, 164, 210, 156, 243, 198, 212 }, - { 2, 59, 94, 182, 131, 157, 205, 149, 240, 194, 217 }, - { 1, 36, 58, 143, 112, 148, 187, 137, 237, 186, 212 }, - { 1, 15, 24, 73, 93, 134, 121, 109, 206, 156, 180 } - }, { /* Coeff Band 4 */ - { 1, 154, 179, 223, 168, 176, 220, 166, 244, 205, 215 }, - { 21, 111, 156, 215, 160, 171, 218, 164, 244, 201, 208 }, - { 4, 79, 121, 202, 147, 167, 213, 160, 244, 202, 213 }, - { 1, 57, 90, 181, 131, 159, 202, 152, 241, 199, 204 }, - { 1, 34, 54, 136, 108, 146, 182, 134, 237, 188, 205 }, - { 1, 14, 21, 65, 91, 138, 110, 106, 200, 154, 174 } - }, { /* Coeff Band 5 */ - { 1, 175, 204, 235, 184, 182, 228, 171, 247, 214, 232 }, - { 38, 122, 178, 227, 172, 179, 227, 171, 248, 207, 216 }, - { 9, 86, 136, 214, 154, 170, 222, 165, 247, 206, 244 }, - { 2, 60, 98, 192, 134, 160, 214, 157, 245, 206, 218 }, - { 1, 34, 58, 145, 110, 148, 191, 138, 242, 194, 220 }, - { 1, 13, 22, 69, 89, 136, 121, 110, 212, 159, 192 } + { /* Intra */ + { /* Coeff Band 0 */ + { 198, 28, 192, 217, 170, 174, 201, 162, 219, 179, 159 }, + { 96, 36, 145, 198, 153, 167, 193, 153, 222, 180, 177 }, + { 31, 35, 89, 156, 131, 157, 166, 136, 214, 170, 178 } + }, { /* Coeff Band 1 */ + { 1, 138, 202, 225, 174, 178, 218, 164, 243, 200, 201 }, + { 147, 134, 202, 223, 174, 177, 215, 162, 243, 204, 220 }, + { 65, 115, 179, 224, 176, 177, 215, 162, 243, 202, 227 }, + { 25, 86, 141, 217, 163, 177, 216, 159, 243, 201, 225 }, + { 6, 48, 79, 181, 125, 157, 209, 151, 244, 201, 212 }, + { 1, 16, 25, 77, 91, 134, 132, 112, 210, 162, 180 } + }, { /* Coeff Band 2 */ + { 1, 78, 195, 222, 172, 177, 219, 162, 245, 205, 227 }, + { 67, 79, 154, 211, 158, 171, 212, 159, 243, 201, 222 }, + { 18, 63, 108, 192, 140, 163, 205, 152, 242, 197, 214 }, + { 6, 49, 77, 163, 121, 154, 192, 142, 239, 191, 216 }, + { 1, 34, 49, 112, 106, 143, 160, 122, 233, 178, 213 }, + { 1, 14, 20, 56, 93, 135, 94, 102, 189, 141, 170 } + }, { /* Coeff Band 3 */ + { 1, 137, 210, 229, 182, 181, 223, 164, 247, 214, 201 }, + { 89, 123, 189, 226, 176, 180, 217, 165, 245, 207, 216 }, + { 24, 100, 155, 217, 162, 176, 215, 163, 242, 198, 215 }, + { 8, 78, 121, 199, 147, 167, 206, 155, 241, 198, 212 }, + { 2, 52, 81, 161, 125, 156, 185, 139, 236, 186, 207 }, + { 1, 22, 35, 88, 102, 141, 121, 116, 199, 153, 179 } + }, { /* Coeff Band 4 */ + { 1, 169, 220, 239, 196, 191, 220, 173, 242, 201, 226 }, + { 64, 139, 195, 231, 183, 184, 215, 169, 240, 196, 211 }, + { 12, 103, 153, 217, 162, 174, 212, 163, 236, 195, 211 }, + { 3, 71, 109, 190, 141, 164, 202, 152, 240, 192, 220 }, + { 1, 38, 61, 139, 114, 149, 175, 133, 233, 183, 211 }, + { 1, 13, 22, 61, 93, 134, 101, 106, 194, 145, 185 } + }, { /* Coeff Band 5 */ + { 1, 204, 220, 234, 193, 185, 220, 166, 247, 207, 237 }, + { 42, 139, 187, 221, 174, 177, 215, 161, 246, 201, 242 }, + { 5, 83, 132, 204, 152, 168, 212, 158, 246, 203, 225 }, + { 1, 48, 84, 175, 126, 157, 203, 148, 245, 199, 233 }, + { 1, 24, 46, 123, 103, 142, 178, 128, 243, 189, 235 }, + { 1, 10, 19, 58, 88, 134, 109, 101, 216, 151, 216 } + } + }, { /* Inter */ + { /* Coeff Band 0 */ + { 227, 36, 243, 237, 206, 186, 210, 157, 245, 195, 200 }, + { 144, 41, 214, 226, 190, 182, 207, 155, 238, 193, 177 }, + { 63, 37, 153, 199, 162, 169, 193, 145, 227, 187, 152 } + }, { /* Coeff Band 1 */ + { 1, 170, 247, 248, 213, 201, 239, 188, 238, 203, 255 }, + { 214, 166, 242, 248, 212, 198, 236, 191, 221, 219, 199 }, + { 139, 148, 224, 247, 207, 197, 236, 189, 249, 241, 128 }, + { 102, 127, 195, 244, 190, 198, 235, 189, 239, 202, 228 }, + { 76, 106, 154, 227, 159, 176, 234, 182, 243, 216, 229 }, + { 52, 69, 93, 158, 125, 155, 173, 139, 225, 170, 209 } + }, { /* Coeff Band 2 */ + { 1, 139, 241, 245, 205, 193, 230, 177, 239, 198, 183 }, + { 131, 139, 214, 240, 191, 189, 224, 181, 236, 203, 194 }, + { 32, 102, 157, 228, 167, 177, 221, 174, 235, 191, 194 }, + { 12, 75, 112, 201, 142, 163, 208, 161, 227, 180, 200 }, + { 2, 45, 66, 142, 119, 154, 178, 141, 220, 171, 213 }, + { 1, 15, 20, 56, 102, 151, 87, 104, 182, 136, 175 } + }, { /* Coeff Band 3 */ + { 1, 174, 243, 248, 212, 201, 237, 194, 249, 207, 255 }, + { 134, 155, 223, 244, 200, 195, 230, 184, 248, 189, 233 }, + { 26, 115, 177, 235, 180, 185, 225, 176, 245, 198, 255 }, + { 8, 82, 129, 217, 156, 175, 220, 168, 243, 204, 228 }, + { 3, 48, 75, 165, 122, 155, 193, 145, 245, 189, 199 }, + { 1, 15, 27, 73, 101, 139, 117, 112, 212, 157, 209 } + }, { /* Coeff Band 4 */ + { 1, 191, 244, 248, 214, 200, 229, 185, 249, 207, 255 }, + { 106, 167, 221, 242, 198, 192, 223, 178, 245, 202, 246 }, + { 13, 117, 169, 229, 175, 182, 220, 170, 244, 202, 226 }, + { 2, 74, 114, 203, 143, 170, 211, 160, 248, 199, 232 }, + { 1, 35, 58, 141, 111, 144, 184, 132, 244, 196, 239 }, + { 1, 12, 22, 66, 91, 138, 114, 102, 225, 156, 214 } + }, { /* Coeff Band 5 */ + { 1, 220, 231, 246, 203, 196, 239, 188, 255, 212, 255 }, + { 42, 155, 203, 241, 189, 191, 235, 184, 253, 220, 255 }, + { 4, 95, 151, 230, 167, 182, 234, 178, 252, 217, 243 }, + { 1, 61, 105, 206, 140, 168, 226, 167, 250, 215, 242 }, + { 1, 31, 60, 151, 109, 148, 204, 142, 250, 208, 230 }, + { 1, 13, 26, 76, 93, 132, 139, 106, 236, 171, 237 } + } } } }; static const vp9_coeff_probs default_coef_probs_32x32[BLOCK_TYPES_32X32] = { { /* block Type 0 */ - { /* Coeff Band 0 */ - { 34, 33, 198, 199, 178, 175, 165, 143, 201, 180, 114 }, - { 18, 27, 136, 172, 153, 164, 154, 133, 196, 174, 127 }, - { 6, 23, 69, 126, 129, 154, 129, 122, 184, 159, 122 }, - { 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 */ - { 1, 172, 209, 214, 169, 166, 184, 110, 237, 176, 154 }, - { 190, 162, 204, 209, 171, 172, 190, 142, 227, 170, 205 }, - { 137, 137, 189, 210, 164, 174, 188, 154, 225, 195, 186 }, - { 89, 111, 161, 205, 173, 165, 191, 147, 243, 190, 171 }, - { 41, 73, 113, 176, 133, 161, 199, 147, 230, 170, 177 }, - { 6, 30, 42, 85, 113, 141, 115, 111, 148, 134, 110 } - }, { /* Coeff Band 2 */ - { 1, 133, 202, 201, 167, 167, 174, 159, 228, 164, 177 }, - { 81, 120, 158, 181, 154, 171, 151, 140, 227, 167, 150 }, - { 22, 91, 114, 170, 147, 154, 141, 137, 212, 146, 184 }, - { 7, 61, 75, 155, 116, 166, 143, 138, 215, 153, 178 }, - { 1, 34, 42, 103, 102, 137, 133, 138, 219, 161, 170 }, - { 1, 9, 11, 33, 94, 135, 51, 99, 130, 117, 96 } - }, { /* Coeff Band 3 */ - { 1, 217, 188, 204, 169, 169, 192, 147, 237, 186, 213 }, - { 11, 124, 151, 189, 153, 165, 188, 144, 236, 186, 211 }, - { 1, 68, 100, 170, 135, 159, 185, 141, 237, 185, 217 }, - { 1, 41, 64, 142, 115, 150, 176, 133, 235, 183, 212 }, - { 1, 22, 35, 97, 99, 138, 152, 117, 231, 174, 210 }, - { 1, 9, 15, 44, 89, 133, 83, 97, 186, 137, 170 } - }, { /* Coeff Band 4 */ - { 1, 197, 215, 225, 181, 177, 197, 161, 215, 167, 178 }, - { 47, 142, 183, 215, 171, 171, 192, 149, 210, 177, 175 }, - { 8, 94, 132, 195, 152, 170, 185, 140, 216, 183, 169 }, - { 1, 59, 86, 166, 127, 163, 175, 143, 216, 176, 144 }, - { 1, 28, 43, 108, 106, 145, 142, 126, 197, 159, 168 }, - { 1, 6, 10, 25, 89, 131, 46, 96, 114, 118, 111 } - }, { /* Coeff Band 5 */ - { 1, 226, 201, 212, 176, 173, 188, 148, 231, 178, 208 }, - { 13, 135, 163, 196, 159, 169, 183, 148, 225, 177, 199 }, - { 1, 74, 107, 177, 139, 162, 181, 144, 228, 176, 203 }, - { 1, 43, 67, 145, 118, 152, 170, 135, 226, 174, 201 }, - { 1, 22, 34, 94, 100, 138, 142, 116, 220, 166, 201 }, - { 1, 7, 12, 36, 88, 133, 70, 96, 168, 128, 158 } + { /* Intra */ + { /* Coeff Band 0 */ + { 38, 32, 115, 163, 140, 164, 143, 139, 167, 157, 105 }, + { 11, 27, 73, 131, 126, 154, 131, 129, 178, 151, 138 }, + { 2, 19, 36, 83, 107, 144, 102, 116, 169, 140, 149 } + }, { /* Coeff Band 1 */ + { 1, 116, 150, 184, 149, 164, 180, 140, 230, 178, 199 }, + { 71, 114, 149, 183, 150, 164, 181, 141, 229, 179, 203 }, + { 39, 102, 139, 182, 148, 164, 181, 142, 229, 179, 197 }, + { 16, 82, 117, 176, 143, 161, 180, 141, 230, 180, 200 }, + { 3, 49, 72, 148, 120, 152, 175, 134, 230, 178, 200 }, + { 1, 14, 21, 56, 94, 135, 92, 103, 179, 141, 158 } + }, { /* Coeff Band 2 */ + { 1, 56, 140, 180, 151, 164, 175, 140, 224, 175, 194 }, + { 28, 51, 101, 162, 135, 158, 170, 136, 222, 175, 193 }, + { 9, 38, 68, 137, 120, 151, 160, 129, 221, 172, 193 }, + { 3, 28, 47, 111, 108, 145, 145, 121, 216, 165, 192 }, + { 1, 17, 28, 76, 97, 137, 117, 110, 206, 152, 189 }, + { 1, 7, 11, 34, 89, 131, 62, 96, 154, 123, 148 } + }, { /* Coeff Band 3 */ + { 1, 129, 170, 198, 160, 169, 186, 147, 231, 181, 201 }, + { 45, 106, 147, 191, 152, 166, 186, 145, 228, 182, 197 }, + { 14, 81, 117, 178, 141, 161, 183, 143, 227, 184, 187 }, + { 4, 61, 89, 159, 129, 156, 178, 137, 226, 182, 174 }, + { 1, 39, 59, 126, 113, 146, 161, 126, 227, 176, 186 }, + { 1, 18, 26, 67, 98, 137, 103, 107, 190, 146, 166 } + }, { /* Coeff Band 4 */ + { 1, 152, 180, 211, 166, 173, 206, 154, 243, 197, 216 }, + { 24, 112, 150, 202, 155, 169, 204, 152, 242, 196, 212 }, + { 3, 76, 112, 186, 141, 163, 199, 148, 241, 195, 212 }, + { 1, 51, 80, 164, 124, 155, 191, 141, 240, 192, 212 }, + { 1, 30, 48, 123, 106, 144, 170, 127, 235, 182, 210 }, + { 1, 13, 20, 60, 92, 134, 102, 105, 189, 146, 160 } + }, { /* Coeff Band 5 */ + { 1, 212, 207, 235, 190, 187, 220, 170, 240, 200, 207 }, + { 11, 134, 179, 226, 175, 181, 214, 166, 236, 195, 201 }, + { 1, 86, 133, 210, 155, 172, 210, 161, 236, 194, 201 }, + { 1, 54, 88, 180, 129, 159, 200, 150, 235, 191, 200 }, + { 1, 27, 46, 122, 104, 143, 170, 128, 230, 181, 198 }, + { 1, 8, 15, 45, 88, 132, 81, 99, 171, 135, 154 } + } + }, { /* Inter */ + { /* Coeff Band 0 */ + { 50, 51, 216, 230, 193, 186, 193, 156, 219, 181, 168 }, + { 36, 44, 174, 210, 175, 174, 186, 149, 218, 179, 172 }, + { 12, 32, 100, 161, 140, 159, 162, 135, 209, 168, 172 } + }, { /* Coeff Band 1 */ + { 1, 179, 230, 238, 191, 185, 229, 171, 250, 213, 200 }, + { 167, 173, 225, 237, 190, 186, 231, 171, 245, 209, 223 }, + { 115, 153, 208, 237, 187, 186, 229, 174, 247, 215, 216 }, + { 71, 131, 182, 233, 176, 184, 228, 172, 247, 210, 238 }, + { 41, 108, 145, 214, 151, 169, 228, 169, 246, 208, 210 }, + { 19, 78, 95, 151, 128, 155, 168, 134, 218, 173, 175 } + }, { /* Coeff Band 2 */ + { 1, 147, 215, 231, 181, 181, 227, 171, 249, 212, 218 }, + { 65, 122, 179, 222, 168, 175, 223, 166, 248, 213, 216 }, + { 11, 85, 126, 204, 148, 167, 218, 159, 247, 208, 222 }, + { 4, 61, 89, 177, 128, 158, 206, 147, 246, 204, 208 }, + { 1, 38, 54, 130, 109, 145, 179, 128, 241, 191, 203 }, + { 1, 18, 24, 68, 96, 137, 110, 107, 196, 153, 145 } + }, { /* Coeff Band 3 */ + { 1, 182, 227, 239, 193, 187, 231, 177, 250, 214, 189 }, + { 73, 147, 202, 234, 182, 183, 230, 174, 248, 213, 219 }, + { 12, 104, 154, 223, 164, 176, 228, 171, 248, 210, 225 }, + { 3, 74, 113, 205, 143, 167, 222, 163, 246, 211, 214 }, + { 1, 45, 69, 163, 116, 151, 205, 144, 244, 202, 205 }, + { 1, 19, 30, 87, 96, 138, 134, 115, 199, 165, 133 } + }, { /* Coeff Band 4 */ + { 1, 198, 229, 242, 196, 190, 235, 182, 248, 216, 224 }, + { 55, 154, 201, 236, 183, 185, 233, 179, 247, 214, 190 }, + { 5, 101, 150, 225, 163, 177, 229, 172, 245, 210, 205 }, + { 1, 68, 106, 203, 140, 165, 223, 165, 246, 209, 194 }, + { 1, 38, 62, 154, 112, 149, 199, 143, 241, 198, 191 }, + { 1, 14, 22, 66, 94, 133, 109, 107, 178, 154, 122 } + }, { /* Coeff Band 5 */ + { 1, 237, 226, 244, 205, 196, 225, 177, 243, 203, 210 }, + { 24, 154, 200, 238, 189, 189, 221, 173, 240, 199, 210 }, + { 2, 98, 150, 224, 167, 179, 217, 168, 240, 199, 207 }, + { 1, 61, 99, 193, 137, 164, 207, 155, 239, 197, 208 }, + { 1, 28, 49, 128, 105, 145, 177, 130, 234, 185, 206 }, + { 1, 9, 16, 48, 89, 134, 89, 99, 183, 140, 169 } + } } } }; diff --git a/vp9/common/vp9_entropy.c b/vp9/common/vp9_entropy.c index 4e19ba0..759b901 100644 --- a/vp9/common/vp9_entropy.c +++ b/vp9/common/vp9_entropy.c @@ -255,19 +255,10 @@ int vp9_get_coef_context(int * recent_energy, int token) { void vp9_default_coef_probs(VP9_COMMON *pc) { vpx_memcpy(pc->fc.coef_probs_4x4, default_coef_probs_4x4, sizeof(pc->fc.coef_probs_4x4)); - vpx_memcpy(pc->fc.hybrid_coef_probs_4x4, default_hybrid_coef_probs_4x4, - sizeof(pc->fc.hybrid_coef_probs_4x4)); - vpx_memcpy(pc->fc.coef_probs_8x8, default_coef_probs_8x8, sizeof(pc->fc.coef_probs_8x8)); - vpx_memcpy(pc->fc.hybrid_coef_probs_8x8, default_hybrid_coef_probs_8x8, - sizeof(pc->fc.hybrid_coef_probs_8x8)); - vpx_memcpy(pc->fc.coef_probs_16x16, default_coef_probs_16x16, sizeof(pc->fc.coef_probs_16x16)); - vpx_memcpy(pc->fc.hybrid_coef_probs_16x16, - default_hybrid_coef_probs_16x16, - sizeof(pc->fc.hybrid_coef_probs_16x16)); vpx_memcpy(pc->fc.coef_probs_32x32, default_coef_probs_32x32, sizeof(pc->fc.coef_probs_32x32)); } @@ -290,28 +281,30 @@ static void update_coef_probs(vp9_coeff_probs *dst_coef_probs, vp9_coeff_probs *pre_coef_probs, int block_types, vp9_coeff_count *coef_counts, int count_sat, int update_factor) { - int t, i, j, k, count; + int t, i, j, k, l, count; unsigned int branch_ct[ENTROPY_NODES][2]; vp9_prob coef_probs[ENTROPY_NODES]; int factor; 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 && j == 0) - continue; - vp9_tree_probs_from_distribution(MAX_ENTROPY_TOKENS, - vp9_coef_encodings, vp9_coef_tree, - coef_probs, branch_ct, - coef_counts[i][j][k]); - for (t = 0; t < ENTROPY_NODES; ++t) { - count = branch_ct[t][0] + branch_ct[t][1]; - count = count > count_sat ? count_sat : count; - factor = (update_factor * count / count_sat); - dst_coef_probs[i][j][k][t] = weighted_prob(pre_coef_probs[i][j][k][t], - coef_probs[t], factor); + for (j = 0; j < REF_TYPES; ++j) + for (k = 0; k < COEF_BANDS; ++k) + for (l = 0; l < PREV_COEF_CONTEXTS; ++l) { + if (l >= 3 && k == 0) + continue; + vp9_tree_probs_from_distribution(MAX_ENTROPY_TOKENS, + vp9_coef_encodings, vp9_coef_tree, + coef_probs, branch_ct, + coef_counts[i][j][k][l]); + for (t = 0; t < ENTROPY_NODES; ++t) { + count = branch_ct[t][0] + branch_ct[t][1]; + count = count > count_sat ? count_sat : count; + factor = (update_factor * count / count_sat); + dst_coef_probs[i][j][k][l][t] = + weighted_prob(pre_coef_probs[i][j][k][l][t], + coef_probs[t], factor); + } } - } } void vp9_adapt_coef_probs(VP9_COMMON *cm) { @@ -333,85 +326,14 @@ void vp9_adapt_coef_probs(VP9_COMMON *cm) { count_sat = COEF_COUNT_SAT; } -#ifdef COEF_COUNT_TESTING - { - printf("static const unsigned int\ncoef_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.coef_counts[i][j][k][t]); - printf("},\n"); - } - printf(" },\n"); - } - printf(" },\n"); - } - printf("};\n"); - printf("static const unsigned int\ncoef_counts_8x8" - "[BLOCK_TYPES_8X8] [COEF_BANDS]" - "[PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS] = {\n"); - for (i = 0; i < BLOCK_TYPES_8X8; ++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.coef_counts_8x8[i][j][k][t]); - printf("},\n"); - } - printf(" },\n"); - } - 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 - update_coef_probs(cm->fc.coef_probs_4x4, cm->fc.pre_coef_probs_4x4, - BLOCK_TYPES_4X4, cm->fc.coef_counts_4x4, - count_sat, update_factor); - update_coef_probs(cm->fc.hybrid_coef_probs_4x4, - cm->fc.pre_hybrid_coef_probs_4x4, - BLOCK_TYPES_4X4_HYBRID, cm->fc.hybrid_coef_counts_4x4, + BLOCK_TYPES, cm->fc.coef_counts_4x4, count_sat, update_factor); update_coef_probs(cm->fc.coef_probs_8x8, cm->fc.pre_coef_probs_8x8, - BLOCK_TYPES_8X8, cm->fc.coef_counts_8x8, - count_sat, update_factor); - update_coef_probs(cm->fc.hybrid_coef_probs_8x8, - cm->fc.pre_hybrid_coef_probs_8x8, - BLOCK_TYPES_8X8_HYBRID, cm->fc.hybrid_coef_counts_8x8, + BLOCK_TYPES, cm->fc.coef_counts_8x8, count_sat, update_factor); update_coef_probs(cm->fc.coef_probs_16x16, cm->fc.pre_coef_probs_16x16, - BLOCK_TYPES_16X16, cm->fc.coef_counts_16x16, - count_sat, update_factor); - update_coef_probs(cm->fc.hybrid_coef_probs_16x16, - cm->fc.pre_hybrid_coef_probs_16x16, - BLOCK_TYPES_16X16_HYBRID, cm->fc.hybrid_coef_counts_16x16, + BLOCK_TYPES, cm->fc.coef_counts_16x16, count_sat, update_factor); update_coef_probs(cm->fc.coef_probs_32x32, cm->fc.pre_coef_probs_32x32, BLOCK_TYPES_32X32, cm->fc.coef_counts_32x32, diff --git a/vp9/common/vp9_entropy.h b/vp9/common/vp9_entropy.h index 323bd47..20559a7 100644 --- a/vp9/common/vp9_entropy.h +++ b/vp9/common/vp9_entropy.h @@ -60,16 +60,9 @@ extern vp9_extra_bit_struct vp9_extra_bits[12]; /* indexed by token value */ /* Coefficients are predicted via a 3-dimensional probability table. */ /* Outside dimension. 0 = Y with DC, 1 = UV */ -#define BLOCK_TYPES_4X4 2 -#define BLOCK_TYPES_4X4_HYBRID 1 - -#define BLOCK_TYPES_8X8 2 -#define BLOCK_TYPES_8X8_HYBRID 1 - -#define BLOCK_TYPES_16X16 2 -#define BLOCK_TYPES_16X16_HYBRID 1 - +#define BLOCK_TYPES 2 #define BLOCK_TYPES_32X32 1 +#define REF_TYPES 2 // intra=0, inter=1 /* Middle dimension reflects the coefficient position within the transform. */ #define COEF_BANDS 6 @@ -93,11 +86,11 @@ extern vp9_extra_bit_struct vp9_extra_bits[12]; /* indexed by token value */ /*# define DC_TOKEN_CONTEXTS 3*/ /* 00, 0!0, !0!0 */ #define PREV_COEF_CONTEXTS 6 -typedef unsigned int vp9_coeff_count[COEF_BANDS][PREV_COEF_CONTEXTS] +typedef unsigned int vp9_coeff_count[REF_TYPES][COEF_BANDS][PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS]; -typedef unsigned int vp9_coeff_stats[COEF_BANDS][PREV_COEF_CONTEXTS] +typedef unsigned int vp9_coeff_stats[REF_TYPES][COEF_BANDS][PREV_COEF_CONTEXTS] [ENTROPY_NODES][2]; -typedef vp9_prob vp9_coeff_probs[COEF_BANDS][PREV_COEF_CONTEXTS] +typedef vp9_prob vp9_coeff_probs[REF_TYPES][COEF_BANDS][PREV_COEF_CONTEXTS] [ENTROPY_NODES]; #define SUBEXP_PARAM 4 /* Subexponential code parameter */ diff --git a/vp9/common/vp9_onyxc_int.h b/vp9/common/vp9_onyxc_int.h index 6fee493..e952fe9 100644 --- a/vp9/common/vp9_onyxc_int.h +++ b/vp9/common/vp9_onyxc_int.h @@ -54,12 +54,9 @@ typedef struct frame_contexts { vp9_prob i8x8_mode_prob[VP9_I8X8_MODES - 1]; vp9_prob sub_mv_ref_prob[SUBMVREF_COUNT][VP9_SUBMVREFS - 1]; vp9_prob mbsplit_prob[VP9_NUMMBSPLITS - 1]; - vp9_coeff_probs coef_probs_4x4[BLOCK_TYPES_4X4]; - vp9_coeff_probs hybrid_coef_probs_4x4[BLOCK_TYPES_4X4_HYBRID]; - vp9_coeff_probs coef_probs_8x8[BLOCK_TYPES_8X8]; - vp9_coeff_probs hybrid_coef_probs_8x8[BLOCK_TYPES_8X8_HYBRID]; - vp9_coeff_probs coef_probs_16x16[BLOCK_TYPES_16X16]; - vp9_coeff_probs hybrid_coef_probs_16x16[BLOCK_TYPES_16X16_HYBRID]; + vp9_coeff_probs coef_probs_4x4[BLOCK_TYPES]; + vp9_coeff_probs coef_probs_8x8[BLOCK_TYPES]; + vp9_coeff_probs coef_probs_16x16[BLOCK_TYPES]; vp9_coeff_probs coef_probs_32x32[BLOCK_TYPES_32X32]; nmv_context nmvc; @@ -79,20 +76,14 @@ typedef struct frame_contexts { unsigned int sub_mv_ref_counts[SUBMVREF_COUNT][VP9_SUBMVREFS]; unsigned int mbsplit_counts[VP9_NUMMBSPLITS]; - vp9_coeff_probs pre_coef_probs_4x4[BLOCK_TYPES_4X4]; - vp9_coeff_probs pre_hybrid_coef_probs_4x4[BLOCK_TYPES_4X4_HYBRID]; - vp9_coeff_probs pre_coef_probs_8x8[BLOCK_TYPES_8X8]; - vp9_coeff_probs pre_hybrid_coef_probs_8x8[BLOCK_TYPES_8X8_HYBRID]; - vp9_coeff_probs pre_coef_probs_16x16[BLOCK_TYPES_16X16]; - vp9_coeff_probs pre_hybrid_coef_probs_16x16[BLOCK_TYPES_16X16_HYBRID]; + vp9_coeff_probs pre_coef_probs_4x4[BLOCK_TYPES]; + vp9_coeff_probs pre_coef_probs_8x8[BLOCK_TYPES]; + vp9_coeff_probs pre_coef_probs_16x16[BLOCK_TYPES]; vp9_coeff_probs pre_coef_probs_32x32[BLOCK_TYPES_32X32]; - vp9_coeff_count coef_counts_4x4[BLOCK_TYPES_4X4]; - vp9_coeff_count hybrid_coef_counts_4x4[BLOCK_TYPES_4X4_HYBRID]; - vp9_coeff_count coef_counts_8x8[BLOCK_TYPES_8X8]; - vp9_coeff_count hybrid_coef_counts_8x8[BLOCK_TYPES_8X8_HYBRID]; - vp9_coeff_count coef_counts_16x16[BLOCK_TYPES_16X16]; - vp9_coeff_count hybrid_coef_counts_16x16[BLOCK_TYPES_16X16_HYBRID]; + vp9_coeff_count coef_counts_4x4[BLOCK_TYPES]; + vp9_coeff_count coef_counts_8x8[BLOCK_TYPES]; + vp9_coeff_count coef_counts_16x16[BLOCK_TYPES]; vp9_coeff_count coef_counts_32x32[BLOCK_TYPES_32X32]; nmv_context_counts NMVcount; diff --git a/vp9/decoder/vp9_decodemv.c b/vp9/decoder/vp9_decodemv.c index 316bda3..a1225f1 100644 --- a/vp9/decoder/vp9_decodemv.c +++ b/vp9/decoder/vp9_decodemv.c @@ -143,6 +143,8 @@ static void kfread_modes(VP9D_COMP *pbi, int map_index = mb_row * pbi->common.mb_cols + mb_col; MB_PREDICTION_MODE y_mode; + m->mbmi.ref_frame = INTRA_FRAME; + // Read the Macroblock segmentation map if it is being updated explicitly // this frame (reset to 0 by default). m->mbmi.segment_id = 0; diff --git a/vp9/decoder/vp9_decodframe.c b/vp9/decoder/vp9_decodframe.c index 8253cbe..f25a9db 100644 --- a/vp9/decoder/vp9_decodframe.c +++ b/vp9/decoder/vp9_decodframe.c @@ -1170,20 +1170,21 @@ static void init_frame(VP9D_COMP *pbi) { static void read_coef_probs_common(BOOL_DECODER* const bc, vp9_coeff_probs *coef_probs, int block_types) { - int i, j, k, l; + int i, j, k, l, m; if (vp9_read_bit(bc)) { for (i = 0; i < block_types; i++) { - for (j = 0; j < COEF_BANDS; j++) { - /* NB: This j loop starts from 1 on block type i == 0 */ - for (k = 0; k < PREV_COEF_CONTEXTS; k++) { - if (k >= 3 && j == 0) - continue; - for (l = 0; l < ENTROPY_NODES; l++) { - vp9_prob *const p = coef_probs[i][j][k] + l; - - if (vp9_read(bc, COEF_UPDATE_PROB)) { - *p = read_prob_diff_update(bc, *p); + for (j = 0; j < REF_TYPES; j++) { + for (k = 0; k < COEF_BANDS; k++) { + for (l = 0; l < PREV_COEF_CONTEXTS; l++) { + if (l >= 3 && k == 0) + continue; + for (m = 0; m < ENTROPY_NODES; m++) { + vp9_prob *const p = coef_probs[i][j][k][l] + m; + + if (vp9_read(bc, COEF_UPDATE_PROB)) { + *p = read_prob_diff_update(bc, *p); + } } } } @@ -1195,19 +1196,13 @@ static void read_coef_probs_common(BOOL_DECODER* const bc, static void read_coef_probs(VP9D_COMP *pbi, BOOL_DECODER* const bc) { VP9_COMMON *const pc = &pbi->common; - read_coef_probs_common(bc, pc->fc.coef_probs_4x4, BLOCK_TYPES_4X4); - read_coef_probs_common(bc, pc->fc.hybrid_coef_probs_4x4, - BLOCK_TYPES_4X4_HYBRID); + read_coef_probs_common(bc, pc->fc.coef_probs_4x4, BLOCK_TYPES); if (pbi->common.txfm_mode != ONLY_4X4) { - read_coef_probs_common(bc, pc->fc.coef_probs_8x8, BLOCK_TYPES_8X8); - read_coef_probs_common(bc, pc->fc.hybrid_coef_probs_8x8, - BLOCK_TYPES_8X8_HYBRID); + read_coef_probs_common(bc, pc->fc.coef_probs_8x8, BLOCK_TYPES); } if (pbi->common.txfm_mode > ALLOW_8X8) { - read_coef_probs_common(bc, pc->fc.coef_probs_16x16, BLOCK_TYPES_16X16); - read_coef_probs_common(bc, pc->fc.hybrid_coef_probs_16x16, - BLOCK_TYPES_16X16_HYBRID); + read_coef_probs_common(bc, pc->fc.coef_probs_16x16, BLOCK_TYPES); } if (pbi->common.txfm_mode > ALLOW_16X16) { read_coef_probs_common(bc, pc->fc.coef_probs_32x32, BLOCK_TYPES_32X32); @@ -1582,16 +1577,10 @@ int vp9_decode_frame(VP9D_COMP *pbi, const unsigned char **p_data_end) { vp9_copy(pbi->common.fc.pre_coef_probs_4x4, pbi->common.fc.coef_probs_4x4); - vp9_copy(pbi->common.fc.pre_hybrid_coef_probs_4x4, - pbi->common.fc.hybrid_coef_probs_4x4); vp9_copy(pbi->common.fc.pre_coef_probs_8x8, pbi->common.fc.coef_probs_8x8); - vp9_copy(pbi->common.fc.pre_hybrid_coef_probs_8x8, - pbi->common.fc.hybrid_coef_probs_8x8); vp9_copy(pbi->common.fc.pre_coef_probs_16x16, pbi->common.fc.coef_probs_16x16); - vp9_copy(pbi->common.fc.pre_hybrid_coef_probs_16x16, - pbi->common.fc.hybrid_coef_probs_16x16); vp9_copy(pbi->common.fc.pre_coef_probs_32x32, pbi->common.fc.coef_probs_32x32); vp9_copy(pbi->common.fc.pre_ymode_prob, pbi->common.fc.ymode_prob); @@ -1606,11 +1595,8 @@ int vp9_decode_frame(VP9D_COMP *pbi, const unsigned char **p_data_end) { #endif pbi->common.fc.pre_nmvc = pbi->common.fc.nmvc; vp9_zero(pbi->common.fc.coef_counts_4x4); - vp9_zero(pbi->common.fc.hybrid_coef_counts_4x4); vp9_zero(pbi->common.fc.coef_counts_8x8); - vp9_zero(pbi->common.fc.hybrid_coef_counts_8x8); vp9_zero(pbi->common.fc.coef_counts_16x16); - vp9_zero(pbi->common.fc.hybrid_coef_counts_16x16); vp9_zero(pbi->common.fc.coef_counts_32x32); vp9_zero(pbi->common.fc.ymode_counts); vp9_zero(pbi->common.fc.sb_ymode_counts); diff --git a/vp9/decoder/vp9_detokenize.c b/vp9/decoder/vp9_detokenize.c index e42f208..6358926 100644 --- a/vp9/decoder/vp9_detokenize.c +++ b/vp9/decoder/vp9_detokenize.c @@ -65,7 +65,7 @@ static int get_signed(BOOL_DECODER *br, int value_to_sign) { #define INCREMENT_COUNT(token) \ do { \ - coef_counts[type][get_coef_band(txfm_size, c)][pt][token]++; \ + coef_counts[type][ref][get_coef_band(txfm_size, c)][pt][token]++; \ pt = vp9_get_coef_context(&recent_energy, token); \ } while (0) @@ -99,39 +99,25 @@ static int decode_coefs(VP9D_COMP *dx, const MACROBLOCKD *xd, vp9_coeff_probs *coef_probs; vp9_prob *prob; vp9_coeff_count *coef_counts; + const int ref = xd->mode_info_context->mbmi.ref_frame != INTRA_FRAME; switch (txfm_size) { default: case TX_4X4: - if (tx_type == DCT_DCT) { - coef_probs = fc->coef_probs_4x4; - coef_counts = fc->coef_counts_4x4; - } else { - coef_probs = fc->hybrid_coef_probs_4x4; - coef_counts = fc->hybrid_coef_counts_4x4; - } + coef_probs = fc->coef_probs_4x4; + coef_counts = fc->coef_counts_4x4; break; case TX_8X8: - if (tx_type == DCT_DCT) { - coef_probs = fc->coef_probs_8x8; - coef_counts = fc->coef_counts_8x8; - } else { - coef_probs = fc->hybrid_coef_probs_8x8; - coef_counts = fc->hybrid_coef_counts_8x8; - } + coef_probs = fc->coef_probs_8x8; + coef_counts = fc->coef_counts_8x8; #if CONFIG_CNVCONTEXT above_ec = (A0[aidx] + A0[aidx + 1]) != 0; left_ec = (L0[lidx] + L0[lidx + 1]) != 0; #endif break; case TX_16X16: - if (tx_type == DCT_DCT) { - coef_probs = fc->coef_probs_16x16; - coef_counts = fc->coef_counts_16x16; - } else { - coef_probs = fc->hybrid_coef_probs_16x16; - coef_counts = fc->hybrid_coef_counts_16x16; - } + coef_probs = fc->coef_probs_16x16; + coef_counts = fc->coef_counts_16x16; #if CONFIG_CNVCONTEXT if (type == PLANE_TYPE_UV) { ENTROPY_CONTEXT *A1 = (ENTROPY_CONTEXT *) (xd->above_context + 1); @@ -176,7 +162,7 @@ static int decode_coefs(VP9D_COMP *dx, const MACROBLOCKD *xd, int val; const uint8_t *cat6 = cat6_prob; if (c >= seg_eob) break; - prob = coef_probs[type][get_coef_band(txfm_size, c)][pt]; + prob = coef_probs[type][ref][get_coef_band(txfm_size, c)][pt]; if (!vp9_read(br, prob[EOB_CONTEXT_NODE])) break; SKIP_START: @@ -184,7 +170,7 @@ SKIP_START: if (!vp9_read(br, prob[ZERO_CONTEXT_NODE])) { INCREMENT_COUNT(ZERO_TOKEN); ++c; - prob = coef_probs[type][get_coef_band(txfm_size, c)][pt]; + prob = coef_probs[type][ref][get_coef_band(txfm_size, c)][pt]; goto SKIP_START; } // ONE_CONTEXT_NODE_0_ @@ -248,7 +234,7 @@ SKIP_START: } if (c < seg_eob) - coef_counts[type][get_coef_band(txfm_size, c)][pt][DCT_EOB_TOKEN]++; + coef_counts[type][ref][get_coef_band(txfm_size, c)][pt][DCT_EOB_TOKEN]++; A0[aidx] = L0[lidx] = (c > 0); if (txfm_size >= TX_8X8) { diff --git a/vp9/encoder/vp9_bitstream.c b/vp9/encoder/vp9_bitstream.c index dd4d66a..7101947 100644 --- a/vp9/encoder/vp9_bitstream.c +++ b/vp9/encoder/vp9_bitstream.c @@ -42,12 +42,9 @@ unsigned __int64 Sectionbits[500]; int intra_mode_stats[VP9_KF_BINTRAMODES] [VP9_KF_BINTRAMODES] [VP9_KF_BINTRAMODES]; -vp9_coeff_stats tree_update_hist_4x4[BLOCK_TYPES_4X4]; -vp9_coeff_stats hybrid_tree_update_hist_4x4[BLOCK_TYPES_4X4_HYBRID]; -vp9_coeff_stats tree_update_hist_8x8[BLOCK_TYPES_8X8]; -vp9_coeff_stats hybrid_tree_update_hist_8x8[BLOCK_TYPES_8X8_HYBRID]; -vp9_coeff_stats tree_update_hist_16x16[BLOCK_TYPES_16X16]; -vp9_coeff_stats hybrid_tree_update_hist_16x16[BLOCK_TYPES_16X16_HYBRID]; +vp9_coeff_stats tree_update_hist_4x4[BLOCK_TYPES]; +vp9_coeff_stats tree_update_hist_8x8[BLOCK_TYPES]; +vp9_coeff_stats tree_update_hist_16x16[BLOCK_TYPES]; vp9_coeff_stats tree_update_hist_32x32[BLOCK_TYPES_32X32]; extern unsigned int active_section; @@ -1145,20 +1142,23 @@ static void write_modes(VP9_COMP *cpi, vp9_writer* const bc, /* This function is used for debugging probability trees. */ -static void print_prob_tree(vp9_coeff_probs *coef_probs) { +static void print_prob_tree(vp9_coeff_probs *coef_probs, int block_types) { /* print coef probability tree */ - int i, j, k, l; + int i, j, k, l, m; FILE *f = fopen("enc_tree_probs.txt", "a"); fprintf(f, "{\n"); - for (i = 0; i < BLOCK_TYPES_4X4; i++) { + for (i = 0; i < block_types; i++) { fprintf(f, " {\n"); - for (j = 0; j < COEF_BANDS; j++) { - fprintf(f, " {\n"); - for (k = 0; k < PREV_COEF_CONTEXTS; k++) { - fprintf(f, " {"); - for (l = 0; l < ENTROPY_NODES; l++) { - fprintf(f, "%3u, ", - (unsigned int)(coef_probs [i][j][k][l])); + for (j = 0; j < REF_TYPES; ++j) { + fprintf(f, " {\n"); + for (k = 0; k < COEF_BANDS; k++) { + fprintf(f, " {\n"); + for (l = 0; l < PREV_COEF_CONTEXTS; l++) { + fprintf(f, " {"); + for (m = 0; m < ENTROPY_NODES; m++) { + fprintf(f, "%3u, ", + (unsigned int)(coef_probs[i][j][k][l][m])); + } } fprintf(f, " }\n"); } @@ -1178,26 +1178,28 @@ static void build_tree_distribution(vp9_coeff_probs *coef_probs, #endif vp9_coeff_stats *coef_branch_ct, int block_types) { - int i = 0, j, k; + int i, j, k, l; #ifdef ENTROPY_STATS int t = 0; #endif 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 && j == 0) - continue; - vp9_tree_probs_from_distribution(MAX_ENTROPY_TOKENS, - vp9_coef_encodings, vp9_coef_tree, - coef_probs[i][j][k], - coef_branch_ct[i][j][k], - coef_counts[i][j][k]); + for (j = 0; j < REF_TYPES; ++j) { + for (k = 0; k < COEF_BANDS; ++k) { + for (l = 0; l < PREV_COEF_CONTEXTS; ++l) { + if (l >= 3 && k == 0) + continue; + vp9_tree_probs_from_distribution(MAX_ENTROPY_TOKENS, + vp9_coef_encodings, vp9_coef_tree, + coef_probs[i][j][k][l], + coef_branch_ct[i][j][k][l], + coef_counts[i][j][k][l]); #ifdef ENTROPY_STATS if (!cpi->dummy_packing) for (t = 0; t < MAX_ENTROPY_TOKENS; ++t) - context_counters[i][j][k][t] += coef_counts[i][j][k][t]; + context_counters[i][j][k][l][t] += coef_counts[i][j][k][l][t]; #endif + } } } } @@ -1209,40 +1211,19 @@ static void build_coeff_contexts(VP9_COMP *cpi) { #ifdef ENTROPY_STATS cpi, context_counters_4x4, #endif - cpi->frame_branch_ct_4x4, BLOCK_TYPES_4X4); - build_tree_distribution(cpi->frame_hybrid_coef_probs_4x4, - cpi->hybrid_coef_counts_4x4, -#ifdef ENTROPY_STATS - cpi, hybrid_context_counters_4x4, -#endif - cpi->frame_hybrid_branch_ct_4x4, - BLOCK_TYPES_4X4_HYBRID); + cpi->frame_branch_ct_4x4, BLOCK_TYPES); build_tree_distribution(cpi->frame_coef_probs_8x8, cpi->coef_counts_8x8, #ifdef ENTROPY_STATS cpi, context_counters_8x8, #endif - cpi->frame_branch_ct_8x8, BLOCK_TYPES_8X8); - build_tree_distribution(cpi->frame_hybrid_coef_probs_8x8, - cpi->hybrid_coef_counts_8x8, -#ifdef ENTROPY_STATS - cpi, hybrid_context_counters_8x8, -#endif - cpi->frame_hybrid_branch_ct_8x8, - BLOCK_TYPES_8X8_HYBRID); + cpi->frame_branch_ct_8x8, BLOCK_TYPES); build_tree_distribution(cpi->frame_coef_probs_16x16, cpi->coef_counts_16x16, #ifdef ENTROPY_STATS cpi, context_counters_16x16, #endif - cpi->frame_branch_ct_16x16, BLOCK_TYPES_16X16); - build_tree_distribution(cpi->frame_hybrid_coef_probs_16x16, - cpi->hybrid_coef_counts_16x16, -#ifdef ENTROPY_STATS - cpi, hybrid_context_counters_16x16, -#endif - cpi->frame_hybrid_branch_ct_16x16, - BLOCK_TYPES_16X16_HYBRID); + cpi->frame_branch_ct_16x16, BLOCK_TYPES); build_tree_distribution(cpi->frame_coef_probs_32x32, cpi->coef_counts_32x32, #ifdef ENTROPY_STATS @@ -1260,7 +1241,7 @@ static void update_coef_probs_common(vp9_writer* const bc, vp9_coeff_probs *old_frame_coef_probs, vp9_coeff_stats *frame_branch_ct, int block_types) { - int i, j, k, t; + int i, j, k, l, t; int update[2] = {0, 0}; int savings; // vp9_prob bestupd = find_coef_update_prob(cpi); @@ -1268,39 +1249,39 @@ static void update_coef_probs_common(vp9_writer* const bc, /* dry run to see if there is any udpate at all needed */ savings = 0; for (i = 0; i < block_types; ++i) { - for (j = 0; 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) { - vp9_prob newp = new_frame_coef_probs[i][j][k][t]; - const vp9_prob oldp = old_frame_coef_probs[i][j][k][t]; - const vp9_prob upd = COEF_UPDATE_PROB; - int s = prev_coef_savings[t]; - int u = 0; - - if (k >= 3 && j == 0) - continue; + for (j = 0; j < REF_TYPES; ++j) { + for (k = 0; k < COEF_BANDS; ++k) { + int prev_coef_savings[ENTROPY_NODES] = {0}; + for (l = 0; l < PREV_COEF_CONTEXTS; ++l) { + for (t = 0; t < ENTROPY_NODES; ++t) { + vp9_prob newp = new_frame_coef_probs[i][j][k][l][t]; + const vp9_prob oldp = old_frame_coef_probs[i][j][k][l][t]; + const vp9_prob upd = COEF_UPDATE_PROB; + int s = prev_coef_savings[t]; + int u = 0; + + if (l >= 3 && k == 0) + continue; #if defined(SEARCH_NEWP) - s = prob_diff_update_savings_search( - frame_branch_ct[i][j][k][t], - oldp, &newp, upd); - if (s > 0 && newp != oldp) - u = 1; - if (u) - savings += s - (int)(vp9_cost_zero(upd)); - else - savings -= (int)(vp9_cost_zero(upd)); + s = prob_diff_update_savings_search(frame_branch_ct[i][j][k][l][t], + oldp, &newp, upd); + if (s > 0 && newp != oldp) + u = 1; + if (u) + savings += s - (int)(vp9_cost_zero(upd)); + else + savings -= (int)(vp9_cost_zero(upd)); #else - s = prob_update_savings( - frame_branch_ct[i][j][k][t], - oldp, newp, upd); - if (s > 0) - u = 1; - if (u) - savings += s; + s = prob_update_savings(frame_branch_ct[i][j][k][l][t], + oldp, newp, upd); + if (s > 0) + u = 1; + if (u) + savings += s; #endif - update[u]++; + update[u]++; + } } } } @@ -1313,41 +1294,42 @@ static void update_coef_probs_common(vp9_writer* const bc, } else { vp9_write_bit(bc, 1); for (i = 0; i < block_types; ++i) { - for (j = 0; 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) { - vp9_prob newp = new_frame_coef_probs[i][j][k][t]; - vp9_prob *oldp = old_frame_coef_probs[i][j][k] + t; - const vp9_prob upd = COEF_UPDATE_PROB; - int s = prev_coef_savings[t]; - int u = 0; - if (k >= 3 && j == 0) - continue; + for (j = 0; j < REF_TYPES; ++j) { + for (k = 0; k < COEF_BANDS; ++k) { + int prev_coef_savings[ENTROPY_NODES] = {0}; + for (l = 0; l < PREV_COEF_CONTEXTS; ++l) { + // calc probs and branch cts for this frame only + for (t = 0; t < ENTROPY_NODES; ++t) { + vp9_prob newp = new_frame_coef_probs[i][j][k][l][t]; + vp9_prob *oldp = old_frame_coef_probs[i][j][k][l] + t; + const vp9_prob upd = COEF_UPDATE_PROB; + int s = prev_coef_savings[t]; + int u = 0; + if (l >= 3 && k == 0) + continue; #if defined(SEARCH_NEWP) - s = prob_diff_update_savings_search( - frame_branch_ct[i][j][k][t], - *oldp, &newp, upd); - if (s > 0 && newp != *oldp) - u = 1; + s = prob_diff_update_savings_search( + frame_branch_ct[i][j][k][l][t], + *oldp, &newp, upd); + if (s > 0 && newp != *oldp) + u = 1; #else - s = prob_update_savings( - frame_branch_ct[i][j][k][t], - *oldp, newp, upd); - if (s > 0) - u = 1; + s = prob_update_savings(frame_branch_ct[i][j][k][l][t], + *oldp, newp, upd); + if (s > 0) + u = 1; #endif - vp9_write(bc, u, upd); + vp9_write(bc, u, upd); #ifdef ENTROPY_STATS - if (!cpi->dummy_packing) - ++tree_update_hist[i][j][k][t][u]; + if (!cpi->dummy_packing) + ++tree_update_hist[i][j][k][l][t][u]; #endif - if (u) { - /* send/use new probability */ - write_prob_diff_update(bc, newp, *oldp); - *oldp = newp; + if (u) { + /* send/use new probability */ + write_prob_diff_update(bc, newp, *oldp); + *oldp = newp; + } } } } @@ -1370,17 +1352,7 @@ static void update_coef_probs(VP9_COMP* const cpi, vp9_writer* const bc) { cpi->frame_coef_probs_4x4, cpi->common.fc.coef_probs_4x4, cpi->frame_branch_ct_4x4, - BLOCK_TYPES_4X4); - - update_coef_probs_common(bc, -#ifdef ENTROPY_STATS - cpi, - hybrid_tree_update_hist_4x4, -#endif - cpi->frame_hybrid_coef_probs_4x4, - cpi->common.fc.hybrid_coef_probs_4x4, - cpi->frame_hybrid_branch_ct_4x4, - BLOCK_TYPES_4X4_HYBRID); + BLOCK_TYPES); /* do not do this if not even allowed */ if (cpi->common.txfm_mode != ONLY_4X4) { @@ -1392,17 +1364,7 @@ static void update_coef_probs(VP9_COMP* const cpi, vp9_writer* const bc) { cpi->frame_coef_probs_8x8, cpi->common.fc.coef_probs_8x8, cpi->frame_branch_ct_8x8, - BLOCK_TYPES_8X8); - - update_coef_probs_common(bc, -#ifdef ENTROPY_STATS - cpi, - hybrid_tree_update_hist_8x8, -#endif - cpi->frame_hybrid_coef_probs_8x8, - cpi->common.fc.hybrid_coef_probs_8x8, - cpi->frame_hybrid_branch_ct_8x8, - BLOCK_TYPES_8X8_HYBRID); + BLOCK_TYPES); } if (cpi->common.txfm_mode > ALLOW_8X8) { @@ -1414,16 +1376,7 @@ static void update_coef_probs(VP9_COMP* const cpi, vp9_writer* const bc) { cpi->frame_coef_probs_16x16, cpi->common.fc.coef_probs_16x16, cpi->frame_branch_ct_16x16, - BLOCK_TYPES_16X16); - update_coef_probs_common(bc, -#ifdef ENTROPY_STATS - cpi, - hybrid_tree_update_hist_16x16, -#endif - cpi->frame_hybrid_coef_probs_16x16, - cpi->common.fc.hybrid_coef_probs_16x16, - cpi->frame_hybrid_branch_ct_16x16, - BLOCK_TYPES_16X16_HYBRID); + BLOCK_TYPES); } if (cpi->common.txfm_mode > ALLOW_16X16) { @@ -1938,16 +1891,10 @@ void vp9_pack_bitstream(VP9_COMP *cpi, unsigned char *dest, vp9_copy(cpi->common.fc.pre_coef_probs_4x4, cpi->common.fc.coef_probs_4x4); - vp9_copy(cpi->common.fc.pre_hybrid_coef_probs_4x4, - cpi->common.fc.hybrid_coef_probs_4x4); vp9_copy(cpi->common.fc.pre_coef_probs_8x8, cpi->common.fc.coef_probs_8x8); - vp9_copy(cpi->common.fc.pre_hybrid_coef_probs_8x8, - cpi->common.fc.hybrid_coef_probs_8x8); vp9_copy(cpi->common.fc.pre_coef_probs_16x16, cpi->common.fc.coef_probs_16x16); - vp9_copy(cpi->common.fc.pre_hybrid_coef_probs_16x16, - cpi->common.fc.hybrid_coef_probs_16x16); vp9_copy(cpi->common.fc.pre_coef_probs_32x32, cpi->common.fc.coef_probs_32x32); vp9_copy(cpi->common.fc.pre_sb_ymode_prob, cpi->common.fc.sb_ymode_prob); @@ -2124,19 +2071,23 @@ void vp9_pack_bitstream(VP9_COMP *cpi, unsigned char *dest, static void print_tree_update_for_type(FILE *f, vp9_coeff_stats *tree_update_hist, int block_types, const char *header) { - int i, j, k, l; + int i, j, k, l, m; fprintf(f, "const vp9_coeff_prob %s = {\n", header); for (i = 0; i < block_types; i++) { fprintf(f, " { \n"); - for (j = 0; j < COEF_BANDS; j++) { - fprintf(f, " {\n"); - for (k = 0; k < PREV_COEF_CONTEXTS; k++) { - fprintf(f, " {"); - for (l = 0; l < ENTROPY_NODES; l++) { - fprintf(f, "%3d, ", - get_binary_prob(tree_update_hist[i][j][k][l][0], - tree_update_hist[i][j][k][l][1])); + for (j = 0; j < REF_TYPES; j++) { + fprintf(f, " { \n"); + for (k = 0; k < COEF_BANDS; k++) { + fprintf(f, " {\n"); + for (l = 0; l < PREV_COEF_CONTEXTS; l++) { + fprintf(f, " {"); + for (m = 0; m < ENTROPY_NODES; m++) { + fprintf(f, "%3d, ", + get_binary_prob(tree_update_hist[i][j][k][l][m][0], + tree_update_hist[i][j][k][l][m][1])); + } + fprintf(f, "},\n"); } fprintf(f, "},\n"); } @@ -2151,24 +2102,12 @@ void print_tree_update_probs() { FILE *f = fopen("coefupdprob.h", "w"); fprintf(f, "\n/* Update probabilities for token entropy tree. */\n\n"); - print_tree_update_for_type(f, tree_update_hist_4x4, BLOCK_TYPES_4X4, + print_tree_update_for_type(f, tree_update_hist_4x4, BLOCK_TYPES, "vp9_coef_update_probs_4x4[BLOCK_TYPES_4X4]"); - print_tree_update_for_type(f, hybrid_tree_update_hist_4x4, - BLOCK_TYPES_4X4_HYBRID, - "vp9_coef_update_probs_4x4" - "[BLOCK_TYPES_4X4_HYBRID]"); - print_tree_update_for_type(f, tree_update_hist_8x8, BLOCK_TYPES_8X8, + print_tree_update_for_type(f, tree_update_hist_8x8, BLOCK_TYPES, "vp9_coef_update_probs_8x8[BLOCK_TYPES_8X8]"); - print_tree_update_for_type(f, hybrid_tree_update_hist_8x8, - BLOCK_TYPES_8X8_HYBRID, - "vp9_coef_update_probs_8x8" - "[BLOCK_TYPES_8X8_HYBRID]"); - print_tree_update_for_type(f, tree_update_hist_16x16, BLOCK_TYPES_16X16, + print_tree_update_for_type(f, tree_update_hist_16x16, BLOCK_TYPES, "vp9_coef_update_probs_16x16[BLOCK_TYPES_16X16]"); - print_tree_update_for_type(f, hybrid_tree_update_hist_16x16, - BLOCK_TYPES_16X16_HYBRID, - "vp9_coef_update_probs_16x16" - "[BLOCK_TYPES_16X16_HYBRID]"); print_tree_update_for_type(f, tree_update_hist_32x32, BLOCK_TYPES_32X32, "vp9_coef_update_probs_32x32[BLOCK_TYPES_32X32]"); @@ -2177,6 +2116,7 @@ void print_tree_update_probs() { fwrite(tree_update_hist_4x4, sizeof(tree_update_hist_4x4), 1, f); fwrite(tree_update_hist_8x8, sizeof(tree_update_hist_8x8), 1, f); fwrite(tree_update_hist_16x16, sizeof(tree_update_hist_16x16), 1, f); + fwrite(tree_update_hist_32x32, sizeof(tree_update_hist_32x32), 1, f); fclose(f); } #endif diff --git a/vp9/encoder/vp9_block.h b/vp9/encoder/vp9_block.h index 6c46455..d888b6f 100644 --- a/vp9/encoder/vp9_block.h +++ b/vp9/encoder/vp9_block.h @@ -156,8 +156,7 @@ typedef struct macroblock { unsigned char *active_ptr; - vp9_coeff_count token_costs[TX_SIZE_MAX_SB][BLOCK_TYPES_4X4]; - vp9_coeff_count hybrid_token_costs[TX_SIZE_MAX_SB][BLOCK_TYPES_4X4_HYBRID]; + vp9_coeff_count token_costs[TX_SIZE_MAX_SB][BLOCK_TYPES]; int optimize; diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c index bedd10f..8805557 100644 --- a/vp9/encoder/vp9_encodeframe.c +++ b/vp9/encoder/vp9_encodeframe.c @@ -1291,11 +1291,8 @@ static void encode_frame_internal(VP9_COMP *cpi) { vp9_zero(cpi->NMVcount); vp9_zero(cpi->coef_counts_4x4); - vp9_zero(cpi->hybrid_coef_counts_4x4); vp9_zero(cpi->coef_counts_8x8); - vp9_zero(cpi->hybrid_coef_counts_8x8); vp9_zero(cpi->coef_counts_16x16); - vp9_zero(cpi->hybrid_coef_counts_16x16); vp9_zero(cpi->coef_counts_32x32); #if CONFIG_NEW_MVREF vp9_zero(cpi->mb_mv_ref_count); diff --git a/vp9/encoder/vp9_encodemb.c b/vp9/encoder/vp9_encodemb.c index 95b36c9..2665d8a 100644 --- a/vp9/encoder/vp9_encodemb.c +++ b/vp9/encoder/vp9_encodemb.c @@ -330,6 +330,7 @@ static int trellis_get_coeff_context(int token) { static void optimize_b(MACROBLOCK *mb, int i, PLANE_TYPE type, ENTROPY_CONTEXT *a, ENTROPY_CONTEXT *l, int tx_size) { + const int ref = mb->e_mbd.mode_info_context->mbmi.ref_frame != INTRA_FRAME; BLOCK *b = &mb->block[i]; BLOCKD *d = &mb->e_mbd.block[i]; vp9_token_state tokens[257][2]; @@ -418,9 +419,9 @@ static void optimize_b(MACROBLOCK *mb, int i, PLANE_TYPE type, band = get_coef_band(tx_size, i + 1); pt = trellis_get_coeff_context(t0); rate0 += - mb->token_costs[tx_size][type][band][pt][tokens[next][0].token]; + mb->token_costs[tx_size][type][ref][band][pt][tokens[next][0].token]; rate1 += - mb->token_costs[tx_size][type][band][pt][tokens[next][1].token]; + mb->token_costs[tx_size][type][ref][band][pt][tokens[next][1].token]; } UPDATE_RD_COST(); /* And pick the best. */ @@ -465,12 +466,12 @@ static void optimize_b(MACROBLOCK *mb, int i, PLANE_TYPE type, band = get_coef_band(tx_size, i + 1); if (t0 != DCT_EOB_TOKEN) { pt = trellis_get_coeff_context(t0); - rate0 += mb->token_costs[tx_size][type][band][pt][ + rate0 += mb->token_costs[tx_size][type][ref][band][pt][ tokens[next][0].token]; } if (t1 != DCT_EOB_TOKEN) { pt = trellis_get_coeff_context(t1); - rate1 += mb->token_costs[tx_size][type][band][pt][ + rate1 += mb->token_costs[tx_size][type][ref][band][pt][ tokens[next][1].token]; } } @@ -502,11 +503,13 @@ static void optimize_b(MACROBLOCK *mb, int i, PLANE_TYPE type, t1 = tokens[next][1].token; /* Update the cost of each path if we're past the EOB token. */ if (t0 != DCT_EOB_TOKEN) { - tokens[next][0].rate += mb->token_costs[tx_size][type][band][0][t0]; + tokens[next][0].rate += + mb->token_costs[tx_size][type][ref][band][0][t0]; tokens[next][0].token = ZERO_TOKEN; } if (t1 != DCT_EOB_TOKEN) { - tokens[next][1].rate += mb->token_costs[tx_size][type][band][0][t1]; + tokens[next][1].rate += + mb->token_costs[tx_size][type][ref][band][0][t1]; tokens[next][1].token = ZERO_TOKEN; } /* Don't update next, because we didn't add a new node. */ @@ -522,8 +525,8 @@ static void optimize_b(MACROBLOCK *mb, int i, PLANE_TYPE type, error1 = tokens[next][1].error; t0 = tokens[next][0].token; t1 = tokens[next][1].token; - rate0 += mb->token_costs[tx_size][type][band][pt][t0]; - rate1 += mb->token_costs[tx_size][type][band][pt][t1]; + rate0 += mb->token_costs[tx_size][type][ref][band][pt][t0]; + rate1 += mb->token_costs[tx_size][type][ref][band][pt][t1]; UPDATE_RD_COST(); best = rd_cost1 < rd_cost0; final_eob = i0 - 1; diff --git a/vp9/encoder/vp9_onyx_if.c b/vp9/encoder/vp9_onyx_if.c index 33c1dd2..40a1263 100644 --- a/vp9/encoder/vp9_onyx_if.c +++ b/vp9/encoder/vp9_onyx_if.c @@ -3233,14 +3233,8 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi, update_reference_frames(cpi); vp9_copy(cpi->common.fc.coef_counts_4x4, cpi->coef_counts_4x4); - vp9_copy(cpi->common.fc.hybrid_coef_counts_4x4, - cpi->hybrid_coef_counts_4x4); vp9_copy(cpi->common.fc.coef_counts_8x8, cpi->coef_counts_8x8); - vp9_copy(cpi->common.fc.hybrid_coef_counts_8x8, - cpi->hybrid_coef_counts_8x8); vp9_copy(cpi->common.fc.coef_counts_16x16, cpi->coef_counts_16x16); - vp9_copy(cpi->common.fc.hybrid_coef_counts_16x16, - cpi->hybrid_coef_counts_16x16); vp9_copy(cpi->common.fc.coef_counts_32x32, cpi->coef_counts_32x32); if (!cpi->common.error_resilient_mode && !cpi->common.frame_parallel_decoding_mode) diff --git a/vp9/encoder/vp9_onyx_int.h b/vp9/encoder/vp9_onyx_int.h index cfd761a..6b9bf87 100644 --- a/vp9/encoder/vp9_onyx_int.h +++ b/vp9/encoder/vp9_onyx_int.h @@ -85,12 +85,9 @@ typedef struct { // 0 = BPRED, ZERO_MV, MV, SPLIT signed char last_mode_lf_deltas[MAX_MODE_LF_DELTAS]; - vp9_coeff_probs coef_probs_4x4[BLOCK_TYPES_4X4]; - vp9_coeff_probs hybrid_coef_probs_4x4[BLOCK_TYPES_4X4_HYBRID]; - vp9_coeff_probs coef_probs_8x8[BLOCK_TYPES_8X8]; - vp9_coeff_probs hybrid_coef_probs_8x8[BLOCK_TYPES_8X8_HYBRID]; - vp9_coeff_probs coef_probs_16x16[BLOCK_TYPES_16X16]; - vp9_coeff_probs hybrid_coef_probs_16x16[BLOCK_TYPES_16X16_HYBRID]; + vp9_coeff_probs coef_probs_4x4[BLOCK_TYPES]; + vp9_coeff_probs coef_probs_8x8[BLOCK_TYPES]; + vp9_coeff_probs coef_probs_16x16[BLOCK_TYPES]; vp9_coeff_probs coef_probs_32x32[BLOCK_TYPES_32X32]; vp9_prob sb_ymode_prob[VP9_I32X32_MODES - 1]; @@ -462,26 +459,17 @@ typedef struct VP9_COMP { nmv_context_counts NMVcount; - vp9_coeff_count coef_counts_4x4[BLOCK_TYPES_4X4]; - vp9_coeff_probs frame_coef_probs_4x4[BLOCK_TYPES_4X4]; - vp9_coeff_stats frame_branch_ct_4x4[BLOCK_TYPES_4X4]; - vp9_coeff_count hybrid_coef_counts_4x4[BLOCK_TYPES_4X4_HYBRID]; - vp9_coeff_probs frame_hybrid_coef_probs_4x4[BLOCK_TYPES_4X4_HYBRID]; - vp9_coeff_stats frame_hybrid_branch_ct_4x4[BLOCK_TYPES_4X4_HYBRID]; - - vp9_coeff_count coef_counts_8x8[BLOCK_TYPES_8X8]; - vp9_coeff_probs frame_coef_probs_8x8[BLOCK_TYPES_8X8]; - vp9_coeff_stats frame_branch_ct_8x8[BLOCK_TYPES_8X8]; - vp9_coeff_count hybrid_coef_counts_8x8[BLOCK_TYPES_8X8_HYBRID]; - vp9_coeff_probs frame_hybrid_coef_probs_8x8[BLOCK_TYPES_8X8_HYBRID]; - vp9_coeff_stats frame_hybrid_branch_ct_8x8[BLOCK_TYPES_8X8_HYBRID]; - - vp9_coeff_count coef_counts_16x16[BLOCK_TYPES_16X16]; - vp9_coeff_probs frame_coef_probs_16x16[BLOCK_TYPES_16X16]; - vp9_coeff_stats frame_branch_ct_16x16[BLOCK_TYPES_16X16]; - vp9_coeff_count hybrid_coef_counts_16x16[BLOCK_TYPES_16X16_HYBRID]; - vp9_coeff_probs frame_hybrid_coef_probs_16x16[BLOCK_TYPES_16X16_HYBRID]; - vp9_coeff_stats frame_hybrid_branch_ct_16x16[BLOCK_TYPES_16X16_HYBRID]; + vp9_coeff_count coef_counts_4x4[BLOCK_TYPES]; + vp9_coeff_probs frame_coef_probs_4x4[BLOCK_TYPES]; + vp9_coeff_stats frame_branch_ct_4x4[BLOCK_TYPES]; + + vp9_coeff_count coef_counts_8x8[BLOCK_TYPES]; + vp9_coeff_probs frame_coef_probs_8x8[BLOCK_TYPES]; + vp9_coeff_stats frame_branch_ct_8x8[BLOCK_TYPES]; + + vp9_coeff_count coef_counts_16x16[BLOCK_TYPES]; + vp9_coeff_probs frame_coef_probs_16x16[BLOCK_TYPES]; + vp9_coeff_stats frame_branch_ct_16x16[BLOCK_TYPES]; vp9_coeff_count coef_counts_32x32[BLOCK_TYPES_32X32]; vp9_coeff_probs frame_coef_probs_32x32[BLOCK_TYPES_32X32]; diff --git a/vp9/encoder/vp9_ratectrl.c b/vp9/encoder/vp9_ratectrl.c index 5bb0ef5..53d931c 100644 --- a/vp9/encoder/vp9_ratectrl.c +++ b/vp9/encoder/vp9_ratectrl.c @@ -169,11 +169,8 @@ void vp9_save_coding_context(VP9_COMP *cpi) { vp9_copy(cc->last_mode_lf_deltas, xd->last_mode_lf_deltas); vp9_copy(cc->coef_probs_4x4, cm->fc.coef_probs_4x4); - vp9_copy(cc->hybrid_coef_probs_4x4, cm->fc.hybrid_coef_probs_4x4); vp9_copy(cc->coef_probs_8x8, cm->fc.coef_probs_8x8); - vp9_copy(cc->hybrid_coef_probs_8x8, cm->fc.hybrid_coef_probs_8x8); vp9_copy(cc->coef_probs_16x16, cm->fc.coef_probs_16x16); - vp9_copy(cc->hybrid_coef_probs_16x16, cm->fc.hybrid_coef_probs_16x16); vp9_copy(cc->coef_probs_32x32, cm->fc.coef_probs_32x32); vp9_copy(cc->switchable_interp_prob, cm->fc.switchable_interp_prob); #if CONFIG_COMP_INTERINTRA_PRED @@ -227,11 +224,8 @@ void vp9_restore_coding_context(VP9_COMP *cpi) { vp9_copy(xd->last_mode_lf_deltas, cc->last_mode_lf_deltas); vp9_copy(cm->fc.coef_probs_4x4, cc->coef_probs_4x4); - vp9_copy(cm->fc.hybrid_coef_probs_4x4, cc->hybrid_coef_probs_4x4); vp9_copy(cm->fc.coef_probs_8x8, cc->coef_probs_8x8); - vp9_copy(cm->fc.hybrid_coef_probs_8x8, cc->hybrid_coef_probs_8x8); vp9_copy(cm->fc.coef_probs_16x16, cc->coef_probs_16x16); - vp9_copy(cm->fc.hybrid_coef_probs_16x16, cc->hybrid_coef_probs_16x16); vp9_copy(cm->fc.coef_probs_32x32, cc->coef_probs_32x32); vp9_copy(cm->fc.switchable_interp_prob, cc->switchable_interp_prob); #if CONFIG_COMP_INTERINTRA_PRED diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c index fd2c2b0..1122496 100644 --- a/vp9/encoder/vp9_rdopt.c +++ b/vp9/encoder/vp9_rdopt.c @@ -150,20 +150,21 @@ const MODE_DEFINITION vp9_mode_order[MAX_MODES] = { static void fill_token_costs(vp9_coeff_count *c, vp9_coeff_probs *p, int block_type_counts) { - int i, j, k; + int i, j, k, l; for (i = 0; i < block_type_counts; i++) - for (j = 0; j < COEF_BANDS; j++) - for (k = 0; k < PREV_COEF_CONTEXTS; k++) { - if (k == 0 && j > 0) - vp9_cost_tokens_skip((int *)(c[i][j][k]), - p[i][j][k], - vp9_coef_tree); - else - vp9_cost_tokens((int *)(c[i][j][k]), - p[i][j][k], - vp9_coef_tree); - } + for (j = 0; j < REF_TYPES; j++) + for (k = 0; k < COEF_BANDS; k++) + for (l = 0; l < PREV_COEF_CONTEXTS; l++) { + if (l == 0 && k > 0) + vp9_cost_tokens_skip((int *)(c[i][j][k][l]), + p[i][j][k][l], + vp9_coef_tree); + else + vp9_cost_tokens((int *)(c[i][j][k][l]), + p[i][j][k][l], + vp9_coef_tree); + } } @@ -268,23 +269,11 @@ void vp9_initialize_rd_consts(VP9_COMP *cpi, int QIndex) { } fill_token_costs(cpi->mb.token_costs[TX_4X4], - cpi->common.fc.coef_probs_4x4, BLOCK_TYPES_4X4); - fill_token_costs(cpi->mb.hybrid_token_costs[TX_4X4], - cpi->common.fc.hybrid_coef_probs_4x4, - BLOCK_TYPES_4X4_HYBRID); - + cpi->common.fc.coef_probs_4x4, BLOCK_TYPES); fill_token_costs(cpi->mb.token_costs[TX_8X8], - cpi->common.fc.coef_probs_8x8, BLOCK_TYPES_8X8); - fill_token_costs(cpi->mb.hybrid_token_costs[TX_8X8], - cpi->common.fc.hybrid_coef_probs_8x8, - BLOCK_TYPES_8X8_HYBRID); - + cpi->common.fc.coef_probs_8x8, BLOCK_TYPES); fill_token_costs(cpi->mb.token_costs[TX_16X16], - cpi->common.fc.coef_probs_16x16, BLOCK_TYPES_16X16); - fill_token_costs(cpi->mb.hybrid_token_costs[TX_16X16], - cpi->common.fc.hybrid_coef_probs_16x16, - BLOCK_TYPES_16X16_HYBRID); - + cpi->common.fc.coef_probs_16x16, BLOCK_TYPES); fill_token_costs(cpi->mb.token_costs[TX_32X32], cpi->common.fc.coef_probs_32x32, BLOCK_TYPES_32X32); @@ -407,11 +396,11 @@ static INLINE int cost_coeffs(MACROBLOCK *mb, const int segment_id = xd->mode_info_context->mbmi.segment_id; const int *scan; int16_t *qcoeff_ptr = b->qcoeff; + const int ref = xd->mode_info_context->mbmi.ref_frame != INTRA_FRAME; const TX_TYPE tx_type = (type == PLANE_TYPE_Y_WITH_DC) ? get_tx_type(xd, b) : DCT_DCT; unsigned int (*token_costs)[PREV_COEF_CONTEXTS][MAX_ENTROPY_TOKENS] = - (tx_type == DCT_DCT) ? mb->token_costs[tx_size][type] : - mb->hybrid_token_costs[tx_size][type]; + mb->token_costs[tx_size][type][ref]; ENTROPY_CONTEXT a_ec = *a, l_ec = *l; switch (tx_size) { @@ -453,19 +442,7 @@ static INLINE int cost_coeffs(MACROBLOCK *mb, if (vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP)) seg_eob = 0; - if (tx_type != DCT_DCT) { - int recent_energy = 0; - for (; c < eob; c++) { - int v = qcoeff_ptr[scan[c]]; - int t = vp9_dct_value_tokens_ptr[v].Token; - cost += token_costs[get_coef_band(tx_size, c)][pt][t]; - cost += vp9_dct_value_cost_ptr[v]; - pt = vp9_get_coef_context(&recent_energy, t); - } - if (c < seg_eob) - cost += mb->hybrid_token_costs[tx_size][type][get_coef_band(tx_size, c)] - [pt][DCT_EOB_TOKEN]; - } else { + { int recent_energy = 0; for (; c < eob; c++) { int v = qcoeff_ptr[scan[c]]; @@ -475,7 +452,7 @@ static INLINE int cost_coeffs(MACROBLOCK *mb, pt = vp9_get_coef_context(&recent_energy, t); } if (c < seg_eob) - cost += mb->token_costs[tx_size][type][get_coef_band(tx_size, c)] + cost += mb->token_costs[tx_size][type][ref][get_coef_band(tx_size, c)] [pt][DCT_EOB_TOKEN]; } diff --git a/vp9/encoder/vp9_tokenize.c b/vp9/encoder/vp9_tokenize.c index 4401b24..8efc976 100644 --- a/vp9/encoder/vp9_tokenize.c +++ b/vp9/encoder/vp9_tokenize.c @@ -25,20 +25,14 @@ compressions, then generating vp9_context.c = initial stats. */ #ifdef ENTROPY_STATS -vp9_coeff_accum context_counters_4x4[BLOCK_TYPES_4X4]; -vp9_coeff_accum hybrid_context_counters_4x4[BLOCK_TYPES_4X4_HYBRID]; -vp9_coeff_accum context_counters_8x8[BLOCK_TYPES_8X8]; -vp9_coeff_accum hybrid_context_counters_8x8[BLOCK_TYPES_8X8_HYBRID]; -vp9_coeff_accum context_counters_16x16[BLOCK_TYPES_16X16]; -vp9_coeff_accum hybrid_context_counters_16x16[BLOCK_TYPES_16X16_HYBRID]; +vp9_coeff_accum context_counters_4x4[BLOCK_TYPES]; +vp9_coeff_accum context_counters_8x8[BLOCK_TYPES]; +vp9_coeff_accum context_counters_16x16[BLOCK_TYPES]; vp9_coeff_accum context_counters_32x32[BLOCK_TYPES_32X32]; -extern vp9_coeff_stats tree_update_hist_4x4[BLOCK_TYPES_4X4]; -extern vp9_coeff_stats hybrid_tree_update_hist_4x4[BLOCK_TYPES_4X4_HYBRID]; -extern vp9_coeff_stats tree_update_hist_8x8[BLOCK_TYPES_8X8]; -extern vp9_coeff_stats hybrid_tree_update_hist_8x8[BLOCK_TYPES_8X8_HYBRID]; -extern vp9_coeff_stats tree_update_hist_16x16[BLOCK_TYPES_16X16]; -extern vp9_coeff_stats hybrid_tree_update_hist_16x16[BLOCK_TYPES_16X16_HYBRID]; +extern vp9_coeff_stats tree_update_hist_4x4[BLOCK_TYPES]; +extern vp9_coeff_stats tree_update_hist_8x8[BLOCK_TYPES]; +extern vp9_coeff_stats tree_update_hist_16x16[BLOCK_TYPES]; extern vp9_coeff_stats tree_update_hist_32x32[BLOCK_TYPES_32X32]; #endif /* ENTROPY_STATS */ @@ -121,6 +115,7 @@ static void tokenize_b(VP9_COMP *cpi, vp9_coeff_probs *probs; const TX_TYPE tx_type = (type == PLANE_TYPE_Y_WITH_DC) ? get_tx_type(xd, b) : DCT_DCT; + const int ref = xd->mode_info_context->mbmi.ref_frame != INTRA_FRAME; ENTROPY_CONTEXT *const a = (ENTROPY_CONTEXT *)xd->above_context + vp9_block2above[tx_size][ib]; @@ -140,17 +135,14 @@ static void tokenize_b(VP9_COMP *cpi, seg_eob = 16; scan = vp9_default_zig_zag1d_4x4; if (tx_type != DCT_DCT) { - counts = cpi->hybrid_coef_counts_4x4; - probs = cpi->common.fc.hybrid_coef_probs_4x4; if (tx_type == ADST_DCT) { scan = vp9_row_scan_4x4; } else if (tx_type == DCT_ADST) { scan = vp9_col_scan_4x4; } - } else { - counts = cpi->coef_counts_4x4; - probs = cpi->common.fc.coef_probs_4x4; } + counts = cpi->coef_counts_4x4; + probs = cpi->common.fc.coef_probs_4x4; break; case TX_8X8: #if CONFIG_CNVCONTEXT @@ -159,13 +151,8 @@ static void tokenize_b(VP9_COMP *cpi, #endif seg_eob = 64; scan = vp9_default_zig_zag1d_8x8; - if (tx_type != DCT_DCT) { - counts = cpi->hybrid_coef_counts_8x8; - probs = cpi->common.fc.hybrid_coef_probs_8x8; - } else { - counts = cpi->coef_counts_8x8; - probs = cpi->common.fc.coef_probs_8x8; - } + counts = cpi->coef_counts_8x8; + probs = cpi->common.fc.coef_probs_8x8; break; case TX_16X16: #if CONFIG_CNVCONTEXT @@ -179,13 +166,8 @@ static void tokenize_b(VP9_COMP *cpi, #endif seg_eob = 256; scan = vp9_default_zig_zag1d_16x16; - if (tx_type != DCT_DCT) { - counts = cpi->hybrid_coef_counts_16x16; - probs = cpi->common.fc.hybrid_coef_probs_16x16; - } else { - counts = cpi->coef_counts_16x16; - probs = cpi->common.fc.coef_probs_16x16; - } + counts = cpi->coef_counts_16x16; + probs = cpi->common.fc.coef_probs_16x16; if (type == PLANE_TYPE_UV) { int uv_idx = (ib - 16) >> 2; qcoeff_ptr = xd->sb_coeff_data.qcoeff + 1024 + 256 * uv_idx; @@ -229,11 +211,11 @@ static void tokenize_b(VP9_COMP *cpi, } t->Token = token; - t->context_tree = probs[type][band][pt]; + t->context_tree = probs[type][ref][band][pt]; t->skip_eob_node = (pt == 0) && (band > 0); assert(vp9_coef_encodings[t->Token].Len - t->skip_eob_node > 0); if (!dry_run) { - ++counts[type][band][pt][token]; + ++counts[type][ref][band][pt][token]; } pt = vp9_get_coef_context(&recent_energy, token); @@ -470,25 +452,13 @@ void init_context_counters(void) { FILE *f = fopen("context.bin", "rb"); if (!f) { vpx_memset(context_counters_4x4, 0, sizeof(context_counters_4x4)); - vpx_memset(hybrid_context_counters_4x4, 0, - sizeof(hybrid_context_counters_4x4)); vpx_memset(context_counters_8x8, 0, sizeof(context_counters_8x8)); - vpx_memset(hybrid_context_counters_8x8, 0, - sizeof(hybrid_context_counters_8x8)); vpx_memset(context_counters_16x16, 0, sizeof(context_counters_16x16)); - vpx_memset(hybrid_context_counters_16x16, 0, - sizeof(hybrid_context_counters_16x16)); vpx_memset(context_counters_32x32, 0, sizeof(context_counters_32x32)); } else { fread(context_counters_4x4, sizeof(context_counters_4x4), 1, f); - fread(hybrid_context_counters_4x4, - sizeof(hybrid_context_counters_4x4), 1, f); fread(context_counters_8x8, sizeof(context_counters_8x8), 1, f); - fread(hybrid_context_counters_8x8, - sizeof(hybrid_context_counters_8x8), 1, f); fread(context_counters_16x16, sizeof(context_counters_16x16), 1, f); - fread(hybrid_context_counters_16x16, - sizeof(hybrid_context_counters_16x16), 1, f); fread(context_counters_32x32, sizeof(context_counters_32x32), 1, f); fclose(f); } @@ -496,25 +466,13 @@ void init_context_counters(void) { f = fopen("treeupdate.bin", "rb"); if (!f) { vpx_memset(tree_update_hist_4x4, 0, sizeof(tree_update_hist_4x4)); - vpx_memset(hybrid_tree_update_hist_4x4, 0, - sizeof(hybrid_tree_update_hist_4x4)); vpx_memset(tree_update_hist_8x8, 0, sizeof(tree_update_hist_8x8)); - vpx_memset(hybrid_tree_update_hist_8x8, 0, - sizeof(hybrid_tree_update_hist_8x8)); vpx_memset(tree_update_hist_16x16, 0, sizeof(tree_update_hist_16x16)); - vpx_memset(hybrid_tree_update_hist_16x16, 0, - sizeof(hybrid_tree_update_hist_16x16)); vpx_memset(tree_update_hist_32x32, 0, sizeof(tree_update_hist_32x32)); } else { fread(tree_update_hist_4x4, sizeof(tree_update_hist_4x4), 1, f); - fread(hybrid_tree_update_hist_4x4, - sizeof(hybrid_tree_update_hist_4x4), 1, f); fread(tree_update_hist_8x8, sizeof(tree_update_hist_8x8), 1, f); - fread(hybrid_tree_update_hist_8x8, - sizeof(hybrid_tree_update_hist_8x8), 1, f); fread(tree_update_hist_16x16, sizeof(tree_update_hist_16x16), 1, f); - fread(hybrid_tree_update_hist_16x16, - sizeof(hybrid_tree_update_hist_16x16), 1, f); fread(tree_update_hist_32x32, sizeof(tree_update_hist_32x32), 1, f); fclose(f); } @@ -522,33 +480,38 @@ void init_context_counters(void) { static void print_counter(FILE *f, vp9_coeff_accum *context_counters, int block_types, const char *header) { - int type, band, pt, t; + int type, ref, band, pt, t; fprintf(f, "static const vp9_coeff_count %s = {\n", header); #define Comma(X) (X ? "," : "") type = 0; do { + ref = 0; fprintf(f, "%s\n { /* block Type %d */", Comma(type), type); - band = 0; do { - fprintf(f, "%s\n { /* Coeff Band %d */", Comma(band), band); - pt = 0; + fprintf(f, "%s\n { /* %s */", Comma(type), ref ? "Inter" : "Intra"); + band = 0; do { - fprintf(f, "%s\n {", Comma(pt)); - - t = 0; + fprintf(f, "%s\n { /* Coeff Band %d */", Comma(band), band); + pt = 0; do { - const int64_t x = context_counters[type][band][pt][t]; - const int y = (int) x; - - assert(x == (int64_t) y); /* no overflow handling yet */ - fprintf(f, "%s %d", Comma(t), y); - } while (++t < MAX_ENTROPY_TOKENS); - fprintf(f, "}"); - } while (++pt < PREV_COEF_CONTEXTS); + fprintf(f, "%s\n {", Comma(pt)); + + t = 0; + do { + const int64_t x = context_counters[type][ref][band][pt][t]; + const int y = (int) x; + + assert(x == (int64_t) y); /* no overflow handling yet */ + fprintf(f, "%s %d", Comma(t), y); + } while (++t < MAX_ENTROPY_TOKENS); + fprintf(f, "}"); + } while (++pt < PREV_COEF_CONTEXTS); + fprintf(f, "\n }"); + } while (++band < COEF_BANDS); fprintf(f, "\n }"); - } while (++band < COEF_BANDS); + } while (++ref < REF_TYPES); fprintf(f, "\n }"); } while (++type < block_types); fprintf(f, "\n};\n"); @@ -556,7 +519,7 @@ static void print_counter(FILE *f, vp9_coeff_accum *context_counters, static void print_probs(FILE *f, vp9_coeff_accum *context_counters, int block_types, const char *header) { - int type, band, pt, t; + int type, ref, band, pt, t; fprintf(f, "static const vp9_coeff_probs %s = {", header); @@ -565,32 +528,38 @@ static void print_probs(FILE *f, vp9_coeff_accum *context_counters, do { fprintf(f, "%s%s{ /* block Type %d */", Comma(type), Newline(type, " "), type); - band = 0; + ref = 0; do { - fprintf(f, "%s%s{ /* Coeff Band %d */", - Comma(band), Newline(band, " "), band); - pt = 0; + fprintf(f, "%s%s{ /* %s */", + Comma(band), Newline(band, " "), ref ? "Inter" : "Intra"); + band = 0; do { - unsigned int branch_ct[ENTROPY_NODES][2]; - unsigned int coef_counts[MAX_ENTROPY_TOKENS]; - vp9_prob coef_probs[ENTROPY_NODES]; - - for (t = 0; t < MAX_ENTROPY_TOKENS; ++t) - coef_counts[t] = context_counters[type][band][pt][t]; - vp9_tree_probs_from_distribution(MAX_ENTROPY_TOKENS, - vp9_coef_encodings, vp9_coef_tree, - coef_probs, branch_ct, coef_counts); - fprintf(f, "%s\n {", Comma(pt)); - - t = 0; + fprintf(f, "%s%s{ /* Coeff Band %d */", + Comma(band), Newline(band, " "), band); + pt = 0; do { - fprintf(f, "%s %3d", Comma(t), coef_probs[t]); - } while (++t < ENTROPY_NODES); - - fprintf(f, " }"); - } while (++pt < PREV_COEF_CONTEXTS); + unsigned int branch_ct[ENTROPY_NODES][2]; + unsigned int coef_counts[MAX_ENTROPY_TOKENS]; + vp9_prob coef_probs[ENTROPY_NODES]; + + for (t = 0; t < MAX_ENTROPY_TOKENS; ++t) + coef_counts[t] = context_counters[type][ref][band][pt][t]; + vp9_tree_probs_from_distribution(MAX_ENTROPY_TOKENS, + vp9_coef_encodings, vp9_coef_tree, + coef_probs, branch_ct, coef_counts); + fprintf(f, "%s\n {", Comma(pt)); + + t = 0; + do { + fprintf(f, "%s %3d", Comma(t), coef_probs[t]); + } while (++t < ENTROPY_NODES); + + fprintf(f, " }"); + } while (++pt < PREV_COEF_CONTEXTS); + fprintf(f, "\n }"); + } while (++band < COEF_BANDS); fprintf(f, "\n }"); - } while (++band < COEF_BANDS); + } while (++ref < REF_TYPES); fprintf(f, "\n }"); } while (++type < block_types); fprintf(f, "\n};\n"); @@ -603,35 +572,22 @@ void print_context_counters() { fprintf(f, "\n/* *** GENERATED FILE: DO NOT EDIT *** */\n\n"); /* print counts */ - print_counter(f, context_counters_4x4, BLOCK_TYPES_4X4, + print_counter(f, context_counters_4x4, BLOCK_TYPES, "vp9_default_coef_counts_4x4[BLOCK_TYPES_4X4]"); - print_counter(f, hybrid_context_counters_4x4, BLOCK_TYPES_4X4_HYBRID, - "vp9_default_hybrid_coef_counts_4x4[BLOCK_TYPES_4X4_HYBRID]"); - print_counter(f, context_counters_8x8, BLOCK_TYPES_8X8, + print_counter(f, context_counters_8x8, BLOCK_TYPES, "vp9_default_coef_counts_8x8[BLOCK_TYPES_8X8]"); - print_counter(f, hybrid_context_counters_8x8, BLOCK_TYPES_8X8_HYBRID, - "vp9_default_hybrid_coef_counts_8x8[BLOCK_TYPES_8X8_HYBRID]"); - print_counter(f, context_counters_16x16, BLOCK_TYPES_16X16, + print_counter(f, context_counters_16x16, BLOCK_TYPES, "vp9_default_coef_counts_16x16[BLOCK_TYPES_16X16]"); - print_counter(f, hybrid_context_counters_16x16, BLOCK_TYPES_16X16_HYBRID, - "vp9_default_hybrid_coef_counts_16x16" - "[BLOCK_TYPES_16X16_HYBRID]"); print_counter(f, context_counters_32x32, BLOCK_TYPES_32X32, "vp9_default_coef_counts_32x32[BLOCK_TYPES_32X32]"); /* print coefficient probabilities */ - print_probs(f, context_counters_4x4, BLOCK_TYPES_4X4, + print_probs(f, context_counters_4x4, BLOCK_TYPES, "default_coef_probs_4x4[BLOCK_TYPES_4X4]"); - print_probs(f, hybrid_context_counters_4x4, BLOCK_TYPES_4X4_HYBRID, - "default_hybrid_coef_probs_4x4[BLOCK_TYPES_4X4_HYBRID]"); - print_probs(f, context_counters_8x8, BLOCK_TYPES_8X8, + print_probs(f, context_counters_8x8, BLOCK_TYPES, "default_coef_probs_8x8[BLOCK_TYPES_8X8]"); - print_probs(f, hybrid_context_counters_8x8, BLOCK_TYPES_8X8_HYBRID, - "default_hybrid_coef_probs_8x8[BLOCK_TYPES_8X8_HYBRID]"); - print_probs(f, context_counters_16x16, BLOCK_TYPES_16X16, + print_probs(f, context_counters_16x16, BLOCK_TYPES, "default_coef_probs_16x16[BLOCK_TYPES_16X16]"); - print_probs(f, hybrid_context_counters_16x16, BLOCK_TYPES_16X16_HYBRID, - "default_hybrid_coef_probs_16x16[BLOCK_TYPES_16X16_HYBRID]"); print_probs(f, context_counters_32x32, BLOCK_TYPES_32X32, "default_coef_probs_32x32[BLOCK_TYPES_32X32]"); @@ -639,14 +595,8 @@ void print_context_counters() { f = fopen("context.bin", "wb"); fwrite(context_counters_4x4, sizeof(context_counters_4x4), 1, f); - fwrite(hybrid_context_counters_4x4, - sizeof(hybrid_context_counters_4x4), 1, f); fwrite(context_counters_8x8, sizeof(context_counters_8x8), 1, f); - fwrite(hybrid_context_counters_8x8, - sizeof(hybrid_context_counters_8x8), 1, f); fwrite(context_counters_16x16, sizeof(context_counters_16x16), 1, f); - fwrite(hybrid_context_counters_16x16, - sizeof(hybrid_context_counters_16x16), 1, f); fwrite(context_counters_32x32, sizeof(context_counters_32x32), 1, f); fclose(f); } @@ -663,13 +613,11 @@ static INLINE void stuff_b(VP9_COMP *cpi, PLANE_TYPE type, TX_SIZE tx_size, int dry_run) { - const BLOCKD * const b = xd->block + ib; vp9_coeff_count *counts; vp9_coeff_probs *probs; int pt, band; TOKENEXTRA *t = *tp; - const TX_TYPE tx_type = (type == PLANE_TYPE_Y_WITH_DC) ? - get_tx_type(xd, b) : DCT_DCT; + const int ref = xd->mode_info_context->mbmi.ref_frame != INTRA_FRAME; ENTROPY_CONTEXT *const a = (ENTROPY_CONTEXT *)xd->above_context + vp9_block2above[tx_size][ib]; ENTROPY_CONTEXT *const l = (ENTROPY_CONTEXT *)xd->left_context + @@ -683,26 +631,16 @@ static INLINE void stuff_b(VP9_COMP *cpi, switch (tx_size) { default: case TX_4X4: - if (tx_type != DCT_DCT) { - counts = cpi->hybrid_coef_counts_4x4; - probs = cpi->common.fc.hybrid_coef_probs_4x4; - } else { - counts = cpi->coef_counts_4x4; - probs = cpi->common.fc.coef_probs_4x4; - } + counts = cpi->coef_counts_4x4; + probs = cpi->common.fc.coef_probs_4x4; break; case TX_8X8: #if CONFIG_CNVCONTEXT a_ec = (a[0] + a[1]) != 0; l_ec = (l[0] + l[1]) != 0; #endif - if (tx_type != DCT_DCT) { - counts = cpi->hybrid_coef_counts_8x8; - probs = cpi->common.fc.hybrid_coef_probs_8x8; - } else { - counts = cpi->coef_counts_8x8; - probs = cpi->common.fc.coef_probs_8x8; - } + counts = cpi->coef_counts_8x8; + probs = cpi->common.fc.coef_probs_8x8; break; case TX_16X16: #if CONFIG_CNVCONTEXT @@ -714,13 +652,8 @@ static INLINE void stuff_b(VP9_COMP *cpi, l_ec = (l[0] + l[1] + l1[0] + l1[1]) != 0; } #endif - if (tx_type != DCT_DCT) { - counts = cpi->hybrid_coef_counts_16x16; - probs = cpi->common.fc.hybrid_coef_probs_16x16; - } else { - counts = cpi->coef_counts_16x16; - probs = cpi->common.fc.coef_probs_16x16; - } + counts = cpi->coef_counts_16x16; + probs = cpi->common.fc.coef_probs_16x16; break; case TX_32X32: #if CONFIG_CNVCONTEXT @@ -740,7 +673,7 @@ static INLINE void stuff_b(VP9_COMP *cpi, band = get_coef_band(tx_size, 0); t->Token = DCT_EOB_TOKEN; - t->context_tree = probs[type][band][pt]; + t->context_tree = probs[type][ref][band][pt]; t->skip_eob_node = 0; ++t; *tp = t; @@ -764,7 +697,7 @@ static INLINE void stuff_b(VP9_COMP *cpi, } if (!dry_run) { - ++counts[type][band][pt][DCT_EOB_TOKEN]; + ++counts[type][ref][band][pt][DCT_EOB_TOKEN]; } } diff --git a/vp9/encoder/vp9_tokenize.h b/vp9/encoder/vp9_tokenize.h index 8d1daff..6ac19ba 100644 --- a/vp9/encoder/vp9_tokenize.h +++ b/vp9/encoder/vp9_tokenize.h @@ -28,7 +28,7 @@ typedef struct { uint8_t skip_eob_node; } TOKENEXTRA; -typedef int64_t vp9_coeff_accum[COEF_BANDS][PREV_COEF_CONTEXTS] +typedef int64_t vp9_coeff_accum[REF_TYPES][COEF_BANDS][PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS]; int vp9_mby_is_skippable_4x4(MACROBLOCKD *xd); @@ -57,14 +57,10 @@ void vp9_fix_contexts_sb(MACROBLOCKD *xd); void init_context_counters(); void print_context_counters(); -extern vp9_coeff_accum context_counters_4x4[BLOCK_TYPES_4X4]; -extern vp9_coeff_accum context_counters_8x8[BLOCK_TYPES_8X8]; -extern vp9_coeff_accum context_counters_16x16[BLOCK_TYPES_16X16]; +extern vp9_coeff_accum context_counters_4x4[BLOCK_TYPES]; +extern vp9_coeff_accum context_counters_8x8[BLOCK_TYPES]; +extern vp9_coeff_accum context_counters_16x16[BLOCK_TYPES]; extern vp9_coeff_accum context_counters_32x32[BLOCK_TYPES_32X32]; - -extern vp9_coeff_accum hybrid_context_counters_4x4[BLOCK_TYPES_4X4_HYBRID]; -extern vp9_coeff_accum hybrid_context_counters_8x8[BLOCK_TYPES_8X8_HYBRID]; -extern vp9_coeff_accum hybrid_context_counters_16x16[BLOCK_TYPES_16X16_HYBRID]; #endif extern const int *vp9_dct_value_cost_ptr; -- 2.7.4