Commit 885cf816 authored by Ronald S. Bultje's avatar Ronald S. Bultje
Browse files

Introduce vp9_coeff_probs/counts/stats/accum types.

Use these, instead of the 4/5-dimensional arrays, to hold statistics,
counts, accumulations and probabilities for coefficient tokens. This
commit also re-allows ENTROPY_STATS to compile.

Change-Id: If441ffac936f52a3af91d8f2922ea8a0ceabdaa5
parent c456b35f
...@@ -12,10 +12,7 @@ ...@@ -12,10 +12,7 @@
/*Generated file, included by vp9_entropy.c*/ /*Generated file, included by vp9_entropy.c*/
static const vp9_prob default_coef_probs [BLOCK_TYPES] static const vp9_coeff_probs default_coef_probs_4x4[BLOCK_TYPES_4X4] = {
[COEF_BANDS]
[PREV_COEF_CONTEXTS]
[ENTROPY_NODES] = {
{ {
/* Block Type ( 0 ) */ /* Block Type ( 0 ) */
{ {
...@@ -254,10 +251,7 @@ static const vp9_prob default_coef_probs [BLOCK_TYPES] ...@@ -254,10 +251,7 @@ static const vp9_prob default_coef_probs [BLOCK_TYPES]
} }
}; };
static const vp9_prob default_hybrid_coef_probs [BLOCK_TYPES] static const vp9_coeff_probs default_hybrid_coef_probs_4x4[BLOCK_TYPES_4X4] = {
[COEF_BANDS]
[PREV_COEF_CONTEXTS]
[ENTROPY_NODES] = {
{ {
/* Block Type ( 0 ) */ /* Block Type ( 0 ) */
{ {
...@@ -496,11 +490,7 @@ static const vp9_prob default_hybrid_coef_probs [BLOCK_TYPES] ...@@ -496,11 +490,7 @@ static const vp9_prob default_hybrid_coef_probs [BLOCK_TYPES]
} }
}; };
static const vp9_prob static const vp9_coeff_probs default_coef_probs_8x8[BLOCK_TYPES_8X8] = {
default_coef_probs_8x8[BLOCK_TYPES_8X8]
[COEF_BANDS]
[PREV_COEF_CONTEXTS]
[ENTROPY_NODES] = {
{ {
/* block Type 0 */ /* block Type 0 */
{ {
...@@ -729,11 +719,7 @@ default_coef_probs_8x8[BLOCK_TYPES_8X8] ...@@ -729,11 +719,7 @@ default_coef_probs_8x8[BLOCK_TYPES_8X8]
} }
}; };
static const vp9_prob static const vp9_coeff_probs default_hybrid_coef_probs_8x8[BLOCK_TYPES_8X8] = {
default_hybrid_coef_probs_8x8[BLOCK_TYPES_8X8]
[COEF_BANDS]
[PREV_COEF_CONTEXTS]
[ENTROPY_NODES] = {
{ {
/* block Type 0 */ /* block Type 0 */
{ {
...@@ -962,11 +948,7 @@ default_hybrid_coef_probs_8x8[BLOCK_TYPES_8X8] ...@@ -962,11 +948,7 @@ default_hybrid_coef_probs_8x8[BLOCK_TYPES_8X8]
} }
}; };
static const vp9_prob static const vp9_coeff_probs default_coef_probs_16x16[BLOCK_TYPES_16X16] = {
default_coef_probs_16x16[BLOCK_TYPES_16X16]
[COEF_BANDS]
[PREV_COEF_CONTEXTS]
[ENTROPY_NODES] = {
{ /* block Type 0 */ { /* block Type 0 */
{ /* Coeff Band 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},
...@@ -1169,11 +1151,8 @@ static const vp9_prob ...@@ -1169,11 +1151,8 @@ static const vp9_prob
} }
}; };
static const vp9_prob static const vp9_coeff_probs
default_hybrid_coef_probs_16x16[BLOCK_TYPES_16X16] default_hybrid_coef_probs_16x16[BLOCK_TYPES_16X16] = {
[COEF_BANDS]
[PREV_COEF_CONTEXTS]
[ENTROPY_NODES] = {
{ /* block Type 0 */ { /* block Type 0 */
{ /* Coeff Band 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},
......
...@@ -307,10 +307,10 @@ vp9_extra_bit_struct vp9_extra_bits[12] = { ...@@ -307,10 +307,10 @@ vp9_extra_bit_struct vp9_extra_bits[12] = {
#include "vp9/common/vp9_default_coef_probs.h" #include "vp9/common/vp9_default_coef_probs.h"
void vp9_default_coef_probs(VP9_COMMON *pc) { void vp9_default_coef_probs(VP9_COMMON *pc) {
vpx_memcpy(pc->fc.coef_probs, default_coef_probs, vpx_memcpy(pc->fc.coef_probs_4x4, default_coef_probs_4x4,
sizeof(pc->fc.coef_probs)); sizeof(pc->fc.coef_probs_4x4));
vpx_memcpy(pc->fc.hybrid_coef_probs, default_hybrid_coef_probs, vpx_memcpy(pc->fc.hybrid_coef_probs_4x4, default_hybrid_coef_probs_4x4,
sizeof(pc->fc.hybrid_coef_probs)); sizeof(pc->fc.hybrid_coef_probs_4x4));
vpx_memcpy(pc->fc.coef_probs_8x8, default_coef_probs_8x8, vpx_memcpy(pc->fc.coef_probs_8x8, default_coef_probs_8x8,
sizeof(pc->fc.coef_probs_8x8)); sizeof(pc->fc.coef_probs_8x8));
...@@ -343,13 +343,42 @@ void vp9_coef_tree_initialize() { ...@@ -343,13 +343,42 @@ void vp9_coef_tree_initialize() {
#define COEF_COUNT_SAT_AFTER_KEY 24 #define COEF_COUNT_SAT_AFTER_KEY 24
#define COEF_MAX_UPDATE_FACTOR_AFTER_KEY 128 #define COEF_MAX_UPDATE_FACTOR_AFTER_KEY 128
void vp9_adapt_coef_probs(VP9_COMMON *cm) { 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, count;
unsigned int branch_ct[ENTROPY_NODES][2]; unsigned int branch_ct[ENTROPY_NODES][2];
vp9_prob coef_probs[ENTROPY_NODES]; vp9_prob coef_probs[ENTROPY_NODES];
int update_factor; /* denominator 256 */
int factor; 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 && ((i == 0 && j == 1) || (i > 0 && 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], 256, 1);
for (t = 0; t < ENTROPY_NODES; ++t) {
int prob;
count = branch_ct[t][0] + branch_ct[t][1];
count = count > count_sat ? count_sat : count;
factor = (update_factor * count / count_sat);
prob = ((int)pre_coef_probs[i][j][k][t] * (256 - factor) +
(int)coef_probs[t] * factor + 128) >> 8;
dst_coef_probs[i][j][k][t] = clip_prob(prob);
}
}
}
void vp9_adapt_coef_probs(VP9_COMMON *cm) {
#ifdef COEF_COUNT_TESTING
int t, i, j, k;
#endif
int count_sat; int count_sat;
int update_factor; /* denominator 256 */
// printf("Frame type: %d\n", cm->frame_type); // printf("Frame type: %d\n", cm->frame_type);
if (cm->frame_type == KEY_FRAME) { if (cm->frame_type == KEY_FRAME) {
...@@ -422,159 +451,30 @@ void vp9_adapt_coef_probs(VP9_COMMON *cm) { ...@@ -422,159 +451,30 @@ void vp9_adapt_coef_probs(VP9_COMMON *cm) {
} }
#endif #endif
for (i = 0; i < BLOCK_TYPES; ++i) update_coef_probs(cm->fc.coef_probs_4x4, cm->fc.pre_coef_probs_4x4,
for (j = 0; j < COEF_BANDS; ++j) BLOCK_TYPES_4X4, cm->fc.coef_counts_4x4,
for (k = 0; k < PREV_COEF_CONTEXTS; ++k) { count_sat, update_factor);
if (k >= 3 && ((i == 0 && j == 1) || (i > 0 && j == 0))) update_coef_probs(cm->fc.hybrid_coef_probs_4x4,
continue; cm->fc.pre_hybrid_coef_probs_4x4,
vp9_tree_probs_from_distribution( BLOCK_TYPES_4X4, cm->fc.hybrid_coef_counts_4x4,
MAX_ENTROPY_TOKENS, vp9_coef_encodings, vp9_coef_tree, count_sat, update_factor);
coef_probs, branch_ct, cm->fc.coef_counts [i][j][k], update_coef_probs(cm->fc.coef_probs_8x8, cm->fc.pre_coef_probs_8x8,
256, 1); BLOCK_TYPES_8X8, cm->fc.coef_counts_8x8,
for (t = 0; t < ENTROPY_NODES; ++t) { count_sat, update_factor);
int prob; update_coef_probs(cm->fc.hybrid_coef_probs_8x8,
count = branch_ct[t][0] + branch_ct[t][1]; cm->fc.pre_hybrid_coef_probs_8x8,
count = count > count_sat ? count_sat : count; BLOCK_TYPES_8X8, cm->fc.hybrid_coef_counts_8x8,
factor = (update_factor * count / count_sat); count_sat, update_factor);
prob = ((int)cm->fc.pre_coef_probs[i][j][k][t] * (256 - factor) + update_coef_probs(cm->fc.coef_probs_16x16, cm->fc.pre_coef_probs_16x16,
(int)coef_probs[t] * factor + 128) >> 8; BLOCK_TYPES_16X16, cm->fc.coef_counts_16x16,
if (prob <= 0) cm->fc.coef_probs[i][j][k][t] = 1; count_sat, update_factor);
else if (prob > 255) cm->fc.coef_probs[i][j][k][t] = 255; update_coef_probs(cm->fc.hybrid_coef_probs_16x16,
else cm->fc.coef_probs[i][j][k][t] = prob; cm->fc.pre_hybrid_coef_probs_16x16,
} BLOCK_TYPES_16X16, cm->fc.hybrid_coef_counts_16x16,
} count_sat, update_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 && ((i == 0 && j == 1) || (i > 0 && j == 0)))
continue;
vp9_tree_probs_from_distribution(
MAX_ENTROPY_TOKENS, vp9_coef_encodings, vp9_coef_tree,
coef_probs, branch_ct, cm->fc.hybrid_coef_counts [i][j][k],
256, 1);
for (t = 0; t < ENTROPY_NODES; ++t) {
int prob;
count = branch_ct[t][0] + branch_ct[t][1];
count = count > count_sat ? count_sat : count;
factor = (update_factor * count / count_sat);
prob = ((int)cm->fc.pre_hybrid_coef_probs[i][j][k][t] * (256 - factor) +
(int)coef_probs[t] * factor + 128) >> 8;
if (prob <= 0) cm->fc.hybrid_coef_probs[i][j][k][t] = 1;
else if (prob > 255) cm->fc.hybrid_coef_probs[i][j][k][t] = 255;
else cm->fc.hybrid_coef_probs[i][j][k][t] = prob;
}
}
for (i = 0; i < BLOCK_TYPES_8X8; ++i)
for (j = 0; j < COEF_BANDS; ++j)
for (k = 0; k < PREV_COEF_CONTEXTS; ++k) {
if (k >= 3 && ((i == 0 && j == 1) || (i > 0 && j == 0)))
continue;
vp9_tree_probs_from_distribution(
MAX_ENTROPY_TOKENS, vp9_coef_encodings, vp9_coef_tree,
coef_probs, branch_ct, cm->fc.coef_counts_8x8 [i][j][k],
256, 1);
for (t = 0; t < ENTROPY_NODES; ++t) {
int prob;
count = branch_ct[t][0] + branch_ct[t][1];
count = count > count_sat ? count_sat : count;
factor = (update_factor * count / count_sat);
prob = ((int)cm->fc.pre_coef_probs_8x8[i][j][k][t] * (256 - factor) +
(int)coef_probs[t] * factor + 128) >> 8;
if (prob <= 0) cm->fc.coef_probs_8x8[i][j][k][t] = 1;
else if (prob > 255) cm->fc.coef_probs_8x8[i][j][k][t] = 255;
else cm->fc.coef_probs_8x8[i][j][k][t] = prob;
}
}
for (i = 0; i < BLOCK_TYPES_8X8; ++i)
for (j = 0; j < COEF_BANDS; ++j)
for (k = 0; k < PREV_COEF_CONTEXTS; ++k) {
if (k >= 3 && ((i == 0 && j == 1) || (i > 0 && j == 0)))
continue;
vp9_tree_probs_from_distribution(
MAX_ENTROPY_TOKENS, vp9_coef_encodings, vp9_coef_tree,
coef_probs, branch_ct, cm->fc.hybrid_coef_counts_8x8 [i][j][k],
256, 1);
for (t = 0; t < ENTROPY_NODES; ++t) {
int prob;
count = branch_ct[t][0] + branch_ct[t][1];
count = count > count_sat ? count_sat : count;
factor = (update_factor * count / count_sat);
prob = ((int)cm->fc.pre_hybrid_coef_probs_8x8[i][j][k][t] *
(256 - factor) +
(int)coef_probs[t] * factor + 128) >> 8;
if (prob <= 0) cm->fc.hybrid_coef_probs_8x8[i][j][k][t] = 1;
else if (prob > 255) cm->fc.hybrid_coef_probs_8x8[i][j][k][t] = 255;
else cm->fc.hybrid_coef_probs_8x8[i][j][k][t] = prob;
}
}
for (i = 0; i < BLOCK_TYPES_16X16; ++i)
for (j = 0; j < COEF_BANDS; ++j)
for (k = 0; k < PREV_COEF_CONTEXTS; ++k) {
if (k >= 3 && ((i == 0 && j == 1) || (i > 0 && j == 0)))
continue;
vp9_tree_probs_from_distribution(
MAX_ENTROPY_TOKENS, vp9_coef_encodings, vp9_coef_tree,
coef_probs, branch_ct, cm->fc.coef_counts_16x16[i][j][k], 256, 1);
for (t = 0; t < ENTROPY_NODES; ++t) {
int prob;
count = branch_ct[t][0] + branch_ct[t][1];
count = count > count_sat ? count_sat : count;
factor = (update_factor * count / count_sat);
prob = ((int)cm->fc.pre_coef_probs_16x16[i][j][k][t] *
(256 - factor) +
(int)coef_probs[t] * factor + 128) >> 8;
if (prob <= 0) cm->fc.coef_probs_16x16[i][j][k][t] = 1;
else if (prob > 255) cm->fc.coef_probs_16x16[i][j][k][t] = 255;
else cm->fc.coef_probs_16x16[i][j][k][t] = prob;
}
}
for (i = 0; i < BLOCK_TYPES_16X16; ++i)
for (j = 0; j < COEF_BANDS; ++j)
for (k = 0; k < PREV_COEF_CONTEXTS; ++k) {
if (k >= 3 && ((i == 0 && j == 1) || (i > 0 && j == 0)))
continue;
vp9_tree_probs_from_distribution(
MAX_ENTROPY_TOKENS, vp9_coef_encodings, vp9_coef_tree,
coef_probs, branch_ct, cm->fc.hybrid_coef_counts_16x16[i][j][k], 256, 1);
for (t = 0; t < ENTROPY_NODES; ++t) {
int prob;
count = branch_ct[t][0] + branch_ct[t][1];
count = count > count_sat ? count_sat : count;
factor = (update_factor * count / count_sat);
prob = ((int)cm->fc.pre_hybrid_coef_probs_16x16[i][j][k][t] * (256 - factor) +
(int)coef_probs[t] * factor + 128) >> 8;
if (prob <= 0) cm->fc.hybrid_coef_probs_16x16[i][j][k][t] = 1;
else if (prob > 255) cm->fc.hybrid_coef_probs_16x16[i][j][k][t] = 255;
else cm->fc.hybrid_coef_probs_16x16[i][j][k][t] = prob;
}
}
#if CONFIG_TX32X32 && CONFIG_SUPERBLOCKS #if CONFIG_TX32X32 && CONFIG_SUPERBLOCKS
for (i = 0; i < BLOCK_TYPES_32X32; ++i) update_coef_probs(cm->fc.coef_probs_32x32, cm->fc.pre_coef_probs_32x32,
for (j = 0; j < COEF_BANDS; ++j) BLOCK_TYPES_32X32, cm->fc.coef_counts_32x32,
for (k = 0; k < PREV_COEF_CONTEXTS; ++k) { count_sat, update_factor);
if (k >= 3 && ((i == 0 && j == 1) || (i > 0 && j == 0)))
continue;
vp9_tree_probs_from_distribution(
MAX_ENTROPY_TOKENS, vp9_coef_encodings, vp9_coef_tree,
coef_probs, branch_ct, cm->fc.coef_counts_32x32[i][j][k], 256, 1);
for (t = 0; t < ENTROPY_NODES; ++t) {
int prob;
count = branch_ct[t][0] + branch_ct[t][1];
count = count > count_sat ? count_sat : count;
factor = (update_factor * count / count_sat);
prob = ((int)cm->fc.pre_coef_probs_32x32[i][j][k][t] *
(256 - factor) +
(int)coef_probs[t] * factor + 128) >> 8;
if (prob <= 0) cm->fc.coef_probs_32x32[i][j][k][t] = 1;
else if (prob > 255) cm->fc.coef_probs_32x32[i][j][k][t] = 255;
else cm->fc.coef_probs_32x32[i][j][k][t] = prob;
}
}
#endif #endif
} }
...@@ -60,7 +60,7 @@ extern vp9_extra_bit_struct vp9_extra_bits[12]; /* indexed by token value */ ...@@ -60,7 +60,7 @@ extern vp9_extra_bit_struct vp9_extra_bits[12]; /* indexed by token value */
/* Coefficients are predicted via a 3-dimensional probability table. */ /* Coefficients are predicted via a 3-dimensional probability table. */
/* Outside dimension. 0 = Y no DC, 1 = Y2, 2 = UV, 3 = Y with DC */ /* Outside dimension. 0 = Y no DC, 1 = Y2, 2 = UV, 3 = Y with DC */
#define BLOCK_TYPES 4 #define BLOCK_TYPES_4X4 4
#define BLOCK_TYPES_8X8 4 #define BLOCK_TYPES_8X8 4
...@@ -100,6 +100,13 @@ extern DECLARE_ALIGNED(16, const int, vp9_coef_bands_32x32[1024]); ...@@ -100,6 +100,13 @@ extern DECLARE_ALIGNED(16, const int, vp9_coef_bands_32x32[1024]);
/*# define DC_TOKEN_CONTEXTS 3*/ /* 00, 0!0, !0!0 */ /*# define DC_TOKEN_CONTEXTS 3*/ /* 00, 0!0, !0!0 */
#define PREV_COEF_CONTEXTS 4 #define PREV_COEF_CONTEXTS 4
typedef unsigned int vp9_coeff_count[COEF_BANDS][PREV_COEF_CONTEXTS]
[MAX_ENTROPY_TOKENS];
typedef unsigned int vp9_coeff_stats[COEF_BANDS][PREV_COEF_CONTEXTS]
[ENTROPY_NODES][2];
typedef vp9_prob vp9_coeff_probs[COEF_BANDS][PREV_COEF_CONTEXTS]
[ENTROPY_NODES];
#define SUBEXP_PARAM 4 /* Subexponential code parameter */ #define SUBEXP_PARAM 4 /* Subexponential code parameter */
#define MODULUS_PARAM 13 /* Modulus parameter */ #define MODULUS_PARAM 13 /* Modulus parameter */
......
...@@ -52,14 +52,14 @@ typedef struct frame_contexts { ...@@ -52,14 +52,14 @@ typedef struct frame_contexts {
vp9_prob i8x8_mode_prob[VP9_I8X8_MODES - 1]; vp9_prob i8x8_mode_prob[VP9_I8X8_MODES - 1];
vp9_prob sub_mv_ref_prob[SUBMVREF_COUNT][VP9_SUBMVREFS - 1]; vp9_prob sub_mv_ref_prob[SUBMVREF_COUNT][VP9_SUBMVREFS - 1];
vp9_prob mbsplit_prob[VP9_NUMMBSPLITS - 1]; vp9_prob mbsplit_prob[VP9_NUMMBSPLITS - 1];
vp9_prob coef_probs [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES]; vp9_coeff_probs coef_probs_4x4[BLOCK_TYPES_4X4];
vp9_prob hybrid_coef_probs [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES]; vp9_coeff_probs hybrid_coef_probs_4x4[BLOCK_TYPES_4X4];
vp9_prob coef_probs_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES]; vp9_coeff_probs coef_probs_8x8[BLOCK_TYPES_8X8];
vp9_prob hybrid_coef_probs_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES]; vp9_coeff_probs hybrid_coef_probs_8x8[BLOCK_TYPES_8X8];
vp9_prob coef_probs_16x16 [BLOCK_TYPES_16X16] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES]; vp9_coeff_probs coef_probs_16x16[BLOCK_TYPES_16X16];
vp9_prob hybrid_coef_probs_16x16 [BLOCK_TYPES_16X16] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES]; vp9_coeff_probs hybrid_coef_probs_16x16[BLOCK_TYPES_16X16];
#if CONFIG_TX32X32 && CONFIG_SUPERBLOCKS #if CONFIG_TX32X32 && CONFIG_SUPERBLOCKS
vp9_prob coef_probs_32x32 [BLOCK_TYPES_32X32] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES]; vp9_coeff_probs coef_probs_32x32[BLOCK_TYPES_32X32];
#endif #endif
nmv_context nmvc; nmv_context nmvc;
...@@ -83,44 +83,24 @@ typedef struct frame_contexts { ...@@ -83,44 +83,24 @@ typedef struct frame_contexts {
unsigned int sub_mv_ref_counts[SUBMVREF_COUNT][VP9_SUBMVREFS]; unsigned int sub_mv_ref_counts[SUBMVREF_COUNT][VP9_SUBMVREFS];
unsigned int mbsplit_counts[VP9_NUMMBSPLITS]; unsigned int mbsplit_counts[VP9_NUMMBSPLITS];
vp9_prob pre_coef_probs [BLOCK_TYPES] [COEF_BANDS] vp9_coeff_probs pre_coef_probs_4x4[BLOCK_TYPES_4X4];
[PREV_COEF_CONTEXTS] [ENTROPY_NODES]; vp9_coeff_probs pre_hybrid_coef_probs_4x4[BLOCK_TYPES_4X4];
vp9_prob pre_hybrid_coef_probs [BLOCK_TYPES] [COEF_BANDS] vp9_coeff_probs pre_coef_probs_8x8[BLOCK_TYPES_8X8];
[PREV_COEF_CONTEXTS] [ENTROPY_NODES]; vp9_coeff_probs pre_hybrid_coef_probs_8x8[BLOCK_TYPES_8X8];
vp9_coeff_probs pre_coef_probs_16x16[BLOCK_TYPES_16X16];
vp9_prob pre_coef_probs_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS] vp9_coeff_probs pre_hybrid_coef_probs_16x16[BLOCK_TYPES_16X16];
[PREV_COEF_CONTEXTS] [ENTROPY_NODES];
vp9_prob pre_hybrid_coef_probs_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS]
[PREV_COEF_CONTEXTS] [ENTROPY_NODES];
vp9_prob pre_coef_probs_16x16 [BLOCK_TYPES_16X16] [COEF_BANDS]
[PREV_COEF_CONTEXTS] [ENTROPY_NODES];
vp9_prob pre_hybrid_coef_probs_16x16 [BLOCK_TYPES_16X16] [COEF_BANDS]
[PREV_COEF_CONTEXTS] [ENTROPY_NODES];
#if CONFIG_TX32X32 && CONFIG_SUPERBLOCKS #if CONFIG_TX32X32 && CONFIG_SUPERBLOCKS
vp9_prob pre_coef_probs_32x32 [BLOCK_TYPES_32X32] [COEF_BANDS] vp9_coeff_probs pre_coef_probs_32x32[BLOCK_TYPES_32X32];
[PREV_COEF_CONTEXTS] [ENTROPY_NODES];
#endif #endif
unsigned int coef_counts [BLOCK_TYPES] [COEF_BANDS] vp9_coeff_count coef_counts_4x4[BLOCK_TYPES_4X4];
[PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS]; vp9_coeff_count hybrid_coef_counts_4x4[BLOCK_TYPES_4X4];
unsigned int hybrid_coef_counts [BLOCK_TYPES] [COEF_BANDS] vp9_coeff_count coef_counts_8x8[BLOCK_TYPES_8X8];
[PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS]; vp9_coeff_count hybrid_coef_counts_8x8[BLOCK_TYPES_8X8];
vp9_coeff_count coef_counts_16x16[BLOCK_TYPES_16X16];
unsigned int coef_counts_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS] vp9_coeff_count hybrid_coef_counts_16x16[BLOCK_TYPES_16X16];
[PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];
unsigned int hybrid_coef_counts_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS]
[PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];
unsigned int coef_counts_16x16 [BLOCK_TYPES_16X16] [COEF_BANDS]
[PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];
unsigned int hybrid_coef_counts_16x16 [BLOCK_TYPES_16X16] [COEF_BANDS]
[PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];
#if CONFIG_TX32X32 && CONFIG_SUPERBLOCKS #if CONFIG_TX32X32 && CONFIG_SUPERBLOCKS
unsigned int coef_counts_32x32 [BLOCK_TYPES_32X32] [COEF_BANDS] vp9_coeff_count coef_counts_32x32[BLOCK_TYPES_32X32];
[PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];
#endif #endif
nmv_context_counts NMVcount; nmv_context_counts NMVcount;
......
...@@ -1231,14 +1231,13 @@ static void init_frame(VP9D_COMP *pbi) { ...@@ -1231,14 +1231,13 @@ static void init_frame(VP9D_COMP *pbi) {
} }
static void read_coef_probs_common( static void read_coef_probs_common(BOOL_DECODER* const bc,
BOOL_DECODER* const bc, vp9_coeff_probs *coef_probs,
vp9_prob coef_probs[BLOCK_TYPES][COEF_BANDS] int block_types) {
[PREV_COEF_CONTEXTS][ENTROPY_NODES]) {
int i, j, k, l; int i, j, k, l;
if (vp9_read_bit(bc)) { if (vp9_read_bit(bc)) {
for (i = 0; i < BLOCK_TYPES; i++) { for (i = 0; i < block_types; i++) {
for (j = !i; j < COEF_BANDS; j++) { for (j = !i; j < COEF_BANDS; j++) {
/* NB: This j loop starts from 1 on block type i == 0 */ /* NB: This j loop starts from 1 on block type i == 0 */
for (k = 0; k < PREV_COEF_CONTEXTS; k++) { for (k = 0; k < PREV_COEF_CONTEXTS; k++) {
...@@ -1261,20 +1260,21 @@ static void read_coef_probs_common( ...@@ -1261,20 +1260,21 @@ static void read_coef_probs_common(
static void read_coef_probs(VP9D_COMP *pbi, BOOL_DECODER* const bc) { static void read_coef_probs(VP9D_COMP *pbi, BOOL_DECODER* const bc) {
VP9_COMMON *const pc = &pbi->common; VP9_COMMON *const pc = &pbi->common;
read_coef_probs_common(bc, pc->fc.coef_probs); read_coef_probs_common(bc, pc->fc.coef_probs_4x4, BLOCK_TYPES_4X4);
read_coef_probs_common(bc, pc->fc.hybrid_coef_probs); read_coef_probs_common(bc, pc->fc.hybrid_coef_probs_4x4, BLOCK_TYPES_4X4);
if (pbi->common.txfm_mode != ONLY_4X4) { if (pbi->common.txfm_mode != ONLY_4X4) {
read_coef_probs_common(bc, pc->fc.coef_probs_8x8); read_coef_probs_common(bc, pc->fc.coef_probs_8x8, BLOCK_TYPES_8X8);
read_coef_probs_common(bc, pc->fc.hybrid_coef_probs_8x8); read_coef_probs_common(bc, pc->fc.hybrid_coef_probs_8x8, BLOCK_TYPES_8X8);
} }
if (pbi->common.txfm_mode > ALLOW_8X8) { if (pbi->common.txfm_mode > ALLOW_8X8) {
read_coef_probs_common(bc, pc->fc.coef_probs_16x16); read_coef_probs_common(bc, pc->fc.coef_probs_16x16, BLOCK_TYPES_16X16);
read_coef_probs_common(bc, pc->fc.hybrid_coef_probs_16x16); read_coef_probs_common(bc, pc->fc.hybrid_coef_probs_16x16,
BLOCK_TYPES_16X16);
} }
#if CONFIG_TX32X32 && CONFIG_SUPERBLOCKS #if CONFIG_TX32X32 && CONFIG_SUPERBLOCKS
if (pbi->common.txfm_mode > ALLOW_16X16) { if (pbi->common.txfm_mode > ALLOW_16X16) {
read_coef_probs_common(bc, pc->fc.coef_probs_32x32); read_coef_probs_common(bc, pc->fc.coef_probs_32x32, BLOCK_TYPES_32X32);
} }
#endif #endif
} }
...@@ -1619,10 +1619,10 @@ int vp9_decode_frame(VP9D_COMP *pbi, const unsigned char **p_data_end) { ...@@ -1619,10 +1619,10 @@ int vp9_decode_frame(VP9D_COMP *pbi, const unsigned char **p_data_end) {
fclose(z); fclose(z);
} }
vp9_copy(pbi->common.fc.pre_coef_probs, vp9_copy(pbi->common.fc.pre_coef_probs_4x4,
pbi->common.fc.coef_probs); pbi->common.fc.coef_probs_4x4);
vp9_copy(pbi->common.fc.pre_hybrid_coef_probs, vp9_copy(pbi->common.fc.pre_hybrid_coef_probs_4x4,
pbi->common.fc.hybrid_coef_probs); pbi->common.fc.hybrid_coef_probs_4x4);
vp9_copy(pbi->common.fc.pre_coef_probs_8x8, vp9_copy(pbi->common.fc.pre_coef_probs_8x8,
pbi->common.fc.coef_probs_8x8); pbi->common.fc.coef_probs_8x8);
vp9_copy(pbi->common.fc.pre_hybrid_coef_probs_8x8, vp9_copy(pbi->common.fc.pre_hybrid_coef_probs_8x8,
...@@ -1648,8 +1648,8 @@ int vp9_decode_frame(VP9D_COMP *pbi, const unsigned char **p_data_end) { ...@@ -1648,8 +1648,8 @@ int vp9_decode_frame(VP9D_COMP *pbi, const unsigned char **p_data_end) {
pbi->common.fc.pre_interintra_prob = pbi->common.fc.interintra_prob; pbi->common.fc.pre_interintra_prob = pbi->common.fc.interintra_prob;
#endif #endif
pbi->common.fc.pre_nmvc = pbi->common.fc.nmvc; pbi->common.fc.pre_nmvc = pbi->common.fc.nmvc;
vp9_zero(pbi->common.fc.coef_counts); vp9_zero(pbi->common.fc.coef_counts_4x4);
vp9_zero(pbi->common.fc.hybrid_coef_counts); vp9_zero(pbi->common.fc.hybrid_coef_counts_4x4);
vp9_zero(pbi->common.fc.coef_counts_8x8); vp9_zero(pbi->common.fc.coef_counts_8x8);
vp9_zero(pbi->common.fc.hybrid_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.coef_counts_16x16);
......