Merge "Moving mv entropy encodings calculation to the encoder side."

This commit is contained in:
Dmitry Kovalev 2013-11-25 19:15:21 -08:00 коммит произвёл Gerrit Code Review
Родитель d5f6ca8255 56d048c412
Коммит 5488da280d
6 изменённых файлов: 27 добавлений и 30 удалений

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

@ -213,7 +213,6 @@ void vp9_initialize_common() {
vp9_init_neighbors();
vp9_coef_tree_initialize();
vp9_entropy_mode_init();
vp9_entropy_mv_init();
}
void vp9_update_frame_size(VP9_COMMON *cm) {

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

@ -23,7 +23,6 @@ const vp9_tree_index vp9_mv_joint_tree[TREE_SIZE(MV_JOINTS)] = {
-MV_JOINT_HNZVZ, 4,
-MV_JOINT_HZVNZ, -MV_JOINT_HNZVNZ
};
struct vp9_token vp9_mv_joint_encodings[MV_JOINTS];
const vp9_tree_index vp9_mv_class_tree[TREE_SIZE(MV_CLASSES)] = {
-MV_CLASS_0, 2,
@ -37,19 +36,16 @@ const vp9_tree_index vp9_mv_class_tree[TREE_SIZE(MV_CLASSES)] = {
-MV_CLASS_7, -MV_CLASS_8,
-MV_CLASS_9, -MV_CLASS_10,
};
struct vp9_token vp9_mv_class_encodings[MV_CLASSES];
const vp9_tree_index vp9_mv_class0_tree[TREE_SIZE(CLASS0_SIZE)] = {
-0, -1,
};
struct vp9_token vp9_mv_class0_encodings[CLASS0_SIZE];
const vp9_tree_index vp9_mv_fp_tree[TREE_SIZE(4)] = {
const vp9_tree_index vp9_mv_fp_tree[TREE_SIZE(MV_FP_SIZE)] = {
-0, 2,
-1, 4,
-2, -3
};
struct vp9_token vp9_mv_fp_encodings[4];
static const nmv_context default_nmv_context = {
{32, 64, 96},
@ -235,13 +231,6 @@ void vp9_adapt_mv_probs(VP9_COMMON *cm, int allow_hp) {
}
}
void vp9_entropy_mv_init() {
vp9_tokens_from_tree(vp9_mv_joint_encodings, vp9_mv_joint_tree);
vp9_tokens_from_tree(vp9_mv_class_encodings, vp9_mv_class_tree);
vp9_tokens_from_tree(vp9_mv_class0_encodings, vp9_mv_class0_tree);
vp9_tokens_from_tree(vp9_mv_fp_encodings, vp9_mv_fp_tree);
}
void vp9_init_mv_probs(VP9_COMMON *cm) {
cm->fc.nmvc = default_nmv_context;
}

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

@ -18,7 +18,6 @@
struct VP9Common;
void vp9_entropy_mv_init();
void vp9_init_mv_probs(struct VP9Common *cm);
void vp9_adapt_mv_probs(struct VP9Common *cm, int usehp);
@ -72,17 +71,10 @@ typedef enum {
#define MV_UPP ((1 << MV_IN_USE_BITS) - 1)
#define MV_LOW (-(1 << MV_IN_USE_BITS))
extern const vp9_tree_index vp9_mv_joint_tree[TREE_SIZE(MV_JOINTS)];
extern struct vp9_token vp9_mv_joint_encodings[MV_JOINTS];
extern const vp9_tree_index vp9_mv_class_tree[TREE_SIZE(MV_CLASSES)];
extern struct vp9_token vp9_mv_class_encodings[MV_CLASSES];
extern const vp9_tree_index vp9_mv_class0_tree[TREE_SIZE(CLASS0_SIZE)];
extern struct vp9_token vp9_mv_class0_encodings[CLASS0_SIZE];
extern const vp9_tree_index vp9_mv_fp_tree[TREE_SIZE(MV_FP_SIZE)];
extern struct vp9_token vp9_mv_fp_encodings[4];
extern const vp9_tree_index vp9_mv_joint_tree[];
extern const vp9_tree_index vp9_mv_class_tree[];
extern const vp9_tree_index vp9_mv_class0_tree[];
extern const vp9_tree_index vp9_mv_fp_tree[];
typedef struct {
vp9_prob sign;

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

@ -15,11 +15,22 @@
#include "vp9/common/vp9_systemdependent.h"
#include "vp9/encoder/vp9_encodemv.h"
#ifdef ENTROPY_STATS
extern unsigned int active_section;
#endif
static struct vp9_token mv_joint_encodings[MV_JOINTS];
static struct vp9_token mv_class_encodings[MV_CLASSES];
static struct vp9_token mv_fp_encodings[MV_FP_SIZE];
static struct vp9_token mv_class0_encodings[CLASS0_SIZE];
void vp9_entropy_mv_init() {
vp9_tokens_from_tree(mv_joint_encodings, vp9_mv_joint_tree);
vp9_tokens_from_tree(mv_class_encodings, vp9_mv_class_tree);
vp9_tokens_from_tree(mv_class0_encodings, vp9_mv_class0_tree);
vp9_tokens_from_tree(mv_fp_encodings, vp9_mv_fp_tree);
}
static void encode_mv_component(vp9_writer* w, int comp,
const nmv_component* mvcomp, int usehp) {
int offset;
@ -37,12 +48,12 @@ static void encode_mv_component(vp9_writer* w, int comp,
// Class
write_token(w, vp9_mv_class_tree, mvcomp->classes,
&vp9_mv_class_encodings[mv_class]);
&mv_class_encodings[mv_class]);
// Integer bits
if (mv_class == MV_CLASS_0) {
write_token(w, vp9_mv_class0_tree, mvcomp->class0,
&vp9_mv_class0_encodings[d]);
&mv_class0_encodings[d]);
} else {
int i;
const int n = mv_class + CLASS0_BITS - 1; // number of bits
@ -53,7 +64,7 @@ static void encode_mv_component(vp9_writer* w, int comp,
// Fractional bits
write_token(w, vp9_mv_fp_tree,
mv_class == MV_CLASS_0 ? mvcomp->class0_fp[d] : mvcomp->fp,
&vp9_mv_fp_encodings[fr]);
&mv_fp_encodings[fr]);
// High precision bit
if (usehp)
@ -198,7 +209,7 @@ void vp9_encode_mv(VP9_COMP* cpi, vp9_writer* w,
const MV_JOINT_TYPE j = vp9_get_mv_joint(&diff);
usehp = usehp && vp9_use_mv_hp(ref);
write_token(w, vp9_mv_joint_tree, mvctx->joints, &vp9_mv_joint_encodings[j]);
write_token(w, vp9_mv_joint_tree, mvctx->joints, &mv_joint_encodings[j]);
if (mv_joint_vertical(j))
encode_mv_component(w, diff.row, &mvctx->comps[0], usehp);
@ -258,3 +269,4 @@ void vp9_update_mv_count(VP9_COMP *cpi, MACROBLOCK *x, int_mv best_ref_mv[2]) {
inc_mvs(mbmi->mv, best_ref_mv, is_compound, &cpi->NMVcount);
}
}

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

@ -14,6 +14,8 @@
#include "vp9/encoder/vp9_onyx_int.h"
void vp9_entropy_mv_init();
void vp9_write_nmv_probs(VP9_COMP* const, int usehp, vp9_writer* const);
void vp9_encode_mv(VP9_COMP *cpi, vp9_writer* w, const MV* mv, const MV* ref,

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

@ -24,6 +24,8 @@
#include "vp9/common/vp9_reconinter.h"
#include "vp9/common/vp9_systemdependent.h"
#include "vp9/common/vp9_tile_common.h"
#include "vp9/encoder/vp9_encodemv.h"
#include "vp9/encoder/vp9_firstpass.h"
#include "vp9/encoder/vp9_mbgraph.h"
#include "vp9/encoder/vp9_onyx_int.h"
@ -159,6 +161,7 @@ void vp9_initialize_enc() {
vp9_init_me_luts();
vp9_init_minq_luts();
// init_base_skip_probs();
vp9_entropy_mv_init();
init_done = 1;
}
}