Commit 074a38b1 authored by Yaowu Xu's avatar Yaowu Xu

changed to use a fixed number for update probabity

This commit is to remove two arrays, which contain the probabilities
of how likely each probability in coef_probs table is updated. The
commit changed to use a fixed number "252".

Surprisedly, the overall impact on quality is close to zero, which
basically says the two big static arrays are not helpful at all.
derf: -0.016%, -0.020%
std-hd: 0.000%, -0.013%
yt: -0.022%, +0.007%
yt-hd: -0.038%, +0.034%

Change-Id: Ifee94d28a37dcab4f1d2b994bd5b07575be42b72
parent bb25083d
This diff is collapsed.
......@@ -512,128 +512,128 @@ vp8_default_coef_probs_8x8[BLOCK_TYPES_8X8]
{
{ /* block Type 0 */
{ /* Coeff Band 0 */
{ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128},
{ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128},
{ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128}
{ 128, 191, 223, 239, 247, 251, 253, 254, 254, 254, 254},
{ 128, 191, 223, 239, 247, 251, 253, 254, 254, 254, 254},
{ 128, 191, 223, 239, 247, 251, 253, 254, 254, 254, 254}
},
{ /* Coeff Band 1 */
{ 60, 140, 195, 255, 212, 214, 128, 128, 128, 128, 128},
{ 75, 221, 231, 255, 203, 255, 128, 128, 128, 128, 128},
{ 9, 212, 196, 251, 197, 207, 255, 185, 128, 128, 128}
{ 60, 140, 195, 255, 212, 214, 234, 244, 249, 252, 253},
{ 75, 221, 231, 255, 203, 255, 255, 255, 255, 255, 255},
{ 9, 212, 196, 251, 197, 207, 255, 185, 220, 237, 246}
},
{ /* Coeff Band 2 */
{ 1, 227, 226, 255, 215, 215, 128, 128, 128, 128, 128},
{ 5, 163, 209, 255, 212, 212, 255, 255, 128, 128, 128},
{ 1, 133, 203, 255, 210, 220, 255, 255, 128, 128, 128}
{ 1, 227, 226, 255, 215, 215, 235, 245, 250, 252, 253},
{ 5, 163, 209, 255, 212, 212, 255, 255, 255, 255, 255},
{ 1, 133, 203, 255, 210, 220, 255, 255, 255, 255, 255}
},
{ /* Coeff Band 3 */
{ 1, 226, 225, 255, 228, 236, 128, 128, 128, 128, 128},
{ 6, 163, 208, 255, 224, 234, 255, 255, 128, 128, 128},
{ 1, 122, 196, 253, 212, 248, 255, 255, 128, 128, 128}
{ 1, 226, 225, 255, 228, 237, 246, 250, 252, 253, 254},
{ 6, 163, 208, 255, 224, 234, 255, 255, 255, 255, 255},
{ 1, 122, 196, 253, 212, 248, 255, 255, 255, 255, 255}
},
{ /* Coeff Band 4 */
{ 1, 222, 197, 254, 193, 216, 255, 236, 128, 128, 128},
{ 7, 140, 163, 251, 195, 211, 255, 238, 128, 128, 128},
{ 1, 91, 152, 249, 181, 197, 255, 239, 128, 128, 128}
{ 1, 222, 198, 254, 193, 216, 255, 242, 248, 251, 253},
{ 7, 140, 163, 251, 195, 211, 255, 238, 246, 250, 252},
{ 1, 91, 152, 249, 181, 197, 255, 239, 247, 251, 253}
},
{ /* Coeff Band 5 */
{ 1, 226, 218, 255, 216, 241, 255, 255, 128, 128, 128},
{ 6, 154, 191, 255, 218, 240, 255, 255, 128, 128, 128},
{ 1, 111, 184, 255, 210, 225, 255, 255, 128, 128, 128}
{ 1, 226, 218, 255, 216, 242, 255, 255, 255, 255, 255},
{ 6, 154, 191, 255, 218, 240, 255, 255, 255, 255, 255},
{ 1, 111, 184, 255, 210, 225, 255, 255, 255, 255, 255}
},
{ /* Coeff Band 6 */
{ 1, 221, 217, 255, 208, 217, 255, 232, 128, 128, 128},
{ 11, 155, 189, 254, 203, 211, 255, 249, 128, 128, 128},
{ 1, 110, 171, 252, 191, 204, 255, 236, 128, 128, 128}
{ 1, 221, 217, 255, 208, 217, 255, 255, 255, 255, 255},
{ 11, 155, 189, 254, 203, 211, 255, 249, 252, 253, 254},
{ 1, 110, 171, 252, 191, 204, 255, 237, 246, 250, 252}
},
{ /* Coeff Band 7 */
{ 1, 207, 235, 255, 232, 240, 128, 128, 128, 128, 128},
{ 58, 161, 216, 255, 229, 235, 255, 255, 128, 128, 128},
{ 8, 133, 204, 255, 219, 231, 255, 255, 128, 128, 128}
{ 1, 207, 235, 255, 232, 241, 248, 251, 253, 254, 254},
{ 58, 161, 216, 255, 230, 235, 255, 255, 255, 255, 255},
{ 8, 133, 204, 255, 219, 231, 255, 255, 255, 255, 255}
}
},
{ /* block Type 1 */
{ /* Coeff Band 0 */
{ 134, 152, 233, 224, 234, 52, 255, 166, 128, 128, 128},
{ 97, 132, 185, 234, 186, 189, 197, 171, 255, 212, 128},
{ 84, 110, 185, 237, 182, 182, 145, 145, 255, 255, 128}
{ 134, 152, 233, 224, 234, 52, 255, 166, 210, 232, 243},
{ 97, 132, 185, 234, 186, 189, 197, 171, 255, 212, 233},
{ 84, 110, 185, 237, 182, 182, 145, 145, 255, 255, 255}
},
{ /* Coeff Band 1 */
{ 1, 124, 213, 247, 192, 212, 255, 255, 128, 128, 128},
{ 88, 111, 178, 254, 189, 211, 255, 255, 128, 128, 128},
{ 12, 59, 129, 236, 150, 179, 239, 195, 255, 255, 128}
{ 1, 124, 213, 247, 192, 212, 255, 255, 255, 255, 255},
{ 88, 111, 178, 254, 189, 211, 255, 255, 255, 255, 255},
{ 12, 59, 129, 236, 150, 179, 239, 195, 255, 255, 255}
},
{ /* Coeff Band 2 */
{ 1, 102, 225, 255, 210, 240, 128, 128, 128, 128, 128},
{ 110, 78, 195, 254, 200, 191, 255, 255, 128, 128, 128},
{ 37, 63, 177, 255, 194, 195, 128, 128, 128, 128, 128}
{ 1, 102, 225, 255, 210, 240, 247, 251, 253, 254, 254},
{ 110, 78, 195, 254, 200, 191, 255, 255, 255, 255, 255},
{ 37, 63, 177, 255, 194, 195, 225, 240, 247, 251, 253}
},
{ /* Coeff Band 3 */
{ 1, 1, 229, 255, 202, 224, 128, 128, 128, 128, 128},
{ 150, 1, 192, 255, 206, 226, 128, 128, 128, 128, 128},
{ 75, 1, 138, 255, 172, 228, 128, 128, 128, 128, 128}
{ 1, 1, 229, 255, 202, 224, 239, 247, 251, 253, 254},
{ 150, 1, 192, 255, 206, 226, 240, 247, 251, 253, 254},
{ 75, 1, 138, 255, 172, 228, 241, 248, 251, 253, 254}
},
{ /* Coeff Band 4 */
{ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128},
{ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128},
{ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128}
{ 128, 191, 223, 239, 247, 251, 253, 254, 254, 254, 254},
{ 128, 191, 223, 239, 247, 251, 253, 254, 254, 254, 254},
{ 128, 191, 223, 239, 247, 251, 253, 254, 254, 254, 254}
},
{ /* Coeff Band 5 */
{ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128},
{ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128},
{ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128}
{ 128, 191, 223, 239, 247, 251, 253, 254, 254, 254, 254},
{ 128, 191, 223, 239, 247, 251, 253, 254, 254, 254, 254},
{ 128, 191, 223, 239, 247, 251, 253, 254, 254, 254, 254}
},
{ /* Coeff Band 6 */
{ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128},
{ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128},
{ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128}
{ 128, 191, 223, 239, 247, 251, 253, 254, 254, 254, 254},
{ 128, 191, 223, 239, 247, 251, 253, 254, 254, 254, 254},
{ 128, 191, 223, 239, 247, 251, 253, 254, 254, 254, 254}
},
{ /* Coeff Band 7 */
{ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128},
{ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128},
{ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128}
{ 128, 191, 223, 239, 247, 251, 253, 254, 254, 254, 254},
{ 128, 191, 223, 239, 247, 251, 253, 254, 254, 254, 254},
{ 128, 191, 223, 239, 247, 251, 253, 254, 254, 254, 254}
}
},
{ /* block Type 2 */
{ /* Coeff Band 0 */
{ 11, 181, 226, 199, 183, 255, 255, 255, 128, 128, 128},
{ 2, 147, 185, 248, 163, 180, 255, 236, 128, 128, 128},
{ 1, 123, 157, 238, 154, 176, 255, 226, 255, 255, 128}
{ 11, 181, 226, 199, 183, 255, 255, 255, 255, 255, 255},
{ 2, 147, 185, 248, 163, 180, 255, 236, 245, 250, 252},
{ 1, 123, 157, 238, 154, 176, 255, 226, 255, 255, 255}
},
{ /* Coeff Band 1 */
{ 1, 150, 191, 246, 174, 188, 255, 235, 128, 128, 128},
{ 1, 125, 166, 245, 165, 185, 255, 234, 128, 128, 128},
{ 1, 79, 125, 240, 148, 179, 255, 234, 255, 255, 128}
{ 1, 150, 191, 246, 174, 188, 255, 235, 245, 250, 252},
{ 1, 125, 166, 245, 165, 185, 255, 234, 244, 249, 252},
{ 1, 79, 125, 240, 148, 179, 255, 234, 255, 255, 255}
},
{ /* Coeff Band 2 */
{ 1, 146, 184, 242, 167, 183, 255, 230, 255, 255, 128},
{ 1, 119, 160, 239, 156, 178, 255, 231, 255, 255, 128},
{ 1, 75, 115, 234, 142, 173, 255, 225, 255, 255, 128}
{ 1, 146, 184, 242, 167, 183, 255, 231, 243, 249, 252},
{ 1, 119, 160, 239, 156, 178, 255, 231, 255, 255, 255},
{ 1, 75, 115, 234, 142, 173, 255, 225, 255, 255, 255}
},
{ /* Coeff Band 3 */
{ 1, 150, 188, 244, 169, 183, 255, 233, 255, 255, 128},
{ 1, 123, 162, 243, 161, 180, 255, 233, 128, 128, 128},
{ 1, 76, 120, 238, 148, 178, 255, 230, 255, 255, 128}
{ 1, 150, 189, 244, 169, 183, 255, 234, 244, 249, 252},
{ 1, 123, 162, 243, 161, 180, 255, 233, 244, 249, 252},
{ 1, 76, 120, 238, 148, 178, 255, 230, 255, 255, 255}
},
{ /* Coeff Band 4 */
{ 1, 163, 202, 252, 188, 204, 255, 248, 128, 128, 128},
{ 1, 136, 180, 251, 181, 201, 255, 246, 128, 128, 128},
{ 1, 92, 146, 249, 170, 197, 255, 245, 128, 128, 128}
{ 1, 163, 202, 252, 188, 204, 255, 249, 252, 253, 254},
{ 1, 136, 180, 251, 181, 201, 255, 247, 251, 253, 254},
{ 1, 92, 146, 249, 170, 197, 255, 246, 250, 252, 253}
},
{ /* Coeff Band 5 */
{ 1, 156, 195, 249, 179, 193, 255, 241, 255, 255, 128},
{ 1, 128, 169, 248, 171, 192, 255, 242, 255, 255, 128},
{ 1, 84, 132, 245, 158, 187, 255, 240, 255, 255, 128}
{ 1, 156, 195, 249, 179, 193, 255, 242, 248, 251, 253},
{ 1, 128, 169, 248, 171, 192, 255, 242, 248, 251, 253},
{ 1, 84, 132, 245, 158, 187, 255, 240, 247, 251, 253}
},
{ /* Coeff Band 6 */
{ 1, 36, 71, 251, 192, 201, 255, 243, 255, 255, 128},
{ 1, 49, 185, 250, 184, 199, 255, 242, 128, 128, 128},
{ 1, 95, 147, 247, 168, 190, 255, 239, 255, 255, 128}
{ 1, 172, 209, 251, 192, 201, 255, 243, 249, 252, 253},
{ 1, 143, 185, 250, 184, 199, 255, 242, 248, 251, 253},
{ 1, 95, 147, 247, 168, 190, 255, 240, 247, 251, 253}
},
{ /* Coeff Band 7 */
{ 1, 19, 98, 255, 218, 222, 255, 255, 128, 128, 128},
{ 36, 50, 210, 255, 212, 221, 255, 255, 128, 128, 128},
{ 6, 117, 180, 254, 199, 216, 255, 251, 128, 128, 128}
{ 1, 178, 229, 255, 218, 223, 255, 255, 255, 255, 255},
{ 36, 155, 210, 255, 212, 221, 255, 255, 255, 255, 255},
{ 6, 117, 180, 254, 199, 216, 255, 252, 253, 254, 254}
}
}
};
......
......@@ -15,6 +15,7 @@
#include "treecoder.h"
#include "blockd.h"
#include "common.h"
#include "coefupdateprobs.h"
/* Coefficient token alphabet */
#define ZERO_TOKEN 0 /* 0 Extra Bits 0+0 */
......@@ -99,9 +100,6 @@ extern DECLARE_ALIGNED(64, const unsigned char, vp8_coef_bands_8x8[64]);
extern DECLARE_ALIGNED(16, const unsigned char, vp8_prev_token_class[MAX_ENTROPY_TOKENS]);
extern const vp8_prob vp8_coef_update_probs [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
extern const vp8_prob vp8_coef_update_probs_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
struct VP8Common;
void vp8_default_coef_probs(struct VP8Common *);
extern DECLARE_ALIGNED(16, const int, vp8_default_zig_zag1d[16]);
......
......@@ -832,7 +832,7 @@ static void read_coef_probs3(VP8D_COMP *pbi)
#endif
{
vp8_prob *const p = pc->fc.coef_probs [i][j][k] + l;
int u = vp8_read(bc, vp8_coef_update_probs [i][j][k][l]);
int u = vp8_read(bc, COEF_UPDATE_PROB);
if (u) *p = read_prob_diff_update(bc, *p);
}
}
......@@ -856,7 +856,7 @@ static void read_coef_probs3(VP8D_COMP *pbi)
#endif
{
vp8_prob *const p = pc->fc.coef_probs_8x8 [i][j][k] + l;
int u = vp8_read(bc, vp8_coef_update_probs_8x8 [i][j][k][l]);
int u = vp8_read(bc, COEF_UPDATE_PROB_8X8);
if (u) *p = read_prob_diff_update(bc, *p);
}
}
......@@ -887,7 +887,7 @@ static void read_coef_probs2(VP8D_COMP *pbi)
#endif
{
vp8_prob *const p = pc->fc.coef_probs [i][j][k] + l;
int u = vp8_read(bc, vp8_coef_update_probs [i][j][k][l]);
int u = vp8_read(bc, COEF_UPDATE_PROB);
if (u) *p = read_prob_diff_update(bc, *p);
}
}
......@@ -911,7 +911,7 @@ static void read_coef_probs2(VP8D_COMP *pbi)
{
vp8_prob *const p = pc->fc.coef_probs_8x8 [i][j][k] + l;
int u = vp8_read(bc, vp8_coef_update_probs_8x8 [i][j][k][l]);
int u = vp8_read(bc, COEF_UPDATE_PROB_8X8);
if (u) *p = read_prob_diff_update(bc, *p);
}
}
......@@ -948,7 +948,7 @@ static void read_coef_probs(VP8D_COMP *pbi)
{
vp8_prob *const p = pc->fc.coef_probs [i][j][k] + l;
if (vp8_read(bc, vp8_coef_update_probs [i][j][k][l]))
if (vp8_read(bc, COEF_UPDATE_PROB))
{
#if CONFIG_NEWUPDATE
*p = read_prob_diff_update(bc, *p);
......@@ -982,7 +982,7 @@ static void read_coef_probs(VP8D_COMP *pbi)
vp8_prob *const p = pc->fc.coef_probs_8x8 [i][j][k] + l;
if (vp8_read(bc, vp8_coef_update_probs_8x8 [i][j][k][l]))
if (vp8_read(bc, COEF_UPDATE_PROB_8X8))
{
#if CONFIG_NEWUPDATE
*p = read_prob_diff_update(bc, *p);
......
......@@ -1509,7 +1509,7 @@ static void update_coef_probs3(VP8_COMP *cpi)
{
vp8_prob newp = cpi->frame_coef_probs [i][j][k][t];
vp8_prob *Pold = cpi->common.fc.coef_probs [i][j][k] + t;
const vp8_prob upd = vp8_coef_update_probs [i][j][k][t];
const vp8_prob upd = COEF_UPDATE_PROB;
int s;
int u = 0;
#if CONFIG_EXPANDED_COEF_CONTEXT
......@@ -1548,7 +1548,7 @@ static void update_coef_probs3(VP8_COMP *cpi)
{
vp8_prob newp = cpi->frame_coef_probs [i][j][k][t];
vp8_prob *Pold = cpi->common.fc.coef_probs [i][j][k] + t;
const vp8_prob upd = vp8_coef_update_probs [i][j][k][t];
const vp8_prob upd = COEF_UPDATE_PROB;
int s;
int u = 0;
......@@ -1597,7 +1597,7 @@ static void update_coef_probs3(VP8_COMP *cpi)
{
vp8_prob newp = cpi->frame_coef_probs_8x8 [i][j][k][t];
vp8_prob *Pold = cpi->common.fc.coef_probs_8x8 [i][j][k] + t;
const vp8_prob upd = vp8_coef_update_probs_8x8 [i][j][k][t];
const vp8_prob upd = COEF_UPDATE_PROB_8X8;
int s;
int u = 0;
......@@ -1639,7 +1639,7 @@ static void update_coef_probs3(VP8_COMP *cpi)
{
vp8_prob newp = cpi->frame_coef_probs_8x8 [i][j][k][t];
vp8_prob *Pold = cpi->common.fc.coef_probs_8x8 [i][j][k] + t;
const vp8_prob upd = vp8_coef_update_probs_8x8 [i][j][k][t];
const vp8_prob upd = COEF_UPDATE_PROB_8X8;
int s;
int u = 0;
......@@ -1703,7 +1703,7 @@ static void update_coef_probs2(VP8_COMP *cpi)
{
vp8_prob newp = cpi->frame_coef_probs [i][j][k][t];
vp8_prob *Pold = cpi->common.fc.coef_probs [i][j][k] + t;
const vp8_prob upd = vp8_coef_update_probs [i][j][k][t];
const vp8_prob upd = COEF_UPDATE_PROB;
int s;
int u = 0;
#if CONFIG_EXPANDED_COEF_CONTEXT
......@@ -1745,7 +1745,7 @@ static void update_coef_probs2(VP8_COMP *cpi)
{
vp8_prob newp = cpi->frame_coef_probs [i][j][k][t];
vp8_prob *Pold = cpi->common.fc.coef_probs [i][j][k] + t;
const vp8_prob upd = vp8_coef_update_probs [i][j][k][t];
const vp8_prob upd = COEF_UPDATE_PROB;
int s;
int u = 0;
#if CONFIG_EXPANDED_COEF_CONTEXT
......@@ -1791,7 +1791,7 @@ static void update_coef_probs2(VP8_COMP *cpi)
{
vp8_prob newp = cpi->frame_coef_probs_8x8 [i][j][k][t];
vp8_prob *Pold = cpi->common.fc.coef_probs_8x8 [i][j][k] + t;
const vp8_prob upd = vp8_coef_update_probs_8x8 [i][j][k][t];
const vp8_prob upd = COEF_UPDATE_PROB_8X8;
int s;
int u = 0;
#if CONFIG_EXPANDED_COEF_CONTEXT
......@@ -1835,7 +1835,7 @@ static void update_coef_probs2(VP8_COMP *cpi)
{
vp8_prob newp = cpi->frame_coef_probs_8x8 [i][j][k][t];
vp8_prob *Pold = cpi->common.fc.coef_probs_8x8 [i][j][k] + t;
const vp8_prob upd = vp8_coef_update_probs_8x8 [i][j][k][t];
const vp8_prob upd = COEF_UPDATE_PROB_8X8;
int s;
int u = 0;
#if CONFIG_EXPANDED_COEF_CONTEXT
......@@ -1907,7 +1907,7 @@ static void update_coef_probs(VP8_COMP *cpi)
{
vp8_prob newp = cpi->frame_coef_probs [i][j][k][t];
vp8_prob *Pold = cpi->common.fc.coef_probs [i][j][k] + t;
const vp8_prob upd = vp8_coef_update_probs [i][j][k][t];
const vp8_prob upd = COEF_UPDATE_PROB;
int s = prev_coef_savings[t];
int u = 0;
#if CONFIG_EXPANDED_COEF_CONTEXT
......@@ -1978,7 +1978,7 @@ static void update_coef_probs(VP8_COMP *cpi)
{
vp8_prob newp = cpi->frame_coef_probs [i][j][k][t];
vp8_prob *Pold = cpi->common.fc.coef_probs [i][j][k] + t;
const vp8_prob upd = vp8_coef_update_probs [i][j][k][t];
const vp8_prob upd = COEF_UPDATE_PROB;
int s = prev_coef_savings[t];
int u = 0;
#if CONFIG_EXPANDED_COEF_CONTEXT
......@@ -2055,8 +2055,8 @@ static void update_coef_probs(VP8_COMP *cpi)
vp8_prob newp = cpi->frame_coef_probs_8x8 [i][j][k][t];
vp8_prob *Pold = cpi->common.fc.coef_probs_8x8 [i][j][k] + t;
const vp8_prob oldp = *Pold;
const vp8_prob upd = vp8_coef_update_probs_8x8 [i][j][k][t];
int s,u;
const vp8_prob upd = COEF_UPDATE_PROB_8X8;
#if CONFIG_EXPANDED_COEF_CONTEXT
if (k >=3 && ((i == 0 && j == 1) || (i > 0 && j == 0)))
continue;
......@@ -2116,7 +2116,7 @@ static void update_coef_probs(VP8_COMP *cpi)
vp8_prob newp = cpi->frame_coef_probs_8x8 [i][j][k][t];
vp8_prob *Pold = cpi->common.fc.coef_probs_8x8 [i][j][k] + t;
const vp8_prob oldp = *Pold;
const vp8_prob upd = vp8_coef_update_probs_8x8 [i][j][k][t];
const vp8_prob upd = COEF_UPDATE_PROB_8X8;
#if CONFIG_NEWUPDATE && defined(SEARCH_NEWP)
const int s = prob_diff_update_savings_search(ct, oldp, &newp, upd);
const int u = s > 0 && newp != oldp ? 1 : 0;
......
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