unsigned cn = component_num[c];
image->pixel_write_pointer[cn] += (image->vsample[cn] * DCTSIZE - 1) * image->stride[cn];
}
-
- // Some debug code.
- const int c = 1;
if (mcu_y == image->num_blocks_vertical) {
- unsigned stride = image->num_blocks_horizontal * image->hsample[c] * DCTSIZE;
- 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);
+ return;
}
}
}
break;
case 0xd9:
/* EOI */
- exit(0);
+ return;
case 0xc4:
/* DHT (define Huffman tables) */
read_huffman_tables(&tables, byte_source_input_func, &source);
struct jpeg_image jpeg;
read_jpeg(&jpeg, stdin);
+
+ // Some debug code.
+ const int c = 1;
+ unsigned stride = jpeg.num_blocks_horizontal * jpeg.hsample[c] * DCTSIZE;
+ unsigned height = jpeg.num_blocks_vertical * jpeg.vsample[c] * DCTSIZE;
+ printf("P5\n%u %u\n255\n", stride, height);
+ fwrite(jpeg.pixel_data[c], stride * height, 1, stdout);
}