From: sgunderson@bigfoot.com <> Date: Sun, 31 May 2009 18:20:56 +0000 (+0200) Subject: Correct PGM height for vertically sampled components. X-Git-Url: https://git.sesse.net/?p=fjl;a=commitdiff_plain;h=e58d7fc6e17349a9a456632f9403a73262a428e5;ds=inline Correct PGM height for vertically sampled components. --- diff --git a/driver.c b/driver.c index fd861f2..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); } } }