line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
2
|
|
|
|
|
|
|
# File: KyoceraRaw.pm |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# Description: Read Kyocera RAW meta information |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
# Revisions: 02/17/2006 - P. Harvey Created |
7
|
|
|
|
|
|
|
# |
8
|
|
|
|
|
|
|
# References: 1) http://www.cybercom.net/~dcoffin/dcraw/ |
9
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
package Image::ExifTool::KyoceraRaw; |
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
4500
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
32
|
|
14
|
1
|
|
|
1
|
|
6
|
use vars qw($VERSION); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
44
|
|
15
|
1
|
|
|
1
|
|
7
|
use Image::ExifTool qw(:DataAccess :Utils); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
583
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
$VERSION = '1.03'; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub ProcessRAW($$); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# utility to reverse order of characters in a string |
22
|
4
|
|
|
4
|
0
|
41
|
sub ReverseString($) { pack('C*',reverse unpack('C*',shift)) } |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# Contax N Digital tags (ref PH) |
25
|
|
|
|
|
|
|
%Image::ExifTool::KyoceraRaw::Main = ( |
26
|
|
|
|
|
|
|
PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData, |
27
|
|
|
|
|
|
|
GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' }, |
28
|
|
|
|
|
|
|
NOTES => 'Tags for Kyocera Contax N Digital RAW images.', |
29
|
|
|
|
|
|
|
0x01 => { |
30
|
|
|
|
|
|
|
Name => 'FirmwareVersion', |
31
|
|
|
|
|
|
|
Format => 'string[10]', |
32
|
|
|
|
|
|
|
ValueConv => \&ReverseString, |
33
|
|
|
|
|
|
|
}, |
34
|
|
|
|
|
|
|
0x0c => { |
35
|
|
|
|
|
|
|
Name => 'Model', |
36
|
|
|
|
|
|
|
Format => 'string[12]', |
37
|
|
|
|
|
|
|
ValueConv => \&ReverseString, |
38
|
|
|
|
|
|
|
}, |
39
|
|
|
|
|
|
|
0x19 => { #1 |
40
|
|
|
|
|
|
|
Name => 'Make', |
41
|
|
|
|
|
|
|
Format => 'string[7]', |
42
|
|
|
|
|
|
|
ValueConv => \&ReverseString, |
43
|
|
|
|
|
|
|
}, |
44
|
|
|
|
|
|
|
0x21 => { #1 |
45
|
|
|
|
|
|
|
Name => 'DateTimeOriginal', |
46
|
|
|
|
|
|
|
Description => 'Date/Time Original', |
47
|
|
|
|
|
|
|
Groups => { 2 => 'Time' }, |
48
|
|
|
|
|
|
|
Format => 'string[20]', |
49
|
|
|
|
|
|
|
ValueConv => \&ReverseString, |
50
|
|
|
|
|
|
|
PrintConv => '$self->ConvertDateTime($val)', |
51
|
|
|
|
|
|
|
}, |
52
|
|
|
|
|
|
|
0x34 => { |
53
|
|
|
|
|
|
|
Name => 'ISO', |
54
|
|
|
|
|
|
|
Groups => { 2 => 'Image' }, |
55
|
|
|
|
|
|
|
Format => 'int32u', |
56
|
|
|
|
|
|
|
PrintConv => { |
57
|
|
|
|
|
|
|
7 => 25, |
58
|
|
|
|
|
|
|
8 => 32, |
59
|
|
|
|
|
|
|
9 => 40, |
60
|
|
|
|
|
|
|
10 => 50, |
61
|
|
|
|
|
|
|
11 => 64, |
62
|
|
|
|
|
|
|
12 => 80, |
63
|
|
|
|
|
|
|
13 => 100, |
64
|
|
|
|
|
|
|
14 => 125, |
65
|
|
|
|
|
|
|
15 => 160, |
66
|
|
|
|
|
|
|
16 => 200, |
67
|
|
|
|
|
|
|
17 => 250, |
68
|
|
|
|
|
|
|
18 => 320, |
69
|
|
|
|
|
|
|
19 => 400, |
70
|
|
|
|
|
|
|
}, |
71
|
|
|
|
|
|
|
}, |
72
|
|
|
|
|
|
|
0x38 => { |
73
|
|
|
|
|
|
|
Name => 'ExposureTime', |
74
|
|
|
|
|
|
|
Groups => { 2 => 'Image' }, |
75
|
|
|
|
|
|
|
Format => 'int32u', |
76
|
|
|
|
|
|
|
ValueConv => '2**($val / 8) / 16000', |
77
|
|
|
|
|
|
|
PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)', |
78
|
|
|
|
|
|
|
}, |
79
|
|
|
|
|
|
|
0x3c => { #1 |
80
|
|
|
|
|
|
|
Name => 'WB_RGGBLevels', |
81
|
|
|
|
|
|
|
Groups => { 2 => 'Image' }, |
82
|
|
|
|
|
|
|
Format => 'int32u[4]', |
83
|
|
|
|
|
|
|
}, |
84
|
|
|
|
|
|
|
0x58 => { |
85
|
|
|
|
|
|
|
Name => 'FNumber', |
86
|
|
|
|
|
|
|
Groups => { 2 => 'Image' }, |
87
|
|
|
|
|
|
|
Format => 'int32u', |
88
|
|
|
|
|
|
|
ValueConv => '2**($val/16)', |
89
|
|
|
|
|
|
|
PrintConv => 'sprintf("%.2g",$val)', |
90
|
|
|
|
|
|
|
}, |
91
|
|
|
|
|
|
|
0x68 => { |
92
|
|
|
|
|
|
|
Name => 'MaxAperture', |
93
|
|
|
|
|
|
|
Format => 'int32u', |
94
|
|
|
|
|
|
|
ValueConv => '2**($val/16)', |
95
|
|
|
|
|
|
|
PrintConv => 'sprintf("%.2g",$val)', |
96
|
|
|
|
|
|
|
}, |
97
|
|
|
|
|
|
|
0x70 => { |
98
|
|
|
|
|
|
|
Name => 'FocalLength', |
99
|
|
|
|
|
|
|
Format => 'int32u', |
100
|
|
|
|
|
|
|
PrintConv => '"$val mm"', |
101
|
|
|
|
|
|
|
}, |
102
|
|
|
|
|
|
|
0x7c => { |
103
|
|
|
|
|
|
|
Name => 'Lens', |
104
|
|
|
|
|
|
|
Format => 'string[32]', |
105
|
|
|
|
|
|
|
}, |
106
|
|
|
|
|
|
|
); |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
109
|
|
|
|
|
|
|
# Extract information from Kyocera RAW image |
110
|
|
|
|
|
|
|
# Inputs: 0) ExifTool object reference, 1) dirInfo reference |
111
|
|
|
|
|
|
|
# Returns: 1 if this was a valid Kyocera RAW image |
112
|
|
|
|
|
|
|
sub ProcessRAW($$) |
113
|
|
|
|
|
|
|
{ |
114
|
1
|
|
|
1
|
0
|
3
|
my ($et, $dirInfo) = @_; |
115
|
1
|
|
|
|
|
3
|
my $raf = $$dirInfo{RAF}; |
116
|
1
|
|
|
|
|
2
|
my $size = 156; # size of header |
117
|
1
|
|
|
|
|
1
|
my $buff; |
118
|
|
|
|
|
|
|
|
119
|
1
|
50
|
|
|
|
4
|
$raf->Read($buff, $size) == $size or return 0; |
120
|
|
|
|
|
|
|
# validate Make string ('KYOCERA' reversed) |
121
|
1
|
50
|
|
|
|
5
|
substr($buff, 0x19, 7) eq 'ARECOYK' or return 0; |
122
|
1
|
|
|
|
|
8
|
$et->SetFileType(); |
123
|
1
|
|
|
|
|
14
|
SetByteOrder('MM'); |
124
|
1
|
|
|
|
|
16
|
my %dirInfo = ( |
125
|
|
|
|
|
|
|
DataPt => \$buff, |
126
|
|
|
|
|
|
|
DataPos => 0, |
127
|
|
|
|
|
|
|
DataLen => $size, |
128
|
|
|
|
|
|
|
DirStart => 0, |
129
|
|
|
|
|
|
|
DirLen => $size, |
130
|
|
|
|
|
|
|
); |
131
|
1
|
|
|
|
|
6
|
my $tagTablePtr = GetTagTable('Image::ExifTool::KyoceraRaw::Main'); |
132
|
1
|
|
|
|
|
6
|
$et->ProcessDirectory(\%dirInfo, $tagTablePtr); |
133
|
1
|
|
|
|
|
4
|
return 1; |
134
|
|
|
|
|
|
|
} |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
1; # end |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
__END__ |