shithub: libvpx

Download patch

ref: 4d1540f8ce1c9965bc89674ba4e46e332f52599d
parent: 594e53514b07093b1745ec6af9be290a9ed1f251
parent: 4d1c117f5bc0200b7484b95ad07c856c6b9003cd
author: Johann Koenig <johannkoenig@google.com>
date: Thu Sep 1 21:39:17 EDT 2016

Merge changes from topic 'Wundef'

* changes:
  Enable -Wundef by default
  Define VP8_TEMPORAL_ALT_REF to !CONFIG_REALTIME_ONLY
  Remove CONFIG_DEBUG guards from assert()
  Remove unused function vpx_de_mblock
  Fix -Wundef warning for OUTPUT_FPF
  Fix -Wundef warning for __SANITIZE_ADDRESS__

--- a/configure
+++ b/configure
@@ -574,6 +574,9 @@
         check_add_cflags -Wimplicit-function-declaration
         check_add_cflags -Wuninitialized
         check_add_cflags -Wunused
+        # check_add_cflags also adds to cxxflags. gtest does not do well with
+        # -Wundef so add it explicitly to CFLAGS only.
+        check_cflags -Wundef && add_cflags_only -Wundef
         case ${CC} in
           *clang*)
               # libvpx and/or clang have issues with aliasing:
--- a/vp8/common/treecoder.c
+++ b/vp8/common/treecoder.c
@@ -8,12 +8,10 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#if CONFIG_DEBUG
 #include <assert.h>
-#endif
 #include <stdio.h>
 
-#include "treecoder.h"
+#include "vp8/common/treecoder.h"
 
 static void tree2tok(struct vp8_token_struct *const p, vp8_tree t, int i, int v,
                      int L) {
@@ -48,9 +46,7 @@
   const int tree_len = n - 1;
   int t = 0;
 
-#if CONFIG_DEBUG
   assert(tree_len);
-#endif
 
   do {
     branch_ct[t][0] = branch_ct[t][1] = 0;
@@ -68,17 +64,13 @@
     do {
       const int b = (enc >> --L) & 1;
       const int j = i >> 1;
-#if CONFIG_DEBUG
       assert(j < tree_len && 0 <= L);
-#endif
 
       branch_ct[j][b] += ct;
       i = tree[i + b];
     } while (i > 0);
 
-#if CONFIG_DEBUG
     assert(!L);
-#endif
   } while (++t < n);
 }
 
@@ -97,9 +89,7 @@
     const unsigned int *const c = branch_ct[t];
     const unsigned int tot = c[0] + c[1];
 
-#if CONFIG_DEBUG
     assert(tot < (1 << 24)); /* no overflow below */
-#endif
 
     if (tot) {
       const unsigned int p = ((c[0] * Pfac) + (rd ? tot >> 1 : 0)) / tot;
--- a/vp8/decoder/decodemv.c
+++ b/vp8/decoder/decodemv.c
@@ -14,9 +14,6 @@
 #include "onyxd_int.h"
 #include "vp8/common/findnearmv.h"
 
-#if CONFIG_DEBUG
-#include <assert.h>
-#endif
 static B_PREDICTION_MODE read_bmode(vp8_reader *bc, const vp8_prob *p) {
   const int i = vp8_treed_read(bc, vp8_bmode_tree, p);
 
--- a/vp8/encoder/bitstream.c
+++ b/vp8/encoder/bitstream.c
@@ -338,9 +338,7 @@
 
 static void write_mv_ref(vp8_writer *w, MB_PREDICTION_MODE m,
                          const vp8_prob *p) {
-#if CONFIG_DEBUG
   assert(NEARESTMV <= m && m <= SPLITMV);
-#endif
   vp8_write_token(w, vp8_mv_ref_tree, p,
                   vp8_mv_ref_encoding_array + (m - NEARESTMV));
 }
@@ -347,9 +345,7 @@
 
 static void write_sub_mv_ref(vp8_writer *w, B_PREDICTION_MODE m,
                              const vp8_prob *p) {
-#if CONFIG_DEBUG
   assert(LEFT4X4 <= m && m <= NEW4X4);
-#endif
   vp8_write_token(w, vp8_sub_mv_ref_tree, p,
                   vp8_sub_mv_ref_encoding_array + (m - LEFT4X4));
 }
--- a/vp8/encoder/firstpass.c
+++ b/vp8/encoder/firstpass.c
@@ -33,7 +33,7 @@
 #include "encodemv.h"
 #include "encodeframe.h"
 
-/* #define OUTPUT_FPF 1 */
+#define OUTPUT_FPF 0
 
 extern void vp8cx_frame_init_quantizer(VP8_COMP *cpi);
 
--- a/vp8/encoder/onyx_int.h
+++ b/vp8/encoder/onyx_int.h
@@ -55,9 +55,7 @@
 #define MV_ZBIN_BOOST 4
 #define ZBIN_OQ_MAX 192
 
-#if !(CONFIG_REALTIME_ONLY)
-#define VP8_TEMPORAL_ALT_REF 1
-#endif
+#define VP8_TEMPORAL_ALT_REF !CONFIG_REALTIME_ONLY
 
 typedef struct {
   int kf_indicated;
--- a/vpx_dsp/deblock.c
+++ b/vpx_dsp/deblock.c
@@ -190,13 +190,3 @@
     }
   }
 }
-
-#if CONFIG_POSTPROC
-static void vpx_de_mblock(YV12_BUFFER_CONFIG *post, int q) {
-  vpx_mbpost_proc_across_ip(post->y_buffer, post->y_stride, post->y_height,
-                            post->y_width, q2mbl(q));
-  vpx_mbpost_proc_down(post->y_buffer, post->y_stride, post->y_height,
-                       post->y_width, q2mbl(q));
-}
-
-#endif
--- a/vpx_ports/mem.h
+++ b/vpx_ports/mem.h
@@ -53,10 +53,10 @@
 #define __has_feature(x) 0
 #endif  // !defined(__has_feature)
 
-#if __has_feature(address_sanitizer) || __SANITIZE_ADDRESS__
+#if __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__)
 #define VPX_WITH_ASAN 1
 #else
 #define VPX_WITH_ASAN 0
-#endif  // __has_feature(address_sanitizer) || __SANITIZE_ADDRESS
+#endif  // __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__)
 
 #endif  // VPX_PORTS_MEM_H_