]> git.tue.mpg.de Git - paraslash.git/commitdiff
save one level of indentation in build_table().
authorAndre Noll <maan@systemlinux.org>
Sun, 18 Oct 2009 13:28:06 +0000 (15:28 +0200)
committerAndre Noll <maan@systemlinux.org>
Wed, 18 Nov 2009 18:34:20 +0000 (19:34 +0100)
bitstream.c

index e6360e6a92848db1ef41e7a57483c950140d84d6..dedcdead5bc77bb12880ec9342dc95a39e6cd615 100644 (file)
@@ -83,29 +83,29 @@ static int build_table(struct vlc *vlc, int table_nb_bits, int nb_codes,
                /* if code matches the prefix, it is in the table */
                n -= n_prefix;
                code_prefix2 = code >> n;
-               if (n > 0 && code_prefix2 == code_prefix) {
-                       if (n <= table_nb_bits) {
-                               /* no need to add another table */
-                               j = (code << (table_nb_bits - n)) & (table_size - 1);
-                               nb = 1 << (table_nb_bits - n);
-                               for (k = 0; k < nb; k++) {
-                                       if (table[j][1] /* bits */ != 0) {
-                                               PARA_EMERG_LOG("detected incorrect code\n");
-                                               exit(EXIT_FAILURE);
-                                       }
-                                       table[j][1] = n;        //bits
-                                       table[j][0] = symbol;
-                                       j++;
+               if (n <= 0 || code_prefix2 != code_prefix)
+                       continue;
+               if (n <= table_nb_bits) {
+                       /* no need to add another table */
+                       j = (code << (table_nb_bits - n)) & (table_size - 1);
+                       nb = 1 << (table_nb_bits - n);
+                       for (k = 0; k < nb; k++) {
+                               if (table[j][1] /* bits */ != 0) {
+                                       PARA_EMERG_LOG("incorrect code\n");
+                                       exit(EXIT_FAILURE);
                                }
-                       } else {
-                               n -= table_nb_bits;
-                               j = (code >> n) & ((1 << table_nb_bits) - 1);
-                               /* compute table size */
-                               n1 = -table[j][1];      //bits
-                               if (n > n1)
-                                       n1 = n;
-                               table[j][1] = -n1;      //bits
+                               table[j][1] = n;        //bits
+                               table[j][0] = symbol;
+                               j++;
                        }
+               } else {
+                       n -= table_nb_bits;
+                       j = (code >> n) & ((1 << table_nb_bits) - 1);
+                       /* compute table size */
+                       n1 = -table[j][1];      //bits
+                       if (n > n1)
+                               n1 = n;
+                       table[j][1] = -n1;      //bits
                }
        }
 
@@ -156,8 +156,7 @@ void init_vlc(struct vlc *vlc, int nb_bits, int nb_codes, const void *bits,
        vlc->table = NULL;
        vlc->table_allocated = 0;
        vlc->table_size = 0;
-       build_table(vlc, nb_bits, nb_codes, bits,
-               codes, codes_size, 0, 0);
+       build_table(vlc, nb_bits, nb_codes, bits, codes, codes_size, 0, 0);
 }
 
 void free_vlc(struct vlc *vlc)