16-bit lossless JPEG support
This commit is contained in:
43
djpeg.c
43
djpeg.c
@@ -662,7 +662,14 @@ main(int argc, char **argv)
|
||||
#endif
|
||||
#ifdef GIF_SUPPORTED
|
||||
case FMT_GIF:
|
||||
if (cinfo.data_precision == 12)
|
||||
if (cinfo.data_precision == 16) {
|
||||
#ifdef D_LOSSLESS_SUPPORTED
|
||||
dest_mgr = j16init_write_gif(&cinfo, TRUE);
|
||||
#else
|
||||
ERREXIT1(&cinfo, JERR_BAD_PRECISION, cinfo.data_precision);
|
||||
break;
|
||||
#endif
|
||||
} else if (cinfo.data_precision == 12)
|
||||
dest_mgr = j12init_write_gif(&cinfo, TRUE);
|
||||
else
|
||||
dest_mgr = jinit_write_gif(&cinfo, TRUE);
|
||||
@@ -673,7 +680,14 @@ main(int argc, char **argv)
|
||||
#endif
|
||||
#ifdef PPM_SUPPORTED
|
||||
case FMT_PPM:
|
||||
if (cinfo.data_precision == 12)
|
||||
if (cinfo.data_precision == 16) {
|
||||
#ifdef D_LOSSLESS_SUPPORTED
|
||||
dest_mgr = j16init_write_ppm(&cinfo);
|
||||
#else
|
||||
ERREXIT1(&cinfo, JERR_BAD_PRECISION, cinfo.data_precision);
|
||||
break;
|
||||
#endif
|
||||
} else if (cinfo.data_precision == 12)
|
||||
dest_mgr = j12init_write_ppm(&cinfo);
|
||||
else
|
||||
dest_mgr = jinit_write_ppm(&cinfo);
|
||||
@@ -715,7 +729,9 @@ main(int argc, char **argv)
|
||||
(*dest_mgr->start_output) (&cinfo, dest_mgr);
|
||||
cinfo.output_height = tmp;
|
||||
|
||||
if (cinfo.data_precision == 12) {
|
||||
if (cinfo.data_precision == 16)
|
||||
ERREXIT(&cinfo, JERR_NOTIMPL);
|
||||
else if (cinfo.data_precision == 12) {
|
||||
/* Process data */
|
||||
while (cinfo.output_scanline < skip_start) {
|
||||
num_scanlines = jpeg12_read_scanlines(&cinfo, dest_mgr->buffer12,
|
||||
@@ -767,7 +783,9 @@ main(int argc, char **argv)
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (cinfo.data_precision == 12)
|
||||
if (cinfo.data_precision == 16)
|
||||
ERREXIT(&cinfo, JERR_NOTIMPL);
|
||||
else if (cinfo.data_precision == 12)
|
||||
jpeg12_crop_scanline(&cinfo, &crop_x, &crop_width);
|
||||
else
|
||||
jpeg_crop_scanline(&cinfo, &crop_x, &crop_width);
|
||||
@@ -784,7 +802,9 @@ main(int argc, char **argv)
|
||||
(*dest_mgr->start_output) (&cinfo, dest_mgr);
|
||||
cinfo.output_height = tmp;
|
||||
|
||||
if (cinfo.data_precision == 12) {
|
||||
if (cinfo.data_precision == 16)
|
||||
ERREXIT(&cinfo, JERR_NOTIMPL);
|
||||
else if (cinfo.data_precision == 12) {
|
||||
/* Process data */
|
||||
if ((tmp = jpeg12_skip_scanlines(&cinfo, crop_y)) != crop_y) {
|
||||
fprintf(stderr, "%s: jpeg12_skip_scanlines() returned %u rather than %u\n",
|
||||
@@ -831,7 +851,18 @@ main(int argc, char **argv)
|
||||
/* Write output file header */
|
||||
(*dest_mgr->start_output) (&cinfo, dest_mgr);
|
||||
|
||||
if (cinfo.data_precision == 12) {
|
||||
if (cinfo.data_precision == 16) {
|
||||
#ifdef D_LOSSLESS_SUPPORTED
|
||||
/* Process data */
|
||||
while (cinfo.output_scanline < cinfo.output_height) {
|
||||
num_scanlines = jpeg16_read_scanlines(&cinfo, dest_mgr->buffer16,
|
||||
dest_mgr->buffer_height);
|
||||
(*dest_mgr->put_pixel_rows) (&cinfo, dest_mgr, num_scanlines);
|
||||
}
|
||||
#else
|
||||
ERREXIT1(&cinfo, JERR_BAD_PRECISION, cinfo.data_precision);
|
||||
#endif
|
||||
} else if (cinfo.data_precision == 12) {
|
||||
/* Process data */
|
||||
while (cinfo.output_scanline < cinfo.output_height) {
|
||||
num_scanlines = jpeg12_read_scanlines(&cinfo, dest_mgr->buffer12,
|
||||
|
||||
Reference in New Issue
Block a user