~ubuntu-branches/debian/sid/libopenraw/sid

« back to all changes in this revision

Viewing changes to debian/patches/02-fix_support_for_ORF_and_PEF.patch

  • Committer: Bazaar Package Importer
  • Author(s): David Paleino
  • Date: 2010-08-18 11:36:32 UTC
  • Revision ID: james.westby@ubuntu.com-20100818113632-l0xc1bc2ydcuds0i
Tags: 0.0.8-2
* debian/control:
  - updated my email address
  - DMUA removed
  - Sarah J. Fortune added as co-maintainer (Closes: #530244)
  - Build-Depends change: libjpeg62-dev → libjpeg-dev
  - Standards-Version bumped to 3.9.1
    + debian/libopenraw-dev.install, debian/libopenrawgnome-dev.install:
      don't install *.la files anymore (§10.2)
  - remove Build-Depends on quilt
  - Build-Depend on debhelper >= 7.0.50~
* debian/copyright: updated copyright years for debian/*
* debian/patches/02-fix_support_for_ORF_and_PEF.patch added,
  cherry-picked from upstream's git (see comment) (Closes: #569788)
* debian/source/format: using 3.0 (quilt)
* debian/rules:
  - removed quilt machinery
  - use full dh7 power :)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
From: Hubert Figuiere <hub@figuiere.net>
 
2
Subject: Support (partially) PEF from Pentax K20D.
 
3
 Detect that ORF file are compressed if they are. (Closes #26618)
 
4
 Skip compressed CFA when rendering the image. (Closes #25464) 
 
5
Origin: upstream, http://cgit.freedesktop.org/libopenraw/commit/?id=1b15acdcfdc4664bc6c0be473cb6e096071a4e62
 
6
 
 
7
---
 
8
 README                      |    5 +++--
 
9
 include/libopenraw/consts.h |    5 +++--
 
10
 lib/orffile.cpp             |   33 +++++++++++++++++++++++++++++----
 
11
 lib/peffile.cpp             |   20 ++++++++++----------
 
12
 lib/rawfile.cpp             |    7 ++++++-
 
13
 testsuite/testsuite.xml     |   36 ++++++++++++++++++++++++++++++++++++
 
14
 6 files changed, 87 insertions(+), 19 deletions(-)
 
15
 
 
16
--- libopenraw.orig/README
 
17
+++ libopenraw/README
 
18
@@ -114,9 +114,9 @@ Olympus ORF              Y Y N Y Y Y
 
19
  E-10                    B B       T
 
20
  E-3                     T T       T
 
21
  E-300                   T T B T T T
 
22
- E-330                   T T       T
 
23
+ E-330                   T T N     T
 
24
  E-400                   T B   T   T
 
25
- E-410                   B T   T   T
 
26
+ E-410                   B T N T   T
 
27
  E-500                   T T   T   T
 
28
  E-510                   B T   T   T
 
29
  SP-350
 
30
@@ -143,6 +143,7 @@ Pentax PEF               Y Y N Y Y Y
 
31
  K10D                    T T N T T T
 
32
  K100D                             T
 
33
  K100D Super             T T N     T
 
34
+ K20D                    T T N T
 
35
 
 
36
 Epson ERF                Y Y Y Y Y Y
 
37
  Epson RD1               T T T T T T
 
38
--- libopenraw.orig/include/libopenraw/consts.h
 
39
+++ libopenraw/include/libopenraw/consts.h
 
40
@@ -1,8 +1,8 @@
 
41
 /*
 
42
  * libopenraw - consts.h
 
43
  *
 
44
- * Copyright (C) 2005-2009 Hubert Figuiere
 
45
  * Copyright (c) 2008 Novell, Inc.
 
46
+ * Copyright (C) 2005-2010 Hubert Figuiere
 
47
  *
 
48
  * This library is free software: you can redistribute it and/or
 
49
  * modify it under the terms of the GNU Lesser General Public License
 
50
@@ -204,7 +204,8 @@ extern "C" {
 
51
                OR_TYPEID_PENTAX_IST_D,
 
52
                OR_TYPEID_PENTAX_IST_DL,
 
53
                OR_TYPEID_PENTAX_K100D_PEF,
 
54
-               OR_TYPEID_PENTAX_K100D_SUPER_PEF
 
55
+               OR_TYPEID_PENTAX_K100D_SUPER_PEF,
 
56
+               OR_TYPEID_PENTAX_K20D_PEF
 
57
        };
 
58
 
 
59
        /** Epson type IDs */
 
60
--- libopenraw.orig/lib/orffile.cpp
 
61
+++ libopenraw/lib/orffile.cpp
 
62
@@ -1,7 +1,7 @@
 
63
 /*
 
64
  * libopenraw - orffile.cpp
 
65
  *
 
66
- * Copyright (C) 2006, 2008 Hubert Figuiere
 
67
+ * Copyright (C) 2006, 2008, 2010 Hubert Figuiere
 
68
  *
 
69
  * This library is free software: you can redistribute it and/or
 
70
  * modify it under the terms of the GNU Lesser General Public License
 
71
@@ -77,7 +77,7 @@ namespace OpenRaw {
 
72
 
 
73
                IFDDir::Ref  ORFFile::_locateCfaIfd()
 
74
                {
 
75
-                       // in PEF the CFA IFD is the main IFD
 
76
+                       // in ORF the CFA IFD is the main IFD
 
77
                        if(!m_mainIfd) {
 
78
                                m_mainIfd = _locateMainIfd();
 
79
                        }
 
80
@@ -92,12 +92,37 @@ namespace OpenRaw {
 
81
 
 
82
 
 
83
                
 
84
-               ::or_error ORFFile::_getRawData(RawData & data, uint32_t /*options*/)
 
85
+               ::or_error ORFFile::_getRawData(RawData & data, uint32_t options)
 
86
                {
 
87
+                       ::or_error err;
 
88
                        if(!m_cfaIfd) {
 
89
                                m_cfaIfd = _locateCfaIfd();
 
90
                        }
 
91
-                       return _getRawDataFromDir(data, m_cfaIfd);
 
92
+                       err = _getRawDataFromDir(data, m_cfaIfd);
 
93
+                       if(err == OR_ERROR_NONE) {
 
94
+                               // ORF files seems to be marked as uncompressed even if they are.
 
95
+                               uint32_t x = data.x();
 
96
+                               uint32_t y = data.y();
 
97
+                               uint16_t compression = 0;
 
98
+                               if(data.size() < x * y * 2) {
 
99
+                    compression = 65535;
 
100
+                    data.setCompression(65535);
 
101
+                                       data.setDataType(OR_DATA_TYPE_COMPRESSED_CFA);
 
102
+                               }
 
103
+                else {
 
104
+                    compression = data.compression();
 
105
+                }
 
106
+                switch(compression) {
 
107
+                case 65535:
 
108
+                    if((options & OR_OPTIONS_DONT_DECOMPRESS) == 0) {
 
109
+                        // TODO decompress
 
110
+                    }
 
111
+                                       break;
 
112
+                               default:
 
113
+                                       break;
 
114
+                               }
 
115
+                       }
 
116
+                       return err;
 
117
                }
 
118
 
 
119
        }
 
120
--- libopenraw.orig/lib/peffile.cpp
 
121
+++ libopenraw/lib/peffile.cpp
 
122
@@ -1,7 +1,7 @@
 
123
 /*
 
124
  * libopenraw - peffile.cpp
 
125
  *
 
126
- * Copyright (C) 2006-2008 Hubert Figuiere
 
127
+ * Copyright (C) 2006-2008, 2010 Hubert Figuiere
 
128
  *
 
129
  * This library is free software: you can redistribute it and/or
 
130
  * modify it under the terms of the GNU Lesser General Public License
 
131
@@ -48,6 +48,8 @@ namespace OpenRaw {
 
132
                                                                                                                 OR_TYPEID_PENTAX_K100D_PEF) },
 
133
                        { "PENTAX K100D Super ", OR_MAKE_FILE_TYPEID(OR_TYPEID_VENDOR_PENTAX, 
 
134
                                                                                                                 OR_TYPEID_PENTAX_K100D_PEF) },
 
135
+                       { "PENTAX K20D        ", OR_MAKE_FILE_TYPEID(OR_TYPEID_VENDOR_PENTAX,
 
136
+                                                                                                                OR_TYPEID_PENTAX_K20D_PEF) },
 
137
                        { 0, 0 }
 
138
                };
 
139
 
 
140
@@ -83,7 +85,7 @@ namespace OpenRaw {
 
141
                        return m_container->setDirectory(0);
 
142
                }
 
143
 
 
144
-               ::or_error PEFFile::_getRawData(RawData & data, uint32_t /*options*/)
 
145
+               ::or_error PEFFile::_getRawData(RawData & data, uint32_t options)
 
146
                {
 
147
                        ::or_error err;
 
148
                        if(!m_cfaIfd) {
 
149
@@ -91,14 +93,12 @@ namespace OpenRaw {
 
150
                        }
 
151
                        err = _getRawDataFromDir(data, m_cfaIfd);
 
152
                        if(err == OR_ERROR_NONE) {
 
153
-                               uint16_t compression = 0;
 
154
-                               m_cfaIfd->getValue(IFD::EXIF_TAG_COMPRESSION, compression);
 
155
-                               switch(compression) {
 
156
-                               case 1:
 
157
-                                       data.setDataType(OR_DATA_TYPE_CFA);
 
158
-                                       break;
 
159
-                               case 65535:
 
160
-                                       // TODO decompress
 
161
+                uint16_t compression = data.compression();
 
162
+                switch(compression) {
 
163
+                case 65535:
 
164
+                    if((options & OR_OPTIONS_DONT_DECOMPRESS) == 0) {
 
165
+                        // TODO decompress
 
166
+                    }
 
167
                                        break;
 
168
                                default:
 
169
                                        break;
 
170
--- libopenraw.orig/lib/rawfile.cpp
 
171
+++ libopenraw/lib/rawfile.cpp
 
172
@@ -1,8 +1,8 @@
 
173
 /*
 
174
  * libopenraw - rawfile.cpp
 
175
  *
 
176
- * Copyright (C) 2006-2008 Hubert Figuiere
 
177
  * Copyright (C) 2008 Novell, Inc.
 
178
+ * Copyright (C) 2006-2008, 2010 Hubert Figuiere
 
179
  *
 
180
  * This library is free software: you can redistribute it and/or
 
181
  * modify it under the terms of the GNU Lesser General Public License
 
182
@@ -379,8 +379,13 @@ const std::vector<uint32_t> & RawFile::l
 
183
 ::or_error RawFile::getRenderedImage(BitmapData & bitmapdata, uint32_t options)
 
184
 {
 
185
     RawData rawdata;
 
186
+    Trace(DEBUG1) << "options are " << options << "\n";
 
187
     ::or_error ret = getRawData(rawdata, options);
 
188
     if(ret == OR_ERROR_NONE) {
 
189
+        if(rawdata.dataType() != OR_DATA_TYPE_CFA) {
 
190
+            Trace(DEBUG1) << "wrong data type\n";
 
191
+            return OR_ERROR_INVALID_FORMAT;
 
192
+        }
 
193
         uint32_t x,y;
 
194
         or_cfa_pattern pattern;
 
195
         uint16_t *src;
 
196
--- libopenraw.orig/testsuite/testsuite.xml
 
197
+++ libopenraw/testsuite/testsuite.xml
 
198
@@ -346,6 +346,42 @@
 
199
     </results>
 
200
   </test>
 
201
   <test>
 
202
+    <name>ORF-test E330</name>
 
203
+    <file>/home/hub/samples/300mm_f5.6.ORF</file>
 
204
+    <source>http://raw.fotosite.pl/download-Olympus_E-330_Sigma_135-400_f4.5-5.6/300mm_f5.6.ORF</source>
 
205
+    <results>
 
206
+      <rawType>ORF</rawType>
 
207
+      <rawTypeId>458757</rawTypeId>
 
208
+      <thumbNum>1</thumbNum>
 
209
+      <thumbSizes>160</thumbSizes>
 
210
+      <thumbFormats>JPEG</thumbFormats>
 
211
+      <thumbDataSizes>11074</thumbDataSizes>
 
212
+      <rawDataType>COMP_CFA</rawDataType>
 
213
+      <rawDataSize>12857600</rawDataSize>
 
214
+      <rawDataDimensions>3280 2450</rawDataDimensions>
 
215
+      <rawCfaPattern>RGGB</rawCfaPattern>
 
216
+      <rawMinValue>0</rawMinValue>
 
217
+      <rawMaxValue>65535</rawMaxValue>
 
218
+      <metaOrientation>1</metaOrientation>
 
219
+    </results>
 
220
+  </test>
 
221
+  <test>
 
222
+       <name>ORF-test E-410</name>
 
223
+       <file>/home/hub/samples/p1013308.orf</file>
 
224
+       <results>
 
225
+      <rawType>ORF</rawType>
 
226
+      <rawTypeId>458759</rawTypeId>
 
227
+      <thumbNum>0</thumbNum>
 
228
+      <rawDataType>COMP_CFA</rawDataType>
 
229
+      <rawDataSize>8131436</rawDataSize>
 
230
+      <rawDataDimensions>3720 2800</rawDataDimensions>
 
231
+      <rawCfaPattern>RGGB</rawCfaPattern>
 
232
+      <rawMinValue>0</rawMinValue>
 
233
+      <rawMaxValue>65535</rawMaxValue>
 
234
+      <metaOrientation>1</metaOrientation>
 
235
+       </results>
 
236
+  </test>
 
237
+  <test>
 
238
     <name>MRW-test Dimage5</name>
 
239
     <file>/home/hub/samples/mrw/Dimage5/dimage5.mrw</file>
 
240
     <source>http://libopenraw.freedesktop.org/samples/mrw/dimage5.mrw</source>