Commit 4956fcd3 authored by Dmitry Kovalev's avatar Dmitry Kovalev
Browse files

Adding MV_FP_SIZE constant.

Change-Id: I98d750ee92ff51fb714980418ea28be3b1d0f3c6
parent 82f8ae4c
...@@ -62,6 +62,7 @@ typedef enum { ...@@ -62,6 +62,7 @@ typedef enum {
#define CLASS0_BITS 1 /* bits at integer precision for class 0 */ #define CLASS0_BITS 1 /* bits at integer precision for class 0 */
#define CLASS0_SIZE (1 << CLASS0_BITS) #define CLASS0_SIZE (1 << CLASS0_BITS)
#define MV_OFFSET_BITS (MV_CLASSES + CLASS0_BITS - 2) #define MV_OFFSET_BITS (MV_CLASSES + CLASS0_BITS - 2)
#define MV_FP_SIZE 4
#define MV_MAX_BITS (MV_CLASSES + CLASS0_BITS + 2) #define MV_MAX_BITS (MV_CLASSES + CLASS0_BITS + 2)
#define MV_MAX ((1 << MV_MAX_BITS) - 1) #define MV_MAX ((1 << MV_MAX_BITS) - 1)
...@@ -80,7 +81,7 @@ extern struct vp9_token vp9_mv_class_encodings[MV_CLASSES]; ...@@ -80,7 +81,7 @@ extern struct vp9_token vp9_mv_class_encodings[MV_CLASSES];
extern const vp9_tree_index vp9_mv_class0_tree[TREE_SIZE(CLASS0_SIZE)]; extern const vp9_tree_index vp9_mv_class0_tree[TREE_SIZE(CLASS0_SIZE)];
extern struct vp9_token vp9_mv_class0_encodings[CLASS0_SIZE]; extern struct vp9_token vp9_mv_class0_encodings[CLASS0_SIZE];
extern const vp9_tree_index vp9_mv_fp_tree[TREE_SIZE(4)]; extern const vp9_tree_index vp9_mv_fp_tree[TREE_SIZE(MV_FP_SIZE)];
extern struct vp9_token vp9_mv_fp_encodings[4]; extern struct vp9_token vp9_mv_fp_encodings[4];
typedef struct { typedef struct {
...@@ -88,8 +89,8 @@ typedef struct { ...@@ -88,8 +89,8 @@ typedef struct {
vp9_prob classes[MV_CLASSES - 1]; vp9_prob classes[MV_CLASSES - 1];
vp9_prob class0[CLASS0_SIZE - 1]; vp9_prob class0[CLASS0_SIZE - 1];
vp9_prob bits[MV_OFFSET_BITS]; vp9_prob bits[MV_OFFSET_BITS];
vp9_prob class0_fp[CLASS0_SIZE][4 - 1]; vp9_prob class0_fp[CLASS0_SIZE][MV_FP_SIZE - 1];
vp9_prob fp[4 - 1]; vp9_prob fp[MV_FP_SIZE - 1];
vp9_prob class0_hp; vp9_prob class0_hp;
vp9_prob hp; vp9_prob hp;
} nmv_component; } nmv_component;
...@@ -116,8 +117,8 @@ typedef struct { ...@@ -116,8 +117,8 @@ typedef struct {
unsigned int classes[MV_CLASSES]; unsigned int classes[MV_CLASSES];
unsigned int class0[CLASS0_SIZE]; unsigned int class0[CLASS0_SIZE];
unsigned int bits[MV_OFFSET_BITS][2]; unsigned int bits[MV_OFFSET_BITS][2];
unsigned int class0_fp[CLASS0_SIZE][4]; unsigned int class0_fp[CLASS0_SIZE][MV_FP_SIZE];
unsigned int fp[4]; unsigned int fp[MV_FP_SIZE];
unsigned int class0_hp[2]; unsigned int class0_hp[2];
unsigned int hp[2]; unsigned int hp[2];
} nmv_component_counts; } nmv_component_counts;
......
...@@ -159,7 +159,7 @@ static void update_mv_probs(vp9_prob *p, int n, vp9_reader *r) { ...@@ -159,7 +159,7 @@ static void update_mv_probs(vp9_prob *p, int n, vp9_reader *r) {
int i; int i;
for (i = 0; i < n; ++i) for (i = 0; i < n; ++i)
if (vp9_read(r, NMV_UPDATE_PROB)) if (vp9_read(r, NMV_UPDATE_PROB))
p[i] = (vp9_read_literal(r, 7) << 1) | 1; p[i] = (vp9_read_literal(r, 7) << 1) | 1;
} }
static void read_mv_probs(nmv_context *ctx, int allow_hp, vp9_reader *r) { static void read_mv_probs(nmv_context *ctx, int allow_hp, vp9_reader *r) {
...@@ -178,7 +178,7 @@ static void read_mv_probs(nmv_context *ctx, int allow_hp, vp9_reader *r) { ...@@ -178,7 +178,7 @@ static void read_mv_probs(nmv_context *ctx, int allow_hp, vp9_reader *r) {
for (i = 0; i < 2; ++i) { for (i = 0; i < 2; ++i) {
nmv_component *const comp_ctx = &ctx->comps[i]; nmv_component *const comp_ctx = &ctx->comps[i];
for (j = 0; j < CLASS0_SIZE; ++j) for (j = 0; j < CLASS0_SIZE; ++j)
update_mv_probs(comp_ctx->class0_fp[j], 3, r); update_mv_probs(comp_ctx->class0_fp[j], MV_FP_SIZE - 1, r);
update_mv_probs(comp_ctx->fp, 3, r); update_mv_probs(comp_ctx->fp, 3, r);
} }
......
...@@ -68,7 +68,7 @@ static void build_nmv_component_cost_table(int *mvcost, ...@@ -68,7 +68,7 @@ static void build_nmv_component_cost_table(int *mvcost,
int i, v; int i, v;
int sign_cost[2], class_cost[MV_CLASSES], class0_cost[CLASS0_SIZE]; int sign_cost[2], class_cost[MV_CLASSES], class0_cost[CLASS0_SIZE];
int bits_cost[MV_OFFSET_BITS][2]; int bits_cost[MV_OFFSET_BITS][2];
int class0_fp_cost[CLASS0_SIZE][4], fp_cost[4]; int class0_fp_cost[CLASS0_SIZE][MV_FP_SIZE], fp_cost[MV_FP_SIZE];
int class0_hp_cost[2], hp_cost[2]; int class0_hp_cost[2], hp_cost[2];
sign_cost[0] = vp9_cost_zero(mvcomp->sign); sign_cost[0] = vp9_cost_zero(mvcomp->sign);
...@@ -145,8 +145,8 @@ static void counts_to_nmv_context( ...@@ -145,8 +145,8 @@ static void counts_to_nmv_context(
unsigned int (*branch_ct_classes)[MV_CLASSES - 1][2], unsigned int (*branch_ct_classes)[MV_CLASSES - 1][2],
unsigned int (*branch_ct_class0)[CLASS0_SIZE - 1][2], unsigned int (*branch_ct_class0)[CLASS0_SIZE - 1][2],
unsigned int (*branch_ct_bits)[MV_OFFSET_BITS][2], unsigned int (*branch_ct_bits)[MV_OFFSET_BITS][2],
unsigned int (*branch_ct_class0_fp)[CLASS0_SIZE][4 - 1][2], unsigned int (*branch_ct_class0_fp)[CLASS0_SIZE][MV_FP_SIZE - 1][2],
unsigned int (*branch_ct_fp)[4 - 1][2], unsigned int (*branch_ct_fp)[MV_FP_SIZE - 1][2],
unsigned int (*branch_ct_class0_hp)[2], unsigned int (*branch_ct_class0_hp)[2],
unsigned int (*branch_ct_hp)[2]) { unsigned int (*branch_ct_hp)[2]) {
int i, j, k; int i, j, k;
...@@ -205,8 +205,8 @@ void vp9_write_nmv_probs(VP9_COMP* const cpi, int usehp, vp9_writer* const bc) { ...@@ -205,8 +205,8 @@ void vp9_write_nmv_probs(VP9_COMP* const cpi, int usehp, vp9_writer* const bc) {
unsigned int branch_ct_classes[2][MV_CLASSES - 1][2]; unsigned int branch_ct_classes[2][MV_CLASSES - 1][2];
unsigned int branch_ct_class0[2][CLASS0_SIZE - 1][2]; unsigned int branch_ct_class0[2][CLASS0_SIZE - 1][2];
unsigned int branch_ct_bits[2][MV_OFFSET_BITS][2]; unsigned int branch_ct_bits[2][MV_OFFSET_BITS][2];
unsigned int branch_ct_class0_fp[2][CLASS0_SIZE][4 - 1][2]; unsigned int branch_ct_class0_fp[2][CLASS0_SIZE][MV_FP_SIZE - 1][2];
unsigned int branch_ct_fp[2][4 - 1][2]; unsigned int branch_ct_fp[2][MV_FP_SIZE - 1][2];
unsigned int branch_ct_class0_hp[2][2]; unsigned int branch_ct_class0_hp[2][2];
unsigned int branch_ct_hp[2][2]; unsigned int branch_ct_hp[2][2];
nmv_context *mvc = &cpi->common.fc.nmvc; nmv_context *mvc = &cpi->common.fc.nmvc;
...@@ -238,12 +238,12 @@ void vp9_write_nmv_probs(VP9_COMP* const cpi, int usehp, vp9_writer* const bc) { ...@@ -238,12 +238,12 @@ void vp9_write_nmv_probs(VP9_COMP* const cpi, int usehp, vp9_writer* const bc) {
for (i = 0; i < 2; ++i) { for (i = 0; i < 2; ++i) {
for (j = 0; j < CLASS0_SIZE; ++j) { for (j = 0; j < CLASS0_SIZE; ++j) {
int k; int k;
for (k = 0; k < 3; ++k) for (k = 0; k < MV_FP_SIZE - 1; ++k)
update_mv(bc, branch_ct_class0_fp[i][j][k], update_mv(bc, branch_ct_class0_fp[i][j][k],
&mvc->comps[i].class0_fp[j][k], NMV_UPDATE_PROB); &mvc->comps[i].class0_fp[j][k], NMV_UPDATE_PROB);
} }
for (j = 0; j < 3; ++j) for (j = 0; j < MV_FP_SIZE - 1; ++j)
update_mv(bc, branch_ct_fp[i][j], &mvc->comps[i].fp[j], NMV_UPDATE_PROB); update_mv(bc, branch_ct_fp[i][j], &mvc->comps[i].fp[j], NMV_UPDATE_PROB);
} }
......
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