summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohann Koenig <johannkoenig@google.com>2017-02-14 03:02:50 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2017-02-14 03:02:51 +0000
commiteeb288d568fde3512e4362d73e4d684af3bcf87c (patch)
tree5b25e0247620ab6931a0a4d703840e480e1f1429
parentde9ae32b93d2d4ff67895dde7cda9828e08f3ef3 (diff)
parent8a1fb4027345c7f36ef02bea969484018ee0693b (diff)
downloadlibvpx-eeb288d568fde3512e4362d73e4d684af3bcf87c.tar
libvpx-eeb288d568fde3512e4362d73e4d684af3bcf87c.tar.gz
libvpx-eeb288d568fde3512e4362d73e4d684af3bcf87c.tar.bz2
libvpx-eeb288d568fde3512e4362d73e4d684af3bcf87c.zip
Merge "Remove UNINITIALIZED_IS_SAFE"
-rw-r--r--vp8/encoder/onyx_if.c9
-rw-r--r--vp8/encoder/pickinter.c9
-rw-r--r--vp8/encoder/rdopt.c15
-rw-r--r--vpx_ports/mem.h10
4 files changed, 18 insertions, 25 deletions
diff --git a/vp8/encoder/onyx_if.c b/vp8/encoder/onyx_if.c
index 9717feb13..320a7a79b 100644
--- a/vp8/encoder/onyx_if.c
+++ b/vp8/encoder/onyx_if.c
@@ -1633,8 +1633,7 @@ void vp8_change_config(VP8_COMP *cpi, VP8_CONFIG *oxcf) {
cm->sharpness_level = cpi->oxcf.Sharpness;
if (cm->horiz_scale != NORMAL || cm->vert_scale != NORMAL) {
- int UNINITIALIZED_IS_SAFE(hr), UNINITIALIZED_IS_SAFE(hs);
- int UNINITIALIZED_IS_SAFE(vr), UNINITIALIZED_IS_SAFE(vs);
+ int hr, hs, vr, vs;
Scale2Ratio(cm->horiz_scale, &hr, &hs);
Scale2Ratio(cm->vert_scale, &vr, &vs);
@@ -2504,8 +2503,7 @@ static void scale_and_extend_source(YV12_BUFFER_CONFIG *sd, VP8_COMP *cpi) {
/* are we resizing the image */
if (cm->horiz_scale != 0 || cm->vert_scale != 0) {
#if CONFIG_SPATIAL_RESAMPLING
- int UNINITIALIZED_IS_SAFE(hr), UNINITIALIZED_IS_SAFE(hs);
- int UNINITIALIZED_IS_SAFE(vr), UNINITIALIZED_IS_SAFE(vs);
+ int hr, hs, vr, vs;
int tmp_height;
if (cm->vert_scale == 3) {
@@ -2538,8 +2536,7 @@ static int resize_key_frame(VP8_COMP *cpi) {
*/
if (cpi->oxcf.allow_spatial_resampling &&
(cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER)) {
- int UNINITIALIZED_IS_SAFE(hr), UNINITIALIZED_IS_SAFE(hs);
- int UNINITIALIZED_IS_SAFE(vr), UNINITIALIZED_IS_SAFE(vs);
+ int hr, hs, vr, vs;
int new_width, new_height;
/* If we are below the resample DOWN watermark then scale down a
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;
}
diff --git a/vp8/encoder/rdopt.c b/vp8/encoder/rdopt.c
index 7bbeb2857..b08a573f6 100644
--- a/vp8/encoder/rdopt.c
+++ b/vp8/encoder/rdopt.c
@@ -8,6 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#include <assert.h>
#include <stdio.h>
#include <math.h>
#include <limits.h>
@@ -608,9 +609,8 @@ static int rd_pick_intra4x4mby_modes(MACROBLOCK *mb, int *Rate, int *rate_y,
for (i = 0; i < 16; ++i) {
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(ry),
- UNINITIALIZED_IS_SAFE(d);
+ B_PREDICTION_MODE best_mode = B_MODE_COUNT;
+ int r = 0, ry = 0, d = 0;
if (mb->e_mbd.frame_type == KEY_FRAME) {
const B_PREDICTION_MODE A = above_block_mode(mic, i, mis);
@@ -627,6 +627,7 @@ static int rd_pick_intra4x4mby_modes(MACROBLOCK *mb, int *Rate, int *rate_y,
distortion += d;
tot_rate_y += ry;
+ assert(best_mode != B_MODE_COUNT);
mic->bmi[i].as_mode = best_mode;
if (total_rd >= (int64_t)best_rd) break;
@@ -644,7 +645,7 @@ static int rd_pick_intra4x4mby_modes(MACROBLOCK *mb, int *Rate, int *rate_y,
static int rd_pick_intra16x16mby_mode(MACROBLOCK *x, int *Rate, int *rate_y,
int *Distortion) {
MB_PREDICTION_MODE mode;
- MB_PREDICTION_MODE UNINITIALIZED_IS_SAFE(mode_selected);
+ MB_PREDICTION_MODE mode_selected = MB_MODE_COUNT;
int rate, ratey;
int distortion;
int best_rd = INT_MAX;
@@ -674,6 +675,7 @@ static int rd_pick_intra16x16mby_mode(MACROBLOCK *x, int *Rate, int *rate_y,
}
}
+ assert(mode_selected != MB_MODE_COUNT);
xd->mode_info_context->mbmi.mode = mode_selected;
return best_rd;
}
@@ -741,9 +743,9 @@ static int rd_inter4x4_uv(VP8_COMP *cpi, MACROBLOCK *x, int *rate,
static void rd_pick_intra_mbuv_mode(MACROBLOCK *x, int *rate,
int *rate_tokenonly, int *distortion) {
MB_PREDICTION_MODE mode;
- MB_PREDICTION_MODE UNINITIALIZED_IS_SAFE(mode_selected);
+ MB_PREDICTION_MODE mode_selected = MB_MODE_COUNT;
int best_rd = INT_MAX;
- int UNINITIALIZED_IS_SAFE(d), UNINITIALIZED_IS_SAFE(r);
+ int d = 0, r = 0;
int rate_to;
MACROBLOCKD *xd = &x->e_mbd;
@@ -787,6 +789,7 @@ static void rd_pick_intra_mbuv_mode(MACROBLOCK *x, int *rate,
*rate = r;
*distortion = d;
+ assert(mode_selected != MB_MODE_COUNT);
xd->mode_info_context->mbmi.uv_mode = mode_selected;
}
diff --git a/vpx_ports/mem.h b/vpx_ports/mem.h
index 2d49b7a06..49954e904 100644
--- a/vpx_ports/mem.h
+++ b/vpx_ports/mem.h
@@ -23,16 +23,6 @@
#define DECLARE_ALIGNED(n, typ, val) typ val
#endif
-/* Indicates that the usage of the specified variable has been audited to assure
- * that it's safe to use uninitialized. Silences 'may be used uninitialized'
- * warnings on gcc.
- */
-#if defined(__GNUC__) && __GNUC__
-#define UNINITIALIZED_IS_SAFE(x) x = x
-#else
-#define UNINITIALIZED_IS_SAFE(x) x
-#endif
-
#if HAVE_NEON && defined(_MSC_VER)
#define __builtin_prefetch(x)
#endif