67 for (
int j = 0; j < width; j++) {
69 auto *dst =
reinterpret_cast<float *
>(it.
rawData());
72 const float v = std::ldexp(1.0f,
int(image[3]) - (128 + 8));
73 const float pixelData[4] = {float(image[0]) *
v,
77 memcpy(dst, pixelData, 4 *
sizeof(
float));
80 const float pixelData[4] = {0.0f, 0.0f, 0.0f, 1.0f};
81 memcpy(dst, pixelData, 4 *
sizeof(
float));
95 lineArray.resize(4 * width);
96 quint8 *image = (quint8 *)lineArray.data();
98 for (
int cline = 0; cline < height; cline++) {
115 s.device()->ungetChar(val);
133 if ((image[1] != 2) || (image[2] & 128)) {
142 if ((image[2] << 8 | image[3]) != width) {
143 dbgFile <<
"Line of pixels had width" << (image[2] << 8 | image[3]) <<
"instead of" << width;
148 for (
int i = 0; i < 4; i++) {
149 for (
int j = 0; j < width;) {
152 dbgFile <<
"Truncated HDR file";
159 if (j + code - 1 >= width) {
160 dbgFile <<
"Broken file detected: cannot duplicate data past image bounds!";
164 image[i + j * 4] = val;
170 if (j + code - 1 >= width) {
171 dbgFile <<
"Broken file detected: cannot extract data past image bounds!";
175 s >> image[i + j * 4];