Skip to content

Commit 68776e4

Browse files
committed
Reduce number of sections GC-ed at strip phase for jxl_dec (#3990)
(cherry picked from commit fcab7df75647bb96da3469e3b20e8ce47b622203)
1 parent b238a67 commit 68776e4

File tree

4 files changed

+23
-1
lines changed

4 files changed

+23
-1
lines changed

lib/base/data_parallel.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424

2525
namespace jxl {
2626

27+
struct ThreadPoolNoInit {};
28+
2729
class ThreadPool {
2830
public:
2931
ThreadPool(JxlParallelRunner runner, void* runner_opaque)
@@ -77,7 +79,7 @@ class ThreadPool {
7779
}
7880

7981
// Use this as init_func when no initialization is needed.
80-
static Status NoInit(size_t num_threads) { return true; }
82+
static constexpr ThreadPoolNoInit NoInit{};
8183

8284
private:
8385
// class holding the state of a Run() call to pass to the runner_ as an
@@ -137,6 +139,14 @@ Status RunOnPool(ThreadPool* pool, const uint32_t begin, const uint32_t end,
137139
}
138140
}
139141

142+
template <class DataFunc>
143+
Status RunOnPool(ThreadPool* pool, const uint32_t begin, const uint32_t end,
144+
const ThreadPoolNoInit& no_init_func,
145+
const DataFunc& data_func, const char* caller) {
146+
const auto init_func = [](size_t num_threads) -> Status { return true; };
147+
return RunOnPool(pool, begin, end, init_func, data_func, caller);
148+
}
149+
140150
} // namespace jxl
141151
#if JXL_COMPILER_MSVC
142152
#pragma warning(default : 4180)

lib/jxl_lists.bzl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ libjxl_dec_sources = [
152152
"jxl/dct_util.h",
153153
"jxl/dec_ans.cc",
154154
"jxl/dec_ans.h",
155+
"jxl/dec_bit_reader.cc",
155156
"jxl/dec_bit_reader.h",
156157
"jxl/dec_cache.cc",
157158
"jxl/dec_cache.h",
@@ -227,6 +228,8 @@ libjxl_dec_sources = [
227228
"jxl/modular/transform/rct.h",
228229
"jxl/modular/transform/squeeze.cc",
229230
"jxl/modular/transform/squeeze.h",
231+
"jxl/modular/transform/squeeze_params.cc",
232+
"jxl/modular/transform/squeeze_params.h",
230233
"jxl/modular/transform/transform.cc",
231234
"jxl/modular/transform/transform.h",
232235
"jxl/noise.h",
@@ -246,6 +249,7 @@ libjxl_dec_sources = [
246249
"jxl/render_pipeline/low_memory_render_pipeline.h",
247250
"jxl/render_pipeline/render_pipeline.cc",
248251
"jxl/render_pipeline/render_pipeline.h",
252+
"jxl/render_pipeline/render_pipeline_stage.cc",
249253
"jxl/render_pipeline/render_pipeline_stage.h",
250254
"jxl/render_pipeline/simple_render_pipeline.cc",
251255
"jxl/render_pipeline/simple_render_pipeline.h",

lib/jxl_lists.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ set(JPEGXL_INTERNAL_DEC_SOURCES
152152
jxl/dct_util.h
153153
jxl/dec_ans.cc
154154
jxl/dec_ans.h
155+
jxl/dec_bit_reader.cc
155156
jxl/dec_bit_reader.h
156157
jxl/dec_cache.cc
157158
jxl/dec_cache.h
@@ -227,6 +228,8 @@ set(JPEGXL_INTERNAL_DEC_SOURCES
227228
jxl/modular/transform/rct.h
228229
jxl/modular/transform/squeeze.cc
229230
jxl/modular/transform/squeeze.h
231+
jxl/modular/transform/squeeze_params.cc
232+
jxl/modular/transform/squeeze_params.h
230233
jxl/modular/transform/transform.cc
231234
jxl/modular/transform/transform.h
232235
jxl/noise.h
@@ -246,6 +249,7 @@ set(JPEGXL_INTERNAL_DEC_SOURCES
246249
jxl/render_pipeline/low_memory_render_pipeline.h
247250
jxl/render_pipeline/render_pipeline.cc
248251
jxl/render_pipeline/render_pipeline.h
252+
jxl/render_pipeline/render_pipeline_stage.cc
249253
jxl/render_pipeline/render_pipeline_stage.h
250254
jxl/render_pipeline/simple_render_pipeline.cc
251255
jxl/render_pipeline/simple_render_pipeline.h

lib/lib.gni

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ libjxl_dec_sources = [
155155
"jxl/dct_util.h",
156156
"jxl/dec_ans.cc",
157157
"jxl/dec_ans.h",
158+
"jxl/dec_bit_reader.cc",
158159
"jxl/dec_bit_reader.h",
159160
"jxl/dec_cache.cc",
160161
"jxl/dec_cache.h",
@@ -230,6 +231,8 @@ libjxl_dec_sources = [
230231
"jxl/modular/transform/rct.h",
231232
"jxl/modular/transform/squeeze.cc",
232233
"jxl/modular/transform/squeeze.h",
234+
"jxl/modular/transform/squeeze_params.cc",
235+
"jxl/modular/transform/squeeze_params.h",
233236
"jxl/modular/transform/transform.cc",
234237
"jxl/modular/transform/transform.h",
235238
"jxl/noise.h",
@@ -249,6 +252,7 @@ libjxl_dec_sources = [
249252
"jxl/render_pipeline/low_memory_render_pipeline.h",
250253
"jxl/render_pipeline/render_pipeline.cc",
251254
"jxl/render_pipeline/render_pipeline.h",
255+
"jxl/render_pipeline/render_pipeline_stage.cc",
252256
"jxl/render_pipeline/render_pipeline_stage.h",
253257
"jxl/render_pipeline/simple_render_pipeline.cc",
254258
"jxl/render_pipeline/simple_render_pipeline.h",

0 commit comments

Comments
 (0)