diff options
author | Johann <johannkoenig@google.com> | 2017-01-31 15:18:40 -0800 |
---|---|---|
committer | Johann Koenig <johannkoenig@google.com> | 2017-02-14 00:56:08 +0000 |
commit | 8a1fb4027345c7f36ef02bea969484018ee0693b (patch) | |
tree | a9ffca3c911fcf097215b824fd2fb914978aa8e2 /vp8/encoder/pickinter.c | |
parent | 5cc0a364ae9bd3e3ac6248f85283cf0cfa9ab07f (diff) | |
download | libvpx-8a1fb4027345c7f36ef02bea969484018ee0693b.tar libvpx-8a1fb4027345c7f36ef02bea969484018ee0693b.tar.gz libvpx-8a1fb4027345c7f36ef02bea969484018ee0693b.tar.bz2 libvpx-8a1fb4027345c7f36ef02bea969484018ee0693b.zip |
Remove UNINITIALIZED_IS_SAFE
Where clang static analysis or gcc -Wmaybe-uninitialized warns of
uninitialized values, assign 0 to ints, MB_MODE_COUNT to
MB_PREDICTION_MODE, and B_MODE_COUNT to B_PREDICTION_MODE.
Assert that the modes have been changed from the invalid value by
the end of the function.
Change-Id: Ib11e1ffb08f0a6fe4b6c6729dc93b83b1c4b6350
Diffstat (limited to 'vp8/encoder/pickinter.c')
-rw-r--r-- | vp8/encoder/pickinter.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/vp8/encoder/pickinter.c b/vp8/encoder/pickinter.c index 7b68d35f5..d59bd3310 100644 --- a/vp8/encoder/pickinter.c +++ b/vp8/encoder/pickinter.c @@ -8,6 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ +#include <assert.h> #include <limits.h> #include "vpx_config.h" #include "./vpx_dsp_rtcd.h" @@ -299,8 +300,8 @@ static int pick_intra4x4mby_modes(MACROBLOCK *mb, int *Rate, int *best_dist) { MODE_INFO *const mic = xd->mode_info_context; const int mis = xd->mode_info_stride; - B_PREDICTION_MODE UNINITIALIZED_IS_SAFE(best_mode); - int UNINITIALIZED_IS_SAFE(r), UNINITIALIZED_IS_SAFE(d); + B_PREDICTION_MODE best_mode = B_MODE_COUNT; + int r = 0, d = 0; if (mb->e_mbd.frame_type == KEY_FRAME) { const B_PREDICTION_MODE A = above_block_mode(mic, i, mis); @@ -313,6 +314,7 @@ static int pick_intra4x4mby_modes(MACROBLOCK *mb, int *Rate, int *best_dist) { cost += r; distortion += d; + assert(best_mode != B_MODE_COUNT); mic->bmi[i].as_mode = best_mode; /* Break out case where we have already exceeded best so far value @@ -353,7 +355,7 @@ static void pick_intra_mbuv_mode(MACROBLOCK *mb) { int Vaverage = 0; int diff; int pred_error[4] = { 0, 0, 0, 0 }, best_error = INT_MAX; - MB_PREDICTION_MODE UNINITIALIZED_IS_SAFE(best_mode); + MB_PREDICTION_MODE best_mode = MB_MODE_COUNT; for (i = 0; i < 8; ++i) { uleft_col[i] = x->dst.u_buffer[i * x->dst.uv_stride - 1]; @@ -442,6 +444,7 @@ static void pick_intra_mbuv_mode(MACROBLOCK *mb) { } } + assert(best_mode != MB_MODE_COUNT); mb->e_mbd.mode_info_context->mbmi.uv_mode = best_mode; } |