From: Yaowu Xu Date: Wed, 10 Aug 2016 01:36:23 +0000 (-0700) Subject: Change to use proper types X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d67a8feb93a946b903a77475539e625faabeadea;p=libvpx Change to use proper types block: from int64_t to int as it is a block index. sse: from unsigned int to int64_t to reduce type conversion. Change-Id: Iec8104ff8a3fd3a77d4e451c12918bd869966c2f --- diff --git a/vp10/encoder/rd.c b/vp10/encoder/rd.c index cbdcc94c8..4d2380be4 100644 --- a/vp10/encoder/rd.c +++ b/vp10/encoder/rd.c @@ -558,9 +558,9 @@ static void model_rd_norm(int xsq_q10, int *r_q10, int *d_q10) { *d_q10 = (dist_tab_q10[xq] * b_q10 + dist_tab_q10[xq + 1] * a_q10) >> 10; } -void vp10_model_rd_from_var_lapndz(unsigned int var, unsigned int n_log2, - unsigned int qstep, int *rate, - int64_t *dist) { +void vp10_model_rd_from_var_lapndz(int64_t var, unsigned int n_log2, + unsigned int qstep, int *rate, + int64_t *dist) { // This function models the rate and distortion for a Laplacian // source with given variance when quantized with a uniform quantizer // with given stepsize. The closed form expressions are in: diff --git a/vp10/encoder/rd.h b/vp10/encoder/rd.h index 8f7aecfc3..b668f1063 100644 --- a/vp10/encoder/rd.h +++ b/vp10/encoder/rd.h @@ -394,21 +394,21 @@ void vp10_initialize_rd_consts(struct VP10_COMP *cpi); void vp10_initialize_me_consts(const struct VP10_COMP *cpi, MACROBLOCK *x, int qindex); -void vp10_model_rd_from_var_lapndz(unsigned int var, unsigned int n, - unsigned int qstep, int *rate, - int64_t *dist); +void vp10_model_rd_from_var_lapndz(int64_t var, unsigned int n, + unsigned int qstep, int *rate, + int64_t *dist); int vp10_get_switchable_rate(const struct VP10_COMP *cpi, - const MACROBLOCKD *const xd); + const MACROBLOCKD *const xd); int vp10_raster_block_offset(BLOCK_SIZE plane_bsize, - int raster_block, int stride); + int raster_block, int stride); int16_t* vp10_raster_block_offset_int16(BLOCK_SIZE plane_bsize, - int raster_block, int16_t *base); + int raster_block, int16_t *base); YV12_BUFFER_CONFIG *vp10_get_scaled_ref_frame(const struct VP10_COMP *cpi, - int ref_frame); + int ref_frame); void vp10_init_me_luts(void); @@ -417,9 +417,9 @@ void vp10_set_mvcost(MACROBLOCK *x, MV_REFERENCE_FRAME ref_frame); #endif void vp10_get_entropy_contexts(BLOCK_SIZE bsize, TX_SIZE tx_size, - const struct macroblockd_plane *pd, - ENTROPY_CONTEXT t_above[2 * MAX_MIB_SIZE], - ENTROPY_CONTEXT t_left[2 * MAX_MIB_SIZE]); + const struct macroblockd_plane *pd, + ENTROPY_CONTEXT t_above[2 * MAX_MIB_SIZE], + ENTROPY_CONTEXT t_left[2 * MAX_MIB_SIZE]); void vp10_set_rd_speed_thresholds(struct VP10_COMP *cpi); @@ -441,8 +441,8 @@ static INLINE int rd_less_than_thresh(int64_t best_rd, int thresh, } void vp10_mv_pred(struct VP10_COMP *cpi, MACROBLOCK *x, - uint8_t *ref_y_buffer, int ref_y_stride, - int ref_frame, BLOCK_SIZE block_size); + uint8_t *ref_y_buffer, int ref_y_stride, + int ref_frame, BLOCK_SIZE block_size); static INLINE void set_error_per_bit(MACROBLOCK *x, int rdmult) { x->errorperbit = rdmult >> RD_EPB_SHIFT; @@ -450,14 +450,14 @@ static INLINE void set_error_per_bit(MACROBLOCK *x, int rdmult) { } void vp10_setup_pred_block(const MACROBLOCKD *xd, - struct buf_2d dst[MAX_MB_PLANE], - const YV12_BUFFER_CONFIG *src, - int mi_row, int mi_col, - const struct scale_factors *scale, - const struct scale_factors *scale_uv); + struct buf_2d dst[MAX_MB_PLANE], + const YV12_BUFFER_CONFIG *src, + int mi_row, int mi_col, + const struct scale_factors *scale, + const struct scale_factors *scale_uv); int vp10_get_intra_cost_penalty(int qindex, int qdelta, - vpx_bit_depth_t bit_depth); + vpx_bit_depth_t bit_depth); #ifdef __cplusplus } // extern "C" diff --git a/vp10/encoder/rdopt.c b/vp10/encoder/rdopt.c index ffb88b18e..d580bb0a5 100644 --- a/vp10/encoder/rdopt.c +++ b/vp10/encoder/rdopt.c @@ -792,7 +792,7 @@ static void model_rd_from_sse(const VP10_COMP *const cpi, const MACROBLOCKD *const xd, BLOCK_SIZE bsize, int plane, - uint64_t sse, + int64_t sse, int *rate, int64_t *dist) { const struct macroblockd_plane *const pd = &xd->plane[plane]; @@ -809,7 +809,8 @@ static void model_rd_from_sse(const VP10_COMP *const cpi, int quantizer = (pd->dequant[1] >> dequant_shift); if (quantizer < 120) - *rate = (square_error * (280 - quantizer)) >> (16 - VP9_PROB_COST_SHIFT); + *rate = (int)((square_error * (280 - quantizer)) >> + (16 - VP9_PROB_COST_SHIFT)); else *rate = 0; *dist = (square_error * quantizer) >> 8; @@ -4475,7 +4476,8 @@ static int64_t encode_inter_mb_segment(VP10_COMP *cpi, k = i; for (idy = 0; idy < height / 4; idy += num_4x4_h) { for (idx = 0; idx < width / 4; idx += num_4x4_w) { - int64_t dist, ssz, rd, rd1, rd2, block; + int64_t dist, ssz, rd, rd1, rd2; + int block; int coeff_ctx; k += (idy * 2 + idx); if (tx_size == TX_4X4)