Skip to content

Commit 41b07f1

Browse files
committed
removed unnecessary retuen value from decodeRawInternal
1 parent 4b800e6 commit 41b07f1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+91
-133
lines changed

src/librawspeed/decoders/ArwDecoder.cpp

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ bool ArwDecoder::isAppropriateDecoder(const TiffRootIFD* rootIFD,
5757
return make == "SONY";
5858
}
5959

60-
RawImage ArwDecoder::decodeSRF(const TiffIFD* raw) {
60+
void ArwDecoder::decodeSRF(const TiffIFD* raw) {
6161
raw = mRootIFD->getIFDWithTag(TiffTag::IMAGEWIDTH);
6262

6363
uint32_t width = raw->getEntry(TiffTag::IMAGEWIDTH)->getU32();
@@ -101,11 +101,9 @@ RawImage ArwDecoder::decodeSRF(const TiffIFD* raw) {
101101
UncompressedDecompressor u(
102102
ByteStream(DataBuffer(di.getSubView(0, len), Endianness::little)), mRaw);
103103
u.decodeRawUnpacked<16, Endianness::big>(width, height);
104-
105-
return mRaw;
106104
}
107105

108-
RawImage ArwDecoder::decodeRawInternal() {
106+
void ArwDecoder::decodeRawInternal() {
109107
const TiffIFD* raw = nullptr;
110108
vector<const TiffIFD*> data = mRootIFD->getIFDsWithTag(TiffTag::STRIPOFFSETS);
111109

@@ -127,11 +125,13 @@ RawImage ArwDecoder::decodeRawInternal() {
127125
mRaw->createData();
128126
a.decompress(input);
129127

130-
return mRaw;
128+
return;
131129
}
132130

133-
if (hints.has("srf_format"))
134-
return decodeSRF(raw);
131+
if (hints.has("srf_format")) {
132+
decodeSRF(raw);
133+
return;
134+
}
135135

136136
ThrowRDE("No image data found");
137137
}
@@ -140,7 +140,7 @@ RawImage ArwDecoder::decodeRawInternal() {
140140
int compression = raw->getEntry(TiffTag::COMPRESSION)->getU32();
141141
if (1 == compression) {
142142
DecodeUncompressed(raw);
143-
return mRaw;
143+
return;
144144
}
145145

146146
if (32767 != compression)
@@ -176,7 +176,7 @@ RawImage ArwDecoder::decodeRawInternal() {
176176
// to detect it this way in the future.
177177
data = mRootIFD->getIFDsWithTag(TiffTag::MAKE);
178178
if (data.size() > 1) {
179-
for (auto &i : data) {
179+
for (auto& i : data) {
180180
std::string make = i->getEntry(TiffTag::MAKE)->getString();
181181
/* Check for maker "SONY" without spaces */
182182
if (make == "SONY")
@@ -199,14 +199,14 @@ RawImage ArwDecoder::decodeRawInternal() {
199199
std::array<uint32_t, 6> sony_curve = {{0, 0, 0, 0, 0, 4095}};
200200

201201
for (uint32_t i = 0; i < 4; i++)
202-
sony_curve[i+1] = (c->getU16(i) >> 2) & 0xfff;
202+
sony_curve[i + 1] = (c->getU16(i) >> 2) & 0xfff;
203203

204204
for (uint32_t i = 0; i < 0x4001; i++)
205205
curve[i] = i;
206206

207207
for (uint32_t i = 0; i < 5; i++)
208208
for (uint32_t j = sony_curve[i] + 1; j <= sony_curve[i + 1]; j++)
209-
curve[j] = curve[j-1] + (1 << i);
209+
curve[j] = curve[j - 1] + (1 << i);
210210

211211
RawImageCurveGuard curveHandler(&mRaw, curve, uncorrectedRawValues);
212212

@@ -227,8 +227,6 @@ RawImage ArwDecoder::decodeRawInternal() {
227227
a.decompress(input);
228228
} else
229229
DecodeARW2(input, width, height, bitPerPixel);
230-
231-
return mRaw;
232230
}
233231

234232
void ArwDecoder::DecodeUncompressed(const TiffIFD* raw) const {

src/librawspeed/decoders/ArwDecoder.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ class ArwDecoder final : public AbstractTiffDecoder
4242
ArwDecoder(TiffRootIFDOwner&& root, const Buffer& file)
4343
: AbstractTiffDecoder(std::move(root), file) {}
4444

45-
RawImage decodeRawInternal() override;
45+
void decodeRawInternal() override;
4646
void decodeMetaDataInternal(const CameraMetaData* meta) override;
4747

4848
private:
4949
void ParseA100WB() const;
5050

5151
[[nodiscard]] int getDecoderVersion() const override { return 1; }
52-
RawImage decodeSRF(const TiffIFD* raw);
52+
void decodeSRF(const TiffIFD* raw);
5353
void DecodeARW2(const ByteStream& input, uint32_t w, uint32_t h,
5454
uint32_t bpp);
5555
void DecodeUncompressed(const TiffIFD* raw) const;

src/librawspeed/decoders/Cr2Decoder.cpp

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ bool Cr2Decoder::isAppropriateDecoder(const TiffRootIFD* rootIFD,
5656
(make == "Kodak" && (model == "DCS520C" || model == "DCS560C"));
5757
}
5858

59-
RawImage Cr2Decoder::decodeOldFormat() {
59+
void Cr2Decoder::decodeOldFormat() {
6060
uint32_t offset = 0;
6161
if (mRootIFD->getEntryRecursive(TiffTag::CANON_RAW_DATA_OFFSET)) {
6262
offset =
@@ -77,7 +77,7 @@ RawImage Cr2Decoder::decodeOldFormat() {
7777

7878
// some old models (1D/1DS/D2000C) encode two lines as one
7979
// see: FIX_CANON_HALF_HEIGHT_DOUBLE_WIDTH
80-
if (width > 2*height) {
80+
if (width > 2 * height) {
8181
height *= 2;
8282
width /= 2;
8383
}
@@ -105,13 +105,11 @@ RawImage Cr2Decoder::decodeOldFormat() {
105105
if (!uncorrectedRawValues)
106106
mRaw->sixteenBitLookup();
107107
}
108-
109-
return mRaw;
110108
}
111109

112110
// for technical details about Cr2 mRAW/sRAW, see http://lclevy.free.fr/cr2/
113111

114-
RawImage Cr2Decoder::decodeNewFormat() {
112+
void Cr2Decoder::decodeNewFormat() {
115113
const TiffEntry* sensorInfoE =
116114
mRootIFD->getEntryRecursive(TiffTag::CANON_SENSOR_INFO);
117115
if (!sensorInfoE)
@@ -192,15 +190,13 @@ RawImage Cr2Decoder::decodeNewFormat() {
192190

193191
if (mRaw->metadata.subsampling.x > 1 || mRaw->metadata.subsampling.y > 1)
194192
sRawInterpolate();
195-
196-
return mRaw;
197193
}
198194

199-
RawImage Cr2Decoder::decodeRawInternal() {
195+
void Cr2Decoder::decodeRawInternal() {
200196
if (mRootIFD->getSubIFDs().size() < 4)
201-
return decodeOldFormat();
197+
decodeOldFormat();
202198
else // NOLINT ok, here it make sense
203-
return decodeNewFormat();
199+
decodeNewFormat();
204200
}
205201

206202
void Cr2Decoder::checkSupportInternal(const CameraMetaData* meta) {

src/librawspeed/decoders/Cr2Decoder.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ class Cr2Decoder final : public AbstractTiffDecoder
3939
Cr2Decoder(TiffRootIFDOwner&& root, const Buffer& file)
4040
: AbstractTiffDecoder(std::move(root), file) {}
4141

42-
RawImage decodeRawInternal() override;
42+
void decodeRawInternal() override;
4343
void checkSupportInternal(const CameraMetaData* meta) override;
4444
void decodeMetaDataInternal(const CameraMetaData* meta) override;
4545

4646
private:
4747
[[nodiscard]] int getDecoderVersion() const override { return 9; }
48-
RawImage decodeOldFormat();
49-
RawImage decodeNewFormat();
48+
void decodeOldFormat();
49+
void decodeNewFormat();
5050
void sRawInterpolate();
5151
[[nodiscard]] bool isSubSampled() const;
5252
[[nodiscard]] iPoint2D getSubSampling() const;

src/librawspeed/decoders/CrwDecoder.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ CrwDecoder::CrwDecoder(std::unique_ptr<const CiffIFD> rootIFD,
6060
const Buffer& file)
6161
: RawDecoder(file), mRootIFD(std::move(rootIFD)) {}
6262

63-
RawImage CrwDecoder::decodeRawInternal() {
63+
void CrwDecoder::decodeRawInternal() {
6464
const CiffEntry* rawData = mRootIFD->getEntry(CiffTag::RAWDATA);
6565
if (!rawData)
6666
ThrowRDE("Couldn't find the raw data chunk");
@@ -84,13 +84,11 @@ RawImage CrwDecoder::decodeRawInternal() {
8484
assert(decTable != nullptr);
8585
uint32_t dec_table = decTable->getU32();
8686

87-
bool lowbits = ! hints.has("no_decompressed_lowbits");
87+
bool lowbits = !hints.has("no_decompressed_lowbits");
8888

8989
CrwDecompressor c(mRaw, dec_table, lowbits, rawData->getData());
9090
mRaw->createData();
9191
c.decompress();
92-
93-
return mRaw;
9492
}
9593

9694
void CrwDecoder::checkSupportInternal(const CameraMetaData* meta) {

src/librawspeed/decoders/CrwDecoder.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class CrwDecoder final : public RawDecoder {
3838

3939
public:
4040
CrwDecoder(std::unique_ptr<const CiffIFD> rootIFD, const Buffer& file);
41-
RawImage decodeRawInternal() override;
41+
void decodeRawInternal() override;
4242
void checkSupportInternal(const CameraMetaData* meta) override;
4343
void decodeMetaDataInternal(const CameraMetaData* meta) override;
4444
static bool isCRW(const Buffer& input);

src/librawspeed/decoders/DcrDecoder.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ void DcrDecoder::checkImageDimensions() {
5353
ThrowRDE("Unexpected image dimensions found: (%u; %u)", width, height);
5454
}
5555

56-
RawImage DcrDecoder::decodeRawInternal() {
56+
void DcrDecoder::decodeRawInternal() {
5757
SimpleTiffDecoder::prepareForRawDecoding();
5858

5959
ByteStream input(DataBuffer(mFile.getSubView(off), Endianness::little));
@@ -112,8 +112,6 @@ RawImage DcrDecoder::decodeRawInternal() {
112112

113113
KodakDecompressor k(mRaw, input, bps, uncorrectedRawValues);
114114
k.decompress();
115-
116-
return mRaw;
117115
}
118116

119117
void DcrDecoder::decodeMetaDataInternal(const CameraMetaData* meta) {

src/librawspeed/decoders/DcrDecoder.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class DcrDecoder final : public SimpleTiffDecoder {
4141
DcrDecoder(TiffRootIFDOwner&& root, const Buffer& file)
4242
: SimpleTiffDecoder(std::move(root), file) {}
4343

44-
RawImage decodeRawInternal() override;
44+
void decodeRawInternal() override;
4545
void decodeMetaDataInternal(const CameraMetaData* meta) override;
4646

4747
private:

src/librawspeed/decoders/DcsDecoder.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ void DcsDecoder::checkImageDimensions() {
5151
ThrowRDE("Unexpected image dimensions found: (%u; %u)", width, height);
5252
}
5353

54-
RawImage DcsDecoder::decodeRawInternal() {
54+
void DcsDecoder::decodeRawInternal() {
5555
SimpleTiffDecoder::prepareForRawDecoding();
5656

5757
const TiffEntry* linearization =
@@ -73,8 +73,6 @@ RawImage DcsDecoder::decodeRawInternal() {
7373
u.decode8BitRaw<true>(width, height);
7474
else
7575
u.decode8BitRaw<false>(width, height);
76-
77-
return mRaw;
7876
}
7977

8078
void DcsDecoder::decodeMetaDataInternal(const CameraMetaData* meta) {

src/librawspeed/decoders/DcsDecoder.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class DcsDecoder final : public SimpleTiffDecoder {
4141
DcsDecoder(TiffRootIFDOwner&& root, const Buffer& file)
4242
: SimpleTiffDecoder(std::move(root), file) {}
4343

44-
RawImage decodeRawInternal() override;
44+
void decodeRawInternal() override;
4545
void decodeMetaDataInternal(const CameraMetaData* meta) override;
4646

4747
private:

0 commit comments

Comments
 (0)