Beispiel #1
0
    void CrwMap::extract0x102a(const CiffComponent& ciffComponent,
                               const CrwMapInfo* crwMapInfo,
                               Image& image,
                               ByteOrder byteOrder)
    {
        if (ciffComponent.typeId() != unsignedShort) {
            return extractBasic(ciffComponent, crwMapInfo, image, byteOrder);
        }

        long aperture = 0;
        long shutterSpeed = 0;

        std::string ifdItem(ExifTags::ifdItem(canonCs2IfdId));
        uint16_t c = 1;
        while (uint32_t(c)*2 < ciffComponent.size()) {
            uint16_t n = 1;
            ExifKey key(c, ifdItem);
            UShortValue value;
            value.read(ciffComponent.pData() + c*2, n*2, byteOrder);
            image.exifData().add(key, &value);
            if (c == 21) aperture = value.toLong();
            if (c == 22) shutterSpeed = value.toLong();
            c += n;
        }

        // Exif.Photo.FNumber
        float f = fnumber(canonEv(aperture));
        // Beware: primitive conversion algorithm
        uint32_t den = 1000000;
        uint32_t nom = static_cast<uint32_t>(f * den);
        uint32_t g = gcd(nom, den);
        URational ur(nom/g, den/g);
        URationalValue fn;
        fn.value_.push_back(ur);
        image.exifData().add(ExifKey("Exif.Photo.FNumber"), &fn);

        // Exif.Photo.ExposureTime
        ur = exposureTime(canonEv(shutterSpeed));
        URationalValue et;
        et.value_.push_back(ur);
        image.exifData().add(ExifKey("Exif.Photo.ExposureTime"), &et);

    } // CrwMap::extract0x102a
Beispiel #2
0
    void CrwMap::extract0x102d(const CiffComponent& ciffComponent,
                               const CrwMapInfo* crwMapInfo,
                               Image& image,
                               ByteOrder byteOrder)
    {
        if (ciffComponent.typeId() != unsignedShort) {
            return extractBasic(ciffComponent, crwMapInfo, image, byteOrder);
        }

        std::string ifdItem(ExifTags::ifdItem(canonCs1IfdId));
        uint16_t c = 1;
        while (uint32_t(c)*2 < ciffComponent.size()) {
            uint16_t n = 1;
            ExifKey key(c, ifdItem);
            UShortValue value;
            if (c == 23 && ciffComponent.size() > 50) n = 3;
            value.read(ciffComponent.pData() + c*2, n*2, byteOrder);
            image.exifData().add(key, &value);
            c += n;
        }
    } // CrwMap::extract0x102d
Beispiel #3
0
 std::string ExifTags::makeKey(uint16 tag, IfdId ifdId)
 {
     return std::string(ifdItem(ifdId)) 
         + "." + std::string(sectionName(tag, ifdId)) 
         + "." + std::string(tagName(tag, ifdId));
 }
Beispiel #4
0
 /*!
   @brief Return the name of the group (the second part of the key).
          For Exif keys, the group name is the IFD item.
 */ 
 virtual std::string groupName() const { return ifdItem(); }