Correct PGM height for vertically sampled components.
authorsgunderson@bigfoot.com <>
Sun, 31 May 2009 18:20:56 +0000 (20:20 +0200)
committersgunderson@bigfoot.com <>
Sun, 31 May 2009 18:20:56 +0000 (20:20 +0200)
driver.c

index fd861f2..b12b226 100644 (file)
--- 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);
                        }
                }
        }