13 Commits

Author SHA1 Message Date
Mirco Miranda
4168c46964 RAW: Fixed unnecessary image unpack
Backport of MR !254 (According to the libraw documentation, the sizes are available directly after open_datastream.)

One benefit is that it doubles the speed of preview creation in Dolphin.
2024-09-15 10:31:40 +00:00
Mirco Miranda
478e49b8a6 raw: fix multi image load
Fixes not loading a second image in the file. This patch allow code like the following.

QImageReader r(file);
do {
    auto qi = r.read();
    if (!qi.isNull()) {
        qi.save(QString("/tmp/%1_%2.tif")
                .arg(QFileInfo(file).baseName())
                .arg(r.currentImageNumber()));
    }
}
while (r.jumpToNextImage());

m_startPos is used to reposition the device if you decide to do a subsequent read: libraw wants it to be at the beginning of the RAW stream

(cherry picked from commit 18ea0492bc5b6689c9523c84dd716b3c50dc918f)
2023-09-25 22:56:39 +02:00
Friedrich W. H. Kossebau
ed6a3c520d Add explicit moc includes to sources for moc-covered headers
* speeds up incremental builds as changes to a header will not always
  need the full mocs_compilation.cpp for all the target's headers rebuild,
  while having a moc file sourced into a source file only adds minor
  extra costs, due to small own code and the used headers usually
  already covered by the source file, being for the same class/struct
* seems to not slow down clean builds, due to empty mocs_compilation.cpp
  resulting in those quickly processed, while the minor extra cost of the
  sourced moc files does not outweigh that in summary.
  Measured times actually improved by some percent points.
  (ideally CMake would just skip empty mocs_compilation.cpp & its object
  file one day)
* enables compiler to see all methods of a class in same compilation unit
  to do some sanity checks
* potentially more inlining in general, due to more in the compilation unit
* allows to keep using more forward declarations in the header, as with the
  moc code being sourced into the cpp file there definitions can be ensured
  and often are already for the needs of the normal class methods

(cherry picked from commit 34ed3bad2714247f8c2dfec615bf6f031cc5fea8)
2023-07-02 11:55:33 +02:00
Mirco Miranda
bc52c03981 HDR support removed from RAW plugin 2023-01-30 21:59:09 +00:00
Albert Astals Cid
05bd9397b3 raw: tweak seek implementation
libraw uses fseek when doing files, which allows seeking past the end
without problems, so do the same, otherwise when we report oss-fuzz
issues they say "give me an example to reproduce" and since our seek
and their seek don't behave the same it's hard to convince them
to fix their code
2022-12-14 23:56:20 +01:00
Mirco Miranda
a3049f6740 Fix missing DCI-P3 color space set 2022-11-24 15:02:31 +01:00
Mirco Miranda
dcab3a06ab raw: LibRaw_QIODevice::read: fixed possible partial reading of an item
- If the size of an item is greater than 1 byte, it must be ensured that it is not partially read.
- In many readings, LibRAW gives an error if a partial number of items are read so I always try to read everything.
2022-11-19 10:14:16 +00:00
Albert Astals Cid
8586bb4719 raw: Don't seek back if we were asked to read too much
Otherwise we will return false when LibRaw::derror
calls for eof() when it is actually that we have reached eof
2022-10-30 23:59:55 +01:00
Friedrich W. H. Kossebau
20f74ce5e6 FindLibRaw: fix include dir, should not contain prefix libraw/
See also the examples at https://www.libraw.org/docs/API-CXX.html

BUG: 460105
2022-10-08 02:15:18 +02:00
Mirco Miranda
c96ad6ba8a Fixes for sequential devices 2022-10-02 06:01:23 +00:00
Mirco Miranda
6f3a326cf8 LibRaw_QIODevice::seek() avoid seek on a sequential device 2022-09-21 02:14:55 +02:00
Mirco Miranda
d881a7bbb1 LibRaw_QIODevice::seek() bounding checks 2022-09-20 19:44:08 +02:00
Mirco Miranda
65a20b43fc Camera RAW images plugin
Plugin to read RAW camera images based on LibRAW.

- Supersedes MR !86 
- Support to LibRaw 0.20 and 0.21-Beta
- Support to multi-shot images: use imageCount(), jumpToImage() to select the wanted shot
- By default generates 16-bits sRGB images using camera white balance and interpolation AHD
- Should fix CCBUG: 454208: on my Debian with KF5.96 and the pulgin installed, I see the preview of all my RAW files (ARW included) in Dolphin

News compared to V1 (MR !86)

- Fix possible stack overflow due to the huge size of LibRaw class
- Fix image allocation with Qt 6 (make use of QImageIOHandler::allocateImage()) 
- Support to XMP metapacket
- Support to quality option. For e.g. you can focus on quality (q = 10) or speed (q = 1)
- oss-fuzz available [here](https://github.com/mircomir/oss-fuzz/tree/raw_fuzz/projects/kimageformats)
2022-09-19 23:52:43 +00:00