}
}
- 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;
}
}