[FFmpeg-devel] [PATCH 1/2] avcodec/vorbisenc: use av_assert1() instead of assert()

Michael Niedermayer michael at niedermayer.cc
Sat Feb 2 00:33:34 EET 2019


Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavcodec/vorbisenc.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/libavcodec/vorbisenc.c b/libavcodec/vorbisenc.c
index 18a679f2dc..54cac0c0ad 100644
--- a/libavcodec/vorbisenc.c
+++ b/libavcodec/vorbisenc.c
@@ -40,9 +40,6 @@
 #define BITSTREAM_WRITER_LE
 #include "put_bits.h"
 
-#undef NDEBUG
-#include <assert.h>
-
 typedef struct vorbis_enc_codebook {
     int nentries;
     uint8_t *lens;
@@ -223,8 +220,8 @@ static int ready_residue(vorbis_enc_residue *rc, vorbis_enc_context *venc)
         if (j == 8) // zero
             continue;
         cb = &venc->codebooks[rc->books[i][j]];
-        assert(cb->ndimensions >= 2);
-        assert(cb->lookup);
+        av_assert1(cb->ndimensions >= 2);
+        av_assert1(cb->lookup);
 
         for (j = 0; j < cb->nentries; j++) {
             float a;
@@ -853,7 +850,7 @@ static int floor_encode(vorbis_enc_context *venc, vorbis_enc_floor *fc,
                     if (coded[counter + k] < maxval)
                         break;
                 }
-                assert(l != csub);
+                av_assert1(l != csub);
                 cval   |= l << cshift;
                 cshift += c->subclass;
             }
@@ -884,7 +881,7 @@ static float *put_vector(vorbis_enc_codebook *book, PutBitContext *pb,
 {
     int i, entry = -1;
     float distance = FLT_MAX;
-    assert(book->dimensions);
+    av_assert1(book->dimensions);
     for (i = 0; i < book->nentries; i++) {
         float * vec = book->dimensions + i * book->ndimensions, d = book->pow2[i];
         int j;
@@ -951,8 +948,8 @@ static int residue_encode(vorbis_enc_context *venc, vorbis_enc_residue *rc,
                     if (nbook == -1)
                         continue;
 
-                    assert(rc->type == 0 || rc->type == 2);
-                    assert(!(psize % book->ndimensions));
+                    av_assert1(rc->type == 0 || rc->type == 2);
+                    av_assert1(!(psize % book->ndimensions));
 
                     if (rc->type == 0) {
                         for (k = 0; k < psize; k += book->ndimensions) {
-- 
2.20.1



More information about the ffmpeg-devel mailing list