diff --git a/README.md b/README.md index 65d37979..17b8957b 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,9 @@ Anyone. As the OpenJPEG code is released under the [2-clauses BSD license](https API Documentation needs a major refactoring. Meanwhile, you can check [installation](https://github.com/uclouvain/openjpeg/wiki/Installation) instructions and [codec documentation](https://github.com/uclouvain/openjpeg/wiki/DocJ2KCodec). ## Current Status -* Build status: [![Build Status](https://travis-ci.org/uclouvain/openjpeg.svg?branch=master)](https://travis-ci.org/uclouvain/openjpeg) +[![Build Status](https://travis-ci.org/uclouvain/openjpeg.svg?branch=master)](https://travis-ci.org/uclouvain/openjpeg) + +[![Coverity Scan Build Status](https://scan.coverity.com/projects/6383/badge.svg)](https://scan.coverity.com/projects/uclouvain-openjpeg) ## Who are the developers ? diff --git a/doc/man/man1/opj_compress.1 b/doc/man/man1/opj_compress.1 index 51e5b1a5..cb37a427 100644 --- a/doc/man/man1/opj_compress.1 +++ b/doc/man/man1/opj_compress.1 @@ -29,7 +29,7 @@ .SP .fi .. -.TH opj_compress 1 "Version 1.4.0" "opj_compress" "converts to jpeg2000 files" +.TH opj_compress 1 "Version 2.1.1" "opj_compress" "converts to jpeg2000 files" .P .SH NAME opj_compress - diff --git a/doc/man/man1/opj_decompress.1 b/doc/man/man1/opj_decompress.1 index 470fd3c1..1e7b6c54 100644 --- a/doc/man/man1/opj_decompress.1 +++ b/doc/man/man1/opj_decompress.1 @@ -29,7 +29,7 @@ .SP .fi .. -.TH opj_decompress 1 "Version 1.4.0" "opj_decompress" "converts jpeg2000 files" +.TH opj_decompress 1 "Version 2.1.1" "opj_decompress" "converts jpeg2000 files" .P .SH NAME opj_decompress - @@ -73,9 +73,19 @@ n is the maximum number of quality layers to decode. See LAYERS below) .B \-\^OutFor "ext" (extension for output files) .P +.SH JPIP OPTIONS +Options usable only if the library has been compiled with +.B BUILD_JPIP +.TP +.B -jpip +Embed index table box into the output JP2 file (compulsory for JPIP) +.TP +.B -TP R +Partition a tile into tile parts of different resolution levels (compulsory for JPT-stream) +.P .SH JPWL OPTIONS Options usable only if the library has been compiled with -.B -DUSE_JPWL +.B BUILD_JPWL .TP .B -W c\fR[=Nc] (Nc is the number of expected components in the codestream; default:3) .TP diff --git a/doc/man/man1/opj_dump.1 b/doc/man/man1/opj_dump.1 index a6033c61..160af63a 100644 --- a/doc/man/man1/opj_dump.1 +++ b/doc/man/man1/opj_dump.1 @@ -29,7 +29,7 @@ .SP .fi .. -.TH opj_dump 1 "Version 1.4.0" "opj_dump" "dumps jpeg2000 files" +.TH opj_dump 1 "Version 2.1.1" "opj_dump" "dumps jpeg2000 files" .P .SH NAME opj_dump - diff --git a/src/bin/jp2/convert.c b/src/bin/jp2/convert.c index a894a369..1ccb34f8 100644 --- a/src/bin/jp2/convert.c +++ b/src/bin/jp2/convert.c @@ -573,7 +573,7 @@ static int tga_readheader(FILE *fp, unsigned int *bits_per_pixel, unsigned int *width, unsigned int *height, int *flip_image) { int palette_size; - unsigned char *tga ; + unsigned char tga[TGA_HEADER_SIZE]; unsigned char id_len, /*cmap_type,*/ image_type; unsigned char pixel_depth, image_desc; unsigned short /*cmap_index,*/ cmap_len, cmap_entry_size; @@ -581,7 +581,6 @@ static int tga_readheader(FILE *fp, unsigned int *bits_per_pixel, if (!bits_per_pixel || !width || !height || !flip_image) return 0; - tga = (unsigned char*)malloc(18); if ( fread(tga, TGA_HEADER_SIZE, 1, fp) != 1 ) { @@ -605,8 +604,6 @@ static int tga_readheader(FILE *fp, unsigned int *bits_per_pixel, pixel_depth = (unsigned char)tga[16]; image_desc = (unsigned char)tga[17]; - free(tga); - *bits_per_pixel = (unsigned int)pixel_depth; *width = (unsigned int)image_w; *height = (unsigned int)image_h; diff --git a/src/bin/jp2/convertbmp.c b/src/bin/jp2/convertbmp.c index 1131a599..0678d9d3 100644 --- a/src/bin/jp2/convertbmp.c +++ b/src/bin/jp2/convertbmp.c @@ -572,7 +572,7 @@ static OPJ_BOOL bmp_read_rle4_data(FILE* IN, OPJ_UINT8* pData, OPJ_UINT32 stride OPJ_UINT8 c1 = (OPJ_UINT8)getc(IN); for (j = 0; (j < c) && (x < width) && ((OPJ_SIZE_T)pix < (OPJ_SIZE_T)beyond); j++, x++, pix++) { - *pix = (j&1) ? (c1 & 0x0f) : ((c1>>4)&0x0f); + *pix = (OPJ_UINT8)((j&1) ? (c1 & 0x0fU) : ((c1>>4)&0x0fU)); } } else { /* absolute mode */ @@ -598,7 +598,7 @@ static OPJ_BOOL bmp_read_rle4_data(FILE* IN, OPJ_UINT8* pData, OPJ_UINT32 stride if((j&1) == 0) { c1 = (OPJ_UINT8)getc(IN); } - *pix = (j&1) ? (c1 & 0x0f) : ((c1>>4)&0x0f); + *pix = (OPJ_UINT8)((j&1) ? (c1 & 0x0fU) : ((c1>>4)&0x0fU)); } if(((c&3) == 1) || ((c&3) == 2)) { /* skip padding byte */ getc(IN); diff --git a/src/lib/openjp2/j2k.c b/src/lib/openjp2/j2k.c index d487d89d..f7a1d764 100644 --- a/src/lib/openjp2/j2k.c +++ b/src/lib/openjp2/j2k.c @@ -8603,8 +8603,10 @@ static opj_codestream_index_t* opj_j2k_create_cstr_index(void) cstr_index->marknum = 0; cstr_index->marker = (opj_marker_info_t*) opj_calloc(cstr_index->maxmarknum, sizeof(opj_marker_info_t)); - if (!cstr_index-> marker) + if (!cstr_index-> marker) { + opj_free(cstr_index); return NULL; + } cstr_index->tile_index = NULL; @@ -9668,14 +9670,14 @@ static OPJ_BOOL opj_j2k_decode_one_tile ( opj_j2k_t *p_j2k, * so move to the last SOT read */ if ( !(opj_stream_read_seek(p_stream, p_j2k->m_specific_param.m_decoder.m_last_sot_read_pos+2, p_manager)) ){ opj_event_msg(p_manager, EVT_ERROR, "Problem with seek function\n"); - opj_free(l_current_data); + opj_free(l_current_data); return OPJ_FALSE; } } else{ if ( !(opj_stream_read_seek(p_stream, p_j2k->cstr_index->tile_index[l_tile_no_to_dec].tp_index[0].start_pos+2, p_manager)) ) { opj_event_msg(p_manager, EVT_ERROR, "Problem with seek function\n"); - opj_free(l_current_data); + opj_free(l_current_data); return OPJ_FALSE; } } @@ -9733,6 +9735,7 @@ static OPJ_BOOL opj_j2k_decode_one_tile ( opj_j2k_t *p_j2k, /* move into the codestream to the the first SOT (FIXME or not move?)*/ if (!(opj_stream_read_seek(p_stream, p_j2k->cstr_index->main_head_end + 2, p_manager) ) ) { opj_event_msg(p_manager, EVT_ERROR, "Problem with seek function\n"); + opj_free(l_current_data); return OPJ_FALSE; } break; @@ -9998,11 +10001,15 @@ OPJ_BOOL opj_j2k_encode(opj_j2k_t * p_j2k, /* now copy this data into the tile component */ if (! opj_tcd_copy_tile_data(p_j2k->m_tcd,l_current_data,l_current_tile_size)) { opj_event_msg(p_manager, EVT_ERROR, "Size mismatch between tile data and sent data." ); + opj_free(l_current_data); return OPJ_FALSE; } } if (! opj_j2k_post_write_tile (p_j2k,p_stream,p_manager)) { + if (l_current_data) { + opj_free(l_current_data); + } return OPJ_FALSE; } }