Commit d67a8feb authored by Yaowu Xu's avatar Yaowu Xu
Browse files

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
parent c57816fb
...@@ -558,9 +558,9 @@ static void model_rd_norm(int xsq_q10, int *r_q10, int *d_q10) { ...@@ -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; *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, void vp10_model_rd_from_var_lapndz(int64_t var, unsigned int n_log2,
unsigned int qstep, int *rate, unsigned int qstep, int *rate,
int64_t *dist) { int64_t *dist) {
// This function models the rate and distortion for a Laplacian // This function models the rate and distortion for a Laplacian
// source with given variance when quantized with a uniform quantizer // source with given variance when quantized with a uniform quantizer
// with given stepsize. The closed form expressions are in: // with given stepsize. The closed form expressions are in:
......
...@@ -394,21 +394,21 @@ void vp10_initialize_rd_consts(struct VP10_COMP *cpi); ...@@ -394,21 +394,21 @@ void vp10_initialize_rd_consts(struct VP10_COMP *cpi);
void vp10_initialize_me_consts(const struct VP10_COMP *cpi, void vp10_initialize_me_consts(const struct VP10_COMP *cpi,
MACROBLOCK *x, int qindex); MACROBLOCK *x, int qindex);
void vp10_model_rd_from_var_lapndz(unsigned int var, unsigned int n, void vp10_model_rd_from_var_lapndz(int64_t var, unsigned int n,
unsigned int qstep, int *rate, unsigned int qstep, int *rate,
int64_t *dist); int64_t *dist);
int vp10_get_switchable_rate(const struct VP10_COMP *cpi, 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 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, 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, 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); void vp10_init_me_luts(void);
...@@ -417,9 +417,9 @@ void vp10_set_mvcost(MACROBLOCK *x, MV_REFERENCE_FRAME ref_frame); ...@@ -417,9 +417,9 @@ void vp10_set_mvcost(MACROBLOCK *x, MV_REFERENCE_FRAME ref_frame);
#endif #endif
void vp10_get_entropy_contexts(BLOCK_SIZE bsize, TX_SIZE tx_size, void vp10_get_entropy_contexts(BLOCK_SIZE bsize, TX_SIZE tx_size,
const struct macroblockd_plane *pd, const struct macroblockd_plane *pd,
ENTROPY_CONTEXT t_above[2 * MAX_MIB_SIZE], ENTROPY_CONTEXT t_above[2 * MAX_MIB_SIZE],
ENTROPY_CONTEXT t_left[2 * MAX_MIB_SIZE]); ENTROPY_CONTEXT t_left[2 * MAX_MIB_SIZE]);
void vp10_set_rd_speed_thresholds(struct VP10_COMP *cpi); 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, ...@@ -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, void vp10_mv_pred(struct VP10_COMP *cpi, MACROBLOCK *x,
uint8_t *ref_y_buffer, int ref_y_stride, uint8_t *ref_y_buffer, int ref_y_stride,
int ref_frame, BLOCK_SIZE block_size); int ref_frame, BLOCK_SIZE block_size);
static INLINE void set_error_per_bit(MACROBLOCK *x, int rdmult) { static INLINE void set_error_per_bit(MACROBLOCK *x, int rdmult) {
x->errorperbit = rdmult >> RD_EPB_SHIFT; x->errorperbit = rdmult >> RD_EPB_SHIFT;
...@@ -450,14 +450,14 @@ static INLINE void set_error_per_bit(MACROBLOCK *x, int rdmult) { ...@@ -450,14 +450,14 @@ static INLINE void set_error_per_bit(MACROBLOCK *x, int rdmult) {
} }
void vp10_setup_pred_block(const MACROBLOCKD *xd, void vp10_setup_pred_block(const MACROBLOCKD *xd,
struct buf_2d dst[MAX_MB_PLANE], struct buf_2d dst[MAX_MB_PLANE],
const YV12_BUFFER_CONFIG *src, const YV12_BUFFER_CONFIG *src,
int mi_row, int mi_col, int mi_row, int mi_col,
const struct scale_factors *scale, const struct scale_factors *scale,
const struct scale_factors *scale_uv); const struct scale_factors *scale_uv);
int vp10_get_intra_cost_penalty(int qindex, int qdelta, int vp10_get_intra_cost_penalty(int qindex, int qdelta,
vpx_bit_depth_t bit_depth); vpx_bit_depth_t bit_depth);
#ifdef __cplusplus #ifdef __cplusplus
} // extern "C" } // extern "C"
......
...@@ -792,7 +792,7 @@ static void model_rd_from_sse(const VP10_COMP *const cpi, ...@@ -792,7 +792,7 @@ static void model_rd_from_sse(const VP10_COMP *const cpi,
const MACROBLOCKD *const xd, const MACROBLOCKD *const xd,
BLOCK_SIZE bsize, BLOCK_SIZE bsize,
int plane, int plane,
uint64_t sse, int64_t sse,
int *rate, int *rate,
int64_t *dist) { int64_t *dist) {
const struct macroblockd_plane *const pd = &xd->plane[plane]; const struct macroblockd_plane *const pd = &xd->plane[plane];
...@@ -809,7 +809,8 @@ static void model_rd_from_sse(const VP10_COMP *const cpi, ...@@ -809,7 +809,8 @@ static void model_rd_from_sse(const VP10_COMP *const cpi,
int quantizer = (pd->dequant[1] >> dequant_shift); int quantizer = (pd->dequant[1] >> dequant_shift);
if (quantizer < 120) 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 else
*rate = 0; *rate = 0;
*dist = (square_error * quantizer) >> 8; *dist = (square_error * quantizer) >> 8;
...@@ -4475,7 +4476,8 @@ static int64_t encode_inter_mb_segment(VP10_COMP *cpi, ...@@ -4475,7 +4476,8 @@ static int64_t encode_inter_mb_segment(VP10_COMP *cpi,
k = i; k = i;
for (idy = 0; idy < height / 4; idy += num_4x4_h) { for (idy = 0; idy < height / 4; idy += num_4x4_h) {
for (idx = 0; idx < width / 4; idx += num_4x4_w) { 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; int coeff_ctx;
k += (idy * 2 + idx); k += (idy * 2 + idx);
if (tx_size == TX_4X4) if (tx_size == TX_4X4)
......
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