4 #include "dcpomatic_log.h"
5 #include "j2k_encoder_cpu_backend.h"
6 #include "player_video.h"
14 using boost::optional;
15 using boost::shared_ptr;
20 J2KEncoderCPUBackend::encode (vector<shared_ptr<DCPVideo> > all_video)
22 DCPOMATIC_ASSERT (all_video.size() == 1);
23 shared_ptr<DCPVideo> video = all_video.front();
26 LOG_TIMING ("start-local-encode thread=%1 frame=%2", thread_id(), video->index());
27 string const comment = Config::instance()->dcp_j2k_comment();
29 Data enc = dcp::compress_j2k (
30 DCPVideo::convert_to_xyz (video->frame(), boost::bind(&Log::dcp_log, dcpomatic_log.get(), _1, _2)),
31 video->j2k_bandwidth(),
32 video->frames_per_second(),
33 video->frame()->eyes() == EYES_LEFT || video->frame()->eyes() == EYES_RIGHT,
34 video->resolution() == RESOLUTION_4K,
35 comment.empty() ? "libdcp" : comment
38 switch (video->frame()->eyes()) {
40 LOG_DEBUG_ENCODE (N_("Finished locally-encoded frame %1 for mono"), video->index());
43 LOG_DEBUG_ENCODE (N_("Finished locally-encoded frame %1 for L"), video->index());
46 LOG_DEBUG_ENCODE (N_("Finished locally-encoded frame %1 for R"), video->index());
52 LOG_TIMING ("finish-local-encode thread=%1 frame=%2", thread_id(), video->index());
56 } catch (std::exception& e) {
57 /* This is very bad, so don't cope with it, just pass it on */
58 LOG_ERROR (N_("Local encode failed (%1)"), e.what());