2 Copyright (C) 2015 Carl Hetherington <cth@carlh.net>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #include "poznan_encoder.h"
21 #include "exceptions.h"
22 #include "poznan/config/parameters.h"
28 using boost::shared_ptr;
30 PoznanEncoder::PoznanEncoder ()
32 /* XXX: need cross-platform implementation of dlopen etc. */
34 void* config = dlopen ("libdcpomatic-config.so", RTLD_LAZY | RTLD_GLOBAL);
36 throw JPEG2000EncoderUnavailableException (name(), "could not find libdcpomatic-config.so");
39 void* misc = dlopen ("libdcpomatic-misc.so", RTLD_LAZY | RTLD_GLOBAL);
41 throw JPEG2000EncoderUnavailableException (name(), "could not find libdcpomatic-misc.so");
44 void (*init_device) (type_parameters *);
45 init_device = (void (*)(type_parameters *)) dlsym (config, "init_device");
47 throw JPEG2000EncoderUnavailableException (name(), "missing symbol");
50 type_parameters param;
52 /* One tile which covers entire image */
53 param.param_tile_w = -1;
54 param.param_tile_h = -1;
58 uint8_t param_tile_comp_dlvls;
59 uint8_t param_cblk_exp_w; ///Maximum codeblock size is 2^6 x 2^6 ( 64 x 64 ).
60 uint8_t param_cblk_exp_h; ///Maximum codeblock size is 2^6 x 2^6 ( 64 x 64 ).
61 uint8_t param_wavelet_type; ///Lossy encoding
62 uint8_t param_use_mct;//Multi-component transform
64 param.param_device = 0;
66 uint32_t param_target_size;//Target size of output file
67 float param_bp;//Bits per pixel per component
68 uint8_t param_use_part2_mct; // Multiple component transform as in 15444-2
69 uint8_t param_mct_compression_method; // 0 klt 2 wavelet
70 uint32_t param_mct_klt_iterations; // max number of iterations of Gram-Schmidt algorithm
71 float param_mct_klt_border_eigenvalue; // cut-off for dumping components
72 float param_mct_klt_err; // error sufficient for Gram-Schmit algorithm to end iteration
79 PoznanEncoder::name () const
81 return _("CUDA (GPU) encoder (Poznan Supercomputing and Networking Center)");
85 PoznanEncoder::set_bandwidth (int bandwidth)
91 PoznanEncoder::set_frame_rate (int frame_rate)
97 PoznanEncoder::set_resolution (Resolution resolution)
103 PoznanEncoder::set_threed (bool threed)
108 shared_ptr<EncodedData>
109 PoznanEncoder::do_encode (shared_ptr<const dcp::XYZImage> input, dcp::NoteHandler note_handler)
111 return shared_ptr<EncodedData> ();