exiftool_vendored 12.93.0 → 12.95.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -758,10 +758,10 @@ my %insvLimit = (
758
758
  );
759
759
 
760
760
  #------------------------------------------------------------------------------
761
- # Convert unsigned 4-byte integer to signed
761
+ # Convert unsigned 32-bit integer to signed
762
762
  # Inputs: <none> (uses value in $_)
763
- # Returns: signed integet
764
- sub MakeSigned()
763
+ # Returns: signed integer
764
+ sub SignedInt32()
765
765
  {
766
766
  return $_ < 0x80000000 ? $_ : $_ - 4294967296;
767
767
  }
@@ -1624,7 +1624,7 @@ sub ProcessFreeGPS($$$)
1624
1624
  if (defined $lat) {
1625
1625
  # extract accelerometer readings if GPS was valid
1626
1626
  # and change to signed integer and divide by 256
1627
- @acc = map { MakeSigned / 256 } unpack('x68V3', $$dataPt);
1627
+ @acc = map { SignedInt32 / 256 } unpack('x68V3', $$dataPt);
1628
1628
  }
1629
1629
 
1630
1630
  } elsif ($$dataPt =~ /^.{37}\0\0\0A([NS])([EW])\0/s) {
@@ -1666,7 +1666,7 @@ sub ProcessFreeGPS($$$)
1666
1666
  # (may be all zeros or int16u counting from 1 to 6 if not valid)
1667
1667
  my $tmp = substr($$dataPt, 60, 12);
1668
1668
  if ($tmp ne "\0\0\0\0\0\0\0\0\0\0\0\0" and $tmp ne "\x01\0\x02\0\x03\0\x04\0\x05\0\x06\0") {
1669
- @acc = map { MakeSigned / 256 } unpack('V3', $tmp);
1669
+ @acc = map { SignedInt32 / 256 } unpack('V3', $tmp);
1670
1670
  }
1671
1671
 
1672
1672
  } else {
@@ -1684,9 +1684,9 @@ sub ProcessFreeGPS($$$)
1684
1684
  # (16-byte string at 0x68 is base64 encoded and encrypted 'luckychip' string)
1685
1685
  $spd = GetFloat($dataPt, 0x54) * $knotsToKph;
1686
1686
  $trk = GetFloat($dataPt, 0x58);
1687
- @acc = map MakeSigned, unpack('x92V3', $$dataPt);
1688
- # (accelerometer scaling is roughly 300=1G, but this doesn't seem to be exact for each
1689
- # axis, so leave the values as raw. The axes are positive acceleration up,left,forward)
1687
+ @acc = map SignedInt32, unpack('x92V3', $$dataPt);
1688
+ # (accelerometer scaling is roughly 1G=250-300, but it varies depending on the axis,
1689
+ # so leave the values as raw. The axes are positive acceleration up,left,forward)
1690
1690
  if ($notEnc) { # (not encrypted)
1691
1691
  ($lat = $lt) =~ s/\0+$//;
1692
1692
  ($lon = $ln) =~ s/\0+$//;
@@ -1764,7 +1764,7 @@ sub ProcessFreeGPS($$$)
1764
1764
  $trk -= 360 if $trk >= 360;
1765
1765
  undef @acc;
1766
1766
  } else {
1767
- @acc = map { MakeSigned / 1000 } @acc; # (NC)
1767
+ @acc = map { SignedInt32 / 1000 } @acc; # (NC)
1768
1768
  }
1769
1769
 
1770
1770
  } elsif ($$dataPt =~ /^.{60}4W`b]S</s and length($$dataPt) >= 140) {
@@ -1868,7 +1868,7 @@ sub ProcessFreeGPS($$$)
1868
1868
  return 0;
1869
1869
  }
1870
1870
  # (not sure about acc scaling)
1871
- @acc = map { MakeSigned / 1000 } @acc;
1871
+ @acc = map { SignedInt32 / 1000 } @acc;
1872
1872
  $lon = GetFloat($dataPt, 0x5c);
1873
1873
  $lat = GetFloat($dataPt, 0x60);
1874
1874
  $spd = GetFloat($dataPt, 0x64) * $knotsToKph;
@@ -2013,7 +2013,7 @@ ATCRec: for ($recPos = 0x30; $recPos + 52 < $dirLen; $recPos += 52) {
2013
2013
  # 0x7c - int32s[3] accelerometer * 1000
2014
2014
  ($latRef, $lonRef) = ($1, $2);
2015
2015
  ($hr,$min,$sec,$yr,$mon,$day,@acc) = unpack('x48V3x52V6', $$dataPt);
2016
- @acc = map { MakeSigned / 1000 } @acc;
2016
+ @acc = map { SignedInt32 / 1000 } @acc;
2017
2017
  $lat = GetDouble($dataPt, 0x40);
2018
2018
  $lon = GetDouble($dataPt, 0x50);
2019
2019
  $spd = GetDouble($dataPt, 0x60) * $knotsToKph;
@@ -2029,7 +2029,7 @@ ATCRec: for ($recPos = 0x30; $recPos + 52 < $dirLen; $recPos += 52) {
2029
2029
  $lon = abs(GetFloat(\$dat, 8)); # (abs just to be safe)
2030
2030
  $spd = GetFloat(\$dat, 12) * $knotsToKph;
2031
2031
  $trk = GetFloat(\$dat, 16);
2032
- @acc = map MakeSigned, unpack('x20V3', $dat);
2032
+ @acc = map SignedInt32, unpack('x20V3', $dat);
2033
2033
  ConvertLatLon($lat, $lon);
2034
2034
  $$et{DOC_NUM} = ++$$et{DOC_COUNT};
2035
2035
  $et->HandleTag($tagTbl, GPSLatitude => $lat * (substr($dat,1,1) eq 'S' ? -1 : 1));
@@ -2063,7 +2063,7 @@ ATCRec: for ($recPos = 0x30; $recPos + 52 < $dirLen; $recPos += 52) {
2063
2063
  $lon = abs(GetDouble($dataPt, 48)); # (abs just to be safe)
2064
2064
  $spd = GetDouble($dataPt, 64) * $knotsToKph;
2065
2065
  $trk = GetDouble($dataPt, 72);
2066
- @acc = map { MakeSigned / 1000 } @acc; # (NC)
2066
+ @acc = map { SignedInt32 / 1000 } @acc; # (NC)
2067
2067
  # (not necessary to read RMC sentence because we already have it all)
2068
2068
 
2069
2069
  } elsif ($$dataPt =~ /^.{72}A[NS][EW]\0/s) {
@@ -2197,7 +2197,7 @@ ATCRec: for ($recPos = 0x30; $recPos + 52 < $dirLen; $recPos += 52) {
2197
2197
  $day < 1 or $day > 31 or
2198
2198
  $hr > 59 or $min > 59 or $sec > 600;
2199
2199
  # change lat/lon to signed integer and divide by 1e7
2200
- ($lat, $lon) = map { MakeSigned / 1e7 } $lat, $lon;
2200
+ ($lat, $lon) = map { SignedInt32 / 1e7 } $lat, $lon;
2201
2201
  $trk -= 0x10000 if $trk >= 0x8000; # make it signed
2202
2202
  $trk /= 100;
2203
2203
  $trk += 360 if $trk < 0;