Frame: Dynamically balance catalog splats

This commit is contained in:
wyj committed 2026-08-27 00:36:38 -04:00
1 parent 7b034f42e8
commit d9f2c83b9f
1 file changed
+9 -4
+9 -4
View File
@@ -333,10 +333,15 @@ size_t frame_splat_catalog(const FrameLensMesh *mesh,
#pragma omp parallel num_threads((int)worker_count) reduction(+ : images)
{
const size_t worker = (size_t)omp_get_thread_num();
const size_t first = mesh->triangle_count * worker / worker_count;
const size_t last = mesh->triangle_count * (worker + 1) / worker_count;
images += splat_catalog_triangles(mesh, catalog, private_hdr[worker], width,
height, exposure, psf, first, last);
/* Source density and lens magnification can vary by orders of magnitude
* between neighboring image triangles. Dynamic single-triangle chunks
* prevent a small sky region from leaving the other private HDR workers
* idle. Each worker still owns its HDR buffer exclusively. */
#pragma omp for schedule(dynamic, 1)
for (size_t triangle = 0; triangle < mesh->triangle_count; ++triangle)
images += splat_catalog_triangles(mesh, catalog, private_hdr[worker],
width, height, exposure, psf, triangle,
triangle + 1);
}
#pragma omp parallel for schedule(static)
for (size_t pixel = 0; pixel < pixel_count; ++pixel)