Skip to content

Commit e843bc4

Browse files
committed
Print compression in RAF header structure
1 parent 2469369 commit e843bc4

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

src/rafimage.cpp

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ void RafImage::printStructure(std::ostream& out, PrintStructureOption option, si
7474
throw Error(ErrorCode::kerNotAnImage, "RAF");
7575
}
7676

77+
// The following is based on https://libopenraw.freedesktop.org/formats/raf/ and
78+
// https://exiftool.org/TagNames/FujiFilm.html#RAFHeader
79+
7780
const bool bPrint = option == kpsBasic || option == kpsRecursive;
7881
if (bPrint) {
7982
io_->seek(0, BasicIo::beg); // rewind
@@ -159,7 +162,7 @@ void RafImage::printStructure(std::ostream& out, PrintStructureOption option, si
159162

160163
// RAFs can carry the payload in one or two parts
161164
uint32_t meta_off[2], meta_len[2];
162-
uint32_t cfa_off[2], cfa_len[2], cfa_skip[2], cfa_size[2], cfa_stride[2];
165+
uint32_t cfa_off[2], cfa_len[2], comp[2], cfa_size[2], cfa_data[2];
163166
for (size_t i = 0; i < 2; i++) {
164167
address = io_->tell();
165168
byte data[4];
@@ -187,34 +190,34 @@ void RafImage::printStructure(std::ostream& out, PrintStructureOption option, si
187190
cfa_len[i] = Exiv2::getULong(data, bigEndian);
188191
size_t address3 = io_->tell();
189192
io_->readOrThrow(data, 4);
190-
cfa_skip[i] = Exiv2::getULong(data, bigEndian);
193+
comp[i] = Exiv2::getULong(data, bigEndian);
191194
size_t address4 = io_->tell();
192195
io_->readOrThrow(data, 4);
193196
cfa_size[i] = Exiv2::getULong(data, bigEndian);
194197
size_t address5 = io_->tell();
195198
io_->readOrThrow(data, 4);
196-
cfa_stride[i] = Exiv2::getULong(data, bigEndian);
199+
cfa_data[i] = Exiv2::getULong(data, bigEndian);
197200
{
198201
std::stringstream c_off;
199202
std::stringstream c_len;
200-
std::stringstream c_skip;
203+
std::stringstream c_comp;
201204
std::stringstream c_size;
202-
std::stringstream c_stride;
205+
std::stringstream c_data;
203206
c_off << cfa_off[i];
204207
c_len << cfa_len[i];
205-
c_skip << cfa_skip[i];
208+
c_comp << comp[i];
206209
c_size << cfa_size[i];
207-
c_stride << cfa_stride[i];
210+
c_data << cfa_data[i];
208211
out << Internal::indent(depth) << Internal::stringFormat(format, address, 4U) << " CFA offset" << i + 1 << " : "
209212
<< c_off.str() << std::endl;
210213
out << Internal::indent(depth) << Internal::stringFormat(format, address2, 4U) << " CFA length" << i + 1
211214
<< " : " << c_len.str() << std::endl;
212-
out << Internal::indent(depth) << Internal::stringFormat(format, address3, 4U) << " CFA skip" << i + 1
213-
<< " : " << c_skip.str() << std::endl;
215+
out << Internal::indent(depth) << Internal::stringFormat(format, address3, 4U) << "compression" << i + 1
216+
<< " : " << c_comp.str() << std::endl;
214217
out << Internal::indent(depth) << Internal::stringFormat(format, address4, 4U) << " CFA chunk" << i + 1
215218
<< " : " << c_size.str() << std::endl;
216-
out << Internal::indent(depth) << Internal::stringFormat(format, address5, 4U) << " CFA stride" << i + 1
217-
<< " : " << c_stride.str() << std::endl;
219+
out << Internal::indent(depth) << Internal::stringFormat(format, address5, 4U) << " unknown" << i + 1
220+
<< " : " << c_data.str() << std::endl;
218221
}
219222
}
220223

0 commit comments

Comments
 (0)