X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=driver.c;h=b12b226c336dcc29ea9993f521fbd8f393ec8f79;hb=2427a61d1b1db701b057eeeb269c1e4211b982d7;hp=35934da1d72d711efafdb588b62dae22cdcd8e54;hpb=bed2510078b46c35b95941e59327b1008e4bd176;p=fjl diff --git a/driver.c b/driver.c index 35934da..b12b226 100644 --- a/driver.c +++ b/driver.c @@ -214,8 +214,9 @@ void read_scan(struct byte_source* source, struct jpeg_image* image, huffman_tab const int c = 1; if (mcu_y == image->num_blocks_vertical) { unsigned stride = image->num_blocks_horizontal * image->hsample[c] * DCTSIZE; - printf("P5\n%u %u\n255\n", stride, image->height); - fwrite(image->pixel_data[c], stride * image->height, 1, stdout); + 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); } } } @@ -293,6 +294,9 @@ int main(void) case 0xd8: /* SOI */ break; + case 0xd9: + /* EOI */ + exit(0); case 0xc4: /* DHT (define Huffman tables) */ read_huffman_tables(&tables, byte_source_input_func, &source);