109{
110 const uint32_t xPos =
d.m_header.layer_info.crop_x0;
111 const uint32_t yPos =
d.m_header.layer_info.crop_y0;
112 const uint32_t width =
d.m_header.layer_info.xsize;
113 const uint32_t height =
d.m_header.layer_info.ysize;
115
116 const auto *
src =
reinterpret_cast<const channelsType *
>(
d.m_rawData.data());
117 const uint32_t channels =
d.m_pixelFormat.num_channels;
118
121 const double *lCoef =
d.lCoef.constData();
123 float *
tmp = pixelValues.data();
124 const quint32 alphaPos = cs->
alphaPos();
125
126 for (size_t j = 0; j < height; j++) {
127 for (size_t i = 0; i < width; i++) {
128 for (size_t i = 0; i < channels; i++) {
130 }
131
132 for (size_t ch = 0; ch < channels; ch++) {
133 if (ch == alphaPos) {
134 tmp[ch] = value<LinearizePolicy::KeepTheSame, channelsType>(src, ch);
135 } else {
136 tmp[ch] = value<policy, channelsType>(src, ch);
137 }
138 }
139
140 if (swap) {
141 std::swap(
tmp[0],
tmp[2]);
142 }
143
146 }
147
149
150 src +=
d.m_pixelFormat.num_channels;
151
152 it->nextPixel();
153 }
154 it->nextRow();
155 }
156 } else {
157 for (size_t j = 0; j < height; j++) {
158 for (size_t i = 0; i < width; i++) {
159 auto *dst = reinterpret_cast<channelsType *>(it->rawData());
160
161 std::memcpy(dst, src, channels * sizeof(channelsType));
162
163 if (swap) {
164 std::swap(dst[0], dst[2]);
165 }
else if (
d.isCMYK &&
d.m_info.uses_original_profile) {
166
167 std::swap(dst[3], dst[4]);
168 }
169
170 src +=
d.m_pixelFormat.num_channels;
171
172 it->nextPixel();
173 }
174 it->nextRow();
175 }
176 }
177}
ALWAYS_INLINE void applyHLGOOTF(float *rgb, const double *lumaCoefficients, float gamma=1.2f) noexcept
virtual quint32 alphaPos() const =0
virtual quint32 channelCount() const =0
virtual void fromNormalisedChannelsValue(quint8 *pixel, const QVector< float > &values) const =0