Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 22875be

Browse files
committedApr 18, 2017
Merge branch 'dev' of https://github.com/t0pu/RawTherapee into t0pu-dev
2 parents 2c40a4a + f2b0efe commit 22875be

File tree

5 files changed

+185
-5
lines changed

5 files changed

+185
-5
lines changed
 

‎rtengine/imagedata.cc

+13-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,8 @@ void ImageData::extractInfo ()
157157
"SAMSUNG",
158158
"Mamiya",
159159
"MOTOROLA",
160-
"Leaf"
160+
"Leaf",
161+
"Panasonic"
161162
}) {
162163
if (make.find(corp) != std::string::npos) { // Simplify company names
163164
make = corp;
@@ -482,6 +483,17 @@ void ImageData::extractInfo ()
482483
lens = eq->getTag ("LensType")->valueToString ();
483484
}
484485
}
486+
} else if (mnote && !make.compare (0, 9, "Panasonic")) {
487+
if (mnote->getTag ("LensType")) {
488+
std::string panalens = mnote->getTag("LensType")->valueToString();
489+
490+
if (panalens.find("LUMIX") != Glib::ustring::npos) {
491+
lens = "Panasonic " + panalens;
492+
}
493+
else {
494+
lens = panalens;
495+
}
496+
}
485497
}
486498
} else if (exif->getTag ("DNGLensInfo")) {
487499
lens = exif->getTag ("DNGLensInfo")->valueToString ();

‎rtexif/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
add_library(rtexif rtexif.cc stdattribs.cc nikonattribs.cc canonattribs.cc pentaxattribs.cc fujiattribs.cc sonyminoltaattribs.cc olympusattribs.cc kodakattribs.cc)
1+
add_library(rtexif rtexif.cc stdattribs.cc nikonattribs.cc canonattribs.cc pentaxattribs.cc fujiattribs.cc sonyminoltaattribs.cc olympusattribs.cc kodakattribs.cc panasonicattribs.cc)
22
add_dependencies(rtexif UpdateInfo)
33

44
if(WIN32)

‎rtexif/panasonicattribs.cc

+142
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
/*
2+
* This file is part of RawTherapee.
3+
*/
4+
#ifndef _PANASONICATTRIBS_
5+
#define _PANASONICATTRIBS_
6+
7+
#include <string.h>
8+
#include "rtexif.h"
9+
10+
namespace rtexif
11+
{
12+
13+
// TODO: write interpreters
14+
15+
const TagAttrib panasonicAttribs[] = {
16+
{0, AC_WRITE, 0, nullptr, 0x0001, AUTO, "Quality", &stdInterpreter},
17+
{0, AC_WRITE, 0, nullptr, 0x0002, AUTO, "FirmwareVersion", &stdInterpreter},
18+
{0, AC_WRITE, 0, nullptr, 0x0003, AUTO, "WhiteBalance", &stdInterpreter},
19+
{0, AC_WRITE, 0, nullptr, 0x0007, AUTO, "FocusMode", &stdInterpreter},
20+
{0, AC_WRITE, 0, nullptr, 0x000f, AUTO, "AFMode", &stdInterpreter},
21+
{0, AC_WRITE, 0, nullptr, 0x001a, AUTO, "ImageStabilization", &stdInterpreter},
22+
{0, AC_WRITE, 0, nullptr, 0x001c, AUTO, "Macro", &stdInterpreter},
23+
{0, AC_WRITE, 0, nullptr, 0x001f, AUTO, "ShootingMode", &stdInterpreter},
24+
{0, AC_WRITE, 0, nullptr, 0x0020, AUTO, "Audio", &stdInterpreter},
25+
{0, AC_WRITE, 0, nullptr, 0x0023, AUTO, "WhiteBalanceBias", &stdInterpreter},
26+
{0, AC_WRITE, 0, nullptr, 0x0024, AUTO, "FlashBias", &stdInterpreter},
27+
{0, AC_WRITE, 0, nullptr, 0x0025, AUTO, "InternalSerialNumber", &stdInterpreter},
28+
{0, AC_WRITE, 0, nullptr, 0x0026, AUTO, "ExifVersion", &stdInterpreter},
29+
{0, AC_WRITE, 0, nullptr, 0x0028, AUTO, "ColorEffect", &stdInterpreter},
30+
{0, AC_WRITE, 0, nullptr, 0x0029, AUTO, "TimeSincePowerOn", &stdInterpreter},
31+
{0, AC_WRITE, 0, nullptr, 0x002a, AUTO, "BurstMode", &stdInterpreter},
32+
{0, AC_WRITE, 0, nullptr, 0x002b, AUTO, "SequenceNumber", &stdInterpreter},
33+
{0, AC_WRITE, 0, nullptr, 0x002c, AUTO, "Contrast", &stdInterpreter},
34+
{0, AC_WRITE, 0, nullptr, 0x002d, AUTO, "NoiseReduction", &stdInterpreter},
35+
{0, AC_WRITE, 0, nullptr, 0x002e, AUTO, "SelfTimer", &stdInterpreter},
36+
{0, AC_WRITE, 0, nullptr, 0x0030, AUTO, "Rotation", &stdInterpreter},
37+
{0, AC_WRITE, 0, nullptr, 0x0031, AUTO, "AFAssistLamp", &stdInterpreter},
38+
{0, AC_WRITE, 0, nullptr, 0x0032, AUTO, "ColorMode", &stdInterpreter},
39+
{0, AC_WRITE, 0, nullptr, 0x0033, AUTO, "BabyAge1", &stdInterpreter},
40+
{0, AC_WRITE, 0, nullptr, 0x0034, AUTO, "OpticalZoomMode", &stdInterpreter},
41+
{0, AC_WRITE, 0, nullptr, 0x0035, AUTO, "ConversionLens", &stdInterpreter},
42+
{0, AC_WRITE, 0, nullptr, 0x0036, AUTO, "TravelDay", &stdInterpreter},
43+
{0, AC_WRITE, 0, nullptr, 0x0039, AUTO, "Contrast", &stdInterpreter},
44+
{0, AC_WRITE, 0, nullptr, 0x003a, AUTO, "WorldTimeLocation", &stdInterpreter},
45+
{0, AC_WRITE, 0, nullptr, 0x003b, AUTO, "TextStamp1", &stdInterpreter},
46+
{0, AC_WRITE, 0, nullptr, 0x003c, AUTO, "ProgramISO", &stdInterpreter},
47+
{0, AC_WRITE, 0, nullptr, 0x003d, AUTO, "AdvancedSceneType", &stdInterpreter},
48+
{0, AC_WRITE, 0, nullptr, 0x003e, AUTO, "TextStamp2", &stdInterpreter},
49+
{0, AC_WRITE, 0, nullptr, 0x003f, AUTO, "FacesDetected", &stdInterpreter},
50+
{0, AC_WRITE, 0, nullptr, 0x0040, AUTO, "Saturation", &stdInterpreter},
51+
{0, AC_WRITE, 0, nullptr, 0x0041, AUTO, "Sharpness", &stdInterpreter},
52+
{0, AC_WRITE, 0, nullptr, 0x0042, AUTO, "FilmMode", &stdInterpreter},
53+
{0, AC_WRITE, 0, nullptr, 0x0044, AUTO, "ColorTempKelvin", &stdInterpreter},
54+
{0, AC_WRITE, 0, nullptr, 0x0045, AUTO, "BracketSettings", &stdInterpreter},
55+
{0, AC_WRITE, 0, nullptr, 0x0046, AUTO, "WBAdjustAB", &stdInterpreter},
56+
{0, AC_WRITE, 0, nullptr, 0x0047, AUTO, "WBAdjustGM", &stdInterpreter},
57+
{0, AC_WRITE, 0, nullptr, 0x0048, AUTO, "FlashCurtain", &stdInterpreter},
58+
{0, AC_WRITE, 0, nullptr, 0x0049, AUTO, "LongShutterNoiseReduction", &stdInterpreter},
59+
{0, AC_WRITE, 0, nullptr, 0x004b, AUTO, "ImageWidth", &stdInterpreter},
60+
{0, AC_WRITE, 0, nullptr, 0x004c, AUTO, "ImageHeight", &stdInterpreter},
61+
{0, AC_WRITE, 0, nullptr, 0x004d, AUTO, "AFPointPosition", &stdInterpreter},
62+
{0, AC_WRITE, 0, nullptr, 0x004e, AUTO, "FaceDetInfo", &stdInterpreter},
63+
{0, AC_WRITE, 0, nullptr, 0x0051, AUTO, "LensType", &stdInterpreter},
64+
{0, AC_WRITE, 0, nullptr, 0x0052, AUTO, "LensSerialNumber", &stdInterpreter},
65+
{0, AC_WRITE, 0, nullptr, 0x0053, AUTO, "AccessoryType", &stdInterpreter},
66+
{0, AC_WRITE, 0, nullptr, 0x0054, AUTO, "AccessorySerialNumber", &stdInterpreter},
67+
{0, AC_WRITE, 0, nullptr, 0x0059, AUTO, "Transform1", &stdInterpreter},
68+
{0, AC_WRITE, 0, nullptr, 0x005d, AUTO, "IntelligentExposure", &stdInterpreter},
69+
{0, AC_WRITE, 0, nullptr, 0x0060, AUTO, "LensFirmwareVersion", &stdInterpreter},
70+
{0, AC_WRITE, 0, nullptr, 0x0061, AUTO, "FaceRecInfo", &stdInterpreter},
71+
{0, AC_WRITE, 0, nullptr, 0x0062, AUTO, "FlashWarning", &stdInterpreter},
72+
{0, AC_WRITE, 0, nullptr, 0x0065, AUTO, "Title", &stdInterpreter},
73+
{0, AC_WRITE, 0, nullptr, 0x0066, AUTO, "BabyName", &stdInterpreter},
74+
{0, AC_WRITE, 0, nullptr, 0x0067, AUTO, "Location", &stdInterpreter},
75+
{0, AC_WRITE, 0, nullptr, 0x0069, AUTO, "Country", &stdInterpreter},
76+
{0, AC_WRITE, 0, nullptr, 0x006b, AUTO, "State", &stdInterpreter},
77+
{0, AC_WRITE, 0, nullptr, 0x006d, AUTO, "City", &stdInterpreter},
78+
{0, AC_WRITE, 0, nullptr, 0x006f, AUTO, "Landmark", &stdInterpreter},
79+
{0, AC_WRITE, 0, nullptr, 0x0070, AUTO, "IntelligentResolution", &stdInterpreter},
80+
{0, AC_WRITE, 0, nullptr, 0x0077, AUTO, "BurstSheed", &stdInterpreter},
81+
{0, AC_WRITE, 0, nullptr, 0x0079, AUTO, "IntelligentDRange", &stdInterpreter},
82+
{0, AC_WRITE, 0, nullptr, 0x007c, AUTO, "ClearRetouch", &stdInterpreter},
83+
{0, AC_WRITE, 0, nullptr, 0x0080, AUTO, "City2", &stdInterpreter},
84+
{0, AC_WRITE, 0, nullptr, 0x0086, AUTO, "ManometerPressure", &stdInterpreter},
85+
{0, AC_WRITE, 0, nullptr, 0x0089, AUTO, "PhotoStyle", &stdInterpreter},
86+
{0, AC_WRITE, 0, nullptr, 0x008a, AUTO, "ShadingCompensation", &stdInterpreter},
87+
{0, AC_WRITE, 0, nullptr, 0x008c, AUTO, "AccelerometerZ", &stdInterpreter},
88+
{0, AC_WRITE, 0, nullptr, 0x008d, AUTO, "AccelerometerX", &stdInterpreter},
89+
{0, AC_WRITE, 0, nullptr, 0x008e, AUTO, "AccelerometerY", &stdInterpreter},
90+
{0, AC_WRITE, 0, nullptr, 0x008f, AUTO, "CameraOrientation", &stdInterpreter},
91+
{0, AC_WRITE, 0, nullptr, 0x0090, AUTO, "RollAngle", &stdInterpreter},
92+
{0, AC_WRITE, 0, nullptr, 0x0091, AUTO, "PitchAngle", &stdInterpreter},
93+
{0, AC_WRITE, 0, nullptr, 0x0093, AUTO, "SweepPanoramaDirection", &stdInterpreter},
94+
{0, AC_WRITE, 0, nullptr, 0x0094, AUTO, "PanoramaFieldOfView", &stdInterpreter},
95+
{0, AC_WRITE, 0, nullptr, 0x0096, AUTO, "TimerRecording", &stdInterpreter},
96+
{0, AC_WRITE, 0, nullptr, 0x009d, AUTO, "InternalNDFilter", &stdInterpreter},
97+
{0, AC_WRITE, 0, nullptr, 0x009e, AUTO, "HDR", &stdInterpreter},
98+
{0, AC_WRITE, 0, nullptr, 0x009f, AUTO, "ShutterType", &stdInterpreter},
99+
{0, AC_WRITE, 0, nullptr, 0x00a3, AUTO, "ClearRetouchValue", &stdInterpreter},
100+
{0, AC_WRITE, 0, nullptr, 0x00ab, AUTO, "TouchAE", &stdInterpreter},
101+
{0, AC_WRITE, 0, nullptr, 0x0e00, AUTO, "PrintIM", &stdInterpreter},
102+
{0, AC_WRITE, 0, nullptr, 0x8000, AUTO, "MakerNoteVersion", &stdInterpreter},
103+
{0, AC_WRITE, 0, nullptr, 0x8001, AUTO, "SceneMode", &stdInterpreter},
104+
{0, AC_WRITE, 0, nullptr, 0x8004, AUTO, "WBRedLevel", &stdInterpreter},
105+
{0, AC_WRITE, 0, nullptr, 0x8005, AUTO, "WBGreenLevel", &stdInterpreter},
106+
{0, AC_WRITE, 0, nullptr, 0x8006, AUTO, "WBBlueLevel", &stdInterpreter},
107+
{0, AC_WRITE, 0, nullptr, 0x8007, AUTO, "FlashFired", &stdInterpreter},
108+
{0, AC_WRITE, 0, nullptr, 0x8008, AUTO, "TextStamp3", &stdInterpreter},
109+
{0, AC_WRITE, 0, nullptr, 0x8009, AUTO, "TextStamp4", &stdInterpreter},
110+
{0, AC_WRITE, 0, nullptr, 0x8010, AUTO, "BabyAge2", &stdInterpreter},
111+
{0, AC_WRITE, 0, nullptr, 0x8012, AUTO, "Transform2", &stdInterpreter},
112+
{ -1, AC_DONTWRITE, 0, nullptr, 0, AUTO, "", nullptr }
113+
};
114+
115+
const TagAttrib panasonicRawAttribs[] = {
116+
{0, AC_WRITE, 0, nullptr, 0x0001, AUTO, "Version", &stdInterpreter},
117+
{0, AC_WRITE, 0, nullptr, 0x0002, AUTO, "SensorWidth", &stdInterpreter},
118+
{0, AC_WRITE, 0, nullptr, 0x0003, AUTO, "SensorHeight", &stdInterpreter},
119+
{0, AC_WRITE, 0, nullptr, 0x0004, AUTO, "SensorTopBorder", &stdInterpreter},
120+
{0, AC_WRITE, 0, nullptr, 0x0005, AUTO, "SensorLeftBorder", &stdInterpreter},
121+
{0, AC_WRITE, 0, nullptr, 0x0006, AUTO, "ImageHeight", &stdInterpreter},
122+
{0, AC_WRITE, 0, nullptr, 0x0007, AUTO, "ImageWidth", &stdInterpreter},
123+
{0, AC_WRITE, 0, nullptr, 0x0011, AUTO, "RedBalance", &stdInterpreter},
124+
{0, AC_WRITE, 0, nullptr, 0x0012, AUTO, "BlueBalance", &stdInterpreter},
125+
{0, AC_WRITE, 0, nullptr, 0x0017, AUTO, "ISOSpeed", &stdInterpreter},
126+
{0, AC_WRITE, 0, nullptr, 0x0024, AUTO, "WBRedLevel", &stdInterpreter},
127+
{0, AC_WRITE, 0, nullptr, 0x0025, AUTO, "WBGreenLevel", &stdInterpreter},
128+
{0, AC_WRITE, 0, nullptr, 0x0026, AUTO, "WBBlueLevel", &stdInterpreter},
129+
{0, AC_WRITE, 0, nullptr, 0x002e, AUTO, "PreviewImage", &stdInterpreter},
130+
{0, AC_WRITE, 0, nullptr, 0x010f, AUTO, "Make", &stdInterpreter},
131+
{0, AC_WRITE, 0, nullptr, 0x0110, AUTO, "Model", &stdInterpreter},
132+
{0, AC_WRITE, 0, nullptr, 0x0111, AUTO, "StripOffsets", &stdInterpreter},
133+
{0, AC_WRITE, 0, nullptr, 0x0112, AUTO, "Orientation", &stdInterpreter},
134+
{0, AC_WRITE, 0, nullptr, 0x0116, AUTO, "RowsPerStrip", &stdInterpreter},
135+
{0, AC_WRITE, 0, nullptr, 0x0117, AUTO, "StripByteCounts", &stdInterpreter},
136+
{0, AC_WRITE, 0, nullptr, 0x0118, AUTO, "RawDataOffset", &stdInterpreter},
137+
{ -1, AC_DONTWRITE, 0, nullptr, 0, AUTO, "", nullptr }
138+
};
139+
140+
}
141+
#endif
142+

‎rtexif/rtexif.cc

+26-2
Original file line numberDiff line numberDiff line change
@@ -847,6 +847,22 @@ Tag::Tag (TagDirectory* p, FILE* f, int base)
847847
}
848848
}
849849

850+
if (tag == 0x002e) { // location of the embedded preview image in raw files of Panasonic cameras
851+
TagDirectory* previewdir = ExifManager::parseJPEG (f, ftell (f)); // try to parse the exif data from the preview image
852+
853+
if (previewdir) {
854+
if (previewdir->getTag ("Exif")) {
855+
if (previewdir->getTag ("Make")) {
856+
if (previewdir->getTag ("Make")->valueToString() == "Panasonic") { // "make" is not yet available here, so get it from the preview tags to assure we're doing the right thing
857+
Tag* t = new Tag (parent->getRoot(), lookupAttrib (ifdAttribs, "Exif")); // replace raw exif with preview exif assuming there are the same
858+
t->initSubDir (previewdir->getTag ("Exif")->getDirectory());
859+
parent->getRoot()->addTag (t);
860+
}
861+
}
862+
}
863+
}
864+
}
865+
850866
// if this tag is the makernote, it needs special treatment (brand specific parsing)
851867
if (tag == 0x927C && attrib && !strcmp (attrib->name, "MakerNote") ) {
852868
if ( !parseMakerNote (f, base, order )) {
@@ -1214,6 +1230,14 @@ bool Tag::parseMakerNote (FILE* f, int base, ByteOrder bom )
12141230
} else {
12151231
directory[0] = new TagDirectory (parent, f, base, olympusAttribs, bom);
12161232
}
1233+
} else if ( make.find ( "Panasonic" ) != std::string::npos) {
1234+
makerNoteKind = HEADERIFD;
1235+
valuesize = 12;
1236+
value = new unsigned char[12];
1237+
fread (value, 1, 12, f);
1238+
directory = new TagDirectory*[2];
1239+
directory[0] = new TagDirectory (parent, f, base, panasonicAttribs, bom);
1240+
directory[1] = nullptr;
12171241
} else {
12181242
return false;
12191243
}
@@ -2752,10 +2776,10 @@ TagDirectory* ExifManager::parse (FILE* f, int base, bool skipIgnored)
27522776
return root;
27532777
}
27542778

2755-
TagDirectory* ExifManager::parseJPEG (FILE* f)
2779+
TagDirectory* ExifManager::parseJPEG (FILE* f, int offset)
27562780
{
27572781

2758-
fseek (f, 0, SEEK_SET);
2782+
fseek (f, offset, SEEK_SET);
27592783
unsigned char markerl = 0xff;
27602784
unsigned char c;
27612785
fread (&c, 1, 1, f);

‎rtexif/rtexif.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ class ExifManager
312312
static Tag* saveCIFFMNTag (FILE* f, TagDirectory* root, int len, const char* name);
313313
public:
314314
static TagDirectory* parse (FILE*f, int base, bool skipIgnored = true);
315-
static TagDirectory* parseJPEG (FILE*f);
315+
static TagDirectory* parseJPEG (FILE*f, int offset = 0); // offset: to extract exif data from a embedded preview/thumbnail
316316
static TagDirectory* parseTIFF (FILE*f, bool skipIgnored = true);
317317
static TagDirectory* parseCIFF (FILE* f, int base, int length);
318318
static void parseCIFF (FILE* f, int base, int length, TagDirectory* root);
@@ -629,5 +629,7 @@ extern const TagAttrib sonyCameraSettingsAttribs3[];
629629
extern const TagAttrib olympusAttribs[];
630630
extern const TagAttrib kodakIfdAttribs[];
631631
void parseKodakIfdTextualInfo (Tag *textualInfo, Tag* exif);
632+
extern const TagAttrib panasonicAttribs[];
633+
extern const TagAttrib panasonicRawAttribs[];
632634
}
633635
#endif

0 commit comments

Comments
 (0)
Please sign in to comment.