Reformat: apply reformattin on .h files (#128)

This commit is contained in:
Even Rouault 2017-05-15 12:21:30 +02:00
parent 28d2eabca7
commit 3c2972f924
129 changed files with 7459 additions and 7139 deletions

View File

@ -47,7 +47,7 @@ set -e
# determine changed files
MODIFIED=$(git status --porcelain| ${GP}sed -ne "s/^ *[MA] *//p" | sort -u)
#MODIFIED=$(find src -name "*.c")
#MODIFIED=$(find src -name "*.h")
if [ -z "$MODIFIED" ]; then
echo nothing was modified

View File

@ -1,6 +1,6 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
@ -8,7 +8,7 @@
* Copyright (c) 2002-2014, Professor Benoit Macq
* Copyright (c) 2001-2003, David Janssens
* Copyright (c) 2002-2003, Yannick Verschueren
* Copyright (c) 2003-2007, Francois-Olivier Devaux
* Copyright (c) 2003-2007, Francois-Olivier Devaux
* Copyright (c) 2003-2014, Antonin Descampe
* Copyright (c) 2005, Herve Drolon, FreeImage Team
* All rights reserved.

View File

@ -1,6 +1,6 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
@ -8,7 +8,7 @@
* Copyright (c) 2002-2014, Professor Benoit Macq
* Copyright (c) 2001-2003, David Janssens
* Copyright (c) 2002-2003, Yannick Verschueren
* Copyright (c) 2003-2007, Francois-Olivier Devaux
* Copyright (c) 2003-2007, Francois-Olivier Devaux
* Copyright (c) 2003-2014, Antonin Descampe
* Copyright (c) 2005, Herve Drolon, FreeImage Team
* All rights reserved.

View File

@ -3,17 +3,16 @@
#ifndef _GETOPT_H_
#define _GETOPT_H_
typedef struct opj_option
{
const char *name;
int has_arg;
int *flag;
int val;
}opj_option_t;
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
#define NO_ARG 0
#define REQ_ARG 1
#define OPT_ARG 2
extern int opj_opterr;
extern int opj_optind;
@ -23,7 +22,7 @@ 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);
const opj_option_t *longopts, int totlen);
extern void opj_reset_options_reading(void);
#endif /* _GETOPT_H_ */
#endif /* _GETOPT_H_ */

View File

@ -39,34 +39,34 @@
/* keep in mind there still is a buffer read overflow possible */
static size_t opj_strnlen_s(const char *src, size_t max_len)
{
size_t len;
if (src == NULL) {
return 0U;
}
for (len = 0U; (*src != '\0') && (len < max_len); src++, len++);
return len;
size_t len;
if (src == NULL) {
return 0U;
}
for (len = 0U; (*src != '\0') && (len < max_len); src++, len++);
return len;
}
/* should be equivalent to C11 function except for the handler */
/* keep in mind there still is a buffer read overflow possible */
static int opj_strcpy_s(char* dst, size_t dst_size, const char* src)
{
size_t src_len = 0U;
if ((dst == NULL) || (dst_size == 0U)) {
return EINVAL;
}
if (src == NULL) {
dst[0] = '\0';
return EINVAL;
}
src_len = opj_strnlen_s(src, dst_size);
if (src_len >= dst_size) {
return ERANGE;
}
memcpy(dst, src, src_len);
dst[src_len] = '\0';
return 0;
size_t src_len = 0U;
if ((dst == NULL) || (dst_size == 0U)) {
return EINVAL;
}
if (src == NULL) {
dst[0] = '\0';
return EINVAL;
}
src_len = opj_strnlen_s(src, dst_size);
if (src_len >= dst_size) {
return ERANGE;
}
memcpy(dst, src, src_len);
dst[src_len] = '\0';
return 0;
}
#endif /* OPJ_STRING_H */

View File

@ -1,6 +1,6 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
@ -8,7 +8,7 @@
* Copyright (c) 2002-2014, Professor Benoit Macq
* Copyright (c) 2001-2003, David Janssens
* Copyright (c) 2002-2003, Yannick Verschueren
* Copyright (c) 2003-2007, Francois-Olivier Devaux
* Copyright (c) 2003-2007, Francois-Olivier Devaux
* Copyright (c) 2003-2014, Antonin Descampe
* Copyright (c) 2005, Herve Drolon, FreeImage Team
* All rights reserved.
@ -50,19 +50,19 @@ typedef struct raw_comp_cparameters {
/**@name RAW image encoding parameters */
/*@{*/
typedef struct raw_cparameters {
/** width of the raw image */
int rawWidth;
/** height of the raw image */
int rawHeight;
/** width of the raw image */
int rawWidth;
/** height of the raw image */
int rawHeight;
/** number of components of the raw image */
int rawComp;
int rawComp;
/** bit depth of the raw image */
int rawBitDepth;
/** signed/unsigned raw image */
OPJ_BOOL rawSigned;
/** raw components parameters */
raw_comp_cparameters_t *rawComps;
/*@}*/
/*@}*/
} raw_cparameters_t;
/* Component precision clipping */
@ -71,14 +71,18 @@ void clip_component(opj_image_comp_t* component, OPJ_UINT32 precision);
void scale_component(opj_image_comp_t* component, OPJ_UINT32 precision);
/* planar / interleaved conversions */
typedef void (* convert_32s_CXPX)(const OPJ_INT32* pSrc, OPJ_INT32* const* pDst, OPJ_SIZE_T length);
typedef void (* convert_32s_CXPX)(const OPJ_INT32* pSrc, OPJ_INT32* const* pDst,
OPJ_SIZE_T length);
extern const convert_32s_CXPX convert_32s_CXPX_LUT[5];
typedef void (* convert_32s_PXCX)(OPJ_INT32 const* const* pSrc, OPJ_INT32* pDst, OPJ_SIZE_T length, OPJ_INT32 adjust);
typedef void (* convert_32s_PXCX)(OPJ_INT32 const* const* pSrc, OPJ_INT32* pDst,
OPJ_SIZE_T length, OPJ_INT32 adjust);
extern const convert_32s_PXCX convert_32s_PXCX_LUT[5];
/* bit depth conversions */
typedef void (* convert_XXx32s_C1R)(const OPJ_BYTE* pSrc, OPJ_INT32* pDst, OPJ_SIZE_T length);
typedef void (* convert_XXx32s_C1R)(const OPJ_BYTE* pSrc, OPJ_INT32* pDst,
OPJ_SIZE_T length);
extern const convert_XXx32s_C1R convert_XXu32s_C1R_LUT[9]; /* up to 8bpp */
typedef void (* convert_32sXXx_C1R)(const OPJ_INT32* pSrc, OPJ_BYTE* pDst, OPJ_SIZE_T length);
typedef void (* convert_32sXXx_C1R)(const OPJ_INT32* pSrc, OPJ_BYTE* pDst,
OPJ_SIZE_T length);
extern const convert_32sXXx_C1R convert_32sXXu_C1R_LUT[9]; /* up to 8bpp */
@ -108,12 +112,15 @@ int imagetopnm(opj_image_t *image, const char *outfile, int force_split);
/* RAW conversion */
int imagetoraw(opj_image_t * image, const char *outfile);
int imagetorawl(opj_image_t * image, const char *outfile);
opj_image_t* rawtoimage(const char *filename, opj_cparameters_t *parameters, raw_cparameters_t *raw_cp);
opj_image_t* rawltoimage(const char *filename, opj_cparameters_t *parameters, raw_cparameters_t *raw_cp);
opj_image_t* rawtoimage(const char *filename, opj_cparameters_t *parameters,
raw_cparameters_t *raw_cp);
opj_image_t* rawltoimage(const char *filename, opj_cparameters_t *parameters,
raw_cparameters_t *raw_cp);
/* PNG conversion*/
extern int imagetopng(opj_image_t *image, const char *write_idf);
extern opj_image_t* pngtoimage(const char *filename, opj_cparameters_t *parameters);
extern opj_image_t* pngtoimage(const char *filename,
opj_cparameters_t *parameters);
#endif /* __J2K_CONVERT_H */

View File

@ -1,6 +1,6 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
@ -40,7 +40,7 @@ extern "C" {
/**
Write a structured index to a file
@param cstr_info Codestream information
@param cstr_info Codestream information
@param index Index filename
@return Returns 0 if successful, returns 1 otherwise
*/

View File

@ -1,9 +1,9 @@
/*
* uce-dirent.h - operating system independent dirent implementation
*
*
* Copyright (C) 1998-2002 Toni Ronkko
*
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* ``Software''), to deal in the Software without restriction, including
@ -11,10 +11,10 @@
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
@ -22,8 +22,8 @@
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
*
*
*
* May 28 1998, Toni Ronkko <tronkko@messi.uku.fi>
*
* $Id: uce-dirent.h,v 1.7 2002/05/13 10:48:35 tr Exp $
@ -59,7 +59,7 @@
* Revision 1.1 1998/07/04 16:27:51 tr
* Initial revision
*
*
*
* MSVC 1.0 scans automatic dependencies incorrectly when your project
* contains this very header. The problem is that MSVC cannot handle
* include directives inside #if..#endif block those are never entered.
@ -106,14 +106,14 @@
*/
#if !defined(HAVE_DIRENT_H) && !defined(HAVE_DIRECT_H) && !defined(HAVE_SYS_DIR_H) && !defined(HAVE_NDIR_H) && !defined(HAVE_SYS_NDIR_H) && !defined(HAVE_DIR_H)
# if defined(_MSC_VER) /* Microsoft C/C++ */
/* no dirent.h */
/* no dirent.h */
# elif defined(__MINGW32__) /* MinGW */
/* no dirent.h */
/* no dirent.h */
# elif defined(__BORLANDC__) /* Borland C/C++ */
# define HAVE_DIRENT_H
# define VOID_CLOSEDIR
# elif defined(__TURBOC__) /* Borland Turbo C */
/* no dirent.h */
/* no dirent.h */
# elif defined(__WATCOMC__) /* Watcom C/C++ */
# define HAVE_DIRECT_H
# elif defined(__apollo) /* Apollo */
@ -172,7 +172,7 @@
#elif defined(MSDOS) || defined(WIN32)
/* figure out type of underlaying directory interface to be used */
/* figure out type of underlaying directory interface to be used */
# if defined(WIN32)
# define DIRENT_WIN32_INTERFACE
# elif defined(MSDOS)
@ -181,7 +181,7 @@
# error "missing native dirent interface"
# endif
/*** WIN32 specifics ***/
/*** WIN32 specifics ***/
# if defined(DIRENT_WIN32_INTERFACE)
# include <windows.h>
# if !defined(DIRENT_MAXNAMLEN)
@ -189,11 +189,11 @@
# endif
/*** MS-DOS specifics ***/
/*** MS-DOS specifics ***/
# elif defined(DIRENT_MSDOS_INTERFACE)
# include <dos.h>
/* Borland defines file length macros in dir.h */
/* Borland defines file length macros in dir.h */
# if defined(__BORLANDC__)
# include <dir.h>
# if !defined(DIRENT_MAXNAMLEN)
@ -203,7 +203,7 @@
# define _find_t find_t
# endif
/* Turbo C defines ffblk structure in dir.h */
/* Turbo C defines ffblk structure in dir.h */
# elif defined(__TURBOC__)
# include <dir.h>
# if !defined(DIRENT_MAXNAMLEN)
@ -211,13 +211,13 @@
# endif
# define DIRENT_USE_FFBLK
/* MSVC */
/* MSVC */
# elif defined(_MSC_VER)
# if !defined(DIRENT_MAXNAMLEN)
# define DIRENT_MAXNAMLEN (12)
# endif
/* Watcom */
/* Watcom */
# elif defined(__WATCOMC__)
# if !defined(DIRENT_MAXNAMLEN)
# if defined(__OS2__) || defined(__NT__)
@ -230,7 +230,7 @@
# endif
# endif
/*** generic MS-DOS and MS-Windows stuff ***/
/*** generic MS-DOS and MS-Windows stuff ***/
# if !defined(NAME_MAX) && defined(DIRENT_MAXNAMLEN)
# define NAME_MAX DIRENT_MAXNAMLEN
# endif
@ -239,16 +239,16 @@
# endif
/*
* Substitute for real dirent structure. Note that `d_name' field is a
* true character array although we have it copied in the implementation
* dependent data. We could save some memory if we had declared `d_name'
* as a pointer referring the name within implementation dependent data.
* We have not done that since some code may rely on sizeof(d_name) to be
* something other than four. Besides, directory entries are typically so
* small that it takes virtually no time to copy them from place to place.
*/
typedef struct dirent {
/*
* Substitute for real dirent structure. Note that `d_name' field is a
* true character array although we have it copied in the implementation
* dependent data. We could save some memory if we had declared `d_name'
* as a pointer referring the name within implementation dependent data.
* We have not done that since some code may rely on sizeof(d_name) to be
* something other than four. Besides, directory entries are typically so
* small that it takes virtually no time to copy them from place to place.
*/
typedef struct dirent {
char d_name[NAME_MAX + 1];
/*** Operating system specific part ***/
@ -261,31 +261,31 @@
struct _find_t data;
# endif
# endif
} dirent;
} dirent;
/* DIR substitute structure containing directory name. The name is
* essential for the operation of ``rewinndir'' function. */
typedef struct DIR {
/* DIR substitute structure containing directory name. The name is
* essential for the operation of ``rewinndir'' function. */
typedef struct DIR {
char *dirname; /* directory being scanned */
dirent current; /* current entry */
int dirent_filled; /* is current un-processed? */
/*** Operating system specific part ***/
/*** Operating system specific part ***/
# if defined(DIRENT_WIN32_INTERFACE)
HANDLE search_handle;
# elif defined(DIRENT_MSDOS_INTERFACE)
# endif
} DIR;
} DIR;
# ifdef __cplusplus
extern "C" {
# endif
/* supply prototypes for dirent functions */
static DIR *opendir (const char *dirname);
static struct dirent *readdir (DIR *dirp);
static int closedir (DIR *dirp);
static void rewinddir (DIR *dirp);
static DIR *opendir(const char *dirname);
static struct dirent *readdir(DIR *dirp);
static int closedir(DIR *dirp);
static void rewinddir(DIR *dirp);
/*
* Implement dirent interface as static functions so that the user does not
@ -312,9 +312,9 @@ static void rewinddir (DIR *dirp);
# define _dos_findfirst(name,flags,dest) findfirst(name,dest,flags)
#endif
static int _initdir (DIR *p);
static const char *_getdirname (const struct dirent *dp);
static void _setdirname (struct DIR *dirp);
static int _initdir(DIR *p);
static const char *_getdirname(const struct dirent *dp);
static void _setdirname(struct DIR *dirp);
/*
* <function name="opendir">
@ -325,7 +325,7 @@ static void _setdirname (struct DIR *dirp);
* internal working area that is used for retrieving individual directory
* entries. The internal working area has no fields of your interest.
*
* <ret>Returns a pointer to the internal working area or NULL in case the
* <ret>Returns a pointer to the internal working area or NULL in case the
* directory stream could not be opened. Global `errno' variable will set
* in case of error as follows:
*
@ -344,46 +344,45 @@ static void _setdirname (struct DIR *dirp);
*/
static DIR *opendir(const char *dirname)
{
DIR *dirp;
assert (dirname != NULL);
dirp = (DIR*)malloc (sizeof (struct DIR));
if (dirp != NULL) {
char *p;
/* allocate room for directory name */
dirp->dirname = (char*) malloc (strlen (dirname) + 1 + strlen ("\\*.*"));
if (dirp->dirname == NULL) {
/* failed to duplicate directory name. errno set by malloc() */
free (dirp);
return NULL;
}
/* Copy directory name while appending directory separator and "*.*".
* Directory separator is not appended if the name already ends with
* drive or directory separator. Directory separator is assumed to be
* '/' or '\' and drive separator is assumed to be ':'. */
strcpy (dirp->dirname, dirname);
p = strchr (dirp->dirname, '\0');
if (dirp->dirname < p &&
*(p - 1) != '\\' && *(p - 1) != '/' && *(p - 1) != ':')
{
strcpy (p++, "\\");
}
DIR *dirp;
assert(dirname != NULL);
dirp = (DIR*)malloc(sizeof(struct DIR));
if (dirp != NULL) {
char *p;
/* allocate room for directory name */
dirp->dirname = (char*) malloc(strlen(dirname) + 1 + strlen("\\*.*"));
if (dirp->dirname == NULL) {
/* failed to duplicate directory name. errno set by malloc() */
free(dirp);
return NULL;
}
/* Copy directory name while appending directory separator and "*.*".
* Directory separator is not appended if the name already ends with
* drive or directory separator. Directory separator is assumed to be
* '/' or '\' and drive separator is assumed to be ':'. */
strcpy(dirp->dirname, dirname);
p = strchr(dirp->dirname, '\0');
if (dirp->dirname < p &&
*(p - 1) != '\\' && *(p - 1) != '/' && *(p - 1) != ':') {
strcpy(p++, "\\");
}
# ifdef DIRENT_WIN32_INTERFACE
strcpy (p, "*"); /*scan files with and without extension in win32*/
strcpy(p, "*"); /*scan files with and without extension in win32*/
# else
strcpy (p, "*.*"); /*scan files with and without extension in DOS*/
strcpy(p, "*.*"); /*scan files with and without extension in DOS*/
# endif
/* open stream */
if (_initdir (dirp) == 0) {
/* initialization failed */
free (dirp->dirname);
free (dirp);
return NULL;
/* open stream */
if (_initdir(dirp) == 0) {
/* initialization failed */
free(dirp->dirname);
free(dirp);
return NULL;
}
}
}
return dirp;
return dirp;
}
@ -434,57 +433,57 @@ static DIR *opendir(const char *dirname)
* </function>
*/
static struct dirent *
readdir (DIR *dirp)
readdir(DIR *dirp)
{
assert(dirp != NULL);
if (dirp == NULL) {
errno = EBADF;
return NULL;
}
assert(dirp != NULL);
if (dirp == NULL) {
errno = EBADF;
return NULL;
}
#if defined(DIRENT_WIN32_INTERFACE)
if (dirp->search_handle == INVALID_HANDLE_VALUE) {
/* directory stream was opened/rewound incorrectly or it ended normally */
errno = EBADF;
return NULL;
}
if (dirp->search_handle == INVALID_HANDLE_VALUE) {
/* directory stream was opened/rewound incorrectly or it ended normally */
errno = EBADF;
return NULL;
}
#endif
if (dirp->dirent_filled != 0) {
/*
* Directory entry has already been retrieved and there is no need to
* retrieve a new one. Directory entry will be retrieved in advance
* when the user calls readdir function for the first time. This is so
* because real dirent has separate functions for opening and reading
* the stream whereas Win32 and DOS dirents open the stream
* automatically when we retrieve the first file. Therefore, we have to
* save the first file when opening the stream and later we have to
* return the saved entry when the user tries to read the first entry.
*/
dirp->dirent_filled = 0;
} else {
/* fill in entry and return that */
if (dirp->dirent_filled != 0) {
/*
* Directory entry has already been retrieved and there is no need to
* retrieve a new one. Directory entry will be retrieved in advance
* when the user calls readdir function for the first time. This is so
* because real dirent has separate functions for opening and reading
* the stream whereas Win32 and DOS dirents open the stream
* automatically when we retrieve the first file. Therefore, we have to
* save the first file when opening the stream and later we have to
* return the saved entry when the user tries to read the first entry.
*/
dirp->dirent_filled = 0;
} else {
/* fill in entry and return that */
#if defined(DIRENT_WIN32_INTERFACE)
if (FindNextFile (dirp->search_handle, &dirp->current.data) == FALSE) {
/* Last file has been processed or an error occurred */
FindClose (dirp->search_handle);
dirp->search_handle = INVALID_HANDLE_VALUE;
errno = ENOENT;
return NULL;
}
if (FindNextFile(dirp->search_handle, &dirp->current.data) == FALSE) {
/* Last file has been processed or an error occurred */
FindClose(dirp->search_handle);
dirp->search_handle = INVALID_HANDLE_VALUE;
errno = ENOENT;
return NULL;
}
# elif defined(DIRENT_MSDOS_INTERFACE)
if (_dos_findnext (&dirp->current.data) != 0) {
/* _dos_findnext and findnext will set errno to ENOENT when no
* more entries could be retrieved. */
return NULL;
}
if (_dos_findnext(&dirp->current.data) != 0) {
/* _dos_findnext and findnext will set errno to ENOENT when no
* more entries could be retrieved. */
return NULL;
}
# endif
_setdirname (dirp);
assert (dirp->dirent_filled == 0);
}
return &dirp->current;
_setdirname(dirp);
assert(dirp->dirent_filled == 0);
}
return &dirp->current;
}
@ -508,38 +507,40 @@ readdir (DIR *dirp)
* </function>
*/
static int
closedir (DIR *dirp)
{
int retcode = 0;
closedir(DIR *dirp)
{
int retcode = 0;
/* make sure that dirp points to legal structure */
assert (dirp != NULL);
if (dirp == NULL) {
errno = EBADF;
return -1;
}
/* free directory name and search handles */
if (dirp->dirname != NULL) free (dirp->dirname);
/* make sure that dirp points to legal structure */
assert(dirp != NULL);
if (dirp == NULL) {
errno = EBADF;
return -1;
}
/* free directory name and search handles */
if (dirp->dirname != NULL) {
free(dirp->dirname);
}
#if defined(DIRENT_WIN32_INTERFACE)
if (dirp->search_handle != INVALID_HANDLE_VALUE) {
if (FindClose (dirp->search_handle) == FALSE) {
/* Unknown error */
retcode = -1;
errno = EBADF;
if (dirp->search_handle != INVALID_HANDLE_VALUE) {
if (FindClose(dirp->search_handle) == FALSE) {
/* Unknown error */
retcode = -1;
errno = EBADF;
}
}
}
#endif
#endif
/* clear dirp structure to make sure that it cannot be used anymore*/
memset (dirp, 0, sizeof (*dirp));
/* clear dirp structure to make sure that it cannot be used anymore*/
memset(dirp, 0, sizeof(*dirp));
# if defined(DIRENT_WIN32_INTERFACE)
dirp->search_handle = INVALID_HANDLE_VALUE;
dirp->search_handle = INVALID_HANDLE_VALUE;
# endif
free (dirp);
return retcode;
free(dirp);
return retcode;
}
@ -565,32 +566,32 @@ closedir (DIR *dirp)
* notice it later when you try to retrieve the first directory entry.
*/
static void
rewinddir (DIR *dirp)
{
/* make sure that dirp is legal */
assert (dirp != NULL);
if (dirp == NULL) {
errno = EBADF;
return;
}
assert (dirp->dirname != NULL);
/* close previous stream */
#if defined(DIRENT_WIN32_INTERFACE)
if (dirp->search_handle != INVALID_HANDLE_VALUE) {
if (FindClose (dirp->search_handle) == FALSE) {
/* Unknown error */
errno = EBADF;
rewinddir(DIR *dirp)
{
/* make sure that dirp is legal */
assert(dirp != NULL);
if (dirp == NULL) {
errno = EBADF;
return;
}
assert(dirp->dirname != NULL);
/* close previous stream */
#if defined(DIRENT_WIN32_INTERFACE)
if (dirp->search_handle != INVALID_HANDLE_VALUE) {
if (FindClose(dirp->search_handle) == FALSE) {
/* Unknown error */
errno = EBADF;
}
}
}
#endif
/* re-open previous stream */
if (_initdir (dirp) == 0) {
/* initialization failed but we cannot deal with error. User will notice
* error later when she tries to retrieve first directory enty. */
/*EMPTY*/;
}
/* re-open previous stream */
if (_initdir(dirp) == 0) {
/* initialization failed but we cannot deal with error. User will notice
* error later when she tries to retrieve first directory enty. */
/*EMPTY*/;
}
}
@ -599,38 +600,37 @@ rewinddir (DIR *dirp)
* Be sure to close previous stream before opening new one.
*/
static int
_initdir (DIR *dirp)
{
assert (dirp != NULL);
assert (dirp->dirname != NULL);
dirp->dirent_filled = 0;
_initdir(DIR *dirp)
{
assert(dirp != NULL);
assert(dirp->dirname != NULL);
dirp->dirent_filled = 0;
# if defined(DIRENT_WIN32_INTERFACE)
/* Open stream and retrieve first file */
dirp->search_handle = FindFirstFile (dirp->dirname, &dirp->current.data);
if (dirp->search_handle == INVALID_HANDLE_VALUE) {
/* something went wrong but we don't know what. GetLastError() could
* give us more information about the error, but then we should map
* the error code into errno. */
errno = ENOENT;
return 0;
}
/* Open stream and retrieve first file */
dirp->search_handle = FindFirstFile(dirp->dirname, &dirp->current.data);
if (dirp->search_handle == INVALID_HANDLE_VALUE) {
/* something went wrong but we don't know what. GetLastError() could
* give us more information about the error, but then we should map
* the error code into errno. */
errno = ENOENT;
return 0;
}
# elif defined(DIRENT_MSDOS_INTERFACE)
if (_dos_findfirst (dirp->dirname,
_A_SUBDIR | _A_RDONLY | _A_ARCH | _A_SYSTEM | _A_HIDDEN,
&dirp->current.data) != 0)
{
/* _dos_findfirst and findfirst will set errno to ENOENT when no
* more entries could be retrieved. */
return 0;
}
if (_dos_findfirst(dirp->dirname,
_A_SUBDIR | _A_RDONLY | _A_ARCH | _A_SYSTEM | _A_HIDDEN,
&dirp->current.data) != 0) {
/* _dos_findfirst and findfirst will set errno to ENOENT when no
* more entries could be retrieved. */
return 0;
}
# endif
/* initialize DIR and it's first entry */
_setdirname (dirp);
dirp->dirent_filled = 1;
return 1;
/* initialize DIR and it's first entry */
_setdirname(dirp);
dirp->dirent_filled = 1;
return 1;
}
@ -638,17 +638,17 @@ _initdir (DIR *dirp)
* Return implementation dependent name of the current directory entry.
*/
static const char *
_getdirname (const struct dirent *dp)
_getdirname(const struct dirent *dp)
{
#if defined(DIRENT_WIN32_INTERFACE)
return dp->data.cFileName;
return dp->data.cFileName;
#elif defined(DIRENT_USE_FFBLK)
return dp->data.ff_name;
return dp->data.ff_name;
#else
return dp->data.name;
#endif
return dp->data.name;
#endif
}
@ -656,16 +656,17 @@ _getdirname (const struct dirent *dp)
* Copy name of implementation dependent directory entry to the d_name field.
*/
static void
_setdirname (struct DIR *dirp) {
/* make sure that d_name is long enough */
assert (strlen (_getdirname (&dirp->current)) <= NAME_MAX);
strncpy (dirp->current.d_name,
_getdirname (&dirp->current),
NAME_MAX);
dirp->current.d_name[NAME_MAX] = '\0'; /*char d_name[NAME_MAX+1]*/
_setdirname(struct DIR *dirp)
{
/* make sure that d_name is long enough */
assert(strlen(_getdirname(&dirp->current)) <= NAME_MAX);
strncpy(dirp->current.d_name,
_getdirname(&dirp->current),
NAME_MAX);
dirp->current.d_name[NAME_MAX] = '\0'; /*char d_name[NAME_MAX+1]*/
}
# ifdef __cplusplus
}
# endif

103
src/bin/jp3d/convert.h Executable file → Normal file
View File

@ -1,51 +1,52 @@
/*
* Copyright (c) 2001-2003, David Janssens
* Copyright (c) 2002-2003, Yannick Verschueren
* Copyright (c) 2003-2005, Francois Devaux and Antonin Descampe
* Copyright (c) 2005, Herve Drolon, FreeImage Team
* Copyright (c) 2002-2005, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
* Copyright (c) 2006, Mónica Díez García, Image Processing Laboratory, University of Valladolid, Spain
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __JP3D_CONVERT_H
#define __JP3D_CONVERT_H
/**
Load a single volume component encoded in PGX file format
@param filename Name of the PGX file to load
@param parameters *List ?*
@return Returns a greyscale volume if successful, returns NULL otherwise
*/
opj_volume_t* pgxtovolume(char *filename, opj_cparameters_t *parameters);
int volumetopgx(opj_volume_t *volume, char *outfile);
opj_volume_t* bintovolume(char *filename,char *fileimg, opj_cparameters_t *parameters);
int volumetobin(opj_volume_t *volume, char *outfile);
opj_volume_t* imgtovolume(char *fileimg, opj_cparameters_t *parameters);
#endif /* __J2K_CONVERT_H */
/*
* Copyright (c) 2001-2003, David Janssens
* Copyright (c) 2002-2003, Yannick Verschueren
* Copyright (c) 2003-2005, Francois Devaux and Antonin Descampe
* Copyright (c) 2005, Herve Drolon, FreeImage Team
* Copyright (c) 2002-2005, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
* Copyright (c) 2006, Mónica Díez García, Image Processing Laboratory, University of Valladolid, Spain
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __JP3D_CONVERT_H
#define __JP3D_CONVERT_H
/**
Load a single volume component encoded in PGX file format
@param filename Name of the PGX file to load
@param parameters *List ?*
@return Returns a greyscale volume if successful, returns NULL otherwise
*/
opj_volume_t* pgxtovolume(char *filename, opj_cparameters_t *parameters);
int volumetopgx(opj_volume_t *volume, char *outfile);
opj_volume_t* bintovolume(char *filename, char *fileimg,
opj_cparameters_t *parameters);
int volumetobin(opj_volume_t *volume, char *outfile);
opj_volume_t* imgtovolume(char *fileimg, opj_cparameters_t *parameters);
#endif /* __J2K_CONVERT_H */

28
src/bin/jp3d/getopt.h Executable file → Normal file
View File

@ -1,14 +1,14 @@
/* last review : october 29th, 2002 */
#ifndef _GETOPT_H_
#define _GETOPT_H_
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);
#endif /* _GETOPT_H_ */
/* last review : october 29th, 2002 */
#ifndef _GETOPT_H_
#define _GETOPT_H_
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);
#endif /* _GETOPT_H_ */

View File

@ -1,8 +1,8 @@
/*
* uce-dirent.h - operating system independent dirent implementation
*
*
* Copyright (C) 1998-2002 Toni Ronkko
*
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* ``Software''), to deal in the Software without restriction, including
@ -10,10 +10,10 @@
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
@ -21,8 +21,8 @@
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
*
*
*
* May 28 1998, Toni Ronkko <tronkko@messi.uku.fi>
*
* $Id: uce-dirent.h,v 1.7 2002/05/13 10:48:35 tr Exp $
@ -58,7 +58,7 @@
* Revision 1.1 1998/07/04 16:27:51 tr
* Initial revision
*
*
*
* MSVC 1.0 scans automatic dependencies incorrectly when your project
* contains this very header. The problem is that MSVC cannot handle
* include directives inside #if..#endif block those are never entered.
@ -105,14 +105,14 @@
*/
#if !defined(HAVE_DIRENT_H) && !defined(HAVE_DIRECT_H) && !defined(HAVE_SYS_DIR_H) && !defined(HAVE_NDIR_H) && !defined(HAVE_SYS_NDIR_H) && !defined(HAVE_DIR_H)
# if defined(_MSC_VER) /* Microsoft C/C++ */
/* no dirent.h */
/* no dirent.h */
# elif defined(__MINGW32__) /* MinGW */
/* no dirent.h */
/* no dirent.h */
# elif defined(__BORLANDC__) /* Borland C/C++ */
# define HAVE_DIRENT_H
# define VOID_CLOSEDIR
# elif defined(__TURBOC__) /* Borland Turbo C */
/* no dirent.h */
/* no dirent.h */
# elif defined(__WATCOMC__) /* Watcom C/C++ */
# define HAVE_DIRECT_H
# elif defined(__apollo) /* Apollo */
@ -171,7 +171,7 @@
#elif defined(MSDOS) || defined(WIN32)
/* figure out type of underlaying directory interface to be used */
/* figure out type of underlaying directory interface to be used */
# if defined(WIN32)
# define DIRENT_WIN32_INTERFACE
# elif defined(MSDOS)
@ -180,7 +180,7 @@
# error "missing native dirent interface"
# endif
/*** WIN32 specifics ***/
/*** WIN32 specifics ***/
# if defined(DIRENT_WIN32_INTERFACE)
# include <windows.h>
# if !defined(DIRENT_MAXNAMLEN)
@ -188,11 +188,11 @@
# endif
/*** MS-DOS specifics ***/
/*** MS-DOS specifics ***/
# elif defined(DIRENT_MSDOS_INTERFACE)
# include <dos.h>
/* Borland defines file length macros in dir.h */
/* Borland defines file length macros in dir.h */
# if defined(__BORLANDC__)
# include <dir.h>
# if !defined(DIRENT_MAXNAMLEN)
@ -202,7 +202,7 @@
# define _find_t find_t
# endif
/* Turbo C defines ffblk structure in dir.h */
/* Turbo C defines ffblk structure in dir.h */
# elif defined(__TURBOC__)
# include <dir.h>
# if !defined(DIRENT_MAXNAMLEN)
@ -210,13 +210,13 @@
# endif
# define DIRENT_USE_FFBLK
/* MSVC */
/* MSVC */
# elif defined(_MSC_VER)
# if !defined(DIRENT_MAXNAMLEN)
# define DIRENT_MAXNAMLEN (12)
# endif
/* Watcom */
/* Watcom */
# elif defined(__WATCOMC__)
# if !defined(DIRENT_MAXNAMLEN)
# if defined(__OS2__) || defined(__NT__)
@ -229,7 +229,7 @@
# endif
# endif
/*** generic MS-DOS and MS-Windows stuff ***/
/*** generic MS-DOS and MS-Windows stuff ***/
# if !defined(NAME_MAX) && defined(DIRENT_MAXNAMLEN)
# define NAME_MAX DIRENT_MAXNAMLEN
# endif
@ -238,16 +238,16 @@
# endif
/*
* Substitute for real dirent structure. Note that `d_name' field is a
* true character array although we have it copied in the implementation
* dependent data. We could save some memory if we had declared `d_name'
* as a pointer referring the name within implementation dependent data.
* We have not done that since some code may rely on sizeof(d_name) to be
* something other than four. Besides, directory entries are typically so
* small that it takes virtually no time to copy them from place to place.
*/
typedef struct dirent {
/*
* Substitute for real dirent structure. Note that `d_name' field is a
* true character array although we have it copied in the implementation
* dependent data. We could save some memory if we had declared `d_name'
* as a pointer referring the name within implementation dependent data.
* We have not done that since some code may rely on sizeof(d_name) to be
* something other than four. Besides, directory entries are typically so
* small that it takes virtually no time to copy them from place to place.
*/
typedef struct dirent {
char d_name[NAME_MAX + 1];
/*** Operating system specific part ***/
@ -260,31 +260,31 @@
struct _find_t data;
# endif
# endif
} dirent;
} dirent;
/* DIR substitute structure containing directory name. The name is
* essential for the operation of ``rewinndir'' function. */
typedef struct DIR {
/* DIR substitute structure containing directory name. The name is
* essential for the operation of ``rewinndir'' function. */
typedef struct DIR {
char *dirname; /* directory being scanned */
dirent current; /* current entry */
int dirent_filled; /* is current un-processed? */
/*** Operating system specific part ***/
/*** Operating system specific part ***/
# if defined(DIRENT_WIN32_INTERFACE)
HANDLE search_handle;
# elif defined(DIRENT_MSDOS_INTERFACE)
# endif
} DIR;
} DIR;
# ifdef __cplusplus
extern "C" {
# endif
/* supply prototypes for dirent functions */
static DIR *opendir (const char *dirname);
static struct dirent *readdir (DIR *dirp);
static int closedir (DIR *dirp);
static void rewinddir (DIR *dirp);
static DIR *opendir(const char *dirname);
static struct dirent *readdir(DIR *dirp);
static int closedir(DIR *dirp);
static void rewinddir(DIR *dirp);
/*
* Implement dirent interface as static functions so that the user does not
@ -311,9 +311,9 @@ static void rewinddir (DIR *dirp);
# define _dos_findfirst(name,flags,dest) findfirst(name,dest,flags)
#endif
static int _initdir (DIR *p);
static const char *_getdirname (const struct dirent *dp);
static void _setdirname (struct DIR *dirp);
static int _initdir(DIR *p);
static const char *_getdirname(const struct dirent *dp);
static void _setdirname(struct DIR *dirp);
/*
* <function name="opendir">
@ -324,7 +324,7 @@ static void _setdirname (struct DIR *dirp);
* internal working area that is used for retrieving individual directory
* entries. The internal working area has no fields of your interest.
*
* <ret>Returns a pointer to the internal working area or NULL in case the
* <ret>Returns a pointer to the internal working area or NULL in case the
* directory stream could not be opened. Global `errno' variable will set
* in case of error as follows:
*
@ -343,46 +343,45 @@ static void _setdirname (struct DIR *dirp);
*/
static DIR *opendir(const char *dirname)
{
DIR *dirp;
assert (dirname != NULL);
dirp = (DIR*)malloc (sizeof (struct DIR));
if (dirp != NULL) {
char *p;
/* allocate room for directory name */
dirp->dirname = (char*) malloc (strlen (dirname) + 1 + strlen ("\\*.*"));
if (dirp->dirname == NULL) {
/* failed to duplicate directory name. errno set by malloc() */
free (dirp);
return NULL;
}
/* Copy directory name while appending directory separator and "*.*".
* Directory separator is not appended if the name already ends with
* drive or directory separator. Directory separator is assumed to be
* '/' or '\' and drive separator is assumed to be ':'. */
strcpy (dirp->dirname, dirname);
p = strchr (dirp->dirname, '\0');
if (dirp->dirname < p &&
*(p - 1) != '\\' && *(p - 1) != '/' && *(p - 1) != ':')
{
strcpy (p++, "\\");
}
DIR *dirp;
assert(dirname != NULL);
dirp = (DIR*)malloc(sizeof(struct DIR));
if (dirp != NULL) {
char *p;
/* allocate room for directory name */
dirp->dirname = (char*) malloc(strlen(dirname) + 1 + strlen("\\*.*"));
if (dirp->dirname == NULL) {
/* failed to duplicate directory name. errno set by malloc() */
free(dirp);
return NULL;
}
/* Copy directory name while appending directory separator and "*.*".
* Directory separator is not appended if the name already ends with
* drive or directory separator. Directory separator is assumed to be
* '/' or '\' and drive separator is assumed to be ':'. */
strcpy(dirp->dirname, dirname);
p = strchr(dirp->dirname, '\0');
if (dirp->dirname < p &&
*(p - 1) != '\\' && *(p - 1) != '/' && *(p - 1) != ':') {
strcpy(p++, "\\");
}
# ifdef DIRENT_WIN32_INTERFACE
strcpy (p, "*"); /*scan files with and without extension in win32*/
strcpy(p, "*"); /*scan files with and without extension in win32*/
# else
strcpy (p, "*.*"); /*scan files with and without extension in DOS*/
strcpy(p, "*.*"); /*scan files with and without extension in DOS*/
# endif
/* open stream */
if (_initdir (dirp) == 0) {
/* initialization failed */
free (dirp->dirname);
free (dirp);
return NULL;
/* open stream */
if (_initdir(dirp) == 0) {
/* initialization failed */
free(dirp->dirname);
free(dirp);
return NULL;
}
}
}
return dirp;
return dirp;
}
@ -433,57 +432,57 @@ static DIR *opendir(const char *dirname)
* </function>
*/
static struct dirent *
readdir (DIR *dirp)
readdir(DIR *dirp)
{
assert(dirp != NULL);
if (dirp == NULL) {
errno = EBADF;
return NULL;
}
assert(dirp != NULL);
if (dirp == NULL) {
errno = EBADF;
return NULL;
}
#if defined(DIRENT_WIN32_INTERFACE)
if (dirp->search_handle == INVALID_HANDLE_VALUE) {
/* directory stream was opened/rewound incorrectly or it ended normally */
errno = EBADF;
return NULL;
}
if (dirp->search_handle == INVALID_HANDLE_VALUE) {
/* directory stream was opened/rewound incorrectly or it ended normally */
errno = EBADF;
return NULL;
}
#endif
if (dirp->dirent_filled != 0) {
/*
* Directory entry has already been retrieved and there is no need to
* retrieve a new one. Directory entry will be retrieved in advance
* when the user calls readdir function for the first time. This is so
* because real dirent has separate functions for opening and reading
* the stream whereas Win32 and DOS dirents open the stream
* automatically when we retrieve the first file. Therefore, we have to
* save the first file when opening the stream and later we have to
* return the saved entry when the user tries to read the first entry.
*/
dirp->dirent_filled = 0;
} else {
/* fill in entry and return that */
if (dirp->dirent_filled != 0) {
/*
* Directory entry has already been retrieved and there is no need to
* retrieve a new one. Directory entry will be retrieved in advance
* when the user calls readdir function for the first time. This is so
* because real dirent has separate functions for opening and reading
* the stream whereas Win32 and DOS dirents open the stream
* automatically when we retrieve the first file. Therefore, we have to
* save the first file when opening the stream and later we have to
* return the saved entry when the user tries to read the first entry.
*/
dirp->dirent_filled = 0;
} else {
/* fill in entry and return that */
#if defined(DIRENT_WIN32_INTERFACE)
if (FindNextFile (dirp->search_handle, &dirp->current.data) == FALSE) {
/* Last file has been processed or an error occurred */
FindClose (dirp->search_handle);
dirp->search_handle = INVALID_HANDLE_VALUE;
errno = ENOENT;
return NULL;
}
if (FindNextFile(dirp->search_handle, &dirp->current.data) == FALSE) {
/* Last file has been processed or an error occurred */
FindClose(dirp->search_handle);
dirp->search_handle = INVALID_HANDLE_VALUE;
errno = ENOENT;
return NULL;
}
# elif defined(DIRENT_MSDOS_INTERFACE)
if (_dos_findnext (&dirp->current.data) != 0) {
/* _dos_findnext and findnext will set errno to ENOENT when no
* more entries could be retrieved. */
return NULL;
}
if (_dos_findnext(&dirp->current.data) != 0) {
/* _dos_findnext and findnext will set errno to ENOENT when no
* more entries could be retrieved. */
return NULL;
}
# endif
_setdirname (dirp);
assert (dirp->dirent_filled == 0);
}
return &dirp->current;
_setdirname(dirp);
assert(dirp->dirent_filled == 0);
}
return &dirp->current;
}
@ -507,38 +506,40 @@ readdir (DIR *dirp)
* </function>
*/
static int
closedir (DIR *dirp)
{
int retcode = 0;
closedir(DIR *dirp)
{
int retcode = 0;
/* make sure that dirp points to legal structure */
assert (dirp != NULL);
if (dirp == NULL) {
errno = EBADF;
return -1;
}
/* free directory name and search handles */
if (dirp->dirname != NULL) free (dirp->dirname);
/* make sure that dirp points to legal structure */
assert(dirp != NULL);
if (dirp == NULL) {
errno = EBADF;
return -1;
}
/* free directory name and search handles */
if (dirp->dirname != NULL) {
free(dirp->dirname);
}
#if defined(DIRENT_WIN32_INTERFACE)
if (dirp->search_handle != INVALID_HANDLE_VALUE) {
if (FindClose (dirp->search_handle) == FALSE) {
/* Unknown error */
retcode = -1;
errno = EBADF;
if (dirp->search_handle != INVALID_HANDLE_VALUE) {
if (FindClose(dirp->search_handle) == FALSE) {
/* Unknown error */
retcode = -1;
errno = EBADF;
}
}
}
#endif
#endif
/* clear dirp structure to make sure that it cannot be used anymore*/
memset (dirp, 0, sizeof (*dirp));
/* clear dirp structure to make sure that it cannot be used anymore*/
memset(dirp, 0, sizeof(*dirp));
# if defined(DIRENT_WIN32_INTERFACE)
dirp->search_handle = INVALID_HANDLE_VALUE;
dirp->search_handle = INVALID_HANDLE_VALUE;
# endif
free (dirp);
return retcode;
free(dirp);
return retcode;
}
@ -564,32 +565,32 @@ closedir (DIR *dirp)
* notice it later when you try to retrieve the first directory entry.
*/
static void
rewinddir (DIR *dirp)
{
/* make sure that dirp is legal */
assert (dirp != NULL);
if (dirp == NULL) {
errno = EBADF;
return;
}
assert (dirp->dirname != NULL);
/* close previous stream */
#if defined(DIRENT_WIN32_INTERFACE)
if (dirp->search_handle != INVALID_HANDLE_VALUE) {
if (FindClose (dirp->search_handle) == FALSE) {
/* Unknown error */
errno = EBADF;
rewinddir(DIR *dirp)
{
/* make sure that dirp is legal */
assert(dirp != NULL);
if (dirp == NULL) {
errno = EBADF;
return;
}
assert(dirp->dirname != NULL);
/* close previous stream */
#if defined(DIRENT_WIN32_INTERFACE)
if (dirp->search_handle != INVALID_HANDLE_VALUE) {
if (FindClose(dirp->search_handle) == FALSE) {
/* Unknown error */
errno = EBADF;
}
}
}
#endif
/* re-open previous stream */
if (_initdir (dirp) == 0) {
/* initialization failed but we cannot deal with error. User will notice
* error later when she tries to retrieve first directory enty. */
/*EMPTY*/;
}
/* re-open previous stream */
if (_initdir(dirp) == 0) {
/* initialization failed but we cannot deal with error. User will notice
* error later when she tries to retrieve first directory enty. */
/*EMPTY*/;
}
}
@ -598,38 +599,37 @@ rewinddir (DIR *dirp)
* Be sure to close previous stream before opening new one.
*/
static int
_initdir (DIR *dirp)
{
assert (dirp != NULL);
assert (dirp->dirname != NULL);
dirp->dirent_filled = 0;
_initdir(DIR *dirp)
{
assert(dirp != NULL);
assert(dirp->dirname != NULL);
dirp->dirent_filled = 0;
# if defined(DIRENT_WIN32_INTERFACE)
/* Open stream and retrieve first file */
dirp->search_handle = FindFirstFile (dirp->dirname, &dirp->current.data);
if (dirp->search_handle == INVALID_HANDLE_VALUE) {
/* something went wrong but we don't know what. GetLastError() could
* give us more information about the error, but then we should map
* the error code into errno. */
errno = ENOENT;
return 0;
}
/* Open stream and retrieve first file */
dirp->search_handle = FindFirstFile(dirp->dirname, &dirp->current.data);
if (dirp->search_handle == INVALID_HANDLE_VALUE) {
/* something went wrong but we don't know what. GetLastError() could
* give us more information about the error, but then we should map
* the error code into errno. */
errno = ENOENT;
return 0;
}
# elif defined(DIRENT_MSDOS_INTERFACE)
if (_dos_findfirst (dirp->dirname,
_A_SUBDIR | _A_RDONLY | _A_ARCH | _A_SYSTEM | _A_HIDDEN,
&dirp->current.data) != 0)
{
/* _dos_findfirst and findfirst will set errno to ENOENT when no
* more entries could be retrieved. */
return 0;
}
if (_dos_findfirst(dirp->dirname,
_A_SUBDIR | _A_RDONLY | _A_ARCH | _A_SYSTEM | _A_HIDDEN,
&dirp->current.data) != 0) {
/* _dos_findfirst and findfirst will set errno to ENOENT when no
* more entries could be retrieved. */
return 0;
}
# endif
/* initialize DIR and it's first entry */
_setdirname (dirp);
dirp->dirent_filled = 1;
return 1;
/* initialize DIR and it's first entry */
_setdirname(dirp);
dirp->dirent_filled = 1;
return 1;
}
@ -637,17 +637,17 @@ _initdir (DIR *dirp)
* Return implementation dependent name of the current directory entry.
*/
static const char *
_getdirname (const struct dirent *dp)
_getdirname(const struct dirent *dp)
{
#if defined(DIRENT_WIN32_INTERFACE)
return dp->data.cFileName;
return dp->data.cFileName;
#elif defined(DIRENT_USE_FFBLK)
return dp->data.ff_name;
return dp->data.ff_name;
#else
return dp->data.name;
#endif
return dp->data.name;
#endif
}
@ -655,16 +655,17 @@ _getdirname (const struct dirent *dp)
* Copy name of implementation dependent directory entry to the d_name field.
*/
static void
_setdirname (struct DIR *dirp) {
/* make sure that d_name is long enough */
assert (strlen (_getdirname (&dirp->current)) <= NAME_MAX);
strncpy (dirp->current.d_name,
_getdirname (&dirp->current),
NAME_MAX);
dirp->current.d_name[NAME_MAX] = '\0'; /*char d_name[NAME_MAX+1]*/
_setdirname(struct DIR *dirp)
{
/* make sure that d_name is long enough */
assert(strlen(_getdirname(&dirp->current)) <= NAME_MAX);
strncpy(dirp->current.d_name,
_getdirname(&dirp->current),
NAME_MAX);
dirp->current.d_name[NAME_MAX] = '\0'; /*char d_name[NAME_MAX+1]*/
}
# ifdef __cplusplus
}
# endif

View File

@ -1,6 +1,6 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
@ -8,7 +8,7 @@
* Copyright (c) 2002-2014, Professor Benoit Macq
* Copyright (c) 2001-2003, David Janssens
* Copyright (c) 2002-2003, Yannick Verschueren
* Copyright (c) 2003-2007, Francois-Olivier Devaux
* Copyright (c) 2003-2007, Francois-Olivier Devaux
* Copyright (c) 2003-2014, Antonin Descampe
* Copyright (c) 2005, Herve Drolon, FreeImage Team
* All rights reserved.
@ -40,17 +40,17 @@
/**@name RAW image encoding parameters */
/*@{*/
typedef struct raw_cparameters {
/** width of the raw image */
int rawWidth;
/** height of the raw image */
int rawHeight;
/** components of the raw image */
int rawComp;
/** bit depth of the raw image */
int rawBitDepth;
/** signed/unsigned raw image */
opj_bool rawSigned;
/*@}*/
/** width of the raw image */
int rawWidth;
/** height of the raw image */
int rawHeight;
/** components of the raw image */
int rawComp;
/** bit depth of the raw image */
int rawBitDepth;
/** signed/unsigned raw image */
opj_bool rawSigned;
/*@}*/
} raw_cparameters_t;
/* TGA conversion */
@ -78,11 +78,13 @@ int imagetopnm(opj_image_t *image, const char *outfile);
/* RAW conversion */
int imagetoraw(opj_image_t * image, const char *outfile);
opj_image_t* rawtoimage(const char *filename, opj_cparameters_t *parameters, raw_cparameters_t *raw_cp);
opj_image_t* rawtoimage(const char *filename, opj_cparameters_t *parameters,
raw_cparameters_t *raw_cp);
/* PNG conversion*/
extern int imagetopng(opj_image_t *image, const char *write_idf);
extern opj_image_t* pngtoimage(const char *filename, opj_cparameters_t *parameters);
extern opj_image_t* pngtoimage(const char *filename,
opj_cparameters_t *parameters);
#endif /* __J2K_CONVERT_H */

View File

@ -1,6 +1,6 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
@ -40,7 +40,7 @@ extern "C" {
/**
Write a structured index to a file
@param cstr_info Codestream information
@param cstr_info Codestream information
@param index Index filename
@return Returns 0 if successful, returns 1 otherwise
*/

View File

@ -1,9 +1,9 @@
/*
* uce-dirent.h - operating system independent dirent implementation
*
*
* Copyright (C) 1998-2002 Toni Ronkko
*
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* ``Software''), to deal in the Software without restriction, including
@ -11,10 +11,10 @@
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
@ -22,8 +22,8 @@
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
*
*
*
* May 28 1998, Toni Ronkko <tronkko@messi.uku.fi>
*
* $Id: uce-dirent.h,v 1.7 2002/05/13 10:48:35 tr Exp $
@ -59,7 +59,7 @@
* Revision 1.1 1998/07/04 16:27:51 tr
* Initial revision
*
*
*
* MSVC 1.0 scans automatic dependencies incorrectly when your project
* contains this very header. The problem is that MSVC cannot handle
* include directives inside #if..#endif block those are never entered.
@ -106,14 +106,14 @@
*/
#if !defined(HAVE_DIRENT_H) && !defined(HAVE_DIRECT_H) && !defined(HAVE_SYS_DIR_H) && !defined(HAVE_NDIR_H) && !defined(HAVE_SYS_NDIR_H) && !defined(HAVE_DIR_H)
# if defined(_MSC_VER) /* Microsoft C/C++ */
/* no dirent.h */
/* no dirent.h */
# elif defined(__MINGW32__) /* MinGW */
/* no dirent.h */
/* no dirent.h */
# elif defined(__BORLANDC__) /* Borland C/C++ */
# define HAVE_DIRENT_H
# define VOID_CLOSEDIR
# elif defined(__TURBOC__) /* Borland Turbo C */
/* no dirent.h */
/* no dirent.h */
# elif defined(__WATCOMC__) /* Watcom C/C++ */
# define HAVE_DIRECT_H
# elif defined(__apollo) /* Apollo */
@ -172,7 +172,7 @@
#elif defined(MSDOS) || defined(WIN32)
/* figure out type of underlaying directory interface to be used */
/* figure out type of underlaying directory interface to be used */
# if defined(WIN32)
# define DIRENT_WIN32_INTERFACE
# elif defined(MSDOS)
@ -181,7 +181,7 @@
# error "missing native dirent interface"
# endif
/*** WIN32 specifics ***/
/*** WIN32 specifics ***/
# if defined(DIRENT_WIN32_INTERFACE)
# include <windows.h>
# if !defined(DIRENT_MAXNAMLEN)
@ -189,11 +189,11 @@
# endif
/*** MS-DOS specifics ***/
/*** MS-DOS specifics ***/
# elif defined(DIRENT_MSDOS_INTERFACE)
# include <dos.h>
/* Borland defines file length macros in dir.h */
/* Borland defines file length macros in dir.h */
# if defined(__BORLANDC__)
# include <dir.h>
# if !defined(DIRENT_MAXNAMLEN)
@ -203,7 +203,7 @@
# define _find_t find_t
# endif
/* Turbo C defines ffblk structure in dir.h */
/* Turbo C defines ffblk structure in dir.h */
# elif defined(__TURBOC__)
# include <dir.h>
# if !defined(DIRENT_MAXNAMLEN)
@ -211,13 +211,13 @@
# endif
# define DIRENT_USE_FFBLK
/* MSVC */
/* MSVC */
# elif defined(_MSC_VER)
# if !defined(DIRENT_MAXNAMLEN)
# define DIRENT_MAXNAMLEN (12)
# endif
/* Watcom */
/* Watcom */
# elif defined(__WATCOMC__)
# if !defined(DIRENT_MAXNAMLEN)
# if defined(__OS2__) || defined(__NT__)
@ -230,7 +230,7 @@
# endif
# endif
/*** generic MS-DOS and MS-Windows stuff ***/
/*** generic MS-DOS and MS-Windows stuff ***/
# if !defined(NAME_MAX) && defined(DIRENT_MAXNAMLEN)
# define NAME_MAX DIRENT_MAXNAMLEN
# endif
@ -239,16 +239,16 @@
# endif
/*
* Substitute for real dirent structure. Note that `d_name' field is a
* true character array although we have it copied in the implementation
* dependent data. We could save some memory if we had declared `d_name'
* as a pointer referring the name within implementation dependent data.
* We have not done that since some code may rely on sizeof(d_name) to be
* something other than four. Besides, directory entries are typically so
* small that it takes virtually no time to copy them from place to place.
*/
typedef struct dirent {
/*
* Substitute for real dirent structure. Note that `d_name' field is a
* true character array although we have it copied in the implementation
* dependent data. We could save some memory if we had declared `d_name'
* as a pointer referring the name within implementation dependent data.
* We have not done that since some code may rely on sizeof(d_name) to be
* something other than four. Besides, directory entries are typically so
* small that it takes virtually no time to copy them from place to place.
*/
typedef struct dirent {
char d_name[NAME_MAX + 1];
/*** Operating system specific part ***/
@ -261,31 +261,31 @@
struct _find_t data;
# endif
# endif
} dirent;
} dirent;
/* DIR substitute structure containing directory name. The name is
* essential for the operation of ``rewinndir'' function. */
typedef struct DIR {
/* DIR substitute structure containing directory name. The name is
* essential for the operation of ``rewinndir'' function. */
typedef struct DIR {
char *dirname; /* directory being scanned */
dirent current; /* current entry */
int dirent_filled; /* is current un-processed? */
/*** Operating system specific part ***/
/*** Operating system specific part ***/
# if defined(DIRENT_WIN32_INTERFACE)
HANDLE search_handle;
# elif defined(DIRENT_MSDOS_INTERFACE)
# endif
} DIR;
} DIR;
# ifdef __cplusplus
extern "C" {
# endif
/* supply prototypes for dirent functions */
static DIR *opendir (const char *dirname);
static struct dirent *readdir (DIR *dirp);
static int closedir (DIR *dirp);
static void rewinddir (DIR *dirp);
static DIR *opendir(const char *dirname);
static struct dirent *readdir(DIR *dirp);
static int closedir(DIR *dirp);
static void rewinddir(DIR *dirp);
/*
* Implement dirent interface as static functions so that the user does not
@ -312,9 +312,9 @@ static void rewinddir (DIR *dirp);
# define _dos_findfirst(name,flags,dest) findfirst(name,dest,flags)
#endif
static int _initdir (DIR *p);
static const char *_getdirname (const struct dirent *dp);
static void _setdirname (struct DIR *dirp);
static int _initdir(DIR *p);
static const char *_getdirname(const struct dirent *dp);
static void _setdirname(struct DIR *dirp);
/*
* <function name="opendir">
@ -325,7 +325,7 @@ static void _setdirname (struct DIR *dirp);
* internal working area that is used for retrieving individual directory
* entries. The internal working area has no fields of your interest.
*
* <ret>Returns a pointer to the internal working area or NULL in case the
* <ret>Returns a pointer to the internal working area or NULL in case the
* directory stream could not be opened. Global `errno' variable will set
* in case of error as follows:
*
@ -344,46 +344,45 @@ static void _setdirname (struct DIR *dirp);
*/
static DIR *opendir(const char *dirname)
{
DIR *dirp;
assert (dirname != NULL);
dirp = (DIR*)malloc (sizeof (struct DIR));
if (dirp != NULL) {
char *p;
/* allocate room for directory name */
dirp->dirname = (char*) malloc (strlen (dirname) + 1 + strlen ("\\*.*"));
if (dirp->dirname == NULL) {
/* failed to duplicate directory name. errno set by malloc() */
free (dirp);
return NULL;
}
/* Copy directory name while appending directory separator and "*.*".
* Directory separator is not appended if the name already ends with
* drive or directory separator. Directory separator is assumed to be
* '/' or '\' and drive separator is assumed to be ':'. */
strcpy (dirp->dirname, dirname);
p = strchr (dirp->dirname, '\0');
if (dirp->dirname < p &&
*(p - 1) != '\\' && *(p - 1) != '/' && *(p - 1) != ':')
{
strcpy (p++, "\\");
}
DIR *dirp;
assert(dirname != NULL);
dirp = (DIR*)malloc(sizeof(struct DIR));
if (dirp != NULL) {
char *p;
/* allocate room for directory name */
dirp->dirname = (char*) malloc(strlen(dirname) + 1 + strlen("\\*.*"));
if (dirp->dirname == NULL) {
/* failed to duplicate directory name. errno set by malloc() */
free(dirp);
return NULL;
}
/* Copy directory name while appending directory separator and "*.*".
* Directory separator is not appended if the name already ends with
* drive or directory separator. Directory separator is assumed to be
* '/' or '\' and drive separator is assumed to be ':'. */
strcpy(dirp->dirname, dirname);
p = strchr(dirp->dirname, '\0');
if (dirp->dirname < p &&
*(p - 1) != '\\' && *(p - 1) != '/' && *(p - 1) != ':') {
strcpy(p++, "\\");
}
# ifdef DIRENT_WIN32_INTERFACE
strcpy (p, "*"); /*scan files with and without extension in win32*/
strcpy(p, "*"); /*scan files with and without extension in win32*/
# else
strcpy (p, "*.*"); /*scan files with and without extension in DOS*/
strcpy(p, "*.*"); /*scan files with and without extension in DOS*/
# endif
/* open stream */
if (_initdir (dirp) == 0) {
/* initialization failed */
free (dirp->dirname);
free (dirp);
return NULL;
/* open stream */
if (_initdir(dirp) == 0) {
/* initialization failed */
free(dirp->dirname);
free(dirp);
return NULL;
}
}
}
return dirp;
return dirp;
}
@ -434,57 +433,57 @@ static DIR *opendir(const char *dirname)
* </function>
*/
static struct dirent *
readdir (DIR *dirp)
readdir(DIR *dirp)
{
assert(dirp != NULL);
if (dirp == NULL) {
errno = EBADF;
return NULL;
}
assert(dirp != NULL);
if (dirp == NULL) {
errno = EBADF;
return NULL;
}
#if defined(DIRENT_WIN32_INTERFACE)
if (dirp->search_handle == INVALID_HANDLE_VALUE) {
/* directory stream was opened/rewound incorrectly or it ended normally */
errno = EBADF;
return NULL;
}
if (dirp->search_handle == INVALID_HANDLE_VALUE) {
/* directory stream was opened/rewound incorrectly or it ended normally */
errno = EBADF;
return NULL;
}
#endif
if (dirp->dirent_filled != 0) {
/*
* Directory entry has already been retrieved and there is no need to
* retrieve a new one. Directory entry will be retrieved in advance
* when the user calls readdir function for the first time. This is so
* because real dirent has separate functions for opening and reading
* the stream whereas Win32 and DOS dirents open the stream
* automatically when we retrieve the first file. Therefore, we have to
* save the first file when opening the stream and later we have to
* return the saved entry when the user tries to read the first entry.
*/
dirp->dirent_filled = 0;
} else {
/* fill in entry and return that */
if (dirp->dirent_filled != 0) {
/*
* Directory entry has already been retrieved and there is no need to
* retrieve a new one. Directory entry will be retrieved in advance
* when the user calls readdir function for the first time. This is so
* because real dirent has separate functions for opening and reading
* the stream whereas Win32 and DOS dirents open the stream
* automatically when we retrieve the first file. Therefore, we have to
* save the first file when opening the stream and later we have to
* return the saved entry when the user tries to read the first entry.
*/
dirp->dirent_filled = 0;
} else {
/* fill in entry and return that */
#if defined(DIRENT_WIN32_INTERFACE)
if (FindNextFile (dirp->search_handle, &dirp->current.data) == FALSE) {
/* Last file has been processed or an error occurred */
FindClose (dirp->search_handle);
dirp->search_handle = INVALID_HANDLE_VALUE;
errno = ENOENT;
return NULL;
}
if (FindNextFile(dirp->search_handle, &dirp->current.data) == FALSE) {
/* Last file has been processed or an error occurred */
FindClose(dirp->search_handle);
dirp->search_handle = INVALID_HANDLE_VALUE;
errno = ENOENT;
return NULL;
}
# elif defined(DIRENT_MSDOS_INTERFACE)
if (_dos_findnext (&dirp->current.data) != 0) {
/* _dos_findnext and findnext will set errno to ENOENT when no
* more entries could be retrieved. */
return NULL;
}
if (_dos_findnext(&dirp->current.data) != 0) {
/* _dos_findnext and findnext will set errno to ENOENT when no
* more entries could be retrieved. */
return NULL;
}
# endif
_setdirname (dirp);
assert (dirp->dirent_filled == 0);
}
return &dirp->current;
_setdirname(dirp);
assert(dirp->dirent_filled == 0);
}
return &dirp->current;
}
@ -508,38 +507,40 @@ readdir (DIR *dirp)
* </function>
*/
static int
closedir (DIR *dirp)
{
int retcode = 0;
closedir(DIR *dirp)
{
int retcode = 0;
/* make sure that dirp points to legal structure */
assert (dirp != NULL);
if (dirp == NULL) {
errno = EBADF;
return -1;
}
/* free directory name and search handles */
if (dirp->dirname != NULL) free (dirp->dirname);
/* make sure that dirp points to legal structure */
assert(dirp != NULL);
if (dirp == NULL) {
errno = EBADF;
return -1;
}
/* free directory name and search handles */
if (dirp->dirname != NULL) {
free(dirp->dirname);
}
#if defined(DIRENT_WIN32_INTERFACE)
if (dirp->search_handle != INVALID_HANDLE_VALUE) {
if (FindClose (dirp->search_handle) == FALSE) {
/* Unknown error */
retcode = -1;
errno = EBADF;
if (dirp->search_handle != INVALID_HANDLE_VALUE) {
if (FindClose(dirp->search_handle) == FALSE) {
/* Unknown error */
retcode = -1;
errno = EBADF;
}
}
}
#endif
#endif
/* clear dirp structure to make sure that it cannot be used anymore*/
memset (dirp, 0, sizeof (*dirp));
/* clear dirp structure to make sure that it cannot be used anymore*/
memset(dirp, 0, sizeof(*dirp));
# if defined(DIRENT_WIN32_INTERFACE)
dirp->search_handle = INVALID_HANDLE_VALUE;
dirp->search_handle = INVALID_HANDLE_VALUE;
# endif
free (dirp);
return retcode;
free(dirp);
return retcode;
}
@ -565,32 +566,32 @@ closedir (DIR *dirp)
* notice it later when you try to retrieve the first directory entry.
*/
static void
rewinddir (DIR *dirp)
{
/* make sure that dirp is legal */
assert (dirp != NULL);
if (dirp == NULL) {
errno = EBADF;
return;
}
assert (dirp->dirname != NULL);
/* close previous stream */
#if defined(DIRENT_WIN32_INTERFACE)
if (dirp->search_handle != INVALID_HANDLE_VALUE) {
if (FindClose (dirp->search_handle) == FALSE) {
/* Unknown error */
errno = EBADF;
rewinddir(DIR *dirp)
{
/* make sure that dirp is legal */
assert(dirp != NULL);
if (dirp == NULL) {
errno = EBADF;
return;
}
assert(dirp->dirname != NULL);
/* close previous stream */
#if defined(DIRENT_WIN32_INTERFACE)
if (dirp->search_handle != INVALID_HANDLE_VALUE) {
if (FindClose(dirp->search_handle) == FALSE) {
/* Unknown error */
errno = EBADF;
}
}
}
#endif
/* re-open previous stream */
if (_initdir (dirp) == 0) {
/* initialization failed but we cannot deal with error. User will notice
* error later when she tries to retrieve first directory enty. */
/*EMPTY*/;
}
/* re-open previous stream */
if (_initdir(dirp) == 0) {
/* initialization failed but we cannot deal with error. User will notice
* error later when she tries to retrieve first directory enty. */
/*EMPTY*/;
}
}
@ -599,38 +600,37 @@ rewinddir (DIR *dirp)
* Be sure to close previous stream before opening new one.
*/
static int
_initdir (DIR *dirp)
{
assert (dirp != NULL);
assert (dirp->dirname != NULL);
dirp->dirent_filled = 0;
_initdir(DIR *dirp)
{
assert(dirp != NULL);
assert(dirp->dirname != NULL);
dirp->dirent_filled = 0;
# if defined(DIRENT_WIN32_INTERFACE)
/* Open stream and retrieve first file */
dirp->search_handle = FindFirstFile (dirp->dirname, &dirp->current.data);
if (dirp->search_handle == INVALID_HANDLE_VALUE) {
/* something went wrong but we don't know what. GetLastError() could
* give us more information about the error, but then we should map
* the error code into errno. */
errno = ENOENT;
return 0;
}
/* Open stream and retrieve first file */
dirp->search_handle = FindFirstFile(dirp->dirname, &dirp->current.data);
if (dirp->search_handle == INVALID_HANDLE_VALUE) {
/* something went wrong but we don't know what. GetLastError() could
* give us more information about the error, but then we should map
* the error code into errno. */
errno = ENOENT;
return 0;
}
# elif defined(DIRENT_MSDOS_INTERFACE)
if (_dos_findfirst (dirp->dirname,
_A_SUBDIR | _A_RDONLY | _A_ARCH | _A_SYSTEM | _A_HIDDEN,
&dirp->current.data) != 0)
{
/* _dos_findfirst and findfirst will set errno to ENOENT when no
* more entries could be retrieved. */
return 0;
}
if (_dos_findfirst(dirp->dirname,
_A_SUBDIR | _A_RDONLY | _A_ARCH | _A_SYSTEM | _A_HIDDEN,
&dirp->current.data) != 0) {
/* _dos_findfirst and findfirst will set errno to ENOENT when no
* more entries could be retrieved. */
return 0;
}
# endif
/* initialize DIR and it's first entry */
_setdirname (dirp);
dirp->dirent_filled = 1;
return 1;
/* initialize DIR and it's first entry */
_setdirname(dirp);
dirp->dirent_filled = 1;
return 1;
}
@ -638,17 +638,17 @@ _initdir (DIR *dirp)
* Return implementation dependent name of the current directory entry.
*/
static const char *
_getdirname (const struct dirent *dp)
_getdirname(const struct dirent *dp)
{
#if defined(DIRENT_WIN32_INTERFACE)
return dp->data.cFileName;
return dp->data.cFileName;
#elif defined(DIRENT_USE_FFBLK)
return dp->data.ff_name;
return dp->data.ff_name;
#else
return dp->data.name;
#endif
return dp->data.name;
#endif
}
@ -656,16 +656,17 @@ _getdirname (const struct dirent *dp)
* Copy name of implementation dependent directory entry to the d_name field.
*/
static void
_setdirname (struct DIR *dirp) {
/* make sure that d_name is long enough */
assert (strlen (_getdirname (&dirp->current)) <= NAME_MAX);
strncpy (dirp->current.d_name,
_getdirname (&dirp->current),
NAME_MAX);
dirp->current.d_name[NAME_MAX] = '\0'; /*char d_name[NAME_MAX+1]*/
_setdirname(struct DIR *dirp)
{
/* make sure that d_name is long enough */
assert(strlen(_getdirname(&dirp->current)) <= NAME_MAX);
strncpy(dirp->current.d_name,
_getdirname(&dirp->current),
NAME_MAX);
dirp->current.d_name[NAME_MAX] = '\0'; /*char d_name[NAME_MAX+1]*/
}
# ifdef __cplusplus
}
# endif

View File

@ -9,5 +9,6 @@
void xml_write_init(BOOL n, BOOL t, BOOL r, BOOL d);
int xml_write_struct(FILE *file, FILE *xmlout, opj_mj2_t * movie, unsigned int sampleframe, char* stringDTD, opj_event_mgr_t *event_mgr);
int xml_write_struct(FILE *file, FILE *xmlout, opj_mj2_t * movie,
unsigned int sampleframe, char* stringDTD, opj_event_mgr_t *event_mgr);

View File

@ -1,6 +1,6 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
@ -136,10 +136,10 @@ typedef unsigned long long int8byte;
#endif
#define OPJ_APPLICATION wxT("OPJViewer")
#define OPJ_APPLICATION_NAME wxT("OpenJPEG Viewer")
#define OPJ_APPLICATION_VERSION wxT("0.4 beta")
#define OPJ_APPLICATION_TITLEBAR OPJ_APPLICATION_NAME wxT(" ") OPJ_APPLICATION_VERSION
#define OPJ_APPLICATION_COPYRIGHT wxT("(C) 2007-2008, Giuseppe Baruffa")
#define OPJ_APPLICATION_NAME wxT("OpenJPEG Viewer")
#define OPJ_APPLICATION_VERSION wxT("0.4 beta")
#define OPJ_APPLICATION_TITLEBAR OPJ_APPLICATION_NAME wxT(" ") OPJ_APPLICATION_VERSION
#define OPJ_APPLICATION_COPYRIGHT wxT("(C) 2007-2008, Giuseppe Baruffa")
#define OPJ_APPLICATION_VENDOR wxT("OpenJPEG")
#ifdef __WXMSW__
@ -180,73 +180,86 @@ class OPJChildFrame;
//////////////////////////////////
class OPJViewerApp: public wxApp
{
// public methods and variables
public:
// public methods and variables
public:
// class constructor
OPJViewerApp() { m_showImages = true; m_showButtons = false; }
// class constructor
OPJViewerApp()
{
m_showImages = true;
m_showButtons = false;
}
// other methods
bool OnInit(void);
int OnExit(void);
void SetShowImages(bool show) { m_showImages = show; }
bool ShowImages() const { return m_showImages; }
void ShowCmdLine(const wxCmdLineParser& parser);
// other methods
bool OnInit(void);
int OnExit(void);
void SetShowImages(bool show)
{
m_showImages = show;
}
bool ShowImages() const
{
return m_showImages;
}
void ShowCmdLine(const wxCmdLineParser& parser);
// all the threads currently alive - as soon as the thread terminates, it's
// removed from the array
wxArrayThread m_deco_threads, m_parse_threads, m_enco_threads;
// all the threads currently alive - as soon as the thread terminates, it's
// removed from the array
wxArrayThread m_deco_threads, m_parse_threads, m_enco_threads;
// crit section protects access to all of the arrays below
wxCriticalSection m_deco_critsect, m_parse_critsect, m_enco_critsect;
// crit section protects access to all of the arrays below
wxCriticalSection m_deco_critsect, m_parse_critsect, m_enco_critsect;
// semaphore used to wait for the threads to exit, see OPJFrame::OnQuit()
wxSemaphore m_deco_semAllDone, m_parse_semAllDone, m_enco_semAllDone;
// semaphore used to wait for the threads to exit, see OPJFrame::OnQuit()
wxSemaphore m_deco_semAllDone, m_parse_semAllDone, m_enco_semAllDone;
// the last exiting thread should post to m_semAllDone if this is true
// (protected by the same m_critsect)
bool m_deco_waitingUntilAllDone, m_parse_waitingUntilAllDone, m_enco_waitingUntilAllDone;
// the last exiting thread should post to m_semAllDone if this is true
// (protected by the same m_critsect)
bool m_deco_waitingUntilAllDone, m_parse_waitingUntilAllDone,
m_enco_waitingUntilAllDone;
// the list of all filenames written in the command line
wxArrayString m_filelist;
// the list of all filenames written in the command line
wxArrayString m_filelist;
// displaying engine parameters
int m_resizemethod;
// displaying engine parameters
int m_resizemethod;
// decoding engine parameters
bool m_enabledeco, m_enableparse;
int m_reducefactor, m_qualitylayers, m_components, m_framenum;
// decoding engine parameters
bool m_enabledeco, m_enableparse;
int m_reducefactor, m_qualitylayers, m_components, m_framenum;
#ifdef USE_JPWL
bool m_enablejpwl, m_enablejpwle;
int m_expcomps, m_maxtiles;
bool m_enablejpwl, m_enablejpwle;
int m_expcomps, m_maxtiles;
#endif // USE_JPWL
int m_framewidth, m_frameheight;
int m_framewidth, m_frameheight;
// encoding engine parameters
wxString m_subsampling, m_origin, m_rates, m_comment, m_index, m_quality;
wxString m_cbsize, m_prsize, m_tsize, m_torigin, m_poc;
bool m_enablecomm, m_enableidx, m_multicomp, m_irreversible, m_enablesop, m_enableeph;
bool m_enablebypass, m_enablereset, m_enablerestart, m_enablevsc, m_enableerterm;
bool m_enablesegmark, m_enablepoc;
bool m_enablequality;
int m_resolutions, m_progression;
// encoding engine parameters
wxString m_subsampling, m_origin, m_rates, m_comment, m_index, m_quality;
wxString m_cbsize, m_prsize, m_tsize, m_torigin, m_poc;
bool m_enablecomm, m_enableidx, m_multicomp, m_irreversible, m_enablesop,
m_enableeph;
bool m_enablebypass, m_enablereset, m_enablerestart, m_enablevsc,
m_enableerterm;
bool m_enablesegmark, m_enablepoc;
bool m_enablequality;
int m_resolutions, m_progression;
#ifdef USE_JPWL
int m_hprotsel[MYJPWL_MAX_NO_TILESPECS], m_pprotsel[MYJPWL_MAX_NO_TILESPECS];
int m_htileval[MYJPWL_MAX_NO_TILESPECS], m_ptileval[MYJPWL_MAX_NO_TILESPECS],
m_ppackval[MYJPWL_MAX_NO_TILESPECS];
int m_sensisel[MYJPWL_MAX_NO_TILESPECS], m_stileval[MYJPWL_MAX_NO_TILESPECS];
int m_hprotsel[MYJPWL_MAX_NO_TILESPECS], m_pprotsel[MYJPWL_MAX_NO_TILESPECS];
int m_htileval[MYJPWL_MAX_NO_TILESPECS], m_ptileval[MYJPWL_MAX_NO_TILESPECS],
m_ppackval[MYJPWL_MAX_NO_TILESPECS];
int m_sensisel[MYJPWL_MAX_NO_TILESPECS], m_stileval[MYJPWL_MAX_NO_TILESPECS];
#endif // USE_JPWL
// some layout settings
bool m_showtoolbar, m_showbrowser, m_showpeeker;
int m_browserwidth, m_peekerheight;
// some layout settings
bool m_showtoolbar, m_showbrowser, m_showpeeker;
int m_browserwidth, m_peekerheight;
// application configuration
wxConfig *OPJconfig;
// application configuration
wxConfig *OPJconfig;
// private methods and variables
private:
bool m_showImages, m_showButtons;
// private methods and variables
private:
bool m_showImages, m_showButtons;
};
@ -257,37 +270,39 @@ DECLARE_APP(OPJViewerApp)
///////////////////////////////////////////
class OPJCanvas: public wxScrolledWindow
{
// public methods and variables
public:
// public methods and variables
public:
// class constructor
OPJCanvas(wxFileName fname, wxWindow *parent, const wxPoint& pos, const wxSize& size);
// class constructor
OPJCanvas(wxFileName fname, wxWindow *parent, const wxPoint& pos,
const wxSize& size);
virtual void OnDraw(wxDC& dc);
void OnEvent(wxMouseEvent& event);
void WriteText(const wxString& text) {
#ifndef __WXGTK__
wxMutexGuiEnter();
virtual void OnDraw(wxDC& dc);
void OnEvent(wxMouseEvent& event);
void WriteText(const wxString& text)
{
#ifndef __WXGTK__
wxMutexGuiEnter();
#endif //__WXGTK__
wxLogMessage(text);
#ifndef __WXGTK__
wxMutexGuiLeave();
wxLogMessage(text);
#ifndef __WXGTK__
wxMutexGuiLeave();
#endif //__WXGTK__
}
}
void OnThreadSignal(wxCommandEvent& event);
void OnThreadSignal(wxCommandEvent& event);
OPJDecoThread *CreateDecoThread(void);
OPJEncoThread *CreateEncoThread(void);
OPJDecoThread *CreateDecoThread(void);
OPJEncoThread *CreateEncoThread(void);
OPJChildFrame *m_childframe;
OPJChildFrame *m_childframe;
wxBitmap m_image, m_image100;
wxFileName m_fname, m_savename;
long m_zooml;
wxBitmap m_image, m_image100;
wxFileName m_fname, m_savename;
long m_zooml;
DECLARE_EVENT_TABLE()
DECLARE_EVENT_TABLE()
};
///////////////////////////////////////////////////
@ -295,29 +310,40 @@ class OPJCanvas: public wxScrolledWindow
///////////////////////////////////////////////////
class OPJMarkerData : public wxTreeItemData
{
// public methods and variables
public:
// public methods and variables
public:
// class constructor
OPJMarkerData(const wxString& desc, const wxString& fname = wxT(""), wxFileOffset start = 0, wxFileOffset length = 0) : m_desc(desc), m_filestring(fname) { m_start = start; m_length = length; }
// class constructor
OPJMarkerData(const wxString& desc, const wxString& fname = wxT(""),
wxFileOffset start = 0, wxFileOffset length = 0) : m_desc(desc),
m_filestring(fname)
{
m_start = start;
m_length = length;
}
void ShowInfo(wxTreeCtrl *tree);
const wxChar *GetDesc1() const { return m_desc.c_str(); }
const wxChar *GetDesc2() const { return m_filestring.c_str(); }
wxFileOffset m_start, m_length;
wxString m_desc;
void ShowInfo(wxTreeCtrl *tree);
const wxChar *GetDesc1() const
{
return m_desc.c_str();
}
const wxChar *GetDesc2() const
{
return m_filestring.c_str();
}
wxFileOffset m_start, m_length;
wxString m_desc;
// private methods and variables
private:
wxString m_filestring;
// private methods and variables
private:
wxString m_filestring;
};
class OPJMarkerTree : public wxTreeCtrl
{
public:
enum
{
enum {
TreeCtrlIcon_File,
TreeCtrlIcon_FileSelected,
TreeCtrlIcon_Folder,
@ -326,16 +352,23 @@ public:
};
OPJMarkerTree() { };
OPJMarkerTree(wxWindow *parent, OPJChildFrame *subframe, wxFileName fname, wxString name, const wxWindowID id,
const wxPoint& pos, const wxSize& size,
long style);
virtual ~OPJMarkerTree(){};
OPJParseThread *CreateParseThread(wxTreeItemId parentid = 0x00, OPJChildFrame *subframe = NULL);
void WriteText(const wxString& text) { wxMutexGuiEnter(); wxLogMessage(text); wxMutexGuiLeave(); }
OPJMarkerTree(wxWindow *parent, OPJChildFrame *subframe, wxFileName fname,
wxString name, const wxWindowID id,
const wxPoint& pos, const wxSize& size,
long style);
virtual ~OPJMarkerTree() {};
OPJParseThread *CreateParseThread(wxTreeItemId parentid = 0x00,
OPJChildFrame *subframe = NULL);
void WriteText(const wxString& text)
{
wxMutexGuiEnter();
wxLogMessage(text);
wxMutexGuiLeave();
}
wxFileName m_fname;
wxTextCtrl *m_peektextCtrl;
OPJChildFrame *m_childframe;
wxFileName m_fname;
wxTextCtrl *m_peektextCtrl;
OPJChildFrame *m_childframe;
/*void OnBeginDrag(wxTreeEvent& event);
void OnBeginRDrag(wxTreeEvent& event);
@ -372,9 +405,15 @@ public:
/*void DoToggleIcon(const wxTreeItemId& item);*/
/*void ShowMenu(wxTreeItemId id, const wxPoint& pt);*/
int ImageSize(void) const { return m_imageSize; }
int ImageSize(void) const
{
return m_imageSize;
}
void SetLastItem(wxTreeItemId id) { m_lastItem = id; }
void SetLastItem(wxTreeItemId id)
{
m_lastItem = id;
}
protected:
/*virtual int OnCompareItems(const wxTreeItemId& i1, const wxTreeItemId& i2);*/
@ -408,20 +447,23 @@ private:
};
// this hash map stores all the trees of currently opened images, with an integer key
WX_DECLARE_HASH_MAP(int, OPJMarkerTree*, wxIntegerHash, wxIntegerEqual, OPJMarkerTreeHash);
WX_DECLARE_HASH_MAP(int, OPJMarkerTree*, wxIntegerHash, wxIntegerEqual,
OPJMarkerTreeHash);
// this hash map stores all the children of currently opened images, with an integer key
WX_DECLARE_HASH_MAP(int, OPJChildFrame*, wxIntegerHash, wxIntegerEqual, OPJChildFrameHash);
WX_DECLARE_HASH_MAP(int, OPJChildFrame*, wxIntegerHash, wxIntegerEqual,
OPJChildFrameHash);
// Define a new frame
class OPJFrame: public wxMDIParentFrame
{
public:
public:
OPJFrame(wxWindow *parent, const wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, const long style);
OPJFrame(wxWindow *parent, const wxWindowID id, const wxString& title,
const wxPoint& pos, const wxSize& size, const long style);
~OPJFrame(void);
void OnSize(wxSizeEvent& WXUNUSED(event));
void OnSize(wxSizeEvent& WXUNUSED(event));
void OnAbout(wxCommandEvent& WXUNUSED(event));
void OnFileOpen(wxCommandEvent& WXUNUSED(event));
void OnFileSaveAs(wxCommandEvent& WXUNUSED(event));
@ -429,43 +471,43 @@ class OPJFrame: public wxMDIParentFrame
void OnQuit(wxCommandEvent& WXUNUSED(event));
void OnClose(wxCommandEvent& WXUNUSED(event));
void OnZoom(wxCommandEvent& WXUNUSED(event));
void OnFit(wxCommandEvent& event);
void OnToggleBrowser(wxCommandEvent& WXUNUSED(event));
void OnTogglePeeker(wxCommandEvent& WXUNUSED(event));
void OnToggleToolbar(wxCommandEvent& WXUNUSED(event));
void OnReload(wxCommandEvent& event);
void OnPrevFrame(wxCommandEvent& event);
void OnHomeFrame(wxCommandEvent& event);
void OnNextFrame(wxCommandEvent& event);
void OnLessLayers(wxCommandEvent& event);
void OnAllLayers(wxCommandEvent& event);
void OnMoreLayers(wxCommandEvent& event);
void OnLessRes(wxCommandEvent& event);
void OnFullRes(wxCommandEvent& event);
void OnMoreRes(wxCommandEvent& event);
void OnPrevComp(wxCommandEvent& event);
void OnAllComps(wxCommandEvent& event);
void OnNextComp(wxCommandEvent& event);
void OnSetsEnco(wxCommandEvent& event);
void OnSetsDeco(wxCommandEvent& event);
void OnSashDrag(wxSashEvent& event);
void OpenFiles(wxArrayString paths, wxArrayString filenames);
void SaveFile(wxArrayString paths, wxArrayString filenames);
void OnNotebook(wxNotebookEvent& event);
void Rescale(int scale, OPJChildFrame *child);
void OnThreadLogmsg(wxCommandEvent& event);
void OnFit(wxCommandEvent& event);
void OnToggleBrowser(wxCommandEvent& WXUNUSED(event));
void OnTogglePeeker(wxCommandEvent& WXUNUSED(event));
void OnToggleToolbar(wxCommandEvent& WXUNUSED(event));
void OnReload(wxCommandEvent& event);
void OnPrevFrame(wxCommandEvent& event);
void OnHomeFrame(wxCommandEvent& event);
void OnNextFrame(wxCommandEvent& event);
void OnLessLayers(wxCommandEvent& event);
void OnAllLayers(wxCommandEvent& event);
void OnMoreLayers(wxCommandEvent& event);
void OnLessRes(wxCommandEvent& event);
void OnFullRes(wxCommandEvent& event);
void OnMoreRes(wxCommandEvent& event);
void OnPrevComp(wxCommandEvent& event);
void OnAllComps(wxCommandEvent& event);
void OnNextComp(wxCommandEvent& event);
void OnSetsEnco(wxCommandEvent& event);
void OnSetsDeco(wxCommandEvent& event);
void OnSashDrag(wxSashEvent& event);
void OpenFiles(wxArrayString paths, wxArrayString filenames);
void SaveFile(wxArrayString paths, wxArrayString filenames);
void OnNotebook(wxNotebookEvent& event);
void Rescale(int scale, OPJChildFrame *child);
void OnThreadLogmsg(wxCommandEvent& event);
OPJMarkerTreeHash m_treehash;
OPJChildFrameHash m_childhash;
OPJMarkerTreeHash m_treehash;
OPJChildFrameHash m_childhash;
wxSashLayoutWindow* markerTreeWindow;
wxSashLayoutWindow* loggingWindow;
wxToolBar* tool_bar;
wxToolBar* tool_bar;
void Resize(int number);
wxNotebook *m_bookCtrl;
wxNotebook *m_bookCtrlbottom;
wxNotebook *m_bookCtrl;
wxNotebook *m_bookCtrlbottom;
wxTextCtrl *m_textCtrlbrowse;
private:
private:
void TogStyle(int id, long flag);
void DoSort(bool reverse = false);
@ -479,70 +521,71 @@ protected:
wxSashLayoutWindow* m_topWindow;
wxSashLayoutWindow* m_leftWindow2;
DECLARE_EVENT_TABLE()
DECLARE_EVENT_TABLE()
};
class OPJChildFrame: public wxMDIChildFrame
{
public:
public:
OPJCanvas *m_canvas;
OPJChildFrame(OPJFrame *parent, wxFileName fname, int winnumber, const wxString& title, const wxPoint& pos, const wxSize& size, const long style);
OPJChildFrame(OPJFrame *parent, wxFileName fname, int winnumber,
const wxString& title, const wxPoint& pos, const wxSize& size,
const long style);
~OPJChildFrame(void);
void OnActivate(wxActivateEvent& event);
/*void OnQuit(wxCommandEvent& WXUNUSED(event));*/
void OnClose(wxCloseEvent& event);
void OnGotFocus(wxFocusEvent& event);
void OnLostFocus(wxFocusEvent& event);
/*void OnQuit(wxCommandEvent& WXUNUSED(event));*/
void OnClose(wxCloseEvent& event);
void OnGotFocus(wxFocusEvent& event);
void OnLostFocus(wxFocusEvent& event);
OPJFrame *m_frame;
wxFileName m_fname;
int m_winnumber;
wxFileName m_fname;
int m_winnumber;
unsigned long m_twidth, m_theight, m_tx, m_ty;
unsigned long m_twidth, m_theight, m_tx, m_ty;
DECLARE_EVENT_TABLE()
DECLARE_EVENT_TABLE()
};
// frame and main menu ids
enum {
OPJFRAME_FILEEXIT = wxID_EXIT,
OPJFRAME_HELPABOUT = wxID_ABOUT,
OPJFRAME_FILEOPEN,
OPJFRAME_MEMORYOPEN,
OPJFRAME_FILESAVEAS,
OPJFRAME_FILETOGGLEB,
OPJFRAME_FILETOGGLEP,
OPJFRAME_FILETOGGLET,
OPJFRAME_VIEWZOOM,
OPJFRAME_VIEWFIT,
OPJFRAME_VIEWRELOAD,
OPJFRAME_VIEWPREVFRAME,
OPJFRAME_VIEWHOMEFRAME,
OPJFRAME_VIEWNEXTFRAME,
OPJFRAME_VIEWLESSLAYERS,
OPJFRAME_VIEWALLLAYERS,
OPJFRAME_VIEWMORELAYERS,
OPJFRAME_VIEWLESSRES,
OPJFRAME_VIEWFULLRES,
OPJFRAME_VIEWMORERES,
OPJFRAME_VIEWPREVCOMP,
OPJFRAME_VIEWALLCOMPS,
OPJFRAME_VIEWNEXTCOMP,
OPJFRAME_FILECLOSE,
OPJFRAME_SETSENCO,
OPJFRAME_SETSDECO,
OPJFRAME_FILEEXIT = wxID_EXIT,
OPJFRAME_HELPABOUT = wxID_ABOUT,
OPJFRAME_FILEOPEN,
OPJFRAME_MEMORYOPEN,
OPJFRAME_FILESAVEAS,
OPJFRAME_FILETOGGLEB,
OPJFRAME_FILETOGGLEP,
OPJFRAME_FILETOGGLET,
OPJFRAME_VIEWZOOM,
OPJFRAME_VIEWFIT,
OPJFRAME_VIEWRELOAD,
OPJFRAME_VIEWPREVFRAME,
OPJFRAME_VIEWHOMEFRAME,
OPJFRAME_VIEWNEXTFRAME,
OPJFRAME_VIEWLESSLAYERS,
OPJFRAME_VIEWALLLAYERS,
OPJFRAME_VIEWMORELAYERS,
OPJFRAME_VIEWLESSRES,
OPJFRAME_VIEWFULLRES,
OPJFRAME_VIEWMORERES,
OPJFRAME_VIEWPREVCOMP,
OPJFRAME_VIEWALLCOMPS,
OPJFRAME_VIEWNEXTCOMP,
OPJFRAME_FILECLOSE,
OPJFRAME_SETSENCO,
OPJFRAME_SETSDECO,
OPJFRAME_BROWSEWIN = 10000,
OPJFRAME_LOGWIN,
OPJFRAME_TOOLBAR,
OPJFRAME_BROWSEWIN = 10000,
OPJFRAME_LOGWIN,
OPJFRAME_TOOLBAR,
OPJFRAME_THREADLOGMSG,
OPJCANVAS_THREADSIGNAL
OPJFRAME_THREADLOGMSG,
OPJCANVAS_THREADSIGNAL
};
// menu and control ids
enum
{
enum {
TreeTest_Quit = wxID_EXIT,
TreeTest_About = wxID_ABOUT,
TreeTest_TogButtons = wxID_HIGHEST,
@ -587,8 +630,8 @@ enum
TreeTest_Unselect,
TreeTest_SelectRoot,
TreeTest_Ctrl = 1000,
BOTTOM_NOTEBOOK_ID,
LEFT_NOTEBOOK_ID
BOTTOM_NOTEBOOK_ID,
LEFT_NOTEBOOK_ID
};
class OPJEncoThread : public wxThread
@ -645,19 +688,23 @@ public:
// write something to the text control
void WriteText(const wxString& text);
void LoadFile(wxFileName fname);
void ParseJ2KFile(wxFile *m_file, wxFileOffset offset, wxFileOffset length, wxTreeItemId parentid);
void ParseJP2File(wxFile *fileid, wxFileOffset filepoint, wxFileOffset filelimit, wxTreeItemId parentid);
void LoadFile(wxFileName fname);
void ParseJ2KFile(wxFile *m_file, wxFileOffset offset, wxFileOffset length,
wxTreeItemId parentid);
void ParseJP2File(wxFile *fileid, wxFileOffset filepoint,
wxFileOffset filelimit, wxTreeItemId parentid);
unsigned m_count;
OPJMarkerTree *m_tree;
wxTreeItemId m_parentid;
wxTreeItemId m_parentid;
private:
int jpeg2000parse(wxFile *fileid, wxFileOffset filepoint, wxFileOffset filelimit,
wxTreeItemId parentid, int level, char *scansign, unsigned long int *scanpoint);
int box_handler_function(int boxtype, wxFile *fileid, wxFileOffset filepoint, wxFileOffset filelimit,
wxTreeItemId parentid, int level, char *scansign, unsigned long int *scanpoint);
int jpeg2000parse(wxFile *fileid, wxFileOffset filepoint,
wxFileOffset filelimit,
wxTreeItemId parentid, int level, char *scansign, unsigned long int *scanpoint);
int box_handler_function(int boxtype, wxFile *fileid, wxFileOffset filepoint,
wxFileOffset filelimit,
wxTreeItemId parentid, int level, char *scansign, unsigned long int *scanpoint);
};
@ -666,7 +713,10 @@ private:
class OPJDnDFile: public wxFileDropTarget
{
public:
OPJDnDFile(OPJFrame *pOwner) { m_pOwner = pOwner; }
OPJDnDFile(OPJFrame *pOwner)
{
m_pOwner = pOwner;
}
virtual bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& filenames);
private:
@ -678,137 +728,139 @@ private:
// Property sheet dialog: encoder
class OPJEncoderDialog: public wxPropertySheetDialog
{
DECLARE_CLASS(OPJEncoderDialog)
DECLARE_CLASS(OPJEncoderDialog)
public:
OPJEncoderDialog(wxWindow* parent, int dialogType);
~OPJEncoderDialog();
wxBookCtrlBase* m_settingsNotebook;
wxBookCtrlBase* m_settingsNotebook;
wxPanel* CreateMainSettingsPage(wxWindow* parent);
wxPanel* CreatePart1_1SettingsPage(wxWindow* parent);
wxPanel* CreatePart1_2SettingsPage(wxWindow* parent);
/* wxPanel* CreatePart3SettingsPage(wxWindow* parent);*/
void OnEnableComm(wxCommandEvent& event);
void OnEnableIdx(wxCommandEvent& event);
void OnEnablePoc(wxCommandEvent& event);
void OnRadioQualityRate(wxCommandEvent& event);
/* wxPanel* CreatePart3SettingsPage(wxWindow* parent);*/
void OnEnableComm(wxCommandEvent& event);
void OnEnableIdx(wxCommandEvent& event);
void OnEnablePoc(wxCommandEvent& event);
void OnRadioQualityRate(wxCommandEvent& event);
#ifdef USE_JPWL
void OnEnableJPWL(wxCommandEvent& event);
wxPanel* CreatePart11SettingsPage(wxWindow* parent);
/*wxCheckBox *m_enablejpwlCheck;*/
wxChoice *m_hprotChoice[MYJPWL_MAX_NO_TILESPECS];
wxSpinCtrl *m_htileCtrl[MYJPWL_MAX_NO_TILESPECS];
wxChoice *m_pprotChoice[MYJPWL_MAX_NO_TILESPECS];
wxSpinCtrl *m_ptileCtrl[MYJPWL_MAX_NO_TILESPECS];
wxSpinCtrl *m_ppackCtrl[MYJPWL_MAX_NO_TILESPECS];
wxChoice *m_sensiChoice[MYJPWL_MAX_NO_TILESPECS];
wxSpinCtrl *m_stileCtrl[MYJPWL_MAX_NO_TILESPECS];
void OnHprotSelect(wxCommandEvent& event);
void OnPprotSelect(wxCommandEvent& event);
void OnSensiSelect(wxCommandEvent& event);
void OnEnableJPWL(wxCommandEvent& event);
wxPanel* CreatePart11SettingsPage(wxWindow* parent);
/*wxCheckBox *m_enablejpwlCheck;*/
wxChoice *m_hprotChoice[MYJPWL_MAX_NO_TILESPECS];
wxSpinCtrl *m_htileCtrl[MYJPWL_MAX_NO_TILESPECS];
wxChoice *m_pprotChoice[MYJPWL_MAX_NO_TILESPECS];
wxSpinCtrl *m_ptileCtrl[MYJPWL_MAX_NO_TILESPECS];
wxSpinCtrl *m_ppackCtrl[MYJPWL_MAX_NO_TILESPECS];
wxChoice *m_sensiChoice[MYJPWL_MAX_NO_TILESPECS];
wxSpinCtrl *m_stileCtrl[MYJPWL_MAX_NO_TILESPECS];
void OnHprotSelect(wxCommandEvent& event);
void OnPprotSelect(wxCommandEvent& event);
void OnSensiSelect(wxCommandEvent& event);
#endif // USE_JPWL
wxTextCtrl *m_subsamplingCtrl, *m_originCtrl, *m_rateCtrl, *m_commentCtrl;
wxRadioButton *m_rateRadio, *m_qualityRadio;
wxTextCtrl *m_indexCtrl, *m_qualityCtrl, *m_cbsizeCtrl, *m_prsizeCtrl, *m_pocCtrl;
wxTextCtrl *m_tsizeCtrl, *m_toriginCtrl;
wxRadioBox *progressionBox;
wxCheckBox *m_enablecommCheck, *m_enableidxCheck, *m_mctCheck, *m_irrevCheck;
wxCheckBox *m_sopCheck, *m_ephCheck, *m_enablebypassCheck, *m_enableresetCheck,
*m_enablerestartCheck, *m_enablevscCheck, *m_enableertermCheck, *m_enablesegmarkCheck;
wxCheckBox *m_enablepocCheck, *m_enablejpwlCheck;
wxSpinCtrl *m_resolutionsCtrl;
wxTextCtrl *m_subsamplingCtrl, *m_originCtrl, *m_rateCtrl, *m_commentCtrl;
wxRadioButton *m_rateRadio, *m_qualityRadio;
wxTextCtrl *m_indexCtrl, *m_qualityCtrl, *m_cbsizeCtrl, *m_prsizeCtrl,
*m_pocCtrl;
wxTextCtrl *m_tsizeCtrl, *m_toriginCtrl;
wxRadioBox *progressionBox;
wxCheckBox *m_enablecommCheck, *m_enableidxCheck, *m_mctCheck, *m_irrevCheck;
wxCheckBox *m_sopCheck, *m_ephCheck, *m_enablebypassCheck, *m_enableresetCheck,
*m_enablerestartCheck, *m_enablevscCheck, *m_enableertermCheck,
*m_enablesegmarkCheck;
wxCheckBox *m_enablepocCheck, *m_enablejpwlCheck;
wxSpinCtrl *m_resolutionsCtrl;
protected:
enum {
OPJENCO_ENABLEJPWL = 100,
OPJENCO_RATEFACTOR,
OPJENCO_RATERADIO,
OPJENCO_QUALITYFACTOR,
OPJENCO_QUALITYRADIO,
OPJENCO_RESNUMBER,
OPJENCO_CODEBLOCKSIZE,
OPJENCO_PRECINCTSIZE,
OPJENCO_TILESIZE,
OPJENCO_PROGRESSION,
OPJENCO_SUBSAMPLING,
OPJENCO_ENABLESOP,
OPJENCO_ENABLEEPH,
OPJENCO_ENABLEBYPASS,
OPJENCO_ENABLERESET,
OPJENCO_ENABLERESTART,
OPJENCO_ENABLEVSC,
OPJENCO_ENABLEERTERM,
OPJENCO_ENABLESEGMARK,
OPJENCO_ENABLEPOC,
OPJENCO_ROICOMP,
OPJENCO_ROISHIFT,
OPJENCO_IMORIG,
OPJENCO_TILORIG,
OPJENCO_ENABLEMCT,
OPJENCO_ENABLEIRREV,
OPJENCO_ENABLEINDEX,
OPJENCO_INDEXNAME,
OPJENCO_POCSPEC,
OPJENCO_ENABLECOMM,
OPJENCO_COMMENTTEXT,
OPJENCO_HPROT,
OPJENCO_HTILE,
OPJENCO_PPROT,
OPJENCO_PTILE,
OPJENCO_PPACK,
OPJENCO_SENSI,
OPJENCO_STILE
OPJENCO_ENABLEJPWL = 100,
OPJENCO_RATEFACTOR,
OPJENCO_RATERADIO,
OPJENCO_QUALITYFACTOR,
OPJENCO_QUALITYRADIO,
OPJENCO_RESNUMBER,
OPJENCO_CODEBLOCKSIZE,
OPJENCO_PRECINCTSIZE,
OPJENCO_TILESIZE,
OPJENCO_PROGRESSION,
OPJENCO_SUBSAMPLING,
OPJENCO_ENABLESOP,
OPJENCO_ENABLEEPH,
OPJENCO_ENABLEBYPASS,
OPJENCO_ENABLERESET,
OPJENCO_ENABLERESTART,
OPJENCO_ENABLEVSC,
OPJENCO_ENABLEERTERM,
OPJENCO_ENABLESEGMARK,
OPJENCO_ENABLEPOC,
OPJENCO_ROICOMP,
OPJENCO_ROISHIFT,
OPJENCO_IMORIG,
OPJENCO_TILORIG,
OPJENCO_ENABLEMCT,
OPJENCO_ENABLEIRREV,
OPJENCO_ENABLEINDEX,
OPJENCO_INDEXNAME,
OPJENCO_POCSPEC,
OPJENCO_ENABLECOMM,
OPJENCO_COMMENTTEXT,
OPJENCO_HPROT,
OPJENCO_HTILE,
OPJENCO_PPROT,
OPJENCO_PTILE,
OPJENCO_PPACK,
OPJENCO_SENSI,
OPJENCO_STILE
};
DECLARE_EVENT_TABLE()
DECLARE_EVENT_TABLE()
};
// Property sheet dialog: decoder
class OPJDecoderDialog: public wxPropertySheetDialog
{
DECLARE_CLASS(OPJDecoderDialog)
DECLARE_CLASS(OPJDecoderDialog)
public:
OPJDecoderDialog(wxWindow* parent, int dialogType);
~OPJDecoderDialog();
wxBookCtrlBase* m_settingsNotebook;
wxCheckBox *m_enabledecoCheck, *m_enableparseCheck;
wxSpinCtrl *m_reduceCtrl, *m_layerCtrl, *m_numcompsCtrl;
wxRadioBox* m_resizeBox;
wxBookCtrlBase* m_settingsNotebook;
wxCheckBox *m_enabledecoCheck, *m_enableparseCheck;
wxSpinCtrl *m_reduceCtrl, *m_layerCtrl, *m_numcompsCtrl;
wxRadioBox* m_resizeBox;
void OnEnableDeco(wxCommandEvent& event);
void OnEnableDeco(wxCommandEvent& event);
wxPanel* CreateMainSettingsPage(wxWindow* parent);
wxPanel* CreatePart1SettingsPage(wxWindow* parent);
wxPanel* CreatePart3SettingsPage(wxWindow* parent);
#ifdef USE_JPWL
void OnEnableJPWL(wxCommandEvent& event);
void OnEnableJPWL(wxCommandEvent& event);
wxPanel* CreatePart11SettingsPage(wxWindow* parent);
wxSpinCtrl *m_expcompsCtrl, *m_maxtilesCtrl;
wxCheckBox *m_enablejpwlCheck;
wxSpinCtrl *m_expcompsCtrl, *m_maxtilesCtrl;
wxCheckBox *m_enablejpwlCheck;
#endif // USE_JPWL
wxSpinCtrl *m_framenumCtrl;
wxSpinCtrl *m_framenumCtrl;
protected:
enum {
OPJDECO_RESMETHOD = 100,
OPJDECO_REDUCEFACTOR,
OPJDECO_QUALITYLAYERS,
OPJDECO_NUMCOMPS,
OPJDECO_ENABLEDECO,
OPJDECO_ENABLEPARSE,
OPJDECO_ENABLEJPWL,
OPJDECO_EXPCOMPS,
OPJDECO_MAXTILES,
OPJDECO_FRAMENUM
OPJDECO_RESMETHOD = 100,
OPJDECO_REDUCEFACTOR,
OPJDECO_QUALITYLAYERS,
OPJDECO_NUMCOMPS,
OPJDECO_ENABLEDECO,
OPJDECO_ENABLEPARSE,
OPJDECO_ENABLEJPWL,
OPJDECO_EXPCOMPS,
OPJDECO_MAXTILES,
OPJDECO_FRAMENUM
};
DECLARE_EVENT_TABLE()
DECLARE_EVENT_TABLE()
};
#endif //__OPJ_VIEWER_H__

View File

@ -1,54 +1,56 @@
wxString htmlaboutpage = wxT(
"<html>"
"<body bgcolor=#FFFFFF>"
"<table cellspacing=7 cellpadding=1 border=0 width=100%>"
"<tr>"
"<td rowspan=3 valign=top align=center width=70>"
"<img src=\"memory:opj_logo.xpm\"><br><br>"
"</td>"
"<td align=center>"
"<font size=+0 color=#000000><b>"
OPJ_APPLICATION " " OPJ_APPLICATION_VERSION
"</b></font><br>"
"<font size=-1 color=#000000><b>A JPEG 2000 image viewer</b></font><br>"
"<font size=-2 color=#000000><b>" OPJ_APPLICATION_PLATFORM " version</b></font>"
"</td>"
"</tr>"
"<tr height=3 valign=center>"
"<td valign=center bgcolor=#cc3300></td>"
"</tr>"
"<tr>"
"<td align=justify>"
"<center><font size=+0 color=#000000><a href=\"http://www.openjpeg.org/\">OpenJPEG</a></font></center>"
"<p><font size=-1 color=#000000>The OpenJPEG library is an open-source JPEG 2000 codec written in C language. "
"In addition to the basic codec, various other features are under development.</font></p><br>"
"<font size=-2 color=red>* Build: ")
"<html>"
"<body bgcolor=#FFFFFF>"
"<table cellspacing=7 cellpadding=1 border=0 width=100%>"
"<tr>"
"<td rowspan=3 valign=top align=center width=70>"
"<img src=\"memory:opj_logo.xpm\"><br><br>"
"</td>"
"<td align=center>"
"<font size=+0 color=#000000><b>"
OPJ_APPLICATION " " OPJ_APPLICATION_VERSION
"</b></font><br>"
"<font size=-1 color=#000000><b>A JPEG 2000 image viewer</b></font><br>"
"<font size=-2 color=#000000><b>" OPJ_APPLICATION_PLATFORM " version</b></font>"
"</td>"
"</tr>"
"<tr height=3 valign=center>"
"<td valign=center bgcolor=#cc3300></td>"
"</tr>"
"<tr>"
"<td align=justify>"
"<center><font size=+0 color=#000000><a href=\"http://www.openjpeg.org/\">OpenJPEG</a></font></center>"
"<p><font size=-1 color=#000000>The OpenJPEG library is an open-source JPEG 2000 codec written in C language. "
"In addition to the basic codec, various other features are under development.</font></p><br>"
"<font size=-2 color=red>* Build: ")
#include "build.h"
wxT(", " __DATE__ ", " __TIME__ "</font><br>")
wxT("<font size=-2 color=red>* " wxVERSION_STRING "</font><br>")
wxT("<font size=-2 color=red>* OpenJPEG " OPENJPEG_VERSION " (")
wxT(", " __DATE__ ", " __TIME__ "</font><br>")
wxT("<font size=-2 color=red>* " wxVERSION_STRING "</font><br>")
wxT("<font size=-2 color=red>* OpenJPEG " OPENJPEG_VERSION " (")
#ifdef USE_JPWL
wxT("<font size=-2 color=green>JPWL</font> ")
wxT("<font size=-2 color=green>JPWL</font> ")
#endif // USE_JPWL
#ifdef USE_JPSEC
wxT("<font size=-2 color=green>JPSEC</font> ")
wxT("<font size=-2 color=green>JPSEC</font> ")
#endif // USE_JPSEC
wxT(")</font><br>")
wxT(")</font><br>")
#ifdef USE_MXF
wxT("<font size=-2 color=red>* MXFLib " MXFLIB_VERSION_MAJOR "." MXFLIB_VERSION_MINOR "." MXFLIB_VERSION_TWEAK " (" MXFLIB_VERSION_BUILD ")</font><br>")
wxT("<font size=-2 color=red>* MXFLib " MXFLIB_VERSION_MAJOR "."
MXFLIB_VERSION_MINOR "." MXFLIB_VERSION_TWEAK " (" MXFLIB_VERSION_BUILD
")</font><br>")
#endif // USE_MXF
wxT("</td>"
"</tr>"
"<tr>"
"<td colspan=2 bgcolor=#CC3300 height=3 valign=center></td>"
"</tr>"
"<tr>"
"<td colspan=2>"
"<font size=-2 color=#444444>OpenJPEG is &copy; 2002-2008 <a href=\"http://www.tele.ucl.ac.be/\">TELE</a> - <a href=\"http://www.uclouvain.be/\">Universite' Catholique de Louvain</a></font><br>"
"<font size=-2 color=#444444>OPJViewer is &copy; 2007-2008 <a href=\"http://dsplab.diei.unipg.it/\">DSPLab</a> - <a href=\"http://www.unipg.it/\">Universita' degli studi di Perugia</a></font>"
"</td>"
"</tr>"
"</table>"
"</body>"
"</html>"
);
wxT("</td>"
"</tr>"
"<tr>"
"<td colspan=2 bgcolor=#CC3300 height=3 valign=center></td>"
"</tr>"
"<tr>"
"<td colspan=2>"
"<font size=-2 color=#444444>OpenJPEG is &copy; 2002-2008 <a href=\"http://www.tele.ucl.ac.be/\">TELE</a> - <a href=\"http://www.uclouvain.be/\">Universite' Catholique de Louvain</a></font><br>"
"<font size=-2 color=#444444>OPJViewer is &copy; 2007-2008 <a href=\"http://dsplab.diei.unipg.it/\">DSPLab</a> - <a href=\"http://www.unipg.it/\">Universita' degli studi di Perugia</a></font>"
"</td>"
"</tr>"
"</table>"
"</body>"
"</html>"
);

View File

@ -1 +1 @@
wxT("491")
wxT("491")

View File

@ -1,6 +1,6 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
@ -52,7 +52,7 @@
#include "openjp2/openjpeg.h"
#include "jp2/index.h"
#define wxBITMAP_TYPE_JPEG2000 50
#define wxBITMAP_TYPE_JPEG2000 50
class WXDLLEXPORT wxJPEG2000Handler: public wxImageHandler
{
@ -64,115 +64,117 @@ public:
m_type = wxBITMAP_TYPE_JPEG2000;
m_mime = wxT("image/mj2");
/* decoding */
m_reducefactor = 0;
m_qualitylayers = 0;
m_components = 0;
/* decoding */
m_reducefactor = 0;
m_qualitylayers = 0;
m_components = 0;
#ifdef USE_JPWL
m_enablejpwl = true;
m_expcomps = JPWL_EXPECTED_COMPONENTS;
m_maxtiles = JPWL_MAXIMUM_TILES;
m_enablejpwl = true;
m_expcomps = JPWL_EXPECTED_COMPONENTS;
m_maxtiles = JPWL_MAXIMUM_TILES;
#endif // USE_JPWL
/* encoding */
m_subsampling = wxT("1,1");
m_origin = wxT("0,0");
m_rates = wxT("20,10,5");
m_quality = wxT("30,35,40");
m_enablequality = false;
m_multicomp = false;
m_irreversible = false;
m_resolutions = 6;
m_progression = 0;
m_cbsize = wxT("32,32");
m_prsize = wxT("[128,128],[128,128]");
m_tsize = wxT("");
m_torigin = wxT("0,0");
/*m_progression
m_resilience*/
m_enablesop = false;
m_enableeph = false;
m_enablereset = false;
m_enablesegmark = false;
m_enablevsc = false;
m_enablerestart = false;
m_enableerterm = false;
m_enablebypass = false;
/*m_roicompo
m_roiup
m_indexfname*/
m_enableidx = false;
m_index = wxT("index.txt");
m_enablepoc = false;
m_poc = wxT("T1=0,0,1,5,3,CPRL/T1=5,0,1,6,3,CPRL");
m_enablecomm = true;
/* encoding */
m_subsampling = wxT("1,1");
m_origin = wxT("0,0");
m_rates = wxT("20,10,5");
m_quality = wxT("30,35,40");
m_enablequality = false;
m_multicomp = false;
m_irreversible = false;
m_resolutions = 6;
m_progression = 0;
m_cbsize = wxT("32,32");
m_prsize = wxT("[128,128],[128,128]");
m_tsize = wxT("");
m_torigin = wxT("0,0");
/*m_progression
m_resilience*/
m_enablesop = false;
m_enableeph = false;
m_enablereset = false;
m_enablesegmark = false;
m_enablevsc = false;
m_enablerestart = false;
m_enableerterm = false;
m_enablebypass = false;
/*m_roicompo
m_roiup
m_indexfname*/
m_enableidx = false;
m_index = wxT("index.txt");
m_enablepoc = false;
m_poc = wxT("T1=0,0,1,5,3,CPRL/T1=5,0,1,6,3,CPRL");
m_enablecomm = true;
#if defined __WXMSW__
m_comment = wxT("Created by OPJViewer Win32 - OpenJPEG version ");
m_comment = wxT("Created by OPJViewer Win32 - OpenJPEG version ");
#elif defined __WXGTK__
m_comment = wxT("Created by OPJViewer Lin32 - OpenJPEG version ");
m_comment = wxT("Created by OPJViewer Lin32 - OpenJPEG version ");
#else
m_comment = wxT("Created by OPJViewer - OpenJPEG version ");
m_comment = wxT("Created by OPJViewer - OpenJPEG version ");
#endif
#ifdef USE_JPWL
m_comment += wxString::Format(wxT("%s with JPWL"), (char *) opj_version());
m_comment += wxString::Format(wxT("%s with JPWL"), (char *) opj_version());
#else
m_comment += wxString::Format(wxT("%s"), (char *) opj_version());
m_comment += wxString::Format(wxT("%s"), (char *) opj_version());
#endif
}
// decoding engine parameters
int m_reducefactor, m_qualitylayers, m_components, m_framenum;
// decoding engine parameters
int m_reducefactor, m_qualitylayers, m_components, m_framenum;
#ifdef USE_JPWL
bool m_enablejpwl;
int m_expcomps, m_maxtiles;
bool m_enablejpwl;
int m_expcomps, m_maxtiles;
#endif // USE_JPWL
// encoding engine parameters
wxString m_subsampling;
wxString m_origin;
wxString m_rates;
wxString m_quality;
bool m_enablequality;
bool m_multicomp;
bool m_irreversible;
int m_resolutions;
int m_progression;
wxString m_cbsize;
wxString m_prsize;
wxString m_tsize;
wxString m_torigin;
/*m_progression
m_resilience*/
bool m_enablesop;
bool m_enableeph;
bool m_enablebypass;
bool m_enableerterm;
bool m_enablerestart;
bool m_enablereset;
bool m_enablesegmark;
bool m_enablevsc;
/*m_roicompo
m_roiup
m_indexfname*/
bool m_enableidx;
wxString m_index;
bool m_enablecomm;
wxString m_comment;
bool m_enablepoc;
wxString m_poc;
// encoding engine parameters
wxString m_subsampling;
wxString m_origin;
wxString m_rates;
wxString m_quality;
bool m_enablequality;
bool m_multicomp;
bool m_irreversible;
int m_resolutions;
int m_progression;
wxString m_cbsize;
wxString m_prsize;
wxString m_tsize;
wxString m_torigin;
/*m_progression
m_resilience*/
bool m_enablesop;
bool m_enableeph;
bool m_enablebypass;
bool m_enableerterm;
bool m_enablerestart;
bool m_enablereset;
bool m_enablesegmark;
bool m_enablevsc;
/*m_roicompo
m_roiup
m_indexfname*/
bool m_enableidx;
wxString m_index;
bool m_enablecomm;
wxString m_comment;
bool m_enablepoc;
wxString m_poc;
#if wxUSE_STREAMS
virtual bool LoadFile(wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1);
virtual bool SaveFile(wxImage *image, wxOutputStream& stream, bool verbose=true);
virtual bool LoadFile(wxImage *image, wxInputStream& stream,
bool verbose = true, int index = -1);
virtual bool SaveFile(wxImage *image, wxOutputStream& stream,
bool verbose = true);
protected:
virtual bool DoCanRead(wxInputStream& stream);
#endif
private:
OPJ_PROG_ORDER give_progression(char progression[4]);
OPJ_PROG_ORDER give_progression(char progression[4]);
DECLARE_DYNAMIC_CLASS(wxJPEG2000Handler)
};

View File

@ -1,6 +1,6 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
@ -54,7 +54,7 @@
#include "wx/image.h"
#include "libopenjpeg/openjpeg.h"
#define wxBITMAP_TYPE_MXF 51
#define wxBITMAP_TYPE_MXF 51
class WXDLLEXPORT wxMXFHandler: public wxImageHandler
{
@ -66,30 +66,32 @@ public:
m_type = wxBITMAP_TYPE_MXF;
m_mime = wxT("image/mxf");
m_reducefactor = 0;
m_qualitylayers = 0;
m_components = 0;
m_filename = wxT("");
m_reducefactor = 0;
m_qualitylayers = 0;
m_components = 0;
m_filename = wxT("");
#ifdef USE_JPWL
m_enablejpwl = true;
m_expcomps = JPWL_EXPECTED_COMPONENTS;
m_maxtiles = JPWL_MAXIMUM_TILES;
m_enablejpwl = true;
m_expcomps = JPWL_EXPECTED_COMPONENTS;
m_maxtiles = JPWL_MAXIMUM_TILES;
#endif // USE_JPWL
}
// decoding engine parameters
int m_reducefactor, m_qualitylayers, m_components, m_framenum;
wxFileName m_filename;
// decoding engine parameters
int m_reducefactor, m_qualitylayers, m_components, m_framenum;
wxFileName m_filename;
#ifdef USE_JPWL
bool m_enablejpwl;
int m_expcomps, m_maxtiles;
bool m_enablejpwl;
int m_expcomps, m_maxtiles;
#endif // USE_JPWL
#if wxUSE_STREAMS
virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 );
virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true );
virtual bool LoadFile(wxImage *image, wxInputStream& stream,
bool verbose = true, int index = -1);
virtual bool SaveFile(wxImage *image, wxOutputStream& stream,
bool verbose = true);
protected:
virtual bool DoCanRead( wxInputStream& stream );
virtual bool DoCanRead(wxInputStream& stream);
#endif
private:

View File

@ -1,6 +1,6 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
@ -8,7 +8,7 @@
* Copyright (c) 2002-2014, Professor Benoit Macq
* Copyright (c) 2001-2003, David Janssens
* Copyright (c) 2002-2003, Yannick Verschueren
* Copyright (c) 2003-2007, Francois-Olivier Devaux
* Copyright (c) 2003-2007, Francois-Olivier Devaux
* Copyright (c) 2003-2014, Antonin Descampe
* Copyright (c) 2005, Herve Drolon, FreeImage Team
* All rights reserved.
@ -40,7 +40,7 @@
#include <stddef.h> /* ptrdiff_t */
/**
/**
@file bio.h
@brief Implementation of an individual bit input-output (BIO)
@ -54,23 +54,23 @@ The functions in BIO.C have for goal to realize an individual bit input - output
Individual bit input-output stream (BIO)
*/
typedef struct opj_bio {
/** pointer to the start of the buffer */
OPJ_BYTE *start;
/** pointer to the end of the buffer */
OPJ_BYTE *end;
/** pointer to the present position in the buffer */
OPJ_BYTE *bp;
/** temporary place where each byte is read or written */
OPJ_UINT32 buf;
/** coder : number of bits free to write. decoder : number of bits read */
OPJ_UINT32 ct;
/** pointer to the start of the buffer */
OPJ_BYTE *start;
/** pointer to the end of the buffer */
OPJ_BYTE *end;
/** pointer to the present position in the buffer */
OPJ_BYTE *bp;
/** temporary place where each byte is read or written */
OPJ_UINT32 buf;
/** coder : number of bits free to write. decoder : number of bits read */
OPJ_UINT32 ct;
} opj_bio_t;
/** @name Exported functions */
/*@{*/
/* ----------------------------------------------------------------------- */
/**
Create a new BIO handle
Create a new BIO handle
@return Returns a new BIO handle if successful, returns NULL otherwise
*/
opj_bio_t* opj_bio_create(void);
@ -89,14 +89,14 @@ ptrdiff_t opj_bio_numbytes(opj_bio_t *bio);
Init encoder
@param bio BIO handle
@param bp Output buffer
@param len Output buffer length
@param len Output buffer length
*/
void opj_bio_init_enc(opj_bio_t *bio, OPJ_BYTE *bp, OPJ_UINT32 len);
/**
Init decoder
@param bio BIO handle
@param bp Input buffer
@param len Input buffer length
@param len Input buffer length
*/
void opj_bio_init_dec(opj_bio_t *bio, OPJ_BYTE *bp, OPJ_UINT32 len);
/**
@ -109,7 +109,7 @@ void opj_bio_write(opj_bio_t *bio, OPJ_UINT32 v, OPJ_UINT32 n);
/**
Read bits
@param bio BIO handle
@param n Number of bits to read
@param n Number of bits to read
@return Returns the corresponding read number
*/
OPJ_UINT32 opj_bio_read(opj_bio_t *bio, OPJ_UINT32 n);

View File

@ -40,7 +40,7 @@
#include "openjpeg.h"
/*
/*
* Write Codestream index box (superbox)
*
* @param[in] offset offset of j2k codestream
@ -50,10 +50,11 @@
* @param[in] j2klen length of j2k codestream
* @return length of cidx box
*/
int opj_write_cidx( int offset, opj_stream_private_t *cio, opj_codestream_info_t cstr_info, int j2klen,
opj_event_mgr_t * p_manager );
int opj_write_cidx(int offset, opj_stream_private_t *cio,
opj_codestream_info_t cstr_info, int j2klen,
opj_event_mgr_t * p_manager);
/*
/*
* Check if EPH option is used
*
* @param[in] coff offset of j2k codestream
@ -62,7 +63,8 @@ int opj_write_cidx( int offset, opj_stream_private_t *cio, opj_codestream_info_t
* @param[in] cio file output handle
* @return true if EPH is used
*/
OPJ_BOOL opj_check_EPHuse( int coff, opj_marker_info_t *markers, int marknum, opj_stream_private_t *cio,
opj_event_mgr_t * p_manager );
OPJ_BOOL opj_check_EPHuse(int coff, opj_marker_info_t *markers, int marknum,
opj_stream_private_t *cio,
opj_event_mgr_t * p_manager);
#endif /* !CIDX_MANAGER_H_ */

View File

@ -1,6 +1,6 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
@ -8,10 +8,10 @@
* Copyright (c) 2002-2014, Professor Benoit Macq
* Copyright (c) 2001-2003, David Janssens
* Copyright (c) 2002-2003, Yannick Verschueren
* Copyright (c) 2003-2007, Francois-Olivier Devaux
* Copyright (c) 2003-2007, Francois-Olivier Devaux
* Copyright (c) 2003-2014, Antonin Descampe
* Copyright (c) 2005, Herve Drolon, FreeImage Team
* Copyright (c) 2008, 2011-2012, Centre National d'Etudes Spatiales (CNES), FR
* Copyright (c) 2008, 2011-2012, Centre National d'Etudes Spatiales (CNES), FR
* Copyright (c) 2012, CS Systemes d'Information, France
* All rights reserved.
*
@ -54,19 +54,19 @@ The functions in CIO.C have for goal to realize a byte input / output process.
/* ----------------------------------------------------------------------- */
#if defined(OPJ_BIG_ENDIAN)
#define opj_write_bytes opj_write_bytes_BE
#define opj_read_bytes opj_read_bytes_BE
#define opj_write_double opj_write_double_BE
#define opj_read_double opj_read_double_BE
#define opj_write_float opj_write_float_BE
#define opj_read_float opj_read_float_BE
#define opj_write_bytes opj_write_bytes_BE
#define opj_read_bytes opj_read_bytes_BE
#define opj_write_double opj_write_double_BE
#define opj_read_double opj_read_double_BE
#define opj_write_float opj_write_float_BE
#define opj_read_float opj_read_float_BE
#else
#define opj_write_bytes opj_write_bytes_LE
#define opj_read_bytes opj_read_bytes_LE
#define opj_write_double opj_write_double_LE
#define opj_read_double opj_read_double_LE
#define opj_write_float opj_write_float_LE
#define opj_read_float opj_read_float_LE
#define opj_write_bytes opj_write_bytes_LE
#define opj_read_bytes opj_read_bytes_LE
#define opj_write_double opj_write_double_LE
#define opj_read_double opj_read_double_LE
#define opj_write_float opj_write_float_LE
#define opj_read_float opj_read_float_LE
#endif
@ -78,87 +78,88 @@ The functions in CIO.C have for goal to realize a byte input / output process.
/**
Byte input-output stream.
*/
typedef struct opj_stream_private
{
/**
* User data, be it files, ... The actual data depends on the type of the stream.
*/
void * m_user_data;
typedef struct opj_stream_private {
/**
* User data, be it files, ... The actual data depends on the type of the stream.
*/
void * m_user_data;
/**
* Pointer to function to free m_user_data (NULL at initialization)
* when destroying the stream. If pointer is NULL the function is not
* called and the m_user_data is not freed (even if non-NULL).
*/
opj_stream_free_user_data_fn m_free_user_data_fn;
/**
* Pointer to function to free m_user_data (NULL at initialization)
* when destroying the stream. If pointer is NULL the function is not
* called and the m_user_data is not freed (even if non-NULL).
*/
opj_stream_free_user_data_fn m_free_user_data_fn;
/**
* User data length
*/
OPJ_UINT64 m_user_data_length;
/**
* User data length
*/
OPJ_UINT64 m_user_data_length;
/**
* Pointer to actual read function (NULL at the initialization of the cio.
*/
opj_stream_read_fn m_read_fn;
/**
* Pointer to actual read function (NULL at the initialization of the cio.
*/
opj_stream_read_fn m_read_fn;
/**
* Pointer to actual write function (NULL at the initialization of the cio.
*/
opj_stream_write_fn m_write_fn;
/**
* Pointer to actual write function (NULL at the initialization of the cio.
*/
opj_stream_write_fn m_write_fn;
/**
* Pointer to actual skip function (NULL at the initialization of the cio.
* There is no seek function to prevent from back and forth slow procedures.
*/
opj_stream_skip_fn m_skip_fn;
/**
* Pointer to actual skip function (NULL at the initialization of the cio.
* There is no seek function to prevent from back and forth slow procedures.
*/
opj_stream_skip_fn m_skip_fn;
/**
* Pointer to actual seek function (if available).
*/
opj_stream_seek_fn m_seek_fn;
/**
* Pointer to actual seek function (if available).
*/
opj_stream_seek_fn m_seek_fn;
/**
* Actual data stored into the stream if readed from. Data is read by chunk of fixed size.
* you should never access this data directly.
*/
OPJ_BYTE * m_stored_data;
/**
* Actual data stored into the stream if readed from. Data is read by chunk of fixed size.
* you should never access this data directly.
*/
OPJ_BYTE * m_stored_data;
/**
* Pointer to the current read data.
*/
OPJ_BYTE * m_current_data;
/**
* Pointer to the current read data.
*/
OPJ_BYTE * m_current_data;
/**
* FIXME DOC.
*/
OPJ_OFF_T (* m_opj_skip)(struct opj_stream_private * ,OPJ_OFF_T , struct opj_event_mgr *);
OPJ_OFF_T(* m_opj_skip)(struct opj_stream_private *, OPJ_OFF_T,
struct opj_event_mgr *);
/**
* FIXME DOC.
*/
OPJ_BOOL (* m_opj_seek) (struct opj_stream_private * , OPJ_OFF_T , struct opj_event_mgr *);
OPJ_BOOL(* m_opj_seek)(struct opj_stream_private *, OPJ_OFF_T,
struct opj_event_mgr *);
/**
* number of bytes containing in the buffer.
*/
OPJ_SIZE_T m_bytes_in_buffer;
/**
* number of bytes containing in the buffer.
*/
OPJ_SIZE_T m_bytes_in_buffer;
/**
* The number of bytes read/written from the beginning of the stream
*/
OPJ_OFF_T m_byte_offset;
/**
* The number of bytes read/written from the beginning of the stream
*/
OPJ_OFF_T m_byte_offset;
/**
* The size of the buffer.
*/
OPJ_SIZE_T m_buffer_size;
/**
* The size of the buffer.
*/
OPJ_SIZE_T m_buffer_size;
/**
* Flags to tell the status of the stream.
* Used with OPJ_STREAM_STATUS_* defines.
*/
OPJ_UINT32 m_status;
/**
* Flags to tell the status of the stream.
* Used with OPJ_STREAM_STATUS_* defines.
*/
OPJ_UINT32 m_status;
}
opj_stream_private_t;
@ -168,221 +169,238 @@ opj_stream_private_t;
/* ----------------------------------------------------------------------- */
/**
* Write some bytes to the given data buffer, this function is used in Big Endian cpus.
* @param p_buffer pointer the data buffer to write data to.
* @param p_value the value to write
* @param p_nb_bytes the number of bytes to write
* @param p_buffer pointer the data buffer to write data to.
* @param p_value the value to write
* @param p_nb_bytes the number of bytes to write
*/
void opj_write_bytes_BE (OPJ_BYTE * p_buffer, OPJ_UINT32 p_value, OPJ_UINT32 p_nb_bytes);
void opj_write_bytes_BE(OPJ_BYTE * p_buffer, OPJ_UINT32 p_value,
OPJ_UINT32 p_nb_bytes);
/**
* Reads some bytes from the given data buffer, this function is used in Big Endian cpus.
* @param p_buffer pointer the data buffer to read data from.
* @param p_value pointer to the value that will store the data.
* @param p_nb_bytes the nb bytes to read.
* @return the number of bytes read or -1 if an error occurred.
* @param p_buffer pointer the data buffer to read data from.
* @param p_value pointer to the value that will store the data.
* @param p_nb_bytes the nb bytes to read.
* @return the number of bytes read or -1 if an error occurred.
*/
void opj_read_bytes_BE(const OPJ_BYTE * p_buffer, OPJ_UINT32 * p_value, OPJ_UINT32 p_nb_bytes);
void opj_read_bytes_BE(const OPJ_BYTE * p_buffer, OPJ_UINT32 * p_value,
OPJ_UINT32 p_nb_bytes);
/**
* Write some bytes to the given data buffer, this function is used in Little Endian cpus.
* @param p_buffer pointer the data buffer to write data to.
* @param p_value the value to write
* @param p_nb_bytes the number of bytes to write
* @return the number of bytes written or -1 if an error occurred
* @param p_buffer pointer the data buffer to write data to.
* @param p_value the value to write
* @param p_nb_bytes the number of bytes to write
* @return the number of bytes written or -1 if an error occurred
*/
void opj_write_bytes_LE (OPJ_BYTE * p_buffer, OPJ_UINT32 p_value, OPJ_UINT32 p_nb_bytes);
void opj_write_bytes_LE(OPJ_BYTE * p_buffer, OPJ_UINT32 p_value,
OPJ_UINT32 p_nb_bytes);
/**
* Reads some bytes from the given data buffer, this function is used in Little Endian cpus.
* @param p_buffer pointer the data buffer to read data from.
* @param p_value pointer to the value that will store the data.
* @param p_nb_bytes the nb bytes to read.
* @return the number of bytes read or -1 if an error occurred.
* @param p_buffer pointer the data buffer to read data from.
* @param p_value pointer to the value that will store the data.
* @param p_nb_bytes the nb bytes to read.
* @return the number of bytes read or -1 if an error occurred.
*/
void opj_read_bytes_LE(const OPJ_BYTE * p_buffer, OPJ_UINT32 * p_value, OPJ_UINT32 p_nb_bytes);
void opj_read_bytes_LE(const OPJ_BYTE * p_buffer, OPJ_UINT32 * p_value,
OPJ_UINT32 p_nb_bytes);
/**
* Write some bytes to the given data buffer, this function is used in Little Endian cpus.
* @param p_buffer pointer the data buffer to write data to.
* @param p_value the value to write
* @param p_buffer pointer the data buffer to write data to.
* @param p_value the value to write
*/
void opj_write_double_LE(OPJ_BYTE * p_buffer, OPJ_FLOAT64 p_value);
/***
* Write some bytes to the given data buffer, this function is used in Big Endian cpus.
* @param p_buffer pointer the data buffer to write data to.
* @param p_value the value to write
* @param p_buffer pointer the data buffer to write data to.
* @param p_value the value to write
*/
void opj_write_double_BE(OPJ_BYTE * p_buffer, OPJ_FLOAT64 p_value);
/**
* Reads some bytes from the given data buffer, this function is used in Little Endian cpus.
* @param p_buffer pointer the data buffer to read data from.
* @param p_value pointer to the value that will store the data.
* @param p_buffer pointer the data buffer to read data from.
* @param p_value pointer to the value that will store the data.
*/
void opj_read_double_LE(const OPJ_BYTE * p_buffer, OPJ_FLOAT64 * p_value);
/**
* Reads some bytes from the given data buffer, this function is used in Big Endian cpus.
* @param p_buffer pointer the data buffer to read data from.
* @param p_value pointer to the value that will store the data.
* @param p_buffer pointer the data buffer to read data from.
* @param p_value pointer to the value that will store the data.
*/
void opj_read_double_BE(const OPJ_BYTE * p_buffer, OPJ_FLOAT64 * p_value);
/**
* Reads some bytes from the given data buffer, this function is used in Little Endian cpus.
* @param p_buffer pointer the data buffer to read data from.
* @param p_value pointer to the value that will store the data.
* @param p_buffer pointer the data buffer to read data from.
* @param p_value pointer to the value that will store the data.
*/
void opj_read_float_LE(const OPJ_BYTE * p_buffer, OPJ_FLOAT32 * p_value);
/**
* Reads some bytes from the given data buffer, this function is used in Big Endian cpus.
* @param p_buffer pointer the data buffer to read data from.
* @param p_value pointer to the value that will store the data.
* @param p_buffer pointer the data buffer to read data from.
* @param p_value pointer to the value that will store the data.
*/
void opj_read_float_BE(const OPJ_BYTE * p_buffer, OPJ_FLOAT32 * p_value);
/**
* Write some bytes to the given data buffer, this function is used in Little Endian cpus.
* @param p_buffer pointer the data buffer to write data to.
* @param p_value the value to write
* @param p_buffer pointer the data buffer to write data to.
* @param p_value the value to write
*/
void opj_write_float_LE(OPJ_BYTE * p_buffer, OPJ_FLOAT32 p_value);
/***
* Write some bytes to the given data buffer, this function is used in Big Endian cpus.
* @param p_buffer pointer the data buffer to write data to.
* @param p_value the value to write
* @param p_buffer pointer the data buffer to write data to.
* @param p_value the value to write
*/
void opj_write_float_BE(OPJ_BYTE * p_buffer, OPJ_FLOAT32 p_value);
/**
* Reads some bytes from the stream.
* @param p_stream the stream to read data from.
* @param p_buffer pointer to the data buffer that will receive the data.
* @param p_size number of bytes to read.
* @param p_event_mgr the user event manager to be notified of special events.
* @return the number of bytes read, or -1 if an error occurred or if the stream is at the end.
* @param p_stream the stream to read data from.
* @param p_buffer pointer to the data buffer that will receive the data.
* @param p_size number of bytes to read.
* @param p_event_mgr the user event manager to be notified of special events.
* @return the number of bytes read, or -1 if an error occurred or if the stream is at the end.
*/
OPJ_SIZE_T opj_stream_read_data (opj_stream_private_t * p_stream,OPJ_BYTE * p_buffer, OPJ_SIZE_T p_size, struct opj_event_mgr * p_event_mgr);
OPJ_SIZE_T opj_stream_read_data(opj_stream_private_t * p_stream,
OPJ_BYTE * p_buffer, OPJ_SIZE_T p_size, struct opj_event_mgr * p_event_mgr);
/**
* Writes some bytes to the stream.
* @param p_stream the stream to write data to.
* @param p_buffer pointer to the data buffer holds the data to be writtent.
* @param p_size number of bytes to write.
* @param p_event_mgr the user event manager to be notified of special events.
* @return the number of bytes writtent, or -1 if an error occurred.
* @param p_stream the stream to write data to.
* @param p_buffer pointer to the data buffer holds the data to be writtent.
* @param p_size number of bytes to write.
* @param p_event_mgr the user event manager to be notified of special events.
* @return the number of bytes writtent, or -1 if an error occurred.
*/
OPJ_SIZE_T opj_stream_write_data (opj_stream_private_t * p_stream,const OPJ_BYTE * p_buffer, OPJ_SIZE_T p_size, struct opj_event_mgr * p_event_mgr);
OPJ_SIZE_T opj_stream_write_data(opj_stream_private_t * p_stream,
const OPJ_BYTE * p_buffer, OPJ_SIZE_T p_size,
struct opj_event_mgr * p_event_mgr);
/**
* Writes the content of the stream buffer to the stream.
* @param p_stream the stream to write data to.
* @param p_event_mgr the user event manager to be notified of special events.
* @return true if the data could be flushed, false else.
* @param p_stream the stream to write data to.
* @param p_event_mgr the user event manager to be notified of special events.
* @return true if the data could be flushed, false else.
*/
OPJ_BOOL opj_stream_flush (opj_stream_private_t * p_stream, struct opj_event_mgr * p_event_mgr);
OPJ_BOOL opj_stream_flush(opj_stream_private_t * p_stream,
struct opj_event_mgr * p_event_mgr);
/**
* Skips a number of bytes from the stream.
* @param p_stream the stream to skip data from.
* @param p_size the number of bytes to skip.
* @param p_event_mgr the user event manager to be notified of special events.
* @return the number of bytes skipped, or -1 if an error occurred.
* @param p_stream the stream to skip data from.
* @param p_size the number of bytes to skip.
* @param p_event_mgr the user event manager to be notified of special events.
* @return the number of bytes skipped, or -1 if an error occurred.
*/
OPJ_OFF_T opj_stream_skip (opj_stream_private_t * p_stream,OPJ_OFF_T p_size, struct opj_event_mgr * p_event_mgr);
OPJ_OFF_T opj_stream_skip(opj_stream_private_t * p_stream, OPJ_OFF_T p_size,
struct opj_event_mgr * p_event_mgr);
/**
* Tells the byte offset on the stream (similar to ftell).
*
* @param p_stream the stream to get the information from.
* @param p_stream the stream to get the information from.
*
* @return the current position o fthe stream.
* @return the current position o fthe stream.
*/
OPJ_OFF_T opj_stream_tell (const opj_stream_private_t * p_stream);
OPJ_OFF_T opj_stream_tell(const opj_stream_private_t * p_stream);
/**
* Get the number of bytes left before the end of the stream (similar to cio_numbytesleft).
*
* @param p_stream the stream to get the information from.
* @param p_stream the stream to get the information from.
*
* @return Number of bytes left before the end of the stream.
* @return Number of bytes left before the end of the stream.
*/
OPJ_OFF_T opj_stream_get_number_byte_left (const opj_stream_private_t * p_stream);
OPJ_OFF_T opj_stream_get_number_byte_left(const opj_stream_private_t *
p_stream);
/**
* Skips a number of bytes from the stream.
* @param p_stream the stream to skip data from.
* @param p_size the number of bytes to skip.
* @param p_event_mgr the user event manager to be notified of special events.
* @return the number of bytes skipped, or -1 if an error occurred.
* @param p_stream the stream to skip data from.
* @param p_size the number of bytes to skip.
* @param p_event_mgr the user event manager to be notified of special events.
* @return the number of bytes skipped, or -1 if an error occurred.
*/
OPJ_OFF_T opj_stream_write_skip (opj_stream_private_t * p_stream, OPJ_OFF_T p_size, struct opj_event_mgr * p_event_mgr);
OPJ_OFF_T opj_stream_write_skip(opj_stream_private_t * p_stream,
OPJ_OFF_T p_size, struct opj_event_mgr * p_event_mgr);
/**
* Skips a number of bytes from the stream.
* @param p_stream the stream to skip data from.
* @param p_size the number of bytes to skip.
* @param p_event_mgr the user event manager to be notified of special events.
* @return the number of bytes skipped, or -1 if an error occurred.
* @param p_stream the stream to skip data from.
* @param p_size the number of bytes to skip.
* @param p_event_mgr the user event manager to be notified of special events.
* @return the number of bytes skipped, or -1 if an error occurred.
*/
OPJ_OFF_T opj_stream_read_skip (opj_stream_private_t * p_stream, OPJ_OFF_T p_size, struct opj_event_mgr * p_event_mgr);
OPJ_OFF_T opj_stream_read_skip(opj_stream_private_t * p_stream,
OPJ_OFF_T p_size, struct opj_event_mgr * p_event_mgr);
/**
* Skips a number of bytes from the stream.
* @param p_stream the stream to skip data from.
* @param p_size the number of bytes to skip.
* @param p_event_mgr the user event manager to be notified of special events.
* @return OPJ_TRUE if success, or OPJ_FALSE if an error occurred.
* @param p_stream the stream to skip data from.
* @param p_size the number of bytes to skip.
* @param p_event_mgr the user event manager to be notified of special events.
* @return OPJ_TRUE if success, or OPJ_FALSE if an error occurred.
*/
OPJ_BOOL opj_stream_read_seek (opj_stream_private_t * p_stream, OPJ_OFF_T p_size, struct opj_event_mgr * p_event_mgr);
OPJ_BOOL opj_stream_read_seek(opj_stream_private_t * p_stream, OPJ_OFF_T p_size,
struct opj_event_mgr * p_event_mgr);
/**
* Skips a number of bytes from the stream.
* @param p_stream the stream to skip data from.
* @param p_size the number of bytes to skip.
* @param p_event_mgr the user event manager to be notified of special events.
* @return the number of bytes skipped, or -1 if an error occurred.
* @param p_stream the stream to skip data from.
* @param p_size the number of bytes to skip.
* @param p_event_mgr the user event manager to be notified of special events.
* @return the number of bytes skipped, or -1 if an error occurred.
*/
OPJ_BOOL opj_stream_write_seek (opj_stream_private_t * p_stream, OPJ_OFF_T p_size, struct opj_event_mgr * p_event_mgr);
OPJ_BOOL opj_stream_write_seek(opj_stream_private_t * p_stream,
OPJ_OFF_T p_size, struct opj_event_mgr * p_event_mgr);
/**
* Seeks a number of bytes from the stream.
* @param p_stream the stream to skip data from.
* @param p_size the number of bytes to skip.
* @param p_event_mgr the user event manager to be notified of special events.
* @return true if the stream is seekable.
* @param p_stream the stream to skip data from.
* @param p_size the number of bytes to skip.
* @param p_event_mgr the user event manager to be notified of special events.
* @return true if the stream is seekable.
*/
OPJ_BOOL opj_stream_seek (opj_stream_private_t * p_stream, OPJ_OFF_T p_size, struct opj_event_mgr * p_event_mgr);
OPJ_BOOL opj_stream_seek(opj_stream_private_t * p_stream, OPJ_OFF_T p_size,
struct opj_event_mgr * p_event_mgr);
/**
* Tells if the given stream is seekable.
*/
OPJ_BOOL opj_stream_has_seek (const opj_stream_private_t * p_stream);
OPJ_BOOL opj_stream_has_seek(const opj_stream_private_t * p_stream);
/**
* FIXME DOC.
*/
OPJ_SIZE_T opj_stream_default_read (void * p_buffer, OPJ_SIZE_T p_nb_bytes, void * p_user_data);
OPJ_SIZE_T opj_stream_default_read(void * p_buffer, OPJ_SIZE_T p_nb_bytes,
void * p_user_data);
/**
* FIXME DOC.
*/
OPJ_SIZE_T opj_stream_default_write (void * p_buffer, OPJ_SIZE_T p_nb_bytes, void * p_user_data);
OPJ_SIZE_T opj_stream_default_write(void * p_buffer, OPJ_SIZE_T p_nb_bytes,
void * p_user_data);
/**
* FIXME DOC.
*/
OPJ_OFF_T opj_stream_default_skip (OPJ_OFF_T p_nb_bytes, void * p_user_data);
OPJ_OFF_T opj_stream_default_skip(OPJ_OFF_T p_nb_bytes, void * p_user_data);
/**
* FIXME DOC.
*/
OPJ_BOOL opj_stream_default_seek (OPJ_OFF_T p_nb_bytes, void * p_user_data);
OPJ_BOOL opj_stream_default_seek(OPJ_OFF_T p_nb_bytes, void * p_user_data);
/* ----------------------------------------------------------------------- */
/*@}*/

View File

@ -1,6 +1,6 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
@ -8,7 +8,7 @@
* Copyright (c) 2002-2014, Professor Benoit Macq
* Copyright (c) 2001-2003, David Janssens
* Copyright (c) 2002-2003, Yannick Verschueren
* Copyright (c) 2003-2007, Francois-Olivier Devaux
* Copyright (c) 2003-2007, Francois-Olivier Devaux
* Copyright (c) 2003-2014, Antonin Descampe
* Copyright (c) 2005, Herve Drolon, FreeImage Team
* All rights reserved.
@ -67,7 +67,8 @@ Apply a reversible inverse DWT transform to a component of an image.
@param tilec Tile component information (current tile)
@param numres Number of resolution levels to decode
*/
OPJ_BOOL opj_dwt_decode(opj_thread_pool_t* tp, opj_tcd_tilecomp_t* tilec, OPJ_UINT32 numres);
OPJ_BOOL opj_dwt_decode(opj_thread_pool_t* tp, opj_tcd_tilecomp_t* tilec,
OPJ_UINT32 numres);
/**
Get the gain of a subband for the reversible 5-3 DWT.
@ -83,18 +84,19 @@ Get the norm of a wavelet function of a subband at a specified level for the rev
*/
OPJ_FLOAT64 opj_dwt_getnorm(OPJ_UINT32 level, OPJ_UINT32 orient);
/**
Forward 9-7 wavelet transform in 2-D.
Forward 9-7 wavelet transform in 2-D.
Apply an irreversible DWT transform to a component of an image.
@param tilec Tile component information (current tile)
*/
OPJ_BOOL opj_dwt_encode_real(opj_tcd_tilecomp_t * tilec);
/**
Inverse 9-7 wavelet transform in 2-D.
Inverse 9-7 wavelet transform in 2-D.
Apply an irreversible inverse DWT transform to a component of an image.
@param tilec Tile component information (current tile)
@param numres Number of resolution levels to decode
*/
OPJ_BOOL opj_dwt_decode_real(opj_tcd_tilecomp_t* OPJ_RESTRICT tilec, OPJ_UINT32 numres);
OPJ_BOOL opj_dwt_decode_real(opj_tcd_tilecomp_t* OPJ_RESTRICT tilec,
OPJ_UINT32 numres);
/**
Get the gain of a subband for the irreversible 9-7 DWT.
@ -110,7 +112,7 @@ Get the norm of a wavelet function of a subband at a specified level for the irr
*/
OPJ_FLOAT64 opj_dwt_getnorm_real(OPJ_UINT32 level, OPJ_UINT32 orient);
/**
Explicit calculation of the Quantization Stepsizes
Explicit calculation of the Quantization Stepsizes
@param tccp Tile-component coding parameters
@param prec Precint analyzed
*/

View File

@ -1,11 +1,11 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
* Copyright (c) 2005, Herve Drolon, FreeImage Team
* Copyright (c) 2008, 2011-2012, Centre National d'Etudes Spatiales (CNES), FR
* Copyright (c) 2008, 2011-2012, Centre National d'Etudes Spatiales (CNES), FR
* Copyright (c) 2012, CS Systemes d'Information, France
* All rights reserved.
*
@ -40,33 +40,32 @@ The functions in EVENT.C have for goal to send output messages (errors, warnings
*/
/**
Message handler object
used for
used for
<ul>
<li>Error messages
<li>Warning messages
<li>Debugging messages
</ul>
*/
typedef struct opj_event_mgr
{
/** Data to call the event manager upon */
void * m_error_data;
/** Data to call the event manager upon */
void * m_warning_data;
/** Data to call the event manager upon */
void * m_info_data;
/** Error message callback if available, NULL otherwise */
opj_msg_callback error_handler;
/** Warning message callback if available, NULL otherwise */
opj_msg_callback warning_handler;
/** Debug message callback if available, NULL otherwise */
opj_msg_callback info_handler;
typedef struct opj_event_mgr {
/** Data to call the event manager upon */
void * m_error_data;
/** Data to call the event manager upon */
void * m_warning_data;
/** Data to call the event manager upon */
void * m_info_data;
/** Error message callback if available, NULL otherwise */
opj_msg_callback error_handler;
/** Warning message callback if available, NULL otherwise */
opj_msg_callback warning_handler;
/** Debug message callback if available, NULL otherwise */
opj_msg_callback info_handler;
} opj_event_mgr_t;
#define EVT_ERROR 1 /**< Error event type */
#define EVT_WARNING 2 /**< Warning event type */
#define EVT_INFO 4 /**< Debug event type */
#define EVT_ERROR 1 /**< Error event type */
#define EVT_WARNING 2 /**< Warning event type */
#define EVT_INFO 4 /**< Debug event type */
/** @defgroup EVENT EVENT - Implementation of a event callback system */
/*@{*/
@ -81,13 +80,14 @@ typedef struct opj_event_mgr
/**
* Write formatted data to a string and send the string to a user callback.
*
* @param event_mgr Event handler
* @param event_type Event type or callback to use to send the message
* @param fmt Format-control string (plus optional arguments)
* @param event_mgr Event handler
* @param event_type Event type or callback to use to send the message
* @param fmt Format-control string (plus optional arguments)
*
* @return Returns true if successful, returns false otherwise
*/
OPJ_BOOL opj_event_msg(opj_event_mgr_t* event_mgr, OPJ_INT32 event_type, const char *fmt, ...);
OPJ_BOOL opj_event_msg(opj_event_mgr_t* event_mgr, OPJ_INT32 event_type,
const char *fmt, ...);
/* ----------------------------------------------------------------------- */
/**

View File

@ -1,6 +1,6 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
@ -32,7 +32,7 @@
#ifndef __FUNCTION_LIST_H
#define __FUNCTION_LIST_H
/**
/**
* @file function_list.h
* @brief Implementation of a list of procedures.
@ -54,20 +54,19 @@ typedef void (*opj_procedure)(void);
/**
* A list of procedures.
*/
typedef struct opj_procedure_list
{
/**
* The number of validation procedures.
*/
OPJ_UINT32 m_nb_procedures;
/**
* The number of the array of validation procedures.
*/
OPJ_UINT32 m_nb_max_procedures;
/**
* The array of procedures.
*/
opj_procedure * m_procedures;
typedef struct opj_procedure_list {
/**
* The number of validation procedures.
*/
OPJ_UINT32 m_nb_procedures;
/**
* The number of the array of validation procedures.
*/
OPJ_UINT32 m_nb_max_procedures;
/**
* The array of procedures.
*/
opj_procedure * m_procedures;
} opj_procedure_list_t;
@ -76,7 +75,7 @@ typedef struct opj_procedure_list
/**
* Creates a validation list.
*
* @return the newly created validation list.
* @return the newly created validation list.
*/
opj_procedure_list_t * opj_procedure_list_create(void);
@ -90,41 +89,44 @@ void opj_procedure_list_destroy(opj_procedure_list_t * p_list);
/**
* Adds a new validation procedure.
*
* @param p_validation_list the list of procedure to modify.
* @param p_procedure the procedure to add.
* @param p_validation_list the list of procedure to modify.
* @param p_procedure the procedure to add.
*
* @return OPJ_TRUE if the procedure could be added.
* @return OPJ_TRUE if the procedure could be added.
*/
OPJ_BOOL opj_procedure_list_add_procedure (opj_procedure_list_t * p_validation_list, opj_procedure p_procedure, opj_event_mgr_t* p_manager);
OPJ_BOOL opj_procedure_list_add_procedure(opj_procedure_list_t *
p_validation_list, opj_procedure p_procedure, opj_event_mgr_t* p_manager);
/**
* Gets the number of validation procedures.
*
* @param p_validation_list the list of procedure to modify.
* @param p_validation_list the list of procedure to modify.
*
* @return the number of validation procedures.
*/
OPJ_UINT32 opj_procedure_list_get_nb_procedures (opj_procedure_list_t * p_validation_list);
OPJ_UINT32 opj_procedure_list_get_nb_procedures(opj_procedure_list_t *
p_validation_list);
/**
* Gets the pointer on the first validation procedure. This function is similar to the C++
* iterator class to iterate through all the procedures inside the validation list.
* the caller does not take ownership of the pointer.
*
* @param p_validation_list the list of procedure to get the first procedure from.
* @param p_validation_list the list of procedure to get the first procedure from.
*
* @return a pointer to the first procedure.
* @return a pointer to the first procedure.
*/
opj_procedure* opj_procedure_list_get_first_procedure (opj_procedure_list_t * p_validation_list);
opj_procedure* opj_procedure_list_get_first_procedure(opj_procedure_list_t *
p_validation_list);
/**
* Clears the list of validation procedures.
*
* @param p_validation_list the list of procedure to clear.
* @param p_validation_list the list of procedure to clear.
*
*/
void opj_procedure_list_clear (opj_procedure_list_t * p_validation_list);
void opj_procedure_list_clear(opj_procedure_list_t * p_validation_list);
/*@}*/
#endif /* __FUNCTION_LIST_H */

View File

@ -1,6 +1,6 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
@ -55,12 +55,14 @@ opj_image_t* opj_image_create0(void);
/**
* Updates the components characteristics of the image from the coding parameters.
*
* @param p_image_header the image header to update.
* @param p_cp the coding parameters from which to update the image.
* @param p_image_header the image header to update.
* @param p_cp the coding parameters from which to update the image.
*/
void opj_image_comp_header_update(opj_image_t * p_image, const struct opj_cp* p_cp);
void opj_image_comp_header_update(opj_image_t * p_image,
const struct opj_cp* p_cp);
void opj_copy_image_header(const opj_image_t* p_image_src, opj_image_t* p_image_dest);
void opj_copy_image_header(const opj_image_t* p_image_src,
opj_image_t* p_image_dest);
/*@}*/

View File

@ -56,7 +56,7 @@
#define JPIP_PHLD 0x70686c64 /* Place holder */
/*
/*
* Write tile-part Index table box (superbox)
*
* @param[in] coff offset of j2k codestream
@ -65,11 +65,12 @@
* @param[in] cio file output handle
* @return length of tpix box
*/
int opj_write_tpix( int coff, opj_codestream_info_t cstr_info, int j2klen, opj_stream_private_t *cio,
opj_event_mgr_t * p_manager );
int opj_write_tpix(int coff, opj_codestream_info_t cstr_info, int j2klen,
opj_stream_private_t *cio,
opj_event_mgr_t * p_manager);
/*
/*
* Write tile header index table box (superbox)
*
* @param[in] coff offset of j2k codestream
@ -77,10 +78,11 @@ int opj_write_tpix( int coff, opj_codestream_info_t cstr_info, int j2klen, opj_s
* @param[in] cio file output handle
* @return length of thix box
*/
int opj_write_thix( int coff, opj_codestream_info_t cstr_info, opj_stream_private_t *cio, opj_event_mgr_t * p_manager );
int opj_write_thix(int coff, opj_codestream_info_t cstr_info,
opj_stream_private_t *cio, opj_event_mgr_t * p_manager);
/*
/*
* Write precinct packet index table box (superbox)
*
* @param[in] coff offset of j2k codestream
@ -90,11 +92,12 @@ int opj_write_thix( int coff, opj_codestream_info_t cstr_info, opj_stream_privat
* @param[in] cio file output handle
* @return length of ppix box
*/
int opj_write_ppix( int coff, opj_codestream_info_t cstr_info, OPJ_BOOL EPHused, int j2klen, opj_stream_private_t *cio,
opj_event_mgr_t * p_manager );
int opj_write_ppix(int coff, opj_codestream_info_t cstr_info, OPJ_BOOL EPHused,
int j2klen, opj_stream_private_t *cio,
opj_event_mgr_t * p_manager);
/*
/*
* Write packet header index table box (superbox)
*
* @param[in] coff offset of j2k codestream
@ -104,10 +107,11 @@ int opj_write_ppix( int coff, opj_codestream_info_t cstr_info, OPJ_BOOL EPHused,
* @param[in] cio file output handle
* @return length of ppix box
*/
int opj_write_phix( int coff, opj_codestream_info_t cstr_info, OPJ_BOOL EPHused, int j2klen, opj_stream_private_t *cio,
opj_event_mgr_t * p_manager );
int opj_write_phix(int coff, opj_codestream_info_t cstr_info, OPJ_BOOL EPHused,
int j2klen, opj_stream_private_t *cio,
opj_event_mgr_t * p_manager);
/*
/*
* Write manifest box (box)
*
* @param[in] second number to be visited
@ -116,13 +120,13 @@ int opj_write_phix( int coff, opj_codestream_info_t cstr_info, OPJ_BOOL EPHused,
* @param[in] cio file output handle
*/
void opj_write_manf(int second,
int v,
opj_jp2_box_t *box,
void opj_write_manf(int second,
int v,
opj_jp2_box_t *box,
opj_stream_private_t *cio,
opj_event_mgr_t * p_manager );
opj_event_mgr_t * p_manager);
/*
/*
* Write main header index table (box)
*
* @param[in] coff offset of j2k codestream
@ -130,19 +134,24 @@ void opj_write_manf(int second,
* @param[in] cio file output handle
* @return length of mainmhix box
*/
int opj_write_mainmhix( int coff, opj_codestream_info_t cstr_info, opj_stream_private_t *cio,
opj_event_mgr_t * p_manager );
int opj_write_mainmhix(int coff, opj_codestream_info_t cstr_info,
opj_stream_private_t *cio,
opj_event_mgr_t * p_manager);
int opj_write_phixfaix( int coff, int compno, opj_codestream_info_t cstr_info, OPJ_BOOL EPHused, int j2klen, opj_stream_private_t *cio,
opj_event_mgr_t * p_manager );
int opj_write_phixfaix(int coff, int compno, opj_codestream_info_t cstr_info,
OPJ_BOOL EPHused, int j2klen, opj_stream_private_t *cio,
opj_event_mgr_t * p_manager);
int opj_write_ppixfaix( int coff, int compno, opj_codestream_info_t cstr_info, OPJ_BOOL EPHused, int j2klen, opj_stream_private_t *cio,
opj_event_mgr_t * p_manager );
int opj_write_ppixfaix(int coff, int compno, opj_codestream_info_t cstr_info,
OPJ_BOOL EPHused, int j2klen, opj_stream_private_t *cio,
opj_event_mgr_t * p_manager);
int opj_write_tilemhix( int coff, opj_codestream_info_t cstr_info, int tileno, opj_stream_private_t *cio,
opj_event_mgr_t * p_manager );
int opj_write_tilemhix(int coff, opj_codestream_info_t cstr_info, int tileno,
opj_stream_private_t *cio,
opj_event_mgr_t * p_manager);
int opj_write_tpixfaix( int coff, int compno, opj_codestream_info_t cstr_info, int j2klen, opj_stream_private_t *cio,
opj_event_mgr_t * p_manager );
int opj_write_tpixfaix(int coff, int compno, opj_codestream_info_t cstr_info,
int j2klen, opj_stream_private_t *cio,
opj_event_mgr_t * p_manager);
#endif /* !INDEXBOX_MANAGER_H_ */

View File

@ -1,6 +1,6 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
@ -48,17 +48,17 @@ The function in INVERT.H compute a matrix inversion with a LUP method
* Calculates a n x n double matrix inversion with a LUP method. Data is aligned, rows after rows (or columns after columns).
* The function does not take ownership of any memory block, data must be fred by the user.
*
* @param pSrcMatrix the matrix to invert.
* @param pDestMatrix data to store the inverted matrix.
* @param pSrcMatrix the matrix to invert.
* @param pDestMatrix data to store the inverted matrix.
* @param n size of the matrix
* @return OPJ_TRUE if the inversion is successful, OPJ_FALSE if the matrix is singular.
*/
OPJ_BOOL opj_matrix_inversion_f(OPJ_FLOAT32 * pSrcMatrix,
OPJ_FLOAT32 * pDestMatrix,
OPJ_FLOAT32 * pDestMatrix,
OPJ_UINT32 nb_compo);
/* ----------------------------------------------------------------------- */
/*@}*/
/*@}*/
#endif /* __INVERT_H */
#endif /* __INVERT_H */

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
@ -8,7 +8,7 @@
* Copyright (c) 2002-2014, Professor Benoit Macq
* Copyright (c) 2002-2003, Yannick Verschueren
* Copyright (c) 2005, Herve Drolon, FreeImage Team
* Copyright (c) 2008, 2011-2012, Centre National d'Etudes Spatiales (CNES), FR
* Copyright (c) 2008, 2011-2012, Centre National d'Etudes Spatiales (CNES), FR
* Copyright (c) 2012, CS Systemes d'Information, France
* All rights reserved.
*
@ -70,56 +70,50 @@
/* ----------------------------------------------------------------------- */
typedef enum
{
JP2_STATE_NONE = 0x0,
JP2_STATE_SIGNATURE = 0x1,
JP2_STATE_FILE_TYPE = 0x2,
JP2_STATE_HEADER = 0x4,
JP2_STATE_CODESTREAM = 0x8,
JP2_STATE_END_CODESTREAM = 0x10,
JP2_STATE_UNKNOWN = 0x7fffffff /* ISO C restricts enumerator values to range of 'int' */
typedef enum {
JP2_STATE_NONE = 0x0,
JP2_STATE_SIGNATURE = 0x1,
JP2_STATE_FILE_TYPE = 0x2,
JP2_STATE_HEADER = 0x4,
JP2_STATE_CODESTREAM = 0x8,
JP2_STATE_END_CODESTREAM = 0x10,
JP2_STATE_UNKNOWN = 0x7fffffff /* ISO C restricts enumerator values to range of 'int' */
}
JP2_STATE;
typedef enum
{
JP2_IMG_STATE_NONE = 0x0,
JP2_IMG_STATE_UNKNOWN = 0x7fffffff
typedef enum {
JP2_IMG_STATE_NONE = 0x0,
JP2_IMG_STATE_UNKNOWN = 0x7fffffff
}
JP2_IMG_STATE;
/**
/**
Channel description: channel index, type, association
*/
typedef struct opj_jp2_cdef_info
{
typedef struct opj_jp2_cdef_info {
OPJ_UINT16 cn, typ, asoc;
} opj_jp2_cdef_info_t;
/**
/**
Channel descriptions and number of descriptions
*/
typedef struct opj_jp2_cdef
{
typedef struct opj_jp2_cdef {
opj_jp2_cdef_info_t *info;
OPJ_UINT16 n;
} opj_jp2_cdef_t;
/**
/**
Component mappings: channel index, mapping type, palette index
*/
typedef struct opj_jp2_cmap_comp
{
typedef struct opj_jp2_cmap_comp {
OPJ_UINT16 cmp;
OPJ_BYTE mtyp, pcol;
} opj_jp2_cmap_comp_t;
/**
/**
Palette data: table entries, palette columns
*/
typedef struct opj_jp2_pclr
{
typedef struct opj_jp2_pclr {
OPJ_UINT32 *entries;
OPJ_BYTE *channel_sign;
OPJ_BYTE *channel_size;
@ -128,11 +122,10 @@ typedef struct opj_jp2_pclr
OPJ_BYTE nr_channels;
} opj_jp2_pclr_t;
/**
Collector for ICC profile, palette, component mapping, channel description
/**
Collector for ICC profile, palette, component mapping, channel description
*/
typedef struct opj_jp2_color
{
typedef struct opj_jp2_color {
OPJ_BYTE *icc_profile_buf;
OPJ_UINT32 icc_profile_len;
@ -141,59 +134,58 @@ typedef struct opj_jp2_color
OPJ_BYTE jp2_has_colr;
} opj_jp2_color_t;
/**
/**
JP2 component
*/
typedef struct opj_jp2_comps {
OPJ_UINT32 depth;
OPJ_UINT32 sgnd;
OPJ_UINT32 bpcc;
OPJ_UINT32 depth;
OPJ_UINT32 sgnd;
OPJ_UINT32 bpcc;
} opj_jp2_comps_t;
/**
JPEG-2000 file format reader/writer
*/
typedef struct opj_jp2
{
/** handle to the J2K codec */
opj_j2k_t *j2k;
/** list of validation procedures */
struct opj_procedure_list * m_validation_list;
/** list of execution procedures */
struct opj_procedure_list * m_procedure_list;
typedef struct opj_jp2 {
/** handle to the J2K codec */
opj_j2k_t *j2k;
/** list of validation procedures */
struct opj_procedure_list * m_validation_list;
/** list of execution procedures */
struct opj_procedure_list * m_procedure_list;
/* width of image */
OPJ_UINT32 w;
/* height of image */
OPJ_UINT32 h;
/* number of components in the image */
OPJ_UINT32 numcomps;
OPJ_UINT32 bpc;
OPJ_UINT32 C;
OPJ_UINT32 UnkC;
OPJ_UINT32 IPR;
OPJ_UINT32 meth;
OPJ_UINT32 approx;
OPJ_UINT32 enumcs;
OPJ_UINT32 precedence;
OPJ_UINT32 brand;
OPJ_UINT32 minversion;
OPJ_UINT32 numcl;
OPJ_UINT32 *cl;
opj_jp2_comps_t *comps;
/* FIXME: The following two variables are used to save offset
as we write out a JP2 file to disk. This mecanism is not flexible
as codec writers will need to extand those fields as new part
of the standard are implemented.
*/
/* width of image */
OPJ_UINT32 w;
/* height of image */
OPJ_UINT32 h;
/* number of components in the image */
OPJ_UINT32 numcomps;
OPJ_UINT32 bpc;
OPJ_UINT32 C;
OPJ_UINT32 UnkC;
OPJ_UINT32 IPR;
OPJ_UINT32 meth;
OPJ_UINT32 approx;
OPJ_UINT32 enumcs;
OPJ_UINT32 precedence;
OPJ_UINT32 brand;
OPJ_UINT32 minversion;
OPJ_UINT32 numcl;
OPJ_UINT32 *cl;
opj_jp2_comps_t *comps;
/* FIXME: The following two variables are used to save offset
as we write out a JP2 file to disk. This mecanism is not flexible
as codec writers will need to extand those fields as new part
of the standard are implemented.
*/
OPJ_OFF_T j2k_codestream_offset;
OPJ_OFF_T jpip_iptr_offset;
OPJ_BOOL jpip_on;
OPJ_UINT32 jp2_state;
OPJ_UINT32 jp2_img_state;
OPJ_BOOL jpip_on;
OPJ_UINT32 jp2_state;
OPJ_UINT32 jp2_img_state;
opj_jp2_color_t color;
opj_jp2_color_t color;
OPJ_BOOL ignore_pclr_cmap_cdef;
}
opj_jp2_t;
@ -207,28 +199,26 @@ typedef struct opj_jp2_box {
OPJ_INT32 init_pos;
} opj_jp2_box_t;
typedef struct opj_jp2_header_handler
{
/* marker value */
OPJ_UINT32 id;
/* action linked to the marker */
OPJ_BOOL (*handler) ( opj_jp2_t *jp2,
OPJ_BYTE *p_header_data,
OPJ_UINT32 p_header_size,
opj_event_mgr_t * p_manager);
typedef struct opj_jp2_header_handler {
/* marker value */
OPJ_UINT32 id;
/* action linked to the marker */
OPJ_BOOL(*handler)(opj_jp2_t *jp2,
OPJ_BYTE *p_header_data,
OPJ_UINT32 p_header_size,
opj_event_mgr_t * p_manager);
}
opj_jp2_header_handler_t;
typedef struct opj_jp2_img_header_writer_handler
{
/* action to perform */
OPJ_BYTE* (*handler) (opj_jp2_t *jp2, OPJ_UINT32 * p_data_size);
/* result of the action : data */
OPJ_BYTE* m_data;
/* size of data */
OPJ_UINT32 m_size;
}
typedef struct opj_jp2_img_header_writer_handler {
/* action to perform */
OPJ_BYTE* (*handler)(opj_jp2_t *jp2, OPJ_UINT32 * p_data_size);
/* result of the action : data */
OPJ_BYTE* m_data;
/* size of data */
OPJ_UINT32 m_size;
}
opj_jp2_img_header_writer_handler_t;
/** @name Exported functions */
@ -256,12 +246,12 @@ OPJ_BOOL opj_jp2_set_threads(opj_jp2_t *jp2, OPJ_UINT32 num_threads);
*/
OPJ_BOOL opj_jp2_decode(opj_jp2_t *jp2,
opj_stream_private_t *p_stream,
opj_image_t* p_image,
opj_event_mgr_t * p_manager);
opj_image_t* p_image,
opj_event_mgr_t * p_manager);
/**
* Setup the encoder parameters using the current image and using user parameters.
* Coding parameters are returned in jp2->j2k->cp.
* Setup the encoder parameters using the current image and using user parameters.
* Coding parameters are returned in jp2->j2k->cp.
*
* @param jp2 JP2 compressor handle
* @param parameters compression parameters
@ -269,10 +259,10 @@ OPJ_BOOL opj_jp2_decode(opj_jp2_t *jp2,
* @param p_manager FIXME DOC
* @return OPJ_TRUE if successful, OPJ_FALSE otherwise
*/
OPJ_BOOL opj_jp2_setup_encoder( opj_jp2_t *jp2,
opj_cparameters_t *parameters,
opj_image_t *image,
opj_event_mgr_t * p_manager);
OPJ_BOOL opj_jp2_setup_encoder(opj_jp2_t *jp2,
opj_cparameters_t *parameters,
opj_image_t *image,
opj_event_mgr_t * p_manager);
/**
Encode an image into a JPEG-2000 file stream
@ -281,9 +271,9 @@ Encode an image into a JPEG-2000 file stream
@param p_manager event manager
@return Returns true if successful, returns false otherwise
*/
OPJ_BOOL opj_jp2_encode( opj_jp2_t *jp2,
opj_stream_private_t *stream,
opj_event_mgr_t * p_manager);
OPJ_BOOL opj_jp2_encode(opj_jp2_t *jp2,
opj_stream_private_t *stream,
opj_event_mgr_t * p_manager);
/**
@ -306,9 +296,9 @@ OPJ_BOOL opj_jp2_start_compress(opj_jp2_t *jp2,
* Ends the compression procedures and possibiliy add data to be read after the
* codestream.
*/
OPJ_BOOL opj_jp2_end_compress( opj_jp2_t *jp2,
opj_stream_private_t *cio,
opj_event_mgr_t * p_manager);
OPJ_BOOL opj_jp2_end_compress(opj_jp2_t *jp2,
opj_stream_private_t *cio,
opj_event_mgr_t * p_manager);
/* ----------------------------------------------------------------------- */
@ -316,7 +306,7 @@ OPJ_BOOL opj_jp2_end_compress( opj_jp2_t *jp2,
* Ends the decompression procedures and possibiliy add data to be read after the
* codestream.
*/
OPJ_BOOL opj_jp2_end_decompress(opj_jp2_t *jp2,
OPJ_BOOL opj_jp2_end_decompress(opj_jp2_t *jp2,
opj_stream_private_t *cio,
opj_event_mgr_t * p_manager);
@ -330,10 +320,10 @@ OPJ_BOOL opj_jp2_end_decompress(opj_jp2_t *jp2,
*
* @return true if the box is valid.
*/
OPJ_BOOL opj_jp2_read_header( opj_stream_private_t *p_stream,
opj_jp2_t *jp2,
opj_image_t ** p_image,
opj_event_mgr_t * p_manager );
OPJ_BOOL opj_jp2_read_header(opj_stream_private_t *p_stream,
opj_jp2_t *jp2,
opj_image_t ** p_image,
opj_event_mgr_t * p_manager);
/**
* Reads a tile header.
@ -349,17 +339,17 @@ OPJ_BOOL opj_jp2_read_header( opj_stream_private_t *p_stream,
* @param p_stream the stream to write data to.
* @param p_manager the user event manager.
*/
OPJ_BOOL opj_jp2_read_tile_header ( opj_jp2_t * p_jp2,
OPJ_UINT32 * p_tile_index,
OPJ_UINT32 * p_data_size,
OPJ_INT32 * p_tile_x0,
OPJ_INT32 * p_tile_y0,
OPJ_INT32 * p_tile_x1,
OPJ_INT32 * p_tile_y1,
OPJ_UINT32 * p_nb_comps,
OPJ_BOOL * p_go_on,
opj_stream_private_t *p_stream,
opj_event_mgr_t * p_manager );
OPJ_BOOL opj_jp2_read_tile_header(opj_jp2_t * p_jp2,
OPJ_UINT32 * p_tile_index,
OPJ_UINT32 * p_data_size,
OPJ_INT32 * p_tile_x0,
OPJ_INT32 * p_tile_y0,
OPJ_INT32 * p_tile_x1,
OPJ_INT32 * p_tile_y1,
OPJ_UINT32 * p_nb_comps,
OPJ_BOOL * p_go_on,
opj_stream_private_t *p_stream,
opj_event_mgr_t * p_manager);
/**
* Writes a tile.
@ -371,12 +361,12 @@ OPJ_BOOL opj_jp2_read_tile_header ( opj_jp2_t * p_jp2,
* @param p_stream the stream to write data to.
* @param p_manager the user event manager.
*/
OPJ_BOOL opj_jp2_write_tile ( opj_jp2_t *p_jp2,
OPJ_UINT32 p_tile_index,
OPJ_BYTE * p_data,
OPJ_UINT32 p_data_size,
opj_stream_private_t *p_stream,
opj_event_mgr_t * p_manager );
OPJ_BOOL opj_jp2_write_tile(opj_jp2_t *p_jp2,
OPJ_UINT32 p_tile_index,
OPJ_BYTE * p_data,
OPJ_UINT32 p_data_size,
opj_stream_private_t *p_stream,
opj_event_mgr_t * p_manager);
/**
* Decode tile data.
@ -389,19 +379,19 @@ OPJ_BOOL opj_jp2_write_tile ( opj_jp2_t *p_jp2,
*
* @return FIXME DOC
*/
OPJ_BOOL opj_jp2_decode_tile ( opj_jp2_t * p_jp2,
OPJ_UINT32 p_tile_index,
OPJ_BYTE * p_data,
OPJ_UINT32 p_data_size,
opj_stream_private_t *p_stream,
opj_event_mgr_t * p_manager );
OPJ_BOOL opj_jp2_decode_tile(opj_jp2_t * p_jp2,
OPJ_UINT32 p_tile_index,
OPJ_BYTE * p_data,
OPJ_UINT32 p_data_size,
opj_stream_private_t *p_stream,
opj_event_mgr_t * p_manager);
/**
* Creates a jpeg2000 file decompressor.
*
* @return an empty jpeg2000 file codec.
*/
opj_jp2_t* opj_jp2_create (OPJ_BOOL p_is_decoder);
opj_jp2_t* opj_jp2_create(OPJ_BOOL p_is_decoder);
/**
Destroy a JP2 decompressor handle
@ -423,28 +413,28 @@ void opj_jp2_destroy(opj_jp2_t *jp2);
*
* @return true if the area could be set.
*/
OPJ_BOOL opj_jp2_set_decode_area( opj_jp2_t *p_jp2,
opj_image_t* p_image,
OPJ_INT32 p_start_x, OPJ_INT32 p_start_y,
OPJ_INT32 p_end_x, OPJ_INT32 p_end_y,
opj_event_mgr_t * p_manager );
OPJ_BOOL opj_jp2_set_decode_area(opj_jp2_t *p_jp2,
opj_image_t* p_image,
OPJ_INT32 p_start_x, OPJ_INT32 p_start_y,
OPJ_INT32 p_end_x, OPJ_INT32 p_end_y,
opj_event_mgr_t * p_manager);
/**
*
*/
OPJ_BOOL opj_jp2_get_tile( opj_jp2_t *p_jp2,
opj_stream_private_t *p_stream,
opj_image_t* p_image,
opj_event_mgr_t * p_manager,
OPJ_UINT32 tile_index );
/**
*
*/
OPJ_BOOL opj_jp2_get_tile(opj_jp2_t *p_jp2,
opj_stream_private_t *p_stream,
opj_image_t* p_image,
opj_event_mgr_t * p_manager,
OPJ_UINT32 tile_index);
/**
*
*
*/
OPJ_BOOL opj_jp2_set_decoded_resolution_factor(opj_jp2_t *p_jp2,
OPJ_UINT32 res_factor,
opj_event_mgr_t * p_manager);
OPJ_BOOL opj_jp2_set_decoded_resolution_factor(opj_jp2_t *p_jp2,
OPJ_UINT32 res_factor,
opj_event_mgr_t * p_manager);
/* TODO MSD: clean these 3 functions */
@ -456,7 +446,7 @@ OPJ_BOOL opj_jp2_set_decoded_resolution_factor(opj_jp2_t *p_jp2,
*@param out_stream output stream where dump the elements.
*
*/
void jp2_dump (opj_jp2_t* p_jp2, OPJ_INT32 flag, FILE* out_stream);
void jp2_dump(opj_jp2_t* p_jp2, OPJ_INT32 flag, FILE* out_stream);
/**
* Get the codestream info from a JPEG2000 codec.

View File

@ -1,6 +1,6 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
@ -8,10 +8,10 @@
* Copyright (c) 2002-2014, Professor Benoit Macq
* Copyright (c) 2001-2003, David Janssens
* Copyright (c) 2002-2003, Yannick Verschueren
* Copyright (c) 2003-2007, Francois-Olivier Devaux
* Copyright (c) 2003-2007, Francois-Olivier Devaux
* Copyright (c) 2003-2014, Antonin Descampe
* Copyright (c) 2005, Herve Drolon, FreeImage Team
* Copyright (c) 2008, 2011-2012, Centre National d'Etudes Spatiales (CNES), FR
* Copyright (c) 2008, 2011-2012, Centre National d'Etudes Spatiales (CNES), FR
* Copyright (c) 2012, CS Systemes d'Information, France
* All rights reserved.
*
@ -60,7 +60,8 @@ Apply a reversible multi-component transform to an image
@param c2 Samples blue component
@param n Number of samples for each component
*/
void opj_mct_encode(OPJ_INT32* OPJ_RESTRICT c0, OPJ_INT32* OPJ_RESTRICT c1, OPJ_INT32* OPJ_RESTRICT c2, OPJ_UINT32 n);
void opj_mct_encode(OPJ_INT32* OPJ_RESTRICT c0, OPJ_INT32* OPJ_RESTRICT c1,
OPJ_INT32* OPJ_RESTRICT c2, OPJ_UINT32 n);
/**
Apply a reversible multi-component inverse transform to an image
@param c0 Samples for luminance component
@ -68,11 +69,12 @@ Apply a reversible multi-component inverse transform to an image
@param c2 Samples for blue chrominance component
@param n Number of samples for each component
*/
void opj_mct_decode(OPJ_INT32* OPJ_RESTRICT c0, OPJ_INT32* OPJ_RESTRICT c1, OPJ_INT32* OPJ_RESTRICT c2, OPJ_UINT32 n);
void opj_mct_decode(OPJ_INT32* OPJ_RESTRICT c0, OPJ_INT32* OPJ_RESTRICT c1,
OPJ_INT32* OPJ_RESTRICT c2, OPJ_UINT32 n);
/**
Get norm of the basis function used for the reversible multi-component transform
@param compno Number of the component (0->Y, 1->U, 2->V)
@return
@return
*/
OPJ_FLOAT64 opj_mct_getnorm(OPJ_UINT32 compno);
@ -83,7 +85,8 @@ Apply an irreversible multi-component transform to an image
@param c2 Samples blue component
@param n Number of samples for each component
*/
void opj_mct_encode_real(OPJ_INT32* OPJ_RESTRICT c0, OPJ_INT32* OPJ_RESTRICT c1, OPJ_INT32* OPJ_RESTRICT c2, OPJ_UINT32 n);
void opj_mct_encode_real(OPJ_INT32* OPJ_RESTRICT c0, OPJ_INT32* OPJ_RESTRICT c1,
OPJ_INT32* OPJ_RESTRICT c2, OPJ_UINT32 n);
/**
Apply an irreversible multi-component inverse transform to an image
@param c0 Samples for luminance component
@ -91,11 +94,12 @@ Apply an irreversible multi-component inverse transform to an image
@param c2 Samples for blue chrominance component
@param n Number of samples for each component
*/
void opj_mct_decode_real(OPJ_FLOAT32* OPJ_RESTRICT c0, OPJ_FLOAT32* OPJ_RESTRICT c1, OPJ_FLOAT32* OPJ_RESTRICT c2, OPJ_UINT32 n);
void opj_mct_decode_real(OPJ_FLOAT32* OPJ_RESTRICT c0,
OPJ_FLOAT32* OPJ_RESTRICT c1, OPJ_FLOAT32* OPJ_RESTRICT c2, OPJ_UINT32 n);
/**
Get norm of the basis function used for the irreversible multi-component transform
@param compno Number of the component (0->Y, 1->U, 2->V)
@return
@return
*/
OPJ_FLOAT64 opj_mct_getnorm_real(OPJ_UINT32 compno);
@ -109,11 +113,11 @@ FIXME DOC
@return OPJ_FALSE if function encounter a problem, OPJ_TRUE otherwise
*/
OPJ_BOOL opj_mct_encode_custom(
OPJ_BYTE * p_coding_data,
OPJ_UINT32 n,
OPJ_BYTE ** p_data,
OPJ_UINT32 p_nb_comp,
OPJ_UINT32 is_signed);
OPJ_BYTE * p_coding_data,
OPJ_UINT32 n,
OPJ_BYTE ** p_data,
OPJ_UINT32 p_nb_comp,
OPJ_UINT32 is_signed);
/**
FIXME DOC
@param pDecodingData MCT data
@ -124,29 +128,29 @@ FIXME DOC
@return OPJ_FALSE if function encounter a problem, OPJ_TRUE otherwise
*/
OPJ_BOOL opj_mct_decode_custom(
OPJ_BYTE * pDecodingData,
OPJ_UINT32 n,
OPJ_BYTE ** pData,
OPJ_UINT32 pNbComp,
OPJ_UINT32 isSigned);
OPJ_BYTE * pDecodingData,
OPJ_UINT32 n,
OPJ_BYTE ** pData,
OPJ_UINT32 pNbComp,
OPJ_UINT32 isSigned);
/**
FIXME DOC
@param pNorms MCT data
@param p_nb_comps size of components
@param pMatrix components
@return
@return
*/
void opj_calculate_norms( OPJ_FLOAT64 * pNorms,
OPJ_UINT32 p_nb_comps,
OPJ_FLOAT32 * pMatrix);
void opj_calculate_norms(OPJ_FLOAT64 * pNorms,
OPJ_UINT32 p_nb_comps,
OPJ_FLOAT32 * pMatrix);
/**
FIXME DOC
FIXME DOC
*/
const OPJ_FLOAT64 * opj_mct_get_mct_norms (void);
const OPJ_FLOAT64 * opj_mct_get_mct_norms(void);
/**
FIXME DOC
FIXME DOC
*/
const OPJ_FLOAT64 * opj_mct_get_mct_norms_real (void);
const OPJ_FLOAT64 * opj_mct_get_mct_norms_real(void);
/* ----------------------------------------------------------------------- */
/*@}*/

View File

@ -1,6 +1,6 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
@ -8,7 +8,7 @@
* Copyright (c) 2002-2014, Professor Benoit Macq
* Copyright (c) 2001-2003, David Janssens
* Copyright (c) 2002-2003, Yannick Verschueren
* Copyright (c) 2003-2007, Francois-Olivier Devaux
* Copyright (c) 2003-2007, Francois-Olivier Devaux
* Copyright (c) 2003-2014, Antonin Descampe
* Copyright (c) 2005, Herve Drolon, FreeImage Team
* Copyright (c) 2008, Jerome Fimes, Communications & Systemes <jerome.fimes@c-s.fr>
@ -53,14 +53,14 @@ in MQC.C are used by some function in T1.C.
This struct defines the state of a context.
*/
typedef struct opj_mqc_state {
/** the probability of the Least Probable Symbol (0.75->0x8000, 1.5->0xffff) */
OPJ_UINT32 qeval;
/** the Most Probable Symbol (0 or 1) */
OPJ_UINT32 mps;
/** next state if the next encoded symbol is the MPS */
struct opj_mqc_state *nmps;
/** next state if the next encoded symbol is the LPS */
struct opj_mqc_state *nlps;
/** the probability of the Least Probable Symbol (0.75->0x8000, 1.5->0xffff) */
OPJ_UINT32 qeval;
/** the Most Probable Symbol (0 or 1) */
OPJ_UINT32 mps;
/** next state if the next encoded symbol is the MPS */
struct opj_mqc_state *nmps;
/** next state if the next encoded symbol is the LPS */
struct opj_mqc_state *nlps;
} opj_mqc_state_t;
#define MQC_NUMCTXS 19
@ -69,17 +69,17 @@ typedef struct opj_mqc_state {
MQ coder
*/
typedef struct opj_mqc {
OPJ_UINT32 c;
OPJ_UINT32 a;
OPJ_UINT32 ct;
OPJ_BYTE *bp;
OPJ_BYTE *start;
OPJ_BYTE *end;
opj_mqc_state_t *ctxs[MQC_NUMCTXS];
opj_mqc_state_t **curctx;
const OPJ_BYTE *lut_ctxno_zc_orient; /* lut_ctxno_zc shifted by 256 * bandno */
OPJ_UINT32 c;
OPJ_UINT32 a;
OPJ_UINT32 ct;
OPJ_BYTE *bp;
OPJ_BYTE *start;
OPJ_BYTE *end;
opj_mqc_state_t *ctxs[MQC_NUMCTXS];
opj_mqc_state_t **curctx;
const OPJ_BYTE *lut_ctxno_zc_orient; /* lut_ctxno_zc shifted by 256 * bandno */
#ifdef MQC_PERF_OPT
unsigned char *buffer;
unsigned char *buffer;
#endif
} opj_mqc_t;
@ -89,7 +89,7 @@ typedef struct opj_mqc {
/*@{*/
/* ----------------------------------------------------------------------- */
/**
Create a new MQC handle
Create a new MQC handle
@return Returns a new MQC handle if successful, returns NULL otherwise
*/
opj_mqc_t* opj_mqc_create(void);
@ -105,7 +105,7 @@ Return the number of bytes written/read since initialisation
*/
OPJ_UINT32 opj_mqc_numbytes(opj_mqc_t *mqc);
/**
Reset the states of all the context of the coder/decoder
Reset the states of all the context of the coder/decoder
(each context is set to a state where 0 and 1 are more or less equiprobable)
@param mqc MQC handle
*/
@ -117,7 +117,8 @@ Set the state of a particular context
@param msb The MSB of the new state of the context
@param prob Number that identifies the probability of the symbols for the new state of the context
*/
void opj_mqc_setstate(opj_mqc_t *mqc, OPJ_UINT32 ctxno, OPJ_UINT32 msb, OPJ_INT32 prob);
void opj_mqc_setstate(opj_mqc_t *mqc, OPJ_UINT32 ctxno, OPJ_UINT32 msb,
OPJ_INT32 prob);
/**
Initialize the encoder
@param mqc MQC handle
@ -129,7 +130,7 @@ Set the current context used for coding/decoding
@param mqc MQC handle
@param ctxno Number that identifies the context
*/
#define opj_mqc_setcurctx(mqc, ctxno) (mqc)->curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
#define opj_mqc_setcurctx(mqc, ctxno) (mqc)->curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
/**
Encode a symbol using the MQ-coder
@param mqc MQC handle
@ -142,15 +143,15 @@ Flush the encoder, so that all remaining data is written
*/
void opj_mqc_flush(opj_mqc_t *mqc);
/**
BYPASS mode switch, initialization operation.
JPEG 2000 p 505.
BYPASS mode switch, initialization operation.
JPEG 2000 p 505.
<h2>Not fully implemented and tested !!</h2>
@param mqc MQC handle
*/
void opj_mqc_bypass_init_enc(opj_mqc_t *mqc);
/**
BYPASS mode switch, coding operation.
JPEG 2000 p 505.
BYPASS mode switch, coding operation.
JPEG 2000 p 505.
<h2>Not fully implemented and tested !!</h2>
@param mqc MQC handle
@param d The symbol to be encoded (0 or 1)

View File

@ -1,6 +1,6 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
@ -8,7 +8,7 @@
* Copyright (c) 2002-2014, Professor Benoit Macq
* Copyright (c) 2001-2003, David Janssens
* Copyright (c) 2002-2003, Yannick Verschueren
* Copyright (c) 2003-2007, Francois-Olivier Devaux
* Copyright (c) 2003-2007, Francois-Olivier Devaux
* Copyright (c) 2003-2014, Antonin Descampe
* Copyright (c) 2005, Herve Drolon, FreeImage Team
* Copyright (c) 2008, Jerome Fimes, Communications & Systemes <jerome.fimes@c-s.fr>
@ -43,17 +43,18 @@ FIXME DOC
@param mqc MQC handle
@return
*/
static INLINE OPJ_INT32 opj_mqc_mpsexchange(opj_mqc_t *const mqc) {
OPJ_INT32 d;
if (mqc->a < (*mqc->curctx)->qeval) {
d = (OPJ_INT32)(1 - (*mqc->curctx)->mps);
*mqc->curctx = (*mqc->curctx)->nlps;
} else {
d = (OPJ_INT32)(*mqc->curctx)->mps;
*mqc->curctx = (*mqc->curctx)->nmps;
}
static INLINE OPJ_INT32 opj_mqc_mpsexchange(opj_mqc_t *const mqc)
{
OPJ_INT32 d;
if (mqc->a < (*mqc->curctx)->qeval) {
d = (OPJ_INT32)(1 - (*mqc->curctx)->mps);
*mqc->curctx = (*mqc->curctx)->nlps;
} else {
d = (OPJ_INT32)(*mqc->curctx)->mps;
*mqc->curctx = (*mqc->curctx)->nmps;
}
return d;
return d;
}
/**
@ -61,19 +62,20 @@ FIXME DOC
@param mqc MQC handle
@return
*/
static INLINE OPJ_INT32 opj_mqc_lpsexchange(opj_mqc_t *const mqc) {
OPJ_INT32 d;
if (mqc->a < (*mqc->curctx)->qeval) {
mqc->a = (*mqc->curctx)->qeval;
d = (OPJ_INT32)(*mqc->curctx)->mps;
*mqc->curctx = (*mqc->curctx)->nmps;
} else {
mqc->a = (*mqc->curctx)->qeval;
d = (OPJ_INT32)(1 - (*mqc->curctx)->mps);
*mqc->curctx = (*mqc->curctx)->nlps;
}
static INLINE OPJ_INT32 opj_mqc_lpsexchange(opj_mqc_t *const mqc)
{
OPJ_INT32 d;
if (mqc->a < (*mqc->curctx)->qeval) {
mqc->a = (*mqc->curctx)->qeval;
d = (OPJ_INT32)(*mqc->curctx)->mps;
*mqc->curctx = (*mqc->curctx)->nmps;
} else {
mqc->a = (*mqc->curctx)->qeval;
d = (OPJ_INT32)(1 - (*mqc->curctx)->mps);
*mqc->curctx = (*mqc->curctx)->nlps;
}
return d;
return d;
}
/**
@ -81,39 +83,41 @@ Input a byte
@param mqc MQC handle
*/
#ifdef MQC_PERF_OPT
static INLINE void opj_mqc_bytein(opj_mqc_t *const mqc) {
unsigned int i = *((unsigned int *) mqc->bp);
mqc->c += i & 0xffff00;
mqc->ct = i & 0x0f;
mqc->bp += (i >> 2) & 0x04;
static INLINE void opj_mqc_bytein(opj_mqc_t *const mqc)
{
unsigned int i = *((unsigned int *) mqc->bp);
mqc->c += i & 0xffff00;
mqc->ct = i & 0x0f;
mqc->bp += (i >> 2) & 0x04;
}
#else
static INLINE void opj_mqc_bytein(opj_mqc_t *const mqc) {
if (mqc->bp != mqc->end) {
OPJ_UINT32 c;
if (mqc->bp + 1 != mqc->end) {
c = *(mqc->bp + 1);
} else {
c = 0xff;
}
if (*mqc->bp == 0xff) {
if (c > 0x8f) {
mqc->c += 0xff00;
mqc->ct = 8;
} else {
mqc->bp++;
mqc->c += c << 9;
mqc->ct = 7;
}
} else {
mqc->bp++;
mqc->c += c << 8;
mqc->ct = 8;
}
} else {
mqc->c += 0xff00;
mqc->ct = 8;
}
static INLINE void opj_mqc_bytein(opj_mqc_t *const mqc)
{
if (mqc->bp != mqc->end) {
OPJ_UINT32 c;
if (mqc->bp + 1 != mqc->end) {
c = *(mqc->bp + 1);
} else {
c = 0xff;
}
if (*mqc->bp == 0xff) {
if (c > 0x8f) {
mqc->c += 0xff00;
mqc->ct = 8;
} else {
mqc->bp++;
mqc->c += c << 9;
mqc->ct = 7;
}
} else {
mqc->bp++;
mqc->c += c << 8;
mqc->ct = 8;
}
} else {
mqc->c += 0xff00;
mqc->ct = 8;
}
}
#endif
@ -121,15 +125,16 @@ static INLINE void opj_mqc_bytein(opj_mqc_t *const mqc) {
Renormalize mqc->a and mqc->c while decoding
@param mqc MQC handle
*/
static INLINE void opj_mqc_renormd(opj_mqc_t *const mqc) {
do {
if (mqc->ct == 0) {
opj_mqc_bytein(mqc);
}
mqc->a <<= 1;
mqc->c <<= 1;
mqc->ct--;
} while (mqc->a < 0x8000);
static INLINE void opj_mqc_renormd(opj_mqc_t *const mqc)
{
do {
if (mqc->ct == 0) {
opj_mqc_bytein(mqc);
}
mqc->a <<= 1;
mqc->c <<= 1;
mqc->ct--;
} while (mqc->a < 0x8000);
}
/**
@ -137,23 +142,24 @@ Decode a symbol
@param mqc MQC handle
@return Returns the decoded symbol (0 or 1)
*/
static INLINE OPJ_INT32 opj_mqc_decode(opj_mqc_t *const mqc) {
OPJ_INT32 d;
mqc->a -= (*mqc->curctx)->qeval;
if ((mqc->c >> 16) < (*mqc->curctx)->qeval) {
d = opj_mqc_lpsexchange(mqc);
opj_mqc_renormd(mqc);
} else {
mqc->c -= (*mqc->curctx)->qeval << 16;
if ((mqc->a & 0x8000) == 0) {
d = opj_mqc_mpsexchange(mqc);
opj_mqc_renormd(mqc);
} else {
d = (OPJ_INT32)(*mqc->curctx)->mps;
}
}
static INLINE OPJ_INT32 opj_mqc_decode(opj_mqc_t *const mqc)
{
OPJ_INT32 d;
mqc->a -= (*mqc->curctx)->qeval;
if ((mqc->c >> 16) < (*mqc->curctx)->qeval) {
d = opj_mqc_lpsexchange(mqc);
opj_mqc_renormd(mqc);
} else {
mqc->c -= (*mqc->curctx)->qeval << 16;
if ((mqc->a & 0x8000) == 0) {
d = opj_mqc_mpsexchange(mqc);
opj_mqc_renormd(mqc);
} else {
d = (OPJ_INT32)(*mqc->curctx)->mps;
}
}
return d;
return d;
}
#endif /* __MQC_INL_H */

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*

View File

@ -1,6 +1,6 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
@ -39,114 +39,110 @@
/**
* Main codec handler used for compression or decompression.
*/
typedef struct opj_codec_private
{
typedef struct opj_codec_private {
/** FIXME DOC */
union
{
union {
/**
* Decompression handler.
*/
struct opj_decompression
{
struct opj_decompression {
/** Main header reading function handler */
OPJ_BOOL (*opj_read_header) ( struct opj_stream_private * cio,
void * p_codec,
opj_image_t **p_image,
struct opj_event_mgr * p_manager);
OPJ_BOOL(*opj_read_header)(struct opj_stream_private * cio,
void * p_codec,
opj_image_t **p_image,
struct opj_event_mgr * p_manager);
/** Decoding function */
OPJ_BOOL (*opj_decode) ( void * p_codec,
struct opj_stream_private * p_cio,
opj_image_t * p_image,
struct opj_event_mgr * p_manager);
OPJ_BOOL(*opj_decode)(void * p_codec,
struct opj_stream_private * p_cio,
opj_image_t * p_image,
struct opj_event_mgr * p_manager);
/** FIXME DOC */
OPJ_BOOL (*opj_read_tile_header)( void * p_codec,
OPJ_UINT32 * p_tile_index,
OPJ_UINT32 * p_data_size,
OPJ_INT32 * p_tile_x0,
OPJ_INT32 * p_tile_y0,
OPJ_INT32 * p_tile_x1,
OPJ_INT32 * p_tile_y1,
OPJ_UINT32 * p_nb_comps,
OPJ_BOOL * p_should_go_on,
struct opj_stream_private * p_cio,
struct opj_event_mgr * p_manager);
OPJ_BOOL(*opj_read_tile_header)(void * p_codec,
OPJ_UINT32 * p_tile_index,
OPJ_UINT32 * p_data_size,
OPJ_INT32 * p_tile_x0,
OPJ_INT32 * p_tile_y0,
OPJ_INT32 * p_tile_x1,
OPJ_INT32 * p_tile_y1,
OPJ_UINT32 * p_nb_comps,
OPJ_BOOL * p_should_go_on,
struct opj_stream_private * p_cio,
struct opj_event_mgr * p_manager);
/** FIXME DOC */
OPJ_BOOL (*opj_decode_tile_data)( void * p_codec,
OPJ_UINT32 p_tile_index,
OPJ_BYTE * p_data,
OPJ_UINT32 p_data_size,
struct opj_stream_private * p_cio,
struct opj_event_mgr * p_manager);
OPJ_BOOL(*opj_decode_tile_data)(void * p_codec,
OPJ_UINT32 p_tile_index,
OPJ_BYTE * p_data,
OPJ_UINT32 p_data_size,
struct opj_stream_private * p_cio,
struct opj_event_mgr * p_manager);
/** Reading function used after codestream if necessary */
OPJ_BOOL (* opj_end_decompress) ( void *p_codec,
struct opj_stream_private * cio,
struct opj_event_mgr * p_manager);
OPJ_BOOL(* opj_end_decompress)(void *p_codec,
struct opj_stream_private * cio,
struct opj_event_mgr * p_manager);
/** Codec destroy function handler */
void (*opj_destroy) (void * p_codec);
void (*opj_destroy)(void * p_codec);
/** Setup decoder function handler */
void (*opj_setup_decoder) ( void * p_codec, opj_dparameters_t * p_param);
void (*opj_setup_decoder)(void * p_codec, opj_dparameters_t * p_param);
/** Set decode area function handler */
OPJ_BOOL (*opj_set_decode_area) ( void * p_codec,
opj_image_t * p_image,
OPJ_INT32 p_start_x,
OPJ_INT32 p_end_x,
OPJ_INT32 p_start_y,
OPJ_INT32 p_end_y,
struct opj_event_mgr * p_manager);
OPJ_BOOL(*opj_set_decode_area)(void * p_codec,
opj_image_t * p_image,
OPJ_INT32 p_start_x,
OPJ_INT32 p_end_x,
OPJ_INT32 p_start_y,
OPJ_INT32 p_end_y,
struct opj_event_mgr * p_manager);
/** Get tile function */
OPJ_BOOL (*opj_get_decoded_tile) ( void *p_codec,
opj_stream_private_t * p_cio,
opj_image_t *p_image,
struct opj_event_mgr * p_manager,
OPJ_UINT32 tile_index);
OPJ_BOOL(*opj_get_decoded_tile)(void *p_codec,
opj_stream_private_t * p_cio,
opj_image_t *p_image,
struct opj_event_mgr * p_manager,
OPJ_UINT32 tile_index);
/** Set the decoded resolution factor */
OPJ_BOOL (*opj_set_decoded_resolution_factor) ( void * p_codec,
OPJ_UINT32 res_factor,
opj_event_mgr_t * p_manager);
OPJ_BOOL(*opj_set_decoded_resolution_factor)(void * p_codec,
OPJ_UINT32 res_factor,
opj_event_mgr_t * p_manager);
} m_decompression;
/**
* Compression handler. FIXME DOC
*/
struct opj_compression
{
OPJ_BOOL (* opj_start_compress) ( void *p_codec,
struct opj_stream_private * cio,
struct opj_image * p_image,
struct opj_event_mgr * p_manager);
struct opj_compression {
OPJ_BOOL(* opj_start_compress)(void *p_codec,
struct opj_stream_private * cio,
struct opj_image * p_image,
struct opj_event_mgr * p_manager);
OPJ_BOOL (* opj_encode) ( void * p_codec,
struct opj_stream_private *p_cio,
struct opj_event_mgr * p_manager);
OPJ_BOOL(* opj_encode)(void * p_codec,
struct opj_stream_private *p_cio,
struct opj_event_mgr * p_manager);
OPJ_BOOL (* opj_write_tile) ( void * p_codec,
OPJ_UINT32 p_tile_index,
OPJ_BYTE * p_data,
OPJ_UINT32 p_data_size,
struct opj_stream_private * p_cio,
OPJ_BOOL(* opj_write_tile)(void * p_codec,
OPJ_UINT32 p_tile_index,
OPJ_BYTE * p_data,
OPJ_UINT32 p_data_size,
struct opj_stream_private * p_cio,
struct opj_event_mgr * p_manager);
OPJ_BOOL(* opj_end_compress)(void * p_codec,
struct opj_stream_private * p_cio,
struct opj_event_mgr * p_manager);
void (* opj_destroy)(void * p_codec);
OPJ_BOOL(* opj_setup_encoder)(void * p_codec,
opj_cparameters_t * p_param,
struct opj_image * p_image,
struct opj_event_mgr * p_manager);
OPJ_BOOL (* opj_end_compress) ( void * p_codec,
struct opj_stream_private * p_cio,
struct opj_event_mgr * p_manager);
void (* opj_destroy) (void * p_codec);
OPJ_BOOL (* opj_setup_encoder) ( void * p_codec,
opj_cparameters_t * p_param,
struct opj_image * p_image,
struct opj_event_mgr * p_manager);
} m_compression;
} m_codec_data;
/** FIXME DOC*/
@ -155,12 +151,13 @@ typedef struct opj_codec_private
opj_event_mgr_t m_event_mgr;
/** Flag to indicate if the codec is used to decode or encode*/
OPJ_BOOL is_decompressor;
void (*opj_dump_codec) (void * p_codec, OPJ_INT32 info_flag, FILE* output_stream);
void (*opj_dump_codec)(void * p_codec, OPJ_INT32 info_flag,
FILE* output_stream);
opj_codestream_info_v2_t* (*opj_get_codec_info)(void* p_codec);
opj_codestream_index_t* (*opj_get_codec_index)(void* p_codec);
/** Set number of threads */
OPJ_BOOL (*opj_set_threads) ( void * p_codec, OPJ_UINT32 num_threads );
OPJ_BOOL(*opj_set_threads)(void * p_codec, OPJ_UINT32 num_threads);
}
opj_codec_private_t;

View File

@ -1,11 +1,11 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
* Copyright (c) 2005, Herve Drolon, FreeImage Team
* Copyright (c) 2008, 2011-2012, Centre National d'Etudes Spatiales (CNES), FR
* Copyright (c) 2008, 2011-2012, Centre National d'Etudes Spatiales (CNES), FR
* Copyright (c) 2012, CS Systemes d'Information, France
* All rights reserved.
*
@ -71,11 +71,11 @@
#if defined(WIN32) && !defined(Windows95) && !defined(__BORLANDC__) && \
!(defined(_MSC_VER) && _MSC_VER < 1400) && \
!(defined(__MINGW32__) && __MSVCRT_VERSION__ < 0x800)
/*
Windows '95 and Borland C do not support _lseeki64
Visual Studio does not support _fseeki64 and _ftelli64 until the 2005 release.
Without these interfaces, files over 2GB in size are not supported for Windows.
*/
/*
Windows '95 and Borland C do not support _lseeki64
Visual Studio does not support _fseeki64 and _ftelli64 until the 2005 release.
Without these interfaces, files over 2GB in size are not supported for Windows.
*/
# define OPJ_FSEEK(stream,offset,whence) _fseeki64(stream,/* __int64 */ offset,whence)
# define OPJ_FSTAT(fildes,stat_buff) _fstati64(fildes,/* struct _stati64 */ stat_buff)
# define OPJ_FTELL(stream) /* __int64 */ _ftelli64(stream)
@ -105,83 +105,86 @@
/* Are restricted pointers available? (C99) */
#if (__STDC_VERSION__ >= 199901L)
#define OPJ_RESTRICT restrict
#define OPJ_RESTRICT restrict
#else
/* Not a C99 compiler */
#if defined(__GNUC__)
#define OPJ_RESTRICT __restrict__
/* Not a C99 compiler */
#if defined(__GNUC__)
#define OPJ_RESTRICT __restrict__
/*
vc14 (2015) outputs wrong results.
Need to check OPJ_RESTRICT usage (or a bug in vc14)
#elif defined(_MSC_VER) && (_MSC_VER >= 1400)
#define OPJ_RESTRICT __restrict
#elif defined(_MSC_VER) && (_MSC_VER >= 1400)
#define OPJ_RESTRICT __restrict
*/
#else
#define OPJ_RESTRICT /* restrict */
#endif
#else
#define OPJ_RESTRICT /* restrict */
#endif
#endif
#ifdef __has_attribute
#if __has_attribute(no_sanitize)
#define OPJ_NOSANITIZE(kind) __attribute__((no_sanitize(kind)))
#endif
#if __has_attribute(no_sanitize)
#define OPJ_NOSANITIZE(kind) __attribute__((no_sanitize(kind)))
#endif
#endif
#ifndef OPJ_NOSANITIZE
#define OPJ_NOSANITIZE(kind)
#define OPJ_NOSANITIZE(kind)
#endif
/* MSVC before 2013 and Borland C do not have lrintf */
#if defined(_MSC_VER)
#include <intrin.h>
static INLINE long opj_lrintf(float f){
static INLINE long opj_lrintf(float f)
{
#ifdef _M_X64
return _mm_cvt_ss2si(_mm_load_ss(&f));
return _mm_cvt_ss2si(_mm_load_ss(&f));
/* commented out line breaks many tests */
/* return (long)((f>0.0f) ? (f + 0.5f):(f -0.5f)); */
/* commented out line breaks many tests */
/* return (long)((f>0.0f) ? (f + 0.5f):(f -0.5f)); */
#elif defined(_M_IX86)
int i;
_asm{
_asm{
fld f
fistp i
};
return i;
#else
return (long)((f>0.0f) ? (f + 0.5f) : (f - 0.5f));
#else
return (long)((f>0.0f) ? (f + 0.5f) : (f - 0.5f));
#endif
}
#elif defined(__BORLANDC__)
static INLINE long opj_lrintf(float f) {
static INLINE long opj_lrintf(float f)
{
#ifdef _M_X64
return (long)((f>0.0f) ? (f + 0.5f):(f -0.5f));
return (long)((f > 0.0f) ? (f + 0.5f) : (f - 0.5f));
#else
int i;
int i;
_asm {
fld f
fistp i
};
_asm {
fld f
fistp i
};
return i;
return i;
#endif
}
#else
static INLINE long opj_lrintf(float f) {
return lrintf(f);
static INLINE long opj_lrintf(float f)
{
return lrintf(f);
}
#endif
#if defined(_MSC_VER) && (_MSC_VER < 1400)
#define vsnprintf _vsnprintf
#define vsnprintf _vsnprintf
#endif
/* MSVC x86 is really bad at doing int64 = int32 * int32 on its own. Use intrinsic. */
#if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(__INTEL_COMPILER) && defined(_M_IX86)
# include <intrin.h>
# pragma intrinsic(__emul)
# include <intrin.h>
# pragma intrinsic(__emul)
#endif
/* Type to use for bit-fields in internal headers */

View File

@ -1,6 +1,6 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
@ -8,7 +8,7 @@
* Copyright (c) 2002-2014, Professor Benoit Macq
* Copyright (c) 2001-2003, David Janssens
* Copyright (c) 2002-2003, Yannick Verschueren
* Copyright (c) 2003-2007, Francois-Olivier Devaux
* Copyright (c) 2003-2007, Francois-Olivier Devaux
* Copyright (c) 2003-2014, Antonin Descampe
* Copyright (c) 2005, Herve Drolon, FreeImage Team
* All rights reserved.
@ -53,41 +53,46 @@ The functions in OPJ_INTMATH.H have for goal to realize operations on integers.
Get the minimum of two integers
@return Returns a if a < b else b
*/
static INLINE OPJ_INT32 opj_int_min(OPJ_INT32 a, OPJ_INT32 b) {
return a < b ? a : b;
static INLINE OPJ_INT32 opj_int_min(OPJ_INT32 a, OPJ_INT32 b)
{
return a < b ? a : b;
}
/**
Get the minimum of two integers
@return Returns a if a < b else b
*/
static INLINE OPJ_UINT32 opj_uint_min(OPJ_UINT32 a, OPJ_UINT32 b) {
return a < b ? a : b;
static INLINE OPJ_UINT32 opj_uint_min(OPJ_UINT32 a, OPJ_UINT32 b)
{
return a < b ? a : b;
}
/**
Get the maximum of two integers
@return Returns a if a > b else b
*/
static INLINE OPJ_INT32 opj_int_max(OPJ_INT32 a, OPJ_INT32 b) {
return (a > b) ? a : b;
static INLINE OPJ_INT32 opj_int_max(OPJ_INT32 a, OPJ_INT32 b)
{
return (a > b) ? a : b;
}
/**
Get the maximum of two integers
@return Returns a if a > b else b
*/
static INLINE OPJ_UINT32 opj_uint_max(OPJ_UINT32 a, OPJ_UINT32 b) {
return (a > b) ? a : b;
static INLINE OPJ_UINT32 opj_uint_max(OPJ_UINT32 a, OPJ_UINT32 b)
{
return (a > b) ? a : b;
}
/**
Get the saturated sum of two unsigned integers
@return Returns saturated sum of a+b
*/
static INLINE OPJ_UINT32 opj_uint_adds(OPJ_UINT32 a, OPJ_UINT32 b) {
OPJ_UINT64 sum = (OPJ_UINT64)a + (OPJ_UINT64)b;
return (OPJ_UINT32)(-(OPJ_INT32)(sum >> 32)) | (OPJ_UINT32)sum;
static INLINE OPJ_UINT32 opj_uint_adds(OPJ_UINT32 a, OPJ_UINT32 b)
{
OPJ_UINT64 sum = (OPJ_UINT64)a + (OPJ_UINT64)b;
return (OPJ_UINT32)(-(OPJ_INT32)(sum >> 32)) | (OPJ_UINT32)sum;
}
/**
@ -96,93 +101,105 @@ Clamp an integer inside an interval
<ul>
<li>Returns a if (min < a < max)
<li>Returns max if (a > max)
<li>Returns min if (a < min)
<li>Returns min if (a < min)
</ul>
*/
static INLINE OPJ_INT32 opj_int_clamp(OPJ_INT32 a, OPJ_INT32 min, OPJ_INT32 max) {
if (a < min)
return min;
if (a > max)
return max;
return a;
static INLINE OPJ_INT32 opj_int_clamp(OPJ_INT32 a, OPJ_INT32 min,
OPJ_INT32 max)
{
if (a < min) {
return min;
}
if (a > max) {
return max;
}
return a;
}
/**
@return Get absolute value of integer
*/
static INLINE OPJ_INT32 opj_int_abs(OPJ_INT32 a) {
return a < 0 ? -a : a;
static INLINE OPJ_INT32 opj_int_abs(OPJ_INT32 a)
{
return a < 0 ? -a : a;
}
/**
Divide an integer and round upwards
@return Returns a divided by b
*/
static INLINE OPJ_INT32 opj_int_ceildiv(OPJ_INT32 a, OPJ_INT32 b) {
assert(b);
return (a + b - 1) / b;
static INLINE OPJ_INT32 opj_int_ceildiv(OPJ_INT32 a, OPJ_INT32 b)
{
assert(b);
return (a + b - 1) / b;
}
/**
Divide an integer and round upwards
@return Returns a divided by b
*/
static INLINE OPJ_UINT32 opj_uint_ceildiv(OPJ_UINT32 a, OPJ_UINT32 b) {
assert(b);
return (a + b - 1) / b;
static INLINE OPJ_UINT32 opj_uint_ceildiv(OPJ_UINT32 a, OPJ_UINT32 b)
{
assert(b);
return (a + b - 1) / b;
}
/**
Divide an integer by a power of 2 and round upwards
@return Returns a divided by 2^b
*/
static INLINE OPJ_INT32 opj_int_ceildivpow2(OPJ_INT32 a, OPJ_INT32 b) {
return (OPJ_INT32)((a + ((OPJ_INT64)1 << b) - 1) >> b);
static INLINE OPJ_INT32 opj_int_ceildivpow2(OPJ_INT32 a, OPJ_INT32 b)
{
return (OPJ_INT32)((a + ((OPJ_INT64)1 << b) - 1) >> b);
}
/**
Divide a 64bits integer by a power of 2 and round upwards
@return Returns a divided by 2^b
*/
static INLINE OPJ_INT32 opj_int64_ceildivpow2(OPJ_INT64 a, OPJ_INT32 b) {
return (OPJ_INT32)((a + ((OPJ_INT64)1 << b) - 1) >> b);
static INLINE OPJ_INT32 opj_int64_ceildivpow2(OPJ_INT64 a, OPJ_INT32 b)
{
return (OPJ_INT32)((a + ((OPJ_INT64)1 << b) - 1) >> b);
}
/**
Divide an integer by a power of 2 and round upwards
@return Returns a divided by 2^b
*/
static INLINE OPJ_UINT32 opj_uint_ceildivpow2(OPJ_UINT32 a, OPJ_UINT32 b) {
return (OPJ_UINT32)((a + ((OPJ_UINT64)1U << b) - 1U) >> b);
static INLINE OPJ_UINT32 opj_uint_ceildivpow2(OPJ_UINT32 a, OPJ_UINT32 b)
{
return (OPJ_UINT32)((a + ((OPJ_UINT64)1U << b) - 1U) >> b);
}
/**
Divide an integer by a power of 2 and round downwards
@return Returns a divided by 2^b
*/
static INLINE OPJ_INT32 opj_int_floordivpow2(OPJ_INT32 a, OPJ_INT32 b) {
return a >> b;
static INLINE OPJ_INT32 opj_int_floordivpow2(OPJ_INT32 a, OPJ_INT32 b)
{
return a >> b;
}
/**
Get logarithm of an integer and round downwards
@return Returns log2(a)
*/
static INLINE OPJ_INT32 opj_int_floorlog2(OPJ_INT32 a) {
OPJ_INT32 l;
for (l = 0; a > 1; l++) {
a >>= 1;
}
return l;
static INLINE OPJ_INT32 opj_int_floorlog2(OPJ_INT32 a)
{
OPJ_INT32 l;
for (l = 0; a > 1; l++) {
a >>= 1;
}
return l;
}
/**
Get logarithm of an integer and round downwards
@return Returns log2(a)
*/
static INLINE OPJ_UINT32 opj_uint_floorlog2(OPJ_UINT32 a) {
OPJ_UINT32 l;
for (l = 0; a > 1; ++l)
{
a >>= 1;
}
return l;
static INLINE OPJ_UINT32 opj_uint_floorlog2(OPJ_UINT32 a)
{
OPJ_UINT32 l;
for (l = 0; a > 1; ++l) {
a >>= 1;
}
return l;
}
/**
@ -191,28 +208,31 @@ Multiply two fixed-precision rational numbers.
@param b
@return Returns a * b
*/
static INLINE OPJ_INT32 opj_int_fix_mul(OPJ_INT32 a, OPJ_INT32 b) {
static INLINE OPJ_INT32 opj_int_fix_mul(OPJ_INT32 a, OPJ_INT32 b)
{
#if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(__INTEL_COMPILER) && defined(_M_IX86)
OPJ_INT64 temp = __emul(a, b);
OPJ_INT64 temp = __emul(a, b);
#else
OPJ_INT64 temp = (OPJ_INT64) a * (OPJ_INT64) b ;
OPJ_INT64 temp = (OPJ_INT64) a * (OPJ_INT64) b ;
#endif
temp += 4096;
assert((temp >> 13) <= (OPJ_INT64)0x7FFFFFFF);
assert((temp >> 13) >= (-(OPJ_INT64)0x7FFFFFFF - (OPJ_INT64)1));
return (OPJ_INT32) (temp >> 13);
temp += 4096;
assert((temp >> 13) <= (OPJ_INT64)0x7FFFFFFF);
assert((temp >> 13) >= (-(OPJ_INT64)0x7FFFFFFF - (OPJ_INT64)1));
return (OPJ_INT32)(temp >> 13);
}
static INLINE OPJ_INT32 opj_int_fix_mul_t1(OPJ_INT32 a, OPJ_INT32 b) {
static INLINE OPJ_INT32 opj_int_fix_mul_t1(OPJ_INT32 a, OPJ_INT32 b)
{
#if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(__INTEL_COMPILER) && defined(_M_IX86)
OPJ_INT64 temp = __emul(a, b);
OPJ_INT64 temp = __emul(a, b);
#else
OPJ_INT64 temp = (OPJ_INT64) a * (OPJ_INT64) b ;
OPJ_INT64 temp = (OPJ_INT64) a * (OPJ_INT64) b ;
#endif
temp += 4096;
assert((temp >> (13 + 11 - T1_NMSEDEC_FRACBITS)) <= (OPJ_INT64)0x7FFFFFFF);
assert((temp >> (13 + 11 - T1_NMSEDEC_FRACBITS)) >= (-(OPJ_INT64)0x7FFFFFFF - (OPJ_INT64)1));
return (OPJ_INT32) (temp >> (13 + 11 - T1_NMSEDEC_FRACBITS)) ;
temp += 4096;
assert((temp >> (13 + 11 - T1_NMSEDEC_FRACBITS)) <= (OPJ_INT64)0x7FFFFFFF);
assert((temp >> (13 + 11 - T1_NMSEDEC_FRACBITS)) >= (-(OPJ_INT64)0x7FFFFFFF -
(OPJ_INT64)1));
return (OPJ_INT32)(temp >> (13 + 11 - T1_NMSEDEC_FRACBITS)) ;
}
/* ----------------------------------------------------------------------- */

View File

@ -1,6 +1,6 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*

View File

@ -1,6 +1,6 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*

View File

@ -1,6 +1,6 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*

View File

@ -1,6 +1,6 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
@ -8,7 +8,7 @@
* Copyright (c) 2002-2014, Professor Benoit Macq
* Copyright (c) 2001-2003, David Janssens
* Copyright (c) 2002-2003, Yannick Verschueren
* Copyright (c) 2003-2007, Francois-Olivier Devaux
* Copyright (c) 2003-2007, Francois-Olivier Devaux
* Copyright (c) 2003-2014, Antonin Descampe
* Copyright (c) 2005, Herve Drolon, FreeImage Team
* All rights reserved.
@ -53,58 +53,58 @@ by some function in T2.C.
FIXME DOC
*/
typedef struct opj_pi_resolution {
OPJ_UINT32 pdx, pdy;
OPJ_UINT32 pw, ph;
OPJ_UINT32 pdx, pdy;
OPJ_UINT32 pw, ph;
} opj_pi_resolution_t;
/**
FIXME DOC
*/
typedef struct opj_pi_comp {
OPJ_UINT32 dx, dy;
/** number of resolution levels */
OPJ_UINT32 numresolutions;
opj_pi_resolution_t *resolutions;
OPJ_UINT32 dx, dy;
/** number of resolution levels */
OPJ_UINT32 numresolutions;
opj_pi_resolution_t *resolutions;
} opj_pi_comp_t;
/**
Packet iterator
*/
typedef struct opj_pi_iterator {
/** Enabling Tile part generation*/
OPJ_BYTE tp_on;
/** precise if the packet has been already used (useful for progression order change) */
OPJ_INT16 *include;
/** layer step used to localize the packet in the include vector */
OPJ_UINT32 step_l;
/** resolution step used to localize the packet in the include vector */
OPJ_UINT32 step_r;
/** component step used to localize the packet in the include vector */
OPJ_UINT32 step_c;
/** precinct step used to localize the packet in the include vector */
OPJ_UINT32 step_p;
/** component that identify the packet */
OPJ_UINT32 compno;
/** resolution that identify the packet */
OPJ_UINT32 resno;
/** precinct that identify the packet */
OPJ_UINT32 precno;
/** layer that identify the packet */
OPJ_UINT32 layno;
/** 0 if the first packet */
OPJ_BOOL first;
/** progression order change information */
opj_poc_t poc;
/** number of components in the image */
OPJ_UINT32 numcomps;
/** Components*/
opj_pi_comp_t *comps;
/** FIXME DOC*/
OPJ_INT32 tx0, ty0, tx1, ty1;
/** FIXME DOC*/
OPJ_INT32 x, y;
/** FIXME DOC*/
OPJ_UINT32 dx, dy;
/** Enabling Tile part generation*/
OPJ_BYTE tp_on;
/** precise if the packet has been already used (useful for progression order change) */
OPJ_INT16 *include;
/** layer step used to localize the packet in the include vector */
OPJ_UINT32 step_l;
/** resolution step used to localize the packet in the include vector */
OPJ_UINT32 step_r;
/** component step used to localize the packet in the include vector */
OPJ_UINT32 step_c;
/** precinct step used to localize the packet in the include vector */
OPJ_UINT32 step_p;
/** component that identify the packet */
OPJ_UINT32 compno;
/** resolution that identify the packet */
OPJ_UINT32 resno;
/** precinct that identify the packet */
OPJ_UINT32 precno;
/** layer that identify the packet */
OPJ_UINT32 layno;
/** 0 if the first packet */
OPJ_BOOL first;
/** progression order change information */
opj_poc_t poc;
/** number of components in the image */
OPJ_UINT32 numcomps;
/** Components*/
opj_pi_comp_t *comps;
/** FIXME DOC*/
OPJ_INT32 tx0, ty0, tx1, ty1;
/** FIXME DOC*/
OPJ_INT32 x, y;
/** FIXME DOC*/
OPJ_UINT32 dx, dy;
} opj_pi_iterator_t;
/** @name Exported functions */
@ -113,28 +113,28 @@ typedef struct opj_pi_iterator {
/**
* Creates a packet iterator for encoding.
*
* @param image the image being encoded.
* @param cp the coding parameters.
* @param tileno index of the tile being encoded.
* @param t2_mode the type of pass for generating the packet iterator
* @param image the image being encoded.
* @param cp the coding parameters.
* @param tileno index of the tile being encoded.
* @param t2_mode the type of pass for generating the packet iterator
*
* @return a list of packet iterator that points to the first packet of the tile (not true).
* @return a list of packet iterator that points to the first packet of the tile (not true).
*/
opj_pi_iterator_t *opj_pi_initialise_encode(const opj_image_t *image,
opj_cp_t *cp,
OPJ_UINT32 tileno,
J2K_T2_MODE t2_mode);
opj_cp_t *cp,
OPJ_UINT32 tileno,
J2K_T2_MODE t2_mode);
/**
* Updates the encoding parameters of the codec.
*
* @param p_image the image being encoded.
* @param p_cp the coding parameters.
* @param p_tile_no index of the tile being encoded.
* @param p_image the image being encoded.
* @param p_cp the coding parameters.
* @param p_tile_no index of the tile being encoded.
*/
void opj_pi_update_encoding_parameters( const opj_image_t *p_image,
opj_cp_t *p_cp,
OPJ_UINT32 p_tile_no );
void opj_pi_update_encoding_parameters(const opj_image_t *p_image,
opj_cp_t *p_cp,
OPJ_UINT32 p_tile_no);
/**
Modify the packet iterator for enabling tile part generation
@ -146,13 +146,13 @@ Modify the packet iterator for enabling tile part generation
@param tppos The position of the tile part flag in the progression order
@param t2_mode FIXME DOC
*/
void opj_pi_create_encode( opj_pi_iterator_t *pi,
opj_cp_t *cp,
OPJ_UINT32 tileno,
OPJ_UINT32 pino,
OPJ_UINT32 tpnum,
OPJ_INT32 tppos,
J2K_T2_MODE t2_mode);
void opj_pi_create_encode(opj_pi_iterator_t *pi,
opj_cp_t *cp,
OPJ_UINT32 tileno,
OPJ_UINT32 pino,
OPJ_UINT32 tpnum,
OPJ_INT32 tppos,
J2K_T2_MODE t2_mode);
/**
Create a packet iterator for Decoder
@ -162,14 +162,14 @@ Create a packet iterator for Decoder
@return Returns a packet iterator that points to the first packet of the tile
@see opj_pi_destroy
*/
opj_pi_iterator_t *opj_pi_create_decode(opj_image_t * image,
opj_pi_iterator_t *opj_pi_create_decode(opj_image_t * image,
opj_cp_t * cp,
OPJ_UINT32 tileno);
/**
* Destroys a packet iterator array.
*
* @param p_pi the packet iterator array to destroy.
* @param p_nb_elements the number of elements in the array.
* @param p_pi the packet iterator array to destroy.
* @param p_nb_elements the number of elements in the array.
*/
void opj_pi_destroy(opj_pi_iterator_t *p_pi,
OPJ_UINT32 p_nb_elements);

View File

@ -1,12 +1,12 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2014, Professor Benoit Macq
* Copyright (c) 2003-2007, Francois-Olivier Devaux
* Copyright (c) 2003-2007, Francois-Olivier Devaux
* Copyright (c) 2003-2014, Antonin Descampe
* Copyright (c) 2005, Herve Drolon, FreeImage Team
* All rights reserved.
@ -50,27 +50,27 @@ with the corresponding mode switch.
RAW encoding operations
*/
typedef struct opj_raw {
/** temporary buffer where bits are coded or decoded */
OPJ_BYTE c;
/** number of bits already read or free to write */
OPJ_UINT32 ct;
/** maximum length to decode */
OPJ_UINT32 lenmax;
/** length decoded */
OPJ_UINT32 len;
/** pointer to the current position in the buffer */
OPJ_BYTE *bp;
/** pointer to the start of the buffer */
OPJ_BYTE *start;
/** pointer to the end of the buffer */
OPJ_BYTE *end;
/** temporary buffer where bits are coded or decoded */
OPJ_BYTE c;
/** number of bits already read or free to write */
OPJ_UINT32 ct;
/** maximum length to decode */
OPJ_UINT32 lenmax;
/** length decoded */
OPJ_UINT32 len;
/** pointer to the current position in the buffer */
OPJ_BYTE *bp;
/** pointer to the start of the buffer */
OPJ_BYTE *start;
/** pointer to the end of the buffer */
OPJ_BYTE *end;
} opj_raw_t;
/** @name Exported functions */
/*@{*/
/* ----------------------------------------------------------------------- */
/**
Create a new RAW handle
Create a new RAW handle
@return Returns a new RAW handle if successful, returns NULL otherwise
*/
opj_raw_t* opj_raw_create(void);

View File

@ -1,6 +1,6 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
@ -8,7 +8,7 @@
* Copyright (c) 2002-2014, Professor Benoit Macq
* Copyright (c) 2001-2003, David Janssens
* Copyright (c) 2002-2003, Yannick Verschueren
* Copyright (c) 2003-2007, Francois-Olivier Devaux
* Copyright (c) 2003-2007, Francois-Olivier Devaux
* Copyright (c) 2003-2014, Antonin Descampe
* Copyright (c) 2005, Herve Drolon, FreeImage Team
* All rights reserved.
@ -90,8 +90,8 @@ in T1.C are used by some function in TCD.C.
#define T1_NMSEDEC_FRACBITS (T1_NMSEDEC_BITS-1)
#define T1_TYPE_MQ 0 /**< Normal coding using entropy coder */
#define T1_TYPE_RAW 1 /**< No encoding the information is store under raw format in codestream (mode switch RAW)*/
#define T1_TYPE_MQ 0 /**< Normal coding using entropy coder */
#define T1_TYPE_RAW 1 /**< No encoding the information is store under raw format in codestream (mode switch RAW)*/
/* Those flags are used by opj_colflag_t */
#define T1_COLFLAG_RBS 4U /* RBS = Row Bit Shift */
@ -124,26 +124,26 @@ Tier-1 coding (coding of code-block coefficients)
*/
typedef struct opj_t1 {
/** MQC component */
opj_mqc_t *mqc;
/** RAW component */
opj_raw_t *raw;
/** MQC component */
opj_mqc_t *mqc;
/** RAW component */
opj_raw_t *raw;
OPJ_INT32 *data;
opj_flag_t *flags;
/** Addition flag array such that colflags[1+0] is for state of col=0,row=0..3,
colflags[1+1] for col=1, row=0..3, colflags[1+flags_stride] for col=0,row=4..7, ...
This array avoids too much cache trashing when processing by 4 vertical samples
as done in the various decoding steps. */
opj_colflag_t* colflags;
OPJ_UINT32 w;
OPJ_UINT32 h;
OPJ_UINT32 datasize;
OPJ_UINT32 flagssize;
OPJ_UINT32 flags_stride;
OPJ_UINT32 colflags_size;
OPJ_UINT32 data_stride;
OPJ_BOOL encoder;
OPJ_INT32 *data;
opj_flag_t *flags;
/** Addition flag array such that colflags[1+0] is for state of col=0,row=0..3,
colflags[1+1] for col=1, row=0..3, colflags[1+flags_stride] for col=0,row=4..7, ...
This array avoids too much cache trashing when processing by 4 vertical samples
as done in the various decoding steps. */
opj_colflag_t* colflags;
OPJ_UINT32 w;
OPJ_UINT32 h;
OPJ_UINT32 datasize;
OPJ_UINT32 flagssize;
OPJ_UINT32 flags_stride;
OPJ_UINT32 colflags_size;
OPJ_UINT32 data_stride;
OPJ_BOOL encoder;
} opj_t1_t;
#define MACRO_t1_flags(x,y) t1->flags[((x)*(t1->flags_stride))+(y)]
@ -160,11 +160,11 @@ Encode the code-blocks of a tile
@param mct_norms FIXME DOC
@param mct_numcomps Number of components used for MCT
*/
OPJ_BOOL opj_t1_encode_cblks( opj_t1_t *t1,
opj_tcd_tile_t *tile,
opj_tcp_t *tcp,
const OPJ_FLOAT64 * mct_norms,
OPJ_UINT32 mct_numcomps);
OPJ_BOOL opj_t1_encode_cblks(opj_t1_t *t1,
opj_tcd_tile_t *tile,
opj_tcp_t *tcp,
const OPJ_FLOAT64 * mct_norms,
OPJ_UINT32 mct_numcomps);
/**
Decode the code-blocks of a tile
@ -172,10 +172,10 @@ Decode the code-blocks of a tile
@param tilec The tile to decode
@param tccp Tile coding parameters
*/
void opj_t1_decode_cblks( opj_thread_pool_t* tp,
volatile OPJ_BOOL* pret,
opj_tcd_tilecomp_t* tilec,
opj_tccp_t* tccp);
void opj_t1_decode_cblks(opj_thread_pool_t* tp,
volatile OPJ_BOOL* pret,
opj_tcd_tilecomp_t* tilec,
opj_tccp_t* tccp);

View File

@ -1,143 +1,143 @@
/* This file was automatically generated by t1_generate_luts.c */
static const OPJ_BYTE lut_ctxno_zc[1024] = {
0, 1, 1, 2, 1, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
0, 1, 1, 2, 1, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
0, 1, 1, 2, 1, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
0, 3, 3, 6, 3, 6, 6, 8, 3, 6, 6, 8, 6, 8, 8, 8, 1, 4, 4, 7, 4, 7, 7, 8, 4, 7, 7, 8, 7, 8, 8, 8,
1, 4, 4, 7, 4, 7, 7, 8, 4, 7, 7, 8, 7, 8, 8, 8, 2, 5, 5, 7, 5, 7, 7, 8, 5, 7, 7, 8, 7, 8, 8, 8,
1, 4, 4, 7, 4, 7, 7, 8, 4, 7, 7, 8, 7, 8, 8, 8, 2, 5, 5, 7, 5, 7, 7, 8, 5, 7, 7, 8, 7, 8, 8, 8,
2, 5, 5, 7, 5, 7, 7, 8, 5, 7, 7, 8, 7, 8, 8, 8, 2, 5, 5, 7, 5, 7, 7, 8, 5, 7, 7, 8, 7, 8, 8, 8,
1, 4, 4, 7, 4, 7, 7, 8, 4, 7, 7, 8, 7, 8, 8, 8, 2, 5, 5, 7, 5, 7, 7, 8, 5, 7, 7, 8, 7, 8, 8, 8,
2, 5, 5, 7, 5, 7, 7, 8, 5, 7, 7, 8, 7, 8, 8, 8, 2, 5, 5, 7, 5, 7, 7, 8, 5, 7, 7, 8, 7, 8, 8, 8,
2, 5, 5, 7, 5, 7, 7, 8, 5, 7, 7, 8, 7, 8, 8, 8, 2, 5, 5, 7, 5, 7, 7, 8, 5, 7, 7, 8, 7, 8, 8, 8,
2, 5, 5, 7, 5, 7, 7, 8, 5, 7, 7, 8, 7, 8, 8, 8, 2, 5, 5, 7, 5, 7, 7, 8, 5, 7, 7, 8, 7, 8, 8, 8
0, 1, 1, 2, 1, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
0, 1, 1, 2, 1, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
0, 1, 1, 2, 1, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
0, 3, 3, 6, 3, 6, 6, 8, 3, 6, 6, 8, 6, 8, 8, 8, 1, 4, 4, 7, 4, 7, 7, 8, 4, 7, 7, 8, 7, 8, 8, 8,
1, 4, 4, 7, 4, 7, 7, 8, 4, 7, 7, 8, 7, 8, 8, 8, 2, 5, 5, 7, 5, 7, 7, 8, 5, 7, 7, 8, 7, 8, 8, 8,
1, 4, 4, 7, 4, 7, 7, 8, 4, 7, 7, 8, 7, 8, 8, 8, 2, 5, 5, 7, 5, 7, 7, 8, 5, 7, 7, 8, 7, 8, 8, 8,
2, 5, 5, 7, 5, 7, 7, 8, 5, 7, 7, 8, 7, 8, 8, 8, 2, 5, 5, 7, 5, 7, 7, 8, 5, 7, 7, 8, 7, 8, 8, 8,
1, 4, 4, 7, 4, 7, 7, 8, 4, 7, 7, 8, 7, 8, 8, 8, 2, 5, 5, 7, 5, 7, 7, 8, 5, 7, 7, 8, 7, 8, 8, 8,
2, 5, 5, 7, 5, 7, 7, 8, 5, 7, 7, 8, 7, 8, 8, 8, 2, 5, 5, 7, 5, 7, 7, 8, 5, 7, 7, 8, 7, 8, 8, 8,
2, 5, 5, 7, 5, 7, 7, 8, 5, 7, 7, 8, 7, 8, 8, 8, 2, 5, 5, 7, 5, 7, 7, 8, 5, 7, 7, 8, 7, 8, 8, 8,
2, 5, 5, 7, 5, 7, 7, 8, 5, 7, 7, 8, 7, 8, 8, 8, 2, 5, 5, 7, 5, 7, 7, 8, 5, 7, 7, 8, 7, 8, 8, 8
};
static const OPJ_BYTE lut_ctxno_sc[256] = {
0x9, 0xa, 0xc, 0xd, 0xa, 0xa, 0xd, 0xd, 0xc, 0xd, 0xc, 0xd, 0xd, 0xd, 0xd, 0xd,
0x9, 0xa, 0xc, 0xb, 0xa, 0x9, 0xd, 0xc, 0xc, 0xb, 0xc, 0xb, 0xd, 0xc, 0xd, 0xc,
0x9, 0xa, 0xc, 0xb, 0xa, 0xa, 0xb, 0xb, 0xc, 0xd, 0x9, 0xa, 0xd, 0xd, 0xa, 0xa,
0x9, 0xa, 0xc, 0xd, 0xa, 0x9, 0xb, 0xc, 0xc, 0xb, 0x9, 0xa, 0xd, 0xc, 0xa, 0x9,
0x9, 0xa, 0xc, 0xd, 0xa, 0x9, 0xb, 0xc, 0xc, 0xd, 0xc, 0xd, 0xb, 0xc, 0xb, 0xc,
0x9, 0xa, 0xc, 0xb, 0xa, 0xa, 0xb, 0xb, 0xc, 0xb, 0xc, 0xb, 0xb, 0xb, 0xb, 0xb,
0x9, 0xa, 0xc, 0xb, 0xa, 0x9, 0xd, 0xc, 0xc, 0xd, 0x9, 0xa, 0xb, 0xc, 0xa, 0x9,
0x9, 0xa, 0xc, 0xd, 0xa, 0xa, 0xd, 0xd, 0xc, 0xb, 0x9, 0xa, 0xb, 0xb, 0xa, 0xa,
0x9, 0xa, 0xc, 0xd, 0xa, 0xa, 0xd, 0xd, 0xc, 0xb, 0x9, 0xa, 0xb, 0xb, 0xa, 0xa,
0x9, 0xa, 0xc, 0xb, 0xa, 0x9, 0xd, 0xc, 0xc, 0xd, 0x9, 0xa, 0xb, 0xc, 0xa, 0x9,
0x9, 0xa, 0xc, 0xb, 0xa, 0xa, 0xb, 0xb, 0xc, 0xb, 0xc, 0xb, 0xb, 0xb, 0xb, 0xb,
0x9, 0xa, 0xc, 0xd, 0xa, 0x9, 0xb, 0xc, 0xc, 0xd, 0xc, 0xd, 0xb, 0xc, 0xb, 0xc,
0x9, 0xa, 0xc, 0xd, 0xa, 0x9, 0xb, 0xc, 0xc, 0xb, 0x9, 0xa, 0xd, 0xc, 0xa, 0x9,
0x9, 0xa, 0xc, 0xb, 0xa, 0xa, 0xb, 0xb, 0xc, 0xd, 0x9, 0xa, 0xd, 0xd, 0xa, 0xa,
0x9, 0xa, 0xc, 0xb, 0xa, 0x9, 0xd, 0xc, 0xc, 0xb, 0xc, 0xb, 0xd, 0xc, 0xd, 0xc,
0x9, 0xa, 0xc, 0xd, 0xa, 0xa, 0xd, 0xd, 0xc, 0xd, 0xc, 0xd, 0xd, 0xd, 0xd, 0xd
0x9, 0xa, 0xc, 0xd, 0xa, 0xa, 0xd, 0xd, 0xc, 0xd, 0xc, 0xd, 0xd, 0xd, 0xd, 0xd,
0x9, 0xa, 0xc, 0xb, 0xa, 0x9, 0xd, 0xc, 0xc, 0xb, 0xc, 0xb, 0xd, 0xc, 0xd, 0xc,
0x9, 0xa, 0xc, 0xb, 0xa, 0xa, 0xb, 0xb, 0xc, 0xd, 0x9, 0xa, 0xd, 0xd, 0xa, 0xa,
0x9, 0xa, 0xc, 0xd, 0xa, 0x9, 0xb, 0xc, 0xc, 0xb, 0x9, 0xa, 0xd, 0xc, 0xa, 0x9,
0x9, 0xa, 0xc, 0xd, 0xa, 0x9, 0xb, 0xc, 0xc, 0xd, 0xc, 0xd, 0xb, 0xc, 0xb, 0xc,
0x9, 0xa, 0xc, 0xb, 0xa, 0xa, 0xb, 0xb, 0xc, 0xb, 0xc, 0xb, 0xb, 0xb, 0xb, 0xb,
0x9, 0xa, 0xc, 0xb, 0xa, 0x9, 0xd, 0xc, 0xc, 0xd, 0x9, 0xa, 0xb, 0xc, 0xa, 0x9,
0x9, 0xa, 0xc, 0xd, 0xa, 0xa, 0xd, 0xd, 0xc, 0xb, 0x9, 0xa, 0xb, 0xb, 0xa, 0xa,
0x9, 0xa, 0xc, 0xd, 0xa, 0xa, 0xd, 0xd, 0xc, 0xb, 0x9, 0xa, 0xb, 0xb, 0xa, 0xa,
0x9, 0xa, 0xc, 0xb, 0xa, 0x9, 0xd, 0xc, 0xc, 0xd, 0x9, 0xa, 0xb, 0xc, 0xa, 0x9,
0x9, 0xa, 0xc, 0xb, 0xa, 0xa, 0xb, 0xb, 0xc, 0xb, 0xc, 0xb, 0xb, 0xb, 0xb, 0xb,
0x9, 0xa, 0xc, 0xd, 0xa, 0x9, 0xb, 0xc, 0xc, 0xd, 0xc, 0xd, 0xb, 0xc, 0xb, 0xc,
0x9, 0xa, 0xc, 0xd, 0xa, 0x9, 0xb, 0xc, 0xc, 0xb, 0x9, 0xa, 0xd, 0xc, 0xa, 0x9,
0x9, 0xa, 0xc, 0xb, 0xa, 0xa, 0xb, 0xb, 0xc, 0xd, 0x9, 0xa, 0xd, 0xd, 0xa, 0xa,
0x9, 0xa, 0xc, 0xb, 0xa, 0x9, 0xd, 0xc, 0xc, 0xb, 0xc, 0xb, 0xd, 0xc, 0xd, 0xc,
0x9, 0xa, 0xc, 0xd, 0xa, 0xa, 0xd, 0xd, 0xc, 0xd, 0xc, 0xd, 0xd, 0xd, 0xd, 0xd
};
static const OPJ_BYTE lut_spb[256] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0,
0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1,
0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0,
0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1,
0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0,
0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1,
0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0,
0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1,
0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
};
static const OPJ_INT16 lut_nmsedec_sig[1U << T1_NMSEDEC_BITS] = {
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0180, 0x0300, 0x0480, 0x0600, 0x0780, 0x0900, 0x0a80,
0x0c00, 0x0d80, 0x0f00, 0x1080, 0x1200, 0x1380, 0x1500, 0x1680,
0x1800, 0x1980, 0x1b00, 0x1c80, 0x1e00, 0x1f80, 0x2100, 0x2280,
0x2400, 0x2580, 0x2700, 0x2880, 0x2a00, 0x2b80, 0x2d00, 0x2e80,
0x3000, 0x3180, 0x3300, 0x3480, 0x3600, 0x3780, 0x3900, 0x3a80,
0x3c00, 0x3d80, 0x3f00, 0x4080, 0x4200, 0x4380, 0x4500, 0x4680,
0x4800, 0x4980, 0x4b00, 0x4c80, 0x4e00, 0x4f80, 0x5100, 0x5280,
0x5400, 0x5580, 0x5700, 0x5880, 0x5a00, 0x5b80, 0x5d00, 0x5e80,
0x6000, 0x6180, 0x6300, 0x6480, 0x6600, 0x6780, 0x6900, 0x6a80,
0x6c00, 0x6d80, 0x6f00, 0x7080, 0x7200, 0x7380, 0x7500, 0x7680
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0180, 0x0300, 0x0480, 0x0600, 0x0780, 0x0900, 0x0a80,
0x0c00, 0x0d80, 0x0f00, 0x1080, 0x1200, 0x1380, 0x1500, 0x1680,
0x1800, 0x1980, 0x1b00, 0x1c80, 0x1e00, 0x1f80, 0x2100, 0x2280,
0x2400, 0x2580, 0x2700, 0x2880, 0x2a00, 0x2b80, 0x2d00, 0x2e80,
0x3000, 0x3180, 0x3300, 0x3480, 0x3600, 0x3780, 0x3900, 0x3a80,
0x3c00, 0x3d80, 0x3f00, 0x4080, 0x4200, 0x4380, 0x4500, 0x4680,
0x4800, 0x4980, 0x4b00, 0x4c80, 0x4e00, 0x4f80, 0x5100, 0x5280,
0x5400, 0x5580, 0x5700, 0x5880, 0x5a00, 0x5b80, 0x5d00, 0x5e80,
0x6000, 0x6180, 0x6300, 0x6480, 0x6600, 0x6780, 0x6900, 0x6a80,
0x6c00, 0x6d80, 0x6f00, 0x7080, 0x7200, 0x7380, 0x7500, 0x7680
};
static const OPJ_INT16 lut_nmsedec_sig0[1U << T1_NMSEDEC_BITS] = {
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0080, 0x0080,
0x0080, 0x0080, 0x0100, 0x0100, 0x0100, 0x0180, 0x0180, 0x0200,
0x0200, 0x0280, 0x0280, 0x0300, 0x0300, 0x0380, 0x0400, 0x0400,
0x0480, 0x0500, 0x0580, 0x0580, 0x0600, 0x0680, 0x0700, 0x0780,
0x0800, 0x0880, 0x0900, 0x0980, 0x0a00, 0x0a80, 0x0b80, 0x0c00,
0x0c80, 0x0d00, 0x0e00, 0x0e80, 0x0f00, 0x1000, 0x1080, 0x1180,
0x1200, 0x1300, 0x1380, 0x1480, 0x1500, 0x1600, 0x1700, 0x1780,
0x1880, 0x1980, 0x1a80, 0x1b00, 0x1c00, 0x1d00, 0x1e00, 0x1f00,
0x2000, 0x2100, 0x2200, 0x2300, 0x2400, 0x2500, 0x2680, 0x2780,
0x2880, 0x2980, 0x2b00, 0x2c00, 0x2d00, 0x2e80, 0x2f80, 0x3100,
0x3200, 0x3380, 0x3480, 0x3600, 0x3700, 0x3880, 0x3a00, 0x3b00,
0x3c80, 0x3e00, 0x3f80, 0x4080, 0x4200, 0x4380, 0x4500, 0x4680,
0x4800, 0x4980, 0x4b00, 0x4c80, 0x4e00, 0x4f80, 0x5180, 0x5300,
0x5480, 0x5600, 0x5800, 0x5980, 0x5b00, 0x5d00, 0x5e80, 0x6080,
0x6200, 0x6400, 0x6580, 0x6780, 0x6900, 0x6b00, 0x6d00, 0x6e80,
0x7080, 0x7280, 0x7480, 0x7600, 0x7800, 0x7a00, 0x7c00, 0x7e00
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0080, 0x0080,
0x0080, 0x0080, 0x0100, 0x0100, 0x0100, 0x0180, 0x0180, 0x0200,
0x0200, 0x0280, 0x0280, 0x0300, 0x0300, 0x0380, 0x0400, 0x0400,
0x0480, 0x0500, 0x0580, 0x0580, 0x0600, 0x0680, 0x0700, 0x0780,
0x0800, 0x0880, 0x0900, 0x0980, 0x0a00, 0x0a80, 0x0b80, 0x0c00,
0x0c80, 0x0d00, 0x0e00, 0x0e80, 0x0f00, 0x1000, 0x1080, 0x1180,
0x1200, 0x1300, 0x1380, 0x1480, 0x1500, 0x1600, 0x1700, 0x1780,
0x1880, 0x1980, 0x1a80, 0x1b00, 0x1c00, 0x1d00, 0x1e00, 0x1f00,
0x2000, 0x2100, 0x2200, 0x2300, 0x2400, 0x2500, 0x2680, 0x2780,
0x2880, 0x2980, 0x2b00, 0x2c00, 0x2d00, 0x2e80, 0x2f80, 0x3100,
0x3200, 0x3380, 0x3480, 0x3600, 0x3700, 0x3880, 0x3a00, 0x3b00,
0x3c80, 0x3e00, 0x3f80, 0x4080, 0x4200, 0x4380, 0x4500, 0x4680,
0x4800, 0x4980, 0x4b00, 0x4c80, 0x4e00, 0x4f80, 0x5180, 0x5300,
0x5480, 0x5600, 0x5800, 0x5980, 0x5b00, 0x5d00, 0x5e80, 0x6080,
0x6200, 0x6400, 0x6580, 0x6780, 0x6900, 0x6b00, 0x6d00, 0x6e80,
0x7080, 0x7280, 0x7480, 0x7600, 0x7800, 0x7a00, 0x7c00, 0x7e00
};
static const OPJ_INT16 lut_nmsedec_ref[1U << T1_NMSEDEC_BITS] = {
0x1800, 0x1780, 0x1700, 0x1680, 0x1600, 0x1580, 0x1500, 0x1480,
0x1400, 0x1380, 0x1300, 0x1280, 0x1200, 0x1180, 0x1100, 0x1080,
0x1000, 0x0f80, 0x0f00, 0x0e80, 0x0e00, 0x0d80, 0x0d00, 0x0c80,
0x0c00, 0x0b80, 0x0b00, 0x0a80, 0x0a00, 0x0980, 0x0900, 0x0880,
0x0800, 0x0780, 0x0700, 0x0680, 0x0600, 0x0580, 0x0500, 0x0480,
0x0400, 0x0380, 0x0300, 0x0280, 0x0200, 0x0180, 0x0100, 0x0080,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0080, 0x0100, 0x0180, 0x0200, 0x0280, 0x0300, 0x0380,
0x0400, 0x0480, 0x0500, 0x0580, 0x0600, 0x0680, 0x0700, 0x0780,
0x0800, 0x0880, 0x0900, 0x0980, 0x0a00, 0x0a80, 0x0b00, 0x0b80,
0x0c00, 0x0c80, 0x0d00, 0x0d80, 0x0e00, 0x0e80, 0x0f00, 0x0f80,
0x1000, 0x1080, 0x1100, 0x1180, 0x1200, 0x1280, 0x1300, 0x1380,
0x1400, 0x1480, 0x1500, 0x1580, 0x1600, 0x1680, 0x1700, 0x1780
0x1800, 0x1780, 0x1700, 0x1680, 0x1600, 0x1580, 0x1500, 0x1480,
0x1400, 0x1380, 0x1300, 0x1280, 0x1200, 0x1180, 0x1100, 0x1080,
0x1000, 0x0f80, 0x0f00, 0x0e80, 0x0e00, 0x0d80, 0x0d00, 0x0c80,
0x0c00, 0x0b80, 0x0b00, 0x0a80, 0x0a00, 0x0980, 0x0900, 0x0880,
0x0800, 0x0780, 0x0700, 0x0680, 0x0600, 0x0580, 0x0500, 0x0480,
0x0400, 0x0380, 0x0300, 0x0280, 0x0200, 0x0180, 0x0100, 0x0080,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0080, 0x0100, 0x0180, 0x0200, 0x0280, 0x0300, 0x0380,
0x0400, 0x0480, 0x0500, 0x0580, 0x0600, 0x0680, 0x0700, 0x0780,
0x0800, 0x0880, 0x0900, 0x0980, 0x0a00, 0x0a80, 0x0b00, 0x0b80,
0x0c00, 0x0c80, 0x0d00, 0x0d80, 0x0e00, 0x0e80, 0x0f00, 0x0f80,
0x1000, 0x1080, 0x1100, 0x1180, 0x1200, 0x1280, 0x1300, 0x1380,
0x1400, 0x1480, 0x1500, 0x1580, 0x1600, 0x1680, 0x1700, 0x1780
};
static const OPJ_INT16 lut_nmsedec_ref0[1U << T1_NMSEDEC_BITS] = {
0x2000, 0x1f00, 0x1e00, 0x1d00, 0x1c00, 0x1b00, 0x1a80, 0x1980,
0x1880, 0x1780, 0x1700, 0x1600, 0x1500, 0x1480, 0x1380, 0x1300,
0x1200, 0x1180, 0x1080, 0x1000, 0x0f00, 0x0e80, 0x0e00, 0x0d00,
0x0c80, 0x0c00, 0x0b80, 0x0a80, 0x0a00, 0x0980, 0x0900, 0x0880,
0x0800, 0x0780, 0x0700, 0x0680, 0x0600, 0x0580, 0x0580, 0x0500,
0x0480, 0x0400, 0x0400, 0x0380, 0x0300, 0x0300, 0x0280, 0x0280,
0x0200, 0x0200, 0x0180, 0x0180, 0x0100, 0x0100, 0x0100, 0x0080,
0x0080, 0x0080, 0x0080, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0080, 0x0080,
0x0080, 0x0080, 0x0100, 0x0100, 0x0100, 0x0180, 0x0180, 0x0200,
0x0200, 0x0280, 0x0280, 0x0300, 0x0300, 0x0380, 0x0400, 0x0400,
0x0480, 0x0500, 0x0580, 0x0580, 0x0600, 0x0680, 0x0700, 0x0780,
0x0800, 0x0880, 0x0900, 0x0980, 0x0a00, 0x0a80, 0x0b80, 0x0c00,
0x0c80, 0x0d00, 0x0e00, 0x0e80, 0x0f00, 0x1000, 0x1080, 0x1180,
0x1200, 0x1300, 0x1380, 0x1480, 0x1500, 0x1600, 0x1700, 0x1780,
0x1880, 0x1980, 0x1a80, 0x1b00, 0x1c00, 0x1d00, 0x1e00, 0x1f00
0x2000, 0x1f00, 0x1e00, 0x1d00, 0x1c00, 0x1b00, 0x1a80, 0x1980,
0x1880, 0x1780, 0x1700, 0x1600, 0x1500, 0x1480, 0x1380, 0x1300,
0x1200, 0x1180, 0x1080, 0x1000, 0x0f00, 0x0e80, 0x0e00, 0x0d00,
0x0c80, 0x0c00, 0x0b80, 0x0a80, 0x0a00, 0x0980, 0x0900, 0x0880,
0x0800, 0x0780, 0x0700, 0x0680, 0x0600, 0x0580, 0x0580, 0x0500,
0x0480, 0x0400, 0x0400, 0x0380, 0x0300, 0x0300, 0x0280, 0x0280,
0x0200, 0x0200, 0x0180, 0x0180, 0x0100, 0x0100, 0x0100, 0x0080,
0x0080, 0x0080, 0x0080, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0080, 0x0080,
0x0080, 0x0080, 0x0100, 0x0100, 0x0100, 0x0180, 0x0180, 0x0200,
0x0200, 0x0280, 0x0280, 0x0300, 0x0300, 0x0380, 0x0400, 0x0400,
0x0480, 0x0500, 0x0580, 0x0580, 0x0600, 0x0680, 0x0700, 0x0780,
0x0800, 0x0880, 0x0900, 0x0980, 0x0a00, 0x0a80, 0x0b80, 0x0c00,
0x0c80, 0x0d00, 0x0e00, 0x0e80, 0x0f00, 0x1000, 0x1080, 0x1180,
0x1200, 0x1300, 0x1380, 0x1480, 0x1500, 0x1600, 0x1700, 0x1780,
0x1880, 0x1980, 0x1a80, 0x1b00, 0x1c00, 0x1d00, 0x1e00, 0x1f00
};

View File

@ -1,6 +1,6 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
@ -8,10 +8,10 @@
* Copyright (c) 2002-2014, Professor Benoit Macq
* Copyright (c) 2001-2003, David Janssens
* Copyright (c) 2002-2003, Yannick Verschueren
* Copyright (c) 2003-2007, Francois-Olivier Devaux
* Copyright (c) 2003-2007, Francois-Olivier Devaux
* Copyright (c) 2003-2014, Antonin Descampe
* Copyright (c) 2005, Herve Drolon, FreeImage Team
* Copyright (c) 2008, 2011-2012, Centre National d'Etudes Spatiales (CNES), FR
* Copyright (c) 2008, 2011-2012, Centre National d'Etudes Spatiales (CNES), FR
* Copyright (c) 2012, CS Systemes d'Information, France
* All rights reserved.
*
@ -52,10 +52,10 @@ Tier-2 coding
*/
typedef struct opj_t2 {
/** Encoding: pointer to the src image. Decoding: pointer to the dst image. */
opj_image_t *image;
/** pointer to the image coding parameters */
opj_cp_t *cp;
/** Encoding: pointer to the src image. Decoding: pointer to the dst image. */
opj_image_t *image;
/** pointer to the image coding parameters */
opj_cp_t *cp;
} opj_t2_t;
/** @name Exported functions */
@ -77,18 +77,18 @@ Encode the packets of a tile to a destination buffer
@param pino FIXME DOC
@param t2_mode If == 0 In Threshold calculation ,If == 1 Final pass
*/
OPJ_BOOL opj_t2_encode_packets( opj_t2_t* t2,
OPJ_UINT32 tileno,
opj_tcd_tile_t *tile,
OPJ_UINT32 maxlayers,
OPJ_BYTE *dest,
OPJ_UINT32 * p_data_written,
OPJ_UINT32 len,
opj_codestream_info_t *cstr_info,
OPJ_UINT32 tpnum,
OPJ_INT32 tppos,
OPJ_UINT32 pino,
J2K_T2_MODE t2_mode);
OPJ_BOOL opj_t2_encode_packets(opj_t2_t* t2,
OPJ_UINT32 tileno,
opj_tcd_tile_t *tile,
OPJ_UINT32 maxlayers,
OPJ_BYTE *dest,
OPJ_UINT32 * p_data_written,
OPJ_UINT32 len,
opj_codestream_info_t *cstr_info,
OPJ_UINT32 tpnum,
OPJ_INT32 tppos,
OPJ_UINT32 pino,
J2K_T2_MODE t2_mode);
/**
Decode the packets of a tile from a source buffer
@ -102,21 +102,21 @@ Decode the packets of a tile from a source buffer
@return FIXME DOC
*/
OPJ_BOOL opj_t2_decode_packets( opj_t2_t *t2,
OPJ_UINT32 tileno,
opj_tcd_tile_t *tile,
OPJ_BYTE *src,
OPJ_UINT32 * p_data_read,
OPJ_UINT32 len,
opj_codestream_index_t *cstr_info,
opj_event_mgr_t *p_manager);
OPJ_BOOL opj_t2_decode_packets(opj_t2_t *t2,
OPJ_UINT32 tileno,
opj_tcd_tile_t *tile,
OPJ_BYTE *src,
OPJ_UINT32 * p_data_read,
OPJ_UINT32 len,
opj_codestream_index_t *cstr_info,
opj_event_mgr_t *p_manager);
/**
* Creates a Tier 2 handle
*
* @param p_image Source or destination image
* @param p_cp Image coding parameters.
* @return a new T2 handle if successful, NULL otherwise.
* @param p_image Source or destination image
* @param p_cp Image coding parameters.
* @return a new T2 handle if successful, NULL otherwise.
*/
opj_t2_t* opj_t2_create(opj_image_t *p_image, opj_cp_t *p_cp);

View File

@ -1,6 +1,6 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
@ -8,10 +8,10 @@
* Copyright (c) 2002-2014, Professor Benoit Macq
* Copyright (c) 2001-2003, David Janssens
* Copyright (c) 2002-2003, Yannick Verschueren
* Copyright (c) 2003-2007, Francois-Olivier Devaux
* Copyright (c) 2003-2007, Francois-Olivier Devaux
* Copyright (c) 2003-2014, Antonin Descampe
* Copyright (c) 2005, Herve Drolon, FreeImage Team
* Copyright (c) 2008, 2011-2012, Centre National d'Etudes Spatiales (CNES), FR
* Copyright (c) 2008, 2011-2012, Centre National d'Etudes Spatiales (CNES), FR
* Copyright (c) 2012, CS Systemes d'Information, France
* All rights reserved.
*
@ -53,120 +53,129 @@ each other. The functions in TCD.C are used by other functions in J2K.C.
FIXME DOC
*/
typedef struct opj_tcd_seg {
OPJ_BYTE ** data;
OPJ_UINT32 dataindex;
OPJ_UINT32 numpasses;
OPJ_UINT32 real_num_passes;
OPJ_UINT32 len;
OPJ_UINT32 maxpasses;
OPJ_UINT32 numnewpasses;
OPJ_UINT32 newlen;
OPJ_BYTE ** data;
OPJ_UINT32 dataindex;
OPJ_UINT32 numpasses;
OPJ_UINT32 real_num_passes;
OPJ_UINT32 len;
OPJ_UINT32 maxpasses;
OPJ_UINT32 numnewpasses;
OPJ_UINT32 newlen;
} opj_tcd_seg_t;
/**
FIXME DOC
*/
typedef struct opj_tcd_pass {
OPJ_UINT32 rate;
OPJ_FLOAT64 distortiondec;
OPJ_UINT32 len;
OPJ_BITFIELD term : 1;
OPJ_UINT32 rate;
OPJ_FLOAT64 distortiondec;
OPJ_UINT32 len;
OPJ_BITFIELD term : 1;
} opj_tcd_pass_t;
/**
FIXME DOC
*/
typedef struct opj_tcd_layer {
OPJ_UINT32 numpasses; /* Number of passes in the layer */
OPJ_UINT32 len; /* len of information */
OPJ_FLOAT64 disto; /* add for index (Cfr. Marcela) */
OPJ_BYTE *data; /* data */
OPJ_UINT32 numpasses; /* Number of passes in the layer */
OPJ_UINT32 len; /* len of information */
OPJ_FLOAT64 disto; /* add for index (Cfr. Marcela) */
OPJ_BYTE *data; /* data */
} opj_tcd_layer_t;
/**
FIXME DOC
*/
typedef struct opj_tcd_cblk_enc {
OPJ_BYTE* data; /* Data */
opj_tcd_layer_t* layers; /* layer information */
opj_tcd_pass_t* passes; /* information about the passes */
OPJ_INT32 x0, y0, x1, y1; /* dimension of the code-blocks : left upper corner (x0, y0) right low corner (x1,y1) */
OPJ_UINT32 numbps;
OPJ_UINT32 numlenbits;
OPJ_UINT32 data_size; /* Size of allocated data buffer */
OPJ_UINT32 numpasses; /* number of pass already done for the code-blocks */
OPJ_UINT32 numpassesinlayers; /* number of passes in the layer */
OPJ_UINT32 totalpasses; /* total number of passes */
OPJ_BYTE* data; /* Data */
opj_tcd_layer_t* layers; /* layer information */
opj_tcd_pass_t* passes; /* information about the passes */
OPJ_INT32 x0, y0, x1,
y1; /* dimension of the code-blocks : left upper corner (x0, y0) right low corner (x1,y1) */
OPJ_UINT32 numbps;
OPJ_UINT32 numlenbits;
OPJ_UINT32 data_size; /* Size of allocated data buffer */
OPJ_UINT32
numpasses; /* number of pass already done for the code-blocks */
OPJ_UINT32 numpassesinlayers; /* number of passes in the layer */
OPJ_UINT32 totalpasses; /* total number of passes */
} opj_tcd_cblk_enc_t;
typedef struct opj_tcd_cblk_dec {
OPJ_BYTE * data; /* Data */
opj_tcd_seg_t* segs; /* segments information */
OPJ_INT32 x0, y0, x1, y1; /* position of the code-blocks : left upper corner (x0, y0) right low corner (x1,y1) */
OPJ_UINT32 numbps;
OPJ_UINT32 numlenbits;
OPJ_UINT32 data_max_size; /* Size of allocated data buffer */
OPJ_UINT32 data_current_size; /* Size of used data buffer */
OPJ_UINT32 numnewpasses; /* number of pass added to the code-blocks */
OPJ_UINT32 numsegs; /* number of segments */
OPJ_UINT32 real_num_segs;
OPJ_UINT32 m_current_max_segs;
OPJ_BYTE * data; /* Data */
opj_tcd_seg_t* segs; /* segments information */
OPJ_INT32 x0, y0, x1,
y1; /* position of the code-blocks : left upper corner (x0, y0) right low corner (x1,y1) */
OPJ_UINT32 numbps;
OPJ_UINT32 numlenbits;
OPJ_UINT32 data_max_size; /* Size of allocated data buffer */
OPJ_UINT32 data_current_size; /* Size of used data buffer */
OPJ_UINT32 numnewpasses; /* number of pass added to the code-blocks */
OPJ_UINT32 numsegs; /* number of segments */
OPJ_UINT32 real_num_segs;
OPJ_UINT32 m_current_max_segs;
} opj_tcd_cblk_dec_t;
/**
FIXME DOC
*/
typedef struct opj_tcd_precinct {
OPJ_INT32 x0, y0, x1, y1; /* dimension of the precinct : left upper corner (x0, y0) right low corner (x1,y1) */
OPJ_UINT32 cw, ch; /* number of precinct in width and height */
union{ /* code-blocks information */
opj_tcd_cblk_enc_t* enc;
opj_tcd_cblk_dec_t* dec;
void* blocks;
} cblks;
OPJ_UINT32 block_size; /* size taken by cblks (in bytes) */
opj_tgt_tree_t *incltree; /* inclusion tree */
opj_tgt_tree_t *imsbtree; /* IMSB tree */
OPJ_INT32 x0, y0, x1,
y1; /* dimension of the precinct : left upper corner (x0, y0) right low corner (x1,y1) */
OPJ_UINT32 cw, ch; /* number of precinct in width and height */
union { /* code-blocks information */
opj_tcd_cblk_enc_t* enc;
opj_tcd_cblk_dec_t* dec;
void* blocks;
} cblks;
OPJ_UINT32 block_size; /* size taken by cblks (in bytes) */
opj_tgt_tree_t *incltree; /* inclusion tree */
opj_tgt_tree_t *imsbtree; /* IMSB tree */
} opj_tcd_precinct_t;
/**
FIXME DOC
*/
typedef struct opj_tcd_band {
OPJ_INT32 x0, y0, x1, y1; /* dimension of the subband : left upper corner (x0, y0) right low corner (x1,y1) */
OPJ_UINT32 bandno;
opj_tcd_precinct_t *precincts; /* precinct information */
OPJ_UINT32 precincts_data_size; /* size of data taken by precincts */
OPJ_INT32 numbps;
OPJ_FLOAT32 stepsize;
OPJ_INT32 x0, y0, x1,
y1; /* dimension of the subband : left upper corner (x0, y0) right low corner (x1,y1) */
OPJ_UINT32 bandno;
opj_tcd_precinct_t *precincts; /* precinct information */
OPJ_UINT32 precincts_data_size; /* size of data taken by precincts */
OPJ_INT32 numbps;
OPJ_FLOAT32 stepsize;
} opj_tcd_band_t;
/**
FIXME DOC
*/
typedef struct opj_tcd_resolution {
OPJ_INT32 x0, y0, x1, y1; /* dimension of the resolution level : left upper corner (x0, y0) right low corner (x1,y1) */
OPJ_UINT32 pw, ph;
OPJ_UINT32 numbands; /* number sub-band for the resolution level */
opj_tcd_band_t bands[3]; /* subband information */
OPJ_INT32 x0, y0, x1,
y1; /* dimension of the resolution level : left upper corner (x0, y0) right low corner (x1,y1) */
OPJ_UINT32 pw, ph;
OPJ_UINT32 numbands; /* number sub-band for the resolution level */
opj_tcd_band_t bands[3]; /* subband information */
} opj_tcd_resolution_t;
/**
FIXME DOC
*/
typedef struct opj_tcd_tilecomp
{
OPJ_INT32 x0, y0, x1, y1; /* dimension of component : left upper corner (x0, y0) right low corner (x1,y1) */
OPJ_UINT32 numresolutions; /* number of resolutions level */
OPJ_UINT32 minimum_num_resolutions; /* number of resolutions level to decode (at max)*/
opj_tcd_resolution_t *resolutions; /* resolutions information */
OPJ_UINT32 resolutions_size; /* size of data for resolutions (in bytes) */
OPJ_INT32 *data; /* data of the component */
OPJ_BOOL ownsData; /* if true, then need to free after usage, otherwise do not free */
OPJ_UINT32 data_size_needed; /* we may either need to allocate this amount of data, or re-use image data and ignore this value */
OPJ_UINT32 data_size; /* size of the data of the component */
OPJ_INT32 numpix; /* add fixed_quality */
typedef struct opj_tcd_tilecomp {
OPJ_INT32 x0, y0, x1,
y1; /* dimension of component : left upper corner (x0, y0) right low corner (x1,y1) */
OPJ_UINT32 numresolutions; /* number of resolutions level */
OPJ_UINT32
minimum_num_resolutions; /* number of resolutions level to decode (at max)*/
opj_tcd_resolution_t *resolutions; /* resolutions information */
OPJ_UINT32
resolutions_size; /* size of data for resolutions (in bytes) */
OPJ_INT32 *data; /* data of the component */
OPJ_BOOL ownsData; /* if true, then need to free after usage, otherwise do not free */
OPJ_UINT32
data_size_needed; /* we may either need to allocate this amount of data, or re-use image data and ignore this value */
OPJ_UINT32 data_size; /* size of the data of the component */
OPJ_INT32 numpix; /* add fixed_quality */
} opj_tcd_tilecomp_t;
@ -174,21 +183,21 @@ typedef struct opj_tcd_tilecomp
FIXME DOC
*/
typedef struct opj_tcd_tile {
OPJ_INT32 x0, y0, x1, y1; /* dimension of the tile : left upper corner (x0, y0) right low corner (x1,y1) */
OPJ_UINT32 numcomps; /* number of components in tile */
opj_tcd_tilecomp_t *comps; /* Components information */
OPJ_INT32 numpix; /* add fixed_quality */
OPJ_FLOAT64 distotile; /* add fixed_quality */
OPJ_FLOAT64 distolayer[100]; /* add fixed_quality */
OPJ_UINT32 packno; /* packet number */
OPJ_INT32 x0, y0, x1,
y1; /* dimension of the tile : left upper corner (x0, y0) right low corner (x1,y1) */
OPJ_UINT32 numcomps; /* number of components in tile */
opj_tcd_tilecomp_t *comps; /* Components information */
OPJ_INT32 numpix; /* add fixed_quality */
OPJ_FLOAT64 distotile; /* add fixed_quality */
OPJ_FLOAT64 distolayer[100]; /* add fixed_quality */
OPJ_UINT32 packno; /* packet number */
} opj_tcd_tile_t;
/**
FIXME DOC
*/
typedef struct opj_tcd_image
{
opj_tcd_tile_t *tiles; /* Tiles information */
typedef struct opj_tcd_image {
opj_tcd_tile_t *tiles; /* Tiles information */
}
opj_tcd_image_t;
@ -196,29 +205,28 @@ opj_tcd_image_t;
/**
Tile coder/decoder
*/
typedef struct opj_tcd
{
/** Position of the tilepart flag in Progression order*/
OPJ_INT32 tp_pos;
/** Tile part number*/
OPJ_UINT32 tp_num;
/** Current tile part number*/
OPJ_UINT32 cur_tp_num;
/** Total number of tileparts of the current tile*/
OPJ_UINT32 cur_totnum_tp;
/** Current Packet iterator number */
OPJ_UINT32 cur_pino;
/** info on each image tile */
opj_tcd_image_t *tcd_image;
/** image header */
opj_image_t *image;
/** coding parameters */
opj_cp_t *cp;
/** coding/decoding parameters common to all tiles */
opj_tcp_t *tcp;
/** current encoded/decoded tile */
OPJ_UINT32 tcd_tileno;
/** tell if the tcd is a decoder. */
typedef struct opj_tcd {
/** Position of the tilepart flag in Progression order*/
OPJ_INT32 tp_pos;
/** Tile part number*/
OPJ_UINT32 tp_num;
/** Current tile part number*/
OPJ_UINT32 cur_tp_num;
/** Total number of tileparts of the current tile*/
OPJ_UINT32 cur_totnum_tp;
/** Current Packet iterator number */
OPJ_UINT32 cur_pino;
/** info on each image tile */
opj_tcd_image_t *tcd_image;
/** image header */
opj_image_t *image;
/** coding parameters */
opj_cp_t *cp;
/** coding/decoding parameters common to all tiles */
opj_tcp_t *tcp;
/** current encoded/decoded tile */
OPJ_UINT32 tcd_tileno;
/** tell if the tcd is a decoder. */
OPJ_BITFIELD m_is_decoder : 1;
/** Thread pool */
opj_thread_pool_t* thread_pool;
@ -231,7 +239,7 @@ typedef struct opj_tcd
/**
Dump the content of a tcd structure
*/
/*void tcd_dump(FILE *fd, opj_tcd_t *tcd, opj_tcd_image_t *img);*/ /* TODO MSD shoul use the new v2 structures */
/*void tcd_dump(FILE *fd, opj_tcd_t *tcd, opj_tcd_image_t *img);*/ /* TODO MSD shoul use the new v2 structures */
/**
Create a new TCD handle
@ -248,66 +256,68 @@ void opj_tcd_destroy(opj_tcd_t *tcd);
/**
* Initialize the tile coder and may reuse some memory.
* @param p_tcd TCD handle.
* @param p_image raw image.
* @param p_cp coding parameters.
* @param p_tcd TCD handle.
* @param p_image raw image.
* @param p_cp coding parameters.
* @param p_tp thread pool
*
* @return true if the encoding values could be set (false otherwise).
*/
OPJ_BOOL opj_tcd_init( opj_tcd_t *p_tcd,
opj_image_t * p_image,
opj_cp_t * p_cp,
opj_thread_pool_t* p_tp);
OPJ_BOOL opj_tcd_init(opj_tcd_t *p_tcd,
opj_image_t * p_image,
opj_cp_t * p_cp,
opj_thread_pool_t* p_tp);
/**
* Allocates memory for decoding a specific tile.
*
* @param p_tcd the tile decoder.
* @param p_tile_no the index of the tile received in sequence. This not necessarily lead to the
* @param p_tcd the tile decoder.
* @param p_tile_no the index of the tile received in sequence. This not necessarily lead to the
* tile at index p_tile_no.
* @param p_manager the event manager.
*
* @return true if the remaining data is sufficient.
* @return true if the remaining data is sufficient.
*/
OPJ_BOOL opj_tcd_init_decode_tile(opj_tcd_t *p_tcd, OPJ_UINT32 p_tile_no, opj_event_mgr_t* p_manager);
OPJ_BOOL opj_tcd_init_decode_tile(opj_tcd_t *p_tcd, OPJ_UINT32 p_tile_no,
opj_event_mgr_t* p_manager);
void opj_tcd_makelayer_fixed(opj_tcd_t *tcd, OPJ_UINT32 layno, OPJ_UINT32 final);
void opj_tcd_makelayer_fixed(opj_tcd_t *tcd, OPJ_UINT32 layno,
OPJ_UINT32 final);
void opj_tcd_rateallocate_fixed(opj_tcd_t *tcd);
void opj_tcd_makelayer( opj_tcd_t *tcd,
OPJ_UINT32 layno,
OPJ_FLOAT64 thresh,
OPJ_UINT32 final);
void opj_tcd_makelayer(opj_tcd_t *tcd,
OPJ_UINT32 layno,
OPJ_FLOAT64 thresh,
OPJ_UINT32 final);
OPJ_BOOL opj_tcd_rateallocate( opj_tcd_t *tcd,
OPJ_BYTE *dest,
OPJ_UINT32 * p_data_written,
OPJ_UINT32 len,
opj_codestream_info_t *cstr_info);
OPJ_BOOL opj_tcd_rateallocate(opj_tcd_t *tcd,
OPJ_BYTE *dest,
OPJ_UINT32 * p_data_written,
OPJ_UINT32 len,
opj_codestream_info_t *cstr_info);
/**
* Gets the maximum tile size that will be taken by the tile once decoded.
*/
OPJ_UINT32 opj_tcd_get_decoded_tile_size (opj_tcd_t *p_tcd );
OPJ_UINT32 opj_tcd_get_decoded_tile_size(opj_tcd_t *p_tcd);
/**
* Encodes a tile from the raw image into the given buffer.
* @param p_tcd Tile Coder handle
* @param p_tile_no Index of the tile to encode.
* @param p_dest Destination buffer
* @param p_data_written pointer to an int that is incremented by the number of bytes really written on p_dest
* @param p_len Maximum length of the destination buffer
* @param p_cstr_info Codestream information structure
* @param p_tcd Tile Coder handle
* @param p_tile_no Index of the tile to encode.
* @param p_dest Destination buffer
* @param p_data_written pointer to an int that is incremented by the number of bytes really written on p_dest
* @param p_len Maximum length of the destination buffer
* @param p_cstr_info Codestream information structure
* @return true if the coding is successful.
*/
OPJ_BOOL opj_tcd_encode_tile( opj_tcd_t *p_tcd,
OPJ_UINT32 p_tile_no,
OPJ_BYTE *p_dest,
OPJ_UINT32 * p_data_written,
OPJ_UINT32 p_len,
struct opj_codestream_info *p_cstr_info);
OPJ_BOOL opj_tcd_encode_tile(opj_tcd_t *p_tcd,
OPJ_UINT32 p_tile_no,
OPJ_BYTE *p_dest,
OPJ_UINT32 * p_data_written,
OPJ_UINT32 p_len,
struct opj_codestream_info *p_cstr_info);
/**
@ -319,44 +329,44 @@ Decode a tile from a buffer into a raw image
@param cstr_info FIXME DOC
@param manager the event manager.
*/
OPJ_BOOL opj_tcd_decode_tile( opj_tcd_t *tcd,
OPJ_BYTE *src,
OPJ_UINT32 len,
OPJ_UINT32 tileno,
opj_codestream_index_t *cstr_info,
opj_event_mgr_t *manager);
OPJ_BOOL opj_tcd_decode_tile(opj_tcd_t *tcd,
OPJ_BYTE *src,
OPJ_UINT32 len,
OPJ_UINT32 tileno,
opj_codestream_index_t *cstr_info,
opj_event_mgr_t *manager);
/**
* Copies tile data from the system onto the given memory block.
*/
OPJ_BOOL opj_tcd_update_tile_data ( opj_tcd_t *p_tcd,
OPJ_BYTE * p_dest,
OPJ_UINT32 p_dest_length );
OPJ_BOOL opj_tcd_update_tile_data(opj_tcd_t *p_tcd,
OPJ_BYTE * p_dest,
OPJ_UINT32 p_dest_length);
/**
*
*/
OPJ_UINT32 opj_tcd_get_encoded_tile_size ( opj_tcd_t *p_tcd );
OPJ_UINT32 opj_tcd_get_encoded_tile_size(opj_tcd_t *p_tcd);
/**
* Initialize the tile coder and may reuse some meory.
*
* @param p_tcd TCD handle.
* @param p_tile_no current tile index to encode.
* @param p_tcd TCD handle.
* @param p_tile_no current tile index to encode.
* @param p_manager the event manager.
*
* @return true if the encoding values could be set (false otherwise).
*/
OPJ_BOOL opj_tcd_init_encode_tile ( opj_tcd_t *p_tcd,
OPJ_UINT32 p_tile_no, opj_event_mgr_t* p_manager );
OPJ_BOOL opj_tcd_init_encode_tile(opj_tcd_t *p_tcd,
OPJ_UINT32 p_tile_no, opj_event_mgr_t* p_manager);
/**
* Copies tile data from the given memory block onto the system.
*/
OPJ_BOOL opj_tcd_copy_tile_data (opj_tcd_t *p_tcd,
OPJ_BYTE * p_src,
OPJ_UINT32 p_src_length );
OPJ_BOOL opj_tcd_copy_tile_data(opj_tcd_t *p_tcd,
OPJ_BYTE * p_src,
OPJ_UINT32 p_src_length);
/**
* Allocates tile component data

View File

@ -1,6 +1,6 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
@ -8,11 +8,11 @@
* Copyright (c) 2002-2014, Professor Benoit Macq
* Copyright (c) 2001-2003, David Janssens
* Copyright (c) 2002-2003, Yannick Verschueren
* Copyright (c) 2003-2007, Francois-Olivier Devaux
* Copyright (c) 2003-2007, Francois-Olivier Devaux
* Copyright (c) 2003-2014, Antonin Descampe
* Copyright (c) 2005, Herve Drolon, FreeImage Team
* Copyright (c) 2008, Jerome Fimes, Communications & Systemes <jerome.fimes@c-s.fr>
* Copyright (c) 2011-2012, Centre National d'Etudes Spatiales (CNES), France
* Copyright (c) 2011-2012, Centre National d'Etudes Spatiales (CNES), France
* Copyright (c) 2012, CS Systemes d'Information, France
* All rights reserved.
*
@ -64,13 +64,12 @@ typedef struct opj_tgt_node {
/**
Tag tree
*/
typedef struct opj_tgt_tree
{
OPJ_UINT32 numleafsh;
OPJ_UINT32 numleafsv;
OPJ_UINT32 numnodes;
opj_tgt_node_t *nodes;
OPJ_UINT32 nodes_size; /* maximum size taken by nodes */
typedef struct opj_tgt_tree {
OPJ_UINT32 numleafsh;
OPJ_UINT32 numleafsv;
OPJ_UINT32 numnodes;
opj_tgt_node_t *nodes;
OPJ_UINT32 nodes_size; /* maximum size taken by nodes */
} opj_tgt_tree_t;
@ -83,19 +82,20 @@ Create a tag-tree
@param numleafsv Height of the array of leafs of the tree
@return Returns a new tag-tree if successful, returns NULL otherwise
*/
opj_tgt_tree_t *opj_tgt_create(OPJ_UINT32 numleafsh, OPJ_UINT32 numleafsv, opj_event_mgr_t *manager);
opj_tgt_tree_t *opj_tgt_create(OPJ_UINT32 numleafsh, OPJ_UINT32 numleafsv,
opj_event_mgr_t *manager);
/**
* Reinitialises a tag-tree from an exixting one.
*
* @param p_tree the tree to reinitialize.
* @param p_num_leafs_h the width of the array of leafs of the tree
* @param p_num_leafs_v the height of the array of leafs of the tree
* @param p_tree the tree to reinitialize.
* @param p_num_leafs_h the width of the array of leafs of the tree
* @param p_num_leafs_v the height of the array of leafs of the tree
* @param p_manager the event manager
* @return a new tag-tree if successful, NULL otherwise
* @return a new tag-tree if successful, NULL otherwise
*/
opj_tgt_tree_t *opj_tgt_init(opj_tgt_tree_t * p_tree,
OPJ_UINT32 p_num_leafs_h,
opj_tgt_tree_t *opj_tgt_init(opj_tgt_tree_t * p_tree,
OPJ_UINT32 p_num_leafs_h,
OPJ_UINT32 p_num_leafs_v, opj_event_mgr_t *p_manager);
/**
Destroy a tag-tree, liberating memory
@ -113,8 +113,8 @@ Set the value of a leaf of a tag-tree
@param leafno Number that identifies the leaf to modify
@param value New value of the leaf
*/
void opj_tgt_setvalue(opj_tgt_tree_t *tree,
OPJ_UINT32 leafno,
void opj_tgt_setvalue(opj_tgt_tree_t *tree,
OPJ_UINT32 leafno,
OPJ_INT32 value);
/**
Encode the value of a leaf of the tag-tree up to a given threshold
@ -123,9 +123,9 @@ Encode the value of a leaf of the tag-tree up to a given threshold
@param leafno Number that identifies the leaf to encode
@param threshold Threshold to use when encoding value of the leaf
*/
void opj_tgt_encode(opj_bio_t *bio,
opj_tgt_tree_t *tree,
OPJ_UINT32 leafno,
void opj_tgt_encode(opj_bio_t *bio,
opj_tgt_tree_t *tree,
OPJ_UINT32 leafno,
OPJ_INT32 threshold);
/**
Decode the value of a leaf of the tag-tree up to a given threshold
@ -135,9 +135,9 @@ Decode the value of a leaf of the tag-tree up to a given threshold
@param threshold Threshold to use when decoding value of the leaf
@return Returns 1 if the node's value < threshold, returns 0 otherwise
*/
OPJ_UINT32 opj_tgt_decode(opj_bio_t *bio,
opj_tgt_tree_t *tree,
OPJ_UINT32 leafno,
OPJ_UINT32 opj_tgt_decode(opj_bio_t *bio,
opj_tgt_tree_t *tree,
OPJ_UINT32 leafno,
OPJ_INT32 threshold);
/* ----------------------------------------------------------------------- */
/*@}*/

View File

@ -1,6 +1,6 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
@ -151,13 +151,13 @@ typedef void (*opj_thread_fn)(void* user_data);
* @return a thread handle or NULL in case of failure (can for example happen if the library
* is built without thread support)
*/
opj_thread_t* opj_thread_create( opj_thread_fn thread_fn, void* user_data );
opj_thread_t* opj_thread_create(opj_thread_fn thread_fn, void* user_data);
/** Wait for a thread to be finished and release associated resources to the
* thread handle.
* @param thread the thread to wait for being finished.
*/
void opj_thread_join( opj_thread_t* thread );
void opj_thread_join(opj_thread_t* thread);
/*@}*/
@ -180,10 +180,11 @@ typedef void (*opj_tls_free_func)(void* value);
* @param tls thread local storage handle
* @param key key whose value to set.
* @param value value to set (may be NULL).
* @param free_func function to call currently installed value.
* @param free_func function to call currently installed value.
* @return OPJ_TRUE if successful.
*/
OPJ_BOOL opj_tls_set(opj_tls_t* tls, int key, void* value, opj_tls_free_func free_func);
OPJ_BOOL opj_tls_set(opj_tls_t* tls, int key, void* value,
opj_tls_free_func free_func);
/*@}*/
@ -221,7 +222,8 @@ typedef void (*opj_job_fn)(void* user_data, opj_tls_t* tls);
* @param user_data User data provided to thread_fn.
* @return OPJ_TRUE if the job was successfully submitted.
*/
OPJ_BOOL opj_thread_pool_submit_job(opj_thread_pool_t* tp, opj_job_fn job_fn, void* user_data);
OPJ_BOOL opj_thread_pool_submit_job(opj_thread_pool_t* tp, opj_job_fn job_fn,
void* user_data);
/** Wait that no more than max_remaining_jobs jobs are remaining in the queue of
* the thread pool. The aim of this function is to avoid submitting too many
@ -232,7 +234,8 @@ OPJ_BOOL opj_thread_pool_submit_job(opj_thread_pool_t* tp, opj_job_fn job_fn, vo
* @param tp the thread pool handle
* @param max_remaining_jobs maximum number of jobs allowed to be queued without waiting.
*/
void opj_thread_pool_wait_completion(opj_thread_pool_t* tp, int max_remaining_jobs);
void opj_thread_pool_wait_completion(opj_thread_pool_t* tp,
int max_remaining_jobs);
/** Return the number of threads associated with the thread pool.
*

View File

@ -1,6 +1,6 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*

View File

@ -1,6 +1,6 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
@ -35,7 +35,7 @@
#ifndef __BIO_H
#define __BIO_H
/**
/**
@file bio.h
@brief Implementation of an individual bit input-output (BIO)
@ -49,23 +49,23 @@ The functions in BIO.C have for goal to realize an individual bit input - output
Individual bit input-output stream (BIO)
*/
typedef struct opj_bio {
/** pointer to the start of the buffer */
unsigned char *start;
/** pointer to the end of the buffer */
unsigned char *end;
/** pointer to the present position in the buffer */
unsigned char *bp;
/** temporary place where each byte is read or written */
unsigned int buf;
/** coder : number of bits free to write. decoder : number of bits read */
int ct;
/** pointer to the start of the buffer */
unsigned char *start;
/** pointer to the end of the buffer */
unsigned char *end;
/** pointer to the present position in the buffer */
unsigned char *bp;
/** temporary place where each byte is read or written */
unsigned int buf;
/** coder : number of bits free to write. decoder : number of bits read */
int ct;
} opj_bio_t;
/** @name Funciones generales */
/*@{*/
/* ----------------------------------------------------------------------- */
/**
Create a new BIO handle
Create a new BIO handle
@return Returns a new BIO handle if successful, returns NULL otherwise
*/
opj_bio_t* bio_create(void);
@ -84,14 +84,14 @@ int bio_numbytes(opj_bio_t *bio);
Init encoder
@param bio BIO handle
@param bp Output buffer
@param len Output buffer length
@param len Output buffer length
*/
void bio_init_enc(opj_bio_t *bio, unsigned char *bp, int len);
/**
Init decoder
@param bio BIO handle
@param bp Input buffer
@param len Input buffer length
@param len Input buffer length
*/
void bio_init_dec(opj_bio_t *bio, unsigned char *bp, int len);
/**
@ -104,7 +104,7 @@ void bio_write(opj_bio_t *bio, int v, int n);
/**
Read bits
@param bio BIO handle
@param n Number of bits to read
@param n Number of bits to read
@return Returns the corresponding read number
*/
int bio_read(opj_bio_t *bio, int n);

View File

@ -1,6 +1,6 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*

View File

@ -1,6 +1,6 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
@ -54,10 +54,10 @@ DCCS-LIWT properties
typedef struct opj_wtfilt {
double *LPS;
int lenLPS;
double *HPS;
int lenHPS;
double *LPS;
int lenLPS;
double *HPS;
int lenHPS;
} opj_wtfilt_t;
/** @name Funciones generales */
/*@{*/

View File

@ -1,6 +1,6 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
@ -37,9 +37,9 @@
The functions in EVENT.C have for goal to send output messages (errors, warnings, debug) to the user.
*/
#define EVT_ERROR 1 /**< Error event type */
#define EVT_WARNING 2 /**< Warning event type */
#define EVT_INFO 4 /**< Debug event type */
#define EVT_ERROR 1 /**< Error event type */
#define EVT_WARNING 2 /**< Warning event type */
#define EVT_INFO 4 /**< Debug event type */
/** @defgroup EVENT EVENT - Implementation of a event callback system */
/*@{*/
@ -48,7 +48,7 @@ The functions in EVENT.C have for goal to send output messages (errors, warnings
/*@{*/
/* ----------------------------------------------------------------------- */
/**
Write formatted data to a string and send the string to a user callback.
Write formatted data to a string and send the string to a user callback.
@param cinfo Codec context info
@param event_type Event type or callback to use to send the message
@param fmt Format-control string (plus optionnal arguments)

View File

@ -1,6 +1,6 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
@ -57,9 +57,10 @@ Multiply two fixed-precision rational numbers.
@param b
@return Returns a * b
*/
static int fix_mul(int a, int b) {
static int fix_mul(int a, int b)
{
int64 temp = (int64) a * (int64) b >> 12;
return (int) ((temp >> 1) + (temp & 1)) ;
return (int)((temp >> 1) + (temp & 1)) ;
}
/*@}*/

View File

@ -1,6 +1,6 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
@ -51,15 +51,17 @@ The functions in INT.H have for goal to realize operations on integers.
Get the minimum of two integers
@return Returns a if a < b else b
*/
static int int_min(int a, int b) {
return a < b ? a : b;
static int int_min(int a, int b)
{
return a < b ? a : b;
}
/**
Get the maximum of two integers
@return Returns a if a > b else b
*/
static int int_max(int a, int b) {
return (a > b) ? a : b;
static int int_max(int a, int b)
{
return (a > b) ? a : b;
}
/**
Clamp an integer inside an interval
@ -67,57 +69,66 @@ Clamp an integer inside an interval
<ul>
<li>Returns a if (min < a < max)
<li>Returns max if (a > max)
<li>Returns min if (a < min)
<li>Returns min if (a < min)
</ul>
*/
static int int_clamp(int a, int min, int max) {
if (a < min)
return min;
if (a > max)
return max;
return a;
static int int_clamp(int a, int min, int max)
{
if (a < min) {
return min;
}
if (a > max) {
return max;
}
return a;
}
/**
@return Get absolute value of integer
*/
static int int_abs(int a) {
return a < 0 ? -a : a;
static int int_abs(int a)
{
return a < 0 ? -a : a;
}
static double dbl_abs(double a) {
return a < 0 ? -a : a;
static double dbl_abs(double a)
{
return a < 0 ? -a : a;
}
/**
Divide an integer and round upwards
@return Returns a divided by b
*/
static int int_ceildiv(int a, int b) {
return (a + b - 1) / b;
static int int_ceildiv(int a, int b)
{
return (a + b - 1) / b;
}
/**
Divide an integer by a power of 2 and round upwards
@return Returns a divided by 2^b
*/
static int int_ceildivpow2(int a, int b) {
return (a + (1 << b) - 1) >> b;
static int int_ceildivpow2(int a, int b)
{
return (a + (1 << b) - 1) >> b;
}
/**
Divide an integer by a power of 2 and round downwards
@return Returns a divided by 2^b
*/
static int int_floordivpow2(int a, int b) {
return a >> b;
static int int_floordivpow2(int a, int b)
{
return a >> b;
}
/**
Get logarithm of an integer and round downwards
@return Returns log2(a)
*/
static int int_floorlog2(int a) {
int l;
for (l = 0; a > 1; l++) {
a >>= 1;
}
return l;
static int int_floorlog2(int a)
{
int l;
for (l = 0; a > 1; l++) {
a >>= 1;
}
return l;
}
/* ----------------------------------------------------------------------- */
/*@}*/

View File

@ -1,6 +1,6 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
@ -50,55 +50,55 @@ The functions in J3D.C have for goal to read/write the several parts of the code
#define J3D_CP_CSTY_EPH 0x04
#define J3D_CCP_CSTY_PRT 0x01
/** Table A-8 */
#define J3D_CCP_CBLKSTY_LAZY 0x01 /* Selective arithmetic coding bypass */
#define J3D_CCP_CBLKSTY_LAZY 0x01 /* Selective arithmetic coding bypass */
#define J3D_CCP_CBLKSTY_RESET 0x02 /* Reset context probabilities on coding pass boundaries */
#define J3D_CCP_CBLKSTY_TERMALL 0x04 /* Termination on each coding pass */
#define J3D_CCP_CBLKSTY_VSC 0x08 /* Vertically causal context, add also hook for switching off and on 3D context models */
#define J3D_CCP_CBLKSTY_PTERM 0x10 /* Predictable termination */
#define J3D_CCP_CBLKSTY_SEGSYM 0x20 /* Segmentation symbols are used */
#define J3D_CCP_CBLKSTY_VSC 0x08 /* Vertically causal context, add also hook for switching off and on 3D context models */
#define J3D_CCP_CBLKSTY_PTERM 0x10 /* Predictable termination */
#define J3D_CCP_CBLKSTY_SEGSYM 0x20 /* Segmentation symbols are used */
#define J3D_CCP_CBLKSTY_3DCTXT 0x40 /* 3D context models (3D-EBCOT) vs 2D context models */
#define J3D_CCP_QNTSTY_NOQNT 0 /* Quantization style : no quantization */
#define J3D_CCP_QNTSTY_SIQNT 1 /* Quantization style : scalar derived (values signalled only in LLL subband) */
#define J3D_CCP_QNTSTY_SEQNT 2 /* Quantization style : scalar expounded (values signalled for each subband) */
#define J3D_CCP_QNTSTY_NOQNT 0 /* Quantization style : no quantization */
#define J3D_CCP_QNTSTY_SIQNT 1 /* Quantization style : scalar derived (values signalled only in LLL subband) */
#define J3D_CCP_QNTSTY_SEQNT 2 /* Quantization style : scalar expounded (values signalled for each subband) */
/* ----------------------------------------------------------------------- */
#define J3D_MS_SOC 0xff4f /**< SOC marker value */
#define J3D_MS_SOT 0xff90 /**< SOT marker value */
#define J3D_MS_SOD 0xff93 /**< SOD marker value */
#define J3D_MS_EOC 0xffd9 /**< EOC marker value */
#define J3D_MS_CAP 0xff50 /**< CAP marker value */
#define J3D_MS_SIZ 0xff51 /**< SIZ marker value */
#define J3D_MS_NSI 0xff54 /**< NSI marker value */
#define J3D_MS_COD 0xff52 /**< COD marker value */
#define J3D_MS_COC 0xff53 /**< COC marker value */
#define J3D_MS_RGN 0xff5e /**< RGN marker value */
#define J3D_MS_QCD 0xff5c /**< QCD marker value */
#define J3D_MS_QCC 0xff5d /**< QCC marker value */
#define J3D_MS_POC 0xff5f /**< POC marker value */
#define J3D_MS_TLM 0xff55 /**< TLM marker value */
#define J3D_MS_PLM 0xff57 /**< PLM marker value */
#define J3D_MS_PLT 0xff58 /**< PLT marker value */
#define J3D_MS_PPM 0xff60 /**< PPM marker value */
#define J3D_MS_PPT 0xff61 /**< PPT marker value */
#define J3D_MS_SOP 0xff91 /**< SOP marker value */
#define J3D_MS_EPH 0xff92 /**< EPH marker value */
#define J3D_MS_CRG 0xff63 /**< CRG marker value */
#define J3D_MS_COM 0xff64 /**< COM marker value */
#define J3D_MS_SOC 0xff4f /**< SOC marker value */
#define J3D_MS_SOT 0xff90 /**< SOT marker value */
#define J3D_MS_SOD 0xff93 /**< SOD marker value */
#define J3D_MS_EOC 0xffd9 /**< EOC marker value */
#define J3D_MS_CAP 0xff50 /**< CAP marker value */
#define J3D_MS_SIZ 0xff51 /**< SIZ marker value */
#define J3D_MS_NSI 0xff54 /**< NSI marker value */
#define J3D_MS_COD 0xff52 /**< COD marker value */
#define J3D_MS_COC 0xff53 /**< COC marker value */
#define J3D_MS_RGN 0xff5e /**< RGN marker value */
#define J3D_MS_QCD 0xff5c /**< QCD marker value */
#define J3D_MS_QCC 0xff5d /**< QCC marker value */
#define J3D_MS_POC 0xff5f /**< POC marker value */
#define J3D_MS_TLM 0xff55 /**< TLM marker value */
#define J3D_MS_PLM 0xff57 /**< PLM marker value */
#define J3D_MS_PLT 0xff58 /**< PLT marker value */
#define J3D_MS_PPM 0xff60 /**< PPM marker value */
#define J3D_MS_PPT 0xff61 /**< PPT marker value */
#define J3D_MS_SOP 0xff91 /**< SOP marker value */
#define J3D_MS_EPH 0xff92 /**< EPH marker value */
#define J3D_MS_CRG 0xff63 /**< CRG marker value */
#define J3D_MS_COM 0xff64 /**< COM marker value */
/*15444-2*/
#define J3D_MS_DCO 0xff70 /**< DCO marker value */
#define J3D_MS_DCO 0xff70 /**< DCO marker value */
#define J3D_MS_VMS 0xff71 /**< VMS marker value */
#define J3D_MS_DFS 0xff72 /**< DFS marker value */
#define J3D_MS_ADS 0xff73 /**< ADS marker value */
#define J3D_MS_ATK 0xff79 /**< ATK marker value */
#define J3D_MS_CBD 0xff78 /**< CBD marker value */
#define J3D_MS_MCT 0xff74 /**< MCT marker value */
#define J3D_MS_MCC 0xff75 /**< MCC marker value */
#define J3D_MS_MCO 0xff77 /**< MCO marker value */
#define J3D_MS_NLT 0xff76 /**< NLT marker value */
#define J3D_MS_QPD 0xff5a /**< QPD marker value */
#define J3D_MS_QPC 0xff5b /**< QPC marker value */
#define J3D_MS_DFS 0xff72 /**< DFS marker value */
#define J3D_MS_ADS 0xff73 /**< ADS marker value */
#define J3D_MS_ATK 0xff79 /**< ATK marker value */
#define J3D_MS_CBD 0xff78 /**< CBD marker value */
#define J3D_MS_MCT 0xff74 /**< MCT marker value */
#define J3D_MS_MCC 0xff75 /**< MCC marker value */
#define J3D_MS_MCO 0xff77 /**< MCO marker value */
#define J3D_MS_NLT 0xff76 /**< NLT marker value */
#define J3D_MS_QPD 0xff5a /**< QPD marker value */
#define J3D_MS_QPC 0xff5b /**< QPC marker value */
/* ----------------------------------------------------------------------- */
/* Capability RSIZ parameter, extended */
@ -117,7 +117,7 @@ The functions in J3D.C have for goal to read/write the several parts of the code
#define J3D_RSIZ_ASHAP 0x8400
#define J3D_RSIZ_PRQNT 0x8800
#define J3D_CAP_10 0x00400000
#define J3D_CAP_10 0x00400000
/* Arbitrary transformation kernel, 15444-2 */
#define J3D_ATK_IRR 0
#define J3D_ATK_REV 1
@ -127,24 +127,24 @@ The functions in J3D.C have for goal to read/write the several parts of the code
/* ----------------------------------------------------------------------- */
/**
Values that specify the status of the decoding process when decoding the main header.
These values may be combined with a | operator.
Values that specify the status of the decoding process when decoding the main header.
These values may be combined with a | operator.
*/
typedef enum J3D_STATUS {
/**< a SOC marker is expected */
J3D_STATE_MHSOC = 0x0001,
/**< a SIZ marker is expected */
J3D_STATE_MHSIZ = 0x0002,
/**< the decoding process is in the main header */
J3D_STATE_MH = 0x0004,
/**< the decoding process is in a tile part header and expects a SOT marker */
J3D_STATE_TPHSOT = 0x0008,
/**< the decoding process is in a tile part header */
J3D_STATE_TPH = 0x0010,
/**< the EOC marker has just been read */
J3D_STATE_MT = 0x0020,
/**< the decoding process must not expect a EOC marker because the codestream is truncated */
J3D_STATE_NEOC = 0x0040
/**< a SOC marker is expected */
J3D_STATE_MHSOC = 0x0001,
/**< a SIZ marker is expected */
J3D_STATE_MHSIZ = 0x0002,
/**< the decoding process is in the main header */
J3D_STATE_MH = 0x0004,
/**< the decoding process is in a tile part header and expects a SOT marker */
J3D_STATE_TPHSOT = 0x0008,
/**< the decoding process is in a tile part header */
J3D_STATE_TPH = 0x0010,
/**< the EOC marker has just been read */
J3D_STATE_MT = 0x0020,
/**< the decoding process must not expect a EOC marker because the codestream is truncated */
J3D_STATE_NEOC = 0x0040
} J3D_STATUS;
@ -153,32 +153,32 @@ typedef enum J3D_STATUS {
Arbitrary transformation kernel
*/
typedef struct opj_atk {
/** index of wavelet kernel */
int index;
/** Numerical type of scaling factor and lifting step parameters */
int coeff_typ;
/** Wavelet filter category */
int filt_cat;
/** Wavelet transformation type (REV/IRR) */
int wt_typ;
/** Initial odd/even subsequence */
int minit;
/** Boundary extension method (constant CON / whole-sample symmetric WS) */
int exten;
/** Scaling factor. Only for wt_typ=IRR */
double Katk;
/** Number of lifting steps */
int Natk;
/** Offset for lifting step s. Only for filt_cat=ARB */
int Oatk[256];
/** Base 2 scaling exponent for lifting step s. Only for wt_typ=REV */
int Eatk[256];
/** Additive residue for lifting step s. Only for wt_typ=REV */
int Batk[256];
/** Number of lifting coefficients signaled for lifting step s */
int LCatk[256];
/** Lifting coefficient k for lifting step s */
double Aatk[256][256];
/** index of wavelet kernel */
int index;
/** Numerical type of scaling factor and lifting step parameters */
int coeff_typ;
/** Wavelet filter category */
int filt_cat;
/** Wavelet transformation type (REV/IRR) */
int wt_typ;
/** Initial odd/even subsequence */
int minit;
/** Boundary extension method (constant CON / whole-sample symmetric WS) */
int exten;
/** Scaling factor. Only for wt_typ=IRR */
double Katk;
/** Number of lifting steps */
int Natk;
/** Offset for lifting step s. Only for filt_cat=ARB */
int Oatk[256];
/** Base 2 scaling exponent for lifting step s. Only for wt_typ=REV */
int Eatk[256];
/** Additive residue for lifting step s. Only for wt_typ=REV */
int Batk[256];
/** Number of lifting coefficients signaled for lifting step s */
int LCatk[256];
/** Lifting coefficient k for lifting step s */
double Aatk[256][256];
} opj_atk_t;
@ -186,270 +186,270 @@ typedef struct opj_atk {
Quantization stepsize
*/
typedef struct opj_stepsize {
/** exponent */
int expn;
/** mantissa */
int mant;
/** exponent */
int expn;
/** mantissa */
int mant;
} opj_stepsize_t;
/**
Tile-component coding parameters
*/
typedef struct opj_tccp {
/** coding style */
int csty;
/** number of resolutions of x, y and z-axis */
int numresolution[3];
/** code-blocks width height & depth*/
int cblk[3];
/** code-block coding style */
int cblksty;
/** 0: no ATK (only 9-7 or 5-3) 1: ATK defined WT*/
int atk_wt[3];
/** Arbitrary transformation kernel (15444-2)*/
opj_atk_t *atk;
/** DWT identifier for x, y and z-axis (0:WT9-7 1:WT5-3 >1:WT-atk->index) */
int dwtid[3];
/** reversible/irreversible wavelet transfomation (0:irrev 1:reversible)*/
int reversible;
/** quantisation style */
int qntsty;
/** stepsizes used for quantization */
opj_stepsize_t stepsizes[J3D_MAXBANDS];
/** number of guard bits. Table A28 de 15444-1*/
int numgbits;
/** Region Of Interest shift */
int roishift;
/** precinct width heigth & depth*/
int prctsiz[3][J3D_MAXRLVLS];
/** coding style */
int csty;
/** number of resolutions of x, y and z-axis */
int numresolution[3];
/** code-blocks width height & depth*/
int cblk[3];
/** code-block coding style */
int cblksty;
/** 0: no ATK (only 9-7 or 5-3) 1: ATK defined WT*/
int atk_wt[3];
/** Arbitrary transformation kernel (15444-2)*/
opj_atk_t *atk;
/** DWT identifier for x, y and z-axis (0:WT9-7 1:WT5-3 >1:WT-atk->index) */
int dwtid[3];
/** reversible/irreversible wavelet transfomation (0:irrev 1:reversible)*/
int reversible;
/** quantisation style */
int qntsty;
/** stepsizes used for quantization */
opj_stepsize_t stepsizes[J3D_MAXBANDS];
/** number of guard bits. Table A28 de 15444-1*/
int numgbits;
/** Region Of Interest shift */
int roishift;
/** precinct width heigth & depth*/
int prctsiz[3][J3D_MAXRLVLS];
} opj_tccp_t;
/**
Tile coding parameters : coding/decoding parameters common to all tiles
Tile coding parameters : coding/decoding parameters common to all tiles
(information like COD, COC in main header)
*/
typedef struct opj_tcp {
/** 1 : first part-tile of a tile */
int first;
/** coding style */
int csty;
/** progression order */
OPJ_PROG_ORDER prg;
/** number of layers */
int numlayers;
/** multi-component transform identifier */
int mct;
/** rates of layers */
float rates[100];
/** number of progression order changes */
int numpocs;
/** indicates if a POC marker has been used O:NO, 1:YES */
int POC;
/** progression order changes */
opj_poc_t pocs[J3D_MAXRLVLS - 1];
/** add fixed_quality */
float distoratio[100];
/** tile-component coding parameters */
opj_tccp_t *tccps;
/** packet header store there for futur use in t2_decode_packet */
unsigned char *ppt_data;
/** pointer remaining on the first byte of the first header if ppt is used */
unsigned char *ppt_data_first;
/** If ppt == 1 --> there was a PPT marker for the present tile */
int ppt;
/** used in case of multiple marker PPT (number of info already stored) */
int ppt_store;
int ppt_len;
/** 1 : first part-tile of a tile */
int first;
/** coding style */
int csty;
/** progression order */
OPJ_PROG_ORDER prg;
/** number of layers */
int numlayers;
/** multi-component transform identifier */
int mct;
/** rates of layers */
float rates[100];
/** number of progression order changes */
int numpocs;
/** indicates if a POC marker has been used O:NO, 1:YES */
int POC;
/** progression order changes */
opj_poc_t pocs[J3D_MAXRLVLS - 1];
/** add fixed_quality */
float distoratio[100];
/** tile-component coding parameters */
opj_tccp_t *tccps;
/** packet header store there for futur use in t2_decode_packet */
unsigned char *ppt_data;
/** pointer remaining on the first byte of the first header if ppt is used */
unsigned char *ppt_data_first;
/** If ppt == 1 --> there was a PPT marker for the present tile */
int ppt;
/** used in case of multiple marker PPT (number of info already stored) */
int ppt_store;
int ppt_len;
} opj_tcp_t;
/**
Coding parameters
*/
typedef struct opj_cp {
/** transform format 0: 2DWT, 1: 2D1P, 2: 3DWT, 3: 3RLS */
OPJ_TRANSFORM transform_format;
/** entropy coding format 0: 2EB, 1: 3EB, 2: 2GR, 3: 3GR, 4: GRI*/
OPJ_ENTROPY_CODING encoding_format;
/** allocation by rate/distortion */
int disto_alloc;
/** allocation by fixed layer */
int fixed_alloc;
/** add fixed_quality */
int fixed_quality;
/** Rsiz: capabilities */
int rsiz;
/** if != 0, then original dimension divided by 2^(reduce); if == 0 or not used, volume is decoded to the full resolution */
int reduce[3];
/** if != 0, then only the first "layer" layers are decoded; if == 0 or not used, all the quality layers are decoded */
int layer;
/** 0 = no index || 1 = index */
int index_on;
/** Big-Endian/Little-endian order */
int bigendian;
/** XTOsiz */
int tx0;
/** YTOsiz */
int ty0;
/** ZTOsiz */
int tz0;
/** XTsiz */
int tdx;
/** YTsiz */
int tdy;
/** ZTsiz */
int tdz;
/** comment for coding */
char *comment;
/** number of tiles in width, heigth and depth */
int tw;
int th;
int tl;
/** ID number of the tiles present in the codestream */
int *tileno;
/** size of the vector tileno */
int tileno_size;
/** tile coding parameters */
opj_tcp_t *tcps;
/** fixed layer */
int *matrice;
/** transform format 0: 2DWT, 1: 2D1P, 2: 3DWT, 3: 3RLS */
OPJ_TRANSFORM transform_format;
/** entropy coding format 0: 2EB, 1: 3EB, 2: 2GR, 3: 3GR, 4: GRI*/
OPJ_ENTROPY_CODING encoding_format;
/** allocation by rate/distortion */
int disto_alloc;
/** allocation by fixed layer */
int fixed_alloc;
/** add fixed_quality */
int fixed_quality;
/** Rsiz: capabilities */
int rsiz;
/** if != 0, then original dimension divided by 2^(reduce); if == 0 or not used, volume is decoded to the full resolution */
int reduce[3];
/** if != 0, then only the first "layer" layers are decoded; if == 0 or not used, all the quality layers are decoded */
int layer;
/** 0 = no index || 1 = index */
int index_on;
/** Big-Endian/Little-endian order */
int bigendian;
/** XTOsiz */
int tx0;
/** YTOsiz */
int ty0;
/** ZTOsiz */
int tz0;
/** XTsiz */
int tdx;
/** YTsiz */
int tdy;
/** ZTsiz */
int tdz;
/** comment for coding */
char *comment;
/** number of tiles in width, heigth and depth */
int tw;
int th;
int tl;
/** ID number of the tiles present in the codestream */
int *tileno;
/** size of the vector tileno */
int tileno_size;
/** tile coding parameters */
opj_tcp_t *tcps;
/** fixed layer */
int *matrice;
/** packet header store there for futur use in t2_decode_packet */
unsigned char *ppm_data;
/** pointer remaining on the first byte of the first header if ppm is used */
unsigned char *ppm_data_first;
/** if ppm == 1 --> there was a PPM marker for the present tile */
int ppm;
/** use in case of multiple marker PPM (number of info already store) */
int ppm_store;
/** use in case of multiple marker PPM (case on non-finished previous info) */
int ppm_previous;
int ppm_len;
/** packet header store there for futur use in t2_decode_packet */
unsigned char *ppm_data;
/** pointer remaining on the first byte of the first header if ppm is used */
unsigned char *ppm_data_first;
/** if ppm == 1 --> there was a PPM marker for the present tile */
int ppm;
/** use in case of multiple marker PPM (number of info already store) */
int ppm_store;
/** use in case of multiple marker PPM (case on non-finished previous info) */
int ppm_previous;
int ppm_len;
} opj_cp_t;
/**
Information concerning a packet inside tile
*/
typedef struct opj_packet_info {
/** start position */
int start_pos;
/** end position */
int end_pos;
/** distorsion introduced */
double disto;
/** start position */
int start_pos;
/** end position */
int end_pos;
/** distorsion introduced */
double disto;
} opj_packet_info_t;
/**
Index structure : information regarding tiles inside volume
*/
typedef struct opj_tile_info {
/** value of thresh for each layer by tile cfr. Marcela */
double *thresh;
/** number of tile */
int num_tile;
/** start position */
int start_pos;
/** end position of the header */
int end_header;
/** end position */
int end_pos;
/** precinct number for each resolution level (width, heigth and depth) */
int prctno[3][J3D_MAXRLVLS];
/** precinct size (in power of 2), in X for each resolution level */
int prctsiz[3][J3D_MAXRLVLS];
/** information concerning packets inside tile */
opj_packet_info_t *packet;
/** add fixed_quality */
int nbpix;
/** add fixed_quality */
double distotile;
/** value of thresh for each layer by tile cfr. Marcela */
double *thresh;
/** number of tile */
int num_tile;
/** start position */
int start_pos;
/** end position of the header */
int end_header;
/** end position */
int end_pos;
/** precinct number for each resolution level (width, heigth and depth) */
int prctno[3][J3D_MAXRLVLS];
/** precinct size (in power of 2), in X for each resolution level */
int prctsiz[3][J3D_MAXRLVLS];
/** information concerning packets inside tile */
opj_packet_info_t *packet;
/** add fixed_quality */
int nbpix;
/** add fixed_quality */
double distotile;
} opj_tile_info_t;
/**
Index structure
*/
typedef struct opj_volume_info {
/** transform format 0: 2DWT, 1: 2D1P, 2: 3DWT, 3: 3RLS */
OPJ_TRANSFORM transform_format;
/** output file format 0: 2EB, 1: 3EB, 2: 2GR, 3: 3GR, 4: GRI*/
OPJ_ENTROPY_CODING encoding_format; /** 0 = no index || 1 = index */
int index_on;
/** 0 = wt 9-7 || 1 = wt 5-3 || >=2 wt atk defined */
int dwtid[3];
/** maximum distortion reduction on the whole volume (add for Marcela) */
double D_max;
/** packet number */
int num;
/** writing the packet in the index with t2_encode_packets */
int index_write;
/** volume width, height and depth */
int volume_w;
int volume_h;
int volume_l;
/** progression order */
OPJ_PROG_ORDER prog;
/** tile size in x, y and z */
int tile_x;
int tile_y;
int tile_z;
/** tile origin in x, y and z */
int tile_Ox;
int tile_Oy;
int tile_Oz;
/** number of tiles in X, Y and Z */
int tw;
int th;
int tl;
/** component numbers */
int comp;
/** number of layer */
int layer;
/** number of decomposition in X, Y and Z*/
int decomposition[3];
/** DC offset (15444-2) */
int dcoffset;
/** main header position */
int main_head_end;
/** codestream's size */
int codestream_size;
/** information regarding tiles inside volume */
opj_tile_info_t *tile;
/** transform format 0: 2DWT, 1: 2D1P, 2: 3DWT, 3: 3RLS */
OPJ_TRANSFORM transform_format;
/** output file format 0: 2EB, 1: 3EB, 2: 2GR, 3: 3GR, 4: GRI*/
OPJ_ENTROPY_CODING encoding_format; /** 0 = no index || 1 = index */
int index_on;
/** 0 = wt 9-7 || 1 = wt 5-3 || >=2 wt atk defined */
int dwtid[3];
/** maximum distortion reduction on the whole volume (add for Marcela) */
double D_max;
/** packet number */
int num;
/** writing the packet in the index with t2_encode_packets */
int index_write;
/** volume width, height and depth */
int volume_w;
int volume_h;
int volume_l;
/** progression order */
OPJ_PROG_ORDER prog;
/** tile size in x, y and z */
int tile_x;
int tile_y;
int tile_z;
/** tile origin in x, y and z */
int tile_Ox;
int tile_Oy;
int tile_Oz;
/** number of tiles in X, Y and Z */
int tw;
int th;
int tl;
/** component numbers */
int comp;
/** number of layer */
int layer;
/** number of decomposition in X, Y and Z*/
int decomposition[3];
/** DC offset (15444-2) */
int dcoffset;
/** main header position */
int main_head_end;
/** codestream's size */
int codestream_size;
/** information regarding tiles inside volume */
opj_tile_info_t *tile;
} opj_volume_info_t;
/**
JPEG-2000 codestream reader/writer
*/
typedef struct opj_j3d {
/** codec context */
opj_common_ptr cinfo;
/** locate in which part of the codestream the decoder is (main header, tile header, end) */
int state;
/** number of the tile curently concern by coding/decoding */
int curtileno;
/** locate the position of the end of the tile in the codestream, used to detect a truncated codestream (in j3d_read_sod) */
unsigned char *eot;
/** locate the start position of the SOT marker of the current coded tile: */
int sot_start;
/* after encoding the tile, a jump (in j3d_write_sod) is done to the SOT marker to store the value of its length. */
int sod_start;
/** as the J3D-file is written in several parts during encoding, it enables to make the right correction in position return by cio_tell */
int pos_correction;
/** array used to store the data of each tile */
unsigned char **tile_data;
/** array used to store the length of each tile */
int *tile_len;
/** codec context */
opj_common_ptr cinfo;
/** locate in which part of the codestream the decoder is (main header, tile header, end) */
int state;
/** number of the tile curently concern by coding/decoding */
int curtileno;
/** locate the position of the end of the tile in the codestream, used to detect a truncated codestream (in j3d_read_sod) */
unsigned char *eot;
/** locate the start position of the SOT marker of the current coded tile: */
int sot_start;
/* after encoding the tile, a jump (in j3d_write_sod) is done to the SOT marker to store the value of its length. */
int sod_start;
/** as the J3D-file is written in several parts during encoding, it enables to make the right correction in position return by cio_tell */
int pos_correction;
/** array used to store the data of each tile */
unsigned char **tile_data;
/** array used to store the length of each tile */
int *tile_len;
/** decompression only : store decoding parameters common to all tiles */
opj_tcp_t *default_tcp;
/** pointer to the encoded / decoded volume */
opj_volume_t *volume;
/** pointer to the coding parameters */
opj_cp_t *cp;
/** helper used to write the index file */
opj_volume_info_t *volume_info;
/** pointer to the byte i/o stream */
opj_cio_t *cio;
/** decompression only : store decoding parameters common to all tiles */
opj_tcp_t *default_tcp;
/** pointer to the encoded / decoded volume */
opj_volume_t *volume;
/** pointer to the coding parameters */
opj_cp_t *cp;
/** helper used to write the index file */
opj_volume_info_t *volume_info;
/** pointer to the byte i/o stream */
opj_cio_t *cio;
} opj_j3d_t;
/** @name Funciones generales */
@ -468,7 +468,7 @@ Destroy a J3D decompressor handle
void j3d_destroy_decompress(opj_j3d_t *j3d);
/**
Setup the decoder decoding parameters using user parameters.
Decoding parameters are returned in j3d->cp.
Decoding parameters are returned in j3d->cp.
@param j3d J3D decompressor handle
@param parameters decompression parameters
*/
@ -499,13 +499,14 @@ Destroy a J3D compressor handle
*/
void j3d_destroy_compress(opj_j3d_t *j3d);
/**
Setup the encoder parameters using the current volume and using user parameters.
Coding parameters are returned in j3d->cp.
Setup the encoder parameters using the current volume and using user parameters.
Coding parameters are returned in j3d->cp.
@param j3d J3D compressor handle
@param parameters compression parameters
@param volume input filled volume
*/
void j3d_setup_encoder(opj_j3d_t *j3d, opj_cparameters_t *parameters, opj_volume_t *volume);
void j3d_setup_encoder(opj_j3d_t *j3d, opj_cparameters_t *parameters,
opj_volume_t *volume);
/**
Encode an volume into a JPEG-2000 codestream
@param j3d J3D compressor handle
@ -514,7 +515,8 @@ Encode an volume into a JPEG-2000 codestream
@param index Name of the index file if required, NULL otherwise
@return Returns true if successful, returns false otherwise
*/
bool j3d_encode(opj_j3d_t *j3d, opj_cio_t *cio, opj_volume_t *volume, char *index);
bool j3d_encode(opj_j3d_t *j3d, opj_cio_t *cio, opj_volume_t *volume,
char *index);
/* ----------------------------------------------------------------------- */
/*@}*/

View File

@ -1,6 +1,6 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
@ -55,7 +55,7 @@ Allocate a memory block with elements initialized to 0
@param size Bytes to allocate
@return Returns a void pointer to the allocated space, or NULL if there is insufficient memory available
*/
void* opj_malloc( size_t size );
void* opj_malloc(size_t size);
/**
Reallocate memory blocks.
@ -63,13 +63,13 @@ Reallocate memory blocks.
@param size New size in bytes
@return Returns a void pointer to the reallocated (and possibly moved) memory block
*/
void* opj_realloc( void *memblock, size_t size );
void* opj_realloc(void *memblock, size_t size);
/**
Deallocates or frees a memory block.
@param memblock Previously allocated memory block to be freed
*/
void opj_free( void *memblock );
void opj_free(void *memblock);
/* ----------------------------------------------------------------------- */
/*@}*/

View File

@ -1,6 +1,6 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
@ -68,7 +68,7 @@ void mct_decode(int *c0, int *c1, int *c2, int n);
/**
Get norm of the basis function used for the reversible multi-component transform
@param compno Number of the component (0->Y, 1->U, 2->V)
@return
@return
*/
double mct_getnorm(int compno);
@ -91,7 +91,7 @@ void mct_decode_real(int *c0, int *c1, int *c2, int n);
/**
Get norm of the basis function used for the irreversible multi-component transform
@param compno Number of the component (0->Y, 1->U, 2->V)
@return
@return
*/
double mct_getnorm_real(int compno);
/* ----------------------------------------------------------------------- */

View File

@ -1,6 +1,6 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
@ -50,14 +50,14 @@ in MQC.C are used by some function in T1.C.
This struct defines the state of a context.
*/
typedef struct opj_mqc_state {
/** the probability of the Least Probable Symbol (0.75->0x8000, 1.5->0xffff) */
unsigned int qeval;
/** the Most Probable Symbol (0 or 1) */
int mps;
/** next state if the next encoded symbol is the MPS */
struct opj_mqc_state *nmps;
/** next state if the next encoded symbol is the LPS */
struct opj_mqc_state *nlps;
/** the probability of the Least Probable Symbol (0.75->0x8000, 1.5->0xffff) */
unsigned int qeval;
/** the Most Probable Symbol (0 or 1) */
int mps;
/** next state if the next encoded symbol is the MPS */
struct opj_mqc_state *nmps;
/** next state if the next encoded symbol is the LPS */
struct opj_mqc_state *nlps;
} opj_mqc_state_t;
#define MQC_NUMCTXS 32
@ -66,21 +66,21 @@ typedef struct opj_mqc_state {
MQ coder
*/
typedef struct opj_mqc {
unsigned int c;
unsigned int a;
unsigned int ct;
unsigned char *bp;
unsigned char *start;
unsigned char *end;
opj_mqc_state_t *ctxs[MQC_NUMCTXS];
opj_mqc_state_t **curctx;
unsigned int c;
unsigned int a;
unsigned int ct;
unsigned char *bp;
unsigned char *start;
unsigned char *end;
opj_mqc_state_t *ctxs[MQC_NUMCTXS];
opj_mqc_state_t **curctx;
} opj_mqc_t;
/** @name Exported functions */
/*@{*/
/* ----------------------------------------------------------------------- */
/**
Create a new MQC handle
Create a new MQC handle
@return Returns a new MQC handle if successful, returns NULL otherwise
*/
opj_mqc_t* mqc_create(void);
@ -96,7 +96,7 @@ Return the number of bytes written/read since initialisation
*/
int mqc_numbytes(opj_mqc_t *mqc);
/**
Reset the states of all the context of the coder/decoder
Reset the states of all the context of the coder/decoder
(each context is set to a state where 0 and 1 are more or less equiprobable)
@param mqc MQC handle
*/
@ -133,15 +133,15 @@ Flush the encoder, so that all remaining data is written
*/
void mqc_flush(opj_mqc_t *mqc);
/**
BYPASS mode switch, initialization operation.
JPEG 2000 p 505.
BYPASS mode switch, initialization operation.
JPEG 2000 p 505.
<h2>Not fully implemented and tested !!</h2>
@param mqc MQC handle
*/
void mqc_bypass_init_enc(opj_mqc_t *mqc);
/**
BYPASS mode switch, coding operation.
JPEG 2000 p 505.
BYPASS mode switch, coding operation.
JPEG 2000 p 505.
<h2>Not fully implemented and tested !!</h2>
@param mqc MQC handle
@param d The symbol to be encoded (0 or 1)

View File

@ -1,6 +1,6 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
@ -36,7 +36,7 @@
#ifndef OPENJPEG_H
#define OPENJPEG_H
/*
/*
==========================================================
Compiler directives
==========================================================
@ -56,10 +56,10 @@
#define OPJ_CALLCONV __stdcall
/*
The following ifdef block is the standard way of creating macros which make exporting
The following ifdef block is the standard way of creating macros which make exporting
from a DLL simpler. All files within this DLL are compiled with the OPJ_EXPORTS
symbol defined on the command line. this symbol should not be defined on any project
that uses this DLL. This way any other project whose source files include this file see
that uses this DLL. This way any other project whose source files include this file see
OPJ_API functions as being imported from a DLL, whereas this DLL sees symbols
defined with this macro as being exported.
*/
@ -84,35 +84,35 @@ The C language implementation does not provide the standard header file
braindamage below.
*/
#if !defined(bool)
#define bool int
#define bool int
#endif
#if !defined(true)
#define true 1
#define true 1
#endif
#if !defined(false)
#define false 0
#define false 0
#endif
#endif
#endif /* __cplusplus */
/*
/*
==========================================================
Useful constant definitions
==========================================================
*/
#ifndef MAX_SLICES
#define MAX_SLICES 300 /**< Maximum allowed size for slices */
#define MAX_SLICES 300 /**< Maximum allowed size for slices */
#endif /* MAX_PATH */
#ifndef MAX_PATH
#define MAX_PATH 260 /**< Maximum allowed size for filenames */
#define MAX_PATH 260 /**< Maximum allowed size for filenames */
#endif /* MAX_PATH */
#define J3D_MAXRLVLS 32 /**< Number of maximum resolution level authorized */
#define J3D_MAXBANDS (7*J3D_MAXRLVLS + 1) /**< Number of maximum sub-band linked to number of resolution level */
#define J3D_MAXRLVLS 32 /**< Number of maximum resolution level authorized */
#define J3D_MAXBANDS (7*J3D_MAXRLVLS + 1) /**< Number of maximum sub-band linked to number of resolution level */
#define TINY 1.0E-20
/*
/*
==========================================================
enum definitions
==========================================================
@ -129,77 +129,77 @@ braindamage below.
/** Progression order */
typedef enum PROG_ORDER {
/**< place-holder */
PROG_UNKNOWN = -1,
/**< layer-resolution-component-precinct order */
LRCP = 0,
/**< resolution-layer-component-precinct order */
RLCP = 1,
/**< resolution-precinct-component-layer order */
RPCL = 2,
/**< precinct-component-resolution-layer order */
PCRL = 3,
/**< component-precinct-resolution-layer order */
CPRL = 4
/**< place-holder */
PROG_UNKNOWN = -1,
/**< layer-resolution-component-precinct order */
LRCP = 0,
/**< resolution-layer-component-precinct order */
RLCP = 1,
/**< resolution-precinct-component-layer order */
RPCL = 2,
/**< precinct-component-resolution-layer order */
PCRL = 3,
/**< component-precinct-resolution-layer order */
CPRL = 4
} OPJ_PROG_ORDER;
/**
Supported volume color spaces
*/
typedef enum COLOR_SPACE {
/**< place-holder */
CLRSPC_UNKNOWN = -1,
/**< sRGB */
CLRSPC_SRGB = 1,
/**< grayscale */
CLRSPC_GRAY = 2,
/**< YUV */
CLRSPC_SYCC = 3
/**< place-holder */
CLRSPC_UNKNOWN = -1,
/**< sRGB */
CLRSPC_SRGB = 1,
/**< grayscale */
CLRSPC_GRAY = 2,
/**< YUV */
CLRSPC_SYCC = 3
} OPJ_COLOR_SPACE;
/**
Supported codec
*/
typedef enum CODEC_FORMAT {
/**< place-holder */
CODEC_UNKNOWN = -1,
/**< JPEG-2000 codestream : read/write */
CODEC_J2K = 0,
/**< JPEG-2000 Part 10 file format : read/write */
CODEC_J3D = 1
/**< place-holder */
CODEC_UNKNOWN = -1,
/**< JPEG-2000 codestream : read/write */
CODEC_J2K = 0,
/**< JPEG-2000 Part 10 file format : read/write */
CODEC_J3D = 1
} OPJ_CODEC_FORMAT;
/**
Supported entropy coding algorithms
*/
typedef enum ENTROPY_CODING {
/**< place-holder */
ENCOD_UNKNOWN = -1,
/**< 2D EBCOT encoding */
ENCOD_2EB = 0,
/**< 3D EBCOT encoding */
ENCOD_3EB = 1,
/**< Golomb-Rice coding with 2D context */
ENCOD_2GR = 2,
/**< Golomb-Rice coding with 3D context */
ENCOD_3GR = 3
/**< place-holder */
ENCOD_UNKNOWN = -1,
/**< 2D EBCOT encoding */
ENCOD_2EB = 0,
/**< 3D EBCOT encoding */
ENCOD_3EB = 1,
/**< Golomb-Rice coding with 2D context */
ENCOD_2GR = 2,
/**< Golomb-Rice coding with 3D context */
ENCOD_3GR = 3
} OPJ_ENTROPY_CODING;
/**
Supported transforms
*/
typedef enum TRANSFORM {
/**< place-holder */
TRF_UNKNOWN = -1,
/**< 2D DWT, no transform in axial dim */
TRF_2D_DWT = 0,
/**< 3D DWT */
TRF_3D_DWT = 1,
/**< 3D prediction*/
TRF_3D_RLS = 2,
TRF_3D_LSE = 3
/**< place-holder */
TRF_UNKNOWN = -1,
/**< 2D DWT, no transform in axial dim */
TRF_2D_DWT = 0,
/**< 3D DWT */
TRF_3D_DWT = 1,
/**< 3D prediction*/
TRF_3D_RLS = 2,
TRF_3D_LSE = 3
} OPJ_TRANSFORM;
/*
/*
==========================================================
event manager typedef definitions
==========================================================
@ -208,13 +208,13 @@ typedef enum TRANSFORM {
/**
Callback function prototype for events
@param msg Event message
@param client_data
@param client_data
*/
typedef void (*opj_msg_callback) (const char *msg, void *client_data);
typedef void (*opj_msg_callback)(const char *msg, void *client_data);
/**
Message handler object
used for
used for
<ul>
<li>Error messages
<li>Warning messages
@ -222,16 +222,16 @@ used for
</ul>
*/
typedef struct opj_event_mgr {
/** Error message callback if available, NULL otherwise */
opj_msg_callback error_handler;
/** Warning message callback if available, NULL otherwise */
opj_msg_callback warning_handler;
/** Debug message callback if available, NULL otherwise */
opj_msg_callback info_handler;
/** Error message callback if available, NULL otherwise */
opj_msg_callback error_handler;
/** Warning message callback if available, NULL otherwise */
opj_msg_callback warning_handler;
/** Debug message callback if available, NULL otherwise */
opj_msg_callback info_handler;
} opj_event_mgr_t;
/*
/*
==========================================================
codec typedef definitions
==========================================================
@ -241,11 +241,11 @@ typedef struct opj_event_mgr {
Progression order changes
*/
typedef struct opj_poc {
int resno0, compno0;
int layno1, resno1, compno1;
OPJ_PROG_ORDER prg;
int tile;
char progorder[4];
int resno0, compno0;
int layno1, resno1, compno1;
OPJ_PROG_ORDER prg;
int tile;
char progorder[4];
} opj_poc_t;
@ -253,145 +253,145 @@ typedef struct opj_poc {
Compression parameters
*/
typedef struct opj_cparameters {
/** size of tile: tile_size_on = false (not in argument) or = true (in argument) */
bool tile_size_on;
/** XTOsiz */
int cp_tx0;
/** YTOsiz */
int cp_ty0;
/** ZTOsiz */
int cp_tz0;
/** size of tile: tile_size_on = false (not in argument) or = true (in argument) */
bool tile_size_on;
/** XTOsiz */
int cp_tx0;
/** YTOsiz */
int cp_ty0;
/** ZTOsiz */
int cp_tz0;
/** XTsiz */
int cp_tdx;
/** YTsiz */
int cp_tdy;
/** ZTsiz */
int cp_tdz;
/** allocation by rate/distortion */
int cp_disto_alloc;
/** allocation by fixed layer */
int cp_fixed_alloc;
/** add fixed_quality */
int cp_fixed_quality;
/** fixed layer */
int *cp_matrice;
/** number of layers */
int tcp_numlayers;
/** rates for successive layers */
float tcp_rates[100];
/** psnr's for successive layers */
float tcp_distoratio[100];
/** comment for coding */
char *cp_comment;
/** csty : coding style */
int csty;
/** DC offset (DCO) */
int dcoffset;
/** progression order (default LRCP) */
OPJ_PROG_ORDER prog_order;
/** progression order changes */
opj_poc_t POC[J3D_MAXRLVLS-1];
/** number of progression order changes (POC), default to 0 */
int numpocs;
/** XTsiz */
int cp_tdx;
/** YTsiz */
int cp_tdy;
/** ZTsiz */
int cp_tdz;
/** number of resolutions */
int numresolution[3];
/** initial code block width, height and depth, default to 64 */
int cblock_init[3];
/** mode switch (1=BYPASS(LAZY) 2=RESET 4=RESTART(TERMALL) 8=VSC 16=ERTERM(SEGTERM) 32=SEGMARK(SEGSYM)) */
int mode;
/** allocation by rate/distortion */
int cp_disto_alloc;
/** allocation by fixed layer */
int cp_fixed_alloc;
/** add fixed_quality */
int cp_fixed_quality;
/** fixed layer */
int *cp_matrice;
/** number of layers */
int tcp_numlayers;
/** rates for successive layers */
float tcp_rates[100];
/** psnr's for successive layers */
float tcp_distoratio[100];
/** comment for coding */
char *cp_comment;
/** csty : coding style */
int csty;
/** DC offset (DCO) */
int dcoffset;
/** progression order (default LRCP) */
OPJ_PROG_ORDER prog_order;
/** progression order changes */
opj_poc_t POC[J3D_MAXRLVLS - 1];
/** number of progression order changes (POC), default to 0 */
int numpocs;
/** 1 : use the irreversible DWT 9-7, 0 : use lossless compression (default) */
int irreversible;
/** WT from ATK, default to 0 (false), no of atk used */
int atk_wt[3];
/** region of interest: affected component in [0..3], -1 means no ROI */
int roi_compno;
/** region of interest: upshift value */
int roi_shift;
/** number of resolutions */
int numresolution[3];
/** initial code block width, height and depth, default to 64 */
int cblock_init[3];
/** mode switch (1=BYPASS(LAZY) 2=RESET 4=RESTART(TERMALL) 8=VSC 16=ERTERM(SEGTERM) 32=SEGMARK(SEGSYM)) */
int mode;
/* number of precinct size specifications */
int res_spec;
/** initial precinct width */
int prct_init[3][J3D_MAXRLVLS];
/** 1 : use the irreversible DWT 9-7, 0 : use lossless compression (default) */
int irreversible;
/** WT from ATK, default to 0 (false), no of atk used */
int atk_wt[3];
/** region of interest: affected component in [0..3], -1 means no ROI */
int roi_compno;
/** region of interest: upshift value */
int roi_shift;
/** transform format 0: 0: 2DWT, 1: 2D1P, 2: 3DWT, 3: 3RLS */
OPJ_TRANSFORM transform_format;
/** output file format 0: 2EB, 1: 3EB, 2: 2GR, 3: 3GR, 4: GRI */
OPJ_ENTROPY_CODING encoding_format;
/* number of precinct size specifications */
int res_spec;
/** initial precinct width */
int prct_init[3][J3D_MAXRLVLS];
/**@name command line encoder parameters (not used inside the library) */
/*@{*/
char infile[MAX_PATH]; /** input file name */
char outfile[MAX_PATH]; /** output file name */
char imgfile[MAX_PATH]; /** IMG file name for BIN volumes*/
int index_on; /** creation of an index file, default to 0 (false) */
char index[MAX_PATH]; /** index file name */
int volume_offset_x0; /** subvolume encoding: origin volume offset in x, y and z direction */
int volume_offset_y0;
int volume_offset_z0;
int subsampling_dx; /** subsampling value for dx */
int subsampling_dy;
int subsampling_dz;
int decod_format; /** input file format 0: BIN, 1: PGX */
int cod_format; /** output file format 0: JP3D */
/*@}*/
/** transform format 0: 0: 2DWT, 1: 2D1P, 2: 3DWT, 3: 3RLS */
OPJ_TRANSFORM transform_format;
/** output file format 0: 2EB, 1: 3EB, 2: 2GR, 3: 3GR, 4: GRI */
OPJ_ENTROPY_CODING encoding_format;
/**@name command line encoder parameters (not used inside the library) */
/*@{*/
char infile[MAX_PATH]; /** input file name */
char outfile[MAX_PATH]; /** output file name */
char imgfile[MAX_PATH]; /** IMG file name for BIN volumes*/
int index_on; /** creation of an index file, default to 0 (false) */
char index[MAX_PATH]; /** index file name */
int volume_offset_x0; /** subvolume encoding: origin volume offset in x, y and z direction */
int volume_offset_y0;
int volume_offset_z0;
int subsampling_dx; /** subsampling value for dx */
int subsampling_dy;
int subsampling_dz;
int decod_format; /** input file format 0: BIN, 1: PGX */
int cod_format; /** output file format 0: JP3D */
/*@}*/
} opj_cparameters_t;
/**
Decompression parameters
*/
typedef struct opj_dparameters {
/** Set the number of highest resolution levels to be discarded. if != 0, then original dimension divided by 2^(reduce); if == 0 or not used, volume is decoded to the full resolution */
int cp_reduce[3];
/** Set the maximum number of quality layers to decode. if != 0, then only the first "layer" layers are decoded; if == 0 or not used, all the quality layers are decoded */
int cp_layer;
int bigendian;
/**@name command line encoder parameters (not used inside the library) */
/*@{*/
/** input file name */
char infile[MAX_PATH];
/** output file name */
char outfile[MAX_PATH];
/** IMG file name for BIN volumes*/
char imgfile[MAX_PATH];
/** Original file name for PSNR measures*/
char original[MAX_PATH];
/** input file format 0: J2K, 1: JP3D */
int decod_format;
/** input file format 0: BIN, 1: PGM */
int cod_format;
/** original file format 0: BIN, 1: PGM */
int orig_format;
/*@}*/
/** Set the number of highest resolution levels to be discarded. if != 0, then original dimension divided by 2^(reduce); if == 0 or not used, volume is decoded to the full resolution */
int cp_reduce[3];
/** Set the maximum number of quality layers to decode. if != 0, then only the first "layer" layers are decoded; if == 0 or not used, all the quality layers are decoded */
int cp_layer;
int bigendian;
/**@name command line encoder parameters (not used inside the library) */
/*@{*/
/** input file name */
char infile[MAX_PATH];
/** output file name */
char outfile[MAX_PATH];
/** IMG file name for BIN volumes*/
char imgfile[MAX_PATH];
/** Original file name for PSNR measures*/
char original[MAX_PATH];
/** input file format 0: J2K, 1: JP3D */
int decod_format;
/** input file format 0: BIN, 1: PGM */
int cod_format;
/** original file format 0: BIN, 1: PGM */
int orig_format;
/*@}*/
} opj_dparameters_t;
/** Common fields between JPEG-2000 compression and decompression master structs. */
#define opj_common_fields \
opj_event_mgr_t *event_mgr; /**< pointer to the event manager */\
void * client_data; /**< Available for use by application */\
bool is_decompressor; /**< So common code can tell which is which */\
OPJ_CODEC_FORMAT codec_format; /**< selected codec */\
OPJ_ENTROPY_CODING encoding_format; /**< selected entropy coding */\
OPJ_TRANSFORM transform_format; /**< selected transform */\
void *j3d_handle /**< pointer to the J3D codec */
opj_event_mgr_t *event_mgr; /**< pointer to the event manager */\
void * client_data; /**< Available for use by application */\
bool is_decompressor; /**< So common code can tell which is which */\
OPJ_CODEC_FORMAT codec_format; /**< selected codec */\
OPJ_ENTROPY_CODING encoding_format; /**< selected entropy coding */\
OPJ_TRANSFORM transform_format; /**< selected transform */\
void *j3d_handle /**< pointer to the J3D codec */
/* Routines that are to be used by both halves of the library are declared
* to receive a pointer to this structure. There are no actual instances of
* opj_common_struct_t, only of opj_cinfo_t and opj_dinfo_t.
*/
typedef struct opj_common_struct {
opj_common_fields; /* Fields common to both master struct types */
/* Additional fields follow in an actual opj_cinfo_t or
* opj_dinfo_t. All three structs must agree on these
* initial fields! (This would be a lot cleaner in C++.)
*/
opj_common_fields; /* Fields common to both master struct types */
/* Additional fields follow in an actual opj_cinfo_t or
* opj_dinfo_t. All three structs must agree on these
* initial fields! (This would be a lot cleaner in C++.)
*/
} opj_common_struct_t;
typedef opj_common_struct_t * opj_common_ptr;
@ -400,21 +400,21 @@ typedef opj_common_struct_t * opj_common_ptr;
Compression context info
*/
typedef struct opj_cinfo {
/** Fields shared with opj_dinfo_t */
opj_common_fields;
/* other specific fields go here */
/** Fields shared with opj_dinfo_t */
opj_common_fields;
/* other specific fields go here */
} opj_cinfo_t;
/**
Decompression context info
*/
typedef struct opj_dinfo {
/** Fields shared with opj_cinfo_t */
opj_common_fields;
/* other specific fields go here */
/** Fields shared with opj_cinfo_t */
opj_common_fields;
/* other specific fields go here */
} opj_dinfo_t;
/*
/*
==========================================================
I/O stream typedef definitions
==========================================================
@ -424,7 +424,7 @@ typedef struct opj_dinfo {
* Stream open flags.
*/
/** The stream was opened for reading. */
#define OPJ_STREAM_READ 0x0001
#define OPJ_STREAM_READ 0x0001
/** The stream was opened for writing. */
#define OPJ_STREAM_WRITE 0x0002
@ -432,23 +432,23 @@ typedef struct opj_dinfo {
Byte input-output stream (CIO)
*/
typedef struct opj_cio {
/** codec context */
opj_common_ptr cinfo;
/** open mode (read/write) either OPJ_STREAM_READ or OPJ_STREAM_WRITE */
int openmode;
/** pointer to the start of the buffer */
unsigned char *buffer;
/** buffer size in bytes */
int length;
/** pointer to the start of the stream */
unsigned char *start;
/** pointer to the end of the stream */
unsigned char *end;
/** pointer to the current position */
unsigned char *bp;
/** codec context */
opj_common_ptr cinfo;
/** open mode (read/write) either OPJ_STREAM_READ or OPJ_STREAM_WRITE */
int openmode;
/** pointer to the start of the buffer */
unsigned char *buffer;
/** buffer size in bytes */
int length;
/** pointer to the start of the stream */
unsigned char *start;
/** pointer to the end of the stream */
unsigned char *end;
/** pointer to the current position */
unsigned char *bp;
} opj_cio_t;
/*
/*
==========================================================
volume typedef definitions
==========================================================
@ -458,100 +458,100 @@ typedef struct opj_cio {
Defines a single volume component
*/
typedef struct opj_volume_comp {
/** XRsiz: horizontal separation of a sample of ith component with respect to the reference grid */
int dx;
/** YRsiz: vertical separation of a sample of ith component with respect to the reference grid */
int dy;
/** ZRsiz: vertical separation of a sample of ith component with respect to the reference grid */
int dz;
/** data width */
int w;
/** data height */
int h;
/** data length : no of slices */
int l;
/** x component offset compared to the whole volume */
int x0;
/** y component offset compared to the whole volume */
int y0;
/** z component offset compared to the whole volume */
int z0;
/** precision */
int prec;
/** volume depth in bits */
int bpp;
/** DC offset (15444-2) */
int dcoffset;
/** signed (1) / unsigned (0) */
int sgnd;
/** BE byte order (1) / LE byte order (0) */
int bigendian;
/** number of decoded resolution */
int resno_decoded[3];
/** number of division by 2 of the out volume compared to the original size of volume */
int factor[3];
/** volume component data */
int *data;
/** XRsiz: horizontal separation of a sample of ith component with respect to the reference grid */
int dx;
/** YRsiz: vertical separation of a sample of ith component with respect to the reference grid */
int dy;
/** ZRsiz: vertical separation of a sample of ith component with respect to the reference grid */
int dz;
/** data width */
int w;
/** data height */
int h;
/** data length : no of slices */
int l;
/** x component offset compared to the whole volume */
int x0;
/** y component offset compared to the whole volume */
int y0;
/** z component offset compared to the whole volume */
int z0;
/** precision */
int prec;
/** volume depth in bits */
int bpp;
/** DC offset (15444-2) */
int dcoffset;
/** signed (1) / unsigned (0) */
int sgnd;
/** BE byte order (1) / LE byte order (0) */
int bigendian;
/** number of decoded resolution */
int resno_decoded[3];
/** number of division by 2 of the out volume compared to the original size of volume */
int factor[3];
/** volume component data */
int *data;
} opj_volume_comp_t;
/**
/**
Defines volume data and characteristics
*/
typedef struct opj_volume {
/** XOsiz: horizontal offset from the origin of the reference grid to the left side of the volume area */
int x0;
/** YOsiz: vertical offset from the origin of the reference grid to the top side of the volume area */
int y0;
/** ZOsiz: vertical offset from the origin of the reference grid to the top side of the volume area */
int z0;
/** Xsiz: width of the reference grid */
int x1;
/** Ysiz: height of the reference grid */
int y1;
/** Zsiz: length of the reference grid */
int z1;
/** number of components in the volume */
int numcomps;
/** number of slices in the volume */
int numslices;
/** color space: sRGB, Greyscale or YUV */
OPJ_COLOR_SPACE color_space;
/** volume components */
opj_volume_comp_t *comps;
/** XOsiz: horizontal offset from the origin of the reference grid to the left side of the volume area */
int x0;
/** YOsiz: vertical offset from the origin of the reference grid to the top side of the volume area */
int y0;
/** ZOsiz: vertical offset from the origin of the reference grid to the top side of the volume area */
int z0;
/** Xsiz: width of the reference grid */
int x1;
/** Ysiz: height of the reference grid */
int y1;
/** Zsiz: length of the reference grid */
int z1;
/** number of components in the volume */
int numcomps;
/** number of slices in the volume */
int numslices;
/** color space: sRGB, Greyscale or YUV */
OPJ_COLOR_SPACE color_space;
/** volume components */
opj_volume_comp_t *comps;
} opj_volume_t;
/**
Component parameters structure used by the opj_volume_create function
*/
typedef struct opj_volume_comptparm {
/** XRsiz: horizontal separation of a sample of ith component with respect to the reference grid */
int dx;
/** YRsiz: vertical separation of a sample of ith component with respect to the reference grid */
int dy;
/** ZRsiz: axial separation of a sample of ith component with respect to the reference grid */
int dz;
/** data width */
int w;
/** data height */
int h;
/** data length */
int l;
/** x component offset compared to the whole volume */
int x0;
/** y component offset compared to the whole volume */
int y0;
/** z component offset compared to the whole volume */
int z0;
/** precision */
int prec;
/** volume depth in bits */
int bpp;
/** signed (1) / unsigned (0) */
int sgnd;
/** DC offset*/
int dcoffset;
/** BE byte order (1) / LE byte order (0) */
int bigendian;
/** XRsiz: horizontal separation of a sample of ith component with respect to the reference grid */
int dx;
/** YRsiz: vertical separation of a sample of ith component with respect to the reference grid */
int dy;
/** ZRsiz: axial separation of a sample of ith component with respect to the reference grid */
int dz;
/** data width */
int w;
/** data height */
int h;
/** data length */
int l;
/** x component offset compared to the whole volume */
int x0;
/** y component offset compared to the whole volume */
int y0;
/** z component offset compared to the whole volume */
int z0;
/** precision */
int prec;
/** volume depth in bits */
int bpp;
/** signed (1) / unsigned (0) */
int sgnd;
/** DC offset*/
int dcoffset;
/** BE byte order (1) / LE byte order (0) */
int bigendian;
} opj_volume_cmptparm_t;
#ifdef __cplusplus
@ -559,7 +559,7 @@ extern "C" {
#endif
/*
/*
==========================================================
openjpeg version
==========================================================
@ -567,7 +567,7 @@ extern "C" {
OPJ_API const char * OPJ_CALLCONV opj_version(void);
/*
/*
==========================================================
volume functions definitions
==========================================================
@ -580,7 +580,8 @@ Create an volume
@param clrspc volume color space
@return returns a new volume structure if successful, returns NULL otherwise
*/
OPJ_API opj_volume_t* OPJ_CALLCONV opj_volume_create(int numcmpts, opj_volume_cmptparm_t *cmptparms, OPJ_COLOR_SPACE clrspc);
OPJ_API opj_volume_t* OPJ_CALLCONV opj_volume_create(int numcmpts,
opj_volume_cmptparm_t *cmptparms, OPJ_COLOR_SPACE clrspc);
/**
Deallocate any resources associated with an volume
@ -588,24 +589,25 @@ Deallocate any resources associated with an volume
*/
OPJ_API void OPJ_CALLCONV opj_volume_destroy(opj_volume_t *volume);
/*
/*
==========================================================
stream functions definitions
==========================================================
*/
/**
Open and allocate a memory stream for read / write.
On reading, the user must provide a buffer containing encoded data. The buffer will be
wrapped by the returned CIO handle.
On writing, buffer parameters must be set to 0: a buffer will be allocated by the library
to contain encoded data.
Open and allocate a memory stream for read / write.
On reading, the user must provide a buffer containing encoded data. The buffer will be
wrapped by the returned CIO handle.
On writing, buffer parameters must be set to 0: a buffer will be allocated by the library
to contain encoded data.
@param cinfo Codec context info
@param buffer Reading: buffer address. Writing: NULL
@param length Reading: buffer length. Writing: 0
@return Returns a CIO handle if successful, returns NULL otherwise
*/
OPJ_API opj_cio_t* OPJ_CALLCONV opj_cio_open(opj_common_ptr cinfo, unsigned char *buffer, int length);
OPJ_API opj_cio_t* OPJ_CALLCONV opj_cio_open(opj_common_ptr cinfo,
unsigned char *buffer, int length);
/**
Close and free a CIO handle
@ -626,15 +628,16 @@ Set position in byte stream
*/
OPJ_API void OPJ_CALLCONV cio_seek(opj_cio_t *cio, int pos);
/*
/*
==========================================================
event manager functions definitions
==========================================================
*/
OPJ_API opj_event_mgr_t* OPJ_CALLCONV opj_set_event_mgr(opj_common_ptr cinfo, opj_event_mgr_t *event_mgr, void *context);
OPJ_API opj_event_mgr_t* OPJ_CALLCONV opj_set_event_mgr(opj_common_ptr cinfo,
opj_event_mgr_t *event_mgr, void *context);
/*
/*
==========================================================
codec functions definitions
==========================================================
@ -644,7 +647,8 @@ Creates a J3D decompression structure
@param format Decoder to select
@return Returns a handle to a decompressor if successful, returns NULL otherwise
*/
OPJ_API opj_dinfo_t* OPJ_CALLCONV opj_create_decompress(OPJ_CODEC_FORMAT format);
OPJ_API opj_dinfo_t* OPJ_CALLCONV opj_create_decompress(
OPJ_CODEC_FORMAT format);
/**
Destroy a decompressor handle
@param dinfo decompressor handle to destroy
@ -654,21 +658,24 @@ OPJ_API void OPJ_CALLCONV opj_destroy_decompress(opj_dinfo_t *dinfo);
Set decoding parameters to default values
@param parameters Decompression parameters
*/
OPJ_API void OPJ_CALLCONV opj_set_default_decoder_parameters(opj_dparameters_t *parameters);
OPJ_API void OPJ_CALLCONV opj_set_default_decoder_parameters(
opj_dparameters_t *parameters);
/**
Setup the decoder decoding parameters using user parameters.
Decoding parameters are returned in j3d->cp.
Decoding parameters are returned in j3d->cp.
@param dinfo decompressor handle
@param parameters decompression parameters
*/
OPJ_API void OPJ_CALLCONV opj_setup_decoder(opj_dinfo_t *dinfo, opj_dparameters_t *parameters);
OPJ_API void OPJ_CALLCONV opj_setup_decoder(opj_dinfo_t *dinfo,
opj_dparameters_t *parameters);
/**
Decode an volume from a JPEG-2000 codestream
@param dinfo decompressor handle
@param cio Input buffer stream
@return Returns a decoded volume if successful, returns NULL otherwise
*/
OPJ_API opj_volume_t* OPJ_CALLCONV opj_decode(opj_dinfo_t *dinfo, opj_cio_t *cio);
OPJ_API opj_volume_t* OPJ_CALLCONV opj_decode(opj_dinfo_t *dinfo,
opj_cio_t *cio);
/**
Creates a J3D/JP2 compression structure
@param format Coder to select
@ -681,7 +688,7 @@ Destroy a compressor handle
*/
OPJ_API void OPJ_CALLCONV opj_destroy_compress(opj_cinfo_t *cinfo);
/**
Set encoding parameters to default values, that means :
Set encoding parameters to default values, that means :
<ul>
<li>Lossless
<li>1 tile
@ -701,14 +708,16 @@ Set encoding parameters to default values, that means :
</ul>
@param parameters Compression parameters
*/
OPJ_API void OPJ_CALLCONV opj_set_default_encoder_parameters(opj_cparameters_t *parameters);
OPJ_API void OPJ_CALLCONV opj_set_default_encoder_parameters(
opj_cparameters_t *parameters);
/**
Setup the encoder parameters using the current volume and using user parameters.
Setup the encoder parameters using the current volume and using user parameters.
@param cinfo compressor handle
@param parameters compression parameters
@param volume input filled volume
*/
OPJ_API void OPJ_CALLCONV opj_setup_encoder(opj_cinfo_t *cinfo, opj_cparameters_t *parameters, opj_volume_t *volume);
OPJ_API void OPJ_CALLCONV opj_setup_encoder(opj_cinfo_t *cinfo,
opj_cparameters_t *parameters, opj_volume_t *volume);
/**
Encode an volume into a JPEG-2000 codestream
@param cinfo compressor handle
@ -717,7 +726,8 @@ Encode an volume into a JPEG-2000 codestream
@param index Name of the index file if required, NULL otherwise
@return Returns true if successful, returns false otherwise
*/
OPJ_API bool OPJ_CALLCONV opj_encode(opj_cinfo_t *cinfo, opj_cio_t *cio, opj_volume_t *volume, char *index);
OPJ_API bool OPJ_CALLCONV opj_encode(opj_cinfo_t *cinfo, opj_cio_t *cio,
opj_volume_t *volume, char *index);
#ifdef __cplusplus
}

View File

@ -1,6 +1,6 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*

View File

@ -1,6 +1,6 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
@ -49,69 +49,69 @@ by some function in T2.C.
/*@{*/
/**
Packet iterator : resolution level information
Packet iterator : resolution level information
*/
typedef struct opj_pi_resolution {
/** Size of precints in horizontal axis */
int pdx;
/** Size of precints in vertical axis */
int pdy;
/** Size of precints in axial axis */
int pdz;
/** Number of precints in each axis */
int prctno[3];
/** Size of precints in horizontal axis */
int pdx;
/** Size of precints in vertical axis */
int pdy;
/** Size of precints in axial axis */
int pdz;
/** Number of precints in each axis */
int prctno[3];
} opj_pi_resolution_t;
/**
Packet iterator : component information
Packet iterator : component information
*/
typedef struct opj_pi_comp {
/** Size in horizontal axis */
int dx;
/** Size in vertical axis */
int dy;
/** Size in axial axis */
int dz;
/** Number of resolution levels */
int numresolution[3];
/** Packet iterator : resolution level information */
opj_pi_resolution_t *resolutions;
/** Size in horizontal axis */
int dx;
/** Size in vertical axis */
int dy;
/** Size in axial axis */
int dz;
/** Number of resolution levels */
int numresolution[3];
/** Packet iterator : resolution level information */
opj_pi_resolution_t *resolutions;
} opj_pi_comp_t;
/**
Packet iterator
/**
Packet iterator
*/
typedef struct opj_pi_iterator {
/** precise if the packet has been already used (useful for progression order change) */
short int *include;
/** layer step used to localize the packet in the include vector */
int step_l;
/** resolution step used to localize the packet in the include vector */
int step_r;
/** component step used to localize the packet in the include vector */
int step_c;
/** precinct step used to localize the packet in the include vector */
int step_p;
/** component that identify the packet */
int compno;
/** resolution that identify the packet */
int resno;
/** precinct that identify the packet */
int precno;
/** layer that identify the packet */
int layno;
/** 0 if the first packet */
int first;
/** progression order change information */
opj_poc_t poc;
/** Packet iterator : component information */
opj_pi_comp_t *comps;
int numcomps;
int tx0, ty0, tz0;
int tx1, ty1, tz1;
int x, y, z;
int dx, dy, dz;
/** precise if the packet has been already used (useful for progression order change) */
short int *include;
/** layer step used to localize the packet in the include vector */
int step_l;
/** resolution step used to localize the packet in the include vector */
int step_r;
/** component step used to localize the packet in the include vector */
int step_c;
/** precinct step used to localize the packet in the include vector */
int step_p;
/** component that identify the packet */
int compno;
/** resolution that identify the packet */
int resno;
/** precinct that identify the packet */
int precno;
/** layer that identify the packet */
int layno;
/** 0 if the first packet */
int first;
/** progression order change information */
opj_poc_t poc;
/** Packet iterator : component information */
opj_pi_comp_t *comps;
int numcomps;
int tx0, ty0, tz0;
int tx1, ty1, tz1;
int x, y, z;
int dx, dy, dz;
} opj_pi_iterator_t;
/** @name Funciones generales */
@ -139,7 +139,7 @@ void pi_destroy(opj_pi_iterator_t *pi, opj_cp_t *cp, int tileno);
/**
Modify the packet iterator to point to the next packet
@param pi Packet iterator to modify
@return Returns false if pi pointed to the last packet or else returns true
@return Returns false if pi pointed to the last packet or else returns true
*/
bool pi_next(opj_pi_iterator_t * pi);
/* ----------------------------------------------------------------------- */

View File

@ -1,6 +1,6 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
@ -48,27 +48,27 @@ with the corresponding mode switch.
RAW encoding operations
*/
typedef struct opj_raw {
/** Temporary buffer where bits are coded or decoded */
unsigned char c;
/** Number of bits already read or free to write */
unsigned int ct;
/** Maximum length to decode */
unsigned int lenmax;
/** Length decoded */
unsigned int len;
/** Pointer to the current position in the buffer */
unsigned char *bp;
/** Pointer to the start of the buffer */
unsigned char *start;
/** Pointer to the end of the buffer */
unsigned char *end;
/** Temporary buffer where bits are coded or decoded */
unsigned char c;
/** Number of bits already read or free to write */
unsigned int ct;
/** Maximum length to decode */
unsigned int lenmax;
/** Length decoded */
unsigned int len;
/** Pointer to the current position in the buffer */
unsigned char *bp;
/** Pointer to the start of the buffer */
unsigned char *start;
/** Pointer to the end of the buffer */
unsigned char *end;
} opj_raw_t;
/** @name Funciones generales */
/*@{*/
/* ----------------------------------------------------------------------- */
/**
Create a new RAW handle
Create a new RAW handle
@return Returns a new RAW handle if successful, returns NULL otherwise
*/
opj_raw_t* raw_create(void);

View File

@ -1,6 +1,6 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
@ -48,25 +48,25 @@ in T1.C are used by some function in TCD.C.
/* ----------------------------------------------------------------------- */
#define T1_NMSEDEC_BITS 7
#define T1_MAXCBLKW 256 /*< Maximum size of code-block (width) */
#define T1_MAXCBLKH 256 /*< Maximum size of code-block (heigth) */
#define T1_MAXCBLKD 256 /*< Maximum size of code-block (depth) */
#define T1_MINCBLKW 4 /*< Minimum size of code-block (width) */
#define T1_MINCBLKH 4 /*< Minimum size of code-block (heigth) */
#define T1_MINCBLKD 4 /*< Minimum size of code-block (depth) */
#define T1_MAXWHD 18
#define T1_MAXCBLKW 256 /*< Maximum size of code-block (width) */
#define T1_MAXCBLKH 256 /*< Maximum size of code-block (heigth) */
#define T1_MAXCBLKD 256 /*< Maximum size of code-block (depth) */
#define T1_MINCBLKW 4 /*< Minimum size of code-block (width) */
#define T1_MINCBLKH 4 /*< Minimum size of code-block (heigth) */
#define T1_MINCBLKD 4 /*< Minimum size of code-block (depth) */
#define T1_MAXWHD 18
#define T1_CBLKW 256
#define T1_CBLKH 256
#define T1_CBLKD 256
#define T1_SIG_NE 0x0001 /*< Context orientation : North-East direction */
#define T1_SIG_SE 0x0002 /*< Context orientation : South-East direction */
#define T1_SIG_SW 0x0004 /*< Context orientation : South-West direction */
#define T1_SIG_NW 0x0008 /*< Context orientation : North-West direction */
#define T1_SIG_N 0x0010 /*< Context orientation : North direction */
#define T1_SIG_E 0x0020 /*< Context orientation : East direction */
#define T1_SIG_S 0x0040 /*< Context orientation : South direction */
#define T1_SIG_W 0x0080 /*< Context orientation : West direction */
#define T1_SIG_NE 0x0001 /*< Context orientation : North-East direction */
#define T1_SIG_SE 0x0002 /*< Context orientation : South-East direction */
#define T1_SIG_SW 0x0004 /*< Context orientation : South-West direction */
#define T1_SIG_NW 0x0008 /*< Context orientation : North-West direction */
#define T1_SIG_N 0x0010 /*< Context orientation : North direction */
#define T1_SIG_E 0x0020 /*< Context orientation : East direction */
#define T1_SIG_S 0x0040 /*< Context orientation : South direction */
#define T1_SIG_W 0x0080 /*< Context orientation : West direction */
#define T1_SIG_OTH (T1_SIG_N|T1_SIG_NE|T1_SIG_E|T1_SIG_SE|T1_SIG_S|T1_SIG_SW|T1_SIG_W|T1_SIG_NW)
#define T1_SIG_PRIM (T1_SIG_N|T1_SIG_E|T1_SIG_S|T1_SIG_W)
@ -95,8 +95,8 @@ in T1.C are used by some function in TCD.C.
#define T1_NMSEDEC_FRACBITS (T1_NMSEDEC_BITS-1)
#define T1_TYPE_MQ 0 /*< Normal coding using entropy coder */
#define T1_TYPE_RAW 1 /*< No encoding the information is store under raw format in codestream (mode switch RAW)*/
#define T1_TYPE_MQ 0 /*< Normal coding using entropy coder */
#define T1_TYPE_RAW 1 /*< No encoding the information is store under raw format in codestream (mode switch RAW)*/
/* ----------------------------------------------------------------------- */
@ -104,34 +104,34 @@ in T1.C are used by some function in TCD.C.
Tier-1 coding (coding of code-block coefficients)
*/
typedef struct opj_t1 {
/** codec context */
opj_common_ptr cinfo;
/** codec context */
opj_common_ptr cinfo;
/** MQC component */
opj_mqc_t *mqc;
/** RAW component */
opj_raw_t *raw;
/** LUTs for context-based coding */
int lut_ctxno_zc[1024];
int lut_ctxno_sc[256];
int lut_ctxno_mag[4096];
int lut_spb[256];
/** LUTs for decoding normalised MSE */
int lut_nmsedec_sig[1 << T1_NMSEDEC_BITS];
int lut_nmsedec_sig0[1 << T1_NMSEDEC_BITS];
int lut_nmsedec_ref[1 << T1_NMSEDEC_BITS];
int lut_nmsedec_ref0[1 << T1_NMSEDEC_BITS];
/** Codeblock data */
int data[T1_CBLKD][T1_CBLKH][T1_CBLKW];/*int ***data;*/
/** Context information for each voxel in codeblock */
int flags[T1_CBLKD + 2][T1_CBLKH + 2][T1_CBLKH + 2];/*int ***flags;*/
/** MQC component */
opj_mqc_t *mqc;
/** RAW component */
opj_raw_t *raw;
/** LUTs for context-based coding */
int lut_ctxno_zc[1024];
int lut_ctxno_sc[256];
int lut_ctxno_mag[4096];
int lut_spb[256];
/** LUTs for decoding normalised MSE */
int lut_nmsedec_sig[1 << T1_NMSEDEC_BITS];
int lut_nmsedec_sig0[1 << T1_NMSEDEC_BITS];
int lut_nmsedec_ref[1 << T1_NMSEDEC_BITS];
int lut_nmsedec_ref0[1 << T1_NMSEDEC_BITS];
/** Codeblock data */
int data[T1_CBLKD][T1_CBLKH][T1_CBLKW];/*int ***data;*/
/** Context information for each voxel in codeblock */
int flags[T1_CBLKD + 2][T1_CBLKH + 2][T1_CBLKH + 2];/*int ***flags;*/
} opj_t1_t;
/** @name Exported functions */
/*@{*/
/* ----------------------------------------------------------------------- */
/**
Create a new T1 handle
Create a new T1 handle
and initialize the look-up tables of the Tier-1 coder/decoder
@return Returns a new T1 handle if successful, returns NULL otherwise
@see t1_init_luts
@ -159,8 +159,8 @@ void t1_decode_cblks(opj_t1_t *t1, opj_tcd_tile_t *tile, opj_tcp_t *tcp);
/**
Get weigths of MSE decoding
@param nmsedec The normalized MSE reduction
@param compno
@param level
@param compno
@param level
@param orient
@param bpno
@param stepsize
@ -168,7 +168,8 @@ Get weigths of MSE decoding
@param dwtid
returns MSE associated to decoding pass
*/
double t1_getwmsedec(int nmsedec, int compno, int level[3], int orient, int bpno, double stepsize, int numcomps, int dwtid[3]);
double t1_getwmsedec(int nmsedec, int compno, int level[3], int orient,
int bpno, double stepsize, int numcomps, int dwtid[3]);
/* ----------------------------------------------------------------------- */
/*@}*/

View File

@ -39,62 +39,62 @@ The functions in T1_3D.C are used by some function in TCD.C.
/* ----------------------------------------------------------------------- */
/* Neighbourhood of 3D EBCOT (Significance context)*/
#define T1_3D_SIG_NE 0x00000001 /*< Context orientation : North-East direction */
#define T1_3D_SIG_SE 0x00000002 /*< Context orientation : South-East direction */
#define T1_3D_SIG_SW 0x00000004 /*< Context orientation : South-West direction */
#define T1_3D_SIG_NW 0x00000008 /* Context orientation : North-West direction */
#define T1_3D_SIG_N 0x00000010 /*< Context orientation : North direction */
#define T1_3D_SIG_E 0x00000020 /*< Context orientation : East direction */
#define T1_3D_SIG_S 0x00000040 /*< Context orientation : South direction */
#define T1_3D_SIG_W 0x00000080 /*< Context orientation : West direction */
#define T1_3D_SIG_FC 0x00000100 /*< Context orientation : Forward Central direction */
#define T1_3D_SIG_BC 0x00000200 /*< Context orientation : Backward Central direction */
#define T1_3D_SIG_FNE 0x00000400 /*< Context orientation : Forward North-East direction */
#define T1_3D_SIG_FSE 0x00000800 /*< Context orientation : Forward South-East direction */
#define T1_3D_SIG_FSW 0x00001000 /*< Context orientation : Forward South-West direction */
#define T1_3D_SIG_FNW 0x00002000 /*< Context orientation : Forward North-West direction */
#define T1_3D_SIG_FN 0x00004000 /*< Context orientation : Forward North direction */
#define T1_3D_SIG_FE 0x00008000 /*< Context orientation : Forward East direction */
#define T1_3D_SIG_FS 0x00010000 /*< Context orientation : Forward South direction */
#define T1_3D_SIG_FW 0x00020000 /*< Context orientation : Forward West direction */
#define T1_3D_SIG_BNE 0x00040000 /*< Context orientation : Backward North-East direction */
#define T1_3D_SIG_BSE 0x00080000 /*< Context orientation : Backward South-East direction */
#define T1_3D_SIG_BSW 0x00100000 /*< Context orientation : Backward South-West direction */
#define T1_3D_SIG_BNW 0x00200000 /*< Context orientation : Backward North-West direction */
#define T1_3D_SIG_BN 0x00400000 /*< Context orientation : Backward North direction */
#define T1_3D_SIG_BE 0x00800000 /*< Context orientation : Backward East direction */
#define T1_3D_SIG_BS 0x01000000 /*< Context orientation : Backward South direction */
#define T1_3D_SIG_BW 0x02000000 /*< Context orientation : Backward West direction */
#define T1_3D_SIG_COTH (T1_3D_SIG_N|T1_3D_SIG_NE|T1_3D_SIG_E|T1_3D_SIG_SE|T1_3D_SIG_S|T1_3D_SIG_SW|T1_3D_SIG_W|T1_3D_SIG_NW)
#define T1_3D_SIG_BOTH (T1_3D_SIG_BN|T1_3D_SIG_BNE|T1_3D_SIG_BE|T1_3D_SIG_BSE|T1_3D_SIG_BS|T1_3D_SIG_BSW|T1_3D_SIG_BW|T1_3D_SIG_BNW|T1_3D_SIG_BC)
#define T1_3D_SIG_NE 0x00000001 /*< Context orientation : North-East direction */
#define T1_3D_SIG_SE 0x00000002 /*< Context orientation : South-East direction */
#define T1_3D_SIG_SW 0x00000004 /*< Context orientation : South-West direction */
#define T1_3D_SIG_NW 0x00000008 /* Context orientation : North-West direction */
#define T1_3D_SIG_N 0x00000010 /*< Context orientation : North direction */
#define T1_3D_SIG_E 0x00000020 /*< Context orientation : East direction */
#define T1_3D_SIG_S 0x00000040 /*< Context orientation : South direction */
#define T1_3D_SIG_W 0x00000080 /*< Context orientation : West direction */
#define T1_3D_SIG_FC 0x00000100 /*< Context orientation : Forward Central direction */
#define T1_3D_SIG_BC 0x00000200 /*< Context orientation : Backward Central direction */
#define T1_3D_SIG_FNE 0x00000400 /*< Context orientation : Forward North-East direction */
#define T1_3D_SIG_FSE 0x00000800 /*< Context orientation : Forward South-East direction */
#define T1_3D_SIG_FSW 0x00001000 /*< Context orientation : Forward South-West direction */
#define T1_3D_SIG_FNW 0x00002000 /*< Context orientation : Forward North-West direction */
#define T1_3D_SIG_FN 0x00004000 /*< Context orientation : Forward North direction */
#define T1_3D_SIG_FE 0x00008000 /*< Context orientation : Forward East direction */
#define T1_3D_SIG_FS 0x00010000 /*< Context orientation : Forward South direction */
#define T1_3D_SIG_FW 0x00020000 /*< Context orientation : Forward West direction */
#define T1_3D_SIG_BNE 0x00040000 /*< Context orientation : Backward North-East direction */
#define T1_3D_SIG_BSE 0x00080000 /*< Context orientation : Backward South-East direction */
#define T1_3D_SIG_BSW 0x00100000 /*< Context orientation : Backward South-West direction */
#define T1_3D_SIG_BNW 0x00200000 /*< Context orientation : Backward North-West direction */
#define T1_3D_SIG_BN 0x00400000 /*< Context orientation : Backward North direction */
#define T1_3D_SIG_BE 0x00800000 /*< Context orientation : Backward East direction */
#define T1_3D_SIG_BS 0x01000000 /*< Context orientation : Backward South direction */
#define T1_3D_SIG_BW 0x02000000 /*< Context orientation : Backward West direction */
#define T1_3D_SIG_COTH (T1_3D_SIG_N|T1_3D_SIG_NE|T1_3D_SIG_E|T1_3D_SIG_SE|T1_3D_SIG_S|T1_3D_SIG_SW|T1_3D_SIG_W|T1_3D_SIG_NW)
#define T1_3D_SIG_BOTH (T1_3D_SIG_BN|T1_3D_SIG_BNE|T1_3D_SIG_BE|T1_3D_SIG_BSE|T1_3D_SIG_BS|T1_3D_SIG_BSW|T1_3D_SIG_BW|T1_3D_SIG_BNW|T1_3D_SIG_BC)
#define T1_3D_SIG_FOTH (T1_3D_SIG_FN|T1_3D_SIG_FNE|T1_3D_SIG_FE|T1_3D_SIG_FSE|T1_3D_SIG_FS|T1_3D_SIG_FSW|T1_3D_SIG_FW|T1_3D_SIG_FNW|T1_3D_SIG_FC)
#define T1_3D_SIG_OTH (T1_3D_SIG_FOTH|T1_3D_SIG_BOTH|T1_3D_SIG_COTH)
#define T1_3D_SIG_PRIM (T1_3D_SIG_N|T1_3D_SIG_E|T1_3D_SIG_S|T1_3D_SIG_W|T1_3D_SIG_FC|T1_3D_SIG_BC)
#define T1_3D_SIG_OTH (T1_3D_SIG_FOTH|T1_3D_SIG_BOTH|T1_3D_SIG_COTH)
#define T1_3D_SIG_PRIM (T1_3D_SIG_N|T1_3D_SIG_E|T1_3D_SIG_S|T1_3D_SIG_W|T1_3D_SIG_FC|T1_3D_SIG_BC)
#define T1_3D_SGN_N 0x0400
#define T1_3D_SGN_E 0x0800
#define T1_3D_SGN_S 0x1000
#define T1_3D_SGN_W 0x2000
#define T1_3D_SGN_F 0x4000
#define T1_3D_SGN_B 0x8000
#define T1_3D_SGN (T1_3D_SGN_N|T1_3D_SGN_E|T1_3D_SGN_S|T1_3D_SGN_W|T1_3D_SGN_F|T1_3D_SGN_B)
#define T1_3D_SGN_N 0x0400
#define T1_3D_SGN_E 0x0800
#define T1_3D_SGN_S 0x1000
#define T1_3D_SGN_W 0x2000
#define T1_3D_SGN_F 0x4000
#define T1_3D_SGN_B 0x8000
#define T1_3D_SGN (T1_3D_SGN_N|T1_3D_SGN_E|T1_3D_SGN_S|T1_3D_SGN_W|T1_3D_SGN_F|T1_3D_SGN_B)
#define T1_3D_SIG 0x0001 /*Significance state*/
#define T1_3D_REFINE 0x0002 /*Delayed significance*/
#define T1_3D_VISIT 0x0004 /*First-pass membership*/
#define T1_3D_SIG 0x0001 /*Significance state*/
#define T1_3D_REFINE 0x0002 /*Delayed significance*/
#define T1_3D_VISIT 0x0004 /*First-pass membership*/
#define T1_3D_NUMCTXS_AGG 1
#define T1_3D_NUMCTXS_ZC 16
#define T1_3D_NUMCTXS_MAG 3
#define T1_3D_NUMCTXS_SC 6
#define T1_3D_NUMCTXS_UNI 1
#define T1_3D_NUMCTXS_AGG 1
#define T1_3D_NUMCTXS_ZC 16
#define T1_3D_NUMCTXS_MAG 3
#define T1_3D_NUMCTXS_SC 6
#define T1_3D_NUMCTXS_UNI 1
#define T1_3D_CTXNO_AGG 0
#define T1_3D_CTXNO_ZC (T1_3D_CTXNO_AGG+T1_3D_NUMCTXS_AGG) /*1*/
#define T1_3D_CTXNO_MAG (T1_3D_CTXNO_ZC+T1_3D_NUMCTXS_ZC) /*17*/
#define T1_3D_CTXNO_SC (T1_3D_CTXNO_MAG+T1_3D_NUMCTXS_MAG) /*20*/
#define T1_3D_CTXNO_UNI (T1_3D_CTXNO_SC+T1_3D_NUMCTXS_SC) /*26*/
#define T1_3D_NUMCTXS (T1_3D_CTXNO_UNI+T1_3D_NUMCTXS_UNI) /*27*/
#define T1_3D_CTXNO_ZC (T1_3D_CTXNO_AGG+T1_3D_NUMCTXS_AGG) /*1*/
#define T1_3D_CTXNO_MAG (T1_3D_CTXNO_ZC+T1_3D_NUMCTXS_ZC) /*17*/
#define T1_3D_CTXNO_SC (T1_3D_CTXNO_MAG+T1_3D_NUMCTXS_MAG) /*20*/
#define T1_3D_CTXNO_UNI (T1_3D_CTXNO_SC+T1_3D_NUMCTXS_SC) /*26*/
#define T1_3D_NUMCTXS (T1_3D_CTXNO_UNI+T1_3D_NUMCTXS_UNI) /*27*/
/* ----------------------------------------------------------------------- */
@ -103,30 +103,30 @@ The functions in T1_3D.C are used by some function in TCD.C.
Tier-1 coding (coding of code-block coefficients)
*/
typedef struct opj_t1_3d {
/** Codec context */
opj_common_ptr cinfo;
/** MQC component */
opj_mqc_t *mqc;
/** RAW component */
opj_raw_t *raw;
/** LUTs for decoding normalised MSE */
int lut_nmsedec_sig[1 << T1_NMSEDEC_BITS];
int lut_nmsedec_sig0[1 << T1_NMSEDEC_BITS];
int lut_nmsedec_ref[1 << T1_NMSEDEC_BITS];
int lut_nmsedec_ref0[1 << T1_NMSEDEC_BITS];
/** Codeblock data */
int data[T1_CBLKD][T1_CBLKH][T1_CBLKW];
/** Context information for each voxel in codeblock */
unsigned int flags[T1_CBLKD + 2][T1_CBLKH + 2][T1_CBLKH + 2];
/** Voxel information (significance/visited/refined) */
int flagSVR[T1_CBLKD + 2][T1_CBLKH + 2][T1_CBLKH + 2];
/** Codec context */
opj_common_ptr cinfo;
/** MQC component */
opj_mqc_t *mqc;
/** RAW component */
opj_raw_t *raw;
/** LUTs for decoding normalised MSE */
int lut_nmsedec_sig[1 << T1_NMSEDEC_BITS];
int lut_nmsedec_sig0[1 << T1_NMSEDEC_BITS];
int lut_nmsedec_ref[1 << T1_NMSEDEC_BITS];
int lut_nmsedec_ref0[1 << T1_NMSEDEC_BITS];
/** Codeblock data */
int data[T1_CBLKD][T1_CBLKH][T1_CBLKW];
/** Context information for each voxel in codeblock */
unsigned int flags[T1_CBLKD + 2][T1_CBLKH + 2][T1_CBLKH + 2];
/** Voxel information (significance/visited/refined) */
int flagSVR[T1_CBLKD + 2][T1_CBLKH + 2][T1_CBLKH + 2];
} opj_t1_3d_t;
/** @name Exported functions */
/*@{*/
/* ----------------------------------------------------------------------- */
/**
Create a new T1_3D handle
Create a new T1_3D handle
and initialize the look-up tables of the Tier-1 coder/decoder
@return Returns a new T1 handle if successful, returns NULL otherwise
@see t1_init_luts
@ -154,8 +154,8 @@ void t1_3d_decode_cblks(opj_t1_3d_t *t1, opj_tcd_tile_t *tile, opj_tcp_t *tcp);
/**
Get weigths of MSE decoding
@param nmsedec The normalized MSE reduction
@param compno
@param level
@param compno
@param level
@param orient
@param bpno
@param reversible

View File

@ -1,6 +1,6 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
@ -48,12 +48,12 @@
Tier-2 coding
*/
typedef struct opj_t2 {
/** Codec context */
opj_common_ptr cinfo;
/** Encoding: pointer to the src volume. Decoding: pointer to the dst volume. */
opj_volume_t *volume;
/** Pointer to the volume coding parameters */
opj_cp_t *cp;
/** Codec context */
opj_common_ptr cinfo;
/** Encoding: pointer to the src volume. Decoding: pointer to the dst volume. */
opj_volume_t *volume;
/** Pointer to the volume coding parameters */
opj_cp_t *cp;
} opj_t2_t;
/** @name Funciones generales */
@ -71,7 +71,8 @@ Encode the packets of a tile to a destination buffer
@param volume_info structure to create an index file
@return Number of bytes written from packets
*/
int t2_encode_packets(opj_t2_t* t2, int tileno, opj_tcd_tile_t *tile, int maxlayers, unsigned char *dest, int len, opj_volume_info_t *volume_info);
int t2_encode_packets(opj_t2_t* t2, int tileno, opj_tcd_tile_t *tile,
int maxlayers, unsigned char *dest, int len, opj_volume_info_t *volume_info);
/**
Decode the packets of a tile from a source buffer
@ -82,7 +83,8 @@ Decode the packets of a tile from a source buffer
@param tile tile for which to decode the packets
@return Number of bytes read from packets
*/
int t2_decode_packets(opj_t2_t *t2, unsigned char *src, int len, int tileno, opj_tcd_tile_t *tile);
int t2_decode_packets(opj_t2_t *t2, unsigned char *src, int len, int tileno,
opj_tcd_tile_t *tile);
/**
Create a T2 handle

View File

@ -1,6 +1,6 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
@ -50,209 +50,209 @@ each other. The functions in TCD.C are used by some function in JP3D.C.
Tile coder/decoder: segment instance
*/
typedef struct opj_tcd_seg {
/** Number of passes in the segment */
int numpasses;
/** Length of information */
int len;
/** Data */
unsigned char *data;
/** Number of passes posible for the segment */
int maxpasses;
/** Number of passes added to the segment */
int numnewpasses;
/** New length after inclusion of segments */
int newlen;
/** Number of passes in the segment */
int numpasses;
/** Length of information */
int len;
/** Data */
unsigned char *data;
/** Number of passes posible for the segment */
int maxpasses;
/** Number of passes added to the segment */
int numnewpasses;
/** New length after inclusion of segments */
int newlen;
} opj_tcd_seg_t;
/**
Tile coder/decoder: pass instance
*/
typedef struct opj_tcd_pass {
/** Rate obtained in the pass*/
int rate;
/** Distorsion obtained in the pass*/
double distortiondec;
int term;
/** Length of information */
int len;
/** Rate obtained in the pass*/
int rate;
/** Distorsion obtained in the pass*/
double distortiondec;
int term;
/** Length of information */
int len;
} opj_tcd_pass_t;
/**
Tile coder/decoder: layer instance
*/
typedef struct opj_tcd_layer {
/** Number of passes in the layer */
int numpasses;
/** Length of information */
int len;
/** Distortion within layer */
double disto; /* add for index (Cfr. Marcela) */
unsigned char *data; /* data */
/** Number of passes in the layer */
int numpasses;
/** Length of information */
int len;
/** Distortion within layer */
double disto; /* add for index (Cfr. Marcela) */
unsigned char *data; /* data */
} opj_tcd_layer_t;
/**
Tile coder/decoder: codeblock instance
*/
typedef struct opj_tcd_cblk {
/** Dimension of the code-blocks : left upper corner (x0, y0, z0) */
int x0, y0, z0;
/** Dimension of the code-blocks : right low corner (x1,y1,z1) */
int x1, y1, z1;
/** Number of bits per simbol in codeblock */
int numbps;
int numlenbits;
int len; /* length */
/** Number of pass already done for the code-blocks */
int numpasses;
/** number of pass added to the code-blocks */
int numnewpasses;
/** Number of segments */
int numsegs;
/** Segments informations */
opj_tcd_seg_t segs[100];
/** Number of passes in the layer */
int numpassesinlayers;
/** Layer information */
opj_tcd_layer_t layers[100];
/** Total number of passes */
int totalpasses;
/** Information about the passes */
opj_tcd_pass_t passes[100];
/* Data */
unsigned char data[524288];
/*unsigned char *data;*/
/** Dimension of the code-blocks : left upper corner (x0, y0, z0) */
int x0, y0, z0;
/** Dimension of the code-blocks : right low corner (x1,y1,z1) */
int x1, y1, z1;
/** Number of bits per simbol in codeblock */
int numbps;
int numlenbits;
int len; /* length */
/** Number of pass already done for the code-blocks */
int numpasses;
/** number of pass added to the code-blocks */
int numnewpasses;
/** Number of segments */
int numsegs;
/** Segments informations */
opj_tcd_seg_t segs[100];
/** Number of passes in the layer */
int numpassesinlayers;
/** Layer information */
opj_tcd_layer_t layers[100];
/** Total number of passes */
int totalpasses;
/** Information about the passes */
opj_tcd_pass_t passes[100];
/* Data */
unsigned char data[524288];
/*unsigned char *data;*/
} opj_tcd_cblk_t;
/**
Tile coder/decoder: precint instance
*/
typedef struct opj_tcd_precinct {
/** Dimension of the precint : left upper corner (x0, y0, z0) */
int x0, y0, z0;
/** Dimension of the precint : right low corner (x1,y1,z1) */
int x1, y1, z1;
/** Number of codeblocks in precinct in width and heigth and length*/
int cblkno[3];
/** Information about the codeblocks */
opj_tcd_cblk_t *cblks;
/** Inclusion tree */
opj_tgt_tree_t *incltree;
/** Missing MSBs tree */
opj_tgt_tree_t *imsbtree;
/** Dimension of the precint : left upper corner (x0, y0, z0) */
int x0, y0, z0;
/** Dimension of the precint : right low corner (x1,y1,z1) */
int x1, y1, z1;
/** Number of codeblocks in precinct in width and heigth and length*/
int cblkno[3];
/** Information about the codeblocks */
opj_tcd_cblk_t *cblks;
/** Inclusion tree */
opj_tgt_tree_t *incltree;
/** Missing MSBs tree */
opj_tgt_tree_t *imsbtree;
} opj_tcd_precinct_t;
/**
Tile coder/decoder: subband instance
*/
typedef struct opj_tcd_band {
/** Dimension of the subband : left upper corner (x0, y0, z0) */
int x0, y0, z0;
/** Dimension of the subband : right low corner (x1,y1,z1) */
int x1, y1, z1;
/** Information about the precints */
opj_tcd_precinct_t *precincts; /* precinct information */
/** Number of bits per symbol in band */
int numbps;
/** Quantization stepsize associated */
float stepsize;
/** Band orientation (O->LLL,...,7->HHH) */
int bandno;
/** Dimension of the subband : left upper corner (x0, y0, z0) */
int x0, y0, z0;
/** Dimension of the subband : right low corner (x1,y1,z1) */
int x1, y1, z1;
/** Information about the precints */
opj_tcd_precinct_t *precincts; /* precinct information */
/** Number of bits per symbol in band */
int numbps;
/** Quantization stepsize associated */
float stepsize;
/** Band orientation (O->LLL,...,7->HHH) */
int bandno;
} opj_tcd_band_t;
/**
Tile coder/decoder: resolution instance
*/
typedef struct opj_tcd_resolution {
/** Dimension of the resolution level : left upper corner (x0, y0, z0) */
int x0, y0, z0;
/** Dimension of the resolution level : right low corner (x1,y1,z1) */
int x1, y1, z1;
/** Number of precints in each dimension for the resolution level */
int prctno[3];
/** Number of subbands for the resolution level */
int numbands;
/** Subband information */
opj_tcd_band_t *bands;
/** Dimension of the resolution level : left upper corner (x0, y0, z0) */
int x0, y0, z0;
/** Dimension of the resolution level : right low corner (x1,y1,z1) */
int x1, y1, z1;
/** Number of precints in each dimension for the resolution level */
int prctno[3];
/** Number of subbands for the resolution level */
int numbands;
/** Subband information */
opj_tcd_band_t *bands;
} opj_tcd_resolution_t;
/**
Tile coder/decoder: component instance
*/
typedef struct opj_tcd_tilecomp {
/** Dimension of the component : left upper corner (x0, y0, z0) */
int x0, y0, z0;
/** Dimension of the component : right low corner (x1,y1,z1) */
int x1, y1, z1;
/** Number of resolutions level if DWT transform*/
int numresolution[3];
/** Resolution information */
opj_tcd_resolution_t *resolutions;
/** Data of the component */
int *data;
/** Fixed_quality related */
int nbpix;
/** Number of bits per voxel in component */
int bpp;
/** Dimension of the component : left upper corner (x0, y0, z0) */
int x0, y0, z0;
/** Dimension of the component : right low corner (x1,y1,z1) */
int x1, y1, z1;
/** Number of resolutions level if DWT transform*/
int numresolution[3];
/** Resolution information */
opj_tcd_resolution_t *resolutions;
/** Data of the component */
int *data;
/** Fixed_quality related */
int nbpix;
/** Number of bits per voxel in component */
int bpp;
} opj_tcd_tilecomp_t;
/**
Tile coder/decoder: tile instance
*/
typedef struct opj_tcd_tile {
/** Dimension of the tile : left upper corner (x0, y0, z0) */
int x0, y0, z0;
/** Dimension of the tile : right low corner (x1,y1,z1) */
int x1, y1, z1;
/** Number of components in tile */
int numcomps;
/** Components information */
opj_tcd_tilecomp_t *comps;
/** Fixed_quality related : no of bytes of data*/
int nbpix;
/** Fixed_quality related : distortion achieved in tile */
double distotile;
/** Fixed_quality related : distortion achieved in each layer */
double distolayer[100];
/** Dimension of the tile : left upper corner (x0, y0, z0) */
int x0, y0, z0;
/** Dimension of the tile : right low corner (x1,y1,z1) */
int x1, y1, z1;
/** Number of components in tile */
int numcomps;
/** Components information */
opj_tcd_tilecomp_t *comps;
/** Fixed_quality related : no of bytes of data*/
int nbpix;
/** Fixed_quality related : distortion achieved in tile */
double distotile;
/** Fixed_quality related : distortion achieved in each layer */
double distolayer[100];
} opj_tcd_tile_t;
/**
Tile coder/decoder: volume instance
*/
typedef struct opj_tcd_volume {
/** Number of tiles in width and heigth and length */
int tw, th, tl;
/** Tiles information */
opj_tcd_tile_t *tiles;
/** Number of tiles in width and heigth and length */
int tw, th, tl;
/** Tiles information */
opj_tcd_tile_t *tiles;
} opj_tcd_volume_t;
/**
Tile coder/decoder
*/
typedef struct opj_tcd {
/** Codec context */
opj_common_ptr cinfo;
/** Volume information */
opj_volume_t *volume;
/** Coding parameters */
opj_cp_t *cp;
/** Coding/decoding parameters common to all tiles */
opj_tcp_t *tcp;
/** Info on each volume tile */
opj_tcd_volume_t *tcd_volume;
/** Pointer to the current encoded/decoded tile */
opj_tcd_tile_t *tcd_tile;
/** Current encoded/decoded tile */
int tcd_tileno;
/** Codec context */
opj_common_ptr cinfo;
/** Volume information */
opj_volume_t *volume;
/** Coding parameters */
opj_cp_t *cp;
/** Coding/decoding parameters common to all tiles */
opj_tcp_t *tcp;
/** Info on each volume tile */
opj_tcd_volume_t *tcd_volume;
/** Pointer to the current encoded/decoded tile */
opj_tcd_tile_t *tcd_tile;
/** Current encoded/decoded tile */
int tcd_tileno;
/**@name working variables */
/*@{*/
opj_tcd_tile_t *tile;
opj_tcd_tilecomp_t *tilec;
opj_tcd_resolution_t *res;
opj_tcd_band_t *band;
opj_tcd_precinct_t *prc;
opj_tcd_cblk_t *cblk;
/*@}*/
/**@name working variables */
/*@{*/
opj_tcd_tile_t *tile;
opj_tcd_tilecomp_t *tilec;
opj_tcd_resolution_t *res;
opj_tcd_band_t *band;
opj_tcd_precinct_t *prc;
opj_tcd_cblk_t *cblk;
/*@}*/
} opj_tcd_t;
/** @name Funciones generales */
@ -275,13 +275,14 @@ Destroy a previously created TCD handle
*/
void tcd_destroy(opj_tcd_t *tcd);
/**
Initialize the tile coder (allocate the memory)
Initialize the tile coder (allocate the memory)
@param tcd TCD handle
@param volume Raw volume
@param cp Coding parameters
@param curtileno Number that identifies the tile that will be encoded
*/
void tcd_malloc_encode(opj_tcd_t *tcd, opj_volume_t * volume, opj_cp_t * cp, int curtileno);
void tcd_malloc_encode(opj_tcd_t *tcd, opj_volume_t * volume, opj_cp_t * cp,
int curtileno);
/**
Initialize the tile coder (reuses the memory allocated by tcd_malloc_encode)(for 3D-DWT)
@param tcd TCD handle
@ -289,7 +290,8 @@ Initialize the tile coder (reuses the memory allocated by tcd_malloc_encode)(for
@param cp Coding parameters
@param curtileno Number that identifies the tile that will be encoded
*/
void tcd_init_encode(opj_tcd_t *tcd, opj_volume_t * volume, opj_cp_t * cp, int curtileno);
void tcd_init_encode(opj_tcd_t *tcd, opj_volume_t * volume, opj_cp_t * cp,
int curtileno);
/**
Free the memory allocated for encoding
@param tcd TCD handle
@ -306,7 +308,8 @@ void tcd_malloc_decode(opj_tcd_t *tcd, opj_volume_t * volume, opj_cp_t * cp);
void tcd_makelayer_fixed(opj_tcd_t *tcd, int layno, int final);
void tcd_rateallocate_fixed(opj_tcd_t *tcd);
void tcd_makelayer(opj_tcd_t *tcd, int layno, double thresh, int final);
bool tcd_rateallocate(opj_tcd_t *tcd, unsigned char *dest, int len, opj_volume_info_t * volume_info);
bool tcd_rateallocate(opj_tcd_t *tcd, unsigned char *dest, int len,
opj_volume_info_t * volume_info);
/**
Encode a tile from the raw volume into a buffer
@param tcd TCD handle
@ -314,9 +317,10 @@ Encode a tile from the raw volume into a buffer
@param dest Destination buffer
@param len Length of destination buffer
@param volume_info Creation of index file
@return
@return
*/
int tcd_encode_tile(opj_tcd_t *tcd, int tileno, unsigned char *dest, int len, opj_volume_info_t * volume_info);
int tcd_encode_tile(opj_tcd_t *tcd, int tileno, unsigned char *dest, int len,
opj_volume_info_t * volume_info);
/**
Decode a tile from a buffer into a raw volume
@param tcd TCD handle

View File

@ -1,6 +1,6 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
@ -50,30 +50,30 @@ are used by some function in T2.C.
Tag node
*/
typedef struct opj_tgt_node {
/** Node parent reference */
struct opj_tgt_node *parent;
/** */
int value;
/** */
int low;
/** */
int known;
/** Node parent reference */
struct opj_tgt_node *parent;
/** */
int value;
/** */
int low;
/** */
int known;
} opj_tgt_node_t;
/**
Tag tree
*/
typedef struct opj_tgt_tree {
/** Number of leaves from horizontal axis */
int numleafsh;
/** Number of leaves from vertical axis */
int numleafsv;
/** Number of leaves from axial axis */
int numleafsz;
/** Number of nodes */
int numnodes;
/** Reference to each node instance */
opj_tgt_node_t *nodes;
/** Number of leaves from horizontal axis */
int numleafsh;
/** Number of leaves from vertical axis */
int numleafsv;
/** Number of leaves from axial axis */
int numleafsz;
/** Number of nodes */
int numnodes;
/** Reference to each node instance */
opj_tgt_node_t *nodes;
} opj_tgt_tree_t;
/** @name Funciones generales */
@ -111,7 +111,8 @@ Encode the value of a leaf of the tag-tree up to a given threshold
@param leafno Number that identifies the leaf to encode
@param threshold Threshold to use when encoding value of the leaf
*/
void tgt_encode(opj_bio_t *bio, opj_tgt_tree_t *tree, int leafno, int threshold);
void tgt_encode(opj_bio_t *bio, opj_tgt_tree_t *tree, int leafno,
int threshold);
/**
Decode the value of a leaf of the tag-tree up to a given threshold
@param bio Pointer to a BIO handle
@ -124,7 +125,7 @@ int tgt_decode(opj_bio_t *bio, opj_tgt_tree_t *tree, int leafno, int threshold);
/*@}*/
/* ----------------------------------------------------------------------- */
void tgt_tree_dump (FILE *fd, opj_tgt_tree_t * tree);
void tgt_tree_dump(FILE *fd, opj_tgt_tree_t * tree);
/*@}*/
#endif /* __TGT_H */

View File

@ -1,6 +1,6 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*

View File

@ -35,11 +35,11 @@
#include "opj_includes.h"
/** auxiliary transport setting parameters*/
typedef struct auxtrans_param{
int tcpauxport; /**< tcp port*/
int udpauxport; /**< udp port*/
SOCKET tcplistensock; /**< listenning socket for aux tcp (-1 if not open)*/
SOCKET udplistensock; /**< listenning socket for aux udp (-1 if not open)*/
typedef struct auxtrans_param {
int tcpauxport; /**< tcp port*/
int udpauxport; /**< udp port*/
SOCKET tcplistensock; /**< listenning socket for aux tcp (-1 if not open)*/
SOCKET udplistensock; /**< listenning socket for aux udp (-1 if not open)*/
} auxtrans_param_t;
/**
@ -49,14 +49,14 @@ typedef struct auxtrans_param{
* @param[in] udp_auxport opening udp auxiliary port ( 0 not to open, valid No. 49152-65535)
* @return intialized transport parameters
*/
auxtrans_param_t init_aux_transport( int tcp_auxport, int udp_auxport);
auxtrans_param_t init_aux_transport(int tcp_auxport, int udp_auxport);
/**
* Close auxiliary transport server of JPIP server
*
* @param[in] auxtrans closing transport server
*/
void close_aux_transport( auxtrans_param_t auxtrans);
void close_aux_transport(auxtrans_param_t auxtrans);
/**
* Send response data on aux transport
@ -68,6 +68,7 @@ void close_aux_transport( auxtrans_param_t auxtrans);
* @param[in] length length of data
* @param[in] maxlenPerFrame maximum data length to send per frame
*/
void send_responsedata_on_aux( OPJ_BOOL istcp, auxtrans_param_t auxtrans, const char cid[], void *data, OPJ_SIZE_T length, OPJ_SIZE_T maxlenPerFrame);
void send_responsedata_on_aux(OPJ_BOOL istcp, auxtrans_param_t auxtrans,
const char cid[], void *data, OPJ_SIZE_T length, OPJ_SIZE_T maxlenPerFrame);
#endif /* !AUXTRANS_MANAGER_H_ */

View File

@ -28,26 +28,26 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef BOX_MANAGER_H_
# define BOX_MANAGER_H_
#ifndef BOX_MANAGER_H_
# define BOX_MANAGER_H_
#include "byte_manager.h"
/** box parameters*/
typedef struct box_param{
int fd; /**< file descriptor*/
OPJ_OFF_T offset; /**< byte position of the whole Box (LBox) in the file*/
Byte_t headlen; /**< header length 8 or 16*/
Byte8_t length; /**< length of the whole Box*/
char type[4]; /**< type of information in the DBox*/
struct box_param *next; /**< pointer to the next box*/
typedef struct box_param {
int fd; /**< file descriptor*/
OPJ_OFF_T offset; /**< byte position of the whole Box (LBox) in the file*/
Byte_t headlen; /**< header length 8 or 16*/
Byte8_t length; /**< length of the whole Box*/
char type[4]; /**< type of information in the DBox*/
struct box_param *next; /**< pointer to the next box*/
} box_param_t;
/** Box list parameters*/
typedef struct boxlist_param{
box_param_t *first; /**< first box pointer of the list*/
box_param_t *last; /**< last box pointer of the list*/
typedef struct boxlist_param {
box_param_t *first; /**< first box pointer of the list*/
box_param_t *last; /**< last box pointer of the list*/
} boxlist_param_t;
@ -66,7 +66,7 @@ boxlist_param_t * gene_boxlist(void);
* @param[in] length length of the decomposing region
* @return pointer to the generated boxlist
*/
boxlist_param_t * get_boxstructure( int fd, OPJ_OFF_T offset, OPJ_SIZE_T length);
boxlist_param_t * get_boxstructure(int fd, OPJ_OFF_T offset, OPJ_SIZE_T length);
/**
@ -76,7 +76,7 @@ boxlist_param_t * get_boxstructure( int fd, OPJ_OFF_T offset, OPJ_SIZE_T length)
* @param[in] offset Box offset
* @return pointer to the structure of generate box parameters
*/
box_param_t * gene_boxbyOffset( int fd, OPJ_OFF_T offset);
box_param_t * gene_boxbyOffset(int fd, OPJ_OFF_T offset);
/**
@ -86,29 +86,31 @@ box_param_t * gene_boxbyOffset( int fd, OPJ_OFF_T offset);
* @param[in] offset Box offset of the whole stream
* @return pointer to the structure of generate box parameters
*/
box_param_t * gene_boxbyOffinStream( Byte_t *stream, OPJ_OFF_T offset);
box_param_t * gene_boxbyOffinStream(Byte_t *stream, OPJ_OFF_T offset);
/**
* generate(search) box from JP2 file
*
* @param[in] fd file discriptor of the JP2 file
* @param[in] offset start Byte position of the search
* @param[in] length Byte length of the search, if 0, size to the end of file
* @param[in] length Byte length of the search, if 0, size to the end of file
* @param[in] TBox Box Type
* @return pointer to the structure of generate/found box parameters
*/
box_param_t * gene_boxbyType( int fd, OPJ_OFF_T offset, OPJ_SIZE_T length, const char TBox[]);
box_param_t * gene_boxbyType(int fd, OPJ_OFF_T offset, OPJ_SIZE_T length,
const char TBox[]);
/**
* generate(search) box from code stream
*
* @param[in] stream code stream ( from the first byte)
* @param[in] offset start Byte position of the search
* @param[in] length Byte length of the search, if 0, size to the end of file
* @param[in] length Byte length of the search, if 0, size to the end of file
* @param[in] TBox Box Type
* @return pointer to the structure of generate/found box parameters
*/
box_param_t * gene_boxbyTypeinStream( Byte_t *stream, OPJ_OFF_T offset, OPJ_SIZE_T length, const char TBox[]);
box_param_t * gene_boxbyTypeinStream(Byte_t *stream, OPJ_OFF_T offset,
OPJ_SIZE_T length, const char TBox[]);
/**
* generate child box from JP2 file at the given offset
@ -117,7 +119,7 @@ box_param_t * gene_boxbyTypeinStream( Byte_t *stream, OPJ_OFF_T offset, OPJ_SIZE
* @param[in] offset offset from DBox first byte of superbox
* @return pointer to the structure of generate box parameters
*/
box_param_t * gene_childboxbyOffset( box_param_t *superbox, OPJ_OFF_T offset);
box_param_t * gene_childboxbyOffset(box_param_t *superbox, OPJ_OFF_T offset);
/**
* generate(search) box from JP2 file
@ -127,7 +129,8 @@ box_param_t * gene_childboxbyOffset( box_param_t *superbox, OPJ_OFF_T offset);
* @param[in] TBox Box Type
* @return pointer to the structure of generate/found box parameters
*/
box_param_t * gene_childboxbyType( box_param_t *superbox, OPJ_OFF_T offset, const char TBox[]);
box_param_t * gene_childboxbyType(box_param_t *superbox, OPJ_OFF_T offset,
const char TBox[]);
/**
* get DBox offset
@ -135,7 +138,7 @@ box_param_t * gene_childboxbyType( box_param_t *superbox, OPJ_OFF_T offset, cons
* @param[in] box box pointer
* @return DBox offset (byte position) in the file
*/
OPJ_OFF_T get_DBoxoff( box_param_t *box);
OPJ_OFF_T get_DBoxoff(box_param_t *box);
/**
@ -144,7 +147,7 @@ OPJ_OFF_T get_DBoxoff( box_param_t *box);
* @param[in] box box pointer
* @return DBox length ( content length)
*/
OPJ_SIZE_T get_DBoxlen( box_param_t *box);
OPJ_SIZE_T get_DBoxlen(box_param_t *box);
/**
@ -153,7 +156,7 @@ OPJ_SIZE_T get_DBoxlen( box_param_t *box);
* @param[in] box box pointer
* @return pointer to the fetched bytes
*/
Byte_t * fetch_headbytes( box_param_t *box);
Byte_t * fetch_headbytes(box_param_t *box);
/**
@ -164,7 +167,7 @@ Byte_t * fetch_headbytes( box_param_t *box);
* @param[in] size Byte length
* @return pointer to the fetched data
*/
Byte_t * fetch_DBoxbytes( box_param_t *box, OPJ_OFF_T offset, OPJ_SIZE_T size);
Byte_t * fetch_DBoxbytes(box_param_t *box, OPJ_OFF_T offset, OPJ_SIZE_T size);
/**
* fetch DBox (Box Contents) 1-byte Byte codes in file stream
@ -173,7 +176,7 @@ Byte_t * fetch_DBoxbytes( box_param_t *box, OPJ_OFF_T offset, OPJ_SIZE_T size);
* @param[in] offset start Byte position in DBox
* @return fetched code
*/
Byte_t fetch_DBox1byte( box_param_t *box, OPJ_OFF_T offset);
Byte_t fetch_DBox1byte(box_param_t *box, OPJ_OFF_T offset);
/**
* fetch DBox (Box Contents) 2-byte big endian Byte codes in file stream
@ -182,7 +185,7 @@ Byte_t fetch_DBox1byte( box_param_t *box, OPJ_OFF_T offset);
* @param[in] offset start Byte position in DBox
* @return fetched code
*/
Byte2_t fetch_DBox2bytebigendian( box_param_t *box, OPJ_OFF_T offset);
Byte2_t fetch_DBox2bytebigendian(box_param_t *box, OPJ_OFF_T offset);
/**
* fetch DBox (Box Contents) 4-byte big endian Byte codes in file stream
@ -191,7 +194,7 @@ Byte2_t fetch_DBox2bytebigendian( box_param_t *box, OPJ_OFF_T offset);
* @param[in] offset start Byte position in DBox
* @return fetched code
*/
Byte4_t fetch_DBox4bytebigendian( box_param_t *box, OPJ_OFF_T offset);
Byte4_t fetch_DBox4bytebigendian(box_param_t *box, OPJ_OFF_T offset);
/**
* fetch DBox (Box Contents) 8-byte big endian Byte codes in file stream
@ -200,7 +203,7 @@ Byte4_t fetch_DBox4bytebigendian( box_param_t *box, OPJ_OFF_T offset);
* @param[in] offset start Byte position in DBox
* @return fetched code
*/
Byte8_t fetch_DBox8bytebigendian( box_param_t *box, OPJ_OFF_T offset);
Byte8_t fetch_DBox8bytebigendian(box_param_t *box, OPJ_OFF_T offset);
/**
@ -210,14 +213,14 @@ Byte8_t fetch_DBox8bytebigendian( box_param_t *box, OPJ_OFF_T offset);
* @param[in] boxlist box list pointer
* @return found box pointer
*/
box_param_t * search_box( const char type[], boxlist_param_t *boxlist);
box_param_t * search_box(const char type[], boxlist_param_t *boxlist);
/**
* print box parameters
*
* @param[in] box box pointer
*/
void print_box( box_param_t *box);
void print_box(box_param_t *box);
/**
@ -225,7 +228,7 @@ void print_box( box_param_t *box);
*
* @param[in] boxlist box list pointer
*/
void print_allbox( boxlist_param_t *boxlist);
void print_allbox(boxlist_param_t *boxlist);
/**
* delete a box in list
@ -233,7 +236,7 @@ void print_allbox( boxlist_param_t *boxlist);
* @param[in,out] box address of the deleting box pointer
* @param[in] boxlist box list pointer
*/
void delete_box_in_list( box_param_t **box, boxlist_param_t *boxlist);
void delete_box_in_list(box_param_t **box, boxlist_param_t *boxlist);
/**
@ -242,7 +245,7 @@ void delete_box_in_list( box_param_t **box, boxlist_param_t *boxlist);
* @param[in,out] type box type
* @param[in] boxlist box list pointer
*/
void delete_box_in_list_by_type( const char type[], boxlist_param_t *boxlist);
void delete_box_in_list_by_type(const char type[], boxlist_param_t *boxlist);
/**
@ -250,7 +253,7 @@ void delete_box_in_list_by_type( const char type[], boxlist_param_t *boxlist);
*
* @param[in,out] boxlist address of the box list pointer
*/
void delete_boxlist( boxlist_param_t **boxlist);
void delete_boxlist(boxlist_param_t **boxlist);
/**
@ -259,6 +262,6 @@ void delete_boxlist( boxlist_param_t **boxlist);
* @param[in] box box pointer
* @param[in] boxlist box list pointer
*/
void insert_box_into_list( box_param_t *box, boxlist_param_t *boxlist);
void insert_box_into_list(box_param_t *box, boxlist_param_t *boxlist);
#endif /* !BOX_MANAGER_H_ */
#endif /* !BOX_MANAGER_H_ */

View File

@ -28,19 +28,19 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef BOXHEADER_MANAGER_H_
# define BOXHEADER_MANAGER_H_
#ifndef BOXHEADER_MANAGER_H_
# define BOXHEADER_MANAGER_H_
#include "openjpeg.h"
#include "byte_manager.h"
#include "box_manager.h"
/** box header parameters*/
typedef struct boxheader_param{
Byte_t headlen; /**< header length 8 or 16*/
Byte8_t length; /**< length of the reference Box*/
char type[4]; /**< type of information in the DBox*/
struct boxheader_param *next; /**< pointer to the next header box*/
typedef struct boxheader_param {
Byte_t headlen; /**< header length 8 or 16*/
Byte8_t length; /**< length of the reference Box*/
char type[4]; /**< type of information in the DBox*/
struct boxheader_param *next; /**< pointer to the next header box*/
} boxheader_param_t;
@ -51,7 +51,7 @@ typedef struct boxheader_param{
* @param[in] offset Box offset
* @return pointer to the structure of generate box header parameters
*/
boxheader_param_t * gene_boxheader( int fd, OPJ_OFF_T offset);
boxheader_param_t * gene_boxheader(int fd, OPJ_OFF_T offset);
/**
* generate a child box header at the given offset
@ -60,13 +60,14 @@ boxheader_param_t * gene_boxheader( int fd, OPJ_OFF_T offset);
* @param[in] offset offset from DBox first byte of superbox
* @return pointer to the structure of generate box header parameters
*/
boxheader_param_t * gene_childboxheader( box_param_t *superbox, OPJ_OFF_T offset);
boxheader_param_t * gene_childboxheader(box_param_t *superbox,
OPJ_OFF_T offset);
/**
* print box header parameters
*
* @param[in] boxheader boxheader pointer
*/
void print_boxheader( boxheader_param_t *boxheader);
void print_boxheader(boxheader_param_t *boxheader);
#endif /* !BOXHEADER_MANAGER_H_ */
#endif /* !BOXHEADER_MANAGER_H_ */

View File

@ -28,8 +28,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef BYTE_MANAGER_H_
#define BYTE_MANAGER_H_
#ifndef BYTE_MANAGER_H_
#define BYTE_MANAGER_H_
#include <stddef.h>
#include "openjpeg.h"
@ -47,7 +47,7 @@ typedef uint64_t Byte8_t;
* @param[in] size Byte length
* @return pointer to the fetched data
*/
Byte_t * fetch_bytes( int fd, OPJ_OFF_T offset, OPJ_SIZE_T size);
Byte_t * fetch_bytes(int fd, OPJ_OFF_T offset, OPJ_SIZE_T size);
/**
@ -57,7 +57,7 @@ Byte_t * fetch_bytes( int fd, OPJ_OFF_T offset, OPJ_SIZE_T size);
* @param[in] offset start Byte position
* @return fetched codes
*/
Byte_t fetch_1byte( int fd, OPJ_OFF_T offset);
Byte_t fetch_1byte(int fd, OPJ_OFF_T offset);
/**
* fetch a 2-byte big endian Byte codes in file stream
@ -66,7 +66,7 @@ Byte_t fetch_1byte( int fd, OPJ_OFF_T offset);
* @param[in] offset start Byte position
* @return fetched codes
*/
Byte2_t fetch_2bytebigendian( int fd, OPJ_OFF_T offset);
Byte2_t fetch_2bytebigendian(int fd, OPJ_OFF_T offset);
/**
* fetch a 4-byte big endian Byte codes in file stream
@ -75,7 +75,7 @@ Byte2_t fetch_2bytebigendian( int fd, OPJ_OFF_T offset);
* @param[in] offset start Byte position
* @return fetched codes
*/
Byte4_t fetch_4bytebigendian( int fd, OPJ_OFF_T offset);
Byte4_t fetch_4bytebigendian(int fd, OPJ_OFF_T offset);
/**
* fetch a 8-byte big endian Byte codes in file stream
@ -84,7 +84,7 @@ Byte4_t fetch_4bytebigendian( int fd, OPJ_OFF_T offset);
* @param[in] offset start Byte position
* @return fetched codes
*/
Byte8_t fetch_8bytebigendian( int fd, OPJ_OFF_T offset);
Byte8_t fetch_8bytebigendian(int fd, OPJ_OFF_T offset);
/**
@ -93,7 +93,7 @@ Byte8_t fetch_8bytebigendian( int fd, OPJ_OFF_T offset);
* @param[in] buf Byte codes
* @return resolved number
*/
Byte2_t big2( Byte_t *buf);
Byte2_t big2(Byte_t *buf);
/**
* convert 4-byte big endian Byte codes to number
@ -101,7 +101,7 @@ Byte2_t big2( Byte_t *buf);
* @param[in] buf Byte codes
* @return resolved number
*/
Byte4_t big4( Byte_t *buf);
Byte4_t big4(Byte_t *buf);
/**
* convert 8-byte big endian Byte codes to number
@ -109,15 +109,15 @@ Byte4_t big4( Byte_t *buf);
* @param[in] buf Byte codes
* @return resolved number
*/
Byte8_t big8( Byte_t *buf);
Byte8_t big8(Byte_t *buf);
/**
* modify 4Byte code in a codestream
*
*
* @param[in] code code value
* @param[out] stream modifying codestream
*/
void modify_4Bytecode( Byte4_t code, Byte_t *stream);
void modify_4Bytecode(Byte4_t code, Byte_t *stream);
/**
* Get file size
@ -125,6 +125,6 @@ void modify_4Bytecode( Byte4_t code, Byte_t *stream);
* @param[in] fd file discriptor
* @return file size
*/
OPJ_OFF_T get_filesize( int fd);
OPJ_OFF_T get_filesize(int fd);
#endif /* !BYTE_MANAGER_H_ */
#endif /* !BYTE_MANAGER_H_ */

View File

@ -28,28 +28,28 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef CACHE_MANAGER_H_
# define CACHE_MANAGER_H_
#ifndef CACHE_MANAGER_H_
# define CACHE_MANAGER_H_
#include "metadata_manager.h"
#include "ihdrbox_manager.h"
/** cache parameters*/
typedef struct cache_param{
char *filename; /**< file name*/
char *tid; /**< taregt identifier*/
int csn; /**< codestream number*/
char **cid; /**< dynamic array of channel identifiers*/
int numOfcid; /**< number of cids*/
metadatalist_param_t *metadatalist; /**< metadata-bin list*/
ihdrbox_param_t *ihdrbox; /**< ihdrbox*/
struct cache_param *next; /**< pointer to the next cache*/
typedef struct cache_param {
char *filename; /**< file name*/
char *tid; /**< taregt identifier*/
int csn; /**< codestream number*/
char **cid; /**< dynamic array of channel identifiers*/
int numOfcid; /**< number of cids*/
metadatalist_param_t *metadatalist; /**< metadata-bin list*/
ihdrbox_param_t *ihdrbox; /**< ihdrbox*/
struct cache_param *next; /**< pointer to the next cache*/
} cache_param_t;
/**< cache list parameters*/
typedef struct cachelist_param{
cache_param_t *first; /**< first cache pointer of the list*/
cache_param_t *last; /**< last cache pointer of the list*/
typedef struct cachelist_param {
cache_param_t *first; /**< first cache pointer of the list*/
cache_param_t *last; /**< last cache pointer of the list*/
} cachelist_param_t;
@ -76,14 +76,15 @@ void delete_cachelist(cachelist_param_t **cachelist);
* @param[in] cid channel identifier
* @return pointer to the generated cache
*/
cache_param_t * gene_cache( const char *targetname, int csn, char *tid, char *cid);
cache_param_t * gene_cache(const char *targetname, int csn, char *tid,
char *cid);
/**
* delete a cache
*
* @param[in] cache address of the cache pointer
*/
void delete_cache( cache_param_t **cache);
void delete_cache(cache_param_t **cache);
/**
* insert a cache into list
@ -91,7 +92,7 @@ void delete_cache( cache_param_t **cache);
* @param[in] cache cache pointer
* @param[in] cachelist cache list pointer
*/
void insert_cache_into_list( cache_param_t *cache, cachelist_param_t *cachelist);
void insert_cache_into_list(cache_param_t *cache, cachelist_param_t *cachelist);
/**
@ -101,7 +102,8 @@ void insert_cache_into_list( cache_param_t *cache, cachelist_param_t *cachelist)
* @param[in] cachelist cache list pointer
* @return found cache pointer
*/
cache_param_t * search_cache( const char targetname[], cachelist_param_t *cachelist);
cache_param_t * search_cache(const char targetname[],
cachelist_param_t *cachelist);
/**
@ -111,7 +113,7 @@ cache_param_t * search_cache( const char targetname[], cachelist_param_t *cachel
* @param[in] cachelist cache list pointer
* @return found cache pointer
*/
cache_param_t * search_cacheBycsn( int csn, cachelist_param_t *cachelist);
cache_param_t * search_cacheBycsn(int csn, cachelist_param_t *cachelist);
/**
@ -121,7 +123,8 @@ cache_param_t * search_cacheBycsn( int csn, cachelist_param_t *cachelist);
* @param[in] cachelist cache list pointer
* @return found cache pointer
*/
cache_param_t * search_cacheBycid( const char cid[], cachelist_param_t *cachelist);
cache_param_t * search_cacheBycid(const char cid[],
cachelist_param_t *cachelist);
/**
@ -131,7 +134,8 @@ cache_param_t * search_cacheBycid( const char cid[], cachelist_param_t *cachelis
* @param[in] cachelist cache list pointer
* @return found cache pointer
*/
cache_param_t * search_cacheBytid( const char tid[], cachelist_param_t *cachelist);
cache_param_t * search_cacheBytid(const char tid[],
cachelist_param_t *cachelist);
/**
* add cid into a cache
@ -139,7 +143,7 @@ cache_param_t * search_cacheBytid( const char tid[], cachelist_param_t *cachelis
* @param[in] cid channel identifier
* @param[in] cache cache pointer
*/
void add_cachecid( const char *cid, cache_param_t *cache);
void add_cachecid(const char *cid, cache_param_t *cache);
/**
@ -148,7 +152,7 @@ void add_cachecid( const char *cid, cache_param_t *cache);
* @param[in] tid target identifier
* @param[in] cache cache pointer
*/
void update_cachetid( const char *tid, cache_param_t *cache);
void update_cachetid(const char *tid, cache_param_t *cache);
/**
@ -157,7 +161,7 @@ void update_cachetid( const char *tid, cache_param_t *cache);
* @param[in] cid channel identifier
* @param[in] cachelist cachelist pointer
*/
void remove_cachecid( const char *cid, cachelist_param_t *cachelist);
void remove_cachecid(const char *cid, cachelist_param_t *cachelist);
/**
@ -165,13 +169,13 @@ void remove_cachecid( const char *cid, cachelist_param_t *cachelist);
*
* @param[in] cache cache pointer
*/
void print_cache( cache_param_t *cache);
void print_cache(cache_param_t *cache);
/**
* print all cache parameters
*
* @param[in] cachelist cache list pointer
*/
void print_allcache( cachelist_param_t *cachelist);
void print_allcache(cachelist_param_t *cachelist);
#endif /* !CACHE_MANAGER_H_ */

View File

@ -28,26 +28,26 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef CACHEMODEL_MANAGER_H_
# define CACHEMODEL_MANAGER_H_
#ifndef CACHEMODEL_MANAGER_H_
# define CACHEMODEL_MANAGER_H_
#include "target_manager.h"
/** Cache model parameters*/
typedef struct cachemodel_param{
target_param_t *target; /**< reference pointer to the target*/
OPJ_BOOL jppstream; /**< return type, true: JPP-stream, false: JPT-stream*/
OPJ_BOOL mhead_model; /**< main header model, if sent, 1, else 0*/
OPJ_BOOL *tp_model; /**< dynamic array pointer of tile part model, if sent, 1, else 0*/
OPJ_BOOL *th_model; /**< dynamic array pointer of tile header model*/
OPJ_BOOL **pp_model; /**< dynamic array pointer of precint packet model*/
struct cachemodel_param *next; /**< pointer to the next cache model*/
typedef struct cachemodel_param {
target_param_t *target; /**< reference pointer to the target*/
OPJ_BOOL jppstream; /**< return type, true: JPP-stream, false: JPT-stream*/
OPJ_BOOL mhead_model; /**< main header model, if sent, 1, else 0*/
OPJ_BOOL *tp_model; /**< dynamic array pointer of tile part model, if sent, 1, else 0*/
OPJ_BOOL *th_model; /**< dynamic array pointer of tile header model*/
OPJ_BOOL **pp_model; /**< dynamic array pointer of precint packet model*/
struct cachemodel_param *next; /**< pointer to the next cache model*/
} cachemodel_param_t;
/** Cache model list parameters*/
typedef struct cachemodellist_param{
cachemodel_param_t *first; /**< first cache model pointer of the list*/
cachemodel_param_t *last; /**< last cache model pointer of the list*/
typedef struct cachemodellist_param {
cachemodel_param_t *first; /**< first cache model pointer of the list*/
cachemodel_param_t *last; /**< last cache model pointer of the list*/
} cachemodellist_param_t;
@ -66,7 +66,8 @@ cachemodellist_param_t * gene_cachemodellist(void);
* @param[in] reqJPP if JPP-stream is desired true, JPT-stream false
* @return pointer to the generated cache model
*/
cachemodel_param_t * gene_cachemodel( cachemodellist_param_t *cachemodellist, target_param_t *target, OPJ_BOOL reqJPP);
cachemodel_param_t * gene_cachemodel(cachemodellist_param_t *cachemodellist,
target_param_t *target, OPJ_BOOL reqJPP);
/**
@ -74,7 +75,7 @@ cachemodel_param_t * gene_cachemodel( cachemodellist_param_t *cachemodellist, ta
*
* @param[in] cachemodel cache model
*/
void print_cachemodel( cachemodel_param_t cachemodel);
void print_cachemodel(cachemodel_param_t cachemodel);
/**
@ -84,7 +85,8 @@ void print_cachemodel( cachemodel_param_t cachemodel);
* @param[in] cachemodellist cache model list
* @return found cache model pointer
*/
cachemodel_param_t * search_cachemodel( target_param_t *target, cachemodellist_param_t *cachemodellist);
cachemodel_param_t * search_cachemodel(target_param_t *target,
cachemodellist_param_t *cachemodellist);
/**
@ -93,7 +95,7 @@ cachemodel_param_t * search_cachemodel( target_param_t *target, cachemodellist_p
* @param[in] cachemodel cache model
* @return true if sent all, false otherwise
*/
OPJ_BOOL is_allsent( cachemodel_param_t cachemodel);
OPJ_BOOL is_allsent(cachemodel_param_t cachemodel);
/**
@ -101,14 +103,14 @@ OPJ_BOOL is_allsent( cachemodel_param_t cachemodel);
*
* @param[in] cachemodel address of the cachemodel pointer
*/
void delete_cachemodel( cachemodel_param_t **cachemodel);
void delete_cachemodel(cachemodel_param_t **cachemodel);
/**
* delete cachemodel list
*
* @param[in,out] cachemodellist address of the cachemodel list pointer
*/
void delete_cachemodellist( cachemodellist_param_t **cachemodellist);
void delete_cachemodellist(cachemodellist_param_t **cachemodellist);
#endif /* !CACHEMODEL_MANAGER_H_ */
#endif /* !CACHEMODEL_MANAGER_H_ */

View File

@ -28,8 +28,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef CHANNEL_MANAGER_H_
# define CHANNEL_MANAGER_H_
#ifndef CHANNEL_MANAGER_H_
# define CHANNEL_MANAGER_H_
#include <time.h>
#include "query_parser.h"
@ -40,20 +40,20 @@
#define MAX_LENOFCID 30
/** Channel parameters*/
typedef struct channel_param{
cachemodel_param_t *cachemodel; /**< reference pointer to the cache model*/
char cid[MAX_LENOFCID]; /**< channel identifier*/
cnew_transport_t aux; /**< auxiliary transport*/
/* - a record of the client's capabilities and preferences to the extent that the server queues requests*/
time_t start_tm; /**< starting time*/
struct channel_param *next; /**< pointer to the next channel*/
typedef struct channel_param {
cachemodel_param_t *cachemodel; /**< reference pointer to the cache model*/
char cid[MAX_LENOFCID]; /**< channel identifier*/
cnew_transport_t aux; /**< auxiliary transport*/
/* - a record of the client's capabilities and preferences to the extent that the server queues requests*/
time_t start_tm; /**< starting time*/
struct channel_param *next; /**< pointer to the next channel*/
} channel_param_t;
/** Channel list parameters*/
typedef struct channellist_param{
channel_param_t *first; /**< first channel pointer of the list*/
channel_param_t *last; /**< last channel pointer of the list*/
typedef struct channellist_param {
channel_param_t *first; /**< first channel pointer of the list*/
channel_param_t *last; /**< last channel pointer of the list*/
} channellist_param_t;
@ -74,7 +74,9 @@ channellist_param_t * gene_channellist(void);
* @param[in] channellist channel list pointer
* @return pointer to the generated channel
*/
channel_param_t * gene_channel( query_param_t query_param, auxtrans_param_t auxtrans, cachemodel_param_t *cachemodel, channellist_param_t *channellist);
channel_param_t * gene_channel(query_param_t query_param,
auxtrans_param_t auxtrans, cachemodel_param_t *cachemodel,
channellist_param_t *channellist);
/**
* set channel variable parameters
@ -82,7 +84,8 @@ channel_param_t * gene_channel( query_param_t query_param, auxtrans_param_t auxt
* @param[in] query_param query parameters
* @param[in,out] channel pointer to the modifying channel
*/
void set_channel_variable_param( query_param_t query_param, channel_param_t *channel);
void set_channel_variable_param(query_param_t query_param,
channel_param_t *channel);
/**
* delete a channel
@ -90,7 +93,8 @@ void set_channel_variable_param( query_param_t query_param, channel_param_t *cha
* @param[in] channel address of the deleting channel pointer
* @param[in,out] channellist channel list pointer
*/
void delete_channel( channel_param_t **channel, channellist_param_t *channellist);
void delete_channel(channel_param_t **channel,
channellist_param_t *channellist);
/**
@ -98,7 +102,7 @@ void delete_channel( channel_param_t **channel, channellist_param_t *channellist
*
* @param[in,out] channellist address of the channel list pointer
*/
void delete_channellist( channellist_param_t **channellist);
void delete_channellist(channellist_param_t **channellist);
/**
@ -106,7 +110,7 @@ void delete_channellist( channellist_param_t **channellist);
*
* @param[in] channellist channel list pointer
*/
void print_allchannel( channellist_param_t *channellist);
void print_allchannel(channellist_param_t *channellist);
/**
@ -116,5 +120,6 @@ void print_allchannel( channellist_param_t *channellist);
* @param[in] channellist channel list pointer
* @return found channel pointer
*/
channel_param_t * search_channel( const char cid[], channellist_param_t *channellist);
#endif /* !CHANNEL_MANAGER_H_ */
channel_param_t * search_channel(const char cid[],
channellist_param_t *channellist);
#endif /* !CHANNEL_MANAGER_H_ */

View File

@ -28,16 +28,16 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef CODESTREAM_MANAGER_H_
# define CODESTREAM_MANAGER_H_
#ifndef CODESTREAM_MANAGER_H_
# define CODESTREAM_MANAGER_H_
#include "byte_manager.h"
/** codestream parameters*/
typedef struct codestream_param{
int fd; /**< file descriptor*/
OPJ_OFF_T offset; /**< byte position of DBox (Box Contents) in the file*/
Byte8_t length; /**< content length*/
typedef struct codestream_param {
int fd; /**< file descriptor*/
OPJ_OFF_T offset; /**< byte position of DBox (Box Contents) in the file*/
Byte8_t length; /**< content length*/
} codestream_param_t;
@ -49,7 +49,7 @@ typedef struct codestream_param{
* @param[in] length codestream length
* @return structure of generated codestream parameters
*/
codestream_param_t set_codestream( int fd, OPJ_OFF_T offset, OPJ_SIZE_T length);
codestream_param_t set_codestream(int fd, OPJ_OFF_T offset, OPJ_SIZE_T length);
/**
@ -60,7 +60,8 @@ codestream_param_t set_codestream( int fd, OPJ_OFF_T offset, OPJ_SIZE_T length);
* @param[in] size Byte length
* @return pointer to the fetched data
*/
Byte_t * fetch_codestreambytes( codestream_param_t *cs, OPJ_OFF_T offset, OPJ_SIZE_T size);
Byte_t * fetch_codestreambytes(codestream_param_t *cs, OPJ_OFF_T offset,
OPJ_SIZE_T size);
/**
* fetch Codestream 1-byte Byte code in file stream
@ -69,7 +70,7 @@ Byte_t * fetch_codestreambytes( codestream_param_t *cs, OPJ_OFF_T offset, OPJ_SI
* @param[in] offset start Byte position in codestream
* @return fetched code
*/
Byte_t fetch_codestream1byte( codestream_param_t *cs, OPJ_OFF_T offset);
Byte_t fetch_codestream1byte(codestream_param_t *cs, OPJ_OFF_T offset);
/**
* fetch Codestream 2-byte big endian Byte codes in file stream
@ -78,7 +79,8 @@ Byte_t fetch_codestream1byte( codestream_param_t *cs, OPJ_OFF_T offset);
* @param[in] offset start Byte position in codestream
* @return fetched code
*/
Byte2_t fetch_codestream2bytebigendian( codestream_param_t *cs, OPJ_OFF_T offset);
Byte2_t fetch_codestream2bytebigendian(codestream_param_t *cs,
OPJ_OFF_T offset);
/**
* fetch Codestream 4-byte big endian Byte codes in file stream
@ -87,7 +89,8 @@ Byte2_t fetch_codestream2bytebigendian( codestream_param_t *cs, OPJ_OFF_T offset
* @param[in] offset start Byte position in codestream
* @return fetched code
*/
Byte4_t fetch_codestream4bytebigendian( codestream_param_t *cs, OPJ_OFF_T offset);
Byte4_t fetch_codestream4bytebigendian(codestream_param_t *cs,
OPJ_OFF_T offset);
/**
@ -95,7 +98,7 @@ Byte4_t fetch_codestream4bytebigendian( codestream_param_t *cs, OPJ_OFF_T offset
*
* @param[in] cs codestream
*/
void print_codestream( codestream_param_t cs);
void print_codestream(codestream_param_t cs);
#endif /* !CODESTREAM_MANAGER_H_ */
#endif /* !CODESTREAM_MANAGER_H_ */

View File

@ -3,7 +3,7 @@
*
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2014, Professor Benoit Macq
* Copyright (c) 2010-2011, Kaori Hagihara
* Copyright (c) 2010-2011, Kaori Hagihara
* Copyright (c) 2011, Lucian Corlaciu, GSoC
* All rights reserved.
*
@ -29,8 +29,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef DEC_CLIENTMSG_HANDLER_H_
# define DEC_CLIENTMSG_HANDLER_H_
#ifndef DEC_CLIENTMSG_HANDLER_H_
# define DEC_CLIENTMSG_HANDLER_H_
#include "imgsock_manager.h"
#include "cache_manager.h"
@ -46,7 +46,8 @@
* @param[in,out] streamlen address of stream length
* @param[in,out] msgqueue message queue pointer
*/
void handle_JPIPstreamMSG( SOCKET connected_socket, cachelist_param_t *cachelist, Byte_t **jpipstream, OPJ_SIZE_T *streamlen, msgqueue_param_t *msgqueue);
void handle_JPIPstreamMSG(SOCKET connected_socket, cachelist_param_t *cachelist,
Byte_t **jpipstream, OPJ_SIZE_T *streamlen, msgqueue_param_t *msgqueue);
/**
* handle PNM request message
@ -56,7 +57,8 @@ void handle_JPIPstreamMSG( SOCKET connected_socket, cachelist_param_t *cachelist
* @param[in] msgqueue message queue pointer
* @param[in] cachelist cache list pointer
*/
void handle_PNMreqMSG( SOCKET connected_socket, Byte_t *jpipstream, msgqueue_param_t *msgqueue, cachelist_param_t *cachelist);
void handle_PNMreqMSG(SOCKET connected_socket, Byte_t *jpipstream,
msgqueue_param_t *msgqueue, cachelist_param_t *cachelist);
/**
* handle XML request message
@ -65,7 +67,8 @@ void handle_PNMreqMSG( SOCKET connected_socket, Byte_t *jpipstream, msgqueue_par
* @param[in] jpipstream address of caching jpipstream pointer
* @param[in] cachelist cache list pointer
*/
void handle_XMLreqMSG( SOCKET connected_socket, Byte_t *jpipstream, cachelist_param_t *cachelist);
void handle_XMLreqMSG(SOCKET connected_socket, Byte_t *jpipstream,
cachelist_param_t *cachelist);
/**
* handle TargetID request message
@ -73,7 +76,7 @@ void handle_XMLreqMSG( SOCKET connected_socket, Byte_t *jpipstream, cachelist_pa
* @param[in] connected_socket socket descriptor
* @param[in] cachelist cache list pointer
*/
void handle_TIDreqMSG( SOCKET connected_socket, cachelist_param_t *cachelist);
void handle_TIDreqMSG(SOCKET connected_socket, cachelist_param_t *cachelist);
/**
* handle ChannelID request message
@ -81,7 +84,7 @@ void handle_TIDreqMSG( SOCKET connected_socket, cachelist_param_t *cachelist);
* @param[in] connected_socket socket descriptor
* @param[in] cachelist cache list pointer
*/
void handle_CIDreqMSG( SOCKET connected_socket, cachelist_param_t *cachelist);
void handle_CIDreqMSG(SOCKET connected_socket, cachelist_param_t *cachelist);
/**
* handle distroy ChannelID message
@ -89,7 +92,7 @@ void handle_CIDreqMSG( SOCKET connected_socket, cachelist_param_t *cachelist);
* @param[in] connected_socket socket descriptor
* @param[in,out] cachelist cache list pointer
*/
void handle_dstCIDreqMSG( SOCKET connected_socket, cachelist_param_t *cachelist);
void handle_dstCIDreqMSG(SOCKET connected_socket, cachelist_param_t *cachelist);
/**
* handle SIZ request message
@ -99,7 +102,8 @@ void handle_dstCIDreqMSG( SOCKET connected_socket, cachelist_param_t *cachelist)
* @param[in] msgqueue message queue pointer
* @param[in,out] cachelist cache list pointer
*/
void handle_SIZreqMSG( SOCKET connected_socket, Byte_t *jpipstream, msgqueue_param_t *msgqueue, cachelist_param_t *cachelist);
void handle_SIZreqMSG(SOCKET connected_socket, Byte_t *jpipstream,
msgqueue_param_t *msgqueue, cachelist_param_t *cachelist);
/**
* handle saving JP2 file request message
@ -109,7 +113,8 @@ void handle_SIZreqMSG( SOCKET connected_socket, Byte_t *jpipstream, msgqueue_par
* @param[in] msgqueue message queue pointer
* @param[in] jpipstream address of caching jpipstream pointer
*/
void handle_JP2saveMSG( SOCKET connected_socket, cachelist_param_t *cachelist, msgqueue_param_t *msgqueue, Byte_t *jpipstream);
void handle_JP2saveMSG(SOCKET connected_socket, cachelist_param_t *cachelist,
msgqueue_param_t *msgqueue, Byte_t *jpipstream);
#endif /* !DEC_CLIENTMSG_HANDLER_H_ */
#endif /* !DEC_CLIENTMSG_HANDLER_H_ */

View File

@ -28,53 +28,55 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef FAIXBOX_MANAGER_H_
# define FAIXBOX_MANAGER_H_
#ifndef FAIXBOX_MANAGER_H_
# define FAIXBOX_MANAGER_H_
#include "byte_manager.h"
#include "box_manager.h"
/** 4byte parameters of a faix element*/
typedef struct faixelem4_param{
Byte4_t off; /**< offset*/
Byte4_t len; /**< length*/
typedef struct faixelem4_param {
Byte4_t off; /**< offset*/
Byte4_t len; /**< length*/
} faixelem4_param_t;
/** 8byte parameters of a faix element*/
typedef struct faixelem8_param{
Byte8_t off; /**< offset*/
Byte8_t len; /**< length*/
typedef struct faixelem8_param {
Byte8_t off; /**< offset*/
Byte8_t len; /**< length*/
} faixelem8_param_t;
/** 4byte parameters of fragment array index box*/
typedef struct subfaixbox4_param{
Byte4_t nmax; /**< maximum number of valid elements in any row of the array*/
Byte4_t m; /**< number of raws of the array*/
faixelem4_param_t *elem; /**< dynamic array pointer of faix elements*/
Byte4_t *aux; /**< dynamic array pointer of auxiliary*/
/**info in each element for version 2 or 3*/
typedef struct subfaixbox4_param {
Byte4_t nmax; /**< maximum number of valid elements in any row of the array*/
Byte4_t m; /**< number of raws of the array*/
faixelem4_param_t *elem; /**< dynamic array pointer of faix elements*/
Byte4_t *aux; /**< dynamic array pointer of auxiliary*/
/**info in each element for version 2 or 3*/
} subfaixbox4_param_t;
/** 8byte parameters of fragment array index box*/
typedef struct subfaixbox8_param{
Byte8_t nmax; /**< maximum number of valid elements in any row of the array*/
Byte8_t m; /**< number of raws of the array*/
faixelem8_param_t *elem; /**< dynamic array pointer of faix elements*/
Byte4_t *aux; /**< dynamic array pointer of auxiliary*/
/**info in each element for version 2 or 3*/
typedef struct subfaixbox8_param {
Byte8_t nmax; /**< maximum number of valid elements in any row of the array*/
Byte8_t m; /**< number of raws of the array*/
faixelem8_param_t *elem; /**< dynamic array pointer of faix elements*/
Byte4_t *aux; /**< dynamic array pointer of auxiliary*/
/**info in each element for version 2 or 3*/
} subfaixbox8_param_t;
/** variable sized parameters in fragment array index box*/
typedef union subfaixbox_param{
subfaixbox4_param_t *byte4_params; /**< parameters with 4byte codes for version 0 or 2*/
subfaixbox8_param_t *byte8_params; /**< parameters with 8byte codes for version 1 or 3*/
typedef union subfaixbox_param {
subfaixbox4_param_t
*byte4_params; /**< parameters with 4byte codes for version 0 or 2*/
subfaixbox8_param_t
*byte8_params; /**< parameters with 8byte codes for version 1 or 3*/
} subfaixbox_param_t;
/** fragment array index box parameters*/
/** I.3.2.4.2 Fragment Array Index box*/
typedef struct faixbox_param{
Byte_t version; /**< Refer to the Table I.3 - Version values*/
subfaixbox_param_t subfaixbox; /**< rest information in faixbox*/
typedef struct faixbox_param {
Byte_t version; /**< Refer to the Table I.3 - Version values*/
subfaixbox_param_t subfaixbox; /**< rest information in faixbox*/
} faixbox_param_t;
@ -84,7 +86,7 @@ typedef struct faixbox_param{
* @param[in] box pointer to the reference faix_box
* @return generated faixbox
*/
faixbox_param_t * gene_faixbox( box_param_t *box);
faixbox_param_t * gene_faixbox(box_param_t *box);
/**
@ -92,7 +94,7 @@ faixbox_param_t * gene_faixbox( box_param_t *box);
*
* @param[in] faix faix box pointer
*/
void print_faixbox( faixbox_param_t *faix);
void print_faixbox(faixbox_param_t *faix);
/**
@ -100,21 +102,21 @@ void print_faixbox( faixbox_param_t *faix);
*
* @param[in,out] faix addressof the faixbox pointer
*/
void delete_faixbox( faixbox_param_t **faix);
void delete_faixbox(faixbox_param_t **faix);
/**
* get nmax parameter value from faix box
*
* @param[in] faix faix box pointer
*/
Byte8_t get_nmax( faixbox_param_t *faix);
Byte8_t get_nmax(faixbox_param_t *faix);
/**
* get m parameter value from faix box
*
* @param[in] faix faix box pointer
*/
Byte8_t get_m( faixbox_param_t *faix);
Byte8_t get_m(faixbox_param_t *faix);
/**
* get offset of a element from faix box
@ -123,7 +125,7 @@ Byte8_t get_m( faixbox_param_t *faix);
* @param[in] elem_id element id in a row (0<= <nmax)
* @param[in] row_id row id (0<= <m)
*/
Byte8_t get_elemOff( faixbox_param_t *faix, Byte8_t elem_id, Byte8_t row_id);
Byte8_t get_elemOff(faixbox_param_t *faix, Byte8_t elem_id, Byte8_t row_id);
/**
* get length of a element from faix box
@ -132,7 +134,7 @@ Byte8_t get_elemOff( faixbox_param_t *faix, Byte8_t elem_id, Byte8_t row_id);
* @param[in] elem_id element id in a row (0<= <nmax)
* @param[in] row_id row id (0<= <m)
*/
Byte8_t get_elemLen( faixbox_param_t *faix, Byte8_t elem_id, Byte8_t row_id);
Byte8_t get_elemLen(faixbox_param_t *faix, Byte8_t elem_id, Byte8_t row_id);
/**
* get aux of a element from faix box
@ -141,6 +143,6 @@ Byte8_t get_elemLen( faixbox_param_t *faix, Byte8_t elem_id, Byte8_t row_id);
* @param[in] elem_id element id in a row (0<= <nmax)
* @param[in] row_id row id (0<= <m)
*/
Byte4_t get_elemAux( faixbox_param_t *faix, Byte8_t elem_id, Byte8_t row_id);
Byte4_t get_elemAux(faixbox_param_t *faix, Byte8_t elem_id, Byte8_t row_id);
#endif /* !FAIXBOX_MANAGER_H_ */
#endif /* !FAIXBOX_MANAGER_H_ */

View File

@ -28,19 +28,19 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef IHDRBOX_MANAGER_H_
# define IHDRBOX_MANAGER_H_
#ifndef IHDRBOX_MANAGER_H_
# define IHDRBOX_MANAGER_H_
#include "byte_manager.h"
#include "box_manager.h"
#include "metadata_manager.h"
/** I.5.3.1 Image Header box*/
typedef struct ihdrbox_param{
Byte4_t height;
Byte4_t width;
Byte2_t nc; /**< number of components*/
Byte_t bpc; /**< bits per component*/
typedef struct ihdrbox_param {
Byte4_t height;
Byte4_t width;
Byte2_t nc; /**< number of components*/
Byte_t bpc; /**< bits per component*/
} ihdrbox_param_t;
/**
@ -50,7 +50,8 @@ typedef struct ihdrbox_param{
* @param[in] jpipstream JPT/JPP stream
* @return pointer to generated ihdr box
*/
ihdrbox_param_t * gene_ihdrbox( metadatalist_param_t *metadatalist, Byte_t *jpipstream);
ihdrbox_param_t * gene_ihdrbox(metadatalist_param_t *metadatalist,
Byte_t *jpipstream);
#endif /* !IHDRBOX_MANAGER_H_ */
#endif /* !IHDRBOX_MANAGER_H_ */

View File

@ -28,17 +28,17 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef IMGREG_MANAGER_H_
# define IMGREG_MANAGER_H_
#ifndef IMGREG_MANAGER_H_
# define IMGREG_MANAGER_H_
/** image region parameters */
typedef struct imgreg_param{
int xosiz, yosiz; /** offset from the origin of the reference grid
at the decomposition level */
int fx, fy; /** frame size (fsiz) */
int ox, oy; /** offset (roff) */
int sx, sy; /** region size (rsiz) */
int level; /** decomposition level */
typedef struct imgreg_param {
int xosiz, yosiz; /** offset from the origin of the reference grid
at the decomposition level */
int fx, fy; /** frame size (fsiz) */
int ox, oy; /** offset (roff) */
int sx, sy; /** region size (rsiz) */
int level; /** decomposition level */
} imgreg_param_t;
@ -53,12 +53,12 @@ typedef struct imgreg_param{
* @param[in] numOfreslev number of resolution levels
* @return structure of image region parameters
*/
imgreg_param_t map_viewin2imgreg( const int fx, const int fy,
const int rx, const int ry,
const int rw, const int rh,
const int XOsiz, const int YOsiz,
const int Xsiz, const int Ysiz,
const int numOfreslev);
imgreg_param_t map_viewin2imgreg(const int fx, const int fy,
const int rx, const int ry,
const int rw, const int rh,
const int XOsiz, const int YOsiz,
const int Xsiz, const int Ysiz,
const int numOfreslev);
/**
@ -76,7 +76,8 @@ imgreg_param_t map_viewin2imgreg( const int fx, const int fy,
* @param[in,out] xmax horizontal image size pointer
* @param[in,out] ymax vertical image size pointer
*/
void find_level( int maxlev, int *lev, int *fx, int *fy, int *xmin, int *ymin, int *xmax, int *ymax);
void find_level(int maxlev, int *lev, int *fx, int *fy, int *xmin, int *ymin,
int *xmax, int *ymax);
/**
* compute decomposition level (only to get the level
@ -88,14 +89,14 @@ void find_level( int maxlev, int *lev, int *fx, int *fy, int *xmin, int *ymin, i
* @param[in] Ysiz image height
* @return decomposition level
*/
int comp_decomplev( int fw, int fh, int Xsiz, int Ysiz);
int comp_decomplev(int fw, int fh, int Xsiz, int Ysiz);
/**
* print image region parameters
*
* @param[in] imgreg image region structure of parameters
*/
void print_imgreg( imgreg_param_t imgreg);
void print_imgreg(imgreg_param_t imgreg);
#endif /* !IMGREG_MANAGER_H_ */
#endif /* !IMGREG_MANAGER_H_ */

View File

@ -28,15 +28,15 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef IMGSOCK_MANAGER_H_
# define IMGSOCK_MANAGER_H_
#ifndef IMGSOCK_MANAGER_H_
# define IMGSOCK_MANAGER_H_
#include "byte_manager.h"
#include "sock_manager.h"
#include "opj_includes.h"
#define NUM_OF_MSGTYPES 9
typedef enum eMSGTYPE{ JPIPSTREAM, PNMREQ, XMLREQ, TIDREQ, CIDREQ, CIDDST, SIZREQ, JP2SAVE, QUIT, MSGERROR} msgtype_t;
typedef enum eMSGTYPE { JPIPSTREAM, PNMREQ, XMLREQ, TIDREQ, CIDREQ, CIDDST, SIZREQ, JP2SAVE, QUIT, MSGERROR} msgtype_t;
/**
* indeitify client message type
@ -44,7 +44,7 @@ typedef enum eMSGTYPE{ JPIPSTREAM, PNMREQ, XMLREQ, TIDREQ, CIDREQ, CIDDST, SIZRE
* @param [in] connected_socket file descriptor of the connected socket
* @return message type
*/
msgtype_t identify_clientmsg( SOCKET connected_socket);
msgtype_t identify_clientmsg(SOCKET connected_socket);
/**
* receive a JPT- JPP- stream from client
@ -56,7 +56,8 @@ msgtype_t identify_clientmsg( SOCKET connected_socket);
* @param [out] streamlen length of the received codestream
* @return JPT- JPP- codestream
*/
Byte_t * receive_JPIPstream( SOCKET connected_socket, char **target, char **tid, char **cid, OPJ_SIZE_T *streamlen);
Byte_t * receive_JPIPstream(SOCKET connected_socket, char **target, char **tid,
char **cid, OPJ_SIZE_T *streamlen);
/**
* send PGM/PPM image stream to the client
@ -68,7 +69,8 @@ Byte_t * receive_JPIPstream( SOCKET connected_socket, char **target, char **tid,
* @param [in] numofcomp number of components of the image
* @param [in] maxval maximum value of the image (only 255 supported)
*/
void send_PNMstream( SOCKET connected_socket, Byte_t *pnmstream, unsigned int width, unsigned int height, unsigned int numofcomp, Byte_t maxval);
void send_PNMstream(SOCKET connected_socket, Byte_t *pnmstream,
unsigned int width, unsigned int height, unsigned int numofcomp, Byte_t maxval);
/**
* send XML data stream to the client
@ -77,7 +79,8 @@ void send_PNMstream( SOCKET connected_socket, Byte_t *pnmstream, unsigned int wi
* @param [in] xmlstream xml data stream
* @param [in] length legnth of the xml data stream
*/
void send_XMLstream( SOCKET connected_socket, Byte_t *xmlstream, OPJ_SIZE_T length);
void send_XMLstream(SOCKET connected_socket, Byte_t *xmlstream,
OPJ_SIZE_T length);
/**
* send TID data stream to the client
@ -86,7 +89,8 @@ void send_XMLstream( SOCKET connected_socket, Byte_t *xmlstream, OPJ_SIZE_T leng
* @param [in] tid tid string
* @param [in] tidlen legnth of the tid string
*/
void send_TIDstream( SOCKET connected_socket, const char *tid, OPJ_SIZE_T tidlen);
void send_TIDstream(SOCKET connected_socket, const char *tid,
OPJ_SIZE_T tidlen);
/**
* send CID data stream to the client
@ -95,7 +99,8 @@ void send_TIDstream( SOCKET connected_socket, const char *tid, OPJ_SIZE_T tidlen
* @param [in] cid cid string
* @param [in] cidlen legnth of the cid string
*/
void send_CIDstream( SOCKET connected_socket, const char *cid, OPJ_SIZE_T cidlen);
void send_CIDstream(SOCKET connected_socket, const char *cid,
OPJ_SIZE_T cidlen);
/**
* send SIZ data stream to the client
@ -104,7 +109,8 @@ void send_CIDstream( SOCKET connected_socket, const char *cid, OPJ_SIZE_T cidlen
* @param [in] width original width of the image
* @param [in] height original height of the image
*/
void send_SIZstream( SOCKET connected_socket, unsigned int width, unsigned int height);
void send_SIZstream(SOCKET connected_socket, unsigned int width,
unsigned int height);
/**
* send response signal to the client
@ -112,7 +118,7 @@ void send_SIZstream( SOCKET connected_socket, unsigned int width, unsigned int h
* @param [in] connected_socket file descriptor of the connected socket
* @param [in] succeed whether if the requested process succeeded
*/
void response_signal( SOCKET connected_socket, OPJ_BOOL succeed);
void response_signal(SOCKET connected_socket, OPJ_BOOL succeed);
#endif /* !IMGSOCK_MANAGER_H_ */
@ -124,7 +130,7 @@ void response_signal( SOCKET connected_socket, OPJ_BOOL succeed);
*
* client -> server: JPIP-stream\\n version 1.1\\n (optional for cid registration: targetnamestring\\n tidstring\\n cidstring\\n) bytelengthvalue\\n data \n
* server -> client: 1 or 0 (of 1Byte response signal)
*
*
*\section sec2 PNM request
* Get decoded PGM/PPM image
*

View File

@ -28,8 +28,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef INDEX_MANAGER_H_
# define INDEX_MANAGER_H_
#ifndef INDEX_MANAGER_H_
# define INDEX_MANAGER_H_
#include "opj_config.h"
#include "opj_includes.h"
@ -42,57 +42,59 @@
/** progression order */
#if 0
typedef enum porder {
PROG_UNKNOWN = -1, /**< place-holder */
LRCP = 0, /**< layer-resolution-component-precinct order */
RLCP = 1, /**< resolution-layer-component-precinct order */
RPCL = 2, /**< resolution-precinct-component-layer order */
PCRL = 3, /**< precinct-component-resolution-layer order */
CPRL = 4 /**< component-precinct-resolution-layer order */
PROG_UNKNOWN = -1, /**< place-holder */
LRCP = 0, /**< layer-resolution-component-precinct order */
RLCP = 1, /**< resolution-layer-component-precinct order */
RPCL = 2, /**< resolution-precinct-component-layer order */
PCRL = 3, /**< precinct-component-resolution-layer order */
CPRL = 4 /**< component-precinct-resolution-layer order */
} porder_t;
#endif
/** A.5.1 Image and tile size (SIZ)*/
typedef struct SIZmarker_param{
Byte2_t Lsiz; /**< length of marker segment excluding the marker*/
Byte2_t Rsiz; /**< capabilities that a decoder needs*/
Byte4_t Xsiz; /**< width of the reference grid*/
Byte4_t Ysiz; /**< height of the reference grid*/
Byte4_t XOsiz; /**< horizontal offset from the origin of the reference grid to the left side of the image area*/
Byte4_t YOsiz; /**< vertical offset from the origin of the reference grid to the top side of the image area*/
Byte4_t XTsiz; /**< width of one reference tile with respect to the reference grid*/
Byte4_t YTsiz; /**< height of one reference tile with respect to the reference grid*/
Byte4_t XTOsiz; /**< horizontal offset from the origin of the reference grid to the left side of the first tile*/
Byte4_t YTOsiz; /**< vertical offset from the origin of the reference grid to the top side of the first tile*/
Byte4_t XTnum; /**< number of tiles in horizontal direction*/
Byte4_t YTnum; /**< number of tiles in vertical direction*/
Byte2_t Csiz; /**< number of the components in the image*/
Byte_t Ssiz[3]; /**< precision (depth) in bits and sign of the component samples*/
Byte_t XRsiz[3]; /**< horizontal separation of a sample of component with respect to the reference grid*/
Byte_t YRsiz[3]; /**< vertical separation of a sample of component with respect to the reference grid*/
typedef struct SIZmarker_param {
Byte2_t Lsiz; /**< length of marker segment excluding the marker*/
Byte2_t Rsiz; /**< capabilities that a decoder needs*/
Byte4_t Xsiz; /**< width of the reference grid*/
Byte4_t Ysiz; /**< height of the reference grid*/
Byte4_t XOsiz; /**< horizontal offset from the origin of the reference grid to the left side of the image area*/
Byte4_t YOsiz; /**< vertical offset from the origin of the reference grid to the top side of the image area*/
Byte4_t XTsiz; /**< width of one reference tile with respect to the reference grid*/
Byte4_t YTsiz; /**< height of one reference tile with respect to the reference grid*/
Byte4_t XTOsiz; /**< horizontal offset from the origin of the reference grid to the left side of the first tile*/
Byte4_t YTOsiz; /**< vertical offset from the origin of the reference grid to the top side of the first tile*/
Byte4_t XTnum; /**< number of tiles in horizontal direction*/
Byte4_t YTnum; /**< number of tiles in vertical direction*/
Byte2_t Csiz; /**< number of the components in the image*/
Byte_t Ssiz[3]; /**< precision (depth) in bits and sign of the component samples*/
Byte_t XRsiz[3]; /**< horizontal separation of a sample of component with respect to the reference grid*/
Byte_t YRsiz[3]; /**< vertical separation of a sample of component with respect to the reference grid*/
} SIZmarker_param_t;
/** A.6.1 Coding style default (COD)*/
typedef struct CODmarker_param{
Byte2_t Lcod; /**< length of marker segment excluding the marker*/
Byte_t Scod; /**< Coding style for all components*/
OPJ_PROG_ORDER prog_order; /**< progression order*/
Byte2_t numOflayers; /**< number of layers*/
Byte_t numOfdecomp; /**< number of decompositions levels*/
Byte4_t *XPsiz; /**< dynamic array of precinct width at successive resolution level in order*/
Byte4_t *YPsiz; /**< dynamic array of precinct height at successive resolution level in order*/
typedef struct CODmarker_param {
Byte2_t Lcod; /**< length of marker segment excluding the marker*/
Byte_t Scod; /**< Coding style for all components*/
OPJ_PROG_ORDER prog_order; /**< progression order*/
Byte2_t numOflayers; /**< number of layers*/
Byte_t numOfdecomp; /**< number of decompositions levels*/
Byte4_t *XPsiz; /**< dynamic array of precinct width at successive resolution level in order*/
Byte4_t *YPsiz; /**< dynamic array of precinct height at successive resolution level in order*/
} CODmarker_param_t;
/** index parameters*/
typedef struct index_param{
metadatalist_param_t *metadatalist; /**< metadata-bin list*/
OPJ_OFF_T offset; /**< codestream offset*/
Byte8_t length; /**< codestream length */
Byte8_t mhead_length; /**< main header length */
SIZmarker_param_t SIZ; /**< SIZ marker information*/
CODmarker_param_t COD; /**< COD marker information*/
faixbox_param_t *tilepart; /**< tile part information from tpix box*/
mhixbox_param_t **tileheader; /**< dynamic array of tile header information from thix box*/
faixbox_param_t **precpacket; /**< dynamic array of precint packet information from ppix box*/
typedef struct index_param {
metadatalist_param_t *metadatalist; /**< metadata-bin list*/
OPJ_OFF_T offset; /**< codestream offset*/
Byte8_t length; /**< codestream length */
Byte8_t mhead_length; /**< main header length */
SIZmarker_param_t SIZ; /**< SIZ marker information*/
CODmarker_param_t COD; /**< COD marker information*/
faixbox_param_t *tilepart; /**< tile part information from tpix box*/
mhixbox_param_t
**tileheader; /**< dynamic array of tile header information from thix box*/
faixbox_param_t
**precpacket; /**< dynamic array of precint packet information from ppix box*/
} index_param_t;
@ -103,48 +105,48 @@ typedef struct index_param{
* @param[in] fd file descriptor of the JP2 file
* @return pointer to the generated structure of index parameters
*/
index_param_t * parse_jp2file( int fd);
index_param_t * parse_jp2file(int fd);
/**
* print index parameters
*
* @param[in] index index parameters
*/
void print_index( index_param_t index);
void print_index(index_param_t index);
/**
* print Image and Tile SIZ parameters
*
* @param[in] SIZ SIZ marker information
*/
void print_SIZ( SIZmarker_param_t SIZ);
void print_SIZ(SIZmarker_param_t SIZ);
/**
* print Coding style default COD parameters
*
* @param[in] COD COD marker information
*/
void print_COD( CODmarker_param_t COD);
void print_COD(CODmarker_param_t COD);
/**
* delete index
*
* @param[in,out] index addressof the index pointer
*/
void delete_index( index_param_t **index);
void delete_index(index_param_t **index);
/**
* delete dynamic arrays in COD marker
*
* @param[in] COD COD marker information
*/
void delete_COD( CODmarker_param_t COD);
void delete_COD(CODmarker_param_t COD);
/** 1-dimensional range parameters*/
typedef struct range_param{
Byte4_t minvalue; /**< minimal value*/
Byte4_t maxvalue; /**< maximal value*/
typedef struct range_param {
Byte4_t minvalue; /**< minimal value*/
Byte4_t maxvalue; /**< maximal value*/
} range_param_t;
/**
@ -155,7 +157,8 @@ typedef struct range_param{
* @param[in] level decomposition level
* @return structured range parameter
*/
range_param_t get_tile_Xrange( SIZmarker_param_t SIZ, Byte4_t tile_id, int level);
range_param_t get_tile_Xrange(SIZmarker_param_t SIZ, Byte4_t tile_id,
int level);
/**
* get vertical range of the tile in reference grid
@ -165,7 +168,8 @@ range_param_t get_tile_Xrange( SIZmarker_param_t SIZ, Byte4_t tile_id, int level
* @param[in] level decomposition level
* @return structured range parameter
*/
range_param_t get_tile_Yrange( SIZmarker_param_t SIZ, Byte4_t tile_id, int level);
range_param_t get_tile_Yrange(SIZmarker_param_t SIZ, Byte4_t tile_id,
int level);
/**
@ -176,8 +180,8 @@ range_param_t get_tile_Yrange( SIZmarker_param_t SIZ, Byte4_t tile_id, int level
* @param[in] level decomposition level
* @return tile width
*/
Byte4_t get_tile_XSiz( SIZmarker_param_t SIZ, Byte4_t tile_id, int level);
Byte4_t get_tile_YSiz( SIZmarker_param_t SIZ, Byte4_t tile_id, int level);
Byte4_t get_tile_XSiz(SIZmarker_param_t SIZ, Byte4_t tile_id, int level);
Byte4_t get_tile_YSiz(SIZmarker_param_t SIZ, Byte4_t tile_id, int level);
/**
@ -186,6 +190,6 @@ Byte4_t get_tile_YSiz( SIZmarker_param_t SIZ, Byte4_t tile_id, int level);
* @param[in] index index parameters
* @return true if JPT-stream is feasible
*/
OPJ_BOOL isJPTfeasible( index_param_t index);
OPJ_BOOL isJPTfeasible(index_param_t index);
#endif /* !INDEX_MANAGER_H_ */
#endif /* !INDEX_MANAGER_H_ */

View File

@ -3,7 +3,7 @@
*
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2014, Professor Benoit Macq
* Copyright (c) 2010-2011, Kaori Hagihara
* Copyright (c) 2010-2011, Kaori Hagihara
* Copyright (c) 2011, Lucian Corlaciu, GSoC
* All rights reserved.
*
@ -43,7 +43,8 @@
* @param[out] COD COD marker pointer
* @return if succeeded (true) or failed (false)
*/
OPJ_BOOL get_mainheader_from_j2kstream( Byte_t *j2kstream, SIZmarker_param_t *SIZ, CODmarker_param_t *COD);
OPJ_BOOL get_mainheader_from_j2kstream(Byte_t *j2kstream,
SIZmarker_param_t *SIZ, CODmarker_param_t *COD);
/**
* modify main header in j2k codestream to fit with the new number of decompositions
@ -55,7 +56,8 @@ OPJ_BOOL get_mainheader_from_j2kstream( Byte_t *j2kstream, SIZmarker_param_t *SI
* @param[out] j2klen pointer to the length of j2k code stream
* @return if succeeded (true) or failed (false)
*/
OPJ_BOOL modify_mainheader( Byte_t *j2kstream, int numOfdecomp, SIZmarker_param_t SIZ, CODmarker_param_t COD, Byte8_t *j2klen);
OPJ_BOOL modify_mainheader(Byte_t *j2kstream, int numOfdecomp,
SIZmarker_param_t SIZ, CODmarker_param_t COD, Byte8_t *j2klen);
/**
* modify tile header in j2k codestream to fit with the tile part length, and new number of decompositions for multi-componet images
@ -67,6 +69,7 @@ OPJ_BOOL modify_mainheader( Byte_t *j2kstream, int numOfdecomp, SIZmarker_param_
* @param[out] j2klen pointer to the length of j2k code stream
* @return if succeeded (true) or failed (false)
*/
OPJ_BOOL modify_tileheader( Byte_t *j2kstream, Byte8_t SOToffset, int numOfdecomp, Byte2_t Csiz, Byte8_t *j2klen);
OPJ_BOOL modify_tileheader(Byte_t *j2kstream, Byte8_t SOToffset,
int numOfdecomp, Byte2_t Csiz, Byte8_t *j2klen);
#endif /* !J2KHEADER_MANAGER_H_ */

View File

@ -28,12 +28,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef JP2K_DECODER_H_
# define JP2K_DECODER_H_
#ifndef JP2K_DECODER_H_
# define JP2K_DECODER_H_
#include "byte_manager.h"
#include "ihdrbox_manager.h"
Byte_t * j2k_to_pnm( const char *fn, ihdrbox_param_t **ihdrbox);
Byte_t * j2k_to_pnm(const char *fn, ihdrbox_param_t **ihdrbox);
#endif /* !JP2K_DECODER_H_ */
#endif /* !JP2K_DECODER_H_ */

View File

@ -3,7 +3,7 @@
*
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2014, Professor Benoit Macq
* Copyright (c) 2010-2011, Kaori Hagihara
* Copyright (c) 2010-2011, Kaori Hagihara
* Copyright (c) 2011, Lucian Corlaciu, GSoC
* All rights reserved.
*
@ -29,8 +29,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef JP2K_ENCODER_H_
# define JP2K_ENCODER_H_
#ifndef JP2K_ENCODER_H_
# define JP2K_ENCODER_H_
#include "byte_manager.h"
#include "msgqueue_manager.h"
@ -46,7 +46,8 @@
* @param[out] j2klen pointer to the j2k codestream length
* @return generated reconstructed j2k codestream
*/
Byte_t * recons_j2k( msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte8_t csn, int fw, int fh, Byte8_t *j2klen);
Byte_t * recons_j2k(msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte8_t csn,
int fw, int fh, Byte8_t *j2klen);
/**
@ -58,7 +59,8 @@ Byte_t * recons_j2k( msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte8_t csn
* @param[out] jp2len pointer to the jp2 codestream length
* @return generated reconstructed jp2 codestream
*/
Byte_t * recons_jp2( msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte8_t csn, Byte8_t *jp2len);
Byte_t * recons_jp2(msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte8_t csn,
Byte8_t *jp2len);
/**
* reconstruct j2k codestream of mainheader from message queue
@ -69,6 +71,7 @@ Byte_t * recons_jp2( msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte8_t csn
* @param[out] j2klen pointer to the j2k codestream length
* @return generated reconstructed j2k codestream
*/
Byte_t * recons_j2kmainhead( msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte8_t csn, Byte8_t *j2klen);
Byte_t * recons_j2kmainhead(msgqueue_param_t *msgqueue, Byte_t *jpipstream,
Byte8_t csn, Byte8_t *j2klen);
#endif /* !JP2K_ENCODER_H_ */
#endif /* !JP2K_ENCODER_H_ */

View File

@ -3,7 +3,7 @@
*
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2014, Professor Benoit Macq
* Copyright (c) 2010-2011, Kaori Hagihara
* Copyright (c) 2010-2011, Kaori Hagihara
* Copyright (c) 2011, Lucian Corlaciu, GSoC
* All rights reserved.
*
@ -29,8 +29,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef JPIP_PARSER_H_
# define JPIP_PARSER_H_
#ifndef JPIP_PARSER_H_
# define JPIP_PARSER_H_
#include "query_parser.h"
#include "session_manager.h"
@ -46,7 +46,8 @@
* @param[out] target address of target pointer
* @return if succeeded (true) or failed (false)
*/
OPJ_BOOL identify_target( query_param_t query_param, targetlist_param_t *targetlist, target_param_t **target);
OPJ_BOOL identify_target(query_param_t query_param,
targetlist_param_t *targetlist, target_param_t **target);
/**
* REQUEST: channel association
@ -58,10 +59,10 @@ OPJ_BOOL identify_target( query_param_t query_param, targetlist_param_t *targetl
* @param[out] curchannel address of the associated channel pointer
* @return if succeeded (true) or failed (false)
*/
OPJ_BOOL associate_channel( query_param_t query_param,
sessionlist_param_t *sessionlist,
session_param_t **cursession,
channel_param_t **curchannel);
OPJ_BOOL associate_channel(query_param_t query_param,
sessionlist_param_t *sessionlist,
session_param_t **cursession,
channel_param_t **curchannel);
/**
* REQUEST: new channel (cnew) assignment
*
@ -73,12 +74,12 @@ OPJ_BOOL associate_channel( query_param_t query_param,
* @param[in,out] curchannel address of the associated/opened channel pointer
* @return if succeeded (true) or failed (false)
*/
OPJ_BOOL open_channel( query_param_t query_param,
sessionlist_param_t *sessionlist,
auxtrans_param_t auxtrans,
target_param_t *target,
session_param_t **cursession,
channel_param_t **curchannel);
OPJ_BOOL open_channel(query_param_t query_param,
sessionlist_param_t *sessionlist,
auxtrans_param_t auxtrans,
target_param_t *target,
session_param_t **cursession,
channel_param_t **curchannel);
/**
* REQUEST: channel close (cclose)
@ -89,10 +90,10 @@ OPJ_BOOL open_channel( query_param_t query_param,
* @param[in,out] curchannel address of the deleting channel pointer
* @return if succeeded (true) or failed (false)
*/
OPJ_BOOL close_channel( query_param_t query_param,
sessionlist_param_t *sessionlist,
session_param_t **cursession,
channel_param_t **curchannel);
OPJ_BOOL close_channel(query_param_t query_param,
sessionlist_param_t *sessionlist,
session_param_t **cursession,
channel_param_t **curchannel);
/**
* REQUEST: view-window (fsiz)
@ -104,10 +105,10 @@ OPJ_BOOL close_channel( query_param_t query_param,
* @param[out] msgqueue address of the message queue pointer
* @return if succeeded (true) or failed (false)
*/
OPJ_BOOL gene_JPIPstream( query_param_t query_param,
target_param_t *target,
session_param_t *cursession,
channel_param_t *curchannel,
msgqueue_param_t **msgqueue);
OPJ_BOOL gene_JPIPstream(query_param_t query_param,
target_param_t *target,
session_param_t *cursession,
channel_param_t *curchannel,
msgqueue_param_t **msgqueue);
#endif /* !JPIP_PARSER_H_ */
#endif /* !JPIP_PARSER_H_ */

View File

@ -32,10 +32,13 @@
#include "msgqueue_manager.h"
#include "ihdrbox_manager.h"
Byte_t * update_JPIPstream( Byte_t *newstream, OPJ_SIZE_T newstreamlen, Byte_t *cache_stream, OPJ_SIZE_T *streamlen);
Byte_t * update_JPIPstream(Byte_t *newstream, OPJ_SIZE_T newstreamlen,
Byte_t *cache_stream, OPJ_SIZE_T *streamlen);
void save_codestream( Byte_t *codestream, OPJ_SIZE_T streamlen, const char *fmt);
void save_codestream(Byte_t *codestream, OPJ_SIZE_T streamlen, const char *fmt);
Byte_t * jpipstream_to_pnm( Byte_t *jpipstream, msgqueue_param_t *msgqueue, Byte8_t csn, int fw, int fh, ihdrbox_param_t **ihdrbox);
Byte_t * jpipstream_to_pnm(Byte_t *jpipstream, msgqueue_param_t *msgqueue,
Byte8_t csn, int fw, int fh, ihdrbox_param_t **ihdrbox);
ihdrbox_param_t * get_SIZ_from_jpipstream( Byte_t *jpipstream, msgqueue_param_t *msgqueue, Byte8_t csn);
ihdrbox_param_t * get_SIZ_from_jpipstream(Byte_t *jpipstream,
msgqueue_param_t *msgqueue, Byte8_t csn);

View File

@ -28,8 +28,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef MANFBOX_MANAGER_H_
# define MANFBOX_MANAGER_H_
#ifndef MANFBOX_MANAGER_H_
# define MANFBOX_MANAGER_H_
#include "byte_manager.h"
#include "box_manager.h"
@ -38,8 +38,8 @@
/** manifest box parameters*/
/** I.3.2.3 Manifest box*/
typedef struct manfbox_param{
boxheader_param_t *first; /**< top of the box header list*/
typedef struct manfbox_param {
boxheader_param_t *first; /**< top of the box header list*/
} manfbox_param_t;
@ -49,7 +49,7 @@ typedef struct manfbox_param{
* @param[in] box pointer to the reference manf box
* @return generated manfbox
*/
manfbox_param_t * gene_manfbox( box_param_t *box);
manfbox_param_t * gene_manfbox(box_param_t *box);
/**
@ -57,7 +57,7 @@ manfbox_param_t * gene_manfbox( box_param_t *box);
*
* @param[in,out] manf addressof the manfbox pointer
*/
void delete_manfbox( manfbox_param_t **manf);
void delete_manfbox(manfbox_param_t **manf);
/**
@ -65,7 +65,7 @@ void delete_manfbox( manfbox_param_t **manf);
*
* @param[in] manf manf box pointer
*/
void print_manfbox( manfbox_param_t *manf);
void print_manfbox(manfbox_param_t *manf);
/**
@ -75,7 +75,7 @@ void print_manfbox( manfbox_param_t *manf);
* @param[in] manf manf box pointer
* @return found box pointer
*/
boxheader_param_t * search_boxheader( const char type[], manfbox_param_t *manf);
boxheader_param_t * search_boxheader(const char type[], manfbox_param_t *manf);
#endif /* !MANFBOX_MANAGER_H_ */
#endif /* !MANFBOX_MANAGER_H_ */

View File

@ -28,18 +28,18 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef MARKER_MANAGER_H_
# define MARKER_MANAGER_H_
#ifndef MARKER_MANAGER_H_
# define MARKER_MANAGER_H_
#include "codestream_manager.h"
/** Marker parameters*/
typedef struct marker_param{
codestream_param_t cs; /**< corresponding codestream*/
Byte2_t code; /**< marker code*/
OPJ_OFF_T offset; /**< offset relative to the start of the codestream ( including the length parameter but not the marker itself)*/
Byte2_t length; /**< marker segment length*/
typedef struct marker_param {
codestream_param_t cs; /**< corresponding codestream*/
Byte2_t code; /**< marker code*/
OPJ_OFF_T offset; /**< offset relative to the start of the codestream ( including the length parameter but not the marker itself)*/
Byte2_t length; /**< marker segment length*/
} marker_param_t;
@ -52,7 +52,8 @@ typedef struct marker_param{
* @param[in] length marker segment length
* @return structure of generated marker parameters
*/
marker_param_t set_marker( codestream_param_t cs, Byte2_t code, OPJ_OFF_T offset, Byte2_t length);
marker_param_t set_marker(codestream_param_t cs, Byte2_t code, OPJ_OFF_T offset,
Byte2_t length);
/**
@ -62,7 +63,7 @@ marker_param_t set_marker( codestream_param_t cs, Byte2_t code, OPJ_OFF_T offset
* @param[in] offset start Byte position in marker
* @return fetched code
*/
Byte_t fetch_marker1byte( marker_param_t marker, OPJ_OFF_T offset);
Byte_t fetch_marker1byte(marker_param_t marker, OPJ_OFF_T offset);
/**
* fetch marker content 2-byte big endian Byte codes in file stream
@ -71,7 +72,7 @@ Byte_t fetch_marker1byte( marker_param_t marker, OPJ_OFF_T offset);
* @param[in] offset start Byte position in marker
* @return fetched code
*/
Byte2_t fetch_marker2bytebigendian( marker_param_t marker, OPJ_OFF_T offset);
Byte2_t fetch_marker2bytebigendian(marker_param_t marker, OPJ_OFF_T offset);
/**
* fetch marker content 4-byte big endian Byte codes in file stream
@ -80,7 +81,7 @@ Byte2_t fetch_marker2bytebigendian( marker_param_t marker, OPJ_OFF_T offset);
* @param[in] offset start Byte position in marker
* @return fetched code
*/
Byte4_t fetch_marker4bytebigendian( marker_param_t marker, OPJ_OFF_T offset);
Byte4_t fetch_marker4bytebigendian(marker_param_t marker, OPJ_OFF_T offset);
#endif /* !MARKER_MANAGER_H_ */
#endif /* !MARKER_MANAGER_H_ */

View File

@ -28,30 +28,32 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef METADATA_MANAGER_H_
#define METADATA_MANAGER_H_
#ifndef METADATA_MANAGER_H_
#define METADATA_MANAGER_H_
#include "box_manager.h"
#include "placeholder_manager.h"
typedef struct boxcontents_param{
OPJ_OFF_T offset; /**< byte position of the box contents in the file*/
Byte8_t length; /**< length of the box contents*/
typedef struct boxcontents_param {
OPJ_OFF_T offset; /**< byte position of the box contents in the file*/
Byte8_t length; /**< length of the box contents*/
} boxcontents_param_t;
/** metadata-bin parameters*/
typedef struct metadata_param{
Byte8_t idx; /**< index number*/
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*/
struct metadata_param *next; /**< pointer to the next metadata-bin*/
typedef struct metadata_param {
Byte8_t idx; /**< index number*/
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*/
struct metadata_param
*next; /**< pointer to the next metadata-bin*/
} metadata_param_t;
/** metadata-bin list parameters*/
typedef struct metadatalist_param{
metadata_param_t *first; /**< first metadata-bin pointer of the list*/
metadata_param_t *last; /**< last metadata-bin pointer of the list*/
typedef struct metadatalist_param {
metadata_param_t *first; /**< first metadata-bin pointer of the list*/
metadata_param_t *last; /**< last metadata-bin pointer of the list*/
} metadatalist_param_t;
@ -69,7 +71,7 @@ metadatalist_param_t * gene_metadatalist(void);
* @param[in] fd file descriptor
* @return pointer to the generated metadata-bin list
*/
metadatalist_param_t * const_metadatalist( int fd);
metadatalist_param_t * const_metadatalist(int fd);
/**
@ -77,7 +79,7 @@ metadatalist_param_t * const_metadatalist( int fd);
*
* @param[in,out] list address of the metadata list pointer
*/
void delete_metadatalist( metadatalist_param_t **list);
void delete_metadatalist(metadatalist_param_t **list);
/**
@ -89,35 +91,36 @@ void delete_metadatalist( metadatalist_param_t **list);
* @param[in] boxcontents boxcontents pointer
* @return pointer to the generated metadata bin
*/
metadata_param_t * gene_metadata( Byte8_t idx, boxlist_param_t *boxlist, placeholderlist_param_t *phldlist, boxcontents_param_t *boxcontents);
metadata_param_t * gene_metadata(Byte8_t idx, boxlist_param_t *boxlist,
placeholderlist_param_t *phldlist, boxcontents_param_t *boxcontents);
/**
* delete a metadata bin
*
* @param[in,out] metadata address of the deleting metadata bin pointer
*/
void delete_metadata( metadata_param_t **metadata);
void delete_metadata(metadata_param_t **metadata);
/**
* generate box contents
*
* @return pointer to the box contents
*/
boxcontents_param_t * gene_boxcontents( OPJ_OFF_T offset, OPJ_SIZE_T length);
boxcontents_param_t * gene_boxcontents(OPJ_OFF_T offset, OPJ_SIZE_T length);
/**
* print metadata-bin parameters
*
* @param[in] metadata metadata-bin pointer
*/
void print_metadata( metadata_param_t *metadata);
void print_metadata(metadata_param_t *metadata);
/**
* print all metadata parameters
*
* @param[in] list metadata list pointer
*/
void print_allmetadata( metadatalist_param_t *list);
void print_allmetadata(metadatalist_param_t *list);
/**
@ -127,7 +130,7 @@ void print_allmetadata( metadatalist_param_t *list);
* @param[in] list metadata-bin list pointer
* @return found metadata-bin pointer
*/
metadata_param_t * search_metadata( Byte8_t idx, metadatalist_param_t *list);
metadata_param_t * search_metadata(Byte8_t idx, metadatalist_param_t *list);
/**
@ -137,7 +140,7 @@ metadata_param_t * search_metadata( Byte8_t idx, metadatalist_param_t *list);
* @param[in] list metadata-bin list pointer
* @return found metadata-bin index, if not found, -1
*/
Byte8_t search_metadataidx( char boxtype[4], metadatalist_param_t *list);
Byte8_t search_metadataidx(char boxtype[4], metadatalist_param_t *list);
/**
@ -146,6 +149,7 @@ Byte8_t search_metadataidx( char boxtype[4], metadatalist_param_t *list);
* @param[in] metabin metadata-bin pointer
* @param[in] metadatalist metadata list pointer
*/
void insert_metadata_into_list( metadata_param_t *metabin, metadatalist_param_t *metadatalist);
void insert_metadata_into_list(metadata_param_t *metabin,
metadatalist_param_t *metadatalist);
#endif /* !METADATA_MANAGER_H_ */
#endif /* !METADATA_MANAGER_H_ */

View File

@ -28,31 +28,31 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef MHIXBOX_MANAGER_H_
# define MHIXBOX_MANAGER_H_
#ifndef MHIXBOX_MANAGER_H_
# define MHIXBOX_MANAGER_H_
#include "byte_manager.h"
#include "box_manager.h"
/** 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*/
OPJ_OFF_T offset; /**< offset relative to the start of the*/
/**codestream ( including the length*/
/**parameter but not the marker itself)*/
Byte2_t length; /**< marker segment length*/
struct markeridx_param *next; /**< pointer to the next markeridx*/
typedef struct markeridx_param {
Byte2_t code; /**< marker code*/
Byte2_t num_remain; /**< remining 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)*/
Byte2_t length; /**< marker segment length*/
struct markeridx_param *next; /**< pointer to the next markeridx*/
} markeridx_param_t;
/** header index table box parameters*/
/** I.3.2.4.3 Header Index Table box*/
typedef struct mhixbox_param{
Byte8_t tlen; /**< length ( total length of the main*/
/**header or of the first tile-part header)*/
markeridx_param_t *first; /**< first marker index pointer of the list*/
typedef struct mhixbox_param {
Byte8_t tlen; /**< length ( total length of the main*/
/**header or of the first tile-part header)*/
markeridx_param_t *first; /**< first marker index pointer of the list*/
} mhixbox_param_t;
@ -63,7 +63,7 @@ typedef struct mhixbox_param{
* @param[in] box pointer to the reference mhix box
* @return generated mhixbox pointer
*/
mhixbox_param_t * gene_mhixbox( box_param_t *box);
mhixbox_param_t * gene_mhixbox(box_param_t *box);
/**
@ -73,7 +73,7 @@ mhixbox_param_t * gene_mhixbox( box_param_t *box);
* @param[in] mhix mhix box pointer
* @return found marker index pointer
*/
markeridx_param_t * search_markeridx( Byte2_t code, mhixbox_param_t *mhix);
markeridx_param_t * search_markeridx(Byte2_t code, mhixbox_param_t *mhix);
/**
@ -81,7 +81,7 @@ markeridx_param_t * search_markeridx( Byte2_t code, mhixbox_param_t *mhix);
*
* @param[in] mhix mhix box pointer
*/
void print_mhixbox( mhixbox_param_t *mhix);
void print_mhixbox(mhixbox_param_t *mhix);
/**
@ -89,7 +89,7 @@ void print_mhixbox( mhixbox_param_t *mhix);
*
* @param[in] markeridx marker index pointer
*/
void print_markeridx( markeridx_param_t *markeridx);
void print_markeridx(markeridx_param_t *markeridx);
/**
@ -97,6 +97,6 @@ void print_markeridx( markeridx_param_t *markeridx);
*
* @param[in,out] mhix address of the mhix box pointer
*/
void delete_mhixbox( mhixbox_param_t **mhix);
void delete_mhixbox(mhixbox_param_t **mhix);
#endif /* !MHIXBOX_MANAGER_H_ */
#endif /* !MHIXBOX_MANAGER_H_ */

View File

@ -3,7 +3,7 @@
*
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2014, Professor Benoit Macq
* Copyright (c) 2010-2011, Kaori Hagihara
* Copyright (c) 2010-2011, Kaori Hagihara
* Copyright (c) 2011, Lucian Corlaciu, GSoC
* All rights reserved.
*
@ -29,8 +29,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef MSGQUEUE_MANAGER_H_
# define MSGQUEUE_MANAGER_H_
#ifndef MSGQUEUE_MANAGER_H_
# define MSGQUEUE_MANAGER_H_
#include "byte_manager.h"
#include "cachemodel_manager.h"
@ -45,25 +45,26 @@
#define METADATA_MSG 8
/** message parameters */
typedef struct message_param{
OPJ_BOOL last_byte; /**< if message contains the last byte of the data-bin*/
Byte8_t in_class_id; /**< in-class identifier A.2.3*/
Byte8_t class_id; /**< class identifiers */
Byte8_t csn; /**< index of the codestream*/
Byte8_t bin_offset; /**< offset of the data in this message from the start of the data-bin*/
Byte8_t length; /**< message byte length*/
Byte8_t aux; /**<*/
OPJ_OFF_T res_offset; /**< offset in the resource*/
placeholder_param_t *phld; /**< placeholder pointer in index*/
struct message_param *next; /**< pointer to the next message*/
typedef struct message_param {
OPJ_BOOL
last_byte; /**< if message contains the last byte of the data-bin*/
Byte8_t in_class_id; /**< in-class identifier A.2.3*/
Byte8_t class_id; /**< class identifiers */
Byte8_t csn; /**< index of the codestream*/
Byte8_t bin_offset; /**< offset of the data in this message from the start of the data-bin*/
Byte8_t length; /**< message byte length*/
Byte8_t aux; /**<*/
OPJ_OFF_T res_offset; /**< offset in the resource*/
placeholder_param_t *phld; /**< placeholder pointer in index*/
struct message_param *next; /**< pointer to the next message*/
} message_param_t;
/** message queue parameters */
typedef struct msgqueue_param{
message_param_t *first; /**< first message pointer of the list*/
message_param_t *last; /**< last message pointer of the list*/
OPJ_BOOL stateless; /**< if this is a stateless message queue*/
cachemodel_param_t *cachemodel; /**< reference cachemodel pointer*/
typedef struct msgqueue_param {
message_param_t *first; /**< first message pointer of the list*/
message_param_t *last; /**< last message pointer of the list*/
OPJ_BOOL stateless; /**< if this is a stateless message queue*/
cachemodel_param_t *cachemodel; /**< reference cachemodel pointer*/
} msgqueue_param_t;
/**
@ -73,14 +74,15 @@ typedef struct msgqueue_param{
* @param[in] cachemodel cachemodel pointer
* @return generated message queue pointer
*/
msgqueue_param_t * gene_msgqueue( OPJ_BOOL stateless, cachemodel_param_t *cachemodel);
msgqueue_param_t * gene_msgqueue(OPJ_BOOL stateless,
cachemodel_param_t *cachemodel);
/**
* delete message queue
*
* @param[in] msgqueue address of the message queue pointer
*/
void delete_msgqueue( msgqueue_param_t **msgqueue);
void delete_msgqueue(msgqueue_param_t **msgqueue);
/**
* delete a message in msgqueue
@ -88,14 +90,15 @@ void delete_msgqueue( msgqueue_param_t **msgqueue);
* @param[in] message address of the deleting message pointer
* @param[in] msgqueue message queue pointer
*/
void delete_message_in_msgqueue( message_param_t **message, msgqueue_param_t *msgqueue);
void delete_message_in_msgqueue(message_param_t **message,
msgqueue_param_t *msgqueue);
/**
* print message queue
*
* @param[in] msgqueue message queue pointer
*/
void print_msgqueue( msgqueue_param_t *msgqueue);
void print_msgqueue(msgqueue_param_t *msgqueue);
/**
@ -103,7 +106,7 @@ void print_msgqueue( msgqueue_param_t *msgqueue);
*
* @param[in,out] msgqueue message queue pointer
*/
void enqueue_mainheader( msgqueue_param_t *msgqueue);
void enqueue_mainheader(msgqueue_param_t *msgqueue);
/**
* enqueue tile headers data-bin into message queue
@ -111,7 +114,7 @@ void enqueue_mainheader( msgqueue_param_t *msgqueue);
* @param[in] tile_id tile id starting from 0
* @param[in,out] msgqueue message queue pointer
*/
void enqueue_tileheader( int tile_id, msgqueue_param_t *msgqueue);
void enqueue_tileheader(int tile_id, msgqueue_param_t *msgqueue);
/**
* enqueue tile data-bin into message queue
@ -120,7 +123,7 @@ void enqueue_tileheader( int tile_id, msgqueue_param_t *msgqueue);
* @param[in] level decomposition level
* @param[in,out] msgqueue message queue pointer
*/
void enqueue_tile( Byte4_t tile_id, int level, msgqueue_param_t *msgqueue);
void enqueue_tile(Byte4_t tile_id, int level, msgqueue_param_t *msgqueue);
/**
* enqueue precinct data-bin into message queue
@ -131,7 +134,8 @@ void enqueue_tile( Byte4_t tile_id, int level, msgqueue_param_t *msgqueue);
* @param[in] layers num of layers
* @param[in,out] msgqueue message queue
*/
void enqueue_precinct( int seq_id, int tile_id, int comp_id, int layers, msgqueue_param_t *msgqueue);
void enqueue_precinct(int seq_id, int tile_id, int comp_id, int layers,
msgqueue_param_t *msgqueue);
/**
@ -140,7 +144,7 @@ void enqueue_precinct( int seq_id, int tile_id, int comp_id, int layers, msgqueu
* @param[in] meta_id metadata-bin id
* @param[in,out] msgqueue message queue pointer
*/
void enqueue_metadata( Byte8_t meta_id, msgqueue_param_t *msgqueue);
void enqueue_metadata(Byte8_t meta_id, msgqueue_param_t *msgqueue);
/**
@ -149,7 +153,7 @@ void enqueue_metadata( Byte8_t meta_id, msgqueue_param_t *msgqueue);
* @param[in] msgqueue message queue pointer
* @param[in] tmpfd file discriptor to write JPT/JPP-stream
*/
void recons_stream_from_msgqueue( msgqueue_param_t *msgqueue, int tmpfd);
void recons_stream_from_msgqueue(msgqueue_param_t *msgqueue, int tmpfd);
/**
@ -160,7 +164,8 @@ void recons_stream_from_msgqueue( msgqueue_param_t *msgqueue, int tmpfd);
* @param[in] offset offset of the stream from the whole beginning
* @param[in,out] msgqueue adding message queue pointer
*/
void parse_JPIPstream( Byte_t *JPIPstream, Byte8_t streamlen, OPJ_OFF_T offset, msgqueue_param_t *msgqueue);
void parse_JPIPstream(Byte_t *JPIPstream, Byte8_t streamlen, OPJ_OFF_T offset,
msgqueue_param_t *msgqueue);
/**
* parse JPT- JPP- stream to message queue
@ -170,7 +175,8 @@ void parse_JPIPstream( Byte_t *JPIPstream, Byte8_t streamlen, OPJ_OFF_T offset,
* @param[in] streamlen stream length
* @param[in] metadatalist adding metadata list pointer
*/
void parse_metamsg( msgqueue_param_t *msgqueue, Byte_t *stream, Byte8_t streamlen, metadatalist_param_t *metadatalist);
void parse_metamsg(msgqueue_param_t *msgqueue, Byte_t *stream,
Byte8_t streamlen, metadatalist_param_t *metadatalist);
/**
* compute precinct ID A.3.2.1
@ -182,6 +188,7 @@ void parse_metamsg( msgqueue_param_t *msgqueue, Byte_t *stream, Byte8_t streamle
* @param[in] num_tiles total number of tiles
* @return precicnt id
*/
Byte8_t comp_precinct_id( int t, int c, int s, int num_components, int num_tiles);
Byte8_t comp_precinct_id(int t, int c, int s, int num_components,
int num_tiles);
#endif /* !MSGQUEUE_MANAGER_H_ */
#endif /* !MSGQUEUE_MANAGER_H_ */

View File

@ -59,26 +59,26 @@
#endif /*SERVER*/
/*
/*
*==========================================================
* JPIP server API
*==========================================================
*/
#ifdef SERVER
#ifdef SERVER
/** Server static records*/
typedef struct server_record{
sessionlist_param_t *sessionlist; /**< list of session records*/
targetlist_param_t *targetlist; /**< list of target records*/
auxtrans_param_t auxtrans;
typedef struct server_record {
sessionlist_param_t *sessionlist; /**< list of session records*/
targetlist_param_t *targetlist; /**< list of target records*/
auxtrans_param_t auxtrans;
} server_record_t;
/** Query/response data for each client*/
typedef struct QR{
query_param_t *query; /**< query parameters*/
msgqueue_param_t *msgqueue; /**< message queue*/
channel_param_t *channel; /**< channel, (NULL if stateless)*/
typedef struct QR {
query_param_t *query; /**< query parameters*/
msgqueue_param_t *msgqueue; /**< message queue*/
channel_param_t *channel; /**< channel, (NULL if stateless)*/
} QR_t;
/**
@ -88,14 +88,14 @@ typedef struct QR{
* @param[in] udp_auxport opening udp auxiliary port ( 0 not to open, valid No. 49152-65535)
* @return intialized server record pointer
*/
server_record_t * init_JPIPserver( int tcp_auxport, int udp_auxport);
server_record_t * init_JPIPserver(int tcp_auxport, int udp_auxport);
/**
* Terminate the JPIP server
*
* @param[in] rec address of deleting server static record pointer
*/
void terminate_JPIPserver( server_record_t **rec);
void terminate_JPIPserver(server_record_t **rec);
/**
* 1st process per client request; parse query string
@ -103,16 +103,16 @@ void terminate_JPIPserver( server_record_t **rec);
* @param[in] query_string request query string
* @return initialized query/response data pointer
*/
QR_t * parse_querystring( const char *query_string);
QR_t * parse_querystring(const char *query_string);
/**
* 2nd process; process JPIP request and construct message queue
*
* @param[in] rec server static record pointer
* @param[in] qr query/response data pointer
* @return true if succeed, otherwise false
* @return true if succeed, otherwise false
*/
OPJ_BOOL process_JPIPrequest( server_record_t *rec, QR_t *qr);
OPJ_BOOL process_JPIPrequest(server_record_t *rec, QR_t *qr);
/**
* 3rd process; send response data JPT/JPP-stream
@ -120,15 +120,15 @@ OPJ_BOOL process_JPIPrequest( server_record_t *rec, QR_t *qr);
* @param[in] rec server static record pointer
* @param[in] qr query/response data pointer
*/
void send_responsedata( server_record_t *rec, QR_t *qr);
void send_responsedata(server_record_t *rec, QR_t *qr);
/**
* 4th (last) process;
* 4th (last) process;
*
* @param[in] rec server static record pinter
* @param[in] qr address of query/response data pointer
*/
void end_QRprocess( server_record_t *rec, QR_t **qr);
void end_QRprocess(server_record_t *rec, QR_t **qr);
/**
* Option for local tests; print out parameter values to logstream (stderr)
@ -140,11 +140,12 @@ void end_QRprocess( server_record_t *rec, QR_t **qr);
* @param[in] qr query/response data pointer
* @param[in] rec server static record pinter
*/
void local_log( OPJ_BOOL query, OPJ_BOOL messages, OPJ_BOOL sessions, OPJ_BOOL targets, QR_t *qr, server_record_t *rec);
void local_log(OPJ_BOOL query, OPJ_BOOL messages, OPJ_BOOL sessions,
OPJ_BOOL targets, QR_t *qr, server_record_t *rec);
#endif /*SERVER*/
/*
/*
*==========================================================
* JPIP decoding server API
*==========================================================
@ -153,12 +154,12 @@ void local_log( OPJ_BOOL query, OPJ_BOOL messages, OPJ_BOOL sessions, OPJ_BOOL t
#ifndef SERVER
/** Decoding server static records*/
typedef struct dec_server_record{
cachelist_param_t *cachelist; /**< cache list*/
Byte_t *jpipstream; /**< JPT/JPP stream*/
OPJ_SIZE_T jpipstreamlen; /**< length of jpipstream*/
msgqueue_param_t *msgqueue; /**< parsed message queue of jpipstream*/
SOCKET listening_socket; /**< listenning socket*/
typedef struct dec_server_record {
cachelist_param_t *cachelist; /**< cache list*/
Byte_t *jpipstream; /**< JPT/JPP stream*/
OPJ_SIZE_T jpipstreamlen; /**< length of jpipstream*/
msgqueue_param_t *msgqueue; /**< parsed message queue of jpipstream*/
SOCKET listening_socket; /**< listenning socket*/
} dec_server_record_t;
@ -171,14 +172,14 @@ typedef SOCKET client_t;
* @param[in] port opening tcp port (valid No. 49152-65535)
* @return intialized decoding server record pointer
*/
OPJ_API dec_server_record_t * OPJ_CALLCONV init_dec_server( int port);
OPJ_API dec_server_record_t * OPJ_CALLCONV init_dec_server(int port);
/**
* Terminate the image decoding server
*
* @param[in] rec address of deleting decoding server static record pointer
*/
OPJ_API void OPJ_CALLCONV terminate_dec_server( dec_server_record_t **rec);
OPJ_API void OPJ_CALLCONV terminate_dec_server(dec_server_record_t **rec);
/**
* Accept client connection
@ -186,20 +187,21 @@ OPJ_API void OPJ_CALLCONV terminate_dec_server( dec_server_record_t **rec);
* @param[in] rec decoding server static record pointer
* @return client socket ID, -1 if failed
*/
OPJ_API client_t OPJ_CALLCONV accept_connection( dec_server_record_t *rec);
OPJ_API client_t OPJ_CALLCONV accept_connection(dec_server_record_t *rec);
/**
* Handle client request
*
* @param[in] client client socket ID
* @param[in] rec decoding server static record pointer
* @return true if succeed
*/
OPJ_API OPJ_BOOL OPJ_CALLCONV handle_clientreq( client_t client, dec_server_record_t *rec);
/**
* Handle client request
*
* @param[in] client client socket ID
* @param[in] rec decoding server static record pointer
* @return true if succeed
*/
OPJ_API OPJ_BOOL OPJ_CALLCONV handle_clientreq(client_t client,
dec_server_record_t *rec);
#endif /*SERVER*/
/*
/*
*==========================================================
* JPIP tool API
*==========================================================
@ -212,14 +214,14 @@ OPJ_API OPJ_BOOL OPJ_CALLCONV handle_clientreq( client_t client, dec_server_reco
*/
/** JPIP decoding parameters*/
typedef struct jpip_dec_param{
Byte_t *jpipstream; /**< JPT/JPP-stream*/
Byte8_t jpiplen; /**< length of jpipstream*/
msgqueue_param_t *msgqueue; /**< message queue*/
metadatalist_param_t *metadatalist; /**< metadata list going into JP2 file*/
ihdrbox_param_t *ihdrbox; /**< ihdr box going into JP2 file*/
Byte_t *jp2kstream; /**< J2K codestream or JP2 file codestream*/
Byte8_t jp2klen; /**< length of j2kstream or JP2 file*/
typedef struct jpip_dec_param {
Byte_t *jpipstream; /**< JPT/JPP-stream*/
Byte8_t jpiplen; /**< length of jpipstream*/
msgqueue_param_t *msgqueue; /**< message queue*/
metadatalist_param_t *metadatalist; /**< metadata list going into JP2 file*/
ihdrbox_param_t *ihdrbox; /**< ihdr box going into JP2 file*/
Byte_t *jp2kstream; /**< J2K codestream or JP2 file codestream*/
Byte8_t jp2klen; /**< length of j2kstream or JP2 file*/
} jpip_dec_param_t;
/**
@ -228,14 +230,14 @@ typedef struct jpip_dec_param{
* @param[in] jp2 true in case of jp2 file encoding, else j2k file encoding
* @return JPIP decoding parameters pointer
*/
OPJ_API jpip_dec_param_t * OPJ_CALLCONV init_jpipdecoder( OPJ_BOOL jp2);
OPJ_API jpip_dec_param_t * OPJ_CALLCONV init_jpipdecoder(OPJ_BOOL jp2);
/**
* Destroy jpip decoding parameters
*
* @param[in] dec address of JPIP decoding parameters pointer
*/
OPJ_API void OPJ_CALLCONV destroy_jpipdecoder( jpip_dec_param_t **dec);
OPJ_API void OPJ_CALLCONV destroy_jpipdecoder(jpip_dec_param_t **dec);
/**
* Read jpip codestream from a file
@ -244,14 +246,15 @@ OPJ_API void OPJ_CALLCONV destroy_jpipdecoder( jpip_dec_param_t **dec);
* @param[in] dec JPIP decoding parameters pointer
* @return true if succeed
*/
OPJ_API OPJ_BOOL OPJ_CALLCONV fread_jpip( const char fname[], jpip_dec_param_t *dec);
OPJ_API OPJ_BOOL OPJ_CALLCONV fread_jpip(const char fname[],
jpip_dec_param_t *dec);
/**
* Decode jpip codestream
*
* @param[in] dec JPIP decoding parameters pointer
*/
OPJ_API void OPJ_CALLCONV decode_jpip( jpip_dec_param_t *dec);
OPJ_API void OPJ_CALLCONV decode_jpip(jpip_dec_param_t *dec);
/**
* Write J2K/JP2 codestream to a file
@ -260,7 +263,8 @@ OPJ_API void OPJ_CALLCONV decode_jpip( jpip_dec_param_t *dec);
* @param[in] dec JPIP decoding parameters pointer
* @return true if succeed
*/
OPJ_API OPJ_BOOL OPJ_CALLCONV fwrite_jp2k( const char fname[], jpip_dec_param_t *dec);
OPJ_API OPJ_BOOL OPJ_CALLCONV fwrite_jp2k(const char fname[],
jpip_dec_param_t *dec);
/**
* Option; print out parameter values to stderr
@ -270,7 +274,8 @@ OPJ_API OPJ_BOOL OPJ_CALLCONV fwrite_jp2k( const char fname[], jpip_dec_param_t
* @param[in] ihdrbox true if image header data is to be printed out
* @param[in] dec JPIP decoding parameters pointer
*/
OPJ_API void OPJ_CALLCONV output_log( OPJ_BOOL messages, OPJ_BOOL metadata, OPJ_BOOL ihdrbox, jpip_dec_param_t *dec);
OPJ_API void OPJ_CALLCONV output_log(OPJ_BOOL messages, OPJ_BOOL metadata,
OPJ_BOOL ihdrbox, jpip_dec_param_t *dec);
/*
* test the format of index (cidx) box in JP2 file
@ -281,18 +286,18 @@ typedef index_param_t index_t;
/**
* Parse JP2 file and get index information from cidx box inside
*
*
* @param[in] fd file descriptor of the JP2 file
* @return pointer to the generated structure of index parameters
*/
OPJ_API index_t * OPJ_CALLCONV get_index_from_JP2file( int fd);
OPJ_API index_t * OPJ_CALLCONV get_index_from_JP2file(int fd);
/**
* Destroy index parameters
*
* @param[in,out] idx addressof the index pointer
*/
OPJ_API void OPJ_CALLCONV destroy_index( index_t **idx);
OPJ_API void OPJ_CALLCONV destroy_index(index_t **idx);
/**
@ -300,7 +305,7 @@ OPJ_API void OPJ_CALLCONV destroy_index( index_t **idx);
*
* @param[in] index index parameters
*/
OPJ_API void OPJ_CALLCONV output_index( index_t *index);
OPJ_API void OPJ_CALLCONV output_index(index_t *index);
#endif /*SERVER*/

View File

@ -28,36 +28,36 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef PLACEHOLDER_MANAGER_H_
# define PLACEHOLDER_MANAGER_H_
#ifndef PLACEHOLDER_MANAGER_H_
# define PLACEHOLDER_MANAGER_H_
#include "byte_manager.h"
#include "box_manager.h"
/** A.3.6.3 Placeholder box format*/
/** placeholder box parameters*/
typedef struct placeholder_param{
Byte4_t LBox;
char TBox[4];
Byte4_t Flags;
Byte8_t OrigID;
Byte_t *OrigBH; /**< dynamic memory pointer*/
Byte_t OrigBHlen; /**< length of OrigBH*/
typedef struct placeholder_param {
Byte4_t LBox;
char TBox[4];
Byte4_t Flags;
Byte8_t OrigID;
Byte_t *OrigBH; /**< dynamic memory pointer*/
Byte_t OrigBHlen; /**< length of OrigBH*/
#ifdef AAA
Byte8_t EquivID;
Byte_t *EquivBH; /**< dynamic memory pointer*/
Byte_t EquivBHlen; /**< length of EquivBH*/
Byte8_t CSID;
Byte4_t NCS;
Byte8_t EquivID;
Byte_t *EquivBH; /**< dynamic memory pointer*/
Byte_t EquivBHlen; /**< length of EquivBH*/
Byte8_t CSID;
Byte4_t NCS;
#endif /*AAA*/
struct placeholder_param *next; /**< pointer to the next placeholder*/
struct placeholder_param *next; /**< pointer to the next placeholder*/
} placeholder_param_t;
/** placeholder box list parameters*/
typedef struct placeholderlist_param{
placeholder_param_t *first; /**< first placeholder pointer of the list*/
placeholder_param_t *last; /**< last placeholder pointer of the list*/
typedef struct placeholderlist_param {
placeholder_param_t *first; /**< first placeholder pointer of the list*/
placeholder_param_t *last; /**< last placeholder pointer of the list*/
} placeholderlist_param_t;
@ -74,7 +74,7 @@ placeholderlist_param_t * gene_placeholderlist(void);
*
* @param[in,out] list address of the placeholder list pointer
*/
void delete_placeholderlist( placeholderlist_param_t **list);
void delete_placeholderlist(placeholderlist_param_t **list);
/**
@ -84,7 +84,7 @@ void delete_placeholderlist( placeholderlist_param_t **list);
* @param[in] origID metadata-bin ID of the bin containing the contents of the original box
* @return pointer to the generated placeholder
*/
placeholder_param_t * gene_placeholder( box_param_t *box, Byte8_t origID);
placeholder_param_t * gene_placeholder(box_param_t *box, Byte8_t origID);
/**
@ -92,9 +92,10 @@ placeholder_param_t * gene_placeholder( box_param_t *box, Byte8_t origID);
*
* @param[in,out] placeholder address of the placeholder pointer
*/
void delete_placeholder( placeholder_param_t **placeholder);
void delete_placeholder(placeholder_param_t **placeholder);
void insert_placeholder_into_list( placeholder_param_t *phld, placeholderlist_param_t *phldlist);
void insert_placeholder_into_list(placeholder_param_t *phld,
placeholderlist_param_t *phldlist);
/**
@ -102,7 +103,7 @@ void insert_placeholder_into_list( placeholder_param_t *phld, placeholderlist_pa
*
* @param[in] phld placeholder pointer
*/
void print_placeholder( placeholder_param_t *phld);
void print_placeholder(placeholder_param_t *phld);
/**
@ -110,6 +111,6 @@ void print_placeholder( placeholder_param_t *phld);
*
* @param[in] list placeholder list pointer
*/
void print_allplaceholder( placeholderlist_param_t *list);
void print_allplaceholder(placeholderlist_param_t *list);
#endif /* !PLACEHOLDER_MANAGER_H_ */
#endif /* !PLACEHOLDER_MANAGER_H_ */

View File

@ -29,8 +29,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef QUERY_PARSER_H_
# define QUERY_PARSER_H_
#ifndef QUERY_PARSER_H_
# define QUERY_PARSER_H_
#include "opj_includes.h"
@ -41,33 +41,34 @@
typedef enum cnew_transport { non, http, tcp, udp} cnew_transport_t;
/** image return type */
typedef enum image_return { JPPstream, JPTstream, UNKNOWN=-1} image_return_t;
typedef enum image_return { JPPstream, JPTstream, UNKNOWN = -1} image_return_t;
/** Query parameters */
typedef struct query_param{
char *target; /**< target name */
char *tid; /**< target identifier */
int fx, fy; /**< frame size (fx,fy) */
int rx, ry, rw, rh; /**< roi region */
int layers; /**< quality layers */
int lastcomp; /**< last component number */
OPJ_BOOL *comps; /**< components (dynamic array) for jpp-stream, null means all components */
char *cid; /**< channel identifier */
cnew_transport_t cnew; /**< transport name if there is new channel request, else non */
char *cclose; /**< list of closing channel identifiers, separated by '\\0' */
int numOfcclose; /**< number of closing channels */
char box_type[MAX_NUMOFBOX][4]; /**< interested box-types */
int limit[MAX_NUMOFBOX]; /**< limit value, -1: skeleton request "r", 0: entire contents */
OPJ_BOOL w[MAX_NUMOFBOX]; /**< Metadata request qualifier flags */
OPJ_BOOL s[MAX_NUMOFBOX];
OPJ_BOOL g[MAX_NUMOFBOX];
OPJ_BOOL a[MAX_NUMOFBOX];
OPJ_BOOL priority[MAX_NUMOFBOX]; /**< priority flag */
int root_bin; /**< root-bin */
int max_depth; /**< max-depth */
OPJ_BOOL metadata_only; /**< metadata-only request */
image_return_t return_type; /**< image return type */
int len; /**< maximum response length */
typedef struct query_param {
char *target; /**< target name */
char *tid; /**< target identifier */
int fx, fy; /**< frame size (fx,fy) */
int rx, ry, rw, rh; /**< roi region */
int layers; /**< quality layers */
int lastcomp; /**< last component number */
OPJ_BOOL *comps; /**< components (dynamic array) for jpp-stream, null means all components */
char *cid; /**< channel identifier */
cnew_transport_t
cnew; /**< transport name if there is new channel request, else non */
char *cclose; /**< list of closing channel identifiers, separated by '\\0' */
int numOfcclose; /**< number of closing channels */
char box_type[MAX_NUMOFBOX][4]; /**< interested box-types */
int limit[MAX_NUMOFBOX]; /**< limit value, -1: skeleton request "r", 0: entire contents */
OPJ_BOOL w[MAX_NUMOFBOX]; /**< Metadata request qualifier flags */
OPJ_BOOL s[MAX_NUMOFBOX];
OPJ_BOOL g[MAX_NUMOFBOX];
OPJ_BOOL a[MAX_NUMOFBOX];
OPJ_BOOL priority[MAX_NUMOFBOX]; /**< priority flag */
int root_bin; /**< root-bin */
int max_depth; /**< max-depth */
OPJ_BOOL metadata_only; /**< metadata-only request */
image_return_t return_type; /**< image return type */
int len; /**< maximum response length */
} query_param_t;
@ -77,14 +78,14 @@ typedef struct query_param{
* @param[in] query_string request query string
* @return pointer to query parameters
*/
query_param_t * parse_query( const char *query_string);
query_param_t * parse_query(const char *query_string);
/**
* print query parameters
*
* @param[in] query_param query parameters
*/
void print_queryparam( query_param_t query_param);
void print_queryparam(query_param_t query_param);
/**
@ -92,6 +93,6 @@ void print_queryparam( query_param_t query_param);
*
* @param[in] query address of the deleting query pointer
*/
void delete_query( query_param_t **query);
void delete_query(query_param_t **query);
#endif /* !QUERY_PARSER_H_ */
#endif /* !QUERY_PARSER_H_ */

View File

@ -28,23 +28,23 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef SESSION_MANAGER_H_
# define SESSION_MANAGER_H_
#ifndef SESSION_MANAGER_H_
# define SESSION_MANAGER_H_
#include "channel_manager.h"
#include "cachemodel_manager.h"
/** Session parameters*/
typedef struct session_param{
channellist_param_t *channellist; /**< channel list pointer*/
cachemodellist_param_t *cachemodellist; /**< cache list pointer*/
struct session_param *next; /**< pointer to the next session*/
typedef struct session_param {
channellist_param_t *channellist; /**< channel list pointer*/
cachemodellist_param_t *cachemodellist; /**< cache list pointer*/
struct session_param *next; /**< pointer to the next session*/
} session_param_t;
/** Session list parameters*/
typedef struct sessionlist_param{
session_param_t *first; /**< first session pointer of the list*/
session_param_t *last; /**< last session pointer of the list*/
typedef struct sessionlist_param {
session_param_t *first; /**< first session pointer of the list*/
session_param_t *last; /**< last session pointer of the list*/
} sessionlist_param_t;
@ -62,7 +62,7 @@ sessionlist_param_t * gene_sessionlist(void);
* @param[in] sessionlist session list to insert the new session
* @return pointer to the generated session
*/
session_param_t * gene_session( sessionlist_param_t *sessionlist);
session_param_t * gene_session(sessionlist_param_t *sessionlist);
/**
* search a channel and its belonging session by channel ID
@ -73,10 +73,10 @@ session_param_t * gene_session( sessionlist_param_t *sessionlist);
* @param[in,out] foundchannel address of the found channel pointer
* @return if the channel is found (true) or not (false)
*/
OPJ_BOOL search_session_and_channel( char cid[],
sessionlist_param_t *sessionlist,
session_param_t **foundsession,
channel_param_t **foundchannel);
OPJ_BOOL search_session_and_channel(char cid[],
sessionlist_param_t *sessionlist,
session_param_t **foundsession,
channel_param_t **foundchannel);
/**
* insert a cache model into a session
@ -84,7 +84,8 @@ OPJ_BOOL search_session_and_channel( char cid[],
* @param[in] session session pointer
* @param[in] cachemodel cachemodel pointer
*/
void insert_cachemodel_into_session( session_param_t *session, cachemodel_param_t *cachemodel);
void insert_cachemodel_into_session(session_param_t *session,
cachemodel_param_t *cachemodel);
/**
@ -94,7 +95,8 @@ void insert_cachemodel_into_session( session_param_t *session, cachemodel_param_
* @param[in] sessionlist session list pointer
* @return if succeeded (true) or failed (false)
*/
OPJ_BOOL delete_session( session_param_t **session, sessionlist_param_t *sessionlist);
OPJ_BOOL delete_session(session_param_t **session,
sessionlist_param_t *sessionlist);
/**
@ -102,14 +104,14 @@ OPJ_BOOL delete_session( session_param_t **session, sessionlist_param_t *session
*
* @param[in,out] sessionlist address of the session list pointer
*/
void delete_sessionlist( sessionlist_param_t **sessionlist);
void delete_sessionlist(sessionlist_param_t **sessionlist);
/**
* print all sessions
*
* @param[in] sessionlist session list pointer
*/
void print_allsession( sessionlist_param_t *sessionlist);
void print_allsession(sessionlist_param_t *sessionlist);
#endif /* !SESSION_MANAGER_H_ */
#endif /* !SESSION_MANAGER_H_ */

View File

@ -28,8 +28,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef SOCK_MANAGER_H_
# define SOCK_MANAGER_H_
#ifndef SOCK_MANAGER_H_
# define SOCK_MANAGER_H_
#include "byte_manager.h"
#include "opj_stdint.h"
@ -48,7 +48,7 @@ typedef int SOCKET;
* @param port opening port number
* @return new socket
*/
SOCKET open_listeningsocket( uint16_t port);
SOCKET open_listeningsocket(uint16_t port);
/**
* accept a new connection to the listenning socket
@ -56,7 +56,7 @@ SOCKET open_listeningsocket( uint16_t port);
* @param listening_socket listenning socket
* @return connected socket (-1 if error occurs)
*/
SOCKET accept_socket( SOCKET listening_socket);
SOCKET accept_socket(SOCKET listening_socket);
/**
@ -74,7 +74,7 @@ OPJ_SIZE_T receive_line(SOCKET connected_socket, char *buf);
* @param [in] connected_socket file descriptor of the connected socket
* @return pointer to the string (memory allocated)
*/
char * receive_string( SOCKET connected_socket);
char * receive_string(SOCKET connected_socket);
/**
* receive data stream to client
@ -83,7 +83,7 @@ char * receive_string( SOCKET connected_socket);
* @param [in] length length of the receiving stream
* @return pointer to the data stream (memory allocated), NULL if failed
*/
void * receive_stream( SOCKET connected_socket, OPJ_SIZE_T length);
void * receive_stream(SOCKET connected_socket, OPJ_SIZE_T length);
/**
* send data stream to client
@ -92,7 +92,8 @@ void * receive_stream( SOCKET connected_socket, OPJ_SIZE_T length);
* @param [in] stream data stream
* @param [in] length length of data stream
*/
void send_stream( SOCKET connected_socket, const void *stream, OPJ_SIZE_T length);
void send_stream(SOCKET connected_socket, const void *stream,
OPJ_SIZE_T length);
/**
* close socket
@ -100,6 +101,6 @@ void send_stream( SOCKET connected_socket, const void *stream, OPJ_SIZE_T length
* @param [in] sock closing socket
* @return 0 if succeed, -1 if failed
*/
int close_socket( SOCKET sock);
int close_socket(SOCKET sock);
#endif /* !SOCK_MANAGER_H_ */

Some files were not shown because too many files have changed in this diff Show More