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
This commit is contained in:
Родитель
c456b35fdf
Коммит
885cf816eb
|
@ -12,10 +12,7 @@
|
|||
/*Generated file, included by vp9_entropy.c*/
|
||||
|
||||
|
||||
static const vp9_prob default_coef_probs [BLOCK_TYPES]
|
||||
[COEF_BANDS]
|
||||
[PREV_COEF_CONTEXTS]
|
||||
[ENTROPY_NODES] = {
|
||||
static const vp9_coeff_probs default_coef_probs_4x4[BLOCK_TYPES_4X4] = {
|
||||
{
|
||||
/* Block Type ( 0 ) */
|
||||
{
|
||||
|
@ -254,10 +251,7 @@ static const vp9_prob default_coef_probs [BLOCK_TYPES]
|
|||
}
|
||||
};
|
||||
|
||||
static const vp9_prob default_hybrid_coef_probs [BLOCK_TYPES]
|
||||
[COEF_BANDS]
|
||||
[PREV_COEF_CONTEXTS]
|
||||
[ENTROPY_NODES] = {
|
||||
static const vp9_coeff_probs default_hybrid_coef_probs_4x4[BLOCK_TYPES_4X4] = {
|
||||
{
|
||||
/* Block Type ( 0 ) */
|
||||
{
|
||||
|
@ -496,11 +490,7 @@ static const vp9_prob default_hybrid_coef_probs [BLOCK_TYPES]
|
|||
}
|
||||
};
|
||||
|
||||
static const vp9_prob
|
||||
default_coef_probs_8x8[BLOCK_TYPES_8X8]
|
||||
[COEF_BANDS]
|
||||
[PREV_COEF_CONTEXTS]
|
||||
[ENTROPY_NODES] = {
|
||||
static const vp9_coeff_probs default_coef_probs_8x8[BLOCK_TYPES_8X8] = {
|
||||
{
|
||||
/* block Type 0 */
|
||||
{
|
||||
|
@ -729,11 +719,7 @@ default_coef_probs_8x8[BLOCK_TYPES_8X8]
|
|||
}
|
||||
};
|
||||
|
||||
static const vp9_prob
|
||||
default_hybrid_coef_probs_8x8[BLOCK_TYPES_8X8]
|
||||
[COEF_BANDS]
|
||||
[PREV_COEF_CONTEXTS]
|
||||
[ENTROPY_NODES] = {
|
||||
static const vp9_coeff_probs default_hybrid_coef_probs_8x8[BLOCK_TYPES_8X8] = {
|
||||
{
|
||||
/* block Type 0 */
|
||||
{
|
||||
|
@ -962,11 +948,7 @@ default_hybrid_coef_probs_8x8[BLOCK_TYPES_8X8]
|
|||
}
|
||||
};
|
||||
|
||||
static const vp9_prob
|
||||
default_coef_probs_16x16[BLOCK_TYPES_16X16]
|
||||
[COEF_BANDS]
|
||||
[PREV_COEF_CONTEXTS]
|
||||
[ENTROPY_NODES] = {
|
||||
static const vp9_coeff_probs default_coef_probs_16x16[BLOCK_TYPES_16X16] = {
|
||||
{ /* block Type 0 */
|
||||
{ /* Coeff Band 0 */
|
||||
{ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128},
|
||||
|
@ -1169,11 +1151,8 @@ static const vp9_prob
|
|||
}
|
||||
};
|
||||
|
||||
static const vp9_prob
|
||||
default_hybrid_coef_probs_16x16[BLOCK_TYPES_16X16]
|
||||
[COEF_BANDS]
|
||||
[PREV_COEF_CONTEXTS]
|
||||
[ENTROPY_NODES] = {
|
||||
static const vp9_coeff_probs
|
||||
default_hybrid_coef_probs_16x16[BLOCK_TYPES_16X16] = {
|
||||
{ /* block Type 0 */
|
||||
{ /* Coeff Band 0 */
|
||||
{ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128},
|
||||
|
|
|
@ -307,10 +307,10 @@ vp9_extra_bit_struct vp9_extra_bits[12] = {
|
|||
#include "vp9/common/vp9_default_coef_probs.h"
|
||||
|
||||
void vp9_default_coef_probs(VP9_COMMON *pc) {
|
||||
vpx_memcpy(pc->fc.coef_probs, default_coef_probs,
|
||||
sizeof(pc->fc.coef_probs));
|
||||
vpx_memcpy(pc->fc.hybrid_coef_probs, default_hybrid_coef_probs,
|
||||
sizeof(pc->fc.hybrid_coef_probs));
|
||||
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));
|
||||
|
@ -343,13 +343,42 @@ void vp9_coef_tree_initialize() {
|
|||
#define COEF_COUNT_SAT_AFTER_KEY 24
|
||||
#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;
|
||||
unsigned int branch_ct[ENTROPY_NODES][2];
|
||||
vp9_prob coef_probs[ENTROPY_NODES];
|
||||
int update_factor; /* denominator 256 */
|
||||
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 update_factor; /* denominator 256 */
|
||||
|
||||
// printf("Frame type: %d\n", cm->frame_type);
|
||||
if (cm->frame_type == KEY_FRAME) {
|
||||
|
@ -422,159 +451,30 @@ void vp9_adapt_coef_probs(VP9_COMMON *cm) {
|
|||
}
|
||||
#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 && ((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 [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[i][j][k][t] * (256 - factor) +
|
||||
(int)coef_probs[t] * factor + 128) >> 8;
|
||||
if (prob <= 0) cm->fc.coef_probs[i][j][k][t] = 1;
|
||||
else if (prob > 255) cm->fc.coef_probs[i][j][k][t] = 255;
|
||||
else cm->fc.coef_probs[i][j][k][t] = prob;
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
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, cm->fc.hybrid_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, cm->fc.hybrid_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, cm->fc.hybrid_coef_counts_16x16,
|
||||
count_sat, update_factor);
|
||||
#if CONFIG_TX32X32 && CONFIG_SUPERBLOCKS
|
||||
for (i = 0; i < BLOCK_TYPES_32X32; ++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_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;
|
||||
}
|
||||
}
|
||||
update_coef_probs(cm->fc.coef_probs_32x32, cm->fc.pre_coef_probs_32x32,
|
||||
BLOCK_TYPES_32X32, cm->fc.coef_counts_32x32,
|
||||
count_sat, update_factor);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -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. */
|
||||
|
||||
/* 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
|
||||
|
||||
|
@ -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 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 MODULUS_PARAM 13 /* Modulus parameter */
|
||||
|
||||
|
|
|
@ -52,14 +52,14 @@ 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_prob coef_probs [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
|
||||
vp9_prob hybrid_coef_probs [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
|
||||
vp9_prob coef_probs_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
|
||||
vp9_prob hybrid_coef_probs_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
|
||||
vp9_prob coef_probs_16x16 [BLOCK_TYPES_16X16] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
|
||||
vp9_prob hybrid_coef_probs_16x16 [BLOCK_TYPES_16X16] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
|
||||
vp9_coeff_probs coef_probs_4x4[BLOCK_TYPES_4X4];
|
||||
vp9_coeff_probs hybrid_coef_probs_4x4[BLOCK_TYPES_4X4];
|
||||
vp9_coeff_probs coef_probs_8x8[BLOCK_TYPES_8X8];
|
||||
vp9_coeff_probs hybrid_coef_probs_8x8[BLOCK_TYPES_8X8];
|
||||
vp9_coeff_probs coef_probs_16x16[BLOCK_TYPES_16X16];
|
||||
vp9_coeff_probs hybrid_coef_probs_16x16[BLOCK_TYPES_16X16];
|
||||
#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
|
||||
|
||||
nmv_context nmvc;
|
||||
|
@ -83,44 +83,24 @@ typedef struct frame_contexts {
|
|||
unsigned int sub_mv_ref_counts[SUBMVREF_COUNT][VP9_SUBMVREFS];
|
||||
unsigned int mbsplit_counts[VP9_NUMMBSPLITS];
|
||||
|
||||
vp9_prob pre_coef_probs [BLOCK_TYPES] [COEF_BANDS]
|
||||
[PREV_COEF_CONTEXTS] [ENTROPY_NODES];
|
||||
vp9_prob pre_hybrid_coef_probs [BLOCK_TYPES] [COEF_BANDS]
|
||||
[PREV_COEF_CONTEXTS] [ENTROPY_NODES];
|
||||
|
||||
vp9_prob pre_coef_probs_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS]
|
||||
[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];
|
||||
|
||||
vp9_coeff_probs pre_coef_probs_4x4[BLOCK_TYPES_4X4];
|
||||
vp9_coeff_probs pre_hybrid_coef_probs_4x4[BLOCK_TYPES_4X4];
|
||||
vp9_coeff_probs pre_coef_probs_8x8[BLOCK_TYPES_8X8];
|
||||
vp9_coeff_probs pre_hybrid_coef_probs_8x8[BLOCK_TYPES_8X8];
|
||||
vp9_coeff_probs pre_coef_probs_16x16[BLOCK_TYPES_16X16];
|
||||
vp9_coeff_probs pre_hybrid_coef_probs_16x16[BLOCK_TYPES_16X16];
|
||||
#if CONFIG_TX32X32 && CONFIG_SUPERBLOCKS
|
||||
vp9_prob pre_coef_probs_32x32 [BLOCK_TYPES_32X32] [COEF_BANDS]
|
||||
[PREV_COEF_CONTEXTS] [ENTROPY_NODES];
|
||||
vp9_coeff_probs pre_coef_probs_32x32[BLOCK_TYPES_32X32];
|
||||
#endif
|
||||
|
||||
unsigned int coef_counts [BLOCK_TYPES] [COEF_BANDS]
|
||||
[PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];
|
||||
unsigned int hybrid_coef_counts [BLOCK_TYPES] [COEF_BANDS]
|
||||
[PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];
|
||||
|
||||
unsigned int coef_counts_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS]
|
||||
[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];
|
||||
|
||||
vp9_coeff_count coef_counts_4x4[BLOCK_TYPES_4X4];
|
||||
vp9_coeff_count hybrid_coef_counts_4x4[BLOCK_TYPES_4X4];
|
||||
vp9_coeff_count coef_counts_8x8[BLOCK_TYPES_8X8];
|
||||
vp9_coeff_count hybrid_coef_counts_8x8[BLOCK_TYPES_8X8];
|
||||
vp9_coeff_count coef_counts_16x16[BLOCK_TYPES_16X16];
|
||||
vp9_coeff_count hybrid_coef_counts_16x16[BLOCK_TYPES_16X16];
|
||||
#if CONFIG_TX32X32 && CONFIG_SUPERBLOCKS
|
||||
unsigned int coef_counts_32x32 [BLOCK_TYPES_32X32] [COEF_BANDS]
|
||||
[PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];
|
||||
vp9_coeff_count coef_counts_32x32[BLOCK_TYPES_32X32];
|
||||
#endif
|
||||
|
||||
nmv_context_counts NMVcount;
|
||||
|
|
|
@ -1231,14 +1231,13 @@ static void init_frame(VP9D_COMP *pbi) {
|
|||
|
||||
}
|
||||
|
||||
static void read_coef_probs_common(
|
||||
BOOL_DECODER* const bc,
|
||||
vp9_prob coef_probs[BLOCK_TYPES][COEF_BANDS]
|
||||
[PREV_COEF_CONTEXTS][ENTROPY_NODES]) {
|
||||
static void read_coef_probs_common(BOOL_DECODER* const bc,
|
||||
vp9_coeff_probs *coef_probs,
|
||||
int block_types) {
|
||||
int i, j, k, l;
|
||||
|
||||
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++) {
|
||||
/* NB: This j loop starts from 1 on block type i == 0 */
|
||||
for (k = 0; k < PREV_COEF_CONTEXTS; k++) {
|
||||
|
@ -1261,20 +1260,21 @@ static void read_coef_probs_common(
|
|||
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);
|
||||
read_coef_probs_common(bc, pc->fc.hybrid_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_4x4, BLOCK_TYPES_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.hybrid_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, BLOCK_TYPES_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.hybrid_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,
|
||||
BLOCK_TYPES_16X16);
|
||||
}
|
||||
#if CONFIG_TX32X32 && CONFIG_SUPERBLOCKS
|
||||
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
|
||||
}
|
||||
|
@ -1619,10 +1619,10 @@ int vp9_decode_frame(VP9D_COMP *pbi, const unsigned char **p_data_end) {
|
|||
fclose(z);
|
||||
}
|
||||
|
||||
vp9_copy(pbi->common.fc.pre_coef_probs,
|
||||
pbi->common.fc.coef_probs);
|
||||
vp9_copy(pbi->common.fc.pre_hybrid_coef_probs,
|
||||
pbi->common.fc.hybrid_coef_probs);
|
||||
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,
|
||||
|
@ -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;
|
||||
#endif
|
||||
pbi->common.fc.pre_nmvc = pbi->common.fc.nmvc;
|
||||
vp9_zero(pbi->common.fc.coef_counts);
|
||||
vp9_zero(pbi->common.fc.hybrid_coef_counts);
|
||||
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);
|
||||
|
|
|
@ -100,10 +100,10 @@ static int get_signed(BOOL_DECODER *br, int value_to_sign) {
|
|||
return v;
|
||||
}
|
||||
|
||||
#define INCREMENT_COUNT(token) \
|
||||
do { \
|
||||
coef_counts[coef_bands[c]][pt][token]++; \
|
||||
pt = vp9_prev_token_class[token]; \
|
||||
#define INCREMENT_COUNT(token) \
|
||||
do { \
|
||||
coef_counts[type][coef_bands[c]][pt][token]++; \
|
||||
pt = vp9_prev_token_class[token]; \
|
||||
} while (0)
|
||||
|
||||
#define WRITE_COEF_CONTINUE(val, token) \
|
||||
|
@ -130,42 +130,43 @@ static int decode_coefs(VP9D_COMP *dx, const MACROBLOCKD *xd,
|
|||
const int *coef_bands) {
|
||||
FRAME_CONTEXT *const fc = &dx->common.fc;
|
||||
int pt, c = (type == PLANE_TYPE_Y_NO_DC);
|
||||
vp9_prob (*coef_probs)[PREV_COEF_CONTEXTS][ENTROPY_NODES], *prob;
|
||||
unsigned int (*coef_counts)[PREV_COEF_CONTEXTS][MAX_ENTROPY_TOKENS];
|
||||
vp9_coeff_probs *coef_probs;
|
||||
vp9_prob *prob;
|
||||
vp9_coeff_count *coef_counts;
|
||||
|
||||
switch (txfm_size) {
|
||||
default:
|
||||
case TX_4X4:
|
||||
if (tx_type == DCT_DCT) {
|
||||
coef_probs = fc->coef_probs[type];
|
||||
coef_counts = fc->coef_counts[type];
|
||||
coef_probs = fc->coef_probs_4x4;
|
||||
coef_counts = fc->coef_counts_4x4;
|
||||
} else {
|
||||
coef_probs = fc->hybrid_coef_probs[type];
|
||||
coef_counts = fc->hybrid_coef_counts[type];
|
||||
coef_probs = fc->hybrid_coef_probs_4x4;
|
||||
coef_counts = fc->hybrid_coef_counts_4x4;
|
||||
}
|
||||
break;
|
||||
case TX_8X8:
|
||||
if (tx_type == DCT_DCT) {
|
||||
coef_probs = fc->coef_probs_8x8[type];
|
||||
coef_counts = fc->coef_counts_8x8[type];
|
||||
coef_probs = fc->coef_probs_8x8;
|
||||
coef_counts = fc->coef_counts_8x8;
|
||||
} else {
|
||||
coef_probs = fc->hybrid_coef_probs_8x8[type];
|
||||
coef_counts = fc->hybrid_coef_counts_8x8[type];
|
||||
coef_probs = fc->hybrid_coef_probs_8x8;
|
||||
coef_counts = fc->hybrid_coef_counts_8x8;
|
||||
}
|
||||
break;
|
||||
case TX_16X16:
|
||||
if (tx_type == DCT_DCT) {
|
||||
coef_probs = fc->coef_probs_16x16[type];
|
||||
coef_counts = fc->coef_counts_16x16[type];
|
||||
coef_probs = fc->coef_probs_16x16;
|
||||
coef_counts = fc->coef_counts_16x16;
|
||||
} else {
|
||||
coef_probs = fc->hybrid_coef_probs_16x16[type];
|
||||
coef_counts = fc->hybrid_coef_counts_16x16[type];
|
||||
coef_probs = fc->hybrid_coef_probs_16x16;
|
||||
coef_counts = fc->hybrid_coef_counts_16x16;
|
||||
}
|
||||
break;
|
||||
#if CONFIG_TX32X32 && CONFIG_SUPERBLOCKS
|
||||
case TX_32X32:
|
||||
coef_probs = fc->coef_probs_32x32[type];
|
||||
coef_counts = fc->coef_counts_32x32[type];
|
||||
coef_probs = fc->coef_probs_32x32;
|
||||
coef_counts = fc->coef_counts_32x32;
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
@ -175,7 +176,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[coef_bands[c]][pt];
|
||||
prob = coef_probs[type][coef_bands[c]][pt];
|
||||
if (!vp9_read(br, prob[EOB_CONTEXT_NODE]))
|
||||
break;
|
||||
SKIP_START:
|
||||
|
@ -183,7 +184,7 @@ SKIP_START:
|
|||
if (!vp9_read(br, prob[ZERO_CONTEXT_NODE])) {
|
||||
INCREMENT_COUNT(ZERO_TOKEN);
|
||||
++c;
|
||||
prob = coef_probs[coef_bands[c]][pt];
|
||||
prob = coef_probs[type][coef_bands[c]][pt];
|
||||
goto SKIP_START;
|
||||
}
|
||||
// ONE_CONTEXT_NODE_0_
|
||||
|
@ -247,7 +248,7 @@ SKIP_START:
|
|||
}
|
||||
|
||||
if (c < seg_eob)
|
||||
coef_counts[coef_bands[c]][pt][DCT_EOB_TOKEN]++;
|
||||
coef_counts[type][coef_bands[c]][pt][DCT_EOB_TOKEN]++;
|
||||
|
||||
a[0] = l[0] = (c > !type);
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ typedef struct {
|
|||
|
||||
INT16 *qcoeff_start_ptr;
|
||||
|
||||
vp9_prob const *coef_probs[BLOCK_TYPES];
|
||||
vp9_prob const *coef_probs_4x4[BLOCK_TYPES_4X4];
|
||||
vp9_prob const *coef_probs_8x8[BLOCK_TYPES_8X8];
|
||||
vp9_prob const *coef_probs_16X16[BLOCK_TYPES_16X16];
|
||||
|
||||
|
|
|
@ -39,30 +39,13 @@ unsigned __int64 Sectionbits[500];
|
|||
int intra_mode_stats[VP9_KF_BINTRAMODES]
|
||||
[VP9_KF_BINTRAMODES]
|
||||
[VP9_KF_BINTRAMODES];
|
||||
unsigned int tree_update_hist [BLOCK_TYPES]
|
||||
[COEF_BANDS]
|
||||
[PREV_COEF_CONTEXTS]
|
||||
[ENTROPY_NODES][2];
|
||||
unsigned int hybrid_tree_update_hist [BLOCK_TYPES]
|
||||
[COEF_BANDS]
|
||||
[PREV_COEF_CONTEXTS]
|
||||
[ENTROPY_NODES][2];
|
||||
unsigned int tree_update_hist_8x8 [BLOCK_TYPES_8X8]
|
||||
[COEF_BANDS]
|
||||
[PREV_COEF_CONTEXTS]
|
||||
[ENTROPY_NODES] [2];
|
||||
unsigned int hybrid_tree_update_hist_8x8 [BLOCK_TYPES_8X8]
|
||||
[COEF_BANDS]
|
||||
[PREV_COEF_CONTEXTS]
|
||||
[ENTROPY_NODES] [2];
|
||||
unsigned int tree_update_hist_16x16 [BLOCK_TYPES_16X16]
|
||||
[COEF_BANDS]
|
||||
[PREV_COEF_CONTEXTS]
|
||||
[ENTROPY_NODES] [2];
|
||||
unsigned int hybrid_tree_update_hist_16x16 [BLOCK_TYPES_16X16]
|
||||
[COEF_BANDS]
|
||||
[PREV_COEF_CONTEXTS]
|
||||
[ENTROPY_NODES] [2];
|
||||
vp9_coeff_stats tree_update_hist_4x4[BLOCK_TYPES_4X4];
|
||||
vp9_coeff_stats hybrid_tree_update_hist_4x4[BLOCK_TYPES_4X4];
|
||||
vp9_coeff_stats tree_update_hist_8x8[BLOCK_TYPES_8X8];
|
||||
vp9_coeff_stats hybrid_tree_update_hist_8x8[BLOCK_TYPES_8X8];
|
||||
vp9_coeff_stats tree_update_hist_16x16[BLOCK_TYPES_16X16];
|
||||
vp9_coeff_stats hybrid_tree_update_hist_16x16[BLOCK_TYPES_16X16];
|
||||
vp9_coeff_stats tree_update_hist_32x32[BLOCK_TYPES_32X32];
|
||||
|
||||
extern unsigned int active_section;
|
||||
#endif
|
||||
|
@ -982,9 +965,9 @@ static void pack_inter_mode_mvs(VP9_COMP *const cpi, vp9_writer *const bc) {
|
|||
|
||||
vp9_mv_ref_probs(&cpi->common, mv_ref_p, mi->mb_mode_context[rf]);
|
||||
|
||||
#ifdef ENTROPY_STATS
|
||||
accum_mv_refs(mode, ct);
|
||||
#endif
|
||||
// #ifdef ENTROPY_STATS
|
||||
// accum_mv_refs(mode, ct);
|
||||
// #endif
|
||||
}
|
||||
|
||||
#ifdef ENTROPY_STATS
|
||||
|
@ -1419,13 +1402,12 @@ static void write_kfmodes(VP9_COMP* const cpi, vp9_writer* const bc) {
|
|||
|
||||
|
||||
/* This function is used for debugging probability trees. */
|
||||
static void print_prob_tree(vp9_prob
|
||||
coef_probs[BLOCK_TYPES][COEF_BANDS][PREV_COEF_CONTEXTS][ENTROPY_NODES]) {
|
||||
static void print_prob_tree(vp9_coeff_probs *coef_probs) {
|
||||
/* print coef probability tree */
|
||||
int i, j, k, l;
|
||||
FILE *f = fopen("enc_tree_probs.txt", "a");
|
||||
fprintf(f, "{\n");
|
||||
for (i = 0; i < BLOCK_TYPES; i++) {
|
||||
for (i = 0; i < BLOCK_TYPES_4X4; i++) {
|
||||
fprintf(f, " {\n");
|
||||
for (j = 0; j < COEF_BANDS; j++) {
|
||||
fprintf(f, " {\n");
|
||||
|
@ -1445,176 +1427,95 @@ static void print_prob_tree(vp9_prob
|
|||
fclose(f);
|
||||
}
|
||||
|
||||
static void build_coeff_contexts(VP9_COMP *cpi) {
|
||||
static void build_tree_distribution(vp9_coeff_probs *coef_probs,
|
||||
vp9_coeff_count *coef_counts,
|
||||
#ifdef ENTROPY_STATS
|
||||
VP9_COMP *cpi,
|
||||
vp9_coeff_accum *context_counters,
|
||||
#endif
|
||||
vp9_coeff_stats *coef_branch_ct,
|
||||
int block_types) {
|
||||
int i = 0, j, k;
|
||||
#ifdef ENTROPY_STATS
|
||||
int t = 0;
|
||||
#endif
|
||||
for (i = 0; i < BLOCK_TYPES; ++i) {
|
||||
|
||||
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,
|
||||
cpi->frame_coef_probs [i][j][k],
|
||||
cpi->frame_branch_ct [i][j][k],
|
||||
cpi->coef_counts [i][j][k],
|
||||
256, 1
|
||||
);
|
||||
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], 256, 1);
|
||||
#ifdef ENTROPY_STATS
|
||||
if (!cpi->dummy_packing)
|
||||
for (t = 0; t < MAX_ENTROPY_TOKENS; ++t)
|
||||
context_counters[i][j][k][t] += cpi->coef_counts[i][j][k][t];
|
||||
#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 && ((i == 0 && j == 1) || (i > 0 && j == 0)))
|
||||
continue;
|
||||
vp9_tree_probs_from_distribution(
|
||||
MAX_ENTROPY_TOKENS, vp9_coef_encodings, vp9_coef_tree,
|
||||
cpi->frame_hybrid_coef_probs [i][j][k],
|
||||
cpi->frame_hybrid_branch_ct [i][j][k],
|
||||
cpi->hybrid_coef_counts [i][j][k],
|
||||
256, 1
|
||||
);
|
||||
#ifdef ENTROPY_STATS
|
||||
if (!cpi->dummy_packing)
|
||||
for (t = 0; t < MAX_ENTROPY_TOKENS; ++t)
|
||||
hybrid_context_counters[i][j][k][t] += cpi->hybrid_coef_counts[i][j][k][t];
|
||||
context_counters[i][j][k][t] += coef_counts[i][j][k][t];
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (cpi->common.txfm_mode != ONLY_4X4) {
|
||||
for (i = 0; i < BLOCK_TYPES_8X8; ++i) {
|
||||
for (j = 0; j < COEF_BANDS; ++j) {
|
||||
for (k = 0; k < PREV_COEF_CONTEXTS; ++k) {
|
||||
/* at every context */
|
||||
/* calc probs and branch cts for this frame only */
|
||||
// vp9_prob new_p [ENTROPY_NODES];
|
||||
// unsigned int branch_ct [ENTROPY_NODES] [2];
|
||||
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,
|
||||
cpi->frame_coef_probs_8x8 [i][j][k],
|
||||
cpi->frame_branch_ct_8x8 [i][j][k],
|
||||
cpi->coef_counts_8x8 [i][j][k],
|
||||
256, 1
|
||||
);
|
||||
static void build_coeff_contexts(VP9_COMP *cpi) {
|
||||
build_tree_distribution(cpi->frame_coef_probs_4x4,
|
||||
cpi->coef_counts_4x4,
|
||||
#ifdef ENTROPY_STATS
|
||||
if (!cpi->dummy_packing)
|
||||
for (t = 0; t < MAX_ENTROPY_TOKENS; ++t)
|
||||
context_counters_8x8[i][j][k][t] += cpi->coef_counts_8x8[i][j][k][t];
|
||||
cpi, context_counters_4x4,
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
for (i = 0; i < BLOCK_TYPES_8X8; ++i) {
|
||||
for (j = 0; j < COEF_BANDS; ++j) {
|
||||
for (k = 0; k < PREV_COEF_CONTEXTS; ++k) {
|
||||
/* at every context */
|
||||
/* calc probs and branch cts for this frame only */
|
||||
// vp9_prob new_p [ENTROPY_NODES];
|
||||
// unsigned int branch_ct [ENTROPY_NODES] [2];
|
||||
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,
|
||||
cpi->frame_hybrid_coef_probs_8x8 [i][j][k],
|
||||
cpi->frame_hybrid_branch_ct_8x8 [i][j][k],
|
||||
cpi->hybrid_coef_counts_8x8 [i][j][k],
|
||||
256, 1
|
||||
);
|
||||
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
|
||||
if (!cpi->dummy_packing)
|
||||
for (t = 0; t < MAX_ENTROPY_TOKENS; ++t)
|
||||
hybrid_context_counters_8x8[i][j][k][t] += cpi->hybrid_coef_counts_8x8[i][j][k][t];
|
||||
cpi, hybrid_context_counters_4x4,
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (cpi->common.txfm_mode > ALLOW_8X8) {
|
||||
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,
|
||||
cpi->frame_coef_probs_16x16[i][j][k],
|
||||
cpi->frame_branch_ct_16x16[i][j][k],
|
||||
cpi->coef_counts_16x16[i][j][k], 256, 1);
|
||||
cpi->frame_hybrid_branch_ct_4x4, BLOCK_TYPES_4X4);
|
||||
build_tree_distribution(cpi->frame_coef_probs_8x8,
|
||||
cpi->coef_counts_8x8,
|
||||
#ifdef ENTROPY_STATS
|
||||
if (!cpi->dummy_packing)
|
||||
for (t = 0; t < MAX_ENTROPY_TOKENS; ++t)
|
||||
context_counters_16x16[i][j][k][t] += cpi->coef_counts_16x16[i][j][k][t];
|
||||
cpi, context_counters_8x8,
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
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,
|
||||
cpi->frame_hybrid_coef_probs_16x16[i][j][k],
|
||||
cpi->frame_hybrid_branch_ct_16x16[i][j][k],
|
||||
cpi->hybrid_coef_counts_16x16[i][j][k], 256, 1);
|
||||
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
|
||||
if (!cpi->dummy_packing)
|
||||
for (t = 0; t < MAX_ENTROPY_TOKENS; ++t)
|
||||
hybrid_context_counters_16x16[i][j][k][t] +=
|
||||
cpi->hybrid_coef_counts_16x16[i][j][k][t];
|
||||
cpi, hybrid_context_counters_8x8,
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cpi->frame_hybrid_branch_ct_8x8, BLOCK_TYPES_8X8);
|
||||
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);
|
||||
#if CONFIG_TX32X32 && CONFIG_SUPERBLOCKS
|
||||
if (cpi->common.txfm_mode > ALLOW_16X16) {
|
||||
for (i = 0; i < BLOCK_TYPES_32X32; ++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,
|
||||
cpi->frame_coef_probs_32x32[i][j][k],
|
||||
cpi->frame_branch_ct_32x32[i][j][k],
|
||||
cpi->coef_counts_32x32[i][j][k], 256, 1);
|
||||
build_tree_distribution(cpi->frame_coef_probs_32x32,
|
||||
cpi->coef_counts_32x32,
|
||||
#ifdef ENTROPY_STATS
|
||||
if (!cpi->dummy_packing)
|
||||
for (t = 0; t < MAX_ENTROPY_TOKENS; ++t)
|
||||
context_counters_32x32[i][j][k][t] +=
|
||||
cpi->coef_counts_32x32[i][j][k][t];
|
||||
cpi, context_counters_32x32,
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
cpi->frame_branch_ct_32x32, BLOCK_TYPES_32X32);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void update_coef_probs_common(
|
||||
vp9_writer* const bc,
|
||||
vp9_prob new_frame_coef_probs[BLOCK_TYPES][COEF_BANDS]
|
||||
[PREV_COEF_CONTEXTS][ENTROPY_NODES],
|
||||
vp9_prob old_frame_coef_probs[BLOCK_TYPES][COEF_BANDS]
|
||||
[PREV_COEF_CONTEXTS][ENTROPY_NODES],
|
||||
unsigned int frame_branch_ct[BLOCK_TYPES][COEF_BANDS]
|
||||
[PREV_COEF_CONTEXTS][ENTROPY_NODES][2]) {
|
||||
static void update_coef_probs_common(vp9_writer* const bc,
|
||||
#ifdef ENTROPY_STATS
|
||||
VP9_COMP *cpi,
|
||||
vp9_coeff_stats *tree_update_hist,
|
||||
#endif
|
||||
vp9_coeff_probs *new_frame_coef_probs,
|
||||
vp9_coeff_probs *old_frame_coef_probs,
|
||||
vp9_coeff_stats *frame_branch_ct,
|
||||
int block_types) {
|
||||
int i, j, k, t;
|
||||
int update[2] = {0, 0};
|
||||
int savings;
|
||||
|
@ -1622,7 +1523,7 @@ static void update_coef_probs_common(
|
|||
|
||||
/* dry run to see if there is any udpate at all needed */
|
||||
savings = 0;
|
||||
for (i = 0; i < BLOCK_TYPES; ++i) {
|
||||
for (i = 0; i < block_types; ++i) {
|
||||
for (j = !i; j < COEF_BANDS; ++j) {
|
||||
int prev_coef_savings[ENTROPY_NODES] = {0};
|
||||
for (k = 0; k < PREV_COEF_CONTEXTS; ++k) {
|
||||
|
@ -1666,7 +1567,7 @@ static void update_coef_probs_common(
|
|||
vp9_write_bit(bc, 0);
|
||||
} else {
|
||||
vp9_write_bit(bc, 1);
|
||||
for (i = 0; i < BLOCK_TYPES; ++i) {
|
||||
for (i = 0; i < block_types; ++i) {
|
||||
for (j = !i; j < COEF_BANDS; ++j) {
|
||||
int prev_coef_savings[ENTROPY_NODES] = {0};
|
||||
for (k = 0; k < PREV_COEF_CONTEXTS; ++k) {
|
||||
|
@ -1696,7 +1597,7 @@ static void update_coef_probs_common(
|
|||
vp9_write(bc, u, upd);
|
||||
#ifdef ENTROPY_STATS
|
||||
if (!cpi->dummy_packing)
|
||||
++ tree_update_hist [i][j][k][t] [u];
|
||||
++tree_update_hist[i][j][k][t][u];
|
||||
#endif
|
||||
if (u) {
|
||||
/* send/use new probability */
|
||||
|
@ -1717,45 +1618,80 @@ static void update_coef_probs(VP9_COMP* const cpi, vp9_writer* const bc) {
|
|||
build_coeff_contexts(cpi);
|
||||
|
||||
update_coef_probs_common(bc,
|
||||
cpi->frame_coef_probs,
|
||||
cpi->common.fc.coef_probs,
|
||||
cpi->frame_branch_ct);
|
||||
#ifdef ENTROPY_STATS
|
||||
cpi,
|
||||
tree_update_hist_4x4,
|
||||
#endif
|
||||
cpi->frame_coef_probs_4x4,
|
||||
cpi->common.fc.coef_probs_4x4,
|
||||
cpi->frame_branch_ct_4x4,
|
||||
BLOCK_TYPES_4X4);
|
||||
|
||||
update_coef_probs_common(bc,
|
||||
cpi->frame_hybrid_coef_probs,
|
||||
cpi->common.fc.hybrid_coef_probs,
|
||||
cpi->frame_hybrid_branch_ct);
|
||||
#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);
|
||||
|
||||
/* do not do this if not even allowed */
|
||||
if (cpi->common.txfm_mode != ONLY_4X4) {
|
||||
update_coef_probs_common(bc,
|
||||
#ifdef ENTROPY_STATS
|
||||
cpi,
|
||||
tree_update_hist_8x8,
|
||||
#endif
|
||||
cpi->frame_coef_probs_8x8,
|
||||
cpi->common.fc.coef_probs_8x8,
|
||||
cpi->frame_branch_ct_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);
|
||||
cpi->frame_hybrid_branch_ct_8x8,
|
||||
BLOCK_TYPES_8X8);
|
||||
}
|
||||
|
||||
if (cpi->common.txfm_mode > ALLOW_8X8) {
|
||||
update_coef_probs_common(bc,
|
||||
#ifdef ENTROPY_STATS
|
||||
cpi,
|
||||
tree_update_hist_16x16,
|
||||
#endif
|
||||
cpi->frame_coef_probs_16x16,
|
||||
cpi->common.fc.coef_probs_16x16,
|
||||
cpi->frame_branch_ct_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);
|
||||
cpi->frame_hybrid_branch_ct_16x16,
|
||||
BLOCK_TYPES_16X16);
|
||||
}
|
||||
|
||||
#if CONFIG_TX32X32 && CONFIG_SUPERBLOCKS
|
||||
if (cpi->common.txfm_mode > ALLOW_16X16) {
|
||||
update_coef_probs_common(bc,
|
||||
#ifdef ENTROPY_STATS
|
||||
cpi,
|
||||
tree_update_hist_32x32,
|
||||
#endif
|
||||
cpi->frame_coef_probs_32x32,
|
||||
cpi->common.fc.coef_probs_32x32,
|
||||
cpi->frame_branch_ct_32x32);
|
||||
cpi->frame_branch_ct_32x32,
|
||||
BLOCK_TYPES_32X32);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -2223,12 +2159,18 @@ void vp9_pack_bitstream(VP9_COMP *cpi, unsigned char *dest,
|
|||
|
||||
vp9_clear_system_state(); // __asm emms;
|
||||
|
||||
vp9_copy(cpi->common.fc.pre_coef_probs, cpi->common.fc.coef_probs);
|
||||
vp9_copy(cpi->common.fc.pre_hybrid_coef_probs, cpi->common.fc.hybrid_coef_probs);
|
||||
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_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);
|
||||
#if CONFIG_TX32X32 && CONFIG_SUPERBLOCKS
|
||||
vp9_copy(cpi->common.fc.pre_coef_probs_32x32,
|
||||
cpi->common.fc.coef_probs_32x32);
|
||||
|
@ -2362,27 +2304,22 @@ void vp9_pack_bitstream(VP9_COMP *cpi, unsigned char *dest,
|
|||
}
|
||||
|
||||
#ifdef ENTROPY_STATS
|
||||
void print_tree_update_probs() {
|
||||
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;
|
||||
FILE *f = fopen("coefupdprob.h", "w");
|
||||
int Sum;
|
||||
fprintf(f, "\n/* Update probabilities for token entropy tree. */\n\n");
|
||||
|
||||
fprintf(f, "const vp9_prob\n"
|
||||
"vp9_coef_update_probs[BLOCK_TYPES]\n"
|
||||
" [COEF_BANDS]\n"
|
||||
" [PREV_COEF_CONTEXTS]\n"
|
||||
" [ENTROPY_NODES] = {\n");
|
||||
for (i = 0; i < BLOCK_TYPES; i++) {
|
||||
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, "%3ld, ",
|
||||
get_binary_prob(tree_update_hist[i][j][k][l][0],
|
||||
tree_update_hist[i][j][k][l][1]));
|
||||
fprintf(f, "%3d, ",
|
||||
get_binary_prob(tree_update_hist[i][j][k][l][0],
|
||||
tree_update_hist[i][j][k][l][1]));
|
||||
}
|
||||
fprintf(f, "},\n");
|
||||
}
|
||||
|
@ -2391,56 +2328,33 @@ void print_tree_update_probs() {
|
|||
fprintf(f, " },\n");
|
||||
}
|
||||
fprintf(f, "};\n");
|
||||
}
|
||||
|
||||
fprintf(f, "const vp9_prob\n"
|
||||
"vp9_coef_update_probs_8x8[BLOCK_TYPES_8X8]\n"
|
||||
" [COEF_BANDS]\n"
|
||||
" [PREV_COEF_CONTEXTS]\n"
|
||||
" [ENTROPY_NODES] = {\n");
|
||||
for (i = 0; i < BLOCK_TYPES_8X8; 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 < MAX_ENTROPY_TOKENS - 1; l++) {
|
||||
fprintf(f, "%3ld, ",
|
||||
get_binary_prob(tree_update_hist_8x8[i][j][k][l][0],
|
||||
tree_update_hist_8x8[i][j][k][l][1]));
|
||||
}
|
||||
fprintf(f, "},\n");
|
||||
}
|
||||
fprintf(f, " },\n");
|
||||
}
|
||||
fprintf(f, " },\n");
|
||||
}
|
||||
void print_tree_update_probs() {
|
||||
FILE *f = fopen("coefupdprob.h", "w");
|
||||
fprintf(f, "\n/* Update probabilities for token entropy tree. */\n\n");
|
||||
|
||||
fprintf(f, "const vp9_prob\n"
|
||||
"vp9_coef_update_probs_16x16[BLOCK_TYPES_16X16]\n"
|
||||
" [COEF_BANDS]\n"
|
||||
" [PREV_COEF_CONTEXTS]\n"
|
||||
" [ENTROPY_NODES] = {\n");
|
||||
for (i = 0; i < BLOCK_TYPES_16X16; 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 < MAX_ENTROPY_TOKENS - 1; l++) {
|
||||
fprintf(f, "%3ld, ",
|
||||
get_binary_prob(tree_update_hist_16x16[i][j][k][l][0],
|
||||
tree_update_hist_16x16[i][j][k][l][1]));
|
||||
}
|
||||
fprintf(f, "},\n");
|
||||
}
|
||||
fprintf(f, " },\n");
|
||||
}
|
||||
fprintf(f, " },\n");
|
||||
}
|
||||
print_tree_update_for_type(f, tree_update_hist_4x4, BLOCK_TYPES_4X4,
|
||||
"vp9_coef_update_probs_4x4[BLOCK_TYPES_4X4]");
|
||||
print_tree_update_for_type(f, hybrid_tree_update_hist_4x4, BLOCK_TYPES_4X4,
|
||||
"vp9_coef_update_probs_4x4[BLOCK_TYPES_4X4]");
|
||||
print_tree_update_for_type(f, tree_update_hist_8x8, BLOCK_TYPES_8X8,
|
||||
"vp9_coef_update_probs_8x8[BLOCK_TYPES_8X8]");
|
||||
print_tree_update_for_type(f, hybrid_tree_update_hist_8x8, BLOCK_TYPES_8X8,
|
||||
"vp9_coef_update_probs_8x8[BLOCK_TYPES_8X8]");
|
||||
print_tree_update_for_type(f, tree_update_hist_16x16, BLOCK_TYPES_16X16,
|
||||
"vp9_coef_update_probs_16x16[BLOCK_TYPES_16X16]");
|
||||
print_tree_update_for_type(f, hybrid_tree_update_hist_16x16,
|
||||
BLOCK_TYPES_16X16,
|
||||
"vp9_coef_update_probs_16x16[BLOCK_TYPES_16X16]");
|
||||
#if CONFIG_TX32X32
|
||||
print_tree_update_for_type(f, tree_update_hist_32x32, BLOCK_TYPES_32X32,
|
||||
"vp9_coef_update_probs_32x32[BLOCK_TYPES_32X32]");
|
||||
#endif
|
||||
|
||||
fclose(f);
|
||||
f = fopen("treeupdate.bin", "wb");
|
||||
fwrite(tree_update_hist, sizeof(tree_update_hist), 1, f);
|
||||
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);
|
||||
fclose(f);
|
||||
|
|
|
@ -173,10 +173,8 @@ typedef struct macroblock {
|
|||
|
||||
unsigned char *active_ptr;
|
||||
|
||||
unsigned int token_costs[TX_SIZE_MAX_SB][BLOCK_TYPES][COEF_BANDS]
|
||||
[PREV_COEF_CONTEXTS][MAX_ENTROPY_TOKENS];
|
||||
unsigned int hybrid_token_costs[TX_SIZE_MAX_SB][BLOCK_TYPES][COEF_BANDS]
|
||||
[PREV_COEF_CONTEXTS][MAX_ENTROPY_TOKENS];
|
||||
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];
|
||||
|
||||
int optimize;
|
||||
|
||||
|
|
|
@ -1485,8 +1485,8 @@ static void encode_frame_internal(VP9_COMP *cpi) {
|
|||
xd->prev_mode_info_context = cm->prev_mi;
|
||||
|
||||
vp9_zero(cpi->NMVcount);
|
||||
vp9_zero(cpi->coef_counts);
|
||||
vp9_zero(cpi->hybrid_coef_counts);
|
||||
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);
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#ifdef ENTROPY_STATS
|
||||
extern void init_mv_ref_counts();
|
||||
extern void accum_mv_refs(MB_PREDICTION_MODE, const int near_mv_ref_cts[4]);
|
||||
void print_mode_context(void);
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -2223,11 +2223,11 @@ void vp9_remove_compressor(VP9_PTR *ptr) {
|
|||
fprintf(fmode, "[VP9_KF_BINTRAMODES][VP9_KF_BINTRAMODES]"
|
||||
"[VP9_KF_BINTRAMODES] =\n{\n");
|
||||
|
||||
for (i = 0; i < VP8_KF_BINTRAMODES; i++) {
|
||||
for (i = 0; i < VP9_KF_BINTRAMODES; i++) {
|
||||
|
||||
fprintf(fmode, " { // Above Mode : %d\n", i);
|
||||
|
||||
for (j = 0; j < VP8_KF_BINTRAMODES; j++) {
|
||||
for (j = 0; j < VP9_KF_BINTRAMODES; j++) {
|
||||
|
||||
fprintf(fmode, " {");
|
||||
|
||||
|
@ -3691,10 +3691,12 @@ static void encode_frame_to_data_rate
|
|||
#endif
|
||||
|
||||
update_reference_frames(cm);
|
||||
vp9_copy(cpi->common.fc.coef_counts, cpi->coef_counts);
|
||||
vp9_copy(cpi->common.fc.hybrid_coef_counts, cpi->hybrid_coef_counts);
|
||||
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.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);
|
||||
|
|
|
@ -94,24 +94,14 @@ typedef struct {
|
|||
// 0 = BPRED, ZERO_MV, MV, SPLIT
|
||||
signed char last_mode_lf_deltas[MAX_MODE_LF_DELTAS];
|
||||
|
||||
vp9_prob coef_probs[BLOCK_TYPES]
|
||||
[COEF_BANDS][PREV_COEF_CONTEXTS][ENTROPY_NODES];
|
||||
vp9_prob hybrid_coef_probs[BLOCK_TYPES]
|
||||
[COEF_BANDS][PREV_COEF_CONTEXTS][ENTROPY_NODES];
|
||||
|
||||
vp9_prob coef_probs_8x8[BLOCK_TYPES_8X8]
|
||||
[COEF_BANDS][PREV_COEF_CONTEXTS][ENTROPY_NODES];
|
||||
vp9_prob hybrid_coef_probs_8x8[BLOCK_TYPES_8X8]
|
||||
[COEF_BANDS][PREV_COEF_CONTEXTS][ENTROPY_NODES];
|
||||
|
||||
vp9_prob coef_probs_16x16[BLOCK_TYPES_16X16]
|
||||
[COEF_BANDS][PREV_COEF_CONTEXTS][ENTROPY_NODES];
|
||||
vp9_prob hybrid_coef_probs_16x16[BLOCK_TYPES_16X16]
|
||||
[COEF_BANDS][PREV_COEF_CONTEXTS][ENTROPY_NODES];
|
||||
|
||||
vp9_coeff_probs coef_probs_4x4[BLOCK_TYPES_4X4];
|
||||
vp9_coeff_probs hybrid_coef_probs_4x4[BLOCK_TYPES_4X4];
|
||||
vp9_coeff_probs coef_probs_8x8[BLOCK_TYPES_8X8];
|
||||
vp9_coeff_probs hybrid_coef_probs_8x8[BLOCK_TYPES_8X8];
|
||||
vp9_coeff_probs coef_probs_16x16[BLOCK_TYPES_16X16];
|
||||
vp9_coeff_probs hybrid_coef_probs_16x16[BLOCK_TYPES_16X16];
|
||||
#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
|
||||
|
||||
#if CONFIG_SUPERBLOCKS
|
||||
|
@ -598,31 +588,31 @@ typedef struct VP9_COMP {
|
|||
|
||||
nmv_context_counts NMVcount;
|
||||
|
||||
unsigned int coef_counts [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS]; /* for this frame */
|
||||
vp9_prob frame_coef_probs [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
|
||||
unsigned int frame_branch_ct [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES][2];
|
||||
unsigned int hybrid_coef_counts [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS]; /* for this frame */
|
||||
vp9_prob frame_hybrid_coef_probs [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
|
||||
unsigned int frame_hybrid_branch_ct [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES][2];
|
||||
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];
|
||||
vp9_coeff_probs frame_hybrid_coef_probs_4x4[BLOCK_TYPES_4X4];
|
||||
vp9_coeff_stats frame_hybrid_branch_ct_4x4[BLOCK_TYPES_4X4];
|
||||
|
||||
unsigned int coef_counts_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS]; /* for this frame */
|
||||
vp9_prob frame_coef_probs_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
|
||||
unsigned int frame_branch_ct_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES][2];
|
||||
unsigned int hybrid_coef_counts_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS]; /* for this frame */
|
||||
vp9_prob frame_hybrid_coef_probs_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
|
||||
unsigned int frame_hybrid_branch_ct_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES][2];
|
||||
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];
|
||||
vp9_coeff_probs frame_hybrid_coef_probs_8x8[BLOCK_TYPES_8X8];
|
||||
vp9_coeff_stats frame_hybrid_branch_ct_8x8[BLOCK_TYPES_8X8];
|
||||
|
||||
unsigned int coef_counts_16x16 [BLOCK_TYPES_16X16] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS]; /* for this frame */
|
||||
vp9_prob frame_coef_probs_16x16 [BLOCK_TYPES_16X16] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
|
||||
unsigned int frame_branch_ct_16x16 [BLOCK_TYPES_16X16] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES][2];
|
||||
unsigned int hybrid_coef_counts_16x16 [BLOCK_TYPES_16X16] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS]; /* for this frame */
|
||||
vp9_prob frame_hybrid_coef_probs_16x16 [BLOCK_TYPES_16X16] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
|
||||
unsigned int frame_hybrid_branch_ct_16x16 [BLOCK_TYPES_16X16] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES][2];
|
||||
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];
|
||||
vp9_coeff_probs frame_hybrid_coef_probs_16x16[BLOCK_TYPES_16X16];
|
||||
vp9_coeff_stats frame_hybrid_branch_ct_16x16[BLOCK_TYPES_16X16];
|
||||
|
||||
#if CONFIG_SUPERBLOCKS && CONFIG_TX32X32
|
||||
unsigned int coef_counts_32x32 [BLOCK_TYPES_32X32] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS]; /* for this frame */
|
||||
vp9_prob frame_coef_probs_32x32 [BLOCK_TYPES_32X32] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
|
||||
unsigned int frame_branch_ct_32x32 [BLOCK_TYPES_32X32] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES][2];
|
||||
#if CONFIG_TX32X32 && CONFIG_SUPERBLOCKS
|
||||
vp9_coeff_count coef_counts_32x32[BLOCK_TYPES_32X32];
|
||||
vp9_coeff_probs frame_coef_probs_32x32[BLOCK_TYPES_32X32];
|
||||
vp9_coeff_stats frame_branch_ct_32x32[BLOCK_TYPES_32X32];
|
||||
#endif
|
||||
|
||||
int gfu_boost;
|
||||
|
|
|
@ -169,8 +169,8 @@ void vp9_save_coding_context(VP9_COMP *cpi) {
|
|||
vp9_copy(cc->last_ref_lf_deltas, xd->last_ref_lf_deltas);
|
||||
vp9_copy(cc->last_mode_lf_deltas, xd->last_mode_lf_deltas);
|
||||
|
||||
vp9_copy(cc->coef_probs, cm->fc.coef_probs);
|
||||
vp9_copy(cc->hybrid_coef_probs, cm->fc.hybrid_coef_probs);
|
||||
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);
|
||||
|
@ -231,8 +231,8 @@ void vp9_restore_coding_context(VP9_COMP *cpi) {
|
|||
vp9_copy(xd->last_ref_lf_deltas, cc->last_ref_lf_deltas);
|
||||
vp9_copy(xd->last_mode_lf_deltas, cc->last_mode_lf_deltas);
|
||||
|
||||
vp9_copy(cm->fc.coef_probs, cc->coef_probs);
|
||||
vp9_copy(cm->fc.hybrid_coef_probs, cc->hybrid_coef_probs);
|
||||
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);
|
||||
|
|
|
@ -239,10 +239,9 @@ const MODE_DEFINITION vp9_mode_order[MAX_MODES] = {
|
|||
};
|
||||
#endif
|
||||
|
||||
static void fill_token_costs(
|
||||
unsigned int (*c)[COEF_BANDS][PREV_COEF_CONTEXTS][MAX_ENTROPY_TOKENS],
|
||||
const vp9_prob(*p)[COEF_BANDS][PREV_COEF_CONTEXTS][ENTROPY_NODES],
|
||||
int block_type_counts) {
|
||||
static void fill_token_costs(vp9_coeff_count *c,
|
||||
vp9_coeff_probs *p,
|
||||
int block_type_counts) {
|
||||
int i, j, k;
|
||||
|
||||
for (i = 0; i < block_type_counts; i++)
|
||||
|
@ -370,41 +369,24 @@ void vp9_initialize_rd_consts(VP9_COMP *cpi, int QIndex) {
|
|||
}
|
||||
}
|
||||
|
||||
fill_token_costs(
|
||||
cpi->mb.token_costs[TX_4X4],
|
||||
(const vp9_prob( *)[8][PREV_COEF_CONTEXTS][11]) cpi->common.fc.coef_probs,
|
||||
BLOCK_TYPES);
|
||||
fill_token_costs(
|
||||
cpi->mb.hybrid_token_costs[TX_4X4],
|
||||
(const vp9_prob( *)[8][PREV_COEF_CONTEXTS][11])
|
||||
cpi->common.fc.hybrid_coef_probs,
|
||||
BLOCK_TYPES);
|
||||
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);
|
||||
|
||||
fill_token_costs(
|
||||
cpi->mb.token_costs[TX_8X8],
|
||||
(const vp9_prob( *)[8][PREV_COEF_CONTEXTS][11]) cpi->common.fc.coef_probs_8x8,
|
||||
BLOCK_TYPES_8X8);
|
||||
fill_token_costs(
|
||||
cpi->mb.hybrid_token_costs[TX_8X8],
|
||||
(const vp9_prob( *)[8][PREV_COEF_CONTEXTS][11])
|
||||
cpi->common.fc.hybrid_coef_probs_8x8,
|
||||
BLOCK_TYPES_8X8);
|
||||
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);
|
||||
|
||||
fill_token_costs(
|
||||
cpi->mb.token_costs[TX_16X16],
|
||||
(const vp9_prob(*)[8][PREV_COEF_CONTEXTS][11]) cpi->common.fc.coef_probs_16x16,
|
||||
BLOCK_TYPES_16X16);
|
||||
fill_token_costs(
|
||||
cpi->mb.hybrid_token_costs[TX_16X16],
|
||||
(const vp9_prob(*)[8][PREV_COEF_CONTEXTS][11])
|
||||
cpi->common.fc.hybrid_coef_probs_16x16,
|
||||
BLOCK_TYPES_16X16);
|
||||
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);
|
||||
|
||||
#if CONFIG_TX32X32 && CONFIG_SUPERBLOCKS
|
||||
fill_token_costs(
|
||||
cpi->mb.token_costs[TX_32X32],
|
||||
(const vp9_prob(*)[8][PREV_COEF_CONTEXTS][11]) cpi->common.fc.coef_probs_32x32,
|
||||
BLOCK_TYPES_32X32);
|
||||
fill_token_costs(cpi->mb.token_costs[TX_32X32],
|
||||
cpi->common.fc.coef_probs_32x32, BLOCK_TYPES_32X32);
|
||||
#endif
|
||||
|
||||
/*rough estimate for costing*/
|
||||
|
|
|
@ -25,27 +25,25 @@
|
|||
compressions, then generating vp9_context.c = initial stats. */
|
||||
|
||||
#ifdef ENTROPY_STATS
|
||||
INT64 context_counters[BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];
|
||||
INT64 hybrid_context_counters[BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];
|
||||
vp9_coeff_accum context_counters_4x4[BLOCK_TYPES_4X4];
|
||||
vp9_coeff_accum hybrid_context_counters_4x4[BLOCK_TYPES_4X4];
|
||||
vp9_coeff_accum context_counters_8x8[BLOCK_TYPES_8X8];
|
||||
vp9_coeff_accum hybrid_context_counters_8x8[BLOCK_TYPES_8X8];
|
||||
vp9_coeff_accum context_counters_16x16[BLOCK_TYPES_16X16];
|
||||
vp9_coeff_accum hybrid_context_counters_16x16[BLOCK_TYPES_16X16];
|
||||
#if CONFIG_TX32X32
|
||||
vp9_coeff_accum context_counters_32x32[BLOCK_TYPES_32X32];
|
||||
#endif
|
||||
|
||||
INT64 context_counters_8x8[BLOCK_TYPES_8X8] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];
|
||||
INT64 hybrid_context_counters_8x8[BLOCK_TYPES_8X8] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];
|
||||
|
||||
INT64 context_counters_16x16[BLOCK_TYPES_16X16] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];
|
||||
INT64 hybrid_context_counters_16x16[BLOCK_TYPES_16X16] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];
|
||||
|
||||
extern unsigned int tree_update_hist[BLOCK_TYPES][COEF_BANDS]
|
||||
[PREV_COEF_CONTEXTS][ENTROPY_NODES][2];
|
||||
extern unsigned int hybrid_tree_update_hist[BLOCK_TYPES][COEF_BANDS]
|
||||
[PREV_COEF_CONTEXTS][ENTROPY_NODES][2];
|
||||
extern unsigned int tree_update_hist_8x8[BLOCK_TYPES_8X8][COEF_BANDS]
|
||||
[PREV_COEF_CONTEXTS][ENTROPY_NODES] [2];
|
||||
extern unsigned int hybrid_tree_update_hist_8x8[BLOCK_TYPES_8X8][COEF_BANDS]
|
||||
[PREV_COEF_CONTEXTS][ENTROPY_NODES] [2];
|
||||
extern unsigned int tree_update_hist_16x16[BLOCK_TYPES_16X16][COEF_BANDS]
|
||||
[PREV_COEF_CONTEXTS][ENTROPY_NODES] [2];
|
||||
extern unsigned int hybrid_tree_update_hist_16x16[BLOCK_TYPES_16X16][COEF_BANDS]
|
||||
[PREV_COEF_CONTEXTS][ENTROPY_NODES] [2];
|
||||
extern vp9_coeff_stats tree_update_hist_4x4[BLOCK_TYPES_4X4];
|
||||
extern vp9_coeff_stats hybrid_tree_update_hist_4x4[BLOCK_TYPES_4X4];
|
||||
extern vp9_coeff_stats tree_update_hist_8x8[BLOCK_TYPES_8X8];
|
||||
extern vp9_coeff_stats hybrid_tree_update_hist_8x8[BLOCK_TYPES_8X8];
|
||||
extern vp9_coeff_stats tree_update_hist_16x16[BLOCK_TYPES_16X16];
|
||||
extern vp9_coeff_stats hybrid_tree_update_hist_16x16[BLOCK_TYPES_16X16];
|
||||
#if CONFIG_TX32X32
|
||||
extern vp9_coeff_stats tree_update_hist_32x32[BLOCK_TYPES_32X32];
|
||||
#endif
|
||||
#endif /* ENTROPY_STATS */
|
||||
|
||||
static TOKENVALUE dct_value_tokens[DCT_MAX_VALUE * 2];
|
||||
|
@ -123,8 +121,8 @@ static void tokenize_b(VP9_COMP *cpi,
|
|||
int seg_eob;
|
||||
int segment_id = xd->mode_info_context->mbmi.segment_id;
|
||||
const int *bands, *scan;
|
||||
unsigned int (*counts)[COEF_BANDS][PREV_COEF_CONTEXTS][MAX_ENTROPY_TOKENS];
|
||||
vp9_prob (*probs)[COEF_BANDS][PREV_COEF_CONTEXTS][ENTROPY_NODES];
|
||||
vp9_coeff_count *counts;
|
||||
vp9_coeff_probs *probs;
|
||||
const TX_TYPE tx_type = (type == PLANE_TYPE_Y_WITH_DC) ?
|
||||
get_tx_type(xd, b) : DCT_DCT;
|
||||
|
||||
|
@ -136,16 +134,16 @@ static void tokenize_b(VP9_COMP *cpi,
|
|||
bands = vp9_coef_bands;
|
||||
scan = vp9_default_zig_zag1d;
|
||||
if (tx_type != DCT_DCT) {
|
||||
counts = cpi->hybrid_coef_counts;
|
||||
probs = cpi->common.fc.hybrid_coef_probs;
|
||||
counts = cpi->hybrid_coef_counts_4x4;
|
||||
probs = cpi->common.fc.hybrid_coef_probs_4x4;
|
||||
if (tx_type == ADST_DCT) {
|
||||
scan = vp9_row_scan;
|
||||
} else if (tx_type == DCT_ADST) {
|
||||
scan = vp9_col_scan;
|
||||
}
|
||||
} else {
|
||||
counts = cpi->coef_counts;
|
||||
probs = cpi->common.fc.coef_probs;
|
||||
counts = cpi->coef_counts_4x4;
|
||||
probs = cpi->common.fc.coef_probs_4x4;
|
||||
}
|
||||
break;
|
||||
case TX_8X8:
|
||||
|
@ -514,40 +512,70 @@ void vp9_tokenize_mb(VP9_COMP *cpi,
|
|||
void init_context_counters(void) {
|
||||
FILE *f = fopen("context.bin", "rb");
|
||||
if (!f) {
|
||||
vpx_memset(context_counters, 0, sizeof(context_counters));
|
||||
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));
|
||||
#if CONFIG_TX32X32
|
||||
vpx_memset(context_counters_32x32, 0, sizeof(context_counters_32x32));
|
||||
#endif
|
||||
} else {
|
||||
fread(context_counters, sizeof(context_counters), 1, f);
|
||||
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);
|
||||
#if CONFIG_TX32X32
|
||||
fread(context_counters_32x32, sizeof(context_counters_32x32), 1, f);
|
||||
#endif
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
f = fopen("treeupdate.bin", "rb");
|
||||
if (!f) {
|
||||
vpx_memset(tree_update_hist, 0, sizeof(tree_update_hist));
|
||||
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));
|
||||
#if CONFIG_TX32X32
|
||||
vpx_memset(tree_update_hist_32x32, 0, sizeof(tree_update_hist_32x32));
|
||||
#endif
|
||||
} else {
|
||||
fread(tree_update_hist, sizeof(tree_update_hist), 1, f);
|
||||
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);
|
||||
#if CONFIG_TX32X32
|
||||
fread(tree_update_hist_32x32, sizeof(tree_update_hist_32x32), 1, f);
|
||||
#endif
|
||||
fclose(f);
|
||||
}
|
||||
}
|
||||
|
||||
void print_context_counters() {
|
||||
static void print_counter(FILE *f, vp9_coeff_accum *context_counters,
|
||||
int block_types, const char *header) {
|
||||
int type, band, pt, t;
|
||||
FILE *f = fopen("vp9_context.c", "w");
|
||||
|
||||
fprintf(f, "#include \"vp9_entropy.h\"\n");
|
||||
fprintf(f, "\n/* *** GENERATED FILE: DO NOT EDIT *** */\n\n");
|
||||
fprintf(f, "static const unsigned int\n"
|
||||
"vp9_default_coef_counts[BLOCK_TYPES]\n"
|
||||
" [COEF_BANDS]\n"
|
||||
" [PREV_COEF_CONTEXTS]\n"
|
||||
" [MAX_ENTROPY_TOKENS]={\n");
|
||||
fprintf(f, "static const vp9_coeff_count %s = {\n", header);
|
||||
|
||||
# define Comma( X) (X? ",":"")
|
||||
type = 0;
|
||||
|
@ -564,6 +592,7 @@ void print_context_counters() {
|
|||
do {
|
||||
const INT64 x = context_counters [type] [band] [pt] [t];
|
||||
const int y = (int) x;
|
||||
|
||||
assert(x == (INT64) y); /* no overflow handling yet */
|
||||
fprintf(f, "%s %d", Comma(t), y);
|
||||
} while (++t < MAX_ENTROPY_TOKENS);
|
||||
|
@ -572,78 +601,16 @@ void print_context_counters() {
|
|||
fprintf(f, "\n }");
|
||||
} while (++band < COEF_BANDS);
|
||||
fprintf(f, "\n }");
|
||||
} while (++type < BLOCK_TYPES);
|
||||
} while (++type < block_types);
|
||||
fprintf(f, "\n};\n");
|
||||
}
|
||||
|
||||
fprintf(f, "static const unsigned int\nvp9_default_coef_counts_8x8"
|
||||
"[BLOCK_TYPES_8X8] [COEF_BANDS]"
|
||||
"[PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS] = {");
|
||||
type = 0;
|
||||
do {
|
||||
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;
|
||||
do {
|
||||
fprintf(f, "%s\n {", Comma(pt));
|
||||
t = 0;
|
||||
do {
|
||||
const INT64 x = context_counters_8x8 [type] [band] [pt] [t];
|
||||
const int y = (int) x;
|
||||
static void print_probs(FILE *f, vp9_coeff_accum *context_counters,
|
||||
int block_types, const char *header) {
|
||||
int type, band, pt, t;
|
||||
|
||||
assert(x == (INT64) y); /* no overflow handling yet */
|
||||
fprintf(f, "%s %d", Comma(t), y);
|
||||
fprintf(f, "static const vp9_coeff_probs %s = {\n", header);
|
||||
|
||||
} while (++t < MAX_ENTROPY_TOKENS);
|
||||
|
||||
fprintf(f, "}");
|
||||
} while (++pt < PREV_COEF_CONTEXTS);
|
||||
|
||||
fprintf(f, "\n }");
|
||||
|
||||
} while (++band < COEF_BANDS);
|
||||
|
||||
fprintf(f, "\n }");
|
||||
} while (++type < BLOCK_TYPES_8X8);
|
||||
fprintf(f, "\n};\n");
|
||||
|
||||
fprintf(f, "static const unsigned int\nvp9_default_coef_counts_16x16"
|
||||
"[BLOCK_TYPES_16X16] [COEF_BANDS]"
|
||||
"[PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS] = {");
|
||||
type = 0;
|
||||
do {
|
||||
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;
|
||||
do {
|
||||
fprintf(f, "%s\n {", Comma(pt));
|
||||
t = 0;
|
||||
do {
|
||||
const INT64 x = context_counters_16x16 [type] [band] [pt] [t];
|
||||
const int y = (int) x;
|
||||
|
||||
assert(x == (INT64) 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 (++type < BLOCK_TYPES_16X16);
|
||||
fprintf(f, "\n};\n");
|
||||
|
||||
fprintf(f, "static const vp9_prob\n"
|
||||
"vp9_default_coef_probs[BLOCK_TYPES] [COEF_BANDS] \n"
|
||||
"[PREV_COEF_CONTEXTS] [ENTROPY_NODES] = {");
|
||||
type = 0;
|
||||
do {
|
||||
fprintf(f, "%s\n { /* block Type %d */", Comma(type), type);
|
||||
|
@ -655,17 +622,18 @@ void print_context_counters() {
|
|||
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, 256, 1);
|
||||
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,
|
||||
256, 1);
|
||||
fprintf(f, "%s\n {", Comma(pt));
|
||||
|
||||
t = 0;
|
||||
do {
|
||||
fprintf(f, "%s %d", Comma(t), coef_probs[t]);
|
||||
|
||||
} while (++t < ENTROPY_NODES);
|
||||
|
||||
fprintf(f, "}");
|
||||
|
@ -673,81 +641,67 @@ void print_context_counters() {
|
|||
fprintf(f, "\n }");
|
||||
} while (++band < COEF_BANDS);
|
||||
fprintf(f, "\n }");
|
||||
} while (++type < BLOCK_TYPES);
|
||||
} while (++type < block_types);
|
||||
fprintf(f, "\n};\n");
|
||||
}
|
||||
|
||||
fprintf(f, "static const vp9_prob\n"
|
||||
"vp9_default_coef_probs_8x8[BLOCK_TYPES_8X8] [COEF_BANDS]\n"
|
||||
"[PREV_COEF_CONTEXTS] [ENTROPY_NODES] = {");
|
||||
type = 0;
|
||||
do {
|
||||
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;
|
||||
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_8x8[type] [band] [pt] [t];
|
||||
vp9_tree_probs_from_distribution(
|
||||
MAX_ENTROPY_TOKENS, vp9_coef_encodings, vp9_coef_tree,
|
||||
coef_probs, branch_ct, coef_counts, 256, 1);
|
||||
fprintf(f, "%s\n {", Comma(pt));
|
||||
void print_context_counters() {
|
||||
FILE *f = fopen("vp9_context.c", "w");
|
||||
|
||||
t = 0;
|
||||
do {
|
||||
fprintf(f, "%s %d", 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 (++type < BLOCK_TYPES_8X8);
|
||||
fprintf(f, "\n};\n");
|
||||
fprintf(f, "#include \"vp9_entropy.h\"\n");
|
||||
fprintf(f, "\n/* *** GENERATED FILE: DO NOT EDIT *** */\n\n");
|
||||
|
||||
fprintf(f, "static const vp9_prob\n"
|
||||
"vp9_default_coef_probs_16x16[BLOCK_TYPES_16X16] [COEF_BANDS]\n"
|
||||
"[PREV_COEF_CONTEXTS] [ENTROPY_NODES] = {");
|
||||
type = 0;
|
||||
do {
|
||||
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;
|
||||
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_16x16[type] [band] [pt] [t];
|
||||
vp9_tree_probs_from_distribution(
|
||||
MAX_ENTROPY_TOKENS, vp9_coef_encodings, vp9_coef_tree,
|
||||
coef_probs, branch_ct, coef_counts, 256, 1);
|
||||
fprintf(f, "%s\n {", Comma(pt));
|
||||
/* print counts */
|
||||
print_counter(f, context_counters_4x4, BLOCK_TYPES_4X4,
|
||||
"vp9_default_coef_counts_4x4[BLOCK_TYPES_4X4]");
|
||||
print_counter(f, hybrid_context_counters_4x4, BLOCK_TYPES_4X4,
|
||||
"vp9_default_hybrid_coef_counts_4x4[BLOCK_TYPES_4X4]");
|
||||
print_counter(f, context_counters_8x8, BLOCK_TYPES_8X8,
|
||||
"vp9_default_coef_counts_8x8[BLOCK_TYPES_8X8]");
|
||||
print_counter(f, hybrid_context_counters_8x8, BLOCK_TYPES_8X8,
|
||||
"vp9_default_hybrid_coef_counts_8x8[BLOCK_TYPES_8X8]");
|
||||
print_counter(f, context_counters_16x16, BLOCK_TYPES_16X16,
|
||||
"vp9_default_coef_counts_16x16[BLOCK_TYPES_16X16]");
|
||||
print_counter(f, hybrid_context_counters_16x16, BLOCK_TYPES_16X16,
|
||||
"vp9_default_hybrid_coef_counts_16x16[BLOCK_TYPES_16X16]");
|
||||
#if CONFIG_TX32X32
|
||||
print_counter(f, context_counters_32x32, BLOCK_TYPES_32X32,
|
||||
"vp9_default_coef_counts_32x32[BLOCK_TYPES_32X32]");
|
||||
#endif
|
||||
|
||||
t = 0;
|
||||
do {
|
||||
fprintf(f, "%s %d", 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 (++type < BLOCK_TYPES_16X16);
|
||||
fprintf(f, "\n};\n");
|
||||
/* print coefficient probabilities */
|
||||
print_probs(f, context_counters_4x4, BLOCK_TYPES_4X4,
|
||||
"vp9_default_coef_probs_4x4[BLOCK_TYPES_4X4]");
|
||||
print_probs(f, hybrid_context_counters_4x4, BLOCK_TYPES_4X4,
|
||||
"vp9_default_hybrid_coef_probs_4x4[BLOCK_TYPES_4X4]");
|
||||
print_probs(f, context_counters_8x8, BLOCK_TYPES_8X8,
|
||||
"vp9_default_coef_probs_8x8[BLOCK_TYPES_8X8]");
|
||||
print_probs(f, hybrid_context_counters_8x8, BLOCK_TYPES_8X8,
|
||||
"vp9_default_hybrid_coef_probs_8x8[BLOCK_TYPES_8X8]");
|
||||
print_probs(f, context_counters_16x16, BLOCK_TYPES_16X16,
|
||||
"vp9_default_coef_probs_16x16[BLOCK_TYPES_16X16]");
|
||||
print_probs(f, hybrid_context_counters_16x16, BLOCK_TYPES_16X16,
|
||||
"vp9_default_hybrid_coef_probs_16x16[BLOCK_TYPES_16X16]");
|
||||
#if CONFIG_TX32X32
|
||||
print_probs(f, context_counters_32x32, BLOCK_TYPES_32X32,
|
||||
"vp9_default_coef_probs_32x32[BLOCK_TYPES_32X32]");
|
||||
#endif
|
||||
|
||||
fclose(f);
|
||||
|
||||
f = fopen("context.bin", "wb");
|
||||
fwrite(context_counters, sizeof(context_counters), 1, f);
|
||||
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);
|
||||
#if CONFIG_TX32X32
|
||||
fwrite(context_counters_32x32, sizeof(context_counters_32x32), 1, f);
|
||||
#endif
|
||||
fclose(f);
|
||||
}
|
||||
#endif
|
||||
|
@ -766,8 +720,8 @@ static __inline void stuff_b(VP9_COMP *cpi,
|
|||
TX_SIZE tx_size,
|
||||
int dry_run) {
|
||||
const int *bands;
|
||||
unsigned int (*counts)[COEF_BANDS][PREV_COEF_CONTEXTS][MAX_ENTROPY_TOKENS];
|
||||
vp9_prob (*probs)[COEF_BANDS][PREV_COEF_CONTEXTS][ENTROPY_NODES];
|
||||
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) ?
|
||||
|
@ -779,11 +733,11 @@ static __inline void stuff_b(VP9_COMP *cpi,
|
|||
case TX_4X4:
|
||||
bands = vp9_coef_bands;
|
||||
if (tx_type != DCT_DCT) {
|
||||
counts = cpi->hybrid_coef_counts;
|
||||
probs = cpi->common.fc.hybrid_coef_probs;
|
||||
counts = cpi->hybrid_coef_counts_4x4;
|
||||
probs = cpi->common.fc.hybrid_coef_probs_4x4;
|
||||
} else {
|
||||
counts = cpi->coef_counts;
|
||||
probs = cpi->common.fc.coef_probs;
|
||||
counts = cpi->coef_counts_4x4;
|
||||
probs = cpi->common.fc.coef_probs_4x4;
|
||||
}
|
||||
break;
|
||||
case TX_8X8:
|
||||
|
|
|
@ -29,6 +29,9 @@ typedef struct {
|
|||
unsigned char skip_eob_node;
|
||||
} TOKENEXTRA;
|
||||
|
||||
typedef INT64 vp9_coeff_accum[COEF_BANDS][PREV_COEF_CONTEXTS]
|
||||
[MAX_ENTROPY_TOKENS];
|
||||
|
||||
extern int vp9_mby_is_skippable_4x4(MACROBLOCKD *xd, int has_y2_block);
|
||||
extern int vp9_mbuv_is_skippable_4x4(MACROBLOCKD *xd);
|
||||
extern int vp9_mby_is_skippable_8x8(MACROBLOCKD *xd, int has_y2_block);
|
||||
|
@ -62,12 +65,14 @@ extern void vp9_fix_contexts_sb(MACROBLOCKD *xd);
|
|||
void init_context_counters();
|
||||
void print_context_counters();
|
||||
|
||||
extern INT64 context_counters[BLOCK_TYPES][COEF_BANDS]
|
||||
[PREV_COEF_CONTEXTS][MAX_ENTROPY_TOKENS];
|
||||
extern INT64 context_counters_8x8[BLOCK_TYPES_8X8][COEF_BANDS]
|
||||
[PREV_COEF_CONTEXTS][MAX_ENTROPY_TOKENS];
|
||||
extern INT64 context_counters_16x16[BLOCK_TYPES_16X16][COEF_BANDS]
|
||||
[PREV_COEF_CONTEXTS][MAX_ENTROPY_TOKENS];
|
||||
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_32x32[BLOCK_TYPES_32X32];
|
||||
|
||||
extern vp9_coeff_accum hybrid_context_counters_4x4[BLOCK_TYPES_4X4];
|
||||
extern vp9_coeff_accum hybrid_context_counters_8x8[BLOCK_TYPES_8X8];
|
||||
extern vp9_coeff_accum hybrid_context_counters_16x16[BLOCK_TYPES_16X16];
|
||||
#endif
|
||||
|
||||
extern const int *vp9_dct_value_cost_ptr;
|
||||
|
|
Загрузка…
Ссылка в новой задаче