Commit c27fcccc authored by Urvang Joshi's avatar Urvang Joshi

Code cleanup: mainly rd_pick_partition and methods called from there.

- Const correctness
- Refactoring
- Make variables local when possible
etc
- Remove -Wcast-qual to allow explicitly casting away const.

Change-Id: I6ecb7d345162dc08ccdd17095b0800fb3a00cf2f
parent b910c0bd
...@@ -242,7 +242,7 @@ typedef struct macroblockd { ...@@ -242,7 +242,7 @@ typedef struct macroblockd {
FRAME_CONTEXT *fc; FRAME_CONTEXT *fc;
/* pointers to reference frames */ /* pointers to reference frames */
RefBuffer *block_refs[2]; const RefBuffer *block_refs[2];
/* pointer to current frame */ /* pointer to current frame */
const YV12_BUFFER_CONFIG *cur_buf; const YV12_BUFFER_CONFIG *cur_buf;
......
...@@ -673,8 +673,8 @@ void av1_find_best_ref_mvs(int allow_hp, int_mv *mvlist, int_mv *nearest_mv, ...@@ -673,8 +673,8 @@ void av1_find_best_ref_mvs(int allow_hp, int_mv *mvlist, int_mv *nearest_mv,
*near_mv = mvlist[1]; *near_mv = mvlist[1];
} }
void av1_append_sub8x8_mvs_for_idx(AV1_COMMON *cm, MACROBLOCKD *xd, int block, void av1_append_sub8x8_mvs_for_idx(const AV1_COMMON *cm, MACROBLOCKD *xd,
int ref, int mi_row, int mi_col, int block, int ref, int mi_row, int mi_col,
int_mv *nearest_mv, int_mv *near_mv) { int_mv *nearest_mv, int_mv *near_mv) {
int_mv mv_list[MAX_MV_REF_CANDIDATES]; int_mv mv_list[MAX_MV_REF_CANDIDATES];
MODE_INFO *const mi = xd->mi[0]; MODE_INFO *const mi = xd->mi[0];
......
...@@ -435,8 +435,8 @@ void av1_find_mv_refs(const AV1_COMMON *cm, const MACROBLOCKD *xd, ...@@ -435,8 +435,8 @@ void av1_find_mv_refs(const AV1_COMMON *cm, const MACROBLOCKD *xd,
void av1_find_best_ref_mvs(int allow_hp, int_mv *mvlist, int_mv *nearest_mv, void av1_find_best_ref_mvs(int allow_hp, int_mv *mvlist, int_mv *nearest_mv,
int_mv *near_mv); int_mv *near_mv);
void av1_append_sub8x8_mvs_for_idx(AV1_COMMON *cm, MACROBLOCKD *xd, int block, void av1_append_sub8x8_mvs_for_idx(const AV1_COMMON *cm, MACROBLOCKD *xd,
int ref, int mi_row, int mi_col, int block, int ref, int mi_row, int mi_col,
int_mv *nearest_mv, int_mv *near_mv); int_mv *nearest_mv, int_mv *near_mv);
#ifdef __cplusplus #ifdef __cplusplus
......
...@@ -355,7 +355,8 @@ static INLINE YV12_BUFFER_CONFIG *get_ref_frame(AV1_COMMON *cm, int index) { ...@@ -355,7 +355,8 @@ static INLINE YV12_BUFFER_CONFIG *get_ref_frame(AV1_COMMON *cm, int index) {
return &cm->buffer_pool->frame_bufs[cm->ref_frame_map[index]].buf; return &cm->buffer_pool->frame_bufs[cm->ref_frame_map[index]].buf;
} }
static INLINE YV12_BUFFER_CONFIG *get_frame_new_buffer(AV1_COMMON *cm) { static INLINE YV12_BUFFER_CONFIG *get_frame_new_buffer(
const AV1_COMMON *const cm) {
return &cm->buffer_pool->frame_bufs[cm->new_fb_idx].buf; return &cm->buffer_pool->frame_bufs[cm->new_fb_idx].buf;
} }
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
extern "C" { extern "C" {
#endif #endif
static INLINE int get_segment_id(const AV1_COMMON *cm, static INLINE int get_segment_id(const AV1_COMMON *const cm,
const uint8_t *segment_ids, BLOCK_SIZE bsize, const uint8_t *segment_ids, BLOCK_SIZE bsize,
int mi_row, int mi_col) { int mi_row, int mi_col) {
const int mi_offset = mi_row * cm->mi_cols + mi_col; const int mi_offset = mi_row * cm->mi_cols + mi_col;
......
...@@ -407,7 +407,7 @@ void av1_setup_obmc_mask(int length, const uint8_t *mask[2]) { ...@@ -407,7 +407,7 @@ void av1_setup_obmc_mask(int length, const uint8_t *mask[2]) {
// top/left neighboring blocks' inter predictors with the regular inter // top/left neighboring blocks' inter predictors with the regular inter
// prediction. We assume the original prediction (bmc) is stored in // prediction. We assume the original prediction (bmc) is stored in
// xd->plane[].dst.buf // xd->plane[].dst.buf
void av1_build_obmc_inter_prediction(AV1_COMMON *cm, MACROBLOCKD *xd, void av1_build_obmc_inter_prediction(const AV1_COMMON *cm, MACROBLOCKD *xd,
int mi_row, int mi_col, int mi_row, int mi_col,
int use_tmp_dst_buf, int use_tmp_dst_buf,
uint8_t *final_buf[MAX_MB_PLANE], uint8_t *final_buf[MAX_MB_PLANE],
...@@ -573,7 +573,7 @@ void av1_build_obmc_inter_prediction(AV1_COMMON *cm, MACROBLOCKD *xd, ...@@ -573,7 +573,7 @@ void av1_build_obmc_inter_prediction(AV1_COMMON *cm, MACROBLOCKD *xd,
} // each mi in the left column } // each mi in the left column
} }
void av1_build_prediction_by_above_preds(AV1_COMMON *cm, MACROBLOCKD *xd, void av1_build_prediction_by_above_preds(const AV1_COMMON *cm, MACROBLOCKD *xd,
int mi_row, int mi_col, int mi_row, int mi_col,
uint8_t *tmp_buf[MAX_MB_PLANE], uint8_t *tmp_buf[MAX_MB_PLANE],
const int tmp_stride[MAX_MB_PLANE]) { const int tmp_stride[MAX_MB_PLANE]) {
...@@ -600,8 +600,8 @@ void av1_build_prediction_by_above_preds(AV1_COMMON *cm, MACROBLOCKD *xd, ...@@ -600,8 +600,8 @@ void av1_build_prediction_by_above_preds(AV1_COMMON *cm, MACROBLOCKD *xd,
pd->subsampling_x, pd->subsampling_y); pd->subsampling_x, pd->subsampling_y);
} }
for (ref = 0; ref < 1 + has_second_ref(mbmi); ++ref) { for (ref = 0; ref < 1 + has_second_ref(mbmi); ++ref) {
MV_REFERENCE_FRAME frame = mbmi->ref_frame[ref]; const MV_REFERENCE_FRAME frame = mbmi->ref_frame[ref];
RefBuffer *ref_buf = &cm->frame_refs[frame - LAST_FRAME]; const RefBuffer *const ref_buf = &cm->frame_refs[frame - LAST_FRAME];
xd->block_refs[ref] = ref_buf; xd->block_refs[ref] = ref_buf;
if ((!av1_is_valid_scale(&ref_buf->sf))) if ((!av1_is_valid_scale(&ref_buf->sf)))
...@@ -649,7 +649,7 @@ void av1_build_prediction_by_above_preds(AV1_COMMON *cm, MACROBLOCKD *xd, ...@@ -649,7 +649,7 @@ void av1_build_prediction_by_above_preds(AV1_COMMON *cm, MACROBLOCKD *xd,
xd->mb_to_left_edge = -((mi_col * MI_SIZE) * 8); xd->mb_to_left_edge = -((mi_col * MI_SIZE) * 8);
} }
void av1_build_prediction_by_left_preds(AV1_COMMON *cm, MACROBLOCKD *xd, void av1_build_prediction_by_left_preds(const AV1_COMMON *cm, MACROBLOCKD *xd,
int mi_row, int mi_col, int mi_row, int mi_col,
uint8_t *tmp_buf[MAX_MB_PLANE], uint8_t *tmp_buf[MAX_MB_PLANE],
const int tmp_stride[MAX_MB_PLANE]) { const int tmp_stride[MAX_MB_PLANE]) {
...@@ -676,8 +676,8 @@ void av1_build_prediction_by_left_preds(AV1_COMMON *cm, MACROBLOCKD *xd, ...@@ -676,8 +676,8 @@ void av1_build_prediction_by_left_preds(AV1_COMMON *cm, MACROBLOCKD *xd,
pd->subsampling_x, pd->subsampling_y); pd->subsampling_x, pd->subsampling_y);
} }
for (ref = 0; ref < 1 + has_second_ref(mbmi); ++ref) { for (ref = 0; ref < 1 + has_second_ref(mbmi); ++ref) {
MV_REFERENCE_FRAME frame = mbmi->ref_frame[ref]; const MV_REFERENCE_FRAME frame = mbmi->ref_frame[ref];
RefBuffer *ref_buf = &cm->frame_refs[frame - LAST_FRAME]; const RefBuffer *const ref_buf = &cm->frame_refs[frame - LAST_FRAME];
xd->block_refs[ref] = ref_buf; xd->block_refs[ref] = ref_buf;
if ((!av1_is_valid_scale(&ref_buf->sf))) if ((!av1_is_valid_scale(&ref_buf->sf)))
...@@ -725,7 +725,7 @@ void av1_build_prediction_by_left_preds(AV1_COMMON *cm, MACROBLOCKD *xd, ...@@ -725,7 +725,7 @@ void av1_build_prediction_by_left_preds(AV1_COMMON *cm, MACROBLOCKD *xd,
xd->mb_to_top_edge = -((mi_row * MI_SIZE) * 8); xd->mb_to_top_edge = -((mi_row * MI_SIZE) * 8);
} }
void av1_build_obmc_inter_predictors_sb(AV1_COMMON *cm, MACROBLOCKD *xd, void av1_build_obmc_inter_predictors_sb(const AV1_COMMON *cm, MACROBLOCKD *xd,
int mi_row, int mi_col) { int mi_row, int mi_col) {
#if CONFIG_AOM_HIGHBITDEPTH #if CONFIG_AOM_HIGHBITDEPTH
DECLARE_ALIGNED(16, uint8_t, tmp_buf1[2 * MAX_MB_PLANE * MAX_SB_SQUARE]); DECLARE_ALIGNED(16, uint8_t, tmp_buf1[2 * MAX_MB_PLANE * MAX_SB_SQUARE]);
......
...@@ -198,7 +198,7 @@ void av1_setup_pre_planes(MACROBLOCKD *xd, int idx, ...@@ -198,7 +198,7 @@ void av1_setup_pre_planes(MACROBLOCKD *xd, int idx,
#if CONFIG_MOTION_VAR #if CONFIG_MOTION_VAR
void av1_setup_obmc_mask(int length, const uint8_t *mask[2]); void av1_setup_obmc_mask(int length, const uint8_t *mask[2]);
void av1_build_obmc_inter_prediction(AV1_COMMON *cm, MACROBLOCKD *xd, void av1_build_obmc_inter_prediction(const AV1_COMMON *cm, MACROBLOCKD *xd,
int mi_row, int mi_col, int mi_row, int mi_col,
int use_tmp_dst_buf, int use_tmp_dst_buf,
uint8_t *final_buf[MAX_MB_PLANE], uint8_t *final_buf[MAX_MB_PLANE],
...@@ -207,15 +207,15 @@ void av1_build_obmc_inter_prediction(AV1_COMMON *cm, MACROBLOCKD *xd, ...@@ -207,15 +207,15 @@ void av1_build_obmc_inter_prediction(AV1_COMMON *cm, MACROBLOCKD *xd,
const int above_pred_stride[MAX_MB_PLANE], const int above_pred_stride[MAX_MB_PLANE],
uint8_t *left_pred_buf[MAX_MB_PLANE], uint8_t *left_pred_buf[MAX_MB_PLANE],
const int left_pred_stride[MAX_MB_PLANE]); const int left_pred_stride[MAX_MB_PLANE]);
void av1_build_prediction_by_above_preds(AV1_COMMON *cm, MACROBLOCKD *xd, void av1_build_prediction_by_above_preds(const AV1_COMMON *cm, MACROBLOCKD *xd,
int mi_row, int mi_col, int mi_row, int mi_col,
uint8_t *tmp_buf[MAX_MB_PLANE], uint8_t *tmp_buf[MAX_MB_PLANE],
const int tmp_stride[MAX_MB_PLANE]); const int tmp_stride[MAX_MB_PLANE]);
void av1_build_prediction_by_left_preds(AV1_COMMON *cm, MACROBLOCKD *xd, void av1_build_prediction_by_left_preds(const AV1_COMMON *cm, MACROBLOCKD *xd,
int mi_row, int mi_col, int mi_row, int mi_col,
uint8_t *tmp_buf[MAX_MB_PLANE], uint8_t *tmp_buf[MAX_MB_PLANE],
const int tmp_stride[MAX_MB_PLANE]); const int tmp_stride[MAX_MB_PLANE]);
void av1_build_obmc_inter_predictors_sb(AV1_COMMON *cm, MACROBLOCKD *xd, void av1_build_obmc_inter_predictors_sb(const AV1_COMMON *cm, MACROBLOCKD *xd,
int mi_row, int mi_col); int mi_row, int mi_col);
#endif // CONFIG_MOTION_VAR #endif // CONFIG_MOTION_VAR
static INLINE int has_subpel_mv_component(const MODE_INFO *const mi, static INLINE int has_subpel_mv_component(const MODE_INFO *const mi,
......
...@@ -111,9 +111,9 @@ void av1_setup_in_frame_q_adj(AV1_COMP *cpi) { ...@@ -111,9 +111,9 @@ void av1_setup_in_frame_q_adj(AV1_COMP *cpi) {
// Select a segment for the current block. // Select a segment for the current block.
// The choice of segment for a block depends on the ratio of the projected // The choice of segment for a block depends on the ratio of the projected
// bits for the block vs a target average and its spatial complexity. // bits for the block vs a target average and its spatial complexity.
void av1_caq_select_segment(AV1_COMP *cpi, MACROBLOCK *mb, BLOCK_SIZE bs, void av1_caq_select_segment(const AV1_COMP *cpi, MACROBLOCK *mb, BLOCK_SIZE bs,
int mi_row, int mi_col, int projected_rate) { int mi_row, int mi_col, int projected_rate) {
AV1_COMMON *const cm = &cpi->common; const AV1_COMMON *const cm = &cpi->common;
const int mi_offset = mi_row * cm->mi_cols + mi_col; const int mi_offset = mi_row * cm->mi_cols + mi_col;
const int bw = num_8x8_blocks_wide_lookup[BLOCK_64X64]; const int bw = num_8x8_blocks_wide_lookup[BLOCK_64X64];
......
...@@ -22,7 +22,7 @@ struct AV1_COMP; ...@@ -22,7 +22,7 @@ struct AV1_COMP;
struct macroblock; struct macroblock;
// Select a segment for the current Block. // Select a segment for the current Block.
void av1_caq_select_segment(struct AV1_COMP *cpi, struct macroblock *, void av1_caq_select_segment(const struct AV1_COMP *cpi, struct macroblock *,
BLOCK_SIZE bs, int mi_row, int mi_col, BLOCK_SIZE bs, int mi_row, int mi_col,
int projected_rate); int projected_rate);
......
...@@ -209,7 +209,7 @@ int av1_cyclic_refresh_rc_bits_per_mb(const AV1_COMP *cpi, int i, ...@@ -209,7 +209,7 @@ int av1_cyclic_refresh_rc_bits_per_mb(const AV1_COMP *cpi, int i,
// Prior to coding a given prediction block, of size bsize at (mi_row, mi_col), // Prior to coding a given prediction block, of size bsize at (mi_row, mi_col),
// check if we should reset the segment_id, and update the cyclic_refresh map // check if we should reset the segment_id, and update the cyclic_refresh map
// and segmentation map. // and segmentation map.
void av1_cyclic_refresh_update_segment(AV1_COMP *const cpi, void av1_cyclic_refresh_update_segment(const AV1_COMP *cpi,
MB_MODE_INFO *const mbmi, int mi_row, MB_MODE_INFO *const mbmi, int mi_row,
int mi_col, BLOCK_SIZE bsize, int mi_col, BLOCK_SIZE bsize,
int64_t rate, int64_t dist, int skip) { int64_t rate, int64_t dist, int skip) {
......
...@@ -49,7 +49,7 @@ int av1_cyclic_refresh_rc_bits_per_mb(const struct AV1_COMP *cpi, int i, ...@@ -49,7 +49,7 @@ int av1_cyclic_refresh_rc_bits_per_mb(const struct AV1_COMP *cpi, int i,
// Prior to coding a given prediction block, of size bsize at (mi_row, mi_col), // Prior to coding a given prediction block, of size bsize at (mi_row, mi_col),
// check if we should reset the segment_id, and update the cyclic_refresh map // check if we should reset the segment_id, and update the cyclic_refresh map
// and segmentation map. // and segmentation map.
void av1_cyclic_refresh_update_segment(struct AV1_COMP *const cpi, void av1_cyclic_refresh_update_segment(const struct AV1_COMP *cpi,
MB_MODE_INFO *const mbmi, int mi_row, MB_MODE_INFO *const mbmi, int mi_row,
int mi_col, BLOCK_SIZE bsize, int mi_col, BLOCK_SIZE bsize,
int64_t rate, int64_t dist, int skip); int64_t rate, int64_t dist, int skip);
......
...@@ -138,7 +138,7 @@ static void aq_highbd_8_variance(const uint8_t *a8, int a_stride, ...@@ -138,7 +138,7 @@ static void aq_highbd_8_variance(const uint8_t *a8, int a_stride,
} }
#endif // CONFIG_AOM_HIGHBITDEPTH #endif // CONFIG_AOM_HIGHBITDEPTH
static unsigned int block_variance(AV1_COMP *cpi, MACROBLOCK *x, static unsigned int block_variance(const AV1_COMP *const cpi, MACROBLOCK *x,
BLOCK_SIZE bs) { BLOCK_SIZE bs) {
MACROBLOCKD *xd = &x->e_mbd; MACROBLOCKD *xd = &x->e_mbd;
unsigned int var, sse; unsigned int var, sse;
...@@ -186,14 +186,14 @@ static unsigned int block_variance(AV1_COMP *cpi, MACROBLOCK *x, ...@@ -186,14 +186,14 @@ static unsigned int block_variance(AV1_COMP *cpi, MACROBLOCK *x,
} }
} }
double av1_log_block_var(AV1_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bs) { double av1_log_block_var(const AV1_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bs) {
unsigned int var = block_variance(cpi, x, bs); unsigned int var = block_variance(cpi, x, bs);
aom_clear_system_state(); aom_clear_system_state();
return log(var + 1.0); return log(var + 1.0);
} }
#define DEFAULT_E_MIDPOINT 10.0 #define DEFAULT_E_MIDPOINT 10.0
int av1_block_energy(AV1_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bs) { int av1_block_energy(const AV1_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bs) {
double energy; double energy;
double energy_midpoint; double energy_midpoint;
aom_clear_system_state(); aom_clear_system_state();
......
...@@ -21,8 +21,8 @@ extern "C" { ...@@ -21,8 +21,8 @@ extern "C" {
unsigned int av1_vaq_segment_id(int energy); unsigned int av1_vaq_segment_id(int energy);
void av1_vaq_frame_setup(AV1_COMP *cpi); void av1_vaq_frame_setup(AV1_COMP *cpi);
int av1_block_energy(AV1_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bs); int av1_block_energy(const AV1_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bs);
double av1_log_block_var(AV1_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bs); double av1_log_block_var(const AV1_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bs);
#ifdef __cplusplus #ifdef __cplusplus
} // extern "C" } // extern "C"
......
...@@ -36,12 +36,12 @@ struct macroblock_plane { ...@@ -36,12 +36,12 @@ struct macroblock_plane {
struct buf_2d src; struct buf_2d src;
// Quantizer setings // Quantizer setings
int16_t *quant_fp; const int16_t *quant_fp;
int16_t *round_fp; const int16_t *round_fp;
int16_t *quant; const int16_t *quant;
int16_t *quant_shift; const int16_t *quant_shift;
int16_t *zbin; const int16_t *zbin;
int16_t *round; const int16_t *round;
int64_t quant_thred[2]; int64_t quant_thred[2];
}; };
......
This diff is collapsed.
...@@ -606,23 +606,22 @@ static INLINE int get_ref_frame_map_idx(const AV1_COMP *cpi, ...@@ -606,23 +606,22 @@ static INLINE int get_ref_frame_map_idx(const AV1_COMP *cpi,
return cpi->alt_fb_idx; return cpi->alt_fb_idx;
} }
static INLINE int get_ref_frame_buf_idx(const AV1_COMP *const cpi, static INLINE int get_ref_frame_buf_idx(const AV1_COMP *cpi, int ref_frame) {
int ref_frame) {
const AV1_COMMON *const cm = &cpi->common; const AV1_COMMON *const cm = &cpi->common;
const int map_idx = get_ref_frame_map_idx(cpi, ref_frame); const int map_idx = get_ref_frame_map_idx(cpi, ref_frame);
return (map_idx != INVALID_IDX) ? cm->ref_frame_map[map_idx] : INVALID_IDX; return (map_idx != INVALID_IDX) ? cm->ref_frame_map[map_idx] : INVALID_IDX;
} }
static INLINE YV12_BUFFER_CONFIG *get_ref_frame_buffer( static INLINE YV12_BUFFER_CONFIG *get_ref_frame_buffer(
AV1_COMP *cpi, MV_REFERENCE_FRAME ref_frame) { const AV1_COMP *cpi, MV_REFERENCE_FRAME ref_frame) {
AV1_COMMON *const cm = &cpi->common; const AV1_COMMON *const cm = &cpi->common;
const int buf_idx = get_ref_frame_buf_idx(cpi, ref_frame); const int buf_idx = get_ref_frame_buf_idx(cpi, ref_frame);
return buf_idx != INVALID_IDX ? &cm->buffer_pool->frame_bufs[buf_idx].buf return buf_idx != INVALID_IDX ? &cm->buffer_pool->frame_bufs[buf_idx].buf
: NULL; : NULL;
} }
static INLINE const YV12_BUFFER_CONFIG *get_upsampled_ref( static INLINE const YV12_BUFFER_CONFIG *get_upsampled_ref(
AV1_COMP *cpi, const MV_REFERENCE_FRAME ref_frame) { const AV1_COMP *cpi, const MV_REFERENCE_FRAME ref_frame) {
// Use up-sampled reference frames. // Use up-sampled reference frames.
const int buf_idx = const int buf_idx =
cpi->upsampled_ref_idx[get_ref_frame_map_idx(cpi, ref_frame)]; cpi->upsampled_ref_idx[get_ref_frame_map_idx(cpi, ref_frame)];
...@@ -683,7 +682,7 @@ static INLINE int is_altref_enabled(const AV1_COMP *const cpi) { ...@@ -683,7 +682,7 @@ static INLINE int is_altref_enabled(const AV1_COMP *const cpi) {
cpi->oxcf.enable_auto_arf; cpi->oxcf.enable_auto_arf;
} }
static INLINE void set_ref_ptrs(AV1_COMMON *cm, MACROBLOCKD *xd, static INLINE void set_ref_ptrs(const AV1_COMMON *cm, MACROBLOCKD *xd,
MV_REFERENCE_FRAME ref0, MV_REFERENCE_FRAME ref0,
MV_REFERENCE_FRAME ref1) { MV_REFERENCE_FRAME ref1) {
xd->block_refs[0] = xd->block_refs[0] =
......
...@@ -2176,7 +2176,7 @@ int av1_full_pixel_diamond(const AV1_COMP *cpi, MACROBLOCK *x, MV *mvp_full, ...@@ -2176,7 +2176,7 @@ int av1_full_pixel_diamond(const AV1_COMP *cpi, MACROBLOCK *x, MV *mvp_full,
#define MIN_INTERVAL 1 #define MIN_INTERVAL 1
// Runs an limited range exhaustive mesh search using a pattern set // Runs an limited range exhaustive mesh search using a pattern set
// according to the encode speed profile. // according to the encode speed profile.
static int full_pixel_exhaustive(AV1_COMP *cpi, MACROBLOCK *x, static int full_pixel_exhaustive(const AV1_COMP *const cpi, MACROBLOCK *x,
MV *centre_mv_full, int sadpb, int *cost_list, MV *centre_mv_full, int sadpb, int *cost_list,
const aom_variance_fn_ptr_t *fn_ptr, const aom_variance_fn_ptr_t *fn_ptr,
const MV *ref_mv, MV *dst_mv) { const MV *ref_mv, MV *dst_mv) {
...@@ -2547,7 +2547,7 @@ int av1_refining_search_8p_c(const MACROBLOCK *x, MV *ref_mv, int error_per_bit, ...@@ -2547,7 +2547,7 @@ int av1_refining_search_8p_c(const MACROBLOCK *x, MV *ref_mv, int error_per_bit,
} }
#define MIN_EX_SEARCH_LIMIT 128 #define MIN_EX_SEARCH_LIMIT 128
static int is_exhaustive_allowed(AV1_COMP *cpi, MACROBLOCK *x) { static int is_exhaustive_allowed(const AV1_COMP *const cpi, MACROBLOCK *x) {
const SPEED_FEATURES *const sf = &cpi->sf; const SPEED_FEATURES *const sf = &cpi->sf;
const int max_ex = const int max_ex =
AOMMAX(MIN_EX_SEARCH_LIMIT, AOMMAX(MIN_EX_SEARCH_LIMIT,
...@@ -2558,13 +2558,13 @@ static int is_exhaustive_allowed(AV1_COMP *cpi, MACROBLOCK *x) { ...@@ -2558,13 +2558,13 @@ static int is_exhaustive_allowed(AV1_COMP *cpi, MACROBLOCK *x) {
(*x->ex_search_count_ptr <= max_ex) && !cpi->rc.is_src_frame_alt_ref; (*x->ex_search_count_ptr <= max_ex) && !cpi->rc.is_src_frame_alt_ref;
} }
int av1_full_pixel_search(AV1_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bsize, int av1_full_pixel_search(const AV1_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bsize,
MV *mvp_full, int step_param, int error_per_bit, MV *mvp_full, int step_param, int error_per_bit,
int *cost_list, const MV *ref_mv, MV *tmp_mv, int *cost_list, const MV *ref_mv, MV *tmp_mv,
int var_max, int rd) { int var_max, int rd) {
const SPEED_FEATURES *const sf = &cpi->sf; const SPEED_FEATURES *const sf = &cpi->sf;
const SEARCH_METHODS method = sf->mv.search_method; const SEARCH_METHODS method = sf->mv.search_method;
aom_variance_fn_ptr_t *fn_ptr = &cpi->fn_ptr[bsize]; const aom_variance_fn_ptr_t *const fn_ptr = &cpi->fn_ptr[bsize];
int var = 0; int var = 0;
if (cost_list) { if (cost_list) {
cost_list[0] = INT_MAX; cost_list[0] = INT_MAX;
......
...@@ -128,10 +128,10 @@ int av1_refining_search_8p_c(const MACROBLOCK *x, MV *ref_mv, int error_per_bit, ...@@ -128,10 +128,10 @@ int av1_refining_search_8p_c(const MACROBLOCK *x, MV *ref_mv, int error_per_bit,
struct AV1_COMP; struct AV1_COMP;
int av1_full_pixel_search(struct AV1_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bsize, int av1_full_pixel_search(const struct AV1_COMP *cpi, MACROBLOCK *x,
MV *mvp_full, int step_param, int error_per_bit, BLOCK_SIZE bsize, MV *mvp_full, int step_param,
int *cost_list, const MV *ref_mv, MV *tmp_mv, int error_per_bit, int *cost_list, const MV *ref_mv,
int var_max, int rd); MV *tmp_mv, int var_max, int rd);
#ifdef __cplusplus #ifdef __cplusplus
} // extern "C" } // extern "C"
......
...@@ -377,10 +377,10 @@ void av1_init_quantizer(AV1_COMP *cpi) { ...@@ -377,10 +377,10 @@ void av1_init_quantizer(AV1_COMP *cpi) {
} }
} }
void av1_init_plane_quantizers(AV1_COMP *cpi, MACROBLOCK *x) { void av1_init_plane_quantizers(const AV1_COMP *cpi, MACROBLOCK *x) {
const AV1_COMMON *const cm = &cpi->common; const AV1_COMMON *const cm = &cpi->common;
MACROBLOCKD *const xd = &x->e_mbd; MACROBLOCKD *const xd = &x->e_mbd;
QUANTS *const quants = &cpi->quants; const QUANTS *const quants = &cpi->quants;
const int segment_id = xd->mi[0]->mbmi.segment_id; const int segment_id = xd->mi[0]->mbmi.segment_id;
const int qindex = av1_get_qindex(&cm->seg, segment_id, cm->base_qindex); const int qindex = av1_get_qindex(&cm->seg, segment_id, cm->base_qindex);
const int rdmult = av1_compute_rd_mult(cpi, qindex + cm->y_dc_delta_q); const int rdmult = av1_compute_rd_mult(cpi, qindex + cm->y_dc_delta_q);
......
...@@ -47,7 +47,7 @@ struct AV1Common; ...@@ -47,7 +47,7 @@ struct AV1Common;
void av1_frame_init_quantizer(struct AV1_COMP *cpi); void av1_frame_init_quantizer(struct AV1_COMP *cpi);
void av1_init_plane_quantizers(struct AV1_COMP *cpi, MACROBLOCK *x); void av1_init_plane_quantizers(const struct AV1_COMP *cpi, MACROBLOCK *x);
void av1_init_quantizer(struct AV1_COMP *cpi); void av1_init_quantizer(struct AV1_COMP *cpi);
......
...@@ -200,7 +200,7 @@ static int compute_rd_thresh_factor(int qindex, aom_bit_depth_t bit_depth) { ...@@ -200,7 +200,7 @@ static int compute_rd_thresh_factor(int qindex, aom_bit_depth_t bit_depth) {
return AOMMAX((int)(pow(q, RD_THRESH_POW) * 5.12), 8); return AOMMAX((int)(pow(q, RD_THRESH_POW) * 5.12), 8);
} }
void av1_initialize_me_consts(AV1_COMP *cpi, MACROBLOCK *x, int qindex) { void av1_initialize_me_consts(const AV1_COMP *cpi, MACROBLOCK *x, int qindex) {
#if CONFIG_AOM_HIGHBITDEPTH #if CONFIG_AOM_HIGHBITDEPTH
switch (cpi->common.bit_depth) { switch (cpi->common.bit_depth) {
case AOM_BITS_8: case AOM_BITS_8:
...@@ -484,7 +484,7 @@ void av1_get_entropy_contexts(BLOCK_SIZE bsize, TX_SIZE tx_size, ...@@ -484,7 +484,7 @@ void av1_get_entropy_contexts(BLOCK_SIZE bsize, TX_SIZE tx_size,
} }
} }
void av1_mv_pred(AV1_COMP *cpi, MACROBLOCK *x, uint8_t *ref_y_buffer, void av1_mv_pred(const AV1_COMP *cpi, MACROBLOCK *x, uint8_t *ref_y_buffer,
int ref_y_stride, int ref_frame, BLOCK_SIZE block_size) { int ref_y_stride, int ref_frame, BLOCK_SIZE block_size) {
int i; int i;
int zero_seen = 0; int zero_seen = 0;
......
...@@ -131,13 +131,13 @@ int av1_compute_rd_mult(const struct AV1_COMP *cpi, int qindex); ...@@ -131,13 +131,13 @@ int av1_compute_rd_mult(const struct AV1_COMP *cpi, int qindex);
void av1_initialize_rd_consts(struct AV1_COMP *cpi); void av1_initialize_rd_consts(struct AV1_COMP *cpi);
void av1_initialize_me_consts(struct AV1_COMP *cpi, MACROBLOCK *x, int qindex); void av1_initialize_me_consts(const struct AV1_COMP *cpi, MACROBLOCK *x,
int qindex);
void av1_model_rd_from_var_lapndz(unsigned int var, unsigned int n, void av1_model_rd_from_var_lapndz(unsigned int var, unsigned int n,
unsigned int qstep, int *rate, int64_t *dist); unsigned int qstep, int *rate, int64_t *dist);
int av1_get_switchable_rate(const struct AV1_COMP *cpi, int av1_get_switchable_rate(const struct AV1_COMP *cpi, const MACROBLOCKD *xd);
const MACROBLOCKD *const xd);
int av1_raster_block_offset(BLOCK_SIZE plane_bsize, int raster_block, int av1_raster_block_offset(BLOCK_SIZE plane_bsize, int raster_block,
int stride); int stride);
...@@ -172,8 +172,9 @@ static INLINE int rd_less_than_thresh(int64_t best_rd, int thresh, ...@@ -172,8 +172,9 @@ static INLINE int rd_less_than_thresh(int64_t best_rd, int thresh,
return best_rd < ((int64_t)thresh * thresh_fact >> 5) || thresh == INT_MAX; return best_rd < ((int64_t)thresh * thresh_fact >> 5) || thresh == INT_MAX;
} }
void av1_mv_pred(struct AV1_COMP *cpi, MACROBLOCK *x, uint8_t *ref_y_buffer, void av1_mv_pred(const struct AV1_COMP *cpi, MACROBLOCK *x,
int ref_y_stride, int ref_frame, BLOCK_SIZE block_size); uint8_t *ref_y_buffer, int ref_y_stride, int ref_frame,
BLOCK_SIZE block_size);
static INLINE void set_error_per_bit(MACROBLOCK *x, int rdmult) { static INLINE void set_error_per_bit(MACROBLOCK *x, int rdmult) {
x->errorperbit = rdmult >> RD_EPB_SHIFT; x->errorperbit = rdmult >> RD_EPB_SHIFT;
......
This diff is collapsed.
...@@ -26,36 +26,36 @@ struct AV1_COMP; ...@@ -26,36 +26,36 @@ struct AV1_COMP;
struct macroblock; struct macroblock;