diff options
| author | Carl Hetherington <cth@carlh.net> | 2022-12-04 23:32:09 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2022-12-04 23:32:11 +0100 |
| commit | 2c6d80c295dd3d10c1c9c08dd31758dd1abdf5da (patch) | |
| tree | 2f6b676c56d1693e339fc61f318a450bcb78495a /src/j2k_transcode.cc | |
| parent | b995947a86a583a44bbe667e9bbd031296bf7e88 (diff) | |
Support building either with our patched OpenJPEG, or 2.5.0.
Either has a way to specify the number of guard bits.
Diffstat (limited to 'src/j2k_transcode.cc')
| -rw-r--r-- | src/j2k_transcode.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/j2k_transcode.cc b/src/j2k_transcode.cc index 2cc903c7..596d92c1 100644 --- a/src/j2k_transcode.cc +++ b/src/j2k_transcode.cc @@ -281,11 +281,19 @@ dcp::compress_j2k (shared_ptr<const OpenJPEGImage> xyz, int bandwidth, int frame parameters.max_comp_size = parameters.max_cs_size / 1.25; parameters.tcp_numlayers = 1; parameters.tcp_mct = 1; +#ifdef LIBDCP_HAVE_NUMGBITS parameters.numgbits = fourk ? 2 : 1; +#endif /* Setup the encoder parameters using the current image and user parameters */ opj_setup_encoder (encoder, ¶meters, xyz->opj_image()); +#ifndef LIBDCP_HAVE_NUMGBITS + string numgbits = String::compose("GUARD_BITS=%1", fourk ? 2 : 1); + char const* extra_options[] = { numgbits.c_str(), nullptr }; + opj_encoder_set_extra_options(encoder, extra_options); +#endif + auto stream = opj_stream_default_create (OPJ_FALSE); if (!stream) { opj_destroy_codec (encoder); |
