assert(len >= 8);
image->precision = read_uint8(byte_source_input_func, source);
assert(image->precision == 8);
- image->width = read_uint16(byte_source_input_func, source);
image->height = read_uint16(byte_source_input_func, source);
+ image->width = read_uint16(byte_source_input_func, source);
image->num_components = read_uint8(byte_source_input_func, source);
len -= 8;
i += 15;
continue;
}
+ i += r;
possibly_refill(&bits, s);
-
- i += r;
coeff[unzigzag[i]] = extend(read_bits(&bits, s), s);
}
}
}
- 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;
}
}