Enhance some new JPIP files about opj_config inclusion and using of free/calloc (credit to Julien Malik)

This commit is contained in:
Mickael Savinaud 2011-09-19 16:53:10 +00:00
parent ac59fd1476
commit af7ebd96a0
8 changed files with 19 additions and 22 deletions

View File

@ -6,6 +6,7 @@ What's New for OpenJPEG
+ : added
September 19, 2011
+ [mickael] Enhance some new JPIP files about opj_config inclusion and using of free/calloc (credit to Julien Malik)
+ [mickael] WIP: begin to test opj_decode_tile_data
+ [mickael] WIP: update t1, t2, tcd to use same strut as in V2
+ [mickael] WIP: begin to test opj_read_tile_header with V2 style

View File

@ -260,11 +260,11 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
case 'd': /* Input decode ROI */
{
int size_optarg = (int)strlen(optarg) + 1;
int size_optarg = (int)strlen(opj_optarg) + 1;
char *ROI_values = (char*) malloc(size_optarg);
ROI_values[0] = '\0';
strncpy(ROI_values, optarg, strlen(optarg));
ROI_values[strlen(optarg)] = '\0';
strncpy(ROI_values, opj_optarg, strlen(opj_optarg));
ROI_values[strlen(opj_optarg)] = '\0';
/*printf("ROI_values = %s [%d / %d]\n", ROI_values, strlen(ROI_values), size_optarg ); */
parse_ROI_values( ROI_values, &parameters->ROI_x0, &parameters->ROI_y0, &parameters->ROI_x1, &parameters->ROI_y1);
}

View File

@ -31,9 +31,7 @@
#include <stdio.h>
#include <stdlib.h>
#include "cidx_manager.h"
#include "indexbox_manager.h"
#include "cio.h"
#include "opj_includes.h"
/*
@ -76,7 +74,7 @@ int write_cidx( int offset, opj_cio_t *cio, opj_image_t *image, opj_codestream_i
int num_box = 0;
opj_bool EPHused;
box = (opj_jp2_box_t *)calloc( 32, sizeof(opj_jp2_box_t));
box = (opj_jp2_box_t *)opj_calloc( 32, sizeof(opj_jp2_box_t));
for (i=0;i<2;i++){
@ -120,7 +118,7 @@ int write_cidx( int offset, opj_cio_t *cio, opj_image_t *image, opj_codestream_i
cio_seek( cio, lenp+len);
}
free( box);
opj_free( box);
return len;
}

View File

@ -108,6 +108,7 @@ static INLINE long lrintf(float f){
#include "j2k_lib.h"
#include "opj_malloc.h"
#include "event.h"
#include "bio.h"
#include "cio.h"
#include "image.h"

View File

@ -35,8 +35,8 @@
#include <stdlib.h>
#include <math.h>
#include "indexbox_manager.h"
#include "cio.h"
#include "opj_includes.h"
/*
* Write faix box of phix
@ -56,7 +56,7 @@ int write_phix( int coff, opj_codestream_info_t cstr_info, opj_bool EPHused, int
int len, lenp=0, compno, i;
opj_jp2_box_t *box;
box = (opj_jp2_box_t *)calloc( cstr_info.numcomps, sizeof(opj_jp2_box_t));
box = (opj_jp2_box_t *)opj_calloc( cstr_info.numcomps, sizeof(opj_jp2_box_t));
for( i=0;i<2;i++){
if (i) cio_seek( cio, lenp);
@ -78,7 +78,7 @@ int write_phix( int coff, opj_codestream_info_t cstr_info, opj_bool EPHused, int
cio_seek( cio, lenp+len);
}
free(box);
opj_free(box);
return len;
}

View File

@ -36,8 +36,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "indexbox_manager.h"
#include "cio.h"
#include "opj_includes.h"
/*
* Write faix box of ppix
@ -59,7 +58,7 @@ int write_ppix( int coff, opj_codestream_info_t cstr_info, opj_bool EPHused, int
// printf("cstr_info.packno %d\n", cstr_info.packno); //NMAX?
box = (opj_jp2_box_t *)calloc( cstr_info.numcomps, sizeof(opj_jp2_box_t));
box = (opj_jp2_box_t *)opj_calloc( cstr_info.numcomps, sizeof(opj_jp2_box_t));
for (i=0;i<2;i++){
if (i) cio_seek( cio, lenp);
@ -81,7 +80,7 @@ int write_ppix( int coff, opj_codestream_info_t cstr_info, opj_bool EPHused, int
cio_seek( cio, lenp+len);
}
free(box);
opj_free(box);
return len;
}

View File

@ -36,8 +36,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "indexbox_manager.h"
#include "cio.h"
#include "opj_includes.h"
/*
* Write tile-part headers mhix box
@ -57,7 +56,7 @@ int write_thix( int coff, opj_codestream_info_t cstr_info, opj_cio_t *cio)
opj_jp2_box_t *box;
lenp = 0;
box = (opj_jp2_box_t *)calloc( cstr_info.tw*cstr_info.th, sizeof(opj_jp2_box_t));
box = (opj_jp2_box_t *)opj_calloc( cstr_info.tw*cstr_info.th, sizeof(opj_jp2_box_t));
for ( i = 0; i < 2 ; i++ ){
if (i)
@ -79,7 +78,7 @@ int write_thix( int coff, opj_codestream_info_t cstr_info, opj_cio_t *cio)
cio_seek( cio, lenp+len);
}
free(box);
opj_free(box);
return len;
}

View File

@ -34,8 +34,7 @@
*/
#include <math.h>
#include "indexbox_manager.h"
#include "cio.h"
#include "opj_includes.h"
#define MAX(a,b) ((a)>(b)?(a):(b))