-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathdcraw.patch
127 lines (126 loc) · 3.66 KB
/
dcraw.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
--- dcraw.tmp.c~ 2020-04-25 19:35:20.262807800 +0200
+++ dcraw.tmp.c 2020-04-25 19:41:25.738176300 +0200
@@ -176,2 +176,21 @@
#define SWAP(a,b) { a=a+b; b=a-b; a=a-b; }
+#define SET_TIMESTAMP(t) ({ time_t _ = mktime(t); if (_ > 0) timestamp = _; })
+
+#ifdef SMALL
+# define bright (1)
+# define half_size (1)
+# define threshold (0)
+# define highlight (0)
+# define output_bps (8)
+# define use_auto_wb (1)
+# define output_tiff (0)
+# define output_color (1)
+# define use_camera_wb (0)
+# define document_mode (1)
+# define four_color_rgb (1)
+# define no_auto_bright (0)
+# define use_camera_matrix (1)
+# undef stdout
+# define stdout NULL
+#endif /* SMALL */
@@ -5488,4 +5507,3 @@
t.tm_isdst = -1;
- if (mktime(&t) > 0)
- timestamp = mktime(&t);
+ SET_TIMESTAMP(&t);
}
@@ -5799,2 +5817,4 @@
case 274: /* Orientation */
+ // i = get2();
+ // tiff_ifd[ifd].flip = "50132467"[(/*dng_version&&*/i>8?i>>1:i) & 7]-'0';
tiff_ifd[ifd].flip = "50132467"[get2() & 7]-'0';
@@ -5939,4 +5959,6 @@
case 34853: /* GPSInfo tag */
+#ifndef SMALL
fseek (ifp, get4()+base, SEEK_SET);
parse_gps (base);
+#endif
break;
@@ -6613,4 +6635,3 @@
t.tm_mon -= 1;
- if (mktime(&t) > 0)
- timestamp = mktime(&t);
+ SET_TIMESTAMP(&t);
strcpy (make, "Rollei");
@@ -6819,4 +6840,3 @@
t.tm_year -= 1900;
- if (mktime(&t) > 0)
- timestamp = mktime(&t);
+ SET_TIMESTAMP(&t);
}
@@ -8803,4 +8823,6 @@
zero_is_bad = table[i].flags & 2;
+#ifndef SMALL
if (table[i].flags & 1)
parse_external_jpeg();
+#endif
data_offset = table[i].offset;
@@ -9952,2 +9974,6 @@
th->rat[8] *= focal_len;
+#ifdef SMALL
+ tiff_set (th, &th->ntag, 274, 3, 1, "12435867"[flip]-'0');
+ return;
+#endif
strncpy (th->desc, desc, 512);
@@ -10095,3 +10121,20 @@
#endif
-
+#ifdef SMALL
+ argv[argc] = "";
+ for (arg=1; (((opm = argv[arg][0]) - 2) | 2) == '+'; ) {
+ opt = argv[arg++][1];
+ switch (opt) {
+ case 'O': outfile = argv[arg++]; break;
+ case 'e': thumbnail_only = 1; break;
+ case 'i': identify_only = 1; break;
+ case 'v': verbose = 1; break;
+ default:
+ fprintf (stderr,_("Unknown option \"-%c\".\n"), opt);
+ return 1;
+ }
+ }
+ if (thumbnail_only) {
+ printf(_("Raw photo decoder, dcraw.js v%s - https://github.com/meganz/dcraw.js\n"), DCRAW_VERSION);
+ }
+#else /* SMALL */
#ifndef LOCALTIME
@@ -10235,2 +10278,3 @@
}
+#endif /* SMALL */
for ( ; arg < argc; arg++) {
@@ -10279,2 +10323,5 @@
goto next;
+ } else if ((status = !(thumb_height * thumb_width > 262144 && ((int)thumb_length) > 0x7ff))) {
+ fprintf (stderr,_("%s has unwanted thumbnail: %d x %d (%db)\n"), ifname, thumb_width, thumb_height, thumb_length);
+ goto next;
} else if (thumb_load_raw) {
@@ -10298,3 +10345,7 @@
printf (_("\nFilename: %s\n"), ifname);
+#ifndef SMALL
printf (_("Timestamp: %s"), ctime(×tamp));
+#else
+ printf (_("Timestamp: %10ld\n"), (long) timestamp);
+#endif
printf (_("Camera: %s %s\n"), make, model);
@@ -10326,2 +10377,5 @@
(threshold || aber[0] != 1 || aber[2] != 1)));
+#ifdef SMALL
+ for (iwidth = height > width ? height : width, shrink = 8; shrink && ((iwidth >> shrink) < 1000); --shrink) {}
+#endif
iheight = (height + shrink) >> shrink;
@@ -10329,2 +10383,4 @@
if (identify_only) {
+ printf(_("shrink(%d): %d x %d -> %d x %d (f:%x,c:%d,o:%d)\n"),
+ shrink, width, height, iwidth, iheight, filters, colors, flip);
if (0) {
@@ -10454,2 +10510,3 @@
image[i][1] = (image[i][1] + image[i][3]) >> 1;
+#ifndef SMALL
if (!is_foveon && colors == 3) median_filter();
@@ -10461,2 +10518,3 @@
#endif
+#endif
convert_to_rgb();