Deprecate 4x4 intra modes from bit-stream

Replace B_DC_PRED like syntax element writing/reading with sb_ymode
set (e.g., DC_PRED, etc).

Change-Id: I293006a6b3bcd130c08ea9f053e7a79c6819c6f8
This commit is contained in:
Jingning Han 2013-05-20 12:08:22 -07:00
Родитель da39272f5c
Коммит 1e6be7bc75
3 изменённых файлов: 65 добавлений и 40 удалений

Просмотреть файл

@ -103,7 +103,6 @@ static void kfread_modes(VP9D_COMP *pbi, MODE_INFO *m,
vp9_reader *r) { vp9_reader *r) {
VP9_COMMON *const cm = &pbi->common; VP9_COMMON *const cm = &pbi->common;
MACROBLOCKD *const xd = &pbi->mb; MACROBLOCKD *const xd = &pbi->mb;
const int mis = cm->mode_info_stride;
m->mbmi.ref_frame = INTRA_FRAME; m->mbmi.ref_frame = INTRA_FRAME;
// Read segmentation map if it is being updated explicitly this frame // Read segmentation map if it is being updated explicitly this frame
@ -138,14 +137,18 @@ static void kfread_modes(VP9D_COMP *pbi, MODE_INFO *m,
#else #else
if (m->mbmi.mode == I4X4_PRED) { if (m->mbmi.mode == I4X4_PRED) {
#endif #endif
int i; int idx, idy;
for (i = 0; i < 4; ++i) { int bw = 1 << b_width_log2(m->mbmi.sb_type);
const B_PREDICTION_MODE a = above_block_mode(m, i, mis); int bh = 1 << b_height_log2(m->mbmi.sb_type);
const B_PREDICTION_MODE l = xd->left_available || // FIXME(jingning): fix intra4x4 rate-distortion optimization, then
(i & 1) ? // use bw and bh as the increment values.
left_block_mode(m, i) : B_DC_PRED; #if !CONFIG_AB4X4 || CONFIG_AB4X4
m->bmi[i].as_mode.first = read_kf_bmode(r, cm->kf_bmode_prob[a][l]); bw = 1, bh = 1;
} #endif
for (idy = 0; idy < 2; idy += bh)
for (idx = 0; idx < 2; idx += bw)
m->bmi[idy * 2 + idx].as_mode.first =
read_kf_sb_ymode(r, cm->sb_kf_ymode_prob[cm->kf_ymode_probs_index]);
} }
m->mbmi.uv_mode = read_uv_mode(r, cm->kf_uv_mode_prob[m->mbmi.mode]); m->mbmi.uv_mode = read_uv_mode(r, cm->kf_uv_mode_prob[m->mbmi.mode]);
@ -854,12 +857,19 @@ static void read_mb_modes_mv(VP9D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
#else #else
if (mbmi->mode == I4X4_PRED) { if (mbmi->mode == I4X4_PRED) {
#endif #endif
int j = 0; int idx, idy;
do { // FIXME(jingning): fix intra4x4 rate-distortion optimization, then
int m = read_bmode(r, cm->fc.bmode_prob); // use bw and bh as the increment values.
mi->bmi[j].as_mode.first = m; #if !CONFIG_AB4X4 || CONFIG_AB4X4
cm->fc.bmode_counts[m]++; bw = 1, bh = 1;
} while (++j < 4); #endif
for (idy = 0; idy < 2; idy += bh) {
for (idx = 0; idx < 2; idx += bw) {
int m = read_sb_ymode(r, cm->fc.sb_ymode_prob);
mi->bmi[idy * 2 + idx].as_mode.first = m;
cm->fc.sb_ymode_counts[m]++;
}
}
} }
mbmi->uv_mode = read_uv_mode(r, cm->fc.uv_mode_prob[mbmi->mode]); mbmi->uv_mode = read_uv_mode(r, cm->fc.uv_mode_prob[mbmi->mode]);

Просмотреть файл

@ -269,10 +269,11 @@ static void write_uv_mode(vp9_writer *bc, int m, const vp9_prob *p) {
write_token(bc, vp9_uv_mode_tree, p, vp9_uv_mode_encodings + m); write_token(bc, vp9_uv_mode_tree, p, vp9_uv_mode_encodings + m);
} }
#if !CONFIG_AB4X4
static void write_bmode(vp9_writer *bc, int m, const vp9_prob *p) { static void write_bmode(vp9_writer *bc, int m, const vp9_prob *p) {
write_token(bc, vp9_bmode_tree, p, vp9_bmode_encodings + m); write_token(bc, vp9_bmode_tree, p, vp9_bmode_encodings + m);
} }
#endif
static void write_kf_bmode(vp9_writer *bc, int m, const vp9_prob *p) { static void write_kf_bmode(vp9_writer *bc, int m, const vp9_prob *p) {
write_token(bc, vp9_kf_bmode_tree, p, vp9_kf_bmode_encodings + m); write_token(bc, vp9_kf_bmode_tree, p, vp9_kf_bmode_encodings + m);
@ -630,11 +631,18 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m,
#else #else
if (mode == I4X4_PRED) { if (mode == I4X4_PRED) {
#endif #endif
int j = 0; int idx, idy;
do { int bw = 1 << b_width_log2(mi->sb_type);
write_bmode(bc, m->bmi[j].as_mode.first, int bh = 1 << b_height_log2(mi->sb_type);
pc->fc.bmode_prob); // FIXME(jingning): fix intra4x4 rate-distortion optimization, then
} while (++j < 4); // use bw and bh as the increment values.
#if !CONFIG_AB4X4 || CONFIG_AB4X4
bw = 1, bh = 1;
#endif
for (idy = 0; idy < 2; idy += bh)
for (idx = 0; idx < 2; idx += bw)
write_sb_ymode(bc, m->bmi[idy * 2 + idx].as_mode.first,
pc->fc.sb_ymode_prob);
} }
write_uv_mode(bc, mi->uv_mode, write_uv_mode(bc, mi->uv_mode,
pc->fc.uv_mode_prob[mode]); pc->fc.uv_mode_prob[mode]);
@ -777,7 +785,6 @@ static void write_mb_modes_kf(const VP9_COMP *cpi,
vp9_writer *bc, int mi_row, int mi_col) { vp9_writer *bc, int mi_row, int mi_col) {
const VP9_COMMON *const c = &cpi->common; const VP9_COMMON *const c = &cpi->common;
const MACROBLOCKD *const xd = &cpi->mb.e_mbd; const MACROBLOCKD *const xd = &cpi->mb.e_mbd;
const int mis = c->mode_info_stride;
const int ym = m->mbmi.mode; const int ym = m->mbmi.mode;
const int segment_id = m->mbmi.segment_id; const int segment_id = m->mbmi.segment_id;
int skip_coeff; int skip_coeff;
@ -807,19 +814,18 @@ static void write_mb_modes_kf(const VP9_COMP *cpi,
#else #else
if (ym == I4X4_PRED) { if (ym == I4X4_PRED) {
#endif #endif
int i = 0; int idx, idy;
do { int bw = 1 << b_width_log2(m->mbmi.sb_type);
const B_PREDICTION_MODE a = above_block_mode(m, i, mis); int bh = 1 << b_height_log2(m->mbmi.sb_type);
const B_PREDICTION_MODE l = (xd->left_available || // FIXME(jingning): fix intra4x4 rate-distortion optimization, then
(i & 1)) ? // use bw and bh as the increment values.
left_block_mode(m, i) : B_DC_PRED; #if !CONFIG_AB4X4 || CONFIG_AB4X4
const int bm = m->bmi[i].as_mode.first; bw = 1, bh = 1;
#endif
/*#ifdef ENTROPY_STATS for (idy = 0; idy < 2; idy += bh)
++intra_mode_stats [A] [L] [bm]; for (idx = 0; idx < 2; idx += bw)
#endif*/ sb_kfwrite_ymode(bc, m->bmi[idy * 2 + idx].as_mode.first,
write_kf_bmode(bc, bm, c->kf_bmode_prob[a][l]); c->sb_kf_ymode_prob[c->kf_ymode_probs_index]);
} while (++i < 4);
} }
write_uv_mode(bc, m->mbmi.uv_mode, c->kf_uv_mode_prob[ym]); write_uv_mode(bc, m->mbmi.uv_mode, c->kf_uv_mode_prob[ym]);

Просмотреть файл

@ -1614,11 +1614,20 @@ static void sum_intra_stats(VP9_COMP *cpi, MACROBLOCK *x) {
} }
++cpi->y_uv_mode_count[m][uvm]; ++cpi->y_uv_mode_count[m][uvm];
if (m == I4X4_PRED) { if (m == I4X4_PRED) {
int b = 0; int idx, idy;
do { int bw = 1 << b_width_log2(xd->mode_info_context->mbmi.sb_type);
int m = xd->mode_info_context->bmi[b].as_mode.first; int bh = 1 << b_height_log2(xd->mode_info_context->mbmi.sb_type);
++cpi->bmode_count[m]; // FIXME(jingning): fix intra4x4 rate-distortion optimization, then
} while (++b < 4); // use bw and bh as the increment values.
#if !CONFIG_AB4X4 || CONFIG_AB4X4
bw = 1, bh = 1;
#endif
for (idy = 0; idy < 2; idy += bh) {
for (idx = 0; idx < 2; idx += bw) {
int m = xd->mode_info_context->bmi[idy * 2 + idx].as_mode.first;
++cpi->sb_ymode_count[m];
}
}
} }
} }