From e58d7fc6e17349a9a456632f9403a73262a428e5 Mon Sep 17 00:00:00 2001 From: "sgunderson@bigfoot.com" <> Date: Sun, 31 May 2009 20:20:56 +0200 Subject: [PATCH] Correct PGM height for vertically sampled components. --- driver.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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); } } } -- 2.39.2