[trunk] enhance mj2 when read jp2h (credit to winfried)

This commit is contained in:
Mickael Savinaud 2011-11-09 14:38:12 +00:00
parent 11d875d043
commit 5b35f5fb69
2 changed files with 18 additions and 9 deletions

View File

@ -6,6 +6,7 @@ What's New for OpenJPEG
+ : added + : added
November 9, 2011 November 9, 2011
+ [mickael] enhance mj2 when read jp2h (credit to winfried)
+ [mickael] check if the file extension is the same as the infile format (credit to winfried) + [mickael] check if the file extension is the same as the infile format (credit to winfried)
+ [jmalik] add some sanity check in CMakeLists to prevent STRING(REGEX..) call issues + [jmalik] add some sanity check in CMakeLists to prevent STRING(REGEX..) call issues

View File

@ -1096,8 +1096,9 @@ int mj2_read_smj2(opj_image_t * img, mj2_tk_t * tk, opj_cio_t *cio)
{ {
mj2_box_t box; mj2_box_t box;
mj2_box_t box2; mj2_box_t box2;
int i;
opj_jp2_color_t color; opj_jp2_color_t color;
int i;
opj_bool ok;
mj2_read_boxhdr(&box, cio); mj2_read_boxhdr(&box, cio);
@ -1155,9 +1156,16 @@ int mj2_read_smj2(opj_image_t * img, mj2_tk_t * tk, opj_cio_t *cio)
tk->or_fieldorder = 0; tk->or_fieldorder = 0;
cio_skip(cio,2); /* Pre-defined = -1 */ cio_skip(cio,2); /* Pre-defined = -1 */
memset(&color, 0, sizeof(opj_jp2_color_t));
if (!jp2_read_jp2h(&tk->jp2_struct, cio, &color)) { memset(&color, 0, sizeof(opj_jp2_color_t));
tk->jp2_struct.cinfo = tk->cinfo;
ok = jp2_read_jp2h(&tk->jp2_struct, cio, &color);
tk->jp2_struct.cinfo = NULL;
if(ok == OPJ_FALSE)
{
opj_event_msg(tk->cinfo, EVT_ERROR, "Error reading JP2H Box\n"); opj_event_msg(tk->cinfo, EVT_ERROR, "Error reading JP2H Box\n");
return 1; return 1;
} }
@ -2759,9 +2767,9 @@ void mj2_destroy_decompress(opj_mj2_t *movie) {
if (tk->name_size != 0) if (tk->name_size != 0)
opj_free(tk->name); opj_free(tk->name);
if (tk->track_type == 0) {// Video track if (tk->track_type == 0) {// Video track
if (tk->jp2_struct.comps != 0) if (tk->jp2_struct.comps != NULL)
opj_free(tk->jp2_struct.comps); opj_free(tk->jp2_struct.comps);
if (tk->jp2_struct.cl != 0) if (tk->jp2_struct.cl != NULL)
opj_free(tk->jp2_struct.cl); opj_free(tk->jp2_struct.cl);
if (tk->num_jp2x != 0) if (tk->num_jp2x != 0)
opj_free(tk->jp2xdata); opj_free(tk->jp2xdata);
@ -2878,9 +2886,9 @@ void mj2_destroy_compress(opj_mj2_t *movie) {
if (tk->name_size != 0) if (tk->name_size != 0)
opj_free(tk->name); opj_free(tk->name);
if (tk->track_type == 0) {// Video track if (tk->track_type == 0) {// Video track
if (tk->jp2_struct.comps != 0) if (tk->jp2_struct.comps != NULL)
opj_free(tk->jp2_struct.comps); opj_free(tk->jp2_struct.comps);
if (tk->jp2_struct.cl != 0) if (tk->jp2_struct.cl != NULL)
opj_free(tk->jp2_struct.cl); opj_free(tk->jp2_struct.cl);
if (tk->num_jp2x != 0) if (tk->num_jp2x != 0)
opj_free(tk->jp2xdata); opj_free(tk->jp2xdata);