shithub: libvpx

Download patch

ref: 18b66911057dcac1423a2363d9648423e8c6047a
parent: 24f534ac9036a68f78d6983120a19c7f3fedc62f
author: Johann <[email protected]>
date: Fri Aug 26 14:08:35 EDT 2016

Remove CONFIG_DEBUG guards from assert()

When 'NDEBUG' is set, assert() generates no code.

Change-Id: Icf61cfc1a8f6e5f0770b3626d8c73ae968df1108

--- 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));
 }