Commit d01357bb authored by Deb Mukherjee's avatar Deb Mukherjee

New b-intra mode where direction is contextual

Preliminary patch on a new 4x4 intra mode B_CONTEXT_PRED where the
dominant direction from the context is used to encode. Various decoder
changes are needed to support decoding of B_CONTEXT_PRED in conjunction
with hybrid transforms since the scan order and tokenization depends on
the actual direction of prediction obtained from the context. Currently
the traditional directional modes are used in conjunction with the
B_CONTEXT_PRED, which also seems to provide the best results.

The gains are small - in the 0.1% range.

Change-Id: I5a7ea80b5218f42a9c0dfb42d3f79a68c7f0cdc2
parent 3f7182cb
......@@ -245,6 +245,7 @@ EXPERIMENT_LIST="
subpelrefmv
new_mvref
implicit_segmentation
newbintramodes
"
CONFIG_LIST="
external_build
......
......@@ -149,8 +149,8 @@ typedef enum {
B_DC_PRED, /* average of above and left pixels */
B_TM_PRED,
B_VE_PRED, /* vertical prediction */
B_HE_PRED, /* horizontal prediction */
B_VE_PRED, /* vertical prediction */
B_HE_PRED, /* horizontal prediction */
B_LD_PRED,
B_RD_PRED,
......@@ -159,6 +159,9 @@ typedef enum {
B_VL_PRED,
B_HD_PRED,
B_HU_PRED,
#if CONFIG_NEWBINTRAMODES
B_CONTEXT_PRED,
#endif
LEFT4X4,
ABOVE4X4,
......@@ -168,9 +171,19 @@ typedef enum {
B_MODE_COUNT
} B_PREDICTION_MODE;
#define VP9_BINTRAMODES (B_HU_PRED + 1) /* 10 */
#define VP9_BINTRAMODES (LEFT4X4)
#define VP9_SUBMVREFS (1 + NEW4X4 - LEFT4X4)
#if CONFIG_NEWBINTRAMODES
/* The number of B_PRED intra modes that are replaced by B_CONTEXT_PRED */
#define CONTEXT_PRED_REPLACEMENTS 0
#define VP9_KF_BINTRAMODES (VP9_BINTRAMODES - 1)
#define VP9_NKF_BINTRAMODES (VP9_BINTRAMODES - CONTEXT_PRED_REPLACEMENTS)
#else
#define VP9_KF_BINTRAMODES (VP9_BINTRAMODES) /* 10 */
#define VP9_NKF_BINTRAMODES (VP9_BINTRAMODES) /* 10 */
#endif
typedef enum {
PARTITIONING_16X8 = 0,
PARTITIONING_8X16,
......@@ -187,9 +200,11 @@ union b_mode_info {
struct {
B_PREDICTION_MODE first;
TX_TYPE tx_type;
#if CONFIG_COMP_INTRA_PRED
B_PREDICTION_MODE second;
#endif
#if CONFIG_NEWBINTRAMODES
B_PREDICTION_MODE context;
#endif
} as_mode;
struct {
......@@ -443,6 +458,12 @@ static TX_TYPE txfm_map(B_PREDICTION_MODE bmode) {
tx_type = DCT_ADST;
break;
#if CONFIG_NEWBINTRAMODES
case B_CONTEXT_PRED:
assert(0);
break;
#endif
default :
tx_type = DCT_DCT;
break;
......@@ -454,7 +475,11 @@ static TX_TYPE get_tx_type_4x4(const MACROBLOCKD *xd, const BLOCKD *b) {
TX_TYPE tx_type = DCT_DCT;
if (xd->mode_info_context->mbmi.mode == B_PRED &&
xd->q_index < ACTIVE_HT) {
tx_type = txfm_map(b->bmi.as_mode.first);
tx_type = txfm_map(
#if CONFIG_NEWBINTRAMODES
b->bmi.as_mode.first == B_CONTEXT_PRED ? b->bmi.as_mode.context :
#endif
b->bmi.as_mode.first);
}
return tx_type;
}
......
This diff is collapsed.
......@@ -17,6 +17,9 @@
#define SUBMVREF_COUNT 5
#define VP9_NUMMBSPLITS 4
#if CONFIG_COMP_INTRA_PRED
#define DEFAULT_COMP_INTRA_PROB 32
#endif
typedef const int vp9_mbsplit[16];
......@@ -32,11 +35,12 @@ extern const vp9_prob vp9_sub_mv_ref_prob[VP9_SUBMVREFS - 1];
extern const vp9_prob vp9_sub_mv_ref_prob2[SUBMVREF_COUNT][VP9_SUBMVREFS - 1];
extern const unsigned int vp9_kf_default_bmode_counts[VP9_BINTRAMODES]
[VP9_BINTRAMODES]
[VP9_BINTRAMODES];
extern const unsigned int vp9_kf_default_bmode_counts[VP9_KF_BINTRAMODES]
[VP9_KF_BINTRAMODES]
[VP9_KF_BINTRAMODES];
extern const vp9_tree_index vp9_bmode_tree[];
extern const vp9_tree_index vp9_kf_bmode_tree[];
extern const vp9_tree_index vp9_ymode_tree[];
extern const vp9_tree_index vp9_kf_ymode_tree[];
......@@ -48,7 +52,8 @@ extern const vp9_tree_index vp9_mv_ref_tree[];
extern const vp9_tree_index vp9_sb_mv_ref_tree[];
extern const vp9_tree_index vp9_sub_mv_ref_tree[];
extern struct vp9_token_struct vp9_bmode_encodings[VP9_BINTRAMODES];
extern struct vp9_token_struct vp9_bmode_encodings[VP9_NKF_BINTRAMODES];
extern struct vp9_token_struct vp9_kf_bmode_encodings[VP9_KF_BINTRAMODES];
extern struct vp9_token_struct vp9_ymode_encodings[VP9_YMODES];
extern struct vp9_token_struct vp9_sb_kf_ymode_encodings[VP9_I32X32_MODES];
extern struct vp9_token_struct vp9_kf_ymode_encodings[VP9_YMODES];
......@@ -76,10 +81,11 @@ extern void vp9_accum_mv_refs(struct VP9Common *pc,
MB_PREDICTION_MODE m,
const int ct[4]);
void vp9_default_bmode_probs(vp9_prob dest[VP9_BINTRAMODES - 1]);
void vp9_default_bmode_probs(vp9_prob dest[VP9_NKF_BINTRAMODES - 1]);
void vp9_kf_default_bmode_probs(vp9_prob dest[VP9_BINTRAMODES][VP9_BINTRAMODES]
[VP9_BINTRAMODES - 1]);
void vp9_kf_default_bmode_probs(vp9_prob dest[VP9_KF_BINTRAMODES]
[VP9_KF_BINTRAMODES]
[VP9_KF_BINTRAMODES - 1]);
void vp9_adapt_mode_probs(struct VP9Common *);
......
......@@ -159,12 +159,12 @@ void vp9_find_near_mvs
}
vp9_prob *vp9_mv_ref_probs(VP9_COMMON *pc,
vp9_prob p[VP9_MVREFS - 1], const int near_mv_ref_ct[4]
) {
p[0] = pc->fc.vp8_mode_contexts [near_mv_ref_ct[0]] [0];
p[1] = pc->fc.vp8_mode_contexts [near_mv_ref_ct[1]] [1];
p[2] = pc->fc.vp8_mode_contexts [near_mv_ref_ct[2]] [2];
p[3] = pc->fc.vp8_mode_contexts [near_mv_ref_ct[3]] [3];
vp9_prob p[VP9_MVREFS - 1],
const int near_mv_ref_ct[4]) {
p[0] = pc->fc.vp9_mode_contexts[near_mv_ref_ct[0]][0];
p[1] = pc->fc.vp9_mode_contexts[near_mv_ref_ct[1]][1];
p[2] = pc->fc.vp9_mode_contexts[near_mv_ref_ct[2]][2];
p[3] = pc->fc.vp9_mode_contexts[near_mv_ref_ct[3]][3];
return p;
}
......
......@@ -11,7 +11,9 @@
#include "entropymode.h"
const unsigned int vp9_kf_default_bmode_counts[VP9_BINTRAMODES][VP9_BINTRAMODES][VP9_BINTRAMODES] = {
const unsigned int vp9_kf_default_bmode_counts[VP9_KF_BINTRAMODES]
[VP9_KF_BINTRAMODES]
[VP9_KF_BINTRAMODES] = {
{
/*Above Mode : 0*/
{ 43438, 2195, 470, 316, 615, 171, 217, 412, 124, 160, }, /* left_mode 0 */
......
......@@ -44,12 +44,12 @@ void vp9_initialize_common(void);
#define COMP_PRED_CONTEXTS 2
typedef struct frame_contexts {
vp9_prob bmode_prob [VP9_BINTRAMODES - 1];
vp9_prob ymode_prob [VP9_YMODES - 1]; /* interframe intra mode probs */
vp9_prob uv_mode_prob [VP9_YMODES][VP9_UV_MODES - 1];
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 bmode_prob[VP9_NKF_BINTRAMODES - 1];
vp9_prob ymode_prob[VP9_YMODES - 1]; /* interframe intra mode probs */
vp9_prob uv_mode_prob[VP9_YMODES][VP9_UV_MODES - 1];
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];
......@@ -59,18 +59,18 @@ typedef struct frame_contexts {
nmv_context nmvc;
nmv_context pre_nmvc;
vp9_prob pre_bmode_prob [VP9_BINTRAMODES - 1];
vp9_prob pre_ymode_prob [VP9_YMODES - 1]; /* interframe intra mode probs */
vp9_prob pre_uv_mode_prob [VP9_YMODES][VP9_UV_MODES - 1];
vp9_prob pre_i8x8_mode_prob [VP9_I8X8_MODES - 1];
vp9_prob pre_sub_mv_ref_prob [SUBMVREF_COUNT][VP9_SUBMVREFS - 1];
vp9_prob pre_mbsplit_prob [VP9_NUMMBSPLITS - 1];
unsigned int bmode_counts [VP9_BINTRAMODES];
unsigned int ymode_counts [VP9_YMODES]; /* interframe intra mode probs */
unsigned int uv_mode_counts [VP9_YMODES][VP9_UV_MODES];
unsigned int i8x8_mode_counts [VP9_I8X8_MODES]; /* interframe intra mode probs */
unsigned int sub_mv_ref_counts [SUBMVREF_COUNT][VP9_SUBMVREFS];
unsigned int mbsplit_counts [VP9_NUMMBSPLITS];
vp9_prob pre_bmode_prob[VP9_NKF_BINTRAMODES - 1];
vp9_prob pre_ymode_prob[VP9_YMODES - 1]; /* interframe intra mode probs */
vp9_prob pre_uv_mode_prob[VP9_YMODES][VP9_UV_MODES - 1];
vp9_prob pre_i8x8_mode_prob[VP9_I8X8_MODES - 1];
vp9_prob pre_sub_mv_ref_prob[SUBMVREF_COUNT][VP9_SUBMVREFS - 1];
vp9_prob pre_mbsplit_prob[VP9_NUMMBSPLITS - 1];
unsigned int bmode_counts[VP9_NKF_BINTRAMODES];
unsigned int ymode_counts[VP9_YMODES]; /* interframe intra mode probs */
unsigned int uv_mode_counts[VP9_YMODES][VP9_UV_MODES];
unsigned int i8x8_mode_counts[VP9_I8X8_MODES]; /* interframe intra probs */
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];
......@@ -108,7 +108,7 @@ typedef struct frame_contexts {
int mode_context[6][4];
int mode_context_a[6][4];
int vp8_mode_contexts[6][4];
int vp9_mode_contexts[6][4];
int mv_ref_ct[6][4][2];
int mv_ref_ct_a[6][4][2];
} FRAME_CONTEXT;
......@@ -241,7 +241,9 @@ typedef struct VP9Common {
/* keyframe block modes are predicted by their above, left neighbors */
vp9_prob kf_bmode_prob [VP9_BINTRAMODES] [VP9_BINTRAMODES] [VP9_BINTRAMODES - 1];
vp9_prob kf_bmode_prob[VP9_KF_BINTRAMODES]
[VP9_KF_BINTRAMODES]
[VP9_KF_BINTRAMODES - 1];
vp9_prob kf_ymode_prob[8][VP9_YMODES - 1]; /* keyframe "" */
#if CONFIG_SUPERBLOCKS
vp9_prob sb_kf_ymode_prob[8][VP9_I32X32_MODES - 1];
......
......@@ -196,9 +196,50 @@ static void d153_predictor(uint8_t *ypred_ptr, int y_stride, int n,
}
}
static void corner_predictor(unsigned char *ypred_ptr, int y_stride, int n,
unsigned char *yabove_row,
unsigned char *yleft_col) {
int h[32], v[32], mh, mv, maxgradh, maxgradv, x, y, nx, ny;
int i, j;
int top_left = yabove_row[-1];
mh = mv = 0;
maxgradh = yabove_row[1] - top_left;
maxgradv = yleft_col[1] - top_left;
for (i = 2; i < n; ++i) {
int gh = yabove_row[i] - yabove_row[i - 2];
int gv = yleft_col[i] - yleft_col[i - 2];
if (gh > maxgradh) {
maxgradh = gh;
mh = i - 1;
}
if (gv > maxgradv) {
maxgradv = gv;
mv = i - 1;
}
}
nx = mh + mv + 3;
ny = 2 * n + 1 - nx;
x = top_left;
for (i = 0; i <= mh; ++i) x += yabove_row[i];
for (i = 0; i <= mv; ++i) x += yleft_col[i];
x += (nx >> 1);
x /= nx;
y = 0;
for (i = mh + 1; i < n; ++i) y += yabove_row[i];
for (i = mv + 1; i < n; ++i) y += yleft_col[i];
y += (ny >> 1);
y /= ny;
for (i = 0; i < n; ++i) {
for (j = 0; j < n; ++j)
ypred_ptr[j] = (i <= mh && j <= mv ? x : y);
ypred_ptr += y_stride;
}
}
void vp9_recon_intra_mbuv(MACROBLOCKD *xd) {
int i;
for (i = 16; i < 24; i += 2) {
BLOCKD *b = &xd->block[i];
vp9_recon2b(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
......
......@@ -14,5 +14,8 @@
#include "blockd.h"
extern void vp9_recon_intra_mbuv(MACROBLOCKD *xd);
extern B_PREDICTION_MODE vp9_find_dominant_direction(unsigned char *ptr,
int stride, int n);
extern B_PREDICTION_MODE vp9_find_bpred_context(BLOCKD *x);
#endif // __INC_RECONINTRA_H
......@@ -14,8 +14,146 @@
#include "reconintra.h"
#include "vpx_rtcd.h"
void vp9_intra4x4_predict_c(BLOCKD *x, int b_mode,
unsigned char *predictor) {
#if CONFIG_NEWBINTRAMODES
static int find_grad_measure(unsigned char *x, int stride, int n, int t,
int dx, int dy) {
int i, j;
int count = 0, gsum = 0, gdiv;
/* TODO: Make this code more efficient by breaking up into two loops */
for (i = -t; i < n; ++i)
for (j = -t; j < n; ++j) {
int g;
if (i >= 0 && j >= 0) continue;
if (i + dy >= 0 && j + dx >= 0) continue;
if (i + dy < -t || i + dy >= n || j + dx < -t || j + dx >= n) continue;
g = abs(x[(i + dy) * stride + j + dx] - x[i * stride + j]);
gsum += g * g;
count++;
}
gdiv = (dx * dx + dy * dy) * count;
return ((gsum << 8) + (gdiv >> 1)) / gdiv;
}
#if CONTEXT_PRED_REPLACEMENTS == 6
B_PREDICTION_MODE vp9_find_dominant_direction(
unsigned char *ptr, int stride, int n) {
int g[8], i, imin, imax;
g[1] = find_grad_measure(ptr, stride, n, 4, 2, 1);
g[2] = find_grad_measure(ptr, stride, n, 4, 1, 1);
g[3] = find_grad_measure(ptr, stride, n, 4, 1, 2);
g[5] = find_grad_measure(ptr, stride, n, 4, -1, 2);
g[6] = find_grad_measure(ptr, stride, n, 4, -1, 1);
g[7] = find_grad_measure(ptr, stride, n, 4, -2, 1);
imin = 1;
for (i = 2; i < 8; i += 1 + (i == 3))
imin = (g[i] < g[imin] ? i : imin);
imax = 1;
for (i = 2; i < 8; i += 1 + (i == 3))
imax = (g[i] > g[imax] ? i : imax);
/*
printf("%d %d %d %d %d %d = %d %d\n",
g[1], g[2], g[3], g[5], g[6], g[7], imin, imax);
*/
switch (imin) {
case 1:
return B_HD_PRED;
case 2:
return B_RD_PRED;
case 3:
return B_VR_PRED;
case 5:
return B_VL_PRED;
case 6:
return B_LD_PRED;
case 7:
return B_HU_PRED;
default:
assert(0);
}
}
#elif CONTEXT_PRED_REPLACEMENTS == 4
B_PREDICTION_MODE vp9_find_dominant_direction(
unsigned char *ptr, int stride, int n) {
int g[8], i, imin, imax;
g[1] = find_grad_measure(ptr, stride, n, 4, 2, 1);
g[3] = find_grad_measure(ptr, stride, n, 4, 1, 2);
g[5] = find_grad_measure(ptr, stride, n, 4, -1, 2);
g[7] = find_grad_measure(ptr, stride, n, 4, -2, 1);
imin = 1;
for (i = 3; i < 8; i+=2)
imin = (g[i] < g[imin] ? i : imin);
imax = 1;
for (i = 3; i < 8; i+=2)
imax = (g[i] > g[imax] ? i : imax);
/*
printf("%d %d %d %d = %d %d\n",
g[1], g[3], g[5], g[7], imin, imax);
*/
switch (imin) {
case 1:
return B_HD_PRED;
case 3:
return B_VR_PRED;
case 5:
return B_VL_PRED;
case 7:
return B_HU_PRED;
default:
assert(0);
}
}
#elif CONTEXT_PRED_REPLACEMENTS == 0
B_PREDICTION_MODE vp9_find_dominant_direction(
unsigned char *ptr, int stride, int n) {
int g[8], i, imin, imin2, imax;
g[0] = find_grad_measure(ptr, stride, n, 4, 1, 0);
g[1] = find_grad_measure(ptr, stride, n, 4, 2, 1);
g[2] = find_grad_measure(ptr, stride, n, 4, 1, 1);
g[3] = find_grad_measure(ptr, stride, n, 4, 1, 2);
g[4] = find_grad_measure(ptr, stride, n, 4, 0, 1);
g[5] = find_grad_measure(ptr, stride, n, 4, -1, 2);
g[6] = find_grad_measure(ptr, stride, n, 4, -1, 1);
g[7] = find_grad_measure(ptr, stride, n, 4, -2, 1);
imax = 0;
for (i = 1; i < 8; i++)
imax = (g[i] > g[imax] ? i : imax);
imin = 0;
for (i = 1; i < 8; i++)
imin = (g[i] < g[imin] ? i : imin);
switch (imin) {
case 0:
return B_HE_PRED;
case 1:
return B_HD_PRED;
case 2:
return B_RD_PRED;
case 3:
return B_VR_PRED;
case 4:
return B_VE_PRED;
case 5:
return B_VL_PRED;
case 6:
return B_LD_PRED;
case 7:
return B_HU_PRED;
default:
assert(0);
}
}
#endif
B_PREDICTION_MODE vp9_find_bpred_context(BLOCKD *x) {
unsigned char *ptr = *(x->base_dst) + x->dst;
int stride = x->dst_stride;
return vp9_find_dominant_direction(ptr, stride, 4);
}
#endif
void vp9_intra4x4_predict(BLOCKD *x,
int b_mode,
unsigned char *predictor) {
int i, r, c;
unsigned char *Above = *(x->base_dst) + x->dst - x->dst_stride;
......@@ -27,6 +165,11 @@ void vp9_intra4x4_predict_c(BLOCKD *x, int b_mode,
Left[2] = (*(x->base_dst))[x->dst - 1 + 2 * x->dst_stride];
Left[3] = (*(x->base_dst))[x->dst - 1 + 3 * x->dst_stride];
#if CONFIG_NEWBINTRAMODES
if (b_mode == B_CONTEXT_PRED)
b_mode = x->bmi.as_mode.context;
#endif
switch (b_mode) {
case B_DC_PRED: {
int expected_dc = 0;
......@@ -270,7 +413,15 @@ void vp9_intra4x4_predict_c(BLOCKD *x, int b_mode,
}
break;
#if CONFIG_NEWBINTRAMODES
case B_CONTEXT_PRED:
break;
/*
case B_CORNER_PRED:
corner_predictor(predictor, 16, 4, Above, Left);
break;
*/
#endif
}
}
......
......@@ -29,7 +29,17 @@ int dec_mvcount = 0;
#endif
static int read_bmode(vp9_reader *bc, const vp9_prob *p) {
return treed_read(bc, vp9_bmode_tree, p);
B_PREDICTION_MODE m = treed_read(bc, vp9_bmode_tree, p);
#if CONFIG_NEWBINTRAMODES
if (m == B_CONTEXT_PRED - CONTEXT_PRED_REPLACEMENTS)
m = B_CONTEXT_PRED;
assert(m < B_CONTEXT_PRED - CONTEXT_PRED_REPLACEMENTS || m == B_CONTEXT_PRED);
#endif
return m;
}
static int read_kf_bmode(vp9_reader *bc, const vp9_prob *p) {
return treed_read(bc, vp9_kf_bmode_tree, p);
}
static int read_ymode(vp9_reader *bc, const vp9_prob *p) {
......@@ -142,19 +152,19 @@ static void kfread_modes(VP9D_COMP *pbi,
if ((m->mbmi.mode = y_mode) == B_PRED) {
int i = 0;
#if CONFIG_COMP_INTRA_PRED
int use_comp_pred = vp9_read(bc, 128);
int use_comp_pred = vp9_read(bc, DEFAULT_COMP_INTRA_PROB);
#endif
do {
const B_PREDICTION_MODE A = above_block_mode(m, i, mis);
const B_PREDICTION_MODE L = left_block_mode(m, i);
m->bmi[i].as_mode.first =
(B_PREDICTION_MODE) read_bmode(
(B_PREDICTION_MODE) read_kf_bmode(
bc, pbi->common.kf_bmode_prob [A] [L]);
#if CONFIG_COMP_INTRA_PRED
if (use_comp_pred) {
m->bmi[i].as_mode.second =
(B_PREDICTION_MODE) read_bmode(
(B_PREDICTION_MODE) read_kf_bmode(
bc, pbi->common.kf_bmode_prob [A] [L]);
} else {
m->bmi[i].as_mode.second = (B_PREDICTION_MODE)(B_DC_PRED - 1);
......@@ -1075,19 +1085,16 @@ static void read_mb_modes_mv(VP9D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
if (mbmi->mode == B_PRED) {
int j = 0;
#if CONFIG_COMP_INTRA_PRED
int use_comp_pred = vp9_read(bc, 128);
int use_comp_pred = vp9_read(bc, DEFAULT_COMP_INTRA_PROB);
#endif
do {
mi->bmi[j].as_mode.first = (B_PREDICTION_MODE)read_bmode(bc, pbi->common.fc.bmode_prob);
/*
{
int p;
for (p = 0; p < VP9_BINTRAMODES - 1; ++p)
printf(" %d", pbi->common.fc.bmode_prob[p]);
printf("\nbmode[%d][%d]: %d\n", pbi->common.current_video_frame, j, mi->bmi[j].as_mode.first);
}
*/
pbi->common.fc.bmode_counts[mi->bmi[j].as_mode.first]++;
int m;
m = mi->bmi[j].as_mode.first = (B_PREDICTION_MODE)
read_bmode(bc, pbi->common.fc.bmode_prob);
#if CONFIG_NEWBINTRAMODES
if (m == B_CONTEXT_PRED) m -= CONTEXT_PRED_REPLACEMENTS;
#endif
pbi->common.fc.bmode_counts[m]++;
#if CONFIG_COMP_INTRA_PRED
if (use_comp_pred) {
mi->bmi[j].as_mode.second = (B_PREDICTION_MODE)read_bmode(bc, pbi->common.fc.bmode_prob);
......
......@@ -376,7 +376,7 @@ static void decode_macroblock(VP9D_COMP *pbi, MACROBLOCKD *xd,
eobtotal = vp9_decode_mb_tokens_16x16(pbi, xd, bc);
} else if (tx_size == TX_8X8) {
eobtotal = vp9_decode_mb_tokens_8x8(pbi, xd, bc);
} else {
} else if (mode != B_PRED) {
eobtotal = vp9_decode_mb_tokens(pbi, xd, bc);
}
}
......@@ -404,7 +404,9 @@ static void decode_macroblock(VP9D_COMP *pbi, MACROBLOCKD *xd,
/* do prediction */
if (xd->mode_info_context->mbmi.ref_frame == INTRA_FRAME) {
if (mode != I8X8_PRED) {
vp9_build_intra_predictors_mbuv(xd);
if (mode != B_PRED) {
vp9_build_intra_predictors_mbuv(xd);
}
if (mode != B_PRED) {
vp9_build_intra_predictors_mby(xd);
}
......@@ -461,10 +463,20 @@ static void decode_macroblock(VP9D_COMP *pbi, MACROBLOCKD *xd,
}
} else if (mode == B_PRED) {
for (i = 0; i < 16; i++) {
int b_mode;
#if CONFIG_COMP_INTRA_PRED
int b_mode2;
#endif
BLOCKD *b = &xd->block[i];
int b_mode = xd->mode_info_context->bmi[i].as_mode.first;
b_mode = xd->mode_info_context->bmi[i].as_mode.first;
#if CONFIG_NEWBINTRAMODES
xd->mode_info_context->bmi[i].as_mode.context = b->bmi.as_mode.context =
vp9_find_bpred_context(b);
#endif
if (!xd->mode_info_context->mbmi.mb_skip_coeff)
eobtotal += vp9_decode_coefs_4x4(pbi, xd, bc, PLANE_TYPE_Y_WITH_DC, i);
#if CONFIG_COMP_INTRA_PRED
int b_mode2 = xd->mode_info_context->bmi[i].as_mode.second;
b_mode2 = xd->mode_info_context->bmi[i].as_mode.second;
if (b_mode2 == (B_PREDICTION_MODE)(B_DC_PRED - 1)) {
#endif
......@@ -485,6 +497,14 @@ static void decode_macroblock(VP9D_COMP *pbi, MACROBLOCKD *xd,
*(b->base_dst) + b->dst, 16, b->dst_stride);
}
}
if (!xd->mode_info_context->mbmi.mb_skip_coeff) {
for (i = 16; i < 24; ++i)
eobtotal += vp9_decode_coefs_4x4(pbi, xd, bc, PLANE_TYPE_UV, i);
}
vp9_build_intra_predictors_mbuv(xd);
pbi->idct_add_uv_block(xd->qcoeff + 16 * 16, xd->block[16].dequant,
xd->predictor + 16 * 16, xd->dst.u_buffer,
xd->dst.v_buffer, xd->dst.uv_stride, xd->eobs + 16);
} else if (mode == SPLITMV) {
if (tx_size == TX_8X8) {
vp9_dequant_idct_add_y_block_8x8(xd->qcoeff, xd->block[0].dequant,
......@@ -492,8 +512,8 @@ static void decode_macroblock(VP9D_COMP *pbi, MACROBLOCKD *xd,
xd->dst.y_stride, xd->eobs, xd);
} else {
pbi->idct_add_y_block(xd->qcoeff, xd->block[0].dequant,
xd->predictor, xd->dst.y_buffer,
xd->dst.y_stride, xd->eobs);
xd->predictor, xd->dst.y_buffer,
xd->dst.y_stride, xd->eobs);
}
} else {
BLOCKD *b = &xd->block[24];
......@@ -556,7 +576,8 @@ static void decode_macroblock(VP9D_COMP *pbi, MACROBLOCKD *xd,
(xd->qcoeff + 16 * 16, xd->block[16].dequant,
xd->predictor + 16 * 16, xd->dst.u_buffer, xd->dst.v_buffer,
xd->dst.uv_stride, xd->eobs + 16, xd);
else if (xd->mode_info_context->mbmi.mode != I8X8_PRED)
else if (xd->mode_info_context->mbmi.mode != I8X8_PRED &&
xd->mode_info_context->mbmi.mode != B_PRED)
pbi->idct_add_uv_block(xd->qcoeff + 16 * 16, xd->block[16].dequant,