Commit 3f5d60b3 authored by Deb Mukherjee's avatar Deb Mukherjee
Browse files

Entropy coding for hybrid transform

Separates the entropy coding context models for 4x4, 8x8 and 16x16
ADST variants.

There is a small improvement for HD (hd/std-hd) by about 0.1-0.2%.
Results on derf/yt are about the same, probably because there is not
enough statistics.

Results may improve somewhat once the initial probability tables are
updated for the hybrid transforms which is coming soon.

Change-Id: Ic7c0c62dacc68ef551054fdb575be8b8507d32a8
parent 70e21afb
This diff is collapsed.
...@@ -28,6 +28,8 @@ typedef vp8_prob Prob; ...@@ -28,6 +28,8 @@ typedef vp8_prob Prob;
#include "coefupdateprobs.h" #include "coefupdateprobs.h"
const int vp8_i8x8_block[4] = {0, 2, 8, 10};
DECLARE_ALIGNED(16, const unsigned char, vp8_norm[256]) = { DECLARE_ALIGNED(16, const unsigned char, vp8_norm[256]) = {
0, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 0, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
...@@ -208,13 +210,26 @@ vp8_extra_bit_struct vp8_extra_bits[12] = { ...@@ -208,13 +210,26 @@ vp8_extra_bit_struct vp8_extra_bits[12] = {
void vp8_default_coef_probs(VP8_COMMON *pc) { void vp8_default_coef_probs(VP8_COMMON *pc) {
vpx_memcpy(pc->fc.coef_probs, default_coef_probs, vpx_memcpy(pc->fc.coef_probs, default_coef_probs,
sizeof(pc->fc.coef_probs)); sizeof(pc->fc.coef_probs));
#if CONFIG_HYBRIDTRANSFORM
vpx_memcpy(pc->fc.hybrid_coef_probs, default_hybrid_coef_probs,
sizeof(pc->fc.hybrid_coef_probs));
#endif
vpx_memcpy(pc->fc.coef_probs_8x8, vp8_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));
#if CONFIG_HYBRIDTRANSFORM8X8
vpx_memcpy(pc->fc.hybrid_coef_probs_8x8, default_hybrid_coef_probs_8x8,
sizeof(pc->fc.hybrid_coef_probs_8x8));
#endif
#if CONFIG_TX16X16 || CONFIG_HYBRIDTRANSFORM16X16 #if CONFIG_TX16X16
vpx_memcpy(pc->fc.coef_probs_16x16, vp8_default_coef_probs_16x16, vpx_memcpy(pc->fc.coef_probs_16x16, default_coef_probs_16x16,
sizeof(pc->fc.coef_probs_16x16)); sizeof(pc->fc.coef_probs_16x16));
#if CONFIG_HYBRIDTRANSFORM16X16
vpx_memcpy(pc->fc.hybrid_coef_probs_16x16,
default_hybrid_coef_probs_16x16,
sizeof(pc->fc.hybrid_coef_probs_16x16));
#endif
#endif #endif
} }
...@@ -263,7 +278,8 @@ void vp8_adapt_coef_probs(VP8_COMMON *cm) { ...@@ -263,7 +278,8 @@ void vp8_adapt_coef_probs(VP8_COMMON *cm) {
printf(" {\n"); printf(" {\n");
for (k = 0; k < PREV_COEF_CONTEXTS; ++k) { for (k = 0; k < PREV_COEF_CONTEXTS; ++k) {
printf(" {"); printf(" {");
for (t = 0; t < MAX_ENTROPY_TOKENS; ++t) printf("%d, ", cm->fc.coef_counts[i][j][k][t]); for (t = 0; t < MAX_ENTROPY_TOKENS; ++t)
printf("%d, ", cm->fc.coef_counts[i][j][k][t]);
printf("},\n"); printf("},\n");
} }
printf(" },\n"); printf(" },\n");
...@@ -280,7 +296,26 @@ void vp8_adapt_coef_probs(VP8_COMMON *cm) { ...@@ -280,7 +296,26 @@ void vp8_adapt_coef_probs(VP8_COMMON *cm) {
printf(" {\n"); printf(" {\n");
for (k = 0; k < PREV_COEF_CONTEXTS; ++k) { for (k = 0; k < PREV_COEF_CONTEXTS; ++k) {
printf(" {"); printf(" {");
for (t = 0; t < MAX_ENTROPY_TOKENS; ++t) printf("%d, ", cm->fc.coef_counts_8x8[i][j][k][t]); for (t = 0; t < MAX_ENTROPY_TOKENS; ++t)
printf("%d, ", cm->fc.coef_counts_8x8[i][j][k][t]);
printf("},\n");
}
printf(" },\n");
}
printf(" },\n");
}
printf("};\n");
printf("static const unsigned int\nhybrid_coef_counts"
"[BLOCK_TYPES] [COEF_BANDS]"
"[PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS] = {\n");
for (i = 0; i < BLOCK_TYPES; ++i) {
printf(" {\n");
for (j = 0; j < COEF_BANDS; ++j) {
printf(" {\n");
for (k = 0; k < PREV_COEF_CONTEXTS; ++k) {
printf(" {");
for (t = 0; t < MAX_ENTROPY_TOKENS; ++t)
printf("%d, ", cm->fc.hybrid_coef_counts[i][j][k][t]);
printf("},\n"); printf("},\n");
} }
printf(" },\n"); printf(" },\n");
...@@ -313,6 +348,30 @@ void vp8_adapt_coef_probs(VP8_COMMON *cm) { ...@@ -313,6 +348,30 @@ void vp8_adapt_coef_probs(VP8_COMMON *cm) {
} }
} }
#if CONFIG_HYBRIDTRANSFORM
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;
vp8_tree_probs_from_distribution(
MAX_ENTROPY_TOKENS, vp8_coef_encodings, vp8_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;
}
}
#endif
for (i = 0; i < BLOCK_TYPES_8X8; ++i) for (i = 0; i < BLOCK_TYPES_8X8; ++i)
for (j = 0; j < COEF_BANDS; ++j) for (j = 0; j < COEF_BANDS; ++j)
for (k = 0; k < PREV_COEF_CONTEXTS; ++k) { for (k = 0; k < PREV_COEF_CONTEXTS; ++k) {
...@@ -335,7 +394,32 @@ void vp8_adapt_coef_probs(VP8_COMMON *cm) { ...@@ -335,7 +394,32 @@ void vp8_adapt_coef_probs(VP8_COMMON *cm) {
} }
} }
#if CONFIG_TX16X16 || CONFIG_HYBRIDTRANSFORM16X16 #if CONFIG_HYBRIDTRANSFORM8X8
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;
vp8_tree_probs_from_distribution(
MAX_ENTROPY_TOKENS, vp8_coef_encodings, vp8_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;
}
}
#endif
#if CONFIG_TX16X16
for (i = 0; i < BLOCK_TYPES_16X16; ++i) for (i = 0; i < BLOCK_TYPES_16X16; ++i)
for (j = 0; j < COEF_BANDS; ++j) for (j = 0; j < COEF_BANDS; ++j)
for (k = 0; k < PREV_COEF_CONTEXTS; ++k) { for (k = 0; k < PREV_COEF_CONTEXTS; ++k) {
...@@ -349,12 +433,36 @@ void vp8_adapt_coef_probs(VP8_COMMON *cm) { ...@@ -349,12 +433,36 @@ void vp8_adapt_coef_probs(VP8_COMMON *cm) {
count = branch_ct[t][0] + branch_ct[t][1]; count = branch_ct[t][0] + branch_ct[t][1];
count = count > count_sat ? count_sat : count; count = count > count_sat ? count_sat : count;
factor = (update_factor * count / count_sat); factor = (update_factor * count / count_sat);
prob = ((int)cm->fc.pre_coef_probs_16x16[i][j][k][t] * (256 - factor) + prob = ((int)cm->fc.pre_coef_probs_16x16[i][j][k][t] *
(256 - factor) +
(int)coef_probs[t] * factor + 128) >> 8; (int)coef_probs[t] * factor + 128) >> 8;
if (prob <= 0) cm->fc.coef_probs_16x16[i][j][k][t] = 1; 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 if (prob > 255) cm->fc.coef_probs_16x16[i][j][k][t] = 255;
else cm->fc.coef_probs_16x16[i][j][k][t] = prob; else cm->fc.coef_probs_16x16[i][j][k][t] = prob;
} }
} }
#if CONFIG_HYBRIDTRANSFORM16X16
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;
vp8_tree_probs_from_distribution(
MAX_ENTROPY_TOKENS, vp8_coef_encodings, vp8_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;
}
}
#endif
#endif #endif
} }
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
//#define SUBMVREF_COUNT 5 //#define SUBMVREF_COUNT 5
//#define VP8_NUMMBSPLITS 4 //#define VP8_NUMMBSPLITS 4
extern const int vp8_i8x8_block[4];
/* Coefficient token alphabet */ /* Coefficient token alphabet */
#define ZERO_TOKEN 0 /* 0 Extra Bits 0+0 */ #define ZERO_TOKEN 0 /* 0 Extra Bits 0+0 */
...@@ -97,8 +99,6 @@ extern DECLARE_ALIGNED(16, const int, vp8_coef_bands_16x16[256]); ...@@ -97,8 +99,6 @@ extern DECLARE_ALIGNED(16, const int, vp8_coef_bands_16x16[256]);
#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 */
#define COEFUPDATETYPE 1 /* coef update type to use (1/2) */
extern DECLARE_ALIGNED(16, const unsigned char, vp8_prev_token_class[MAX_ENTROPY_TOKENS]); extern DECLARE_ALIGNED(16, const unsigned char, vp8_prev_token_class[MAX_ENTROPY_TOKENS]);
......
...@@ -51,10 +51,20 @@ typedef struct frame_contexts { ...@@ -51,10 +51,20 @@ typedef struct frame_contexts {
vp8_prob sub_mv_ref_prob [SUBMVREF_COUNT][VP8_SUBMVREFS - 1]; vp8_prob sub_mv_ref_prob [SUBMVREF_COUNT][VP8_SUBMVREFS - 1];
vp8_prob mbsplit_prob [VP8_NUMMBSPLITS - 1]; vp8_prob mbsplit_prob [VP8_NUMMBSPLITS - 1];
vp8_prob coef_probs [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES]; vp8_prob coef_probs [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
#if CONFIG_HYBRIDTRANSFORM
vp8_prob hybrid_coef_probs [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
#endif
vp8_prob coef_probs_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES]; vp8_prob coef_probs_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
#if CONFIG_TX16X16 || CONFIG_HYBRIDTRANSFORM16X16 #if CONFIG_HYBRIDTRANSFORM8X8
vp8_prob hybrid_coef_probs_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
#endif
#if CONFIG_TX16X16
vp8_prob coef_probs_16x16 [BLOCK_TYPES_16X16] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES]; vp8_prob coef_probs_16x16 [BLOCK_TYPES_16X16] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
#if CONFIG_HYBRIDTRANSFORM16X16
vp8_prob hybrid_coef_probs_16x16 [BLOCK_TYPES_16X16] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
#endif
#endif #endif
#if CONFIG_NEWMVENTROPY #if CONFIG_NEWMVENTROPY
nmv_context nmvc; nmv_context nmvc;
nmv_context pre_nmvc; nmv_context pre_nmvc;
...@@ -79,20 +89,50 @@ typedef struct frame_contexts { ...@@ -79,20 +89,50 @@ typedef struct frame_contexts {
vp8_prob pre_coef_probs [BLOCK_TYPES] [COEF_BANDS] vp8_prob pre_coef_probs [BLOCK_TYPES] [COEF_BANDS]
[PREV_COEF_CONTEXTS] [ENTROPY_NODES]; [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
#if CONFIG_HYBRIDTRANSFORM
vp8_prob pre_hybrid_coef_probs [BLOCK_TYPES] [COEF_BANDS]
[PREV_COEF_CONTEXTS] [ENTROPY_NODES];
#endif
vp8_prob pre_coef_probs_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS] vp8_prob pre_coef_probs_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS]
[PREV_COEF_CONTEXTS] [ENTROPY_NODES]; [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
#if CONFIG_TX16X16 || CONFIG_HYBRIDTRANSFORM16X16 #if CONFIG_HYBRIDTRANSFORM8X8
vp8_prob pre_hybrid_coef_probs_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS]
[PREV_COEF_CONTEXTS] [ENTROPY_NODES];
#endif
#if CONFIG_TX16X16
vp8_prob pre_coef_probs_16x16 [BLOCK_TYPES_16X16] [COEF_BANDS] vp8_prob pre_coef_probs_16x16 [BLOCK_TYPES_16X16] [COEF_BANDS]
[PREV_COEF_CONTEXTS] [ENTROPY_NODES]; [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
#if CONFIG_HYBRIDTRANSFORM16X16
vp8_prob pre_hybrid_coef_probs_16x16 [BLOCK_TYPES_16X16] [COEF_BANDS]
[PREV_COEF_CONTEXTS] [ENTROPY_NODES];
#endif #endif
#endif
unsigned int coef_counts [BLOCK_TYPES] [COEF_BANDS] unsigned int coef_counts [BLOCK_TYPES] [COEF_BANDS]
[PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS]; [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];
#if CONFIG_HYBRIDTRANSFORM
unsigned int hybrid_coef_counts [BLOCK_TYPES] [COEF_BANDS]
[PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];
#endif
unsigned int coef_counts_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS] unsigned int coef_counts_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS]
[PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS]; [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];
#if CONFIG_TX16X16 || CONFIG_HYBRIDTRANSFORM16X16 #if CONFIG_HYBRIDTRANSFORM8X8
unsigned int hybrid_coef_counts_8x8 [BLOCK_TYPES_8X8] [COEF_BANDS]
[PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];
#endif
#if CONFIG_TX16X16
unsigned int coef_counts_16x16 [BLOCK_TYPES_16X16] [COEF_BANDS] unsigned int coef_counts_16x16 [BLOCK_TYPES_16X16] [COEF_BANDS]
[PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS]; [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];
#if CONFIG_HYBRIDTRANSFORM16X16
unsigned int hybrid_coef_counts_16x16 [BLOCK_TYPES_16X16] [COEF_BANDS]
[PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];
#endif #endif
#endif
#if CONFIG_NEWMVENTROPY #if CONFIG_NEWMVENTROPY
nmv_context_counts NMVcount; nmv_context_counts NMVcount;
#else #else
......
...@@ -207,7 +207,6 @@ static void skip_recon_mb(VP8D_COMP *pbi, MACROBLOCKD *xd) { ...@@ -207,7 +207,6 @@ static void skip_recon_mb(VP8D_COMP *pbi, MACROBLOCKD *xd) {
} }
} }
extern const int vp8_i8x8_block[4];
static void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd, static void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd,
unsigned int mb_col) { unsigned int mb_col) {
int eobtotal = 0; int eobtotal = 0;
...@@ -931,6 +930,7 @@ static void init_frame(VP8D_COMP *pbi) { ...@@ -931,6 +930,7 @@ static void init_frame(VP8D_COMP *pbi) {
} }
#if 0
static void read_coef_probs2(VP8D_COMP *pbi) { static void read_coef_probs2(VP8D_COMP *pbi) {
const vp8_prob grpupd = 192; const vp8_prob grpupd = 192;
int i, j, k, l; int i, j, k, l;
...@@ -973,6 +973,7 @@ static void read_coef_probs2(VP8D_COMP *pbi) { ...@@ -973,6 +973,7 @@ static void read_coef_probs2(VP8D_COMP *pbi) {
} }
} }
} }
#endif
static void read_coef_probs(VP8D_COMP *pbi) { static void read_coef_probs(VP8D_COMP *pbi) {
int i, j, k, l; int i, j, k, l;
...@@ -998,6 +999,27 @@ static void read_coef_probs(VP8D_COMP *pbi) { ...@@ -998,6 +999,27 @@ static void read_coef_probs(VP8D_COMP *pbi) {
} }
} }
} }
#if CONFIG_HYBRIDTRANSFORM
{
if (vp8_read_bit(bc)) {
/* read coef probability tree */
for (i = 0; i < BLOCK_TYPES; i++)
for (j = !i; j < COEF_BANDS; j++)
for (k = 0; k < PREV_COEF_CONTEXTS; k++) {
if (k >= 3 && ((i == 0 && j == 1) ||
(i > 0 && j == 0)))
continue;
for (l = 0; l < ENTROPY_NODES; l++) {
vp8_prob *const p = pc->fc.hybrid_coef_probs [i][j][k] + l;
if (vp8_read(bc, COEF_UPDATE_PROB)) {
*p = read_prob_diff_update(bc, *p);
}
}
}
}
}
#endif
if (pbi->common.txfm_mode == ALLOW_8X8 && vp8_read_bit(bc)) { if (pbi->common.txfm_mode == ALLOW_8X8 && vp8_read_bit(bc)) {
// read coef probability tree // read coef probability tree
...@@ -1017,8 +1039,28 @@ static void read_coef_probs(VP8D_COMP *pbi) { ...@@ -1017,8 +1039,28 @@ static void read_coef_probs(VP8D_COMP *pbi) {
} }
} }
} }
#if CONFIG_HYBRIDTRANSFORM8X8
if (pbi->common.txfm_mode == ALLOW_8X8 && vp8_read_bit(bc)) {
// read coef probability tree
for (i = 0; i < BLOCK_TYPES_8X8; i++)
for (j = !i; j < COEF_BANDS; j++)
for (k = 0; k < PREV_COEF_CONTEXTS; k++) {
if (k >= 3 && ((i == 0 && j == 1) ||
(i > 0 && j == 0)))
continue;
for (l = 0; l < ENTROPY_NODES; l++) {
#if CONFIG_TX16X16 || CONFIG_HYBRIDTRANSFORM16X16 vp8_prob *const p = pc->fc.hybrid_coef_probs_8x8 [i][j][k] + l;
if (vp8_read(bc, COEF_UPDATE_PROB_8X8)) {
*p = read_prob_diff_update(bc, *p);
}
}
}
}
#endif
#if CONFIG_TX16X16
// 16x16 // 16x16
if (vp8_read_bit(bc)) { if (vp8_read_bit(bc)) {
// read coef probability tree // read coef probability tree
...@@ -1038,6 +1080,26 @@ static void read_coef_probs(VP8D_COMP *pbi) { ...@@ -1038,6 +1080,26 @@ static void read_coef_probs(VP8D_COMP *pbi) {
} }
} }
} }
#if CONFIG_HYBRIDTRANSFORM16X16
if (vp8_read_bit(bc)) {
// read coef probability tree
for (i = 0; i < BLOCK_TYPES_16X16; ++i)
for (j = !i; j < COEF_BANDS; ++j)
for (k = 0; k < PREV_COEF_CONTEXTS; ++k) {
if (k >= 3 && ((i == 0 && j == 1) ||
(i > 0 && j == 0)))
continue;
for (l = 0; l < ENTROPY_NODES; ++l) {
vp8_prob *const p = pc->fc.hybrid_coef_probs_16x16[i][j][k] + l;
if (vp8_read(bc, COEF_UPDATE_PROB_16X16)) {
*p = read_prob_diff_update(bc, *p);
}
}
}
}
#endif
#endif #endif
} }
...@@ -1399,10 +1461,25 @@ int vp8_decode_frame(VP8D_COMP *pbi) { ...@@ -1399,10 +1461,25 @@ int vp8_decode_frame(VP8D_COMP *pbi) {
fclose(z); fclose(z);
} }
vp8_copy(pbi->common.fc.pre_coef_probs, pbi->common.fc.coef_probs); vp8_copy(pbi->common.fc.pre_coef_probs,
vp8_copy(pbi->common.fc.pre_coef_probs_8x8, pbi->common.fc.coef_probs_8x8); pbi->common.fc.coef_probs);
#if CONFIG_TX16X16 || CONFIG_HYBRIDTRANSFORM16X16 #if CONFIG_HYBRIDTRANSFORM
vp8_copy(pbi->common.fc.pre_coef_probs_16x16, pbi->common.fc.coef_probs_16x16); vp8_copy(pbi->common.fc.pre_hybrid_coef_probs,
pbi->common.fc.hybrid_coef_probs);
#endif
vp8_copy(pbi->common.fc.pre_coef_probs_8x8,
pbi->common.fc.coef_probs_8x8);
#if CONFIG_HYBRIDTRANSFORM8X8
vp8_copy(pbi->common.fc.pre_hybrid_coef_probs_8x8,
pbi->common.fc.hybrid_coef_probs_8x8);
#endif
#if CONFIG_TX16X16
vp8_copy(pbi->common.fc.pre_coef_probs_16x16,
pbi->common.fc.coef_probs_16x16);
#if CONFIG_HYBRIDTRANSFORM16X16
vp8_copy(pbi->common.fc.pre_hybrid_coef_probs_16x16,
pbi->common.fc.hybrid_coef_probs_16x16);
#endif
#endif #endif
vp8_copy(pbi->common.fc.pre_ymode_prob, pbi->common.fc.ymode_prob); vp8_copy(pbi->common.fc.pre_ymode_prob, pbi->common.fc.ymode_prob);
vp8_copy(pbi->common.fc.pre_uv_mode_prob, pbi->common.fc.uv_mode_prob); vp8_copy(pbi->common.fc.pre_uv_mode_prob, pbi->common.fc.uv_mode_prob);
...@@ -1417,9 +1494,18 @@ int vp8_decode_frame(VP8D_COMP *pbi) { ...@@ -1417,9 +1494,18 @@ int vp8_decode_frame(VP8D_COMP *pbi) {
vp8_copy(pbi->common.fc.pre_mvc_hp, pbi->common.fc.mvc_hp); vp8_copy(pbi->common.fc.pre_mvc_hp, pbi->common.fc.mvc_hp);
#endif #endif
vp8_zero(pbi->common.fc.coef_counts); vp8_zero(pbi->common.fc.coef_counts);
#if CONFIG_HYBRIDTRANSFORM
vp8_zero(pbi->common.fc.hybrid_coef_counts);
#endif
vp8_zero(pbi->common.fc.coef_counts_8x8); vp8_zero(pbi->common.fc.coef_counts_8x8);
#if CONFIG_TX16X16 || CONFIG_HYBRIDTRANSFORM16X16 #if CONFIG_HYBRIDTRANSFORM8X8
vp8_zero(pbi->common.fc.hybrid_coef_counts_8x8);
#endif
#if CONFIG_TX16X16
vp8_zero(pbi->common.fc.coef_counts_16x16); vp8_zero(pbi->common.fc.coef_counts_16x16);
#if CONFIG_HYBRIDTRANSFORM16X16
vp8_zero(pbi->common.fc.hybrid_coef_counts_16x16);
#endif
#endif #endif
vp8_zero(pbi->common.fc.ymode_counts); vp8_zero(pbi->common.fc.ymode_counts);
vp8_zero(pbi->common.fc.uv_mode_counts); vp8_zero(pbi->common.fc.uv_mode_counts);
...@@ -1435,11 +1521,8 @@ int vp8_decode_frame(VP8D_COMP *pbi) { ...@@ -1435,11 +1521,8 @@ int vp8_decode_frame(VP8D_COMP *pbi) {
#endif #endif
vp8_zero(pbi->common.fc.mv_ref_ct); vp8_zero(pbi->common.fc.mv_ref_ct);
vp8_zero(pbi->common.fc.mv_ref_ct_a); vp8_zero(pbi->common.fc.mv_ref_ct_a);
#if COEFUPDATETYPE == 2
read_coef_probs2(pbi);
#else
read_coef_probs(pbi); read_coef_probs(pbi);
#endif
vpx_memcpy(&xd->pre, &pc->yv12_fb[pc->lst_fb_idx], sizeof(YV12_BUFFER_CONFIG)); vpx_memcpy(&xd->pre, &pc->yv12_fb[pc->lst_fb_idx], sizeof(YV12_BUFFER_CONFIG));
vpx_memcpy(&xd->dst, &pc->yv12_fb[pc->new_fb_idx], sizeof(YV12_BUFFER_CONFIG)); vpx_memcpy(&xd->dst, &pc->yv12_fb[pc->new_fb_idx], sizeof(YV12_BUFFER_CONFIG));
......
...@@ -141,33 +141,26 @@ int get_token(int v) { ...@@ -141,33 +141,26 @@ int get_token(int v) {
#if CONFIG_HYBRIDTRANSFORM #if CONFIG_HYBRIDTRANSFORM
void static count_tokens_adaptive_scan(const MACROBLOCKD *xd, INT16 *qcoeff_ptr, void static count_tokens_adaptive_scan(const MACROBLOCKD *xd, INT16 *qcoeff_ptr,
int block, int type, ENTROPY_CONTEXT *a, int block, int type,
ENTROPY_CONTEXT *l, int eob, int seg_eob, TX_TYPE tx_type,
ENTROPY_CONTEXT *a, ENTROPY_CONTEXT *l,
int eob, int seg_eob,
FRAME_CONTEXT *fc) { FRAME_CONTEXT *fc) {
int c, pt, token, band; int c, pt, token, band;
const int *scan; const int *scan;
int QIndex = xd->q_index; switch(tx_type) {
int active_ht = (QIndex < ACTIVE_HT) && case ADST_DCT :
(xd->mode_info_context->mbmi.mode == B_PRED) && scan = vp8_row_scan;
(type == PLANE_TYPE_Y_WITH_DC); break;
if(active_ht) {
switch(xd->block[block].bmi.as_mode.tx_type) {
case ADST_DCT :
scan = vp8_row_scan;
break;
case DCT_ADST : case DCT_ADST :
scan = vp8_col_scan