libopenraw
erffile.cpp
1 /*
2  * libopenraw - erffile.cpp
3  *
4  * Copyright (C) 2006-2016 Hubert Figuiere
5  *
6  * This library is free software: you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public License
8  * as published by the Free Software Foundation, either version 3 of
9  * the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library. If not, see
18  * <http://www.gnu.org/licenses/>.
19  */
20 
21 
22 #include <libopenraw/cameraids.h>
23 
24 #include "ifddir.hpp"
25 #include "rawfile_private.hpp"
26 #include "erffile.hpp"
27 
28 using namespace Debug;
29 
30 namespace OpenRaw {
31 
32 class RawData;
33 
34 namespace Internals {
35 
36 /* taken from dcraw, by default */
37 static const BuiltinColourMatrix s_matrices[] = {
38  { OR_MAKE_FILE_TYPEID(OR_TYPEID_VENDOR_EPSON, OR_TYPEID_EPSON_RD1), 0, 0,
39  { 6827,-1878,-732,-8429,16012,2564,-704,592,7145 } },
40  { OR_MAKE_FILE_TYPEID(OR_TYPEID_VENDOR_EPSON, OR_TYPEID_EPSON_RD1S), 0, 0,
41  { 6827,-1878,-732,-8429,16012,2564,-704,592,7145 } },
42  { 0, 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0 } }
43 };
44 
45 const IfdFile::camera_ids_t ERFFile::s_def[] = {
46  { "R-D1", OR_MAKE_FILE_TYPEID(OR_TYPEID_VENDOR_EPSON,
47  OR_TYPEID_EPSON_RD1) },
48  { "R-D1s", OR_MAKE_FILE_TYPEID(OR_TYPEID_VENDOR_EPSON,
49  OR_TYPEID_EPSON_RD1S) }, { 0, 0 }
50 };
51 
52 RawFile *ERFFile::factory(const IO::Stream::Ptr &s)
53 {
54  return new ERFFile(s);
55 }
56 
57 ERFFile::ERFFile(const IO::Stream::Ptr &s)
58  : TiffEpFile(s, OR_RAWFILE_TYPE_ERF)
59 {
60  _setIdMap(s_def);
61  _setMatrices(s_matrices);
62 }
63 
64 ERFFile::~ERFFile()
65 {
66 }
67 
68 ::or_error ERFFile::_getRawData(RawData & data, uint32_t /*options*/)
69 {
70  ::or_error err;
71  const IfdDir::Ref & _cfaIfd = cfaIfd();
72  if(_cfaIfd) {
73  err = _getRawDataFromDir(data, _cfaIfd);
74  }
75  else {
76  err = OR_ERROR_NOT_FOUND;
77  }
78  return err;
79 }
80 
81 }
82 }
83 
84 /*
85  Local Variables:
86  mode:c++
87  c-file-style:"stroustrup"
88  c-file-offsets:((innamespace . 0))
89  indent-tabs-mode:nil
90  fill-column:80
91  End:
92 */
CIFF is the container for CRW files. It is an attempt from Canon to make this a standard. I guess it failed.
Definition: arwfile.cpp:30
virtual ::or_error _getRawData(RawData &data, uint32_t options) override
Definition: erffile.cpp:68
Definition: trace.cpp:30
const IfdDir::Ref & cfaIfd()
Definition: ifdfile.cpp:333
::or_error _getRawDataFromDir(RawData &data, const IfdDir::Ref &dir)
Definition: ifdfile.cpp:511