From 758b23791b9778e51c42b21f66d7a233a69025ff Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 8 Oct 2025 10:04:06 +0200 Subject: fixup! wip: CUDA with nvjpeg2k --- src/lib/encode_cli.cc | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) (limited to 'src/lib/encode_cli.cc') diff --git a/src/lib/encode_cli.cc b/src/lib/encode_cli.cc index 91e399439..0187bae11 100644 --- a/src/lib/encode_cli.cc +++ b/src/lib/encode_cli.cc @@ -304,9 +304,12 @@ encode_cli(int argc, char* argv[], function out, function", "make DCP from the given film; default if no other command is specified"}); commands.push_back({"list-servers", "", variant::insert_dcpomatic("display a list of encoding servers that {} can use (until Ctrl-C)")}); commands.push_back({"dump", "", "show a summary of the film's settings"}); -#ifdef DCPOMATIC_GROK +#if defined(DCPOMATIC_GROK) || defined(DCPOMATIC_HAVE_NVJPEG2K) commands.push_back({"config-params", "", "list the parameters that can be set with `config`"}); commands.push_back({"config", " ", "set a DCP-o-matic configuration value"}); +#endif + +#if defined(DCPOMATIC_GROK) commands.push_back({"list-gpus", "", "list available GPUs"}); #endif @@ -420,7 +423,40 @@ encode_cli(int argc, char* argv[], function out, function config_params; -#ifdef DCPOMATIC_GROK +#if defined(DCPOMATIC_GROK) && defined(DCPOMATIC_HAVE_NVJPEG2K) + + config_params.push_back( + {"gpu-type", "\"grok\" to enable the Grok encoder, \"nvjpeg2k\" to enable the NVIDIA encoder, \"none\" to use the CPU only", + [](Config* config, string value) -> optional { + if (value == "grok") { + config->set_gpu_type(Config::GPUType::GROK); + } else if (value == "nvjpeg2k") { + config->set_gpu_type(Config::GPUType::NVJPEG2K); + } else if (value == "none") { + config->set_gpu_type(Config::GPUType::NONE); + } else { + return fmt::format("Invalid value {} for gpu-type (use \"grok\" to enable the Grok encoder, \"nvjpeg2k\" to enable the NVIDIA encoder, \"none\" to use the CPU only)", value); + } + return {}; + }}); + +#elif defined(DCPOMATIC_HAVE_NVJPEG2K) + + config_params.push_back( + {"gpu-type", "\"nvjpeg2k\" to enable the NVIDIA encoder, \"none\" to use the CPU only", + [](Config* config, string value) -> optional { + if (value == "nvjpeg2k") { + config->set_gpu_type(Config::GPUType::NVJPEG2K); + } else if (value == "none") { + config->set_gpu_type(Config::GPUType::NONE); + } else { + return fmt::format("Invalid value {} for gpu-type (use \"nvjpeg2k\" to enable the NVIDIA encoder, \"none\" to use the CPU only)", value); + } + return {}; + }}); + +#elif defined(DCPOMATIC_GROK) + config_params.push_back( {"gpu-type", "\"grok\" to enable the Grok encoder, \"none\" to disable it", [](Config* config, string value) -> optional { -- cgit v1.2.3