[FFmpeg-cvslog] avcodec/bitstream: fill invalid vlc tables entries as last pass instead of first

Michael Niedermayer git at videolan.org
Mon Jun 16 20:16:56 CEST 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Mon Jun 16 18:46:14 2014 +0200| [f7f96cf4bcc369730bb945e993bec53881e212f5] | committer: Michael Niedermayer

avcodec/bitstream: fill invalid vlc tables entries as last pass instead of first

This avoids writing entries twice

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f7f96cf4bcc369730bb945e993bec53881e212f5
---

 libavcodec/bitstream.c |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/libavcodec/bitstream.c b/libavcodec/bitstream.c
index 2d3f606..c61243e 100644
--- a/libavcodec/bitstream.c
+++ b/libavcodec/bitstream.c
@@ -174,11 +174,6 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes,
         return table_index;
     table = &vlc->table[table_index];
 
-    for (i = 0; i < table_size; i++) {
-        table[i][1] = 0; //bits
-        table[i][0] = -1; //codes
-    }
-
     /* first pass: map codes and compute auxiliary table sizes */
     for (i = 0; i < nb_codes; i++) {
         n      = codes[i].bits;
@@ -237,6 +232,12 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes,
             i = k-1;
         }
     }
+
+    for (i = 0; i < table_size; i++) {
+        if (table[i][1] == 0) //bits
+            table[i][0] = -1; //codes
+    }
+
     return table_index;
 }
 



More information about the ffmpeg-cvslog mailing list