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
This commit is contained in:
@@ -43,6 +43,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#include "encodeframe.h"
|
#include "encodeframe.h"
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <limits.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.
|
// Only return non-zero if we have at least ~1/16 samples for estimate.
|
||||||
if (num_blocks > (tot_num_blocks >> 4)) {
|
if (num_blocks > (tot_num_blocks >> 4)) {
|
||||||
|
assert(num_blocks != 0);
|
||||||
return (Total / num_blocks);
|
return (Total / num_blocks);
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
|
Reference in New Issue
Block a user