Code cleanup for min/max functions. Committed on behalf of lebedev.ri (thanks!).

This commit is contained in:
Emil Martinec
2012-04-09 15:42:59 -05:00
parent 30681df133
commit 033755b6df
61 changed files with 767 additions and 620 deletions

View File

@@ -1,11 +1,13 @@
--- C:/GCC/RT/RTSrc/rtengine/dcraw.c Thu Dec 29 12:43:38 2011
+++ C:/GCC/RT/RTSrc/rtengine/dcraw.cc Sun Mar 25 19:10:21 2012
@@ -1,3 +1,14 @@
--- dcraw.c 2012-04-06 17:30:26.000000000 +0400
+++ dcraw.cc 2012-04-06 21:59:43.816583252 +0400
@@ -1,3 +1,16 @@
+/*RT*/#include <glib.h>
+/*RT*/#include <glib/gstdio.h>
+/*RT*/#undef MAX
+/*RT*/#undef MIN
+/*RT*/#undef ABS
+/*RT*/#include <algorithm>
+/*RT*/#include "rt_math.h"
+/*RT*/#define NO_LCMS
+/*RT*/#define NO_JPEG
+/*RT*/#define NO_JASPER
@@ -15,7 +17,7 @@
/*
dcraw.c -- Dave Coffin's raw photo decoder
Copyright 1997-2011 by Dave Coffin, dcoffin a cybercom o net
@@ -29,17 +40,17 @@
@@ -29,17 +42,17 @@
#define _GNU_SOURCE
#endif
#define _USE_MATH_DEFINES
@@ -43,7 +45,7 @@
#include <sys/types.h>
#ifdef NODEPS
@@ -98,18 +109,16 @@
@@ -98,18 +111,16 @@
#define LONG_BIT (8 * sizeof (long))
#endif
@@ -67,7 +69,7 @@
FILE *ifp, *ofp;
short order;
const char *ifname;
@@ -137,13 +146,13 @@
@@ -137,13 +148,13 @@
int output_color=1, output_bps=8, output_tiff=0, med_passes=0;
int no_auto_bright=0;
unsigned greybox[4] = { 0, 0, UINT_MAX, UINT_MAX };
@@ -84,7 +86,7 @@
void (*write_thumb)(), (*write_fun)();
void (*load_raw)(), (*thumb_load_raw)();
jmp_buf failure;
@@ -161,8 +170,8 @@
@@ -161,21 +172,23 @@
int format, key_off, black, black_off, split_col, tag_21a;
float tag_210;
} ph1;
@@ -95,7 +97,25 @@
#define FORC(cnt) for (c=0; c < cnt; c++)
#define FORC3 FORC(3)
@@ -280,6 +289,7 @@
#define FORC4 FORC(4)
#define FORCC FORC(colors)
-#define SQR(x) ((x)*(x))
+#define SQR(x) rtengine::SQR(x)
#define ABS(x) (((int)(x) ^ ((int)(x) >> 31)) - ((int)(x) >> 31))
-#define MIN(a,b) ((a) < (b) ? (a) : (b))
-#define MAX(a,b) ((a) > (b) ? (a) : (b))
+#define MIN(a,b) rtengine::min(a,b)
+#define MAX(a,b) rtengine::max(a,b)
#define LIM(x,min,max) MAX(min,MIN(x,max))
#define ULIM(x,y,z) ((y) < (z) ? LIM(x,y,z) : LIM(x,z,y))
#define CLIP(x) LIM(x,0,65535)
+#define CLIPD(x) LIM(x,0.0,65535.0)
+#define CLIPF(x) LIM(x,0.0f,65535.0f)
#define SWAP(a,b) { a=a+b; b=a-b; a=a-b; }
/*
@@ -280,6 +293,7 @@
fprintf (stderr,_("Corrupt data near 0x%llx\n"), (INT64) ftello(ifp));
}
data_error++;
@@ -103,7 +123,7 @@
}
ushort CLASS sget2 (uchar *s)
@@ -353,7 +363,7 @@
@@ -353,7 +367,7 @@
{
if (fread (pixel, 2, count, ifp) < count) derror();
if ((order == 0x4949) == (ntohs(0x1234) == 0x1234))
@@ -112,7 +132,7 @@
}
void CLASS canon_600_fixed_wb (int temp)
@@ -545,10 +555,10 @@
@@ -545,10 +559,10 @@
getbits(-1) initializes the buffer
getbits(n) where 0 <= n <= 25 returns an n-bit integer
*/
@@ -126,7 +146,16 @@
unsigned c;
if (nbits == -1)
@@ -1261,7 +1271,7 @@
@@ -1171,7 +1185,7 @@
else hpred[col & 1] += diff;
if ((ushort)(hpred[col & 1] + min) >= max) derror();
if ((unsigned) (col-left_margin) < width)
- BAYER(row,col-left_margin) = curve[LIM((short)hpred[col & 1],0,0x3fff)];
+ BAYER(row,col-left_margin) = curve[LIM((short)hpred[col & 1],(short)0,(short)0x3fff)];
}
}
free (huff);
@@ -1261,7 +1275,7 @@
int i, nz;
char tail[424];
@@ -135,7 +164,7 @@
fread (tail, 1, sizeof tail, ifp);
for (nz=i=0; i < sizeof tail; i++)
if (tail[i]) nz++;
@@ -1297,7 +1307,7 @@
@@ -1297,7 +1311,7 @@
free (pixel);
}
@@ -144,7 +173,34 @@
void CLASS ppm_thumb()
{
@@ -1573,10 +1583,10 @@
@@ -1407,7 +1421,7 @@
c = nc > 2 ? FC(row,col) : 0;
if (!(c & 1)) {
c = BAYER(row,col) * mult[c];
- BAYER(row,col) = LIM(c,0,65535);
+ BAYER(row,col) = LIM(c,0u,65535u);
}
for (c=0; c < nc; c+=2)
mult[c] += mult[c+1];
@@ -1451,7 +1465,7 @@
poly[3] += (ph1.tag_210 - poly[7]) * poly[6] + 1;
for (i=0; i < 0x10000; i++) {
num = (poly[5]*i + poly[3])*i + poly[1];
- curve[i] = LIM(num,0,65535);
+ curve[i] = CLIPF(num);
} goto apply; /* apply to right half */
} else if (tag == 0x41a) { /* Polynomial curve */
for (i=0; i < 4; i++)
@@ -1459,7 +1473,7 @@
for (i=0; i < 0x10000; i++) {
for (num=0, j=4; j--; )
num = num * i + poly[j];
- curve[i] = LIM(num+i,0,65535);
+ curve[i] = CLIPF(num+i);
} apply: /* apply to whole image */
for (row=0; row < height; row++)
for (col = (tag & 1)*ph1.split_col; col < width; col++)
@@ -1573,10 +1587,10 @@
phase_one_correct();
}
@@ -158,7 +214,7 @@
unsigned c;
if (nbits == -1)
@@ -1702,7 +1712,7 @@
@@ -1702,7 +1716,7 @@
}
}
@@ -167,16 +223,7 @@
void CLASS sinar_4shot_load_raw()
{
@@ -1731,7 +1741,7 @@
if ((r = row-top_margin - (shot >> 1 & 1)) >= height) continue;
for (col=0; col < raw_width; col++) {
if ((c = col-left_margin - (shot & 1)) >= width) continue;
- image[r*width+c][FC(row,col)] = pixel[col];
+ image[r*width+c][FC(row,col)] = pixel[col];
}
}
}
@@ -1843,10 +1853,10 @@
@@ -1843,10 +1857,10 @@
maximum = 0x3ff;
}
@@ -190,7 +237,7 @@
int byte;
if (!nbits) return vbits=0;
@@ -2135,11 +2145,11 @@
@@ -2135,11 +2149,11 @@
METHODDEF(boolean)
fill_input_buffer (j_decompress_ptr cinfo)
{
@@ -204,16 +251,7 @@
cinfo->src->next_input_byte = jpeg_buffer;
cinfo->src->bytes_in_buffer = nbytes;
return TRUE;
@@ -2215,7 +2225,7 @@
for (col=0; col < raw_width; col++) {
val = curve[pixel[col]];
if ((unsigned) (col-left_margin) < width)
- BAYER(row,col-left_margin) = val;
+ BAYER(row,col-left_margin) = val;
else lblack += val;
}
}
@@ -2411,9 +2421,9 @@
@@ -2411,9 +2425,9 @@
maximum = (1 << (thumb_misc & 31)) - 1;
}
@@ -225,7 +263,7 @@
if (start) {
for (p=0; p < 4; p++)
@@ -2712,7 +2722,7 @@
@@ -2712,7 +2726,7 @@
void CLASS foveon_decoder (unsigned size, unsigned code)
{
@@ -234,16 +272,76 @@
struct decode *cur;
int i, len;
@@ -3651,7 +3661,7 @@
lpass = size*((lev & 1)+1);
for (row=0; row < iheight; row++) {
hat_transform (temp, fimg+hpass+row*iwidth, 1, iwidth, 1 << lev);
- for (col=0; col < iwidth; col++)
+ for (col=0; col < iwidth; col++)
fimg[lpass + row*iwidth + col] = temp[col] * 0.25;
@@ -3670,7 +3684,7 @@
hpass = lpass;
}
for (col=0; col < iwidth; col++) {
@@ -4397,7 +4407,7 @@
for (i=0; i < size; i++)
- image[i][c] = CLIP(SQR(fimg[i]+fimg[lpass+i])/0x10000);
+ image[i][c] = CLIPF(SQR(fimg[i]+fimg[lpass+i])/0x10000);
}
if (filters && colors == 3) { /* pull G1 and G3 closer together */
for (row=0; row < 2; row++) {
@@ -3696,7 +3710,7 @@
if (diff < -thold) diff += thold;
else if (diff > thold) diff -= thold;
else diff = 0;
- BAYER(row,col) = CLIP(SQR(avg+diff) + 0.5);
+ BAYER(row,col) = CLIPD(SQR(avg+diff) + 0.5);
}
}
}
@@ -3716,8 +3730,8 @@
memcpy (pre_mul, user_mul, sizeof pre_mul);
if (use_auto_wb || (use_camera_wb && cam_mul[0] == -1)) {
memset (dsum, 0, sizeof dsum);
- bottom = MIN (greybox[1]+greybox[3], height);
- right = MIN (greybox[0]+greybox[2], width);
+ bottom = MIN (greybox[1]+greybox[3], static_cast<unsigned int>(height));
+ right = MIN (greybox[0]+greybox[2], static_cast<unsigned int>(width));
for (row=greybox[1]; row < bottom; row += 8)
for (col=greybox[0]; col < right; col += 8) {
memset (sum, 0, sizeof sum);
@@ -3921,7 +3935,7 @@
*/
void CLASS vng_interpolate()
{
- static const signed char *cp, terms[] = {
+ static const signed short int *cp, terms[] = {
-2,-2,+0,-1,0,0x01, -2,-2,+0,+0,1,0x01, -2,-1,-1,+0,0,0x01,
-2,-1,+0,-1,0,0x02, -2,-1,+0,+0,0,0x03, -2,-1,+0,+1,1,0x01,
-2,+0,+0,-1,0,0x06, -2,+0,+0,+0,1,0x02, -2,+0,+0,+1,0,0x03,
@@ -4071,7 +4085,7 @@
ABS(pix[-3*d][1] - pix[-d][1]) ) * 2;
}
d = dir[i = diff[0] > diff[1]];
- pix[0][1] = ULIM(guess[i] >> 2, pix[d][1], pix[-d][1]);
+ pix[0][1] = ULIM(guess[i] >> 2, static_cast<int>(pix[d][1]), static_cast<int>(pix[-d][1]));
}
/* Calculate red and blue for each green pixel: */
for (row=1; row < height-1; row++)
@@ -4144,10 +4158,10 @@
pix = image + row*width+col;
val = ((pix[-1][1] + pix[0][c] + pix[1][1]) * 2
- pix[-2][c] - pix[2][c]) >> 2;
- rgb[0][row-top][col-left][1] = ULIM(val,pix[-1][1],pix[1][1]);
+ rgb[0][row-top][col-left][1] = ULIM(val,static_cast<int>(pix[-1][1]),static_cast<int>(pix[1][1]));
val = ((pix[-width][1] + pix[0][c] + pix[width][1]) * 2
- pix[-2*width][c] - pix[2*width][c]) >> 2;
- rgb[1][row-top][col-left][1] = ULIM(val,pix[-width][1],pix[width][1]);
+ rgb[1][row-top][col-left][1] = ULIM(val,static_cast<int>(pix[-width][1]),static_cast<int>(pix[width][1]));
}
}
/* Interpolate red and blue, and convert to CIELab: */
@@ -4278,7 +4292,7 @@
if (c == colors) continue;
FORCC {
cam[0][c] = image[row*width+col][c];
- cam[1][c] = MIN(cam[0][c],clip);
+ cam[1][c] = MIN(cam[0][c],static_cast<float>(clip));
}
for (i=0; i < 2; i++) {
FORCC for (lab[i][c]=j=0; j < colors; j++)
@@ -4397,7 +4411,7 @@
}
}
@@ -252,7 +350,7 @@
void CLASS parse_makernote (int base, int uptag)
{
@@ -4528,12 +4538,12 @@
@@ -4528,12 +4542,12 @@
cam_mul[0] = getreal(type);
cam_mul[2] = getreal(type);
}
@@ -271,7 +369,16 @@
if (tag == 0x10 && type == 4)
unique_id = get4();
if (tag == 0x11 && is_raw && !strncmp(make,"NIKON",5)) {
@@ -4912,8 +4922,8 @@
@@ -4777,7 +4791,7 @@
case 6:
FORC(2) gpsdata[18+c] = get4(); break;
case 18: case 29:
- fgets ((char *) (gpsdata+14+tag/3), MIN(len,12), ifp);
+ fgets ((char *) (gpsdata+14+tag/3), MIN(len,12u), ifp);
}
fseek (ifp, save, SEEK_SET);
}
@@ -4912,8 +4926,8 @@
}
}
@@ -282,7 +389,7 @@
int CLASS parse_tiff_ifd (int base)
{
@@ -4927,7 +4937,7 @@
@@ -4927,7 +4941,7 @@
unsigned sony_curve[] = { 0,0,0,0,0,4095 };
unsigned *buf, sony_offset=0, sony_length=0, sony_key=0;
struct jhead jh;
@@ -291,7 +398,7 @@
if (tiff_nifds >= sizeof tiff_ifd / sizeof tiff_ifd[0])
return 1;
@@ -4944,6 +4954,9 @@
@@ -4944,6 +4958,9 @@
case 6: height = get2(); break;
case 7: width += get2(); break;
case 9: filters = get2(); break;
@@ -301,7 +408,7 @@
case 17: case 18:
if (type == 3 && len == 1)
cam_mul[(tag-17)*2] = get2() / 256.0;
@@ -5347,12 +5360,13 @@
@@ -5347,12 +5364,13 @@
fread (buf, sony_length, 1, ifp);
sony_decrypt (buf, sony_length/4, 1, sony_key);
sfp = ifp;
@@ -320,7 +427,7 @@
ifp = sfp;
free (buf);
}
@@ -5377,6 +5391,8 @@
@@ -5377,6 +5395,8 @@
{
int doff;
@@ -329,7 +436,7 @@
fseek (ifp, base, SEEK_SET);
order = get2();
if (order != 0x4949 && order != 0x4d4d) return 0;
@@ -5551,7 +5567,7 @@
@@ -5551,7 +5571,7 @@
{
const char *file, *ext;
char *jname, *jfile, *jext;
@@ -338,14 +445,7 @@
ext = strrchr (ifname, '.');
file = strrchr (ifname, '/');
@@ -5573,13 +5589,14 @@
} else
while (isdigit(*--jext)) {
if (*jext != '9') {
- (*jext)++;
+ (*jext)++;
break;
}
@@ -5579,7 +5599,8 @@
*jext = '0';
}
if (strcmp (jname, ifname)) {
@@ -355,20 +455,30 @@
if (verbose)
fprintf (stderr,_("Reading metadata from %s ...\n"), jname);
parse_tiff (12);
@@ -5918,7 +5935,11 @@
@@ -5918,7 +5939,11 @@
order = get2();
hlen = get4();
if (get4() == 0x48454150) /* "HEAP" */
- parse_ciff (save+hlen, len-hlen);
+/*RT*/ {
+/*RT*/ ciff_base = save+hlen;
+/*RT*/ ciff_len = len-hlen;
+ parse_ciff (save+hlen, len-hlen);
parse_ciff (save+hlen, len-hlen);
+/*RT*/ }
if (parse_tiff (save+6)) apply_tiff();
fseek (ifp, save+len, SEEK_SET);
}
@@ -6181,36 +6202,36 @@
@@ -6165,7 +6190,9 @@
{
static const struct {
const char *prefix;
- short black, maximum, trans[12];
+ short black;
+ int maximum;
+ short trans[12];
} table[] = {
{ "AGFAPHOTO DC-833m", 0, 0, /* DJC */
{ 11438,-3762,-1115,-2409,9914,2497,-1227,2295,5300 } },
@@ -6181,36 +6208,36 @@
{ 6188,-1341,-890,-7168,14489,2937,-2640,3228,8483 } },
{ "Canon EOS 5D Mark II", 0, 0x3cf0,
{ 4716,603,-830,-7798,15474,2480,-1496,1937,6651 } },
@@ -419,7 +529,7 @@
{ "Canon EOS 600D", 0, 0x3510,
{ 6461,-907,-882,-4300,12184,2378,-819,1944,5931 } },
{ "Canon EOS 1000D", 0, 0xe43,
@@ -6223,8 +6244,8 @@
@@ -6223,8 +6250,8 @@
{ 6517,-602,-867,-8180,15926,2378,-1618,1771,7633 } },
{ "Canon EOS-1D Mark IV", 0, 0x3bb0,
{ 6014,-220,-795,-4109,12014,2361,-561,1824,5787 } },
@@ -430,7 +540,7 @@
{ "Canon EOS-1D Mark II N", 0, 0xe80,
{ 6240,-466,-822,-8180,15825,2500,-1801,1938,8042 } },
{ "Canon EOS-1D Mark II", 0, 0xe80,
@@ -6241,12 +6262,12 @@
@@ -6241,12 +6268,12 @@
{ -5300,9846,1776,3436,684,3939,-5540,9879,6200,-1404,11175,217 } },
{ "Canon PowerShot A5", 0, 0,
{ -4801,9475,1952,2926,1611,4094,-5259,10164,5947,-1554,10883,547 } },
@@ -447,16 +557,7 @@
{ "Canon PowerShot G1", 0, 0,
{ -4778,9467,2172,4743,-1141,4344,-5146,9908,6077,-1566,11051,557 } },
{ "Canon PowerShot G2", 0, 0,
@@ -6302,7 +6323,7 @@
{ "Canon PowerShot SX1 IS", 0, 0,
{ 6578,-259,-502,-5974,13030,3309,-308,1058,4970 } },
{ "Canon PowerShot SX110 IS", 0, 0, /* DJC */
- { 14134,-5576,-1527,-1991,10719,1273,-1158,1929,3581 } },
+ { 14134,-5576,-1527,-1991,10719,1273,-1158,1929,3581 } },
{ "CASIO EX-S20", 0, 0, /* DJC */
{ 11634,-3924,-1128,-4968,12954,2015,-1588,2648,7206 } },
{ "CASIO EX-Z750", 0, 0, /* DJC */
@@ -6373,8 +6394,8 @@
@@ -6373,8 +6400,8 @@
{ 13690,-5358,-1474,-3369,11600,1998,-132,1554,4395 } },
{ "FUJIFILM FinePix F600EXR", 0, 0,
{ 13690,-5358,-1474,-3369,11600,1998,-132,1554,4395 } },
@@ -467,7 +568,7 @@
{ "FUJIFILM X10", 0, 0,
{ 13509,-6199,-1254,-4430,12733,1865,-331,1441,5022 } },
{ "Imacon Ixpress", 0, 0, /* DJC */
@@ -6475,22 +6496,22 @@
@@ -6475,22 +6502,22 @@
{ 7702,-2245,-975,-9114,17242,1875,-2679,3055,8521 } },
{ "NIKON D1", 0, 0, /* multiplied by 2.218750, 1.0, 1.148438 */
{ 16772,-4726,-2141,-7611,15713,1972,-2846,3494,9521 } },
@@ -498,7 +599,7 @@
{ "NIKON D3", 0, 0,
{ 8139,-2171,-663,-8747,16541,2295,-1925,2008,8093 } },
{ "NIKON D40X", 0, 0,
@@ -6505,10 +6526,10 @@
@@ -6505,10 +6532,10 @@
{ 7732,-2422,-789,-8238,15884,2498,-859,783,7330 } },
{ "NIKON D60", 0, 0,
{ 8736,-2458,-935,-9075,16894,2251,-1354,1242,8263 } },
@@ -513,7 +614,7 @@
{ "NIKON D70", 0, 0,
{ 7732,-2422,-789,-8238,15884,2498,-859,783,7330 } },
{ "NIKON D80", 0, 0,
@@ -6569,8 +6590,8 @@
@@ -6569,8 +6596,8 @@
{ 7828,-1761,-348,-5788,14071,1830,-2853,4518,6557 } },
{ "OLYMPUS E-330", 0, 0,
{ 8961,-2473,-1084,-7979,15990,2067,-2319,3035,8249 } },
@@ -524,7 +625,7 @@
{ "OLYMPUS E-3", 0, 0xf99,
{ 9487,-2875,-1115,-7533,15606,2010,-1618,2100,7389 } },
{ "OLYMPUS E-400", 0, 0,
@@ -6587,26 +6608,26 @@
@@ -6587,26 +6614,26 @@
{ 8785,-2529,-1033,-7639,15624,2112,-1783,2300,7817 } },
{ "OLYMPUS E-520", 0, 0xfd2,
{ 8344,-2322,-1020,-7596,15635,2048,-1748,2269,7287 } },
@@ -567,7 +668,7 @@
{ "OLYMPUS E-PM1", 0, 0,
{ 7575,-2159,-571,-3722,11341,2725,-1434,2819,6271 } },
{ "OLYMPUS SP350", 0, 0,
@@ -6623,8 +6644,8 @@
@@ -6623,8 +6650,8 @@
{ 10915,-3677,-982,-5587,12986,2911,-1168,1968,6223 } },
{ "OLYMPUS SP570UZ", 0, 0,
{ 11522,-4044,-1146,-4736,12172,2904,-988,1829,6039 } },
@@ -578,7 +679,7 @@
{ "PENTAX *ist DL2", 0, 0,
{ 10504,-2438,-1189,-8603,16207,2531,-1022,863,12242 } },
{ "PENTAX *ist DL", 0, 0,
@@ -6641,8 +6662,8 @@
@@ -6641,8 +6668,8 @@
{ 11095,-3157,-1324,-8377,15834,2720,-1108,947,11688 } },
{ "PENTAX K20D", 0, 0,
{ 9427,-2714,-868,-7493,16092,1373,-2199,3264,7180 } },
@@ -589,7 +690,7 @@
{ "PENTAX K2000", 0, 0,
{ 11057,-3604,-1155,-5152,13046,2329,-282,375,8104 } },
{ "PENTAX K-m", 0, 0,
@@ -6699,34 +6720,36 @@
@@ -6699,34 +6726,36 @@
{ 10909,-4295,-948,-1333,9306,2399,22,1738,4582 } },
{ "LEICA D-LUX 5", 143, 0,
{ 10909,-4295,-948,-1333,9306,2399,22,1738,4582 } },
@@ -646,7 +747,7 @@
{ "Panasonic DMC-GX1", 143, 0,
{ 6763,-1919,-863,-3868,11515,2684,-1216,2387,5879 } },
{ "Phase One H 20", 0, 0, /* DJC */
@@ -6787,26 +6810,22 @@
@@ -6787,26 +6816,22 @@
{ 5932,-1492,-411,-4813,12285,2856,-741,1524,6739 } },
{ "SONY DSLR-A5", 128, 0xfeb,
{ 4950,-580,-103,-5228,12542,3029,-709,1435,7371 } },
@@ -685,7 +786,7 @@
{ "SONY SLT-A33", 128, 0,
{ 6069,-1221,-366,-5221,12779,2734,-1024,2066,6834 } },
{ "SONY SLT-A35", 128, 0,
@@ -6815,8 +6834,8 @@
@@ -6815,8 +6840,8 @@
{ 5932,-1492,-411,-4813,12285,2856,-741,1524,6739 } },
{ "SONY SLT-A65", 128, 0,
{ 5491,-1192,-363,-4951,12342,2948,-911,1722,7192 } },
@@ -696,7 +797,7 @@
};
double cam_xyz[4][3];
char name[130];
@@ -7060,6 +7079,12 @@
@@ -7060,6 +7085,12 @@
fread (head, 1, 32, ifp);
fseek (ifp, 0, SEEK_END);
flen = fsize = ftell(ifp);
@@ -709,7 +810,7 @@
if ((cp = (char *) memmem (head, 32, "MMMM", 4)) ||
(cp = (char *) memmem (head, 32, "IIII", 4))) {
parse_phase_one (cp-head);
@@ -7067,6 +7092,8 @@
@@ -7067,6 +7098,8 @@
} else if (order == 0x4949 || order == 0x4d4d) {
if (!memcmp (head+6,"HEAPCCDR",8)) {
data_offset = hlen;
@@ -718,7 +819,7 @@
parse_ciff (hlen, flen - hlen);
} else if (parse_tiff(0)) apply_tiff();
} else if (!memcmp (head,"\xff\xd8\xff\xe1",4) &&
@@ -7110,6 +7137,7 @@
@@ -7110,6 +7143,7 @@
fseek (ifp, 100+28*(shot_select > 0), SEEK_SET);
parse_tiff (data_offset = get4());
parse_tiff (thumb_offset+12);
@@ -726,7 +827,7 @@
apply_tiff();
} else if (!memcmp (head,"RIFF",4)) {
fseek (ifp, 0, SEEK_SET);
@@ -7155,8 +7183,7 @@
@@ -7155,8 +7189,7 @@
parse_redcine();
load_raw = &CLASS redcine_load_raw;
gamma_curve (1/2.4, 12.92, 1, 4095);
@@ -736,7 +837,7 @@
parse_rollei();
else if (!memcmp (head,"PWAD",4))
parse_sinar_ia();
@@ -7211,7 +7238,7 @@
@@ -7211,7 +7244,7 @@
if (height == 3136 && width == 4864) /* Pentax K20D and Samsung GX20 */
{ height = 3124; width = 4688; filters = 0x16161616; }
if (width == 4352 && (!strcmp(model,"K-r") || !strcmp(model,"K-x")))
@@ -745,16 +846,16 @@
if (width >= 4960 && !strcmp(model,"K-5"))
{ left_margin = 10; width = 4950; filters = 0x16161616; }
if (width == 4736 && !strcmp(model,"K-7"))
@@ -8553,7 +8580,7 @@
for (j=0; j < 3; j++) {
for (num = k=0; k < 3; k++)
num += xyzd50_srgb[i][k] * inverse[j][k];
- oprof[pbody[j*3+23]/4+i+2] = num * 0x10000 + 0.5;
+ oprof[pbody[j*3+23]/4+i+2] = num * 0x10000 + 0.5;
}
for (i=0; i < phead[0]/4; i++)
oprof[i] = htonl(oprof[i]);
@@ -8852,13 +8879,13 @@
@@ -8779,7 +8812,7 @@
strncpy (th->desc, desc, 512);
strncpy (th->make, make, 64);
strncpy (th->model, model, 64);
- strcpy (th->soft, "dcraw v"DCRAW_VERSION);
+ sprintf (th->soft, "dcraw v%s", DCRAW_VERSION);
t = localtime (&timestamp);
sprintf (th->date, "%04d:%02d:%02d %02d:%02d:%02d",
t->tm_year+1900,t->tm_mon+1,t->tm_mday,t->tm_hour,t->tm_min,t->tm_sec);
@@ -8852,13 +8885,13 @@
FORCC ppm [col*colors+c] = curve[image[soff][c]] >> 8;
else FORCC ppm2[col*colors+c] = curve[image[soff][c]];
if (output_bps == 16 && !output_tiff && htons(0x55aa) != 0x55aa)
@@ -770,7 +871,7 @@
{
int arg, status=0;
int timestamp_only=0, thumbnail_only=0, identify_only=0;
@@ -8971,7 +8998,7 @@
@@ -8971,7 +9004,7 @@
case 'i': identify_only = 1; break;
case 'c': write_to_stdout = 1; break;
case 'v': verbose = 1; break;
@@ -779,8 +880,11 @@
case 'f': four_color_rgb = 1; break;
case 'A': FORC4 greybox[c] = atoi(argv[arg++]);
case 'a': use_auto_wb = 1; break;
@@ -9234,3 +9261,4 @@
@@ -9234,3 +9267,7 @@
}
return status;
}
+*/
+/*RT*/#undef MAX
+/*RT*/#undef MIN
+/*RT*/#undef ABS