summaryrefslogtreecommitdiff
path: root/vp9/encoder
diff options
context:
space:
mode:
authorYaowu Xu <yaowu@google.com>2013-09-17 16:31:46 -0700
committerYaowu Xu <yaowu@google.com>2013-09-19 08:14:26 -0700
commit014acfa2af084034daeb01c06ac0c71a0ef39682 (patch)
tree580bf34ada8b5ddd7750114635bf9af78e4e7611 /vp9/encoder
parent1600707d350f572d6768a9adb57248ba44c29b82 (diff)
downloadlibvpx-014acfa2af084034daeb01c06ac0c71a0ef39682.tar
libvpx-014acfa2af084034daeb01c06ac0c71a0ef39682.tar.gz
libvpx-014acfa2af084034daeb01c06ac0c71a0ef39682.tar.bz2
libvpx-014acfa2af084034daeb01c06ac0c71a0ef39682.zip
fix integer overflow errors
Change-Id: I76f440a917832c02d7a727697b225bac66b99f56
Diffstat (limited to 'vp9/encoder')
-rw-r--r--vp9/encoder/vp9_dct.c66
-rw-r--r--vp9/encoder/vp9_encodeframe.c4
-rw-r--r--vp9/encoder/vp9_firstpass.c4
-rw-r--r--vp9/encoder/vp9_mcomp.c96
-rw-r--r--vp9/encoder/vp9_onyx_int.h3
-rw-r--r--vp9/encoder/vp9_rdopt.c18
6 files changed, 95 insertions, 96 deletions
diff --git a/vp9/encoder/vp9_dct.c b/vp9/encoder/vp9_dct.c
index 4f4ad04b3..ca863931e 100644
--- a/vp9/encoder/vp9_dct.c
+++ b/vp9/encoder/vp9_dct.c
@@ -58,10 +58,10 @@ void vp9_short_fdct4x4_c(int16_t *input, int16_t *output, int pitch) {
for (i = 0; i < 4; ++i) {
// Load inputs.
if (0 == pass) {
- input[0] = in[0 * stride] << 4;
- input[1] = in[1 * stride] << 4;
- input[2] = in[2 * stride] << 4;
- input[3] = in[3 * stride] << 4;
+ input[0] = in[0 * stride] * 16;
+ input[1] = in[1 * stride] * 16;
+ input[2] = in[2 * stride] * 16;
+ input[3] = in[3 * stride] * 16;
if (i == 0 && input[0]) {
input[0] += 1;
}
@@ -160,7 +160,7 @@ void vp9_short_fht4x4_c(int16_t *input, int16_t *output,
// Columns
for (i = 0; i < 4; ++i) {
for (j = 0; j < 4; ++j)
- temp_in[j] = input[j * pitch + i] << 4;
+ temp_in[j] = input[j * pitch + i] * 16;
if (i == 0 && temp_in[0])
temp_in[0] += 1;
ht.cols(temp_in, temp_out);
@@ -250,14 +250,14 @@ void vp9_short_fdct8x8_c(int16_t *input, int16_t *final_output, int pitch) {
int i;
for (i = 0; i < 8; i++) {
// stage 1
- s0 = (input[0 * stride] + input[7 * stride]) << 2;
- s1 = (input[1 * stride] + input[6 * stride]) << 2;
- s2 = (input[2 * stride] + input[5 * stride]) << 2;
- s3 = (input[3 * stride] + input[4 * stride]) << 2;
- s4 = (input[3 * stride] - input[4 * stride]) << 2;
- s5 = (input[2 * stride] - input[5 * stride]) << 2;
- s6 = (input[1 * stride] - input[6 * stride]) << 2;
- s7 = (input[0 * stride] - input[7 * stride]) << 2;
+ s0 = (input[0 * stride] + input[7 * stride]) * 4;
+ s1 = (input[1 * stride] + input[6 * stride]) * 4;
+ s2 = (input[2 * stride] + input[5 * stride]) * 4;
+ s3 = (input[3 * stride] + input[4 * stride]) * 4;
+ s4 = (input[3 * stride] - input[4 * stride]) * 4;
+ s5 = (input[2 * stride] - input[5 * stride]) * 4;
+ s6 = (input[1 * stride] - input[6 * stride]) * 4;
+ s7 = (input[0 * stride] - input[7 * stride]) * 4;
// fdct4_1d(step, step);
x0 = s0 + s3;
@@ -331,23 +331,23 @@ void vp9_short_fdct16x16_c(int16_t *input, int16_t *output, int pitch) {
for (i = 0; i < 16; i++) {
if (0 == pass) {
// Calculate input for the first 8 results.
- input[0] = (in[0 * stride] + in[15 * stride]) << 2;
- input[1] = (in[1 * stride] + in[14 * stride]) << 2;
- input[2] = (in[2 * stride] + in[13 * stride]) << 2;
- input[3] = (in[3 * stride] + in[12 * stride]) << 2;
- input[4] = (in[4 * stride] + in[11 * stride]) << 2;
- input[5] = (in[5 * stride] + in[10 * stride]) << 2;
- input[6] = (in[6 * stride] + in[ 9 * stride]) << 2;
- input[7] = (in[7 * stride] + in[ 8 * stride]) << 2;
+ input[0] = (in[0 * stride] + in[15 * stride]) * 4;
+ input[1] = (in[1 * stride] + in[14 * stride]) * 4;
+ input[2] = (in[2 * stride] + in[13 * stride]) * 4;
+ input[3] = (in[3 * stride] + in[12 * stride]) * 4;
+ input[4] = (in[4 * stride] + in[11 * stride]) * 4;
+ input[5] = (in[5 * stride] + in[10 * stride]) * 4;
+ input[6] = (in[6 * stride] + in[ 9 * stride]) * 4;
+ input[7] = (in[7 * stride] + in[ 8 * stride]) * 4;
// Calculate input for the next 8 results.
- step1[0] = (in[7 * stride] - in[ 8 * stride]) << 2;
- step1[1] = (in[6 * stride] - in[ 9 * stride]) << 2;
- step1[2] = (in[5 * stride] - in[10 * stride]) << 2;
- step1[3] = (in[4 * stride] - in[11 * stride]) << 2;
- step1[4] = (in[3 * stride] - in[12 * stride]) << 2;
- step1[5] = (in[2 * stride] - in[13 * stride]) << 2;
- step1[6] = (in[1 * stride] - in[14 * stride]) << 2;
- step1[7] = (in[0 * stride] - in[15 * stride]) << 2;
+ step1[0] = (in[7 * stride] - in[ 8 * stride]) * 4;
+ step1[1] = (in[6 * stride] - in[ 9 * stride]) * 4;
+ step1[2] = (in[5 * stride] - in[10 * stride]) * 4;
+ step1[3] = (in[4 * stride] - in[11 * stride]) * 4;
+ step1[4] = (in[3 * stride] - in[12 * stride]) * 4;
+ step1[5] = (in[2 * stride] - in[13 * stride]) * 4;
+ step1[6] = (in[1 * stride] - in[14 * stride]) * 4;
+ step1[7] = (in[0 * stride] - in[15 * stride]) * 4;
} else {
// Calculate input for the first 8 results.
input[0] = ((in[0 * 16] + 1) >> 2) + ((in[15 * 16] + 1) >> 2);
@@ -575,7 +575,7 @@ void vp9_short_fht8x8_c(int16_t *input, int16_t *output,
// Columns
for (i = 0; i < 8; ++i) {
for (j = 0; j < 8; ++j)
- temp_in[j] = input[j * pitch + i] << 2;
+ temp_in[j] = input[j * pitch + i] * 4;
ht.cols(temp_in, temp_out);
for (j = 0; j < 8; ++j)
outptr[j * 8 + i] = temp_out[j];
@@ -975,7 +975,7 @@ void vp9_short_fht16x16_c(int16_t *input, int16_t *output,
// Columns
for (i = 0; i < 16; ++i) {
for (j = 0; j < 16; ++j)
- temp_in[j] = input[j * pitch + i] << 2;
+ temp_in[j] = input[j * pitch + i] * 4;
ht.cols(temp_in, temp_out);
for (j = 0; j < 16; ++j)
outptr[j * 16 + i] = (temp_out[j] + 1 + (temp_out[j] < 0)) >> 2;
@@ -1335,7 +1335,7 @@ void vp9_short_fdct32x32_c(int16_t *input, int16_t *out, int pitch) {
for (i = 0; i < 32; ++i) {
int temp_in[32], temp_out[32];
for (j = 0; j < 32; ++j)
- temp_in[j] = input[j * shortpitch + i] << 2;
+ temp_in[j] = input[j * shortpitch + i] * 4;
dct32_1d(temp_in, temp_out, 0);
for (j = 0; j < 32; ++j)
output[j * 32 + i] = (temp_out[j] + 1 + (temp_out[j] > 0)) >> 2;
@@ -1364,7 +1364,7 @@ void vp9_short_fdct32x32_rd_c(int16_t *input, int16_t *out, int pitch) {
for (i = 0; i < 32; ++i) {
int temp_in[32], temp_out[32];
for (j = 0; j < 32; ++j)
- temp_in[j] = input[j * shortpitch + i] << 2;
+ temp_in[j] = input[j * shortpitch + i] * 4;
dct32_1d(temp_in, temp_out, 0);
for (j = 0; j < 32; ++j)
// TODO(cd): see quality impact of only doing
diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c
index 3b92a3905..ee938bda9 100644
--- a/vp9/encoder/vp9_encodeframe.c
+++ b/vp9/encoder/vp9_encodeframe.c
@@ -435,7 +435,8 @@ static void update_state(VP9_COMP *cpi, PICK_MODE_CONTEXT *ctx,
best_second_mv.as_int = ctx->second_best_ref_mv.as_int;
if (mbmi->mode == NEWMV) {
best_mv.as_int = mbmi->ref_mvs[rf1][0].as_int;
- best_second_mv.as_int = mbmi->ref_mvs[rf2][0].as_int;
+ if (rf2 > 0)
+ best_second_mv.as_int = mbmi->ref_mvs[rf2][0].as_int;
}
mbmi->best_mv.as_int = best_mv.as_int;
mbmi->best_second_mv.as_int = best_second_mv.as_int;
@@ -2627,7 +2628,6 @@ void vp9_encode_frame(VP9_COMP *cpi) {
} else {
encode_frame_internal(cpi);
}
-
}
static void sum_intra_stats(VP9_COMP *cpi, const MODE_INFO *mi) {
diff --git a/vp9/encoder/vp9_firstpass.c b/vp9/encoder/vp9_firstpass.c
index 9cf7b8348..ad7e6d821 100644
--- a/vp9/encoder/vp9_firstpass.c
+++ b/vp9/encoder/vp9_firstpass.c
@@ -660,8 +660,8 @@ void vp9_first_pass(VP9_COMP *cpi) {
neutral_count++;
}
- mv.as_mv.row <<= 3;
- mv.as_mv.col <<= 3;
+ mv.as_mv.row *= 8;
+ mv.as_mv.col *= 8;
this_error = motion_error;
vp9_set_mbmode_and_mvs(x, NEWMV, &mv);
xd->this_mi->mbmi.tx_size = TX_4X4;
diff --git a/vp9/encoder/vp9_mcomp.c b/vp9/encoder/vp9_mcomp.c
index 8f340d2af..ad8c8999a 100644
--- a/vp9/encoder/vp9_mcomp.c
+++ b/vp9/encoder/vp9_mcomp.c
@@ -339,13 +339,13 @@ int vp9_find_best_sub_pixel_iterative(MACROBLOCK *x,
int rr = ref_mv->as_mv.row;
int rc = ref_mv->as_mv.col;
- int br = bestmv->as_mv.row << 3;
- int bc = bestmv->as_mv.col << 3;
+ int br = bestmv->as_mv.row * 8;
+ int bc = bestmv->as_mv.col * 8;
int hstep = 4;
- const int minc = MAX(x->mv_col_min << 3, ref_mv->as_mv.col - MV_MAX);
- const int maxc = MIN(x->mv_col_max << 3, ref_mv->as_mv.col + MV_MAX);
- const int minr = MAX(x->mv_row_min << 3, ref_mv->as_mv.row - MV_MAX);
- const int maxr = MIN(x->mv_row_max << 3, ref_mv->as_mv.row + MV_MAX);
+ const int minc = MAX(x->mv_col_min * 8, ref_mv->as_mv.col - MV_MAX);
+ const int maxc = MIN(x->mv_col_max * 8, ref_mv->as_mv.col + MV_MAX);
+ const int minr = MAX(x->mv_row_min * 8, ref_mv->as_mv.row - MV_MAX);
+ const int maxr = MIN(x->mv_row_max * 8, ref_mv->as_mv.row + MV_MAX);
int tr = br;
int tc = bc;
@@ -436,20 +436,20 @@ int vp9_find_best_sub_pixel_tree(MACROBLOCK *x,
int rr = ref_mv->as_mv.row;
int rc = ref_mv->as_mv.col;
- int br = bestmv->as_mv.row << 3;
- int bc = bestmv->as_mv.col << 3;
+ int br = bestmv->as_mv.row * 8;
+ int bc = bestmv->as_mv.col * 8;
int hstep = 4;
- const int minc = MAX(x->mv_col_min << 3, ref_mv->as_mv.col - MV_MAX);
- const int maxc = MIN(x->mv_col_max << 3, ref_mv->as_mv.col + MV_MAX);
- const int minr = MAX(x->mv_row_min << 3, ref_mv->as_mv.row - MV_MAX);
- const int maxr = MIN(x->mv_row_max << 3, ref_mv->as_mv.row + MV_MAX);
+ const int minc = MAX(x->mv_col_min * 8, ref_mv->as_mv.col - MV_MAX);
+ const int maxc = MIN(x->mv_col_max * 8, ref_mv->as_mv.col + MV_MAX);
+ const int minr = MAX(x->mv_row_min * 8, ref_mv->as_mv.row - MV_MAX);
+ const int maxr = MIN(x->mv_row_max * 8, ref_mv->as_mv.row + MV_MAX);
int tr = br;
int tc = bc;
// central mv
- bestmv->as_mv.row <<= 3;
- bestmv->as_mv.col <<= 3;
+ bestmv->as_mv.row *= 8;
+ bestmv->as_mv.col *= 8;
// calculate central point error
besterr = vfp->vf(y, y_stride, z, src_stride, sse1);
@@ -532,20 +532,20 @@ int vp9_find_best_sub_pixel_comp_iterative(MACROBLOCK *x,
int rr = ref_mv->as_mv.row;
int rc = ref_mv->as_mv.col;
- int br = bestmv->as_mv.row << 3;
- int bc = bestmv->as_mv.col << 3;
+ int br = bestmv->as_mv.row * 8;
+ int bc = bestmv->as_mv.col * 8;
int hstep = 4;
- const int minc = MAX(x->mv_col_min << 3, ref_mv->as_mv.col - MV_MAX);
- const int maxc = MIN(x->mv_col_max << 3, ref_mv->as_mv.col + MV_MAX);
- const int minr = MAX(x->mv_row_min << 3, ref_mv->as_mv.row - MV_MAX);
- const int maxr = MIN(x->mv_row_max << 3, ref_mv->as_mv.row + MV_MAX);
+ const int minc = MAX(x->mv_col_min * 8, ref_mv->as_mv.col - MV_MAX);
+ const int maxc = MIN(x->mv_col_max * 8, ref_mv->as_mv.col + MV_MAX);
+ const int minr = MAX(x->mv_row_min * 8, ref_mv->as_mv.row - MV_MAX);
+ const int maxr = MIN(x->mv_row_max * 8, ref_mv->as_mv.row + MV_MAX);
int tr = br;
int tc = bc;
// central mv
- bestmv->as_mv.row <<= 3;
- bestmv->as_mv.col <<= 3;
+ bestmv->as_mv.row *= 8;
+ bestmv->as_mv.col *= 8;
// calculate central point error
// TODO(yunqingwang): central pointer error was already calculated in full-
@@ -634,20 +634,20 @@ int vp9_find_best_sub_pixel_comp_tree(MACROBLOCK *x,
int rr = ref_mv->as_mv.row;
int rc = ref_mv->as_mv.col;
- int br = bestmv->as_mv.row << 3;
- int bc = bestmv->as_mv.col << 3;
+ int br = bestmv->as_mv.row * 8;
+ int bc = bestmv->as_mv.col * 8;
int hstep = 4;
- const int minc = MAX(x->mv_col_min << 3, ref_mv->as_mv.col - MV_MAX);
- const int maxc = MIN(x->mv_col_max << 3, ref_mv->as_mv.col + MV_MAX);
- const int minr = MAX(x->mv_row_min << 3, ref_mv->as_mv.row - MV_MAX);
- const int maxr = MIN(x->mv_row_max << 3, ref_mv->as_mv.row + MV_MAX);
+ const int minc = MAX(x->mv_col_min * 8, ref_mv->as_mv.col - MV_MAX);
+ const int maxc = MIN(x->mv_col_max * 8, ref_mv->as_mv.col + MV_MAX);
+ const int minr = MAX(x->mv_row_min * 8, ref_mv->as_mv.row - MV_MAX);
+ const int maxr = MIN(x->mv_row_max * 8, ref_mv->as_mv.row + MV_MAX);
int tr = br;
int tc = bc;
// central mv
- bestmv->as_mv.row <<= 3;
- bestmv->as_mv.col <<= 3;
+ bestmv->as_mv.row *= 8;
+ bestmv->as_mv.col *= 8;
// calculate central point error
// TODO(yunqingwang): central pointer error was already calculated in full-
@@ -980,8 +980,8 @@ static int vp9_pattern_search(MACROBLOCK *x,
this_offset = base_offset + (best_mv->as_mv.row * (in_what_stride)) +
best_mv->as_mv.col;
- this_mv.as_mv.row = best_mv->as_mv.row << 3;
- this_mv.as_mv.col = best_mv->as_mv.col << 3;
+ this_mv.as_mv.row = best_mv->as_mv.row * 8;
+ this_mv.as_mv.col = best_mv->as_mv.col * 8;
if (bestsad == INT_MAX)
return INT_MAX;
return
@@ -1243,8 +1243,8 @@ int vp9_diamond_search_sad_c(MACROBLOCK *x,
(*num00)++;
}
- this_mv.as_mv.row = best_mv->as_mv.row << 3;
- this_mv.as_mv.col = best_mv->as_mv.col << 3;
+ this_mv.as_mv.row = best_mv->as_mv.row * 8;
+ this_mv.as_mv.col = best_mv->as_mv.col * 8;
if (bestsad == INT_MAX)
return INT_MAX;
@@ -1416,8 +1416,8 @@ int vp9_diamond_search_sadx4(MACROBLOCK *x,
(*num00)++;
}
- this_mv.as_mv.row = best_mv->as_mv.row << 3;
- this_mv.as_mv.col = best_mv->as_mv.col << 3;
+ this_mv.as_mv.row = best_mv->as_mv.row * 8;
+ this_mv.as_mv.col = best_mv->as_mv.col * 8;
if (bestsad == INT_MAX)
return INT_MAX;
@@ -1567,8 +1567,8 @@ int vp9_full_search_sad_c(MACROBLOCK *x, int_mv *ref_mv,
}
}
- this_mv.as_mv.row = best_mv->as_mv.row << 3;
- this_mv.as_mv.col = best_mv->as_mv.col << 3;
+ this_mv.as_mv.row = best_mv->as_mv.row * 8;
+ this_mv.as_mv.col = best_mv->as_mv.col * 8;
if (bestsad < INT_MAX)
return
@@ -1688,8 +1688,8 @@ int vp9_full_search_sadx3(MACROBLOCK *x, int_mv *ref_mv,
}
- this_mv.as_mv.row = best_mv->as_mv.row << 3;
- this_mv.as_mv.col = best_mv->as_mv.col << 3;
+ this_mv.as_mv.row = best_mv->as_mv.row * 8;
+ this_mv.as_mv.col = best_mv->as_mv.col * 8;
if (bestsad < INT_MAX)
return
@@ -1836,8 +1836,8 @@ int vp9_full_search_sadx8(MACROBLOCK *x, int_mv *ref_mv,
}
}
- this_mv.as_mv.row = best_mv->as_mv.row << 3;
- this_mv.as_mv.col = best_mv->as_mv.col << 3;
+ this_mv.as_mv.row = best_mv->as_mv.row * 8;
+ this_mv.as_mv.col = best_mv->as_mv.col * 8;
if (bestsad < INT_MAX)
return
@@ -1912,8 +1912,8 @@ int vp9_refining_search_sad_c(MACROBLOCK *x,
}
}
- this_mv.as_mv.row = ref_mv->as_mv.row << 3;
- this_mv.as_mv.col = ref_mv->as_mv.col << 3;
+ this_mv.as_mv.row = ref_mv->as_mv.row * 8;
+ this_mv.as_mv.col = ref_mv->as_mv.col * 8;
if (bestsad < INT_MAX)
return
@@ -2018,8 +2018,8 @@ int vp9_refining_search_sadx4(MACROBLOCK *x,
}
}
- this_mv.as_mv.row = ref_mv->as_mv.row << 3;
- this_mv.as_mv.col = ref_mv->as_mv.col << 3;
+ this_mv.as_mv.row = ref_mv->as_mv.row * 8;
+ this_mv.as_mv.col = ref_mv->as_mv.col * 8;
if (bestsad < INT_MAX)
return
@@ -2109,8 +2109,8 @@ int vp9_refining_search_8p_c(MACROBLOCK *x,
}
}
- this_mv.as_mv.row = ref_mv->as_mv.row << 3;
- this_mv.as_mv.col = ref_mv->as_mv.col << 3;
+ this_mv.as_mv.row = ref_mv->as_mv.row * 8;
+ this_mv.as_mv.col = ref_mv->as_mv.col * 8;
if (bestsad < INT_MAX) {
// FIXME(rbultje, yunqing): add full-pixel averaging variance functions
diff --git a/vp9/encoder/vp9_onyx_int.h b/vp9/encoder/vp9_onyx_int.h
index 92edf49ab..9b20dafde 100644
--- a/vp9/encoder/vp9_onyx_int.h
+++ b/vp9/encoder/vp9_onyx_int.h
@@ -392,8 +392,7 @@ typedef struct VP9_COMP {
int rd_thresh_freq_fact[BLOCK_SIZES][MAX_MODES];
int64_t rd_comp_pred_diff[NB_PREDICTION_TYPES];
- // FIXME(rbultje) int64_t?
- int rd_prediction_type_threshes[4][NB_PREDICTION_TYPES];
+ int64_t rd_prediction_type_threshes[4][NB_PREDICTION_TYPES];
unsigned int intra_inter_count[INTRA_INTER_CONTEXTS][2];
unsigned int comp_inter_count[COMP_INTER_CONTEXTS][2];
unsigned int single_ref_count[REF_CONTEXTS][2][2];
diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c
index 64185fcfa..470379c47 100644
--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -269,7 +269,7 @@ void vp9_initialize_rd_consts(VP9_COMP *cpi, int qindex) {
cpi->mb.inter_mode_cost[i][m - NEARESTMV] =
cost_token(vp9_inter_mode_tree,
cpi->common.fc.inter_mode_probs[i],
- vp9_inter_mode_encodings - NEARESTMV + m);
+ vp9_inter_mode_encodings + (m - NEARESTMV));
}
}
}
@@ -1683,17 +1683,17 @@ static void rd_check_segment_txsize(VP9_COMP *cpi, MACROBLOCK *x,
i = idy * 2 + idx;
frame_mv[ZEROMV][mbmi->ref_frame[0]].as_int = 0;
- frame_mv[ZEROMV][mbmi->ref_frame[1]].as_int = 0;
vp9_append_sub8x8_mvs_for_idx(&cpi->common, &x->e_mbd,
&frame_mv[NEARESTMV][mbmi->ref_frame[0]],
&frame_mv[NEARMV][mbmi->ref_frame[0]],
i, 0, mi_row, mi_col);
- if (has_second_rf)
+ if (has_second_rf) {
+ frame_mv[ZEROMV][mbmi->ref_frame[1]].as_int = 0;
vp9_append_sub8x8_mvs_for_idx(&cpi->common, &x->e_mbd,
- &frame_mv[NEARESTMV][mbmi->ref_frame[1]],
- &frame_mv[NEARMV][mbmi->ref_frame[1]],
- i, 1, mi_row, mi_col);
-
+ &frame_mv[NEARESTMV][mbmi->ref_frame[1]],
+ &frame_mv[NEARMV][mbmi->ref_frame[1]],
+ i, 1, mi_row, mi_col);
+ }
// search for the best motion vector on this segment
for (this_mode = NEARESTMV; this_mode <= NEWMV; ++this_mode) {
const struct buf_2d orig_src = x->plane[0].src;
@@ -3262,8 +3262,8 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
continue;
// Test best rd so far against threshold for trying this mode.
- if ((best_rd < ((cpi->rd_threshes[bsize][mode_index] *
- cpi->rd_thresh_freq_fact[bsize][mode_index]) >> 5)) ||
+ if ((best_rd < ((int64_t)cpi->rd_threshes[bsize][mode_index] *
+ cpi->rd_thresh_freq_fact[bsize][mode_index] >> 5)) ||
cpi->rd_threshes[bsize][mode_index] == INT_MAX)
continue;