X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;ds=inline;f=images%2Fio-libjpeg.c;h=be394c95b393a9152fe300c60bd1adbdc9391e30;hb=1f05348cde42852d77da3457b96a33dff1600ca4;hp=2a39c9f93bd118aa5fc90cb3147764dda732d148;hpb=18d925e9069196dea2ca58e05ba0e5b4549fcd8b;p=libucw.git diff --git a/images/io-libjpeg.c b/images/io-libjpeg.c index 2a39c9f9..be394c95 100644 --- a/images/io-libjpeg.c +++ b/images/io-libjpeg.c @@ -94,6 +94,7 @@ libjpeg_fastbuf_read_prepare(struct libjpeg_read_internals *i) DBG("libjpeg_fb_read_prepare()"); byte *start; uns len = bdirect_read_prepare(i->fastbuf, &start); + DBG("readed %u bytes at %p", len, start); if (!len) { // XXX: maybe only generate a warning and return EOI markers to recover from such errors (also in skip_input_data) @@ -133,6 +134,7 @@ libjpeg_fill_input_buffer(j_decompress_ptr cinfo) DBG("libjpeg_fill_input_buffer()"); struct libjpeg_read_internals *i = (struct libjpeg_read_internals *)cinfo; libjpeg_fastbuf_read_commit(i); + libjpeg_fastbuf_read_prepare(i); return 1; } @@ -375,7 +377,11 @@ libjpeg_read_data(struct image_io *io) { case JCS_CMYK: read_flags = (read_flags & ~IMAGE_COLOR_SPACE & IMAGE_CHANNELS_FORMAT) | COLOR_SPACE_CMYK; - i->cinfo.out_color_space = JCS_YCbCr; + i->cinfo.out_color_space = JCS_CMYK; + break; + case JCS_YCCK: + read_flags = (read_flags & ~IMAGE_COLOR_SPACE & IMAGE_CHANNELS_FORMAT) | COLOR_SPACE_YCCK; + i->cinfo.out_color_space = JCS_YCCK; break; default: read_flags = (read_flags & ~IMAGE_COLOR_SPACE & IMAGE_CHANNELS_FORMAT) | COLOR_SPACE_RGB; @@ -537,6 +543,7 @@ libjpeg_write(struct image_io *io) } i.cinfo.input_components = color_space_channels[img->flags & IMAGE_COLOR_SPACE]; jpeg_set_defaults(&i.cinfo); + jpeg_set_colorspace(&i.cinfo, i.cinfo.in_color_space); if (io->jpeg_quality) jpeg_set_quality(&i.cinfo, MIN(io->jpeg_quality, 100), 1); if (io->exif_size)