| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
#include "cdjpeg.h" |
|---|
| 15 |
#include "transupp.h" |
|---|
| 16 |
#include "jversion.h" |
|---|
| 17 |
|
|---|
| 18 |
#ifdef USE_CCOMMAND |
|---|
| 19 |
#ifdef __MWERKS__ |
|---|
| 20 |
#include <SIOUX.h> |
|---|
| 21 |
#include <console.h> |
|---|
| 22 |
#endif |
|---|
| 23 |
#ifdef THINK_C |
|---|
| 24 |
#include <console.h> |
|---|
| 25 |
#endif |
|---|
| 26 |
#endif |
|---|
| 27 |
|
|---|
| 28 |
|
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 |
|
|---|
| 32 |
|
|---|
| 33 |
|
|---|
| 34 |
|
|---|
| 35 |
|
|---|
| 36 |
|
|---|
| 37 |
|
|---|
| 38 |
static const char * progname; |
|---|
| 39 |
static char * outfilename; |
|---|
| 40 |
static JCOPY_OPTION copyoption; |
|---|
| 41 |
static jpeg_transform_info transformoption; |
|---|
| 42 |
|
|---|
| 43 |
|
|---|
| 44 |
LOCAL(void) |
|---|
| 45 |
usage (void) |
|---|
| 46 |
|
|---|
| 47 |
{ |
|---|
| 48 |
fprintf(stderr, "usage: %s [switches] ", progname); |
|---|
| 49 |
#ifdef TWO_FILE_COMMANDLINE |
|---|
| 50 |
fprintf(stderr, "inputfile outputfile\n"); |
|---|
| 51 |
#else |
|---|
| 52 |
fprintf(stderr, "[inputfile]\n"); |
|---|
| 53 |
#endif |
|---|
| 54 |
|
|---|
| 55 |
fprintf(stderr, "Switches (names may be abbreviated):\n"); |
|---|
| 56 |
fprintf(stderr, " -copy none Copy no extra markers from source file\n"); |
|---|
| 57 |
fprintf(stderr, " -copy comments Copy only comment markers (default)\n"); |
|---|
| 58 |
fprintf(stderr, " -copy all Copy all extra markers\n"); |
|---|
| 59 |
#ifdef ENTROPY_OPT_SUPPORTED |
|---|
| 60 |
fprintf(stderr, " -optimize Optimize Huffman table (smaller file, but slow compression)\n"); |
|---|
| 61 |
#endif |
|---|
| 62 |
#ifdef C_PROGRESSIVE_SUPPORTED |
|---|
| 63 |
fprintf(stderr, " -progressive Create progressive JPEG file\n"); |
|---|
| 64 |
#endif |
|---|
| 65 |
#if TRANSFORMS_SUPPORTED |
|---|
| 66 |
fprintf(stderr, "Switches for modifying the image:\n"); |
|---|
| 67 |
fprintf(stderr, " -grayscale Reduce to grayscale (omit color data)\n"); |
|---|
| 68 |
fprintf(stderr, " -flip [horizontal|vertical] Mirror image (left-right or top-bottom)\n"); |
|---|
| 69 |
fprintf(stderr, " -rotate [90|180|270] Rotate image (degrees clockwise)\n"); |
|---|
| 70 |
fprintf(stderr, " -transpose Transpose image\n"); |
|---|
| 71 |
fprintf(stderr, " -transverse Transverse transpose image\n"); |
|---|
| 72 |
fprintf(stderr, " -trim Drop non-transformable edge blocks\n"); |
|---|
| 73 |
#endif |
|---|
| 74 |
fprintf(stderr, "Switches for advanced users:\n"); |
|---|
| 75 |
fprintf(stderr, " -restart N Set restart interval in rows, or in blocks with B\n"); |
|---|
| 76 |
fprintf(stderr, " -maxmemory N Maximum memory to use (in kbytes)\n"); |
|---|
| 77 |
fprintf(stderr, " -outfile name Specify name for output file\n"); |
|---|
| 78 |
fprintf(stderr, " -verbose or -debug Emit debug output\n"); |
|---|
| 79 |
fprintf(stderr, "Switches for wizards:\n"); |
|---|
| 80 |
#ifdef C_ARITH_CODING_SUPPORTED |
|---|
| 81 |
fprintf(stderr, " -arithmetic Use arithmetic coding\n"); |
|---|
| 82 |
#endif |
|---|
| 83 |
#ifdef C_MULTISCAN_FILES_SUPPORTED |
|---|
| 84 |
fprintf(stderr, " -scans file Create multi-scan JPEG per script file\n"); |
|---|
| 85 |
#endif |
|---|
| 86 |
exit(EXIT_FAILURE); |
|---|
| 87 |
} |
|---|
| 88 |
|
|---|
| 89 |
|
|---|
| 90 |
LOCAL(void) |
|---|
| 91 |
select_transform (JXFORM_CODE transform) |
|---|
| 92 |
|
|---|
| 93 |
|
|---|
| 94 |
|
|---|
| 95 |
{ |
|---|
| 96 |
#if TRANSFORMS_SUPPORTED |
|---|
| 97 |
if (transformoption.transform == JXFORM_NONE || |
|---|
| 98 |
transformoption.transform == transform) { |
|---|
| 99 |
transformoption.transform = transform; |
|---|
| 100 |
} else { |
|---|
| 101 |
fprintf(stderr, "%s: can only do one image transformation at a time\n", |
|---|
| 102 |
progname); |
|---|
| 103 |
usage(); |
|---|
| 104 |
} |
|---|
| 105 |
#else |
|---|
| 106 |
fprintf(stderr, "%s: sorry, image transformation was not compiled\n", |
|---|
| 107 |
progname); |
|---|
| 108 |
exit(EXIT_FAILURE); |
|---|
| 109 |
#endif |
|---|
| 110 |
} |
|---|
| 111 |
|
|---|
| 112 |
|
|---|
| 113 |
LOCAL(int) |
|---|
| 114 |
parse_switches (j_compress_ptr cinfo, int argc, char **argv, |
|---|
| 115 |
int last_file_arg_seen, boolean for_real) |
|---|
| 116 |
|
|---|
| 117 |
|
|---|
| 118 |
|
|---|
| 119 |
|
|---|
| 120 |
|
|---|
| 121 |
|
|---|
| 122 |
|
|---|
| 123 |
|
|---|
| 124 |
{ |
|---|
| 125 |
int argn; |
|---|
| 126 |
char * arg; |
|---|
| 127 |
boolean simple_progressive; |
|---|
| 128 |
char * scansarg = NULL; |
|---|
| 129 |
|
|---|
| 130 |
|
|---|
| 131 |
simple_progressive = FALSE; |
|---|
| 132 |
outfilename = NULL; |
|---|
| 133 |
copyoption = JCOPYOPT_DEFAULT; |
|---|
| 134 |
transformoption.transform = JXFORM_NONE; |
|---|
| 135 |
transformoption.trim = FALSE; |
|---|
| 136 |
transformoption.force_grayscale = FALSE; |
|---|
| 137 |
cinfo->err->trace_level = 0; |
|---|
| 138 |
|
|---|
| 139 |
|
|---|
| 140 |
|
|---|
| 141 |
for (argn = 1; argn < argc; argn++) { |
|---|
| 142 |
arg = argv[argn]; |
|---|
| 143 |
if (*arg != '-') { |
|---|
| 144 |
|
|---|
| 145 |
if (argn <= last_file_arg_seen) { |
|---|
| 146 |
outfilename = NULL; |
|---|
| 147 |
continue; |
|---|
| 148 |
} |
|---|
| 149 |
break; |
|---|
| 150 |
} |
|---|
| 151 |
arg++; |
|---|
| 152 |
|
|---|
| 153 |
if (keymatch(arg, "arithmetic", 1)) { |
|---|
| 154 |
|
|---|
| 155 |
#ifdef C_ARITH_CODING_SUPPORTED |
|---|
| 156 |
cinfo->arith_code = TRUE; |
|---|
| 157 |
#else |
|---|
| 158 |
fprintf(stderr, "%s: sorry, arithmetic coding not supported\n", |
|---|
| 159 |
progname); |
|---|
| 160 |
exit(EXIT_FAILURE); |
|---|
| 161 |
#endif |
|---|
| 162 |
|
|---|
| 163 |
} else if (keymatch(arg, "copy", 1)) { |
|---|
| 164 |
|
|---|
| 165 |
if (++argn >= argc) |
|---|
| 166 |
usage(); |
|---|
| 167 |
if (keymatch(argv[argn], "none", 1)) { |
|---|
| 168 |
copyoption = JCOPYOPT_NONE; |
|---|
| 169 |
} else if (keymatch(argv[argn], "comments", 1)) { |
|---|
| 170 |
copyoption = JCOPYOPT_COMMENTS; |
|---|
| 171 |
} else if (keymatch(argv[argn], "all", 1)) { |
|---|
| 172 |
copyoption = JCOPYOPT_ALL; |
|---|
| 173 |
} else |
|---|
| 174 |
usage(); |
|---|
| 175 |
|
|---|
| 176 |
} else if (keymatch(arg, "debug", 1) || keymatch(arg, "verbose", 1)) { |
|---|
| 177 |
|
|---|
| 178 |
|
|---|
| 179 |
static boolean printed_version = FALSE; |
|---|
| 180 |
|
|---|
| 181 |
if (! printed_version) { |
|---|
| 182 |
fprintf(stderr, "Independent JPEG Group's JPEGTRAN, version %s\n%s\n", |
|---|
| 183 |
JVERSION, JCOPYRIGHT); |
|---|
| 184 |
printed_version = TRUE; |
|---|
| 185 |
} |
|---|
| 186 |
cinfo->err->trace_level++; |
|---|
| 187 |
|
|---|
| 188 |
} else if (keymatch(arg, "flip", 1)) { |
|---|
| 189 |
|
|---|
| 190 |
if (++argn >= argc) |
|---|
| 191 |
usage(); |
|---|
| 192 |
if (keymatch(argv[argn], "horizontal", 1)) |
|---|
| 193 |
select_transform(JXFORM_FLIP_H); |
|---|
| 194 |
else if (keymatch(argv[argn], "vertical", 1)) |
|---|
| 195 |
select_transform(JXFORM_FLIP_V); |
|---|
| 196 |
else |
|---|
| 197 |
usage(); |
|---|
| 198 |
|
|---|
| 199 |
} else if (keymatch(arg, "grayscale", 1) || keymatch(arg, "greyscale",1)) { |
|---|
| 200 |
|
|---|
| 201 |
#if TRANSFORMS_SUPPORTED |
|---|
| 202 |
transformoption.force_grayscale = TRUE; |
|---|
| 203 |
#else |
|---|
| 204 |
select_transform(JXFORM_NONE); |
|---|
| 205 |
#endif |
|---|
| 206 |
|
|---|
| 207 |
} else if (keymatch(arg, "maxmemory", 3)) { |
|---|
| 208 |
|
|---|
| 209 |
long lval; |
|---|
| 210 |
char ch = 'x'; |
|---|
| 211 |
|
|---|
| 212 |
if (++argn >= argc) |
|---|
| 213 |
usage(); |
|---|
| 214 |
if (sscanf(argv[argn], "%ld%c", &lval, &ch) < 1) |
|---|
| 215 |
usage(); |
|---|
| 216 |
if (ch == 'm' || ch == 'M') |
|---|
| 217 |
lval *= 1000L; |
|---|
| 218 |
cinfo->mem->max_memory_to_use = lval * 1000L; |
|---|
| 219 |
|
|---|
| 220 |
} else if (keymatch(arg, "optimize", 1) || keymatch(arg, "optimise", 1)) { |
|---|
| 221 |
|
|---|
| 222 |
#ifdef ENTROPY_OPT_SUPPORTED |
|---|
| 223 |
cinfo->optimize_coding = TRUE; |
|---|
| 224 |
#else |
|---|
| 225 |
fprintf(stderr, "%s: sorry, entropy optimization was not compiled\n", |
|---|
| 226 |
progname); |
|---|
| 227 |
exit(EXIT_FAILURE); |
|---|
| 228 |
#endif |
|---|
| 229 |
|
|---|
| 230 |
} else if (keymatch(arg, "outfile", 4)) { |
|---|
| 231 |
|
|---|
| 232 |
if (++argn >= argc) |
|---|
| 233 |
usage(); |
|---|
| 234 |
outfilename = argv[argn]; |
|---|
| 235 |
|
|---|
| 236 |
} else if (keymatch(arg, "progressive", 1)) { |
|---|
| 237 |
|
|---|
| 238 |
#ifdef C_PROGRESSIVE_SUPPORTED |
|---|
| 239 |
simple_progressive = TRUE; |
|---|
| 240 |
|
|---|
| 241 |
#else |
|---|
| 242 |
fprintf(stderr, "%s: sorry, progressive output was not compiled\n", |
|---|
| 243 |
progname); |
|---|
| 244 |
exit(EXIT_FAILURE); |
|---|
| 245 |
#endif |
|---|
| 246 |
|
|---|
| 247 |
} else if (keymatch(arg, "restart", 1)) { |
|---|
| 248 |
|
|---|
| 249 |
long lval; |
|---|
| 250 |
char ch = 'x'; |
|---|
| 251 |
|
|---|
| 252 |
if (++argn >= argc) |
|---|
| 253 |
usage(); |
|---|
| 254 |
if (sscanf(argv[argn], "%ld%c", &lval, &ch) < 1) |
|---|
| 255 |
usage(); |
|---|
| 256 |
if (lval < 0 || lval > 65535L) |
|---|
| 257 |
usage(); |
|---|
| 258 |
if (ch == 'b' || ch == 'B') { |
|---|
| 259 |
cinfo->restart_interval = (unsigned int) lval; |
|---|
| 260 |
cinfo->restart_in_rows = 0; |
|---|
| 261 |
} else { |
|---|
| 262 |
cinfo->restart_in_rows = (int) lval; |
|---|
| 263 |
|
|---|
| 264 |
} |
|---|
| 265 |
|
|---|
| 266 |
} else if (keymatch(arg, "rotate", 2)) { |
|---|
| 267 |
|
|---|
| 268 |
if (++argn >= argc) |
|---|
| 269 |
usage(); |
|---|
| 270 |
if (keymatch(argv[argn], "90", 2)) |
|---|
| 271 |
select_transform(JXFORM_ROT_90); |
|---|
| 272 |
else if (keymatch(argv[argn], "180", 3)) |
|---|
| 273 |
select_transform(JXFORM_ROT_180); |
|---|
| 274 |
else if (keymatch(argv[argn], "270", 3)) |
|---|
| 275 |
select_transform(JXFORM_ROT_270); |
|---|
| 276 |
else |
|---|
| 277 |
usage(); |
|---|
| 278 |
|
|---|
| 279 |
} else if (keymatch(arg, "scans", 1)) { |
|---|
| 280 |
|
|---|
| 281 |
#ifdef C_MULTISCAN_FILES_SUPPORTED |
|---|
| 282 |
if (++argn >= argc) |
|---|
| 283 |
usage(); |
|---|
| 284 |
scansarg = argv[argn]; |
|---|
| 285 |
|
|---|
| 286 |
#else |
|---|
| 287 |
fprintf(stderr, "%s: sorry, multi-scan output was not compiled\n", |
|---|
| 288 |
progname); |
|---|
| 289 |
exit(EXIT_FAILURE); |
|---|
| 290 |
#endif |
|---|
| 291 |
|
|---|
| 292 |
} else if (keymatch(arg, "transpose", 1)) { |
|---|
| 293 |
|
|---|
| 294 |
select_transform(JXFORM_TRANSPOSE); |
|---|
| 295 |
|
|---|
| 296 |
} else if (keymatch(arg, "transverse", 6)) { |
|---|
| 297 |
|
|---|
| 298 |
select_transform(JXFORM_TRANSVERSE); |
|---|
| 299 |
|
|---|
| 300 |
} else if (keymatch(arg, "trim", 3)) { |
|---|
| 301 |
|
|---|
| 302 |
transformoption.trim = TRUE; |
|---|
| 303 |
|
|---|
| 304 |
} else { |
|---|
| 305 |
usage(); |
|---|
| 306 |
} |
|---|
| 307 |
} |
|---|
| 308 |
|
|---|
| 309 |
|
|---|
| 310 |
|
|---|
| 311 |
if (for_real) { |
|---|
| 312 |
|
|---|
| 313 |
#ifdef C_PROGRESSIVE_SUPPORTED |
|---|
| 314 |
if (simple_progressive) |
|---|
| 315 |
jpeg_simple_progression(cinfo); |
|---|
| 316 |
#endif |
|---|
| 317 |
|
|---|
| 318 |
#ifdef C_MULTISCAN_FILES_SUPPORTED |
|---|
| 319 |
if (scansarg != NULL) |
|---|
| 320 |
if (! read_scan_script(cinfo, scansarg)) |
|---|
| 321 |
usage(); |
|---|
| 322 |
#endif |
|---|
| 323 |
} |
|---|
| 324 |
|
|---|
| 325 |
return argn; |
|---|
| 326 |
} |
|---|
| 327 |
|
|---|
| 328 |
|
|---|
| 329 |
|
|---|
| 330 |
|
|---|
| 331 |
|
|---|
| 332 |
|
|---|
| 333 |
int |
|---|
| 334 |
main (int argc, char **argv) |
|---|
| 335 |
{ |
|---|
| 336 |
struct jpeg_decompress_struct srcinfo; |
|---|
| 337 |
struct jpeg_compress_struct dstinfo; |
|---|
| 338 |
struct jpeg_error_mgr jsrcerr, jdsterr; |
|---|
| 339 |
#ifdef PROGRESS_REPORT |
|---|
| 340 |
struct cdjpeg_progress_mgr progress; |
|---|
| 341 |
#endif |
|---|
| 342 |
jvirt_barray_ptr * src_coef_arrays; |
|---|
| 343 |
jvirt_barray_ptr * dst_coef_arrays; |
|---|
| 344 |
int file_index; |
|---|
| 345 |
FILE * input_file; |
|---|
| 346 |
FILE * output_file; |
|---|
| 347 |
|
|---|
| 348 |
|
|---|
| 349 |
#ifdef USE_CCOMMAND |
|---|
| 350 |
argc = ccommand(&argv); |
|---|
| 351 |
#endif |
|---|
| 352 |
|
|---|
| 353 |
progname = argv[0]; |
|---|
| 354 |
if (progname == NULL || progname[0] == 0) |
|---|
| 355 |
progname = "jpegtran"; |
|---|
| 356 |
|
|---|
| 357 |
|
|---|
| 358 |
srcinfo.err = jpeg_std_error(&jsrcerr); |
|---|
| 359 |
jpeg_create_decompress(&srcinfo); |
|---|
| 360 |
|
|---|
| 361 |
dstinfo.err = jpeg_std_error(&jdsterr); |
|---|
| 362 |
jpeg_create_compress(&dstinfo); |
|---|
| 363 |
|
|---|
| 364 |
|
|---|
| 365 |
|
|---|
| 366 |
|
|---|
| 367 |
#ifdef NEED_SIGNAL_CATCHER |
|---|
| 368 |
enable_signal_catcher((j_common_ptr) &srcinfo); |
|---|
| 369 |
#endif |
|---|
| 370 |
|
|---|
| 371 |
|
|---|
| 372 |
|
|---|
| 373 |
|
|---|
| 374 |
|
|---|
| 375 |
|
|---|
| 376 |
|
|---|
| 377 |
|
|---|
| 378 |
|
|---|
| 379 |
file_index = parse_switches(&dstinfo, argc, argv, 0, FALSE); |
|---|
| 380 |
jsrcerr.trace_level = jdsterr.trace_level; |
|---|
| 381 |
srcinfo.mem->max_memory_to_use = dstinfo.mem->max_memory_to_use; |
|---|
| 382 |
|
|---|
| 383 |
#ifdef TWO_FILE_COMMANDLINE |
|---|
| 384 |
|
|---|
| 385 |
if (outfilename == NULL) { |
|---|
| 386 |
if (file_index != argc-2) { |
|---|
| 387 |
fprintf(stderr, "%s: must name one input and one output file\n", |
|---|
| 388 |
progname); |
|---|
| 389 |
usage(); |
|---|
| 390 |
} |
|---|
| 391 |
outfilename = argv[file_index+1]; |
|---|
| 392 |
} else { |
|---|
| 393 |
if (file_index != argc-1) { |
|---|
| 394 |
fprintf(stderr, "%s: must name one input and one output file\n", |
|---|
| 395 |
progname); |
|---|
| 396 |
usage(); |
|---|
| 397 |
} |
|---|
| 398 |
} |
|---|
| 399 |
#else |
|---|
| 400 |
|
|---|
| 401 |
if (file_index < argc-1) { |
|---|
| 402 |
fprintf(stderr, "%s: only one input file\n", progname); |
|---|
| 403 |
usage(); |
|---|
| 404 |
} |
|---|
| 405 |
#endif |
|---|
| 406 |
|
|---|
| 407 |
|
|---|
| 408 |
if (file_index < argc) { |
|---|
| 409 |
if ((input_file = fopen(argv[file_index], READ_BINARY)) == NULL) { |
|---|
| 410 |
fprintf(stderr, "%s: can't open %s\n", progname, argv[file_index]); |
|---|
| 411 |
exit(EXIT_FAILURE); |
|---|
| 412 |
} |
|---|
| 413 |
} else { |
|---|
| 414 |
|
|---|
| 415 |
input_file = read_stdin(); |
|---|
| 416 |
} |
|---|
| 417 |
|
|---|
| 418 |
|
|---|
| 419 |
if (outfilename != NULL) { |
|---|
| 420 |
if ((output_file = fopen(outfilename, WRITE_BINARY)) == NULL) { |
|---|
| 421 |
fprintf(stderr, "%s: can't open %s\n", progname, outfilename); |
|---|
| 422 |
exit(EXIT_FAILURE); |
|---|
| 423 |
} |
|---|
| 424 |
} else { |
|---|
| 425 |
|
|---|
| 426 |
output_file = write_stdout(); |
|---|
| 427 |
} |
|---|
| 428 |
|
|---|
| 429 |
#ifdef PROGRESS_REPORT |
|---|
| 430 |
start_progress_monitor((j_common_ptr) &dstinfo, &progress); |
|---|
| 431 |
#endif |
|---|
| 432 |
|
|---|
| 433 |
|
|---|
| 434 |
jpeg_stdio_src(&srcinfo, input_file); |
|---|
| 435 |
|
|---|
| 436 |
|
|---|
| 437 |
jcopy_markers_setup(&srcinfo, copyoption); |
|---|
| 438 |
|
|---|
| 439 |
|
|---|
| 440 |
(void) jpeg_read_header(&srcinfo, TRUE); |
|---|
| 441 |
|
|---|
| 442 |
|
|---|
| 443 |
|
|---|
| 444 |
|
|---|
| 445 |
#if TRANSFORMS_SUPPORTED |
|---|
| 446 |
jtransform_request_workspace(&srcinfo, &transformoption); |
|---|
| 447 |
#endif |
|---|
| 448 |
|
|---|
| 449 |
|
|---|
| 450 |
src_coef_arrays = jpeg_read_coefficients(&srcinfo); |
|---|
| 451 |
|
|---|
| 452 |
|
|---|
| 453 |
jpeg_copy_critical_parameters(&srcinfo, &dstinfo); |
|---|
| 454 |
|
|---|
| 455 |
|
|---|
| 456 |
|
|---|
| 457 |
|
|---|
| 458 |
#if TRANSFORMS_SUPPORTED |
|---|
| 459 |
dst_coef_arrays = jtransform_adjust_parameters(&srcinfo, &dstinfo, |
|---|
| 460 |
src_coef_arrays, |
|---|
| 461 |
&transformoption); |
|---|
| 462 |
#else |
|---|
| 463 |
dst_coef_arrays = src_coef_arrays; |
|---|
| 464 |
#endif |
|---|
| 465 |
|
|---|
| 466 |
|
|---|
| 467 |
file_index = parse_switches(&dstinfo, argc, argv, 0, TRUE); |
|---|
| 468 |
|
|---|
| 469 |
|
|---|
| 470 |
jpeg_stdio_dest(&dstinfo, output_file); |
|---|
| 471 |
|
|---|
| 472 |
|
|---|
| 473 |
jpeg_write_coefficients(&dstinfo, dst_coef_arrays); |
|---|
| 474 |
|
|---|
| 475 |
|
|---|
| 476 |
jcopy_markers_execute(&srcinfo, &dstinfo, copyoption); |
|---|
| 477 |
|
|---|
| 478 |
|
|---|
| 479 |
#if TRANSFORMS_SUPPORTED |
|---|
| 480 |
jtransform_execute_transformation(&srcinfo, &dstinfo, |
|---|
| 481 |
src_coef_arrays, |
|---|
| 482 |
&transformoption); |
|---|
| 483 |
#endif |
|---|
| 484 |
|
|---|
| 485 |
|
|---|
| 486 |
jpeg_finish_compress(&dstinfo); |
|---|
| 487 |
jpeg_destroy_compress(&dstinfo); |
|---|
| 488 |
(void) jpeg_finish_decompress(&srcinfo); |
|---|
| 489 |
jpeg_destroy_decompress(&srcinfo); |
|---|
| 490 |
|
|---|
| 491 |
|
|---|
| 492 |
if (input_file != stdin) |
|---|
| 493 |
fclose(input_file); |
|---|
| 494 |
if (output_file != stdout) |
|---|
| 495 |
fclose(output_file); |
|---|
| 496 |
|
|---|
| 497 |
#ifdef PROGRESS_REPORT |
|---|
| 498 |
end_progress_monitor((j_common_ptr) &dstinfo); |
|---|
| 499 |
#endif |
|---|
| 500 |
|
|---|
| 501 |
|
|---|
| 502 |
exit(jsrcerr.num_warnings + jdsterr.num_warnings ?EXIT_WARNING:EXIT_SUCCESS); |
|---|
| 503 |
return 0; |
|---|
| 504 |
} |
|---|