Skip to content
Snippets Groups Projects
Commit 000098a0 authored by Yaowu Xu's avatar Yaowu Xu
Browse files

Convert "var" to uint64_t

This is to avoid overflow at uint32_t.

Change-Id: I549d2d13d0577fd05d57303a438fbc8034755e45
parent 1801d35d
No related branches found
No related tags found
Loading
......@@ -167,7 +167,7 @@ static unsigned int block_variance(AV1_COMP *cpi, MACROBLOCK *x,
bw, bh, &sse, &avg);
#endif // CONFIG_AOM_HIGHBITDEPTH
var = sse - (((int64_t)avg * avg) / (bw * bh));
return (256 * var) / (bw * bh);
return ((uint64_t)var * 256) / (bw * bh);
} else {
#if CONFIG_AOM_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
......@@ -182,7 +182,7 @@ static unsigned int block_variance(AV1_COMP *cpi, MACROBLOCK *x,
var = cpi->fn_ptr[bs].vf(x->plane[0].src.buf, x->plane[0].src.stride,
av1_64_zeros, 0, &sse);
#endif // CONFIG_AOM_HIGHBITDEPTH
return (256 * var) >> num_pels_log2_lookup[bs];
return ((uint64_t)var * 256) >> num_pels_log2_lookup[bs];
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment