]> git.sesse.net Git - fjl/blobdiff - dehuff.c
More debug code moving.
[fjl] / dehuff.c
index 695da0bdc78ee2d863cbb0fa547b628619ffc4ab..5574e27184b8de5961b01f1f76cbf0e27688c89b 100644 (file)
--- a/dehuff.c
+++ b/dehuff.c
@@ -123,8 +123,6 @@ void read_huffman_tables(huffman_tables_t* dst, input_func_t* input_func, void*
                // Generate the AC lookup tables.
                for (unsigned i = 0; i < DEHUF_AC_TABLE_SIZE; ++i) {
                        tbl->ac_table_codes[i] = AC_DEHUF_SLOW_PATH;
-                       tbl->ac_table_length[i] = AC_DEHUF_SLOW_PATH;
-                       tbl->ac_table_skip[i] = AC_DEHUF_SLOW_PATH;
 
                        int lookup = i >> (DEHUF_AC_TABLE_BITS - DEHUF_TABLE_BITS);
                        int rs = tbl->lookup_table_codes[lookup];
@@ -135,16 +133,16 @@ void read_huffman_tables(huffman_tables_t* dst, input_func_t* input_func, void*
                        }
                        if (rs == 0x00) {
                                // End of block.
-                               tbl->ac_table_codes[i] = AC_END_OF_BLOCK;
+                               tbl->ac_table_codes[i] = 0;
                                tbl->ac_table_length[i] = length;
-                               tbl->ac_table_skip[i] = 0;
+                               tbl->ac_table_skip[i] = 64;
                                continue;
                        }
                        if (rs == 0xf0) {
                                // 16 zero coefficients.
-                               tbl->ac_table_codes[i] = AC_SIXTEEN_ZEROS;
+                               tbl->ac_table_codes[i] = 0;
                                tbl->ac_table_length[i] = length;
-                               tbl->ac_table_skip[i] = 15;
+                               tbl->ac_table_skip[i] = 16;
                                continue;
                        }
                        
@@ -159,7 +157,7 @@ void read_huffman_tables(huffman_tables_t* dst, input_func_t* input_func, void*
 
                        tbl->ac_table_codes[i] = extend(bits, s);
                        tbl->ac_table_length[i] = length + s;
-                       tbl->ac_table_skip[i] = r;
+                       tbl->ac_table_skip[i] = r + 1;
 
                        assert(tbl->ac_table_length[i] <= DEHUF_AC_TABLE_BITS);
                }