summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2020-05-20 20:29:31 +0200
committerGitHub <noreply@github.com>2020-05-20 20:29:31 +0200
commit1d358f25c8eabbc7c274bcc148f4f5d594ec13fe (patch)
tree42a5e5ce02d28ee7517ce9a2f3a2dc317eb3e01d /src/bin
parent64689d05dfaaf52105581d93fb1eb173b20829a4 (diff)
parent4edb8c83374f52cd6a8f2c7c875e8ffacccb5fa5 (diff)
Merge pull request #1246 from rouault/write_plt
Add support for generation of PLT markers in encoder
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/jp2/opj_compress.c30
1 files changed, 27 insertions, 3 deletions
diff --git a/src/bin/jp2/opj_compress.c b/src/bin/jp2/opj_compress.c
index cd3953e9..cbc30fba 100644
--- a/src/bin/jp2/opj_compress.c
+++ b/src/bin/jp2/opj_compress.c
@@ -229,6 +229,8 @@ static void encode_help_display(void)
fprintf(stdout, " Write SOP marker before each packet.\n");
fprintf(stdout, "-EPH\n");
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, "-M <key value>\n");
fprintf(stdout, " Mode switch.\n");
fprintf(stdout, " [1=BYPASS(LAZY) 2=RESET 4=RESTART(TERMALL)\n");
@@ -576,7 +578,8 @@ static int parse_cmdline_encoder(int argc, char **argv,
opj_cparameters_t *parameters,
img_fol_t *img_fol, raw_cparameters_t *raw_cp, char *indexfilename,
size_t indexfilename_size,
- int* pOutFramerate)
+ int* pOutFramerate,
+ OPJ_BOOL* pOutPLT)
{
OPJ_UINT32 i, j;
int totlen, c;
@@ -592,7 +595,8 @@ static int parse_cmdline_encoder(int argc, char **argv,
{"ROI", REQ_ARG, NULL, 'R'},
{"jpip", NO_ARG, NULL, 'J'},
{"mct", REQ_ARG, NULL, 'Y'},
- {"IMF", REQ_ARG, NULL, 'Z'}
+ {"IMF", REQ_ARG, NULL, 'Z'},
+ {"PLT", NO_ARG, NULL, 'A'}
};
/* parse the command line */
@@ -1670,6 +1674,13 @@ static int parse_cmdline_encoder(int argc, char **argv,
break;
/* ------------------------------------------------------ */
+ case 'A': { /* PLT markers */
+ *pOutPLT = OPJ_TRUE;
+ }
+ break;
+
+ /* ------------------------------------------------------ */
+
default:
fprintf(stderr, "[WARNING] An invalid option has been ignored\n");
@@ -1848,6 +1859,8 @@ int main(int argc, char **argv)
int framerate = 0;
OPJ_FLOAT64 t = opj_clock();
+ OPJ_BOOL PLT = OPJ_FALSE;
+
/* set encoding parameters to default values */
opj_set_default_encoder_parameters(&parameters);
@@ -1867,7 +1880,7 @@ 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) == 1) {
+ indexfilename, sizeof(indexfilename), &framerate, &PLT) == 1) {
ret = 1;
goto fin;
}
@@ -2117,6 +2130,17 @@ int main(int argc, char **argv)
goto fin;
}
+ if (PLT) {
+ const char* const options[] = { "PLT=YES", NULL };
+ 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);
+ opj_image_destroy(image);
+ ret = 1;
+ goto fin;
+ }
+ }
+
/* open a byte stream for writing and allocate memory for all tiles */
l_stream = opj_stream_create_default_file_stream(parameters.outfile, OPJ_FALSE);
if (! l_stream) {