]> git.sesse.net Git - fjl/blobdiff - driver.c
Minor optimizations to the new AC coefficient tables.
[fjl] / driver.c
index cda257e3c90ba023ed8b465eeedf2e1417768aff..c5ae87e3b003cc2b060ccfe3fa1571ff817a2246 100644 (file)
--- a/driver.c
+++ b/driver.c
@@ -120,8 +120,6 @@ void decode_ac_coefficients(const struct huffman_table* tbl, struct bit_source*
                possibly_refill(bits, DEHUF_AC_TABLE_BITS);
                unsigned lookup = peek_bits(bits, DEHUF_AC_TABLE_BITS);
                int code = tbl->ac_table_codes[lookup];
-               int length = tbl->ac_table_length[lookup];
-               int r = tbl->ac_table_skip[lookup];
 
                assert(length == AC_DEHUF_SLOW_PATH || (length > 0 && length <= DEHUF_AC_TABLE_BITS));
 
@@ -145,6 +143,8 @@ void decode_ac_coefficients(const struct huffman_table* tbl, struct bit_source*
 
                        coeff[unzigzag[i]] = extend(read_bits(bits, s), s);
                } else {
+                       int length = tbl->ac_table_length[lookup];
+                       int r = tbl->ac_table_skip[lookup];
                        assert(r >= 0);
                        i += r;
                        assert(bits->bits_available >= length);