From 2b29b0c72e26b359bd648d3698d0ec7253dfbf0d Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Mon, 1 Jun 2009 22:35:56 +0200 Subject: [PATCH] More debug code moving. --- driver.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/driver.c b/driver.c index c4f48ac..94cce90 100644 --- a/driver.c +++ b/driver.c @@ -217,14 +217,8 @@ void read_scan(struct byte_source* source, struct jpeg_image* image, huffman_tab unsigned cn = component_num[c]; image->pixel_write_pointer[cn] += (image->vsample[cn] * DCTSIZE - 1) * image->stride[cn]; } - - // Some debug code. - const int c = 1; if (mcu_y == image->num_blocks_vertical) { - unsigned stride = image->num_blocks_horizontal * image->hsample[c] * DCTSIZE; - unsigned height = image->num_blocks_vertical * image->vsample[c] * DCTSIZE; - printf("P5\n%u %u\n255\n", stride, height); - fwrite(image->pixel_data[c], stride * height, 1, stdout); + return; } } } @@ -302,7 +296,7 @@ void read_jpeg(struct jpeg_image* jpeg, FILE *input) break; case 0xd9: /* EOI */ - exit(0); + return; case 0xc4: /* DHT (define Huffman tables) */ read_huffman_tables(&tables, byte_source_input_func, &source); @@ -324,4 +318,11 @@ int main(void) struct jpeg_image jpeg; read_jpeg(&jpeg, stdin); + + // Some debug code. + const int c = 1; + unsigned stride = jpeg.num_blocks_horizontal * jpeg.hsample[c] * DCTSIZE; + unsigned height = jpeg.num_blocks_vertical * jpeg.vsample[c] * DCTSIZE; + printf("P5\n%u %u\n255\n", stride, height); + fwrite(jpeg.pixel_data[c], stride * height, 1, stdout); } -- 2.39.2