blob: 1cc8768962b3ab7ff48a8440e29f1fc6d00e1b3b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
--- a/src/j2k_transcode.cc 2022-05-17 10:07:44.525679224 +0200
+++ b/src/j2k_transcode.cc 2022-05-17 10:04:18.846330309 +0200
@@ -46,7 +46,7 @@
#include <openjpeg.h>
#include <cmath>
#include <iostream>
-
+#include <string>
using std::min;
using std::pow;
@@ -315,10 +315,13 @@
parameters.max_comp_size = parameters.max_cs_size / 1.25;
parameters.tcp_numlayers = 1;
parameters.tcp_mct = 1;
- parameters.numgbits = fourk ? 2 : 1;
+ string numgbits = "GUARD_BITS=";
+ numgbits.append(std::to_string(fourk ? 2 : 1));
+ const char* extraopt[] { numgbits.data(), nullptr };
/* Setup the encoder parameters using the current image and user parameters */
opj_setup_encoder (encoder, ¶meters, xyz->opj_image());
+ opj_encoder_set_extra_options(encoder, extraopt);
auto stream = opj_stream_default_create (OPJ_FALSE);
if (!stream) {
|