summaryrefslogtreecommitdiff
path: root/src/bin/jp2/opj_compress.c
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2021-06-07 15:16:53 +0200
committerEven Rouault <even.rouault@spatialys.com>2021-06-07 15:49:08 +0200
commita36ae0386066c9ddd089788930be5a42a176446e (patch)
tree8effed4d892faee90d8ea96c6c15030ed6953614 /src/bin/jp2/opj_compress.c
parent2624908517ac0489ff1b5471f423dfe84d79da08 (diff)
Add support for enabling generation of TLM markers in encoder
Support was already there, but restricted to Cinema and IMF profiles, and 255 tiles * Add -TLM switch added to opj_compress * Make opj_encoder_set_extra_options() function accept a TLM=YES option.
Diffstat (limited to 'src/bin/jp2/opj_compress.c')
-rw-r--r--src/bin/jp2/opj_compress.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/src/bin/jp2/opj_compress.c b/src/bin/jp2/opj_compress.c
index 76ba8ec4..e488abcd 100644
--- a/src/bin/jp2/opj_compress.c
+++ b/src/bin/jp2/opj_compress.c
@@ -231,6 +231,8 @@ static void encode_help_display(void)
fprintf(stdout, " Write EPH marker after each header packet.\n");
fprintf(stdout, "-PLT\n");
fprintf(stdout, " Write PLT marker in tile-part header.\n");
+ fprintf(stdout, "-TLM\n");
+ fprintf(stdout, " Write TLM marker in main header.\n");
fprintf(stdout, "-M <key value>\n");
fprintf(stdout, " Mode switch.\n");
fprintf(stdout, " [1=BYPASS(LAZY) 2=RESET 4=RESTART(TERMALL)\n");
@@ -597,6 +599,7 @@ static int parse_cmdline_encoder(int argc, char **argv,
size_t indexfilename_size,
int* pOutFramerate,
OPJ_BOOL* pOutPLT,
+ OPJ_BOOL* pOutTLM,
int* pOutNumThreads)
{
OPJ_UINT32 i, j;
@@ -615,7 +618,8 @@ static int parse_cmdline_encoder(int argc, char **argv,
{"mct", REQ_ARG, NULL, 'Y'},
{"IMF", REQ_ARG, NULL, 'Z'},
{"PLT", NO_ARG, NULL, 'A'},
- {"threads", REQ_ARG, NULL, 'B'}
+ {"threads", REQ_ARG, NULL, 'B'},
+ {"TLM", NO_ARG, NULL, 'D'},
};
/* parse the command line */
@@ -1712,6 +1716,12 @@ static int parse_cmdline_encoder(int argc, char **argv,
}
}
break;
+ /* ------------------------------------------------------ */
+
+ case 'D': { /* TLM markers */
+ *pOutTLM = OPJ_TRUE;
+ }
+ break;
/* ------------------------------------------------------ */
@@ -1895,6 +1905,7 @@ int main(int argc, char **argv)
OPJ_FLOAT64 t = opj_clock();
OPJ_BOOL PLT = OPJ_FALSE;
+ OPJ_BOOL TLM = OPJ_FALSE;
int num_threads = 0;
/* set encoding parameters to default values */
@@ -1916,7 +1927,8 @@ int main(int argc, char **argv)
parameters.tcp_mct = (char)
255; /* This will be set later according to the input image or the provided option */
if (parse_cmdline_encoder(argc, argv, &parameters, &img_fol, &raw_cp,
- indexfilename, sizeof(indexfilename), &framerate, &PLT, &num_threads) == 1) {
+ indexfilename, sizeof(indexfilename), &framerate, &PLT, &TLM,
+ &num_threads) == 1) {
ret = 1;
goto fin;
}
@@ -2160,8 +2172,16 @@ int main(int argc, char **argv)
goto fin;
}
- if (PLT) {
- const char* const options[] = { "PLT=YES", NULL };
+ if (PLT || TLM) {
+ const char* options[3] = { NULL, NULL, NULL };
+ int iOpt = 0;
+ if (PLT) {
+ options[iOpt++] = "PLT=YES";
+ }
+ if (TLM) {
+ options[iOpt++] = "TLM=YES";
+ }
+ (void)iOpt;
if (!opj_encoder_set_extra_options(l_codec, options)) {
fprintf(stderr, "failed to encode image: opj_encoder_set_extra_options\n");
opj_destroy_codec(l_codec);