2010-05-18 17:58:33 +02:00
|
|
|
/*
|
2010-09-09 14:16:39 +02:00
|
|
|
* Copyright (c) 2010 The WebM project authors. All Rights Reserved.
|
2010-05-18 17:58:33 +02:00
|
|
|
*
|
2010-06-18 18:39:21 +02:00
|
|
|
* Use of this source code is governed by a BSD-style license
|
2010-06-04 22:19:40 +02:00
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
2010-06-18 18:39:21 +02:00
|
|
|
* in the file PATENTS. All contributing project authors may
|
2010-06-04 22:19:40 +02:00
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
2010-05-18 17:58:33 +02:00
|
|
|
*/
|
|
|
|
|
2012-11-30 01:36:10 +01:00
|
|
|
#ifndef VP9_ENCODER_VP9_MCOMP_H_
|
|
|
|
#define VP9_ENCODER_VP9_MCOMP_H_
|
2010-05-18 17:58:33 +02:00
|
|
|
|
2012-11-28 19:41:40 +01:00
|
|
|
#include "vp9/encoder/vp9_block.h"
|
2015-06-05 18:54:19 +02:00
|
|
|
#include "vpx_dsp/variance.h"
|
2010-05-18 17:58:33 +02:00
|
|
|
|
2014-01-18 21:16:11 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2013-03-06 21:02:15 +01:00
|
|
|
// The maximum number of steps in a step search given the largest
|
|
|
|
// allowed initial step
|
2013-03-12 05:51:00 +01:00
|
|
|
#define MAX_MVSEARCH_STEPS 11
|
2013-11-16 05:32:03 +01:00
|
|
|
// Max full pel mv specified in the unit of full pixel
|
|
|
|
// Enable the use of motion vector in range [-1023, 1023].
|
|
|
|
#define MAX_FULL_PEL_VAL ((1 << (MAX_MVSEARCH_STEPS - 1)) - 1)
|
2013-03-06 21:02:15 +01:00
|
|
|
// Maximum size of the first step in full pel units
|
2016-07-27 05:43:23 +02:00
|
|
|
#define MAX_FIRST_STEP (1 << (MAX_MVSEARCH_STEPS - 1))
|
2013-09-24 22:47:29 +02:00
|
|
|
// Allowed motion vector pixel distance outside image border
|
|
|
|
// for Block_16x16
|
|
|
|
#define BORDER_MV_PIXELS_B16 (16 + VP9_INTERP_EXTEND)
|
|
|
|
|
2014-04-26 03:22:27 +02:00
|
|
|
typedef struct search_site_config {
|
2015-10-26 10:39:38 +01:00
|
|
|
// motion search sites
|
2016-07-27 05:43:23 +02:00
|
|
|
MV ss_mv[8 * MAX_MVSEARCH_STEPS]; // Motion vector
|
|
|
|
intptr_t ss_os[8 * MAX_MVSEARCH_STEPS]; // Offset
|
2014-04-26 03:22:27 +02:00
|
|
|
int searches_per_step;
|
2015-10-28 15:35:04 +01:00
|
|
|
int total_steps;
|
2014-04-26 03:22:27 +02:00
|
|
|
} search_site_config;
|
|
|
|
|
|
|
|
void vp9_init_dsmotion_compensation(search_site_config *cfg, int stride);
|
2016-07-27 05:43:23 +02:00
|
|
|
void vp9_init3smotion_compensation(search_site_config *cfg, int stride);
|
2010-05-18 17:58:33 +02:00
|
|
|
|
2016-08-08 20:42:27 +02:00
|
|
|
void vp9_set_mv_search_range(MvLimits *mv_limits, const MV *mv);
|
2016-07-27 05:43:23 +02:00
|
|
|
int vp9_mv_bit_cost(const MV *mv, const MV *ref, const int *mvjcost,
|
|
|
|
int *mvcost[2], int weight);
|
2014-02-28 23:29:22 +01:00
|
|
|
|
|
|
|
// Utility to compute variance + MV rate cost for a given MV
|
2016-07-27 05:43:23 +02:00
|
|
|
int vp9_get_mvpred_var(const MACROBLOCK *x, const MV *best_mv,
|
|
|
|
const MV *center_mv, const vp9_variance_fn_ptr_t *vfp,
|
2014-02-28 23:29:22 +01:00
|
|
|
int use_mvcost);
|
2016-07-27 05:43:23 +02:00
|
|
|
int vp9_get_mvpred_av_var(const MACROBLOCK *x, const MV *best_mv,
|
|
|
|
const MV *center_mv, const uint8_t *second_pred,
|
|
|
|
const vp9_variance_fn_ptr_t *vfp, int use_mvcost);
|
2013-02-28 23:40:20 +01:00
|
|
|
|
2012-10-31 01:53:32 +01:00
|
|
|
struct VP9_COMP;
|
2014-05-02 01:36:51 +02:00
|
|
|
struct SPEED_FEATURES;
|
|
|
|
|
2014-07-11 18:52:26 +02:00
|
|
|
int vp9_init_search_range(int size);
|
2013-06-24 16:19:16 +02:00
|
|
|
|
2016-07-27 05:43:23 +02:00
|
|
|
int vp9_refining_search_sad(const struct macroblock *x, struct mv *ref_mv,
|
2014-11-17 20:25:43 +01:00
|
|
|
int sad_per_bit, int distance,
|
|
|
|
const struct vp9_variance_vtable *fn_ptr,
|
|
|
|
const struct mv *center_mv);
|
|
|
|
|
2015-03-04 19:28:33 +01:00
|
|
|
// Perform integral projection based motion estimation.
|
|
|
|
unsigned int vp9_int_pro_motion_estimation(const struct VP9_COMP *cpi,
|
2016-07-27 05:43:23 +02:00
|
|
|
MACROBLOCK *x, BLOCK_SIZE bsize,
|
2015-05-22 21:03:58 +02:00
|
|
|
int mi_row, int mi_col);
|
2015-03-04 19:28:33 +01:00
|
|
|
|
2016-07-27 05:43:23 +02:00
|
|
|
typedef uint32_t(fractional_mv_step_fp)(
|
|
|
|
const MACROBLOCK *x, MV *bestmv, const MV *ref_mv, int allow_hp,
|
|
|
|
int error_per_bit, const vp9_variance_fn_ptr_t *vfp,
|
2013-08-08 02:01:43 +02:00
|
|
|
int forced_stop, // 0 - full, 1 - qtr only, 2 - half only
|
2016-07-27 05:43:23 +02:00
|
|
|
int iters_per_step, int *cost_list, int *mvjcost, int *mvcost[2],
|
|
|
|
uint32_t *distortion, uint32_t *sse1, const uint8_t *second_pred, int w,
|
|
|
|
int h);
|
2013-12-19 20:20:56 +01:00
|
|
|
|
2014-07-09 23:50:50 +02:00
|
|
|
extern fractional_mv_step_fp vp9_find_best_sub_pixel_tree;
|
2014-08-27 23:06:30 +02:00
|
|
|
extern fractional_mv_step_fp vp9_find_best_sub_pixel_tree_pruned;
|
2014-09-24 22:25:34 +02:00
|
|
|
extern fractional_mv_step_fp vp9_find_best_sub_pixel_tree_pruned_more;
|
2014-10-07 11:48:08 +02:00
|
|
|
extern fractional_mv_step_fp vp9_find_best_sub_pixel_tree_pruned_evenmore;
|
2016-03-14 18:09:57 +01:00
|
|
|
extern fractional_mv_step_fp vp9_skip_sub_pixel_tree;
|
2017-03-31 19:39:57 +02:00
|
|
|
extern fractional_mv_step_fp vp9_return_max_sub_pixel_mv;
|
|
|
|
extern fractional_mv_step_fp vp9_return_min_sub_pixel_mv;
|
2010-05-18 17:58:33 +02:00
|
|
|
|
2016-07-27 05:43:23 +02:00
|
|
|
typedef int (*vp9_full_search_fn_t)(const MACROBLOCK *x, const MV *ref_mv,
|
|
|
|
int sad_per_bit, int distance,
|
2014-02-12 23:28:23 +01:00
|
|
|
const vp9_variance_fn_ptr_t *fn_ptr,
|
2014-02-17 14:24:57 +01:00
|
|
|
const MV *center_mv, MV *best_mv);
|
2012-11-06 01:58:03 +01:00
|
|
|
|
2016-07-27 05:43:23 +02:00
|
|
|
typedef int (*vp9_refining_search_fn_t)(const MACROBLOCK *x, MV *ref_mv,
|
|
|
|
int sad_per_bit, int distance,
|
2014-02-12 23:28:23 +01:00
|
|
|
const vp9_variance_fn_ptr_t *fn_ptr,
|
2013-12-14 00:24:48 +01:00
|
|
|
const MV *center_mv);
|
2012-11-06 01:58:03 +01:00
|
|
|
|
2016-07-27 05:43:23 +02:00
|
|
|
typedef int (*vp9_diamond_search_fn_t)(
|
|
|
|
const MACROBLOCK *x, const search_site_config *cfg, MV *ref_mv, MV *best_mv,
|
|
|
|
int search_param, int sad_per_bit, int *num00,
|
|
|
|
const vp9_variance_fn_ptr_t *fn_ptr, const MV *center_mv);
|
2010-05-18 17:58:33 +02:00
|
|
|
|
2016-07-27 05:43:23 +02:00
|
|
|
int vp9_refining_search_8p_c(const MACROBLOCK *x, MV *ref_mv, int error_per_bit,
|
2014-02-12 23:28:23 +01:00
|
|
|
int search_range,
|
|
|
|
const vp9_variance_fn_ptr_t *fn_ptr,
|
2014-05-14 15:06:16 +02:00
|
|
|
const MV *center_mv, const uint8_t *second_pred);
|
2014-06-12 22:06:37 +02:00
|
|
|
|
|
|
|
struct VP9_COMP;
|
|
|
|
|
2016-07-27 05:43:23 +02:00
|
|
|
int vp9_full_pixel_search(struct VP9_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bsize,
|
2017-02-01 12:04:49 +01:00
|
|
|
MV *mvp_full, int step_param, int search_method,
|
|
|
|
int error_per_bit, int *cost_list, const MV *ref_mv,
|
|
|
|
MV *tmp_mv, int var_max, int rd);
|
2014-08-27 23:06:30 +02:00
|
|
|
|
2017-03-22 15:08:59 +01:00
|
|
|
void vp9_set_subpel_mv_search_range(MvLimits *subpel_mv_limits,
|
|
|
|
const MvLimits *umv_window_limits,
|
|
|
|
const MV *ref_mv);
|
|
|
|
|
2014-01-18 21:16:11 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
} // extern "C"
|
|
|
|
#endif
|
|
|
|
|
2012-12-19 00:31:19 +01:00
|
|
|
#endif // VP9_ENCODER_VP9_MCOMP_H_
|