annotate src/format_fuji.c @ 414:49c1cbe058ae

partially fixed reading embedded color profiles with exiv2
author nadvornik
date Fri, 18 Apr 2008 22:31:58 +0000
parents 9995c5fb202a
children 4b2d7f9af171
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
45
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
1 /*
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
2 * GQView
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
3 * (C) 2005 John Ellis
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
4 *
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
5 * Authors:
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
6 * Original version 2005 Lars Ellenberg, base on dcraw by David coffin.
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
7 *
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
8 * This software is released under the GNU General Public License (GNU GPL).
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
9 * Please read the included file COPYING for more information.
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
10 * This software comes with no warranty of any kind, use at your own risk!
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
11 */
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
12
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
13 #ifdef HAVE_CONFIG_H
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
14 # include "config.h"
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
15 #endif
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
16
177
0ca3b4c8ffae started exiv2 integration
nadvornik
parents: 138
diff changeset
17 #ifndef HAVE_EXIV2
45
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
18
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
19 #include <stdio.h>
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
20 #include <string.h>
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
21 #include <unistd.h>
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
22
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
23 #include <glib.h>
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
24
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
25 #include "intl.h"
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
26
281
9995c5fb202a gqview.h -> main.h
zas_
parents: 177
diff changeset
27 #include "main.h"
45
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
28 #include "format_fuji.h"
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
29 #include "format_raw.h"
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
30
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
31 #include "exif.h"
45
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
32
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
33
53
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
34 /*
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
35 *-----------------------------------------------------------------------------
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
36 * Raw (RAF) embedded jpeg extraction for Fujifilm
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
37 *-----------------------------------------------------------------------------
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
38 */
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
39
00843150f7c8 Tue Jun 7 03:47:03 2005 John Ellis <johne@verizon.net>
gqview
parents: 51
diff changeset
40
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 53
diff changeset
41 gint format_fuji_raw(unsigned char *data, const guint len,
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
42 guint *image_offset, guint *exif_offset)
45
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
43 {
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
44 guint io;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
45 guint eo;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
46
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
47 if (len < 128 ||
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
48 memcmp(data, "FUJIFILM", 8) != 0)
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
49 {
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
50 return FALSE;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
51 }
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
52
101
847e4bc6b54c Tue Nov 7 15:35:59 2006 John Ellis <johne@verizon.net>
gqview
parents: 57
diff changeset
53 /* offset to jpeg is embedded at bytes 84-87 */
108
9c355d5c8619 Fri Nov 10 16:11:28 2006 John Ellis <johne@verizon.net>
gqview
parents: 101
diff changeset
54 io = exif_byte_get_int32(data + 84, EXIF_BYTE_ORDER_MOTOROLA);
101
847e4bc6b54c Tue Nov 7 15:35:59 2006 John Ellis <johne@verizon.net>
gqview
parents: 57
diff changeset
55 if (io + 4 > len) return FALSE;
45
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
56
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
57 /* verify jpeg marker */
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
58 if (memcmp(data + io, "\xff\xd8\xff\xe1", 4) != 0)
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
59 {
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
60 return FALSE;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
61 }
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
62
101
847e4bc6b54c Tue Nov 7 15:35:59 2006 John Ellis <johne@verizon.net>
gqview
parents: 57
diff changeset
63 /* Exif is stored in the jpeg, so use the same offset */
847e4bc6b54c Tue Nov 7 15:35:59 2006 John Ellis <johne@verizon.net>
gqview
parents: 57
diff changeset
64 eo=io;
847e4bc6b54c Tue Nov 7 15:35:59 2006 John Ellis <johne@verizon.net>
gqview
parents: 57
diff changeset
65
45
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
66 if (image_offset) *image_offset = io;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
67 if (exif_offset) *exif_offset = eo;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
68
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
69 return TRUE;
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
70 }
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
71
7cfa60beda76 Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net>
gqview
parents:
diff changeset
72
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
73 /*
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
74 *-----------------------------------------------------------------------------
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
75 * EXIF Makernote for Fujifilm
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
76 *-----------------------------------------------------------------------------
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
77 */
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
78
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
79 static ExifTextList FujiTagSharpness[] = {
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
80 { 1, "soft" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
81 { 2, "soft" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
82 { 3, "normal" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
83 { 4, "hard" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
84 { 5, "hard" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
85 EXIF_TEXT_LIST_END
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
86 };
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
87
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
88 static ExifTextList FujiTagWhiteBalance[]= {
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
89 { 0, "auto" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
90 { 256, "daylight" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
91 { 512, "cloudy" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
92 { 768, "daylight color-fluorescence" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
93 { 769, "daywhite color-fluorescence" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
94 { 770, "white-fluorescence" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
95 { 1024, "incandescent" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
96 { 3840, "custom" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
97 EXIF_TEXT_LIST_END
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
98 };
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
99
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
100 static ExifTextList FujiTagColorTone[]= {
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
101 { 0, "normal" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
102 { 256, "high" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
103 { 512, "low" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
104 EXIF_TEXT_LIST_END
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
105 };
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
106
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
107 static ExifTextList FujiTagFlashMode[]= {
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
108 { 0, "auto" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
109 { 1, "on" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
110 { 2, "off" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
111 { 3, "red-eye reduction" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
112 EXIF_TEXT_LIST_END
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
113 };
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
114
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
115 static ExifTextList FujiTagOffOn[]= {
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
116 { 0, "off" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
117 { 1, "on" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
118 EXIF_TEXT_LIST_END
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
119 };
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
120
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
121 static ExifTextList FujiTagFocusMode[]= {
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
122 { 0, "auto" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
123 { 1, "manual" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
124 EXIF_TEXT_LIST_END
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
125 };
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
126
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
127 static ExifTextList FujiTagPictureMode[]= {
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
128 { 0, "auto" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
129 { 1, "portrait" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
130 { 2, "landscape" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
131 { 4, "sports" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
132 { 5, "night" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
133 { 6, "program AE" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
134 { 256, "aperture priority AE" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
135 { 512, "shutter priority AE" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
136 { 768, "manual" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
137 EXIF_TEXT_LIST_END
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
138 };
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
139
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
140 static ExifTextList FujiTagNoYes[]= {
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
141 { 0, "no" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
142 { 1, "yes" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
143 EXIF_TEXT_LIST_END
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
144 };
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
145
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
146 #if 0
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
147 static ExifTextList FujiTag[]= {
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
148 { , "" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
149 { , "" },
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
150 EXIF_TEXT_LIST_END
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
151 };
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
152 #endif
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
153
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
154
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
155 static ExifMarker FujiExifMarkersList[] = {
57
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
156 { 0x1000, EXIF_FORMAT_STRING, 8, "Fuji.Quality", "Quality", NULL },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
157 { 0x1001, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Fuji.Sharpness", "Sharpness", FujiTagSharpness },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
158 { 0x1002, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Fuji.WhiteBalance", "White balance",FujiTagWhiteBalance },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
159 { 0x1003, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Fuji.Color", "Color", FujiTagColorTone },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
160 { 0x1004, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Fuji.Tone", "Tone", FujiTagColorTone },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
161 { 0x1010, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Fuji.FlashMode", "Flash mode", FujiTagFlashMode },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
162 { 0x1011, EXIF_FORMAT_RATIONAL, 1, "Fuji.FlashStrength", "Flash strength", NULL },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
163 { 0x1020, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Fuji.Macro", "Macro", FujiTagOffOn },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
164 { 0x1021, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Fuji.FocusMode", "Focus mode", FujiTagFocusMode },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
165 { 0x1030, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Fuji.SlowSync", "Slow synchro", FujiTagOffOn },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
166 { 0x1031, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Fuji.PictureMode", "Picture mode", FujiTagPictureMode },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
167 { 0x1100, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Fuji.ContTake/Bracket",
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
168 "Continuous / Auto bracket", FujiTagOffOn },
57
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
169 { 0x1300, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Fuji.BlurWarning", "Blue warning", FujiTagNoYes },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
170 { 0x1301, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Fuji.FocusWarning", "Focus warning",FujiTagNoYes },
a8c9992320f4 Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
gqview
parents: 54
diff changeset
171 { 0x1302, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Fuji.AEWarning", "AE warning", FujiTagNoYes },
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
172 EXIF_MARKER_LIST_END
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
173 };
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
174
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
175
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
176
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
177 gint format_fuji_makernote(ExifData *exif, unsigned char *tiff, guint offset,
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 53
diff changeset
178 guint size, ExifByteOrder bo)
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
179 {
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
180 unsigned char *data;
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
181 guint ifdstart;
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
182
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
183 if (offset + 8 + 4 >= size) return FALSE;
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
184
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
185 data = tiff + offset;
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 53
diff changeset
186
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 53
diff changeset
187 /* Fuji tag format starts with "FUJIFILM",
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 53
diff changeset
188 * followed by 4 bytes indicating offset to IFD directory using Fuji tags,
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 53
diff changeset
189 * byte order is always little endian (II).
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 53
diff changeset
190 */
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
191 if (memcmp(data, "FUJIFILM", 8) != 0) return FALSE;
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
192
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
193 ifdstart = exif_byte_get_int32(data + 8, EXIF_BYTE_ORDER_INTEL);
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
194 if (offset + ifdstart >= size) return FALSE;
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
195
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
196 if (exif_parse_IFD_table(exif, tiff + offset, ifdstart, size - offset,
54
b58cac75ad12 Thu Jun 9 22:23:18 2005 John Ellis <johne@verizon.net>
gqview
parents: 53
diff changeset
197 EXIF_BYTE_ORDER_INTEL, 0, FujiExifMarkersList) != 0)
51
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
198 {
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
199 return FALSE;
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
200 }
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
201
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
202 return TRUE;
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
203 }
276ea4c98d33 Sat Jun 4 22:24:00 2005 John Ellis <johne@verizon.net>
gqview
parents: 45
diff changeset
204
177
0ca3b4c8ffae started exiv2 integration
nadvornik
parents: 138
diff changeset
205 #endif
0ca3b4c8ffae started exiv2 integration
nadvornik
parents: 138
diff changeset
206 /* not HAVE_EXIV2 */