Commit a16608ab authored by Yaowu Xu's avatar Yaowu Xu
Browse files

Merge QIMODE experiment

This commit merge the QI mode experiment. As the experiment affects
the encoding of intra coding modes on key frame only, the overall
effect of the experiment on encoding tests is insignificant.

Change-Id: I9e4e3933adface88867ad429cee3986e529c511d
parent c1814d26
......@@ -225,9 +225,7 @@ void vp8_create_common(VP8_COMMON *oci)
/* Default disable buffer to buffer copying */
oci->copy_buffer_to_gf = 0;
oci->copy_buffer_to_arf = 0;
#if CONFIG_QIMODE
oci->kf_ymode_probs_update = 0;
#endif
}
void vp8_remove_common(VP8_COMMON *oci)
......
......@@ -15,7 +15,6 @@
#include "vpx_mem/vpx_mem.h"
#if CONFIG_QIMODE
const unsigned int kf_y_mode_cts[8][VP8_YMODES] =
{
{17, 6, 5, 2, 22, 203},
......@@ -27,10 +26,6 @@ const unsigned int kf_y_mode_cts[8][VP8_YMODES] =
{88, 38, 39, 19, 16, 57},
{99, 42, 43, 21, 12, 39},
};
#else
static const unsigned int kf_y_mode_cts[VP8_YMODES] = {
49, 22, 23, 11, 23, 128};
#endif
static const unsigned int y_mode_cts [VP8_YMODES] = {
106, 25, 21, 13, 16, 74};
......@@ -262,7 +257,6 @@ void vp8_init_mbmode_probs(VP8_COMMON *x)
x->fc.ymode_prob, bct, y_mode_cts,
256, 1
);
#if CONFIG_QIMODE
{
int i;
for (i=0;i<8;i++)
......@@ -272,13 +266,6 @@ void vp8_init_mbmode_probs(VP8_COMMON *x)
256, 1
);
}
#else
vp8_tree_probs_from_distribution(
VP8_YMODES, vp8_kf_ymode_encodings, vp8_kf_ymode_tree,
x->kf_ymode_prob, bct, kf_y_mode_cts,
256, 1
);
#endif
{
int i;
for (i=0;i<VP8_YMODES;i++)
......
......@@ -201,13 +201,9 @@ typedef struct VP8Common
/* keyframe block modes are predicted by their above, left neighbors */
vp8_prob kf_bmode_prob [VP8_BINTRAMODES] [VP8_BINTRAMODES] [VP8_BINTRAMODES-1];
#if CONFIG_QIMODE
vp8_prob kf_ymode_prob[8][VP8_YMODES-1]; /* keyframe "" */
int kf_ymode_probs_index;
int kf_ymode_probs_update;
#else
vp8_prob kf_ymode_prob [VP8_YMODES-1]; /* keyframe "" */
#endif
vp8_prob kf_uv_mode_prob[VP8_YMODES] [VP8_UV_MODES-1];
vp8_prob i8x8_mode_prob [VP8_UV_MODES-1];
......
......@@ -127,13 +127,8 @@ static void vp8_kfread_modes(VP8D_COMP *pbi,
m->mbmi.mb_skip_coeff = 0;
}
#if CONFIG_QIMODE
y_mode = (MB_PREDICTION_MODE) vp8_kfread_ymode(bc,
pbi->common.kf_ymode_prob[pbi->common.kf_ymode_probs_index]);
#else
y_mode = (MB_PREDICTION_MODE) vp8_kfread_ymode(
bc, pbi->common.kf_ymode_prob);
#endif
#if CONFIG_COMP_INTRA_PRED
m->mbmi.second_mode = (MB_PREDICTION_MODE) (DC_PRED - 1);
#endif
......@@ -1048,12 +1043,10 @@ void vp8_decode_mode_mvs(VP8D_COMP *pbi)
mb_mode_mv_init(pbi);
#if CONFIG_QIMODE
if(cm->frame_type==KEY_FRAME && !cm->kf_ymode_probs_update)
{
cm->kf_ymode_probs_index = vp8_read_literal(&pbi->bc, 3);
}
#endif
for (sb_row=0; sb_row<sb_rows; sb_row++)
{
......
......@@ -1236,12 +1236,10 @@ static void write_kfmodes(VP8_COMP *cpi)
#endif
}
#if CONFIG_QIMODE
if(!c->kf_ymode_probs_update)
{
vp8_write_literal(bc, c->kf_ymode_probs_index, 3);
}
#endif
mb_row = 0;
for (row=0; row < c->mb_rows; row += 2)
......@@ -1292,12 +1290,8 @@ static void write_kfmodes(VP8_COMP *cpi)
vp8_encode_bool(bc, m->mbmi.mb_skip_coeff, prob_skip_false);
#endif
}
#if CONFIG_QIMODE
kfwrite_ymode(bc, ym,
c->kf_ymode_prob[c->kf_ymode_probs_index]);
#else
kfwrite_ymode(bc, ym, c->kf_ymode_prob);
#endif
if (ym == B_PRED)
{
......@@ -2227,7 +2221,6 @@ static void put_delta_q(vp8_writer *bc, int delta_q)
else
vp8_write_bit(bc, 0);
}
#if CONFIG_QIMODE
extern const unsigned int kf_y_mode_cts[8][VP8_YMODES];
static void decide_kf_ymode_entropy(VP8_COMP *cpi)
{
......@@ -2255,7 +2248,6 @@ static void decide_kf_ymode_entropy(VP8_COMP *cpi)
cpi->common.kf_ymode_probs_index = bestindex;
}
#endif
static void segment_reference_frames(VP8_COMP *cpi)
{
VP8_COMMON *oci = &cpi->common;
......@@ -2688,9 +2680,7 @@ void vp8_pack_bitstream(VP8_COMP *cpi, unsigned char *dest, unsigned long *size)
if (pc->frame_type == KEY_FRAME)
{
#if CONFIG_QIMODE
decide_kf_ymode_entropy(cpi);
#endif
write_kfmodes(cpi);
#ifdef ENTROPY_STATS
......
......@@ -41,14 +41,9 @@ void vp8_init_mode_costs(VP8_COMP *c)
x->fc.sub_mv_ref_prob, vp8_sub_mv_ref_tree);
vp8_cost_tokens(c->mb.mbmode_cost[1], x->fc.ymode_prob, vp8_ymode_tree);
#if CONFIG_QIMODE
vp8_cost_tokens(c->mb.mbmode_cost[0],
x->kf_ymode_prob[c->common.kf_ymode_probs_index],
vp8_kf_ymode_tree);
#else
vp8_cost_tokens(c->mb.mbmode_cost[0],
x->kf_ymode_prob, vp8_kf_ymode_tree);
#endif
vp8_cost_tokens(c->mb.intra_uv_mode_cost[1],
x->fc.uv_mode_prob[VP8_YMODES-1], vp8_uv_mode_tree);
vp8_cost_tokens(c->mb.intra_uv_mode_cost[0],
......
......@@ -378,10 +378,8 @@ void vp8_initialize_rd_consts(VP8_COMP *cpi, int QIndex)
cpi->mb.token_costs_8x8,
(const vp8_prob( *)[8][3][11]) cpi->common.fc.coef_probs_8x8
);
#if CONFIG_QIMODE
//rough estimate for costing
/*rough estimate for costing*/
cpi->common.kf_ymode_probs_index = cpi->common.base_qindex>>4;
#endif
vp8_init_mode_costs(cpi);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment