Commit 26e5b5e2 authored by Dmitry Kovalev's avatar Dmitry Kovalev

Removing unused or redundant arguments from *_args structures.

Redundant dst, pre[2] from build_inter_predictors_args, unused cm from
encode_b_args.

Change-Id: I2c476cd328c5c0cca4c78ba451ca6ba2a2c37e2d
parent 367cb10f
......@@ -115,9 +115,8 @@ MV clamp_mv_to_umv_border_sb(const MACROBLOCKD *xd, const MV *src_mv,
struct build_inter_predictors_args {
MACROBLOCKD *xd;
int x, y;
struct buf_2d *dst;
struct buf_2d *pre[2];
};
static void build_inter_predictors(int plane, int block,
BLOCK_SIZE_TYPE bsize,
int pred_w, int pred_h,
......@@ -141,8 +140,8 @@ static void build_inter_predictors(int plane, int block,
for (ref = 0; ref < 1 + use_second_ref; ++ref) {
struct scale_factors *const scale = &xd->scale_factor[ref];
struct buf_2d *const pre_buf = arg->pre[ref];
struct buf_2d *const dst_buf = arg->dst;
struct buf_2d *const pre_buf = &pd->pre[ref];
struct buf_2d *const dst_buf = &pd->dst;
const uint8_t *const pre = pre_buf->buf + scaled_buffer_offset(x, y,
pre_buf->stride, scale);
......@@ -182,8 +181,6 @@ static void build_inter_predictors_for_planes(MACROBLOCKD *xd,
for (plane = plane_from; plane <= plane_to; ++plane) {
struct build_inter_predictors_args args = {
xd, mi_col * MI_SIZE, mi_row * MI_SIZE,
&xd->plane[plane].dst,
{&xd->plane[plane].pre[0], &xd->plane[plane].pre[1]}
};
foreach_predicted_block_in_plane(xd, bsize, plane, build_inter_predictors,
&args);
......
......@@ -125,24 +125,22 @@ static unsigned int tt_activity_measure(MACROBLOCK *x) {
}
// Stub for alternative experimental activity measures.
static unsigned int alt_activity_measure(VP9_COMP *cpi, MACROBLOCK *x,
int use_dc_pred) {
return vp9_encode_intra(cpi, x, use_dc_pred);
static unsigned int alt_activity_measure(MACROBLOCK *x, int use_dc_pred) {
return vp9_encode_intra(x, use_dc_pred);
}
DECLARE_ALIGNED(16, static const uint8_t, vp9_64x64_zeros[64*64]) = {0};
// Measure the activity of the current macroblock
// What we measure here is TBD so abstracted to this function
#define ALT_ACT_MEASURE 1
static unsigned int mb_activity_measure(VP9_COMP *cpi, MACROBLOCK *x,
int mb_row, int mb_col) {
static unsigned int mb_activity_measure(MACROBLOCK *x, int mb_row, int mb_col) {
unsigned int mb_activity;
if (ALT_ACT_MEASURE) {
int use_dc_pred = (mb_col || mb_row) && (!mb_col || !mb_row);
// Or use and alternative.
mb_activity = alt_activity_measure(cpi, x, use_dc_pred);
mb_activity = alt_activity_measure(x, use_dc_pred);
} else {
// Original activity measure from Tim T's code.
mb_activity = tt_activity_measure(x);
......@@ -299,7 +297,7 @@ static void build_activity_map(VP9_COMP *cpi) {
#endif
// measure activity
mb_activity = mb_activity_measure(cpi, x, mb_row, mb_col);
mb_activity = mb_activity_measure(x, mb_row, mb_col);
// Keep frame sum
activity_sum += mb_activity;
......@@ -2641,8 +2639,8 @@ static void encode_superblock(VP9_COMP *cpi, TOKENEXTRA **t, int output_enabled,
}
if (mbmi->ref_frame[0] == INTRA_FRAME) {
vp9_encode_intra_block_y(cm, x, MAX(bsize, BLOCK_8X8));
vp9_encode_intra_block_uv(cm, x, MAX(bsize, BLOCK_8X8));
vp9_encode_intra_block_y(x, MAX(bsize, BLOCK_8X8));
vp9_encode_intra_block_uv(x, MAX(bsize, BLOCK_8X8));
if (output_enabled)
sum_intra_stats(cpi, x);
} else {
......@@ -2668,7 +2666,7 @@ static void encode_superblock(VP9_COMP *cpi, TOKENEXTRA **t, int output_enabled,
if (mbmi->ref_frame[0] == INTRA_FRAME) {
vp9_tokenize_sb(cpi, t, !output_enabled, MAX(bsize, BLOCK_8X8));
} else if (!x->skip) {
vp9_encode_sb(cm, x, MAX(bsize, BLOCK_8X8));
vp9_encode_sb(x, MAX(bsize, BLOCK_8X8));
vp9_tokenize_sb(cpi, t, !output_enabled, MAX(bsize, BLOCK_8X8));
} else {
int mb_skip_context = xd->left_available ? (mi - 1)->mbmi.skip_coeff : 0;
......
......@@ -15,14 +15,14 @@
#include "vp9/encoder/vp9_encodemb.h"
#include "vp9/encoder/vp9_encodeintra.h"
int vp9_encode_intra(VP9_COMP *cpi, MACROBLOCK *x, int use_16x16_pred) {
int vp9_encode_intra(MACROBLOCK *x, int use_16x16_pred) {
MB_MODE_INFO * mbmi = &x->e_mbd.mode_info_context->mbmi;
(void) cpi;
x->skip_encode = 0;
mbmi->mode = DC_PRED;
mbmi->ref_frame[0] = INTRA_FRAME;
mbmi->txfm_size = use_16x16_pred ? (mbmi->sb_type >= BLOCK_16X16 ?
TX_16X16 : TX_8X8) : TX_4X4;
vp9_encode_intra_block_y(&cpi->common, x, mbmi->sb_type);
mbmi->txfm_size = use_16x16_pred ? (mbmi->sb_type >= BLOCK_16X16 ? TX_16X16
: TX_8X8)
: TX_4X4;
vp9_encode_intra_block_y(x, mbmi->sb_type);
return vp9_get_mb_ss(x->plane[0].src_diff);
}
......@@ -13,12 +13,8 @@
#include "vp9/encoder/vp9_onyx_int.h"
int vp9_encode_intra(VP9_COMP *cpi, MACROBLOCK *x, int use_16x16_pred);
int vp9_encode_intra(MACROBLOCK *x, int use_16x16_pred);
void vp9_encode_block_intra(int plane, int block, BLOCK_SIZE_TYPE bsize,
TX_SIZE tx_size, void *arg);
void vp9_encode_intra_block_y(VP9_COMMON *const cm, MACROBLOCK *mb,
BLOCK_SIZE_TYPE bs);
void vp9_encode_intra_block_uv(VP9_COMMON *const cm, MACROBLOCK *mb,
BLOCK_SIZE_TYPE bs);
#endif // VP9_ENCODER_VP9_ENCODEINTRA_H_
......@@ -428,17 +428,16 @@ void optimize_init_b(int plane, BLOCK_SIZE_TYPE bsize, void *arg) {
}
}
void vp9_optimize_sby(VP9_COMMON *cm, MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
void vp9_optimize_sby(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
struct optimize_ctx ctx;
struct encode_b_args arg = {cm, x, &ctx};
struct encode_b_args arg = {x, &ctx};
optimize_init_b(0, bsize, &arg);
foreach_transformed_block_in_plane(&x->e_mbd, bsize, 0, optimize_block, &arg);
}
void vp9_optimize_sbuv(VP9_COMMON *const cm, MACROBLOCK *x,
BLOCK_SIZE_TYPE bsize) {
void vp9_optimize_sbuv(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
struct optimize_ctx ctx;
struct encode_b_args arg = {cm, x, &ctx};
struct encode_b_args arg = {x, &ctx};
int i;
for (i = 1; i < MAX_MB_PLANE; ++i)
optimize_init_b(i, bsize, &arg);
......@@ -563,25 +562,24 @@ static void encode_block(int plane, int block, BLOCK_SIZE_TYPE bsize,
}
}
void vp9_xform_quant_sby(VP9_COMMON *cm, MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
void vp9_xform_quant_sby(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
MACROBLOCKD* const xd = &x->e_mbd;
struct encode_b_args arg = {cm, x, NULL};
struct encode_b_args arg = {x, NULL};
foreach_transformed_block_in_plane(xd, bsize, 0, vp9_xform_quant, &arg);
}
void vp9_xform_quant_sbuv(VP9_COMMON *cm, MACROBLOCK *x,
BLOCK_SIZE_TYPE bsize) {
void vp9_xform_quant_sbuv(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
MACROBLOCKD* const xd = &x->e_mbd;
struct encode_b_args arg = {cm, x, NULL};
struct encode_b_args arg = {x, NULL};
foreach_transformed_block_uv(xd, bsize, vp9_xform_quant, &arg);
}
void vp9_encode_sby(VP9_COMMON *cm, MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
void vp9_encode_sby(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
MACROBLOCKD *const xd = &x->e_mbd;
struct optimize_ctx ctx;
struct encode_b_args arg = {cm, x, &ctx};
struct encode_b_args arg = {x, &ctx};
vp9_subtract_sby(x, bsize);
if (x->optimize)
......@@ -590,10 +588,10 @@ void vp9_encode_sby(VP9_COMMON *cm, MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
foreach_transformed_block_in_plane(xd, bsize, 0, encode_block, &arg);
}
void vp9_encode_sbuv(VP9_COMMON *cm, MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
void vp9_encode_sbuv(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
MACROBLOCKD *const xd = &x->e_mbd;
struct optimize_ctx ctx;
struct encode_b_args arg = {cm, x, &ctx};
struct encode_b_args arg = {x, &ctx};
vp9_subtract_sbuv(x, bsize);
if (x->optimize) {
......@@ -605,10 +603,10 @@ void vp9_encode_sbuv(VP9_COMMON *cm, MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
foreach_transformed_block_uv(xd, bsize, encode_block, &arg);
}
void vp9_encode_sb(VP9_COMMON *cm, MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
void vp9_encode_sb(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
MACROBLOCKD *const xd = &x->e_mbd;
struct optimize_ctx ctx;
struct encode_b_args arg = {cm, x, &ctx};
struct encode_b_args arg = {x, &ctx};
vp9_subtract_sb(x, bsize);
......@@ -772,20 +770,18 @@ void vp9_encode_block_intra(int plane, int block, BLOCK_SIZE_TYPE bsize,
}
}
void vp9_encode_intra_block_y(VP9_COMMON *cm, MACROBLOCK *x,
BLOCK_SIZE_TYPE bsize) {
void vp9_encode_intra_block_y(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
MACROBLOCKD* const xd = &x->e_mbd;
struct optimize_ctx ctx;
struct encode_b_args arg = {cm, x, &ctx};
struct encode_b_args arg = {x, &ctx};
foreach_transformed_block_in_plane(xd, bsize, 0, vp9_encode_block_intra,
&arg);
}
void vp9_encode_intra_block_uv(VP9_COMMON *cm, MACROBLOCK *x,
BLOCK_SIZE_TYPE bsize) {
void vp9_encode_intra_block_uv(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize) {
MACROBLOCKD* const xd = &x->e_mbd;
struct optimize_ctx ctx;
struct encode_b_args arg = {cm, x, &ctx};
struct encode_b_args arg = {x, &ctx};
foreach_transformed_block_uv(xd, bsize, vp9_encode_block_intra, &arg);
}
......@@ -28,27 +28,30 @@ struct optimize_ctx {
};
struct encode_b_args {
VP9_COMMON *cm;
MACROBLOCK *x;
struct optimize_ctx *ctx;
};
void vp9_optimize_b(int plane, int block, BLOCK_SIZE_TYPE bsize,
TX_SIZE tx_size, MACROBLOCK *x, struct optimize_ctx *ctx);
void vp9_optimize_sby(VP9_COMMON *cm, MACROBLOCK *x, BLOCK_SIZE_TYPE bsize);
void vp9_optimize_sbuv(VP9_COMMON *cm, MACROBLOCK *x, BLOCK_SIZE_TYPE bsize);
void vp9_optimize_sby(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize);
void vp9_optimize_sbuv(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize);
void vp9_encode_sb(VP9_COMMON *cm, MACROBLOCK *x, BLOCK_SIZE_TYPE bsize);
void vp9_encode_sby(VP9_COMMON *cm, MACROBLOCK *x, BLOCK_SIZE_TYPE bsize);
void vp9_encode_sbuv(VP9_COMMON *cm, MACROBLOCK *x, BLOCK_SIZE_TYPE bsize);
void vp9_encode_sb(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize);
void vp9_encode_sby(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize);
void vp9_encode_sbuv(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize);
void vp9_xform_quant(int plane, int block, BLOCK_SIZE_TYPE bsize,
TX_SIZE tx_size, void *arg);
void vp9_xform_quant_sby(VP9_COMMON *cm, MACROBLOCK *x, BLOCK_SIZE_TYPE bsize);
void vp9_xform_quant_sbuv(VP9_COMMON *cm, MACROBLOCK *x, BLOCK_SIZE_TYPE bsize);
void vp9_xform_quant_sby(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize);
void vp9_xform_quant_sbuv(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize);
void vp9_subtract_sby(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize);
void vp9_subtract_sbuv(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize);
void vp9_subtract_sb(MACROBLOCK *xd, BLOCK_SIZE_TYPE bsize);
void vp9_subtract_sb(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize);
void vp9_encode_intra_block_y(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize);
void vp9_encode_intra_block_uv(MACROBLOCK *x, BLOCK_SIZE_TYPE bsize);
#endif // VP9_ENCODER_VP9_ENCODEMB_H_
......@@ -568,7 +568,7 @@ void vp9_first_pass(VP9_COMP *cpi) {
1 << mi_height_log2(xd->mode_info_context->mbmi.sb_type));
// do intra 16x16 prediction
this_error = vp9_encode_intra(cpi, x, use_dc_pred);
this_error = vp9_encode_intra(x, use_dc_pred);
// "intrapenalty" below deals with situations where the intra and inter error scores are very low (eg a plain black frame)
// We do not have special cases in first pass for 0,0 and nearest etc so all inter modes carry an overhead cost estimate fot the mv.
......@@ -667,7 +667,7 @@ void vp9_first_pass(VP9_COMP *cpi) {
vp9_build_inter_predictors_sby(xd, mb_row << 1,
mb_col << 1,
xd->mode_info_context->mbmi.sb_type);
vp9_encode_sby(cm, x, xd->mode_info_context->mbmi.sb_type);
vp9_encode_sby(x, xd->mode_info_context->mbmi.sb_type);
sum_mvr += mv.as_mv.row;
sum_mvr_abs += abs(mv.as_mv.row);
sum_mvc += mv.as_mv.col;
......
......@@ -556,7 +556,6 @@ static INLINE int cost_coeffs(MACROBLOCK *mb,
}
struct rdcost_block_args {
VP9_COMMON *cm;
MACROBLOCK *x;
ENTROPY_CONTEXT t_above[16];
ENTROPY_CONTEXT t_left[16];
......@@ -616,7 +615,7 @@ static void block_yrd_txfm(int plane, int block, BLOCK_SIZE_TYPE bsize,
struct rdcost_block_args *args = arg;
MACROBLOCK *const x = args->x;
MACROBLOCKD *const xd = &x->e_mbd;
struct encode_b_args encode_args = {args->cm, x, NULL};
struct encode_b_args encode_args = {x, NULL};
int64_t rd1, rd2, rd;
if (args->skip)
......@@ -641,7 +640,7 @@ static void block_yrd_txfm(int plane, int block, BLOCK_SIZE_TYPE bsize,
rate_block(plane, block, bsize, tx_size, args);
}
static void txfm_rd_in_plane(VP9_COMMON *const cm, MACROBLOCK *x,
static void txfm_rd_in_plane(MACROBLOCK *x,
int *rate, int64_t *distortion,
int *skippable, int64_t *sse,
int64_t ref_best_rd, int plane,
......@@ -652,7 +651,7 @@ static void txfm_rd_in_plane(VP9_COMMON *const cm, MACROBLOCK *x,
const int num_4x4_blocks_wide = num_4x4_blocks_wide_lookup[bs];
const int num_4x4_blocks_high = num_4x4_blocks_high_lookup[bs];
int i;
struct rdcost_block_args args = { cm, x, { 0 }, { 0 }, tx_size,
struct rdcost_block_args args = { x, { 0 }, { 0 }, tx_size,
num_4x4_blocks_wide, num_4x4_blocks_high,
0, 0, 0, ref_best_rd, 0 };
if (plane == 0)
......@@ -725,7 +724,7 @@ static void choose_largest_txfm_size(VP9_COMP *cpi, MACROBLOCK *x,
} else {
mbmi->txfm_size = TX_4X4;
}
txfm_rd_in_plane(cm, x, rate, distortion, skip,
txfm_rd_in_plane(x, rate, distortion, skip,
&sse[mbmi->txfm_size], ref_best_rd, 0, bs,
mbmi->txfm_size);
cpi->txfm_stepdown_count[0]++;
......@@ -909,7 +908,7 @@ static void choose_txfm_size_from_modelrd(VP9_COMP *cpi, MACROBLOCK *x,
// Actually encode using the chosen mode if a model was used, but do not
// update the r, d costs
txfm_rd_in_plane(cm, x, rate, distortion, skip, &sse[mbmi->txfm_size],
txfm_rd_in_plane(x, rate, distortion, skip, &sse[mbmi->txfm_size],
ref_best_rd, 0, bs, mbmi->txfm_size);
if (max_txfm_size == TX_32X32 &&
......@@ -933,7 +932,6 @@ static void super_block_yrd(VP9_COMP *cpi,
int *skip, int64_t *psse, BLOCK_SIZE_TYPE bs,
int64_t txfm_cache[TX_MODES],
int64_t ref_best_rd) {
VP9_COMMON *const cm = &cpi->common;
int r[TX_SIZES][2], s[TX_SIZES];
int64_t d[TX_SIZES], sse[TX_SIZES];
MACROBLOCKD *xd = &x->e_mbd;
......@@ -973,14 +971,14 @@ static void super_block_yrd(VP9_COMP *cpi,
skip, sse, ref_best_rd, bs);
} else {
if (bs >= BLOCK_32X32)
txfm_rd_in_plane(cm, x, &r[TX_32X32][0], &d[TX_32X32], &s[TX_32X32],
txfm_rd_in_plane(x, &r[TX_32X32][0], &d[TX_32X32], &s[TX_32X32],
&sse[TX_32X32], ref_best_rd, 0, bs, TX_32X32);
if (bs >= BLOCK_16X16)
txfm_rd_in_plane(cm, x, &r[TX_16X16][0], &d[TX_16X16], &s[TX_16X16],
txfm_rd_in_plane(x, &r[TX_16X16][0], &d[TX_16X16], &s[TX_16X16],
&sse[TX_16X16], ref_best_rd, 0, bs, TX_16X16);
txfm_rd_in_plane(cm, x, &r[TX_8X8][0], &d[TX_8X8], &s[TX_8X8],
txfm_rd_in_plane(x, &r[TX_8X8][0], &d[TX_8X8], &s[TX_8X8],
&sse[TX_8X8], ref_best_rd, 0, bs, TX_8X8);
txfm_rd_in_plane(cm, x, &r[TX_4X4][0], &d[TX_4X4], &s[TX_4X4],
txfm_rd_in_plane(x, &r[TX_4X4][0], &d[TX_4X4], &s[TX_4X4],
&sse[TX_4X4], ref_best_rd, 0, bs, TX_4X4);
choose_txfm_size_from_rd(cpi, x, r, rate, d, distortion, s,
skip, txfm_cache, bs);
......@@ -1301,7 +1299,7 @@ static void super_block_uvrd(VP9_COMMON *const cm, MACROBLOCK *x,
*skippable = 1;
for (plane = 1; plane < MAX_MB_PLANE; ++plane) {
txfm_rd_in_plane(cm, x, &pnrate, &pndist, &pnskip, &pnsse,
txfm_rd_in_plane(x, &pnrate, &pndist, &pnskip, &pnsse,
INT64_MAX, plane, bsize, uv_txfm_size);
*rate += pnrate;
*distortion += pndist;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment