Mercurial > hg > orthanc-stone
comparison Framework/Loaders/OrthancMultiframeVolumeLoader.cpp @ 1349:b1e6bef86955 broker
Tentative loop optimization in CopyPixelDataAndComputeDistribution
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Fri, 10 Apr 2020 16:12:14 +0200 |
parents | b1396be5aa27 |
children | 104e0b0f2316 |
comparison
equal
deleted
inserted
replaced
1348:eac254fb6791 | 1349:b1e6bef86955 |
---|---|
311 OrthancStone::ImageBuffer3D::SliceWriter writer(target, OrthancStone::VolumeProjection_Axial, z); | 311 OrthancStone::ImageBuffer3D::SliceWriter writer(target, OrthancStone::VolumeProjection_Axial, z); |
312 | 312 |
313 assert(writer.GetAccessor().GetWidth() == width && | 313 assert(writer.GetAccessor().GetWidth() == width && |
314 writer.GetAccessor().GetHeight() == height); | 314 writer.GetAccessor().GetHeight() == height); |
315 | 315 |
316 T* targetAddr0 = reinterpret_cast<T*>(writer.GetAccessor().GetRow(0)); | |
317 unsigned int pitch = writer.GetAccessor().GetPitch(); | |
318 T* targetAddr = targetAddr0; | |
319 assert(sizeof(T) == Orthanc::GetBytesPerPixel(target.GetFormat())); | |
320 | |
316 for (unsigned int y = 0; y < height; y++) | 321 for (unsigned int y = 0; y < height; y++) |
317 { | 322 { |
318 assert(sizeof(T) == Orthanc::GetBytesPerPixel(target.GetFormat())); | |
319 | |
320 T* target = reinterpret_cast<T*>(writer.GetAccessor().GetRow(y)); | |
321 | |
322 for (unsigned int x = 0; x < width; x++) | 323 for (unsigned int x = 0; x < width; x++) |
323 { | 324 { |
324 CopyPixel(*target, source); | 325 CopyPixel(*targetAddr, source); |
325 | 326 |
326 distribution[*target] += 1; | 327 distribution[*targetAddr] += 1; |
327 | 328 |
328 target++; | 329 targetAddr++; |
329 source += bpp; | 330 source += bpp; |
330 } | 331 } |
332 targetAddr += pitch; | |
331 } | 333 } |
332 } | 334 } |
333 } | 335 } |
334 } | 336 } |
335 | 337 |