diff options
author | Johann <johannkoenig@google.com> | 2017-01-31 15:51:15 -0800 |
---|---|---|
committer | Johann Koenig <johannkoenig@google.com> | 2017-02-14 04:27:31 +0000 |
commit | 25301a84a8fe65f57cfe7d67001912b44f5085c8 (patch) | |
tree | 7dfa7f5269b9f21eed757d4b510c1f1f62489d8c | |
parent | eeb288d568fde3512e4362d73e4d684af3bcf87c (diff) | |
download | libvpx-25301a84a8fe65f57cfe7d67001912b44f5085c8.tar libvpx-25301a84a8fe65f57cfe7d67001912b44f5085c8.tar.gz libvpx-25301a84a8fe65f57cfe7d67001912b44f5085c8.tar.bz2 libvpx-25301a84a8fe65f57cfe7d67001912b44f5085c8.zip |
vp8 onyx_if: assert divide by zero
Clears up static clang analysis warning regarding divide by zero.
Trying to explain to the compiler how it's impossible to avoid
incrementing num_blocks at least once is difficult.
Change-Id: Ibaae43be572e5cd7a689b440dcd341c17d33443b
-rw-r--r-- | vp8/encoder/onyx_if.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/vp8/encoder/onyx_if.c b/vp8/encoder/onyx_if.c index 320a7a79b..37907855b 100644 --- a/vp8/encoder/onyx_if.c +++ b/vp8/encoder/onyx_if.c @@ -43,6 +43,7 @@ #endif #include "encodeframe.h" +#include <assert.h> #include <math.h> #include <stdio.h> #include <limits.h> @@ -3052,6 +3053,7 @@ static int measure_square_diff_partial(YV12_BUFFER_CONFIG *source, } // Only return non-zero if we have at least ~1/16 samples for estimate. if (num_blocks > (tot_num_blocks >> 4)) { + assert(num_blocks != 0); return (Total / num_blocks); } else { return 0; |