diff --git a/scripts/prepare-commit.sh b/scripts/prepare-commit.sh index 63dac65c..44e3df5c 100755 --- a/scripts/prepare-commit.sh +++ b/scripts/prepare-commit.sh @@ -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 diff --git a/src/bin/common/color.h b/src/bin/common/color.h index 0cd78e89..24792544 100644 --- a/src/bin/common/color.h +++ b/src/bin/common/color.h @@ -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. diff --git a/src/bin/common/format_defs.h b/src/bin/common/format_defs.h index 608d7b3a..1985b54f 100644 --- a/src/bin/common/format_defs.h +++ b/src/bin/common/format_defs.h @@ -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. diff --git a/src/bin/common/opj_getopt.h b/src/bin/common/opj_getopt.h index f97e8b35..18ac24d4 100644 --- a/src/bin/common/opj_getopt.h +++ b/src/bin/common/opj_getopt.h @@ -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_ */ diff --git a/src/bin/common/opj_string.h b/src/bin/common/opj_string.h index 8829926a..f704a8c9 100644 --- a/src/bin/common/opj_string.h +++ b/src/bin/common/opj_string.h @@ -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 */ diff --git a/src/bin/jp2/convert.h b/src/bin/jp2/convert.h index ab1d61a8..61439d49 100644 --- a/src/bin/jp2/convert.h +++ b/src/bin/jp2/convert.h @@ -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 */ diff --git a/src/bin/jp2/index.h b/src/bin/jp2/index.h index d8b448d0..b461e91b 100644 --- a/src/bin/jp2/index.h +++ b/src/bin/jp2/index.h @@ -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 */ diff --git a/src/bin/jp2/windirent.h b/src/bin/jp2/windirent.h index bef28194..b7ed9a3c 100644 --- a/src/bin/jp2/windirent.h +++ b/src/bin/jp2/windirent.h @@ -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 * * $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 # if !defined(DIRENT_MAXNAMLEN) @@ -189,11 +189,11 @@ # endif - /*** MS-DOS specifics ***/ +/*** MS-DOS specifics ***/ # elif defined(DIRENT_MSDOS_INTERFACE) # include - /* Borland defines file length macros in dir.h */ +/* Borland defines file length macros in dir.h */ # if defined(__BORLANDC__) # include # 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 # 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); /* * @@ -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. * - * Returns a pointer to the internal working area or NULL in case the + * 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) * */ 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) * */ 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 diff --git a/src/bin/jp3d/convert.h b/src/bin/jp3d/convert.h old mode 100755 new mode 100644 index 85885561..1df170eb --- a/src/bin/jp3d/convert.h +++ b/src/bin/jp3d/convert.h @@ -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 */ + diff --git a/src/bin/jp3d/getopt.h b/src/bin/jp3d/getopt.h old mode 100755 new mode 100644 index 23299d1b..935171ba --- a/src/bin/jp3d/getopt.h +++ b/src/bin/jp3d/getopt.h @@ -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_ */ diff --git a/src/bin/jp3d/windirent.h b/src/bin/jp3d/windirent.h index 2494cd4e..4b1d9ff1 100644 --- a/src/bin/jp3d/windirent.h +++ b/src/bin/jp3d/windirent.h @@ -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 * * $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 # if !defined(DIRENT_MAXNAMLEN) @@ -188,11 +188,11 @@ # endif - /*** MS-DOS specifics ***/ +/*** MS-DOS specifics ***/ # elif defined(DIRENT_MSDOS_INTERFACE) # include - /* Borland defines file length macros in dir.h */ +/* Borland defines file length macros in dir.h */ # if defined(__BORLANDC__) # include # 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 # 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); /* * @@ -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. * - * Returns a pointer to the internal working area or NULL in case the + * 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) * */ 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) * */ 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 diff --git a/src/bin/jpwl/convert.h b/src/bin/jpwl/convert.h index 591bde61..7f1a5bc8 100644 --- a/src/bin/jpwl/convert.h +++ b/src/bin/jpwl/convert.h @@ -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 */ diff --git a/src/bin/jpwl/index.h b/src/bin/jpwl/index.h index d8b448d0..b461e91b 100644 --- a/src/bin/jpwl/index.h +++ b/src/bin/jpwl/index.h @@ -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 */ diff --git a/src/bin/jpwl/windirent.h b/src/bin/jpwl/windirent.h index bef28194..b7ed9a3c 100644 --- a/src/bin/jpwl/windirent.h +++ b/src/bin/jpwl/windirent.h @@ -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 * * $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 # if !defined(DIRENT_MAXNAMLEN) @@ -189,11 +189,11 @@ # endif - /*** MS-DOS specifics ***/ +/*** MS-DOS specifics ***/ # elif defined(DIRENT_MSDOS_INTERFACE) # include - /* Borland defines file length macros in dir.h */ +/* Borland defines file length macros in dir.h */ # if defined(__BORLANDC__) # include # 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 # 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); /* * @@ -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. * - * Returns a pointer to the internal working area or NULL in case the + * 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) * */ 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) * */ 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 diff --git a/src/bin/mj2/meta_out.h b/src/bin/mj2/meta_out.h index 293316d1..769ff391 100644 --- a/src/bin/mj2/meta_out.h +++ b/src/bin/mj2/meta_out.h @@ -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); diff --git a/src/bin/wx/OPJViewer/source/OPJViewer.h b/src/bin/wx/OPJViewer/source/OPJViewer.h index 0d49468a..b60e0d14 100644 --- a/src/bin/wx/OPJViewer/source/OPJViewer.h +++ b/src/bin/wx/OPJViewer/source/OPJViewer.h @@ -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__ diff --git a/src/bin/wx/OPJViewer/source/about_htm.h b/src/bin/wx/OPJViewer/source/about_htm.h index 79a859d8..2d5dec27 100644 --- a/src/bin/wx/OPJViewer/source/about_htm.h +++ b/src/bin/wx/OPJViewer/source/about_htm.h @@ -1,54 +1,56 @@ wxString htmlaboutpage = wxT( -"" -"" -"" -"" -"" -"" -"" -"" -"" -"" -"" -"" + "" + "" + "" + "" + "" + "" + "" + "
" -"

" -"
" -"" -OPJ_APPLICATION " " OPJ_APPLICATION_VERSION -"
" -"A JPEG 2000 image viewer
" -"" OPJ_APPLICATION_PLATFORM " version" -"
" -"
OpenJPEG
" -"

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.


" -"* Build: ") + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" -"" -"" -"" -"" -"" -"" -"" -"
" + "

" + "
" + "" + OPJ_APPLICATION " " OPJ_APPLICATION_VERSION + "
" + "A JPEG 2000 image viewer
" + "" OPJ_APPLICATION_PLATFORM " version" + "
" + "
OpenJPEG
" + "

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.


" + "* Build: ") #include "build.h" -wxT(", " __DATE__ ", " __TIME__ "
") -wxT("* " wxVERSION_STRING "
") -wxT("* OpenJPEG " OPENJPEG_VERSION " (") + wxT(", " __DATE__ ", " __TIME__ "
") + wxT("* " wxVERSION_STRING "
") + wxT("* OpenJPEG " OPENJPEG_VERSION " (") #ifdef USE_JPWL -wxT("JPWL ") + wxT("JPWL ") #endif // USE_JPWL #ifdef USE_JPSEC -wxT("JPSEC ") + wxT("JPSEC ") #endif // USE_JPSEC -wxT(")
") + wxT(")
") #ifdef USE_MXF -wxT("* MXFLib " MXFLIB_VERSION_MAJOR "." MXFLIB_VERSION_MINOR "." MXFLIB_VERSION_TWEAK " (" MXFLIB_VERSION_BUILD ")
") + wxT("* MXFLib " MXFLIB_VERSION_MAJOR "." + MXFLIB_VERSION_MINOR "." MXFLIB_VERSION_TWEAK " (" MXFLIB_VERSION_BUILD + ")
") #endif // USE_MXF -wxT("
" -"OpenJPEG is © 2002-2008 TELE - Universite' Catholique de Louvain
" -"OPJViewer is © 2007-2008 DSPLab - Universita' degli studi di Perugia" -"
" -"" -"" -); + wxT("
" + "OpenJPEG is © 2002-2008 TELE - Universite' Catholique de Louvain
" + "OPJViewer is © 2007-2008 DSPLab - Universita' degli studi di Perugia" + "
" + "" + "" + ); diff --git a/src/bin/wx/OPJViewer/source/build.h b/src/bin/wx/OPJViewer/source/build.h index f0f072c8..d49d58b6 100644 --- a/src/bin/wx/OPJViewer/source/build.h +++ b/src/bin/wx/OPJViewer/source/build.h @@ -1 +1 @@ -wxT("491") +wxT("491") diff --git a/src/bin/wx/OPJViewer/source/imagjpeg2000.h b/src/bin/wx/OPJViewer/source/imagjpeg2000.h index 945bba5a..ca7f7f29 100644 --- a/src/bin/wx/OPJViewer/source/imagjpeg2000.h +++ b/src/bin/wx/OPJViewer/source/imagjpeg2000.h @@ -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) }; diff --git a/src/bin/wx/OPJViewer/source/imagmxf.h b/src/bin/wx/OPJViewer/source/imagmxf.h index e4cb35df..099aa1cc 100644 --- a/src/bin/wx/OPJViewer/source/imagmxf.h +++ b/src/bin/wx/OPJViewer/source/imagmxf.h @@ -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: diff --git a/src/lib/openjp2/bio.h b/src/lib/openjp2/bio.h index fba24284..d55dd42a 100644 --- a/src/lib/openjp2/bio.h +++ b/src/lib/openjp2/bio.h @@ -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 /* 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); diff --git a/src/lib/openjp2/cidx_manager.h b/src/lib/openjp2/cidx_manager.h index d0bbef88..a3532521 100644 --- a/src/lib/openjp2/cidx_manager.h +++ b/src/lib/openjp2/cidx_manager.h @@ -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_ */ diff --git a/src/lib/openjp2/cio.h b/src/lib/openjp2/cio.h index 4ea03ff3..ae13389d 100644 --- a/src/lib/openjp2/cio.h +++ b/src/lib/openjp2/cio.h @@ -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); /* ----------------------------------------------------------------------- */ /*@}*/ diff --git a/src/lib/openjp2/dwt.h b/src/lib/openjp2/dwt.h index 5321175b..b3939c6f 100644 --- a/src/lib/openjp2/dwt.h +++ b/src/lib/openjp2/dwt.h @@ -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 */ diff --git a/src/lib/openjp2/event.h b/src/lib/openjp2/event.h index fa8604ed..964fc1a6 100644 --- a/src/lib/openjp2/event.h +++ b/src/lib/openjp2/event.h @@ -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
  • Error messages
  • Warning messages
  • Debugging messages
*/ -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, ...); /* ----------------------------------------------------------------------- */ /** diff --git a/src/lib/openjp2/function_list.h b/src/lib/openjp2/function_list.h index ab091b7b..e669695d 100644 --- a/src/lib/openjp2/function_list.h +++ b/src/lib/openjp2/function_list.h @@ -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 */ diff --git a/src/lib/openjp2/image.h b/src/lib/openjp2/image.h index e0e2772d..e47b3aab 100644 --- a/src/lib/openjp2/image.h +++ b/src/lib/openjp2/image.h @@ -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); /*@}*/ diff --git a/src/lib/openjp2/indexbox_manager.h b/src/lib/openjp2/indexbox_manager.h index ebcde8fe..238114bd 100644 --- a/src/lib/openjp2/indexbox_manager.h +++ b/src/lib/openjp2/indexbox_manager.h @@ -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_ */ diff --git a/src/lib/openjp2/invert.h b/src/lib/openjp2/invert.h index 2fae8e54..d1c560c5 100644 --- a/src/lib/openjp2/invert.h +++ b/src/lib/openjp2/invert.h @@ -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 */ diff --git a/src/lib/openjp2/j2k.h b/src/lib/openjp2/j2k.h index 7e68b3af..fe65cd87 100644 --- a/src/lib/openjp2/j2k.h +++ b/src/lib/openjp2/j2k.h @@ -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,12 +8,12 @@ * 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) 2006-2007, Parvatha Elangovan * Copyright (c) 2008, Jerome Fimes, Communications & Systemes - * 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. @@ -69,39 +69,39 @@ The functions in J2K.C have for goal to read/write the several parts of the code /* ----------------------------------------------------------------------- */ -#define J2K_MS_SOC 0xff4f /**< SOC marker value */ -#define J2K_MS_SOT 0xff90 /**< SOT marker value */ -#define J2K_MS_SOD 0xff93 /**< SOD marker value */ -#define J2K_MS_EOC 0xffd9 /**< EOC marker value */ -#define J2K_MS_SIZ 0xff51 /**< SIZ marker value */ -#define J2K_MS_COD 0xff52 /**< COD marker value */ -#define J2K_MS_COC 0xff53 /**< COC marker value */ -#define J2K_MS_RGN 0xff5e /**< RGN marker value */ -#define J2K_MS_QCD 0xff5c /**< QCD marker value */ -#define J2K_MS_QCC 0xff5d /**< QCC marker value */ -#define J2K_MS_POC 0xff5f /**< POC marker value */ -#define J2K_MS_TLM 0xff55 /**< TLM marker value */ -#define J2K_MS_PLM 0xff57 /**< PLM marker value */ -#define J2K_MS_PLT 0xff58 /**< PLT marker value */ -#define J2K_MS_PPM 0xff60 /**< PPM marker value */ -#define J2K_MS_PPT 0xff61 /**< PPT marker value */ -#define J2K_MS_SOP 0xff91 /**< SOP marker value */ -#define J2K_MS_EPH 0xff92 /**< EPH marker value */ -#define J2K_MS_CRG 0xff63 /**< CRG marker value */ -#define J2K_MS_COM 0xff64 /**< COM marker value */ -#define J2K_MS_CBD 0xff78 /**< CBD marker value */ -#define J2K_MS_MCC 0xff75 /**< MCC marker value */ -#define J2K_MS_MCT 0xff74 /**< MCT marker value */ -#define J2K_MS_MCO 0xff77 /**< MCO marker value */ +#define J2K_MS_SOC 0xff4f /**< SOC marker value */ +#define J2K_MS_SOT 0xff90 /**< SOT marker value */ +#define J2K_MS_SOD 0xff93 /**< SOD marker value */ +#define J2K_MS_EOC 0xffd9 /**< EOC marker value */ +#define J2K_MS_SIZ 0xff51 /**< SIZ marker value */ +#define J2K_MS_COD 0xff52 /**< COD marker value */ +#define J2K_MS_COC 0xff53 /**< COC marker value */ +#define J2K_MS_RGN 0xff5e /**< RGN marker value */ +#define J2K_MS_QCD 0xff5c /**< QCD marker value */ +#define J2K_MS_QCC 0xff5d /**< QCC marker value */ +#define J2K_MS_POC 0xff5f /**< POC marker value */ +#define J2K_MS_TLM 0xff55 /**< TLM marker value */ +#define J2K_MS_PLM 0xff57 /**< PLM marker value */ +#define J2K_MS_PLT 0xff58 /**< PLT marker value */ +#define J2K_MS_PPM 0xff60 /**< PPM marker value */ +#define J2K_MS_PPT 0xff61 /**< PPT marker value */ +#define J2K_MS_SOP 0xff91 /**< SOP marker value */ +#define J2K_MS_EPH 0xff92 /**< EPH marker value */ +#define J2K_MS_CRG 0xff63 /**< CRG marker value */ +#define J2K_MS_COM 0xff64 /**< COM marker value */ +#define J2K_MS_CBD 0xff78 /**< CBD marker value */ +#define J2K_MS_MCC 0xff75 /**< MCC marker value */ +#define J2K_MS_MCT 0xff74 /**< MCT marker value */ +#define J2K_MS_MCO 0xff77 /**< MCO marker value */ -#define J2K_MS_UNK 0 /**< UNKNOWN marker value */ +#define J2K_MS_UNK 0 /**< UNKNOWN marker value */ /* UniPG>> */ #ifdef USE_JPWL -#define J2K_MS_EPC 0xff68 /**< EPC marker value (Part 11: JPEG 2000 for Wireless) */ -#define J2K_MS_EPB 0xff66 /**< EPB marker value (Part 11: JPEG 2000 for Wireless) */ -#define J2K_MS_ESD 0xff67 /**< ESD marker value (Part 11: JPEG 2000 for Wireless) */ -#define J2K_MS_RED 0xff69 /**< RED marker value (Part 11: JPEG 2000 for Wireless) */ +#define J2K_MS_EPC 0xff68 /**< EPC marker value (Part 11: JPEG 2000 for Wireless) */ +#define J2K_MS_EPB 0xff66 /**< EPB marker value (Part 11: JPEG 2000 for Wireless) */ +#define J2K_MS_ESD 0xff67 /**< ESD marker value (Part 11: JPEG 2000 for Wireless) */ +#define J2K_MS_RED 0xff69 /**< RED marker value (Part 11: JPEG 2000 for Wireless) */ #endif /* USE_JPWL */ #ifdef USE_JPSEC #define J2K_MS_SEC 0xff65 /**< SEC marker value (Part 8: Secure JPEG 2000) */ @@ -116,91 +116,88 @@ The functions in J2K.C have for goal to read/write the several parts of the code * These values may be combined with a | operator. * */ typedef enum J2K_STATUS { - J2K_STATE_NONE = 0x0000, /**< a SOC marker is expected */ - J2K_STATE_MHSOC = 0x0001, /**< a SOC marker is expected */ - J2K_STATE_MHSIZ = 0x0002, /**< a SIZ marker is expected */ - J2K_STATE_MH = 0x0004, /**< the decoding process is in the main header */ - J2K_STATE_TPHSOT = 0x0008, /**< the decoding process is in a tile part header and expects a SOT marker */ - J2K_STATE_TPH = 0x0010, /**< the decoding process is in a tile part header */ - J2K_STATE_MT = 0x0020, /**< the EOC marker has just been read */ - J2K_STATE_NEOC = 0x0040, /**< the decoding process must not expect a EOC marker because the codestream is truncated */ + J2K_STATE_NONE = 0x0000, /**< a SOC marker is expected */ + J2K_STATE_MHSOC = 0x0001, /**< a SOC marker is expected */ + J2K_STATE_MHSIZ = 0x0002, /**< a SIZ marker is expected */ + J2K_STATE_MH = 0x0004, /**< the decoding process is in the main header */ + J2K_STATE_TPHSOT = 0x0008, /**< the decoding process is in a tile part header and expects a SOT marker */ + J2K_STATE_TPH = 0x0010, /**< the decoding process is in a tile part header */ + J2K_STATE_MT = 0x0020, /**< the EOC marker has just been read */ + J2K_STATE_NEOC = 0x0040, /**< the decoding process must not expect a EOC marker because the codestream is truncated */ - J2K_STATE_EOC = 0x0100, /**< the decoding process has encountered the EOC marker */ - J2K_STATE_ERR = 0x8000 /**< the decoding process has encountered an error (FIXME warning V1 = 0x0080)*/ + J2K_STATE_EOC = 0x0100, /**< the decoding process has encountered the EOC marker */ + J2K_STATE_ERR = 0x8000 /**< the decoding process has encountered an error (FIXME warning V1 = 0x0080)*/ } J2K_STATUS; /** * Type of elements storing in the MCT data */ -typedef enum MCT_ELEMENT_TYPE -{ - MCT_TYPE_INT16 = 0, /** MCT data is stored as signed shorts*/ - MCT_TYPE_INT32 = 1, /** MCT data is stored as signed integers*/ - MCT_TYPE_FLOAT = 2, /** MCT data is stored as floats*/ - MCT_TYPE_DOUBLE = 3 /** MCT data is stored as doubles*/ +typedef enum MCT_ELEMENT_TYPE { + MCT_TYPE_INT16 = 0, /** MCT data is stored as signed shorts*/ + MCT_TYPE_INT32 = 1, /** MCT data is stored as signed integers*/ + MCT_TYPE_FLOAT = 2, /** MCT data is stored as floats*/ + MCT_TYPE_DOUBLE = 3 /** MCT data is stored as doubles*/ } J2K_MCT_ELEMENT_TYPE; /** * Type of MCT array */ -typedef enum MCT_ARRAY_TYPE -{ - MCT_TYPE_DEPENDENCY = 0, - MCT_TYPE_DECORRELATION = 1, - MCT_TYPE_OFFSET = 2 +typedef enum MCT_ARRAY_TYPE { + MCT_TYPE_DEPENDENCY = 0, + MCT_TYPE_DECORRELATION = 1, + MCT_TYPE_OFFSET = 2 } J2K_MCT_ARRAY_TYPE; /* ----------------------------------------------------------------------- */ -/** -T2 encoding mode +/** +T2 encoding mode */ typedef enum T2_MODE { - THRESH_CALC = 0, /** Function called in Rate allocation process*/ - FINAL_PASS = 1 /** Function called in Tier 2 process*/ -}J2K_T2_MODE; + THRESH_CALC = 0, /** Function called in Rate allocation process*/ + FINAL_PASS = 1 /** Function called in Tier 2 process*/ +} J2K_T2_MODE; /** * Quantization stepsize */ typedef struct opj_stepsize { - /** exponent */ - OPJ_INT32 expn; - /** mantissa */ - OPJ_INT32 mant; + /** exponent */ + OPJ_INT32 expn; + /** mantissa */ + OPJ_INT32 mant; } opj_stepsize_t; /** Tile-component coding parameters */ -typedef struct opj_tccp -{ - /** coding style */ - OPJ_UINT32 csty; - /** number of resolutions */ - OPJ_UINT32 numresolutions; - /** code-blocks width */ - OPJ_UINT32 cblkw; - /** code-blocks height */ - OPJ_UINT32 cblkh; - /** code-block coding style */ - OPJ_UINT32 cblksty; - /** discrete wavelet transform identifier */ - OPJ_UINT32 qmfbid; - /** quantisation style */ - OPJ_UINT32 qntsty; - /** stepsizes used for quantization */ - opj_stepsize_t stepsizes[OPJ_J2K_MAXBANDS]; - /** number of guard bits */ - OPJ_UINT32 numgbits; - /** Region Of Interest shift */ - OPJ_INT32 roishift; - /** precinct width */ - OPJ_UINT32 prcw[OPJ_J2K_MAXRLVLS]; - /** precinct height */ - OPJ_UINT32 prch[OPJ_J2K_MAXRLVLS]; - /** the dc_level_shift **/ - OPJ_INT32 m_dc_level_shift; +typedef struct opj_tccp { + /** coding style */ + OPJ_UINT32 csty; + /** number of resolutions */ + OPJ_UINT32 numresolutions; + /** code-blocks width */ + OPJ_UINT32 cblkw; + /** code-blocks height */ + OPJ_UINT32 cblkh; + /** code-block coding style */ + OPJ_UINT32 cblksty; + /** discrete wavelet transform identifier */ + OPJ_UINT32 qmfbid; + /** quantisation style */ + OPJ_UINT32 qntsty; + /** stepsizes used for quantization */ + opj_stepsize_t stepsizes[OPJ_J2K_MAXBANDS]; + /** number of guard bits */ + OPJ_UINT32 numgbits; + /** Region Of Interest shift */ + OPJ_INT32 roishift; + /** precinct width */ + OPJ_UINT32 prcw[OPJ_J2K_MAXRLVLS]; + /** precinct height */ + OPJ_UINT32 prch[OPJ_J2K_MAXRLVLS]; + /** the dc_level_shift **/ + OPJ_INT32 m_dc_level_shift; } opj_tccp_t; @@ -209,33 +206,30 @@ opj_tccp_t; /** * FIXME DOC */ -typedef struct opj_mct_data -{ - J2K_MCT_ELEMENT_TYPE m_element_type; - J2K_MCT_ARRAY_TYPE m_array_type; - OPJ_UINT32 m_index; - OPJ_BYTE * m_data; - OPJ_UINT32 m_data_size; +typedef struct opj_mct_data { + J2K_MCT_ELEMENT_TYPE m_element_type; + J2K_MCT_ARRAY_TYPE m_array_type; + OPJ_UINT32 m_index; + OPJ_BYTE * m_data; + OPJ_UINT32 m_data_size; } opj_mct_data_t; /** * FIXME DOC */ -typedef struct opj_simple_mcc_decorrelation_data -{ - OPJ_UINT32 m_index; - OPJ_UINT32 m_nb_comps; - opj_mct_data_t * m_decorrelation_array; - opj_mct_data_t * m_offset_array; - OPJ_BITFIELD m_is_irreversible : 1; +typedef struct opj_simple_mcc_decorrelation_data { + OPJ_UINT32 m_index; + OPJ_UINT32 m_nb_comps; + opj_mct_data_t * m_decorrelation_array; + opj_mct_data_t * m_offset_array; + OPJ_BITFIELD m_is_irreversible : 1; } opj_simple_mcc_decorrelation_data_t; -typedef struct opj_ppx_struct -{ - OPJ_BYTE* m_data; /* m_data == NULL => Zppx not read yet */ - OPJ_UINT32 m_data_size; +typedef struct opj_ppx_struct { + OPJ_BYTE* m_data; /* m_data == NULL => Zppx not read yet */ + OPJ_UINT32 m_data_size; } opj_ppx; /** @@ -243,106 +237,103 @@ Tile coding parameters : this structure is used to store coding/decoding parameters common to all tiles (information like COD, COC in main header) */ -typedef struct opj_tcp -{ - /** coding style */ - OPJ_UINT32 csty; - /** progression order */ - OPJ_PROG_ORDER prg; - /** number of layers */ - OPJ_UINT32 numlayers; - OPJ_UINT32 num_layers_to_decode; - /** multi-component transform identifier */ - OPJ_UINT32 mct; - /** rates of layers */ - OPJ_FLOAT32 rates[100]; - /** number of progression order changes */ - OPJ_UINT32 numpocs; - /** progression order changes */ - opj_poc_t pocs[32]; - - /** number of ppt markers (reserved size) */ - OPJ_UINT32 ppt_markers_count; - /** ppt markers data (table indexed by Zppt) */ - opj_ppx* ppt_markers; - - /** packet header store there for future use in t2_decode_packet */ - OPJ_BYTE *ppt_data; - /** used to keep a track of the allocated memory */ - OPJ_BYTE *ppt_buffer; - /** Number of bytes stored inside ppt_data*/ - OPJ_UINT32 ppt_data_size; - /** size of ppt_data*/ - OPJ_UINT32 ppt_len; - /** add fixed_quality */ - OPJ_FLOAT32 distoratio[100]; - /** tile-component coding parameters */ - opj_tccp_t *tccps; - /** number of tile parts for the tile. */ - OPJ_UINT32 m_nb_tile_parts; - /** data for the tile */ - OPJ_BYTE * m_data; - /** size of data */ - OPJ_UINT32 m_data_size; - /** encoding norms */ - OPJ_FLOAT64 * mct_norms; - /** the mct decoding matrix */ - OPJ_FLOAT32 * m_mct_decoding_matrix; - /** the mct coding matrix */ - OPJ_FLOAT32 * m_mct_coding_matrix; - /** mct records */ - opj_mct_data_t * m_mct_records; - /** the number of mct records. */ - OPJ_UINT32 m_nb_mct_records; - /** the max number of mct records. */ - OPJ_UINT32 m_nb_max_mct_records; - /** mcc records */ - opj_simple_mcc_decorrelation_data_t * m_mcc_records; - /** the number of mct records. */ - OPJ_UINT32 m_nb_mcc_records; - /** the max number of mct records. */ - OPJ_UINT32 m_nb_max_mcc_records; +typedef struct opj_tcp { + /** coding style */ + OPJ_UINT32 csty; + /** progression order */ + OPJ_PROG_ORDER prg; + /** number of layers */ + OPJ_UINT32 numlayers; + OPJ_UINT32 num_layers_to_decode; + /** multi-component transform identifier */ + OPJ_UINT32 mct; + /** rates of layers */ + OPJ_FLOAT32 rates[100]; + /** number of progression order changes */ + OPJ_UINT32 numpocs; + /** progression order changes */ + opj_poc_t pocs[32]; + + /** number of ppt markers (reserved size) */ + OPJ_UINT32 ppt_markers_count; + /** ppt markers data (table indexed by Zppt) */ + opj_ppx* ppt_markers; + + /** packet header store there for future use in t2_decode_packet */ + OPJ_BYTE *ppt_data; + /** used to keep a track of the allocated memory */ + OPJ_BYTE *ppt_buffer; + /** Number of bytes stored inside ppt_data*/ + OPJ_UINT32 ppt_data_size; + /** size of ppt_data*/ + OPJ_UINT32 ppt_len; + /** add fixed_quality */ + OPJ_FLOAT32 distoratio[100]; + /** tile-component coding parameters */ + opj_tccp_t *tccps; + /** number of tile parts for the tile. */ + OPJ_UINT32 m_nb_tile_parts; + /** data for the tile */ + OPJ_BYTE * m_data; + /** size of data */ + OPJ_UINT32 m_data_size; + /** encoding norms */ + OPJ_FLOAT64 * mct_norms; + /** the mct decoding matrix */ + OPJ_FLOAT32 * m_mct_decoding_matrix; + /** the mct coding matrix */ + OPJ_FLOAT32 * m_mct_coding_matrix; + /** mct records */ + opj_mct_data_t * m_mct_records; + /** the number of mct records. */ + OPJ_UINT32 m_nb_mct_records; + /** the max number of mct records. */ + OPJ_UINT32 m_nb_max_mct_records; + /** mcc records */ + opj_simple_mcc_decorrelation_data_t * m_mcc_records; + /** the number of mct records. */ + OPJ_UINT32 m_nb_mcc_records; + /** the max number of mct records. */ + OPJ_UINT32 m_nb_max_mcc_records; - /***** FLAGS *******/ - /** If cod == 1 --> there was a COD marker for the present tile */ - OPJ_BITFIELD cod : 1; - /** If ppt == 1 --> there was a PPT marker for the present tile */ - OPJ_BITFIELD ppt : 1; - /** indicates if a POC marker has been used O:NO, 1:YES */ - OPJ_BITFIELD POC : 1; + /***** FLAGS *******/ + /** If cod == 1 --> there was a COD marker for the present tile */ + OPJ_BITFIELD cod : 1; + /** If ppt == 1 --> there was a PPT marker for the present tile */ + OPJ_BITFIELD ppt : 1; + /** indicates if a POC marker has been used O:NO, 1:YES */ + OPJ_BITFIELD POC : 1; } opj_tcp_t; -typedef struct opj_encoding_param -{ - /** Maximum rate for each component. If == 0, component size limitation is not considered */ - OPJ_UINT32 m_max_comp_size; - /** Position of tile part flag in progression order*/ - OPJ_INT32 m_tp_pos; - /** fixed layer */ - OPJ_INT32 *m_matrice; - /** Flag determining tile part generation*/ - OPJ_BYTE m_tp_flag; - /** allocation by rate/distortion */ - OPJ_BITFIELD m_disto_alloc : 1; - /** allocation by fixed layer */ - OPJ_BITFIELD m_fixed_alloc : 1; - /** add fixed_quality */ - OPJ_BITFIELD m_fixed_quality : 1; - /** Enabling Tile part generation*/ - OPJ_BITFIELD m_tp_on : 1; +typedef struct opj_encoding_param { + /** Maximum rate for each component. If == 0, component size limitation is not considered */ + OPJ_UINT32 m_max_comp_size; + /** Position of tile part flag in progression order*/ + OPJ_INT32 m_tp_pos; + /** fixed layer */ + OPJ_INT32 *m_matrice; + /** Flag determining tile part generation*/ + OPJ_BYTE m_tp_flag; + /** allocation by rate/distortion */ + OPJ_BITFIELD m_disto_alloc : 1; + /** allocation by fixed layer */ + OPJ_BITFIELD m_fixed_alloc : 1; + /** add fixed_quality */ + OPJ_BITFIELD m_fixed_quality : 1; + /** Enabling Tile part generation*/ + OPJ_BITFIELD m_tp_on : 1; } opj_encoding_param_t; -typedef struct opj_decoding_param -{ - /** if != 0, then original dimension divided by 2^(reduce); if == 0 or not used, image is decoded to the full resolution */ - OPJ_UINT32 m_reduce; - /** if != 0, then only the first "layer" layers are decoded; if == 0 or not used, all the quality layers are decoded */ - OPJ_UINT32 m_layer; +typedef struct opj_decoding_param { + /** if != 0, then original dimension divided by 2^(reduce); if == 0 or not used, image is decoded to the full resolution */ + OPJ_UINT32 m_reduce; + /** if != 0, then only the first "layer" layers are decoded; if == 0 or not used, all the quality layers are decoded */ + OPJ_UINT32 m_layer; } opj_decoding_param_t; @@ -350,199 +341,195 @@ opj_decoding_param_t; /** * Coding parameters */ -typedef struct opj_cp -{ - /** Size of the image in bits*/ - /*int img_size;*/ - /** Rsiz*/ +typedef struct opj_cp { + /** Size of the image in bits*/ + /*int img_size;*/ + /** Rsiz*/ OPJ_UINT16 rsiz; - /** XTOsiz */ - OPJ_UINT32 tx0; /* MSD see norm */ - /** YTOsiz */ - OPJ_UINT32 ty0; /* MSD see norm */ - /** XTsiz */ - OPJ_UINT32 tdx; - /** YTsiz */ - OPJ_UINT32 tdy; - /** comment */ - OPJ_CHAR *comment; - /** number of tiles in width */ - OPJ_UINT32 tw; - /** number of tiles in heigth */ - OPJ_UINT32 th; + /** XTOsiz */ + OPJ_UINT32 tx0; /* MSD see norm */ + /** YTOsiz */ + OPJ_UINT32 ty0; /* MSD see norm */ + /** XTsiz */ + OPJ_UINT32 tdx; + /** YTsiz */ + OPJ_UINT32 tdy; + /** comment */ + OPJ_CHAR *comment; + /** number of tiles in width */ + OPJ_UINT32 tw; + /** number of tiles in heigth */ + OPJ_UINT32 th; - /** number of ppm markers (reserved size) */ - OPJ_UINT32 ppm_markers_count; - /** ppm markers data (table indexed by Zppm) */ - opj_ppx* ppm_markers; - - /** packet header store there for future use in t2_decode_packet */ - OPJ_BYTE *ppm_data; - /** size of the ppm_data*/ - OPJ_UINT32 ppm_len; - /** size of the ppm_data*/ - OPJ_UINT32 ppm_data_read; + /** number of ppm markers (reserved size) */ + OPJ_UINT32 ppm_markers_count; + /** ppm markers data (table indexed by Zppm) */ + opj_ppx* ppm_markers; - OPJ_BYTE *ppm_data_current; + /** packet header store there for future use in t2_decode_packet */ + OPJ_BYTE *ppm_data; + /** size of the ppm_data*/ + OPJ_UINT32 ppm_len; + /** size of the ppm_data*/ + OPJ_UINT32 ppm_data_read; - /** packet header storage original buffer */ - OPJ_BYTE *ppm_buffer; - /** pointer remaining on the first byte of the first header if ppm is used */ - OPJ_BYTE *ppm_data_first; - /** Number of bytes actually stored inside the ppm_data */ - OPJ_UINT32 ppm_data_size; - /** use in case of multiple marker PPM (number of info already store) */ - OPJ_INT32 ppm_store; - /** use in case of multiple marker PPM (case on non-finished previous info) */ - OPJ_INT32 ppm_previous; + OPJ_BYTE *ppm_data_current; - /** tile coding parameters */ - opj_tcp_t *tcps; + /** packet header storage original buffer */ + OPJ_BYTE *ppm_buffer; + /** pointer remaining on the first byte of the first header if ppm is used */ + OPJ_BYTE *ppm_data_first; + /** Number of bytes actually stored inside the ppm_data */ + OPJ_UINT32 ppm_data_size; + /** use in case of multiple marker PPM (number of info already store) */ + OPJ_INT32 ppm_store; + /** use in case of multiple marker PPM (case on non-finished previous info) */ + OPJ_INT32 ppm_previous; - union - { - opj_decoding_param_t m_dec; - opj_encoding_param_t m_enc; - } - m_specific_param; + /** tile coding parameters */ + opj_tcp_t *tcps; + + union { + opj_decoding_param_t m_dec; + opj_encoding_param_t m_enc; + } + m_specific_param; -/* UniPG>> */ + /* UniPG>> */ #ifdef USE_JPWL - /** enables writing of EPC in MH, thus activating JPWL */ - OPJ_BOOL epc_on; - /** enables writing of EPB, in case of activated JPWL */ - OPJ_BOOL epb_on; - /** enables writing of ESD, in case of activated JPWL */ - OPJ_BOOL esd_on; - /** enables writing of informative techniques of ESD, in case of activated JPWL */ - OPJ_BOOL info_on; - /** enables writing of RED, in case of activated JPWL */ - OPJ_BOOL red_on; - /** error protection method for MH (0,1,16,32,37-128) */ - int hprot_MH; - /** tile number of header protection specification (>=0) */ - int hprot_TPH_tileno[JPWL_MAX_NO_TILESPECS]; - /** error protection methods for TPHs (0,1,16,32,37-128) */ - int hprot_TPH[JPWL_MAX_NO_TILESPECS]; - /** tile number of packet protection specification (>=0) */ - int pprot_tileno[JPWL_MAX_NO_PACKSPECS]; - /** packet number of packet protection specification (>=0) */ - int pprot_packno[JPWL_MAX_NO_PACKSPECS]; - /** error protection methods for packets (0,1,16,32,37-128) */ - int pprot[JPWL_MAX_NO_PACKSPECS]; - /** enables writing of ESD, (0/2/4 bytes) */ - int sens_size; - /** sensitivity addressing size (0=auto/2/4 bytes) */ - int sens_addr; - /** sensitivity range (0-3) */ - int sens_range; - /** sensitivity method for MH (-1,0-7) */ - int sens_MH; - /** tile number of sensitivity specification (>=0) */ - int sens_TPH_tileno[JPWL_MAX_NO_TILESPECS]; - /** sensitivity methods for TPHs (-1,0-7) */ - int sens_TPH[JPWL_MAX_NO_TILESPECS]; - /** enables JPWL correction at the decoder */ - OPJ_BOOL correct; - /** expected number of components at the decoder */ - int exp_comps; - /** maximum number of tiles at the decoder */ - OPJ_UINT32 max_tiles; + /** enables writing of EPC in MH, thus activating JPWL */ + OPJ_BOOL epc_on; + /** enables writing of EPB, in case of activated JPWL */ + OPJ_BOOL epb_on; + /** enables writing of ESD, in case of activated JPWL */ + OPJ_BOOL esd_on; + /** enables writing of informative techniques of ESD, in case of activated JPWL */ + OPJ_BOOL info_on; + /** enables writing of RED, in case of activated JPWL */ + OPJ_BOOL red_on; + /** error protection method for MH (0,1,16,32,37-128) */ + int hprot_MH; + /** tile number of header protection specification (>=0) */ + int hprot_TPH_tileno[JPWL_MAX_NO_TILESPECS]; + /** error protection methods for TPHs (0,1,16,32,37-128) */ + int hprot_TPH[JPWL_MAX_NO_TILESPECS]; + /** tile number of packet protection specification (>=0) */ + int pprot_tileno[JPWL_MAX_NO_PACKSPECS]; + /** packet number of packet protection specification (>=0) */ + int pprot_packno[JPWL_MAX_NO_PACKSPECS]; + /** error protection methods for packets (0,1,16,32,37-128) */ + int pprot[JPWL_MAX_NO_PACKSPECS]; + /** enables writing of ESD, (0/2/4 bytes) */ + int sens_size; + /** sensitivity addressing size (0=auto/2/4 bytes) */ + int sens_addr; + /** sensitivity range (0-3) */ + int sens_range; + /** sensitivity method for MH (-1,0-7) */ + int sens_MH; + /** tile number of sensitivity specification (>=0) */ + int sens_TPH_tileno[JPWL_MAX_NO_TILESPECS]; + /** sensitivity methods for TPHs (-1,0-7) */ + int sens_TPH[JPWL_MAX_NO_TILESPECS]; + /** enables JPWL correction at the decoder */ + OPJ_BOOL correct; + /** expected number of components at the decoder */ + int exp_comps; + /** maximum number of tiles at the decoder */ + OPJ_UINT32 max_tiles; #endif /* USE_JPWL */ - /******** FLAGS *********/ - /** if ppm == 1 --> there was a PPM marker*/ - OPJ_BITFIELD ppm : 1; - /** tells if the parameter is a coding or decoding one */ - OPJ_BITFIELD m_is_decoder : 1; -/* < there was a PPM marker*/ + OPJ_BITFIELD ppm : 1; + /** tells if the parameter is a coding or decoding one */ + OPJ_BITFIELD m_is_decoder : 1; + /* <cp. +Decoding parameters are returned in j2k->cp. @param j2k J2K decompressor handle @param parameters decompression parameters */ @@ -623,10 +608,10 @@ OPJ_BOOL opj_j2k_set_threads(opj_j2k_t *j2k, OPJ_UINT32 num_threads); opj_j2k_t* opj_j2k_create_compress(void); -OPJ_BOOL opj_j2k_setup_encoder( opj_j2k_t *p_j2k, - opj_cparameters_t *parameters, - opj_image_t *image, - opj_event_mgr_t * p_manager); +OPJ_BOOL opj_j2k_setup_encoder(opj_j2k_t *p_j2k, + opj_cparameters_t *parameters, + opj_image_t *image, + opj_event_mgr_t * p_manager); /** Converts an enum type progression order to string type @@ -656,87 +641,87 @@ OPJ_BOOL opj_j2k_end_decompress(opj_j2k_t *j2k, * * @return true if the box is valid. */ -OPJ_BOOL opj_j2k_read_header( opj_stream_private_t *p_stream, - opj_j2k_t* p_j2k, - opj_image_t** p_image, - opj_event_mgr_t* p_manager ); +OPJ_BOOL opj_j2k_read_header(opj_stream_private_t *p_stream, + opj_j2k_t* p_j2k, + opj_image_t** p_image, + opj_event_mgr_t* p_manager); /** * Destroys a jpeg2000 codec. * - * @param p_j2k the jpeg20000 structure to destroy. + * @param p_j2k the jpeg20000 structure to destroy. */ -void opj_j2k_destroy (opj_j2k_t *p_j2k); +void opj_j2k_destroy(opj_j2k_t *p_j2k); /** * Destroys a codestream index structure. * - * @param p_cstr_ind the codestream index parameter to destroy. + * @param p_cstr_ind the codestream index parameter to destroy. */ -void j2k_destroy_cstr_index (opj_codestream_index_t *p_cstr_ind); +void j2k_destroy_cstr_index(opj_codestream_index_t *p_cstr_ind); /** * Decode tile data. - * @param p_j2k the jpeg2000 codec. - * @param p_tile_index + * @param p_j2k the jpeg2000 codec. + * @param p_tile_index * @param p_data FIXME DOC * @param p_data_size FIXME DOC - * @param p_stream the stream to write data to. - * @param p_manager the user event manager. + * @param p_stream the stream to write data to. + * @param p_manager the user event manager. */ -OPJ_BOOL opj_j2k_decode_tile ( opj_j2k_t * p_j2k, - 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_j2k_decode_tile(opj_j2k_t * p_j2k, + 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); /** * Reads a tile header. - * @param p_j2k the jpeg2000 codec. - * @param p_tile_index FIXME DOC - * @param p_data_size FIXME DOC - * @param p_tile_x0 FIXME DOC - * @param p_tile_y0 FIXME DOC - * @param p_tile_x1 FIXME DOC - * @param p_tile_y1 FIXME DOC - * @param p_nb_comps FIXME DOC - * @param p_go_on FIXME DOC - * @param p_stream the stream to write data to. - * @param p_manager the user event manager. + * @param p_j2k the jpeg2000 codec. + * @param p_tile_index FIXME DOC + * @param p_data_size FIXME DOC + * @param p_tile_x0 FIXME DOC + * @param p_tile_y0 FIXME DOC + * @param p_tile_x1 FIXME DOC + * @param p_tile_y1 FIXME DOC + * @param p_nb_comps FIXME DOC + * @param p_go_on FIXME DOC + * @param p_stream the stream to write data to. + * @param p_manager the user event manager. */ -OPJ_BOOL opj_j2k_read_tile_header ( opj_j2k_t * p_j2k, - 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_j2k_read_tile_header(opj_j2k_t * p_j2k, + 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); /** * Sets the given area to be decoded. This function should be called right after opj_read_header and before any tile header reading. * - * @param p_j2k the jpeg2000 codec. - * @param p_image FIXME DOC - * @param p_start_x the left position of the rectangle to decode (in image coordinates). - * @param p_start_y the up position of the rectangle to decode (in image coordinates). - * @param p_end_x the right position of the rectangle to decode (in image coordinates). - * @param p_end_y the bottom position of the rectangle to decode (in image coordinates). - * @param p_manager the user event manager + * @param p_j2k the jpeg2000 codec. + * @param p_image FIXME DOC + * @param p_start_x the left position of the rectangle to decode (in image coordinates). + * @param p_start_y the up position of the rectangle to decode (in image coordinates). + * @param p_end_x the right position of the rectangle to decode (in image coordinates). + * @param p_end_y the bottom position of the rectangle to decode (in image coordinates). + * @param p_manager the user event manager * - * @return true if the area could be set. + * @return true if the area could be set. */ -OPJ_BOOL opj_j2k_set_decode_area( opj_j2k_t *p_j2k, - 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_j2k_set_decode_area(opj_j2k_t *p_j2k, + 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); /** * Creates a J2K decompression structure. @@ -749,48 +734,50 @@ opj_j2k_t* opj_j2k_create_decompress(void); /** * Dump some elements from the J2K decompression structure . * - *@param p_j2k the jpeg2000 codec. - *@param flag flag to describe what elments are dump. - *@param out_stream output stream where dump the elements. + *@param p_j2k the jpeg2000 codec. + *@param flag flag to describe what elments are dump. + *@param out_stream output stream where dump the elements. * */ -void j2k_dump (opj_j2k_t* p_j2k, OPJ_INT32 flag, FILE* out_stream); +void j2k_dump(opj_j2k_t* p_j2k, OPJ_INT32 flag, FILE* out_stream); /** * Dump an image header structure. * - *@param image the image header to dump. - *@param dev_dump_flag flag to describe if we are in the case of this function is use outside j2k_dump function - *@param out_stream output stream where dump the elements. + *@param image the image header to dump. + *@param dev_dump_flag flag to describe if we are in the case of this function is use outside j2k_dump function + *@param out_stream output stream where dump the elements. */ -void j2k_dump_image_header(opj_image_t* image, OPJ_BOOL dev_dump_flag, FILE* out_stream); +void j2k_dump_image_header(opj_image_t* image, OPJ_BOOL dev_dump_flag, + FILE* out_stream); /** * Dump a component image header structure. * - *@param comp the component image header to dump. - *@param dev_dump_flag flag to describe if we are in the case of this function is use outside j2k_dump function - *@param out_stream output stream where dump the elements. + *@param comp the component image header to dump. + *@param dev_dump_flag flag to describe if we are in the case of this function is use outside j2k_dump function + *@param out_stream output stream where dump the elements. */ -void j2k_dump_image_comp_header(opj_image_comp_t* comp, OPJ_BOOL dev_dump_flag, FILE* out_stream); +void j2k_dump_image_comp_header(opj_image_comp_t* comp, OPJ_BOOL dev_dump_flag, + FILE* out_stream); /** * Get the codestream info from a JPEG2000 codec. * - *@param p_j2k the component image header to dump. + *@param p_j2k the component image header to dump. * - *@return the codestream information extract from the jpg2000 codec + *@return the codestream information extract from the jpg2000 codec */ opj_codestream_info_v2_t* j2k_get_cstr_info(opj_j2k_t* p_j2k); /** * Get the codestream index from a JPEG2000 codec. * - *@param p_j2k the component image header to dump. + *@param p_j2k the component image header to dump. * - *@return the codestream index extract from the jpg2000 codec + *@return the codestream index extract from the jpg2000 codec */ opj_codestream_index_t* j2k_get_cstr_index(opj_j2k_t* p_j2k); @@ -808,64 +795,64 @@ OPJ_BOOL opj_j2k_decode(opj_j2k_t *j2k, opj_event_mgr_t *p_manager); -OPJ_BOOL opj_j2k_get_tile( opj_j2k_t *p_j2k, - opj_stream_private_t *p_stream, - opj_image_t* p_image, - opj_event_mgr_t * p_manager, - OPJ_UINT32 tile_index ); +OPJ_BOOL opj_j2k_get_tile(opj_j2k_t *p_j2k, + opj_stream_private_t *p_stream, + opj_image_t* p_image, + opj_event_mgr_t * p_manager, + OPJ_UINT32 tile_index); -OPJ_BOOL opj_j2k_set_decoded_resolution_factor(opj_j2k_t *p_j2k, - OPJ_UINT32 res_factor, - opj_event_mgr_t * p_manager); +OPJ_BOOL opj_j2k_set_decoded_resolution_factor(opj_j2k_t *p_j2k, + OPJ_UINT32 res_factor, + opj_event_mgr_t * p_manager); /** * Writes a tile. - * @param p_j2k the jpeg2000 codec. + * @param p_j2k the jpeg2000 codec. * @param p_tile_index FIXME DOC * @param p_data FIXME DOC * @param p_data_size FIXME DOC - * @param p_stream the stream to write data to. - * @param p_manager the user event manager. + * @param p_stream the stream to write data to. + * @param p_manager the user event manager. */ -OPJ_BOOL opj_j2k_write_tile ( opj_j2k_t * p_j2k, - 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_j2k_write_tile(opj_j2k_t * p_j2k, + 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); /** * Encodes an image into a JPEG-2000 codestream */ -OPJ_BOOL opj_j2k_encode( opj_j2k_t * p_j2k, - opj_stream_private_t *cio, - opj_event_mgr_t * p_manager ); +OPJ_BOOL opj_j2k_encode(opj_j2k_t * p_j2k, + opj_stream_private_t *cio, + opj_event_mgr_t * p_manager); /** * Starts a compression scheme, i.e. validates the codec parameters, writes the header. * - * @param p_j2k the jpeg2000 codec. - * @param p_stream the stream object. - * @param p_image FIXME DOC - * @param p_manager the user event manager. + * @param p_j2k the jpeg2000 codec. + * @param p_stream the stream object. + * @param p_image FIXME DOC + * @param p_manager the user event manager. * * @return true if the codec is valid. */ OPJ_BOOL opj_j2k_start_compress(opj_j2k_t *p_j2k, - opj_stream_private_t *p_stream, - opj_image_t * p_image, - opj_event_mgr_t * p_manager); + opj_stream_private_t *p_stream, + opj_image_t * p_image, + opj_event_mgr_t * p_manager); /** * Ends the compression procedures and possibiliy add data to be read after the * codestream. */ -OPJ_BOOL opj_j2k_end_compress( opj_j2k_t *p_j2k, - opj_stream_private_t *cio, - opj_event_mgr_t * p_manager); +OPJ_BOOL opj_j2k_end_compress(opj_j2k_t *p_j2k, + opj_stream_private_t *cio, + opj_event_mgr_t * p_manager); -OPJ_BOOL opj_j2k_setup_mct_encoding (opj_tcp_t * p_tcp, opj_image_t * p_image); +OPJ_BOOL opj_j2k_setup_mct_encoding(opj_tcp_t * p_tcp, opj_image_t * p_image); #endif /* __J2K_H */ diff --git a/src/lib/openjp2/jp2.h b/src/lib/openjp2/jp2.h index b54d0bfd..7ca5b598 100644 --- a/src/lib/openjp2/jp2.h +++ b/src/lib/openjp2/jp2.h @@ -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. diff --git a/src/lib/openjp2/mct.h b/src/lib/openjp2/mct.h index 1bc722e3..293cdfe8 100644 --- a/src/lib/openjp2/mct.h +++ b/src/lib/openjp2/mct.h @@ -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); /* ----------------------------------------------------------------------- */ /*@}*/ diff --git a/src/lib/openjp2/mqc.h b/src/lib/openjp2/mqc.h index 491ee50e..8417bb0a 100644 --- a/src/lib/openjp2/mqc.h +++ b/src/lib/openjp2/mqc.h @@ -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 @@ -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.

Not fully implemented and tested !!

@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.

Not fully implemented and tested !!

@param mqc MQC handle @param d The symbol to be encoded (0 or 1) diff --git a/src/lib/openjp2/mqc_inl.h b/src/lib/openjp2/mqc_inl.h index 882b59f4..7e1c17d1 100644 --- a/src/lib/openjp2/mqc_inl.h +++ b/src/lib/openjp2/mqc_inl.h @@ -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 @@ -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 */ diff --git a/src/lib/openjp2/openjpeg.h b/src/lib/openjp2/openjpeg.h index 7912c236..c7c82fcc 100644 --- a/src/lib/openjp2/openjpeg.h +++ b/src/lib/openjp2/openjpeg.h @@ -1,110 +1,110 @@ - /* - * 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) 2001-2003, David Janssens - * Copyright (c) 2002-2003, Yannick Verschueren - * Copyright (c) 2003-2007, Francois-Olivier Devaux - * Copyright (c) 2003-2014, Antonin Descampe - * Copyright (c) 2005, Herve Drolon, FreeImage Team - * Copyright (c) 2006-2007, Parvatha Elangovan - * Copyright (c) 2008, Jerome Fimes, Communications & Systemes - * Copyright (c) 2010-2011, Kaori Hagihara - * Copyright (c) 2011-2012, Centre National d'Etudes Spatiales (CNES), France - * Copyright (c) 2012, CS Systemes d'Information, France - * 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. - */ +/* +* 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) 2001-2003, David Janssens +* Copyright (c) 2002-2003, Yannick Verschueren +* Copyright (c) 2003-2007, Francois-Olivier Devaux +* Copyright (c) 2003-2014, Antonin Descampe +* Copyright (c) 2005, Herve Drolon, FreeImage Team +* Copyright (c) 2006-2007, Parvatha Elangovan +* Copyright (c) 2008, Jerome Fimes, Communications & Systemes +* Copyright (c) 2010-2011, Kaori Hagihara +* Copyright (c) 2011-2012, Centre National d'Etudes Spatiales (CNES), France +* Copyright (c) 2012, CS Systemes d'Information, France +* 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 OPENJPEG_H #define OPENJPEG_H -/* +/* ========================================================== Compiler directives ========================================================== */ /* -The inline keyword is supported by C99 but not by C90. -Most compilers implement their own version of this keyword ... +The inline keyword is supported by C99 but not by C90. +Most compilers implement their own version of this keyword ... */ #ifndef INLINE - #if defined(_MSC_VER) - #define INLINE __forceinline - #elif defined(__GNUC__) - #define INLINE __inline__ - #elif defined(__MWERKS__) - #define INLINE inline - #else - /* add other compilers here ... */ - #define INLINE - #endif /* defined() */ +#if defined(_MSC_VER) +#define INLINE __forceinline +#elif defined(__GNUC__) +#define INLINE __inline__ +#elif defined(__MWERKS__) +#define INLINE inline +#else +/* add other compilers here ... */ +#define INLINE +#endif /* defined() */ #endif /* INLINE */ /* deprecated attribute */ #ifdef __GNUC__ - #define OPJ_DEPRECATED(func) func __attribute__ ((deprecated)) +#define OPJ_DEPRECATED(func) func __attribute__ ((deprecated)) #elif defined(_MSC_VER) - #define OPJ_DEPRECATED(func) __declspec(deprecated) func +#define OPJ_DEPRECATED(func) __declspec(deprecated) func #else - #pragma message("WARNING: You need to implement DEPRECATED for this compiler") - #define OPJ_DEPRECATED(func) func +#pragma message("WARNING: You need to implement DEPRECATED for this compiler") +#define OPJ_DEPRECATED(func) func #endif #if defined(OPJ_STATIC) || !defined(_WIN32) /* http://gcc.gnu.org/wiki/Visibility */ -# if __GNUC__ >= 4 -# if defined(OPJ_STATIC) /* static library uses "hidden" */ -# define OPJ_API __attribute__ ((visibility ("hidden"))) -# else -# define OPJ_API __attribute__ ((visibility ("default"))) -# endif -# define OPJ_LOCAL __attribute__ ((visibility ("hidden"))) -# else -# define OPJ_API -# define OPJ_LOCAL -# endif -# define OPJ_CALLCONV +# if __GNUC__ >= 4 +# if defined(OPJ_STATIC) /* static library uses "hidden" */ +# define OPJ_API __attribute__ ((visibility ("hidden"))) +# else +# define OPJ_API __attribute__ ((visibility ("default"))) +# endif +# define OPJ_LOCAL __attribute__ ((visibility ("hidden"))) +# else +# define OPJ_API +# define OPJ_LOCAL +# endif +# define OPJ_CALLCONV #else -# define OPJ_CALLCONV __stdcall +# 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. */ -# if defined(OPJ_EXPORTS) || defined(DLL_EXPORT) -# define OPJ_API __declspec(dllexport) -# else -# define OPJ_API __declspec(dllimport) -# endif /* OPJ_EXPORTS */ +# if defined(OPJ_EXPORTS) || defined(DLL_EXPORT) +# define OPJ_API __declspec(dllexport) +# else +# define OPJ_API __declspec(dllimport) +# endif /* OPJ_EXPORTS */ #endif /* !OPJ_STATIC || !_WIN32 */ typedef int OPJ_BOOL; @@ -135,7 +135,7 @@ typedef size_t OPJ_SIZE_T; /* Avoid compile-time warning because parameter is not used */ #define OPJ_ARG_NOT_USED(x) (void)(x) -/* +/* ========================================================== Useful constant definitions ========================================================== @@ -143,19 +143,19 @@ typedef size_t OPJ_SIZE_T; #define OPJ_PATH_LEN 4096 /**< Maximum allowed size for filenames */ -#define OPJ_J2K_MAXRLVLS 33 /**< Number of maximum resolution level authorized */ -#define OPJ_J2K_MAXBANDS (3*OPJ_J2K_MAXRLVLS-2) /**< Number of maximum sub-band linked to number of resolution level */ +#define OPJ_J2K_MAXRLVLS 33 /**< Number of maximum resolution level authorized */ +#define OPJ_J2K_MAXBANDS (3*OPJ_J2K_MAXRLVLS-2) /**< Number of maximum sub-band linked to number of resolution level */ -#define OPJ_J2K_DEFAULT_NB_SEGS 10 -#define OPJ_J2K_STREAM_CHUNK_SIZE 0x100000 /** 1 mega by default */ -#define OPJ_J2K_DEFAULT_HEADER_SIZE 1000 -#define OPJ_J2K_MCC_DEFAULT_NB_RECORDS 10 -#define OPJ_J2K_MCT_DEFAULT_NB_RECORDS 10 +#define OPJ_J2K_DEFAULT_NB_SEGS 10 +#define OPJ_J2K_STREAM_CHUNK_SIZE 0x100000 /** 1 mega by default */ +#define OPJ_J2K_DEFAULT_HEADER_SIZE 1000 +#define OPJ_J2K_MCC_DEFAULT_NB_RECORDS 10 +#define OPJ_J2K_MCT_DEFAULT_NB_RECORDS 10 /* UniPG>> */ /* NOT YET USED IN THE V2 VERSION OF OPENJPEG */ -#define JPWL_MAX_NO_TILESPECS 16 /**< Maximum number of tile parts expected by JPWL: increase at your will */ -#define JPWL_MAX_NO_PACKSPECS 16 /**< Maximum number of packet parts expected by JPWL: increase at your will */ -#define JPWL_MAX_NO_MARKERS 512 /**< Maximum number of JPWL markers: increase at your will */ +#define JPWL_MAX_NO_TILESPECS 16 /**< Maximum number of tile parts expected by JPWL: increase at your will */ +#define JPWL_MAX_NO_PACKSPECS 16 /**< Maximum number of packet parts expected by JPWL: increase at your will */ +#define JPWL_MAX_NO_MARKERS 512 /**< Maximum number of JPWL markers: increase at your will */ #define JPWL_PRIVATEINDEX_NAME "jpwl_index_privatefilename" /**< index file name used when JPWL is on */ #define JPWL_EXPECTED_COMPONENTS 3 /**< Expect this number of components, so you'll find better the first EPB */ #define JPWL_MAXIMUM_TILES 8192 /**< Expect this maximum number of tiles, to avoid some crashes */ @@ -167,15 +167,15 @@ typedef size_t OPJ_SIZE_T; * EXPERIMENTAL FOR THE MOMENT * Supported options about file information used only in j2k_dump */ -#define OPJ_IMG_INFO 1 /**< Basic image information provided to the user */ -#define OPJ_J2K_MH_INFO 2 /**< Codestream information based only on the main header */ -#define OPJ_J2K_TH_INFO 4 /**< Tile information based on the current tile header */ -#define OPJ_J2K_TCH_INFO 8 /**< Tile/Component information of all tiles */ -#define OPJ_J2K_MH_IND 16 /**< Codestream index based only on the main header */ -#define OPJ_J2K_TH_IND 32 /**< Tile index based on the current tile */ -/*FIXME #define OPJ_J2K_CSTR_IND 48*/ /**< */ -#define OPJ_JP2_INFO 128 /**< JP2 file information */ -#define OPJ_JP2_IND 256 /**< JP2 file index */ +#define OPJ_IMG_INFO 1 /**< Basic image information provided to the user */ +#define OPJ_J2K_MH_INFO 2 /**< Codestream information based only on the main header */ +#define OPJ_J2K_TH_INFO 4 /**< Tile information based on the current tile header */ +#define OPJ_J2K_TCH_INFO 8 /**< Tile/Component information of all tiles */ +#define OPJ_J2K_MH_IND 16 /**< Codestream index based only on the main header */ +#define OPJ_J2K_TH_IND 32 /**< Tile index based on the current tile */ +/*FIXME #define OPJ_J2K_CSTR_IND 48*/ /**< */ +#define OPJ_JP2_INFO 128 /**< JP2 file information */ +#define OPJ_JP2_IND 256 /**< JP2 file index */ /** * JPEG 2000 Profiles, see Table A.10 from 15444-1 (updated in various AMD) @@ -228,12 +228,12 @@ typedef size_t OPJ_SIZE_T; /** * JPEG 2000 codestream and component size limits in cinema profiles * */ -#define OPJ_CINEMA_24_CS 1302083 /** Maximum codestream length for 24fps */ +#define OPJ_CINEMA_24_CS 1302083 /** Maximum codestream length for 24fps */ #define OPJ_CINEMA_48_CS 651041 /** Maximum codestream length for 48fps */ #define OPJ_CINEMA_24_COMP 1041666 /** Maximum size per color component for 2K & 4K @ 24fps */ -#define OPJ_CINEMA_48_COMP 520833 /** Maximum size per color component for 2K @ 48fps */ +#define OPJ_CINEMA_48_COMP 520833 /** Maximum size per color component for 2K @ 48fps */ -/* +/* ========================================================== enum definitions ========================================================== @@ -244,9 +244,9 @@ typedef size_t OPJ_SIZE_T; * Rsiz Capabilities * */ typedef enum RSIZ_CAPABILITIES { - OPJ_STD_RSIZ = 0, /** Standard JPEG2000 profile*/ - OPJ_CINEMA2K = 3, /** Profile name for a 2K image*/ - OPJ_CINEMA4K = 4, /** Profile name for a 4K image*/ + OPJ_STD_RSIZ = 0, /** Standard JPEG2000 profile*/ + OPJ_CINEMA2K = 3, /** Profile name for a 2K image*/ + OPJ_CINEMA4K = 4, /** Profile name for a 4K image*/ OPJ_MCT = 0x8100 } OPJ_RSIZ_CAPABILITIES; @@ -255,33 +255,33 @@ typedef enum RSIZ_CAPABILITIES { * Digital cinema operation mode * */ typedef enum CINEMA_MODE { - OPJ_OFF = 0, /** Not Digital Cinema*/ - OPJ_CINEMA2K_24 = 1, /** 2K Digital Cinema at 24 fps*/ - OPJ_CINEMA2K_48 = 2, /** 2K Digital Cinema at 48 fps*/ - OPJ_CINEMA4K_24 = 3 /** 4K Digital Cinema at 24 fps*/ -}OPJ_CINEMA_MODE; + OPJ_OFF = 0, /** Not Digital Cinema*/ + OPJ_CINEMA2K_24 = 1, /** 2K Digital Cinema at 24 fps*/ + OPJ_CINEMA2K_48 = 2, /** 2K Digital Cinema at 48 fps*/ + OPJ_CINEMA4K_24 = 3 /** 4K Digital Cinema at 24 fps*/ +} OPJ_CINEMA_MODE; -/** +/** * Progression order * */ typedef enum PROG_ORDER { - OPJ_PROG_UNKNOWN = -1, /**< place-holder */ - OPJ_LRCP = 0, /**< layer-resolution-component-precinct order */ - OPJ_RLCP = 1, /**< resolution-layer-component-precinct order */ - OPJ_RPCL = 2, /**< resolution-precinct-component-layer order */ - OPJ_PCRL = 3, /**< precinct-component-resolution-layer order */ - OPJ_CPRL = 4 /**< component-precinct-resolution-layer order */ + OPJ_PROG_UNKNOWN = -1, /**< place-holder */ + OPJ_LRCP = 0, /**< layer-resolution-component-precinct order */ + OPJ_RLCP = 1, /**< resolution-layer-component-precinct order */ + OPJ_RPCL = 2, /**< resolution-precinct-component-layer order */ + OPJ_PCRL = 3, /**< precinct-component-resolution-layer order */ + OPJ_CPRL = 4 /**< component-precinct-resolution-layer order */ } OPJ_PROG_ORDER; /** * Supported image color spaces */ typedef enum COLOR_SPACE { - OPJ_CLRSPC_UNKNOWN = -1, /**< not supported by the library */ - OPJ_CLRSPC_UNSPECIFIED = 0, /**< not specified in the codestream */ - OPJ_CLRSPC_SRGB = 1, /**< sRGB */ - OPJ_CLRSPC_GRAY = 2, /**< grayscale */ - OPJ_CLRSPC_SYCC = 3, /**< YUV */ + OPJ_CLRSPC_UNKNOWN = -1, /**< not supported by the library */ + OPJ_CLRSPC_UNSPECIFIED = 0, /**< not specified in the codestream */ + OPJ_CLRSPC_SRGB = 1, /**< sRGB */ + OPJ_CLRSPC_GRAY = 2, /**< grayscale */ + OPJ_CLRSPC_SYCC = 3, /**< YUV */ OPJ_CLRSPC_EYCC = 4, /**< e-YCC */ OPJ_CLRSPC_CMYK = 5 /**< CMYK */ } OPJ_COLOR_SPACE; @@ -290,16 +290,16 @@ typedef enum COLOR_SPACE { * Supported codec */ typedef enum CODEC_FORMAT { - OPJ_CODEC_UNKNOWN = -1, /**< place-holder */ - OPJ_CODEC_J2K = 0, /**< JPEG-2000 codestream : read/write */ - OPJ_CODEC_JPT = 1, /**< JPT-stream (JPEG 2000, JPIP) : read only */ - OPJ_CODEC_JP2 = 2, /**< JP2 file format : read/write */ - OPJ_CODEC_JPP = 3, /**< JPP-stream (JPEG 2000, JPIP) : to be coded */ - OPJ_CODEC_JPX = 4 /**< JPX file format (JPEG 2000 Part-2) : to be coded */ + OPJ_CODEC_UNKNOWN = -1, /**< place-holder */ + OPJ_CODEC_J2K = 0, /**< JPEG-2000 codestream : read/write */ + OPJ_CODEC_JPT = 1, /**< JPT-stream (JPEG 2000, JPIP) : read only */ + OPJ_CODEC_JP2 = 2, /**< JP2 file format : read/write */ + OPJ_CODEC_JPP = 3, /**< JPP-stream (JPEG 2000, JPIP) : to be coded */ + OPJ_CODEC_JPX = 4 /**< JPX file format (JPEG 2000 Part-2) : to be coded */ } OPJ_CODEC_FORMAT; -/* +/* ========================================================== event manager typedef definitions ========================================================== @@ -308,11 +308,11 @@ typedef enum CODEC_FORMAT { /** * Callback function prototype for events * @param msg Event message - * @param client_data Client object where will be return the event message + * @param client_data Client object where will be return the event message * */ -typedef void (*opj_msg_callback) (const char *msg, void *client_data); +typedef void (*opj_msg_callback)(const char *msg, void *client_data); -/* +/* ========================================================== codec typedef definitions ========================================================== @@ -320,147 +320,147 @@ typedef void (*opj_msg_callback) (const char *msg, void *client_data); /** * Progression order changes - * + * */ typedef struct opj_poc { - /** Resolution num start, Component num start, given by POC */ - OPJ_UINT32 resno0, compno0; - /** Layer num end,Resolution num end, Component num end, given by POC */ - OPJ_UINT32 layno1, resno1, compno1; - /** Layer num start,Precinct num start, Precinct num end */ - OPJ_UINT32 layno0, precno0, precno1; - /** Progression order enum*/ - OPJ_PROG_ORDER prg1,prg; - /** Progression order string*/ - OPJ_CHAR progorder[5]; - /** Tile number */ - OPJ_UINT32 tile; - /** Start and end values for Tile width and height*/ - OPJ_INT32 tx0,tx1,ty0,ty1; - /** Start value, initialised in pi_initialise_encode*/ - OPJ_UINT32 layS, resS, compS, prcS; - /** End value, initialised in pi_initialise_encode */ - OPJ_UINT32 layE, resE, compE, prcE; - /** Start and end values of Tile width and height, initialised in pi_initialise_encode*/ - OPJ_UINT32 txS,txE,tyS,tyE,dx,dy; - /** Temporary values for Tile parts, initialised in pi_create_encode */ - OPJ_UINT32 lay_t, res_t, comp_t, prc_t,tx0_t,ty0_t; + /** Resolution num start, Component num start, given by POC */ + OPJ_UINT32 resno0, compno0; + /** Layer num end,Resolution num end, Component num end, given by POC */ + OPJ_UINT32 layno1, resno1, compno1; + /** Layer num start,Precinct num start, Precinct num end */ + OPJ_UINT32 layno0, precno0, precno1; + /** Progression order enum*/ + OPJ_PROG_ORDER prg1, prg; + /** Progression order string*/ + OPJ_CHAR progorder[5]; + /** Tile number */ + OPJ_UINT32 tile; + /** Start and end values for Tile width and height*/ + OPJ_INT32 tx0, tx1, ty0, ty1; + /** Start value, initialised in pi_initialise_encode*/ + OPJ_UINT32 layS, resS, compS, prcS; + /** End value, initialised in pi_initialise_encode */ + OPJ_UINT32 layE, resE, compE, prcE; + /** Start and end values of Tile width and height, initialised in pi_initialise_encode*/ + OPJ_UINT32 txS, txE, tyS, tyE, dx, dy; + /** Temporary values for Tile parts, initialised in pi_create_encode */ + OPJ_UINT32 lay_t, res_t, comp_t, prc_t, tx0_t, ty0_t; } opj_poc_t; /** * Compression parameters * */ typedef struct opj_cparameters { - /** size of tile: tile_size_on = false (not in argument) or = true (in argument) */ - OPJ_BOOL tile_size_on; - /** XTOsiz */ - int cp_tx0; - /** YTOsiz */ - int cp_ty0; - /** XTsiz */ - int cp_tdx; - /** YTsiz */ - int cp_tdy; - /** 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; - /** comment for coding */ - char *cp_comment; - /** csty : coding style */ - int csty; - /** progression order (default OPJ_LRCP) */ - OPJ_PROG_ORDER prog_order; - /** progression order changes */ - opj_poc_t POC[32]; - /** number of progression order changes (POC), default to 0 */ - OPJ_UINT32 numpocs; - /** number of layers */ - int tcp_numlayers; + /** size of tile: tile_size_on = false (not in argument) or = true (in argument) */ + OPJ_BOOL tile_size_on; + /** XTOsiz */ + int cp_tx0; + /** YTOsiz */ + int cp_ty0; + /** XTsiz */ + int cp_tdx; + /** YTsiz */ + int cp_tdy; + /** 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; + /** comment for coding */ + char *cp_comment; + /** csty : coding style */ + int csty; + /** progression order (default OPJ_LRCP) */ + OPJ_PROG_ORDER prog_order; + /** progression order changes */ + opj_poc_t POC[32]; + /** number of progression order changes (POC), default to 0 */ + OPJ_UINT32 numpocs; + /** number of layers */ + int tcp_numlayers; /** rates of layers - might be subsequently limited by the max_cs_size field */ - float tcp_rates[100]; - /** different psnr for successive layers */ - float tcp_distoratio[100]; - /** number of resolutions */ - int numresolution; - /** initial code block width, default to 64 */ - int cblockw_init; - /** initial code block height, default to 64 */ - int cblockh_init; - /** mode switch (cblk_style) */ - int mode; - /** 1 : use the irreversible DWT 9-7, 0 : use lossless compression (default) */ - int irreversible; - /** 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 precinct size specifications */ - int res_spec; - /** initial precinct width */ - int prcw_init[OPJ_J2K_MAXRLVLS]; - /** initial precinct height */ - int prch_init[OPJ_J2K_MAXRLVLS]; + float tcp_rates[100]; + /** different psnr for successive layers */ + float tcp_distoratio[100]; + /** number of resolutions */ + int numresolution; + /** initial code block width, default to 64 */ + int cblockw_init; + /** initial code block height, default to 64 */ + int cblockh_init; + /** mode switch (cblk_style) */ + int mode; + /** 1 : use the irreversible DWT 9-7, 0 : use lossless compression (default) */ + int irreversible; + /** 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 precinct size specifications */ + int res_spec; + /** initial precinct width */ + int prcw_init[OPJ_J2K_MAXRLVLS]; + /** initial precinct height */ + int prch_init[OPJ_J2K_MAXRLVLS]; - /**@name command line encoder parameters (not used inside the library) */ - /*@{*/ - /** input file name */ - char infile[OPJ_PATH_LEN]; - /** output file name */ - char outfile[OPJ_PATH_LEN]; - /** DEPRECATED. Index generation is now handeld with the opj_encode_with_info() function. Set to NULL */ - int index_on; - /** DEPRECATED. Index generation is now handeld with the opj_encode_with_info() function. Set to NULL */ - char index[OPJ_PATH_LEN]; - /** subimage encoding: origin image offset in x direction */ - int image_offset_x0; - /** subimage encoding: origin image offset in y direction */ - int image_offset_y0; - /** subsampling value for dx */ - int subsampling_dx; - /** subsampling value for dy */ - int subsampling_dy; - /** input file format 0: PGX, 1: PxM, 2: BMP 3:TIF*/ - int decod_format; - /** output file format 0: J2K, 1: JP2, 2: JPT */ - int cod_format; - /*@}*/ + /**@name command line encoder parameters (not used inside the library) */ + /*@{*/ + /** input file name */ + char infile[OPJ_PATH_LEN]; + /** output file name */ + char outfile[OPJ_PATH_LEN]; + /** DEPRECATED. Index generation is now handeld with the opj_encode_with_info() function. Set to NULL */ + int index_on; + /** DEPRECATED. Index generation is now handeld with the opj_encode_with_info() function. Set to NULL */ + char index[OPJ_PATH_LEN]; + /** subimage encoding: origin image offset in x direction */ + int image_offset_x0; + /** subimage encoding: origin image offset in y direction */ + int image_offset_y0; + /** subsampling value for dx */ + int subsampling_dx; + /** subsampling value for dy */ + int subsampling_dy; + /** input file format 0: PGX, 1: PxM, 2: BMP 3:TIF*/ + int decod_format; + /** output file format 0: J2K, 1: JP2, 2: JPT */ + int cod_format; + /*@}*/ -/* UniPG>> */ /* NOT YET USED IN THE V2 VERSION OF OPENJPEG */ - /**@name JPWL encoding parameters */ - /*@{*/ - /** enables writing of EPC in MH, thus activating JPWL */ - OPJ_BOOL jpwl_epc_on; - /** error protection method for MH (0,1,16,32,37-128) */ - int jpwl_hprot_MH; - /** tile number of header protection specification (>=0) */ - int jpwl_hprot_TPH_tileno[JPWL_MAX_NO_TILESPECS]; - /** error protection methods for TPHs (0,1,16,32,37-128) */ - int jpwl_hprot_TPH[JPWL_MAX_NO_TILESPECS]; - /** tile number of packet protection specification (>=0) */ - int jpwl_pprot_tileno[JPWL_MAX_NO_PACKSPECS]; - /** packet number of packet protection specification (>=0) */ - int jpwl_pprot_packno[JPWL_MAX_NO_PACKSPECS]; - /** error protection methods for packets (0,1,16,32,37-128) */ - int jpwl_pprot[JPWL_MAX_NO_PACKSPECS]; - /** enables writing of ESD, (0=no/1/2 bytes) */ - int jpwl_sens_size; - /** sensitivity addressing size (0=auto/2/4 bytes) */ - int jpwl_sens_addr; - /** sensitivity range (0-3) */ - int jpwl_sens_range; - /** sensitivity method for MH (-1=no,0-7) */ - int jpwl_sens_MH; - /** tile number of sensitivity specification (>=0) */ - int jpwl_sens_TPH_tileno[JPWL_MAX_NO_TILESPECS]; - /** sensitivity methods for TPHs (-1=no,0-7) */ - int jpwl_sens_TPH[JPWL_MAX_NO_TILESPECS]; - /*@}*/ -/* <> */ /* NOT YET USED IN THE V2 VERSION OF OPENJPEG */ + /**@name JPWL encoding parameters */ + /*@{*/ + /** enables writing of EPC in MH, thus activating JPWL */ + OPJ_BOOL jpwl_epc_on; + /** error protection method for MH (0,1,16,32,37-128) */ + int jpwl_hprot_MH; + /** tile number of header protection specification (>=0) */ + int jpwl_hprot_TPH_tileno[JPWL_MAX_NO_TILESPECS]; + /** error protection methods for TPHs (0,1,16,32,37-128) */ + int jpwl_hprot_TPH[JPWL_MAX_NO_TILESPECS]; + /** tile number of packet protection specification (>=0) */ + int jpwl_pprot_tileno[JPWL_MAX_NO_PACKSPECS]; + /** packet number of packet protection specification (>=0) */ + int jpwl_pprot_packno[JPWL_MAX_NO_PACKSPECS]; + /** error protection methods for packets (0,1,16,32,37-128) */ + int jpwl_pprot[JPWL_MAX_NO_PACKSPECS]; + /** enables writing of ESD, (0=no/1/2 bytes) */ + int jpwl_sens_size; + /** sensitivity addressing size (0=auto/2/4 bytes) */ + int jpwl_sens_addr; + /** sensitivity range (0-3) */ + int jpwl_sens_range; + /** sensitivity method for MH (-1=no,0-7) */ + int jpwl_sens_MH; + /** tile number of sensitivity specification (>=0) */ + int jpwl_sens_TPH_tileno[JPWL_MAX_NO_TILESPECS]; + /** sensitivity methods for TPHs (-1=no,0-7) */ + int jpwl_sens_TPH[JPWL_MAX_NO_TILESPECS]; + /*@}*/ + /* <> */ /* NOT YET USED IN THE V2 VERSION OF OPENJPEG */ - /**@name JPWL decoding parameters */ - /*@{*/ - /** activates the JPWL correction capabilities */ - OPJ_BOOL jpwl_correct; - /** expected number of components */ - int jpwl_exp_comps; - /** maximum number of tiles */ - int jpwl_max_tiles; - /*@}*/ -/* <> */ /* NOT YET USED IN THE V2 VERSION OF OPENJPEG */ + /**@name JPWL decoding parameters */ + /*@{*/ + /** activates the JPWL correction capabilities */ + OPJ_BOOL jpwl_correct; + /** expected number of components */ + int jpwl_exp_comps; + /** maximum number of tiles */ + int jpwl_max_tiles; + /*@}*/ + /* <> */ - /** number of markers */ - int marknum; - /** list of markers */ - opj_marker_info_t *marker; - /** actual size of markers array */ - int maxmarknum; -/* <> */ + /** number of markers */ + int marknum; + /** list of markers */ + opj_marker_info_t *marker; + /** actual size of markers array */ + int maxmarknum; + /* <> */ /* NOT USED FOR THE MOMENT IN THE V2 VERSION */ - /** number of markers */ - OPJ_UINT32 marknum; - /** list of markers */ - opj_marker_info_t *marker; - /** actual size of markers array */ - OPJ_UINT32 maxmarknum; - /* <> */ /* NOT USED FOR THE MOMENT IN THE V2 VERSION */ + /** number of markers */ + OPJ_UINT32 marknum; + /** list of markers */ + opj_marker_info_t *marker; + /** actual size of markers array */ + OPJ_UINT32 maxmarknum; + /* <> */ /* NOT USED FOR THE MOMENT IN THE V2 VERSION */ - /** number of markers */ - OPJ_UINT32 marknum; - /** list of markers */ - opj_marker_info_t *marker; - /** actual size of markers array */ - OPJ_UINT32 maxmarknum; -/* <> */ /* NOT USED FOR THE MOMENT IN THE V2 VERSION */ + /** number of markers */ + OPJ_UINT32 marknum; + /** list of markers */ + opj_marker_info_t *marker; + /** actual size of markers array */ + OPJ_UINT32 maxmarknum; + /* < */ /* @@ -1024,8 +1027,8 @@ typedef struct opj_codestream_index { * EXPERIMENTAL FOR THE MOMENT */ typedef struct opj_jp2_metadata { - /** */ - OPJ_INT32 not_used; + /** */ + OPJ_INT32 not_used; } opj_jp2_metadata_t; @@ -1034,8 +1037,8 @@ typedef struct opj_jp2_metadata { * EXPERIMENTAL FOR THE MOMENT */ typedef struct opj_jp2_index { - /** */ - OPJ_INT32 not_used; + /** */ + OPJ_INT32 not_used; } opj_jp2_index_t; @@ -1045,7 +1048,7 @@ extern "C" { #endif -/* +/* ========================================================== openjpeg version ========================================================== @@ -1054,7 +1057,7 @@ extern "C" { /* Get the version of the openjpeg library*/ OPJ_API const char * OPJ_CALLCONV opj_version(void); -/* +/* ========================================================== image functions definitions ========================================================== @@ -1068,7 +1071,8 @@ OPJ_API const char * OPJ_CALLCONV opj_version(void); * @param clrspc image color space * @return returns a new image structure if successful, returns NULL otherwise * */ -OPJ_API opj_image_t* OPJ_CALLCONV opj_image_create(OPJ_UINT32 numcmpts, opj_image_cmptparm_t *cmptparms, OPJ_COLOR_SPACE clrspc); +OPJ_API opj_image_t* OPJ_CALLCONV opj_image_create(OPJ_UINT32 numcmpts, + opj_image_cmptparm_t *cmptparms, OPJ_COLOR_SPACE clrspc); /** * Deallocate any resources associated with an image @@ -1080,15 +1084,16 @@ OPJ_API void OPJ_CALLCONV opj_image_destroy(opj_image_t *image); /** * Creates an image without allocating memory for the image (used in the new version of the library). * - * @param numcmpts the number of components - * @param cmptparms the components parameters - * @param clrspc the image color space + * @param numcmpts the number of components + * @param cmptparms the components parameters + * @param clrspc the image color space * - * @return a new image structure if successful, NULL otherwise. + * @return a new image structure if successful, NULL otherwise. */ -OPJ_API opj_image_t* OPJ_CALLCONV opj_image_tile_create(OPJ_UINT32 numcmpts, opj_image_cmptparm_t *cmptparms, OPJ_COLOR_SPACE clrspc); +OPJ_API opj_image_t* OPJ_CALLCONV opj_image_tile_create(OPJ_UINT32 numcmpts, + opj_image_cmptparm_t *cmptparms, OPJ_COLOR_SPACE clrspc); -/* +/* ========================================================== stream functions definitions ========================================================== @@ -1097,65 +1102,72 @@ OPJ_API opj_image_t* OPJ_CALLCONV opj_image_tile_create(OPJ_UINT32 numcmpts, opj /** * Creates an abstract stream. This function does nothing except allocating memory and initializing the abstract stream. * - * @param p_is_input if set to true then the stream will be an input stream, an output stream else. + * @param p_is_input if set to true then the stream will be an input stream, an output stream else. * - * @return a stream object. + * @return a stream object. */ -OPJ_API opj_stream_t* OPJ_CALLCONV opj_stream_default_create(OPJ_BOOL p_is_input); +OPJ_API opj_stream_t* OPJ_CALLCONV opj_stream_default_create( + OPJ_BOOL p_is_input); /** * Creates an abstract stream. This function does nothing except allocating memory and initializing the abstract stream. * - * @param p_buffer_size FIXME DOC - * @param p_is_input if set to true then the stream will be an input stream, an output stream else. + * @param p_buffer_size FIXME DOC + * @param p_is_input if set to true then the stream will be an input stream, an output stream else. * - * @return a stream object. + * @return a stream object. */ -OPJ_API opj_stream_t* OPJ_CALLCONV opj_stream_create(OPJ_SIZE_T p_buffer_size, OPJ_BOOL p_is_input); +OPJ_API opj_stream_t* OPJ_CALLCONV opj_stream_create(OPJ_SIZE_T p_buffer_size, + OPJ_BOOL p_is_input); /** * Destroys a stream created by opj_create_stream. This function does NOT close the abstract stream. If needed the user must * close its own implementation of the stream. * - * @param p_stream the stream to destroy. + * @param p_stream the stream to destroy. */ OPJ_API void OPJ_CALLCONV opj_stream_destroy(opj_stream_t* p_stream); - + /** * Sets the given function to be used as a read function. - * @param p_stream the stream to modify - * @param p_function the function to use a read function. + * @param p_stream the stream to modify + * @param p_function the function to use a read function. */ -OPJ_API void OPJ_CALLCONV opj_stream_set_read_function(opj_stream_t* p_stream, opj_stream_read_fn p_function); +OPJ_API void OPJ_CALLCONV opj_stream_set_read_function(opj_stream_t* p_stream, + opj_stream_read_fn p_function); /** * Sets the given function to be used as a write function. - * @param p_stream the stream to modify - * @param p_function the function to use a write function. + * @param p_stream the stream to modify + * @param p_function the function to use a write function. */ -OPJ_API void OPJ_CALLCONV opj_stream_set_write_function(opj_stream_t* p_stream, opj_stream_write_fn p_function); +OPJ_API void OPJ_CALLCONV opj_stream_set_write_function(opj_stream_t* p_stream, + opj_stream_write_fn p_function); /** * Sets the given function to be used as a skip function. - * @param p_stream the stream to modify - * @param p_function the function to use a skip function. + * @param p_stream the stream to modify + * @param p_function the function to use a skip function. */ -OPJ_API void OPJ_CALLCONV opj_stream_set_skip_function(opj_stream_t* p_stream, opj_stream_skip_fn p_function); +OPJ_API void OPJ_CALLCONV opj_stream_set_skip_function(opj_stream_t* p_stream, + opj_stream_skip_fn p_function); /** * Sets the given function to be used as a seek function, the stream is then seekable. - * @param p_stream the stream to modify - * @param p_function the function to use a skip function. + * @param p_stream the stream to modify + * @param p_function the function to use a skip function. */ -OPJ_API void OPJ_CALLCONV opj_stream_set_seek_function(opj_stream_t* p_stream, opj_stream_seek_fn p_function); +OPJ_API void OPJ_CALLCONV opj_stream_set_seek_function(opj_stream_t* p_stream, + opj_stream_seek_fn p_function); /** * Sets the given data to be used as a user data for the stream. - * @param p_stream the stream to modify - * @param p_data the data to set. - * @param p_function the function to free p_data when opj_stream_destroy() is called. + * @param p_stream the stream to modify + * @param p_data the data to set. + * @param p_function the function to free p_data when opj_stream_destroy() is called. */ -OPJ_API void OPJ_CALLCONV opj_stream_set_user_data (opj_stream_t* p_stream, void * p_data, opj_stream_free_user_data_fn p_function); +OPJ_API void OPJ_CALLCONV opj_stream_set_user_data(opj_stream_t* p_stream, + void * p_data, opj_stream_free_user_data_fn p_function); /** * Sets the length of the user data for the stream. @@ -1163,25 +1175,28 @@ OPJ_API void OPJ_CALLCONV opj_stream_set_user_data (opj_stream_t* p_stream, void * @param p_stream the stream to modify * @param data_length length of the user_data. */ -OPJ_API void OPJ_CALLCONV opj_stream_set_user_data_length(opj_stream_t* p_stream, OPJ_UINT64 data_length); +OPJ_API void OPJ_CALLCONV opj_stream_set_user_data_length( + opj_stream_t* p_stream, OPJ_UINT64 data_length); /** * Create a stream from a file identified with its filename with default parameters (helper function) * @param fname the filename of the file to stream * @param p_is_read_stream whether the stream is a read stream (true) or not (false) */ -OPJ_API opj_stream_t* OPJ_CALLCONV opj_stream_create_default_file_stream (const char *fname, OPJ_BOOL p_is_read_stream); - +OPJ_API opj_stream_t* OPJ_CALLCONV opj_stream_create_default_file_stream( + const char *fname, OPJ_BOOL p_is_read_stream); + /** Create a stream from a file identified with its filename with a specific buffer size * @param fname the filename of the file to stream * @param p_buffer_size size of the chunk used to stream * @param p_is_read_stream whether the stream is a read stream (true) or not (false) */ -OPJ_API opj_stream_t* OPJ_CALLCONV opj_stream_create_file_stream (const char *fname, - OPJ_SIZE_T p_buffer_size, - OPJ_BOOL p_is_read_stream); - -/* +OPJ_API opj_stream_t* OPJ_CALLCONV opj_stream_create_file_stream( + const char *fname, + OPJ_SIZE_T p_buffer_size, + OPJ_BOOL p_is_read_stream); + +/* ========================================================== event manager functions definitions ========================================================== @@ -1192,9 +1207,9 @@ OPJ_API opj_stream_t* OPJ_CALLCONV opj_stream_create_file_stream (const char *fn * @param p_callback the callback function which will be used * @param p_user_data client object where will be returned the message */ -OPJ_API OPJ_BOOL OPJ_CALLCONV opj_set_info_handler(opj_codec_t * p_codec, - opj_msg_callback p_callback, - void * p_user_data); +OPJ_API OPJ_BOOL OPJ_CALLCONV opj_set_info_handler(opj_codec_t * p_codec, + opj_msg_callback p_callback, + void * p_user_data); /** * Set the warning handler use by openjpeg. * @param p_codec the codec previously initialise @@ -1202,19 +1217,19 @@ OPJ_API OPJ_BOOL OPJ_CALLCONV opj_set_info_handler(opj_codec_t * p_codec, * @param p_user_data client object where will be returned the message */ OPJ_API OPJ_BOOL OPJ_CALLCONV opj_set_warning_handler(opj_codec_t * p_codec, - opj_msg_callback p_callback, - void * p_user_data); + opj_msg_callback p_callback, + void * p_user_data); /** * Set the error handler use by openjpeg. * @param p_codec the codec previously initialise * @param p_callback the callback function which will be used * @param p_user_data client object where will be returned the message */ -OPJ_API OPJ_BOOL OPJ_CALLCONV opj_set_error_handler(opj_codec_t * p_codec, - opj_msg_callback p_callback, - void * p_user_data); +OPJ_API OPJ_BOOL OPJ_CALLCONV opj_set_error_handler(opj_codec_t * p_codec, + opj_msg_callback p_callback, + void * p_user_data); -/* +/* ========================================================== codec functions definitions ========================================================== @@ -1222,45 +1237,47 @@ OPJ_API OPJ_BOOL OPJ_CALLCONV opj_set_error_handler(opj_codec_t * p_codec, /** * Creates a J2K/JP2 decompression structure - * @param format Decoder to select + * @param format Decoder to select * * @return Returns a handle to a decompressor if successful, returns NULL otherwise * */ -OPJ_API opj_codec_t* OPJ_CALLCONV opj_create_decompress(OPJ_CODEC_FORMAT format); +OPJ_API opj_codec_t* OPJ_CALLCONV opj_create_decompress( + OPJ_CODEC_FORMAT format); /** * Destroy a decompressor handle * - * @param p_codec decompressor handle to destroy + * @param p_codec decompressor handle to destroy */ OPJ_API void OPJ_CALLCONV opj_destroy_codec(opj_codec_t * p_codec); /** * Read after the codestream if necessary - * @param p_codec the JPEG2000 codec to read. - * @param p_stream the JPEG2000 stream. + * @param p_codec the JPEG2000 codec to read. + * @param p_stream the JPEG2000 stream. */ -OPJ_API OPJ_BOOL OPJ_CALLCONV opj_end_decompress ( opj_codec_t *p_codec, - opj_stream_t *p_stream); +OPJ_API OPJ_BOOL OPJ_CALLCONV opj_end_decompress(opj_codec_t *p_codec, + opj_stream_t *p_stream); /** * 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 with decompression parameters provided by the user and with the message handler * provided by the user. * - * @param p_codec decompressor handler - * @param parameters decompression parameters + * @param p_codec decompressor handler + * @param parameters decompression parameters * - * @return true if the decoder is correctly set + * @return true if the decoder is correctly set */ OPJ_API OPJ_BOOL OPJ_CALLCONV opj_setup_decoder(opj_codec_t *p_codec, - opj_dparameters_t *parameters ); + opj_dparameters_t *parameters); /** * Allocates worker threads for the compressor/decompressor. @@ -1279,151 +1296,152 @@ OPJ_API OPJ_BOOL OPJ_CALLCONV opj_setup_decoder(opj_codec_t *p_codec, * @return OPJ_TRUE if the decoder is correctly set */ OPJ_API OPJ_BOOL OPJ_CALLCONV opj_codec_set_threads(opj_codec_t *p_codec, - int num_threads); + int num_threads); /** * Decodes an image header. * - * @param p_stream the jpeg2000 stream. - * @param p_codec the jpeg2000 codec to read. - * @param p_image the image structure initialized with the characteristics of encoded image. + * @param p_stream the jpeg2000 stream. + * @param p_codec the jpeg2000 codec to read. + * @param p_image the image structure initialized with the characteristics of encoded image. * - * @return true if the main header of the codestream and the JP2 header is correctly read. + * @return true if the main header of the codestream and the JP2 header is correctly read. */ -OPJ_API OPJ_BOOL OPJ_CALLCONV opj_read_header ( opj_stream_t *p_stream, - opj_codec_t *p_codec, - opj_image_t **p_image); +OPJ_API OPJ_BOOL OPJ_CALLCONV opj_read_header(opj_stream_t *p_stream, + opj_codec_t *p_codec, + opj_image_t **p_image); /** * Sets the given area to be decoded. This function should be called right after opj_read_header and before any tile header reading. * - * @param p_codec the jpeg2000 codec. - * @param p_image the decoded image previously setted by opj_read_header - * @param p_start_x the left position of the rectangle to decode (in image coordinates). - * @param p_end_x the right position of the rectangle to decode (in image coordinates). - * @param p_start_y the up position of the rectangle to decode (in image coordinates). - * @param p_end_y the bottom position of the rectangle to decode (in image coordinates). + * @param p_codec the jpeg2000 codec. + * @param p_image the decoded image previously setted by opj_read_header + * @param p_start_x the left position of the rectangle to decode (in image coordinates). + * @param p_end_x the right position of the rectangle to decode (in image coordinates). + * @param p_start_y the up position of the rectangle to decode (in image coordinates). + * @param p_end_y the bottom position of the rectangle to decode (in image coordinates). * - * @return true if the area could be set. + * @return true if the area could be set. */ -OPJ_API OPJ_BOOL OPJ_CALLCONV opj_set_decode_area( opj_codec_t *p_codec, - 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_API OPJ_BOOL OPJ_CALLCONV opj_set_decode_area(opj_codec_t *p_codec, + 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); /** * Decode an image from a JPEG-2000 codestream * - * @param p_decompressor decompressor handle - * @param p_stream Input buffer stream - * @param p_image the decoded image - * @return true if success, otherwise false + * @param p_decompressor decompressor handle + * @param p_stream Input buffer stream + * @param p_image the decoded image + * @return true if success, otherwise false * */ -OPJ_API OPJ_BOOL OPJ_CALLCONV opj_decode( opj_codec_t *p_decompressor, - opj_stream_t *p_stream, - opj_image_t *p_image); +OPJ_API OPJ_BOOL OPJ_CALLCONV opj_decode(opj_codec_t *p_decompressor, + opj_stream_t *p_stream, + opj_image_t *p_image); /** * Get the decoded tile from the codec * - * @param p_codec the jpeg2000 codec. - * @param p_stream input streamm - * @param p_image output image - * @param tile_index index of the tile which will be decode + * @param p_codec the jpeg2000 codec. + * @param p_stream input streamm + * @param p_image output image + * @param tile_index index of the tile which will be decode * - * @return true if success, otherwise false + * @return true if success, otherwise false */ -OPJ_API OPJ_BOOL OPJ_CALLCONV opj_get_decoded_tile( opj_codec_t *p_codec, - opj_stream_t *p_stream, - opj_image_t *p_image, - OPJ_UINT32 tile_index); +OPJ_API OPJ_BOOL OPJ_CALLCONV opj_get_decoded_tile(opj_codec_t *p_codec, + opj_stream_t *p_stream, + opj_image_t *p_image, + OPJ_UINT32 tile_index); /** * Set the resolution factor of the decoded image - * @param p_codec the jpeg2000 codec. - * @param res_factor resolution factor to set + * @param p_codec the jpeg2000 codec. + * @param res_factor resolution factor to set * - * @return true if success, otherwise false + * @return true if success, otherwise false */ -OPJ_API OPJ_BOOL OPJ_CALLCONV opj_set_decoded_resolution_factor(opj_codec_t *p_codec, OPJ_UINT32 res_factor); +OPJ_API OPJ_BOOL OPJ_CALLCONV opj_set_decoded_resolution_factor( + opj_codec_t *p_codec, OPJ_UINT32 res_factor); /** * Writes a tile with the given data. * - * @param p_codec the jpeg2000 codec. - * @param p_tile_index the index of the tile to write. At the moment, the tiles must be written from 0 to n-1 in sequence. - * @param p_data pointer to the data to write. Data is arranged in sequence, data_comp0, then data_comp1, then ... NO INTERLEAVING should be set. - * @param p_data_size this value os used to make sure the data being written is correct. The size must be equal to the sum for each component of + * @param p_codec the jpeg2000 codec. + * @param p_tile_index the index of the tile to write. At the moment, the tiles must be written from 0 to n-1 in sequence. + * @param p_data pointer to the data to write. Data is arranged in sequence, data_comp0, then data_comp1, then ... NO INTERLEAVING should be set. + * @param p_data_size this value os used to make sure the data being written is correct. The size must be equal to the sum for each component of * tile_width * tile_height * component_size. component_size can be 1,2 or 4 bytes, depending on the precision of the given component. - * @param p_stream the stream to write data to. + * @param p_stream the stream to write data to. * - * @return true if the data could be written. + * @return true if the data could be written. */ -OPJ_API OPJ_BOOL OPJ_CALLCONV opj_write_tile ( opj_codec_t *p_codec, - OPJ_UINT32 p_tile_index, - OPJ_BYTE * p_data, - OPJ_UINT32 p_data_size, - opj_stream_t *p_stream ); +OPJ_API OPJ_BOOL OPJ_CALLCONV opj_write_tile(opj_codec_t *p_codec, + OPJ_UINT32 p_tile_index, + OPJ_BYTE * p_data, + OPJ_UINT32 p_data_size, + opj_stream_t *p_stream); /** * Reads a tile header. This function is compulsory and allows one to know the size of the tile that will be decoded. * The user may need to refer to the image got by opj_read_header to understand the size being taken by the tile. * - * @param p_codec the jpeg2000 codec. - * @param p_tile_index pointer to a value that will hold the index of the tile being decoded, in case of success. - * @param p_data_size pointer to a value that will hold the maximum size of the decoded data, in case of success. In case - * of truncated codestreams, the actual number of bytes decoded may be lower. The computation of the size is the same - * as depicted in opj_write_tile. - * @param p_tile_x0 pointer to a value that will hold the x0 pos of the tile (in the image). - * @param p_tile_y0 pointer to a value that will hold the y0 pos of the tile (in the image). - * @param p_tile_x1 pointer to a value that will hold the x1 pos of the tile (in the image). - * @param p_tile_y1 pointer to a value that will hold the y1 pos of the tile (in the image). - * @param p_nb_comps pointer to a value that will hold the number of components in the tile. - * @param p_should_go_on pointer to a boolean that will hold the fact that the decoding should go on. In case the - * codestream is over at the time of the call, the value will be set to false. The user should then stop - * the decoding. - * @param p_stream the stream to decode. - * @return true if the tile header could be decoded. In case the decoding should end, the returned value is still true. - * returning false may be the result of a shortage of memory or an internal error. + * @param p_codec the jpeg2000 codec. + * @param p_tile_index pointer to a value that will hold the index of the tile being decoded, in case of success. + * @param p_data_size pointer to a value that will hold the maximum size of the decoded data, in case of success. In case + * of truncated codestreams, the actual number of bytes decoded may be lower. The computation of the size is the same + * as depicted in opj_write_tile. + * @param p_tile_x0 pointer to a value that will hold the x0 pos of the tile (in the image). + * @param p_tile_y0 pointer to a value that will hold the y0 pos of the tile (in the image). + * @param p_tile_x1 pointer to a value that will hold the x1 pos of the tile (in the image). + * @param p_tile_y1 pointer to a value that will hold the y1 pos of the tile (in the image). + * @param p_nb_comps pointer to a value that will hold the number of components in the tile. + * @param p_should_go_on pointer to a boolean that will hold the fact that the decoding should go on. In case the + * codestream is over at the time of the call, the value will be set to false. The user should then stop + * the decoding. + * @param p_stream the stream to decode. + * @return true if the tile header could be decoded. In case the decoding should end, the returned value is still true. + * returning false may be the result of a shortage of memory or an internal error. */ -OPJ_API OPJ_BOOL OPJ_CALLCONV opj_read_tile_header( opj_codec_t *p_codec, - opj_stream_t * p_stream, - 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 ); +OPJ_API OPJ_BOOL OPJ_CALLCONV opj_read_tile_header(opj_codec_t *p_codec, + opj_stream_t * p_stream, + 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); /** * Reads a tile data. This function is compulsory and allows one to decode tile data. opj_read_tile_header should be called before. * The user may need to refer to the image got by opj_read_header to understand the size being taken by the tile. * - * @param p_codec the jpeg2000 codec. - * @param p_tile_index the index of the tile being decoded, this should be the value set by opj_read_tile_header. - * @param p_data pointer to a memory block that will hold the decoded data. - * @param p_data_size size of p_data. p_data_size should be bigger or equal to the value set by opj_read_tile_header. - * @param p_stream the stream to decode. + * @param p_codec the jpeg2000 codec. + * @param p_tile_index the index of the tile being decoded, this should be the value set by opj_read_tile_header. + * @param p_data pointer to a memory block that will hold the decoded data. + * @param p_data_size size of p_data. p_data_size should be bigger or equal to the value set by opj_read_tile_header. + * @param p_stream the stream to decode. * - * @return true if the data could be decoded. + * @return true if the data could be decoded. */ -OPJ_API OPJ_BOOL OPJ_CALLCONV opj_decode_tile_data( opj_codec_t *p_codec, - OPJ_UINT32 p_tile_index, - OPJ_BYTE * p_data, - OPJ_UINT32 p_data_size, - opj_stream_t *p_stream ); +OPJ_API OPJ_BOOL OPJ_CALLCONV opj_decode_tile_data(opj_codec_t *p_codec, + OPJ_UINT32 p_tile_index, + OPJ_BYTE * p_data, + OPJ_UINT32 p_data_size, + opj_stream_t *p_stream); /* COMPRESSION FUNCTIONS*/ /** * Creates a J2K/JP2 compression structure - * @param format Coder to select - * @return Returns a handle to a compressor if successful, returns NULL otherwise + * @param format Coder to select + * @return Returns a handle to a compressor if successful, returns NULL otherwise */ OPJ_API opj_codec_t* OPJ_CALLCONV opj_create_compress(OPJ_CODEC_FORMAT format); /** -Set encoding parameters to default values, that means : +Set encoding parameters to default values, that means :
  • Lossless
  • 1 tile @@ -1443,45 +1461,46 @@ Set encoding parameters to default values, that means :
@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 image and using user parameters. - * @param p_codec Compressor handle - * @param parameters Compression parameters - * @param image Input filled image + * @param p_codec Compressor handle + * @param parameters Compression parameters + * @param image Input filled image */ -OPJ_API OPJ_BOOL OPJ_CALLCONV opj_setup_encoder(opj_codec_t *p_codec, - opj_cparameters_t *parameters, - opj_image_t *image); +OPJ_API OPJ_BOOL OPJ_CALLCONV opj_setup_encoder(opj_codec_t *p_codec, + opj_cparameters_t *parameters, + opj_image_t *image); /** * Start to compress the current image. - * @param p_codec Compressor handle - * @param image Input filled image - * @param p_stream Input stgream + * @param p_codec Compressor handle + * @param image Input filled image + * @param p_stream Input stgream */ -OPJ_API OPJ_BOOL OPJ_CALLCONV opj_start_compress ( opj_codec_t *p_codec, - opj_image_t * p_image, - opj_stream_t *p_stream); +OPJ_API OPJ_BOOL OPJ_CALLCONV opj_start_compress(opj_codec_t *p_codec, + opj_image_t * p_image, + opj_stream_t *p_stream); /** * End to compress the current image. - * @param p_codec Compressor handle - * @param p_stream Input stgream + * @param p_codec Compressor handle + * @param p_stream Input stgream */ -OPJ_API OPJ_BOOL OPJ_CALLCONV opj_end_compress (opj_codec_t *p_codec, - opj_stream_t *p_stream); +OPJ_API OPJ_BOOL OPJ_CALLCONV opj_end_compress(opj_codec_t *p_codec, + opj_stream_t *p_stream); /** * Encode an image into a JPEG-2000 codestream - * @param p_codec compressor handle - * @param p_stream Output buffer stream + * @param p_codec compressor handle + * @param p_stream Output buffer stream * - * @return Returns true if successful, returns false otherwise + * @return Returns true if successful, returns false otherwise */ OPJ_API OPJ_BOOL OPJ_CALLCONV opj_encode(opj_codec_t *p_codec, - opj_stream_t *p_stream); + opj_stream_t *p_stream); /* ========================================================== codec output functions definitions @@ -1493,60 +1512,65 @@ OPJ_API OPJ_BOOL OPJ_CALLCONV opj_encode(opj_codec_t *p_codec, Destroy Codestream information after compression or decompression @param cstr_info Codestream information structure */ -OPJ_API void OPJ_CALLCONV opj_destroy_cstr_info(opj_codestream_info_v2_t **cstr_info); +OPJ_API void OPJ_CALLCONV opj_destroy_cstr_info(opj_codestream_info_v2_t + **cstr_info); /** * Dump the codec information into the output stream * - * @param p_codec the jpeg2000 codec. - * @param info_flag type of information dump. - * @param output_stream output stream where dump the informations get from the codec. + * @param p_codec the jpeg2000 codec. + * @param info_flag type of information dump. + * @param output_stream output stream where dump the informations get from the codec. * */ -OPJ_API void OPJ_CALLCONV opj_dump_codec( opj_codec_t *p_codec, - OPJ_INT32 info_flag, - FILE* output_stream); +OPJ_API void OPJ_CALLCONV opj_dump_codec(opj_codec_t *p_codec, + OPJ_INT32 info_flag, + FILE* output_stream); /** * Get the codestream information from the codec * - * @param p_codec the jpeg2000 codec. + * @param p_codec the jpeg2000 codec. * - * @return a pointer to a codestream information structure. + * @return a pointer to a codestream information structure. * */ -OPJ_API opj_codestream_info_v2_t* OPJ_CALLCONV opj_get_cstr_info(opj_codec_t *p_codec); +OPJ_API opj_codestream_info_v2_t* OPJ_CALLCONV opj_get_cstr_info( + opj_codec_t *p_codec); /** * Get the codestream index from the codec * - * @param p_codec the jpeg2000 codec. + * @param p_codec the jpeg2000 codec. * - * @return a pointer to a codestream index structure. + * @return a pointer to a codestream index structure. * */ -OPJ_API opj_codestream_index_t * OPJ_CALLCONV opj_get_cstr_index(opj_codec_t *p_codec); +OPJ_API opj_codestream_index_t * OPJ_CALLCONV opj_get_cstr_index( + opj_codec_t *p_codec); -OPJ_API void OPJ_CALLCONV opj_destroy_cstr_index(opj_codestream_index_t **p_cstr_index); +OPJ_API void OPJ_CALLCONV opj_destroy_cstr_index(opj_codestream_index_t + **p_cstr_index); /** * Get the JP2 file information from the codec FIXME * - * @param p_codec the jpeg2000 codec. + * @param p_codec the jpeg2000 codec. * - * @return a pointer to a JP2 metadata structure. + * @return a pointer to a JP2 metadata structure. * */ -OPJ_API opj_jp2_metadata_t* OPJ_CALLCONV opj_get_jp2_metadata(opj_codec_t *p_codec); +OPJ_API opj_jp2_metadata_t* OPJ_CALLCONV opj_get_jp2_metadata( + opj_codec_t *p_codec); /** * Get the JP2 file index from the codec FIXME * - * @param p_codec the jpeg2000 codec. + * @param p_codec the jpeg2000 codec. * - * @return a pointer to a JP2 index structure. + * @return a pointer to a JP2 index structure. * */ OPJ_API opj_jp2_index_t* OPJ_CALLCONV opj_get_jp2_index(opj_codec_t *p_codec); @@ -1561,17 +1585,17 @@ OPJ_API opj_jp2_index_t* OPJ_CALLCONV opj_get_jp2_index(opj_codec_t *p_codec); /** * Sets the MCT matrix to use. * - * @param parameters the parameters to change. - * @param pEncodingMatrix the encoding matrix. - * @param p_dc_shift the dc shift coefficients to use. - * @param pNbComp the number of components of the image. + * @param parameters the parameters to change. + * @param pEncodingMatrix the encoding matrix. + * @param p_dc_shift the dc shift coefficients to use. + * @param pNbComp the number of components of the image. * - * @return true if the parameters could be set. + * @return true if the parameters could be set. */ -OPJ_API OPJ_BOOL OPJ_CALLCONV opj_set_MCT( opj_cparameters_t *parameters, - OPJ_FLOAT32 * pEncodingMatrix, - OPJ_INT32 * p_dc_shift, - OPJ_UINT32 pNbComp); +OPJ_API OPJ_BOOL OPJ_CALLCONV opj_set_MCT(opj_cparameters_t *parameters, + OPJ_FLOAT32 * pEncodingMatrix, + OPJ_INT32 * p_dc_shift, + OPJ_UINT32 pNbComp); /* ========================================================== diff --git a/src/lib/openjp2/opj_clock.h b/src/lib/openjp2/opj_clock.h index 6f5168b5..a50eef24 100644 --- a/src/lib/openjp2/opj_clock.h +++ b/src/lib/openjp2/opj_clock.h @@ -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. * diff --git a/src/lib/openjp2/opj_codec.h b/src/lib/openjp2/opj_codec.h index c88005d7..00ce9ab9 100644 --- a/src/lib/openjp2/opj_codec.h +++ b/src/lib/openjp2/opj_codec.h @@ -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; diff --git a/src/lib/openjp2/opj_includes.h b/src/lib/openjp2/opj_includes.h index e3de42da..98ade3fd 100644 --- a/src/lib/openjp2/opj_includes.h +++ b/src/lib/openjp2/opj_includes.h @@ -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 -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 -# pragma intrinsic(__emul) +# include +# pragma intrinsic(__emul) #endif /* Type to use for bit-fields in internal headers */ diff --git a/src/lib/openjp2/opj_intmath.h b/src/lib/openjp2/opj_intmath.h index 3f7934c4..03a446f1 100644 --- a/src/lib/openjp2/opj_intmath.h +++ b/src/lib/openjp2/opj_intmath.h @@ -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
  • Returns a if (min < a < max)
  • Returns max if (a > max) -
  • Returns min if (a < min) +
  • Returns min if (a < min)
*/ -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)) ; } /* ----------------------------------------------------------------------- */ diff --git a/src/lib/openjp2/opj_inttypes.h b/src/lib/openjp2/opj_inttypes.h index e74aed6a..2c9749a1 100644 --- a/src/lib/openjp2/opj_inttypes.h +++ b/src/lib/openjp2/opj_inttypes.h @@ -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. * diff --git a/src/lib/openjp2/opj_malloc.h b/src/lib/openjp2/opj_malloc.h index 1b3fced9..c8c2fc2d 100644 --- a/src/lib/openjp2/opj_malloc.h +++ b/src/lib/openjp2/opj_malloc.h @@ -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. * diff --git a/src/lib/openjp2/opj_stdint.h b/src/lib/openjp2/opj_stdint.h index b8556a19..f26c921c 100644 --- a/src/lib/openjp2/opj_stdint.h +++ b/src/lib/openjp2/opj_stdint.h @@ -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. * diff --git a/src/lib/openjp2/pi.h b/src/lib/openjp2/pi.h index 265d5b1e..a16995bd 100644 --- a/src/lib/openjp2/pi.h +++ b/src/lib/openjp2/pi.h @@ -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); diff --git a/src/lib/openjp2/raw.h b/src/lib/openjp2/raw.h index 572c6661..9a32c83d 100644 --- a/src/lib/openjp2/raw.h +++ b/src/lib/openjp2/raw.h @@ -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); diff --git a/src/lib/openjp2/t1.h b/src/lib/openjp2/t1.h index c3fb7bed..31a2d9f3 100644 --- a/src/lib/openjp2/t1.h +++ b/src/lib/openjp2/t1.h @@ -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); diff --git a/src/lib/openjp2/t1_luts.h b/src/lib/openjp2/t1_luts.h index 561133fb..8402b7a8 100644 --- a/src/lib/openjp2/t1_luts.h +++ b/src/lib/openjp2/t1_luts.h @@ -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 }; diff --git a/src/lib/openjp2/t2.h b/src/lib/openjp2/t2.h index 3b652eea..b80891b7 100644 --- a/src/lib/openjp2/t2.h +++ b/src/lib/openjp2/t2.h @@ -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); diff --git a/src/lib/openjp2/tcd.h b/src/lib/openjp2/tcd.h index 76eff005..913979a8 100644 --- a/src/lib/openjp2/tcd.h +++ b/src/lib/openjp2/tcd.h @@ -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 diff --git a/src/lib/openjp2/tgt.h b/src/lib/openjp2/tgt.h index 10223805..0ed0e658 100644 --- a/src/lib/openjp2/tgt.h +++ b/src/lib/openjp2/tgt.h @@ -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 - * 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); /* ----------------------------------------------------------------------- */ /*@}*/ diff --git a/src/lib/openjp2/thread.h b/src/lib/openjp2/thread.h index 241e6d88..c89e19b4 100644 --- a/src/lib/openjp2/thread.h +++ b/src/lib/openjp2/thread.h @@ -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. * diff --git a/src/lib/openjp2/tls_keys.h b/src/lib/openjp2/tls_keys.h index fb26498d..ba0373a7 100644 --- a/src/lib/openjp2/tls_keys.h +++ b/src/lib/openjp2/tls_keys.h @@ -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. * diff --git a/src/lib/openjp3d/bio.h b/src/lib/openjp3d/bio.h index a44a0c64..1c26eb3c 100644 --- a/src/lib/openjp3d/bio.h +++ b/src/lib/openjp3d/bio.h @@ -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); diff --git a/src/lib/openjp3d/cio.h b/src/lib/openjp3d/cio.h index 3cfa6fcb..ff7ae683 100644 --- a/src/lib/openjp3d/cio.h +++ b/src/lib/openjp3d/cio.h @@ -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. * diff --git a/src/lib/openjp3d/dwt.h b/src/lib/openjp3d/dwt.h index 00082900..634df95a 100644 --- a/src/lib/openjp3d/dwt.h +++ b/src/lib/openjp3d/dwt.h @@ -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 */ /*@{*/ diff --git a/src/lib/openjp3d/event.h b/src/lib/openjp3d/event.h index e5a09c43..67d3c6a5 100644 --- a/src/lib/openjp3d/event.h +++ b/src/lib/openjp3d/event.h @@ -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) diff --git a/src/lib/openjp3d/fix.h b/src/lib/openjp3d/fix.h index ea05403c..416fd0fd 100644 --- a/src/lib/openjp3d/fix.h +++ b/src/lib/openjp3d/fix.h @@ -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)) ; } /*@}*/ diff --git a/src/lib/openjp3d/int.h b/src/lib/openjp3d/int.h index 0e154ca4..fb0480b6 100644 --- a/src/lib/openjp3d/int.h +++ b/src/lib/openjp3d/int.h @@ -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
  • Returns a if (min < a < max)
  • Returns max if (a > max) -
  • Returns min if (a < min) +
  • Returns min if (a < min)
*/ -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; } /* ----------------------------------------------------------------------- */ /*@}*/ diff --git a/src/lib/openjp3d/jp3d.h b/src/lib/openjp3d/jp3d.h index 7032d3fb..6bd5c86f 100644 --- a/src/lib/openjp3d/jp3d.h +++ b/src/lib/openjp3d/jp3d.h @@ -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); /* ----------------------------------------------------------------------- */ /*@}*/ diff --git a/src/lib/openjp3d/jp3d_lib.h b/src/lib/openjp3d/jp3d_lib.h index 48c5464b..3ca1cca6 100644 --- a/src/lib/openjp3d/jp3d_lib.h +++ b/src/lib/openjp3d/jp3d_lib.h @@ -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); /* ----------------------------------------------------------------------- */ /*@}*/ diff --git a/src/lib/openjp3d/mct.h b/src/lib/openjp3d/mct.h index 5c1b3dec..24463d4a 100644 --- a/src/lib/openjp3d/mct.h +++ b/src/lib/openjp3d/mct.h @@ -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); /* ----------------------------------------------------------------------- */ diff --git a/src/lib/openjp3d/mqc.h b/src/lib/openjp3d/mqc.h index dcb0012c..cff92f61 100644 --- a/src/lib/openjp3d/mqc.h +++ b/src/lib/openjp3d/mqc.h @@ -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.

Not fully implemented and tested !!

@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.

Not fully implemented and tested !!

@param mqc MQC handle @param d The symbol to be encoded (0 or 1) diff --git a/src/lib/openjp3d/openjp3d.h b/src/lib/openjp3d/openjp3d.h index a720bd37..0dd8aed8 100644 --- a/src/lib/openjp3d/openjp3d.h +++ b/src/lib/openjp3d/openjp3d.h @@ -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
  • Error messages
  • Warning messages @@ -222,16 +222,16 @@ used for
*/ 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 :
  • Lossless
  • 1 tile @@ -701,14 +708,16 @@ Set encoding parameters to default values, that means :
@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 } diff --git a/src/lib/openjp3d/opj_includes.h b/src/lib/openjp3d/opj_includes.h index 20290588..f917e2fa 100644 --- a/src/lib/openjp3d/opj_includes.h +++ b/src/lib/openjp3d/opj_includes.h @@ -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. * diff --git a/src/lib/openjp3d/pi.h b/src/lib/openjp3d/pi.h index c81f9ef0..59a73d55 100644 --- a/src/lib/openjp3d/pi.h +++ b/src/lib/openjp3d/pi.h @@ -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); /* ----------------------------------------------------------------------- */ diff --git a/src/lib/openjp3d/raw.h b/src/lib/openjp3d/raw.h index bd2aa4e8..a9d7080a 100644 --- a/src/lib/openjp3d/raw.h +++ b/src/lib/openjp3d/raw.h @@ -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); diff --git a/src/lib/openjp3d/t1.h b/src/lib/openjp3d/t1.h index 8d52f0cc..f2c61e0a 100644 --- a/src/lib/openjp3d/t1.h +++ b/src/lib/openjp3d/t1.h @@ -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]); /* ----------------------------------------------------------------------- */ /*@}*/ diff --git a/src/lib/openjp3d/t1_3d.h b/src/lib/openjp3d/t1_3d.h index 2974781f..c7cf8876 100644 --- a/src/lib/openjp3d/t1_3d.h +++ b/src/lib/openjp3d/t1_3d.h @@ -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 diff --git a/src/lib/openjp3d/t2.h b/src/lib/openjp3d/t2.h index 2f24ac44..b11bc6a5 100644 --- a/src/lib/openjp3d/t2.h +++ b/src/lib/openjp3d/t2.h @@ -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 diff --git a/src/lib/openjp3d/tcd.h b/src/lib/openjp3d/tcd.h index 66f1e167..4c57494a 100644 --- a/src/lib/openjp3d/tcd.h +++ b/src/lib/openjp3d/tcd.h @@ -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 diff --git a/src/lib/openjp3d/tgt.h b/src/lib/openjp3d/tgt.h index f73c0f84..ae937191 100644 --- a/src/lib/openjp3d/tgt.h +++ b/src/lib/openjp3d/tgt.h @@ -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 */ diff --git a/src/lib/openjp3d/volume.h b/src/lib/openjp3d/volume.h index a8a0c850..8cc6102a 100644 --- a/src/lib/openjp3d/volume.h +++ b/src/lib/openjp3d/volume.h @@ -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. * diff --git a/src/lib/openjpip/auxtrans_manager.h b/src/lib/openjpip/auxtrans_manager.h index e3e61451..ac553e12 100644 --- a/src/lib/openjpip/auxtrans_manager.h +++ b/src/lib/openjpip/auxtrans_manager.h @@ -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_ */ diff --git a/src/lib/openjpip/box_manager.h b/src/lib/openjpip/box_manager.h index d45d84e6..250ef640 100644 --- a/src/lib/openjpip/box_manager.h +++ b/src/lib/openjpip/box_manager.h @@ -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_ */ diff --git a/src/lib/openjpip/boxheader_manager.h b/src/lib/openjpip/boxheader_manager.h index 81e8288b..b43b447c 100644 --- a/src/lib/openjpip/boxheader_manager.h +++ b/src/lib/openjpip/boxheader_manager.h @@ -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_ */ diff --git a/src/lib/openjpip/byte_manager.h b/src/lib/openjpip/byte_manager.h index 16091ece..57a7d501 100644 --- a/src/lib/openjpip/byte_manager.h +++ b/src/lib/openjpip/byte_manager.h @@ -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 #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_ */ diff --git a/src/lib/openjpip/cache_manager.h b/src/lib/openjpip/cache_manager.h index 466fd7ea..64358326 100644 --- a/src/lib/openjpip/cache_manager.h +++ b/src/lib/openjpip/cache_manager.h @@ -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_ */ diff --git a/src/lib/openjpip/cachemodel_manager.h b/src/lib/openjpip/cachemodel_manager.h index 041f1ad9..4cf47856 100644 --- a/src/lib/openjpip/cachemodel_manager.h +++ b/src/lib/openjpip/cachemodel_manager.h @@ -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_ */ diff --git a/src/lib/openjpip/channel_manager.h b/src/lib/openjpip/channel_manager.h index 52bfa5e5..6f981ad6 100644 --- a/src/lib/openjpip/channel_manager.h +++ b/src/lib/openjpip/channel_manager.h @@ -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 #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_ */ diff --git a/src/lib/openjpip/codestream_manager.h b/src/lib/openjpip/codestream_manager.h index 71f73b23..632294ae 100644 --- a/src/lib/openjpip/codestream_manager.h +++ b/src/lib/openjpip/codestream_manager.h @@ -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_ */ diff --git a/src/lib/openjpip/dec_clientmsg_handler.h b/src/lib/openjpip/dec_clientmsg_handler.h index 48950db8..d04ea41f 100644 --- a/src/lib/openjpip/dec_clientmsg_handler.h +++ b/src/lib/openjpip/dec_clientmsg_handler.h @@ -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_ */ diff --git a/src/lib/openjpip/faixbox_manager.h b/src/lib/openjpip/faixbox_manager.h index ec893c37..9b0ea76c 100644 --- a/src/lib/openjpip/faixbox_manager.h +++ b/src/lib/openjpip/faixbox_manager.h @@ -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<= 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 * diff --git a/src/lib/openjpip/index_manager.h b/src/lib/openjpip/index_manager.h index 8831d7f5..f0b06186 100644 --- a/src/lib/openjpip/index_manager.h +++ b/src/lib/openjpip/index_manager.h @@ -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_ */ diff --git a/src/lib/openjpip/j2kheader_manager.h b/src/lib/openjpip/j2kheader_manager.h index 33722b49..d95f1250 100644 --- a/src/lib/openjpip/j2kheader_manager.h +++ b/src/lib/openjpip/j2kheader_manager.h @@ -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_ */ diff --git a/src/lib/openjpip/jp2k_decoder.h b/src/lib/openjpip/jp2k_decoder.h index 79ca7d91..a88d844a 100644 --- a/src/lib/openjpip/jp2k_decoder.h +++ b/src/lib/openjpip/jp2k_decoder.h @@ -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_ */ diff --git a/src/lib/openjpip/jp2k_encoder.h b/src/lib/openjpip/jp2k_encoder.h index 30e1035f..8ace4341 100644 --- a/src/lib/openjpip/jp2k_encoder.h +++ b/src/lib/openjpip/jp2k_encoder.h @@ -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_ */ diff --git a/src/lib/openjpip/jpip_parser.h b/src/lib/openjpip/jpip_parser.h index ff2bf286..093f0592 100644 --- a/src/lib/openjpip/jpip_parser.h +++ b/src/lib/openjpip/jpip_parser.h @@ -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_ */ diff --git a/src/lib/openjpip/jpipstream_manager.h b/src/lib/openjpip/jpipstream_manager.h index 3b829a57..225694d8 100644 --- a/src/lib/openjpip/jpipstream_manager.h +++ b/src/lib/openjpip/jpipstream_manager.h @@ -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); diff --git a/src/lib/openjpip/manfbox_manager.h b/src/lib/openjpip/manfbox_manager.h index 1b1bf915..f75bed2d 100644 --- a/src/lib/openjpip/manfbox_manager.h +++ b/src/lib/openjpip/manfbox_manager.h @@ -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_ */ diff --git a/src/lib/openjpip/marker_manager.h b/src/lib/openjpip/marker_manager.h index a28c44b7..e532af54 100644 --- a/src/lib/openjpip/marker_manager.h +++ b/src/lib/openjpip/marker_manager.h @@ -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_ */ diff --git a/src/lib/openjpip/metadata_manager.h b/src/lib/openjpip/metadata_manager.h index bd09ff39..6cf00306 100644 --- a/src/lib/openjpip/metadata_manager.h +++ b/src/lib/openjpip/metadata_manager.h @@ -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_ */ diff --git a/src/lib/openjpip/mhixbox_manager.h b/src/lib/openjpip/mhixbox_manager.h index 48b34d09..8b39e58d 100644 --- a/src/lib/openjpip/mhixbox_manager.h +++ b/src/lib/openjpip/mhixbox_manager.h @@ -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_ */ diff --git a/src/lib/openjpip/msgqueue_manager.h b/src/lib/openjpip/msgqueue_manager.h index 54cb4f95..ad97828d 100644 --- a/src/lib/openjpip/msgqueue_manager.h +++ b/src/lib/openjpip/msgqueue_manager.h @@ -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_ */ diff --git a/src/lib/openjpip/openjpip.h b/src/lib/openjpip/openjpip.h index 2bda1ac2..11a1f272 100644 --- a/src/lib/openjpip/openjpip.h +++ b/src/lib/openjpip/openjpip.h @@ -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*/ diff --git a/src/lib/openjpip/placeholder_manager.h b/src/lib/openjpip/placeholder_manager.h index c08edd40..301a8410 100644 --- a/src/lib/openjpip/placeholder_manager.h +++ b/src/lib/openjpip/placeholder_manager.h @@ -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_ */ diff --git a/src/lib/openjpip/query_parser.h b/src/lib/openjpip/query_parser.h index 5d6ce443..46d57484 100644 --- a/src/lib/openjpip/query_parser.h +++ b/src/lib/openjpip/query_parser.h @@ -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_ */ diff --git a/src/lib/openjpip/session_manager.h b/src/lib/openjpip/session_manager.h index 7952fc0d..1343b1e7 100644 --- a/src/lib/openjpip/session_manager.h +++ b/src/lib/openjpip/session_manager.h @@ -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_ */ diff --git a/src/lib/openjpip/sock_manager.h b/src/lib/openjpip/sock_manager.h index 0c89b55a..01d97574 100644 --- a/src/lib/openjpip/sock_manager.h +++ b/src/lib/openjpip/sock_manager.h @@ -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_ */ diff --git a/src/lib/openjpip/target_manager.h b/src/lib/openjpip/target_manager.h index 561510f5..c8a13de8 100644 --- a/src/lib/openjpip/target_manager.h +++ b/src/lib/openjpip/target_manager.h @@ -28,8 +28,8 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#ifndef TARGET_MANAGER_H_ -# define TARGET_MANAGER_H_ +#ifndef TARGET_MANAGER_H_ +# define TARGET_MANAGER_H_ #include "index_manager.h" @@ -37,26 +37,28 @@ #define MAX_LENOFTID 30 /** target parameters*/ -typedef struct target_param{ - char tid[MAX_LENOFTID]; /**< target identifier*/ - char *targetname; /**< local file path or URL ( URL is suported only with SERVER mode)*/ - int fd; /**< file descriptor*/ +typedef struct target_param { + char tid[MAX_LENOFTID]; /**< target identifier*/ + char *targetname; /**< local file path or URL ( URL is suported only with SERVER mode)*/ + int fd; /**< file descriptor*/ #ifdef SERVER - char *tmpfname; /**< temporal file name to download a remote target file*/ + char *tmpfname; /**< temporal file name to download a remote target file*/ #endif - int csn; /**< codestream number */ - index_param_t *codeidx; /**< index information of codestream */ - int num_of_use; /**< numbers of sessions referring to this target */ - OPJ_BOOL jppstream; /**< if this target can return JPP-stream */ - OPJ_BOOL jptstream; /**< if this target can return JPP-stream */ - struct target_param *next; /**< pointer to the next target */ + int csn; /**< codestream number */ + index_param_t + *codeidx; /**< index information of codestream */ + int num_of_use; /**< numbers of sessions referring to this target */ + OPJ_BOOL jppstream; /**< if this target can return JPP-stream */ + OPJ_BOOL jptstream; /**< if this target can return JPP-stream */ + struct target_param + *next; /**< pointer to the next target */ } target_param_t; /** Target list parameters*/ -typedef struct targetlist_param{ - target_param_t *first; /**< first target pointer of the list*/ - target_param_t *last; /**< last target pointer of the list*/ +typedef struct targetlist_param { + target_param_t *first; /**< first target pointer of the list*/ + target_param_t *last; /**< last target pointer of the list*/ } targetlist_param_t; @@ -76,7 +78,7 @@ targetlist_param_t * gene_targetlist(void); * @param[in] targetpath file path or URL of the target * @return pointer to the generated target */ -target_param_t * gene_target( targetlist_param_t *targetlist, char *targetpath); +target_param_t * gene_target(targetlist_param_t *targetlist, char *targetpath); /** @@ -85,7 +87,7 @@ target_param_t * gene_target( targetlist_param_t *targetlist, char *targetpath); * @param[in] reftarget reference target pointer * @param[out] ptr address of feeding target pointer */ -void refer_target( target_param_t *reftarget, target_param_t **ptr); +void refer_target(target_param_t *reftarget, target_param_t **ptr); /** @@ -93,14 +95,14 @@ void refer_target( target_param_t *reftarget, target_param_t **ptr); * * @param[in] target reference pointer to the target */ -void unrefer_target( target_param_t *target); +void unrefer_target(target_param_t *target); /** * delete a target * * @param[in,out] target address of the deleting target pointer */ -void delete_target( target_param_t **target); +void delete_target(target_param_t **target); /** @@ -109,7 +111,8 @@ void delete_target( target_param_t **target); * @param[in,out] target address of the deleting target pointer * @param[in] targetlist target list pointer */ -void delete_target_in_list( target_param_t **target, targetlist_param_t *targetlist); +void delete_target_in_list(target_param_t **target, + targetlist_param_t *targetlist); /** @@ -125,14 +128,14 @@ void delete_targetlist(targetlist_param_t **targetlist); * * @param[in] target target pointer */ -void print_target( target_param_t *target); +void print_target(target_param_t *target); /** * print all target parameters * * @param[in] targetlist target list pointer */ -void print_alltarget( targetlist_param_t *targetlist); +void print_alltarget(targetlist_param_t *targetlist); /** @@ -142,7 +145,8 @@ void print_alltarget( targetlist_param_t *targetlist); * @param[in] targetlist target list pointer * @return found target pointer */ -target_param_t * search_target( const char targetname[], targetlist_param_t *targetlist); +target_param_t * search_target(const char targetname[], + targetlist_param_t *targetlist); /** @@ -152,7 +156,8 @@ target_param_t * search_target( const char targetname[], targetlist_param_t *tar * @param[in] targetlist target list pointer * @return found target pointer */ -target_param_t * search_targetBytid( const char tid[], targetlist_param_t *targetlist); +target_param_t * search_targetBytid(const char tid[], + targetlist_param_t *targetlist); -#endif /* !TARGET_MANAGER_H_ */ +#endif /* !TARGET_MANAGER_H_ */ diff --git a/src/lib/openjpwl/crc.h b/src/lib/openjpwl/crc.h index e4695f75..ea399822 100644 --- a/src/lib/openjpwl/crc.h +++ b/src/lib/openjpwl/crc.h @@ -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,7 +57,7 @@ * CRC-checksum. * * implemented by Michael Neumann, 14.06.1998 - * + * */ void updateCRC16(unsigned short *, unsigned char); diff --git a/src/lib/openjpwl/jpwl.h b/src/lib/openjpwl/jpwl.h index ca0ee0a1..ed8a57e6 100644 --- a/src/lib/openjpwl/jpwl.h +++ b/src/lib/openjpwl/jpwl.h @@ -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. * @@ -60,155 +60,155 @@ Assume a basic codestream structure, so you can resort better from uncorrected e EPB (Error Protection Block) Marker segment */ typedef struct jpwl_epb_ms { - /**@name Private fields set by epb_create */ - /*@{*/ - /** is the latest in header? */ - opj_bool latest; - /** is it in packed mode? */ - opj_bool packed; - /** TH where this marker has been placed (-1 means MH) */ - int tileno; - /** index in current header (0-63) */ - unsigned char index; - /** error protection method [-1=absent 0=none 1=predefined 16=CRC-16 32=CRC-32 37-128=RS] */ - int hprot; - /** message word length of pre-data */ - int k_pre; - /** code word length of pre-data */ - int n_pre; - /** length of pre-data */ - int pre_len; - /** message word length of post-data */ - int k_post; - /** code word length of post-data */ - int n_post; - /** length of post-data */ - int post_len; - /*@}*/ - /**@name Marker segment fields */ - /*@{*/ - /** two bytes for the length of EPB MS, exluding the marker itself (11 to 65535 bytes) */ - unsigned short int Lepb; - /** single byte for the style */ - unsigned char Depb; - /** four bytes, from 0 to 2^31-1 */ - unsigned long int LDPepb; - /** four bytes, next error management method */ - unsigned long int Pepb; - /** EPB data, variable size */ - unsigned char *data; - /*@}*/ -} jpwl_epb_ms_t; + /**@name Private fields set by epb_create */ + /*@{*/ + /** is the latest in header? */ + opj_bool latest; + /** is it in packed mode? */ + opj_bool packed; + /** TH where this marker has been placed (-1 means MH) */ + int tileno; + /** index in current header (0-63) */ + unsigned char index; + /** error protection method [-1=absent 0=none 1=predefined 16=CRC-16 32=CRC-32 37-128=RS] */ + int hprot; + /** message word length of pre-data */ + int k_pre; + /** code word length of pre-data */ + int n_pre; + /** length of pre-data */ + int pre_len; + /** message word length of post-data */ + int k_post; + /** code word length of post-data */ + int n_post; + /** length of post-data */ + int post_len; + /*@}*/ + /**@name Marker segment fields */ + /*@{*/ + /** two bytes for the length of EPB MS, exluding the marker itself (11 to 65535 bytes) */ + unsigned short int Lepb; + /** single byte for the style */ + unsigned char Depb; + /** four bytes, from 0 to 2^31-1 */ + unsigned long int LDPepb; + /** four bytes, next error management method */ + unsigned long int Pepb; + /** EPB data, variable size */ + unsigned char *data; + /*@}*/ +} jpwl_epb_ms_t; /** EPC (Error Protection Capability) Marker segment */ typedef struct jpwl_epc_ms { - /** is ESD active? */ - opj_bool esd_on; - /** is RED active? */ - opj_bool red_on; - /** is EPB active? */ - opj_bool epb_on; - /** are informative techniques active? */ - opj_bool info_on; - /**@name Marker segment fields */ - /*@{*/ - /** two bytes for the length of EPC MS, exluding the marker itself (9 to 65535 bytes) */ - unsigned short int Lepc; - /** two bytes, CRC for the EPC, excluding Pcrc itself */ - unsigned short int Pcrc; - /** four bytes, the codestream length from SOC to EOC */ - unsigned long int DL; - /** one byte, signals JPWL techniques adoption */ - unsigned char Pepc; - /** EPC data, variable length */ - unsigned char *data; - /*@}*/ -} jpwl_epc_ms_t; + /** is ESD active? */ + opj_bool esd_on; + /** is RED active? */ + opj_bool red_on; + /** is EPB active? */ + opj_bool epb_on; + /** are informative techniques active? */ + opj_bool info_on; + /**@name Marker segment fields */ + /*@{*/ + /** two bytes for the length of EPC MS, exluding the marker itself (9 to 65535 bytes) */ + unsigned short int Lepc; + /** two bytes, CRC for the EPC, excluding Pcrc itself */ + unsigned short int Pcrc; + /** four bytes, the codestream length from SOC to EOC */ + unsigned long int DL; + /** one byte, signals JPWL techniques adoption */ + unsigned char Pepc; + /** EPC data, variable length */ + unsigned char *data; + /*@}*/ +} jpwl_epc_ms_t; /** ESD (Error Sensitivity Descriptor) Marker segment */ typedef struct jpwl_esd_ms { - /** codestream addressing mode [0=packet, 1=byte range, 2=packet range, 3=reserved] */ - unsigned char addrm; - /** size of codestream addresses [2/4 bytes] */ - unsigned char ad_size; - /** type of sensitivity - [0=relative error, 1=MSE, 2=MSE reduction, 3=PSNR, 4=PSNR increment, - 5=MAXERR (absolute peak error), 6=TSE (total squared error), 7=reserved */ - unsigned char senst; - /** size of sensitivity data (1/2 bytes) */ - unsigned char se_size; - /**@name Marker segment fields */ - /*@{*/ - /** two bytes for the length of ESD MS, exluding the marker itself (4 to 65535 bytes) */ - unsigned short int Lesd; - /** two bytes, component of error sensitivity */ - unsigned short int Cesd; - /** one byte, signals JPWL techniques adoption */ - unsigned char Pesd; - /** ESD data, variable length */ - unsigned char *data; - /*@}*/ - /**@name Fields set by esd_create (only internal use) */ - /*@{*/ - /** number of components in the image */ - int numcomps; - /** tile where this marker has been placed (-1 means MH) */ - int tileno; - /** number of sensitivity values */ - unsigned long int svalnum; - /** size of a single sensitivity pair (address+value) */ - size_t sensval_size; - /*@}*/ -} jpwl_esd_ms_t; + /** codestream addressing mode [0=packet, 1=byte range, 2=packet range, 3=reserved] */ + unsigned char addrm; + /** size of codestream addresses [2/4 bytes] */ + unsigned char ad_size; + /** type of sensitivity + [0=relative error, 1=MSE, 2=MSE reduction, 3=PSNR, 4=PSNR increment, + 5=MAXERR (absolute peak error), 6=TSE (total squared error), 7=reserved */ + unsigned char senst; + /** size of sensitivity data (1/2 bytes) */ + unsigned char se_size; + /**@name Marker segment fields */ + /*@{*/ + /** two bytes for the length of ESD MS, exluding the marker itself (4 to 65535 bytes) */ + unsigned short int Lesd; + /** two bytes, component of error sensitivity */ + unsigned short int Cesd; + /** one byte, signals JPWL techniques adoption */ + unsigned char Pesd; + /** ESD data, variable length */ + unsigned char *data; + /*@}*/ + /**@name Fields set by esd_create (only internal use) */ + /*@{*/ + /** number of components in the image */ + int numcomps; + /** tile where this marker has been placed (-1 means MH) */ + int tileno; + /** number of sensitivity values */ + unsigned long int svalnum; + /** size of a single sensitivity pair (address+value) */ + size_t sensval_size; + /*@}*/ +} jpwl_esd_ms_t; /** RED (Residual Error Descriptor) Marker segment */ typedef struct jpwl_red_ms { - /** two bytes for the length of RED MS, exluding the marker itself (3 to 65535 bytes) */ - unsigned short int Lred; - /** one byte, signals JPWL techniques adoption */ - unsigned char Pred; - /** RED data, variable length */ - unsigned char *data; -} jpwl_red_ms_t; + /** two bytes for the length of RED MS, exluding the marker itself (3 to 65535 bytes) */ + unsigned short int Lred; + /** one byte, signals JPWL techniques adoption */ + unsigned char Pred; + /** RED data, variable length */ + unsigned char *data; +} jpwl_red_ms_t; /** Structure used to store JPWL markers temporary position and readyness */ typedef struct jpwl_marker { - /** marker value (J2K_MS_EPC, etc.) */ - int id; - /** union keeping the pointer to the real marker struct */ - union jpwl_marks { - /** pointer to EPB marker */ - jpwl_epb_ms_t *epbmark; - /** pointer to EPC marker */ - jpwl_epc_ms_t *epcmark; - /** pointer to ESD marker */ - jpwl_esd_ms_t *esdmark; - /** pointer to RED marker */ - jpwl_red_ms_t *redmark; - } m; - /** position where the marker should go, in the pre-JPWL codestream */ - unsigned long int pos; - /** same as before, only written as a double, so we can sort it better */ - double dpos; - /** length of the marker segment (marker excluded) */ - unsigned short int len; - /** the marker length is ready or not? */ - opj_bool len_ready; - /** the marker position is ready or not? */ - opj_bool pos_ready; - /** the marker parameters are ready or not? */ - opj_bool parms_ready; - /** are the written data ready or not */ - opj_bool data_ready; -} jpwl_marker_t; + /** marker value (J2K_MS_EPC, etc.) */ + int id; + /** union keeping the pointer to the real marker struct */ + union jpwl_marks { + /** pointer to EPB marker */ + jpwl_epb_ms_t *epbmark; + /** pointer to EPC marker */ + jpwl_epc_ms_t *epcmark; + /** pointer to ESD marker */ + jpwl_esd_ms_t *esdmark; + /** pointer to RED marker */ + jpwl_red_ms_t *redmark; + } m; + /** position where the marker should go, in the pre-JPWL codestream */ + unsigned long int pos; + /** same as before, only written as a double, so we can sort it better */ + double dpos; + /** length of the marker segment (marker excluded) */ + unsigned short int len; + /** the marker length is ready or not? */ + opj_bool len_ready; + /** the marker position is ready or not? */ + opj_bool pos_ready; + /** the marker parameters are ready or not? */ + opj_bool parms_ready; + /** are the written data ready or not */ + opj_bool data_ready; +} jpwl_marker_t; /** Encode according to JPWL specs @@ -287,8 +287,9 @@ void j2k_read_red(opj_j2k_t *j2k); @param post_len length of post-protected data @return returns the freshly created EPB */ -jpwl_epb_ms_t *jpwl_epb_create(opj_j2k_t *j2k, opj_bool latest, opj_bool packed, int tileno, int idx, int hprot, - unsigned long int pre_len, unsigned long int post_len); +jpwl_epb_ms_t *jpwl_epb_create(opj_j2k_t *j2k, opj_bool latest, opj_bool packed, + int tileno, int idx, int hprot, + unsigned long int pre_len, unsigned long int post_len); /** add a number of EPB marker segments @param j2k J2K compressor handle @@ -306,9 +307,9 @@ jpwl_epb_ms_t *jpwl_epb_create(opj_j2k_t *j2k, opj_bool latest, opj_bool packed, @return returns the length of all added markers */ int jpwl_epbs_add(opj_j2k_t *j2k, jpwl_marker_t *jwmarker, int *jwmarker_num, - opj_bool latest, opj_bool packed, opj_bool insideMH, int *idx, int hprot, - double place_pos, int tileno, - unsigned long int pre_len, unsigned long int post_len); + opj_bool latest, opj_bool packed, opj_bool insideMH, int *idx, int hprot, + double place_pos, int tileno, + unsigned long int pre_len, unsigned long int post_len); /** add a number of ESD marker segments @param j2k J2K compressor handle @@ -324,24 +325,28 @@ int jpwl_epbs_add(opj_j2k_t *j2k, jpwl_marker_t *jwmarker, int *jwmarker_num, @return returns the length of all added markers */ int jpwl_esds_add(opj_j2k_t *j2k, jpwl_marker_t *jwmarker, int *jwmarker_num, - int comps, unsigned char addrm, unsigned char ad_size, - unsigned char senst, unsigned char se_size, - double place_pos, int tileno); - + int comps, unsigned char addrm, unsigned char ad_size, + unsigned char senst, unsigned char se_size, + double place_pos, int tileno); + /** updates the information structure by modifying the positions and lengths @param j2k J2K compressor handle @param jwmarker pointer to JPWL markers list @param jwmarker_num number of JPWL markers @return returns true in case of success -*/ -opj_bool jpwl_update_info(opj_j2k_t *j2k, jpwl_marker_t *jwmarker, int jwmarker_num); +*/ +opj_bool jpwl_update_info(opj_j2k_t *j2k, jpwl_marker_t *jwmarker, + int jwmarker_num); -opj_bool jpwl_esd_fill(opj_j2k_t *j2k, jpwl_esd_ms_t *esdmark, unsigned char *buf); +opj_bool jpwl_esd_fill(opj_j2k_t *j2k, jpwl_esd_ms_t *esdmark, + unsigned char *buf); -opj_bool jpwl_epb_fill(opj_j2k_t *j2k, jpwl_epb_ms_t *epbmark, unsigned char *buf, unsigned char *post_buf); +opj_bool jpwl_epb_fill(opj_j2k_t *j2k, jpwl_epb_ms_t *epbmark, + unsigned char *buf, unsigned char *post_buf); -opj_bool j2k_add_marker(opj_codestream_info_t *cstr_info, unsigned short int type, int pos, int len); +opj_bool j2k_add_marker(opj_codestream_info_t *cstr_info, + unsigned short int type, int pos, int len); /** corrects the data in the JPWL codestream @param j2k J2K compressor handle @@ -359,8 +364,9 @@ opj_bool jpwl_correct(opj_j2k_t *j2k); @param L4_bufp is a pointer to the buffer pointer of redundancy data @return returns true if correction could be successfully performed */ -opj_bool jpwl_epb_correct(opj_j2k_t *j2k, unsigned char *buffer, int type, int pre_len, int post_len, int *conn, - unsigned char **L4_bufp); +opj_bool jpwl_epb_correct(opj_j2k_t *j2k, unsigned char *buffer, int type, + int pre_len, int post_len, int *conn, + unsigned char **L4_bufp); /** check that a tile and its children have valid data @param j2k J2K decompressor handle diff --git a/src/lib/openjpwl/rs.h b/src/lib/openjpwl/rs.h index 57e5c22d..009437cd 100644 --- a/src/lib/openjpwl/rs.h +++ b/src/lib/openjpwl/rs.h @@ -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. * @@ -59,11 +59,11 @@ * to NN-KK erasures or (NN-KK)/2 errors, or combinations thereof with * each error counting as two erasures. */ -#define MM 8 /* RS code over GF(2**MM) - change to suit */ +#define MM 8 /* RS code over GF(2**MM) - change to suit */ /* KK defined in rs.c */ -#define NN ((1 << MM) - 1) +#define NN ((1 << MM) - 1) #if (MM <= 8) typedef unsigned char dtype; @@ -77,13 +77,13 @@ void init_rs(int); /** These two functions *must* be called in this order (e.g., * by init_rs()) before any encoding/decoding */ -void generate_gf(void); /* Generate Galois Field */ -void gen_poly(void); /* Generate generator polynomial */ +void generate_gf(void); /* Generate Galois Field */ +void gen_poly(void); /* Generate generator polynomial */ /** Reed-Solomon encoding * data[] is the input block, parity symbols are placed in bb[] * bb[] may lie past the end of the data, e.g., for (255,223): - * encode_rs(&data[0],&data[223]); + * encode_rs(&data[0],&data[223]); */ int encode_rs(dtype data[], dtype bb[]); diff --git a/src/lib/openmj2/bio.h b/src/lib/openmj2/bio.h index ea7a73de..48de33b4 100644 --- a/src/lib/openmj2/bio.h +++ b/src/lib/openmj2/bio.h @@ -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. @@ -37,7 +37,7 @@ #ifndef __BIO_H #define __BIO_H -/** +/** @file bio.h @brief Implementation of an individual bit input-output (BIO) @@ -51,23 +51,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 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* bio_create(void); @@ -86,14 +86,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); /** @@ -106,7 +106,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); diff --git a/src/lib/openmj2/cio.h b/src/lib/openmj2/cio.h index 3cae708e..fd0e7166 100644 --- a/src/lib/openmj2/cio.h +++ b/src/lib/openmj2/cio.h @@ -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. @@ -76,7 +76,8 @@ Write some bytes @param n Number of bytes to write @return Returns the number of bytes written or 0 if an error occurred */ -OPJ_API unsigned int OPJ_CALLCONV cio_write(opj_cio_t *cio, unsigned int64 v, int n); +OPJ_API unsigned int OPJ_CALLCONV cio_write(opj_cio_t *cio, unsigned int64 v, + int n); /** Read some bytes @param cio CIO handle diff --git a/src/lib/openmj2/dwt.h b/src/lib/openmj2/dwt.h index 5b9645bf..50bd3d02 100644 --- a/src/lib/openmj2/dwt.h +++ b/src/lib/openmj2/dwt.h @@ -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. @@ -80,13 +80,13 @@ Get the norm of a wavelet function of a subband at a specified level for the rev */ double dwt_getnorm(int level, int 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) */ void 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 @@ -106,7 +106,7 @@ Get the norm of a wavelet function of a subband at a specified level for the irr */ double dwt_getnorm_real(int level, int orient); /** -Explicit calculation of the Quantization Stepsizes +Explicit calculation of the Quantization Stepsizes @param tccp Tile-component coding parameters @param prec Precint analyzed */ diff --git a/src/lib/openmj2/event.h b/src/lib/openmj2/event.h index d0a73edf..ade06cfb 100644 --- a/src/lib/openmj2/event.h +++ b/src/lib/openmj2/event.h @@ -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,13 +48,14 @@ 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) @return Returns true if successful, returns false otherwise */ -opj_bool opj_event_msg(opj_common_ptr cinfo, int event_type, const char *fmt, ...); +opj_bool opj_event_msg(opj_common_ptr cinfo, int event_type, const char *fmt, + ...); /* ----------------------------------------------------------------------- */ /*@}*/ diff --git a/src/lib/openmj2/fix.h b/src/lib/openmj2/fix.h index f6a76a7e..e67b1267 100644 --- a/src/lib/openmj2/fix.h +++ b/src/lib/openmj2/fix.h @@ -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. @@ -59,10 +59,11 @@ Multiply two fixed-precision rational numbers. @param b @return Returns a * b */ -static INLINE int fix_mul(int a, int b) { +static INLINE int fix_mul(int a, int b) +{ int64 temp = (int64) a * (int64) b ; temp += temp & 4096; - return (int) (temp >> 13) ; + return (int)(temp >> 13) ; } /*@}*/ diff --git a/src/lib/openmj2/image.h b/src/lib/openmj2/image.h index 074a26d3..dd432150 100644 --- a/src/lib/openmj2/image.h +++ b/src/lib/openmj2/image.h @@ -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. * diff --git a/src/lib/openmj2/int.h b/src/lib/openmj2/int.h index 07f60c31..641fc7b4 100644 --- a/src/lib/openmj2/int.h +++ b/src/lib/openmj2/int.h @@ -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,15 +53,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 INLINE int int_min(int a, int b) { - return a < b ? a : b; +static INLINE 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 INLINE int int_max(int a, int b) { - return (a > b) ? a : b; +static INLINE int int_max(int a, int b) +{ + return (a > b) ? a : b; } /** Clamp an integer inside an interval @@ -69,53 +71,61 @@ Clamp an integer inside an interval
  • Returns a if (min < a < max)
  • Returns max if (a > max) -
  • Returns min if (a < min) +
  • Returns min if (a < min)
*/ -static INLINE int int_clamp(int a, int min, int max) { - if (a < min) - return min; - if (a > max) - return max; - return a; +static INLINE 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 INLINE int int_abs(int a) { - return a < 0 ? -a : a; +static INLINE int int_abs(int a) +{ + return a < 0 ? -a : a; } /** Divide an integer and round upwards @return Returns a divided by b */ -static INLINE int int_ceildiv(int a, int b) { - return (a + b - 1) / b; +static INLINE 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 INLINE int int_ceildivpow2(int a, int b) { - return (a + (1 << b) - 1) >> b; +static INLINE 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 INLINE int int_floordivpow2(int a, int b) { - return a >> b; +static INLINE int int_floordivpow2(int a, int b) +{ + return a >> b; } /** Get logarithm of an integer and round downwards @return Returns log2(a) */ -static INLINE int int_floorlog2(int a) { - int l; - for (l = 0; a > 1; l++) { - a >>= 1; - } - return l; +static INLINE int int_floorlog2(int a) +{ + int l; + for (l = 0; a > 1; l++) { + a >>= 1; + } + return l; } /* ----------------------------------------------------------------------- */ /*@}*/ diff --git a/src/lib/openmj2/j2k.h b/src/lib/openmj2/j2k.h index f41bd6af..e13510fb 100644 --- a/src/lib/openmj2/j2k.h +++ b/src/lib/openmj2/j2k.h @@ -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) 2006-2007, Parvatha Elangovan @@ -63,32 +63,32 @@ The functions in J2K.C have for goal to read/write the several parts of the code /* ----------------------------------------------------------------------- */ -#define J2K_MS_SOC 0xff4f /**< SOC marker value */ -#define J2K_MS_SOT 0xff90 /**< SOT marker value */ -#define J2K_MS_SOD 0xff93 /**< SOD marker value */ -#define J2K_MS_EOC 0xffd9 /**< EOC marker value */ -#define J2K_MS_SIZ 0xff51 /**< SIZ marker value */ -#define J2K_MS_COD 0xff52 /**< COD marker value */ -#define J2K_MS_COC 0xff53 /**< COC marker value */ -#define J2K_MS_RGN 0xff5e /**< RGN marker value */ -#define J2K_MS_QCD 0xff5c /**< QCD marker value */ -#define J2K_MS_QCC 0xff5d /**< QCC marker value */ -#define J2K_MS_POC 0xff5f /**< POC marker value */ -#define J2K_MS_TLM 0xff55 /**< TLM marker value */ -#define J2K_MS_PLM 0xff57 /**< PLM marker value */ -#define J2K_MS_PLT 0xff58 /**< PLT marker value */ -#define J2K_MS_PPM 0xff60 /**< PPM marker value */ -#define J2K_MS_PPT 0xff61 /**< PPT marker value */ -#define J2K_MS_SOP 0xff91 /**< SOP marker value */ -#define J2K_MS_EPH 0xff92 /**< EPH marker value */ -#define J2K_MS_CRG 0xff63 /**< CRG marker value */ -#define J2K_MS_COM 0xff64 /**< COM marker value */ +#define J2K_MS_SOC 0xff4f /**< SOC marker value */ +#define J2K_MS_SOT 0xff90 /**< SOT marker value */ +#define J2K_MS_SOD 0xff93 /**< SOD marker value */ +#define J2K_MS_EOC 0xffd9 /**< EOC marker value */ +#define J2K_MS_SIZ 0xff51 /**< SIZ marker value */ +#define J2K_MS_COD 0xff52 /**< COD marker value */ +#define J2K_MS_COC 0xff53 /**< COC marker value */ +#define J2K_MS_RGN 0xff5e /**< RGN marker value */ +#define J2K_MS_QCD 0xff5c /**< QCD marker value */ +#define J2K_MS_QCC 0xff5d /**< QCC marker value */ +#define J2K_MS_POC 0xff5f /**< POC marker value */ +#define J2K_MS_TLM 0xff55 /**< TLM marker value */ +#define J2K_MS_PLM 0xff57 /**< PLM marker value */ +#define J2K_MS_PLT 0xff58 /**< PLT marker value */ +#define J2K_MS_PPM 0xff60 /**< PPM marker value */ +#define J2K_MS_PPT 0xff61 /**< PPT marker value */ +#define J2K_MS_SOP 0xff91 /**< SOP marker value */ +#define J2K_MS_EPH 0xff92 /**< EPH marker value */ +#define J2K_MS_CRG 0xff63 /**< CRG marker value */ +#define J2K_MS_COM 0xff64 /**< COM marker value */ /* UniPG>> */ #ifdef USE_JPWL -#define J2K_MS_EPC 0xff68 /**< EPC marker value (Part 11: JPEG 2000 for Wireless) */ -#define J2K_MS_EPB 0xff66 /**< EPB marker value (Part 11: JPEG 2000 for Wireless) */ -#define J2K_MS_ESD 0xff67 /**< ESD marker value (Part 11: JPEG 2000 for Wireless) */ -#define J2K_MS_RED 0xff69 /**< RED marker value (Part 11: JPEG 2000 for Wireless) */ +#define J2K_MS_EPC 0xff68 /**< EPC marker value (Part 11: JPEG 2000 for Wireless) */ +#define J2K_MS_EPB 0xff66 /**< EPB marker value (Part 11: JPEG 2000 for Wireless) */ +#define J2K_MS_ESD 0xff67 /**< ESD marker value (Part 11: JPEG 2000 for Wireless) */ +#define J2K_MS_RED 0xff69 /**< RED marker value (Part 11: JPEG 2000 for Wireless) */ #endif /* USE_JPWL */ #ifdef USE_JPSEC #define J2K_MS_SEC 0xff65 /**< SEC marker value (Part 8: Secure JPEG 2000) */ @@ -100,278 +100,278 @@ The functions in J2K.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 J2K_STATUS { - J2K_STATE_MHSOC = 0x0001, /**< a SOC marker is expected */ - J2K_STATE_MHSIZ = 0x0002, /**< a SIZ marker is expected */ - J2K_STATE_MH = 0x0004, /**< the decoding process is in the main header */ - J2K_STATE_TPHSOT = 0x0008, /**< the decoding process is in a tile part header and expects a SOT marker */ - J2K_STATE_TPH = 0x0010, /**< the decoding process is in a tile part header */ - J2K_STATE_MT = 0x0020, /**< the EOC marker has just been read */ - J2K_STATE_NEOC = 0x0040, /**< the decoding process must not expect a EOC marker because the codestream is truncated */ - J2K_STATE_ERR = 0x0080 /**< the decoding process has encountered an error */ + J2K_STATE_MHSOC = 0x0001, /**< a SOC marker is expected */ + J2K_STATE_MHSIZ = 0x0002, /**< a SIZ marker is expected */ + J2K_STATE_MH = 0x0004, /**< the decoding process is in the main header */ + J2K_STATE_TPHSOT = 0x0008, /**< the decoding process is in a tile part header and expects a SOT marker */ + J2K_STATE_TPH = 0x0010, /**< the decoding process is in a tile part header */ + J2K_STATE_MT = 0x0020, /**< the EOC marker has just been read */ + J2K_STATE_NEOC = 0x0040, /**< the decoding process must not expect a EOC marker because the codestream is truncated */ + J2K_STATE_ERR = 0x0080 /**< the decoding process has encountered an error */ } J2K_STATUS; /* ----------------------------------------------------------------------- */ -/** -T2 encoding mode +/** +T2 encoding mode */ typedef enum T2_MODE { - THRESH_CALC = 0, /** Function called in Rate allocation process*/ - FINAL_PASS = 1 /** Function called in Tier 2 process*/ -}J2K_T2_MODE; + THRESH_CALC = 0, /** Function called in Rate allocation process*/ + FINAL_PASS = 1 /** Function called in Tier 2 process*/ +} J2K_T2_MODE; /** 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 */ - int numresolutions; - /** code-blocks width */ - int cblkw; - /** code-blocks height */ - int cblkh; - /** code-block coding style */ - int cblksty; - /** discrete wavelet transform identifier */ - int qmfbid; - /** quantisation style */ - int qntsty; - /** stepsizes used for quantization */ - opj_stepsize_t stepsizes[J2K_MAXBANDS]; - /** number of guard bits */ - int numgbits; - /** Region Of Interest shift */ - int roishift; - /** precinct width */ - int prcw[J2K_MAXRLVLS]; - /** precinct height */ - int prch[J2K_MAXRLVLS]; + /** coding style */ + int csty; + /** number of resolutions */ + int numresolutions; + /** code-blocks width */ + int cblkw; + /** code-blocks height */ + int cblkh; + /** code-block coding style */ + int cblksty; + /** discrete wavelet transform identifier */ + int qmfbid; + /** quantisation style */ + int qntsty; + /** stepsizes used for quantization */ + opj_stepsize_t stepsizes[J2K_MAXBANDS]; + /** number of guard bits */ + int numgbits; + /** Region Of Interest shift */ + int roishift; + /** precinct width */ + int prcw[J2K_MAXRLVLS]; + /** precinct height */ + int prch[J2K_MAXRLVLS]; } opj_tccp_t; /** -Tile coding parameters : +Tile coding parameters : this structure is used to store 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[32]; - /** 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; - /** ppmbug1 */ - int ppt_len; - /** add fixed_quality */ - float distoratio[100]; - /** tile-component coding parameters */ - opj_tccp_t *tccps; + /** 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[32]; + /** 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; + /** ppmbug1 */ + int ppt_len; + /** add fixed_quality */ + float distoratio[100]; + /** tile-component coding parameters */ + opj_tccp_t *tccps; } opj_tcp_t; /** Coding parameters */ typedef struct opj_cp { - /** Digital cinema profile*/ - OPJ_CINEMA_MODE cinema; - /** Maximum rate for each component. If == 0, component size limitation is not considered */ - int max_comp_size; - /** Size of the image in bits*/ - int img_size; - /** Rsiz*/ - OPJ_RSIZ_CAPABILITIES rsiz; - /** Enabling Tile part generation*/ - char tp_on; - /** Flag determining tile part generation*/ - char tp_flag; - /** Position of tile part flag in progression order*/ - int tp_pos; - /** allocation by rate/distortion */ - int disto_alloc; - /** allocation by fixed layer */ - int fixed_alloc; - /** add fixed_quality */ - int fixed_quality; - /** if != 0, then original dimension divided by 2^(reduce); if == 0 or not used, image is decoded to the full resolution */ - int reduce; - /** if != 0, then only the first "layer" layers are decoded; if == 0 or not used, all the quality layers are decoded */ - int layer; - /** if == NO_LIMITATION, decode entire codestream; if == LIMIT_TO_MAIN_HEADER then only decode the main header */ - OPJ_LIMIT_DECODING limit_decoding; - /** XTOsiz */ - int tx0; - /** YTOsiz */ - int ty0; - /** XTsiz */ - int tdx; - /** YTsiz */ - int tdy; - /** comment for coding */ - char *comment; - /** number of tiles in width */ - int tw; - /** number of tiles in heigth */ - int th; - /** ID number of the tiles present in the codestream */ - int *tileno; - /** size of the vector tileno */ - int tileno_size; - /** 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; - /** ppmbug1 */ - int ppm_len; - /** tile coding parameters */ - opj_tcp_t *tcps; - /** fixed layer */ - int *matrice; -/* UniPG>> */ + /** Digital cinema profile*/ + OPJ_CINEMA_MODE cinema; + /** Maximum rate for each component. If == 0, component size limitation is not considered */ + int max_comp_size; + /** Size of the image in bits*/ + int img_size; + /** Rsiz*/ + OPJ_RSIZ_CAPABILITIES rsiz; + /** Enabling Tile part generation*/ + char tp_on; + /** Flag determining tile part generation*/ + char tp_flag; + /** Position of tile part flag in progression order*/ + int tp_pos; + /** allocation by rate/distortion */ + int disto_alloc; + /** allocation by fixed layer */ + int fixed_alloc; + /** add fixed_quality */ + int fixed_quality; + /** if != 0, then original dimension divided by 2^(reduce); if == 0 or not used, image is decoded to the full resolution */ + int reduce; + /** if != 0, then only the first "layer" layers are decoded; if == 0 or not used, all the quality layers are decoded */ + int layer; + /** if == NO_LIMITATION, decode entire codestream; if == LIMIT_TO_MAIN_HEADER then only decode the main header */ + OPJ_LIMIT_DECODING limit_decoding; + /** XTOsiz */ + int tx0; + /** YTOsiz */ + int ty0; + /** XTsiz */ + int tdx; + /** YTsiz */ + int tdy; + /** comment for coding */ + char *comment; + /** number of tiles in width */ + int tw; + /** number of tiles in heigth */ + int th; + /** ID number of the tiles present in the codestream */ + int *tileno; + /** size of the vector tileno */ + int tileno_size; + /** 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; + /** ppmbug1 */ + int ppm_len; + /** tile coding parameters */ + opj_tcp_t *tcps; + /** fixed layer */ + int *matrice; + /* UniPG>> */ #ifdef USE_JPWL - /** enables writing of EPC in MH, thus activating JPWL */ - opj_bool epc_on; - /** enables writing of EPB, in case of activated JPWL */ - opj_bool epb_on; - /** enables writing of ESD, in case of activated JPWL */ - opj_bool esd_on; - /** enables writing of informative techniques of ESD, in case of activated JPWL */ - opj_bool info_on; - /** enables writing of RED, in case of activated JPWL */ - opj_bool red_on; - /** error protection method for MH (0,1,16,32,37-128) */ - int hprot_MH; - /** tile number of header protection specification (>=0) */ - int hprot_TPH_tileno[JPWL_MAX_NO_TILESPECS]; - /** error protection methods for TPHs (0,1,16,32,37-128) */ - int hprot_TPH[JPWL_MAX_NO_TILESPECS]; - /** tile number of packet protection specification (>=0) */ - int pprot_tileno[JPWL_MAX_NO_PACKSPECS]; - /** packet number of packet protection specification (>=0) */ - int pprot_packno[JPWL_MAX_NO_PACKSPECS]; - /** error protection methods for packets (0,1,16,32,37-128) */ - int pprot[JPWL_MAX_NO_PACKSPECS]; - /** enables writing of ESD, (0/2/4 bytes) */ - int sens_size; - /** sensitivity addressing size (0=auto/2/4 bytes) */ - int sens_addr; - /** sensitivity range (0-3) */ - int sens_range; - /** sensitivity method for MH (-1,0-7) */ - int sens_MH; - /** tile number of sensitivity specification (>=0) */ - int sens_TPH_tileno[JPWL_MAX_NO_TILESPECS]; - /** sensitivity methods for TPHs (-1,0-7) */ - int sens_TPH[JPWL_MAX_NO_TILESPECS]; - /** enables JPWL correction at the decoder */ - opj_bool correct; - /** expected number of components at the decoder */ - int exp_comps; - /** maximum number of tiles at the decoder */ - int max_tiles; + /** enables writing of EPC in MH, thus activating JPWL */ + opj_bool epc_on; + /** enables writing of EPB, in case of activated JPWL */ + opj_bool epb_on; + /** enables writing of ESD, in case of activated JPWL */ + opj_bool esd_on; + /** enables writing of informative techniques of ESD, in case of activated JPWL */ + opj_bool info_on; + /** enables writing of RED, in case of activated JPWL */ + opj_bool red_on; + /** error protection method for MH (0,1,16,32,37-128) */ + int hprot_MH; + /** tile number of header protection specification (>=0) */ + int hprot_TPH_tileno[JPWL_MAX_NO_TILESPECS]; + /** error protection methods for TPHs (0,1,16,32,37-128) */ + int hprot_TPH[JPWL_MAX_NO_TILESPECS]; + /** tile number of packet protection specification (>=0) */ + int pprot_tileno[JPWL_MAX_NO_PACKSPECS]; + /** packet number of packet protection specification (>=0) */ + int pprot_packno[JPWL_MAX_NO_PACKSPECS]; + /** error protection methods for packets (0,1,16,32,37-128) */ + int pprot[JPWL_MAX_NO_PACKSPECS]; + /** enables writing of ESD, (0/2/4 bytes) */ + int sens_size; + /** sensitivity addressing size (0=auto/2/4 bytes) */ + int sens_addr; + /** sensitivity range (0-3) */ + int sens_range; + /** sensitivity method for MH (-1,0-7) */ + int sens_MH; + /** tile number of sensitivity specification (>=0) */ + int sens_TPH_tileno[JPWL_MAX_NO_TILESPECS]; + /** sensitivity methods for TPHs (-1,0-7) */ + int sens_TPH[JPWL_MAX_NO_TILESPECS]; + /** enables JPWL correction at the decoder */ + opj_bool correct; + /** expected number of components at the decoder */ + int exp_comps; + /** maximum number of tiles at the decoder */ + int max_tiles; #endif /* USE_JPWL */ -/* <cp. +Decoding parameters are returned in j2k->cp. @param j2k J2K decompressor handle @param parameters decompression parameters */ @@ -402,7 +402,8 @@ Decode an image from a JPEG-2000 codestream @param cstr_info Codestream information structure if required, NULL otherwise @return Returns a decoded image if successful, returns NULL otherwise */ -opj_image_t* j2k_decode(opj_j2k_t *j2k, opj_cio_t *cio, opj_codestream_info_t *cstr_info); +opj_image_t* j2k_decode(opj_j2k_t *j2k, opj_cio_t *cio, + opj_codestream_info_t *cstr_info); /** Decode an image form a JPT-stream (JPEG 2000, JPIP) @param j2k J2K decompressor handle @@ -410,7 +411,8 @@ Decode an image form a JPT-stream (JPEG 2000, JPIP) @param cstr_info Codestream information structure if required, NULL otherwise @return Returns a decoded image if successful, returns NULL otherwise */ -opj_image_t* j2k_decode_jpt_stream(opj_j2k_t *j2k, opj_cio_t *cio, opj_codestream_info_t *cstr_info); +opj_image_t* j2k_decode_jpt_stream(opj_j2k_t *j2k, opj_cio_t *cio, + opj_codestream_info_t *cstr_info); /** Creates a J2K compression structure @param cinfo Codec context info @@ -423,13 +425,14 @@ Destroy a J2K compressor handle */ void j2k_destroy_compress(opj_j2k_t *j2k); /** -Setup the encoder parameters using the current image and using user parameters. -Coding parameters are returned in j2k->cp. +Setup the encoder parameters using the current image and using user parameters. +Coding parameters are returned in j2k->cp. @param j2k J2K compressor handle @param parameters compression parameters @param image input filled image */ -void j2k_setup_encoder(opj_j2k_t *j2k, opj_cparameters_t *parameters, opj_image_t *image); +void j2k_setup_encoder(opj_j2k_t *j2k, opj_cparameters_t *parameters, + opj_image_t *image); /** Converts an enum type progression order to string type */ @@ -442,7 +445,8 @@ Encode an image into a JPEG-2000 codestream @param cstr_info Codestream information structure if required, NULL otherwise @return Returns true if successful, returns false otherwise */ -opj_bool j2k_encode(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t *cstr_info); +opj_bool j2k_encode(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image, + opj_codestream_info_t *cstr_info); /* ----------------------------------------------------------------------- */ /*@}*/ diff --git a/src/lib/openmj2/j2k_lib.h b/src/lib/openmj2/j2k_lib.h index 8f4ad3af..33559a73 100644 --- a/src/lib/openmj2/j2k_lib.h +++ b/src/lib/openmj2/j2k_lib.h @@ -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. * diff --git a/src/lib/openmj2/jp2.h b/src/lib/openmj2/jp2.h index fbd17a4d..582fb50c 100644 --- a/src/lib/openmj2/jp2.h +++ b/src/lib/openmj2/jp2.h @@ -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. * @@ -42,52 +42,48 @@ /** @defgroup JP2 JP2 - JPEG-2000 file format reader/writer */ /*@{*/ -#define JP2_JP 0x6a502020 /**< JPEG 2000 signature box */ -#define JP2_FTYP 0x66747970 /**< File type box */ -#define JP2_JP2H 0x6a703268 /**< JP2 header box */ -#define JP2_IHDR 0x69686472 /**< Image header box */ -#define JP2_COLR 0x636f6c72 /**< Colour specification box */ -#define JP2_JP2C 0x6a703263 /**< Contiguous codestream box */ -#define JP2_URL 0x75726c20 /**< URL box */ -#define JP2_DTBL 0x6474626c /**< Data Reference box */ -#define JP2_BPCC 0x62706363 /**< Bits per component box */ -#define JP2_JP2 0x6a703220 /**< File type fields */ -#define JP2_PCLR 0x70636c72 /**< Palette box */ -#define JP2_CMAP 0x636d6170 /**< Component Mapping box */ -#define JP2_CDEF 0x63646566 /**< Channel Definition box */ +#define JP2_JP 0x6a502020 /**< JPEG 2000 signature box */ +#define JP2_FTYP 0x66747970 /**< File type box */ +#define JP2_JP2H 0x6a703268 /**< JP2 header box */ +#define JP2_IHDR 0x69686472 /**< Image header box */ +#define JP2_COLR 0x636f6c72 /**< Colour specification box */ +#define JP2_JP2C 0x6a703263 /**< Contiguous codestream box */ +#define JP2_URL 0x75726c20 /**< URL box */ +#define JP2_DTBL 0x6474626c /**< Data Reference box */ +#define JP2_BPCC 0x62706363 /**< Bits per component box */ +#define JP2_JP2 0x6a703220 /**< File type fields */ +#define JP2_PCLR 0x70636c72 /**< Palette box */ +#define JP2_CMAP 0x636d6170 /**< Component Mapping box */ +#define JP2_CDEF 0x63646566 /**< Channel Definition box */ /* ----------------------------------------------------------------------- */ -/** +/** Channel description: channel index, type, association */ -typedef struct opj_jp2_cdef_info -{ +typedef struct opj_jp2_cdef_info { unsigned short 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; unsigned short 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 { unsigned short cmp; unsigned char mtyp, pcol; } opj_jp2_cmap_comp_t; -/** +/** Palette data: table entries, palette columns */ -typedef struct opj_jp2_pclr -{ +typedef struct opj_jp2_pclr { unsigned int *entries; unsigned char *channel_sign; unsigned char *channel_size; @@ -95,11 +91,10 @@ typedef struct opj_jp2_pclr unsigned short nr_entries, 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 { unsigned char *icc_profile_buf; int icc_profile_len; @@ -108,51 +103,51 @@ typedef struct opj_jp2_color unsigned char jp2_has_colr; } opj_jp2_color_t; -/** +/** JP2 component */ typedef struct opj_jp2_comps { - int depth; - int sgnd; - int bpcc; + int depth; + int sgnd; + int bpcc; } opj_jp2_comps_t; /** JPEG-2000 file format reader/writer */ typedef struct opj_jp2 { - /** codec context */ - opj_common_ptr cinfo; - /** handle to the J2K codec */ - opj_j2k_t *j2k; - unsigned int w; - unsigned int h; - unsigned int numcomps; - unsigned int bpc; - unsigned int C; - unsigned int UnkC; - unsigned int IPR; - unsigned int meth; - unsigned int approx; - unsigned int enumcs; - unsigned int precedence; - unsigned int brand; - unsigned int minversion; - unsigned int numcl; - unsigned int *cl; - opj_jp2_comps_t *comps; - unsigned int j2k_codestream_offset; - unsigned int j2k_codestream_length; - opj_bool ignore_pclr_cmap_cdef; + /** codec context */ + opj_common_ptr cinfo; + /** handle to the J2K codec */ + opj_j2k_t *j2k; + unsigned int w; + unsigned int h; + unsigned int numcomps; + unsigned int bpc; + unsigned int C; + unsigned int UnkC; + unsigned int IPR; + unsigned int meth; + unsigned int approx; + unsigned int enumcs; + unsigned int precedence; + unsigned int brand; + unsigned int minversion; + unsigned int numcl; + unsigned int *cl; + opj_jp2_comps_t *comps; + unsigned int j2k_codestream_offset; + unsigned int j2k_codestream_length; + opj_bool ignore_pclr_cmap_cdef; } opj_jp2_t; /** JP2 Box */ typedef struct opj_jp2_box { - int length; - int type; - int init_pos; + int length; + int type; + int init_pos; } opj_jp2_box_t; /** @name Exported functions */ @@ -185,7 +180,7 @@ Destroy a JP2 decompressor handle void jp2_destroy_decompress(opj_jp2_t *jp2); /** Setup the decoder decoding parameters using user parameters. -Decoding parameters are returned in jp2->j2k->cp. +Decoding parameters are returned in jp2->j2k->cp. @param jp2 JP2 decompressor handle @param parameters decompression parameters */ @@ -197,7 +192,8 @@ Decode an image from a JPEG-2000 file stream @param cstr_info Codestream information structure if required, NULL otherwise @return Returns a decoded image if successful, returns NULL otherwise */ -opj_image_t* opj_jp2_decode(opj_jp2_t *jp2, opj_cio_t *cio, opj_codestream_info_t *cstr_info); +opj_image_t* opj_jp2_decode(opj_jp2_t *jp2, opj_cio_t *cio, + opj_codestream_info_t *cstr_info); /** Creates a JP2 compression structure @param cinfo Codec context info @@ -210,13 +206,14 @@ Destroy a JP2 compressor handle */ void jp2_destroy_compress(opj_jp2_t *jp2); /** -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 @param image input filled image */ -void jp2_setup_encoder(opj_jp2_t *jp2, opj_cparameters_t *parameters, opj_image_t *image); +void jp2_setup_encoder(opj_jp2_t *jp2, opj_cparameters_t *parameters, + opj_image_t *image); /** Encode an image into a JPEG-2000 file stream @param jp2 JP2 compressor handle @@ -225,7 +222,8 @@ Encode an image into a JPEG-2000 file stream @param cstr_info Codestream information structure if required, NULL otherwise @return Returns true if successful, returns false otherwise */ -opj_bool opj_jp2_encode(opj_jp2_t *jp2, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t *cstr_info); +opj_bool opj_jp2_encode(opj_jp2_t *jp2, opj_cio_t *cio, opj_image_t *image, + opj_codestream_info_t *cstr_info); /* ----------------------------------------------------------------------- */ /*@}*/ diff --git a/src/lib/openmj2/jpt.h b/src/lib/openmj2/jpt.h index f974432d..9b039c87 100644 --- a/src/lib/openmj2/jpt.h +++ b/src/lib/openmj2/jpt.h @@ -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. * @@ -38,33 +38,33 @@ @file jpt.h @brief JPT-stream reader (JPEG 2000, JPIP) -JPT-stream functions are implemented in J2K.C. +JPT-stream functions are implemented in J2K.C. */ /** Message Header JPT stream structure */ typedef struct opj_jpt_msg_header { - /** In-class Identifier */ - unsigned int Id; - /** Last byte information */ - unsigned int last_byte; - /** Class Identifier */ - unsigned int Class_Id; - /** CSn : index identifier */ - unsigned int CSn_Id; - /** Message offset */ - unsigned int Msg_offset; - /** Message length */ - unsigned int Msg_length; - /** Auxiliary for JPP case */ - unsigned int Layer_nb; + /** In-class Identifier */ + unsigned int Id; + /** Last byte information */ + unsigned int last_byte; + /** Class Identifier */ + unsigned int Class_Id; + /** CSn : index identifier */ + unsigned int CSn_Id; + /** Message offset */ + unsigned int Msg_offset; + /** Message length */ + unsigned int Msg_length; + /** Auxiliary for JPP case */ + unsigned int Layer_nb; } opj_jpt_msg_header_t; /* ----------------------------------------------------------------------- */ /** -Initialize the value of the message header structure +Initialize the value of the message header structure @param header Message header structure */ void jpt_init_msg_header(opj_jpt_msg_header_t * header); @@ -75,6 +75,7 @@ Read the message header for a JPP/JPT - stream @param cio CIO handle @param header Message header structure */ -void jpt_read_msg_header(opj_common_ptr cinfo, opj_cio_t *cio, opj_jpt_msg_header_t *header); +void jpt_read_msg_header(opj_common_ptr cinfo, opj_cio_t *cio, + opj_jpt_msg_header_t *header); #endif diff --git a/src/lib/openmj2/mct.h b/src/lib/openmj2/mct.h index 08f18474..3c1e1b79 100644 --- a/src/lib/openmj2/mct.h +++ b/src/lib/openmj2/mct.h @@ -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. @@ -70,7 +70,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); @@ -93,7 +93,7 @@ void mct_decode_real(float* c0, float* c1, float* 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); /* ----------------------------------------------------------------------- */ diff --git a/src/lib/openmj2/mj2.h b/src/lib/openmj2/mj2.h index 8761111f..8e08f0b5 100644 --- a/src/lib/openmj2/mj2.h +++ b/src/lib/openmj2/mj2.h @@ -80,7 +80,7 @@ Decompressed format used in parameters YUV = 0 */ -#define YUV_DFMT 1 +#define YUV_DFMT 1 /** Compressed format used in parameters @@ -95,208 +95,208 @@ MJ2 = 0 Time To Sample */ typedef struct mj2_tts { - int sample_count; - int sample_delta; + int sample_count; + int sample_delta; } mj2_tts_t; /** Chunk */ -typedef struct mj2_chunk { - unsigned int num_samples; - int sample_descr_idx; - int offset; +typedef struct mj2_chunk { + unsigned int num_samples; + int sample_descr_idx; + int offset; } mj2_chunk_t; /** Sample to chunk */ -typedef struct mj2_sampletochunk { - unsigned int first_chunk; - unsigned int samples_per_chunk; - int sample_descr_idx; +typedef struct mj2_sampletochunk { + unsigned int first_chunk; + unsigned int samples_per_chunk; + int sample_descr_idx; } mj2_sampletochunk_t; /** Sample */ -typedef struct mj2_sample { - unsigned int sample_size; - unsigned int offset; - unsigned int sample_delta; +typedef struct mj2_sample { + unsigned int sample_size; + unsigned int offset; + unsigned int sample_delta; } mj2_sample_t; /** URL */ typedef struct mj2_url { - int location[4]; + int location[4]; } mj2_url_t; /** URN */ -typedef struct mj2_urn { - int name[2]; - int location[4]; +typedef struct mj2_urn { + int name[2]; + int location[4]; } mj2_urn_t; /** Video Track Parameters */ typedef struct mj2_tk { - /** codec context */ - opj_common_ptr cinfo; - int track_ID; - int track_type; - unsigned int creation_time; - unsigned int modification_time; - int duration; - int timescale; - int layer; - int volume; - int language; - int balance; - int maxPDUsize; - int avgPDUsize; - int maxbitrate; - int avgbitrate; - int slidingavgbitrate; - int graphicsmode; - int opcolor[3]; - int num_url; - mj2_url_t *url; - int num_urn; - mj2_urn_t *urn; - int Dim[2]; - int w; - int h; - int visual_w; - int visual_h; - int CbCr_subsampling_dx; - int CbCr_subsampling_dy; - int sample_rate; - int sample_description; - int horizresolution; - int vertresolution; - int compressorname[8]; - int depth; - unsigned char fieldcount; - unsigned char fieldorder; - unsigned char or_fieldcount; - unsigned char or_fieldorder; - int num_br; - unsigned int *br; - unsigned char num_jp2x; - unsigned char *jp2xdata; - unsigned char hsub; - unsigned char vsub; - unsigned char hoff; - unsigned char voff; - int trans_matrix[9]; - /** Number of samples */ - unsigned int num_samples; - int transorm; - int handler_type; - int name_size; - unsigned char same_sample_size; - int num_tts; - /** Time to sample */ - mj2_tts_t *tts; - unsigned int num_chunks; - mj2_chunk_t *chunk; - unsigned int num_samplestochunk; - mj2_sampletochunk_t *sampletochunk; - char *name; - opj_jp2_t jp2_struct; - /** Sample parameters */ - mj2_sample_t *sample; -} mj2_tk_t; + /** codec context */ + opj_common_ptr cinfo; + int track_ID; + int track_type; + unsigned int creation_time; + unsigned int modification_time; + int duration; + int timescale; + int layer; + int volume; + int language; + int balance; + int maxPDUsize; + int avgPDUsize; + int maxbitrate; + int avgbitrate; + int slidingavgbitrate; + int graphicsmode; + int opcolor[3]; + int num_url; + mj2_url_t *url; + int num_urn; + mj2_urn_t *urn; + int Dim[2]; + int w; + int h; + int visual_w; + int visual_h; + int CbCr_subsampling_dx; + int CbCr_subsampling_dy; + int sample_rate; + int sample_description; + int horizresolution; + int vertresolution; + int compressorname[8]; + int depth; + unsigned char fieldcount; + unsigned char fieldorder; + unsigned char or_fieldcount; + unsigned char or_fieldorder; + int num_br; + unsigned int *br; + unsigned char num_jp2x; + unsigned char *jp2xdata; + unsigned char hsub; + unsigned char vsub; + unsigned char hoff; + unsigned char voff; + int trans_matrix[9]; + /** Number of samples */ + unsigned int num_samples; + int transorm; + int handler_type; + int name_size; + unsigned char same_sample_size; + int num_tts; + /** Time to sample */ + mj2_tts_t *tts; + unsigned int num_chunks; + mj2_chunk_t *chunk; + unsigned int num_samplestochunk; + mj2_sampletochunk_t *sampletochunk; + char *name; + opj_jp2_t jp2_struct; + /** Sample parameters */ + mj2_sample_t *sample; +} mj2_tk_t; /** MJ2 box */ typedef struct mj2_box { - int length; - int type; - int init_pos; + int length; + int type; + int init_pos; } mj2_box_t; /** MJ2 Movie */ -typedef struct opj_mj2 { - /** codec context */ - opj_common_ptr cinfo; - /** handle to the J2K codec */ - opj_j2k_t *j2k; - unsigned int brand; - unsigned int minversion; - int num_cl; - unsigned int *cl; - unsigned int creation_time; - unsigned int modification_time; - int timescale; - unsigned int duration; - int rate; - int num_vtk; - int num_stk; - int num_htk; - int volume; - int trans_matrix[9]; - int next_tk_id; - /** Track Parameters */ - mj2_tk_t *tk; +typedef struct opj_mj2 { + /** codec context */ + opj_common_ptr cinfo; + /** handle to the J2K codec */ + opj_j2k_t *j2k; + unsigned int brand; + unsigned int minversion; + int num_cl; + unsigned int *cl; + unsigned int creation_time; + unsigned int modification_time; + int timescale; + unsigned int duration; + int rate; + int num_vtk; + int num_stk; + int num_htk; + int volume; + int trans_matrix[9]; + int next_tk_id; + /** Track Parameters */ + mj2_tk_t *tk; } opj_mj2_t; /** Decompression parameters */ typedef struct mj2_dparameters { - /**@name command line encoder parameters (not used inside the library) */ - /*@{*/ - /** input file name */ - char infile[OPJ_PATH_LEN]; - /** output file name */ - char outfile[OPJ_PATH_LEN]; - /** J2K decompression parameters */ - opj_dparameters_t j2k_parameters; + /**@name command line encoder parameters (not used inside the library) */ + /*@{*/ + /** input file name */ + char infile[OPJ_PATH_LEN]; + /** output file name */ + char outfile[OPJ_PATH_LEN]; + /** J2K decompression parameters */ + opj_dparameters_t j2k_parameters; } mj2_dparameters_t; /** Compression parameters */ typedef struct mj2_cparameters { - /**@name command line encoder parameters (not used inside the library) */ - /*@{*/ - /** J2K compression parameters */ - opj_cparameters_t j2k_parameters; - /** input file name */ - char infile[OPJ_PATH_LEN]; - /** output file name */ - char outfile[OPJ_PATH_LEN]; - /** input file format 0:MJ2 */ - int decod_format; - /** output file format 0:YUV */ - int cod_format; - /** Portion of the image coded */ - int Dim[2]; - /** YUV Frame width */ - int w; - /** YUV Frame height */ - int h; - /* Sample rate of YUV 4:4:4, 4:2:2 or 4:2:0 */ - int CbCr_subsampling_dx; - /* Sample rate of YUV 4:4:4, 4:2:2 or 4:2:0 */ - int CbCr_subsampling_dy; - /* Video Frame Rate */ - int frame_rate; - /* In YUV files, numcomps always considered as 3 */ - int numcomps; - /* In YUV files, precision always considered as 8 */ - int prec; - unsigned int meth; - unsigned int enumcs; + /**@name command line encoder parameters (not used inside the library) */ + /*@{*/ + /** J2K compression parameters */ + opj_cparameters_t j2k_parameters; + /** input file name */ + char infile[OPJ_PATH_LEN]; + /** output file name */ + char outfile[OPJ_PATH_LEN]; + /** input file format 0:MJ2 */ + int decod_format; + /** output file format 0:YUV */ + int cod_format; + /** Portion of the image coded */ + int Dim[2]; + /** YUV Frame width */ + int w; + /** YUV Frame height */ + int h; + /* Sample rate of YUV 4:4:4, 4:2:2 or 4:2:0 */ + int CbCr_subsampling_dx; + /* Sample rate of YUV 4:4:4, 4:2:2 or 4:2:0 */ + int CbCr_subsampling_dy; + /* Video Frame Rate */ + int frame_rate; + /* In YUV files, numcomps always considered as 3 */ + int numcomps; + /* In YUV files, precision always considered as 8 */ + int prec; + unsigned int meth; + unsigned int enumcs; } mj2_cparameters_t; @@ -304,7 +304,7 @@ typedef struct mj2_cparameters { /*@{*/ /* ----------------------------------------------------------------------- */ /** -Write the JP box +Write the JP box */ OPJ_API void OPJ_CALLCONV mj2_write_jp(opj_cio_t *cio); /** @@ -325,11 +325,12 @@ Destroy a MJ2 decompressor handle OPJ_API void OPJ_CALLCONV mj2_destroy_decompress(opj_mj2_t *movie); /** Setup the decoder decoding parameters using user parameters. -Decoding parameters are returned in mj2->j2k->cp. +Decoding parameters are returned in mj2->j2k->cp. @param movie MJ2 decompressor handle @param mj2_parameters decompression parameters */ -OPJ_API void OPJ_CALLCONV mj2_setup_decoder(opj_mj2_t *movie, mj2_dparameters_t *mj2_parameters); +OPJ_API void OPJ_CALLCONV mj2_setup_decoder(opj_mj2_t *movie, + mj2_dparameters_t *mj2_parameters); /** Decode an image from a JPEG-2000 file stream @param movie MJ2 decompressor handle @@ -348,12 +349,13 @@ Destroy a MJ2 compressor handle */ OPJ_API void OPJ_CALLCONV mj2_destroy_compress(opj_mj2_t *movie); /** -Setup the encoder parameters using the current image and using user parameters. -Coding parameters are returned in mj2->j2k->cp. +Setup the encoder parameters using the current image and using user parameters. +Coding parameters are returned in mj2->j2k->cp. @param movie MJ2 compressor handle @param parameters compression parameters */ -OPJ_API void OPJ_CALLCONV mj2_setup_encoder(opj_mj2_t *movie, mj2_cparameters_t *parameters); +OPJ_API void OPJ_CALLCONV mj2_setup_encoder(opj_mj2_t *movie, + mj2_cparameters_t *parameters); /** Encode an image into a JPEG-2000 file stream @param movie MJ2 compressor handle @@ -362,7 +364,8 @@ Encode an image into a JPEG-2000 file stream @param index Name of the index file if required, NULL otherwise @return Returns true if successful, returns false otherwise */ -opj_bool mj2_encode(opj_mj2_t *movie, opj_cio_t *cio, opj_image_t *image, char *index); +opj_bool mj2_encode(opj_mj2_t *movie, opj_cio_t *cio, opj_image_t *image, + char *index); /** Init a Standard MJ2 movie @@ -373,13 +376,13 @@ OPJ_API int OPJ_CALLCONV mj2_init_stdmovie(opj_mj2_t *movie); /** Read the structure of an MJ2 file @param file MJ2 input File -@param mj2 J2 movie structure +@param mj2 J2 movie structure @return Returns 0 if successful, returns 1 otherwise */ OPJ_API int OPJ_CALLCONV mj2_read_struct(FILE *file, opj_mj2_t *mj2); /** Write the MOOV box to an output buffer stream -@param movie MJ2 movie structure +@param movie MJ2 movie structure @param cio Output buffer stream */ OPJ_API void OPJ_CALLCONV mj2_write_moov(opj_mj2_t *movie, opj_cio_t *cio); diff --git a/src/lib/openmj2/mj2_convert.h b/src/lib/openmj2/mj2_convert.h index 073731b3..e5c18cdb 100644 --- a/src/lib/openmj2/mj2_convert.h +++ b/src/lib/openmj2/mj2_convert.h @@ -35,9 +35,11 @@ OPJ_API int OPJ_CALLCONV imagetoyuv(opj_image_t * img, char *outfile); OPJ_API int OPJ_CALLCONV imagetobmp(opj_image_t * img, char *outfile); -OPJ_API opj_image_t * OPJ_CALLCONV mj2_image_create(mj2_tk_t * tk, opj_cparameters_t *parameters); +OPJ_API opj_image_t * OPJ_CALLCONV mj2_image_create(mj2_tk_t * tk, + opj_cparameters_t *parameters); -OPJ_API char OPJ_CALLCONV yuvtoimage(mj2_tk_t * tk, opj_image_t * img, int frame_num, opj_cparameters_t *parameters, char* infile); +OPJ_API char OPJ_CALLCONV yuvtoimage(mj2_tk_t * tk, opj_image_t * img, + int frame_num, opj_cparameters_t *parameters, char* infile); OPJ_API unsigned int OPJ_CALLCONV yuv_num_frames(mj2_tk_t * tk, char *infile); diff --git a/src/lib/openmj2/mqc.h b/src/lib/openmj2/mqc.h index 08196d16..8966e55b 100644 --- a/src/lib/openmj2/mqc.h +++ b/src/lib/openmj2/mqc.h @@ -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. @@ -52,14 +52,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 19 @@ -68,16 +68,16 @@ 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; #ifdef MQC_PERF_OPT - unsigned char *buffer; + unsigned char *buffer; #endif } opj_mqc_t; @@ -85,7 +85,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* mqc_create(void); @@ -101,7 +101,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 */ @@ -125,7 +125,7 @@ Set the current context used for coding/decoding @param mqc MQC handle @param ctxno Number that identifies the context */ -#define mqc_setcurctx(mqc, ctxno) (mqc)->curctx = &(mqc)->ctxs[(int)(ctxno)] +#define mqc_setcurctx(mqc, ctxno) (mqc)->curctx = &(mqc)->ctxs[(int)(ctxno)] /** Encode a symbol using the MQ-coder @param mqc MQC handle @@ -138,15 +138,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.

Not fully implemented and tested !!

@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.

Not fully implemented and tested !!

@param mqc MQC handle @param d The symbol to be encoded (0 or 1) diff --git a/src/lib/openmj2/openjpeg.h b/src/lib/openmj2/openjpeg.h index 132ec2fd..f6b39737 100644 --- a/src/lib/openmj2/openjpeg.h +++ b/src/lib/openmj2/openjpeg.h @@ -1,45 +1,45 @@ - /* - * 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) 2001-2003, David Janssens - * Copyright (c) 2002-2003, Yannick Verschueren - * Copyright (c) 2003-2007, Francois-Olivier Devaux - * Copyright (c) 2003-2014, Antonin Descampe - * Copyright (c) 2005, Herve Drolon, FreeImage Team - * Copyright (c) 2006-2007, Parvatha Elangovan - * Copyright (c) 2010-2011, Kaori Hagihara - * 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. - */ +/* +* 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) 2001-2003, David Janssens +* Copyright (c) 2002-2003, Yannick Verschueren +* Copyright (c) 2003-2007, Francois-Olivier Devaux +* Copyright (c) 2003-2014, Antonin Descampe +* Copyright (c) 2005, Herve Drolon, FreeImage Team +* Copyright (c) 2006-2007, Parvatha Elangovan +* Copyright (c) 2010-2011, Kaori Hagihara +* 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 OPENJPEG_H #define OPENJPEG_H -/* +/* ========================================================== Compiler directives ========================================================== @@ -58,10 +58,10 @@ #else #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. */ @@ -78,7 +78,7 @@ typedef int opj_bool; /* Avoid compile-time warning because parameter is not used */ #define OPJ_ARG_NOT_USED(x) (void)(x) -/* +/* ========================================================== Useful constant definitions ========================================================== @@ -86,13 +86,13 @@ typedef int opj_bool; #define OPJ_PATH_LEN 4096 /**< Maximum allowed size for filenames */ -#define J2K_MAXRLVLS 33 /**< Number of maximum resolution level authorized */ -#define J2K_MAXBANDS (3*J2K_MAXRLVLS-2) /**< Number of maximum sub-band linked to number of resolution level */ +#define J2K_MAXRLVLS 33 /**< Number of maximum resolution level authorized */ +#define J2K_MAXBANDS (3*J2K_MAXRLVLS-2) /**< Number of maximum sub-band linked to number of resolution level */ /* UniPG>> */ -#define JPWL_MAX_NO_TILESPECS 16 /**< Maximum number of tile parts expected by JPWL: increase at your will */ -#define JPWL_MAX_NO_PACKSPECS 16 /**< Maximum number of packet parts expected by JPWL: increase at your will */ -#define JPWL_MAX_NO_MARKERS 512 /**< Maximum number of JPWL markers: increase at your will */ +#define JPWL_MAX_NO_TILESPECS 16 /**< Maximum number of tile parts expected by JPWL: increase at your will */ +#define JPWL_MAX_NO_PACKSPECS 16 /**< Maximum number of packet parts expected by JPWL: increase at your will */ +#define JPWL_MAX_NO_MARKERS 512 /**< Maximum number of JPWL markers: increase at your will */ #define JPWL_PRIVATEINDEX_NAME "jpwl_index_privatefilename" /**< index file name used when JPWL is on */ #define JPWL_EXPECTED_COMPONENTS 3 /**< Expect this number of components, so you'll find better the first EPB */ #define JPWL_MAXIMUM_TILES 8192 /**< Expect this maximum number of tiles, to avoid some crashes */ @@ -100,51 +100,51 @@ typedef int opj_bool; #define JPWL_MAXIMUM_EPB_ROOM 65450 /**< Expect this maximum number of bytes for composition of EPBs */ /* <
  • Error messages
  • Warning messages @@ -193,16 +193,16 @@ used for */ 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 ========================================================== @@ -212,237 +212,237 @@ typedef struct opj_event_mgr { Progression order changes */ typedef struct opj_poc { - /** Resolution num start, Component num start, given by POC */ - int resno0, compno0; - /** Layer num end,Resolution num end, Component num end, given by POC */ - int layno1, resno1, compno1; - /** Layer num start,Precinct num start, Precinct num end */ - int layno0, precno0, precno1; - /** Progression order enum*/ - OPJ_PROG_ORDER prg1,prg; - /** Progression order string*/ - char progorder[5]; - /** Tile number */ - int tile; - /** Start and end values for Tile width and height*/ - int tx0,tx1,ty0,ty1; - /** Start value, initialised in pi_initialise_encode*/ - int layS, resS, compS, prcS; - /** End value, initialised in pi_initialise_encode */ - int layE, resE, compE, prcE; - /** Start and end values of Tile width and height, initialised in pi_initialise_encode*/ - int txS,txE,tyS,tyE,dx,dy; - /** Temporary values for Tile parts, initialised in pi_create_encode */ - int lay_t, res_t, comp_t, prc_t,tx0_t,ty0_t; + /** Resolution num start, Component num start, given by POC */ + int resno0, compno0; + /** Layer num end,Resolution num end, Component num end, given by POC */ + int layno1, resno1, compno1; + /** Layer num start,Precinct num start, Precinct num end */ + int layno0, precno0, precno1; + /** Progression order enum*/ + OPJ_PROG_ORDER prg1, prg; + /** Progression order string*/ + char progorder[5]; + /** Tile number */ + int tile; + /** Start and end values for Tile width and height*/ + int tx0, tx1, ty0, ty1; + /** Start value, initialised in pi_initialise_encode*/ + int layS, resS, compS, prcS; + /** End value, initialised in pi_initialise_encode */ + int layE, resE, compE, prcE; + /** Start and end values of Tile width and height, initialised in pi_initialise_encode*/ + int txS, txE, tyS, tyE, dx, dy; + /** Temporary values for Tile parts, initialised in pi_create_encode */ + int lay_t, res_t, comp_t, prc_t, tx0_t, ty0_t; } opj_poc_t; /** Compression parameters */ typedef struct opj_cparameters { - /** size of tile: tile_size_on = false (not in argument) or = true (in argument) */ - opj_bool tile_size_on; - /** XTOsiz */ - int cp_tx0; - /** YTOsiz */ - int cp_ty0; - /** XTsiz */ - int cp_tdx; - /** YTsiz */ - int cp_tdy; - /** 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; - /** comment for coding */ - char *cp_comment; - /** csty : coding style */ - int csty; - /** progression order (default LRCP) */ - OPJ_PROG_ORDER prog_order; - /** progression order changes */ - opj_poc_t POC[32]; - /** number of progression order changes (POC), default to 0 */ - int numpocs; - /** number of layers */ - int tcp_numlayers; - /** rates of layers */ - float tcp_rates[100]; - /** different psnr for successive layers */ - float tcp_distoratio[100]; - /** number of resolutions */ - int numresolution; - /** initial code block width, default to 64 */ - int cblockw_init; - /** initial code block height, default to 64 */ - int cblockh_init; - /** mode switch (cblk_style) */ - int mode; - /** 1 : use the irreversible DWT 9-7, 0 : use lossless compression (default) */ - int irreversible; - /** 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 precinct size specifications */ - int res_spec; - /** initial precinct width */ - int prcw_init[J2K_MAXRLVLS]; - /** initial precinct height */ - int prch_init[J2K_MAXRLVLS]; + /** size of tile: tile_size_on = false (not in argument) or = true (in argument) */ + opj_bool tile_size_on; + /** XTOsiz */ + int cp_tx0; + /** YTOsiz */ + int cp_ty0; + /** XTsiz */ + int cp_tdx; + /** YTsiz */ + int cp_tdy; + /** 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; + /** comment for coding */ + char *cp_comment; + /** csty : coding style */ + int csty; + /** progression order (default LRCP) */ + OPJ_PROG_ORDER prog_order; + /** progression order changes */ + opj_poc_t POC[32]; + /** number of progression order changes (POC), default to 0 */ + int numpocs; + /** number of layers */ + int tcp_numlayers; + /** rates of layers */ + float tcp_rates[100]; + /** different psnr for successive layers */ + float tcp_distoratio[100]; + /** number of resolutions */ + int numresolution; + /** initial code block width, default to 64 */ + int cblockw_init; + /** initial code block height, default to 64 */ + int cblockh_init; + /** mode switch (cblk_style) */ + int mode; + /** 1 : use the irreversible DWT 9-7, 0 : use lossless compression (default) */ + int irreversible; + /** 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 precinct size specifications */ + int res_spec; + /** initial precinct width */ + int prcw_init[J2K_MAXRLVLS]; + /** initial precinct height */ + int prch_init[J2K_MAXRLVLS]; - /**@name command line encoder parameters (not used inside the library) */ - /*@{*/ - /** input file name */ - char infile[OPJ_PATH_LEN]; - /** output file name */ - char outfile[OPJ_PATH_LEN]; - /** DEPRECATED. Index generation is now handeld with the opj_encode_with_info() function. Set to NULL */ - int index_on; - /** DEPRECATED. Index generation is now handeld with the opj_encode_with_info() function. Set to NULL */ - char index[OPJ_PATH_LEN]; - /** subimage encoding: origin image offset in x direction */ - int image_offset_x0; - /** subimage encoding: origin image offset in y direction */ - int image_offset_y0; - /** subsampling value for dx */ - int subsampling_dx; - /** subsampling value for dy */ - int subsampling_dy; - /** input file format 0: PGX, 1: PxM, 2: BMP 3:TIF*/ - int decod_format; - /** output file format 0: J2K, 1: JP2, 2: JPT */ - int cod_format; - /*@}*/ + /**@name command line encoder parameters (not used inside the library) */ + /*@{*/ + /** input file name */ + char infile[OPJ_PATH_LEN]; + /** output file name */ + char outfile[OPJ_PATH_LEN]; + /** DEPRECATED. Index generation is now handeld with the opj_encode_with_info() function. Set to NULL */ + int index_on; + /** DEPRECATED. Index generation is now handeld with the opj_encode_with_info() function. Set to NULL */ + char index[OPJ_PATH_LEN]; + /** subimage encoding: origin image offset in x direction */ + int image_offset_x0; + /** subimage encoding: origin image offset in y direction */ + int image_offset_y0; + /** subsampling value for dx */ + int subsampling_dx; + /** subsampling value for dy */ + int subsampling_dy; + /** input file format 0: PGX, 1: PxM, 2: BMP 3:TIF*/ + int decod_format; + /** output file format 0: J2K, 1: JP2, 2: JPT */ + int cod_format; + /*@}*/ -/* UniPG>> */ - /**@name JPWL encoding parameters */ - /*@{*/ - /** enables writing of EPC in MH, thus activating JPWL */ - opj_bool jpwl_epc_on; - /** error protection method for MH (0,1,16,32,37-128) */ - int jpwl_hprot_MH; - /** tile number of header protection specification (>=0) */ - int jpwl_hprot_TPH_tileno[JPWL_MAX_NO_TILESPECS]; - /** error protection methods for TPHs (0,1,16,32,37-128) */ - int jpwl_hprot_TPH[JPWL_MAX_NO_TILESPECS]; - /** tile number of packet protection specification (>=0) */ - int jpwl_pprot_tileno[JPWL_MAX_NO_PACKSPECS]; - /** packet number of packet protection specification (>=0) */ - int jpwl_pprot_packno[JPWL_MAX_NO_PACKSPECS]; - /** error protection methods for packets (0,1,16,32,37-128) */ - int jpwl_pprot[JPWL_MAX_NO_PACKSPECS]; - /** enables writing of ESD, (0=no/1/2 bytes) */ - int jpwl_sens_size; - /** sensitivity addressing size (0=auto/2/4 bytes) */ - int jpwl_sens_addr; - /** sensitivity range (0-3) */ - int jpwl_sens_range; - /** sensitivity method for MH (-1=no,0-7) */ - int jpwl_sens_MH; - /** tile number of sensitivity specification (>=0) */ - int jpwl_sens_TPH_tileno[JPWL_MAX_NO_TILESPECS]; - /** sensitivity methods for TPHs (-1=no,0-7) */ - int jpwl_sens_TPH[JPWL_MAX_NO_TILESPECS]; - /*@}*/ -/* <> */ + /**@name JPWL encoding parameters */ + /*@{*/ + /** enables writing of EPC in MH, thus activating JPWL */ + opj_bool jpwl_epc_on; + /** error protection method for MH (0,1,16,32,37-128) */ + int jpwl_hprot_MH; + /** tile number of header protection specification (>=0) */ + int jpwl_hprot_TPH_tileno[JPWL_MAX_NO_TILESPECS]; + /** error protection methods for TPHs (0,1,16,32,37-128) */ + int jpwl_hprot_TPH[JPWL_MAX_NO_TILESPECS]; + /** tile number of packet protection specification (>=0) */ + int jpwl_pprot_tileno[JPWL_MAX_NO_PACKSPECS]; + /** packet number of packet protection specification (>=0) */ + int jpwl_pprot_packno[JPWL_MAX_NO_PACKSPECS]; + /** error protection methods for packets (0,1,16,32,37-128) */ + int jpwl_pprot[JPWL_MAX_NO_PACKSPECS]; + /** enables writing of ESD, (0=no/1/2 bytes) */ + int jpwl_sens_size; + /** sensitivity addressing size (0=auto/2/4 bytes) */ + int jpwl_sens_addr; + /** sensitivity range (0-3) */ + int jpwl_sens_range; + /** sensitivity method for MH (-1=no,0-7) */ + int jpwl_sens_MH; + /** tile number of sensitivity specification (>=0) */ + int jpwl_sens_TPH_tileno[JPWL_MAX_NO_TILESPECS]; + /** sensitivity methods for TPHs (-1=no,0-7) */ + int jpwl_sens_TPH[JPWL_MAX_NO_TILESPECS]; + /*@}*/ + /* <> */ - /**@name JPWL decoding parameters */ - /*@{*/ - /** activates the JPWL correction capabilities */ - opj_bool jpwl_correct; - /** expected number of components */ - int jpwl_exp_comps; - /** maximum number of tiles */ - int jpwl_max_tiles; - /*@}*/ -/* <> */ + /**@name JPWL decoding parameters */ + /*@{*/ + /** activates the JPWL correction capabilities */ + opj_bool jpwl_correct; + /** expected number of components */ + int jpwl_exp_comps; + /** maximum number of tiles */ + int jpwl_max_tiles; + /*@}*/ + /* <> */ - /** number of markers */ - int marknum; - /** list of markers */ - opj_marker_info_t *marker; - /** actual size of markers array */ - int maxmarknum; -/* <> */ + /** number of markers */ + int marknum; + /** list of markers */ + opj_marker_info_t *marker; + /** actual size of markers array */ + int maxmarknum; + /* <cp. +Decoding parameters are returned in j2k->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 image from a JPEG-2000 codestream +Decode an image from a JPEG-2000 codestream @param dinfo decompressor handle @param cio Input buffer stream @return Returns a decoded image if successful, returns NULL otherwise */ -OPJ_API opj_image_t* OPJ_CALLCONV opj_decode(opj_dinfo_t *dinfo, opj_cio_t *cio); +OPJ_API opj_image_t* OPJ_CALLCONV opj_decode(opj_dinfo_t *dinfo, + opj_cio_t *cio); /** Decode an image from a JPEG-2000 codestream and extract the codestream information @@ -851,7 +858,8 @@ Decode an image from a JPEG-2000 codestream and extract the codestream informati @param cstr_info Codestream information structure if needed afterwards, NULL otherwise @return Returns a decoded image if successful, returns NULL otherwise */ -OPJ_API opj_image_t* OPJ_CALLCONV opj_decode_with_info(opj_dinfo_t *dinfo, opj_cio_t *cio, opj_codestream_info_t *cstr_info); +OPJ_API opj_image_t* OPJ_CALLCONV opj_decode_with_info(opj_dinfo_t *dinfo, + opj_cio_t *cio, opj_codestream_info_t *cstr_info); /** Creates a J2K/JP2 compression structure @param format Coder to select @@ -864,7 +872,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 :
    • Lossless
    • 1 tile @@ -884,14 +892,16 @@ Set encoding parameters to default values, that means :
    @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 image and using user parameters. +Setup the encoder parameters using the current image and using user parameters. @param cinfo Compressor handle @param parameters Compression parameters @param image Input filled image */ -OPJ_API void OPJ_CALLCONV opj_setup_encoder(opj_cinfo_t *cinfo, opj_cparameters_t *parameters, opj_image_t *image); +OPJ_API void OPJ_CALLCONV opj_setup_encoder(opj_cinfo_t *cinfo, + opj_cparameters_t *parameters, opj_image_t *image); /** Encode an image into a JPEG-2000 codestream 3@param cinfo compressor handle @@ -900,7 +910,8 @@ Encode an image into a JPEG-2000 codestream @param index Depreacted -> Set to NULL. To extract index, used opj_encode_wci() @return Returns true if successful, returns false otherwise */ -OPJ_API opj_bool OPJ_CALLCONV opj_encode(opj_cinfo_t *cinfo, opj_cio_t *cio, opj_image_t *image, char *index); +OPJ_API opj_bool OPJ_CALLCONV opj_encode(opj_cinfo_t *cinfo, opj_cio_t *cio, + opj_image_t *image, char *index); /** Encode an image into a JPEG-2000 codestream and extract the codestream information @param cinfo compressor handle @@ -909,12 +920,14 @@ Encode an image into a JPEG-2000 codestream and extract the codestream informati @param cstr_info Codestream information structure if needed afterwards, NULL otherwise @return Returns true if successful, returns false otherwise */ -OPJ_API opj_bool OPJ_CALLCONV opj_encode_with_info(opj_cinfo_t *cinfo, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t *cstr_info); +OPJ_API opj_bool OPJ_CALLCONV opj_encode_with_info(opj_cinfo_t *cinfo, + opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t *cstr_info); /** Destroy Codestream information after compression or decompression @param cstr_info Codestream information structure */ -OPJ_API void OPJ_CALLCONV opj_destroy_cstr_info(opj_codestream_info_t *cstr_info); +OPJ_API void OPJ_CALLCONV opj_destroy_cstr_info(opj_codestream_info_t + *cstr_info); #ifdef __cplusplus diff --git a/src/lib/openmj2/opj_includes.h b/src/lib/openmj2/opj_includes.h index 018bba21..340e8a91 100644 --- a/src/lib/openmj2/opj_includes.h +++ b/src/lib/openmj2/opj_includes.h @@ -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. * @@ -61,49 +61,50 @@ /* Ignore GCC attributes if this is not GCC */ #ifndef __GNUC__ - #define __attribute__(x) /* __attribute__(x) */ +#define __attribute__(x) /* __attribute__(x) */ #endif /* -The inline keyword is supported by C99 but not by C90. -Most compilers implement their own version of this keyword ... +The inline keyword is supported by C99 but not by C90. +Most compilers implement their own version of this keyword ... */ #ifndef INLINE - #if defined(_MSC_VER) - #define INLINE __forceinline - #elif defined(__GNUC__) - #define INLINE __inline__ - #elif defined(__MWERKS__) - #define INLINE inline - #else - /* add other compilers here ... */ - #define INLINE - #endif /* defined() */ +#if defined(_MSC_VER) +#define INLINE __forceinline +#elif defined(__GNUC__) +#define INLINE __inline__ +#elif defined(__MWERKS__) +#define INLINE inline +#else +/* add other compilers here ... */ +#define INLINE +#endif /* defined() */ #endif /* INLINE */ /* Are restricted pointers available? (C99) */ #if (__STDC_VERSION__ != 199901L) - /* Not a C99 compiler */ - #ifdef __GNUC__ - #define restrict __restrict__ - #else - #define restrict /* restrict */ - #endif +/* Not a C99 compiler */ +#ifdef __GNUC__ +#define restrict __restrict__ +#else +#define restrict /* restrict */ +#endif #endif /* MSVC and Borland C do not have lrintf */ #if defined(_MSC_VER) || defined(__BORLANDC__) -static INLINE long lrintf(float f){ +static INLINE long 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; - + _asm{ fld f fistp i }; - + return i; #endif } diff --git a/src/lib/openmj2/opj_malloc.h b/src/lib/openmj2/opj_malloc.h index ffac8961..5149a657 100644 --- a/src/lib/openmj2/opj_malloc.h +++ b/src/lib/openmj2/opj_malloc.h @@ -70,64 +70,65 @@ Allocate memory aligned to a 16 byte boundary */ /* FIXME: These should be set with cmake tests, but we're currently not requiring use of cmake */ #ifdef _WIN32 - /* Someone should tell the mingw people that their malloc.h ought to provide _mm_malloc() */ - #ifdef __GNUC__ - #include - #define HAVE_MM_MALLOC - #else /* MSVC, Intel C++ */ - #include - #ifdef _mm_malloc - #define HAVE_MM_MALLOC - #endif - #endif +/* Someone should tell the mingw people that their malloc.h ought to provide _mm_malloc() */ +#ifdef __GNUC__ +#include +#define HAVE_MM_MALLOC +#else /* MSVC, Intel C++ */ +#include +#ifdef _mm_malloc +#define HAVE_MM_MALLOC +#endif +#endif #else /* Not _WIN32 */ - #if defined(__sun) - #define HAVE_MEMALIGN - #elif defined(__FreeBSD__) - #define HAVE_POSIX_MEMALIGN - /* Linux x86_64 and OSX always align allocations to 16 bytes */ - #elif !defined(__amd64__) && !defined(__APPLE__) && !defined(_AIX) - #define HAVE_MEMALIGN - #include - #endif +#if defined(__sun) +#define HAVE_MEMALIGN +#elif defined(__FreeBSD__) +#define HAVE_POSIX_MEMALIGN +/* Linux x86_64 and OSX always align allocations to 16 bytes */ +#elif !defined(__amd64__) && !defined(__APPLE__) && !defined(_AIX) +#define HAVE_MEMALIGN +#include +#endif #endif #define opj_aligned_malloc(size) malloc(size) #define opj_aligned_free(m) free(m) #ifdef HAVE_MM_MALLOC - #undef opj_aligned_malloc - #define opj_aligned_malloc(size) _mm_malloc(size, 16) - #undef opj_aligned_free - #define opj_aligned_free(m) _mm_free(m) +#undef opj_aligned_malloc +#define opj_aligned_malloc(size) _mm_malloc(size, 16) +#undef opj_aligned_free +#define opj_aligned_free(m) _mm_free(m) #endif #ifdef HAVE_MEMALIGN - extern void* memalign(size_t, size_t); - #undef opj_aligned_malloc - #define opj_aligned_malloc(size) memalign(16, (size)) - #undef opj_aligned_free - #define opj_aligned_free(m) free(m) +extern void* memalign(size_t, size_t); +#undef opj_aligned_malloc +#define opj_aligned_malloc(size) memalign(16, (size)) +#undef opj_aligned_free +#define opj_aligned_free(m) free(m) #endif #ifdef HAVE_POSIX_MEMALIGN - #undef opj_aligned_malloc - extern int posix_memalign(void**, size_t, size_t); +#undef opj_aligned_malloc +extern int posix_memalign(void**, size_t, size_t); - static INLINE void* __attribute__ ((malloc)) opj_aligned_malloc(size_t size){ - void* mem = NULL; - posix_memalign(&mem, 16, size); - return mem; - } - #undef opj_aligned_free - #define opj_aligned_free(m) free(m) +static INLINE void* __attribute__((malloc)) opj_aligned_malloc(size_t size) +{ + void* mem = NULL; + posix_memalign(&mem, 16, size); + return mem; +} +#undef opj_aligned_free +#define opj_aligned_free(m) free(m) #endif #ifdef ALLOC_PERF_OPT - #undef opj_aligned_malloc - #define opj_aligned_malloc(size) opj_malloc(size) - #undef opj_aligned_free - #define opj_aligned_free(m) opj_free(m) +#undef opj_aligned_malloc +#define opj_aligned_malloc(size) opj_malloc(size) +#undef opj_aligned_free +#define opj_aligned_free(m) opj_free(m) #endif /** diff --git a/src/lib/openmj2/pi.h b/src/lib/openmj2/pi.h index 7f2fe3ef..c8976cc3 100644 --- a/src/lib/openmj2/pi.h +++ b/src/lib/openmj2/pi.h @@ -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,54 +53,54 @@ by some function in T2.C. FIXME: documentation */ typedef struct opj_pi_resolution { - int pdx, pdy; - int pw, ph; + int pdx, pdy; + int pw, ph; } opj_pi_resolution_t; /** FIXME: documentation */ typedef struct opj_pi_comp { - int dx, dy; - /** number of resolution levels */ - int numresolutions; - opj_pi_resolution_t *resolutions; + int dx, dy; + /** number of resolution levels */ + int numresolutions; + opj_pi_resolution_t *resolutions; } opj_pi_comp_t; -/** -Packet iterator +/** +Packet iterator */ typedef struct opj_pi_iterator { - /** Enabling Tile part generation*/ - char tp_on; - /** 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; - /** number of components in the image */ - int numcomps; - /** Components*/ - opj_pi_comp_t *comps; - int tx0, ty0, tx1, ty1; - int x, y, dx, dy; + /** Enabling Tile part generation*/ + char tp_on; + /** 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; + /** number of components in the image */ + int numcomps; + /** Components*/ + opj_pi_comp_t *comps; + int tx0, ty0, tx1, ty1; + int x, y, dx, dy; } opj_pi_iterator_t; /** @name Exported functions */ @@ -115,10 +115,11 @@ Create a packet iterator for Encoder @return Returns a packet iterator that points to the first packet of the tile @see pi_destroy */ -opj_pi_iterator_t *pi_initialise_encode(opj_image_t *image, opj_cp_t *cp, int tileno,J2K_T2_MODE t2_mode); +opj_pi_iterator_t *pi_initialise_encode(opj_image_t *image, opj_cp_t *cp, + int tileno, J2K_T2_MODE t2_mode); /** Modify the packet iterator for enabling tile part generation -@param pi Handle to the packet iterator generated in pi_initialise_encode +@param pi Handle to the packet iterator generated in pi_initialise_encode @param cp Coding parameters @param tileno Number that identifies the tile for which to list the packets @param pino Iterator index for pi @@ -126,9 +127,10 @@ 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 If == 0 In Threshold calculation ,If == 1 Final pass @param cur_totnum_tp The total number of tile parts in the current tile -@return Returns true if an error is detected +@return Returns true if an error is detected */ -opj_bool pi_create_encode(opj_pi_iterator_t *pi, opj_cp_t *cp,int tileno, int pino,int tpnum, int tppos, J2K_T2_MODE t2_mode,int cur_totnum_tp); +opj_bool pi_create_encode(opj_pi_iterator_t *pi, opj_cp_t *cp, int tileno, + int pino, int tpnum, int tppos, J2K_T2_MODE t2_mode, int cur_totnum_tp); /** Create a packet iterator for Decoder @param image Raw image for which the packets will be listed @@ -137,7 +139,8 @@ Create a packet iterator for Decoder @return Returns a packet iterator that points to the first packet of the tile @see pi_destroy */ -opj_pi_iterator_t *pi_create_decode(opj_image_t * image, opj_cp_t * cp, int tileno); +opj_pi_iterator_t *pi_create_decode(opj_image_t * image, opj_cp_t * cp, + int tileno); /** Destroy a packet iterator @@ -151,7 +154,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 */ opj_bool pi_next(opj_pi_iterator_t * pi); /* ----------------------------------------------------------------------- */ diff --git a/src/lib/openmj2/raw.h b/src/lib/openmj2/raw.h index 6dbd0553..51655040 100644 --- a/src/lib/openmj2/raw.h +++ b/src/lib/openmj2/raw.h @@ -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 */ - 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 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* raw_create(void); diff --git a/src/lib/openmj2/t1.h b/src/lib/openmj2/t1.h index ac39e45c..79185855 100644 --- a/src/lib/openmj2/t1.h +++ b/src/lib/openmj2/t1.h @@ -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,14 +50,14 @@ in T1.C are used by some function in TCD.C. /* ----------------------------------------------------------------------- */ #define T1_NMSEDEC_BITS 7 -#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) @@ -86,8 +86,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)*/ /* ----------------------------------------------------------------------- */ @@ -97,21 +97,21 @@ typedef short flag_t; 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; + /** MQC component */ + opj_mqc_t *mqc; + /** RAW component */ + opj_raw_t *raw; - int *data; - flag_t *flags; - int w; - int h; - int datasize; - int flagssize; - int flags_stride; + int *data; + flag_t *flags; + int w; + int h; + int datasize; + int flagssize; + int flags_stride; } opj_t1_t; #define MACRO_t1_flags(x,y) t1->flags[((x)*(t1->flags_stride))+(y)] @@ -120,7 +120,7 @@ typedef struct opj_t1 { /*@{*/ /* ----------------------------------------------------------------------- */ /** -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 diff --git a/src/lib/openmj2/t1_luts.h b/src/lib/openmj2/t1_luts.h index e5e33f66..278a594c 100644 --- a/src/lib/openmj2/t1_luts.h +++ b/src/lib/openmj2/t1_luts.h @@ -1,143 +1,143 @@ /* This file was automatically generated by t1_generate_luts.c */ static char 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 char 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 char 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 short lut_nmsedec_sig[1 << 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 short lut_nmsedec_sig0[1 << 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 short lut_nmsedec_ref[1 << 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 short lut_nmsedec_ref0[1 << 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 }; diff --git a/src/lib/openmj2/t2.h b/src/lib/openmj2/t2.h index 2bf5337f..2f1a4e2b 100644 --- a/src/lib/openmj2/t2.h +++ b/src/lib/openmj2/t2.h @@ -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. @@ -49,13 +49,13 @@ Tier-2 coding */ typedef struct opj_t2 { - /** codec context */ - opj_common_ptr cinfo; + /** codec context */ + opj_common_ptr cinfo; - /** 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 */ @@ -70,14 +70,16 @@ Encode the packets of a tile to a destination buffer @param maxlayers maximum number of layers @param dest the destination buffer @param len the length of the destination buffer -@param cstr_info Codestream information structure +@param cstr_info Codestream information structure @param tpnum Tile part number of the current tile @param tppos The position of the tile part flag in the progression order -@param pino +@param pino @param t2_mode If == 0 In Threshold calculation ,If == 1 Final pass @param cur_totnum_tp The total number of tile parts in the current tile */ -int t2_encode_packets(opj_t2_t* t2,int tileno, opj_tcd_tile_t *tile, int maxlayers, unsigned char *dest, int len, opj_codestream_info_t *cstr_info,int tpnum, int tppos,int pino,J2K_T2_MODE t2_mode,int cur_totnum_tp); +int t2_encode_packets(opj_t2_t* t2, int tileno, opj_tcd_tile_t *tile, + int maxlayers, unsigned char *dest, int len, opj_codestream_info_t *cstr_info, + int tpnum, int tppos, int pino, J2K_T2_MODE t2_mode, int cur_totnum_tp); /** Decode the packets of a tile from a source buffer @param t2 T2 handle @@ -87,7 +89,8 @@ Decode the packets of a tile from a source buffer @param tile tile for which to decode the packets @param cstr_info Codestream information structure */ -int t2_decode_packets(opj_t2_t *t2, unsigned char *src, int len, int tileno, opj_tcd_tile_t *tile, opj_codestream_info_t *cstr_info); +int t2_decode_packets(opj_t2_t *t2, unsigned char *src, int len, int tileno, + opj_tcd_tile_t *tile, opj_codestream_info_t *cstr_info); /** Create a T2 handle diff --git a/src/lib/openmj2/tcd.h b/src/lib/openmj2/tcd.h index 339e3b78..f88c1ed3 100644 --- a/src/lib/openmj2/tcd.h +++ b/src/lib/openmj2/tcd.h @@ -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. @@ -51,159 +51,166 @@ each other. The functions in TCD.C are used by some function in J2K.C. FIXME: documentation */ typedef struct opj_tcd_seg { - unsigned char** data; - int dataindex; - int numpasses; - int len; - int maxpasses; - int numnewpasses; - int newlen; + unsigned char** data; + int dataindex; + int numpasses; + int len; + int maxpasses; + int numnewpasses; + int newlen; } opj_tcd_seg_t; /** FIXME: documentation */ typedef struct opj_tcd_pass { - int rate; - double distortiondec; - int term, len; + int rate; + double distortiondec; + int term, len; } opj_tcd_pass_t; /** FIXME: documentation */ typedef struct opj_tcd_layer { - int numpasses; /* Number of passes in the layer */ - int len; /* len of information */ - double disto; /* add for index (Cfr. Marcela) */ - unsigned char *data; /* data */ + int numpasses; /* Number of passes in the layer */ + int len; /* len of information */ + double disto; /* add for index (Cfr. Marcela) */ + unsigned char *data; /* data */ } opj_tcd_layer_t; /** FIXME: documentation */ typedef struct opj_tcd_cblk_enc { - unsigned char* data; /* Data */ - opj_tcd_layer_t* layers; /* layer information */ - opj_tcd_pass_t* passes; /* information about the passes */ - int x0, y0, x1, y1; /* dimension of the code-blocks : left upper corner (x0, y0) right low corner (x1,y1) */ - int numbps; - int numlenbits; - int numpasses; /* number of pass already done for the code-blocks */ - int numpassesinlayers; /* number of passes in the layer */ - int totalpasses; /* total number of passes */ + unsigned char* data; /* Data */ + opj_tcd_layer_t* layers; /* layer information */ + opj_tcd_pass_t* passes; /* information about the passes */ + int x0, y0, x1, + y1; /* dimension of the code-blocks : left upper corner (x0, y0) right low corner (x1,y1) */ + int numbps; + int numlenbits; + int numpasses; /* number of pass already done for the code-blocks */ + int numpassesinlayers; /* number of passes in the layer */ + int totalpasses; /* total number of passes */ } opj_tcd_cblk_enc_t; typedef struct opj_tcd_cblk_dec { - unsigned char* data; /* Data */ - opj_tcd_seg_t* segs; /* segments informations */ - int x0, y0, x1, y1; /* dimension of the code-blocks : left upper corner (x0, y0) right low corner (x1,y1) */ - int numbps; - int numlenbits; - int len; /* length */ - int numnewpasses; /* number of pass added to the code-blocks */ - int numsegs; /* number of segments */ + unsigned char* data; /* Data */ + opj_tcd_seg_t* segs; /* segments informations */ + int x0, y0, x1, + y1; /* dimension of the code-blocks : left upper corner (x0, y0) right low corner (x1,y1) */ + int numbps; + int numlenbits; + int len; /* length */ + int numnewpasses; /* number of pass added to the code-blocks */ + int numsegs; /* number of segments */ } opj_tcd_cblk_dec_t; /** FIXME: documentation */ typedef struct opj_tcd_precinct { - int x0, y0, x1, y1; /* dimension of the precinct : left upper corner (x0, y0) right low corner (x1,y1) */ - int cw, ch; /* number of precinct in width and heigth */ - union{ /* code-blocks informations */ - opj_tcd_cblk_enc_t* enc; - opj_tcd_cblk_dec_t* dec; - } cblks; - opj_tgt_tree_t *incltree; /* inclusion tree */ - opj_tgt_tree_t *imsbtree; /* IMSB tree */ + int x0, y0, x1, + y1; /* dimension of the precinct : left upper corner (x0, y0) right low corner (x1,y1) */ + int cw, ch; /* number of precinct in width and heigth */ + union { /* code-blocks informations */ + opj_tcd_cblk_enc_t* enc; + opj_tcd_cblk_dec_t* dec; + } cblks; + opj_tgt_tree_t *incltree; /* inclusion tree */ + opj_tgt_tree_t *imsbtree; /* IMSB tree */ } opj_tcd_precinct_t; /** FIXME: documentation */ typedef struct opj_tcd_band { - int x0, y0, x1, y1; /* dimension of the subband : left upper corner (x0, y0) right low corner (x1,y1) */ - int bandno; - opj_tcd_precinct_t *precincts; /* precinct information */ - int numbps; - float stepsize; + int x0, y0, x1, + y1; /* dimension of the subband : left upper corner (x0, y0) right low corner (x1,y1) */ + int bandno; + opj_tcd_precinct_t *precincts; /* precinct information */ + int numbps; + float stepsize; } opj_tcd_band_t; /** FIXME: documentation */ typedef struct opj_tcd_resolution { - int x0, y0, x1, y1; /* dimension of the resolution level : left upper corner (x0, y0) right low corner (x1,y1) */ - int pw, ph; - int numbands; /* number sub-band for the resolution level */ - opj_tcd_band_t bands[3]; /* subband information */ + int x0, y0, x1, + y1; /* dimension of the resolution level : left upper corner (x0, y0) right low corner (x1,y1) */ + int pw, ph; + int numbands; /* number sub-band for the resolution level */ + opj_tcd_band_t bands[3]; /* subband information */ } opj_tcd_resolution_t; /** FIXME: documentation */ typedef struct opj_tcd_tilecomp { - int x0, y0, x1, y1; /* dimension of component : left upper corner (x0, y0) right low corner (x1,y1) */ - int numresolutions; /* number of resolutions level */ - opj_tcd_resolution_t *resolutions; /* resolutions information */ - int *data; /* data of the component */ - int numpix; /* add fixed_quality */ + int x0, y0, x1, + y1; /* dimension of component : left upper corner (x0, y0) right low corner (x1,y1) */ + int numresolutions; /* number of resolutions level */ + opj_tcd_resolution_t *resolutions; /* resolutions information */ + int *data; /* data of the component */ + int numpix; /* add fixed_quality */ } opj_tcd_tilecomp_t; /** FIXME: documentation */ typedef struct opj_tcd_tile { - int x0, y0, x1, y1; /* dimension of the tile : left upper corner (x0, y0) right low corner (x1,y1) */ - int numcomps; /* number of components in tile */ - opj_tcd_tilecomp_t *comps; /* Components information */ - int numpix; /* add fixed_quality */ - double distotile; /* add fixed_quality */ - double distolayer[100]; /* add fixed_quality */ - /** packet number */ - int packno; + int x0, y0, x1, + y1; /* dimension of the tile : left upper corner (x0, y0) right low corner (x1,y1) */ + int numcomps; /* number of components in tile */ + opj_tcd_tilecomp_t *comps; /* Components information */ + int numpix; /* add fixed_quality */ + double distotile; /* add fixed_quality */ + double distolayer[100]; /* add fixed_quality */ + /** packet number */ + int packno; } opj_tcd_tile_t; /** FIXME: documentation */ typedef struct opj_tcd_image { - int tw, th; /* number of tiles in width and heigth */ - opj_tcd_tile_t *tiles; /* Tiles information */ + int tw, th; /* number of tiles in width and heigth */ + opj_tcd_tile_t *tiles; /* Tiles information */ } opj_tcd_image_t; /** Tile coder/decoder */ typedef struct opj_tcd { - /** Position of the tilepart flag in Progression order*/ - int tp_pos; - /** Tile part number*/ - int tp_num; - /** Current tile part number*/ - int cur_tp_num; - /** Total number of tileparts of the current tile*/ - int cur_totnum_tp; - /** Current Packet iterator number */ - int cur_pino; - /** codec context */ - opj_common_ptr cinfo; + /** Position of the tilepart flag in Progression order*/ + int tp_pos; + /** Tile part number*/ + int tp_num; + /** Current tile part number*/ + int cur_tp_num; + /** Total number of tileparts of the current tile*/ + int cur_totnum_tp; + /** Current Packet iterator number */ + int cur_pino; + /** codec context */ + opj_common_ptr cinfo; - /** info on each image tile */ - opj_tcd_image_t *tcd_image; - /** image */ - opj_image_t *image; - /** coding parameters */ - opj_cp_t *cp; - /** pointer to the current encoded/decoded tile */ - opj_tcd_tile_t *tcd_tile; - /** coding/decoding parameters common to all tiles */ - opj_tcp_t *tcp; - /** current encoded/decoded tile */ - int tcd_tileno; - /** Time taken to encode a tile*/ - double encoding_time; + /** info on each image tile */ + opj_tcd_image_t *tcd_image; + /** image */ + opj_image_t *image; + /** coding parameters */ + opj_cp_t *cp; + /** pointer to the current encoded/decoded tile */ + opj_tcd_tile_t *tcd_tile; + /** coding/decoding parameters common to all tiles */ + opj_tcp_t *tcp; + /** current encoded/decoded tile */ + int tcd_tileno; + /** Time taken to encode a tile*/ + double encoding_time; } opj_tcd_t; /** @name Exported functions */ @@ -232,7 +239,8 @@ Initialize the tile coder (allocate the memory) @param cp Coding parameters @param curtileno Number that identifies the tile that will be encoded */ -void tcd_malloc_encode(opj_tcd_t *tcd, opj_image_t * image, opj_cp_t * cp, int curtileno); +void tcd_malloc_encode(opj_tcd_t *tcd, opj_image_t * image, opj_cp_t * cp, + int curtileno); /** Free the memory allocated for encoding @param tcd TCD handle @@ -245,7 +253,8 @@ Initialize the tile coder (reuses the memory allocated by tcd_malloc_encode) @param cp Coding parameters @param curtileno Number that identifies the tile that will be encoded */ -void tcd_init_encode(opj_tcd_t *tcd, opj_image_t * image, opj_cp_t * cp, int curtileno); +void tcd_init_encode(opj_tcd_t *tcd, opj_image_t * image, opj_cp_t * cp, + int curtileno); /** Initialize the tile decoder @param tcd TCD handle @@ -253,21 +262,24 @@ Initialize the tile decoder @param cp Coding parameters */ void tcd_malloc_decode(opj_tcd_t *tcd, opj_image_t * image, opj_cp_t * cp); -void tcd_malloc_decode_tile(opj_tcd_t *tcd, opj_image_t * image, opj_cp_t * cp, int tileno, opj_codestream_info_t *cstr_info); +void tcd_malloc_decode_tile(opj_tcd_t *tcd, opj_image_t * image, opj_cp_t * cp, + int tileno, opj_codestream_info_t *cstr_info); 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); -opj_bool tcd_rateallocate(opj_tcd_t *tcd, unsigned char *dest, int len, opj_codestream_info_t *cstr_info); +opj_bool tcd_rateallocate(opj_tcd_t *tcd, unsigned char *dest, int len, + opj_codestream_info_t *cstr_info); /** Encode a tile from the raw image into a buffer @param tcd TCD handle @param tileno Number that identifies one of the tiles to be encoded @param dest Destination buffer @param len Length of destination buffer -@param cstr_info Codestream information structure -@return +@param cstr_info Codestream information structure +@return */ -int tcd_encode_tile(opj_tcd_t *tcd, int tileno, unsigned char *dest, int len, opj_codestream_info_t *cstr_info); +int tcd_encode_tile(opj_tcd_t *tcd, int tileno, unsigned char *dest, int len, + opj_codestream_info_t *cstr_info); /** Decode a tile from a buffer into a raw image @param tcd TCD handle @@ -276,7 +288,8 @@ Decode a tile from a buffer into a raw image @param tileno Number that identifies one of the tiles to be decoded @param cstr_info Codestream information structure */ -opj_bool tcd_decode_tile(opj_tcd_t *tcd, unsigned char *src, int len, int tileno, opj_codestream_info_t *cstr_info); +opj_bool tcd_decode_tile(opj_tcd_t *tcd, unsigned char *src, int len, + int tileno, opj_codestream_info_t *cstr_info); /** Free the memory allocated for decoding @param tcd TCD handle diff --git a/src/lib/openmj2/tgt.h b/src/lib/openmj2/tgt.h index d0eb42dc..0a299449 100644 --- a/src/lib/openmj2/tgt.h +++ b/src/lib/openmj2/tgt.h @@ -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. @@ -52,20 +52,20 @@ are used by some function in T2.C. Tag node */ typedef struct opj_tgt_node { - struct opj_tgt_node *parent; - int value; - int low; - int known; + struct opj_tgt_node *parent; + int value; + int low; + int known; } opj_tgt_node_t; /** Tag tree */ typedef struct opj_tgt_tree { - int numleafsh; - int numleafsv; - int numnodes; - opj_tgt_node_t *nodes; + int numleafsh; + int numleafsv; + int numnodes; + opj_tgt_node_t *nodes; } opj_tgt_tree_t; /** @name Exported functions */ @@ -102,7 +102,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