3 #include "dcpomatic_log.h"
5 #include "grok/context.h"
6 #include "grok_j2k_encoder_thread.h"
7 #include "j2k_encoder.h"
8 #include "scope_guard.h"
14 using std::make_shared;
15 using std::shared_ptr;
18 GrokJ2KEncoderThread::GrokJ2KEncoderThread(J2KEncoder& encoder, grk_plugin::GrokContext* context)
19 : J2KEncoderThread(encoder)
27 GrokJ2KEncoderThread::run()
32 LOG_TIMING("encoder-sleep thread=%1", thread_id());
33 auto frame = _encoder.pop();
35 ScopeGuard frame_guard([this, &frame]() {
36 _encoder.retry(frame);
39 LOG_TIMING("encoder-pop thread=%1 frame=%2 eyes=%3", thread_id(), frame.index(), static_cast<int>(frame.eyes()));
41 if (_context->launch(frame, Config::instance()->selected_gpu()) && _context->scheduleCompress(frame)) {
45 } catch (boost::thread_interrupted& e) {