+
+ image->num_blocks_horizontal = (image->width + image->max_hsample * DCTSIZE - 1) / (image->max_hsample * DCTSIZE);
+ image->num_blocks_vertical = (image->height + image->max_vsample * DCTSIZE - 1) / (image->max_vsample * DCTSIZE);
+
+ for (unsigned c = 0; c < 256; ++c) {
+ if (image->hsample[c] == 0) {
+ continue;
+ }
+
+ unsigned width = image->num_blocks_horizontal * image->hsample[c] * DCTSIZE;
+ unsigned height = image->num_blocks_vertical * image->vsample[c] * DCTSIZE;
+ image->pixel_data[c] = (uint8_t*)malloc(width * height);
+ assert(image->pixel_data[c] != NULL);
+
+ fprintf(stderr, "Component %u: allocating %d x %d\n", c, width, height);
+ }