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
This commit is contained in:
Urvang Joshi 2016-06-28 12:05:14 -07:00
Родитель b910c0bd73
Коммит c27fccccdf
27 изменённых файлов: 283 добавлений и 265 удалений

Просмотреть файл

@ -242,7 +242,7 @@ typedef struct macroblockd {
FRAME_CONTEXT *fc;
/* pointers to reference frames */
RefBuffer *block_refs[2];
const RefBuffer *block_refs[2];
/* pointer to current frame */
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,
*near_mv = mvlist[1];
}
void av1_append_sub8x8_mvs_for_idx(AV1_COMMON *cm, MACROBLOCKD *xd, int block,
int ref, int mi_row, int mi_col,
void av1_append_sub8x8_mvs_for_idx(const AV1_COMMON *cm, MACROBLOCKD *xd,
int block, int ref, int mi_row, int mi_col,
int_mv *nearest_mv, int_mv *near_mv) {
int_mv mv_list[MAX_MV_REF_CANDIDATES];
MODE_INFO *const mi = xd->mi[0];

Просмотреть файл

@ -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,
int_mv *near_mv);
void av1_append_sub8x8_mvs_for_idx(AV1_COMMON *cm, MACROBLOCKD *xd, int block,
int ref, int mi_row, int mi_col,
void av1_append_sub8x8_mvs_for_idx(const AV1_COMMON *cm, MACROBLOCKD *xd,
int block, int ref, int mi_row, int mi_col,
int_mv *nearest_mv, int_mv *near_mv);
#ifdef __cplusplus

Просмотреть файл

@ -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;
}
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;
}

Просмотреть файл

@ -20,7 +20,7 @@
extern "C" {
#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,
int mi_row, int 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]) {
// top/left neighboring blocks' inter predictors with the regular inter
// prediction. We assume the original prediction (bmc) is stored in
// 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 use_tmp_dst_buf,
uint8_t *final_buf[MAX_MB_PLANE],
@ -573,7 +573,7 @@ void av1_build_obmc_inter_prediction(AV1_COMMON *cm, MACROBLOCKD *xd,
} // 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,
uint8_t *tmp_buf[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,
pd->subsampling_x, pd->subsampling_y);
}
for (ref = 0; ref < 1 + has_second_ref(mbmi); ++ref) {
MV_REFERENCE_FRAME frame = mbmi->ref_frame[ref];
RefBuffer *ref_buf = &cm->frame_refs[frame - LAST_FRAME];
const MV_REFERENCE_FRAME frame = mbmi->ref_frame[ref];
const RefBuffer *const ref_buf = &cm->frame_refs[frame - LAST_FRAME];
xd->block_refs[ref] = ref_buf;
if ((!av1_is_valid_scale(&ref_buf->sf)))
@ -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);
}
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,
uint8_t *tmp_buf[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,
pd->subsampling_x, pd->subsampling_y);
}
for (ref = 0; ref < 1 + has_second_ref(mbmi); ++ref) {
MV_REFERENCE_FRAME frame = mbmi->ref_frame[ref];
RefBuffer *ref_buf = &cm->frame_refs[frame - LAST_FRAME];
const MV_REFERENCE_FRAME frame = mbmi->ref_frame[ref];
const RefBuffer *const ref_buf = &cm->frame_refs[frame - LAST_FRAME];
xd->block_refs[ref] = ref_buf;
if ((!av1_is_valid_scale(&ref_buf->sf)))
@ -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);
}
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) {
#if CONFIG_AOM_HIGHBITDEPTH
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,
#if CONFIG_MOTION_VAR
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 use_tmp_dst_buf,
uint8_t *final_buf[MAX_MB_PLANE],
@ -207,15 +207,15 @@ void av1_build_obmc_inter_prediction(AV1_COMMON *cm, MACROBLOCKD *xd,
const int above_pred_stride[MAX_MB_PLANE],
uint8_t *left_pred_buf[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,
uint8_t *tmp_buf[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,
uint8_t *tmp_buf[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);
#endif // CONFIG_MOTION_VAR
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) {
// Select a segment for the current block.
// 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.
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) {
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 bw = num_8x8_blocks_wide_lookup[BLOCK_64X64];

Просмотреть файл

@ -22,7 +22,7 @@ struct AV1_COMP;
struct macroblock;
// 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,
int projected_rate);

Просмотреть файл

@ -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),
// check if we should reset the segment_id, and update the cyclic_refresh 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,
int mi_col, BLOCK_SIZE bsize,
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,
// 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
// 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,
int mi_col, BLOCK_SIZE bsize,
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,
}
#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) {
MACROBLOCKD *xd = &x->e_mbd;
unsigned int var, sse;
@ -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);
aom_clear_system_state();
return log(var + 1.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_midpoint;
aom_clear_system_state();

Просмотреть файл

@ -21,8 +21,8 @@ extern "C" {
unsigned int av1_vaq_segment_id(int energy);
void av1_vaq_frame_setup(AV1_COMP *cpi);
int av1_block_energy(AV1_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bs);
double av1_log_block_var(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(const AV1_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bs);
#ifdef __cplusplus
} // extern "C"

Просмотреть файл

@ -36,12 +36,12 @@ struct macroblock_plane {
struct buf_2d src;
// Quantizer setings
int16_t *quant_fp;
int16_t *round_fp;
int16_t *quant;
int16_t *quant_shift;
int16_t *zbin;
int16_t *round;
const int16_t *quant_fp;
const int16_t *round_fp;
const int16_t *quant;
const int16_t *quant_shift;
const int16_t *zbin;
const int16_t *round;
int64_t quant_thred[2];
};

Просмотреть файл

@ -47,9 +47,10 @@
#include "av1/encoder/segmentation.h"
#include "av1/encoder/tokenize.h"
static void encode_superblock(AV1_COMP *cpi, ThreadData *td, TOKENEXTRA **t,
int output_enabled, int mi_row, int mi_col,
BLOCK_SIZE bsize, PICK_MODE_CONTEXT *ctx);
static void encode_superblock(const AV1_COMP *const cpi, ThreadData *td,
TOKENEXTRA **t, int output_enabled, int mi_row,
int mi_col, BLOCK_SIZE bsize,
PICK_MODE_CONTEXT *ctx);
// This is used as a reference when computing the source variance for the
// purposes of activity masking.
@ -97,7 +98,7 @@ static const uint16_t AV1_HIGH_VAR_OFFS_12[64] = {
};
#endif // CONFIG_AOM_HIGHBITDEPTH
unsigned int av1_get_sby_perpixel_variance(AV1_COMP *cpi,
unsigned int av1_get_sby_perpixel_variance(const AV1_COMP *cpi,
const struct buf_2d *ref,
BLOCK_SIZE bs) {
unsigned int sse;
@ -107,7 +108,7 @@ unsigned int av1_get_sby_perpixel_variance(AV1_COMP *cpi,
}
#if CONFIG_AOM_HIGHBITDEPTH
unsigned int av1_high_get_sby_perpixel_variance(AV1_COMP *cpi,
unsigned int av1_high_get_sby_perpixel_variance(const AV1_COMP *cpi,
const struct buf_2d *ref,
BLOCK_SIZE bs, int bd) {
unsigned int var, sse;
@ -133,7 +134,7 @@ unsigned int av1_high_get_sby_perpixel_variance(AV1_COMP *cpi,
}
#endif // CONFIG_AOM_HIGHBITDEPTH
static unsigned int get_sby_perpixel_diff_variance(AV1_COMP *cpi,
static unsigned int get_sby_perpixel_diff_variance(const AV1_COMP *const cpi,
const struct buf_2d *ref,
int mi_row, int mi_col,
BLOCK_SIZE bs) {
@ -164,21 +165,21 @@ static BLOCK_SIZE get_rd_var_based_fixed_partition(AV1_COMP *cpi, MACROBLOCK *x,
// Lighter version of set_offsets that only sets the mode info
// pointers.
static INLINE void set_mode_info_offsets(AV1_COMP *const cpi,
static INLINE void set_mode_info_offsets(const AV1_COMP *const cpi,
MACROBLOCK *const x,
MACROBLOCKD *const xd, int mi_row,
int mi_col) {
AV1_COMMON *const cm = &cpi->common;
const AV1_COMMON *const cm = &cpi->common;
const int idx_str = xd->mi_stride * mi_row + mi_col;
xd->mi = cm->mi_grid_visible + idx_str;
xd->mi[0] = cm->mi + idx_str;
x->mbmi_ext = cpi->mbmi_ext_base + (mi_row * cm->mi_cols + mi_col);
}
static void set_offsets(AV1_COMP *cpi, const TileInfo *const tile,
static void set_offsets(const AV1_COMP *const cpi, const TileInfo *const tile,
MACROBLOCK *const x, int mi_row, int mi_col,
BLOCK_SIZE bsize) {
AV1_COMMON *const cm = &cpi->common;
const AV1_COMMON *const cm = &cpi->common;
MACROBLOCKD *const xd = &x->e_mbd;
MB_MODE_INFO *mbmi;
const int mi_width = num_8x8_blocks_wide_lookup[bsize];
@ -875,11 +876,11 @@ static int choose_partitioning(AV1_COMP *cpi, const TileInfo *const tile,
return 0;
}
static void update_state(AV1_COMP *cpi, ThreadData *td, PICK_MODE_CONTEXT *ctx,
int mi_row, int mi_col, BLOCK_SIZE bsize,
int output_enabled) {
static void update_state(const AV1_COMP *const cpi, ThreadData *td,
PICK_MODE_CONTEXT *ctx, int mi_row, int mi_col,
BLOCK_SIZE bsize, int output_enabled) {
int i, x_idx, y;
AV1_COMMON *const cm = &cpi->common;
const AV1_COMMON *const cm = &cpi->common;
RD_COUNTS *const rdc = &td->rd_counts;
MACROBLOCK *const x = &td->mb;
MACROBLOCKD *const xd = &x->e_mbd;
@ -983,18 +984,22 @@ static void update_state(AV1_COMP *cpi, ThreadData *td, PICK_MODE_CONTEXT *ctx,
if (!output_enabled) return;
#if CONFIG_INTERNAL_STATS
if (frame_is_intra_only(cm)) {
static const int kf_mode_index[] = {
THR_DC /*DC_PRED*/, THR_V_PRED /*V_PRED*/,
THR_H_PRED /*H_PRED*/, THR_D45_PRED /*D45_PRED*/,
THR_D135_PRED /*D135_PRED*/, THR_D117_PRED /*D117_PRED*/,
THR_D153_PRED /*D153_PRED*/, THR_D207_PRED /*D207_PRED*/,
THR_D63_PRED /*D63_PRED*/, THR_TM /*TM_PRED*/,
};
++cpi->mode_chosen_counts[kf_mode_index[mbmi->mode]];
} else {
// Note how often each mode chosen as best
++cpi->mode_chosen_counts[ctx->best_mode_index];
{
unsigned int *const mode_chosen_counts =
(unsigned int *)cpi->mode_chosen_counts; // Cast const away.
if (frame_is_intra_only(cm)) {
static const int kf_mode_index[] = {
THR_DC /*DC_PRED*/, THR_V_PRED /*V_PRED*/,
THR_H_PRED /*H_PRED*/, THR_D45_PRED /*D45_PRED*/,
THR_D135_PRED /*D135_PRED*/, THR_D117_PRED /*D117_PRED*/,
THR_D153_PRED /*D153_PRED*/, THR_D207_PRED /*D207_PRED*/,
THR_D63_PRED /*D63_PRED*/, THR_TM /*TM_PRED*/,
};
++mode_chosen_counts[kf_mode_index[mbmi->mode]];
} else {
// Note how often each mode chosen as best
++mode_chosen_counts[ctx->best_mode_index];
}
}
#endif
if (!frame_is_intra_only(cm)) {
@ -1053,21 +1058,21 @@ void av1_setup_src_planes(MACROBLOCK *x, const YV12_BUFFER_CONFIG *src,
x->e_mbd.plane[i].subsampling_y);
}
static int set_segment_rdmult(AV1_COMP *const cpi, MACROBLOCK *const x,
static int set_segment_rdmult(const AV1_COMP *const cpi, MACROBLOCK *const x,
int8_t segment_id) {
int segment_qindex;
AV1_COMMON *const cm = &cpi->common;
const AV1_COMMON *const cm = &cpi->common;
av1_init_plane_quantizers(cpi, x);
aom_clear_system_state();
segment_qindex = av1_get_qindex(&cm->seg, segment_id, cm->base_qindex);
return av1_compute_rd_mult(cpi, segment_qindex + cm->y_dc_delta_q);
}
static void rd_pick_sb_modes(AV1_COMP *cpi, TileDataEnc *tile_data,
static void rd_pick_sb_modes(const AV1_COMP *const cpi, TileDataEnc *tile_data,
MACROBLOCK *const x, int mi_row, int mi_col,
RD_COST *rd_cost, BLOCK_SIZE bsize,
PICK_MODE_CONTEXT *ctx, int64_t best_rd) {
AV1_COMMON *const cm = &cpi->common;
const AV1_COMMON *const cm = &cpi->common;
TileInfo *const tile_info = &tile_data->tile_info;
MACROBLOCKD *const xd = &x->e_mbd;
MB_MODE_INFO *mbmi;
@ -1206,7 +1211,7 @@ static void update_inter_mode_stats(FRAME_COUNTS *counts, PREDICTION_MODE mode,
}
#endif
static void update_stats(AV1_COMMON *cm, ThreadData *td) {
static void update_stats(const AV1_COMMON *const cm, ThreadData *td) {
const MACROBLOCK *x = &td->mb;
const MACROBLOCKD *const xd = &x->e_mbd;
const MODE_INFO *const mi = xd->mi[0];
@ -1403,8 +1408,8 @@ static void save_context(MACROBLOCK *const x, int mi_row, int mi_col,
sizeof(xd->left_seg_context[0]) * mi_height);
}
static void encode_b(AV1_COMP *cpi, const TileInfo *const tile, ThreadData *td,
TOKENEXTRA **tp, int mi_row, int mi_col,
static void encode_b(const AV1_COMP *const cpi, const TileInfo *const tile,
ThreadData *td, TOKENEXTRA **tp, int mi_row, int mi_col,
int output_enabled, BLOCK_SIZE bsize,
PICK_MODE_CONTEXT *ctx) {
MACROBLOCK *const x = &td->mb;
@ -1417,10 +1422,11 @@ static void encode_b(AV1_COMP *cpi, const TileInfo *const tile, ThreadData *td,
}
}
static void encode_sb(AV1_COMP *cpi, ThreadData *td, const TileInfo *const tile,
TOKENEXTRA **tp, int mi_row, int mi_col,
int output_enabled, BLOCK_SIZE bsize, PC_TREE *pc_tree) {
AV1_COMMON *const cm = &cpi->common;
static void encode_sb(const AV1_COMP *const cpi, ThreadData *td,
const TileInfo *const tile, TOKENEXTRA **tp, int mi_row,
int mi_col, int output_enabled, BLOCK_SIZE bsize,
PC_TREE *pc_tree) {
const AV1_COMMON *const cm = &cpi->common;
MACROBLOCK *const x = &td->mb;
MACROBLOCKD *const xd = &x->e_mbd;
@ -1940,26 +1946,25 @@ static void rd_auto_partition_range(AV1_COMP *cpi, const TileInfo *const tile,
}
// TODO(jingning) refactor functions setting partition search range
static void set_partition_range(AV1_COMMON *cm, MACROBLOCKD *xd, int mi_row,
static void set_partition_range(const AV1_COMMON *const cm,
const MACROBLOCKD *const xd, int mi_row,
int mi_col, BLOCK_SIZE bsize,
BLOCK_SIZE *min_bs, BLOCK_SIZE *max_bs) {
int mi_width = num_8x8_blocks_wide_lookup[bsize];
int mi_height = num_8x8_blocks_high_lookup[bsize];
BLOCK_SIZE *const min_bs,
BLOCK_SIZE *const max_bs) {
const int mi_width = num_8x8_blocks_wide_lookup[bsize];
const int mi_height = num_8x8_blocks_high_lookup[bsize];
int idx, idy;
MODE_INFO *mi;
const int idx_str = cm->mi_stride * mi_row + mi_col;
MODE_INFO **prev_mi = &cm->prev_mi_grid_visible[idx_str];
BLOCK_SIZE bs, min_size, max_size;
min_size = BLOCK_64X64;
max_size = BLOCK_4X4;
MODE_INFO **const prev_mi = &cm->prev_mi_grid_visible[idx_str];
BLOCK_SIZE min_size = BLOCK_64X64; // default values
BLOCK_SIZE max_size = BLOCK_4X4;
if (prev_mi) {
for (idy = 0; idy < mi_height; ++idy) {
for (idx = 0; idx < mi_width; ++idx) {
mi = prev_mi[idy * cm->mi_stride + idx];
bs = mi ? mi->mbmi.sb_type : bsize;
const MODE_INFO *const mi = prev_mi[idy * cm->mi_stride + idx];
const BLOCK_SIZE bs = mi ? mi->mbmi.sb_type : bsize;
min_size = AOMMIN(min_size, bs);
max_size = AOMMAX(max_size, bs);
}
@ -1968,8 +1973,8 @@ static void set_partition_range(AV1_COMMON *cm, MACROBLOCKD *xd, int mi_row,
if (xd->left_available) {
for (idy = 0; idy < mi_height; ++idy) {
mi = xd->mi[idy * cm->mi_stride - 1];
bs = mi ? mi->mbmi.sb_type : bsize;
const MODE_INFO *const mi = xd->mi[idy * cm->mi_stride - 1];
const BLOCK_SIZE bs = mi ? mi->mbmi.sb_type : bsize;
min_size = AOMMIN(min_size, bs);
max_size = AOMMAX(max_size, bs);
}
@ -1977,8 +1982,8 @@ static void set_partition_range(AV1_COMMON *cm, MACROBLOCKD *xd, int mi_row,
if (xd->up_available) {
for (idx = 0; idx < mi_width; ++idx) {
mi = xd->mi[idx - cm->mi_stride];
bs = mi ? mi->mbmi.sb_type : bsize;
const MODE_INFO *const mi = xd->mi[idx - cm->mi_stride];
const BLOCK_SIZE bs = mi ? mi->mbmi.sb_type : bsize;
min_size = AOMMIN(min_size, bs);
max_size = AOMMAX(max_size, bs);
}
@ -2052,25 +2057,25 @@ static INLINE int get_motion_inconsistency(MOTION_DIRECTION this_mv,
// TODO(jingning,jimbankoski,rbultje): properly skip partition types that are
// unlikely to be selected depending on previous rate-distortion optimization
// results, for encoding speed-up.
static void rd_pick_partition(AV1_COMP *cpi, ThreadData *td,
static void rd_pick_partition(const AV1_COMP *const cpi, ThreadData *td,
TileDataEnc *tile_data, TOKENEXTRA **tp,
int mi_row, int mi_col, BLOCK_SIZE bsize,
RD_COST *rd_cost, int64_t best_rd,
PC_TREE *pc_tree) {
AV1_COMMON *const cm = &cpi->common;
const AV1_COMMON *const cm = &cpi->common;
TileInfo *const tile_info = &tile_data->tile_info;
MACROBLOCK *const x = &td->mb;
MACROBLOCKD *const xd = &x->e_mbd;
const MACROBLOCKD *const xd = &x->e_mbd;
const int mi_step = num_8x8_blocks_wide_lookup[bsize] / 2;
ENTROPY_CONTEXT l[16 * MAX_MB_PLANE], a[16 * MAX_MB_PLANE];
PARTITION_CONTEXT sl[8], sa[8];
TOKENEXTRA *tp_orig = *tp;
const TOKENEXTRA *const tp_orig = *tp;
PICK_MODE_CONTEXT *ctx = &pc_tree->none;
int i, pl;
BLOCK_SIZE subsize;
RD_COST this_rdc, sum_rdc, best_rdc;
int do_split = bsize >= BLOCK_8X8;
int do_rect = 1;
const int bsize_at_least_8x8 = (bsize >= BLOCK_8X8);
int do_square_split = bsize_at_least_8x8;
int do_rectangular_split = 1;
// Override skipping rectangular partition operations for edge blocks
const int force_horz_split = (mi_row + mi_step >= cm->mi_rows);
@ -2088,9 +2093,9 @@ static void rd_pick_partition(AV1_COMP *cpi, ThreadData *td,
int partition_none_allowed = !force_horz_split && !force_vert_split;
int partition_horz_allowed =
!force_vert_split && yss <= xss && bsize >= BLOCK_8X8;
!force_vert_split && yss <= xss && bsize_at_least_8x8;
int partition_vert_allowed =
!force_horz_split && xss <= yss && bsize >= BLOCK_8X8;
!force_horz_split && xss <= yss && bsize_at_least_8x8;
(void)*tp_orig;
assert(num_8x8_blocks_wide_lookup[bsize] ==
@ -2107,7 +2112,7 @@ static void rd_pick_partition(AV1_COMP *cpi, ThreadData *td,
x->mb_energy = av1_block_energy(cpi, x, bsize);
if (cpi->sf.cb_partition_search && bsize == BLOCK_16X16) {
int cb_partition_search_ctrl =
const int cb_partition_search_ctrl =
((pc_tree->index == 0 || pc_tree->index == 3) +
get_chessboard_index(cm->current_video_frame)) &
0x1;
@ -2119,12 +2124,13 @@ static void rd_pick_partition(AV1_COMP *cpi, ThreadData *td,
// Determine partition types in search according to the speed features.
// The threshold set here has to be of square block size.
if (cpi->sf.auto_min_max_partition_size) {
partition_none_allowed &= (bsize <= max_size && bsize >= min_size);
partition_horz_allowed &=
((bsize <= max_size && bsize > min_size) || force_horz_split);
partition_vert_allowed &=
((bsize <= max_size && bsize > min_size) || force_vert_split);
do_split &= bsize > min_size;
const int no_partition_allowed = (bsize <= max_size && bsize >= min_size);
// Note: Further partitioning is NOT allowed when bsize == min_size already.
const int partition_allowed = (bsize <= max_size && bsize > min_size);
partition_none_allowed &= no_partition_allowed;
partition_horz_allowed &= partition_allowed || force_horz_split;
partition_vert_allowed &= partition_allowed || force_vert_split;
do_square_split &= bsize > min_size;
}
if (cpi->sf.use_square_partition_only) {
partition_horz_allowed &= force_horz_split;
@ -2144,7 +2150,7 @@ static void rd_pick_partition(AV1_COMP *cpi, ThreadData *td,
#if CONFIG_FP_MB_STATS
// Decide whether we shall split directly and skip searching NONE by using
// the first pass block statistics
if (cpi->use_fp_mb_stats && bsize >= BLOCK_32X32 && do_split &&
if (cpi->use_fp_mb_stats && bsize >= BLOCK_32X32 && do_square_split &&
partition_none_allowed && src_diff_var > 4 &&
cm->base_qindex < qindex_split_threshold_lookup[bsize]) {
int mb_row = mi_row >> 1;
@ -2197,25 +2203,25 @@ static void rd_pick_partition(AV1_COMP *cpi, ThreadData *td,
rd_pick_sb_modes(cpi, tile_data, x, mi_row, mi_col, &this_rdc, bsize, ctx,
best_rdc.rdcost);
if (this_rdc.rate != INT_MAX) {
if (bsize >= BLOCK_8X8) {
pl = partition_plane_context(xd, mi_row, mi_col, bsize);
this_rdc.rate += cpi->partition_cost[pl][PARTITION_NONE];
if (bsize_at_least_8x8) {
const int partition_context =
partition_plane_context(xd, mi_row, mi_col, bsize);
this_rdc.rate += cpi->partition_cost[partition_context][PARTITION_NONE];
this_rdc.rdcost =
RDCOST(x->rdmult, x->rddiv, this_rdc.rate, this_rdc.dist);
}
if (this_rdc.rdcost < best_rdc.rdcost) {
int64_t dist_breakout_thr = cpi->sf.partition_search_breakout_dist_thr;
int rate_breakout_thr = cpi->sf.partition_search_breakout_rate_thr;
// Adjust dist breakout threshold according to the partition size.
const int64_t dist_breakout_thr =
cpi->sf.partition_search_breakout_dist_thr >>
(8 - (b_width_log2_lookup[bsize] + b_height_log2_lookup[bsize]));
const int rate_breakout_thr =
cpi->sf.partition_search_breakout_rate_thr *
num_pels_log2_lookup[bsize];
best_rdc = this_rdc;
if (bsize >= BLOCK_8X8) pc_tree->partitioning = PARTITION_NONE;
// Adjust dist breakout threshold according to the partition size.
dist_breakout_thr >>=
8 - (b_width_log2_lookup[bsize] + b_height_log2_lookup[bsize]);
rate_breakout_thr *= num_pels_log2_lookup[bsize];
if (bsize_at_least_8x8) pc_tree->partitioning = PARTITION_NONE;
// If all y, u, v transform blocks in this partition are skippable, and
// the dist & rate are within the thresholds, the partition search is
@ -2225,8 +2231,8 @@ static void rd_pick_partition(AV1_COMP *cpi, ThreadData *td,
if (!x->e_mbd.lossless[xd->mi[0]->mbmi.segment_id] &&
(ctx->skippable && best_rdc.dist < dist_breakout_thr &&
best_rdc.rate < rate_breakout_thr)) {
do_split = 0;
do_rect = 0;
do_square_split = 0;
do_rectangular_split = 0;
}
#if CONFIG_FP_MB_STATS
@ -2235,7 +2241,7 @@ static void rd_pick_partition(AV1_COMP *cpi, ThreadData *td,
// If that is the case, check the difference variance between the
// current frame and the last frame. If the variance is small enough,
// stop further splitting in RD optimization
if (cpi->use_fp_mb_stats && do_split != 0 &&
if (cpi->use_fp_mb_stats && do_square_split &&
cm->base_qindex > qindex_skip_threshold_lookup[bsize]) {
int mb_row = mi_row >> 1;
int mb_col = mi_col >> 1;
@ -2268,8 +2274,8 @@ static void rd_pick_partition(AV1_COMP *cpi, ThreadData *td,
cpi, &x->plane[0].src, mi_row, mi_col, bsize);
}
if (src_diff_var < 8) {
do_split = 0;
do_rect = 0;
do_square_split = 0;
do_rectangular_split = 0;
}
}
}
@ -2285,30 +2291,32 @@ static void rd_pick_partition(AV1_COMP *cpi, ThreadData *td,
// PARTITION_SPLIT
// TODO(jingning): use the motion vectors given by the above search as
// the starting point of motion search in the following partition type check.
if (do_split) {
if (do_square_split) {
int reached_last_index = 0;
subsize = get_subsize(bsize, PARTITION_SPLIT);
if (bsize == BLOCK_8X8) {
i = 4;
if (cpi->sf.adaptive_pred_interp_filter && partition_none_allowed)
pc_tree->leaf_split[0]->pred_interp_filter =
ctx->mic.mbmi.interp_filter;
rd_pick_sb_modes(cpi, tile_data, x, mi_row, mi_col, &sum_rdc, subsize,
pc_tree->leaf_split[0], best_rdc.rdcost);
if (sum_rdc.rate == INT_MAX) sum_rdc.rdcost = INT64_MAX;
reached_last_index = 1;
} else {
for (i = 0; i < 4 && sum_rdc.rdcost < best_rdc.rdcost; ++i) {
const int x_idx = (i & 1) * mi_step;
const int y_idx = (i >> 1) * mi_step;
int idx;
for (idx = 0; idx < 4 && sum_rdc.rdcost < best_rdc.rdcost; ++idx) {
const int x_idx = (idx & 1) * mi_step;
const int y_idx = (idx >> 1) * mi_step;
if (mi_row + y_idx >= cm->mi_rows || mi_col + x_idx >= cm->mi_cols)
continue;
if (cpi->sf.adaptive_motion_search) load_pred_mv(x, ctx);
pc_tree->split[i]->index = i;
rd_pick_partition(cpi, td, tile_data, tp, mi_row + y_idx,
mi_col + x_idx, subsize, &this_rdc,
best_rdc.rdcost - sum_rdc.rdcost, pc_tree->split[i]);
pc_tree->split[idx]->index = idx;
rd_pick_partition(
cpi, td, tile_data, tp, mi_row + y_idx, mi_col + x_idx, subsize,
&this_rdc, best_rdc.rdcost - sum_rdc.rdcost, pc_tree->split[idx]);
if (this_rdc.rate == INT_MAX) {
sum_rdc.rdcost = INT64_MAX;
@ -2319,28 +2327,30 @@ static void rd_pick_partition(AV1_COMP *cpi, ThreadData *td,
sum_rdc.rdcost += this_rdc.rdcost;
}
}
reached_last_index = (idx == 4);
}
if (sum_rdc.rdcost < best_rdc.rdcost && i == 4) {
pl = partition_plane_context(xd, mi_row, mi_col, bsize);
sum_rdc.rate += cpi->partition_cost[pl][PARTITION_SPLIT];
if (reached_last_index && sum_rdc.rdcost < best_rdc.rdcost) {
const int partition_context =
partition_plane_context(xd, mi_row, mi_col, bsize);
sum_rdc.rate += cpi->partition_cost[partition_context][PARTITION_SPLIT];
sum_rdc.rdcost = RDCOST(x->rdmult, x->rddiv, sum_rdc.rate, sum_rdc.dist);
if (sum_rdc.rdcost < best_rdc.rdcost) {
best_rdc = sum_rdc;
pc_tree->partitioning = PARTITION_SPLIT;
}
} else {
} else if (cpi->sf.less_rectangular_check) {
// skip rectangular partition test when larger block size
// gives better rd cost
if (cpi->sf.less_rectangular_check) do_rect &= !partition_none_allowed;
do_rectangular_split &= !partition_none_allowed;
}
restore_context(x, mi_row, mi_col, a, l, sa, sl, bsize);
}
// PARTITION_HORZ
if (partition_horz_allowed &&
(do_rect || av1_active_h_edge(cpi, mi_row, mi_step))) {
(do_rectangular_split || av1_active_h_edge(cpi, mi_row, mi_step))) {
subsize = get_subsize(bsize, PARTITION_HORZ);
if (cpi->sf.adaptive_motion_search) load_pred_mv(x, ctx);
if (cpi->sf.adaptive_pred_interp_filter && bsize == BLOCK_8X8 &&
@ -2349,7 +2359,7 @@ static void rd_pick_partition(AV1_COMP *cpi, ThreadData *td,
rd_pick_sb_modes(cpi, tile_data, x, mi_row, mi_col, &sum_rdc, subsize,
&pc_tree->horizontal[0], best_rdc.rdcost);
if (sum_rdc.rdcost < best_rdc.rdcost && mi_row + mi_step < cm->mi_rows &&
if (sum_rdc.rdcost < best_rdc.rdcost && !force_horz_split &&
bsize > BLOCK_8X8) {
PICK_MODE_CONTEXT *ctx = &pc_tree->horizontal[0];
update_state(cpi, td, ctx, mi_row, mi_col, subsize, 0);
@ -2372,8 +2382,9 @@ static void rd_pick_partition(AV1_COMP *cpi, ThreadData *td,
}
if (sum_rdc.rdcost < best_rdc.rdcost) {
pl = partition_plane_context(xd, mi_row, mi_col, bsize);
sum_rdc.rate += cpi->partition_cost[pl][PARTITION_HORZ];
const int partition_context =
partition_plane_context(xd, mi_row, mi_col, bsize);
sum_rdc.rate += cpi->partition_cost[partition_context][PARTITION_HORZ];
sum_rdc.rdcost = RDCOST(x->rdmult, x->rddiv, sum_rdc.rate, sum_rdc.dist);
if (sum_rdc.rdcost < best_rdc.rdcost) {
best_rdc = sum_rdc;
@ -2384,7 +2395,7 @@ static void rd_pick_partition(AV1_COMP *cpi, ThreadData *td,
}
// PARTITION_VERT
if (partition_vert_allowed &&
(do_rect || av1_active_v_edge(cpi, mi_col, mi_step))) {
(do_rectangular_split || av1_active_v_edge(cpi, mi_col, mi_step))) {
subsize = get_subsize(bsize, PARTITION_VERT);
if (cpi->sf.adaptive_motion_search) load_pred_mv(x, ctx);
@ -2393,7 +2404,7 @@ static void rd_pick_partition(AV1_COMP *cpi, ThreadData *td,
pc_tree->vertical[0].pred_interp_filter = ctx->mic.mbmi.interp_filter;
rd_pick_sb_modes(cpi, tile_data, x, mi_row, mi_col, &sum_rdc, subsize,
&pc_tree->vertical[0], best_rdc.rdcost);
if (sum_rdc.rdcost < best_rdc.rdcost && mi_col + mi_step < cm->mi_cols &&
if (sum_rdc.rdcost < best_rdc.rdcost && !force_vert_split &&
bsize > BLOCK_8X8) {
update_state(cpi, td, &pc_tree->vertical[0], mi_row, mi_col, subsize, 0);
encode_superblock(cpi, td, tp, 0, mi_row, mi_col, subsize,
@ -2416,8 +2427,9 @@ static void rd_pick_partition(AV1_COMP *cpi, ThreadData *td,
}
if (sum_rdc.rdcost < best_rdc.rdcost) {
pl = partition_plane_context(xd, mi_row, mi_col, bsize);
sum_rdc.rate += cpi->partition_cost[pl][PARTITION_VERT];
const int partition_context =
partition_plane_context(xd, mi_row, mi_col, bsize);
sum_rdc.rate += cpi->partition_cost[partition_context][PARTITION_VERT];
sum_rdc.rdcost = RDCOST(x->rdmult, x->rddiv, sum_rdc.rate, sum_rdc.dist);
if (sum_rdc.rdcost < best_rdc.rdcost) {
best_rdc = sum_rdc;
@ -2952,10 +2964,11 @@ static void sum_intra_stats(FRAME_COUNTS *counts, const MODE_INFO *mi,
++counts->uv_mode[y_mode][uv_mode];
}
static void encode_superblock(AV1_COMP *cpi, ThreadData *td, TOKENEXTRA **t,
int output_enabled, int mi_row, int mi_col,
BLOCK_SIZE bsize, PICK_MODE_CONTEXT *ctx) {
AV1_COMMON *const cm = &cpi->common;
static void encode_superblock(const AV1_COMP *const cpi, ThreadData *td,
TOKENEXTRA **t, int output_enabled, int mi_row,
int mi_col, BLOCK_SIZE bsize,
PICK_MODE_CONTEXT *ctx) {
const AV1_COMMON *const cm = &cpi->common;
MACROBLOCK *const x = &td->mb;
MACROBLOCKD *const xd = &x->e_mbd;
MODE_INFO **mi_8x8 = xd->mi;

Просмотреть файл

@ -606,23 +606,22 @@ static INLINE int get_ref_frame_map_idx(const AV1_COMP *cpi,
return cpi->alt_fb_idx;
}
static INLINE int get_ref_frame_buf_idx(const AV1_COMP *const cpi,
int ref_frame) {
static INLINE int get_ref_frame_buf_idx(const AV1_COMP *cpi, int ref_frame) {
const AV1_COMMON *const cm = &cpi->common;
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;
}
static INLINE YV12_BUFFER_CONFIG *get_ref_frame_buffer(
AV1_COMP *cpi, MV_REFERENCE_FRAME ref_frame) {
AV1_COMMON *const cm = &cpi->common;
const AV1_COMP *cpi, MV_REFERENCE_FRAME ref_frame) {
const AV1_COMMON *const cm = &cpi->common;
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
: NULL;
}
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.
const int buf_idx =
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) {
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 ref1) {
xd->block_refs[0] =

Просмотреть файл

@ -2176,7 +2176,7 @@ int av1_full_pixel_diamond(const AV1_COMP *cpi, MACROBLOCK *x, MV *mvp_full,
#define MIN_INTERVAL 1
// Runs an limited range exhaustive mesh search using a pattern set
// 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,
const aom_variance_fn_ptr_t *fn_ptr,
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,
}
#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 int max_ex =
AOMMAX(MIN_EX_SEARCH_LIMIT,
@ -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;
}
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,
int *cost_list, const MV *ref_mv, MV *tmp_mv,
int var_max, int rd) {
const SPEED_FEATURES *const sf = &cpi->sf;
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;
if (cost_list) {
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,
struct AV1_COMP;
int av1_full_pixel_search(struct AV1_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bsize,
MV *mvp_full, int step_param, int error_per_bit,
int *cost_list, const MV *ref_mv, MV *tmp_mv,
int var_max, int rd);
int av1_full_pixel_search(const struct AV1_COMP *cpi, MACROBLOCK *x,
BLOCK_SIZE bsize, MV *mvp_full, int step_param,
int error_per_bit, int *cost_list, const MV *ref_mv,
MV *tmp_mv, int var_max, int rd);
#ifdef __cplusplus
} // extern "C"

Просмотреть файл

@ -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;
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 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);

Просмотреть файл

@ -47,7 +47,7 @@ struct AV1Common;
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);

Просмотреть файл

@ -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);
}
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
switch (cpi->common.bit_depth) {
case AOM_BITS_8:
@ -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 i;
int zero_seen = 0;

Просмотреть файл

@ -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_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,
unsigned int qstep, int *rate, int64_t *dist);
int av1_get_switchable_rate(const struct AV1_COMP *cpi,
const MACROBLOCKD *const xd);
int av1_get_switchable_rate(const struct AV1_COMP *cpi, const MACROBLOCKD *xd);
int av1_raster_block_offset(BLOCK_SIZE plane_bsize, int raster_block,
int stride);
@ -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;
}
void av1_mv_pred(struct AV1_COMP *cpi, MACROBLOCK *x, uint8_t *ref_y_buffer,
int ref_y_stride, int ref_frame, BLOCK_SIZE block_size);
void av1_mv_pred(const struct AV1_COMP *cpi, MACROBLOCK *x,
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) {
x->errorperbit = rdmult >> RD_EPB_SHIFT;

Просмотреть файл

@ -154,8 +154,8 @@ static void swap_block_ptr(MACROBLOCK *x, PICK_MODE_CONTEXT *ctx, int m, int n,
}
}
static void model_rd_for_sb(AV1_COMP *cpi, BLOCK_SIZE bsize, MACROBLOCK *x,
MACROBLOCKD *xd, int *out_rate_sum,
static void model_rd_for_sb(const AV1_COMP *const cpi, BLOCK_SIZE bsize,
MACROBLOCK *x, MACROBLOCKD *xd, int *out_rate_sum,
int64_t *out_dist_sum, int *skip_txfm_sb,
int64_t *skip_sse_sb) {
// Note our transform coeffs are 8 times an orthogonal transform.
@ -563,11 +563,12 @@ static void txfm_rd_in_plane(MACROBLOCK *x, int *rate, int64_t *distortion,
}
}
static void choose_largest_tx_size(AV1_COMP *cpi, MACROBLOCK *x, int *rate,
int64_t *distortion, int *skip, int64_t *sse,
int64_t ref_best_rd, BLOCK_SIZE bs) {
static void choose_largest_tx_size(const AV1_COMP *const cpi, MACROBLOCK *x,
int *rate, int64_t *distortion, int *skip,
int64_t *sse, int64_t ref_best_rd,
BLOCK_SIZE bs) {
const TX_SIZE max_tx_size = max_txsize_lookup[bs];
AV1_COMMON *const cm = &cpi->common;
const AV1_COMMON *const cm = &cpi->common;
const TX_SIZE largest_tx_size = tx_mode_to_biggest_tx_size[cm->tx_mode];
MACROBLOCKD *const xd = &x->e_mbd;
MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
@ -620,8 +621,8 @@ static void choose_largest_tx_size(AV1_COMP *cpi, MACROBLOCK *x, int *rate,
}
}
static void choose_smallest_tx_size(AV1_COMP *cpi, MACROBLOCK *x, int *rate,
int64_t *distortion, int *skip,
static void choose_smallest_tx_size(const AV1_COMP *const cpi, MACROBLOCK *x,
int *rate, int64_t *distortion, int *skip,
int64_t *sse, int64_t ref_best_rd,
BLOCK_SIZE bs) {
MACROBLOCKD *const xd = &x->e_mbd;
@ -633,12 +634,12 @@ static void choose_smallest_tx_size(AV1_COMP *cpi, MACROBLOCK *x, int *rate,
mbmi->tx_size, cpi->sf.use_fast_coef_costing);
}
static void choose_tx_size_from_rd(AV1_COMP *cpi, MACROBLOCK *x, int *rate,
int64_t *distortion, int *skip,
static void choose_tx_size_from_rd(const AV1_COMP *const cpi, MACROBLOCK *x,
int *rate, int64_t *distortion, int *skip,
int64_t *psse, int64_t ref_best_rd,
BLOCK_SIZE bs) {
const TX_SIZE max_tx_size = max_txsize_lookup[bs];
AV1_COMMON *const cm = &cpi->common;
const AV1_COMMON *const cm = &cpi->common;
MACROBLOCKD *const xd = &x->e_mbd;
MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
aom_prob skip_prob = av1_get_skip_prob(cm, xd);
@ -754,7 +755,7 @@ static void choose_tx_size_from_rd(AV1_COMP *cpi, MACROBLOCK *x, int *rate,
memcpy(x->zcoeff_blk[best_tx], zcoeff_blk, num_4x4_blks);
}
static void super_block_yrd(AV1_COMP *cpi, MACROBLOCK *x, int *rate,
static void super_block_yrd(const AV1_COMP *const cpi, MACROBLOCK *x, int *rate,
int64_t *distortion, int *skip, int64_t *psse,
BLOCK_SIZE bs, int64_t ref_best_rd) {
MACROBLOCKD *xd = &x->e_mbd;
@ -793,8 +794,9 @@ static int conditional_skipintra(PREDICTION_MODE mode,
return 0;
}
static int64_t rd_pick_intra4x4block(AV1_COMP *cpi, MACROBLOCK *x, int row,
int col, PREDICTION_MODE *best_mode,
static int64_t rd_pick_intra4x4block(const AV1_COMP *const cpi, MACROBLOCK *x,
int row, int col,
PREDICTION_MODE *best_mode,
const int *bmode_costs, ENTROPY_CONTEXT *a,
ENTROPY_CONTEXT *l, int *bestrate,
int *bestratey, int64_t *bestdistortion,
@ -1008,9 +1010,9 @@ static int64_t rd_pick_intra4x4block(AV1_COMP *cpi, MACROBLOCK *x, int row,
return best_rd;
}
static int64_t rd_pick_intra_sub_8x8_y_mode(AV1_COMP *cpi, MACROBLOCK *mb,
int *rate, int *rate_y,
int64_t *distortion,
static int64_t rd_pick_intra_sub_8x8_y_mode(const AV1_COMP *const cpi,
MACROBLOCK *mb, int *rate,
int *rate_y, int64_t *distortion,
int64_t best_rd) {
int i, j;
const MACROBLOCKD *const xd = &mb->e_mbd;
@ -1083,10 +1085,11 @@ static INLINE int write_uniform_cost(int n, int v) {
}
static int64_t pick_intra_angle_routine_sby(
AV1_COMP *cpi, MACROBLOCK *x, int8_t angle_delta, int max_angle_delta,
int *rate, int *rate_tokenonly, int64_t *distortion, int *skippable,
int8_t *best_angle_delta, TX_SIZE *best_tx_size, TX_TYPE *best_tx_type,
BLOCK_SIZE bsize, int mode_cost, int64_t *best_rd, int64_t best_rd_in) {
const AV1_COMP *const cpi, MACROBLOCK *x, int8_t angle_delta,
int max_angle_delta, int *rate, int *rate_tokenonly, int64_t *distortion,
int *skippable, int8_t *best_angle_delta, TX_SIZE *best_tx_size,
TX_TYPE *best_tx_type, BLOCK_SIZE bsize, int mode_cost, int64_t *best_rd,
int64_t best_rd_in) {
int this_rate, this_rate_tokenonly, s;
int64_t this_distortion, this_rd;
MB_MODE_INFO *const mbmi = &x->e_mbd.mi[0]->mbmi;
@ -1114,10 +1117,11 @@ static int64_t pick_intra_angle_routine_sby(
return this_rd;
}
static int64_t rd_pick_intra_angle_sby(AV1_COMP *cpi, MACROBLOCK *x, int *rate,
int *rate_tokenonly, int64_t *distortion,
int *skippable, BLOCK_SIZE bsize,
int mode_cost, int64_t best_rd) {
static int64_t rd_pick_intra_angle_sby(const AV1_COMP *const cpi, MACROBLOCK *x,
int *rate, int *rate_tokenonly,
int64_t *distortion, int *skippable,
BLOCK_SIZE bsize, int mode_cost,
int64_t best_rd) {
MB_MODE_INFO *const mbmi = &x->e_mbd.mi[0]->mbmi;
const int max_angle_delta =
av1_max_angle_delta_y[max_txsize_lookup[bsize]][mbmi->mode];
@ -1339,10 +1343,10 @@ static void highbd_angle_estimation(const uint8_t *src8, const int src_stride,
#endif // CONFIG_EXT_INTRA
// This function is used only for intra_only frames
static int64_t rd_pick_intra_sby_mode(AV1_COMP *cpi, MACROBLOCK *x, int *rate,
int *rate_tokenonly, int64_t *distortion,
int *skippable, BLOCK_SIZE bsize,
int64_t best_rd) {
static int64_t rd_pick_intra_sby_mode(const AV1_COMP *const cpi, MACROBLOCK *x,
int *rate, int *rate_tokenonly,
int64_t *distortion, int *skippable,
BLOCK_SIZE bsize, int64_t best_rd) {
PREDICTION_MODE mode;
PREDICTION_MODE mode_selected = DC_PRED;
MACROBLOCKD *const xd = &x->e_mbd;
@ -1360,7 +1364,7 @@ static int64_t rd_pick_intra_sby_mode(AV1_COMP *cpi, MACROBLOCK *x, int *rate,
const TX_SIZE max_tx_size = max_txsize_lookup[bsize];
#endif // CONFIG_EXT_INTRA
TX_TYPE best_tx_type = DCT_DCT;
int *bmode_costs;
const int *bmode_costs;
const MODE_INFO *above_mi = xd->above_mi;
const MODE_INFO *left_mi = xd->left_mi;
const PREDICTION_MODE A = av1_above_block_mode(xd->mi[0], above_mi, 0);
@ -1442,7 +1446,7 @@ static int64_t rd_pick_intra_sby_mode(AV1_COMP *cpi, MACROBLOCK *x, int *rate,
// Return value 0: early termination triggered, no valid rd cost available;
// 1: rd cost values are valid.
static int super_block_uvrd(const AV1_COMP *cpi, MACROBLOCK *x, int *rate,
static int super_block_uvrd(const AV1_COMP *const cpi, MACROBLOCK *x, int *rate,
int64_t *distortion, int *skippable, int64_t *sse,
BLOCK_SIZE bsize, int64_t ref_best_rd) {
MACROBLOCKD *const xd = &x->e_mbd;
@ -1494,7 +1498,7 @@ static int super_block_uvrd(const AV1_COMP *cpi, MACROBLOCK *x, int *rate,
#if CONFIG_EXT_INTRA
static int64_t pick_intra_angle_routine_sbuv(
AV1_COMP *cpi, MACROBLOCK *x, int *rate, int *rate_tokenonly,
const AV1_COMP *const cpi, MACROBLOCK *x, int *rate, int *rate_tokenonly,
int64_t *distortion, int *skippable, int8_t *best_angle_delta,
BLOCK_SIZE bsize, int rate_overhead, int64_t *best_rd, int64_t best_rd_in) {
MB_MODE_INFO *mbmi = &x->e_mbd.mi[0]->mbmi;
@ -1574,7 +1578,7 @@ static int rd_pick_intra_angle_sbuv(AV1_COMP *cpi, MACROBLOCK *x, int *rate,
}
#endif // CONFIG_EXT_INTRA
static int64_t rd_pick_intra_sbuv_mode(AV1_COMP *cpi, MACROBLOCK *x,
static int64_t rd_pick_intra_sbuv_mode(const AV1_COMP *const cpi, MACROBLOCK *x,
PICK_MODE_CONTEXT *ctx, int *rate,
int *rate_tokenonly, int64_t *distortion,
int *skippable, BLOCK_SIZE bsize,
@ -1659,7 +1663,7 @@ static int64_t rd_sbuv_dcpred(const AV1_COMP *cpi, MACROBLOCK *x, int *rate,
return RDCOST(x->rdmult, x->rddiv, *rate, *distortion);
}
static void choose_intra_uv_mode(AV1_COMP *cpi, MACROBLOCK *const x,
static void choose_intra_uv_mode(const AV1_COMP *const cpi, MACROBLOCK *const x,
PICK_MODE_CONTEXT *ctx, BLOCK_SIZE bsize,
TX_SIZE max_tx_size, int *rate_uv,
int *rate_uv_tokenonly, int64_t *dist_uv,
@ -1672,7 +1676,7 @@ static void choose_intra_uv_mode(AV1_COMP *cpi, MACROBLOCK *const x,
*mode_uv = x->e_mbd.mi[0]->mbmi.uv_mode;
}
static int cost_mv_ref(const AV1_COMP *cpi, PREDICTION_MODE mode,
static int cost_mv_ref(const AV1_COMP *const cpi, PREDICTION_MODE mode,
int16_t mode_context) {
#if CONFIG_REF_MV
int mode_cost = 0;
@ -1711,8 +1715,9 @@ static int cost_mv_ref(const AV1_COMP *cpi, PREDICTION_MODE mode,
#endif
}
static int set_and_cost_bmi_mvs(AV1_COMP *cpi, MACROBLOCK *x, MACROBLOCKD *xd,
int i, PREDICTION_MODE mode, int_mv this_mv[2],
static int set_and_cost_bmi_mvs(const AV1_COMP *const cpi, MACROBLOCK *x,
MACROBLOCKD *xd, int i, PREDICTION_MODE mode,
int_mv this_mv[2],
int_mv frame_mv[MB_MODE_COUNT][MAX_REF_FRAMES],
int_mv seg_mvs[MAX_REF_FRAMES],
int_mv *best_ref_mv[2], const int *mvjcost,
@ -1780,7 +1785,7 @@ static int set_and_cost_bmi_mvs(AV1_COMP *cpi, MACROBLOCK *x, MACROBLOCKD *xd,
return cost_mv_ref(cpi, mode, mode_ctx) + thismvcost;
}
static int64_t encode_inter_mb_segment(AV1_COMP *cpi, MACROBLOCK *x,
static int64_t encode_inter_mb_segment(const AV1_COMP *const cpi, MACROBLOCK *x,
int64_t best_yrd, int i, int *labelyrate,
int64_t *distortion, int64_t *sse,
ENTROPY_CONTEXT *ta, ENTROPY_CONTEXT *tl,
@ -1936,7 +1941,7 @@ static INLINE int mv_has_subpel(const MV *mv) {
// Check if NEARESTMV/NEARMV/ZEROMV is the cheapest way encode zero motion.
// TODO(aconverse): Find out if this is still productive then clean up or remove
static int check_best_zero_mv(const AV1_COMP *cpi,
static int check_best_zero_mv(const AV1_COMP *const cpi,
const int16_t mode_context[MAX_REF_FRAMES],
int_mv frame_mv[MB_MODE_COUNT][MAX_REF_FRAMES],
int this_mode,
@ -1983,9 +1988,9 @@ static int check_best_zero_mv(const AV1_COMP *cpi,
return 1;
}
static void joint_motion_search(AV1_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bsize,
int_mv *frame_mv, int mi_row, int mi_col,
int_mv single_newmv[MAX_REF_FRAMES],
static void joint_motion_search(const AV1_COMP *cpi, MACROBLOCK *x,
BLOCK_SIZE bsize, int_mv *frame_mv, int mi_row,
int mi_col, int_mv single_newmv[MAX_REF_FRAMES],
int *rate_mv, const int block) {
const AV1_COMMON *const cm = &cpi->common;
const int pw = 4 * num_4x4_blocks_wide_lookup[bsize];
@ -2178,7 +2183,7 @@ static void joint_motion_search(AV1_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bsize,
}
static int64_t rd_pick_best_sub8x8_mode(
AV1_COMP *cpi, MACROBLOCK *x, int_mv *best_ref_mv,
const AV1_COMP *const cpi, MACROBLOCK *x, int_mv *best_ref_mv,
int_mv *second_best_ref_mv, int64_t best_rd, int *returntotrate,
int *returnyrate, int64_t *returndistortion, int *skippable, int64_t *psse,
int mvthresh, int_mv seg_mvs[4][MAX_REF_FRAMES], BEST_SEG_INFO *bsi_buf,
@ -2192,7 +2197,7 @@ static int64_t rd_pick_best_sub8x8_mode(
int k, br = 0, idx, idy;
int64_t bd = 0, block_sse = 0;
PREDICTION_MODE this_mode;
AV1_COMMON *cm = &cpi->common;
const AV1_COMMON *cm = &cpi->common;
struct macroblock_plane *const p = &x->plane[0];
struct macroblockd_plane *const pd = &xd->plane[0];
const int label_count = 4;
@ -2711,7 +2716,7 @@ static void store_coding_context(const MACROBLOCK *x, PICK_MODE_CONTEXT *ctx,
}
static void setup_buffer_inter(
AV1_COMP *cpi, MACROBLOCK *x, MV_REFERENCE_FRAME ref_frame,
const AV1_COMP *const cpi, MACROBLOCK *x, MV_REFERENCE_FRAME ref_frame,
BLOCK_SIZE block_size, int mi_row, int mi_col,
int_mv frame_nearest_mv[MAX_REF_FRAMES],
int_mv frame_near_mv[MAX_REF_FRAMES],
@ -2751,9 +2756,9 @@ static void setup_buffer_inter(
block_size);
}
static void single_motion_search(AV1_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bsize,
int mi_row, int mi_col, int_mv *tmp_mv,
int *rate_mv) {
static void single_motion_search(const AV1_COMP *const cpi, MACROBLOCK *x,
BLOCK_SIZE bsize, int mi_row, int mi_col,
int_mv *tmp_mv, int *rate_mv) {
MACROBLOCKD *xd = &x->e_mbd;
const AV1_COMMON *cm = &cpi->common;
MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
@ -2915,7 +2920,7 @@ static INLINE void restore_dst_buf(MACROBLOCKD *xd,
// However, once established that vector may be usable through the nearest and
// near mv modes to reduce distortion in subsequent blocks and also improve
// visual quality.
static int discount_newmv_test(const AV1_COMP *cpi, int this_mode,
static int discount_newmv_test(const AV1_COMP *const cpi, int this_mode,
int_mv this_mv,
int_mv (*mode_mv)[MAX_REF_FRAMES],
int ref_frame) {
@ -2939,7 +2944,7 @@ static INLINE void clamp_mv2(MV *mv, const MACROBLOCKD *xd) {
}
static int64_t handle_inter_mode(
AV1_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bsize, int *rate2,
const AV1_COMP *const cpi, MACROBLOCK *x, BLOCK_SIZE bsize, int *rate2,
int64_t *distortion, int *skippable, int *rate_y, int *rate_uv,
int *disable_skip, int_mv (*mode_mv)[MAX_REF_FRAMES], int mi_row,
int mi_col,
@ -2951,7 +2956,7 @@ static int64_t handle_inter_mode(
InterpFilter (*single_filter)[MAX_REF_FRAMES],
int (*single_skippable)[MAX_REF_FRAMES], int64_t *psse,
const int64_t ref_best_rd) {
AV1_COMMON *cm = &cpi->common;
const AV1_COMMON *cm = &cpi->common;
MACROBLOCKD *xd = &x->e_mbd;
MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
MB_MODE_INFO_EXT *const mbmi_ext = x->mbmi_ext;
@ -3407,10 +3412,10 @@ static int64_t handle_inter_mode(
return 0; // The rate-distortion cost will be re-calculated by caller.
}
void av1_rd_pick_intra_mode_sb(AV1_COMP *cpi, MACROBLOCK *x, RD_COST *rd_cost,
BLOCK_SIZE bsize, PICK_MODE_CONTEXT *ctx,
int64_t best_rd) {
AV1_COMMON *const cm = &cpi->common;
void av1_rd_pick_intra_mode_sb(const AV1_COMP *cpi, MACROBLOCK *x,
RD_COST *rd_cost, BLOCK_SIZE bsize,
PICK_MODE_CONTEXT *ctx, int64_t best_rd) {
const AV1_COMMON *const cm = &cpi->common;
MACROBLOCKD *const xd = &x->e_mbd;
struct macroblockd_plane *const pd = xd->plane;
int rate_y = 0, rate_uv = 0, rate_y_tokenonly = 0, rate_uv_tokenonly = 0;
@ -3460,7 +3465,7 @@ void av1_rd_pick_intra_mode_sb(AV1_COMP *cpi, MACROBLOCK *x, RD_COST *rd_cost,
#define LOW_VAR_THRESH 16
#define VLOW_ADJ_MAX 25
#define VHIGH_ADJ_MAX 8
static void rd_variance_adjustment(AV1_COMP *cpi, MACROBLOCK *x,
static void rd_variance_adjustment(const AV1_COMP *const cpi, MACROBLOCK *x,
BLOCK_SIZE bsize, int64_t *this_rd,
MV_REFERENCE_FRAME ref_frame,
unsigned int source_variance) {
@ -3511,7 +3516,7 @@ static void rd_variance_adjustment(AV1_COMP *cpi, MACROBLOCK *x,
}
// Do we have an internal image edge (e.g. formatting bars).
int av1_internal_image_edge(AV1_COMP *cpi) {
int av1_internal_image_edge(const AV1_COMP *cpi) {
return (cpi->oxcf.pass == 2) &&
((cpi->twopass.this_frame_stats.inactive_zone_rows > 0) ||
(cpi->twopass.this_frame_stats.inactive_zone_cols > 0));
@ -3520,14 +3525,14 @@ int av1_internal_image_edge(AV1_COMP *cpi) {
// Checks to see if a super block is on a horizontal image edge.
// In most cases this is the "real" edge unless there are formatting
// bars embedded in the stream.
int av1_active_h_edge(AV1_COMP *cpi, int mi_row, int mi_step) {
int av1_active_h_edge(const AV1_COMP *cpi, int mi_row, int mi_step) {
int top_edge = 0;
int bottom_edge = cpi->common.mi_rows;
int is_active_h_edge = 0;
// For two pass account for any formatting bars detected.
if (cpi->oxcf.pass == 2) {
TWO_PASS *twopass = &cpi->twopass;
const TWO_PASS *const twopass = &cpi->twopass;
// The inactive region is specified in MBs not mi units.
// The image edge is in the following MB row.
@ -3547,14 +3552,14 @@ int av1_active_h_edge(AV1_COMP *cpi, int mi_row, int mi_step) {
// Checks to see if a super block is on a vertical image edge.
// In most cases this is the "real" edge unless there are formatting
// bars embedded in the stream.
int av1_active_v_edge(AV1_COMP *cpi, int mi_col, int mi_step) {
int av1_active_v_edge(const AV1_COMP *cpi, int mi_col, int mi_step) {
int left_edge = 0;
int right_edge = cpi->common.mi_cols;
int is_active_v_edge = 0;
// For two pass account for any formatting bars detected.
if (cpi->oxcf.pass == 2) {
TWO_PASS *twopass = &cpi->twopass;
const TWO_PASS *const twopass = &cpi->twopass;
// The inactive region is specified in MBs not mi units.
// The image edge is in the following MB row.
@ -3574,18 +3579,18 @@ int av1_active_v_edge(AV1_COMP *cpi, int mi_col, int mi_step) {
// Checks to see if a super block is at the edge of the active image.
// In most cases this is the "real" edge unless there are formatting
// bars embedded in the stream.
int av1_active_edge_sb(AV1_COMP *cpi, int mi_row, int mi_col) {
int av1_active_edge_sb(const AV1_COMP *cpi, int mi_row, int mi_col) {
return av1_active_h_edge(cpi, mi_row, MI_BLOCK_SIZE) ||
av1_active_v_edge(cpi, mi_col, MI_BLOCK_SIZE);
}
void av1_rd_pick_inter_mode_sb(AV1_COMP *cpi, TileDataEnc *tile_data,
void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
MACROBLOCK *x, int mi_row, int mi_col,
RD_COST *rd_cost, BLOCK_SIZE bsize,
PICK_MODE_CONTEXT *ctx, int64_t best_rd_so_far) {
AV1_COMMON *const cm = &cpi->common;
RD_OPT *const rd_opt = &cpi->rd;
SPEED_FEATURES *const sf = &cpi->sf;
const AV1_COMMON *const cm = &cpi->common;
const RD_OPT *const rd_opt = &cpi->rd;
const SPEED_FEATURES *const sf = &cpi->sf;
MACROBLOCKD *const xd = &x->e_mbd;
MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
MB_MODE_INFO_EXT *const mbmi_ext = x->mbmi_ext;
@ -4491,12 +4496,12 @@ void av1_rd_pick_inter_mode_sb(AV1_COMP *cpi, TileDataEnc *tile_data,
best_mode_skippable);
}
void av1_rd_pick_inter_mode_sb_seg_skip(AV1_COMP *cpi, TileDataEnc *tile_data,
MACROBLOCK *x, RD_COST *rd_cost,
BLOCK_SIZE bsize,
void av1_rd_pick_inter_mode_sb_seg_skip(const AV1_COMP *cpi,
TileDataEnc *tile_data, MACROBLOCK *x,
RD_COST *rd_cost, BLOCK_SIZE bsize,
PICK_MODE_CONTEXT *ctx,
int64_t best_rd_so_far) {
AV1_COMMON *const cm = &cpi->common;
const AV1_COMMON *const cm = &cpi->common;
MACROBLOCKD *const xd = &x->e_mbd;
MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
unsigned char segment_id = mbmi->segment_id;
@ -4594,14 +4599,14 @@ void av1_rd_pick_inter_mode_sb_seg_skip(AV1_COMP *cpi, TileDataEnc *tile_data,
store_coding_context(x, ctx, THR_ZEROMV, best_pred_diff, 0);
}
void av1_rd_pick_inter_mode_sub8x8(AV1_COMP *cpi, TileDataEnc *tile_data,
void av1_rd_pick_inter_mode_sub8x8(const AV1_COMP *cpi, TileDataEnc *tile_data,
MACROBLOCK *x, int mi_row, int mi_col,
RD_COST *rd_cost, BLOCK_SIZE bsize,
PICK_MODE_CONTEXT *ctx,
int64_t best_rd_so_far) {
AV1_COMMON *const cm = &cpi->common;
RD_OPT *const rd_opt = &cpi->rd;
SPEED_FEATURES *const sf = &cpi->sf;
const AV1_COMMON *const cm = &cpi->common;
const RD_OPT *const rd_opt = &cpi->rd;
const SPEED_FEATURES *const sf = &cpi->sf;
MACROBLOCKD *const xd = &x->e_mbd;
MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
const struct segmentation *const seg = &cm->seg;

Просмотреть файл

@ -26,36 +26,36 @@ struct AV1_COMP;
struct macroblock;
struct RD_COST;
void av1_rd_pick_intra_mode_sb(struct AV1_COMP *cpi, struct macroblock *x,
void av1_rd_pick_intra_mode_sb(const struct AV1_COMP *cpi, struct macroblock *x,
struct RD_COST *rd_cost, BLOCK_SIZE bsize,
PICK_MODE_CONTEXT *ctx, int64_t best_rd);
unsigned int av1_get_sby_perpixel_variance(AV1_COMP *cpi,
unsigned int av1_get_sby_perpixel_variance(const struct AV1_COMP *cpi,
const struct buf_2d *ref,
BLOCK_SIZE bs);
#if CONFIG_AOM_HIGHBITDEPTH
unsigned int av1_high_get_sby_perpixel_variance(AV1_COMP *cpi,
unsigned int av1_high_get_sby_perpixel_variance(const struct AV1_COMP *cpi,
const struct buf_2d *ref,
BLOCK_SIZE bs, int bd);
#endif
void av1_rd_pick_inter_mode_sb(struct AV1_COMP *cpi,
void av1_rd_pick_inter_mode_sb(const struct AV1_COMP *cpi,
struct TileDataEnc *tile_data,
struct macroblock *x, int mi_row, int mi_col,
struct RD_COST *rd_cost, BLOCK_SIZE bsize,
PICK_MODE_CONTEXT *ctx, int64_t best_rd_so_far);
void av1_rd_pick_inter_mode_sb_seg_skip(
struct AV1_COMP *cpi, struct TileDataEnc *tile_data, struct macroblock *x,
struct RD_COST *rd_cost, BLOCK_SIZE bsize, PICK_MODE_CONTEXT *ctx,
int64_t best_rd_so_far);
const struct AV1_COMP *cpi, struct TileDataEnc *tile_data,
struct macroblock *x, struct RD_COST *rd_cost, BLOCK_SIZE bsize,
PICK_MODE_CONTEXT *ctx, int64_t best_rd_so_far);
int av1_internal_image_edge(struct AV1_COMP *cpi);
int av1_active_h_edge(struct AV1_COMP *cpi, int mi_row, int mi_step);
int av1_active_v_edge(struct AV1_COMP *cpi, int mi_col, int mi_step);
int av1_active_edge_sb(struct AV1_COMP *cpi, int mi_row, int mi_col);
int av1_internal_image_edge(const struct AV1_COMP *cpi);
int av1_active_h_edge(const struct AV1_COMP *cpi, int mi_row, int mi_step);
int av1_active_v_edge(const struct AV1_COMP *cpi, int mi_col, int mi_step);
int av1_active_edge_sb(const struct AV1_COMP *cpi, int mi_row, int mi_col);
void av1_rd_pick_inter_mode_sub8x8(struct AV1_COMP *cpi,
void av1_rd_pick_inter_mode_sub8x8(const struct AV1_COMP *cpi,
struct TileDataEnc *tile_data,
struct macroblock *x, int mi_row, int mi_col,
struct RD_COST *rd_cost, BLOCK_SIZE bsize,

Просмотреть файл

@ -329,7 +329,7 @@ const struct av1_token av1_coef_encodings[ENTROPY_TOKENS] = {
};
struct tokenize_b_args {
AV1_COMP *cpi;
const AV1_COMP *cpi;
ThreadData *td;
TOKENEXTRA **tp;
};
@ -378,7 +378,7 @@ static INLINE int get_tx_eob(const struct segmentation *seg, int segment_id,
static void tokenize_b(int plane, int block, int blk_row, int blk_col,
BLOCK_SIZE plane_bsize, TX_SIZE tx_size, void *arg) {
struct tokenize_b_args *const args = arg;
AV1_COMP *cpi = args->cpi;
const AV1_COMP *cpi = args->cpi;
ThreadData *const td = args->td;
MACROBLOCK *const x = &td->mb;
MACROBLOCKD *const xd = &x->e_mbd;
@ -498,9 +498,9 @@ int av1_has_high_freq_in_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane) {
return result;
}
void av1_tokenize_sb(AV1_COMP *cpi, ThreadData *td, TOKENEXTRA **t, int dry_run,
BLOCK_SIZE bsize) {
AV1_COMMON *const cm = &cpi->common;
void av1_tokenize_sb(const AV1_COMP *cpi, ThreadData *td, TOKENEXTRA **t,
int dry_run, BLOCK_SIZE bsize) {
const AV1_COMMON *const cm = &cpi->common;
MACROBLOCK *const x = &td->mb;
MACROBLOCKD *const xd = &x->e_mbd;
MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;

Просмотреть файл

@ -51,7 +51,7 @@ int av1_has_high_freq_in_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane);
struct AV1_COMP;
struct ThreadData;
void av1_tokenize_sb(struct AV1_COMP *cpi, struct ThreadData *td,
void av1_tokenize_sb(const struct AV1_COMP *cpi, struct ThreadData *td,
TOKENEXTRA **t, int dry_run, BLOCK_SIZE bsize);
extern const int16_t *av1_dct_value_cost_ptr;

1
configure поставляемый
Просмотреть файл

@ -570,7 +570,6 @@ process_toolchain() {
check_add_cflags -Wdisabled-optimization
check_add_cflags -Wpointer-arith
check_add_cflags -Wtype-limits
check_add_cflags -Wcast-qual
check_add_cflags -Wvla
check_add_cflags -Wimplicit-function-declaration
check_add_cflags -Wuninitialized