OLD | NEW |
1 /* | 1 /* |
2 * jcapimin.c | 2 * jcapimin.c |
3 * | 3 * |
4 * Copyright (C) 1994-1998, Thomas G. Lane. | 4 * Copyright (C) 1994-1998, Thomas G. Lane. |
| 5 * Modified 2003-2010 by Guido Vollbeding. |
5 * This file is part of the Independent JPEG Group's software. | 6 * This file is part of the Independent JPEG Group's software. |
6 * For conditions of distribution and use, see the accompanying README file. | 7 * For conditions of distribution and use, see the accompanying README file. |
7 * | 8 * |
8 * This file contains application interface code for the compression half | 9 * This file contains application interface code for the compression half |
9 * of the JPEG library. These are the "minimum" API routines that may be | 10 * of the JPEG library. These are the "minimum" API routines that may be |
10 * needed in either the normal full-compression case or the transcoding-only | 11 * needed in either the normal full-compression case or the transcoding-only |
11 * case. | 12 * case. |
12 * | 13 * |
13 * Most of the routines intended to be called directly by an application | 14 * Most of the routines intended to be called directly by an application |
14 * are in this file or in jcapistd.c. But also see jcparam.c for | 15 * are in this file or in jcapistd.c. But also see jcparam.c for |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 | 57 |
57 /* Initialize a memory manager instance for this object */ | 58 /* Initialize a memory manager instance for this object */ |
58 jinit_memory_mgr((j_common_ptr) cinfo); | 59 jinit_memory_mgr((j_common_ptr) cinfo); |
59 | 60 |
60 /* Zero out pointers to permanent structures. */ | 61 /* Zero out pointers to permanent structures. */ |
61 cinfo->progress = NULL; | 62 cinfo->progress = NULL; |
62 cinfo->dest = NULL; | 63 cinfo->dest = NULL; |
63 | 64 |
64 cinfo->comp_info = NULL; | 65 cinfo->comp_info = NULL; |
65 | 66 |
66 for (i = 0; i < NUM_QUANT_TBLS; i++) | 67 for (i = 0; i < NUM_QUANT_TBLS; i++) { |
67 cinfo->quant_tbl_ptrs[i] = NULL; | 68 cinfo->quant_tbl_ptrs[i] = NULL; |
| 69 #if JPEG_LIB_VERSION >= 70 |
| 70 cinfo->q_scale_factor[i] = 100; |
| 71 #endif |
| 72 } |
68 | 73 |
69 for (i = 0; i < NUM_HUFF_TBLS; i++) { | 74 for (i = 0; i < NUM_HUFF_TBLS; i++) { |
70 cinfo->dc_huff_tbl_ptrs[i] = NULL; | 75 cinfo->dc_huff_tbl_ptrs[i] = NULL; |
71 cinfo->ac_huff_tbl_ptrs[i] = NULL; | 76 cinfo->ac_huff_tbl_ptrs[i] = NULL; |
72 } | 77 } |
73 | 78 |
| 79 #if JPEG_LIB_VERSION >= 80 |
| 80 /* Must do it here for emit_dqt in case jpeg_write_tables is used */ |
| 81 cinfo->block_size = DCTSIZE; |
| 82 cinfo->natural_order = jpeg_natural_order; |
| 83 cinfo->lim_Se = DCTSIZE2-1; |
| 84 #endif |
| 85 |
74 cinfo->script_space = NULL; | 86 cinfo->script_space = NULL; |
75 | 87 |
76 cinfo->input_gamma = 1.0; /* in case application forgets */ | 88 cinfo->input_gamma = 1.0; /* in case application forgets */ |
77 | 89 |
78 /* OK, I'm ready */ | 90 /* OK, I'm ready */ |
79 cinfo->global_state = CSTATE_START; | 91 cinfo->global_state = CSTATE_START; |
80 } | 92 } |
81 | 93 |
82 | 94 |
83 /* | 95 /* |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 * writer. Some applications had a problem with that: they allocated space | 283 * writer. Some applications had a problem with that: they allocated space |
272 * of their own from the library memory manager, and didn't want it to go | 284 * of their own from the library memory manager, and didn't want it to go |
273 * away during write_tables. So now we do nothing. This will cause a | 285 * away during write_tables. So now we do nothing. This will cause a |
274 * memory leak if an app calls write_tables repeatedly without doing a full | 286 * memory leak if an app calls write_tables repeatedly without doing a full |
275 * compression cycle or otherwise resetting the JPEG object. However, that | 287 * compression cycle or otherwise resetting the JPEG object. However, that |
276 * seems less bad than unexpectedly freeing memory in the normal case. | 288 * seems less bad than unexpectedly freeing memory in the normal case. |
277 * An app that prefers the old behavior can call jpeg_abort for itself after | 289 * An app that prefers the old behavior can call jpeg_abort for itself after |
278 * each call to jpeg_write_tables(). | 290 * each call to jpeg_write_tables(). |
279 */ | 291 */ |
280 } | 292 } |
OLD | NEW |