]>
Commit | Line | Data |
---|---|---|
c1f0ee65 JR |
1 | This patch adds multi-page TIFF support to XV 3.10a |
2 | ||
3 | ||
4 | diff -r -c ../xv-3.10a/xv.c ./xv.c | |
5 | *** ../xv-3.10a/xv.c Thu Jan 19 13:08:43 1995 | |
6 | --- ./xv.c Mon Apr 14 18:21:48 1997 | |
7 | *************** | |
8 | *** 2668,2674 **** | |
9 | #endif | |
10 | ||
11 | #ifdef HAVE_TIFF | |
12 | ! case RFT_TIFF: rv = LoadTIFF (fname, pinfo); break; | |
13 | #endif | |
14 | ||
15 | #ifdef HAVE_PDS | |
16 | --- 2668,2674 ---- | |
17 | #endif | |
18 | ||
19 | #ifdef HAVE_TIFF | |
20 | ! case RFT_TIFF: rv = LoadTIFF (fname, pinfo, quick); break; | |
21 | #endif | |
22 | ||
23 | #ifdef HAVE_PDS | |
24 | ||
25 | ||
26 | *** ../xv-3.10a/xv.h Mon Jan 23 15:22:23 1995 | |
27 | --- ./xv.h Mon Apr 14 18:22:52 1997 | |
28 | *************** | |
29 | *** 1248,1253 **** | |
30 | --- 1248,1254 ---- | |
31 | void xv_getwd PARM((char *, size_t)); | |
32 | char *xv_strstr PARM((char *, char *)); | |
33 | FILE *xv_fopen PARM((char *, char *)); | |
34 | + void xv_mktemp PARM((char *, char *)); | |
35 | void Timer PARM((int)); | |
36 | ||
37 | /*************************** XVCOLOR.C ***************************/ | |
38 | *************** | |
39 | *** 1607,1613 **** | |
40 | void JPEGSaveParams PARM((char *, int)); | |
41 | ||
42 | /**************************** XVTIFF.C ***************************/ | |
43 | ! int LoadTIFF PARM((char *, PICINFO *)); | |
44 | void CreateTIFFW PARM((void)); | |
45 | void TIFFDialog PARM((int)); | |
46 | int TIFFCheckEvent PARM((XEvent *)); | |
47 | --- 1608,1614 ---- | |
48 | void JPEGSaveParams PARM((char *, int)); | |
49 | ||
50 | /**************************** XVTIFF.C ***************************/ | |
51 | ! int LoadTIFF PARM((char *, PICINFO *, int)); | |
52 | void CreateTIFFW PARM((void)); | |
53 | void TIFFDialog PARM((int)); | |
54 | int TIFFCheckEvent PARM((XEvent *)); | |
55 | ||
56 | ||
57 | *** ../xv-3.10a/xvmisc.c Fri Jan 13 18:41:34 1995 | |
58 | --- ./xvmisc.c Mon Apr 14 18:21:48 1997 | |
59 | *************** | |
60 | *** 28,33 **** | |
61 | --- 28,35 ---- | |
62 | * int xvbcmp (s1, s2, length) | |
63 | * void xvbzero(s, length) | |
64 | * char *xv_strstr(s1, s2) | |
65 | + * FILE *xv_fopen(str, str) | |
66 | + * void xv_mktemp(str) | |
67 | * void Timer(milliseconds) | |
68 | */ | |
69 | ||
70 | *************** | |
71 | *** 1066,1071 **** | |
72 | --- 1068,1083 ---- | |
73 | } | |
74 | ||
75 | ||
76 | + /***************************************************/ | |
77 | + void xv_mktemp(buf, fname) | |
78 | + char *buf, *fname; | |
79 | + { | |
80 | + #ifndef VMS | |
81 | + sprintf(buf, "%s/%s", tmpdir, fname); | |
82 | + #else | |
83 | + sprintf(buf, "Sys$Disk:[]%s", fname); | |
84 | + #endif | |
85 | + } | |
86 | ||
87 | ||
88 | /*******/ | |
89 | ||
90 | ||
91 | *** ../xv-3.10a/xvtiff.c Fri Jan 13 14:53:34 1995 | |
92 | --- ./xvtiff.c Mon Apr 14 18:21:48 1997 | |
93 | *************** | |
94 | *** 1,7 **** | |
95 | /* | |
96 | * xvtiff.c - load routine for 'TIFF' format pictures | |
97 | * | |
98 | ! * LoadTIFF(fname, numcols) - load a TIFF file | |
99 | */ | |
100 | ||
101 | #ifndef va_start | |
102 | --- 1,7 ---- | |
103 | /* | |
104 | * xvtiff.c - load routine for 'TIFF' format pictures | |
105 | * | |
106 | ! * LoadTIFF(fname, numcols, quick) - load a TIFF file | |
107 | */ | |
108 | ||
109 | #ifndef va_start | |
110 | *************** | |
111 | *** 15,20 **** | |
112 | --- 15,49 ---- | |
113 | #include "tiffio.h" /* has to be after xv.h, as it needs varargs/stdarg */ | |
114 | ||
115 | ||
116 | + /* Portions fall under the following copyright: | |
117 | + * | |
118 | + * Copyright (c) 1992, 1993, 1994 Sam Leffler | |
119 | + * Copyright (c) 1992, 1993, 1994 Silicon Graphics, Inc. | |
120 | + * | |
121 | + * Permission to use, copy, modify, distribute, and sell this software and | |
122 | + * its documentation for any purpose is hereby granted without fee, provided | |
123 | + * that (i) the above copyright notices and this permission notice appear in | |
124 | + * all copies of the software and related documentation, and (ii) the names of | |
125 | + * Sam Leffler and Silicon Graphics may not be used in any advertising or | |
126 | + * publicity relating to the software without the specific, prior written | |
127 | + * permission of Sam Leffler and Silicon Graphics. | |
128 | + * | |
129 | + * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, | |
130 | + * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY | |
131 | + * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. | |
132 | + * | |
133 | + * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR | |
134 | + * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, | |
135 | + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, | |
136 | + * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF | |
137 | + * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |
138 | + * OF THIS SOFTWARE. | |
139 | + */ | |
140 | + | |
141 | + | |
142 | + static int copyTiff PARM((TIFF *, char *)); | |
143 | + static int cpStrips PARM((TIFF *, TIFF *)); | |
144 | + static int cpTiles PARM((TIFF *, TIFF *)); | |
145 | static byte *loadPalette PARM((TIFF *, uint32, uint32, int, int, PICINFO *)); | |
146 | static byte *loadColor PARM((TIFF *, uint32, uint32, int, int, PICINFO *)); | |
147 | static int loadImage PARM((TIFF *, uint32, uint32, byte *, int)); | |
148 | *************** | |
149 | *** 28,46 **** | |
150 | static int error_occurred; | |
151 | ||
152 | /*******************************************/ | |
153 | ! int LoadTIFF(fname, pinfo) | |
154 | ! char *fname; | |
155 | PICINFO *pinfo; | |
156 | /*******************************************/ | |
157 | { | |
158 | /* returns '1' on success, '0' on failure */ | |
159 | ||
160 | TIFF *tif; | |
161 | uint32 w, h; | |
162 | short bps, spp, photo, orient; | |
163 | FILE *fp; | |
164 | byte *pic8; | |
165 | char *desc, oldpath[MAXPATHLEN+1], tmppath[MAXPATHLEN+1], *sp; | |
166 | ||
167 | error_occurred = 0; | |
168 | ||
169 | --- 57,79 ---- | |
170 | static int error_occurred; | |
171 | ||
172 | /*******************************************/ | |
173 | ! int LoadTIFF(fname, pinfo, quick) | |
174 | ! char *fname; | |
175 | PICINFO *pinfo; | |
176 | + int quick; | |
177 | /*******************************************/ | |
178 | { | |
179 | /* returns '1' on success, '0' on failure */ | |
180 | ||
181 | TIFF *tif; | |
182 | uint32 w, h; | |
183 | + float xres, yres; | |
184 | short bps, spp, photo, orient; | |
185 | FILE *fp; | |
186 | byte *pic8; | |
187 | char *desc, oldpath[MAXPATHLEN+1], tmppath[MAXPATHLEN+1], *sp; | |
188 | + char tmp[256], tmpname[256]; | |
189 | + int i, nump; | |
190 | ||
191 | error_occurred = 0; | |
192 | ||
193 | *************** | |
194 | *** 60,65 **** | |
195 | --- 93,100 ---- | |
196 | filesize = ftell(fp); | |
197 | fclose(fp); | |
198 | ||
199 | + | |
200 | + | |
201 | rmap = pinfo->r; gmap = pinfo->g; bmap = pinfo->b; | |
202 | ||
203 | /* a kludge: temporarily cd to the directory that the file is in (if | |
204 | *************** | |
205 | *** 81,89 **** | |
206 | } | |
207 | } | |
208 | ||
209 | ||
210 | ||
211 | ! tif=TIFFOpen(filename,"r"); | |
212 | if (!tif) return 0; | |
213 | ||
214 | /* flip orientation so that image comes in X order */ | |
215 | --- 116,172 ---- | |
216 | } | |
217 | } | |
218 | ||
219 | + | |
220 | + nump = 1; | |
221 | + | |
222 | + if (!quick) { | |
223 | + /* see if there's more than 1 image in tiff file, to determine if we | |
224 | + should do multi-page thing... */ | |
225 | + | |
226 | + tif = TIFFOpen(filename,"r"); | |
227 | + if (!tif) return 0; | |
228 | + while (TIFFReadDirectory(tif)) nump++; | |
229 | + TIFFClose(tif); | |
230 | + if (DEBUG) | |
231 | + fprintf(stderr,"LoadTIFF: %d page%s found\n", nump, nump==1 ? "" : "s"); | |
232 | + | |
233 | + | |
234 | + /* if there are multiple images, copy them out to multiple tmp files, | |
235 | + and load the first one... */ | |
236 | + | |
237 | + xv_mktemp(tmpname, "xvpgXXXXXX"); | |
238 | + | |
239 | + if (tmpname[0] == '\0') { /* mktemp() blew up */ | |
240 | + sprintf(str,"LoadTIFF: Unable to create temporary filename???"); | |
241 | + ErrPopUp(str, "\nHow unlikely!"); | |
242 | + return 0; | |
243 | + } | |
244 | ||
245 | + if (nump>1) { | |
246 | + TIFF *in, *out; | |
247 | + | |
248 | + in = TIFFOpen(filename, "r"); | |
249 | + if (!in) return 0; | |
250 | + for (i=1; i<=nump; i++) { | |
251 | + sprintf(tmp, "%s%d", tmpname, i); | |
252 | + if (!copyTiff(in, tmp)) { | |
253 | + SetISTR(ISTR_WARNING, "LoadTIFF: Error writing page files!"); | |
254 | + break; | |
255 | + } | |
256 | + | |
257 | + if (!TIFFReadDirectory(in)) break; | |
258 | + } | |
259 | + if (DEBUG) | |
260 | + fprintf(stderr,"LoadTIFF: %d page%s written\n", | |
261 | + i-1, (i-1)==1 ? "" : "s"); | |
262 | + | |
263 | + sprintf(tmp, "%s%d", tmpname, 1); /* open page #1 */ | |
264 | + filename = tmp; | |
265 | + } | |
266 | + } /* if (!quick) ... */ | |
267 | ||
268 | ! | |
269 | ! tif = TIFFOpen(filename,"r"); | |
270 | if (!tif) return 0; | |
271 | ||
272 | /* flip orientation so that image comes in X order */ | |
273 | *************** | |
274 | *** 107,112 **** | |
275 | --- 190,200 ---- | |
276 | TIFFGetFieldDefaulted(tif, TIFFTAG_BITSPERSAMPLE, &bps); | |
277 | TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &photo); | |
278 | TIFFGetFieldDefaulted(tif, TIFFTAG_SAMPLESPERPIXEL, &spp); | |
279 | + if ((TIFFGetField(tif, TIFFTAG_XRESOLUTION, &xres) == 1) && | |
280 | + (TIFFGetField(tif, TIFFTAG_YRESOLUTION, &yres) == 1)) { | |
281 | + normaspect = yres / xres; | |
282 | + if (DEBUG) fprintf(stderr,"TIFF aspect = %f\n", normaspect); | |
283 | + } | |
284 | ||
285 | if (spp == 1) { | |
286 | pic8 = loadPalette(tif, w, h, photo, bps, pinfo); | |
287 | *************** | |
288 | *** 139,144 **** | |
289 | --- 227,234 ---- | |
290 | if (pic8) free(pic8); | |
291 | if (pinfo->comment) free(pinfo->comment); | |
292 | pinfo->comment = (char *) NULL; | |
293 | + if (!quick && nump>1) KillPageFiles(tmpname, nump); | |
294 | + SetCursors(-1); | |
295 | return 0; | |
296 | } | |
297 | ||
298 | *************** | |
299 | *** 148,164 **** | |
300 | --- 238,404 ---- | |
301 | pinfo->normw = pinfo->w; pinfo->normh = pinfo->h; | |
302 | pinfo->frmType = F_TIFF; | |
303 | ||
304 | + if (nump>1) strcpy(pinfo->pagebname, tmpname); | |
305 | + pinfo->numpages = nump; | |
306 | ||
307 | if (pinfo->pic) return 1; | |
308 | ||
309 | + | |
310 | /* failed. if we malloc'd a comment, free it */ | |
311 | if (pinfo->comment) free(pinfo->comment); | |
312 | pinfo->comment = (char *) NULL; | |
313 | ||
314 | + if (!quick && nump>1) KillPageFiles(tmpname, nump); | |
315 | + SetCursors(-1); | |
316 | + | |
317 | return 0; | |
318 | } | |
319 | ||
320 | ||
321 | + | |
322 | + | |
323 | + /*******************************************/ | |
324 | + | |
325 | + #define CopyField(tag, v) \ | |
326 | + if (TIFFGetField(in, tag, &v)) TIFFSetField(out, tag, v) | |
327 | + #define CopyField2(tag, v1, v2) \ | |
328 | + if (TIFFGetField(in, tag, &v1, &v2)) TIFFSetField(out, tag, v1, v2) | |
329 | + #define CopyField3(tag, v1, v2, v3) \ | |
330 | + if (TIFFGetField(in, tag, &v1, &v2, &v3)) TIFFSetField(out, tag, v1, v2, v3) | |
331 | + | |
332 | + | |
333 | + /*******************************************/ | |
334 | + static int copyTiff(in, fname) | |
335 | + TIFF *in; | |
336 | + char *fname; | |
337 | + { | |
338 | + /* copies tiff image to given filename. Returns 0 on error */ | |
339 | + | |
340 | + TIFF *out; | |
341 | + short bitspersample, samplesperpixel, shortv, *shortav; | |
342 | + uint32 w, l; | |
343 | + float floatv; | |
344 | + char *stringv; | |
345 | + uint32 longv; | |
346 | + uint16 *red, *green, *blue, shortv2; | |
347 | + int rv; | |
348 | + | |
349 | + out = TIFFOpen(fname, "w"); | |
350 | + if (!out) return 0; | |
351 | + | |
352 | + CopyField (TIFFTAG_SUBFILETYPE, longv); | |
353 | + CopyField (TIFFTAG_TILEWIDTH, w); | |
354 | + CopyField (TIFFTAG_TILELENGTH, l); | |
355 | + CopyField (TIFFTAG_IMAGEWIDTH, w); | |
356 | + CopyField (TIFFTAG_IMAGELENGTH, l); | |
357 | + CopyField (TIFFTAG_BITSPERSAMPLE, bitspersample); | |
358 | + CopyField (TIFFTAG_COMPRESSION, shortv); | |
359 | + CopyField (TIFFTAG_PREDICTOR, shortv); | |
360 | + CopyField (TIFFTAG_PHOTOMETRIC, shortv); | |
361 | + CopyField (TIFFTAG_THRESHHOLDING, shortv); | |
362 | + CopyField (TIFFTAG_FILLORDER, shortv); | |
363 | + CopyField (TIFFTAG_ORIENTATION, shortv); | |
364 | + CopyField (TIFFTAG_SAMPLESPERPIXEL, samplesperpixel); | |
365 | + CopyField (TIFFTAG_MINSAMPLEVALUE, shortv); | |
366 | + CopyField (TIFFTAG_MAXSAMPLEVALUE, shortv); | |
367 | + CopyField (TIFFTAG_XRESOLUTION, floatv); | |
368 | + CopyField (TIFFTAG_YRESOLUTION, floatv); | |
369 | + CopyField (TIFFTAG_GROUP3OPTIONS, longv); | |
370 | + CopyField (TIFFTAG_GROUP4OPTIONS, longv); | |
371 | + CopyField (TIFFTAG_RESOLUTIONUNIT, shortv); | |
372 | + CopyField (TIFFTAG_PLANARCONFIG, shortv); | |
373 | + CopyField (TIFFTAG_ROWSPERSTRIP, longv); | |
374 | + CopyField (TIFFTAG_XPOSITION, floatv); | |
375 | + CopyField (TIFFTAG_YPOSITION, floatv); | |
376 | + CopyField (TIFFTAG_IMAGEDEPTH, longv); | |
377 | + CopyField (TIFFTAG_TILEDEPTH, longv); | |
378 | + CopyField2(TIFFTAG_EXTRASAMPLES, shortv, shortav); | |
379 | + CopyField3(TIFFTAG_COLORMAP, red, green, blue); | |
380 | + CopyField2(TIFFTAG_PAGENUMBER, shortv, shortv2); | |
381 | + CopyField (TIFFTAG_ARTIST, stringv); | |
382 | + CopyField (TIFFTAG_IMAGEDESCRIPTION,stringv); | |
383 | + CopyField (TIFFTAG_MAKE, stringv); | |
384 | + CopyField (TIFFTAG_MODEL, stringv); | |
385 | + CopyField (TIFFTAG_SOFTWARE, stringv); | |
386 | + CopyField (TIFFTAG_DATETIME, stringv); | |
387 | + CopyField (TIFFTAG_HOSTCOMPUTER, stringv); | |
388 | + CopyField (TIFFTAG_PAGENAME, stringv); | |
389 | + CopyField (TIFFTAG_DOCUMENTNAME, stringv); | |
390 | + | |
391 | + if (TIFFIsTiled(in)) rv = cpTiles (in, out); | |
392 | + else rv = cpStrips(in, out); | |
393 | + | |
394 | + TIFFClose(out); | |
395 | + return rv; | |
396 | + } | |
397 | + | |
398 | + | |
399 | + /*******************************************/ | |
400 | + static int cpStrips(in, out) | |
401 | + TIFF *in, *out; | |
402 | + { | |
403 | + tsize_t bufsize; | |
404 | + byte *buf; | |
405 | + | |
406 | + bufsize = TIFFStripSize(in); | |
407 | + buf = (byte *) malloc((size_t) bufsize); | |
408 | + if (buf) { | |
409 | + tstrip_t s, ns = TIFFNumberOfStrips(in); | |
410 | + uint32 *bytecounts; | |
411 | + | |
412 | + TIFFGetField(in, TIFFTAG_STRIPBYTECOUNTS, &bytecounts); | |
413 | + for (s = 0; s < ns; s++) { | |
414 | + if (bytecounts[s] > bufsize) { | |
415 | + buf = (unsigned char *) realloc(buf, (size_t) bytecounts[s]); | |
416 | + if (!buf) return (0); | |
417 | + bufsize = bytecounts[s]; | |
418 | + } | |
419 | + if (TIFFReadRawStrip (in, s, buf, (tsize_t) bytecounts[s]) < 0 || | |
420 | + TIFFWriteRawStrip(out, s, buf, (tsize_t) bytecounts[s]) < 0) { | |
421 | + free(buf); | |
422 | + return 0; | |
423 | + } | |
424 | + } | |
425 | + free(buf); | |
426 | + return 1; | |
427 | + } | |
428 | + return 0; | |
429 | + } | |
430 | + | |
431 | + | |
432 | + /*******************************/ | |
433 | + static int cpTiles(in, out) | |
434 | + TIFF *in, *out; | |
435 | + { | |
436 | + tsize_t bufsize; | |
437 | + byte *buf; | |
438 | + | |
439 | + bufsize = TIFFTileSize(in); | |
440 | + buf = (unsigned char *) malloc((size_t) bufsize); | |
441 | + if (buf) { | |
442 | + ttile_t t, nt = TIFFNumberOfTiles(in); | |
443 | + uint32 *bytecounts; | |
444 | + | |
445 | + TIFFGetField(in, TIFFTAG_TILEBYTECOUNTS, &bytecounts); | |
446 | + for (t = 0; t < nt; t++) { | |
447 | + if (bytecounts[t] > bufsize) { | |
448 | + buf = (unsigned char *)realloc(buf, (size_t) bytecounts[t]); | |
449 | + if (!buf) return (0); | |
450 | + bufsize = bytecounts[t]; | |
451 | + } | |
452 | + if (TIFFReadRawTile (in, t, buf, (tsize_t) bytecounts[t]) < 0 || | |
453 | + TIFFWriteRawTile(out, t, buf, (tsize_t) bytecounts[t]) < 0) { | |
454 | + free(buf); | |
455 | + return 0; | |
456 | + } | |
457 | + } | |
458 | + free(buf); | |
459 | + return 1; | |
460 | + } | |
461 | + return 0; | |
462 | + } | |
463 | + | |
464 | + | |
465 | /*******************************************/ | |
466 | static byte *loadPalette(tif, w, h, photo, bps, pinfo) | |
467 | TIFF *tif; | |
468 | *************** | |
469 | *** 186,192 **** | |
470 | break; | |
471 | } | |
472 | ||
473 | ! sprintf(pinfo->shrtInfo, "%ux%u TIFF.",w,h); | |
474 | ||
475 | pic8 = (byte *) malloc((size_t) w*h); | |
476 | if (!pic8) FatalError("loadPalette() - couldn't malloc 'pic8'"); | |
477 | --- 426,432 ---- | |
478 | break; | |
479 | } | |
480 | ||
481 | ! sprintf(pinfo->shrtInfo, "%ux%u TIFF.",(u_int) w, (u_int) h); | |
482 | ||
483 | pic8 = (byte *) malloc((size_t) w*h); | |
484 | if (!pic8) FatalError("loadPalette() - couldn't malloc 'pic8'"); | |
485 | *************** | |
486 | *** 214,220 **** | |
487 | "???"), | |
488 | filesize); | |
489 | ||
490 | ! sprintf(pinfo->shrtInfo, "%ux%u TIFF.",w,h); | |
491 | ||
492 | /* allocate 24-bit image */ | |
493 | pic24 = (byte *) malloc((size_t) w*h*3); | |
494 | --- 454,460 ---- | |
495 | "???"), | |
496 | filesize); | |
497 | ||
498 | ! sprintf(pinfo->shrtInfo, "%ux%u TIFF.",(u_int) w, (u_int) h); | |
499 | ||
500 | /* allocate 24-bit image */ | |
501 | pic24 = (byte *) malloc((size_t) w*h*3); | |
502 | *************** | |
503 | *** 1014,1020 **** | |
504 | #define CASE4(x,op) switch (x) { case 3: op; case 2: op; case 1: op; } | |
505 | ||
506 | #define UNROLL8(w, op1, op2) { \ | |
507 | ! uint32 x; \ | |
508 | for (x = w; x >= 8; x -= 8) { \ | |
509 | op1; \ | |
510 | REPEAT8(op2); \ | |
511 | --- 1254,1260 ---- | |
512 | #define CASE4(x,op) switch (x) { case 3: op; case 2: op; case 1: op; } | |
513 | ||
514 | #define UNROLL8(w, op1, op2) { \ | |
515 | ! uint32 x; \ | |
516 | for (x = w; x >= 8; x -= 8) { \ | |
517 | op1; \ | |
518 | REPEAT8(op2); \ | |
519 | *************** | |
520 | *** 1026,1032 **** | |
521 | } | |
522 | ||
523 | #define UNROLL4(w, op1, op2) { \ | |
524 | ! register uint32 x; \ | |
525 | for (x = w; x >= 4; x -= 4) { \ | |
526 | op1; \ | |
527 | REPEAT4(op2); \ | |
528 | --- 1266,1272 ---- | |
529 | } | |
530 | ||
531 | #define UNROLL4(w, op1, op2) { \ | |
532 | ! uint32 x; \ | |
533 | for (x = w; x >= 4; x -= 4) { \ | |
534 | op1; \ | |
535 | REPEAT4(op2); \ | |
536 | *************** | |
537 | *** 1038,1044 **** | |
538 | } | |
539 | ||
540 | #define UNROLL2(w, op1, op2) { \ | |
541 | ! register uint32 x; \ | |
542 | for (x = w; x >= 2; x -= 2) { \ | |
543 | op1; \ | |
544 | REPEAT2(op2); \ | |
545 | --- 1278,1284 ---- | |
546 | } | |
547 | ||
548 | #define UNROLL2(w, op1, op2) { \ | |
549 | ! uint32 x; \ | |
550 | for (x = w; x >= 2; x -= 2) { \ | |
551 | op1; \ | |
552 | REPEAT2(op2); \ | |
553 | *************** | |
554 | *** 1381,1387 **** | |
555 | } | |
556 | } | |
557 | ||
558 | ! #define Code2V(c, RB, RW, CR) ((((c)-(int)RB)*(float)CR)/(float)(RW-RB)) | |
559 | ||
560 | #define CLAMP(f,min,max) \ | |
561 | (int)((f)+.5 < (min) ? (min) : (f)+.5 > (max) ? (max) : (f)+.5) | |
562 | --- 1621,1627 ---- | |
563 | } | |
564 | } | |
565 | ||
566 | ! #define Code2V(c, RB, RW, CR) (((((int)c)-(int)RB)*(float)CR)/(float)(RW-RB)) | |
567 | ||
568 | #define CLAMP(f,min,max) \ | |
569 | (int)((f)+.5 < (min) ? (min) : (f)+.5 > (max) ? (max) : (f)+.5) | |
570 |