diff options
author | Mans Rullgard <mans@mansr.com> | 2011-10-08 01:37:20 +0100 |
---|---|---|
committer | Mans Rullgard <mans@mansr.com> | 2011-10-14 20:45:22 +0100 |
commit | d341d5fd2cd7e301a20dcb50f3e1445571765023 (patch) | |
tree | 33de6fbbcad175cb3b3c5a054eeca9099c88ea44 /libavcodec/dnxhdenc.c | |
parent | 05c8f119cc6b5727319c56b055af82ac1ded93b5 (diff) | |
download | ffmpeg-d341d5fd2cd7e301a20dcb50f3e1445571765023.tar.gz |
dnxhdenc: fixed signed multiplication overflow
The low 32 bits of a multiplication are the same for signed
and unsigned operands. Casting to unsigned before multiplying
is thus equivalent while avoiding signed overflow, which is
undefined by the C99 standard.
Signed-off-by: Mans Rullgard <mans@mansr.com>
Diffstat (limited to 'libavcodec/dnxhdenc.c')
-rw-r--r-- | libavcodec/dnxhdenc.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/dnxhdenc.c b/libavcodec/dnxhdenc.c index db460856d6..89e5c085ab 100644 --- a/libavcodec/dnxhdenc.c +++ b/libavcodec/dnxhdenc.c @@ -623,7 +623,7 @@ static int dnxhd_mb_var_thread(AVCodecContext *avctx, void *arg, int jobnr, int for (mb_x = 0; mb_x < ctx->m.mb_width; ++mb_x, pix += 16) { unsigned mb = mb_y * ctx->m.mb_width + mb_x; int sum = ctx->m.dsp.pix_sum(pix, ctx->m.linesize); - int varc = (ctx->m.dsp.pix_norm1(pix, ctx->m.linesize) - (((unsigned)(sum*sum))>>8)+128)>>8; + int varc = (ctx->m.dsp.pix_norm1(pix, ctx->m.linesize) - (((unsigned)sum*sum)>>8)+128)>>8; ctx->mb_cmp[mb].value = varc; ctx->mb_cmp[mb].mb = mb; } |