summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHubert Figuiere <hub@figuiere.net>2010-03-09 23:15:49 -0800
committerHubert Figuiere <hub@figuiere.net>2010-03-09 23:15:49 -0800
commitb794f3c905a0efcb7597ec3f6a8bcb087804d945 (patch)
tree89c7185c9abe1ae454734df672d1f3bebb9a6f6c
parent69a48e0c8a0d3ecba8f79472544a879da7d8eea7 (diff)
Support for Olympus ORF big-endian files and "RS" (12-bits).
Added E-10, E-P1, E-620, SP350, SP500, SP510 and SP550.
-rw-r--r--README11
-rw-r--r--include/libopenraw/consts.h5
-rw-r--r--lib/ifdfile.cpp8
-rw-r--r--lib/orfcontainer.cpp60
-rw-r--r--lib/orfcontainer.h56
-rw-r--r--lib/orffile.cpp38
-rw-r--r--lib/orffile.h14
-rw-r--r--lib/rawfile.cpp2
8 files changed, 115 insertions, 79 deletions
diff --git a/README b/README
index e373a22..ed43aa5 100644
--- a/README
+++ b/README
@@ -111,7 +111,7 @@ Nikon NEF Y Y Y Y Y Y
Olympus ORF Y Y N Y Y Y
E-1 T T T
- E-10 B B T
+ E-10 T B T
E-3 T T T
E-300 T T B T T T
E-330 T T N T
@@ -119,9 +119,12 @@ Olympus ORF Y Y N Y Y Y
E-410 B T N T T
E-500 T T T T
E-510 B T T T
- SP-350
- SP-510 B B
- SP-550 B B
+ E-620 B N T
+ SP-350 B B X T T T
+ SP-500 B B X T T T
+ SP-510 B B X T T T
+ SP-550 B B X T T T
+ E-P1 B N T
Adobe DNG Y Y N Y Y Y
Leica DMR T T X T T T
diff --git a/include/libopenraw/consts.h b/include/libopenraw/consts.h
index de49034..52019ba 100644
--- a/include/libopenraw/consts.h
+++ b/include/libopenraw/consts.h
@@ -241,7 +241,10 @@ extern "C" {
OR_TYPEID_OLYMPUS_E510,
OR_TYPEID_OLYMPUS_SP350,
OR_TYPEID_OLYMPUS_SP510,
- OR_TYPEID_OLYMPUS_SP550
+ OR_TYPEID_OLYMPUS_SP550,
+ OR_TYPEID_OLYMPUS_SP500,
+ OR_TYPEID_OLYMPUS_EP1,
+ OR_TYPEID_OLYMPUS_E620
};
enum {
diff --git a/lib/ifdfile.cpp b/lib/ifdfile.cpp
index 0236962..ac346b0 100644
--- a/lib/ifdfile.cpp
+++ b/lib/ifdfile.cpp
@@ -84,6 +84,10 @@ void IFDFile::_identifyId()
if(!m_mainIfd) {
m_mainIfd = _locateMainIfd();
}
+ if(!m_mainIfd) {
+ Trace(ERROR) << "Main IFD not found to identify the file.\n";
+ return;
+ }
std::string model;
if(m_mainIfd->getValue(IFD::EXIF_TAG_MODEL, model)) {
_setTypeId(_typeIdFromModel(model));
@@ -480,6 +484,10 @@ static RawData::CfaPattern _getCfaPattern(const IFDDir::Ref & dir)
x = 0;
y = 0;
+ if(!dir) {
+ Trace(ERROR) << "dir is NULL\n";
+ return OR_ERROR_NOT_FOUND;
+ }
got_it = dir->getValue(IFD::EXIF_TAG_BITS_PER_SAMPLE, bpc);
if(!got_it) {
Trace(ERROR) << "unable to guess Bits per sample\n";
diff --git a/lib/orfcontainer.cpp b/lib/orfcontainer.cpp
index bc298cc..5cc91bb 100644
--- a/lib/orfcontainer.cpp
+++ b/lib/orfcontainer.cpp
@@ -1,7 +1,7 @@
/*
* libopenraw - orfcontainer.cpp
*
- * Copyright (C) 2006 Hubert Figuiere
+ * Copyright (C) 2006, 2010 Hubert Figuiere
*
* This library is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
@@ -27,40 +27,50 @@ using namespace Debug;
namespace OpenRaw {
- namespace Internals {
+namespace Internals {
- ORFContainer::ORFContainer(IO::Stream *_file, off_t offset)
- : IFDFileContainer(_file, offset)
- {
- }
+OrfContainer::OrfContainer(IO::Stream *_file, off_t offset)
+ : IFDFileContainer(_file, offset)
+ , subtype_(0)
+{
+}
- ORFContainer::~ORFContainer()
- {
- }
+OrfContainer::~OrfContainer()
+{
+}
- IFDFileContainer::EndianType
- ORFContainer::isMagicHeader(const char *p, int len)
- {
- if (len < 4){
- // we need at least 4 bytes to check
- return ENDIAN_NULL;
- }
- if ((p[0] == 0x49) && (p[1] == 0x49)
- && (p[2] == 0x52) && (p[3] == 0x4f)) {
+IFDFileContainer::EndianType
+OrfContainer::isMagicHeader(const char *p, int len)
+{
+ if (len < 4){
+ // we need at least 4 bytes to check
+ return ENDIAN_NULL;
+ }
+ if ((p[0] == 'I') && (p[1] == 'I')) {
+ if((p[2] == 'R') && ((p[3] == 'O') || (p[3] == 'S'))) {
- Trace(DEBUG1) << "Identified ORF file\n";
+ Trace(DEBUG1) << "Identified EL ORF file. Subtype = " << p[3] << "\n";
+ subtype_ = p[3];
+ return ENDIAN_LITTLE;
+ }
+ }
+ else if((p[0] == 'M') && (p[1] == 'M')) {
+ if((p[3] == 'R') && ((p[2] == 'O') || (p[2] == 'S'))) {
- return ENDIAN_LITTLE;
- }
+ Trace(DEBUG1) << "Identified BE ORF file. Subtype = " << p[2] << "\n";
+ subtype_ = p[2];
+ return ENDIAN_BIG;
+ }
+ }
- Trace(DEBUG1) << "Unidentified ORF file\n";
+ Trace(ERROR) << "Unidentified ORF file\n";
- return ENDIAN_NULL;
- }
+ return ENDIAN_NULL;
+}
- }
+}
}
diff --git a/lib/orfcontainer.h b/lib/orfcontainer.h
index 900020c..a251d45 100644
--- a/lib/orfcontainer.h
+++ b/lib/orfcontainer.h
@@ -1,7 +1,7 @@
/*
* libopenraw - orfcontainer.h
*
- * Copyright (C) 2006 Hubert Figuiere
+ * Copyright (C) 2006, 2010 Hubert Figuiere
*
* This library is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
@@ -25,31 +25,35 @@
#include "ifdfilecontainer.h"
namespace OpenRaw {
- namespace Internals {
-
- class IOFile;
-
- class ORFContainer
- : public IFDFileContainer
- {
- public:
- ORFContainer(IO::Stream *file, off_t offset);
- /** destructor */
- virtual ~ORFContainer();
-
- /**
- Check the ORF magic header.
- */
- virtual IFDFileContainer::EndianType
- isMagicHeader(const char *p, int len);
-
- private:
- /* avoid these being called. */
- ORFContainer(const ORFContainer &);
- ORFContainer & operator=(const ORFContainer &);
- };
-
- }
+namespace Internals {
+
+static const char ORF_SUBTYPE_16BPP = 'O';
+static const char ORF_SUBTYPE_12BPP = 'S';
+
+class IOFile;
+
+class OrfContainer
+ : public IFDFileContainer
+{
+public:
+ OrfContainer(IO::Stream *file, off_t offset);
+ /** destructor */
+ virtual ~OrfContainer();
+
+ /**
+ Check the ORF magic header.
+ */
+ virtual IFDFileContainer::EndianType
+ isMagicHeader(const char *p, int len);
+
+private:
+ char subtype_;
+ /* avoid these being called. */
+ OrfContainer(const OrfContainer &);
+ OrfContainer & operator=(const OrfContainer &);
+};
+
+}
}
diff --git a/lib/orffile.cpp b/lib/orffile.cpp
index 28980f4..a545ebc 100644
--- a/lib/orffile.cpp
+++ b/lib/orffile.cpp
@@ -32,13 +32,12 @@
using namespace Debug;
namespace OpenRaw {
+namespace Internals {
- namespace Internals {
-
- const struct IFDFile::camera_ids_t ORFFile::s_def[] = {
+ const struct IFDFile::camera_ids_t OrfFile::s_def[] = {
{ "E-1 ", OR_MAKE_FILE_TYPEID(OR_TYPEID_VENDOR_OLYMPUS,
OR_TYPEID_OLYMPUS_E1) },
- { "E-10 ", OR_MAKE_FILE_TYPEID(OR_TYPEID_VENDOR_OLYMPUS,
+ { "E-10 " , OR_MAKE_FILE_TYPEID(OR_TYPEID_VENDOR_OLYMPUS,
OR_TYPEID_OLYMPUS_E10) },
{ "E-3 ", OR_MAKE_FILE_TYPEID(OR_TYPEID_VENDOR_OLYMPUS,
OR_TYPEID_OLYMPUS_E3) },
@@ -54,28 +53,39 @@ namespace OpenRaw {
OR_TYPEID_OLYMPUS_E500) },
{ "E-510 ", OR_MAKE_FILE_TYPEID(OR_TYPEID_VENDOR_OLYMPUS,
OR_TYPEID_OLYMPUS_E510) },
-
+ { "SP350" , OR_MAKE_FILE_TYPEID(OR_TYPEID_VENDOR_OLYMPUS,
+ OR_TYPEID_OLYMPUS_SP350) },
+ { "SP500UZ" , OR_MAKE_FILE_TYPEID(OR_TYPEID_VENDOR_OLYMPUS,
+ OR_TYPEID_OLYMPUS_SP500) },
+ { "SP510UZ" , OR_MAKE_FILE_TYPEID(OR_TYPEID_VENDOR_OLYMPUS,
+ OR_TYPEID_OLYMPUS_SP510) },
+ { "SP550UZ ", OR_MAKE_FILE_TYPEID(OR_TYPEID_VENDOR_OLYMPUS,
+ OR_TYPEID_OLYMPUS_SP550) },
+ { "E-P1 ", OR_MAKE_FILE_TYPEID(OR_TYPEID_VENDOR_OLYMPUS,
+ OR_TYPEID_OLYMPUS_EP1) },
+ { "E-620 ", OR_MAKE_FILE_TYPEID(OR_TYPEID_VENDOR_OLYMPUS,
+ OR_TYPEID_OLYMPUS_E620) },
{ 0, 0 }
};
- RawFile *ORFFile::factory(IO::Stream *s)
+ RawFile *OrfFile::factory(IO::Stream *s)
{
- return new ORFFile(s);
+ return new OrfFile(s);
}
- ORFFile::ORFFile(IO::Stream *s)
+ OrfFile::OrfFile(IO::Stream *s)
: IFDFile(s, OR_RAWFILE_TYPE_ORF, false)
{
_setIdMap(s_def);
- m_container = new ORFContainer(m_io, 0);
+ m_container = new OrfContainer(m_io, 0);
}
- ORFFile::~ORFFile()
+ OrfFile::~OrfFile()
{
}
- IFDDir::Ref ORFFile::_locateCfaIfd()
+ IFDDir::Ref OrfFile::_locateCfaIfd()
{
// in ORF the CFA IFD is the main IFD
if(!m_mainIfd) {
@@ -85,14 +95,14 @@ namespace OpenRaw {
}
- IFDDir::Ref ORFFile::_locateMainIfd()
+ IFDDir::Ref OrfFile::_locateMainIfd()
{
return m_container->setDirectory(0);
}
- ::or_error ORFFile::_getRawData(RawData & data, uint32_t options)
+ ::or_error OrfFile::_getRawData(RawData & data, uint32_t options)
{
::or_error err;
if(!m_cfaIfd) {
@@ -125,6 +135,6 @@ namespace OpenRaw {
return err;
}
- }
+}
}
diff --git a/lib/orffile.h b/lib/orffile.h
index 0a1d74e..ece6a30 100644
--- a/lib/orffile.h
+++ b/lib/orffile.h
@@ -1,7 +1,7 @@
/*
* libopenraw - orffile.h
*
- * Copyright (C) 2006-2008 Hubert Figuiere
+ * Copyright (C) 2006-2008, 2010 Hubert Figuiere
*
* This library is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
@@ -33,15 +33,13 @@ namespace OpenRaw {
namespace Internals {
- class ORFContainer;
-
- class ORFFile
+ class OrfFile
: public IFDFile
{
public:
static RawFile *factory(IO::Stream *);
- ORFFile(IO::Stream *);
- virtual ~ORFFile();
+ OrfFile(IO::Stream *);
+ virtual ~OrfFile();
protected:
virtual IFDDir::Ref _locateCfaIfd();
@@ -51,8 +49,8 @@ namespace OpenRaw {
private:
static RawFile::TypeId _typeIdFromModel(const std::string & model);
- ORFFile(const ORFFile&);
- ORFFile & operator=(const ORFFile &);
+ OrfFile(const OrfFile&);
+ OrfFile & operator=(const OrfFile &);
static const IFDFile::camera_ids_t s_def[];
};
diff --git a/lib/rawfile.cpp b/lib/rawfile.cpp
index c1c11cb..1754a8d 100644
--- a/lib/rawfile.cpp
+++ b/lib/rawfile.cpp
@@ -73,7 +73,7 @@ void init(void)
boost::bind(&Internals::ARWFile::factory, _1),
"arw");
static RawFileFactory fctorf(OR_RAWFILE_TYPE_ORF,
- boost::bind(&Internals::ORFFile::factory, _1),
+ boost::bind(&Internals::OrfFile::factory, _1),
"orf");
static RawFileFactory fctdng(OR_RAWFILE_TYPE_DNG,
boost::bind(&Internals::DNGFile::factory, _1),