Commit 07443f15 authored by Deb Mukherjee's avatar Deb Mukherjee
Browse files

Refinements on modelcoef expt to reduce storage

Uses more aggrerssive interpolation to reduce storage for the
model tables by almost more than half. Only 48 lists of probs are
stored (as opposed to 128 before), corresponding to ONE_NODE
probabilities of:
1,
3, 7, 11, ..., 115, 119,
127, 135, ..., 247, 255.

Besides, only 1 table is used as opposed to 2 before. So the overall
memory needed for the tables is just 48 * 8 = 384 bytes.

The table currently used is based on a new Pareto distribution with
heavier tail than a generalized Gaussian - which improves results on
derf by about 0.1% over a single table Generaized Gaussian.

Results overall on derfraw300 is -0.14%.

Change-Id: I19bd03559cbf5894a9f8594b8023dcc3e546f6bd
parent 39a90bc8
......@@ -380,17 +380,17 @@ DECLARE_ALIGNED(16, const int, vp9_default_zig_zag1d_32x32[1024]) = {
const vp9_tree_index vp9_coef_tree[ 22] = /* corresponding _CONTEXT_NODEs */
{
-DCT_EOB_TOKEN, 2, /* 0 = EOB */
-ZERO_TOKEN, 4, /* 1 = ZERO */
-ONE_TOKEN, 6, /* 2 = ONE */
8, 12, /* 3 = LOW_VAL */
-TWO_TOKEN, 10, /* 4 = TWO */
-DCT_EOB_TOKEN, 2, /* 0 = EOB */
-ZERO_TOKEN, 4, /* 1 = ZERO */
-ONE_TOKEN, 6, /* 2 = ONE */
8, 12, /* 3 = LOW_VAL */
-TWO_TOKEN, 10, /* 4 = TWO */
-THREE_TOKEN, -FOUR_TOKEN, /* 5 = THREE */
14, 16, /* 6 = HIGH_LOW */
14, 16, /* 6 = HIGH_LOW */
-DCT_VAL_CATEGORY1, -DCT_VAL_CATEGORY2, /* 7 = CAT_ONE */
18, 20, /* 8 = CAT_THREEFOUR */
-DCT_VAL_CATEGORY3, -DCT_VAL_CATEGORY4, /* 9 = CAT_THREE */
-DCT_VAL_CATEGORY5, -DCT_VAL_CATEGORY6 /* 10 = CAT_FIVE */
-DCT_VAL_CATEGORY3, -DCT_VAL_CATEGORY4, /* 9 = CAT_THREE */
-DCT_VAL_CATEGORY5, -DCT_VAL_CATEGORY6 /* 10 = CAT_FIVE */
};
struct vp9_token vp9_coef_encodings[MAX_ENTROPY_TOKENS];
......@@ -414,293 +414,103 @@ const vp9_tree_index vp9_coefmodel_tree[6] = {
-ONE_TOKEN, -TWO_TOKEN, /* 2 = ONE */
};
const vp9_prob vp9_modelcoefprobs_gg75p1[COEFPROB_MODELS][MODEL_NODES] = {
// Probs generated with a Generalized Gaussian (with shape parameter 0.75)
// source model with varying quantizer step size for a uniform quantizer
{ 3, 86, 129, 6, 87, 21, 90, 26,},
{ 9, 87, 130, 16, 89, 55, 96, 65,},
{ 14, 88, 130, 26, 90, 82, 101, 95,},
{ 20, 89, 131, 35, 92, 105, 105, 119,},
{ 25, 90, 132, 44, 93, 124, 110, 138,},
{ 30, 91, 132, 52, 95, 141, 114, 155,},
{ 35, 92, 133, 60, 96, 155, 118, 168,},
{ 40, 93, 134, 68, 97, 167, 123, 180,},
{ 44, 94, 134, 75, 99, 178, 127, 190,},
{ 49, 94, 135, 82, 100, 187, 131, 199,},
{ 54, 95, 135, 88, 101, 195, 135, 206,},
{ 58, 96, 136, 95, 102, 202, 138, 213,},
{ 63, 97, 137, 101, 104, 209, 142, 218,},
{ 67, 98, 137, 107, 105, 214, 146, 223,},
{ 71, 98, 138, 113, 106, 219, 150, 227,},
{ 76, 99, 138, 118, 107, 223, 153, 231,},
{ 80, 100, 139, 123, 109, 227, 157, 234,},
{ 84, 101, 140, 128, 110, 231, 160, 237,},
{ 88, 102, 140, 133, 111, 234, 164, 239,},
{ 92, 102, 141, 138, 112, 236, 167, 241,},
{ 95, 103, 141, 143, 114, 238, 170, 243,},
{ 99, 104, 142, 147, 115, 241, 173, 245,},
{ 103, 105, 142, 151, 116, 242, 176, 246,},
{ 107, 105, 143, 156, 117, 244, 180, 248,},
{ 110, 106, 144, 159, 119, 245, 182, 249,},
{ 114, 107, 144, 163, 120, 247, 185, 250,},
{ 117, 108, 145, 167, 121, 248, 188, 250,},
{ 121, 109, 145, 171, 123, 249, 191, 251,},
{ 124, 110, 146, 174, 124, 250, 194, 252,},
{ 127, 110, 147, 177, 125, 250, 196, 252,},
{ 130, 111, 147, 181, 127, 251, 199, 253,},
{ 134, 112, 148, 184, 128, 252, 201, 253,},
{ 137, 113, 148, 187, 129, 252, 204, 254,},
{ 140, 114, 149, 190, 130, 253, 206, 254,},
{ 143, 115, 150, 192, 132, 253, 208, 254,},
{ 146, 115, 150, 195, 133, 254, 210, 254,},
{ 149, 116, 151, 198, 134, 254, 212, 255,},
{ 152, 117, 151, 200, 136, 254, 214, 255,},
{ 154, 118, 152, 203, 137, 254, 216, 255,},
{ 157, 119, 153, 205, 139, 255, 218, 255,},
{ 160, 120, 153, 207, 140, 255, 220, 255,},
{ 163, 121, 154, 210, 141, 255, 222, 255,},
{ 165, 122, 154, 212, 143, 255, 223, 255,},
{ 168, 123, 155, 214, 144, 255, 225, 255,},
{ 170, 123, 156, 216, 145, 255, 227, 255,},
{ 173, 124, 156, 218, 147, 255, 228, 255,},
{ 175, 125, 157, 219, 148, 255, 230, 255,},
{ 178, 126, 158, 221, 150, 255, 231, 255,},
{ 180, 127, 158, 223, 151, 255, 232, 255,},
{ 182, 128, 159, 224, 152, 255, 234, 255,},
{ 184, 129, 160, 226, 154, 255, 235, 255,},
{ 187, 130, 160, 227, 155, 255, 236, 255,},
{ 189, 131, 161, 229, 157, 255, 237, 255,},
{ 191, 132, 162, 230, 158, 255, 238, 255,},
{ 193, 133, 163, 232, 159, 255, 239, 255,},
{ 195, 134, 163, 233, 161, 255, 240, 255,},
{ 197, 135, 164, 234, 162, 255, 241, 255,},
{ 199, 136, 165, 235, 164, 255, 242, 255,},
{ 201, 137, 165, 236, 165, 255, 243, 255,},
{ 203, 138, 166, 237, 167, 255, 244, 255,},
{ 205, 139, 167, 238, 168, 255, 244, 255,},
{ 206, 141, 168, 239, 170, 255, 245, 255,},
{ 208, 142, 168, 240, 171, 255, 246, 255,},
{ 210, 143, 169, 241, 173, 255, 246, 255,},
{ 212, 144, 170, 242, 174, 255, 247, 255,},
{ 213, 145, 171, 243, 176, 255, 248, 255,},
{ 215, 146, 171, 244, 177, 255, 248, 255,},
{ 216, 147, 172, 244, 179, 255, 249, 255,},
{ 218, 148, 173, 245, 180, 255, 249, 255,},
{ 220, 150, 174, 246, 181, 255, 250, 255,},
{ 221, 151, 175, 246, 183, 255, 250, 255,},
{ 222, 152, 175, 247, 184, 255, 251, 255,},
{ 224, 153, 176, 248, 186, 255, 251, 255,},
{ 225, 154, 177, 248, 187, 255, 251, 255,},
{ 226, 156, 178, 249, 189, 255, 252, 255,},
{ 228, 157, 179, 249, 190, 255, 252, 255,},
{ 229, 158, 180, 250, 192, 255, 252, 255,},
{ 230, 159, 181, 250, 193, 255, 253, 255,},
{ 231, 161, 181, 251, 195, 255, 253, 255,},
{ 233, 162, 182, 251, 196, 255, 253, 255,},
{ 234, 163, 183, 251, 198, 255, 253, 255,},
{ 235, 165, 184, 252, 199, 255, 254, 255,},
{ 236, 166, 185, 252, 201, 255, 254, 255,},
{ 237, 167, 186, 252, 202, 255, 254, 255,},
{ 238, 169, 187, 253, 204, 255, 254, 255,},
{ 239, 170, 188, 253, 205, 255, 254, 255,},
{ 240, 172, 189, 253, 207, 255, 255, 255,},
{ 241, 173, 190, 253, 208, 255, 255, 255,},
{ 242, 175, 191, 254, 210, 255, 255, 255,},
{ 242, 176, 192, 254, 211, 255, 255, 255,},
{ 243, 177, 193, 254, 213, 255, 255, 255,},
{ 244, 179, 194, 254, 214, 255, 255, 255,},
{ 245, 181, 195, 254, 216, 255, 255, 255,},
{ 245, 182, 196, 255, 217, 255, 255, 255,},
{ 246, 184, 197, 255, 218, 255, 255, 255,},
{ 247, 185, 199, 255, 220, 255, 255, 255,},
{ 247, 187, 200, 255, 221, 255, 255, 255,},
{ 248, 188, 201, 255, 223, 255, 255, 255,},
{ 249, 190, 202, 255, 224, 255, 255, 255,},
{ 249, 192, 203, 255, 225, 255, 255, 255,},
{ 250, 193, 205, 255, 227, 255, 255, 255,},
{ 250, 195, 206, 255, 228, 255, 255, 255,},
{ 251, 197, 207, 255, 229, 255, 255, 255,},
{ 251, 199, 208, 255, 231, 255, 255, 255,},
{ 252, 201, 210, 255, 232, 255, 255, 255,},
{ 252, 202, 211, 255, 233, 255, 255, 255,},
{ 252, 204, 212, 255, 235, 255, 255, 255,},
{ 253, 206, 214, 255, 236, 255, 255, 255,},
{ 253, 208, 215, 255, 237, 255, 255, 255,},
{ 254, 210, 217, 255, 238, 255, 255, 255,},
{ 254, 212, 218, 255, 240, 255, 255, 255,},
{ 254, 214, 220, 255, 241, 255, 255, 255,},
{ 254, 216, 221, 255, 242, 255, 255, 255,},
{ 255, 218, 223, 255, 243, 255, 255, 255,},
{ 255, 220, 225, 255, 244, 255, 255, 255,},
{ 255, 222, 226, 255, 245, 255, 255, 255,},
{ 255, 224, 228, 255, 247, 255, 255, 255,},
{ 255, 227, 230, 255, 248, 255, 255, 255,},
{ 255, 229, 232, 255, 249, 255, 255, 255,},
{ 255, 231, 234, 255, 250, 255, 255, 255,},
{ 255, 234, 236, 255, 251, 255, 255, 255,},
{ 255, 236, 238, 255, 252, 255, 255, 255,},
{ 255, 239, 240, 255, 252, 255, 255, 255,},
{ 255, 241, 242, 255, 253, 255, 255, 255,},
{ 255, 244, 245, 255, 254, 255, 255, 255,},
{ 255, 247, 247, 255, 255, 255, 255, 255,},
{ 255, 250, 250, 255, 255, 255, 255, 255,},
{ 255, 254, 254, 255, 255, 255, 255, 255,},
};
const vp9_prob vp9_modelcoefprobs_gg625p1[COEFPROB_MODELS][MODEL_NODES] = {
// Probs generated with a Generalized Gaussian (with shape parameter 0.625)
// source model with varying quantizer step size for a uniform quantizer
{ 3, 87, 129, 6, 87, 20, 91, 24,},
{ 8, 88, 130, 15, 90, 50, 97, 56,},
{ 14, 90, 131, 24, 91, 74, 102, 81,},
{ 19, 91, 132, 33, 93, 93, 106, 101,},
{ 24, 92, 133, 40, 94, 110, 110, 118,},
{ 29, 93, 134, 48, 96, 125, 113, 132,},
{ 33, 93, 134, 55, 97, 138, 117, 145,},
{ 38, 94, 135, 62, 98, 149, 120, 155,},
{ 42, 95, 136, 68, 99, 159, 124, 165,},
{ 47, 96, 136, 74, 100, 168, 127, 174,},
{ 51, 97, 137, 80, 102, 176, 130, 181,},
{ 55, 98, 137, 86, 103, 184, 133, 188,},
{ 59, 98, 138, 91, 104, 190, 136, 194,},
{ 64, 99, 139, 97, 105, 196, 139, 200,},
{ 68, 100, 139, 102, 106, 201, 142, 205,},
{ 71, 101, 140, 107, 107, 206, 145, 209,},
{ 75, 102, 140, 112, 108, 211, 148, 213,},
{ 79, 102, 141, 116, 109, 215, 150, 217,},
{ 83, 103, 141, 121, 110, 218, 153, 220,},
{ 87, 104, 142, 125, 112, 222, 156, 224,},
{ 90, 105, 143, 129, 113, 225, 159, 226,},
{ 94, 105, 143, 133, 114, 227, 161, 229,},
{ 97, 106, 144, 137, 115, 230, 164, 231,},
{ 101, 107, 144, 141, 116, 232, 166, 233,},
{ 104, 108, 145, 145, 117, 234, 169, 235,},
{ 107, 108, 145, 149, 118, 236, 171, 237,},
{ 111, 109, 146, 152, 119, 238, 174, 239,},
{ 114, 110, 146, 156, 120, 240, 176, 240,},
{ 117, 111, 147, 159, 121, 241, 178, 242,},
{ 120, 112, 148, 162, 122, 242, 181, 243,},
{ 123, 112, 148, 165, 124, 244, 183, 244,},
{ 126, 113, 149, 168, 125, 245, 185, 245,},
{ 129, 114, 149, 171, 126, 246, 187, 246,},
{ 132, 115, 150, 174, 127, 247, 189, 247,},
{ 135, 116, 150, 177, 128, 248, 192, 248,},
{ 138, 116, 151, 180, 129, 248, 194, 249,},
{ 141, 117, 152, 183, 130, 249, 196, 249,},
{ 143, 118, 152, 185, 131, 250, 198, 250,},
{ 146, 119, 153, 188, 132, 250, 200, 250,},
{ 149, 120, 153, 190, 134, 251, 201, 251,},
{ 151, 120, 154, 192, 135, 251, 203, 251,},
{ 154, 121, 155, 195, 136, 252, 205, 252,},
{ 157, 122, 155, 197, 137, 252, 207, 252,},
{ 159, 123, 156, 199, 138, 253, 209, 253,},
{ 162, 124, 156, 201, 139, 253, 210, 253,},
{ 164, 125, 157, 203, 140, 253, 212, 253,},
{ 166, 126, 158, 205, 142, 254, 214, 253,},
{ 169, 126, 158, 207, 143, 254, 215, 254,},
{ 171, 127, 159, 209, 144, 254, 217, 254,},
{ 173, 128, 159, 211, 145, 254, 218, 254,},
{ 176, 129, 160, 213, 146, 254, 220, 254,},
{ 178, 130, 161, 214, 148, 255, 221, 255,},
{ 180, 131, 161, 216, 149, 255, 223, 255,},
{ 182, 132, 162, 218, 150, 255, 224, 255,},
{ 184, 133, 163, 219, 151, 255, 225, 255,},
{ 186, 134, 163, 221, 152, 255, 226, 255,},
{ 188, 135, 164, 222, 154, 255, 228, 255,},
{ 190, 136, 165, 224, 155, 255, 229, 255,},
{ 192, 137, 165, 225, 156, 255, 230, 255,},
{ 194, 137, 166, 226, 157, 255, 231, 255,},
{ 196, 138, 167, 228, 159, 255, 232, 255,},
{ 198, 139, 167, 229, 160, 255, 233, 255,},
{ 200, 140, 168, 230, 161, 255, 234, 255,},
{ 202, 141, 169, 231, 163, 255, 235, 255,},
{ 203, 142, 169, 233, 164, 255, 236, 255,},
{ 205, 143, 170, 234, 165, 255, 237, 255,},
{ 207, 145, 171, 235, 166, 255, 238, 255,},
{ 209, 146, 171, 236, 168, 255, 239, 255,},
{ 210, 147, 172, 237, 169, 255, 240, 255,},
{ 212, 148, 173, 238, 170, 255, 241, 255,},
{ 213, 149, 174, 239, 172, 255, 242, 255,},
{ 215, 150, 174, 240, 173, 255, 242, 255,},
{ 216, 151, 175, 240, 174, 255, 243, 255,},
{ 218, 152, 176, 241, 176, 255, 244, 255,},
{ 219, 153, 177, 242, 177, 255, 244, 255,},
{ 221, 154, 178, 243, 178, 255, 245, 255,},
{ 222, 156, 178, 244, 180, 255, 246, 255,},
{ 223, 157, 179, 244, 181, 255, 246, 255,},
{ 225, 158, 180, 245, 183, 255, 247, 255,},
{ 226, 159, 181, 246, 184, 255, 247, 255,},
{ 227, 160, 182, 246, 185, 255, 248, 255,},
{ 229, 162, 183, 247, 187, 255, 248, 255,},
{ 230, 163, 183, 247, 188, 255, 249, 255,},
{ 231, 164, 184, 248, 190, 255, 249, 255,},
{ 232, 165, 185, 248, 191, 255, 250, 255,},
{ 233, 167, 186, 249, 192, 255, 250, 255,},
{ 234, 168, 187, 249, 194, 255, 251, 255,},
{ 235, 169, 188, 250, 195, 255, 251, 255,},
{ 236, 171, 189, 250, 197, 255, 251, 255,},
{ 237, 172, 190, 251, 198, 255, 252, 255,},
{ 238, 173, 191, 251, 200, 255, 252, 255,},
{ 239, 175, 192, 251, 201, 255, 252, 255,},
{ 240, 176, 193, 252, 203, 255, 253, 255,},
{ 241, 178, 194, 252, 204, 255, 253, 255,},
{ 242, 179, 195, 252, 206, 255, 253, 255,},
{ 243, 181, 196, 253, 207, 255, 253, 255,},
{ 244, 182, 197, 253, 209, 255, 254, 255,},
{ 244, 184, 198, 253, 210, 255, 254, 255,},
{ 245, 185, 199, 254, 212, 255, 254, 255,},
{ 246, 187, 200, 254, 213, 255, 254, 255,},
{ 247, 189, 201, 254, 215, 255, 254, 255,},
{ 247, 190, 203, 254, 216, 255, 255, 255,},
{ 248, 192, 204, 254, 218, 255, 255, 255,},
{ 249, 194, 205, 255, 219, 255, 255, 255,},
{ 249, 195, 206, 255, 221, 255, 255, 255,},
{ 250, 197, 208, 255, 222, 255, 255, 255,},
{ 250, 199, 209, 255, 224, 255, 255, 255,},
{ 251, 201, 210, 255, 225, 255, 255, 255,},
{ 251, 203, 212, 255, 227, 255, 255, 255,},
{ 252, 205, 213, 255, 228, 255, 255, 255,},
{ 252, 207, 215, 255, 230, 255, 255, 255,},
{ 253, 209, 216, 255, 231, 255, 255, 255,},
{ 253, 211, 218, 255, 233, 255, 255, 255,},
{ 253, 213, 219, 255, 234, 255, 255, 255,},
{ 254, 215, 221, 255, 236, 255, 255, 255,},
{ 254, 217, 223, 255, 238, 255, 255, 255,},
{ 254, 219, 224, 255, 239, 255, 255, 255,},
{ 255, 222, 226, 255, 241, 255, 255, 255,},
{ 255, 224, 228, 255, 242, 255, 255, 255,},
{ 255, 227, 230, 255, 244, 255, 255, 255,},
{ 255, 229, 232, 255, 245, 255, 255, 255,},
{ 255, 232, 234, 255, 247, 255, 255, 255,},
{ 255, 235, 237, 255, 248, 255, 255, 255,},
{ 255, 238, 239, 255, 250, 255, 255, 255,},
{ 255, 241, 242, 255, 251, 255, 255, 255,},
{ 255, 244, 245, 255, 253, 255, 255, 255,},
{ 255, 248, 248, 255, 254, 255, 255, 255,},
{ 255, 253, 253, 255, 255, 255, 255, 255,},
// Model obtained from a 2-sided zero-centerd distribuition 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.
const vp9_prob vp9_modelcoefprobs_pareto8[COEFPROB_MODELS][MODEL_NODES] = {
{ 3, 86, 128, 6, 86, 23, 88, 29},
{ 9, 86, 129, 17, 88, 61, 94, 76},
{ 20, 88, 130, 38, 91, 118, 106, 136},
{ 31, 90, 131, 58, 94, 156, 117, 171},
{ 42, 91, 132, 75, 97, 183, 127, 194},
{ 52, 93, 133, 90, 100, 201, 137, 208},
{ 62, 94, 135, 105, 103, 214, 146, 218},
{ 71, 96, 136, 117, 106, 224, 155, 225},
{ 80, 98, 137, 129, 109, 231, 162, 231},
{ 89, 99, 138, 140, 112, 236, 170, 235},
{ 97, 101, 140, 149, 115, 240, 176, 238},
{ 105, 103, 141, 158, 118, 243, 182, 240},
{ 113, 104, 142, 166, 120, 245, 187, 242},
{ 120, 106, 143, 173, 123, 247, 192, 244},
{ 127, 108, 145, 180, 126, 249, 197, 245},
{ 134, 110, 146, 186, 129, 250, 201, 246},
{ 140, 112, 147, 192, 132, 251, 205, 247},
{ 146, 114, 149, 197, 135, 252, 208, 248},
{ 152, 115, 150, 201, 138, 252, 211, 248},
{ 158, 117, 151, 206, 140, 253, 214, 249},
{ 163, 119, 153, 210, 143, 253, 217, 249},
{ 168, 121, 154, 213, 146, 254, 220, 250},
{ 173, 123, 155, 217, 148, 254, 222, 250},
{ 178, 125, 157, 220, 151, 254, 224, 251},
{ 183, 127, 158, 222, 153, 254, 226, 251},
{ 187, 129, 160, 225, 156, 255, 228, 251},
{ 191, 132, 161, 227, 159, 255, 229, 251},
{ 195, 134, 163, 230, 161, 255, 231, 252},
{ 199, 136, 164, 232, 163, 255, 232, 252},
{ 202, 138, 166, 233, 166, 255, 233, 252},
{ 206, 140, 167, 235, 168, 255, 235, 252},
{ 212, 145, 170, 238, 173, 255, 237, 252},
{ 218, 149, 173, 241, 177, 255, 239, 253},
{ 223, 154, 177, 243, 182, 255, 240, 253},
{ 228, 159, 180, 245, 186, 255, 242, 253},
{ 232, 164, 184, 247, 190, 255, 243, 253},
{ 236, 169, 187, 248, 194, 255, 244, 253},
{ 239, 174, 191, 249, 198, 255, 245, 254},
{ 242, 179, 195, 250, 202, 255, 246, 254},
{ 244, 185, 199, 251, 206, 255, 247, 254},
{ 247, 191, 203, 252, 209, 255, 248, 254},
{ 249, 197, 207, 253, 213, 255, 249, 254},
{ 250, 203, 212, 253, 216, 255, 249, 254},
{ 252, 209, 217, 254, 220, 255, 250, 254},
{ 253, 216, 222, 254, 224, 255, 251, 254},
{ 254, 224, 228, 255, 227, 255, 251, 254},
{ 255, 232, 235, 255, 232, 255, 252, 254},
{ 255, 246, 247, 255, 239, 255, 253, 255}
};
void vp9_get_model_distribution(vp9_prob p, vp9_prob *tree_probs,
int b, int r) {
const vp9_prob (*model)[MODEL_NODES];
if (r != INTRA_FRAME && b == PLANE_TYPE_UV)
model = vp9_modelcoefprobs_gg75p1;
else if (r == INTRA_FRAME && b == PLANE_TYPE_UV)
model = vp9_modelcoefprobs_gg75p1;
else if (r != INTRA_FRAME && b == PLANE_TYPE_Y_WITH_DC)
model = vp9_modelcoefprobs_gg75p1;
else
model = vp9_modelcoefprobs_gg625p1;
if (p & 1) { // odd
model = vp9_modelcoefprobs_pareto8;
if (p == 1) {
vpx_memcpy(tree_probs + UNCONSTRAINED_NODES,
model[(p - 1) / 2],
(ENTROPY_NODES - UNCONSTRAINED_NODES) * sizeof(vp9_prob));
} else {
model[2], MODEL_NODES * sizeof(vp9_prob));
} else if (p == 2) {
// interpolate
int i;
for (i = UNCONSTRAINED_NODES; i < ENTROPY_NODES; ++i)
tree_probs[i] = (model[p / 2 - 1][i - UNCONSTRAINED_NODES] +
model[p / 2][i - UNCONSTRAINED_NODES]) >> 1;
tree_probs[i] = (model[0][i - UNCONSTRAINED_NODES] +
model[1][i - UNCONSTRAINED_NODES]) >> 1;
} else if (p < 119) {
// interpolate
int i, k, l;
k = (p - 3) & 3;
l = ((p - 3) >> 2) + 1;
if (k) {
for (i = UNCONSTRAINED_NODES; i < ENTROPY_NODES; ++i)
tree_probs[i] = (model[l][i - UNCONSTRAINED_NODES] * (4 - k) +
model[l + 1][i - UNCONSTRAINED_NODES] * k + 1) >> 2;
} else {
vpx_memcpy(tree_probs + UNCONSTRAINED_NODES,
model[l], MODEL_NODES * sizeof(vp9_prob));
}
} else {
// interpolate
int i, k, l;
k = (p - 119) & 7;
l = ((p - 119) >> 3) + 30;
if (k) {
for (i = UNCONSTRAINED_NODES; i < ENTROPY_NODES; ++i)
tree_probs[i] = (model[l][i - UNCONSTRAINED_NODES] * (8 - k) +
model[l + 1][i - UNCONSTRAINED_NODES] * k + 3) >> 3;
} else {
vpx_memcpy(tree_probs + UNCONSTRAINED_NODES,
model[l], MODEL_NODES * sizeof(vp9_prob));
}
}
}
......
......@@ -157,7 +157,14 @@ extern int vp9_get_coef_context(const int *scan, const int *neighbors,
const int *vp9_get_coef_neighbors_handle(const int *scan, int *pad);
#if CONFIG_MODELCOEFPROB
#define COEFPROB_MODELS 128 // 128 lists stored for probs 1, 3, ..., 255
// 48 lists of probabilities are stored for the following ONE node probs:
// 1, (count 1)
// 3, 7, 11, 15, ..., 115, 119, (count 30)
// 127, 135, 143, ..., 247, 255 (count 17)
// In between probabilities are interpolated linearly
#define COEFPROB_MODELS 48
#define UNCONSTRAINED_NODES 3
#define MODEL_NODES (ENTROPY_NODES - UNCONSTRAINED_NODES)
......
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