Adding search_site_config struct.
Change-Id: I2ad333553e673dbabcdc0f0366aea311e90849bf
This commit is contained in:
parent
5573301dde
commit
aa464eca5e
@ -12,7 +12,7 @@ struct macroblockd;
|
|||||||
/* Encoder forward decls */
|
/* Encoder forward decls */
|
||||||
struct macroblock;
|
struct macroblock;
|
||||||
struct vp9_variance_vtable;
|
struct vp9_variance_vtable;
|
||||||
|
struct search_site_config;
|
||||||
struct mv;
|
struct mv;
|
||||||
union int_mv;
|
union int_mv;
|
||||||
struct yv12_buffer_config;
|
struct yv12_buffer_config;
|
||||||
@ -757,11 +757,11 @@ add_proto qw/int vp9_refining_search_sad/, "const struct macroblock *x, struct m
|
|||||||
specialize qw/vp9_refining_search_sad sse3/;
|
specialize qw/vp9_refining_search_sad sse3/;
|
||||||
$vp9_refining_search_sad_sse3=vp9_refining_search_sadx4;
|
$vp9_refining_search_sad_sse3=vp9_refining_search_sadx4;
|
||||||
|
|
||||||
add_proto qw/int vp9_diamond_search_sad/, "const struct macroblock *x, struct mv *ref_mv, struct mv *best_mv, int search_param, int sad_per_bit, int *num00, const struct vp9_variance_vtable *fn_ptr, const struct mv *center_mv";
|
add_proto qw/int vp9_diamond_search_sad/, "const struct macroblock *x, const struct search_site_config *cfg, struct mv *ref_mv, struct mv *best_mv, int search_param, int sad_per_bit, int *num00, const struct vp9_variance_vtable *fn_ptr, const struct mv *center_mv";
|
||||||
specialize qw/vp9_diamond_search_sad sse3/;
|
specialize qw/vp9_diamond_search_sad sse3/;
|
||||||
$vp9_diamond_search_sad_sse3=vp9_diamond_search_sadx4;
|
$vp9_diamond_search_sad_sse3=vp9_diamond_search_sadx4;
|
||||||
|
|
||||||
add_proto qw/int vp9_full_range_search/, "const struct macroblock *x, struct mv *ref_mv, struct mv *best_mv, int search_param, int sad_per_bit, int *num00, const struct vp9_variance_vtable *fn_ptr, const struct mv *center_mv";
|
add_proto qw/int vp9_full_range_search/, "const struct macroblock *x, const struct search_site_config *cfg, struct mv *ref_mv, struct mv *best_mv, int search_param, int sad_per_bit, int *num00, const struct vp9_variance_vtable *fn_ptr, const struct mv *center_mv";
|
||||||
specialize qw/vp9_full_range_search/;
|
specialize qw/vp9_full_range_search/;
|
||||||
|
|
||||||
add_proto qw/void vp9_temporal_filter_apply/, "uint8_t *frame1, unsigned int stride, uint8_t *frame2, unsigned int block_size, int strength, int filter_weight, unsigned int *accumulator, uint16_t *count";
|
add_proto qw/void vp9_temporal_filter_apply/, "uint8_t *frame1, unsigned int stride, uint8_t *frame2, unsigned int block_size, int strength, int filter_weight, unsigned int *accumulator, uint16_t *count";
|
||||||
|
@ -20,12 +20,6 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// motion search site
|
|
||||||
typedef struct {
|
|
||||||
MV mv;
|
|
||||||
int offset;
|
|
||||||
} search_site;
|
|
||||||
|
|
||||||
// Structure to hold snapshot of coding context during the mode picking process
|
// Structure to hold snapshot of coding context during the mode picking process
|
||||||
typedef struct {
|
typedef struct {
|
||||||
MODE_INFO mic;
|
MODE_INFO mic;
|
||||||
@ -108,10 +102,6 @@ struct macroblock {
|
|||||||
int skip_optimize;
|
int skip_optimize;
|
||||||
int q_index;
|
int q_index;
|
||||||
|
|
||||||
search_site *ss;
|
|
||||||
int ss_count;
|
|
||||||
int searches_per_step;
|
|
||||||
|
|
||||||
int errorperbit;
|
int errorperbit;
|
||||||
int sadperbit16;
|
int sadperbit16;
|
||||||
int sadperbit4;
|
int sadperbit4;
|
||||||
|
@ -501,9 +501,9 @@ static void update_frame_size(VP9_COMP *cpi) {
|
|||||||
int y_stride = cpi->scaled_source.y_stride;
|
int y_stride = cpi->scaled_source.y_stride;
|
||||||
|
|
||||||
if (cpi->sf.search_method == NSTEP) {
|
if (cpi->sf.search_method == NSTEP) {
|
||||||
vp9_init3smotion_compensation(&cpi->mb, y_stride);
|
vp9_init3smotion_compensation(&cpi->ss_cfg, y_stride);
|
||||||
} else if (cpi->sf.search_method == DIAMOND) {
|
} else if (cpi->sf.search_method == DIAMOND) {
|
||||||
vp9_init_dsmotion_compensation(&cpi->mb, y_stride);
|
vp9_init_dsmotion_compensation(&cpi->ss_cfg, y_stride);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -782,9 +782,6 @@ VP9_COMP *vp9_create_compressor(VP9EncoderConfig *oxcf) {
|
|||||||
|
|
||||||
cm->error.setjmp = 1;
|
cm->error.setjmp = 1;
|
||||||
|
|
||||||
CHECK_MEM_ERROR(cm, cpi->mb.ss, vpx_calloc(sizeof(search_site),
|
|
||||||
(MAX_MVSEARCH_STEPS * 8) + 1));
|
|
||||||
|
|
||||||
vp9_rtcd();
|
vp9_rtcd();
|
||||||
|
|
||||||
cpi->use_svc = 0;
|
cpi->use_svc = 0;
|
||||||
@ -1182,7 +1179,6 @@ void vp9_remove_compressor(VP9_COMP *cpi) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dealloc_compressor_data(cpi);
|
dealloc_compressor_data(cpi);
|
||||||
vpx_free(cpi->mb.ss);
|
|
||||||
vpx_free(cpi->tok);
|
vpx_free(cpi->tok);
|
||||||
|
|
||||||
for (i = 0; i < sizeof(cpi->mbgraph_stats) /
|
for (i = 0; i < sizeof(cpi->mbgraph_stats) /
|
||||||
|
@ -497,6 +497,8 @@ typedef struct VP9_COMP {
|
|||||||
|
|
||||||
int frame_flags;
|
int frame_flags;
|
||||||
|
|
||||||
|
search_site_config ss_cfg;
|
||||||
|
|
||||||
#if CONFIG_MULTIPLE_ARF
|
#if CONFIG_MULTIPLE_ARF
|
||||||
// ARF tracking variables.
|
// ARF tracking variables.
|
||||||
int multi_arf_enabled;
|
int multi_arf_enabled;
|
||||||
|
@ -418,7 +418,7 @@ static void first_pass_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
|
|||||||
v_fn_ptr.vf = get_block_variance_fn(bsize);
|
v_fn_ptr.vf = get_block_variance_fn(bsize);
|
||||||
|
|
||||||
// Center the initial step/diamond search on best mv.
|
// Center the initial step/diamond search on best mv.
|
||||||
tmp_err = cpi->diamond_search_sad(x, &ref_mv_full, &tmp_mv,
|
tmp_err = cpi->diamond_search_sad(x, &cpi->ss_cfg, &ref_mv_full, &tmp_mv,
|
||||||
step_param,
|
step_param,
|
||||||
x->sadperbit16, &num00, &v_fn_ptr, ref_mv);
|
x->sadperbit16, &num00, &v_fn_ptr, ref_mv);
|
||||||
if (tmp_err < INT_MAX)
|
if (tmp_err < INT_MAX)
|
||||||
@ -441,7 +441,7 @@ static void first_pass_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
|
|||||||
if (num00) {
|
if (num00) {
|
||||||
--num00;
|
--num00;
|
||||||
} else {
|
} else {
|
||||||
tmp_err = cpi->diamond_search_sad(x, &ref_mv_full, &tmp_mv,
|
tmp_err = cpi->diamond_search_sad(x, &cpi->ss_cfg, &ref_mv_full, &tmp_mv,
|
||||||
step_param + n, x->sadperbit16,
|
step_param + n, x->sadperbit16,
|
||||||
&num00, &v_fn_ptr, ref_mv);
|
&num00, &v_fn_ptr, ref_mv);
|
||||||
if (tmp_err < INT_MAX)
|
if (tmp_err < INT_MAX)
|
||||||
|
@ -101,32 +101,32 @@ static int mvsad_err_cost(const MACROBLOCK *x, const MV *mv, const MV *ref,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void vp9_init_dsmotion_compensation(MACROBLOCK *x, int stride) {
|
void vp9_init_dsmotion_compensation(search_site_config *cfg, int stride) {
|
||||||
int len, ss_count = 1;
|
int len, ss_count = 1;
|
||||||
|
|
||||||
x->ss[0].mv.col = x->ss[0].mv.row = 0;
|
cfg->ss[0].mv.col = cfg->ss[0].mv.row = 0;
|
||||||
x->ss[0].offset = 0;
|
cfg->ss[0].offset = 0;
|
||||||
|
|
||||||
for (len = MAX_FIRST_STEP; len > 0; len /= 2) {
|
for (len = MAX_FIRST_STEP; len > 0; len /= 2) {
|
||||||
// Generate offsets for 4 search sites per step.
|
// Generate offsets for 4 search sites per step.
|
||||||
const MV ss_mvs[] = {{-len, 0}, {len, 0}, {0, -len}, {0, len}};
|
const MV ss_mvs[] = {{-len, 0}, {len, 0}, {0, -len}, {0, len}};
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < 4; ++i) {
|
for (i = 0; i < 4; ++i) {
|
||||||
search_site *const ss = &x->ss[ss_count++];
|
search_site *const ss = &cfg->ss[ss_count++];
|
||||||
ss->mv = ss_mvs[i];
|
ss->mv = ss_mvs[i];
|
||||||
ss->offset = ss->mv.row * stride + ss->mv.col;
|
ss->offset = ss->mv.row * stride + ss->mv.col;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
x->ss_count = ss_count;
|
cfg->ss_count = ss_count;
|
||||||
x->searches_per_step = 4;
|
cfg->searches_per_step = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
void vp9_init3smotion_compensation(MACROBLOCK *x, int stride) {
|
void vp9_init3smotion_compensation(search_site_config *cfg, int stride) {
|
||||||
int len, ss_count = 1;
|
int len, ss_count = 1;
|
||||||
|
|
||||||
x->ss[0].mv.col = x->ss[0].mv.row = 0;
|
cfg->ss[0].mv.col = cfg->ss[0].mv.row = 0;
|
||||||
x->ss[0].offset = 0;
|
cfg->ss[0].offset = 0;
|
||||||
|
|
||||||
for (len = MAX_FIRST_STEP; len > 0; len /= 2) {
|
for (len = MAX_FIRST_STEP; len > 0; len /= 2) {
|
||||||
// Generate offsets for 8 search sites per step.
|
// Generate offsets for 8 search sites per step.
|
||||||
@ -136,14 +136,14 @@ void vp9_init3smotion_compensation(MACROBLOCK *x, int stride) {
|
|||||||
};
|
};
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < 8; ++i) {
|
for (i = 0; i < 8; ++i) {
|
||||||
search_site *const ss = &x->ss[ss_count++];
|
search_site *const ss = &cfg->ss[ss_count++];
|
||||||
ss->mv = ss_mvs[i];
|
ss->mv = ss_mvs[i];
|
||||||
ss->offset = ss->mv.row * stride + ss->mv.col;
|
ss->offset = ss->mv.row * stride + ss->mv.col;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
x->ss_count = ss_count;
|
cfg->ss_count = ss_count;
|
||||||
x->searches_per_step = 8;
|
cfg->searches_per_step = 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -871,7 +871,9 @@ int vp9_fast_dia_search(const MACROBLOCK *x,
|
|||||||
|
|
||||||
#undef CHECK_BETTER
|
#undef CHECK_BETTER
|
||||||
|
|
||||||
int vp9_full_range_search_c(const MACROBLOCK *x, MV *ref_mv, MV *best_mv,
|
int vp9_full_range_search_c(const MACROBLOCK *x,
|
||||||
|
const search_site_config *cfg,
|
||||||
|
MV *ref_mv, MV *best_mv,
|
||||||
int search_param, int sad_per_bit, int *num00,
|
int search_param, int sad_per_bit, int *num00,
|
||||||
const vp9_variance_fn_ptr_t *fn_ptr,
|
const vp9_variance_fn_ptr_t *fn_ptr,
|
||||||
const MV *center_mv) {
|
const MV *center_mv) {
|
||||||
@ -962,6 +964,7 @@ int vp9_full_range_search_c(const MACROBLOCK *x, MV *ref_mv, MV *best_mv,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int vp9_diamond_search_sad_c(const MACROBLOCK *x,
|
int vp9_diamond_search_sad_c(const MACROBLOCK *x,
|
||||||
|
const search_site_config *cfg,
|
||||||
MV *ref_mv, MV *best_mv,
|
MV *ref_mv, MV *best_mv,
|
||||||
int search_param, int sad_per_bit, int *num00,
|
int search_param, int sad_per_bit, int *num00,
|
||||||
const vp9_variance_fn_ptr_t *fn_ptr,
|
const vp9_variance_fn_ptr_t *fn_ptr,
|
||||||
@ -973,8 +976,8 @@ int vp9_diamond_search_sad_c(const MACROBLOCK *x,
|
|||||||
// of iterations
|
// of iterations
|
||||||
// 0 = initial step (MAX_FIRST_STEP) pel : 1 = (MAX_FIRST_STEP/2) pel, 2 =
|
// 0 = initial step (MAX_FIRST_STEP) pel : 1 = (MAX_FIRST_STEP/2) pel, 2 =
|
||||||
// (MAX_FIRST_STEP/4) pel... etc.
|
// (MAX_FIRST_STEP/4) pel... etc.
|
||||||
const search_site *const ss = &x->ss[search_param * x->searches_per_step];
|
const search_site *const ss = &cfg->ss[search_param * cfg->searches_per_step];
|
||||||
const int tot_steps = (x->ss_count / x->searches_per_step) - search_param;
|
const int tot_steps = (cfg->ss_count / cfg->searches_per_step) - search_param;
|
||||||
const MV fcenter_mv = {center_mv->row >> 3, center_mv->col >> 3};
|
const MV fcenter_mv = {center_mv->row >> 3, center_mv->col >> 3};
|
||||||
const uint8_t *best_address, *in_what_ref;
|
const uint8_t *best_address, *in_what_ref;
|
||||||
int best_sad = INT_MAX;
|
int best_sad = INT_MAX;
|
||||||
@ -996,7 +999,7 @@ int vp9_diamond_search_sad_c(const MACROBLOCK *x,
|
|||||||
i = 1;
|
i = 1;
|
||||||
|
|
||||||
for (step = 0; step < tot_steps; step++) {
|
for (step = 0; step < tot_steps; step++) {
|
||||||
for (j = 0; j < x->searches_per_step; j++) {
|
for (j = 0; j < cfg->searches_per_step; j++) {
|
||||||
const MV mv = {best_mv->row + ss[i].mv.row,
|
const MV mv = {best_mv->row + ss[i].mv.row,
|
||||||
best_mv->col + ss[i].mv.col};
|
best_mv->col + ss[i].mv.col};
|
||||||
if (is_mv_in(x, &mv)) {
|
if (is_mv_in(x, &mv)) {
|
||||||
@ -1050,6 +1053,7 @@ int vp9_diamond_search_sad_c(const MACROBLOCK *x,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int vp9_diamond_search_sadx4(const MACROBLOCK *x,
|
int vp9_diamond_search_sadx4(const MACROBLOCK *x,
|
||||||
|
const search_site_config *cfg,
|
||||||
MV *ref_mv, MV *best_mv, int search_param,
|
MV *ref_mv, MV *best_mv, int search_param,
|
||||||
int sad_per_bit, int *num00,
|
int sad_per_bit, int *num00,
|
||||||
const vp9_variance_fn_ptr_t *fn_ptr,
|
const vp9_variance_fn_ptr_t *fn_ptr,
|
||||||
@ -1075,8 +1079,8 @@ int vp9_diamond_search_sadx4(const MACROBLOCK *x,
|
|||||||
// 0 = initial step (MAX_FIRST_STEP) pel
|
// 0 = initial step (MAX_FIRST_STEP) pel
|
||||||
// 1 = (MAX_FIRST_STEP/2) pel,
|
// 1 = (MAX_FIRST_STEP/2) pel,
|
||||||
// 2 = (MAX_FIRST_STEP/4) pel...
|
// 2 = (MAX_FIRST_STEP/4) pel...
|
||||||
const search_site *ss = &x->ss[search_param * x->searches_per_step];
|
const search_site *ss = &cfg->ss[search_param * cfg->searches_per_step];
|
||||||
const int tot_steps = (x->ss_count / x->searches_per_step) - search_param;
|
const int tot_steps = (cfg->ss_count / cfg->searches_per_step) - search_param;
|
||||||
|
|
||||||
const MV fcenter_mv = {center_mv->row >> 3, center_mv->col >> 3};
|
const MV fcenter_mv = {center_mv->row >> 3, center_mv->col >> 3};
|
||||||
clamp_mv(ref_mv, x->mv_col_min, x->mv_col_max, x->mv_row_min, x->mv_row_max);
|
clamp_mv(ref_mv, x->mv_col_min, x->mv_col_max, x->mv_row_min, x->mv_row_max);
|
||||||
@ -1112,7 +1116,7 @@ int vp9_diamond_search_sadx4(const MACROBLOCK *x,
|
|||||||
if (all_in) {
|
if (all_in) {
|
||||||
unsigned int sad_array[4];
|
unsigned int sad_array[4];
|
||||||
|
|
||||||
for (j = 0; j < x->searches_per_step; j += 4) {
|
for (j = 0; j < cfg->searches_per_step; j += 4) {
|
||||||
unsigned char const *block_offset[4];
|
unsigned char const *block_offset[4];
|
||||||
|
|
||||||
for (t = 0; t < 4; t++)
|
for (t = 0; t < 4; t++)
|
||||||
@ -1135,7 +1139,7 @@ int vp9_diamond_search_sadx4(const MACROBLOCK *x,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (j = 0; j < x->searches_per_step; j++) {
|
for (j = 0; j < cfg->searches_per_step; j++) {
|
||||||
// Trap illegal vectors
|
// Trap illegal vectors
|
||||||
const MV this_mv = {best_mv->row + ss[i].mv.row,
|
const MV this_mv = {best_mv->row + ss[i].mv.row,
|
||||||
best_mv->col + ss[i].mv.col};
|
best_mv->col + ss[i].mv.col};
|
||||||
@ -1202,7 +1206,7 @@ int vp9_full_pixel_diamond(const VP9_COMP *cpi, MACROBLOCK *x,
|
|||||||
const MV *ref_mv, MV *dst_mv) {
|
const MV *ref_mv, MV *dst_mv) {
|
||||||
MV temp_mv;
|
MV temp_mv;
|
||||||
int thissme, n, num00 = 0;
|
int thissme, n, num00 = 0;
|
||||||
int bestsme = cpi->diamond_search_sad(x, mvp_full, &temp_mv,
|
int bestsme = cpi->diamond_search_sad(x, &cpi->ss_cfg, mvp_full, &temp_mv,
|
||||||
step_param, sadpb, &n,
|
step_param, sadpb, &n,
|
||||||
fn_ptr, ref_mv);
|
fn_ptr, ref_mv);
|
||||||
if (bestsme < INT_MAX)
|
if (bestsme < INT_MAX)
|
||||||
@ -1220,7 +1224,7 @@ int vp9_full_pixel_diamond(const VP9_COMP *cpi, MACROBLOCK *x,
|
|||||||
if (num00) {
|
if (num00) {
|
||||||
num00--;
|
num00--;
|
||||||
} else {
|
} else {
|
||||||
thissme = cpi->diamond_search_sad(x, mvp_full, &temp_mv,
|
thissme = cpi->diamond_search_sad(x, &cpi->ss_cfg, mvp_full, &temp_mv,
|
||||||
step_param + n, sadpb, &num00,
|
step_param + n, sadpb, &num00,
|
||||||
fn_ptr, ref_mv);
|
fn_ptr, ref_mv);
|
||||||
if (thissme < INT_MAX)
|
if (thissme < INT_MAX)
|
||||||
|
@ -31,6 +31,20 @@ extern "C" {
|
|||||||
// for Block_16x16
|
// for Block_16x16
|
||||||
#define BORDER_MV_PIXELS_B16 (16 + VP9_INTERP_EXTEND)
|
#define BORDER_MV_PIXELS_B16 (16 + VP9_INTERP_EXTEND)
|
||||||
|
|
||||||
|
// motion search site
|
||||||
|
typedef struct search_site {
|
||||||
|
MV mv;
|
||||||
|
int offset;
|
||||||
|
} search_site;
|
||||||
|
|
||||||
|
typedef struct search_site_config {
|
||||||
|
search_site ss[8 * MAX_MVSEARCH_STEPS + 1];
|
||||||
|
int ss_count;
|
||||||
|
int searches_per_step;
|
||||||
|
} search_site_config;
|
||||||
|
|
||||||
|
void vp9_init_dsmotion_compensation(search_site_config *cfg, int stride);
|
||||||
|
void vp9_init3smotion_compensation(search_site_config *cfg, int stride);
|
||||||
|
|
||||||
void vp9_set_mv_search_range(MACROBLOCK *x, const MV *mv);
|
void vp9_set_mv_search_range(MACROBLOCK *x, const MV *mv);
|
||||||
int vp9_mv_bit_cost(const MV *mv, const MV *ref,
|
int vp9_mv_bit_cost(const MV *mv, const MV *ref,
|
||||||
@ -46,8 +60,6 @@ int vp9_get_mvpred_av_var(const MACROBLOCK *x,
|
|||||||
const uint8_t *second_pred,
|
const uint8_t *second_pred,
|
||||||
const vp9_variance_fn_ptr_t *vfp,
|
const vp9_variance_fn_ptr_t *vfp,
|
||||||
int use_mvcost);
|
int use_mvcost);
|
||||||
void vp9_init_dsmotion_compensation(MACROBLOCK *x, int stride);
|
|
||||||
void vp9_init3smotion_compensation(MACROBLOCK *x, int stride);
|
|
||||||
|
|
||||||
struct VP9_COMP;
|
struct VP9_COMP;
|
||||||
int vp9_init_search_range(struct VP9_COMP *cpi, int size);
|
int vp9_init_search_range(struct VP9_COMP *cpi, int size);
|
||||||
@ -119,6 +131,7 @@ typedef int (*vp9_refining_search_fn_t)(const MACROBLOCK *x,
|
|||||||
const MV *center_mv);
|
const MV *center_mv);
|
||||||
|
|
||||||
typedef int (*vp9_diamond_search_fn_t)(const MACROBLOCK *x,
|
typedef int (*vp9_diamond_search_fn_t)(const MACROBLOCK *x,
|
||||||
|
const search_site_config *cfg,
|
||||||
MV *ref_mv, MV *best_mv,
|
MV *ref_mv, MV *best_mv,
|
||||||
int search_param, int sad_per_bit,
|
int search_param, int sad_per_bit,
|
||||||
int *num00,
|
int *num00,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user