]> git.sesse.net Git - fjl/blobdiff - driver.c
Write to the right coefficient.
[fjl] / driver.c
index 20d64f2cd0c9c062e775fb0c66aad4dd6be4b797..6a7a8ec82d01996cdd83ea511575e6a65a76afc4 100644 (file)
--- a/driver.c
+++ b/driver.c
@@ -62,8 +62,8 @@ void read_sof(struct byte_source* source, struct jpeg_image* image)
        assert(len >= 8);
        image->precision = read_uint8(byte_source_input_func, source);
        assert(image->precision == 8);
-       image->width = read_uint16(byte_source_input_func, source);
        image->height = read_uint16(byte_source_input_func, source);
+       image->width = read_uint16(byte_source_input_func, source);
        image->num_components = read_uint8(byte_source_input_func, source);
        len -= 8;
 
@@ -165,9 +165,9 @@ void read_scan(struct byte_source* source, struct jpeg_image* image, huffman_tab
                                                }
 
                                                possibly_refill(&bits, s);
+                                               coeff[unzigzag[i]] = extend(read_bits(&bits, s), s);
 
                                                i += r;
-                                               coeff[unzigzag[i]] = extend(read_bits(&bits, s), s);
                                        }
                        
                                        uint8_t pixdata[DCTSIZE2];