Yet another microoptimization in the driver.
authorSteinar H. Gunderson <sesse@debian.org>
Mon, 1 Jun 2009 00:56:54 +0000 (02:56 +0200)
committerSteinar H. Gunderson <sesse@debian.org>
Mon, 1 Jun 2009 00:56:54 +0000 (02:56 +0200)
driver.c

index d5bec84..5b45453 100644 (file)
--- a/driver.c
+++ b/driver.c
@@ -181,6 +181,7 @@ void read_scan(struct byte_source* source, struct jpeg_image* image, huffman_tab
                                                unsigned r = rs >> 4;
                                                unsigned s = rs & 0xf;
                                                i += r;
+                                               possibly_refill(&bits, s + DEHUF_TABLE_BITS);
 
                                                if (rs == 0x00) {
                                                        /* end of block */
@@ -188,11 +189,9 @@ void read_scan(struct byte_source* source, struct jpeg_image* image, huffman_tab
                                                }
                                                if (rs == 0xf0) {
                                                        /* 16 zero coefficients */
-                                                       possibly_refill(&bits, DEHUF_TABLE_BITS);
                                                        continue;
                                                }
 
-                                               possibly_refill(&bits, s + DEHUF_TABLE_BITS);
                                                coeff[unzigzag[i]] = extend(read_bits(&bits, s), s);
                                        }