Skip to content

Commit a331ae2

Browse files
committed
WIP/HACK: Save output using maximum range for our worst precision (float16)
1 parent f5a2538 commit a331ae2

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/DngFloatWriter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,11 +263,11 @@ void DngFloatWriter::createRawIFD() {
263263
uint16_t cblack[cfaRows * cfaCols];
264264
for (int row = 0; row < cfaRows; ++row) {
265265
for (int col = 0; col < cfaCols; ++col) {
266-
cblack[row*cfaCols + col] = params->blackAt(col, row);
266+
cblack[row*cfaCols + col] = 0;
267267
}
268268
}
269269
rawIFD.addEntry(BLACKLEVEL, IFD::SHORT, cfaRows * cfaCols, cblack);
270-
rawIFD.addEntry(WHITELEVEL, IFD::SHORT, params->max);
270+
rawIFD.addEntry(WHITELEVEL, IFD::SHORT, 65504); //Largest possible non-inf float16 value
271271
rawIFD.addEntry(SAMPLESPERPIXEL, IFD::SHORT, 1);
272272
rawIFD.addEntry(BITSPERSAMPLE, IFD::SHORT, bps);
273273
if (bps == 24) {

src/ImageStack.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -458,13 +458,13 @@ Array2D<float> ImageStack::compose(const RawParameters & params, int featherRadi
458458
}
459459

460460
dst.displace(params.leftMargin, params.topMargin);
461-
// Scale to params.max and recover the black levels
462-
float mult = (params.max - params.maxBlack) / max;
461+
// Scale to float16 limit
462+
float mult = 65504.0 / max; //65504 is the largest non-inf float16
463463
#pragma omp parallel for
464464
for (size_t y = 0; y < params.rawHeight; ++y) {
465465
for (size_t x = 0; x < params.rawWidth; ++x) {
466466
dst(x, y) *= mult;
467-
dst(x, y) += params.blackAt(x - params.leftMargin, y - params.topMargin);
467+
//dst(x, y) += params.blackAt(x - params.leftMargin, y - params.topMargin);
468468
}
469469
}
470470

0 commit comments

Comments
 (0)