Changeset View
Changeset View
Standalone View
Standalone View
kstars/fitsviewer/fitshistogram.cpp
Show First 20 Lines • Show All 223 Lines • ▼ Show 20 Line(s) | 185 | { | |||
---|---|---|---|---|---|
224 | 224 | | |||
225 | for (int n = 0; n < channels; n++) | 225 | for (int n = 0; n < channels; n++) | ||
226 | { | 226 | { | ||
227 | futures.append(QtConcurrent::run([ = ]() | 227 | futures.append(QtConcurrent::run([ = ]() | ||
228 | { | 228 | { | ||
229 | uint32_t offset = n * samples; | 229 | uint32_t offset = n * samples; | ||
230 | int32_t id = 0; | 230 | int32_t id = 0; | ||
231 | 231 | | |||
232 | for (uint32_t i = 0; i < samples; i++) | 232 | const int sampleBy = samples > 1000000 ? samples / 1000000 : 1; | ||
233 | for (uint32_t i = 0; i < samples; i += sampleBy) | ||||
233 | { | 234 | { | ||
234 | id = rint((buffer[i + offset] - FITSMin[n]) / binWidth[n]); | 235 | id = rint((buffer[i + offset] - FITSMin[n]) / binWidth[n]); | ||
235 | if (id < 0) | 236 | if (id < 0) | ||
236 | id = 0; | 237 | id = 0; | ||
237 | frequency[n][id]++; | 238 | frequency[n][id] += sampleBy; | ||
238 | } | 239 | } | ||
239 | })); | 240 | })); | ||
240 | } | 241 | } | ||
241 | 242 | | |||
242 | for (QFuture<void> future : futures) | 243 | for (QFuture<void> future : futures) | ||
243 | future.waitForFinished(); | 244 | future.waitForFinished(); | ||
244 | 245 | | |||
245 | futures.clear(); | 246 | futures.clear(); | ||
▲ Show 20 Lines • Show All 555 Lines • Show Last 20 Lines |