summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancois-Olivier Devaux <fodevaux@users.noreply.github.com>2007-02-19 09:59:29 +0000
committerFrancois-Olivier Devaux <fodevaux@users.noreply.github.com>2007-02-19 09:59:29 +0000
commiteac141b69aea8840ccd8dfa5285f1cab5b59d5eb (patch)
tree291504a63413f5ac52bd9fd1485947d58a6bc525
parentd084ff59f2da8bfa430d113105df1037fb1c605f (diff)
Added OPJ_LIMIT_DECODING enabling us to limit the decoding to main header
-rw-r--r--ChangeLog3
-rw-r--r--libopenjpeg/j2k.c8
-rw-r--r--libopenjpeg/j2k.h2
-rw-r--r--libopenjpeg/openjpeg.c1
-rw-r--r--libopenjpeg/openjpeg.h16
5 files changed, 30 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 42e940f0..57b582ab 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,9 @@ What's New for OpenJPEG
! : changed
+ : added
+February 19, 2007
++ [FOD] Added OPJ_LIMIT_DECODING enabling us to limit the decoding to main header (modified openjpeg.c, openjpeg.h, j2k.c and j2k.h)
+
February 13, 2007
! [FOD] David Fries suggestions. In image_to_j2k and j2k_to_image, strncpy() functions: instead of specifying the path size macro, let the compiler read the length out of the array entry.
! [FOD] David Fries suggestions. Makefile modified. -fPIC flag used for 64-bit compilation. Move operation (rather than copy) for the dist library creation, and -p flag added.
diff --git a/libopenjpeg/j2k.c b/libopenjpeg/j2k.c
index 6e232f27..db291ff2 100644
--- a/libopenjpeg/j2k.c
+++ b/libopenjpeg/j2k.c
@@ -1522,6 +1522,7 @@ void j2k_setup_decoder(opj_j2k_t *j2k, opj_dparameters_t *parameters) {
opj_cp_t *cp = (opj_cp_t*)opj_malloc(sizeof(opj_cp_t));
cp->reduce = parameters->cp_reduce;
cp->layer = parameters->cp_layer;
+ cp->limit_decoding = parameters->cp_limit_decoding;
/* UniPG>> */
#ifdef USE_JPWL
cp->correct = parameters->jpwl_correct;
@@ -1594,11 +1595,18 @@ opj_image_t* j2k_decode(opj_j2k_t *j2k, opj_cio_t *cio) {
return 0;
}
e = j2k_dec_mstab_lookup(id);
+ // Check if the marker is known
if (!(j2k->state & e->states)) {
opj_image_destroy(image);
opj_event_msg(cinfo, EVT_ERROR, "%.8x: unexpected marker %x\n", cio_tell(cio) - 2, id);
return 0;
}
+ // Check if the decoding is limited to the main header
+ if (e->id == J2K_MS_SOT && j2k->cp->limit_decoding == LIMIT_TO_MAIN_HEADER) {
+ opj_event_msg(cinfo, EVT_INFO, "Main Header decoded.\n");
+ return image;
+ }
+
if (e->handler) {
(*e->handler)(j2k);
}
diff --git a/libopenjpeg/j2k.h b/libopenjpeg/j2k.h
index 00ccacfc..9738bf85 100644
--- a/libopenjpeg/j2k.h
+++ b/libopenjpeg/j2k.h
@@ -197,6 +197,8 @@ typedef struct opj_cp {
int reduce;
/** if != 0, then only the first "layer" layers are decoded; if == 0 or not used, all the quality layers are decoded */
int layer;
+ /** if == NO_LIMITATION, decode entire codestream; if == LIMIT_TO_MAIN_HEADER then only decode the main header */
+ OPJ_LIMIT_DECODING limit_decoding;
/** 0 = no index || 1 = index */
int index_on;
/** XTOsiz */
diff --git a/libopenjpeg/openjpeg.c b/libopenjpeg/openjpeg.c
index e90fbb68..b522939e 100644
--- a/libopenjpeg/openjpeg.c
+++ b/libopenjpeg/openjpeg.c
@@ -116,6 +116,7 @@ void OPJ_CALLCONV opj_set_default_decoder_parameters(opj_dparameters_t *paramete
/* default decoding parameters */
parameters->cp_layer = 0;
parameters->cp_reduce = 0;
+ parameters->cp_limit_decoding = NO_LIMITATION;
parameters->decod_format = -1;
parameters->cod_format = -1;
diff --git a/libopenjpeg/openjpeg.h b/libopenjpeg/openjpeg.h
index 39290106..8e9da446 100644
--- a/libopenjpeg/openjpeg.h
+++ b/libopenjpeg/openjpeg.h
@@ -143,6 +143,14 @@ typedef enum CODEC_FORMAT {
CODEC_JP2 = 2 /**< JPEG-2000 file format : read/write */
} OPJ_CODEC_FORMAT;
+/**
+Limit decoding to certain portions of the codestream.
+*/
+typedef enum LIMIT_DECODING {
+ NO_LIMITATION = 0, /**< No limitation for the decoding. The entire codestream will de decoded */
+ LIMIT_TO_MAIN_HEADER = 1 /**< The decoding is limited to the Main Header */
+} OPJ_LIMIT_DECODING;
+
/*
==========================================================
event manager typedef definitions
@@ -331,6 +339,14 @@ typedef struct opj_dparameters {
*/
int cp_layer;
+ /**
+ Specify whether the decoding should be done on the entire codestream, or be limited to the main header
+ Limiting the decoding to the main header makes it possible to extract the characteristics of the codestream
+ if == NO_LIMITATION, the entire codestream is decoded;
+ if == LIMIT_TO_MAIN_HEADER, only the main header is decoded;
+ */
+ OPJ_LIMIT_DECODING cp_limit_decoding;
+
/**@name command line encoder parameters (not used inside the library) */
/*@{*/
/** input file name */