22#include "rawspeedconfig.h"
56#pragma omp for schedule(static)
61 iPoint2D tileSize(e.width, e.height);
81 if (e.dsc.tileW > std::numeric_limits<int>::max() / inputPixelBits)
82 ThrowIOE(
"Integer overflow when calculating input pitch");
84 const int inputPitchBits = inputPixelBits * e.dsc.tileW;
87 if (inputPitchBits % 8 != 0) {
88 ThrowRDE(
"Bad combination of cpp (%u), bps (%u) and width (%u), the "
89 "pitch is %d bits, which is not a multiple of 8 (1 byte)",
90 mRaw->getCpp(),
mBps, e.width, inputPitchBits);
93 const int inputPitch = inputPitchBits / 8;
95 ThrowRDE(
"Data input pitch is too short. Can not decode!");
102 mRaw->setError(err.what());
104 mRaw->setError(err.what());
107 __builtin_unreachable();
114#pragma omp for schedule(static)
120 d.
decode(e.offX, e.offY, e.width, e.height,
123 mRaw->setError(err.what());
125 mRaw->setError(err.what());
128 __builtin_unreachable();
136 std::unique_ptr<unsigned char[]> uBuffer;
139#pragma omp for schedule(static)
144 DeflateDecompressor z(e.bs.peekBuffer(e.bs.getRemainSize()),
mRaw,
151 }
catch (
const IOException& err) {
152 mRaw->setError(err.what());
155 __builtin_unreachable();
163#pragma omp for schedule(static)
169 d.
decode(e.offX, e.offY, e.width, e.height);
171 mRaw->setError(err.what());
173 mRaw->setError(err.what());
176 __builtin_unreachable();
185#pragma omp for schedule(static)
190 JpegDecompressor j(e.bs.peekBuffer(e.bs.getRemainSize()),
mRaw);
191 j.decode(e.offX, e.offY);
194 }
catch (
const IOException& err) {
195 mRaw->setError(err.what());
198 __builtin_unreachable();
222 "ZLIB is not present! Deflate compression will not be supported!"
223 mRaw->setError(
"deflate support is disabled.");
233#pragma message "JPEG is not present! Lossy JPEG DNG will not be supported!"
234 mRaw->setError(
"jpeg support is disabled.");
237 mRaw->setError(
"AbstractDngDecompressor: Unknown compression");
243#pragma omp parallel default(none) num_threads( \
244 rawspeed_get_number_of_processor_cores()) if (slices.size() > 1)
248 std::string firstErr;
249 if (
mRaw->isTooManyErrors(1, &firstErr)) {
250 ThrowRDE(
"Too many errors encountered. Giving up. First Error:\n%s",
std::vector< DngSliceElement > slices
const uint32_t mPredictor
void decompressThread() const noexcept
void setError(const std::string &err) REQUIRES(!mutex)
void decode(uint32_t offsetX, uint32_t offsetY, uint32_t width, uint32_t height, iPoint2D maxDim, bool fixDng16Bug_)
uint32_t RAWSPEED_READONLY getCpp() const
void readUncompressedRaw()
void decode(unsigned int offsetX, unsigned int offsetY, unsigned int width, unsigned int height)
constexpr RAWSPEED_READNONE Ttgt implicit_cast(Tsrc value)
Array1DRef(T *data_, int numElts_) -> Array1DRef< T >