263{
264 const int endValue0 = endianness == QSysInfo::LittleEndian ? 1 : 0;
265 const int endValue1 = endianness == QSysInfo::LittleEndian ? 0 : 1;
270 double *src = pixelValuesLinear.data();
271 float *dst = pixelValues.data();
272
273 for (int y = 0; y < height; y++) {
274 for (int x = 0; x < width; x++) {
275 CSTrait::normalisedChannelsValue(it->
rawDataConst(), pixelValues);
276 if (!convertToRec2020 && !isLinear) {
277 for (int i = 0; i < 4; i++) {
278 src[i] = static_cast<double>(dst[i]);
279 }
281 for (int i = 0; i < 4; i++) {
282 dst[i] =
static_cast<float>(
src[i]);
283 }
284 }
285
287 removeHLGOOTF(dst, lCoef.constData(), hlgGamma, hlgNominalPeak);
288 }
289
290 for (int ch = 0; ch < channels; ch++) {
292 if (ch == CSTrait::alpha_pos) {
293 v = qBound<uint16_t>(
294 0,
295 static_cast<uint16_t>(
296 applyCurveAsNeeded<ConversionPolicy::KeepTheSame>(
297 dst[ch])
300 } else {
301 v = qBound<uint16_t>(
302 0,
303 static_cast<uint16_t>(
304 applyCurveAsNeeded<conversionPolicy>(dst[ch])
307 }
308 ptr[2 * (
x * channels) + y * stride + endValue0 + (ch * 2)] =
310 ptr[2 * (
x * channels) + y * stride + endValue1 + (ch * 2)] =
312 }
313
315 }
316
318 }
319}
ALWAYS_INLINE void removeHLGOOTF(float *rgb, const double *lumaCoefficients, float gamma=1.2f, float nominalPeak=1000.0f) noexcept
static constexpr uint16_t max12bit
virtual const quint8 * rawDataConst() const =0
virtual bool nextPixel()=0
QVector< qreal > lumaCoefficients
virtual const KoColorProfile * profile() const =0
virtual void linearizeFloatValue(QVector< qreal > &Value) const =0