Changeset 4825


Ignore:
Timestamp:
Feb 2, 2010, 12:12:58 AM (14 years ago)
Author:
grum
Message:

Fixes a bug on the exif.exif.ShutterSpeedValue formula

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/AMetaData/JpegMetaData/Readers/IfdReader.class.php

    r4824 r4825  
    451451        case 0x9201: // ShutterSpeedValue, tag0x9201
    452452          if($values[1]==0) $values[1]=1;
    453           $returned=ConvertData::toExposureTime(1/round(pow(2, $values[0]/$values[1]),0));
     453          /*
     454           * the formula to compute the shutter speed value is 1/pow(2, x)
     455           *
     456           * Because of rounding errors, the result obtained using this formula
     457           * is sometimes incorrect.
     458           *
     459           * We consider that if the result is greater than the second, the
     460           * result is rounded to 2 hundredths of a second (to avoid something
     461           * like 3.0000124500015s)
     462           *
     463           * in other case (result is less than 1 second) there is no rules
     464           * result can be strange, but for now I don't know how to resolve this
     465           * problem
     466           *
     467           */
     468
     469          $value=1/pow(2, $values[0]/$values[1]);
     470          if($value>1)
     471          {
     472            $value=round($value,2);
     473          }
     474          $returned=ConvertData::toExposureTime($value);
    454475          break;
    455476        case 0x9202: // ApertureValue, tag0x9202
Note: See TracChangeset for help on using the changeset viewer.