renamed getopt.{c/h} to opj_getopt.{c/h} and forced the use of these files rather than the system ones. This fixed issue 78. Credit to Winfried.
This commit is contained in:
parent
22a2f98ced
commit
aba0e602ed
3
CHANGES
3
CHANGES
@ -5,6 +5,9 @@ What's New for OpenJPEG
|
||||
! : changed
|
||||
+ : added
|
||||
|
||||
September 1st, 2011
|
||||
! [antonin] renamed getopt.{c/h} to opj_getopt.{c/h} and forced the use of these files rather than the system ones. This fixed issue 78. Credit to Winfried.
|
||||
|
||||
August 31, 2011
|
||||
* [mickael] fixed a segfault with fgets return value for some cases inside test function compare_dump_file()
|
||||
+ [mickael] enhance the encoding test suite and remove unsued CONFIGURE_FILE into a CMakeList
|
||||
|
@ -1,15 +0,0 @@
|
||||
# Check if getopt is present:
|
||||
INCLUDE (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
|
||||
SET(DONT_HAVE_GETOPT 1)
|
||||
IF(UNIX) #I am pretty sure only *nix sys have this anyway
|
||||
CHECK_INCLUDE_FILE("getopt.h" CMAKE_HAVE_GETOPT_H)
|
||||
# Seems like we need the contrary:
|
||||
IF(CMAKE_HAVE_GETOPT_H)
|
||||
SET(DONT_HAVE_GETOPT 0)
|
||||
ENDIF(CMAKE_HAVE_GETOPT_H)
|
||||
ENDIF(UNIX)
|
||||
|
||||
IF(DONT_HAVE_GETOPT)
|
||||
ADD_DEFINITIONS(-DDONT_HAVE_GETOPT)
|
||||
ENDIF(DONT_HAVE_GETOPT)
|
||||
|
@ -110,10 +110,6 @@ ENDIF(NOT OPENJPEG_INSTALL_PACKAGE_DIR)
|
||||
# Test for some required system information.
|
||||
INCLUDE (${CMAKE_ROOT}/Modules/CMakeBackwardCompatibilityC.cmake)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Test for getopt being available in this system
|
||||
INCLUDE (${OPENJPEG_SOURCE_DIR}/CMake/CheckHaveGetopt.cmake )
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Setup file for setting custom ctest vars
|
||||
CONFIGURE_FILE(
|
||||
|
@ -4,16 +4,9 @@
|
||||
SET(common_SRCS
|
||||
../codec/convert.c
|
||||
../codec/index.c
|
||||
../common/opj_getopt.c
|
||||
)
|
||||
|
||||
# If not getopt was found then add it to the lib:
|
||||
IF(DONT_HAVE_GETOPT)
|
||||
SET(common_SRCS
|
||||
${common_SRCS}
|
||||
../common/getopt.c
|
||||
)
|
||||
ENDIF(DONT_HAVE_GETOPT)
|
||||
|
||||
|
||||
# Headers file are located here:
|
||||
INCLUDE_DIRECTORIES(
|
||||
|
@ -37,7 +37,7 @@
|
||||
#include <math.h>
|
||||
|
||||
#include "openjpeg.h"
|
||||
#include "getopt.h"
|
||||
#include "opj_getopt.h"
|
||||
#include "convert.h"
|
||||
#include "index.h"
|
||||
#include "dirent.h"
|
||||
@ -492,7 +492,7 @@ void cinema_setup_encoder(opj_cparameters_t *parameters,opj_image_t *image, img_
|
||||
int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||
img_fol_t *img_fol, char *indexfilename) {
|
||||
int i, j,totlen;
|
||||
option_t long_option[]={
|
||||
opj_option_t long_option[]={
|
||||
{"cinema2K",REQ_ARG, NULL ,'w'},
|
||||
{"cinema4K",NO_ARG, NULL ,'y'},
|
||||
{"ImgDir",REQ_ARG, NULL ,'z'},
|
||||
@ -523,7 +523,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||
reset_options_reading();
|
||||
|
||||
while (1) {
|
||||
int c = getopt_long(argc, argv, optlist,long_option,totlen);
|
||||
int c = opj_getopt_long(argc, argv, optlist,long_option,totlen);
|
||||
if (c == -1)
|
||||
break;
|
||||
switch (c) {
|
||||
@ -532,7 +532,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||
|
||||
case 'o': /* output file */
|
||||
{
|
||||
char *outfile = optarg;
|
||||
char *outfile = opj_optarg;
|
||||
parameters->cod_format = get_file_format(outfile);
|
||||
switch(parameters->cod_format) {
|
||||
case J2K_CFMT:
|
||||
@ -550,14 +550,14 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||
case 'O': /* output format */
|
||||
{
|
||||
char outformat[50];
|
||||
char *of = optarg;
|
||||
char *of = opj_optarg;
|
||||
sprintf(outformat,".%s",of);
|
||||
img_fol->set_out_format = 1;
|
||||
parameters->cod_format = get_file_format(outformat);
|
||||
switch(parameters->cod_format) {
|
||||
case J2K_CFMT:
|
||||
case JP2_CFMT:
|
||||
img_fol->out_format = optarg;
|
||||
img_fol->out_format = opj_optarg;
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "Unknown output format image [only j2k, j2c, jp2]!! \n");
|
||||
@ -572,7 +572,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||
|
||||
case 'r': /* rates rates/distorsion */
|
||||
{
|
||||
char *s = optarg;
|
||||
char *s = opj_optarg;
|
||||
while (sscanf(s, "%f", ¶meters->tcp_rates[parameters->tcp_numlayers]) == 1) {
|
||||
parameters->tcp_numlayers++;
|
||||
while (*s && *s != ',') {
|
||||
@ -590,7 +590,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||
|
||||
case 'q': /* add fixed_quality */
|
||||
{
|
||||
char *s = optarg;
|
||||
char *s = opj_optarg;
|
||||
while (sscanf(s, "%f", ¶meters->tcp_distoratio[parameters->tcp_numlayers]) == 1) {
|
||||
parameters->tcp_numlayers++;
|
||||
while (*s && *s != ',') {
|
||||
@ -612,7 +612,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||
int *row = NULL, *col = NULL;
|
||||
int numlayers = 0, numresolution = 0, matrix_width = 0;
|
||||
|
||||
char *s = optarg;
|
||||
char *s = opj_optarg;
|
||||
sscanf(s, "%d", &numlayers);
|
||||
s++;
|
||||
if (numlayers > 9)
|
||||
@ -656,7 +656,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||
|
||||
case 't': /* tiles */
|
||||
{
|
||||
sscanf(optarg, "%d,%d", ¶meters->cp_tdx, ¶meters->cp_tdy);
|
||||
sscanf(opj_optarg, "%d,%d", ¶meters->cp_tdx, ¶meters->cp_tdy);
|
||||
parameters->tile_size_on = true;
|
||||
}
|
||||
break;
|
||||
@ -665,7 +665,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||
|
||||
case 'n': /* resolution */
|
||||
{
|
||||
sscanf(optarg, "%d", ¶meters->numresolution);
|
||||
sscanf(opj_optarg, "%d", ¶meters->numresolution);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -675,7 +675,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||
char sep;
|
||||
int res_spec = 0;
|
||||
|
||||
char *s = optarg;
|
||||
char *s = opj_optarg;
|
||||
do {
|
||||
sep = 0;
|
||||
sscanf(s, "[%d,%d]%c", ¶meters->prcw_init[res_spec],
|
||||
@ -694,7 +694,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||
case 'b': /* code-block dimension */
|
||||
{
|
||||
int cblockw_init = 0, cblockh_init = 0;
|
||||
sscanf(optarg, "%d,%d", &cblockw_init, &cblockh_init);
|
||||
sscanf(opj_optarg, "%d,%d", &cblockw_init, &cblockh_init);
|
||||
if (cblockw_init * cblockh_init > 4096 || cblockw_init > 1024
|
||||
|| cblockw_init < 4 || cblockh_init > 1024 || cblockh_init < 4) {
|
||||
fprintf(stderr,
|
||||
@ -711,7 +711,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||
|
||||
case 'x': /* creation of index file */
|
||||
{
|
||||
char *index = optarg;
|
||||
char *index = opj_optarg;
|
||||
strncpy(indexfilename, index, OPJ_PATH_LEN);
|
||||
}
|
||||
break;
|
||||
@ -722,7 +722,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||
{
|
||||
char progression[4];
|
||||
|
||||
strncpy(progression, optarg, 4);
|
||||
strncpy(progression, opj_optarg, 4);
|
||||
parameters->prog_order = give_progression(progression);
|
||||
if (parameters->prog_order == -1) {
|
||||
fprintf(stderr, "Unrecognized progression order "
|
||||
@ -736,7 +736,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||
|
||||
case 's': /* subsampling factor */
|
||||
{
|
||||
if (sscanf(optarg, "%d,%d", ¶meters->subsampling_dx,
|
||||
if (sscanf(opj_optarg, "%d,%d", ¶meters->subsampling_dx,
|
||||
¶meters->subsampling_dy) != 2) {
|
||||
fprintf(stderr, "'-s' sub-sampling argument error ! [-s dx,dy]\n");
|
||||
return 1;
|
||||
@ -748,7 +748,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||
|
||||
case 'd': /* coordonnate of the reference grid */
|
||||
{
|
||||
if (sscanf(optarg, "%d,%d", ¶meters->image_offset_x0,
|
||||
if (sscanf(opj_optarg, "%d,%d", ¶meters->image_offset_x0,
|
||||
¶meters->image_offset_y0) != 2) {
|
||||
fprintf(stderr, "-d 'coordonnate of the reference grid' argument "
|
||||
"error !! [-d x0,y0]\n");
|
||||
@ -770,7 +770,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||
int numpocs = 0; /* number of progression order change (POC) default 0 */
|
||||
opj_poc_t *POC = NULL; /* POC : used in case of Progression order change */
|
||||
|
||||
char *s = optarg;
|
||||
char *s = opj_optarg;
|
||||
POC = parameters->POC;
|
||||
|
||||
while (sscanf(s, "T%d=%d,%d,%d,%d,%d,%4s", &POC[numpocs].tile,
|
||||
@ -812,7 +812,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||
case 'M': /* Mode switch pas tous au point !! */
|
||||
{
|
||||
int value = 0;
|
||||
if (sscanf(optarg, "%d", &value) == 1) {
|
||||
if (sscanf(opj_optarg, "%d", &value) == 1) {
|
||||
for (i = 0; i <= 5; i++) {
|
||||
int cache = value & (1 << i);
|
||||
if (cache)
|
||||
@ -826,7 +826,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||
|
||||
case 'R': /* ROI */
|
||||
{
|
||||
if (sscanf(optarg, "c=%d,U=%d", ¶meters->roi_compno,
|
||||
if (sscanf(opj_optarg, "c=%d,U=%d", ¶meters->roi_compno,
|
||||
¶meters->roi_shift) != 2) {
|
||||
fprintf(stderr, "ROI error !! [-ROI c='compno',U='shift']\n");
|
||||
return 1;
|
||||
@ -838,7 +838,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||
|
||||
case 'T': /* Tile offset */
|
||||
{
|
||||
if (sscanf(optarg, "%d,%d", ¶meters->cp_tx0, ¶meters->cp_ty0) != 2) {
|
||||
if (sscanf(opj_optarg, "%d,%d", ¶meters->cp_tx0, ¶meters->cp_ty0) != 2) {
|
||||
fprintf(stderr, "-T 'tile offset' argument error !! [-T X0,Y0]");
|
||||
return 1;
|
||||
}
|
||||
@ -849,9 +849,9 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||
|
||||
case 'C': /* add a comment */
|
||||
{
|
||||
parameters->cp_comment = (char*)malloc(strlen(optarg) + 1);
|
||||
parameters->cp_comment = (char*)malloc(strlen(opj_optarg) + 1);
|
||||
if(parameters->cp_comment) {
|
||||
strcpy(parameters->cp_comment, optarg);
|
||||
strcpy(parameters->cp_comment, opj_optarg);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -869,7 +869,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||
|
||||
case 'v': /* Tile part generation*/
|
||||
{
|
||||
parameters->tp_flag = optarg[0];
|
||||
parameters->tp_flag = opj_optarg[0];
|
||||
parameters->tp_on = 1;
|
||||
}
|
||||
break;
|
||||
@ -878,8 +878,8 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||
|
||||
case 'z': /* Image Directory path */
|
||||
{
|
||||
img_fol->imgdirpath = (char*)malloc(strlen(optarg) + 1);
|
||||
strcpy(img_fol->imgdirpath,optarg);
|
||||
img_fol->imgdirpath = (char*)malloc(strlen(opj_optarg) + 1);
|
||||
strcpy(img_fol->imgdirpath,opj_optarg);
|
||||
img_fol->set_imgdir=1;
|
||||
}
|
||||
break;
|
||||
@ -889,7 +889,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||
case 'w': /* Digital Cinema 2K profile compliance*/
|
||||
{
|
||||
int fps=0;
|
||||
sscanf(optarg,"%d",&fps);
|
||||
sscanf(opj_optarg,"%d",&fps);
|
||||
if(fps == 24){
|
||||
parameters->cp_cinema = CINEMA2K_24;
|
||||
}else if(fps == 48 ){
|
||||
@ -933,7 +933,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||
/* search for different protection methods */
|
||||
|
||||
/* break the option in comma points and parse the result */
|
||||
token = strtok(optarg, ",");
|
||||
token = strtok(opj_optarg, ",");
|
||||
while(token != NULL) {
|
||||
|
||||
/* search header error protection method */
|
||||
|
@ -37,7 +37,7 @@
|
||||
#include <math.h>
|
||||
|
||||
#include "openjpeg.h"
|
||||
#include "getopt.h"
|
||||
#include "opj_getopt.h"
|
||||
#include "convert.h"
|
||||
#include "dirent.h"
|
||||
#include "org_openJpeg_OpenJPEGJavaDecoder.h"
|
||||
@ -206,7 +206,7 @@ int get_file_format(char *filename) {
|
||||
int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,img_fol_t *img_fol) {
|
||||
/* parse the command line */
|
||||
int totlen;
|
||||
option_t long_option[]={
|
||||
opj_option_t long_option[]={
|
||||
{"ImgDir",REQ_ARG, NULL ,'y'},
|
||||
{"OutFor",REQ_ARG, NULL ,'O'},
|
||||
};
|
||||
@ -229,13 +229,13 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
||||
reset_options_reading();
|
||||
|
||||
while (1) {
|
||||
int c = getopt_long(argc, argv,optlist,long_option,totlen);
|
||||
int c = opj_getopt_long(argc, argv,optlist,long_option,totlen);
|
||||
if (c == -1)
|
||||
break;
|
||||
switch (c) {
|
||||
case 'i': /* input file */
|
||||
{
|
||||
char *infile = optarg;
|
||||
char *infile = opj_optarg;
|
||||
parameters->decod_format = get_file_format(infile);
|
||||
switch(parameters->decod_format) {
|
||||
case J2K_CFMT:
|
||||
@ -256,7 +256,7 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
||||
|
||||
case 'o': /* output file */
|
||||
{
|
||||
char *outfile = optarg;
|
||||
char *outfile = opj_optarg;
|
||||
parameters->cod_format = get_file_format(outfile);
|
||||
switch(parameters->cod_format) {
|
||||
case PGX_DFMT:
|
||||
@ -279,7 +279,7 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
||||
case 'O': /* output format */
|
||||
{
|
||||
char outformat[50];
|
||||
char *of = optarg;
|
||||
char *of = opj_optarg;
|
||||
sprintf(outformat,".%s",of);
|
||||
img_fol->set_out_format = 1;
|
||||
parameters->cod_format = get_file_format(outformat);
|
||||
@ -315,7 +315,7 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
||||
|
||||
case 'r': /* reduce option */
|
||||
{
|
||||
sscanf(optarg, "%d", ¶meters->cp_reduce);
|
||||
sscanf(opj_optarg, "%d", ¶meters->cp_reduce);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -324,7 +324,7 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
||||
|
||||
case 'l': /* layering option */
|
||||
{
|
||||
sscanf(optarg, "%d", ¶meters->cp_layer);
|
||||
sscanf(opj_optarg, "%d", ¶meters->cp_layer);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -338,8 +338,8 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
||||
|
||||
case 'y': /* Image Directory path */
|
||||
{
|
||||
img_fol->imgdirpath = (char*)malloc(strlen(optarg) + 1);
|
||||
strcpy(img_fol->imgdirpath,optarg);
|
||||
img_fol->imgdirpath = (char*)malloc(strlen(opj_optarg) + 1);
|
||||
strcpy(img_fol->imgdirpath,opj_optarg);
|
||||
img_fol->set_imgdir=1;
|
||||
}
|
||||
break;
|
||||
@ -351,7 +351,7 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
||||
{
|
||||
char *token = NULL;
|
||||
|
||||
token = strtok(optarg, ",");
|
||||
token = strtok(opj_optarg, ",");
|
||||
while(token != NULL) {
|
||||
|
||||
/* search expected number of components */
|
||||
@ -418,7 +418,7 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
||||
/* ----------------------------------------------------- */
|
||||
|
||||
default:
|
||||
fprintf(stderr,"WARNING -> this option is not valid \"-%c %s\"\n",c, optarg);
|
||||
fprintf(stderr,"WARNING -> this option is not valid \"-%c %s\"\n",c, opj_optarg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -5,10 +5,10 @@ CFLAGS = -O3 -lstdc++ # -g -p -pg
|
||||
all: j2k_to_image image_to_j2k
|
||||
|
||||
j2k_to_image: j2k_to_image.c ../libopenjpeg.a
|
||||
gcc $(CFLAGS) ../common/getopt.c convert.c j2k_to_image.c -o j2k_to_image -L.. -lopenjpeg -I ../libopenjpeg/ -lm -ltiff
|
||||
gcc $(CFLAGS) ../common/opj_getopt.c convert.c j2k_to_image.c -o j2k_to_image -L.. -lopenjpeg -I ../libopenjpeg/ -lm -ltiff
|
||||
|
||||
image_to_j2k: image_to_j2k.c ../libopenjpeg.a
|
||||
gcc $(CFLAGS) ../common/getopt.c convert.c image_to_j2k.c -o image_to_j2k -L.. -lopenjpeg -I ../libopenjpeg/ -lm -ltiff
|
||||
gcc $(CFLAGS) ../common/opj_getopt.c convert.c image_to_j2k.c -o image_to_j2k -L.. -lopenjpeg -I ../libopenjpeg/ -lm -ltiff
|
||||
|
||||
clean:
|
||||
rm -f j2k_to_image image_to_j2k
|
||||
|
@ -15,5 +15,5 @@ CMakeLists.txt \
|
||||
common/color.c \
|
||||
common/color.h \
|
||||
common/format_defs.h \
|
||||
common/getopt.c \
|
||||
common/getopt.h
|
||||
common/opj_getopt.c \
|
||||
common/opj_getopt.h
|
||||
|
@ -5,15 +5,8 @@ SET(common_SRCS
|
||||
convert.c
|
||||
index.c
|
||||
${OPENJPEG_SOURCE_DIR}/applications/common/color.c
|
||||
)
|
||||
|
||||
# If not getopt was found then add it to the lib:
|
||||
IF(DONT_HAVE_GETOPT)
|
||||
SET(common_SRCS
|
||||
${common_SRCS}
|
||||
${OPENJPEG_SOURCE_DIR}/applications/common/getopt.c
|
||||
${OPENJPEG_SOURCE_DIR}/applications/common/opj_getopt.c
|
||||
)
|
||||
ENDIF(DONT_HAVE_GETOPT)
|
||||
|
||||
# Headers file are located here:
|
||||
INCLUDE_DIRECTORIES(
|
||||
|
@ -22,7 +22,7 @@ j2k_to_image_CFLAGS =
|
||||
j2k_to_image_LDADD = $(top_builddir)/libopenjpeg/libopenjpeg.la @LCMS1_LIBS@ @LCMS2_LIBS@ @TIFF_LIBS@ @PNG_LIBS@ -lm
|
||||
j2k_to_image_SOURCES = \
|
||||
../common/color.c \
|
||||
../common/getopt.c \
|
||||
../common/opj_getopt.c \
|
||||
convert.c \
|
||||
index.c \
|
||||
j2k_to_image.c \
|
||||
@ -41,7 +41,7 @@ image_to_j2k_CPPFLAGS = \
|
||||
image_to_j2k_CFLAGS =
|
||||
image_to_j2k_LDADD = $(top_builddir)/libopenjpeg/libopenjpeg.la @TIFF_LIBS@ @PNG_LIBS@ -lm
|
||||
image_to_j2k_SOURCES = \
|
||||
../common/getopt.c \
|
||||
../common/opj_getopt.c \
|
||||
convert.c \
|
||||
index.c \
|
||||
image_to_j2k.c \
|
||||
@ -60,10 +60,10 @@ j2k_dump_CPPFLAGS = \
|
||||
j2k_dump_CFLAGS =
|
||||
j2k_dump_LDADD = $(top_builddir)/libopenjpeg/libopenjpeg.la -lm
|
||||
j2k_dump_SOURCES = \
|
||||
../common/getopt.c \
|
||||
../common/opj_getopt.c \
|
||||
index.c \
|
||||
j2k_dump.c \
|
||||
../common/getopt.h \
|
||||
../common/opj_getopt.h \
|
||||
index.h
|
||||
|
||||
JPWL_j2k_to_image_CPPFLAGS = \
|
||||
@ -81,7 +81,7 @@ JPWL_j2k_to_image_CFLAGS =
|
||||
JPWL_j2k_to_image_LDADD = $(top_builddir)/libopenjpeg/jpwl/libopenjpeg_JPWL.la @LCMS1_LIBS@ @LCMS2_LIBS@ @TIFF_LIBS@ @PNG_LIBS@
|
||||
JPWL_j2k_to_image_SOURCES = \
|
||||
../common/color.c \
|
||||
../common/getopt.c \
|
||||
../common/opj_getopt.c \
|
||||
index.c \
|
||||
convert.c \
|
||||
j2k_to_image.c
|
||||
@ -99,7 +99,7 @@ JPWL_image_to_j2k_CFLAGS =
|
||||
JPWL_image_to_j2k_LDADD = $(top_builddir)/libopenjpeg/jpwl/libopenjpeg_JPWL.la @TIFF_LIBS@ @PNG_LIBS@
|
||||
|
||||
JPWL_image_to_j2k_SOURCES = \
|
||||
../common/getopt.c \
|
||||
../common/opj_getopt.c \
|
||||
index.c \
|
||||
convert.c \
|
||||
image_to_j2k.c
|
||||
|
@ -67,9 +67,9 @@ static int int_floorlog2(int a) {
|
||||
|
||||
<<-- <<-- <<-- <<-- */
|
||||
|
||||
#ifdef INFORMATION_ONLY
|
||||
// TGA header definition.
|
||||
#pragma pack(push,1) // Pack structure byte aligned
|
||||
typedef struct tga_header
|
||||
struct tga_header
|
||||
{
|
||||
unsigned char id_length; /* Image id field length */
|
||||
unsigned char colour_map_type; /* Colour map type */
|
||||
@ -89,35 +89,66 @@ typedef struct tga_header
|
||||
unsigned short image_height; /* Image height */
|
||||
unsigned char pixel_depth; /* Pixel depth */
|
||||
unsigned char image_desc; /* Image descriptor */
|
||||
} tga_header;
|
||||
#pragma pack(pop) // Return to normal structure packing alignment.
|
||||
};
|
||||
#endif /* INFORMATION_ONLY */
|
||||
|
||||
static unsigned short get_ushort(unsigned short val) {
|
||||
|
||||
#ifdef ORDER_BIGENDIAN
|
||||
return( ((val & 0xff) << 8) + (val >> 8) );
|
||||
#else
|
||||
return( val );
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#define TGA_HEADER_SIZE 18
|
||||
|
||||
int tga_readheader(FILE *fp, unsigned int *bits_per_pixel,
|
||||
unsigned int *width, unsigned int *height, int *flip_image)
|
||||
{
|
||||
int palette_size;
|
||||
tga_header tga ;
|
||||
unsigned char *tga ;
|
||||
unsigned char id_len, cmap_type, image_type;
|
||||
unsigned char pixel_depth, image_desc;
|
||||
unsigned short cmap_index, cmap_len, cmap_entry_size;
|
||||
unsigned short x_origin, y_origin, image_w, image_h;
|
||||
|
||||
if (!bits_per_pixel || !width || !height || !flip_image)
|
||||
return 0;
|
||||
|
||||
// Read TGA header
|
||||
if ( fread((unsigned char*)&tga, sizeof(tga_header), 1, fp) != 1 )
|
||||
tga = (unsigned char*)malloc(18);
|
||||
|
||||
if ( fread(tga, TGA_HEADER_SIZE, 1, fp) != 1 )
|
||||
{
|
||||
fprintf(stderr, "\nError: fread return a number of element different from the expected.\n");
|
||||
return 0 ;
|
||||
}
|
||||
id_len = (unsigned char)tga[0];
|
||||
cmap_type = (unsigned char)tga[1];
|
||||
image_type = (unsigned char)tga[2];
|
||||
cmap_index = get_ushort(*(unsigned short*)(&tga[3]));
|
||||
cmap_len = get_ushort(*(unsigned short*)(&tga[5]));
|
||||
cmap_entry_size = (unsigned char)tga[7];
|
||||
|
||||
*bits_per_pixel = tga.pixel_depth;
|
||||
|
||||
*width = tga.image_width;
|
||||
*height = tga.image_height ;
|
||||
|
||||
x_origin = get_ushort(*(unsigned short*)(&tga[8]));
|
||||
y_origin = get_ushort(*(unsigned short*)(&tga[10]));
|
||||
image_w = get_ushort(*(unsigned short*)(&tga[12]));
|
||||
image_h = get_ushort(*(unsigned short*)(&tga[14]));
|
||||
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;
|
||||
|
||||
// Ignore tga identifier, if present ...
|
||||
if (tga.id_length)
|
||||
if (id_len)
|
||||
{
|
||||
unsigned char *id = (unsigned char *) malloc(tga.id_length);
|
||||
if ( !fread(id, tga.id_length, 1, fp) )
|
||||
unsigned char *id = (unsigned char *) malloc(id_len);
|
||||
if ( !fread(id, id_len, 1, fp) )
|
||||
{
|
||||
fprintf(stderr, "\nError: fread return a number of element different from the expected.\n");
|
||||
free(id);
|
||||
@ -129,16 +160,16 @@ int tga_readheader(FILE *fp, unsigned int *bits_per_pixel,
|
||||
// Test for compressed formats ... not yet supported ...
|
||||
// Note :- 9 - RLE encoded palettized.
|
||||
// 10 - RLE encoded RGB.
|
||||
if (tga.image_type > 8)
|
||||
if (image_type > 8)
|
||||
{
|
||||
fprintf(stderr, "Sorry, compressed tga files are not currently supported.\n");
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
*flip_image = !(tga.image_desc & 32);
|
||||
*flip_image = !(image_desc & 32);
|
||||
|
||||
// Palettized formats are not yet supported, skip over the palette, if present ...
|
||||
palette_size = tga.colour_map_length * (tga.colour_map_entry_size/8);
|
||||
palette_size = cmap_len * (cmap_entry_size/8);
|
||||
|
||||
if (palette_size>0)
|
||||
{
|
||||
@ -151,31 +182,56 @@ int tga_readheader(FILE *fp, unsigned int *bits_per_pixel,
|
||||
int tga_writeheader(FILE *fp, int bits_per_pixel, int width, int height,
|
||||
opj_bool flip_image)
|
||||
{
|
||||
tga_header tga;
|
||||
unsigned short image_w, image_h, us0;
|
||||
unsigned char uc0, image_type;
|
||||
unsigned char pixel_depth, image_desc;
|
||||
|
||||
if (!bits_per_pixel || !width || !height)
|
||||
return 0;
|
||||
|
||||
memset(&tga, 0, sizeof(tga_header));
|
||||
pixel_depth = 0;
|
||||
|
||||
if ( bits_per_pixel < 256 )
|
||||
tga.pixel_depth = (unsigned char)bits_per_pixel;
|
||||
pixel_depth = (unsigned char)bits_per_pixel;
|
||||
else{
|
||||
fprintf(stderr,"ERROR: Wrong bits per pixel inside tga_header");
|
||||
return 0;
|
||||
}
|
||||
tga.image_width = (unsigned short)width;
|
||||
tga.image_height = (unsigned short)height;
|
||||
tga.image_type = 2; // Uncompressed.
|
||||
tga.image_desc = 8; // 8 bits per component.
|
||||
uc0 = 0;
|
||||
|
||||
if(fwrite(&uc0, 1, 1, fp) != 1) goto fails; // id_length
|
||||
if(fwrite(&uc0, 1, 1, fp) != 1) goto fails; // colour_map_type
|
||||
|
||||
image_type = 2; // Uncompressed.
|
||||
if(fwrite(&image_type, 1, 1, fp) != 1) goto fails;
|
||||
|
||||
us0 = 0;
|
||||
if(fwrite(&us0, 2, 1, fp) != 1) goto fails; // colour_map_index
|
||||
if(fwrite(&us0, 2, 1, fp) != 1) goto fails; // colour_map_length
|
||||
if(fwrite(&uc0, 1, 1, fp) != 1) goto fails; // colour_map_entry_size
|
||||
|
||||
if(fwrite(&us0, 2, 1, fp) != 1) goto fails; // x_origin
|
||||
if(fwrite(&us0, 2, 1, fp) != 1) goto fails; // y_origin
|
||||
|
||||
image_w = (unsigned short)width;
|
||||
image_h = (unsigned short) height;
|
||||
|
||||
if(fwrite(&image_w, 2, 1, fp) != 1) goto fails;
|
||||
if(fwrite(&image_h, 2, 1, fp) != 1) goto fails;
|
||||
|
||||
if(fwrite(&pixel_depth, 1, 1, fp) != 1) goto fails;
|
||||
|
||||
image_desc = 8; // 8 bits per component.
|
||||
|
||||
if (flip_image)
|
||||
tga.image_desc |= 32;
|
||||
|
||||
// Write TGA header
|
||||
fwrite((unsigned char*)&tga, sizeof(tga_header), 1, fp);
|
||||
image_desc |= 32;
|
||||
if(fwrite(&image_desc, 1, 1, fp) != 1) goto fails;
|
||||
|
||||
return 1;
|
||||
|
||||
fails:
|
||||
fputs("\nwrite_tgaheader: write ERROR\n", stderr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
opj_image_t* tgatoimage(const char *filename, opj_cparameters_t *parameters) {
|
||||
|
@ -51,7 +51,7 @@
|
||||
|
||||
#include "opj_config.h"
|
||||
#include "openjpeg.h"
|
||||
#include "getopt.h"
|
||||
#include "opj_getopt.h"
|
||||
#include "convert.h"
|
||||
#include "index.h"
|
||||
|
||||
@ -574,7 +574,7 @@ void cinema_setup_encoder(opj_cparameters_t *parameters,opj_image_t *image, img_
|
||||
int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||
img_fol_t *img_fol, raw_cparameters_t *raw_cp, char *indexfilename) {
|
||||
int i, j, totlen, c;
|
||||
option_t long_option[]={
|
||||
opj_option_t long_option[]={
|
||||
{"cinema2K",REQ_ARG, NULL ,'w'},
|
||||
{"cinema4K",NO_ARG, NULL ,'y'},
|
||||
{"ImgDir",REQ_ARG, NULL ,'z'},
|
||||
@ -598,13 +598,13 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||
raw_cp->rawWidth = 0;
|
||||
|
||||
do{
|
||||
c = getopt_long(argc, argv, optlist,long_option,totlen);
|
||||
c = opj_getopt_long(argc, argv, optlist,long_option,totlen);
|
||||
if (c == -1)
|
||||
break;
|
||||
switch (c) {
|
||||
case 'i': /* input file */
|
||||
{
|
||||
char *infile = optarg;
|
||||
char *infile = opj_optarg;
|
||||
parameters->decod_format = get_file_format(infile);
|
||||
switch(parameters->decod_format) {
|
||||
case PGX_DFMT:
|
||||
@ -630,7 +630,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||
|
||||
case 'o': /* output file */
|
||||
{
|
||||
char *outfile = optarg;
|
||||
char *outfile = opj_optarg;
|
||||
parameters->cod_format = get_file_format(outfile);
|
||||
switch(parameters->cod_format) {
|
||||
case J2K_CFMT:
|
||||
@ -648,14 +648,14 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||
case 'O': /* output format */
|
||||
{
|
||||
char outformat[50];
|
||||
char *of = optarg;
|
||||
char *of = opj_optarg;
|
||||
sprintf(outformat,".%s",of);
|
||||
img_fol->set_out_format = 1;
|
||||
parameters->cod_format = get_file_format(outformat);
|
||||
switch(parameters->cod_format) {
|
||||
case J2K_CFMT:
|
||||
case JP2_CFMT:
|
||||
img_fol->out_format = optarg;
|
||||
img_fol->out_format = opj_optarg;
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "Unknown output format image [only j2k, j2c, jp2]!! \n");
|
||||
@ -670,7 +670,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||
|
||||
case 'r': /* rates rates/distorsion */
|
||||
{
|
||||
char *s = optarg;
|
||||
char *s = opj_optarg;
|
||||
parameters->tcp_numlayers = 0;
|
||||
while (sscanf(s, "%f", ¶meters->tcp_rates[parameters->tcp_numlayers]) == 1) {
|
||||
parameters->tcp_numlayers++;
|
||||
@ -691,7 +691,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||
case 'F': /* Raw image format parameters */
|
||||
{
|
||||
char signo;
|
||||
char *s = optarg;
|
||||
char *s = opj_optarg;
|
||||
if (sscanf(s, "%d,%d,%d,%d,%c", &raw_cp->rawWidth, &raw_cp->rawHeight, &raw_cp->rawComp, &raw_cp->rawBitDepth, &signo) == 5) {
|
||||
if (signo == 's') {
|
||||
raw_cp->rawSigned = OPJ_TRUE;
|
||||
@ -724,7 +724,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||
|
||||
case 'q': /* add fixed_quality */
|
||||
{
|
||||
char *s = optarg;
|
||||
char *s = opj_optarg;
|
||||
while (sscanf(s, "%f", ¶meters->tcp_distoratio[parameters->tcp_numlayers]) == 1) {
|
||||
parameters->tcp_numlayers++;
|
||||
while (*s && *s != ',') {
|
||||
@ -746,7 +746,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||
int *row = NULL, *col = NULL;
|
||||
int numlayers = 0, numresolution = 0, matrix_width = 0;
|
||||
|
||||
char *s = optarg;
|
||||
char *s = opj_optarg;
|
||||
sscanf(s, "%d", &numlayers);
|
||||
s++;
|
||||
if (numlayers > 9)
|
||||
@ -790,7 +790,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||
|
||||
case 't': /* tiles */
|
||||
{
|
||||
sscanf(optarg, "%d,%d", ¶meters->cp_tdx, ¶meters->cp_tdy);
|
||||
sscanf(opj_optarg, "%d,%d", ¶meters->cp_tdx, ¶meters->cp_tdy);
|
||||
parameters->tile_size_on = OPJ_TRUE;
|
||||
}
|
||||
break;
|
||||
@ -799,7 +799,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||
|
||||
case 'n': /* resolution */
|
||||
{
|
||||
sscanf(optarg, "%d", ¶meters->numresolution);
|
||||
sscanf(opj_optarg, "%d", ¶meters->numresolution);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -809,7 +809,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||
char sep;
|
||||
int res_spec = 0;
|
||||
|
||||
char *s = optarg;
|
||||
char *s = opj_optarg;
|
||||
do {
|
||||
sep = 0;
|
||||
sscanf(s, "[%d,%d]%c", ¶meters->prcw_init[res_spec],
|
||||
@ -828,7 +828,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||
case 'b': /* code-block dimension */
|
||||
{
|
||||
int cblockw_init = 0, cblockh_init = 0;
|
||||
sscanf(optarg, "%d,%d", &cblockw_init, &cblockh_init);
|
||||
sscanf(opj_optarg, "%d,%d", &cblockw_init, &cblockh_init);
|
||||
if (cblockw_init * cblockh_init > 4096 || cblockw_init > 1024
|
||||
|| cblockw_init < 4 || cblockh_init > 1024 || cblockh_init < 4) {
|
||||
fprintf(stderr,
|
||||
@ -845,7 +845,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||
|
||||
case 'x': /* creation of index file */
|
||||
{
|
||||
char *index = optarg;
|
||||
char *index = opj_optarg;
|
||||
strncpy(indexfilename, index, OPJ_PATH_LEN);
|
||||
}
|
||||
break;
|
||||
@ -856,7 +856,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||
{
|
||||
char progression[4];
|
||||
|
||||
strncpy(progression, optarg, 4);
|
||||
strncpy(progression, opj_optarg, 4);
|
||||
parameters->prog_order = give_progression(progression);
|
||||
if (parameters->prog_order == -1) {
|
||||
fprintf(stderr, "Unrecognized progression order "
|
||||
@ -870,7 +870,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||
|
||||
case 's': /* subsampling factor */
|
||||
{
|
||||
if (sscanf(optarg, "%d,%d", ¶meters->subsampling_dx,
|
||||
if (sscanf(opj_optarg, "%d,%d", ¶meters->subsampling_dx,
|
||||
¶meters->subsampling_dy) != 2) {
|
||||
fprintf(stderr, "'-s' sub-sampling argument error ! [-s dx,dy]\n");
|
||||
return 1;
|
||||
@ -882,7 +882,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||
|
||||
case 'd': /* coordonnate of the reference grid */
|
||||
{
|
||||
if (sscanf(optarg, "%d,%d", ¶meters->image_offset_x0,
|
||||
if (sscanf(opj_optarg, "%d,%d", ¶meters->image_offset_x0,
|
||||
¶meters->image_offset_y0) != 2) {
|
||||
fprintf(stderr, "-d 'coordonnate of the reference grid' argument "
|
||||
"error !! [-d x0,y0]\n");
|
||||
@ -904,7 +904,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||
int numpocs = 0; /* number of progression order change (POC) default 0 */
|
||||
opj_poc_t *POC = NULL; /* POC : used in case of Progression order change */
|
||||
|
||||
char *s = optarg;
|
||||
char *s = opj_optarg;
|
||||
POC = parameters->POC;
|
||||
|
||||
while (sscanf(s, "T%d=%d,%d,%d,%d,%d,%4s", &POC[numpocs].tile,
|
||||
@ -946,7 +946,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||
case 'M': /* Mode switch pas tous au point !! */
|
||||
{
|
||||
int value = 0;
|
||||
if (sscanf(optarg, "%d", &value) == 1) {
|
||||
if (sscanf(opj_optarg, "%d", &value) == 1) {
|
||||
for (i = 0; i <= 5; i++) {
|
||||
int cache = value & (1 << i);
|
||||
if (cache)
|
||||
@ -960,7 +960,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||
|
||||
case 'R': /* ROI */
|
||||
{
|
||||
if (sscanf(optarg, "c=%d,U=%d", ¶meters->roi_compno,
|
||||
if (sscanf(opj_optarg, "c=%d,U=%d", ¶meters->roi_compno,
|
||||
¶meters->roi_shift) != 2) {
|
||||
fprintf(stderr, "ROI error !! [-ROI c='compno',U='shift']\n");
|
||||
return 1;
|
||||
@ -972,7 +972,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||
|
||||
case 'T': /* Tile offset */
|
||||
{
|
||||
if (sscanf(optarg, "%d,%d", ¶meters->cp_tx0, ¶meters->cp_ty0) != 2) {
|
||||
if (sscanf(opj_optarg, "%d,%d", ¶meters->cp_tx0, ¶meters->cp_ty0) != 2) {
|
||||
fprintf(stderr, "-T 'tile offset' argument error !! [-T X0,Y0]");
|
||||
return 1;
|
||||
}
|
||||
@ -983,9 +983,9 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||
|
||||
case 'C': /* add a comment */
|
||||
{
|
||||
parameters->cp_comment = (char*)malloc(strlen(optarg) + 1);
|
||||
parameters->cp_comment = (char*)malloc(strlen(opj_optarg) + 1);
|
||||
if(parameters->cp_comment) {
|
||||
strcpy(parameters->cp_comment, optarg);
|
||||
strcpy(parameters->cp_comment, opj_optarg);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -1003,7 +1003,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||
|
||||
case 'v': /* Tile part generation*/
|
||||
{
|
||||
parameters->tp_flag = optarg[0];
|
||||
parameters->tp_flag = opj_optarg[0];
|
||||
parameters->tp_on = 1;
|
||||
}
|
||||
break;
|
||||
@ -1012,8 +1012,8 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||
|
||||
case 'z': /* Image Directory path */
|
||||
{
|
||||
img_fol->imgdirpath = (char*)malloc(strlen(optarg) + 1);
|
||||
strcpy(img_fol->imgdirpath,optarg);
|
||||
img_fol->imgdirpath = (char*)malloc(strlen(opj_optarg) + 1);
|
||||
strcpy(img_fol->imgdirpath,opj_optarg);
|
||||
img_fol->set_imgdir=1;
|
||||
}
|
||||
break;
|
||||
@ -1023,7 +1023,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||
case 'w': /* Digital Cinema 2K profile compliance*/
|
||||
{
|
||||
int fps=0;
|
||||
sscanf(optarg,"%d",&fps);
|
||||
sscanf(opj_optarg,"%d",&fps);
|
||||
if(fps == 24){
|
||||
parameters->cp_cinema = CINEMA2K_24;
|
||||
}else if(fps == 48 ){
|
||||
@ -1067,7 +1067,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||
/* search for different protection methods */
|
||||
|
||||
/* break the option in comma points and parse the result */
|
||||
token = strtok(optarg, ",");
|
||||
token = strtok(opj_optarg, ",");
|
||||
while(token != NULL) {
|
||||
|
||||
/* search header error protection method */
|
||||
|
@ -47,7 +47,7 @@
|
||||
#include "openjpeg.h"
|
||||
#include "j2k.h"
|
||||
#include "jp2.h"
|
||||
#include "getopt.h"
|
||||
#include "opj_getopt.h"
|
||||
#include "convert.h"
|
||||
#include "index.h"
|
||||
|
||||
@ -197,7 +197,7 @@ char get_next_file(int imageno,dircnt_t *dirptr,img_fol_t *img_fol, opj_dparamet
|
||||
int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,img_fol_t *img_fol, char *indexfilename) {
|
||||
/* parse the command line */
|
||||
int totlen, c;
|
||||
option_t long_option[]={
|
||||
opj_option_t long_option[]={
|
||||
{"ImgDir",REQ_ARG, NULL ,'y'},
|
||||
};
|
||||
const char optlist[] = "i:o:h";
|
||||
@ -207,13 +207,13 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
||||
totlen=sizeof(long_option);
|
||||
img_fol->set_out_format = 0;
|
||||
do {
|
||||
c = getopt_long(argc, argv,optlist,long_option,totlen);
|
||||
c = opj_getopt_long(argc, argv,optlist,long_option,totlen);
|
||||
if (c == -1)
|
||||
break;
|
||||
switch (c) {
|
||||
case 'i': /* input file */
|
||||
{
|
||||
char *infile = optarg;
|
||||
char *infile = opj_optarg;
|
||||
parameters->decod_format = get_file_format(infile);
|
||||
switch(parameters->decod_format) {
|
||||
case J2K_CFMT:
|
||||
@ -234,7 +234,7 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
||||
|
||||
case 'o': /* output file */
|
||||
{
|
||||
char *outfile = optarg;
|
||||
char *outfile = opj_optarg;
|
||||
strncpy(parameters->outfile, outfile, sizeof(parameters->outfile)-1);
|
||||
}
|
||||
break;
|
||||
@ -249,8 +249,8 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
||||
|
||||
case 'y': /* Image Directory path */
|
||||
{
|
||||
img_fol->imgdirpath = (char*)malloc(strlen(optarg) + 1);
|
||||
strcpy(img_fol->imgdirpath,optarg);
|
||||
img_fol->imgdirpath = (char*)malloc(strlen(opj_optarg) + 1);
|
||||
strcpy(img_fol->imgdirpath,opj_optarg);
|
||||
img_fol->set_imgdir=1;
|
||||
}
|
||||
break;
|
||||
@ -258,7 +258,7 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
||||
/* ----------------------------------------------------- */
|
||||
|
||||
default:
|
||||
fprintf(stderr,"WARNING -> this option is not valid \"-%c %s\"\n",c, optarg);
|
||||
fprintf(stderr,"WARNING -> this option is not valid \"-%c %s\"\n",c, opj_optarg);
|
||||
break;
|
||||
}
|
||||
}while(c != -1);
|
||||
|
@ -51,7 +51,7 @@
|
||||
|
||||
#include "opj_config.h"
|
||||
#include "openjpeg.h"
|
||||
#include "getopt.h"
|
||||
#include "opj_getopt.h"
|
||||
#include "convert.h"
|
||||
#include "index.h"
|
||||
|
||||
@ -238,7 +238,7 @@ char get_next_file(int imageno,dircnt_t *dirptr,img_fol_t *img_fol, opj_dparamet
|
||||
int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,img_fol_t *img_fol, char *indexfilename) {
|
||||
/* parse the command line */
|
||||
int totlen, c;
|
||||
option_t long_option[]={
|
||||
opj_option_t long_option[]={
|
||||
{"ImgDir",REQ_ARG, NULL ,'y'},
|
||||
{"OutFor",REQ_ARG, NULL ,'O'},
|
||||
};
|
||||
@ -254,13 +254,13 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
||||
totlen=sizeof(long_option);
|
||||
img_fol->set_out_format = 0;
|
||||
do {
|
||||
c = getopt_long(argc, argv,optlist,long_option,totlen);
|
||||
c = opj_getopt_long(argc, argv,optlist,long_option,totlen);
|
||||
if (c == -1)
|
||||
break;
|
||||
switch (c) {
|
||||
case 'i': /* input file */
|
||||
{
|
||||
char *infile = optarg;
|
||||
char *infile = opj_optarg;
|
||||
parameters->decod_format = get_file_format(infile);
|
||||
switch(parameters->decod_format) {
|
||||
case J2K_CFMT:
|
||||
@ -281,7 +281,7 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
||||
|
||||
case 'o': /* output file */
|
||||
{
|
||||
char *outfile = optarg;
|
||||
char *outfile = opj_optarg;
|
||||
parameters->cod_format = get_file_format(outfile);
|
||||
switch(parameters->cod_format) {
|
||||
case PGX_DFMT:
|
||||
@ -305,7 +305,7 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
||||
case 'O': /* output format */
|
||||
{
|
||||
char outformat[50];
|
||||
char *of = optarg;
|
||||
char *of = opj_optarg;
|
||||
sprintf(outformat,".%s",of);
|
||||
img_fol->set_out_format = 1;
|
||||
parameters->cod_format = get_file_format(outformat);
|
||||
@ -344,7 +344,7 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
||||
|
||||
case 'r': /* reduce option */
|
||||
{
|
||||
sscanf(optarg, "%d", ¶meters->cp_reduce);
|
||||
sscanf(opj_optarg, "%d", ¶meters->cp_reduce);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -353,7 +353,7 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
||||
|
||||
case 'l': /* layering option */
|
||||
{
|
||||
sscanf(optarg, "%d", ¶meters->cp_layer);
|
||||
sscanf(opj_optarg, "%d", ¶meters->cp_layer);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -367,15 +367,15 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
||||
|
||||
case 'y': /* Image Directory path */
|
||||
{
|
||||
img_fol->imgdirpath = (char*)malloc(strlen(optarg) + 1);
|
||||
strcpy(img_fol->imgdirpath,optarg);
|
||||
img_fol->imgdirpath = (char*)malloc(strlen(opj_optarg) + 1);
|
||||
strcpy(img_fol->imgdirpath,opj_optarg);
|
||||
img_fol->set_imgdir=1;
|
||||
}
|
||||
break;
|
||||
/* ----------------------------------------------------- */
|
||||
case 'x': /* Creation of index file */
|
||||
{
|
||||
char *index = optarg;
|
||||
char *index = opj_optarg;
|
||||
strncpy(indexfilename, index, OPJ_PATH_LEN);
|
||||
}
|
||||
break;
|
||||
@ -387,7 +387,7 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
||||
{
|
||||
char *token = NULL;
|
||||
|
||||
token = strtok(optarg, ",");
|
||||
token = strtok(opj_optarg, ",");
|
||||
while(token != NULL) {
|
||||
|
||||
/* search expected number of components */
|
||||
@ -454,7 +454,7 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
||||
/* ----------------------------------------------------- */
|
||||
|
||||
default:
|
||||
fprintf(stderr,"WARNING -> this option is not valid \"-%c %s\"\n",c, optarg);
|
||||
fprintf(stderr,"WARNING -> this option is not valid \"-%c %s\"\n",c, opj_optarg);
|
||||
break;
|
||||
}
|
||||
}while(c != -1);
|
||||
|
@ -124,7 +124,7 @@
|
||||
# error "not implemented"
|
||||
# elif defined(__sgi) /* Silicon Graphics */
|
||||
# define HAVE_DIRENT_H
|
||||
# elif defined(sun) || defined(_sun) /* Sun Solaris */
|
||||
# elif defined(sun) || defined(__sun) /* Sun Solaris */
|
||||
# define HAVE_DIRENT_H
|
||||
# elif defined(__FreeBSD__) /* FreeBSD */
|
||||
# define HAVE_DIRENT_H
|
||||
|
@ -1,29 +0,0 @@
|
||||
/* last review : october 29th, 2002 */
|
||||
|
||||
#ifndef _GETOPT_H_
|
||||
#define _GETOPT_H_
|
||||
|
||||
typedef struct option
|
||||
{
|
||||
const char *name;
|
||||
int has_arg;
|
||||
int *flag;
|
||||
int val;
|
||||
}option_t;
|
||||
|
||||
#define NO_ARG 0
|
||||
#define REQ_ARG 1
|
||||
#define OPT_ARG 2
|
||||
|
||||
extern int opterr;
|
||||
extern int optind;
|
||||
extern int optopt;
|
||||
extern int optreset;
|
||||
extern char *optarg;
|
||||
|
||||
extern int getopt(int nargc, char *const *nargv, const char *ostr);
|
||||
extern int getopt_long(int argc, char * const argv[], const char *optstring,
|
||||
const struct option *longopts, int totlen);
|
||||
extern void reset_options_reading(void);
|
||||
|
||||
#endif /* _GETOPT_H_ */
|
@ -34,117 +34,110 @@
|
||||
/* last review : october 29th, 2002 */
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static char sccsid[] = "@(#)getopt.c 8.3 (Berkeley) 4/27/95";
|
||||
static char sccsid[] = "@(#)opj_getopt.c 8.3 (Berkeley) 4/27/95";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "opj_getopt.h"
|
||||
|
||||
int opterr = 1, /* if error message should be printed */
|
||||
optind = 1, /* index into parent argv vector */
|
||||
optopt, /* character checked for validity */
|
||||
optreset; /* reset getopt */
|
||||
const char *optarg; /* argument associated with option */
|
||||
|
||||
typedef struct option
|
||||
{
|
||||
const char *name;
|
||||
int has_arg;
|
||||
int *flag;
|
||||
int val;
|
||||
}option_t;
|
||||
int opj_opterr = 1, /* if error message should be printed */
|
||||
opj_optind = 1, /* index into parent argv vector */
|
||||
opj_optopt, /* character checked for validity */
|
||||
opj_optreset; /* reset getopt */
|
||||
char *opj_optarg; /* argument associated with option */
|
||||
|
||||
#define BADCH (int)'?'
|
||||
#define BADARG (int)':'
|
||||
#define EMSG ""
|
||||
static char EMSG[]={""};
|
||||
|
||||
/* As this class remembers its values from one Java call to the other, reset the values before each use */
|
||||
void reset_options_reading(void) {
|
||||
opterr = 1;
|
||||
optind = 1;
|
||||
opj_opterr = 1;
|
||||
opj_optind = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* getopt --
|
||||
* Parse argc/argv argument vector.
|
||||
*/
|
||||
int getopt(int nargc, char *const *nargv, const char *ostr) {
|
||||
int opj_getopt(int nargc, char *const *nargv, const char *ostr) {
|
||||
# define __progname nargv[0]
|
||||
static const char *place = EMSG; /* option letter processing */
|
||||
static char *place = EMSG; /* option letter processing */
|
||||
char *oli; /* option letter list index */
|
||||
|
||||
if (optreset || !*place) { /* update scanning pointer */
|
||||
optreset = 0;
|
||||
if (optind >= nargc || *(place = nargv[optind]) != '-') {
|
||||
if (opj_optreset || !*place) { /* update scanning pointer */
|
||||
opj_optreset = 0;
|
||||
if (opj_optind >= nargc || *(place = nargv[opj_optind]) != '-') {
|
||||
place = EMSG;
|
||||
return (-1);
|
||||
}
|
||||
if (place[1] && *++place == '-') { /* found "--" */
|
||||
++optind;
|
||||
++opj_optind;
|
||||
place = EMSG;
|
||||
return (-1);
|
||||
}
|
||||
} /* option letter okay? */
|
||||
if ((optopt = (int) *place++) == (int) ':' ||
|
||||
!(oli = strchr(ostr, optopt))) {
|
||||
if ((opj_optopt = (int) *place++) == (int) ':' ||
|
||||
!(oli = strchr(ostr, opj_optopt))) {
|
||||
/*
|
||||
* if the user didn't specify '-' as an option,
|
||||
* assume it means -1.
|
||||
*/
|
||||
if (optopt == (int) '-')
|
||||
if (opj_optopt == (int) '-')
|
||||
return (-1);
|
||||
if (!*place)
|
||||
++optind;
|
||||
if (opterr && *ostr != ':') {
|
||||
++opj_optind;
|
||||
if (opj_opterr && *ostr != ':') {
|
||||
fprintf(stderr,
|
||||
"%s: illegal option -- %c\n", __progname, optopt);
|
||||
"%s: illegal option -- %c\n", __progname, opj_optopt);
|
||||
return (BADCH);
|
||||
}
|
||||
}
|
||||
if (*++oli != ':') { /* don't need argument */
|
||||
optarg = NULL;
|
||||
opj_optarg = NULL;
|
||||
if (!*place)
|
||||
++optind;
|
||||
++opj_optind;
|
||||
} else { /* need an argument */
|
||||
if (*place) /* no white space */
|
||||
optarg = place;
|
||||
else if (nargc <= ++optind) { /* no arg */
|
||||
opj_optarg = place;
|
||||
else if (nargc <= ++opj_optind) { /* no arg */
|
||||
place = EMSG;
|
||||
if (*ostr == ':')
|
||||
return (BADARG);
|
||||
if (opterr) {
|
||||
if (opj_opterr) {
|
||||
fprintf(stderr,
|
||||
"%s: option requires an argument -- %c\n",
|
||||
__progname, optopt);
|
||||
__progname, opj_optopt);
|
||||
return (BADCH);
|
||||
}
|
||||
} else /* white space */
|
||||
optarg = nargv[optind];
|
||||
opj_optarg = nargv[opj_optind];
|
||||
place = EMSG;
|
||||
++optind;
|
||||
++opj_optind;
|
||||
}
|
||||
return (optopt); /* dump back option letter */
|
||||
return (opj_optopt); /* dump back option letter */
|
||||
}
|
||||
|
||||
|
||||
int getopt_long(int argc, char * const argv[], const char *optstring,
|
||||
const struct option *longopts, int totlen) {
|
||||
int opj_getopt_long(int argc, char * const argv[], const char *optstring,
|
||||
const opj_option_t *longopts, int totlen) {
|
||||
static int lastidx,lastofs;
|
||||
char *tmp;
|
||||
int i,len;
|
||||
char param = 1;
|
||||
|
||||
again:
|
||||
if (optind >= argc || !argv[optind] || *argv[optind]!='-')
|
||||
if (opj_optind >= argc || !argv[opj_optind] || *argv[opj_optind]!='-')
|
||||
return -1;
|
||||
|
||||
if (argv[optind][0]=='-' && argv[optind][1]==0) {
|
||||
if(optind >= (argc - 1)){ /* no more input parameters */
|
||||
if (argv[opj_optind][0]=='-' && argv[opj_optind][1]==0) {
|
||||
if(opj_optind >= (argc - 1)){ /* no more input parameters */
|
||||
param = 0;
|
||||
}
|
||||
else{ /* more input parameters */
|
||||
if(argv[optind + 1][0] == '-'){
|
||||
if(argv[opj_optind + 1][0] == '-'){
|
||||
param = 0; /* Missing parameter after '-' */
|
||||
}
|
||||
else{
|
||||
@ -154,50 +147,50 @@ again:
|
||||
}
|
||||
|
||||
if (param == 0) {
|
||||
++optind;
|
||||
++opj_optind;
|
||||
return (BADCH);
|
||||
}
|
||||
|
||||
if (argv[optind][0]=='-') { /* long option */
|
||||
char* arg=argv[optind]+1;
|
||||
const struct option* o;
|
||||
if (argv[opj_optind][0]=='-') { /* long option */
|
||||
char* arg=argv[opj_optind]+1;
|
||||
const opj_option_t* o;
|
||||
o=longopts;
|
||||
len=sizeof(longopts[0]);
|
||||
|
||||
if (param > 1){
|
||||
arg = argv[optind+1];
|
||||
optind++;
|
||||
arg = argv[opj_optind+1];
|
||||
opj_optind++;
|
||||
}
|
||||
else
|
||||
arg = argv[optind]+1;
|
||||
arg = argv[opj_optind]+1;
|
||||
|
||||
if(strlen(arg)>1){
|
||||
for (i=0;i<totlen;i=i+len,o++) {
|
||||
if (!strcmp(o->name,arg)) { /* match */
|
||||
if (o->has_arg == 0) {
|
||||
if ((argv[optind+1])&&(!(argv[optind+1][0]=='-'))){
|
||||
fprintf(stderr,"%s: option does not require an argument. Ignoring %s\n",arg,argv[optind+1]);
|
||||
++optind;
|
||||
if ((argv[opj_optind+1])&&(!(argv[opj_optind+1][0]=='-'))){
|
||||
fprintf(stderr,"%s: option does not require an argument. Ignoring %s\n",arg,argv[opj_optind+1]);
|
||||
++opj_optind;
|
||||
}
|
||||
}else{
|
||||
optarg=argv[optind+1];
|
||||
if(optarg){
|
||||
if (optarg[0] == '-'){ /* Has read next input parameter: No arg for current parameter */
|
||||
if (opterr) {
|
||||
opj_optarg=argv[opj_optind+1];
|
||||
if(opj_optarg){
|
||||
if (opj_optarg[0] == '-'){ /* Has read next input parameter: No arg for current parameter */
|
||||
if (opj_opterr) {
|
||||
fprintf(stderr,"%s: option requires an argument\n",arg);
|
||||
return (BADCH);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!optarg && o->has_arg==1) { /* no argument there */
|
||||
if (opterr) {
|
||||
if (!opj_optarg && o->has_arg==1) { /* no argument there */
|
||||
if (opj_opterr) {
|
||||
fprintf(stderr,"%s: option requires an argument \n",arg);
|
||||
return (BADCH);
|
||||
}
|
||||
}
|
||||
++optind;
|
||||
++opj_optind;
|
||||
}
|
||||
++optind;
|
||||
++opj_optind;
|
||||
if (o->flag)
|
||||
*(o->flag)=o->val;
|
||||
else
|
||||
@ -206,56 +199,56 @@ again:
|
||||
}
|
||||
}//(end for)String not found in the list
|
||||
fprintf(stderr,"Invalid option %s\n",arg);
|
||||
++optind;
|
||||
++opj_optind;
|
||||
return (BADCH);
|
||||
}else{ /*Single character input parameter*/
|
||||
if (*optstring==':') return ':';
|
||||
if (lastidx!=optind) {
|
||||
lastidx=optind; lastofs=0;
|
||||
if (lastidx!=opj_optind) {
|
||||
lastidx=opj_optind; lastofs=0;
|
||||
}
|
||||
optopt=argv[optind][lastofs+1];
|
||||
if ((tmp=strchr(optstring,optopt))) {/*Found input parameter in list*/
|
||||
opj_optopt=argv[opj_optind][lastofs+1];
|
||||
if ((tmp=strchr(optstring,opj_optopt))) {/*Found input parameter in list*/
|
||||
if (*tmp==0) { /* apparently, we looked for \0, i.e. end of argument */
|
||||
++optind;
|
||||
++opj_optind;
|
||||
goto again;
|
||||
}
|
||||
if (tmp[1]==':') { /* argument expected */
|
||||
if (tmp[2]==':' || argv[optind][lastofs+2]) { /* "-foo", return "oo" as optarg */
|
||||
if (!*(optarg=argv[optind]+lastofs+2)) optarg=0;
|
||||
if (tmp[2]==':' || argv[opj_optind][lastofs+2]) { /* "-foo", return "oo" as opj_optarg */
|
||||
if (!*(opj_optarg=argv[opj_optind]+lastofs+2)) opj_optarg=0;
|
||||
goto found;
|
||||
}
|
||||
optarg=argv[optind+1];
|
||||
if(optarg){
|
||||
if (optarg[0] == '-'){ /* Has read next input parameter: No arg for current parameter */
|
||||
if (opterr) {
|
||||
opj_optarg=argv[opj_optind+1];
|
||||
if(opj_optarg){
|
||||
if (opj_optarg[0] == '-'){ /* Has read next input parameter: No arg for current parameter */
|
||||
if (opj_opterr) {
|
||||
fprintf(stderr,"%s: option requires an argument\n",arg);
|
||||
return (BADCH);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!optarg) { /* missing argument */
|
||||
if (opterr) {
|
||||
if (!opj_optarg) { /* missing argument */
|
||||
if (opj_opterr) {
|
||||
fprintf(stderr,"%s: option requires an argument\n",arg);
|
||||
return (BADCH);
|
||||
}
|
||||
}
|
||||
++optind;
|
||||
++opj_optind;
|
||||
}else {/*Argument not expected*/
|
||||
++lastofs;
|
||||
return optopt;
|
||||
return opj_optopt;
|
||||
}
|
||||
found:
|
||||
++optind;
|
||||
return optopt;
|
||||
++opj_optind;
|
||||
return opj_optopt;
|
||||
} else { /* not found */
|
||||
fprintf(stderr,"Invalid option %s\n",arg);
|
||||
++optind;
|
||||
++opj_optind;
|
||||
return (BADCH);
|
||||
}//end of not found
|
||||
|
||||
}// end of single character
|
||||
}//end '-'
|
||||
fprintf(stderr,"Invalid option\n");
|
||||
++optind;
|
||||
++opj_optind;
|
||||
return (BADCH);;
|
||||
}//end function
|
29
applications/common/opj_getopt.h
Normal file
29
applications/common/opj_getopt.h
Normal file
@ -0,0 +1,29 @@
|
||||
/* last review : october 29th, 2002 */
|
||||
|
||||
#ifndef _GETOPT_H_
|
||||
#define _GETOPT_H_
|
||||
|
||||
typedef struct opj_option
|
||||
{
|
||||
const char *name;
|
||||
int has_arg;
|
||||
int *flag;
|
||||
int val;
|
||||
}opj_option_t;
|
||||
|
||||
#define NO_ARG 0
|
||||
#define REQ_ARG 1
|
||||
#define OPT_ARG 2
|
||||
|
||||
extern int opj_opterr;
|
||||
extern int opj_optind;
|
||||
extern int opj_optopt;
|
||||
extern int opj_optreset;
|
||||
extern char *opj_optarg;
|
||||
|
||||
extern int opj_getopt(int nargc, char *const *nargv, const char *ostr);
|
||||
extern int opj_getopt_long(int argc, char * const argv[], const char *optstring,
|
||||
const opj_option_t *longopts, int totlen);
|
||||
extern void reset_options_reading(void);
|
||||
|
||||
#endif /* _GETOPT_H_ */
|
@ -1,9 +1,6 @@
|
||||
# Makefile for the MJ2 codecs of the OpenJPEG library: frames_to_mj2, mj2_to_frames, extract_j2k_from_mj2 and wrap_j2k_in_mj2
|
||||
|
||||
SET(common_SRCS "")
|
||||
IF(DONT_HAVE_GETOPT)
|
||||
SET(common_SRCS ${OPENJPEG_SOURCE_DIR}/applications/common/getopt.c)
|
||||
ENDIF(DONT_HAVE_GETOPT)
|
||||
SET(common_SRCS ${OPENJPEG_SOURCE_DIR}/applications/common/opj_getopt.c)
|
||||
|
||||
# While mj2 executables do not use the API correctly, we do not link with the library but rather compile the sources files.
|
||||
SET(OPJ_SRCS
|
||||
|
@ -37,7 +37,7 @@ frames_to_mj2_CFLAGS =
|
||||
frames_to_mj2_LDADD = -lm
|
||||
frames_to_mj2_SOURCES = \
|
||||
$(OPJ_SRC) \
|
||||
../common/getopt.c \
|
||||
../common/opj_getopt.c \
|
||||
mj2_convert.c \
|
||||
mj2.c \
|
||||
frames_to_mj2.c \
|
||||
@ -58,7 +58,7 @@ mj2_to_frames_LDADD = @LCMS2_LIBS@ @LCMS1_LIBS@
|
||||
mj2_to_frames_SOURCES = \
|
||||
$(OPJ_SRC) \
|
||||
../common/color.c \
|
||||
../common/getopt.c \
|
||||
../common/opj_getopt.c \
|
||||
mj2_convert.c \
|
||||
mj2.c \
|
||||
mj2_to_frames.c \
|
||||
|
@ -36,7 +36,7 @@
|
||||
#include "cio.h"
|
||||
#include "mj2.h"
|
||||
#include "mj2_convert.h"
|
||||
#include "getopt.h"
|
||||
#include "opj_getopt.h"
|
||||
|
||||
/**
|
||||
Size of memory first allocated for MOOV box
|
||||
@ -289,15 +289,15 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
while (1) {
|
||||
int c = getopt(argc, argv,
|
||||
int c = opj_getopt(argc, argv,
|
||||
"i:o:r:q:f:t:n:c:b:p:s:d:P:S:E:M:R:T:C:I:W:F:D:h");
|
||||
if (c == -1)
|
||||
break;
|
||||
switch (c) {
|
||||
case 'i': /* IN fill */
|
||||
{
|
||||
char *infile = optarg;
|
||||
s = optarg;
|
||||
char *infile = opj_optarg;
|
||||
s = opj_optarg;
|
||||
while (*s) {
|
||||
s++;
|
||||
}
|
||||
@ -324,7 +324,7 @@ int main(int argc, char **argv)
|
||||
/* ----------------------------------------------------- */
|
||||
case 'o': /* OUT fill */
|
||||
{
|
||||
char *outfile = optarg;
|
||||
char *outfile = opj_optarg;
|
||||
while (*outfile) {
|
||||
outfile++;
|
||||
}
|
||||
@ -335,7 +335,7 @@ int main(int argc, char **argv)
|
||||
outfile--;
|
||||
S1 = *outfile;
|
||||
|
||||
outfile = optarg;
|
||||
outfile = opj_optarg;
|
||||
|
||||
if ((S1 == 'm' && S2 == 'j' && S3 == '2')
|
||||
|| (S1 == 'M' && S2 == 'J' && S3 == '2'))
|
||||
@ -353,7 +353,7 @@ int main(int argc, char **argv)
|
||||
case 'r': /* rates rates/distorsion */
|
||||
{
|
||||
float rate;
|
||||
s = optarg;
|
||||
s = opj_optarg;
|
||||
while (sscanf(s, "%f", &rate) == 1) {
|
||||
j2k_parameters->tcp_rates[j2k_parameters->tcp_numlayers] = rate * 2;
|
||||
j2k_parameters->tcp_numlayers++;
|
||||
@ -369,7 +369,7 @@ int main(int argc, char **argv)
|
||||
break;
|
||||
/* ----------------------------------------------------- */
|
||||
case 'q': /* add fixed_quality */
|
||||
s = optarg;
|
||||
s = opj_optarg;
|
||||
while (sscanf(s, "%f", &j2k_parameters->tcp_distoratio[j2k_parameters->tcp_numlayers]) == 1) {
|
||||
j2k_parameters->tcp_numlayers++;
|
||||
while (*s && *s != ',') {
|
||||
@ -388,7 +388,7 @@ int main(int argc, char **argv)
|
||||
int *row = NULL, *col = NULL;
|
||||
int numlayers = 0, numresolution = 0, matrix_width = 0;
|
||||
|
||||
s = optarg;
|
||||
s = opj_optarg;
|
||||
sscanf(s, "%d", &numlayers);
|
||||
s++;
|
||||
if (numlayers > 9)
|
||||
@ -429,12 +429,12 @@ int main(int argc, char **argv)
|
||||
break;
|
||||
/* ----------------------------------------------------- */
|
||||
case 't': /* tiles */
|
||||
sscanf(optarg, "%d,%d", &j2k_parameters->cp_tdx, &j2k_parameters->cp_tdy);
|
||||
sscanf(opj_optarg, "%d,%d", &j2k_parameters->cp_tdx, &j2k_parameters->cp_tdy);
|
||||
j2k_parameters->tile_size_on = OPJ_TRUE;
|
||||
break;
|
||||
/* ----------------------------------------------------- */
|
||||
case 'n': /* resolution */
|
||||
sscanf(optarg, "%d", &j2k_parameters->numresolution);
|
||||
sscanf(opj_optarg, "%d", &j2k_parameters->numresolution);
|
||||
break;
|
||||
/* ----------------------------------------------------- */
|
||||
case 'c': /* precinct dimension */
|
||||
@ -442,7 +442,7 @@ int main(int argc, char **argv)
|
||||
char sep;
|
||||
int res_spec = 0;
|
||||
|
||||
char *s = optarg;
|
||||
char *s = opj_optarg;
|
||||
do {
|
||||
sep = 0;
|
||||
sscanf(s, "[%d,%d]%c", &j2k_parameters->prcw_init[res_spec],
|
||||
@ -460,7 +460,7 @@ int main(int argc, char **argv)
|
||||
case 'b': /* code-block dimension */
|
||||
{
|
||||
int cblockw_init = 0, cblockh_init = 0;
|
||||
sscanf(optarg, "%d,%d", &cblockw_init, &cblockh_init);
|
||||
sscanf(opj_optarg, "%d,%d", &cblockw_init, &cblockh_init);
|
||||
if (cblockw_init * cblockh_init > 4096 || cblockw_init > 1024
|
||||
|| cblockw_init < 4 || cblockh_init > 1024 || cblockh_init < 4) {
|
||||
fprintf(stderr,
|
||||
@ -477,7 +477,7 @@ int main(int argc, char **argv)
|
||||
{
|
||||
char progression[5];
|
||||
|
||||
strncpy(progression, optarg, 5);
|
||||
strncpy(progression, opj_optarg, 5);
|
||||
j2k_parameters->prog_order = give_progression(progression);
|
||||
if (j2k_parameters->prog_order == -1) {
|
||||
fprintf(stderr, "Unrecognized progression order "
|
||||
@ -489,7 +489,7 @@ int main(int argc, char **argv)
|
||||
/* ----------------------------------------------------- */
|
||||
case 's': /* subsampling factor */
|
||||
{
|
||||
if (sscanf(optarg, "%d,%d", &j2k_parameters->subsampling_dx,
|
||||
if (sscanf(opj_optarg, "%d,%d", &j2k_parameters->subsampling_dx,
|
||||
&j2k_parameters->subsampling_dy) != 2) {
|
||||
fprintf(stderr, "'-s' sub-sampling argument error ! [-s dx,dy]\n");
|
||||
return 1;
|
||||
@ -499,7 +499,7 @@ int main(int argc, char **argv)
|
||||
/* ----------------------------------------------------- */
|
||||
case 'd': /* coordonnate of the reference grid */
|
||||
{
|
||||
if (sscanf(optarg, "%d,%d", &j2k_parameters->image_offset_x0,
|
||||
if (sscanf(opj_optarg, "%d,%d", &j2k_parameters->image_offset_x0,
|
||||
&j2k_parameters->image_offset_y0) != 2) {
|
||||
fprintf(stderr, "-d 'coordonnate of the reference grid' argument "
|
||||
"error !! [-d x0,y0]\n");
|
||||
@ -518,7 +518,7 @@ int main(int argc, char **argv)
|
||||
int numpocs = 0; /* number of progression order change (POC) default 0 */
|
||||
opj_poc_t *POC = NULL; /* POC : used in case of Progression order change */
|
||||
|
||||
char *s = optarg;
|
||||
char *s = opj_optarg;
|
||||
POC = j2k_parameters->POC;
|
||||
|
||||
while (sscanf(s, "T%d=%d,%d,%d,%d,%d,%4s", &POC[numpocs].tile,
|
||||
@ -548,7 +548,7 @@ int main(int argc, char **argv)
|
||||
break;
|
||||
/* ------------------------------------------------------ */
|
||||
case 'M': /* Mode switch pas tous au point !! */
|
||||
if (sscanf(optarg, "%d", &value) == 1) {
|
||||
if (sscanf(opj_optarg, "%d", &value) == 1) {
|
||||
for (i = 0; i <= 5; i++) {
|
||||
int cache = value & (1 << i);
|
||||
if (cache)
|
||||
@ -559,7 +559,7 @@ int main(int argc, char **argv)
|
||||
/* ------------------------------------------------------ */
|
||||
case 'R': /* ROI */
|
||||
{
|
||||
if (sscanf(optarg, "OI:c=%d,U=%d", &j2k_parameters->roi_compno,
|
||||
if (sscanf(opj_optarg, "OI:c=%d,U=%d", &j2k_parameters->roi_compno,
|
||||
&j2k_parameters->roi_shift) != 2) {
|
||||
fprintf(stderr, "ROI error !! [-ROI:c='compno',U='shift']\n");
|
||||
return 1;
|
||||
@ -569,7 +569,7 @@ int main(int argc, char **argv)
|
||||
/* ------------------------------------------------------ */
|
||||
case 'T': /* Tile offset */
|
||||
{
|
||||
if (sscanf(optarg, "%d,%d", &j2k_parameters->cp_tx0, &j2k_parameters->cp_ty0) != 2) {
|
||||
if (sscanf(opj_optarg, "%d,%d", &j2k_parameters->cp_tx0, &j2k_parameters->cp_ty0) != 2) {
|
||||
fprintf(stderr, "-T 'tile offset' argument error !! [-T X0,Y0]");
|
||||
return 1;
|
||||
}
|
||||
@ -578,9 +578,9 @@ int main(int argc, char **argv)
|
||||
/* ------------------------------------------------------ */
|
||||
case 'C': /* Add a comment */
|
||||
{
|
||||
j2k_parameters->cp_comment = (char*)malloc(strlen(optarg) + 1);
|
||||
j2k_parameters->cp_comment = (char*)malloc(strlen(opj_optarg) + 1);
|
||||
if(j2k_parameters->cp_comment) {
|
||||
strcpy(j2k_parameters->cp_comment, optarg);
|
||||
strcpy(j2k_parameters->cp_comment, opj_optarg);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -593,7 +593,7 @@ int main(int argc, char **argv)
|
||||
/* ------------------------------------------------------ */
|
||||
case 'W': /* Width and Height and Cb and Cr subsampling in case of YUV format files */
|
||||
if (sscanf
|
||||
(optarg, "%d,%d,%d,%d", &mj2_parameters.w, &mj2_parameters.h, &mj2_parameters.CbCr_subsampling_dx,
|
||||
(opj_optarg, "%d,%d,%d,%d", &mj2_parameters.w, &mj2_parameters.h, &mj2_parameters.CbCr_subsampling_dx,
|
||||
&mj2_parameters.CbCr_subsampling_dy) != 4) {
|
||||
fprintf(stderr, "-W argument error");
|
||||
return 1;
|
||||
@ -601,14 +601,14 @@ int main(int argc, char **argv)
|
||||
break;
|
||||
/* ------------------------------------------------------ */
|
||||
case 'F': /* Video frame rate */
|
||||
if (sscanf(optarg, "%d", &mj2_parameters.frame_rate) != 1) {
|
||||
if (sscanf(opj_optarg, "%d", &mj2_parameters.frame_rate) != 1) {
|
||||
fprintf(stderr, "-F argument error");
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
/* ------------------------------------------------------ */
|
||||
case 'D': /* Depth: the precision */
|
||||
if(sscanf(optarg, "%d", &prec) != 1) prec = 0;
|
||||
if(sscanf(opj_optarg, "%d", &prec) != 1) prec = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -16,7 +16,7 @@ can be bound by the Open JPEG open-source license and disclaimer, expressed else
|
||||
|
||||
#include "mj2_to_metadata.h"
|
||||
#include <string.h>
|
||||
#include "getopt.h"
|
||||
#include "opj_getopt.h"
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
|
@ -208,7 +208,7 @@
|
||||
Name="MJ2 Header Files"
|
||||
>
|
||||
<File
|
||||
RelativePath="compat\getopt.h"
|
||||
RelativePath="compat\opj_getopt.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
@ -232,7 +232,7 @@
|
||||
Name="MJ2 Source Files"
|
||||
>
|
||||
<File
|
||||
RelativePath="compat\getopt.c"
|
||||
RelativePath="compat\opj_getopt.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
|
@ -9,30 +9,11 @@ INCLUDE_DIRECTORIES(${OPENJPEG_SOURCE_DIR}/libopenjpeg
|
||||
)
|
||||
|
||||
# First thing define the common source:
|
||||
SET(comparePGXimages_SRCS comparePGXimages.c ${OPENJPEG_SOURCE_DIR}/applications/codec/convert.c)
|
||||
SET(comparePGXimages_SRCS comparePGXimages.c ${OPENJPEG_SOURCE_DIR}/applications/codec/convert.c ${OPENJPEG_SOURCE_DIR}/applications/common/opj_getopt.c)
|
||||
|
||||
SET(compare_dump_files_SRCS compare_dump_files.c)
|
||||
SET(compare_dump_files_SRCS compare_dump_files.c ${OPENJPEG_SOURCE_DIR}/applications/common/opj_getopt.c)
|
||||
|
||||
SET(compareRAWimages_SRCS compareRAWimages.c)
|
||||
|
||||
# If not getopt was found then add it to the exe:
|
||||
IF(DONT_HAVE_GETOPT)
|
||||
message("dont have getopt, we will add it")
|
||||
SET(comparePGXimages_SRCS
|
||||
${comparePGXimages_SRCS}
|
||||
${OPENJPEG_SOURCE_DIR}/applications/common/getopt.c
|
||||
)
|
||||
|
||||
SET(compare_dump_files_SRCS
|
||||
${compare_dump_files_SRCS}
|
||||
${OPENJPEG_SOURCE_DIR}/applications/common/getopt.c
|
||||
)
|
||||
|
||||
SET(compareRAWimages_SRCS
|
||||
${compareRAWimages_SRCS}
|
||||
${OPENJPEG_SOURCE_DIR}/applications/common/getopt.c
|
||||
)
|
||||
ENDIF(DONT_HAVE_GETOPT)
|
||||
SET(compareRAWimages_SRCS compareRAWimages.c ${OPENJPEG_SOURCE_DIR}/applications/common/opj_getopt.c)
|
||||
|
||||
ADD_EXECUTABLE(comparePGXimages ${comparePGXimages_SRCS})
|
||||
TARGET_LINK_LIBRARIES(comparePGXimages ${OPENJPEG_LIBRARY_NAME}
|
||||
@ -51,4 +32,4 @@ IF(NOT HAVE_LIBPNG)
|
||||
ENDIF(NOT HAVE_LIBPNG)
|
||||
|
||||
ADD_SUBDIRECTORY(conformance)
|
||||
ADD_SUBDIRECTORY(nonregression)
|
||||
ADD_SUBDIRECTORY(nonregression)
|
||||
|
@ -38,7 +38,7 @@
|
||||
#include <ctype.h>
|
||||
|
||||
#include "opj_config.h"
|
||||
#include "getopt.h"
|
||||
#include "opj_getopt.h"
|
||||
|
||||
#include "openjpeg.h"
|
||||
#include "format_defs.h"
|
||||
@ -110,60 +110,60 @@ int parse_cmdline_cmp(int argc, char **argv, test_cmp_parameters* param)
|
||||
param->tabPEAKvalues = NULL;
|
||||
param->nr_flag = 0;
|
||||
|
||||
opterr = 0;
|
||||
opj_opterr = 0;
|
||||
|
||||
while ((c = getopt(argc, argv, optlist)) != -1)
|
||||
while ((c = opj_getopt(argc, argv, optlist)) != -1)
|
||||
switch (c)
|
||||
{
|
||||
case 'b':
|
||||
sizemembasefile = (int)strlen(optarg)+1;
|
||||
sizemembasefile = (int)strlen(opj_optarg)+1;
|
||||
param->base_filename = (char*) malloc(sizemembasefile);
|
||||
param->base_filename[0] = '\0';
|
||||
strncpy(param->base_filename, optarg, strlen(optarg));
|
||||
param->base_filename[strlen(optarg)] = '\0';
|
||||
strncpy(param->base_filename, opj_optarg, strlen(opj_optarg));
|
||||
param->base_filename[strlen(opj_optarg)] = '\0';
|
||||
//printf("param->base_filename = %s [%d / %d]\n", param->base_filename, strlen(param->base_filename), sizemembasefile );
|
||||
break;
|
||||
case 't':
|
||||
sizememtestfile = (int) strlen(optarg) + 1;
|
||||
sizememtestfile = (int) strlen(opj_optarg) + 1;
|
||||
param->test_filename = (char*) malloc(sizememtestfile);
|
||||
param->test_filename[0] = '\0';
|
||||
strncpy(param->test_filename, optarg, strlen(optarg));
|
||||
param->test_filename[strlen(optarg)] = '\0';
|
||||
strncpy(param->test_filename, opj_optarg, strlen(opj_optarg));
|
||||
param->test_filename[strlen(opj_optarg)] = '\0';
|
||||
//printf("param->test_filename = %s [%d / %d]\n", param->test_filename, strlen(param->test_filename), sizememtestfile);
|
||||
break;
|
||||
case 'n':
|
||||
param->nbcomp = atoi(optarg);
|
||||
param->nbcomp = atoi(opj_optarg);
|
||||
break;
|
||||
case 'm':
|
||||
MSElistvalues = optarg;
|
||||
MSElistvalues = opj_optarg;
|
||||
flagM = 1;
|
||||
break;
|
||||
case 'p':
|
||||
PEAKlistvalues = optarg;
|
||||
PEAKlistvalues = opj_optarg;
|
||||
flagP = 1;
|
||||
break;
|
||||
case 'd':
|
||||
param->nr_flag = 1;
|
||||
break;
|
||||
case 's':
|
||||
separatorList = optarg;
|
||||
separatorList = opj_optarg;
|
||||
break;
|
||||
case '?':
|
||||
if ((optopt == 'b') || (optopt == 't') || (optopt == 'n') || (optopt == 'p') || (optopt == 'm') || (optopt
|
||||
if ((opj_optopt == 'b') || (opj_optopt == 't') || (opj_optopt == 'n') || (opj_optopt == 'p') || (opj_optopt == 'm') || (opj_optopt
|
||||
== 's'))
|
||||
fprintf(stderr, "Option -%c requires an argument.\n", optopt);
|
||||
fprintf(stderr, "Option -%c requires an argument.\n", opj_optopt);
|
||||
else
|
||||
if (isprint(optopt)) fprintf(stderr, "Unknown option `-%c'.\n", optopt);
|
||||
else fprintf(stderr, "Unknown option character `\\x%x'.\n", optopt);
|
||||
if (isprint(opj_optopt)) fprintf(stderr, "Unknown option `-%c'.\n", opj_optopt);
|
||||
else fprintf(stderr, "Unknown option character `\\x%x'.\n", opj_optopt);
|
||||
return 1;
|
||||
default:
|
||||
fprintf(stderr, "WARNING -> this option is not valid \"-%c %s\"\n", c, optarg);
|
||||
fprintf(stderr, "WARNING -> this option is not valid \"-%c %s\"\n", c, opj_optarg);
|
||||
break;
|
||||
}
|
||||
|
||||
if (optind != argc)
|
||||
if (opj_optind != argc)
|
||||
{
|
||||
for (index = optind; index < argc; index++)
|
||||
for (index = opj_optind; index < argc; index++)
|
||||
fprintf(stderr,"Non-option argument %s\n", argv[index]);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
@ -36,7 +36,7 @@
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "getopt.h"
|
||||
#include "opj_getopt.h"
|
||||
|
||||
void compareRAWimages_help_display(void);
|
||||
|
||||
@ -73,40 +73,40 @@ int parse_cmdline_cmp(int argc, char **argv, test_cmp_parameters* param)
|
||||
param->base_filename = NULL;
|
||||
param->test_filename = NULL;
|
||||
|
||||
opterr = 0;
|
||||
opj_opterr = 0;
|
||||
while ((c = getopt(argc, argv, optlist)) != -1)
|
||||
switch (c)
|
||||
{
|
||||
case 'b':
|
||||
sizemembasefile = (int)strlen(optarg)+1;
|
||||
sizemembasefile = (int)strlen(opj_optarg)+1;
|
||||
param->base_filename = (char*) malloc(sizemembasefile);
|
||||
param->base_filename[0] = '\0';
|
||||
strncpy(param->base_filename, optarg, strlen(optarg));
|
||||
param->base_filename[strlen(optarg)] = '\0';
|
||||
strncpy(param->base_filename, opj_optarg, strlen(opj_optarg));
|
||||
param->base_filename[strlen(opj_optarg)] = '\0';
|
||||
//printf("param->base_filename = %s [%d / %d]\n", param->base_filename, strlen(param->base_filename), sizemembasefile );
|
||||
break;
|
||||
case 't':
|
||||
sizememtestfile = (int) strlen(optarg) + 1;
|
||||
sizememtestfile = (int) strlen(opj_optarg) + 1;
|
||||
param->test_filename = (char*) malloc(sizememtestfile);
|
||||
param->test_filename[0] = '\0';
|
||||
strncpy(param->test_filename, optarg, strlen(optarg));
|
||||
param->test_filename[strlen(optarg)] = '\0';
|
||||
strncpy(param->test_filename, opj_optarg, strlen(opj_optarg));
|
||||
param->test_filename[strlen(opj_optarg)] = '\0';
|
||||
//printf("param->test_filename = %s [%d / %d]\n", param->test_filename, strlen(param->test_filename), sizememtestfile);
|
||||
break;
|
||||
case '?':
|
||||
if ((optopt == 'b') || (optopt == 't'))
|
||||
fprintf(stderr, "Option -%c requires an argument.\n", optopt);
|
||||
if ((opj_optopt == 'b') || (opj_optopt == 't'))
|
||||
fprintf(stderr, "Option -%c requires an argument.\n", opj_optopt);
|
||||
else
|
||||
if (isprint(optopt)) fprintf(stderr, "Unknown option `-%c'.\n", optopt);
|
||||
else fprintf(stderr, "Unknown option character `\\x%x'.\n", optopt);
|
||||
if (isprint(opj_optopt)) fprintf(stderr, "Unknown option `-%c'.\n", opj_optopt);
|
||||
else fprintf(stderr, "Unknown option character `\\x%x'.\n", opj_optopt);
|
||||
return 1;
|
||||
default:
|
||||
fprintf(stderr, "WARNING -> this option is not valid \"-%c %s\"\n", c, optarg);
|
||||
fprintf(stderr, "WARNING -> this option is not valid \"-%c %s\"\n", c, opj_optarg);
|
||||
break;
|
||||
}
|
||||
|
||||
if (optind != argc) {
|
||||
for (index = optind; index < argc; index++)
|
||||
if (opj_optind != argc) {
|
||||
for (index = opj_optind; index < argc; index++)
|
||||
fprintf(stderr,"Non-option argument %s\n", argv[index]);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
@ -37,7 +37,7 @@
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "getopt.h"
|
||||
#include "opj_getopt.h"
|
||||
|
||||
typedef struct test_cmp_parameters
|
||||
{
|
||||
@ -71,42 +71,42 @@ int parse_cmdline_cmp(int argc, char **argv, test_cmp_parameters* param)
|
||||
param->base_filename = NULL;
|
||||
param->test_filename = NULL;
|
||||
|
||||
opterr = 0;
|
||||
opj_opterr = 0;
|
||||
|
||||
while ((c = getopt(argc, argv, optlist)) != -1)
|
||||
while ((c = opj_getopt(argc, argv, optlist)) != -1)
|
||||
switch (c)
|
||||
{
|
||||
case 'b':
|
||||
sizemembasefile = (int)strlen(optarg)+1;
|
||||
sizemembasefile = (int)strlen(opj_optarg)+1;
|
||||
param->base_filename = (char*) malloc(sizemembasefile);
|
||||
param->base_filename[0] = '\0';
|
||||
strncpy(param->base_filename, optarg, strlen(optarg));
|
||||
param->base_filename[strlen(optarg)] = '\0';
|
||||
strncpy(param->base_filename, opj_optarg, strlen(opj_optarg));
|
||||
param->base_filename[strlen(opj_optarg)] = '\0';
|
||||
//printf("param->base_filename = %s [%d / %d]\n", param->base_filename, strlen(param->base_filename), sizemembasefile );
|
||||
break;
|
||||
case 't':
|
||||
sizememtestfile = (int) strlen(optarg) + 1;
|
||||
sizememtestfile = (int) strlen(opj_optarg) + 1;
|
||||
param->test_filename = (char*) malloc(sizememtestfile);
|
||||
param->test_filename[0] = '\0';
|
||||
strncpy(param->test_filename, optarg, strlen(optarg));
|
||||
param->test_filename[strlen(optarg)] = '\0';
|
||||
strncpy(param->test_filename, opj_optarg, strlen(opj_optarg));
|
||||
param->test_filename[strlen(opj_optarg)] = '\0';
|
||||
//printf("param->test_filename = %s [%d / %d]\n", param->test_filename, strlen(param->test_filename), sizememtestfile);
|
||||
break;
|
||||
case '?':
|
||||
if ( (optopt == 'b') || (optopt == 't') )
|
||||
fprintf(stderr, "Option -%c requires an argument.\n", optopt);
|
||||
if ( (opj_optopt == 'b') || (opj_optopt == 't') )
|
||||
fprintf(stderr, "Option -%c requires an argument.\n", opj_optopt);
|
||||
else
|
||||
if (isprint(optopt)) fprintf(stderr, "Unknown option `-%c'.\n", optopt);
|
||||
else fprintf(stderr, "Unknown option character `\\x%x'.\n", optopt);
|
||||
if (isprint(opj_optopt)) fprintf(stderr, "Unknown option `-%c'.\n", opj_optopt);
|
||||
else fprintf(stderr, "Unknown option character `\\x%x'.\n", opj_optopt);
|
||||
return 1;
|
||||
default:
|
||||
fprintf(stderr, "WARNING -> this option is not valid \"-%c %s\"\n", c, optarg);
|
||||
fprintf(stderr, "WARNING -> this option is not valid \"-%c %s\"\n", c, opj_optarg);
|
||||
break;
|
||||
}
|
||||
|
||||
if (optind != argc)
|
||||
if (opj_optind != argc)
|
||||
{
|
||||
for (index = optind; index < argc; index++)
|
||||
for (index = opj_optind; index < argc; index++)
|
||||
fprintf(stderr,"Non-option argument %s\n", argv[index]);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ ENDIF (NOT WIN32)
|
||||
|
||||
string(COMPARE EQUAL ${REF_DECODER_BIN_PATH} "NOTFOUND" REF_DECODER_NOTFOUND)
|
||||
IF (REF_DECODER_NOTFOUND)
|
||||
MESSAGE(STATUS "REF_DECODER_BIN_PATH not found, if you want all the encoding tests suite please provide a ragular path")
|
||||
MESSAGE(STATUS "REF_DECODER_BIN_PATH not found, if you want all the encoding tests suite please provide a regular path")
|
||||
ENDIF (REF_DECODER_NOTFOUND)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user