Remove unnecessary input parameters
mi_row and mi_col are not really needed in lots of RDO functions, and can be
removed.
Change-Id: Ie1f50d809b7d3e0152ea386b14ee91118ad61fd4
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index dec84c5..bc4b663 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -70,42 +70,47 @@
static const char av1_tx_size_data_output_file[] = "tx_size_data.txt";
#endif
-typedef void (*model_rd_for_sb_type)(
- const AV1_COMP *const cpi, BLOCK_SIZE bsize, MACROBLOCK *x, MACROBLOCKD *xd,
- int plane_from, int plane_to, int mi_row, int mi_col, int *out_rate_sum,
- int64_t *out_dist_sum, int *skip_txfm_sb, int64_t *skip_sse_sb,
- int *plane_rate, int64_t *plane_sse, int64_t *plane_dist);
+typedef void (*model_rd_for_sb_type)(const AV1_COMP *const cpi,
+ BLOCK_SIZE bsize, MACROBLOCK *x,
+ MACROBLOCKD *xd, int plane_from,
+ int plane_to, int *out_rate_sum,
+ int64_t *out_dist_sum, int *skip_txfm_sb,
+ int64_t *skip_sse_sb, int *plane_rate,
+ int64_t *plane_sse, int64_t *plane_dist);
typedef void (*model_rd_from_sse_type)(const AV1_COMP *const cpi,
const MACROBLOCK *const x,
BLOCK_SIZE plane_bsize, int plane,
int64_t sse, int num_samples, int *rate,
int64_t *dist);
-static AOM_INLINE void model_rd_for_sb(
- const AV1_COMP *const cpi, BLOCK_SIZE bsize, MACROBLOCK *x, MACROBLOCKD *xd,
- int plane_from, int plane_to, int mi_row, int mi_col, int *out_rate_sum,
- int64_t *out_dist_sum, int *skip_txfm_sb, int64_t *skip_sse_sb,
- int *plane_rate, int64_t *plane_sse, int64_t *plane_dist);
+static AOM_INLINE void model_rd_for_sb(const AV1_COMP *const cpi,
+ BLOCK_SIZE bsize, MACROBLOCK *x,
+ MACROBLOCKD *xd, int plane_from,
+ int plane_to, int *out_rate_sum,
+ int64_t *out_dist_sum, int *skip_txfm_sb,
+ int64_t *skip_sse_sb, int *plane_rate,
+ int64_t *plane_sse, int64_t *plane_dist);
static AOM_INLINE void model_rd_for_sb_with_curvfit(
const AV1_COMP *const cpi, BLOCK_SIZE bsize, MACROBLOCK *x, MACROBLOCKD *xd,
- int plane_from, int plane_to, int mi_row, int mi_col, int *out_rate_sum,
- int64_t *out_dist_sum, int *skip_txfm_sb, int64_t *skip_sse_sb,
- int *plane_rate, int64_t *plane_sse, int64_t *plane_dist);
+ int plane_from, int plane_to, int *out_rate_sum, int64_t *out_dist_sum,
+ int *skip_txfm_sb, int64_t *skip_sse_sb, int *plane_rate,
+ int64_t *plane_sse, int64_t *plane_dist);
static AOM_INLINE void model_rd_for_sb_with_surffit(
const AV1_COMP *const cpi, BLOCK_SIZE bsize, MACROBLOCK *x, MACROBLOCKD *xd,
- int plane_from, int plane_to, int mi_row, int mi_col, int *out_rate_sum,
- int64_t *out_dist_sum, int *skip_txfm_sb, int64_t *skip_sse_sb,
- int *plane_rate, int64_t *plane_sse, int64_t *plane_dist);
+ int plane_from, int plane_to, int *out_rate_sum, int64_t *out_dist_sum,
+ int *skip_txfm_sb, int64_t *skip_sse_sb, int *plane_rate,
+ int64_t *plane_sse, int64_t *plane_dist);
static AOM_INLINE void model_rd_for_sb_with_dnn(
const AV1_COMP *const cpi, BLOCK_SIZE bsize, MACROBLOCK *x, MACROBLOCKD *xd,
- int plane_from, int plane_to, int mi_row, int mi_col, int *out_rate_sum,
- int64_t *out_dist_sum, int *skip_txfm_sb, int64_t *skip_sse_sb,
- int *plane_rate, int64_t *plane_sse, int64_t *plane_dist);
+ int plane_from, int plane_to, int *out_rate_sum, int64_t *out_dist_sum,
+ int *skip_txfm_sb, int64_t *skip_sse_sb, int *plane_rate,
+ int64_t *plane_sse, int64_t *plane_dist);
static AOM_INLINE void model_rd_for_sb_with_fullrdy(
const AV1_COMP *const cpi, BLOCK_SIZE bsize, MACROBLOCK *x, MACROBLOCKD *xd,
- int plane_from, int plane_to, int mi_row, int mi_col, int *out_rate_sum,
- int64_t *out_dist_sum, int *skip_txfm_sb, int64_t *skip_sse_sb,
- int *plane_rate, int64_t *plane_sse, int64_t *plane_dist);
+ int plane_from, int plane_to, int *out_rate_sum, int64_t *out_dist_sum,
+ int *skip_txfm_sb, int64_t *skip_sse_sb, int *plane_rate,
+ int64_t *plane_sse, int64_t *plane_dist);
+
static AOM_INLINE void model_rd_from_sse(const AV1_COMP *const cpi,
const MACROBLOCK *const x,
BLOCK_SIZE plane_bsize, int plane,
@@ -2048,15 +2053,13 @@
static AOM_INLINE void model_rd_for_sb(
const AV1_COMP *const cpi, BLOCK_SIZE bsize, MACROBLOCK *x, MACROBLOCKD *xd,
- int plane_from, int plane_to, int mi_row, int mi_col, int *out_rate_sum,
- int64_t *out_dist_sum, int *skip_txfm_sb, int64_t *skip_sse_sb,
- int *plane_rate, int64_t *plane_sse, int64_t *plane_dist) {
+ int plane_from, int plane_to, int *out_rate_sum, int64_t *out_dist_sum,
+ int *skip_txfm_sb, int64_t *skip_sse_sb, int *plane_rate,
+ int64_t *plane_sse, int64_t *plane_dist) {
// Note our transform coeffs are 8 times an orthogonal transform.
// Hence quantizer step is also 8 times. To get effective quantizer
// we need to divide by 8 before sending to modeling function.
int plane;
- (void)mi_row;
- (void)mi_col;
const int ref = xd->mi[0]->ref_frame[0];
int64_t rate_sum = 0;
@@ -2971,11 +2974,9 @@
static AOM_INLINE void model_rd_for_sb_with_dnn(
const AV1_COMP *const cpi, BLOCK_SIZE bsize, MACROBLOCK *x, MACROBLOCKD *xd,
- int plane_from, int plane_to, int mi_row, int mi_col, int *out_rate_sum,
- int64_t *out_dist_sum, int *skip_txfm_sb, int64_t *skip_sse_sb,
- int *plane_rate, int64_t *plane_sse, int64_t *plane_dist) {
- (void)mi_row;
- (void)mi_col;
+ int plane_from, int plane_to, int *out_rate_sum, int64_t *out_dist_sum,
+ int *skip_txfm_sb, int64_t *skip_sse_sb, int *plane_rate,
+ int64_t *plane_sse, int64_t *plane_dist) {
// Note our transform coeffs are 8 times an orthogonal transform.
// Hence quantizer step is also 8 times. To get effective quantizer
// we need to divide by 8 before sending to modeling function.
@@ -3067,11 +3068,9 @@
static AOM_INLINE void model_rd_for_sb_with_surffit(
const AV1_COMP *const cpi, BLOCK_SIZE bsize, MACROBLOCK *x, MACROBLOCKD *xd,
- int plane_from, int plane_to, int mi_row, int mi_col, int *out_rate_sum,
- int64_t *out_dist_sum, int *skip_txfm_sb, int64_t *skip_sse_sb,
- int *plane_rate, int64_t *plane_sse, int64_t *plane_dist) {
- (void)mi_row;
- (void)mi_col;
+ int plane_from, int plane_to, int *out_rate_sum, int64_t *out_dist_sum,
+ int *skip_txfm_sb, int64_t *skip_sse_sb, int *plane_rate,
+ int64_t *plane_sse, int64_t *plane_dist) {
// Note our transform coeffs are 8 times an orthogonal transform.
// Hence quantizer step is also 8 times. To get effective quantizer
// we need to divide by 8 before sending to modeling function.
@@ -3164,11 +3163,9 @@
static AOM_INLINE void model_rd_for_sb_with_curvfit(
const AV1_COMP *const cpi, BLOCK_SIZE bsize, MACROBLOCK *x, MACROBLOCKD *xd,
- int plane_from, int plane_to, int mi_row, int mi_col, int *out_rate_sum,
- int64_t *out_dist_sum, int *skip_txfm_sb, int64_t *skip_sse_sb,
- int *plane_rate, int64_t *plane_sse, int64_t *plane_dist) {
- (void)mi_row;
- (void)mi_col;
+ int plane_from, int plane_to, int *out_rate_sum, int64_t *out_dist_sum,
+ int *skip_txfm_sb, int64_t *skip_sse_sb, int *plane_rate,
+ int64_t *plane_sse, int64_t *plane_dist) {
// Note our transform coeffs are 8 times an orthogonal transform.
// Hence quantizer step is also 8 times. To get effective quantizer
// we need to divide by 8 before sending to modeling function.
@@ -4361,8 +4358,7 @@
// Model based RD estimation for luma intra blocks.
static int64_t intra_model_yrd(const AV1_COMP *const cpi, MACROBLOCK *const x,
- BLOCK_SIZE bsize, int mode_cost, int mi_row,
- int mi_col) {
+ BLOCK_SIZE bsize, int mode_cost) {
const AV1_COMMON *cm = &cpi->common;
MACROBLOCKD *const xd = &x->e_mbd;
MB_MODE_INFO *const mbmi = xd->mi[0];
@@ -4384,8 +4380,8 @@
}
// RD estimation.
model_rd_sb_fn[MODELRD_TYPE_INTRA](
- cpi, bsize, x, xd, 0, 0, mi_row, mi_col, &this_rd_stats.rate,
- &this_rd_stats.dist, &this_rd_stats.skip, &temp_sse, NULL, NULL, NULL);
+ cpi, bsize, x, xd, 0, 0, &this_rd_stats.rate, &this_rd_stats.dist,
+ &this_rd_stats.skip, &temp_sse, NULL, NULL, NULL);
if (av1_is_directional_mode(mbmi->mode) && av1_use_angle_delta(bsize)) {
mode_cost +=
x->angle_delta_cost[mbmi->mode - V_PRED]
@@ -4410,11 +4406,9 @@
// y_rd > 1.5 * best_model_rd.
static AOM_INLINE int model_intra_yrd_and_prune(const AV1_COMP *const cpi,
MACROBLOCK *x, BLOCK_SIZE bsize,
- int mi_row, int mi_col,
int mode_info_cost,
int64_t *best_model_rd) {
- const int64_t this_model_rd =
- intra_model_yrd(cpi, x, bsize, mode_info_cost, mi_row, mi_col);
+ const int64_t this_model_rd = intra_model_yrd(cpi, x, bsize, mode_info_cost);
if (*best_model_rd != INT64_MAX &&
this_model_rd > *best_model_rd + (*best_model_rd >> 1)) {
return 1;
@@ -4517,12 +4511,12 @@
// of palette mode.
static AOM_INLINE void palette_rd_y(
const AV1_COMP *const cpi, MACROBLOCK *x, MB_MODE_INFO *mbmi,
- BLOCK_SIZE bsize, int mi_row, int mi_col, int dc_mode_cost, const int *data,
- int *centroids, int n, uint16_t *color_cache, int n_cache,
- MB_MODE_INFO *best_mbmi, uint8_t *best_palette_color_map, int64_t *best_rd,
- int64_t *best_model_rd, int *rate, int *rate_tokenonly, int *rate_overhead,
- int64_t *distortion, int *skippable, int *beat_best_rd,
- PICK_MODE_CONTEXT *ctx, uint8_t *blk_skip, uint8_t *tx_type_map) {
+ BLOCK_SIZE bsize, int dc_mode_cost, const int *data, int *centroids, int n,
+ uint16_t *color_cache, int n_cache, MB_MODE_INFO *best_mbmi,
+ uint8_t *best_palette_color_map, int64_t *best_rd, int64_t *best_model_rd,
+ int *rate, int *rate_tokenonly, int *rate_overhead, int64_t *distortion,
+ int *skippable, int *beat_best_rd, PICK_MODE_CONTEXT *ctx,
+ uint8_t *blk_skip, uint8_t *tx_type_map) {
optimize_palette_colors(color_cache, n_cache, n, 1, centroids);
int k = av1_remove_duplicates(centroids, n);
if (k < PALETTE_MIN_SIZE) {
@@ -4549,8 +4543,8 @@
const int palette_mode_cost =
intra_mode_info_cost_y(cpi, x, mbmi, bsize, dc_mode_cost);
- if (model_intra_yrd_and_prune(cpi, x, bsize, mi_row, mi_col,
- palette_mode_cost, best_model_rd)) {
+ if (model_intra_yrd_and_prune(cpi, x, bsize, palette_mode_cost,
+ best_model_rd)) {
return;
}
@@ -4584,12 +4578,11 @@
}
static int rd_pick_palette_intra_sby(
- const AV1_COMP *const cpi, MACROBLOCK *x, BLOCK_SIZE bsize, int mi_row,
- int mi_col, int dc_mode_cost, MB_MODE_INFO *best_mbmi,
- uint8_t *best_palette_color_map, int64_t *best_rd, int64_t *best_model_rd,
- int *rate, int *rate_tokenonly, int64_t *distortion, int *skippable,
- int *beat_best_rd, PICK_MODE_CONTEXT *ctx, uint8_t *best_blk_skip,
- uint8_t *tx_type_map) {
+ const AV1_COMP *const cpi, MACROBLOCK *x, BLOCK_SIZE bsize,
+ int dc_mode_cost, MB_MODE_INFO *best_mbmi, uint8_t *best_palette_color_map,
+ int64_t *best_rd, int64_t *best_model_rd, int *rate, int *rate_tokenonly,
+ int64_t *distortion, int *skippable, int *beat_best_rd,
+ PICK_MODE_CONTEXT *ctx, uint8_t *best_blk_skip, uint8_t *tx_type_map) {
MACROBLOCKD *const xd = &x->e_mbd;
MB_MODE_INFO *const mbmi = xd->mi[0];
assert(!is_inter_block(mbmi));
@@ -4675,11 +4668,11 @@
// where the dominant colors and the k-means results are similar.
for (n = AOMMIN(colors, PALETTE_MAX_SIZE); n >= 2; --n) {
for (int i = 0; i < n; ++i) centroids[i] = top_colors[i];
- palette_rd_y(cpi, x, mbmi, bsize, mi_row, mi_col, dc_mode_cost, data,
- centroids, n, color_cache, n_cache, best_mbmi,
- best_palette_color_map, best_rd, best_model_rd, rate,
- rate_tokenonly, &rate_overhead, distortion, skippable,
- beat_best_rd, ctx, best_blk_skip, tx_type_map);
+ palette_rd_y(cpi, x, mbmi, bsize, dc_mode_cost, data, centroids, n,
+ color_cache, n_cache, best_mbmi, best_palette_color_map,
+ best_rd, best_model_rd, rate, rate_tokenonly, &rate_overhead,
+ distortion, skippable, beat_best_rd, ctx, best_blk_skip,
+ tx_type_map);
}
// K-means clustering.
@@ -4697,11 +4690,11 @@
}
av1_k_means(data, centroids, color_map, rows * cols, n, 1, max_itr);
}
- palette_rd_y(cpi, x, mbmi, bsize, mi_row, mi_col, dc_mode_cost, data,
- centroids, n, color_cache, n_cache, best_mbmi,
- best_palette_color_map, best_rd, best_model_rd, rate,
- rate_tokenonly, &rate_overhead, distortion, skippable,
- beat_best_rd, ctx, best_blk_skip, tx_type_map);
+ palette_rd_y(cpi, x, mbmi, bsize, dc_mode_cost, data, centroids, n,
+ color_cache, n_cache, best_mbmi, best_palette_color_map,
+ best_rd, best_model_rd, rate, rate_tokenonly, &rate_overhead,
+ distortion, skippable, beat_best_rd, ctx, best_blk_skip,
+ tx_type_map);
}
}
@@ -4715,11 +4708,10 @@
// Return 1 if an filter intra mode is selected; return 0 otherwise.
static int rd_pick_filter_intra_sby(const AV1_COMP *const cpi, MACROBLOCK *x,
- int mi_row, int mi_col, int *rate,
- int *rate_tokenonly, int64_t *distortion,
- int *skippable, BLOCK_SIZE bsize,
- int mode_cost, int64_t *best_rd,
- int64_t *best_model_rd,
+ int *rate, int *rate_tokenonly,
+ int64_t *distortion, int *skippable,
+ BLOCK_SIZE bsize, int mode_cost,
+ int64_t *best_rd, int64_t *best_model_rd,
PICK_MODE_CONTEXT *ctx) {
MACROBLOCKD *const xd = &x->e_mbd;
MB_MODE_INFO *mbmi = xd->mi[0];
@@ -4739,8 +4731,7 @@
RD_STATS tokenonly_rd_stats;
mbmi->filter_intra_mode_info.filter_intra_mode = mode;
- if (model_intra_yrd_and_prune(cpi, x, bsize, mi_row, mi_col, mode_cost,
- best_model_rd)) {
+ if (model_intra_yrd_and_prune(cpi, x, bsize, mode_cost, best_model_rd)) {
continue;
}
super_block_yrd(cpi, x, &tokenonly_rd_stats, bsize, *best_rd);
@@ -4782,11 +4773,11 @@
// Run RD calculation with given luma intra prediction angle., and return
// the RD cost. Update the best mode info. if the RD cost is the best so far.
static int64_t calc_rd_given_intra_angle(
- const AV1_COMP *const cpi, MACROBLOCK *x, BLOCK_SIZE bsize, int mi_row,
- int mi_col, int mode_cost, int64_t best_rd_in, int8_t angle_delta,
- int max_angle_delta, int *rate, RD_STATS *rd_stats, int *best_angle_delta,
- TX_SIZE *best_tx_size, int64_t *best_rd, int64_t *best_model_rd,
- uint8_t *best_tx_type_map, uint8_t *best_blk_skip, int skip_model_rd) {
+ const AV1_COMP *const cpi, MACROBLOCK *x, BLOCK_SIZE bsize, int mode_cost,
+ int64_t best_rd_in, int8_t angle_delta, int max_angle_delta, int *rate,
+ RD_STATS *rd_stats, int *best_angle_delta, TX_SIZE *best_tx_size,
+ int64_t *best_rd, int64_t *best_model_rd, uint8_t *best_tx_type_map,
+ uint8_t *best_blk_skip, int skip_model_rd) {
RD_STATS tokenonly_rd_stats;
int64_t this_rd;
MACROBLOCKD *xd = &x->e_mbd;
@@ -4795,8 +4786,7 @@
assert(!is_inter_block(mbmi));
mbmi->angle_delta[PLANE_TYPE_Y] = angle_delta;
if (!skip_model_rd) {
- if (model_intra_yrd_and_prune(cpi, x, bsize, mi_row, mi_col, mode_cost,
- best_model_rd)) {
+ if (model_intra_yrd_and_prune(cpi, x, bsize, mode_cost, best_model_rd)) {
return INT64_MAX;
}
}
@@ -4825,10 +4815,9 @@
// With given luma directional intra prediction mode, pick the best angle delta
// Return the RD cost corresponding to the best angle delta.
static int64_t rd_pick_intra_angle_sby(const AV1_COMP *const cpi, MACROBLOCK *x,
- int mi_row, int mi_col, int *rate,
- RD_STATS *rd_stats, BLOCK_SIZE bsize,
- int mode_cost, int64_t best_rd,
- int64_t *best_model_rd,
+ int *rate, RD_STATS *rd_stats,
+ BLOCK_SIZE bsize, int mode_cost,
+ int64_t best_rd, int64_t *best_model_rd,
int skip_model_rd_for_zero_deg) {
MACROBLOCKD *xd = &x->e_mbd;
MB_MODE_INFO *mbmi = xd->mi[0];
@@ -4849,10 +4838,9 @@
(best_rd == INT64_MAX) ? INT64_MAX
: (best_rd + (best_rd >> (first_try ? 3 : 5)));
const int64_t this_rd = calc_rd_given_intra_angle(
- cpi, x, bsize, mi_row, mi_col, mode_cost, best_rd_in,
- (1 - 2 * i) * angle_delta, MAX_ANGLE_DELTA, rate, rd_stats,
- &best_angle_delta, &best_tx_size, &best_rd, best_model_rd,
- best_tx_type_map, best_blk_skip,
+ cpi, x, bsize, mode_cost, best_rd_in, (1 - 2 * i) * angle_delta,
+ MAX_ANGLE_DELTA, rate, rd_stats, &best_angle_delta, &best_tx_size,
+ &best_rd, best_model_rd, best_tx_type_map, best_blk_skip,
(skip_model_rd_for_zero_deg & !angle_delta));
rd_cost[2 * angle_delta + i] = this_rd;
if (first_try && this_rd == INT64_MAX) return best_rd;
@@ -4874,10 +4862,9 @@
skip_search = 1;
if (!skip_search) {
calc_rd_given_intra_angle(
- cpi, x, bsize, mi_row, mi_col, mode_cost, best_rd,
- (1 - 2 * i) * angle_delta, MAX_ANGLE_DELTA, rate, rd_stats,
- &best_angle_delta, &best_tx_size, &best_rd, best_model_rd,
- best_tx_type_map, best_blk_skip, 0);
+ cpi, x, bsize, mode_cost, best_rd, (1 - 2 * i) * angle_delta,
+ MAX_ANGLE_DELTA, rate, rd_stats, &best_angle_delta, &best_tx_size,
+ &best_rd, best_model_rd, best_tx_type_map, best_blk_skip, 0);
}
}
}
@@ -5050,10 +5037,10 @@
// This function is used only for intra_only frames
static int64_t rd_pick_intra_sby_mode(const AV1_COMP *const cpi, MACROBLOCK *x,
- int mi_row, int mi_col, int *rate,
- int *rate_tokenonly, int64_t *distortion,
- int *skippable, BLOCK_SIZE bsize,
- int64_t best_rd, PICK_MODE_CONTEXT *ctx) {
+ int *rate, int *rate_tokenonly,
+ int64_t *distortion, int *skippable,
+ BLOCK_SIZE bsize, int64_t best_rd,
+ PICK_MODE_CONTEXT *ctx) {
MACROBLOCKD *const xd = &x->e_mbd;
MB_MODE_INFO *const mbmi = xd->mi[0];
assert(!is_inter_block(mbmi));
@@ -5111,8 +5098,8 @@
if (!cpi->oxcf.enable_paeth_intra && mbmi->mode == PAETH_PRED) continue;
mbmi->angle_delta[PLANE_TYPE_Y] = 0;
- if (model_intra_yrd_and_prune(cpi, x, bsize, mi_row, mi_col,
- bmode_costs[mbmi->mode], &best_model_rd)) {
+ if (model_intra_yrd_and_prune(cpi, x, bsize, bmode_costs[mbmi->mode],
+ &best_model_rd)) {
continue;
}
@@ -5121,9 +5108,9 @@
if (is_directional_mode && av1_use_angle_delta(bsize) &&
cpi->oxcf.enable_angle_delta) {
this_rd_stats.rate = INT_MAX;
- rd_pick_intra_angle_sby(cpi, x, mi_row, mi_col, &this_rate,
- &this_rd_stats, bsize, bmode_costs[mbmi->mode],
- best_rd, &best_model_rd, 1);
+ rd_pick_intra_angle_sby(cpi, x, &this_rate, &this_rd_stats, bsize,
+ bmode_costs[mbmi->mode], best_rd, &best_model_rd,
+ 1);
} else {
super_block_yrd(cpi, x, &this_rd_stats, bsize, best_rd);
}
@@ -5166,16 +5153,15 @@
if (try_palette) {
rd_pick_palette_intra_sby(
- cpi, x, bsize, mi_row, mi_col, bmode_costs[DC_PRED], &best_mbmi,
- best_palette_color_map, &best_rd, &best_model_rd, rate, rate_tokenonly,
- distortion, skippable, &beat_best_rd, ctx, ctx->blk_skip,
- ctx->tx_type_map);
+ cpi, x, bsize, bmode_costs[DC_PRED], &best_mbmi, best_palette_color_map,
+ &best_rd, &best_model_rd, rate, rate_tokenonly, distortion, skippable,
+ &beat_best_rd, ctx, ctx->blk_skip, ctx->tx_type_map);
}
if (beat_best_rd && av1_filter_intra_allowed_bsize(&cpi->common, bsize)) {
- if (rd_pick_filter_intra_sby(
- cpi, x, mi_row, mi_col, rate, rate_tokenonly, distortion, skippable,
- bsize, bmode_costs[DC_PRED], &best_rd, &best_model_rd, ctx)) {
+ if (rd_pick_filter_intra_sby(cpi, x, rate, rate_tokenonly, distortion,
+ skippable, bsize, bmode_costs[DC_PRED],
+ &best_rd, &best_model_rd, ctx)) {
best_mbmi = *mbmi;
}
}
@@ -6197,8 +6183,8 @@
int64_t model_dist;
int model_skip;
model_rd_sb_fn[MODELRD_TYPE_TX_SEARCH_PRUNE](
- cpi, bsize, x, xd, 0, 0, mi_row, mi_col, &model_rate, &model_dist,
- &model_skip, NULL, NULL, NULL, NULL);
+ cpi, bsize, x, xd, 0, 0, &model_rate, &model_dist, &model_skip, NULL,
+ NULL, NULL, NULL);
const int64_t model_rd = RDCOST(x->rdmult, model_rate, model_dist);
// If the modeled rd is a lot worse than the best so far, breakout.
// TODO(debargha, urvang): Improve the model and make the check below
@@ -6285,9 +6271,9 @@
static AOM_INLINE void model_rd_for_sb_with_fullrdy(
const AV1_COMP *const cpi, BLOCK_SIZE bsize, MACROBLOCK *x, MACROBLOCKD *xd,
- int plane_from, int plane_to, int mi_row, int mi_col, int *out_rate_sum,
- int64_t *out_dist_sum, int *skip_txfm_sb, int64_t *skip_sse_sb,
- int *plane_rate, int64_t *plane_sse, int64_t *plane_dist) {
+ int plane_from, int plane_to, int *out_rate_sum, int64_t *out_dist_sum,
+ int *skip_txfm_sb, int64_t *skip_sse_sb, int *plane_rate,
+ int64_t *plane_sse, int64_t *plane_dist) {
const int ref = xd->mi[0]->ref_frame[0];
int64_t rate_sum = 0;
@@ -6313,6 +6299,8 @@
RD_STATS rd_stats;
if (plane == 0) {
+ const int mi_row = -xd->mb_to_top_edge >> (3 + MI_SIZE_LOG2);
+ const int mi_col = -xd->mb_to_left_edge >> (3 + MI_SIZE_LOG2);
pick_tx_size_type_yrd(cpi, x, &rd_stats, bsize, mi_row, mi_col,
INT64_MAX);
if (rd_stats.rate == INT_MAX) {
@@ -8224,8 +8212,8 @@
}
// Get the RD cost from model RD
model_rd_sb_fn[MODELRD_TYPE_MASKED_COMPOUND](
- cpi, bsize, x, xd, 0, 0, mi_row, mi_col, &rate_sum, &dist_sum,
- &tmp_skip_txfm_sb, &tmp_skip_sse_sb, NULL, NULL, NULL);
+ cpi, bsize, x, xd, 0, 0, &rate_sum, &dist_sum, &tmp_skip_txfm_sb,
+ &tmp_skip_sse_sb, NULL, NULL, NULL);
rd = RDCOST(x->rdmult, *rs2 + *out_rate_mv + rate_sum, dist_sum);
*comp_model_rd_cur = rd;
// Override with best if current is worse than best for new MV
@@ -8519,9 +8507,9 @@
plane_from, plane_to);
model_rd_sb_fn[MODELRD_TYPE_INTERP_FILTER](
- cpi, bsize, x, xd, plane_from, plane_to, mi_row, mi_col,
- &tmp_rd_stats.rate, &tmp_rd_stats.dist, &tmp_rd_stats.skip,
- &tmp_rd_stats.sse, NULL, NULL, NULL);
+ cpi, bsize, x, xd, plane_from, plane_to, &tmp_rd_stats.rate,
+ &tmp_rd_stats.dist, &tmp_rd_stats.skip, &tmp_rd_stats.sse, NULL, NULL,
+ NULL);
av1_merge_rd_stats(rd_stats, &tmp_rd_stats);
}
@@ -9451,8 +9439,8 @@
intrapred, bw);
av1_combine_interintra(xd, bsize, 0, tmp_buf, bw, intrapred, bw);
model_rd_sb_fn[MODELRD_TYPE_INTERINTRA](
- cpi, bsize, x, xd, 0, 0, mi_row, mi_col, &rate_sum, &dist_sum,
- &tmp_skip_txfm_sb, &tmp_skip_sse_sb, NULL, NULL, NULL);
+ cpi, bsize, x, xd, 0, 0, &rate_sum, &dist_sum, &tmp_skip_txfm_sb,
+ &tmp_skip_sse_sb, NULL, NULL, NULL);
rd = RDCOST(x->rdmult, tmp_rate_mv + rate_sum + rmode, dist_sum);
if (rd < best_interintra_rd) {
best_interintra_rd = rd;
@@ -9519,7 +9507,7 @@
orig_dst, intrapred, bw);
av1_combine_interintra(xd, bsize, 0, tmp_buf, bw, intrapred, bw);
model_rd_sb_fn[MODELRD_TYPE_INTERINTRA](
- cpi, bsize, x, xd, 0, 0, mi_row, mi_col, &rate_sum, &dist_sum,
+ cpi, bsize, x, xd, 0, 0, &rate_sum, &dist_sum,
&tmp_skip_txfm_sb, &tmp_skip_sse_sb, NULL, NULL, NULL);
rd = RDCOST(x->rdmult, tmp_rate_mv + rate_sum + rmode, dist_sum);
if (rd < best_interintra_rd) {
@@ -9564,8 +9552,8 @@
av1_enc_build_inter_predictor(cm, xd, mi_row, mi_col, orig_dst, bsize,
AOM_PLANE_Y, AOM_PLANE_Y);
model_rd_sb_fn[MODELRD_TYPE_MASKED_COMPOUND](
- cpi, bsize, x, xd, 0, 0, mi_row, mi_col, &rate_sum, &dist_sum,
- &tmp_skip_txfm_sb, &tmp_skip_sse_sb, NULL, NULL, NULL);
+ cpi, bsize, x, xd, 0, 0, &rate_sum, &dist_sum, &tmp_skip_txfm_sb,
+ &tmp_skip_sse_sb, NULL, NULL, NULL);
rd = RDCOST(x->rdmult, tmp_rate_mv + rmode + rate_sum + rwedge,
dist_sum);
}
@@ -9937,8 +9925,8 @@
} else if (cpi->sf.inter_mode_rd_model_estimation == 2 ||
cpi->sf.use_nonrd_pick_mode) {
model_rd_sb_fn[MODELRD_TYPE_MOTION_MODE_RD](
- cpi, bsize, x, xd, 0, num_planes - 1, mi_row, mi_col,
- &est_residue_cost, &est_dist, NULL, &curr_sse, NULL, NULL, NULL);
+ cpi, bsize, x, xd, 0, num_planes - 1, &est_residue_cost, &est_dist,
+ NULL, &curr_sse, NULL, NULL, NULL);
}
est_rd = RDCOST(x->rdmult, rd_stats->rate + est_residue_cost, est_dist);
if (est_rd * 0.80 > *best_est_rd) {
@@ -10357,8 +10345,8 @@
av1_enc_build_inter_predictor(cm, xd, mi_row, mi_col, orig_dst, bsize,
AOM_PLANE_Y, AOM_PLANE_Y);
model_rd_sb_fn[MODELRD_CURVFIT](
- cpi, bsize, x, xd, 0, 0, mi_row, mi_col, &est_rate[comp_type],
- &est_dist[comp_type], NULL, NULL, NULL, NULL, NULL);
+ cpi, bsize, x, xd, 0, 0, &est_rate[comp_type], &est_dist[comp_type],
+ NULL, NULL, NULL, NULL, NULL);
est_rate[comp_type] += masked_type_cost[comp_type];
est_rd[comp_type] = RDCOST(x->rdmult, est_rate[comp_type] + *rate_mv,
est_dist[comp_type]);
@@ -10428,7 +10416,7 @@
best_rd_cur = RDCOST(x->rdmult, rs2 + *rate_mv + est_rd_stats.rate,
est_rd_stats.dist);
model_rd_sb_fn[MODELRD_TYPE_MASKED_COMPOUND](
- cpi, bsize, x, xd, 0, 0, mi_row, mi_col, &rate_sum, &dist_sum,
+ cpi, bsize, x, xd, 0, 0, &rate_sum, &dist_sum,
&tmp_skip_txfm_sb, &tmp_skip_sse_sb, NULL, NULL, NULL);
comp_model_rd_cur =
RDCOST(x->rdmult, rs2 + *rate_mv + rate_sum, dist_sum);
@@ -10664,9 +10652,8 @@
AOM_PLANE_Y, AOM_PLANE_Y);
int est_rate;
int64_t est_dist;
- model_rd_sb_fn[MODELRD_CURVFIT](cpi, bsize, x, xd, 0, 0, mi_row, mi_col,
- &est_rate, &est_dist, NULL, NULL, NULL, NULL,
- NULL);
+ model_rd_sb_fn[MODELRD_CURVFIT](cpi, bsize, x, xd, 0, 0, &est_rate, &est_dist,
+ NULL, NULL, NULL, NULL, NULL);
return RDCOST(x->rdmult, rd_stats->rate + est_rate, est_dist);
}
@@ -11275,8 +11262,8 @@
mbmi->skip_mode = 0;
const int64_t intra_yrd =
- rd_pick_intra_sby_mode(cpi, x, mi_row, mi_col, &rate_y, &rate_y_tokenonly,
- &dist_y, &y_skip, bsize, best_rd, ctx);
+ rd_pick_intra_sby_mode(cpi, x, &rate_y, &rate_y_tokenonly, &dist_y,
+ &y_skip, bsize, best_rd, ctx);
// Initialize default mode evaluation params
set_mode_eval_params(cpi, x, DEFAULT_EVAL);
@@ -11955,10 +11942,10 @@
}
static AOM_INLINE void search_palette_mode(
- const AV1_COMP *cpi, MACROBLOCK *x, int mi_row, int mi_col,
- RD_STATS *rd_cost, PICK_MODE_CONTEXT *ctx, BLOCK_SIZE bsize,
- MB_MODE_INFO *const mbmi, PALETTE_MODE_INFO *const pmi,
- unsigned int *ref_costs_single, InterModeSearchState *search_state) {
+ const AV1_COMP *cpi, MACROBLOCK *x, RD_STATS *rd_cost,
+ PICK_MODE_CONTEXT *ctx, BLOCK_SIZE bsize, MB_MODE_INFO *const mbmi,
+ PALETTE_MODE_INFO *const pmi, unsigned int *ref_costs_single,
+ InterModeSearchState *search_state) {
const AV1_COMMON *const cm = &cpi->common;
const int num_planes = av1_num_planes(cm);
MACROBLOCKD *const xd = &x->e_mbd;
@@ -11983,10 +11970,9 @@
mbmi->ref_frame[0] = INTRA_FRAME;
mbmi->ref_frame[1] = NONE_FRAME;
rate_overhead_palette = rd_pick_palette_intra_sby(
- cpi, x, bsize, mi_row, mi_col, intra_mode_cost[DC_PRED],
- &best_mbmi_palette, best_palette_color_map, &best_rd_palette,
- &best_model_rd_palette, NULL, NULL, NULL, NULL, NULL, ctx, best_blk_skip,
- best_tx_type_map);
+ cpi, x, bsize, intra_mode_cost[DC_PRED], &best_mbmi_palette,
+ best_palette_color_map, &best_rd_palette, &best_model_rd_palette, NULL,
+ NULL, NULL, NULL, NULL, ctx, best_blk_skip, best_tx_type_map);
if (pmi->palette_size[0] == 0) return;
memcpy(x->blk_skip, best_blk_skip,
@@ -12296,8 +12282,7 @@
static int64_t handle_intra_mode(InterModeSearchState *search_state,
const AV1_COMP *cpi, MACROBLOCK *x,
- BLOCK_SIZE bsize, int mi_row, int mi_col,
- int ref_frame_cost,
+ BLOCK_SIZE bsize, int ref_frame_cost,
const PICK_MODE_CONTEXT *ctx, int disable_skip,
RD_STATS *rd_stats, RD_STATS *rd_stats_y,
RD_STATS *rd_stats_uv) {
@@ -12339,9 +12324,8 @@
rd_stats_y->rate = INT_MAX;
int64_t model_rd = INT64_MAX;
int rate_dummy;
- rd_pick_intra_angle_sby(cpi, x, mi_row, mi_col, &rate_dummy, rd_stats_y,
- bsize, mode_cost, search_state->best_rd, &model_rd,
- 0);
+ rd_pick_intra_angle_sby(cpi, x, &rate_dummy, rd_stats_y, bsize, mode_cost,
+ search_state->best_rd, &model_rd, 0);
} else {
av1_init_rd_stats(rd_stats_y);
@@ -13357,8 +13341,8 @@
RD_STATS intra_rd_stats, intra_rd_stats_y, intra_rd_stats_uv;
intra_rd_stats.rdcost = handle_intra_mode(
- &search_state, cpi, x, bsize, mi_row, mi_col, intra_ref_frame_cost, ctx,
- 0, &intra_rd_stats, &intra_rd_stats_y, &intra_rd_stats_uv);
+ &search_state, cpi, x, bsize, intra_ref_frame_cost, ctx, 0,
+ &intra_rd_stats, &intra_rd_stats_y, &intra_rd_stats_uv);
if (intra_rd_stats.rdcost < search_state.best_rd) {
const int txfm_search_done = 1;
update_search_state(&search_state, rd_cost, ctx, &intra_rd_stats,
@@ -13386,7 +13370,7 @@
!is_inter_mode(search_state.best_mbmode.mode);
PALETTE_MODE_INFO *const pmi = &mbmi->palette_mode_info;
if (try_palette) {
- search_palette_mode(cpi, x, mi_row, mi_col, rd_cost, ctx, bsize, mbmi, pmi,
+ search_palette_mode(cpi, x, rd_cost, ctx, bsize, mbmi, pmi,
ref_costs_single, &search_state);
}
@@ -13950,8 +13934,8 @@
const int ref_frame_cost = ref_costs_single[ref_frame];
intra_rd_stats.rdcost = handle_intra_mode(
- &search_state, cpi, x, bsize, mi_row, mi_col, ref_frame_cost, ctx, 0,
- &intra_rd_stats, &intra_rd_stats_y, &intra_rd_stats_uv);
+ &search_state, cpi, x, bsize, ref_frame_cost, ctx, 0, &intra_rd_stats,
+ &intra_rd_stats_y, &intra_rd_stats_uv);
if (intra_rd_stats.rdcost < search_state.best_rd) {
const int txfm_search_done = 1;
update_search_state(&search_state, rd_cost, ctx, &intra_rd_stats,