ref: 014acfa2af084034daeb01c06ac0c71a0ef39682
parent: 1600707d350f572d6768a9adb57248ba44c29b82
author: Yaowu Xu <yaowu@google.com>
date: Tue Sep 17 12:31:46 EDT 2013
fix integer overflow errors Change-Id: I76f440a917832c02d7a727697b225bac66b99f56
--- a/libmkv/EbmlWriter.c
+++ b/libmkv/EbmlWriter.c
@@ -105,7 +105,7 @@
void Ebml_SerializeBinary(EbmlGlobal *glob, unsigned long class_id, unsigned long bin) {
int size;
for (size = 4; size > 1; size--) {
- if (bin & 0x000000ff << ((size - 1) * 8))
+ if (bin & (unsigned int)0x000000ff << ((size - 1) * 8))
break;
}
Ebml_WriteID(glob, class_id);
--- a/vp9/common/vp9_idct.h
+++ b/vp9/common/vp9_idct.h
@@ -25,7 +25,7 @@
#define WHT_UPSCALE_FACTOR 2
#define pair_set_epi16(a, b) \
- _mm_set1_epi32(((uint16_t)(a)) + (((uint16_t)(b)) << 16))
+ _mm_set_epi16(b, a, b, a, b, a, b, a)
#define pair_set_epi32(a, b) \
_mm_set_epi32(b, a, b, a)
--- a/vp9/common/vp9_loopfilter.c
+++ b/vp9/common/vp9_loopfilter.c
@@ -316,13 +316,13 @@
continue;
}
- intra_lvl = lvl_seg + (lf->ref_deltas[INTRA_FRAME] << n_shift);
+ intra_lvl = lvl_seg + lf->ref_deltas[INTRA_FRAME] * (1 << n_shift);
lfi->lvl[seg_id][INTRA_FRAME][0] = clamp(intra_lvl, 0, MAX_LOOP_FILTER);
for (ref = LAST_FRAME; ref < MAX_REF_FRAMES; ++ref)
for (mode = 0; mode < MAX_MODE_LF_DELTAS; ++mode) {
- const int inter_lvl = lvl_seg + (lf->ref_deltas[ref] << n_shift)
- + (lf->mode_deltas[mode] << n_shift);
+ const int inter_lvl = lvl_seg + lf->ref_deltas[ref] * (1 << n_shift)
+ + lf->mode_deltas[mode] * (1 << n_shift);
lfi->lvl[seg_id][ref][mode] = clamp(inter_lvl, 0, MAX_LOOP_FILTER);
}
}
--- a/vp9/common/vp9_onyxc_int.h
+++ b/vp9/common/vp9_onyxc_int.h
@@ -280,10 +280,10 @@
static void set_mi_row_col(VP9_COMMON *cm, MACROBLOCKD *xd,
int mi_row, int bh,
int mi_col, int bw) {
- xd->mb_to_top_edge = -((mi_row * MI_SIZE) << 3);
- xd->mb_to_bottom_edge = ((cm->mi_rows - bh - mi_row) * MI_SIZE) << 3;
- xd->mb_to_left_edge = -((mi_col * MI_SIZE) << 3);
- xd->mb_to_right_edge = ((cm->mi_cols - bw - mi_col) * MI_SIZE) << 3;
+ xd->mb_to_top_edge = -((mi_row * MI_SIZE) * 8);
+ xd->mb_to_bottom_edge = ((cm->mi_rows - bh - mi_row) * MI_SIZE) * 8;
+ xd->mb_to_left_edge = -((mi_col * MI_SIZE) * 8);
+ xd->mb_to_right_edge = ((cm->mi_cols - bw - mi_col) * MI_SIZE) * 8;
// Are edges available for intra prediction?
xd->up_available = (mi_row != 0);
--- a/vp9/common/vp9_reconinter.c
+++ b/vp9/common/vp9_reconinter.c
@@ -59,8 +59,8 @@
const struct subpix_fn_table *subpix,
enum mv_precision precision) {
const int is_q4 = precision == MV_PRECISION_Q4;
- const MV mv_q4 = { is_q4 ? src_mv->row : src_mv->row << 1,
- is_q4 ? src_mv->col : src_mv->col << 1 };
+ const MV mv_q4 = { is_q4 ? src_mv->row : src_mv->row * 2,
+ is_q4 ? src_mv->col : src_mv->col * 2 };
const MV32 mv = scale->scale_mv(&mv_q4, scale);
const int subpel_x = mv.col & SUBPEL_MASK;
const int subpel_y = mv.row & SUBPEL_MASK;
@@ -100,16 +100,17 @@
const int spel_top = (VP9_INTERP_EXTEND + bh) << SUBPEL_BITS;
const int spel_bottom = spel_top - SUBPEL_SHIFTS;
MV clamped_mv = {
- src_mv->row << (1 - ss_y),
- src_mv->col << (1 - ss_x)
+ src_mv->row * (1 << (1 - ss_y)),
+ src_mv->col * (1 << (1 - ss_x))
};
assert(ss_x <= 1);
assert(ss_y <= 1);
- clamp_mv(&clamped_mv, (xd->mb_to_left_edge << (1 - ss_x)) - spel_left,
- (xd->mb_to_right_edge << (1 - ss_x)) + spel_right,
- (xd->mb_to_top_edge << (1 - ss_y)) - spel_top,
- (xd->mb_to_bottom_edge << (1 - ss_y)) + spel_bottom);
+ clamp_mv(&clamped_mv,
+ xd->mb_to_left_edge * (1 << (1 - ss_x)) - spel_left,
+ xd->mb_to_right_edge * (1 << (1 - ss_x)) + spel_right,
+ xd->mb_to_top_edge * (1 << (1 - ss_y)) - spel_top,
+ xd->mb_to_bottom_edge * (1 << (1 - ss_y)) + spel_bottom);
return clamped_mv;
}
--- a/vp9/encoder/vp9_dct.c
+++ b/vp9/encoder/vp9_dct.c
@@ -58,10 +58,10 @@
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 @@
// 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 @@
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 @@
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 @@
// 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 @@
// 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 @@
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 @@
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
--- a/vp9/encoder/vp9_encodeframe.c
+++ b/vp9/encoder/vp9_encodeframe.c
@@ -435,7 +435,8 @@
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 @@
} else {
encode_frame_internal(cpi);
}
-
}
static void sum_intra_stats(VP9_COMP *cpi, const MODE_INFO *mi) {
--- a/vp9/encoder/vp9_firstpass.c
+++ b/vp9/encoder/vp9_firstpass.c
@@ -660,8 +660,8 @@
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;
--- a/vp9/encoder/vp9_mcomp.c
+++ b/vp9/encoder/vp9_mcomp.c
@@ -339,13 +339,13 @@
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 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 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 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 @@
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 @@
(*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 @@
(*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 @@
}
}
- 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 @@
}
- 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 @@
}
}
- 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 @@
}
}
- 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 @@
}
}
- 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 @@
}
}
- 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
--- a/vp9/encoder/vp9_onyx_int.h
+++ b/vp9/encoder/vp9_onyx_int.h
@@ -392,8 +392,7 @@
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];
--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -269,7 +269,7 @@
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 @@
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 @@
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;
--- a/vp9/vp9_cx_iface.c
+++ b/vp9/vp9_cx_iface.c
@@ -769,7 +769,7 @@
}
/* Add the frame packet to the list of returned packets. */
- round = 1000000 * ctx->cfg.g_timebase.num / 2 - 1;
+ round = (vpx_codec_pts_t)1000000 * ctx->cfg.g_timebase.num / 2 - 1;
delta = (dst_end_time_stamp - dst_time_stamp);
pkt.kind = VPX_CODEC_CX_FRAME_PKT;
pkt.data.frame.pts =
--- a/vpxenc.c
+++ b/vpxenc.c
@@ -883,10 +883,10 @@
while (len >= 4) {
unsigned int k;
- k = data[0];
- k |= data[1] << 8;
- k |= data[2] << 16;
- k |= data[3] << 24;
+ k = (unsigned int)data[0];
+ k |= (unsigned int)data[1] << 8;
+ k |= (unsigned int)data[2] << 16;
+ k |= (unsigned int)data[3] << 24;
k *= m;
k ^= k >> r;
@@ -2671,8 +2671,8 @@
fprintf(stderr, "%7"PRId64" %s %.2f %s ",
cx_time > 9999999 ? cx_time / 1000 : cx_time,
cx_time > 9999999 ? "ms" : "us",
- fps >= 1.0 ? fps : 1000.0 / fps,
- fps >= 1.0 ? "fps" : "ms/f");
+ fps >= 1.0 ? fps : fps * 60,
+ fps >= 1.0 ? "fps" : "fpm");
print_time("ETA", estimated_time_left);
fprintf(stderr, "\033[K");
}