| 1 | #------------------------------------------------------------------------------ | ||||||||||
| 2 | # File: Sanyo.pm | ||||||||||
| 3 | # | ||||||||||
| 4 | # Description: Sanyo EXIF maker notes tags | ||||||||||
| 5 | # | ||||||||||
| 6 | # Revisions: 04/06/2004 - P. Harvey Created | ||||||||||
| 7 | # | ||||||||||
| 8 | # Reference: http://www.exif.org/makernotes/SanyoMakerNote.html | ||||||||||
| 9 | #------------------------------------------------------------------------------ | ||||||||||
| 10 | |||||||||||
| 11 | package Image::ExifTool::Sanyo; | ||||||||||
| 12 | |||||||||||
| 13 | 10 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | 10 | ▶ | use vars qw($VERSION); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 15 | 10 | ▶ | use Image::ExifTool::Exif; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 16 | |||||||||||
| 17 | 10 | $VERSION = '1.16'; | |||||||||
| 18 | |||||||||||
| 19 | 10 | my %offOn = ( | |||||||||
| 20 | 0 => 'Off', | ||||||||||
| 21 | 1 => 'On', | ||||||||||
| 22 | ); | ||||||||||
| 23 | |||||||||||
| 24 | 10 | %Image::ExifTool::Sanyo::Main = ( | |||||||||
| 25 | WRITE_PROC => \&Image::ExifTool::Exif::WriteExif, | ||||||||||
| 26 | CHECK_PROC => \&Image::ExifTool::Exif::CheckExif, | ||||||||||
| 27 | WRITABLE => 1, | ||||||||||
| 28 | GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' }, | ||||||||||
| 29 | 0x00ff => { | ||||||||||
| 30 | # this is an absolute offset in the JPG file... odd - PH | ||||||||||
| 31 | Name => 'MakerNoteOffset', | ||||||||||
| 32 | Writable => 'int32u', | ||||||||||
| 33 | }, | ||||||||||
| 34 | 0x0100 => { | ||||||||||
| 35 | Name => 'SanyoThumbnail', | ||||||||||
| 36 | Groups => { 2 => 'Preview' }, | ||||||||||
| 37 | Writable => 'undef', | ||||||||||
| 38 | WriteCheck => '$self->CheckImage(\$val)', | ||||||||||
| 39 | RawConv => '$self->ValidateImage(\$val,$tag)', | ||||||||||
| 40 | }, | ||||||||||
| 41 | 0x0200 => { | ||||||||||
| 42 | Name => 'SpecialMode', | ||||||||||
| 43 | Writable => 'int32u', | ||||||||||
| 44 | Count => 3, | ||||||||||
| 45 | }, | ||||||||||
| 46 | 0x0201 => { | ||||||||||
| 47 | Name => 'SanyoQuality', | ||||||||||
| 48 | Flags => 'PrintHex', | ||||||||||
| 49 | Writable => 'int16u', | ||||||||||
| 50 | PrintConv => { | ||||||||||
| 51 | 0x0000 => 'Normal/Very Low', | ||||||||||
| 52 | 0x0001 => 'Normal/Low', | ||||||||||
| 53 | 0x0002 => 'Normal/Medium Low', | ||||||||||
| 54 | 0x0003 => 'Normal/Medium', | ||||||||||
| 55 | 0x0004 => 'Normal/Medium High', | ||||||||||
| 56 | 0x0005 => 'Normal/High', | ||||||||||
| 57 | 0x0006 => 'Normal/Very High', | ||||||||||
| 58 | 0x0007 => 'Normal/Super High', | ||||||||||
| 59 | # have seen 0x11 with HD2000 in '8M-H JPEG' mode - PH | ||||||||||
| 60 | 0x0100 => 'Fine/Very Low', | ||||||||||
| 61 | 0x0101 => 'Fine/Low', | ||||||||||
| 62 | 0x0102 => 'Fine/Medium Low', | ||||||||||
| 63 | 0x0103 => 'Fine/Medium', | ||||||||||
| 64 | 0x0104 => 'Fine/Medium High', | ||||||||||
| 65 | 0x0105 => 'Fine/High', | ||||||||||
| 66 | 0x0106 => 'Fine/Very High', | ||||||||||
| 67 | 0x0107 => 'Fine/Super High', | ||||||||||
| 68 | 0x0200 => 'Super Fine/Very Low', | ||||||||||
| 69 | 0x0201 => 'Super Fine/Low', | ||||||||||
| 70 | 0x0202 => 'Super Fine/Medium Low', | ||||||||||
| 71 | 0x0203 => 'Super Fine/Medium', | ||||||||||
| 72 | 0x0204 => 'Super Fine/Medium High', | ||||||||||
| 73 | 0x0205 => 'Super Fine/High', | ||||||||||
| 74 | 0x0206 => 'Super Fine/Very High', | ||||||||||
| 75 | 0x0207 => 'Super Fine/Super High', | ||||||||||
| 76 | }, | ||||||||||
| 77 | }, | ||||||||||
| 78 | 0x0202 => { | ||||||||||
| 79 | Name => 'Macro', | ||||||||||
| 80 | Writable => 'int16u', | ||||||||||
| 81 | PrintConv => { | ||||||||||
| 82 | 0 => 'Normal', | ||||||||||
| 83 | 1 => 'Macro', | ||||||||||
| 84 | 2 => 'View', | ||||||||||
| 85 | 3 => 'Manual', | ||||||||||
| 86 | }, | ||||||||||
| 87 | }, | ||||||||||
| 88 | 0x0204 => { | ||||||||||
| 89 | Name => 'DigitalZoom', | ||||||||||
| 90 | Writable => 'rational64u', | ||||||||||
| 91 | }, | ||||||||||
| 92 | 0x0207 => 'SoftwareVersion', | ||||||||||
| 93 | 0x0208 => 'PictInfo', | ||||||||||
| 94 | 0x0209 => 'CameraID', | ||||||||||
| 95 | 0x020e => { | ||||||||||
| 96 | Name => 'SequentialShot', | ||||||||||
| 97 | Writable => 'int16u', | ||||||||||
| 98 | PrintConv => { | ||||||||||
| 99 | 0 => 'None', | ||||||||||
| 100 | 1 => 'Standard', | ||||||||||
| 101 | 2 => 'Best', | ||||||||||
| 102 | 3 => 'Adjust Exposure', | ||||||||||
| 103 | }, | ||||||||||
| 104 | }, | ||||||||||
| 105 | 0x020f => { | ||||||||||
| 106 | Name => 'WideRange', | ||||||||||
| 107 | Writable => 'int16u', | ||||||||||
| 108 | PrintConv => \%offOn, | ||||||||||
| 109 | }, | ||||||||||
| 110 | 0x0210 => { | ||||||||||
| 111 | Name => 'ColorAdjustmentMode', | ||||||||||
| 112 | Writable => 'int16u', | ||||||||||
| 113 | PrintConv => \%offOn, | ||||||||||
| 114 | }, | ||||||||||
| 115 | 0x0213 => { | ||||||||||
| 116 | Name => 'QuickShot', | ||||||||||
| 117 | Writable => 'int16u', | ||||||||||
| 118 | PrintConv => \%offOn, | ||||||||||
| 119 | }, | ||||||||||
| 120 | 0x0214 => { | ||||||||||
| 121 | Name => 'SelfTimer', | ||||||||||
| 122 | Writable => 'int16u', | ||||||||||
| 123 | PrintConv => \%offOn, | ||||||||||
| 124 | }, | ||||||||||
| 125 | # 0x0215 - Flash? | ||||||||||
| 126 | 0x0216 => { | ||||||||||
| 127 | Name => 'VoiceMemo', | ||||||||||
| 128 | Writable => 'int16u', | ||||||||||
| 129 | PrintConv => \%offOn, | ||||||||||
| 130 | }, | ||||||||||
| 131 | 0x0217 => { | ||||||||||
| 132 | Name => 'RecordShutterRelease', | ||||||||||
| 133 | Writable => 'int16u', | ||||||||||
| 134 | PrintConv => { | ||||||||||
| 135 | 0 => 'Record while down', | ||||||||||
| 136 | 1 => 'Press start, press stop', | ||||||||||
| 137 | }, | ||||||||||
| 138 | }, | ||||||||||
| 139 | 0x0218 => { | ||||||||||
| 140 | Name => 'FlickerReduce', | ||||||||||
| 141 | Writable => 'int16u', | ||||||||||
| 142 | PrintConv => \%offOn, | ||||||||||
| 143 | }, | ||||||||||
| 144 | 0x0219 => { | ||||||||||
| 145 | Name => 'OpticalZoomOn', | ||||||||||
| 146 | Writable => 'int16u', | ||||||||||
| 147 | PrintConv => \%offOn, | ||||||||||
| 148 | }, | ||||||||||
| 149 | 0x021b => { | ||||||||||
| 150 | Name => 'DigitalZoomOn', | ||||||||||
| 151 | Writable => 'int16u', | ||||||||||
| 152 | PrintConv => \%offOn, | ||||||||||
| 153 | }, | ||||||||||
| 154 | 0x021d => { | ||||||||||
| 155 | Name => 'LightSourceSpecial', | ||||||||||
| 156 | Writable => 'int16u', | ||||||||||
| 157 | PrintConv => \%offOn, | ||||||||||
| 158 | }, | ||||||||||
| 159 | 0x021e => { | ||||||||||
| 160 | Name => 'Resaved', | ||||||||||
| 161 | Writable => 'int16u', | ||||||||||
| 162 | PrintConv => { | ||||||||||
| 163 | 0 => 'No', | ||||||||||
| 164 | 1 => 'Yes', | ||||||||||
| 165 | }, | ||||||||||
| 166 | }, | ||||||||||
| 167 | 0x021f => { | ||||||||||
| 168 | Name => 'SceneSelect', | ||||||||||
| 169 | Writable => 'int16u', | ||||||||||
| 170 | PrintConv => { | ||||||||||
| 171 | 0 => 'Off', | ||||||||||
| 172 | 1 => 'Sport', | ||||||||||
| 173 | 2 => 'TV', | ||||||||||
| 174 | 3 => 'Night', | ||||||||||
| 175 | 4 => 'User 1', | ||||||||||
| 176 | 5 => 'User 2', | ||||||||||
| 177 | 6 => 'Lamp', #PH | ||||||||||
| 178 | }, | ||||||||||
| 179 | }, | ||||||||||
| 180 | 0x0223 => [ | ||||||||||
| 181 | { | ||||||||||
| 182 | Name => 'ManualFocusDistance', | ||||||||||
| 183 | Condition => '$format eq "rational64u"', | ||||||||||
| 184 | Writable => 'rational64u', | ||||||||||
| 185 | }, { #PH | ||||||||||
| 186 | Name => 'FaceInfo', | ||||||||||
| 187 | SubDirectory => { TagTable => 'Image::ExifTool::Sanyo::FaceInfo' }, | ||||||||||
| 188 | }, | ||||||||||
| 189 | ], | ||||||||||
| 190 | 0x0224 => { | ||||||||||
| 191 | Name => 'SequenceShotInterval', | ||||||||||
| 192 | Writable => 'int16u', | ||||||||||
| 193 | PrintConv => { | ||||||||||
| 194 | 0 => '5 frames/s', | ||||||||||
| 195 | 1 => '10 frames/s', | ||||||||||
| 196 | 2 => '15 frames/s', | ||||||||||
| 197 | 3 => '20 frames/s', | ||||||||||
| 198 | }, | ||||||||||
| 199 | }, | ||||||||||
| 200 | 0x0225 => { | ||||||||||
| 201 | Name => 'FlashMode', | ||||||||||
| 202 | Writable => 'int16u', | ||||||||||
| 203 | PrintConv => { | ||||||||||
| 204 | 0 => 'Auto', | ||||||||||
| 205 | 1 => 'Force', | ||||||||||
| 206 | 2 => 'Disabled', | ||||||||||
| 207 | 3 => 'Red eye', | ||||||||||
| 208 | }, | ||||||||||
| 209 | }, | ||||||||||
| 210 | 0x0e00 => { | ||||||||||
| 211 | Name => 'PrintIM', | ||||||||||
| 212 | Description => 'Print Image Matching', | ||||||||||
| 213 | Writable => 0, | ||||||||||
| 214 | SubDirectory => { | ||||||||||
| 215 | TagTable => 'Image::ExifTool::PrintIM::Main', | ||||||||||
| 216 | }, | ||||||||||
| 217 | }, | ||||||||||
| 218 | 0x0f00 => { | ||||||||||
| 219 | Name => 'DataDump', | ||||||||||
| 220 | Writable => 0, | ||||||||||
| 221 | Binary => 1, | ||||||||||
| 222 | }, | ||||||||||
| 223 | ); | ||||||||||
| 224 | |||||||||||
| 225 | # face detection information (ref PH) | ||||||||||
| 226 | 10 | %Image::ExifTool::Sanyo::FaceInfo = ( | |||||||||
| 227 | PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData, | ||||||||||
| 228 | WRITE_PROC => \&Image::ExifTool::WriteBinaryData, | ||||||||||
| 229 | CHECK_PROC => \&Image::ExifTool::CheckBinaryData, | ||||||||||
| 230 | GROUPS => { 0 => 'MakerNotes', 2 => 'Image' }, | ||||||||||
| 231 | WRITABLE => 1, | ||||||||||
| 232 | FORMAT => 'int32u', | ||||||||||
| 233 | FIRST_ENTRY => 0, | ||||||||||
| 234 | 0 => 'FacesDetected', | ||||||||||
| 235 | 4 => { | ||||||||||
| 236 | Name => 'FacePosition', | ||||||||||
| 237 | Format => 'int32u[4]', | ||||||||||
| 238 | Notes => q{ | ||||||||||
| 239 | left, top, right and bottom coordinates of detected face in an unrotated | ||||||||||
| 240 | 640-pixel-wide image, with increasing Y downwards | ||||||||||
| 241 | }, | ||||||||||
| 242 | }, | ||||||||||
| 243 | ); | ||||||||||
| 244 | |||||||||||
| 245 | # tags in Sanyo MOV videos (PH - observations from an E6 sample) | ||||||||||
| 246 | # (similar information in Kodak,Minolta,Nikon,Olympus,Pentax and Sanyo videos) | ||||||||||
| 247 | 10 | %Image::ExifTool::Sanyo::MOV = ( | |||||||||
| 248 | PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData, | ||||||||||
| 249 | GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' }, | ||||||||||
| 250 | NOTES => 'This information is found in Sanyo MOV videos.', | ||||||||||
| 251 | 0x00 => { | ||||||||||
| 252 | Name => 'Make', | ||||||||||
| 253 | Format => 'string[24]', | ||||||||||
| 254 | }, | ||||||||||
| 255 | 0x18 => { | ||||||||||
| 256 | Name => 'Model', | ||||||||||
| 257 | Description => 'Camera Model Name', | ||||||||||
| 258 | Format => 'string[8]', | ||||||||||
| 259 | }, | ||||||||||
| 260 | # (01 00 at offset 0x20) | ||||||||||
| 261 | 0x26 => { | ||||||||||
| 262 | Name => 'ExposureTime', | ||||||||||
| 263 | Format => 'int32u', | ||||||||||
| 264 | ValueConv => '$val ? 10 / $val : 0', | ||||||||||
| 265 | PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)', | ||||||||||
| 266 | }, | ||||||||||
| 267 | 0x2a => { | ||||||||||
| 268 | Name => 'FNumber', | ||||||||||
| 269 | Format => 'int32u', | ||||||||||
| 270 | ValueConv => '$val / 10', | ||||||||||
| 271 | PrintConv => 'sprintf("%.1f",$val)', | ||||||||||
| 272 | }, | ||||||||||
| 273 | 0x32 => { | ||||||||||
| 274 | Name => 'ExposureCompensation', | ||||||||||
| 275 | Format => 'int32s', | ||||||||||
| 276 | ValueConv => '$val / 10', | ||||||||||
| 277 | PrintConv => 'Image::ExifTool::Exif::PrintFraction($val)', | ||||||||||
| 278 | }, | ||||||||||
| 279 | 0x44 => { | ||||||||||
| 280 | Name => 'WhiteBalance', | ||||||||||
| 281 | Format => 'int16u', | ||||||||||
| 282 | PrintConv => { | ||||||||||
| 283 | 0 => 'Auto', | ||||||||||
| 284 | 1 => 'Daylight', | ||||||||||
| 285 | 2 => 'Shade', | ||||||||||
| 286 | 3 => 'Fluorescent', #2 | ||||||||||
| 287 | 4 => 'Tungsten', | ||||||||||
| 288 | 5 => 'Manual', | ||||||||||
| 289 | }, | ||||||||||
| 290 | }, | ||||||||||
| 291 | 0x48 => { | ||||||||||
| 292 | Name => 'FocalLength', | ||||||||||
| 293 | Format => 'int32u', | ||||||||||
| 294 | ValueConv => '$val / 10', | ||||||||||
| 295 | PrintConv => 'sprintf("%.1f mm",$val)', | ||||||||||
| 296 | }, | ||||||||||
| 297 | ); | ||||||||||
| 298 | |||||||||||
| 299 | # tags in Sanyo MP4 videos (PH - from C4, C5 and HD1A samples) | ||||||||||
| 300 | # --> very similar to Samsung MP4 information | ||||||||||
| 301 | # (there is still a lot more information here that could be decoded!) | ||||||||||
| 302 | 10 | %Image::ExifTool::Sanyo::MP4 = ( | |||||||||
| 303 | PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData, | ||||||||||
| 304 | GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' }, | ||||||||||
| 305 | NOTES => 'This information is found in Sanyo MP4 videos.', | ||||||||||
| 306 | 0x00 => { | ||||||||||
| 307 | Name => 'Make', | ||||||||||
| 308 | Format => 'string[5]', | ||||||||||
| 309 | PrintConv => 'ucfirst(lc($val))', | ||||||||||
| 310 | }, | ||||||||||
| 311 | 0x18 => { | ||||||||||
| 312 | Name => 'Model', | ||||||||||
| 313 | Description => 'Camera Model Name', | ||||||||||
| 314 | Format => 'string[8]', | ||||||||||
| 315 | }, | ||||||||||
| 316 | # (01 00 at offset 0x28) | ||||||||||
| 317 | # (0x2e has values 0x31, 0x33 and 0x3c in my samples, but | ||||||||||
| 318 | # some of the shutter speeds should be around 1/500 or so) | ||||||||||
| 319 | 0x32 => { | ||||||||||
| 320 | Name => 'FNumber', | ||||||||||
| 321 | Format => 'rational64u', | ||||||||||
| 322 | PrintConv => 'sprintf("%.1f",$val)', | ||||||||||
| 323 | }, | ||||||||||
| 324 | 0x3a => { # (NC) | ||||||||||
| 325 | Name => 'ExposureCompensation', | ||||||||||
| 326 | Format => 'rational64s', | ||||||||||
| 327 | PrintConv => '$val ? sprintf("%+.1f", $val) : 0', | ||||||||||
| 328 | }, | ||||||||||
| 329 | 0x6a => { | ||||||||||
| 330 | Name => 'ISO', | ||||||||||
| 331 | Format => 'int32u', | ||||||||||
| 332 | }, | ||||||||||
| 333 | 0xd1 => { | ||||||||||
| 334 | Name => 'Software', | ||||||||||
| 335 | Notes => 'these tags are shifted up by 1 byte for some models like the HD1A', | ||||||||||
| 336 | Format => 'undef[32]', | ||||||||||
| 337 | RawConv => q{ | ||||||||||
| 338 | $val =~ /^SANYO/ or return undef; | ||||||||||
| 339 | $val =~ tr/\0//d; | ||||||||||
| 340 | $$self{SanyoSledder0xd1} = 1; | ||||||||||
| 341 | return $val; | ||||||||||
| 342 | }, | ||||||||||
| 343 | }, | ||||||||||
| 344 | 0xd2 => { | ||||||||||
| 345 | Name => 'Software', | ||||||||||
| 346 | Format => 'undef[32]', | ||||||||||
| 347 | RawConv => q{ | ||||||||||
| 348 | $val =~ /^SANYO/ or return undef; | ||||||||||
| 349 | $val =~ tr/\0//d; | ||||||||||
| 350 | $$self{SanyoSledder0xd2} = 1; | ||||||||||
| 351 | return $val; | ||||||||||
| 352 | }, | ||||||||||
| 353 | }, | ||||||||||
| 354 | 0xf1 => { | ||||||||||
| 355 | Name => 'Thumbnail', | ||||||||||
| 356 | Condition => '$$self{SanyoSledder0xd1}', | ||||||||||
| 357 | SubDirectory => { | ||||||||||
| 358 | TagTable => 'Image::ExifTool::Sanyo::Thumbnail', | ||||||||||
| 359 | Base => '$start', | ||||||||||
| 360 | }, | ||||||||||
| 361 | }, | ||||||||||
| 362 | 0xf2 => { | ||||||||||
| 363 | Name => 'Thumbnail', | ||||||||||
| 364 | Condition => '$$self{SanyoSledder0xd2}', | ||||||||||
| 365 | SubDirectory => { | ||||||||||
| 366 | TagTable => 'Image::ExifTool::Sanyo::Thumbnail', | ||||||||||
| 367 | Base => '$start', | ||||||||||
| 368 | }, | ||||||||||
| 369 | }, | ||||||||||
| 370 | ); | ||||||||||
| 371 | |||||||||||
| 372 | # thumbnail image information found in MP4 videos (similar in Olympus,Samsung,Sanyo) | ||||||||||
| 373 | 10 | %Image::ExifTool::Sanyo::Thumbnail = ( | |||||||||
| 374 | PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData, | ||||||||||
| 375 | GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' }, | ||||||||||
| 376 | FIRST_ENTRY => 0, | ||||||||||
| 377 | FORMAT => 'int32u', | ||||||||||
| 378 | 1 => 'ThumbnailWidth', | ||||||||||
| 379 | 2 => 'ThumbnailHeight', | ||||||||||
| 380 | 3 => 'ThumbnailLength', | ||||||||||
| 381 | 4 => { Name => 'ThumbnailOffset', IsOffset => 1 }, | ||||||||||
| 382 | ); | ||||||||||
| 383 | |||||||||||
| 384 | |||||||||||
| 385 | #------------------------------------------------------------------------------ | ||||||||||
| 386 | # Patch incorrect offsets in J1, J2, J4, S1, S3 and S4 maker notes | ||||||||||
| 387 | # Inputs: 0) valuePtr, 1) end of previous value, 2) value size, 3) tag ID, 4) write flag | ||||||||||
| 388 | sub FixOffsets($$$$;$) | ||||||||||
| 389 | 0 | ▶ | { | ||||||||
|
Subroutine
FixOffsets: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||
| 390 | 0 | my ($valuePtr, $valEnd, $size, $tagID, $wFlag) = @_; | |||||||||
| 391 | # ignore existing offsets and calculate reasonable values instead | ||||||||||
| 392 | 0 | ▶ | if ($tagID == 0x100) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 393 | # just ignore the SanyoThumbnail when writing (pointer is garbage) | ||||||||||
| 394 | 0 | ▶ | $_[0] = undef if $wFlag; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 395 | } else { | ||||||||||
| 396 | 0 | $_[0] = $valEnd; # set value pointer to next logical location | |||||||||
| 397 | 0 | ▶ | ++$size if $size & 0x01; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 398 | 0 | $_[1] += $size; # update end-of-value pointer | |||||||||
| 399 | } | ||||||||||
| 400 | } | ||||||||||
| 401 | |||||||||||
| 402 | |||||||||||
| 403 | 10 | 1; # end | |||||||||
| 404 | |||||||||||
| 405 | __END__ | ||||||||||