Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: jutils.c

Issue 1953443002: Update to libjpeg_turbo 1.4.90 (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/libjpeg_turbo.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « jstdhuff.c ('k') | jversion.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * jutils.c 2 * jutils.c
3 * 3 *
4 * This file was part of the Independent JPEG Group's software:
4 * Copyright (C) 1991-1996, Thomas G. Lane. 5 * Copyright (C) 1991-1996, 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
6 * For conditions of distribution and use, see the accompanying README file. 7 * relevant to libjpeg-turbo.
8 * For conditions of distribution and use, see the accompanying README.ijg
9 * file.
7 * 10 *
8 * This file contains tables and miscellaneous utility routines needed 11 * This file contains tables and miscellaneous utility routines needed
9 * for both compression and decompression. 12 * for both compression and decompression.
10 * Note we prefix all global names with "j" to minimize conflicts with 13 * Note we prefix all global names with "j" to minimize conflicts with
11 * a surrounding application. 14 * a surrounding application.
12 */ 15 */
13 16
14 #define JPEG_INTERNALS 17 #define JPEG_INTERNALS
15 #include "jinclude.h" 18 #include "jinclude.h"
16 #include "jpeglib.h" 19 #include "jpeglib.h"
17 20
18 21
19 /* 22 /*
20 * jpeg_zigzag_order[i] is the zigzag-order position of the i'th element 23 * jpeg_zigzag_order[i] is the zigzag-order position of the i'th element
21 * of a DCT block read in natural order (left to right, top to bottom). 24 * of a DCT block read in natural order (left to right, top to bottom).
22 */ 25 */
23 26
24 #if 0» » » » /* This table is not actually needed in v6a */ 27 #if 0 /* This table is not actually needed in v6a */
25 28
26 const int jpeg_zigzag_order[DCTSIZE2] = { 29 const int jpeg_zigzag_order[DCTSIZE2] = {
27 0, 1, 5, 6, 14, 15, 27, 28, 30 0, 1, 5, 6, 14, 15, 27, 28,
28 2, 4, 7, 13, 16, 26, 29, 42, 31 2, 4, 7, 13, 16, 26, 29, 42,
29 3, 8, 12, 17, 25, 30, 41, 43, 32 3, 8, 12, 17, 25, 30, 41, 43,
30 9, 11, 18, 24, 31, 40, 44, 53, 33 9, 11, 18, 24, 31, 40, 44, 53,
31 10, 19, 23, 32, 39, 45, 52, 54, 34 10, 19, 23, 32, 39, 45, 52, 54,
32 20, 22, 33, 38, 46, 51, 55, 60, 35 20, 22, 33, 38, 46, 51, 55, 60,
33 21, 34, 37, 47, 50, 56, 59, 61, 36 21, 34, 37, 47, 50, 56, 59, 61,
34 35, 36, 48, 49, 57, 58, 62, 63 37 35, 36, 48, 49, 57, 58, 62, 63
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 GLOBAL(long) 83 GLOBAL(long)
81 jround_up (long a, long b) 84 jround_up (long a, long b)
82 /* Compute a rounded up to next multiple of b, ie, ceil(a/b)*b */ 85 /* Compute a rounded up to next multiple of b, ie, ceil(a/b)*b */
83 /* Assumes a >= 0, b > 0 */ 86 /* Assumes a >= 0, b > 0 */
84 { 87 {
85 a += b - 1L; 88 a += b - 1L;
86 return a - (a % b); 89 return a - (a % b);
87 } 90 }
88 91
89 92
90 /* On normal machines we can apply MEMCOPY() and MEMZERO() to sample arrays
91 * and coefficient-block arrays. This won't work on 80x86 because the arrays
92 * are FAR and we're assuming a small-pointer memory model. However, some
93 * DOS compilers provide far-pointer versions of memcpy() and memset() even
94 * in the small-model libraries. These will be used if USE_FMEM is defined.
95 * Otherwise, the routines below do it the hard way. (The performance cost
96 * is not all that great, because these routines aren't very heavily used.)
97 */
98
99 #ifndef NEED_FAR_POINTERS /* normal case, same as regular macros */
100 #define FMEMCOPY(dest,src,size) MEMCOPY(dest,src,size)
101 #define FMEMZERO(target,size) MEMZERO(target,size)
102 #else /* 80x86 case, define if we can */
103 #ifdef USE_FMEM
104 #define FMEMCOPY(dest,src,size) _fmemcpy((void FAR *)(dest), (const void FAR *)( src), (size_t)(size))
105 #define FMEMZERO(target,size) _fmemset((void FAR *)(target), 0, (size_t)(size) )
106 #endif
107 #endif
108
109
110 GLOBAL(void) 93 GLOBAL(void)
111 jcopy_sample_rows (JSAMPARRAY input_array, int source_row, 94 jcopy_sample_rows (JSAMPARRAY input_array, int source_row,
112 » » JSAMPARRAY output_array, int dest_row, 95 JSAMPARRAY output_array, int dest_row,
113 » » int num_rows, JDIMENSION num_cols) 96 int num_rows, JDIMENSION num_cols)
114 /* Copy some rows of samples from one place to another. 97 /* Copy some rows of samples from one place to another.
115 * num_rows rows are copied from input_array[source_row++] 98 * num_rows rows are copied from input_array[source_row++]
116 * to output_array[dest_row++]; these areas may overlap for duplication. 99 * to output_array[dest_row++]; these areas may overlap for duplication.
117 * The source and destination arrays must be at least as wide as num_cols. 100 * The source and destination arrays must be at least as wide as num_cols.
118 */ 101 */
119 { 102 {
120 register JSAMPROW inptr, outptr; 103 register JSAMPROW inptr, outptr;
121 #ifdef FMEMCOPY 104 register size_t count = (size_t) (num_cols * sizeof(JSAMPLE));
122 register size_t count = (size_t) (num_cols * SIZEOF(JSAMPLE));
123 #else
124 register JDIMENSION count;
125 #endif
126 register int row; 105 register int row;
127 106
128 input_array += source_row; 107 input_array += source_row;
129 output_array += dest_row; 108 output_array += dest_row;
130 109
131 for (row = num_rows; row > 0; row--) { 110 for (row = num_rows; row > 0; row--) {
132 inptr = *input_array++; 111 inptr = *input_array++;
133 outptr = *output_array++; 112 outptr = *output_array++;
134 #ifdef FMEMCOPY 113 MEMCOPY(outptr, inptr, count);
135 FMEMCOPY(outptr, inptr, count);
136 #else
137 for (count = num_cols; count > 0; count--)
138 *outptr++ = *inptr++;» /* needn't bother with GETJSAMPLE() here */
139 #endif
140 } 114 }
141 } 115 }
142 116
143 117
144 GLOBAL(void) 118 GLOBAL(void)
145 jcopy_block_row (JBLOCKROW input_row, JBLOCKROW output_row, 119 jcopy_block_row (JBLOCKROW input_row, JBLOCKROW output_row,
146 » » JDIMENSION num_blocks) 120 JDIMENSION num_blocks)
147 /* Copy a row of coefficient blocks from one place to another. */ 121 /* Copy a row of coefficient blocks from one place to another. */
148 { 122 {
149 #ifdef FMEMCOPY 123 MEMCOPY(output_row, input_row, num_blocks * (DCTSIZE2 * sizeof(JCOEF)));
150 FMEMCOPY(output_row, input_row, num_blocks * (DCTSIZE2 * SIZEOF(JCOEF)));
151 #else
152 register JCOEFPTR inptr, outptr;
153 register long count;
154
155 inptr = (JCOEFPTR) input_row;
156 outptr = (JCOEFPTR) output_row;
157 for (count = (long) num_blocks * DCTSIZE2; count > 0; count--) {
158 *outptr++ = *inptr++;
159 }
160 #endif
161 } 124 }
162 125
163 126
164 GLOBAL(void) 127 GLOBAL(void)
165 jzero_far (void FAR * target, size_t bytestozero) 128 jzero_far (void *target, size_t bytestozero)
166 /* Zero out a chunk of FAR memory. */ 129 /* Zero out a chunk of memory. */
167 /* This might be sample-array data, block-array data, or alloc_large data. */ 130 /* This might be sample-array data, block-array data, or alloc_large data. */
168 { 131 {
169 #ifdef FMEMZERO 132 MEMZERO(target, bytestozero);
170 FMEMZERO(target, bytestozero);
171 #else
172 register char FAR * ptr = (char FAR *) target;
173 register size_t count;
174
175 for (count = bytestozero; count > 0; count--) {
176 *ptr++ = 0;
177 }
178 #endif
179 } 133 }
OLDNEW
« no previous file with comments | « jstdhuff.c ('k') | jversion.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698