add quantizer adaptive intra mb mode encoding
make intra mode coding entropy distribution adaptive to baseQindex, an encoding test on hd clips with all key frame shows universal gain on all clips in both .2%(psnr) and (ssim).3%. To build and test, configure with --enable-experimental --enable-qimode Change-Id: Iaa69241b984d4fdd8baa6d77ee78c0140f5ac00a
This commit is contained in:
Родитель
ca6b85aa4e
Коммит
aac2c12663
|
@ -222,6 +222,7 @@ EXPERIMENT_LIST="
|
|||
t8x8
|
||||
csm
|
||||
i8x8
|
||||
qimode
|
||||
"
|
||||
CONFIG_LIST="
|
||||
external_build
|
||||
|
|
|
@ -25,6 +25,8 @@ void vpx_log(const char *format, ...);
|
|||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
|
||||
#define MODE_STATS
|
||||
|
||||
/*#define DCPRED 1*/
|
||||
#define DCPREDSIMTHRESH 0
|
||||
#define DCPREDCNTTHRESH 3
|
||||
|
|
|
@ -13,7 +13,22 @@
|
|||
#include "entropy.h"
|
||||
#include "vpx_mem/vpx_mem.h"
|
||||
#if CONFIG_I8X8
|
||||
|
||||
#if CONFIG_QIMODE
|
||||
static const unsigned int kf_y_mode_cts[8][VP8_YMODES] =
|
||||
{
|
||||
{17, 6, 5, 2, 22, 203},
|
||||
{27, 13, 13, 6, 27, 170},
|
||||
{35, 17, 18, 9, 26, 152},
|
||||
{45, 22, 24, 12, 27, 126},
|
||||
{58, 26, 29, 13, 26, 104},
|
||||
{73, 33, 36, 17, 20, 78},
|
||||
{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] = { 8080, 1908, 1582, 1007, 0, 5874};
|
||||
#else
|
||||
static const unsigned int kf_y_mode_cts[VP8_YMODES] = { 1607, 915, 812, 811, 5455};
|
||||
|
@ -222,11 +237,23 @@ 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++)
|
||||
vp8_tree_probs_from_distribution(
|
||||
VP8_YMODES, vp8_kf_ymode_encodings, vp8_kf_ymode_tree,
|
||||
x->kf_ymode_prob[i], bct, kf_y_mode_cts[i],
|
||||
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
|
||||
vp8_tree_probs_from_distribution(
|
||||
VP8_UV_MODES, vp8_uv_mode_encodings, vp8_uv_mode_tree,
|
||||
x->fc.uv_mode_prob, bct, uv_mode_cts,
|
||||
|
|
|
@ -183,7 +183,11 @@ 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 "" */
|
||||
#else
|
||||
vp8_prob kf_ymode_prob [VP8_YMODES-1]; /* keyframe "" */
|
||||
#endif
|
||||
vp8_prob kf_uv_mode_prob [VP8_UV_MODES-1];
|
||||
#if CONFIG_I8X8
|
||||
vp8_prob i8x8_mode_prob [VP8_UV_MODES-1];
|
||||
|
|
|
@ -90,9 +90,12 @@ static void vp8_kfread_modes(VP8D_COMP *pbi, MODE_INFO *m, int mb_row, int mb_co
|
|||
m->mbmi.mb_skip_coeff = vp8_read(bc, pbi->prob_skip_false);
|
||||
else
|
||||
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.base_qindex>>4]);
|
||||
#else
|
||||
y_mode = (MB_PREDICTION_MODE) vp8_kfread_ymode(bc, pbi->common.kf_ymode_prob);
|
||||
|
||||
#endif
|
||||
m->mbmi.ref_frame = INTRA_FRAME;
|
||||
|
||||
if ((m->mbmi.mode = y_mode) == B_PRED)
|
||||
|
@ -124,6 +127,7 @@ static void vp8_kfread_modes(VP8D_COMP *pbi, MODE_INFO *m, int mb_row, int mb_co
|
|||
}
|
||||
//printf("%2d%2d%2d%2d\n", m->bmi[0].as_mode,m->bmi[2].as_mode,
|
||||
// m->bmi[8].as_mode,m->bmi[10].as_mode);
|
||||
*/
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
|
|
@ -1192,8 +1192,11 @@ static void write_kfmodes(VP8_COMP *cpi)
|
|||
|
||||
if (c->mb_no_coeff_skip)
|
||||
vp8_encode_bool(bc, m->mbmi.mb_skip_coeff, prob_skip_false);
|
||||
|
||||
#if CONFIG_QIMODE
|
||||
kfwrite_ymode(bc, ym, c->kf_ymode_prob[c->base_qindex>>4]);
|
||||
#else
|
||||
kfwrite_ymode(bc, ym, c->kf_ymode_prob);
|
||||
#endif
|
||||
if (ym == B_PRED)
|
||||
{
|
||||
const int mis = c->mode_info_stride;
|
||||
|
|
|
@ -40,8 +40,11 @@ void vp8_init_mode_costs(VP8_COMP *c)
|
|||
vp8_cost_tokens((int *)c->mb.inter_bmode_costs, 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.base_qindex>>4], 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_uv_mode_tree);
|
||||
vp8_cost_tokens(c->mb.intra_uv_mode_cost[0], x->kf_uv_mode_prob, vp8_uv_mode_tree);
|
||||
#if CONFIG_I8X8
|
||||
|
|
|
@ -81,7 +81,11 @@ typedef struct
|
|||
/* interframe intra mode probs */
|
||||
vp8_prob ymode_prob[VP8_YMODES-1], uv_mode_prob[VP8_UV_MODES-1];
|
||||
/* keyframe intra mode probs */
|
||||
#if CONFIG_QIMODE
|
||||
vp8_prob kf_ymode_prob[8][VP8_YMODES-1], kf_uv_mode_prob[VP8_UV_MODES-1];
|
||||
#else
|
||||
vp8_prob kf_ymode_prob[VP8_YMODES-1], kf_uv_mode_prob[VP8_UV_MODES-1];
|
||||
#endif
|
||||
/* intra MB type cts this frame */
|
||||
int ymode_count[VP8_YMODES], uv_mode_count[VP8_UV_MODES];
|
||||
|
||||
|
|
|
@ -321,7 +321,6 @@ void vp8_restore_coding_context(VP8_COMP *cpi)
|
|||
vp8_copy(cpi->common.fc.mvc, cc->mvc);
|
||||
|
||||
vp8_copy(cpi->mb.mvcosts, cc->mvcosts);
|
||||
|
||||
vp8_copy(cpi->common.kf_ymode_prob, cc->kf_ymode_prob);
|
||||
vp8_copy(cpi->common.fc.ymode_prob, cc->ymode_prob);
|
||||
vp8_copy(cpi->common.kf_uv_mode_prob, cc->kf_uv_mode_prob);
|
||||
|
|
Загрузка…
Ссылка в новой задаче