Skip to content

Commit 0898cee

Browse files
mayjsTurboGit
authored andcommitted
Do not rely on dt_get_thread_num in colorin module
dt_get_thread_num() can be the same value for multiple chunks under some circumstances. Using it for the start and end calculation will thus be unreliable, resulting in parts of the image containing just black pixels. Fixes #18127.
1 parent aa58ed7 commit 0898cee

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/iop/colorin.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -936,7 +936,7 @@ static void process_cmatrix_fastpath(dt_iop_module_t *self,
936936
DT_OMP_FOR()
937937
for(size_t chunk = 0; chunk < nthreads; chunk++)
938938
{
939-
size_t start = chunksize * dt_get_thread_num();
939+
size_t start = chunksize * chunk;
940940
if(start >= npixels) continue; // handle case when chunksize is < 4*nthreads and last thread has no work
941941
size_t end = MIN(start + chunksize, npixels);
942942
if(clipping)
@@ -1062,7 +1062,7 @@ static void process_cmatrix_proper(dt_iop_module_t *self,
10621062
DT_OMP_FOR()
10631063
for(size_t chunk = 0; chunk < nthreads; chunk++)
10641064
{
1065-
size_t start = chunksize * dt_get_thread_num();
1065+
size_t start = chunksize * chunk;
10661066
if(start >= npixels) continue; // handle case when chunksize is < 4*nthreads and last thread has no work
10671067
size_t end = MIN(start + chunksize, npixels);
10681068
if(clipping)

0 commit comments

Comments
 (0)