- Timestamp:
- 2021-02-26T19:39:51+13:00 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/perllib/cpan/Image/ExifTool/MinoltaRaw.pm
r24107 r34921 18 18 use Image::ExifTool::Minolta; 19 19 20 $VERSION = '1.1 2';20 $VERSION = '1.16'; 21 21 22 22 sub ProcessMRW($$;$); … … 60 60 WRITABLE => 1, 61 61 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' }, 62 DATAMEMBER => [ 0 ], 62 63 FIRST_ENTRY => 0, 63 64 0 => { 64 65 Name => 'FirmwareID', 65 66 Format => 'string[8]', 67 RawConv => '$$self{MinoltaPRD} = 1 if $$self{FILE_TYPE} eq "MRW"; $val', # used in decoding RIF info 66 68 }, 67 69 8 => { … … 101 103 Format => 'int8u', 102 104 PrintConv => { 105 # 0 - seen in some Sony A850 ARW images 103 106 1 => 'RGGB', 104 107 4 => 'GBRG', … … 186 189 my ($val, $inv) = @_; 187 190 return int(2 ** (($val-48)/8) * 100 + 0.5) unless $inv; 188 return 48 + 8*log($val/100)/log(2) if Image::ExifTool::IsFloat($val); 191 # (must check for zero below in inverse conversion) 192 return 48 + 8*log($val/100)/log(2) if Image::ExifTool::IsFloat($val) and $val != 0; 189 193 return undef; 190 194 }, … … 213 217 }, 214 218 ], 215 # NOTE: some of these WB_RBLevels may apply to other models too...219 # NOTE: WB_RBLevels up to Custom also apply to Minolta models which write PRD info (ref IB) 216 220 8 => { #3 217 221 Name => 'WB_RBLevelsTungsten', 218 Condition => '$$self{Model} eq "DSLR-A100" ',222 Condition => '$$self{Model} eq "DSLR-A100" or $$self{MinoltaPRD}', 219 223 Format => 'int16u[2]', 220 224 Notes => 'these WB_RBLevels currently decoded only for the Sony A100', … … 222 226 12 => { #3 223 227 Name => 'WB_RBLevelsDaylight', 224 Condition => '$$self{Model} eq "DSLR-A100" ',228 Condition => '$$self{Model} eq "DSLR-A100" or $$self{MinoltaPRD}', 225 229 Format => 'int16u[2]', 226 230 }, 227 231 16 => { #3 228 232 Name => 'WB_RBLevelsCloudy', 229 Condition => '$$self{Model} eq "DSLR-A100" ',233 Condition => '$$self{Model} eq "DSLR-A100" or $$self{MinoltaPRD}', 230 234 Format => 'int16u[2]', 231 235 }, 232 236 20 => { #3 233 237 Name => 'WB_RBLevelsCoolWhiteF', 234 Condition => '$$self{Model} eq "DSLR-A100" ',238 Condition => '$$self{Model} eq "DSLR-A100" or $$self{MinoltaPRD}', 235 239 Format => 'int16u[2]', 236 240 }, 237 241 24 => { #3 238 242 Name => 'WB_RBLevelsFlash', 239 Condition => '$$self{Model} eq "DSLR-A100" ',243 Condition => '$$self{Model} eq "DSLR-A100" or $$self{MinoltaPRD}', 240 244 Format => 'int16u[2]', 241 245 }, 242 246 28 => { #3 243 Name => 'WB_RBLevelsUnknown', 244 Condition => '$$self{Model} eq "DSLR-A100"', 245 Format => 'int16u[2]', 246 Unknown => 1, 247 Name => 'WB_RBLevelsCustom', #IB 248 Condition => '$$self{Model} eq "DSLR-A100" or $$self{MinoltaPRD}', 249 Format => 'int16u[2]', 247 250 }, 248 251 32 => { #3 … … 308 311 76 => { #3 309 312 Name => 'ColorTemperature', 310 Condition => '$$self{M ake} =~ /^SONY/ and $$self{Model} eq "DSLR-A100"',313 Condition => '$$self{Model} eq "DSLR-A100"', 311 314 Notes => 'A100', 312 315 ValueConv => '$val * 100', … … 317 320 77 => { #3 318 321 Name => 'ColorFilter', 319 Condition => '$$self{M ake} =~ /^SONY/ and $$self{Model} eq "DSLR-A100"',322 Condition => '$$self{Model} eq "DSLR-A100"', 320 323 Notes => 'A100', 321 324 }, 322 325 78 => { #3 323 326 Name => 'ColorTemperature', 324 Condition => '$$self{M ake} =~ /^SONY/ and $$self{Model} =~ /^DSLR-A(200|700)$/',327 Condition => '$$self{Model} =~ /^DSLR-A(200|700)$/', 325 328 Notes => 'A200 and A700', 326 329 ValueConv => '$val * 100', … … 331 334 79 => { #3 332 335 Name => 'ColorFilter', 333 Condition => '$$self{M ake} =~ /^SONY/ and $$self{Model} =~ /^DSLR-A(200|700)$/',336 Condition => '$$self{Model} =~ /^DSLR-A(200|700)$/', 334 337 Notes => 'A200 and A700', 338 }, 339 80 => { #3 340 Name => 'RawDataLength', 341 Condition => '$$self{Model} eq "DSLR-A100"', 342 Format => 'int32u', 343 Notes => 'A100', 344 Writable => 0, 335 345 }, 336 346 ); … … 362 372 363 373 #------------------------------------------------------------------------------ 364 # Write MRW directory ( ie. in ARW images)374 # Write MRW directory (eg. in ARW images) 365 375 # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) optional tag table ref 366 376 # Returns: new MRW data or undef on error 367 377 sub WriteMRW($$;$) 368 378 { 369 my ($e xifTool, $dirInfo, $tagTablePtr) = @_;370 $e xifToolor return 1; # allow dummy access379 my ($et, $dirInfo, $tagTablePtr) = @_; 380 $et or return 1; # allow dummy access 371 381 my $buff = ''; 372 382 $$dirInfo{OutFile} = \$buff; 373 ProcessMRW($e xifTool, $dirInfo, $tagTablePtr) > 0 or undef $buff;383 ProcessMRW($et, $dirInfo, $tagTablePtr) > 0 or undef $buff; 374 384 return $buff; 375 385 } … … 382 392 sub ProcessMRW($$;$) 383 393 { 384 my ($e xifTool, $dirInfo, $tagTablePtr) = @_;394 my ($et, $dirInfo, $tagTablePtr) = @_; 385 395 my $raf = $$dirInfo{RAF}; 386 396 my $outfile = $$dirInfo{OutFile}; 387 my $verbose = $e xifTool->Options('Verbose');388 my $out = $e xifTool->Options('TextOut');397 my $verbose = $et->Options('Verbose'); 398 my $out = $et->Options('TextOut'); 389 399 my ($data, $err, $outBuff); 390 400 … … 401 411 my $hdr = "\0MR$1"; 402 412 SetByteOrder($1 . $1); 403 $e xifTool->SetFileType();413 $et->SetFileType(); 404 414 $tagTablePtr = GetTagTable('Image::ExifTool::MinoltaRaw::Main'); 405 415 if ($outfile) { 406 $e xifTool->InitWriteDirs('TIFF'); # use same write dirs as TIFF416 $et->InitWriteDirs('TIFF'); # use same write dirs as TIFF 407 417 $outBuff = ''; 408 418 } … … 418 428 my $len = Get32u(\$data, 4); 419 429 if ($verbose) { 420 print $out "MRW ",$e xifTool->Printable($tag)," segment ($len bytes):\n";430 print $out "MRW ",$et->Printable($tag)," segment ($len bytes):\n"; 421 431 if ($verbose > 2) { 422 432 $raf->Read($data,$len) == $len and $raf->Seek($pos,0) or $err = 1, last; 423 $e xifTool->VerboseDump(\$data);433 $et->VerboseDump(\$data); 424 434 } 425 435 } 426 my $tagInfo = $e xifTool->GetTagInfo($tagTablePtr, $tag);436 my $tagInfo = $et->GetTagInfo($tagTablePtr, $tag); 427 437 if ($tagInfo and $$tagInfo{SubDirectory}) { 428 438 my $subTable = GetTagTable($tagInfo->{SubDirectory}->{TagTable}); 429 439 my $buff; 430 440 # save shift for values stored with wrong base offset 431 $$e xifTool{MRW_WrongBase} = -($raf->Tell());441 $$et{MRW_WrongBase} = -($raf->Tell()); 432 442 $raf->Read($buff, $len) == $len or $err = 1, last; 433 443 my %subdirInfo = ( … … 443 453 if ($outfile) { 444 454 my $writeProc = $tagInfo->{SubDirectory}->{WriteProc}; 445 my $val = $e xifTool->WriteDirectory(\%subdirInfo, $subTable, $writeProc);455 my $val = $et->WriteDirectory(\%subdirInfo, $subTable, $writeProc); 446 456 if (defined $val and length $val) { 447 457 # pad to an even 4 bytes (can't hurt, and it seems to be the standard) … … 453 463 } else { 454 464 my $processProc = $tagInfo->{SubDirectory}->{ProcessProc}; 455 $e xifTool->ProcessDirectory(\%subdirInfo, $subTable, $processProc);465 $et->ProcessDirectory(\%subdirInfo, $subTable, $processProc); 456 466 } 457 467 } elsif ($outfile) { … … 477 487 # Sony IDC utility corrupts MRWInfo when writing ARW images, 478 488 # so make this a minor error for these images 479 $err and $e xifTool->Error("MRW format error", $$exifTool{TIFF_TYPE} eq 'ARW');489 $err and $et->Error("MRW format error", $$et{TIFF_TYPE} eq 'ARW'); 480 490 } else { 481 $err and $e xifTool->Warn("MRW format error");491 $err and $et->Warn("MRW format error"); 482 492 } 483 493 return $rtnVal; … … 503 513 =head1 AUTHOR 504 514 505 Copyright 2003-20 11, Phil Harvey (phil at owl.phy.queensu.ca)515 Copyright 2003-2021, Phil Harvey (philharvey66 at gmail.com) 506 516 507 517 This library is free software; you can redistribute it and/or modify it
Note:
See TracChangeset
for help on using the changeset viewer.