31 #ifdef HAVE_UNSIGNED_CHAR 33 #define UCH(x) ((int) (x)) 35 #ifdef CHAR_IS_UNSIGNED 37 #define UCH(x) ((int) (x)) 40 #define UCH(x) ((int) (x) & 0xFF) 45 #define ReadOK(file,buffer,len) (JFREAD(file,buffer,len) == ((size_t) (len))) 71 register FILE *
infile = sinfo->pub.input_file;
74 if ((c = getc(infile)) == EOF)
75 ERREXIT(sinfo->cinfo, JERR_INPUT_EOF);
86 switch (mapentrysize) {
89 for (
i = 0;
i < cmaplen;
i++) {
97 for (
i = 0;
i < cmaplen;
i++) {
105 ERREXIT(sinfo->cinfo, JERR_BMP_BADCMAP);
131 image_ptr = (*
cinfo->mem->access_virt_sarray)
136 inptr = image_ptr[0];
160 image_ptr = (*
cinfo->mem->access_virt_sarray)
167 inptr = image_ptr[0];
170 outptr[2] = *inptr++;
171 outptr[1] = *inptr++;
172 outptr[0] = *inptr++;
199 if (progress != NULL) {
204 image_ptr = (*
cinfo->mem->access_virt_sarray)
207 out_ptr = image_ptr[0];
208 for (col = source->
row_width; col > 0; col--) {
215 if (progress != NULL)
232 return (*source->
pub.get_pixel_rows) (
cinfo, sinfo);
246 #define GET_2B(array,offset) ((unsigned int) UCH(array[offset]) + \ 247 (((unsigned int) UCH(array[offset+1])) << 8)) 248 #define GET_4B(array,offset) ((INT32) UCH(array[offset]) + \ 249 (((INT32) UCH(array[offset+1])) << 8) + \ 250 (((INT32) UCH(array[offset+2])) << 16) + \ 251 (((INT32) UCH(array[offset+3])) << 24)) 256 unsigned int biPlanes;
258 INT32 biXPelsPerMeter,biYPelsPerMeter;
260 int mapentrysize = 0;
267 if (
GET_2B(bmpfileheader,0) != 0x4D42)
278 if (headerSize < 12 || headerSize > 64)
283 switch ((
int) headerSize) {
288 biPlanes =
GET_2B(bmpinfoheader,8);
294 TRACEMS2(
cinfo, 1, JTRC_BMP_OS2_MAPPED, (
int) biWidth, (
int) biHeight);
297 TRACEMS2(
cinfo, 1, JTRC_BMP_OS2, (
int) biWidth, (
int) biHeight);
310 biWidth =
GET_4B(bmpinfoheader,4);
311 biHeight =
GET_4B(bmpinfoheader,8);
312 biPlanes =
GET_2B(bmpinfoheader,12);
314 biCompression =
GET_4B(bmpinfoheader,16);
315 biXPelsPerMeter =
GET_4B(bmpinfoheader,24);
316 biYPelsPerMeter =
GET_4B(bmpinfoheader,28);
317 biClrUsed =
GET_4B(bmpinfoheader,32);
323 TRACEMS2(
cinfo, 1, JTRC_BMP_MAPPED, (
int) biWidth, (
int) biHeight);
334 if (biCompression != 0)
337 if (biXPelsPerMeter > 0 && biYPelsPerMeter > 0) {
350 bPad = bfOffBits - (headerSize + 14);
353 if (mapentrysize > 0) {
356 else if (biClrUsed > 256)
365 bPad -= biClrUsed * mapentrysize;
371 while (--bPad >= 0) {
388 if (
cinfo->progress != NULL) {
425 bmp_source_ptr source;
struct _bmp_source_struct * bmp_source_ptr
struct jpeg_common_struct * j_common_ptr
start_input_bmp(j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
#define GETJSAMPLE(value)
#define ERREXIT(cinfo, code)
#define TRACEMS2(cinfo, lvl, code, p1, p2)
jinit_read_bmp(j_compress_ptr cinfo)
#define GET_2B(array, offset)
read_byte(bmp_source_ptr sinfo)
finish_input_bmp(j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
J_COLOR_SPACE in_color_space
jvirt_sarray_ptr whole_image
typedef void(PNGAPI *png_error_ptr) PNGARG((png_structp
struct jpeg_progress_mgr pub
struct _bmp_source_struct bmp_source_struct
get_24bit_row(j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
int completed_extra_passes
read_colormap(bmp_source_ptr sinfo, int cmaplen, int mapentrysize)
#define ReadOK(file, buffer, len)
struct cdjpeg_progress_mgr * cd_progress_ptr
preload_image(j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
struct cjpeg_source_struct pub
get_8bit_row(j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
#define GET_4B(array, offset)