summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/openjp2/bench_dwt.c2
-rw-r--r--src/lib/openjp2/cio.h2
-rw-r--r--src/lib/openjp2/dwt.c5
-rw-r--r--src/lib/openjp2/ht_dec.c20
-rw-r--r--src/lib/openjp2/j2k.c89
-rw-r--r--src/lib/openjp2/j2k.h7
-rw-r--r--src/lib/openjp2/jp2.c23
-rw-r--r--src/lib/openjp2/jp2.h9
-rw-r--r--src/lib/openjp2/mct.c2
-rw-r--r--src/lib/openjp2/openjpeg.c27
-rw-r--r--src/lib/openjp2/openjpeg.h29
-rw-r--r--src/lib/openjp2/opj_codec.h3
-rw-r--r--src/lib/openjp2/opj_intmath.h2
-rw-r--r--src/lib/openjp2/pi.c14
-rw-r--r--src/lib/openjp2/sparse_array.c4
-rw-r--r--src/lib/openjp2/t1.h2
-rw-r--r--src/lib/openjp2/t1_ht_generate_luts.c4
-rw-r--r--src/lib/openjp2/t2.c67
-rw-r--r--src/lib/openjpip/auxtrans_manager.c4
-rw-r--r--src/lib/openjpip/imgsock_manager.h6
-rw-r--r--src/lib/openjpip/index_manager.c2
-rw-r--r--src/lib/openjpip/jpip_parser.c2
-rw-r--r--src/lib/openjpip/metadata_manager.h2
-rw-r--r--src/lib/openjpip/mhixbox_manager.h2
24 files changed, 239 insertions, 90 deletions
diff --git a/src/lib/openjp2/bench_dwt.c b/src/lib/openjp2/bench_dwt.c
index 1124cd61..4f2ea9fb 100644
--- a/src/lib/openjp2/bench_dwt.c
+++ b/src/lib/openjp2/bench_dwt.c
@@ -207,7 +207,7 @@ int main(int argc, char** argv)
}
if (irreversible && check) {
- /* Due to irreversible inverse DWT not being symetric of forward */
+ /* Due to irreversible inverse DWT not being symmetric of forward */
/* See BUG_WEIRD_TWO_INVK in dwt.c */
printf("-I and -check aren't compatible\n");
exit(1);
diff --git a/src/lib/openjp2/cio.h b/src/lib/openjp2/cio.h
index 6996a9a0..7caee30a 100644
--- a/src/lib/openjp2/cio.h
+++ b/src/lib/openjp2/cio.h
@@ -118,7 +118,7 @@ typedef struct opj_stream_private {
opj_stream_seek_fn m_seek_fn;
/**
- * Actual data stored into the stream if readed from. Data is read by chunk of fixed size.
+ * Actual data stored into the stream if read from. Data is read by chunk of fixed size.
* you should never access this data directly.
*/
OPJ_BYTE * m_stored_data;
diff --git a/src/lib/openjp2/dwt.c b/src/lib/openjp2/dwt.c
index 824a9fc4..abc500ec 100644
--- a/src/lib/openjp2/dwt.c
+++ b/src/lib/openjp2/dwt.c
@@ -513,7 +513,7 @@ static void opj_idwt53_h(const opj_dwt_t *dwt,
#if (defined(__SSE2__) || defined(__AVX2__)) && !defined(STANDARD_SLOW_VERSION)
-/* Conveniency macros to improve the readabilty of the formulas */
+/* Conveniency macros to improve the readability of the formulas */
#if __AVX2__
#define VREG __m256i
#define LOAD_CST(x) _mm256_set1_epi32(x)
@@ -801,7 +801,8 @@ static void opj_idwt3_v_cas0(OPJ_INT32* tmp,
opj_int_add_no_overflow(opj_int_add_no_overflow(d1c, d1n), 2) >> 2);
tmp[i ] = s0c;
- tmp[i + 1] = d1c + ((s0c + s0n) >> 1);
+ tmp[i + 1] = opj_int_add_no_overflow(d1c, opj_int_add_no_overflow(s0c,
+ s0n) >> 1);
}
tmp[i] = s0n;
diff --git a/src/lib/openjp2/ht_dec.c b/src/lib/openjp2/ht_dec.c
index 5160ee73..1eb4d525 100644
--- a/src/lib/openjp2/ht_dec.c
+++ b/src/lib/openjp2/ht_dec.c
@@ -136,7 +136,7 @@ static INLINE OPJ_UINT32 read_le_uint32(const void* dataIn)
* Each run represents the number of zero events before a one event.
*/
typedef struct dec_mel {
- // data decoding machinary
+ // data decoding machinery
OPJ_UINT8* data; //!<the address of data (or bitstream)
OPJ_UINT64 tmp; //!<temporary buffer for read data
int bits; //!<number of bits stored in tmp
@@ -600,7 +600,7 @@ void rev_read_mrp(rev_struct_t *mrp)
* an architecture that read size must be compatible with the
* alignment of the read address
*
- * There is another simiar subroutine rev_init. This subroutine does
+ * There is another similar subroutine rev_init. This subroutine does
* NOT skip the first 12 bits, and starts with unstuff set to true.
*
* @param [in] mrp is a pointer to rev_struct structure
@@ -1566,7 +1566,7 @@ OPJ_BOOL opj_t1_ht_decode_cblk(opj_t1_t *t1,
}
//first quad, starting at first sample in quad and moving on
- if (qinf[0] & 0x10) { //is it signifcant? (sigma_n)
+ if (qinf[0] & 0x10) { //is it significant? (sigma_n)
OPJ_UINT32 val;
ms_val = frwd_fetch(&magsgn); //get 32 bits of magsgn data
@@ -1816,14 +1816,14 @@ OPJ_BOOL opj_t1_ht_decode_cblk(opj_t1_t *t1,
if ((qinf[0] & 0xF0) & ((qinf[0] & 0xF0) - 1)) { // is \gamma_q 1?
OPJ_UINT32 E = (ls0 & 0x7Fu);
E = E > (lsp[1] & 0x7Fu) ? E : (lsp[1] & 0x7Fu); //max(E, E^NE, E^NF)
- //since U_q alread has u_q + 1, we subtract 2 instead of 1
+ //since U_q already has u_q + 1, we subtract 2 instead of 1
U_q[0] += E > 2 ? E - 2 : 0;
}
if ((qinf[1] & 0xF0) & ((qinf[1] & 0xF0) - 1)) { //is \gamma_q 1?
OPJ_UINT32 E = (lsp[1] & 0x7Fu);
E = E > (lsp[2] & 0x7Fu) ? E : (lsp[2] & 0x7Fu); //max(E, E^NE, E^NF)
- //since U_q alread has u_q + 1, we subtract 2 instead of 1
+ //since U_q already has u_q + 1, we subtract 2 instead of 1
U_q[1] += E > 2 ? E - 2 : 0;
}
@@ -2153,13 +2153,13 @@ OPJ_BOOL opj_t1_ht_decode_cblk(opj_t1_t *t1,
nxt_sig = y & 0x4 ? sigma1 : sigma2; //future samples
nxt_mbr = y & 0x4 ? mbr1 : mbr2; //future samples
val = 3u << (p - 2); // sample values for newly discovered
- // signficant samples including the bin center
+ // significant samples including the bin center
for (i = 0; i < width;
i += 8, cur_sig++, cur_mbr++, nxt_sig++, nxt_mbr++) {
OPJ_UINT32 ux, tx;
OPJ_UINT32 mbr = *cur_mbr;
OPJ_UINT32 new_sig = 0;
- if (mbr) { //are there any samples that migt be signficant
+ if (mbr) { //are there any samples that might be significant
OPJ_INT32 n;
for (n = 0; n < 8; n += 4) {
OPJ_UINT32 col_mask;
@@ -2187,7 +2187,7 @@ OPJ_BOOL opj_t1_ht_decode_cblk(opj_t1_t *t1,
continue;
}
- //scan mbr to find a new signficant sample
+ //scan mbr to find a new significant sample
sample_mask = 0x11111111u & col_mask; // LSB
if (mbr & sample_mask) {
assert(dp[0] == 0); // the sample must have been 0
@@ -2196,7 +2196,7 @@ OPJ_BOOL opj_t1_ht_decode_cblk(opj_t1_t *t1,
OPJ_UINT32 t;
new_sig |= sample_mask; // new significant samples
t = 0x32u << (j * 4);// propagation to neighbors
- mbr |= t & inv_sig; //remove already signifcant samples
+ mbr |= t & inv_sig; //remove already significant samples
}
cwd >>= 1;
++cnt; //consume bit and increment number of
@@ -2254,7 +2254,7 @@ OPJ_BOOL opj_t1_ht_decode_cblk(opj_t1_t *t1,
for (j = n; j < end; ++j, ++dp, col_mask <<= 4) {
OPJ_UINT32 sample_mask;
- if ((col_mask & new_sig) == 0) { //if non is signficant
+ if ((col_mask & new_sig) == 0) { //if non is significant
continue;
}
diff --git a/src/lib/openjp2/j2k.c b/src/lib/openjp2/j2k.c
index 3bfe8020..bcce3165 100644
--- a/src/lib/openjp2/j2k.c
+++ b/src/lib/openjp2/j2k.c
@@ -50,7 +50,7 @@
/*@{*/
/**
- * Sets up the procedures to do on reading header. Developpers wanting to extend the library can add their own reading procedures.
+ * Sets up the procedures to do on reading header. Developers wanting to extend the library can add their own reading procedures.
*/
static OPJ_BOOL opj_j2k_setup_header_reading(opj_j2k_t *p_j2k,
opj_event_mgr_t * p_manager);
@@ -89,22 +89,22 @@ static OPJ_BOOL opj_j2k_decoding_validation(opj_j2k_t * p_j2k,
opj_event_mgr_t * p_manager);
/**
- * Sets up the validation ,i.e. adds the procedures to lauch to make sure the codec parameters
- * are valid. Developpers wanting to extend the library can add their own validation procedures.
+ * Sets up the validation ,i.e. adds the procedures to launch to make sure the codec parameters
+ * are valid. Developers wanting to extend the library can add their own validation procedures.
*/
static OPJ_BOOL opj_j2k_setup_encoding_validation(opj_j2k_t *p_j2k,
opj_event_mgr_t * p_manager);
/**
- * Sets up the validation ,i.e. adds the procedures to lauch to make sure the codec parameters
- * are valid. Developpers wanting to extend the library can add their own validation procedures.
+ * Sets up the validation ,i.e. adds the procedures to launch to make sure the codec parameters
+ * are valid. Developers wanting to extend the library can add their own validation procedures.
*/
static OPJ_BOOL opj_j2k_setup_decoding_validation(opj_j2k_t *p_j2k,
opj_event_mgr_t * p_manager);
/**
- * Sets up the validation ,i.e. adds the procedures to lauch to make sure the codec parameters
- * are valid. Developpers wanting to extend the library can add their own validation procedures.
+ * Sets up the validation ,i.e. adds the procedures to launch to make sure the codec parameters
+ * are valid. Developers wanting to extend the library can add their own validation procedures.
*/
static OPJ_BOOL opj_j2k_setup_end_compress(opj_j2k_t *p_j2k,
opj_event_mgr_t * p_manager);
@@ -147,7 +147,7 @@ static OPJ_BOOL opj_j2k_create_tcd(opj_j2k_t *p_j2k,
opj_event_mgr_t * p_manager);
/**
- * Excutes the given procedures on the given codec.
+ * Executes the given procedures on the given codec.
*
* @param p_procedure_list the list of procedures to execute
* @param p_j2k the jpeg2000 codec to execute the procedures on.
@@ -1430,7 +1430,7 @@ static const opj_dec_memory_marker_handler_t j2k_memory_marker_handler_tab [] =
{J2K_MS_MCC, J2K_STATE_MH | J2K_STATE_TPH, opj_j2k_read_mcc},
{J2K_MS_MCO, J2K_STATE_MH | J2K_STATE_TPH, opj_j2k_read_mco},
#ifdef USE_JPWL
-#ifdef TODO_MS /* remove these functions which are not commpatible with the v2 API */
+#ifdef TODO_MS /* remove these functions which are not compatible with the v2 API */
{J2K_MS_EPC, J2K_STATE_MH | J2K_STATE_TPH, j2k_read_epc},
{J2K_MS_EPB, J2K_STATE_MH | J2K_STATE_TPH, j2k_read_epb},
{J2K_MS_ESD, J2K_STATE_MH | J2K_STATE_TPH, j2k_read_esd},
@@ -1677,7 +1677,7 @@ static OPJ_BOOL opj_j2k_check_poc_val(const opj_poc_t *p_pocs,
assert(p_nb_pocs > 0);
- packet_array = (OPJ_UINT32*) opj_calloc(step_l * p_num_layers,
+ packet_array = (OPJ_UINT32*) opj_calloc((size_t)step_l * p_num_layers,
sizeof(OPJ_UINT32));
if (packet_array == 00) {
opj_event_msg(p_manager, EVT_ERROR,
@@ -1790,7 +1790,7 @@ static OPJ_UINT32 opj_j2k_get_num_tp(opj_cp_t *cp, OPJ_UINT32 pino,
tpnum *= l_current_poc->layE;
break;
}
- /* whould we split here ? */
+ /* would we split here ? */
if (cp->m_specific_param.m_enc.m_tp_flag == prog[i]) {
cp->m_specific_param.m_enc.m_tp_pos = i;
break;
@@ -4964,9 +4964,14 @@ static OPJ_BOOL opj_j2k_read_sod(opj_j2k_t *p_j2k,
/* Check enough bytes left in stream before allocation */
if ((OPJ_OFF_T)p_j2k->m_specific_param.m_decoder.m_sot_length >
opj_stream_get_number_byte_left(p_stream)) {
- opj_event_msg(p_manager, EVT_ERROR,
- "Tile part length size inconsistent with stream length\n");
- return OPJ_FALSE;
+ if (p_j2k->m_cp.strict) {
+ opj_event_msg(p_manager, EVT_ERROR,
+ "Tile part length size inconsistent with stream length\n");
+ return OPJ_FALSE;
+ } else {
+ opj_event_msg(p_manager, EVT_WARNING,
+ "Tile part length size inconsistent with stream length\n");
+ }
}
if (p_j2k->m_specific_param.m_decoder.m_sot_length >
UINT_MAX - OPJ_COMMON_CBLK_DATA_EXTRA) {
@@ -6695,6 +6700,13 @@ void opj_j2k_setup_decoder(opj_j2k_t *j2k, opj_dparameters_t *parameters)
}
}
+void opj_j2k_decoder_set_strict_mode(opj_j2k_t *j2k, OPJ_BOOL strict)
+{
+ if (j2k) {
+ j2k->m_cp.strict = strict;
+ }
+}
+
OPJ_BOOL opj_j2k_set_threads(opj_j2k_t *j2k, OPJ_UINT32 num_threads)
{
/* Currently we pass the thread-pool to the tcd, so we cannot re-set it */
@@ -7654,6 +7666,8 @@ OPJ_BOOL opj_j2k_setup_encoder(opj_j2k_t *p_j2k,
return OPJ_FALSE;
}
+ p_j2k->m_specific_param.m_encoder.m_nb_comps = image->numcomps;
+
/* keep a link to cp so that we can destroy it later in j2k_destroy_compress */
cp = &(p_j2k->m_cp);
@@ -7953,6 +7967,13 @@ OPJ_BOOL opj_j2k_setup_encoder(opj_j2k_t *p_j2k,
(OPJ_INT32)cp->tdx);
cp->th = (OPJ_UINT32)opj_int_ceildiv((OPJ_INT32)(image->y1 - cp->ty0),
(OPJ_INT32)cp->tdy);
+ /* Check that the number of tiles is valid */
+ if (cp->tw > 65535 / cp->th) {
+ opj_event_msg(p_manager, EVT_ERROR,
+ "Invalid number of tiles : %u x %u (maximum fixed by jpeg2000 norm is 65535 tiles)\n",
+ cp->tw, cp->th);
+ return OPJ_FALSE;
+ }
} else {
cp->tdx = image->x1 - cp->tx0;
cp->tdy = image->y1 - cp->ty0;
@@ -8019,7 +8040,7 @@ OPJ_BOOL opj_j2k_setup_encoder(opj_j2k_t *p_j2k,
}
#endif /* USE_JPWL */
- /* initialize the mutiple tiles */
+ /* initialize the multiple tiles */
/* ---------------------------- */
cp->tcps = (opj_tcp_t*) opj_calloc(cp->tw * cp->th, sizeof(opj_tcp_t));
if (!cp->tcps) {
@@ -8829,7 +8850,7 @@ static OPJ_BOOL opj_j2k_read_header_procedure(opj_j2k_t *p_j2k,
if (l_marker_handler->id == J2K_MS_UNK) {
if (! opj_j2k_read_unk(p_j2k, p_stream, &l_current_marker, p_manager)) {
opj_event_msg(p_manager, EVT_ERROR,
- "Unknow marker have been detected and generated error.\n");
+ "Unknown marker has been detected and generated error.\n");
return OPJ_FALSE;
}
@@ -9834,7 +9855,7 @@ OPJ_BOOL opj_j2k_decode_tile(opj_j2k_t * p_j2k,
/* When using the opj_read_tile_header / opj_decode_tile_data API */
/* such as in test_tile_decoder, m_output_image is NULL, so fall back */
/* to the full image dimension. This is a bit surprising that */
- /* opj_set_decode_area() is only used to determinte intersecting tiles, */
+ /* opj_set_decode_area() is only used to determine intersecting tiles, */
/* but full tile decoding is done */
l_image_for_bounds = p_j2k->m_output_image ? p_j2k->m_output_image :
p_j2k->m_private_image;
@@ -9880,10 +9901,10 @@ OPJ_BOOL opj_j2k_decode_tile(opj_j2k_t * p_j2k,
if (p_j2k->m_specific_param.m_decoder.m_state != J2K_STATE_EOC) {
if (opj_stream_read_data(p_stream, l_data, 2, p_manager) != 2) {
- opj_event_msg(p_manager, EVT_ERROR, "Stream too short\n");
- return OPJ_FALSE;
+ opj_event_msg(p_manager, p_j2k->m_cp.strict ? EVT_ERROR : EVT_WARNING,
+ "Stream too short\n");
+ return p_j2k->m_cp.strict ? OPJ_FALSE : OPJ_TRUE;
}
-
opj_read_bytes(l_data, &l_current_marker, 2);
if (l_current_marker == J2K_MS_EOC) {
@@ -10400,6 +10421,9 @@ opj_j2k_t* opj_j2k_create_decompress(void)
/* per component is allowed */
l_j2k->m_cp.allow_different_bit_depth_sign = 1;
+ /* Default to using strict mode. */
+ l_j2k->m_cp.strict = OPJ_TRUE;
+
#ifdef OPJ_DISABLE_TPSOT_FIX
l_j2k->m_specific_param.m_decoder.m_nb_tile_parts_correction_checked = 1;
#endif
@@ -11725,7 +11749,7 @@ static OPJ_BOOL opj_j2k_decode_tiles(opj_j2k_t *p_j2k,
}
/**
- * Sets up the procedures to do on decoding data. Developpers wanting to extend the library can add their own reading procedures.
+ * Sets up the procedures to do on decoding data. Developers wanting to extend the library can add their own reading procedures.
*/
static OPJ_BOOL opj_j2k_setup_decoding(opj_j2k_t *p_j2k,
opj_event_mgr_t * p_manager)
@@ -11857,7 +11881,7 @@ static OPJ_BOOL opj_j2k_decode_one_tile(opj_j2k_t *p_j2k,
}
/**
- * Sets up the procedures to do on decoding one tile. Developpers wanting to extend the library can add their own reading procedures.
+ * Sets up the procedures to do on decoding one tile. Developers wanting to extend the library can add their own reading procedures.
*/
static OPJ_BOOL opj_j2k_setup_decoding_tile(opj_j2k_t *p_j2k,
opj_event_mgr_t * p_manager)
@@ -12083,7 +12107,7 @@ OPJ_BOOL opj_j2k_get_tile(opj_j2k_t *p_j2k,
opj_image_destroy(p_j2k->m_output_image);
}
- /* Create the ouput image from the information previously computed*/
+ /* Create the output image from the information previously computed*/
p_j2k->m_output_image = opj_image_create0();
if (!(p_j2k->m_output_image)) {
return OPJ_FALSE;
@@ -12173,6 +12197,25 @@ OPJ_BOOL opj_j2k_encoder_set_extra_options(
"Invalid value for option: %s.\n", *p_option_iter);
return OPJ_FALSE;
}
+ } else if (strncmp(*p_option_iter, "GUARD_BITS=", strlen("GUARD_BITS=")) == 0) {
+ OPJ_UINT32 tileno;
+ opj_cp_t *cp = cp = &(p_j2k->m_cp);
+
+ int numgbits = atoi(*p_option_iter + strlen("GUARD_BITS="));
+ if (numgbits < 0 || numgbits > 7) {
+ opj_event_msg(p_manager, EVT_ERROR,
+ "Invalid value for option: %s. Should be in [0,7]\n", *p_option_iter);
+ return OPJ_FALSE;
+ }
+
+ for (tileno = 0; tileno < cp->tw * cp->th; tileno++) {
+ OPJ_UINT32 i;
+ opj_tcp_t *tcp = &cp->tcps[tileno];
+ for (i = 0; i < p_j2k->m_specific_param.m_encoder.m_nb_comps; i++) {
+ opj_tccp_t *tccp = &tcp->tccps[i];
+ tccp->numgbits = (OPJ_UINT32)numgbits;
+ }
+ }
} else {
opj_event_msg(p_manager, EVT_ERROR,
"Invalid option: %s.\n", *p_option_iter);
diff --git a/src/lib/openjp2/j2k.h b/src/lib/openjp2/j2k.h
index 2b08e840..04fba645 100644
--- a/src/lib/openjp2/j2k.h
+++ b/src/lib/openjp2/j2k.h
@@ -402,6 +402,8 @@ typedef struct opj_cp {
}
m_specific_param;
+ /** OPJ_TRUE if entire bit stream must be decoded, OPJ_FALSE if partial bitstream decoding allowed */
+ OPJ_BOOL strict;
/* UniPG>> */
#ifdef USE_JPWL
@@ -550,6 +552,9 @@ typedef struct opj_j2k_enc {
/* reserved bytes in m_encoded_tile_size for PLT markers */
OPJ_UINT32 m_reserved_bytes_for_PLT;
+ /** Number of components */
+ OPJ_UINT32 m_nb_comps;
+
} opj_j2k_enc_t;
@@ -622,6 +627,8 @@ Decoding parameters are returned in j2k->cp.
*/
void opj_j2k_setup_decoder(opj_j2k_t *j2k, opj_dparameters_t *parameters);
+void opj_j2k_decoder_set_strict_mode(opj_j2k_t *j2k, OPJ_BOOL strict);
+
OPJ_BOOL opj_j2k_set_threads(opj_j2k_t *j2k, OPJ_UINT32 num_threads);
/**
diff --git a/src/lib/openjp2/jp2.c b/src/lib/openjp2/jp2.c
index 7c065ba7..17572195 100644
--- a/src/lib/openjp2/jp2.c
+++ b/src/lib/openjp2/jp2.c
@@ -331,14 +331,14 @@ static OPJ_BOOL opj_jp2_read_colr(opj_jp2_t *jp2,
/**
* Sets up the procedures to do on writing header after the codestream.
- * Developpers wanting to extend the library can add their own writing procedures.
+ * Developers wanting to extend the library can add their own writing procedures.
*/
static OPJ_BOOL opj_jp2_setup_end_header_writing(opj_jp2_t *jp2,
opj_event_mgr_t * p_manager);
/**
* Sets up the procedures to do on reading header after the codestream.
- * Developpers wanting to extend the library can add their own writing procedures.
+ * Developers wanting to extend the library can add their own writing procedures.
*/
static OPJ_BOOL opj_jp2_setup_end_header_reading(opj_jp2_t *jp2,
opj_event_mgr_t * p_manager);
@@ -388,13 +388,13 @@ static OPJ_BOOL opj_jp2_read_boxhdr(opj_jp2_box_t *box,
/**
* Sets up the validation ,i.e. adds the procedures to launch to make sure the codec parameters
- * are valid. Developpers wanting to extend the library can add their own validation procedures.
+ * are valid. Developers wanting to extend the library can add their own validation procedures.
*/
static OPJ_BOOL opj_jp2_setup_encoding_validation(opj_jp2_t *jp2,
opj_event_mgr_t * p_manager);
/**
- * Sets up the procedures to do on writing header. Developpers wanting to extend the library can add their own writing procedures.
+ * Sets up the procedures to do on writing header. Developers wanting to extend the library can add their own writing procedures.
*/
static OPJ_BOOL opj_jp2_setup_header_writing(opj_jp2_t *jp2,
opj_event_mgr_t * p_manager);
@@ -457,14 +457,14 @@ static OPJ_BOOL opj_jp2_read_boxhdr_char(opj_jp2_box_t *box,
/**
* Sets up the validation ,i.e. adds the procedures to launch to make sure the codec parameters
- * are valid. Developpers wanting to extend the library can add their own validation procedures.
+ * are valid. Developers wanting to extend the library can add their own validation procedures.
*/
static OPJ_BOOL opj_jp2_setup_decoding_validation(opj_jp2_t *jp2,
opj_event_mgr_t * p_manager);
/**
* Sets up the procedures to do on reading header.
- * Developpers wanting to extend the library can add their own writing procedures.
+ * Developers wanting to extend the library can add their own writing procedures.
*/
static OPJ_BOOL opj_jp2_setup_header_reading(opj_jp2_t *jp2,
opj_event_mgr_t * p_manager);
@@ -1136,9 +1136,9 @@ static OPJ_BOOL opj_jp2_apply_pclr(opj_image_t *image,
}
max = image->numcomps;
- for (i = 0; i < max; ++i) {
- if (old_comps[i].data) {
- opj_image_data_free(old_comps[i].data);
+ for (j = 0; j < max; ++j) {
+ if (old_comps[j].data) {
+ opj_image_data_free(old_comps[j].data);
}
}
@@ -1901,6 +1901,11 @@ void opj_jp2_setup_decoder(opj_jp2_t *jp2, opj_dparameters_t *parameters)
OPJ_DPARAMETERS_IGNORE_PCLR_CMAP_CDEF_FLAG;
}
+void opj_jp2_decoder_set_strict_mode(opj_jp2_t *jp2, OPJ_BOOL strict)
+{
+ opj_j2k_decoder_set_strict_mode(jp2->j2k, strict);
+}
+
OPJ_BOOL opj_jp2_set_threads(opj_jp2_t *jp2, OPJ_UINT32 num_threads)
{
return opj_j2k_set_threads(jp2->j2k, num_threads);
diff --git a/src/lib/openjp2/jp2.h b/src/lib/openjp2/jp2.h
index 9e7fa566..173f2511 100644
--- a/src/lib/openjp2/jp2.h
+++ b/src/lib/openjp2/jp2.h
@@ -235,6 +235,15 @@ Decoding parameters are returned in jp2->j2k->cp.
*/
void opj_jp2_setup_decoder(opj_jp2_t *jp2, opj_dparameters_t *parameters);
+/**
+Set the strict mode parameter. When strict mode is enabled, the entire
+bitstream must be decoded or an error is returned. When it is disabled,
+the decoder will decode partial bitstreams.
+@param jp2 JP2 decompressor handle
+@param strict OPJ_TRUE for strict mode
+*/
+void opj_jp2_decoder_set_strict_mode(opj_jp2_t *jp2, OPJ_BOOL strict);
+
/** Allocates worker threads for the compressor/decompressor.
*
* @param jp2 JP2 decompressor handle
diff --git a/src/lib/openjp2/mct.c b/src/lib/openjp2/mct.c
index 88c8f409..78058128 100644
--- a/src/lib/openjp2/mct.c
+++ b/src/lib/openjp2/mct.c
@@ -457,7 +457,7 @@ void opj_calculate_norms(OPJ_FLOAT64 * pNorms,
for (j = 0; j < pNbComps; ++j) {
lCurrentValue = lMatrix[lIndex];
lIndex += pNbComps;
- lNorms[i] += lCurrentValue * lCurrentValue;
+ lNorms[i] += (OPJ_FLOAT64) lCurrentValue * lCurrentValue;
}
lNorms[i] = sqrt(lNorms[i]);
}
diff --git a/src/lib/openjp2/openjpeg.c b/src/lib/openjp2/openjpeg.c
index 0c5f2d5f..29d3ee52 100644
--- a/src/lib/openjp2/openjpeg.c
+++ b/src/lib/openjp2/openjpeg.c
@@ -219,6 +219,10 @@ opj_codec_t* OPJ_CALLCONV opj_create_decompress(OPJ_CODEC_FORMAT p_format)
l_codec->m_codec_data.m_decompression.opj_setup_decoder =
(void (*)(void *, opj_dparameters_t *)) opj_j2k_setup_decoder;
+ l_codec->m_codec_data.m_decompression.opj_decoder_set_strict_mode =
+ (void (*)(void *, OPJ_BOOL)) opj_j2k_decoder_set_strict_mode;
+
+
l_codec->m_codec_data.m_decompression.opj_read_tile_header =
(OPJ_BOOL(*)(void *,
OPJ_UINT32*,
@@ -326,6 +330,9 @@ opj_codec_t* OPJ_CALLCONV opj_create_decompress(OPJ_CODEC_FORMAT p_format)
l_codec->m_codec_data.m_decompression.opj_setup_decoder =
(void (*)(void *, opj_dparameters_t *)) opj_jp2_setup_decoder;
+ l_codec->m_codec_data.m_decompression.opj_decoder_set_strict_mode =
+ (void (*)(void *, OPJ_BOOL)) opj_jp2_decoder_set_strict_mode;
+
l_codec->m_codec_data.m_decompression.opj_set_decode_area =
(OPJ_BOOL(*)(void *,
opj_image_t*,
@@ -426,6 +433,26 @@ OPJ_BOOL OPJ_CALLCONV opj_setup_decoder(opj_codec_t *p_codec,
return OPJ_FALSE;
}
+OPJ_API OPJ_BOOL OPJ_CALLCONV opj_decoder_set_strict_mode(opj_codec_t *p_codec,
+ OPJ_BOOL strict)
+{
+ if (p_codec) {
+ opj_codec_private_t * l_codec = (opj_codec_private_t *) p_codec;
+
+ if (! l_codec->is_decompressor) {
+ opj_event_msg(&(l_codec->m_event_mgr), EVT_ERROR,
+ "Codec provided to the opj_decoder_set_strict_mode function is not a decompressor handler.\n");
+ return OPJ_FALSE;
+ }
+
+ l_codec->m_codec_data.m_decompression.opj_decoder_set_strict_mode(
+ l_codec->m_codec,
+ strict);
+ return OPJ_TRUE;
+ }
+ return OPJ_FALSE;
+}
+
OPJ_BOOL OPJ_CALLCONV opj_read_header(opj_stream_t *p_stream,
opj_codec_t *p_codec,
opj_image_t **p_image)
diff --git a/src/lib/openjp2/openjpeg.h b/src/lib/openjp2/openjpeg.h
index 68e4e7e1..ebce53db 100644
--- a/src/lib/openjp2/openjpeg.h
+++ b/src/lib/openjp2/openjpeg.h
@@ -455,9 +455,9 @@ typedef struct opj_cparameters {
char infile[OPJ_PATH_LEN];
/** output file name */
char outfile[OPJ_PATH_LEN];
- /** DEPRECATED. Index generation is now handeld with the opj_encode_with_info() function. Set to NULL */
+ /** DEPRECATED. Index generation is now handled with the opj_encode_with_info() function. Set to NULL */
int index_on;
- /** DEPRECATED. Index generation is now handeld with the opj_encode_with_info() function. Set to NULL */
+ /** DEPRECATED. Index generation is now handled with the opj_encode_with_info() function. Set to NULL */
char index[OPJ_PATH_LEN];
/** subimage encoding: origin image offset in x direction */
int image_offset_x0;
@@ -1346,6 +1346,20 @@ OPJ_API OPJ_BOOL OPJ_CALLCONV opj_setup_decoder(opj_codec_t *p_codec,
opj_dparameters_t *parameters);
/**
+ * Set strict decoding parameter for this decoder. If strict decoding is enabled, partial bit
+ * streams will fail to decode. If strict decoding is disabled, the decoder will decode partial
+ * bitstreams as much as possible without erroring
+ *
+ * @param p_codec decompressor handler
+ * @param strict OPJ_TRUE to enable strict decoding, OPJ_FALSE to disable
+ *
+ * @return true if the decoder is correctly set
+ */
+
+OPJ_API OPJ_BOOL OPJ_CALLCONV opj_decoder_set_strict_mode(opj_codec_t *p_codec,
+ OPJ_BOOL strict);
+
+/**
* Allocates worker threads for the compressor/decompressor.
*
* By default, only the main thread is used. If this function is not used,
@@ -1453,7 +1467,7 @@ OPJ_API OPJ_BOOL OPJ_CALLCONV opj_decode(opj_codec_t *p_decompressor,
* Get the decoded tile from the codec
*
* @param p_codec the jpeg2000 codec.
- * @param p_stream input streamm
+ * @param p_stream input stream
* @param p_image output image
* @param tile_index index of the tile which will be decode
*
@@ -1599,9 +1613,12 @@ OPJ_API OPJ_BOOL OPJ_CALLCONV opj_setup_encoder(opj_codec_t *p_codec,
* <li>PLT=YES/NO. Defaults to NO. If set to YES, PLT marker segments,
* indicating the length of each packet in the tile-part header, will be
* written. Since 2.4.0</li>
- * <li>TLM=YES/NO. Defaults to NO (except for Cinema and IMF profiles).
- * If set to YES, TLM marker segments, indicating the length of each
- * tile-part part will be written. Since 2.4.0</li>
+ * <li>TLM=YES/NO. Defaults to NO (except for Cinema and IMF profiles).
+ * If set to YES, TLM marker segments, indicating the length of each
+ * tile-part part will be written. Since 2.4.0</li>
+ * <li>GUARD_BITS=value. Number of guard bits in [0,7] range. Default value is 2.
+ * 1 may be used sometimes (like in SMPTE DCP Bv2.1 Application Profile for 2K images).
+ * Since 2.5.0</li>
* </ul>
*
* @param p_codec Compressor handle
diff --git a/src/lib/openjp2/opj_codec.h b/src/lib/openjp2/opj_codec.h
index 8a8af911..7cff6708 100644
--- a/src/lib/openjp2/opj_codec.h
+++ b/src/lib/openjp2/opj_codec.h
@@ -90,6 +90,9 @@ typedef struct opj_codec_private {
/** Setup decoder function handler */
void (*opj_setup_decoder)(void * p_codec, opj_dparameters_t * p_param);
+ /** Strict mode function handler */
+ void (*opj_decoder_set_strict_mode)(void * p_codec, OPJ_BOOL strict);
+
/** Set decode area function handler */
OPJ_BOOL(*opj_set_decode_area)(void * p_codec,
opj_image_t * p_image,
diff --git a/src/lib/openjp2/opj_intmath.h b/src/lib/openjp2/opj_intmath.h
index f8cc6139..1b0c9d03 100644
--- a/src/lib/openjp2/opj_intmath.h
+++ b/src/lib/openjp2/opj_intmath.h
@@ -277,7 +277,7 @@ static INLINE OPJ_INT32 opj_int_fix_mul_t1(OPJ_INT32 a, OPJ_INT32 b)
}
/**
-Addtion two signed integers with a wrap-around behaviour.
+Addition two signed integers with a wrap-around behaviour.
Assumes complement-to-two signed integers.
@param a
@param b
diff --git a/src/lib/openjp2/pi.c b/src/lib/openjp2/pi.c
index ccc5b75c..38f1ba5a 100644
--- a/src/lib/openjp2/pi.c
+++ b/src/lib/openjp2/pi.c
@@ -943,7 +943,7 @@ static void opj_get_all_encoding_parameters(const opj_image_t *p_image,
*p_dy_min = 0x7fffffff;
for (compno = 0; compno < p_image->numcomps; ++compno) {
- /* aritmetic variables to calculate*/
+ /* arithmetic variables to calculate*/
OPJ_UINT32 l_level_no;
OPJ_UINT32 l_rx0, l_ry0, l_rx1, l_ry1;
OPJ_UINT32 l_px0, l_py0, l_px1, py1;
@@ -1225,7 +1225,7 @@ static void opj_pi_update_decode_poc(opj_pi_iterator_t * p_pi,
/* loop*/
OPJ_UINT32 pino;
- /* encoding prameters to set*/
+ /* encoding parameters to set*/
OPJ_UINT32 l_bound;
opj_pi_iterator_t * l_current_pi = 00;
@@ -1272,7 +1272,7 @@ static void opj_pi_update_decode_not_poc(opj_pi_iterator_t * p_pi,
/* loop*/
OPJ_UINT32 pino;
- /* encoding prameters to set*/
+ /* encoding parameters to set*/
OPJ_UINT32 l_bound;
opj_pi_iterator_t * l_current_pi = 00;
@@ -1401,11 +1401,11 @@ opj_pi_iterator_t *opj_pi_create_decode(opj_image_t *p_image,
OPJ_UINT32 pino;
OPJ_UINT32 compno, resno;
- /* to store w, h, dx and dy fro all components and resolutions */
+ /* to store w, h, dx and dy for all components and resolutions */
OPJ_UINT32 * l_tmp_data;
OPJ_UINT32 ** l_tmp_ptr;
- /* encoding prameters to set */
+ /* encoding parameters to set */
OPJ_UINT32 l_max_res;
OPJ_UINT32 l_max_prec;
OPJ_UINT32 l_tx0, l_tx1, l_ty0, l_ty1;
@@ -1624,11 +1624,11 @@ opj_pi_iterator_t *opj_pi_initialise_encode(const opj_image_t *p_image,
OPJ_UINT32 pino;
OPJ_UINT32 compno, resno;
- /* to store w, h, dx and dy fro all components and resolutions*/
+ /* to store w, h, dx and dy for all components and resolutions*/
OPJ_UINT32 * l_tmp_data;
OPJ_UINT32 ** l_tmp_ptr;
- /* encoding prameters to set*/
+ /* encoding parameters to set*/
OPJ_UINT32 l_max_res;
OPJ_UINT32 l_max_prec;
OPJ_UINT32 l_tx0, l_tx1, l_ty0, l_ty1;
diff --git a/src/lib/openjp2/sparse_array.c b/src/lib/openjp2/sparse_array.c
index 73192924..50d1a904 100644
--- a/src/lib/openjp2/sparse_array.c
+++ b/src/lib/openjp2/sparse_array.c
@@ -69,7 +69,7 @@ opj_sparse_array_int32_t* opj_sparse_array_int32_create(OPJ_UINT32 width,
return NULL;
}
sa->data_blocks = (OPJ_INT32**) opj_calloc(sizeof(OPJ_INT32*),
- sa->block_count_hor * sa->block_count_ver);
+ (size_t) sa->block_count_hor * sa->block_count_ver);
if (sa->data_blocks == NULL) {
opj_free(sa);
return NULL;
@@ -235,7 +235,7 @@ static OPJ_BOOL opj_sparse_array_int32_read_or_write(
} else {
if (src_block == NULL) {
src_block = (OPJ_INT32*) opj_calloc(1,
- sa->block_width * sa->block_height * sizeof(OPJ_INT32));
+ (size_t) sa->block_width * sa->block_height * sizeof(OPJ_INT32));
if (src_block == NULL) {
return OPJ_FALSE;
}
diff --git a/src/lib/openjp2/t1.h b/src/lib/openjp2/t1.h
index 81ad0d00..ce43658b 100644
--- a/src/lib/openjp2/t1.h
+++ b/src/lib/openjp2/t1.h
@@ -200,7 +200,7 @@ typedef struct opj_t1 {
OPJ_UINT32 flagssize;
OPJ_BOOL encoder;
- /* Thre 3 variables below are only used by the decoder */
+ /* The 3 variables below are only used by the decoder */
/* set to TRUE in multithreaded context */
OPJ_BOOL mustuse_cblkdatabuffer;
/* Temporary buffer to concatenate all chunks of a codebock */
diff --git a/src/lib/openjp2/t1_ht_generate_luts.c b/src/lib/openjp2/t1_ht_generate_luts.c
index 3fd14eb9..6876e3fd 100644
--- a/src/lib/openjp2/t1_ht_generate_luts.c
+++ b/src/lib/openjp2/t1_ht_generate_luts.c
@@ -887,7 +887,7 @@ static vlc_src_table_t tbl1[] = {
* \li \c cwd_len : 3bits -> the codeword length of the VLC codeword;
* the VLC cwd is in the LSB of bitstream \n
* \li \c u_off : 1bit -> u_offset, which is 1 if u value is not 0 \n
- * \li \c rho : 4bits -> signficant samples within a quad \n
+ * \li \c rho : 4bits -> significant samples within a quad \n
* \li \c e_1 : 4bits -> EMB e_1 \n
* \li \c e_k : 4bits -> EMB e_k \n
* \n
@@ -924,7 +924,7 @@ OPJ_BOOL vlc_init_tables()
}
// this is to convert table entries into values for decoder look up
- // There can be at most 1024 possibilites, not all of them are valid.
+ // There can be at most 1024 possibilities, not all of them are valid.
//
for (int i = 0; i < 1024; ++i) {
int cwd = i & 0x7F; // from i extract codeword
diff --git a/src/lib/openjp2/t2.c b/src/lib/openjp2/t2.c
index 48f8949b..ebda0052 100644
--- a/src/lib/openjp2/t2.c
+++ b/src/lib/openjp2/t2.c
@@ -502,7 +502,6 @@ OPJ_BOOL opj_t2_decode_packets(opj_tcd_t* tcd,
l_current_pi->precno, l_current_pi->layno, skip_packet ? "skipped" : "kept");
*/
}
-
if (!skip_packet) {
l_nb_bytes_read = 0;
@@ -1124,7 +1123,7 @@ static OPJ_BOOL opj_t2_read_packet_header(opj_t2_t* p_t2,
/*
When the marker PPT/PPM is used the packet header are store in PPT/PPM marker
- This part deal with this caracteristic
+ This part deal with this characteristic
step 1: Read packet header in the saved structure
step 2: Return to codestream for decoding
*/
@@ -1378,6 +1377,7 @@ static OPJ_BOOL opj_t2_read_packet_data(opj_t2_t* p_t2,
opj_tcd_cblk_dec_t* l_cblk = 00;
opj_tcd_resolution_t* l_res =
&p_tile->comps[p_pi->compno].resolutions[p_pi->resno];
+ OPJ_BOOL partial_buffer = OPJ_FALSE;
OPJ_ARG_NOT_USED(p_t2);
OPJ_ARG_NOT_USED(pack_info);
@@ -1397,6 +1397,12 @@ static OPJ_BOOL opj_t2_read_packet_data(opj_t2_t* p_t2,
for (cblkno = 0; cblkno < l_nb_code_blocks; ++cblkno) {
opj_tcd_seg_t *l_seg = 00;
+ // if we have a partial data stream, set numchunks to zero
+ // since we have no data to actually decode.
+ if (partial_buffer) {
+ l_cblk->numchunks = 0;
+ }
+
if (!l_cblk->numnewpasses) {
/* nothing to do */
++l_cblk;
@@ -1419,12 +1425,32 @@ static OPJ_BOOL opj_t2_read_packet_data(opj_t2_t* p_t2,
/* Check possible overflow (on l_current_data only, assumes input args already checked) then size */
if ((((OPJ_SIZE_T)l_current_data + (OPJ_SIZE_T)l_seg->newlen) <
(OPJ_SIZE_T)l_current_data) ||
- (l_current_data + l_seg->newlen > p_src_data + p_max_length)) {
- opj_event_msg(p_manager, EVT_ERROR,
- "read: segment too long (%d) with max (%d) for codeblock %d (p=%d, b=%d, r=%d, c=%d)\n",
- l_seg->newlen, p_max_length, cblkno, p_pi->precno, bandno, p_pi->resno,
- p_pi->compno);
- return OPJ_FALSE;
+ (l_current_data + l_seg->newlen > p_src_data + p_max_length) ||
+ (partial_buffer)) {
+ if (p_t2->cp->strict) {
+ opj_event_msg(p_manager, EVT_ERROR,
+ "read: segment too long (%d) with max (%d) for codeblock %d (p=%d, b=%d, r=%d, c=%d)\n",
+ l_seg->newlen, p_max_length, cblkno, p_pi->precno, bandno, p_pi->resno,
+ p_pi->compno);
+ return OPJ_FALSE;
+ } else {
+ opj_event_msg(p_manager, EVT_WARNING,
+ "read: segment too long (%d) with max (%d) for codeblock %d (p=%d, b=%d, r=%d, c=%d)\n",
+ l_seg->newlen, p_max_length, cblkno, p_pi->precno, bandno, p_pi->resno,
+ p_pi->compno);
+ // skip this codeblock since it is a partial read
+ partial_buffer = OPJ_TRUE;
+ l_cblk->numchunks = 0;
+
+ l_seg->numpasses += l_seg->numnewpasses;
+ l_cblk->numnewpasses -= l_seg->numnewpasses;
+ if (l_cblk->numnewpasses > 0) {
+ ++l_seg;
+ ++l_cblk->numsegs;
+ break;
+ }
+ continue;
+ }
}
#ifdef USE_JPWL
@@ -1486,8 +1512,12 @@ static OPJ_BOOL opj_t2_read_packet_data(opj_t2_t* p_t2,
++l_band;
}
- *(p_data_read) = (OPJ_UINT32)(l_current_data - p_src_data);
-
+ // return the number of bytes read
+ if (partial_buffer) {
+ *(p_data_read) = p_max_length;
+ } else {
+ *(p_data_read) = (OPJ_UINT32)(l_current_data - p_src_data);
+ }
return OPJ_TRUE;
}
@@ -1549,11 +1579,18 @@ static OPJ_BOOL opj_t2_skip_packet_data(opj_t2_t* p_t2,
/* Check possible overflow then size */
if (((*p_data_read + l_seg->newlen) < (*p_data_read)) ||
((*p_data_read + l_seg->newlen) > p_max_length)) {
- opj_event_msg(p_manager, EVT_ERROR,
- "skip: segment too long (%d) with max (%d) for codeblock %d (p=%d, b=%d, r=%d, c=%d)\n",
- l_seg->newlen, p_max_length, cblkno, p_pi->precno, bandno, p_pi->resno,
- p_pi->compno);
- return OPJ_FALSE;
+ if (p_t2->cp->strict) {
+ opj_event_msg(p_manager, EVT_ERROR,
+ "skip: segment too long (%d) with max (%d) for codeblock %d (p=%d, b=%d, r=%d, c=%d)\n",
+ l_seg->newlen, p_max_length, cblkno, p_pi->precno, bandno, p_pi->resno,
+ p_pi->compno);
+ return OPJ_FALSE;
+ } else {
+ opj_event_msg(p_manager, EVT_WARNING,
+ "skip: segment too long (%d) with max (%d) for codeblock %d (p=%d, b=%d, r=%d, c=%d)\n",
+ l_seg->newlen, p_max_length, cblkno, p_pi->precno, bandno, p_pi->resno,
+ p_pi->compno);
+ }
}
#ifdef USE_JPWL
diff --git a/src/lib/openjpip/auxtrans_manager.c b/src/lib/openjpip/auxtrans_manager.c
index 8f364b6d..1471974d 100644
--- a/src/lib/openjpip/auxtrans_manager.c
+++ b/src/lib/openjpip/auxtrans_manager.c
@@ -87,7 +87,7 @@ typedef struct aux_response_param {
unsigned char *data; /*!< sending data */
OPJ_SIZE_T datalen; /*!< length of data */
OPJ_SIZE_T maxlenPerFrame; /*!< maximum data length to send per frame */
- SOCKET listensock; /*!< listeing socket */
+ SOCKET listensock; /*!< listening socket */
#ifdef _WIN32
HANDLE hTh; /*!< thread handle */
#endif
@@ -131,7 +131,7 @@ void send_responsedata_on_aux(OPJ_BOOL istcp, auxtrans_param_t auxtrans,
auxresponse->hTh = (HANDLE)_beginthreadex(NULL, 0, &aux_streaming, auxresponse,
0, &threadId);
if (auxresponse->hTh == 0) {
- fprintf(FCGI_stderr, "ERRO: pthread_create() %s",
+ fprintf(FCGI_stderr, "ERROR: pthread_create() %s",
strerror((int)auxresponse->hTh));
}
#else
diff --git a/src/lib/openjpip/imgsock_manager.h b/src/lib/openjpip/imgsock_manager.h
index 3f5b18f5..1343120a 100644
--- a/src/lib/openjpip/imgsock_manager.h
+++ b/src/lib/openjpip/imgsock_manager.h
@@ -77,7 +77,7 @@ void send_PNMstream(SOCKET connected_socket, Byte_t *pnmstream,
*
* @param [in] connected_socket file descriptor of the connected socket
* @param [in] xmlstream xml data stream
- * @param [in] length legnth of the xml data stream
+ * @param [in] length length of the xml data stream
*/
void send_XMLstream(SOCKET connected_socket, Byte_t *xmlstream,
OPJ_SIZE_T length);
@@ -87,7 +87,7 @@ void send_XMLstream(SOCKET connected_socket, Byte_t *xmlstream,
*
* @param [in] connected_socket file descriptor of the connected socket
* @param [in] tid tid string
- * @param [in] tidlen legnth of the tid string
+ * @param [in] tidlen length of the tid string
*/
void send_TIDstream(SOCKET connected_socket, const char *tid,
OPJ_SIZE_T tidlen);
@@ -97,7 +97,7 @@ void send_TIDstream(SOCKET connected_socket, const char *tid,
*
* @param [in] connected_socket file descriptor of the connected socket
* @param [in] cid cid string
- * @param [in] cidlen legnth of the cid string
+ * @param [in] cidlen length of the cid string
*/
void send_CIDstream(SOCKET connected_socket, const char *cid,
OPJ_SIZE_T cidlen);
diff --git a/src/lib/openjpip/index_manager.c b/src/lib/openjpip/index_manager.c
index 89753752..64e760d7 100644
--- a/src/lib/openjpip/index_manager.c
+++ b/src/lib/openjpip/index_manager.c
@@ -53,7 +53,7 @@
#endif /*SERVER*/
/**
- * chekc JP2 box indexing
+ * check JP2 box indexing
*
* @param[in] toplev_boxlist top level box list
* @return if correct (true) or wrong (false)
diff --git a/src/lib/openjpip/jpip_parser.c b/src/lib/openjpip/jpip_parser.c
index 6d8f9500..5cea13fe 100644
--- a/src/lib/openjpip/jpip_parser.c
+++ b/src/lib/openjpip/jpip_parser.c
@@ -140,7 +140,7 @@ OPJ_BOOL close_channel(query_param_t query_param,
#ifndef SERVER
fprintf(logstream, "local log: close all\n");
#endif
- /* all channels associatd with the session will be closed */
+ /* all channels associated with the session will be closed */
if (!delete_session(cursession, sessionlist)) {
return OPJ_FALSE;
}
diff --git a/src/lib/openjpip/metadata_manager.h b/src/lib/openjpip/metadata_manager.h
index 6cf00306..1a389736 100644
--- a/src/lib/openjpip/metadata_manager.h
+++ b/src/lib/openjpip/metadata_manager.h
@@ -45,7 +45,7 @@ typedef struct metadata_param {
boxlist_param_t *boxlist; /**< box list*/
placeholderlist_param_t *placeholderlist; /**< placeholder box list*/
boxcontents_param_t
- *boxcontents; /**< box contens in case of no boxlist and placeholderlist*/
+ *boxcontents; /**< box contents in case of no boxlist and placeholderlist*/
struct metadata_param
*next; /**< pointer to the next metadata-bin*/
} metadata_param_t;
diff --git a/src/lib/openjpip/mhixbox_manager.h b/src/lib/openjpip/mhixbox_manager.h
index 8b39e58d..40a0f6f1 100644
--- a/src/lib/openjpip/mhixbox_manager.h
+++ b/src/lib/openjpip/mhixbox_manager.h
@@ -37,7 +37,7 @@
/** Marker index parameters*/
typedef struct markeridx_param {
Byte2_t code; /**< marker code*/
- Byte2_t num_remain; /**< remining number of the same marker index segments listed immediately*/
+ Byte2_t num_remain; /**< remaining number of the same marker index segments listed immediately*/
OPJ_OFF_T offset; /**< offset relative to the start of the*/
/**codestream ( including the length*/
/**parameter but not the marker itself)*/