summaryrefslogtreecommitdiff
path: root/applications/codec
diff options
context:
space:
mode:
authorAntonin Descampe <antonin@gmail.com>2011-09-09 14:52:42 +0000
committerAntonin Descampe <antonin@gmail.com>2011-09-09 14:52:42 +0000
commit3d06f0307277d4372d83f06e96663f8d6a829ebc (patch)
treeb4206c90b4fe6f1fe2372ea0a0cf8513b669e2b2 /applications/codec
parent5213675ba8d06c586aa5f65418ff850e238610d8 (diff)
BRANCH-1.5:added a new indexer functionality to the library. With the new -jpip option at encoding, the user can now generate a JP2 file including an XML box with the index used when browsing the image with JPIP
Diffstat (limited to 'applications/codec')
-rw-r--r--applications/codec/image_to_j2k.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/applications/codec/image_to_j2k.c b/applications/codec/image_to_j2k.c
index fa04a6fb..4ab7445b 100644
--- a/applications/codec/image_to_j2k.c
+++ b/applications/codec/image_to_j2k.c
@@ -209,6 +209,9 @@ void encode_help_display(void) {
fprintf(stdout," -F rawWidth,rawHeight,rawComp,rawBitDepth,s/u (Signed/Unsigned)\n");
fprintf(stdout," Example: -i lena.raw -o lena.j2k -F 512,512,3,8,u\n");
fprintf(stdout,"\n");
+ fprintf(stdout,"-jpip : write jpip codestream index box in JP2 output file\n");
+ fprintf(stdout," NOTICE: currently supports only RPCL order\n");
+ fprintf(stdout,"\n");
/* UniPG>> */
#ifdef USE_JPWL
fprintf(stdout,"-W : adoption of JPWL (Part 11) capabilities (-W params)\n");
@@ -584,6 +587,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
{"OutFor",REQ_ARG, NULL ,'O'},
{"POC",REQ_ARG, NULL ,'P'},
{"ROI",REQ_ARG, NULL ,'R'},
+ {"jpip",NO_ARG, NULL, 'J'}
};
/* parse the command line */
@@ -1369,9 +1373,16 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
break;
#endif /* USE_JPWL */
/* <<UniPG */
-
+/* ------------------------------------------------------ */
+
+ case 'J': /* jpip on */
+ {
+ parameters->jpip_on = OPJ_TRUE;
+ }
+ break;
/* ------------------------------------------------------ */
+
default:
fprintf(stderr, "ERROR -> Command line not valid\n");
return 1;
@@ -1686,7 +1697,7 @@ int main(int argc, char **argv) {
/* encode the image */
if (*indexfilename) // If need to extract codestream information
- bSuccess = opj_encode_with_info(cinfo, cio, image, &cstr_info);
+ bSuccess = opj_encode_with_info(cinfo, cio, image, &cstr_info);
else
bSuccess = opj_encode(cinfo, cio, image, NULL);
if (!bSuccess) {
@@ -1725,9 +1736,10 @@ int main(int argc, char **argv) {
int codestream_length;
opj_cio_t *cio = NULL;
FILE *f = NULL;
+ opj_cinfo_t *cinfo = NULL;
- /* get a JP2 compressor handle */
- opj_cinfo_t* cinfo = opj_create_compress(CODEC_JP2);
+ /* get a JP2 compressor handle */
+ cinfo = opj_create_compress(CODEC_JP2);
/* catch events using our callbacks and give a local context */
opj_set_event_mgr((opj_common_ptr)cinfo, &event_mgr, stderr);
@@ -1740,8 +1752,8 @@ int main(int argc, char **argv) {
cio = opj_cio_open((opj_common_ptr)cinfo, NULL, 0);
/* encode the image */
- if (*indexfilename) // If need to extract codestream information
- bSuccess = opj_encode_with_info(cinfo, cio, image, &cstr_info);
+ if (*indexfilename || parameters.jpip_on) // If need to extract codestream information
+ bSuccess = opj_encode_with_info(cinfo, cio, image, &cstr_info);
else
bSuccess = opj_encode(cinfo, cio, image, NULL);
if (!bSuccess) {