summaryrefslogtreecommitdiffstats
path: root/third_party/jpeg-xl/lib/threads
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/jpeg-xl/lib/threads')
-rw-r--r--third_party/jpeg-xl/lib/threads/thread_parallel_runner.cc10
-rw-r--r--third_party/jpeg-xl/lib/threads/thread_parallel_runner_internal.cc7
-rw-r--r--third_party/jpeg-xl/lib/threads/thread_parallel_runner_internal.h4
3 files changed, 12 insertions, 9 deletions
diff --git a/third_party/jpeg-xl/lib/threads/thread_parallel_runner.cc b/third_party/jpeg-xl/lib/threads/thread_parallel_runner.cc
index d12947ce55..558c9dbe42 100644
--- a/third_party/jpeg-xl/lib/threads/thread_parallel_runner.cc
+++ b/third_party/jpeg-xl/lib/threads/thread_parallel_runner.cc
@@ -41,11 +41,13 @@ bool ThreadMemoryManagerInit(JxlMemoryManager* self,
} else {
memset(self, 0, sizeof(*self));
}
- if (!self->alloc != !self->free) {
+ bool is_default_alloc = (self->alloc == nullptr);
+ bool is_default_free = (self->free == nullptr);
+ if (is_default_alloc != is_default_free) {
return false;
}
- if (!self->alloc) self->alloc = ThreadMemoryManagerDefaultAlloc;
- if (!self->free) self->free = ThreadMemoryManagerDefaultFree;
+ if (is_default_alloc) self->alloc = ThreadMemoryManagerDefaultAlloc;
+ if (is_default_free) self->free = ThreadMemoryManagerDefaultFree;
return true;
}
@@ -57,7 +59,7 @@ void* ThreadMemoryManagerAlloc(const JxlMemoryManager* memory_manager,
void ThreadMemoryManagerFree(const JxlMemoryManager* memory_manager,
void* address) {
- return memory_manager->free(memory_manager->opaque, address);
+ memory_manager->free(memory_manager->opaque, address);
}
} // namespace
diff --git a/third_party/jpeg-xl/lib/threads/thread_parallel_runner_internal.cc b/third_party/jpeg-xl/lib/threads/thread_parallel_runner_internal.cc
index 5f73d94897..7ffcb34428 100644
--- a/third_party/jpeg-xl/lib/threads/thread_parallel_runner_internal.cc
+++ b/third_party/jpeg-xl/lib/threads/thread_parallel_runner_internal.cc
@@ -6,6 +6,7 @@
#include "lib/threads/thread_parallel_runner_internal.h"
#include <jxl/parallel_runner.h>
+#include <jxl/types.h>
#include <algorithm>
#include <atomic>
@@ -120,9 +121,9 @@ void ThreadParallelRunner::RunRange(ThreadParallelRunner* self,
// because it avoids user-specified parameters.
for (;;) {
-#if 0
- // dynamic
- const uint32_t my_size = std::max(num_tasks / (num_worker_threads * 4), 1);
+#if JXL_FALSE
+ // dynamic
+ const uint32_t my_size = std::max(num_tasks / (num_worker_threads * 4), 1);
#else
// guided
const uint32_t num_reserved =
diff --git a/third_party/jpeg-xl/lib/threads/thread_parallel_runner_internal.h b/third_party/jpeg-xl/lib/threads/thread_parallel_runner_internal.h
index 199a5f2a8b..5b28384bf0 100644
--- a/third_party/jpeg-xl/lib/threads/thread_parallel_runner_internal.h
+++ b/third_party/jpeg-xl/lib/threads/thread_parallel_runner_internal.h
@@ -132,8 +132,8 @@ class ThreadParallelRunner {
// Attempts to reserve and perform some work from the global range of tasks,
// which is encoded within "command". Returns after all tasks are reserved.
- static void RunRange(ThreadParallelRunner* self, const WorkerCommand command,
- const int thread);
+ static void RunRange(ThreadParallelRunner* self, WorkerCommand command,
+ int thread);
static void ThreadFunc(ThreadParallelRunner* self, int thread);