Transform unjpeg into something slightly more useful for benchmarking.
authorSteinar H. Gunderson <sesse@debian.org>
Fri, 2 Jan 2009 11:21:36 +0000 (12:21 +0100)
committerSteinar H. Gunderson <sesse@debian.org>
Fri, 2 Jan 2009 11:21:36 +0000 (12:21 +0100)
unjpeg.c

index a1e92b0..deda062 100644 (file)
--- a/unjpeg.c
+++ b/unjpeg.c
@@ -19,6 +19,8 @@ struct mem_stream {
        unsigned used, room;
 };
 struct mem_stream streams[128];
+char huge[1048576 * 100];
+int num_huge = 0;
 
 void *xmalloc(size_t size)
 {
@@ -322,13 +324,13 @@ void read_scan()
        bits_available = 0;
 
        for ( ;; ) {
-               //fprintf(stderr, "\n");
+               //fprintf(stderr, "new scan, now\n");
 
                int c;
                for (c = 0; c < num_components; ++c) {
                        int zz[63];
-                       /*fprintf(stderr, "coeff %u\n", c);
-                       fprintf(stderr, "getting dc (table %u)\n", dc_huffman_table[c]); */
+                       //fprintf(stderr, "coeff %u\n", c);
+                       //fprintf(stderr, "getting dc (table %u)\n", dc_huffman_table[c]);
 
                        /* decode DC component */
                        unsigned char dc_category = get_huffman_byte(&bits_available, &bit_reservoir, &huffman_tables[0][dc_huffman_table[c]]);
@@ -339,9 +341,9 @@ void read_scan()
                        last_dc[c] += extend(dc_diff, dc_category);
 
                        /*putchar_stream(0, last_dc[c] >> 8);
-                       putchar_stream(0, last_dc[c] & 0xff); */
-                       putchar_stream(0, dc_diff >> 8);
-                       putchar_stream(0, dc_diff & 0xff); 
+                       putchar_stream(0, last_dc[c] & 0xff);  */
+                       huge[num_huge++] = dc_diff >> 8;
+                       huge[num_huge++] = dc_diff & 0xff;
                        
                        for (i = 0; i < 63; ++i) {
                                zz[i] = 0;
@@ -378,8 +380,8 @@ void read_scan()
                                } else {
                                        m = (1 - zz[i] * 2);
                                }
-                               putchar_stream(s * 2 + 2, m >> 8);
-                               putchar_stream(s * 2 + 3, m & 0xff);
+                               huge[num_huge++] = m >> 8;
+                               huge[num_huge++] = m & 0xff;
                        }
                }
        }