Commit fa502297 authored by Debargha Mukherjee's avatar Debargha Mukherjee Committed by Gerrit Code Review
Browse files

Merge "Wedge refactoring to handle signs better" into nextgenv2

parents 8c9f6c55 e5de2ad6
This diff is collapsed.
......@@ -149,51 +149,60 @@ static INLINE void highbd_inter_predictor(const uint8_t *src, int src_stride,
#endif // CONFIG_VP9_HIGHBITDEPTH
#if CONFIG_EXT_INTER
#define WEDGE_BITS_2 2
#define WEDGE_BITS_3 3
#define WEDGE_BITS_4 4
#define WEDGE_BITS_5 5
#define WEDGE_NONE -1
#define MAX_WEDGE_TYPES (1 << 5)
#define WEDGE_WEIGHT_BITS 6
static const int get_wedge_bits_lookup[BLOCK_SIZES] = {
0,
0,
0,
WEDGE_BITS_4,
WEDGE_BITS_4,
WEDGE_BITS_4,
WEDGE_BITS_4,
WEDGE_BITS_4,
WEDGE_BITS_4,
WEDGE_BITS_4,
0,
0,
0,
#if CONFIG_EXT_PARTITION
0,
0,
0,
#endif // CONFIG_EXT_PARTITION
};
#define WEDGE_NONE -1
// Angles are with respect to horizontal anti-clockwise
typedef enum {
WEDGE_HORIZONTAL = 0,
WEDGE_VERTICAL = 1,
WEDGE_OBLIQUE27 = 2,
WEDGE_OBLIQUE63 = 3,
WEDGE_OBLIQUE117 = 4,
WEDGE_OBLIQUE153 = 5,
WEDGE_DIRECTIONS
} WedgeDirectionType;
// 3-tuple: {direction, x_offset, y_offset}
typedef struct {
WedgeDirectionType direction;
int x_offset;
int y_offset;
} wedge_code_type;
typedef struct {
int bits;
const wedge_code_type *codebook;
uint8_t *signflip;
int smoother;
} wedge_params_type;
extern const wedge_params_type wedge_params_lookup[BLOCK_SIZES];
static INLINE int get_wedge_bits_lookup(BLOCK_SIZE sb_type) {
return wedge_params_lookup[sb_type].bits;
}
static INLINE int is_interinter_wedge_used(BLOCK_SIZE sb_type) {
(void) sb_type;
return get_wedge_bits_lookup[sb_type] > 0;
return wedge_params_lookup[sb_type].bits > 0;
}
static INLINE int get_interinter_wedge_bits(BLOCK_SIZE sb_type) {
const int wbits = get_wedge_bits_lookup[sb_type];
const int wbits = wedge_params_lookup[sb_type].bits;
return (wbits > 0) ? wbits + 1 : 0;
}
static INLINE int is_interintra_wedge_used(BLOCK_SIZE sb_type) {
(void) sb_type;
return get_wedge_bits_lookup[sb_type] > 0;
return wedge_params_lookup[sb_type].bits > 0;
}
static INLINE int get_interintra_wedge_bits(BLOCK_SIZE sb_type) {
return get_wedge_bits_lookup[sb_type];
return wedge_params_lookup[sb_type].bits;
}
#endif // CONFIG_EXT_INTER
......
......@@ -1577,7 +1577,7 @@ static void read_inter_block_mode_info(VP10Decoder *const pbi,
xd->counts->wedge_interintra[bsize][mbmi->use_wedge_interintra]++;
if (mbmi->use_wedge_interintra) {
mbmi->interintra_wedge_index =
vp10_read_literal(r, get_wedge_bits_lookup[bsize]);
vp10_read_literal(r, get_wedge_bits_lookup(bsize));
mbmi->interintra_wedge_sign = 0;
}
}
......@@ -1610,7 +1610,7 @@ static void read_inter_block_mode_info(VP10Decoder *const pbi,
xd->counts->wedge_interinter[bsize][mbmi->use_wedge_interinter]++;
if (mbmi->use_wedge_interinter) {
mbmi->interinter_wedge_index =
vp10_read_literal(r, get_wedge_bits_lookup[bsize]);
vp10_read_literal(r, get_wedge_bits_lookup(bsize));
mbmi->interinter_wedge_sign = vp10_read_bit(r);
}
}
......
......@@ -1338,7 +1338,7 @@ static void pack_inter_mode_mvs(VP10_COMP *cpi, const MODE_INFO *mi,
cm->fc->wedge_interintra_prob[bsize]);
if (mbmi->use_wedge_interintra) {
vp10_write_literal(w, mbmi->interintra_wedge_index,
get_wedge_bits_lookup[bsize]);
get_wedge_bits_lookup(bsize));
assert(mbmi->interintra_wedge_sign == 0);
}
}
......@@ -1368,7 +1368,7 @@ static void pack_inter_mode_mvs(VP10_COMP *cpi, const MODE_INFO *mi,
cm->fc->wedge_interinter_prob[bsize]);
if (mbmi->use_wedge_interinter) {
vp10_write_literal(w, mbmi->interinter_wedge_index,
get_wedge_bits_lookup[bsize]);
get_wedge_bits_lookup(bsize));
vp10_write_bit(w, mbmi->interinter_wedge_sign);
}
}
......
......@@ -7146,7 +7146,7 @@ static int64_t handle_inter_mode(VP10_COMP *cpi, MACROBLOCK *x,
mbmi->use_wedge_interinter = 1;
rs = vp10_cost_literal(get_interinter_wedge_bits(bsize)) +
vp10_cost_bit(cm->fc->wedge_interinter_prob[bsize], 1);
wedge_types = (1 << get_wedge_bits_lookup[bsize]);
wedge_types = (1 << get_wedge_bits_lookup(bsize));
vp10_build_inter_predictors_for_planes_single_buf(
xd, bsize, 0, 0, mi_row, mi_col, 0, preds0, strides);
......@@ -7384,7 +7384,7 @@ static int64_t handle_inter_mode(VP10_COMP *cpi, MACROBLOCK *x,
// Disbale wedge search if source variance is small
if (x->source_variance > cpi->sf.disable_wedge_search_var_thresh) {
mbmi->use_wedge_interintra = 1;
wedge_types = (1 << get_wedge_bits_lookup[bsize]);
wedge_types = (1 << get_wedge_bits_lookup(bsize));
rwedge = vp10_cost_literal(get_interintra_wedge_bits(bsize)) +
vp10_cost_bit(cm->fc->wedge_interintra_prob[bsize], 1);
for (wedge_index = 0; wedge_index < wedge_types; ++wedge_index) {
......
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