diff options
author | David Walter Seikel | 2013-01-13 18:54:10 +1000 |
---|---|---|
committer | David Walter Seikel | 2013-01-13 18:54:10 +1000 |
commit | 959831f4ef5a3e797f576c3de08cd65032c997ad (patch) | |
tree | e7351908be5995f0b325b2ebeaa02d5a34b82583 /libraries/irrlicht-1.8/source/Irrlicht/jpeglib/jdtrans.c | |
parent | Add info about changes to Irrlicht. (diff) | |
download | SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.zip SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.gz SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.bz2 SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.xz |
Remove damned ancient DOS line endings from Irrlicht. Hopefully I did not go overboard.
Diffstat (limited to 'libraries/irrlicht-1.8/source/Irrlicht/jpeglib/jdtrans.c')
-rw-r--r-- | libraries/irrlicht-1.8/source/Irrlicht/jpeglib/jdtrans.c | 280 |
1 files changed, 140 insertions, 140 deletions
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/jpeglib/jdtrans.c b/libraries/irrlicht-1.8/source/Irrlicht/jpeglib/jdtrans.c index a51d69d..22dd47f 100644 --- a/libraries/irrlicht-1.8/source/Irrlicht/jpeglib/jdtrans.c +++ b/libraries/irrlicht-1.8/source/Irrlicht/jpeglib/jdtrans.c | |||
@@ -1,140 +1,140 @@ | |||
1 | /* | 1 | /* |
2 | * jdtrans.c | 2 | * jdtrans.c |
3 | * | 3 | * |
4 | * Copyright (C) 1995-1997, Thomas G. Lane. | 4 | * Copyright (C) 1995-1997, Thomas G. Lane. |
5 | * Modified 2000-2009 by Guido Vollbeding. | 5 | * Modified 2000-2009 by Guido Vollbeding. |
6 | * This file is part of the Independent JPEG Group's software. | 6 | * This file is part of the Independent JPEG Group's software. |
7 | * For conditions of distribution and use, see the accompanying README file. | 7 | * For conditions of distribution and use, see the accompanying README file. |
8 | * | 8 | * |
9 | * This file contains library routines for transcoding decompression, | 9 | * This file contains library routines for transcoding decompression, |
10 | * that is, reading raw DCT coefficient arrays from an input JPEG file. | 10 | * that is, reading raw DCT coefficient arrays from an input JPEG file. |
11 | * The routines in jdapimin.c will also be needed by a transcoder. | 11 | * The routines in jdapimin.c will also be needed by a transcoder. |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #define JPEG_INTERNALS | 14 | #define JPEG_INTERNALS |
15 | #include "jinclude.h" | 15 | #include "jinclude.h" |
16 | #include "jpeglib.h" | 16 | #include "jpeglib.h" |
17 | 17 | ||
18 | 18 | ||
19 | /* Forward declarations */ | 19 | /* Forward declarations */ |
20 | LOCAL(void) transdecode_master_selection JPP((j_decompress_ptr cinfo)); | 20 | LOCAL(void) transdecode_master_selection JPP((j_decompress_ptr cinfo)); |
21 | 21 | ||
22 | 22 | ||
23 | /* | 23 | /* |
24 | * Read the coefficient arrays from a JPEG file. | 24 | * Read the coefficient arrays from a JPEG file. |
25 | * jpeg_read_header must be completed before calling this. | 25 | * jpeg_read_header must be completed before calling this. |
26 | * | 26 | * |
27 | * The entire image is read into a set of virtual coefficient-block arrays, | 27 | * The entire image is read into a set of virtual coefficient-block arrays, |
28 | * one per component. The return value is a pointer to the array of | 28 | * one per component. The return value is a pointer to the array of |
29 | * virtual-array descriptors. These can be manipulated directly via the | 29 | * virtual-array descriptors. These can be manipulated directly via the |
30 | * JPEG memory manager, or handed off to jpeg_write_coefficients(). | 30 | * JPEG memory manager, or handed off to jpeg_write_coefficients(). |
31 | * To release the memory occupied by the virtual arrays, call | 31 | * To release the memory occupied by the virtual arrays, call |
32 | * jpeg_finish_decompress() when done with the data. | 32 | * jpeg_finish_decompress() when done with the data. |
33 | * | 33 | * |
34 | * An alternative usage is to simply obtain access to the coefficient arrays | 34 | * An alternative usage is to simply obtain access to the coefficient arrays |
35 | * during a buffered-image-mode decompression operation. This is allowed | 35 | * during a buffered-image-mode decompression operation. This is allowed |
36 | * after any jpeg_finish_output() call. The arrays can be accessed until | 36 | * after any jpeg_finish_output() call. The arrays can be accessed until |
37 | * jpeg_finish_decompress() is called. (Note that any call to the library | 37 | * jpeg_finish_decompress() is called. (Note that any call to the library |
38 | * may reposition the arrays, so don't rely on access_virt_barray() results | 38 | * may reposition the arrays, so don't rely on access_virt_barray() results |
39 | * to stay valid across library calls.) | 39 | * to stay valid across library calls.) |
40 | * | 40 | * |
41 | * Returns NULL if suspended. This case need be checked only if | 41 | * Returns NULL if suspended. This case need be checked only if |
42 | * a suspending data source is used. | 42 | * a suspending data source is used. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | GLOBAL(jvirt_barray_ptr *) | 45 | GLOBAL(jvirt_barray_ptr *) |
46 | jpeg_read_coefficients (j_decompress_ptr cinfo) | 46 | jpeg_read_coefficients (j_decompress_ptr cinfo) |
47 | { | 47 | { |
48 | if (cinfo->global_state == DSTATE_READY) { | 48 | if (cinfo->global_state == DSTATE_READY) { |
49 | /* First call: initialize active modules */ | 49 | /* First call: initialize active modules */ |
50 | transdecode_master_selection(cinfo); | 50 | transdecode_master_selection(cinfo); |
51 | cinfo->global_state = DSTATE_RDCOEFS; | 51 | cinfo->global_state = DSTATE_RDCOEFS; |
52 | } | 52 | } |
53 | if (cinfo->global_state == DSTATE_RDCOEFS) { | 53 | if (cinfo->global_state == DSTATE_RDCOEFS) { |
54 | /* Absorb whole file into the coef buffer */ | 54 | /* Absorb whole file into the coef buffer */ |
55 | for (;;) { | 55 | for (;;) { |
56 | int retcode; | 56 | int retcode; |
57 | /* Call progress monitor hook if present */ | 57 | /* Call progress monitor hook if present */ |
58 | if (cinfo->progress != NULL) | 58 | if (cinfo->progress != NULL) |
59 | (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo); | 59 | (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo); |
60 | /* Absorb some more input */ | 60 | /* Absorb some more input */ |
61 | retcode = (*cinfo->inputctl->consume_input) (cinfo); | 61 | retcode = (*cinfo->inputctl->consume_input) (cinfo); |
62 | if (retcode == JPEG_SUSPENDED) | 62 | if (retcode == JPEG_SUSPENDED) |
63 | return NULL; | 63 | return NULL; |
64 | if (retcode == JPEG_REACHED_EOI) | 64 | if (retcode == JPEG_REACHED_EOI) |
65 | break; | 65 | break; |
66 | /* Advance progress counter if appropriate */ | 66 | /* Advance progress counter if appropriate */ |
67 | if (cinfo->progress != NULL && | 67 | if (cinfo->progress != NULL && |
68 | (retcode == JPEG_ROW_COMPLETED || retcode == JPEG_REACHED_SOS)) { | 68 | (retcode == JPEG_ROW_COMPLETED || retcode == JPEG_REACHED_SOS)) { |
69 | if (++cinfo->progress->pass_counter >= cinfo->progress->pass_limit) { | 69 | if (++cinfo->progress->pass_counter >= cinfo->progress->pass_limit) { |
70 | /* startup underestimated number of scans; ratchet up one scan */ | 70 | /* startup underestimated number of scans; ratchet up one scan */ |
71 | cinfo->progress->pass_limit += (long) cinfo->total_iMCU_rows; | 71 | cinfo->progress->pass_limit += (long) cinfo->total_iMCU_rows; |
72 | } | 72 | } |
73 | } | 73 | } |
74 | } | 74 | } |
75 | /* Set state so that jpeg_finish_decompress does the right thing */ | 75 | /* Set state so that jpeg_finish_decompress does the right thing */ |
76 | cinfo->global_state = DSTATE_STOPPING; | 76 | cinfo->global_state = DSTATE_STOPPING; |
77 | } | 77 | } |
78 | /* At this point we should be in state DSTATE_STOPPING if being used | 78 | /* At this point we should be in state DSTATE_STOPPING if being used |
79 | * standalone, or in state DSTATE_BUFIMAGE if being invoked to get access | 79 | * standalone, or in state DSTATE_BUFIMAGE if being invoked to get access |
80 | * to the coefficients during a full buffered-image-mode decompression. | 80 | * to the coefficients during a full buffered-image-mode decompression. |
81 | */ | 81 | */ |
82 | if ((cinfo->global_state == DSTATE_STOPPING || | 82 | if ((cinfo->global_state == DSTATE_STOPPING || |
83 | cinfo->global_state == DSTATE_BUFIMAGE) && cinfo->buffered_image) { | 83 | cinfo->global_state == DSTATE_BUFIMAGE) && cinfo->buffered_image) { |
84 | return cinfo->coef->coef_arrays; | 84 | return cinfo->coef->coef_arrays; |
85 | } | 85 | } |
86 | /* Oops, improper usage */ | 86 | /* Oops, improper usage */ |
87 | ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); | 87 | ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); |
88 | return NULL; /* keep compiler happy */ | 88 | return NULL; /* keep compiler happy */ |
89 | } | 89 | } |
90 | 90 | ||
91 | 91 | ||
92 | /* | 92 | /* |
93 | * Master selection of decompression modules for transcoding. | 93 | * Master selection of decompression modules for transcoding. |
94 | * This substitutes for jdmaster.c's initialization of the full decompressor. | 94 | * This substitutes for jdmaster.c's initialization of the full decompressor. |
95 | */ | 95 | */ |
96 | 96 | ||
97 | LOCAL(void) | 97 | LOCAL(void) |
98 | transdecode_master_selection (j_decompress_ptr cinfo) | 98 | transdecode_master_selection (j_decompress_ptr cinfo) |
99 | { | 99 | { |
100 | /* This is effectively a buffered-image operation. */ | 100 | /* This is effectively a buffered-image operation. */ |
101 | cinfo->buffered_image = TRUE; | 101 | cinfo->buffered_image = TRUE; |
102 | 102 | ||
103 | /* Compute output image dimensions and related values. */ | 103 | /* Compute output image dimensions and related values. */ |
104 | jpeg_core_output_dimensions(cinfo); | 104 | jpeg_core_output_dimensions(cinfo); |
105 | 105 | ||
106 | /* Entropy decoding: either Huffman or arithmetic coding. */ | 106 | /* Entropy decoding: either Huffman or arithmetic coding. */ |
107 | if (cinfo->arith_code) | 107 | if (cinfo->arith_code) |
108 | jinit_arith_decoder(cinfo); | 108 | jinit_arith_decoder(cinfo); |
109 | else { | 109 | else { |
110 | jinit_huff_decoder(cinfo); | 110 | jinit_huff_decoder(cinfo); |
111 | } | 111 | } |
112 | 112 | ||
113 | /* Always get a full-image coefficient buffer. */ | 113 | /* Always get a full-image coefficient buffer. */ |
114 | jinit_d_coef_controller(cinfo, TRUE); | 114 | jinit_d_coef_controller(cinfo, TRUE); |
115 | 115 | ||
116 | /* We can now tell the memory manager to allocate virtual arrays. */ | 116 | /* We can now tell the memory manager to allocate virtual arrays. */ |
117 | (*cinfo->mem->realize_virt_arrays) ((j_common_ptr) cinfo); | 117 | (*cinfo->mem->realize_virt_arrays) ((j_common_ptr) cinfo); |
118 | 118 | ||
119 | /* Initialize input side of decompressor to consume first scan. */ | 119 | /* Initialize input side of decompressor to consume first scan. */ |
120 | (*cinfo->inputctl->start_input_pass) (cinfo); | 120 | (*cinfo->inputctl->start_input_pass) (cinfo); |
121 | 121 | ||
122 | /* Initialize progress monitoring. */ | 122 | /* Initialize progress monitoring. */ |
123 | if (cinfo->progress != NULL) { | 123 | if (cinfo->progress != NULL) { |
124 | int nscans; | 124 | int nscans; |
125 | /* Estimate number of scans to set pass_limit. */ | 125 | /* Estimate number of scans to set pass_limit. */ |
126 | if (cinfo->progressive_mode) { | 126 | if (cinfo->progressive_mode) { |
127 | /* Arbitrarily estimate 2 interleaved DC scans + 3 AC scans/component. */ | 127 | /* Arbitrarily estimate 2 interleaved DC scans + 3 AC scans/component. */ |
128 | nscans = 2 + 3 * cinfo->num_components; | 128 | nscans = 2 + 3 * cinfo->num_components; |
129 | } else if (cinfo->inputctl->has_multiple_scans) { | 129 | } else if (cinfo->inputctl->has_multiple_scans) { |
130 | /* For a nonprogressive multiscan file, estimate 1 scan per component. */ | 130 | /* For a nonprogressive multiscan file, estimate 1 scan per component. */ |
131 | nscans = cinfo->num_components; | 131 | nscans = cinfo->num_components; |
132 | } else { | 132 | } else { |
133 | nscans = 1; | 133 | nscans = 1; |
134 | } | 134 | } |
135 | cinfo->progress->pass_counter = 0L; | 135 | cinfo->progress->pass_counter = 0L; |
136 | cinfo->progress->pass_limit = (long) cinfo->total_iMCU_rows * nscans; | 136 | cinfo->progress->pass_limit = (long) cinfo->total_iMCU_rows * nscans; |
137 | cinfo->progress->completed_passes = 0; | 137 | cinfo->progress->completed_passes = 0; |
138 | cinfo->progress->total_passes = 1; | 138 | cinfo->progress->total_passes = 1; |
139 | } | 139 | } |
140 | } | 140 | } |