X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=driver.c;h=20d64f2cd0c9c062e775fb0c66aad4dd6be4b797;hb=90cfe68276c3639bb340956754dd726284f7b822;hp=1411b51311e7efca363b88b038a1c9a634173455;hpb=f96984c3f6474f2d85750351fd249b01245b5ec3;p=fjl diff --git a/driver.c b/driver.c index 1411b51..20d64f2 100644 --- a/driver.c +++ b/driver.c @@ -185,8 +185,13 @@ void read_scan(struct byte_source* source, struct jpeg_image* image, huffman_tab } } - if (cn == 1 && ++xb * DCTSIZE == y_stride) { - fwrite(y_row_data, y_stride * DCTSIZE * image->vsample[1], 1, stdout); + if (cn != 1) { + continue; + } + + xb += image->hsample[cn]; + if (xb * DCTSIZE == y_stride) { + fwrite(y_row_data, y_stride * DCTSIZE * image->vsample[cn], 1, stdout); xb = 0; } }