OLD | NEW |
1 /* | 1 /* |
2 * jcomapi.c | 2 * jcomapi.c |
3 * | 3 * |
| 4 * This file was part of the Independent JPEG Group's software: |
4 * Copyright (C) 1994-1997, Thomas G. Lane. | 5 * Copyright (C) 1994-1997, Thomas G. Lane. |
5 * This file is part of the Independent JPEG Group's software. | 6 * It was modified by The libjpeg-turbo Project to include only code relevant |
6 * For conditions of distribution and use, see the accompanying README file. | 7 * to libjpeg-turbo. |
| 8 * For conditions of distribution and use, see the accompanying README.ijg |
| 9 * file. |
7 * | 10 * |
8 * This file contains application interface routines that are used for both | 11 * This file contains application interface routines that are used for both |
9 * compression and decompression. | 12 * compression and decompression. |
10 */ | 13 */ |
11 | 14 |
12 #define JPEG_INTERNALS | 15 #define JPEG_INTERNALS |
13 #include "jinclude.h" | 16 #include "jinclude.h" |
14 #include "jpeglib.h" | 17 #include "jpeglib.h" |
15 | 18 |
16 | 19 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 * responsibility. | 68 * responsibility. |
66 */ | 69 */ |
67 | 70 |
68 GLOBAL(void) | 71 GLOBAL(void) |
69 jpeg_destroy (j_common_ptr cinfo) | 72 jpeg_destroy (j_common_ptr cinfo) |
70 { | 73 { |
71 /* We need only tell the memory manager to release everything. */ | 74 /* We need only tell the memory manager to release everything. */ |
72 /* NB: mem pointer is NULL if memory mgr failed to initialize. */ | 75 /* NB: mem pointer is NULL if memory mgr failed to initialize. */ |
73 if (cinfo->mem != NULL) | 76 if (cinfo->mem != NULL) |
74 (*cinfo->mem->self_destruct) (cinfo); | 77 (*cinfo->mem->self_destruct) (cinfo); |
75 cinfo->mem = NULL;» » /* be safe if jpeg_destroy is called twice */ | 78 cinfo->mem = NULL; /* be safe if jpeg_destroy is called twice */ |
76 cinfo->global_state = 0;» /* mark it destroyed */ | 79 cinfo->global_state = 0; /* mark it destroyed */ |
77 } | 80 } |
78 | 81 |
79 | 82 |
80 /* | 83 /* |
81 * Convenience routines for allocating quantization and Huffman tables. | 84 * Convenience routines for allocating quantization and Huffman tables. |
82 * (Would jutils.c be a more reasonable place to put these?) | 85 * (Would jutils.c be a more reasonable place to put these?) |
83 */ | 86 */ |
84 | 87 |
85 GLOBAL(JQUANT_TBL *) | 88 GLOBAL(JQUANT_TBL *) |
86 jpeg_alloc_quant_table (j_common_ptr cinfo) | 89 jpeg_alloc_quant_table (j_common_ptr cinfo) |
87 { | 90 { |
88 JQUANT_TBL *tbl; | 91 JQUANT_TBL *tbl; |
89 | 92 |
90 tbl = (JQUANT_TBL *) | 93 tbl = (JQUANT_TBL *) |
91 (*cinfo->mem->alloc_small) (cinfo, JPOOL_PERMANENT, SIZEOF(JQUANT_TBL)); | 94 (*cinfo->mem->alloc_small) (cinfo, JPOOL_PERMANENT, sizeof(JQUANT_TBL)); |
92 tbl->sent_table = FALSE;» /* make sure this is false in any new table */ | 95 tbl->sent_table = FALSE; /* make sure this is false in any new table */ |
93 return tbl; | 96 return tbl; |
94 } | 97 } |
95 | 98 |
96 | 99 |
97 GLOBAL(JHUFF_TBL *) | 100 GLOBAL(JHUFF_TBL *) |
98 jpeg_alloc_huff_table (j_common_ptr cinfo) | 101 jpeg_alloc_huff_table (j_common_ptr cinfo) |
99 { | 102 { |
100 JHUFF_TBL *tbl; | 103 JHUFF_TBL *tbl; |
101 | 104 |
102 tbl = (JHUFF_TBL *) | 105 tbl = (JHUFF_TBL *) |
103 (*cinfo->mem->alloc_small) (cinfo, JPOOL_PERMANENT, SIZEOF(JHUFF_TBL)); | 106 (*cinfo->mem->alloc_small) (cinfo, JPOOL_PERMANENT, sizeof(JHUFF_TBL)); |
104 tbl->sent_table = FALSE;» /* make sure this is false in any new table */ | 107 tbl->sent_table = FALSE; /* make sure this is false in any new table */ |
105 return tbl; | 108 return tbl; |
106 } | 109 } |
OLD | NEW |