Skip to content

Commit

Permalink
j2k_decompress_reconfigure will check for platform type
Browse files Browse the repository at this point in the history
j2k_decompress_reconfigure now checks state_decompress_j2k class member platform to see if it is set to j2k_decompress_platform::CPU or j2k_decompress_platform::CUDA prior to calling cmpto_j2k_dec_ctx_cfg_add_cuda_device / cmpto_j2k_dec_ctx_cfg_add_cpu
  • Loading branch information
ATrivialAtomic committed Sep 10, 2024
1 parent d3f1ae4 commit 28b98a9
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions src/video_decompress/cmpto_j2k.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -588,11 +588,27 @@ static int j2k_decompress_reconfigure(void *state, struct video_desc desc,

struct cmpto_j2k_dec_ctx_cfg *ctx_cfg = nullptr;
CHECK_OK(cmpto_j2k_dec_ctx_cfg_create(&ctx_cfg), "Error creating dec cfg", return false);
for (unsigned int i = 0; i < cuda_devices_count; ++i) {
CHECK_OK(cmpto_j2k_dec_ctx_cfg_add_cuda_device(
ctx_cfg, cuda_devices[i], s->cuda_mem_limit,
s->cuda_tile_limit),
"Error setting CUDA device", return false);
if (j2k_decompress_platform::CUDA == s->platform) {
for (unsigned int i = 0; i < cuda_devices_count; ++i) {
CHECK_OK(cmpto_j2k_dec_ctx_cfg_add_cuda_device(
ctx_cfg, cuda_devices[i], s->cuda_mem_limit,
s->cuda_tile_limit),
"Error setting CUDA device", return false);
}
}

if (j2k_decompress_platform::CPU == s->platform) {
CHECK_OK(cmpto_j2k_dec_ctx_cfg_add_cpu(
ctx_cfg,
s->cpu_thread_count,
s->cpu_mem_limit,
s->cpu_img_limit),
"Error configuring the CPU",
return false);

MSG(INFO, "Using %s threads on the CPU. Image Limit set to %i.\n",
(s->cpu_thread_count == 0 ? "all available" : std::to_string(s->cpu_thread_count).c_str()),
s->cpu_img_limit);
}


Expand Down

0 comments on commit 28b98a9

Please sign in to comment.