Commit 8787227a authored by Hui Su's avatar Hui Su

Remove code about tree and probability

Change-Id: I66a542da0c7b8fdb9ac2d4efee73aa62414c10f9
parent b70615b9
......@@ -130,45 +130,6 @@ static INLINE aom_prob get_prob(unsigned int num, unsigned int den) {
}
}
static INLINE aom_prob get_binary_prob(unsigned int n0, unsigned int n1) {
const unsigned int den = n0 + n1;
if (den == 0) return 128u;
return get_prob(n0, den);
}
/* This function assumes prob1 and prob2 are already within [1,255] range. */
static INLINE aom_prob weighted_prob(int prob1, int prob2, int factor) {
return ROUND_POWER_OF_TWO(prob1 * (256 - factor) + prob2 * factor, 8);
}
static INLINE aom_prob merge_probs(aom_prob pre_prob, const unsigned int ct[2],
unsigned int count_sat,
unsigned int max_update_factor) {
const aom_prob prob = get_binary_prob(ct[0], ct[1]);
const unsigned int count = AOMMIN(ct[0] + ct[1], count_sat);
const unsigned int factor = max_update_factor * count / count_sat;
return weighted_prob(pre_prob, prob, factor);
}
// MODE_MV_MAX_UPDATE_FACTOR (128) * count / MODE_MV_COUNT_SAT;
static const int count_to_update_factor[MODE_MV_COUNT_SAT + 1] = {
0, 6, 12, 19, 25, 32, 38, 44, 51, 57, 64,
70, 76, 83, 89, 96, 102, 108, 115, 121, 128
};
static INLINE aom_prob mode_mv_merge_probs(aom_prob pre_prob,
const unsigned int ct[2]) {
const unsigned int den = ct[0] + ct[1];
if (den == 0) {
return pre_prob;
} else {
const unsigned int count = AOMMIN(den, MODE_MV_COUNT_SAT);
const unsigned int factor = count_to_update_factor[count];
const aom_prob prob = get_prob(ct[0], den);
return weighted_prob(pre_prob, prob, factor);
}
}
static INLINE void update_cdf(aom_cdf_prob *cdf, int val, int nsymbs) {
int rate;
const int rate2 = 5;
......
......@@ -61,16 +61,6 @@ const aom_cdf_prob av1_cat6_cdf4[CDF_SIZE(4)] = { AOM_CDF4(32513, 32641,
const aom_cdf_prob *av1_cat6_cdf[] = {
av1_cat6_cdf0, av1_cat6_cdf1, av1_cat6_cdf2, av1_cat6_cdf3, av1_cat6_cdf4
};
/* Extra bits coded from MSB to LSB */
const aom_prob av1_cat1_prob[] = { 159 };
const aom_prob av1_cat2_prob[] = { 165, 145 };
const aom_prob av1_cat3_prob[] = { 173, 148, 140 };
const aom_prob av1_cat4_prob[] = { 176, 155, 140, 135 };
const aom_prob av1_cat5_prob[] = { 180, 157, 141, 134, 130 };
const aom_prob av1_cat6_prob[] = {
255, 255, 255, 255, 254, 254, 254, 252, 249,
243, 230, 196, 177, 153, 140, 133, 130, 129
};
const uint16_t band_count_table[TX_SIZES_ALL][8] = {
{ 1, 2, 3, 4, 3, 16 - 13, 0 }, { 1, 2, 3, 4, 11, 64 - 21, 0 },
......@@ -287,279 +277,6 @@ const uint8_t av1_coefband_trans_4x4[16] = {
const uint8_t av1_pt_energy_class[ENTROPY_TOKENS] = { 0, 1, 2, 3, 3, 4,
4, 5, 5, 5, 5, 5 };
// Model obtained from a 2-sided zero-centered distribution derived
// from a Pareto distribution. The cdf of the distribution is:
// cdf(x) = 0.5 + 0.5 * sgn(x) * [1 - {alpha/(alpha + |x|)} ^ beta]
//
// For a given beta and a given probablity of the 1-node, the alpha
// is first solved, and then the {alpha, beta} pair is used to generate
// the probabilities for the rest of the nodes.
// beta = 8
// Every odd line in this table can be generated from the even lines
// by averaging :
// av1_pareto8_full[l][node] = (av1_pareto8_full[l-1][node] +
// av1_pareto8_full[l+1][node] ) >> 1;
// Values for tokens ONE_TOKEN through CATEGORY6_TOKEN included here.
const aom_prob av1_pareto8_full[COEFF_PROB_MODELS][MODEL_NODES] = {
{ 3, 86, 128, 6, 86, 23, 88, 29 },
{ 6, 86, 128, 11, 87, 42, 91, 52 },
{ 9, 86, 129, 17, 88, 61, 94, 76 },
{ 12, 86, 129, 22, 88, 77, 97, 93 },
{ 15, 87, 129, 28, 89, 93, 100, 110 },
{ 17, 87, 129, 33, 90, 105, 103, 123 },
{ 20, 88, 130, 38, 91, 118, 106, 136 },
{ 23, 88, 130, 43, 91, 128, 108, 146 },
{ 26, 89, 131, 48, 92, 139, 111, 156 },
{ 28, 89, 131, 53, 93, 147, 114, 163 },
{ 31, 90, 131, 58, 94, 156, 117, 171 },
{ 34, 90, 131, 62, 94, 163, 119, 177 },
{ 37, 90, 132, 66, 95, 171, 122, 184 },
{ 39, 90, 132, 70, 96, 177, 124, 189 },
{ 42, 91, 132, 75, 97, 183, 127, 194 },
{ 44, 91, 132, 79, 97, 188, 129, 198 },
{ 47, 92, 133, 83, 98, 193, 132, 202 },
{ 49, 92, 133, 86, 99, 197, 134, 205 },
{ 52, 93, 133, 90, 100, 201, 137, 208 },
{ 54, 93, 133, 94, 100, 204, 139, 211 },
{ 57, 94, 134, 98, 101, 208, 142, 214 },
{ 59, 94, 134, 101, 102, 211, 144, 216 },
{ 62, 94, 135, 105, 103, 214, 146, 218 },
{ 64, 94, 135, 108, 103, 216, 148, 220 },
{ 66, 95, 135, 111, 104, 219, 151, 222 },
{ 68, 95, 135, 114, 105, 221, 153, 223 },
{ 71, 96, 136, 117, 106, 224, 155, 225 },
{ 73, 96, 136, 120, 106, 225, 157, 226 },
{ 76, 97, 136, 123, 107, 227, 159, 228 },
{ 78, 97, 136, 126, 108, 229, 160, 229 },
{ 80, 98, 137, 129, 109, 231, 162, 231 },
{ 82, 98, 137, 131, 109, 232, 164, 232 },
{ 84, 98, 138, 134, 110, 234, 166, 233 },
{ 86, 98, 138, 137, 111, 235, 168, 234 },
{ 89, 99, 138, 140, 112, 236, 170, 235 },
{ 91, 99, 138, 142, 112, 237, 171, 235 },
{ 93, 100, 139, 145, 113, 238, 173, 236 },
{ 95, 100, 139, 147, 114, 239, 174, 237 },
{ 97, 101, 140, 149, 115, 240, 176, 238 },
{ 99, 101, 140, 151, 115, 241, 177, 238 },
{ 101, 102, 140, 154, 116, 242, 179, 239 },
{ 103, 102, 140, 156, 117, 242, 180, 239 },
{ 105, 103, 141, 158, 118, 243, 182, 240 },
{ 107, 103, 141, 160, 118, 243, 183, 240 },
{ 109, 104, 141, 162, 119, 244, 185, 241 },
{ 111, 104, 141, 164, 119, 244, 186, 241 },
{ 113, 104, 142, 166, 120, 245, 187, 242 },
{ 114, 104, 142, 168, 121, 245, 188, 242 },
{ 116, 105, 143, 170, 122, 246, 190, 243 },
{ 118, 105, 143, 171, 122, 246, 191, 243 },
{ 120, 106, 143, 173, 123, 247, 192, 244 },
{ 121, 106, 143, 175, 124, 247, 193, 244 },
{ 123, 107, 144, 177, 125, 248, 195, 244 },
{ 125, 107, 144, 178, 125, 248, 196, 244 },
{ 127, 108, 145, 180, 126, 249, 197, 245 },
{ 128, 108, 145, 181, 127, 249, 198, 245 },
{ 130, 109, 145, 183, 128, 249, 199, 245 },
{ 132, 109, 145, 184, 128, 249, 200, 245 },
{ 134, 110, 146, 186, 129, 250, 201, 246 },
{ 135, 110, 146, 187, 130, 250, 202, 246 },
{ 137, 111, 147, 189, 131, 251, 203, 246 },
{ 138, 111, 147, 190, 131, 251, 204, 246 },
{ 140, 112, 147, 192, 132, 251, 205, 247 },
{ 141, 112, 147, 193, 132, 251, 206, 247 },
{ 143, 113, 148, 194, 133, 251, 207, 247 },
{ 144, 113, 148, 195, 134, 251, 207, 247 },
{ 146, 114, 149, 197, 135, 252, 208, 248 },
{ 147, 114, 149, 198, 135, 252, 209, 248 },
{ 149, 115, 149, 199, 136, 252, 210, 248 },
{ 150, 115, 149, 200, 137, 252, 210, 248 },
{ 152, 115, 150, 201, 138, 252, 211, 248 },
{ 153, 115, 150, 202, 138, 252, 212, 248 },
{ 155, 116, 151, 204, 139, 253, 213, 249 },
{ 156, 116, 151, 205, 139, 253, 213, 249 },
{ 158, 117, 151, 206, 140, 253, 214, 249 },
{ 159, 117, 151, 207, 141, 253, 215, 249 },
{ 161, 118, 152, 208, 142, 253, 216, 249 },
{ 162, 118, 152, 209, 142, 253, 216, 249 },
{ 163, 119, 153, 210, 143, 253, 217, 249 },
{ 164, 119, 153, 211, 143, 253, 217, 249 },
{ 166, 120, 153, 212, 144, 254, 218, 250 },
{ 167, 120, 153, 212, 145, 254, 219, 250 },
{ 168, 121, 154, 213, 146, 254, 220, 250 },
{ 169, 121, 154, 214, 146, 254, 220, 250 },
{ 171, 122, 155, 215, 147, 254, 221, 250 },
{ 172, 122, 155, 216, 147, 254, 221, 250 },
{ 173, 123, 155, 217, 148, 254, 222, 250 },
{ 174, 123, 155, 217, 149, 254, 222, 250 },
{ 176, 124, 156, 218, 150, 254, 223, 250 },
{ 177, 124, 156, 219, 150, 254, 223, 250 },
{ 178, 125, 157, 220, 151, 254, 224, 251 },
{ 179, 125, 157, 220, 151, 254, 224, 251 },
{ 180, 126, 157, 221, 152, 254, 225, 251 },
{ 181, 126, 157, 221, 152, 254, 225, 251 },
{ 183, 127, 158, 222, 153, 254, 226, 251 },
{ 184, 127, 158, 223, 154, 254, 226, 251 },
{ 185, 128, 159, 224, 155, 255, 227, 251 },
{ 186, 128, 159, 224, 155, 255, 227, 251 },
{ 187, 129, 160, 225, 156, 255, 228, 251 },
{ 188, 130, 160, 225, 156, 255, 228, 251 },
{ 189, 131, 160, 226, 157, 255, 228, 251 },
{ 190, 131, 160, 226, 158, 255, 228, 251 },
{ 191, 132, 161, 227, 159, 255, 229, 251 },
{ 192, 132, 161, 227, 159, 255, 229, 251 },
{ 193, 133, 162, 228, 160, 255, 230, 252 },
{ 194, 133, 162, 229, 160, 255, 230, 252 },
{ 195, 134, 163, 230, 161, 255, 231, 252 },
{ 196, 134, 163, 230, 161, 255, 231, 252 },
{ 197, 135, 163, 231, 162, 255, 231, 252 },
{ 198, 135, 163, 231, 162, 255, 231, 252 },
{ 199, 136, 164, 232, 163, 255, 232, 252 },
{ 200, 136, 164, 232, 164, 255, 232, 252 },
{ 201, 137, 165, 233, 165, 255, 233, 252 },
{ 201, 137, 165, 233, 165, 255, 233, 252 },
{ 202, 138, 166, 233, 166, 255, 233, 252 },
{ 203, 138, 166, 233, 166, 255, 233, 252 },
{ 204, 139, 166, 234, 167, 255, 234, 252 },
{ 205, 139, 166, 234, 167, 255, 234, 252 },
{ 206, 140, 167, 235, 168, 255, 235, 252 },
{ 206, 140, 167, 235, 168, 255, 235, 252 },
{ 207, 141, 168, 236, 169, 255, 235, 252 },
{ 208, 141, 168, 236, 170, 255, 235, 252 },
{ 209, 142, 169, 237, 171, 255, 236, 252 },
{ 209, 143, 169, 237, 171, 255, 236, 252 },
{ 210, 144, 169, 237, 172, 255, 236, 252 },
{ 211, 144, 169, 237, 172, 255, 236, 252 },
{ 212, 145, 170, 238, 173, 255, 237, 252 },
{ 213, 145, 170, 238, 173, 255, 237, 252 },
{ 214, 146, 171, 239, 174, 255, 237, 253 },
{ 214, 146, 171, 239, 174, 255, 237, 253 },
{ 215, 147, 172, 240, 175, 255, 238, 253 },
{ 215, 147, 172, 240, 175, 255, 238, 253 },
{ 216, 148, 173, 240, 176, 255, 238, 253 },
{ 217, 148, 173, 240, 176, 255, 238, 253 },
{ 218, 149, 173, 241, 177, 255, 239, 253 },
{ 218, 149, 173, 241, 178, 255, 239, 253 },
{ 219, 150, 174, 241, 179, 255, 239, 253 },
{ 219, 151, 174, 241, 179, 255, 239, 253 },
{ 220, 152, 175, 242, 180, 255, 240, 253 },
{ 221, 152, 175, 242, 180, 255, 240, 253 },
{ 222, 153, 176, 242, 181, 255, 240, 253 },
{ 222, 153, 176, 242, 181, 255, 240, 253 },
{ 223, 154, 177, 243, 182, 255, 240, 253 },
{ 223, 154, 177, 243, 182, 255, 240, 253 },
{ 224, 155, 178, 244, 183, 255, 241, 253 },
{ 224, 155, 178, 244, 183, 255, 241, 253 },
{ 225, 156, 178, 244, 184, 255, 241, 253 },
{ 225, 157, 178, 244, 184, 255, 241, 253 },
{ 226, 158, 179, 244, 185, 255, 242, 253 },
{ 227, 158, 179, 244, 185, 255, 242, 253 },
{ 228, 159, 180, 245, 186, 255, 242, 253 },
{ 228, 159, 180, 245, 186, 255, 242, 253 },
{ 229, 160, 181, 245, 187, 255, 242, 253 },
{ 229, 160, 181, 245, 187, 255, 242, 253 },
{ 230, 161, 182, 246, 188, 255, 243, 253 },
{ 230, 162, 182, 246, 188, 255, 243, 253 },
{ 231, 163, 183, 246, 189, 255, 243, 253 },
{ 231, 163, 183, 246, 189, 255, 243, 253 },
{ 232, 164, 184, 247, 190, 255, 243, 253 },
{ 232, 164, 184, 247, 190, 255, 243, 253 },
{ 233, 165, 185, 247, 191, 255, 244, 253 },
{ 233, 165, 185, 247, 191, 255, 244, 253 },
{ 234, 166, 185, 247, 192, 255, 244, 253 },
{ 234, 167, 185, 247, 192, 255, 244, 253 },
{ 235, 168, 186, 248, 193, 255, 244, 253 },
{ 235, 168, 186, 248, 193, 255, 244, 253 },
{ 236, 169, 187, 248, 194, 255, 244, 253 },
{ 236, 169, 187, 248, 194, 255, 244, 253 },
{ 236, 170, 188, 248, 195, 255, 245, 253 },
{ 236, 170, 188, 248, 195, 255, 245, 253 },
{ 237, 171, 189, 249, 196, 255, 245, 254 },
{ 237, 172, 189, 249, 196, 255, 245, 254 },
{ 238, 173, 190, 249, 197, 255, 245, 254 },
{ 238, 173, 190, 249, 197, 255, 245, 254 },
{ 239, 174, 191, 249, 198, 255, 245, 254 },
{ 239, 174, 191, 249, 198, 255, 245, 254 },
{ 240, 175, 192, 249, 199, 255, 246, 254 },
{ 240, 176, 192, 249, 199, 255, 246, 254 },
{ 240, 177, 193, 250, 200, 255, 246, 254 },
{ 240, 177, 193, 250, 200, 255, 246, 254 },
{ 241, 178, 194, 250, 201, 255, 246, 254 },
{ 241, 178, 194, 250, 201, 255, 246, 254 },
{ 242, 179, 195, 250, 202, 255, 246, 254 },
{ 242, 180, 195, 250, 202, 255, 246, 254 },
{ 242, 181, 196, 250, 203, 255, 247, 254 },
{ 242, 181, 196, 250, 203, 255, 247, 254 },
{ 243, 182, 197, 251, 204, 255, 247, 254 },
{ 243, 183, 197, 251, 204, 255, 247, 254 },
{ 244, 184, 198, 251, 205, 255, 247, 254 },
{ 244, 184, 198, 251, 205, 255, 247, 254 },
{ 244, 185, 199, 251, 206, 255, 247, 254 },
{ 244, 185, 199, 251, 206, 255, 247, 254 },
{ 245, 186, 200, 251, 207, 255, 247, 254 },
{ 245, 187, 200, 251, 207, 255, 247, 254 },
{ 246, 188, 201, 252, 207, 255, 248, 254 },
{ 246, 188, 201, 252, 207, 255, 248, 254 },
{ 246, 189, 202, 252, 208, 255, 248, 254 },
{ 246, 190, 202, 252, 208, 255, 248, 254 },
{ 247, 191, 203, 252, 209, 255, 248, 254 },
{ 247, 191, 203, 252, 209, 255, 248, 254 },
{ 247, 192, 204, 252, 210, 255, 248, 254 },
{ 247, 193, 204, 252, 210, 255, 248, 254 },
{ 248, 194, 205, 252, 211, 255, 248, 254 },
{ 248, 194, 205, 252, 211, 255, 248, 254 },
{ 248, 195, 206, 252, 212, 255, 249, 254 },
{ 248, 196, 206, 252, 212, 255, 249, 254 },
{ 249, 197, 207, 253, 213, 255, 249, 254 },
{ 249, 197, 207, 253, 213, 255, 249, 254 },
{ 249, 198, 208, 253, 214, 255, 249, 254 },
{ 249, 199, 209, 253, 214, 255, 249, 254 },
{ 250, 200, 210, 253, 215, 255, 249, 254 },
{ 250, 200, 210, 253, 215, 255, 249, 254 },
{ 250, 201, 211, 253, 215, 255, 249, 254 },
{ 250, 202, 211, 253, 215, 255, 249, 254 },
{ 250, 203, 212, 253, 216, 255, 249, 254 },
{ 250, 203, 212, 253, 216, 255, 249, 254 },
{ 251, 204, 213, 253, 217, 255, 250, 254 },
{ 251, 205, 213, 253, 217, 255, 250, 254 },
{ 251, 206, 214, 254, 218, 255, 250, 254 },
{ 251, 206, 215, 254, 218, 255, 250, 254 },
{ 252, 207, 216, 254, 219, 255, 250, 254 },
{ 252, 208, 216, 254, 219, 255, 250, 254 },
{ 252, 209, 217, 254, 220, 255, 250, 254 },
{ 252, 210, 217, 254, 220, 255, 250, 254 },
{ 252, 211, 218, 254, 221, 255, 250, 254 },
{ 252, 212, 218, 254, 221, 255, 250, 254 },
{ 253, 213, 219, 254, 222, 255, 250, 254 },
{ 253, 213, 220, 254, 222, 255, 250, 254 },
{ 253, 214, 221, 254, 223, 255, 250, 254 },
{ 253, 215, 221, 254, 223, 255, 250, 254 },
{ 253, 216, 222, 254, 224, 255, 251, 254 },
{ 253, 217, 223, 254, 224, 255, 251, 254 },
{ 253, 218, 224, 254, 225, 255, 251, 254 },
{ 253, 219, 224, 254, 225, 255, 251, 254 },
{ 254, 220, 225, 254, 225, 255, 251, 254 },
{ 254, 221, 226, 254, 225, 255, 251, 254 },
{ 254, 222, 227, 255, 226, 255, 251, 254 },
{ 254, 223, 227, 255, 226, 255, 251, 254 },
{ 254, 224, 228, 255, 227, 255, 251, 254 },
{ 254, 225, 229, 255, 227, 255, 251, 254 },
{ 254, 226, 230, 255, 228, 255, 251, 254 },
{ 254, 227, 230, 255, 229, 255, 251, 254 },
{ 255, 228, 231, 255, 230, 255, 251, 254 },
{ 255, 229, 232, 255, 230, 255, 251, 254 },
{ 255, 230, 233, 255, 231, 255, 252, 254 },
{ 255, 231, 234, 255, 231, 255, 252, 254 },
{ 255, 232, 235, 255, 232, 255, 252, 254 },
{ 255, 233, 236, 255, 232, 255, 252, 254 },
{ 255, 235, 237, 255, 233, 255, 252, 254 },
{ 255, 236, 238, 255, 234, 255, 252, 254 },
{ 255, 238, 240, 255, 235, 255, 252, 255 },
{ 255, 239, 241, 255, 235, 255, 252, 254 },
{ 255, 241, 243, 255, 236, 255, 252, 254 },
{ 255, 243, 245, 255, 237, 255, 252, 254 },
{ 255, 246, 247, 255, 239, 255, 253, 255 },
};
// Model obtained from a 2-sided zero-centered distribution derived
// from a Pareto distribution. The cdf of the distribution is:
// cdf(x) = 0.5 + 0.5 * sgn(x) * [1 - {alpha/(alpha + |x|)} ^ beta]
......
......@@ -115,13 +115,8 @@ DECLARE_ALIGNED(16, extern const uint8_t, av1_pt_energy_class[ENTROPY_TOKENS]);
#define CAT5_MIN_VAL 35
#define CAT6_MIN_VAL 67
#define CAT6_BIT_SIZE 18
// Extra bit probabilities.
DECLARE_ALIGNED(16, extern const uint8_t, av1_cat1_prob[1]);
DECLARE_ALIGNED(16, extern const uint8_t, av1_cat2_prob[2]);
DECLARE_ALIGNED(16, extern const uint8_t, av1_cat3_prob[3]);
DECLARE_ALIGNED(16, extern const uint8_t, av1_cat4_prob[4]);
DECLARE_ALIGNED(16, extern const uint8_t, av1_cat5_prob[5]);
DECLARE_ALIGNED(16, extern const uint8_t, av1_cat6_prob[18]);
extern const aom_cdf_prob *av1_cat1_cdf[];
extern const aom_cdf_prob *av1_cat2_cdf[];
extern const aom_cdf_prob *av1_cat3_cdf[];
......@@ -151,8 +146,7 @@ static INLINE int av1_get_cat6_extrabits_size(TX_SIZE tx_size,
int tx_offset = (int)(tx_size - TX_4X4);
int bits = (int)bit_depth + 3 + tx_offset;
// Round up
bits = AOMMIN((int)sizeof(av1_cat6_prob), ((bits + 3) & ~3));
assert(bits <= (int)sizeof(av1_cat6_prob));
bits = AOMMIN(CAT6_BIT_SIZE, ((bits + 3) & ~3));
return bits;
}
......@@ -231,7 +225,6 @@ static INLINE const uint8_t *get_band_translate(TX_SIZE tx_size) {
#define MODEL_NODES (ENTROPY_NODES - UNCONSTRAINED_NODES)
#define TAIL_NODES (MODEL_NODES + 1)
extern const aom_prob av1_pareto8_full[COEFF_PROB_MODELS][MODEL_NODES];
typedef aom_cdf_prob coeff_cdf_model[REF_TYPES][COEF_BANDS][COEFF_CONTEXTS]
[CDF_SIZE(ENTROPY_TOKENS)];
......@@ -346,18 +339,6 @@ static INLINE int get_entropy_context(TX_SIZE tx_size, const ENTROPY_CONTEXT *a,
#define COEF_COUNT_SAT_AFTER_KEY 24
#define COEF_MAX_UPDATE_FACTOR_AFTER_KEY 128
static INLINE aom_prob av1_merge_probs(aom_prob pre_prob,
const unsigned int ct[2],
unsigned int count_sat,
unsigned int max_update_factor) {
return merge_probs(pre_prob, ct, count_sat, max_update_factor);
}
static INLINE aom_prob av1_mode_mv_merge_probs(aom_prob pre_prob,
const unsigned int ct[2]) {
return mode_mv_merge_probs(pre_prob, ct);
}
static INLINE TX_SIZE get_txsize_entropy_ctx(TX_SIZE txsize) {
return (TX_SIZE)((txsize_sqr_map[txsize] + txsize_sqr_up_map[txsize] + 1) >>
1);
......
......@@ -522,13 +522,7 @@ typedef struct AV1Common {
TXFM_CONTEXT *top_txfm_context[MAX_MB_PLANE];
TXFM_CONTEXT left_txfm_context[MAX_MB_PLANE][2 * MAX_MIB_SIZE];
int above_context_alloc_cols;
// scratch memory for intraonly/keyframe forward updates from default tables
// - this is intentionally not placed in FRAME_CONTEXT since it's reset upon
// each keyframe and not used afterwards
aom_prob kf_y_prob[INTRA_MODES][INTRA_MODES][INTRA_MODES - 1];
WarpedMotionParams global_motion[TOTAL_REFS_PER_FRAME];
BLOCK_SIZE sb_size; // Size of the superblock used for this frame
int mib_size; // Size of the superblock in units of MI blocks
int mib_size_log2; // Log 2 of above.
......
......@@ -59,8 +59,8 @@ static int token_to_value(FRAME_COUNTS *counts, aom_reader *const r, int token,
case CATEGORY5_TOKEN:
return CAT5_MIN_VAL + read_coeff(counts, av1_cat5_cdf, 5, r);
case CATEGORY6_TOKEN: {
const int skip_bits = (int)sizeof(av1_cat6_prob) -
av1_get_cat6_extrabits_size(tx_size, bit_depth);
const int skip_bits =
CAT6_BIT_SIZE - av1_get_cat6_extrabits_size(tx_size, bit_depth);
return CAT6_MIN_VAL + read_coeff(counts, av1_cat6_cdf, 18 - skip_bits, r);
}
default:
......
......@@ -437,10 +437,10 @@ static void pack_mb_tokens(aom_writer *w, const TOKENEXTRA **tp,
const int is_cat6 = (extra_bits->base_val == CAT6_MIN_VAL);
// be written excluding
// the sign bit.
int skip_bits = is_cat6
? (int)sizeof(av1_cat6_prob) -
av1_get_cat6_extrabits_size(tx_size, bit_depth)
: 0;
int skip_bits =
is_cat6
? CAT6_BIT_SIZE - av1_get_cat6_extrabits_size(tx_size, bit_depth)
: 0;
assert(!(bit_string >> (bit_string_length - skip_bits + 1)));
if (bit_string_length > 0)
......
......@@ -38,34 +38,6 @@ const uint16_t av1_prob_cost[256] = {
26, 23, 20, 18, 15, 12, 9, 6, 3
};
static void cost(int *costs, aom_tree tree, const aom_prob *probs, int i,
int c) {
const aom_prob prob = probs[i / 2];
int b;
assert(prob != 0);
for (b = 0; b <= 1; ++b) {
const int cc = c + av1_cost_bit(prob, b);
const aom_tree_index ii = tree[i + b];
if (ii <= 0)
costs[-ii] = cc;
else
cost(costs, tree, probs, ii, cc);
}
}
void av1_cost_tokens(int *costs, const aom_prob *probs, aom_tree tree) {
cost(costs, tree, probs, 0, 0);
}
void av1_cost_tokens_skip(int *costs, const aom_prob *probs, aom_tree tree) {
assert(tree[0] <= 0 && tree[1] > 0);
costs[-tree[0]] = av1_cost_bit(probs[0], 0);
cost(costs, tree, probs, 2, 0);
}
void av1_cost_tokens_from_cdf(int *costs, const aom_cdf_prob *cdf,
const int *inv_map) {
int i;
......
......@@ -42,27 +42,6 @@ static INLINE int av1_cost_symbol(aom_cdf_prob p15) {
av1_cost_literal(shift);
}
static INLINE unsigned int cost_branch256(const unsigned int ct[2],
aom_prob p) {
return ct[0] * av1_cost_zero(p) + ct[1] * av1_cost_one(p);
}
static INLINE int treed_cost(aom_tree tree, const aom_prob *probs, int bits,
int len) {
int cost = 0;
aom_tree_index i = 0;
do {
const int bit = (bits >> --len) & 1;
cost += av1_cost_bit(probs[i >> 1], bit);
i = tree[i + bit];
} while (len);
return cost;
}
void av1_cost_tokens(int *costs, const aom_prob *probs, aom_tree tree);
void av1_cost_tokens_skip(int *costs, const aom_prob *probs, aom_tree tree);
void av1_cost_tokens_from_cdf(int *costs, const aom_cdf_prob *cdf,
const int *inv_map);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment