diff --git a/src/librawspeed/decoders/ArwDecoder.cpp b/src/librawspeed/decoders/ArwDecoder.cpp index ae0fe6dbb..e3bca18ac 100644 --- a/src/librawspeed/decoders/ArwDecoder.cpp +++ b/src/librawspeed/decoders/ArwDecoder.cpp @@ -20,7 +20,6 @@ */ #include "decoders/ArwDecoder.h" -#include "MemorySanitizer.h" #include "adt/Array1DRef.h" #include "adt/Array2DRef.h" #include "adt/Casts.h" @@ -318,7 +317,7 @@ void ArwDecoder::DecodeLJpeg(const TiffIFD* raw) { width > 9728 || height > 6656) ThrowRDE("Unexpected image dimensions found: (%u; %u)", width, height); - mRaw->dim = iPoint2D(2 * width, height / 2); + mRaw->dim = iPoint2D(width, height); auto tilew = uint64_t(raw->getEntry(TiffTag::TILEWIDTH)->getU32()); uint32_t tileh = raw->getEntry(TiffTag::TILELENGTH)->getU32(); @@ -326,9 +325,6 @@ void ArwDecoder::DecodeLJpeg(const TiffIFD* raw) { if (tilew <= 0 || tileh <= 0 || tileh % 2 != 0) ThrowRDE("Invalid tile size: (%" PRIu64 ", %u)", tilew, tileh); - tileh /= 2; - tilew *= 2; - assert(tilew > 0); const auto tilesX = implicit_cast(roundUpDivision(mRaw->dim.x, tilew)); @@ -409,48 +405,11 @@ void ArwDecoder::DecodeLJpeg(const TiffIFD* raw) { firstErr.c_str()); } - PostProcessLJpeg(); - const TiffEntry* size_entry = raw->getEntry(TiffTag::SONYRAWIMAGESIZE); iRectangle2D crop(0, 0, size_entry->getU32(0), size_entry->getU32(1)); mRaw->subFrame(crop); } -void ArwDecoder::PostProcessLJpeg() { - MSan::CheckMemIsInitialized(mRaw->getByteDataAsUncroppedArray2DRef()); - RawImage nonInterleavedRaw = mRaw; - - invariant(nonInterleavedRaw->dim.x % 4 == 0); - iPoint2D interleavedDims = {nonInterleavedRaw->dim.x / 2, - 2 * nonInterleavedRaw->dim.y}; - mRaw = RawImage::create(interleavedDims, RawImageType::UINT16, 1); - - const Array2DRef in = - nonInterleavedRaw->getU16DataAsUncroppedArray2DRef(); - const Array2DRef out = mRaw->getU16DataAsUncroppedArray2DRef(); - -#ifdef HAVE_OPENMP -#pragma omp parallel for schedule(static) default(none) firstprivate(in, out) -#endif - for (int inRow = 0; inRow < in.height(); ++inRow) { - static constexpr iPoint2D inMCUSize = {4, 1}; - static constexpr iPoint2D outMCUSize = {2, 2}; - - invariant(in.width() % inMCUSize.x == 0); - for (int MCUIdx = 0, numMCUsPerRow = in.width() / inMCUSize.x; - MCUIdx < numMCUsPerRow; ++MCUIdx) { - for (int outMCURow = 0; outMCURow != outMCUSize.y; ++outMCURow) { - for (int outMCUСol = 0; outMCUСol != outMCUSize.x; ++outMCUСol) { - out(outMCUSize.y * inRow + outMCURow, - outMCUSize.x * MCUIdx + outMCUСol) = - in(inRow, - MCUIdx * inMCUSize.x + outMCUSize.x * outMCURow + outMCUСol); - } - } - } - } -} - void ArwDecoder::DecodeARW2(ByteStream input, uint32_t w, uint32_t h, uint32_t bpp) { diff --git a/src/librawspeed/decoders/ArwDecoder.h b/src/librawspeed/decoders/ArwDecoder.h index 68d569017..b84ed6c58 100644 --- a/src/librawspeed/decoders/ArwDecoder.h +++ b/src/librawspeed/decoders/ArwDecoder.h @@ -54,7 +54,6 @@ class ArwDecoder final : public AbstractTiffDecoder { RawImage decodeSRF(); void DecodeARW2(ByteStream input, uint32_t w, uint32_t h, uint32_t bpp); void DecodeLJpeg(const TiffIFD* raw); - void PostProcessLJpeg(); void DecodeUncompressed(const TiffIFD* raw) const; static void SonyDecrypt(Array1DRef ibuf, Array1DRef obuf, int len, uint32_t key);