summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/cuda_j2k_encoder_thread.cc15
-rw-r--r--src/lib/dcp_film_encoder.cc16
-rw-r--r--src/lib/encode_cli.cc40
-rw-r--r--src/lib/job.cc1
-rw-r--r--src/lib/transcode_job.cc1
5 files changed, 65 insertions, 8 deletions
diff --git a/src/lib/cuda_j2k_encoder_thread.cc b/src/lib/cuda_j2k_encoder_thread.cc
index 466b78fc1..46b34c077 100644
--- a/src/lib/cuda_j2k_encoder_thread.cc
+++ b/src/lib/cuda_j2k_encoder_thread.cc
@@ -46,9 +46,13 @@ CUDAJ2KEncoderThread::CUDAJ2KEncoderThread(J2KEncoder& encoder)
shared_ptr<dcp::ArrayData>
CUDAJ2KEncoderThread::encode(DCPVideo const& frame)
{
+ std::cout << "CUDA: encode " << frame.index() << "\n";
+
auto xyz = convert_to_xyz(frame.frame());
auto const size = xyz->size();
+ std::cout << "freeowwwwm\n";
+
/* {x,y,z}lp is 4-byte int representation */
int* xlp = xyz->data(0);
int* ylp = xyz->data(1);
@@ -69,14 +73,20 @@ CUDAJ2KEncoderThread::encode(DCPVideo const& frame)
int16_t* zp = _xyz_z.data();
pixel_data_h[2] = reinterpret_cast<uint8_t*>(zp);
+ std::cout << "felcher\n";
+
for (int j = 0; j < size.width * size.height; ++j) {
*xp++ = static_cast<int16_t>(*xlp++);
*yp++ = static_cast<int16_t>(*ylp++);
*zp++ = static_cast<int16_t>(*zlp++);
}
+ std::cout << "big bag o bollox";
+
allocate_pixel_data_d(size);
+ std::cout << "copying to device.\n";
+
/* Copy to device */
size_t pitch_in_bytes_h[3];
for (int i = 0; i < 3; ++i) {
@@ -96,6 +106,8 @@ CUDAJ2KEncoderThread::encode(DCPVideo const& frame)
}
}
+ std::cout << "copied to device.\n";
+
nvjpeg2kImage_t device_image;
device_image.num_components = 3;
device_image.pixel_data = reinterpret_cast<void**>(_pixel_data_d);
@@ -143,6 +155,8 @@ CUDAJ2KEncoderThread::encode(DCPVideo const& frame)
throw CUDAError("nvjpeg2kEncodeParamsSetQuality", status);
}
+ std::cout << "calling nvjpeg2kEncode\n";
+
status = nvjpeg2kEncode(_encoder_handle, _encode_state, _encode_params, &device_image, _stream);
if (status != NVJPEG2K_STATUS_SUCCESS) {
throw CUDAError("nvjpeg2kEncode", status);
@@ -179,6 +193,7 @@ CUDAJ2KEncoderThread::allocate_pixel_data_d(dcp::Size size)
);
if (status != cudaSuccess) {
+ std::cout << "bad news brown: " << status << "\n";
throw CUDAError("cudaMallocPitch", status);
}
}
diff --git a/src/lib/dcp_film_encoder.cc b/src/lib/dcp_film_encoder.cc
index 631010071..d3f7006b4 100644
--- a/src/lib/dcp_film_encoder.cc
+++ b/src/lib/dcp_film_encoder.cc
@@ -123,13 +123,17 @@ DCPFilmEncoder::go()
_writer.write(_player.get_subtitle_fonts());
}
- int passes = 0;
- while (!_player.pass()) {
- if ((++passes % 8) == 0) {
- auto job = _job.lock();
- DCPOMATIC_ASSERT(job);
- job->set_progress(_player.progress());
+ try {
+ int passes = 0;
+ while (!_player.pass()) {
+ if ((++passes % 8) == 0) {
+ auto job = _job.lock();
+ DCPOMATIC_ASSERT(job);
+ job->set_progress(_player.progress());
+ }
}
+ } catch (...) {
+ std::cout << "BOLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLOX\n";
}
for (auto i: get_referenced_reel_assets(_film, _film->playlist())) {
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<void (string)> out, function<void ()
commands.push_back({"make-dcp", "<FILM>", "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", "<FILM>", "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", "<PARAMETER> <VALUE>", "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<void (string)> out, function<void ()
vector<ConfigParam> 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<string> {
+ 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<string> {
+ 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<string> {
diff --git a/src/lib/job.cc b/src/lib/job.cc
index 815d81b5c..16f19f344 100644
--- a/src/lib/job.cc
+++ b/src/lib/job.cc
@@ -276,6 +276,7 @@ Job::run_wrapper()
set_state(FINISHED_ERROR);
} catch (std::exception& e) {
+ std::cout << "FUCK MY HAT " << e.what() << "\n";
set_error(
e.what(),
diff --git a/src/lib/transcode_job.cc b/src/lib/transcode_job.cc
index 50ae4e6b7..5492c7c30 100644
--- a/src/lib/transcode_job.cc
+++ b/src/lib/transcode_job.cc
@@ -143,6 +143,7 @@ TranscodeJob::run ()
_encoder.reset ();
} catch (...) {
+ std::cout << "some tx shit threw\n";
_encoder.reset ();
throw;
}