# 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
/*
- * The 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, 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.
/*
- * The 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, 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.
#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;
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_ */
/* 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 */
/*
- * The 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, 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.
/**@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 */
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 */
/* 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 */
/*
- * The 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.
*
/**
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
*/
/*
* 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
* 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.
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
- *
- *
+ *
+ *
* May 28 1998, Toni Ronkko <tronkko@messi.uku.fi>
*
* $Id: uce-dirent.h,v 1.7 2002/05/13 10:48:35 tr Exp $
* 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.
*/
#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 */
#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)
# error "missing native dirent interface"
# endif
- /*** WIN32 specifics ***/
+/*** WIN32 specifics ***/
# if defined(DIRENT_WIN32_INTERFACE)
# include <windows.h>
# if !defined(DIRENT_MAXNAMLEN)
# endif
- /*** MS-DOS specifics ***/
+/*** MS-DOS specifics ***/
# elif defined(DIRENT_MSDOS_INTERFACE)
# include <dos.h>
- /* Borland defines file length macros in dir.h */
+/* Borland defines file length macros in dir.h */
# if defined(__BORLANDC__)
# include <dir.h>
# if !defined(DIRENT_MAXNAMLEN)
# define _find_t find_t
# endif
- /* Turbo C defines ffblk structure in dir.h */
+/* Turbo C defines ffblk structure in dir.h */
# elif defined(__TURBOC__)
# include <dir.h>
# if !defined(DIRENT_MAXNAMLEN)
# 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__)
# 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
# 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 ***/
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
# define _dos_findfirst(name,flags,dest) findfirst(name,dest,flags)
#endif
-static int _initdir (DIR *p);
-static const char *_getdirname (const struct dirent *dp);
-static void _setdirname (struct DIR *dirp);
+static int _initdir(DIR *p);
+static const char *_getdirname(const struct dirent *dp);
+static void _setdirname(struct DIR *dirp);
/*
* <function name="opendir">
* internal working area that is used for retrieving individual directory
* entries. The internal working area has no fields of your interest.
*
- * <ret>Returns a pointer to the internal working area or NULL in case the
+ * <ret>Returns a pointer to the internal working area or NULL in case the
* directory stream could not be opened. Global `errno' variable will set
* in case of error as follows:
*
*/
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;
}
* </function>
*/
static struct dirent *
-readdir (DIR *dirp)
+readdir(DIR *dirp)
{
- assert(dirp != NULL);
- if (dirp == NULL) {
- errno = EBADF;
- return NULL;
- }
+ assert(dirp != NULL);
+ if (dirp == NULL) {
+ errno = EBADF;
+ return NULL;
+ }
#if defined(DIRENT_WIN32_INTERFACE)
- if (dirp->search_handle == INVALID_HANDLE_VALUE) {
- /* directory stream was opened/rewound incorrectly or it ended normally */
- errno = EBADF;
- return NULL;
- }
+ if (dirp->search_handle == INVALID_HANDLE_VALUE) {
+ /* directory stream was opened/rewound incorrectly or it ended normally */
+ errno = EBADF;
+ return NULL;
+ }
#endif
- if (dirp->dirent_filled != 0) {
- /*
- * Directory entry has already been retrieved and there is no need to
- * retrieve a new one. Directory entry will be retrieved in advance
- * when the user calls readdir function for the first time. This is so
- * because real dirent has separate functions for opening and reading
- * the stream whereas Win32 and DOS dirents open the stream
- * automatically when we retrieve the first file. Therefore, we have to
- * save the first file when opening the stream and later we have to
- * return the saved entry when the user tries to read the first entry.
- */
- dirp->dirent_filled = 0;
- } else {
- /* fill in entry and return that */
+ if (dirp->dirent_filled != 0) {
+ /*
+ * Directory entry has already been retrieved and there is no need to
+ * retrieve a new one. Directory entry will be retrieved in advance
+ * when the user calls readdir function for the first time. This is so
+ * because real dirent has separate functions for opening and reading
+ * the stream whereas Win32 and DOS dirents open the stream
+ * automatically when we retrieve the first file. Therefore, we have to
+ * save the first file when opening the stream and later we have to
+ * return the saved entry when the user tries to read the first entry.
+ */
+ dirp->dirent_filled = 0;
+ } else {
+ /* fill in entry and return that */
#if defined(DIRENT_WIN32_INTERFACE)
- if (FindNextFile (dirp->search_handle, &dirp->current.data) == FALSE) {
- /* Last file has been processed or an error occurred */
- FindClose (dirp->search_handle);
- dirp->search_handle = INVALID_HANDLE_VALUE;
- errno = ENOENT;
- return NULL;
- }
+ if (FindNextFile(dirp->search_handle, &dirp->current.data) == FALSE) {
+ /* Last file has been processed or an error occurred */
+ FindClose(dirp->search_handle);
+ dirp->search_handle = INVALID_HANDLE_VALUE;
+ errno = ENOENT;
+ return NULL;
+ }
# elif defined(DIRENT_MSDOS_INTERFACE)
- if (_dos_findnext (&dirp->current.data) != 0) {
- /* _dos_findnext and findnext will set errno to ENOENT when no
- * more entries could be retrieved. */
- return NULL;
- }
+ if (_dos_findnext(&dirp->current.data) != 0) {
+ /* _dos_findnext and findnext will set errno to ENOENT when no
+ * more entries could be retrieved. */
+ return NULL;
+ }
# endif
- _setdirname (dirp);
- assert (dirp->dirent_filled == 0);
- }
- return &dirp->current;
+ _setdirname(dirp);
+ assert(dirp->dirent_filled == 0);
+ }
+ return &dirp->current;
}
* </function>
*/
static int
-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);
+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);
+ }
#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;
}
* 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 */
+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;
+ 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*/;
+ }
}
* 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;
}
* 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
}
* 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
-/*\r
- * Copyright (c) 2001-2003, David Janssens\r
- * Copyright (c) 2002-2003, Yannick Verschueren\r
- * Copyright (c) 2003-2005, Francois Devaux and Antonin Descampe\r
- * Copyright (c) 2005, Herve Drolon, FreeImage Team\r
- * Copyright (c) 2002-2005, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium\r
- * Copyright (c) 2006, Mónica DÃez GarcÃa, Image Processing Laboratory, University of Valladolid, Spain\r
- * All rights reserved.\r
- *\r
- * Redistribution and use in source and binary forms, with or without\r
- * modification, are permitted provided that the following conditions\r
- * are met:\r
- * 1. Redistributions of source code must retain the above copyright\r
- * notice, this list of conditions and the following disclaimer.\r
- * 2. Redistributions in binary form must reproduce the above copyright\r
- * notice, this list of conditions and the following disclaimer in the\r
- * documentation and/or other materials provided with the distribution.\r
- *\r
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'\r
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\r
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r
- * POSSIBILITY OF SUCH DAMAGE.\r
- */\r
-#ifndef __JP3D_CONVERT_H\r
-#define __JP3D_CONVERT_H\r
-\r
-/**\r
-Load a single volume component encoded in PGX file format\r
-@param filename Name of the PGX file to load\r
-@param parameters *List ?*\r
-@return Returns a greyscale volume if successful, returns NULL otherwise\r
-*/\r
-opj_volume_t* pgxtovolume(char *filename, opj_cparameters_t *parameters);\r
-\r
-int volumetopgx(opj_volume_t *volume, char *outfile);\r
-\r
-opj_volume_t* bintovolume(char *filename,char *fileimg, opj_cparameters_t *parameters);\r
-\r
-int volumetobin(opj_volume_t *volume, char *outfile);\r
-\r
-opj_volume_t* imgtovolume(char *fileimg, opj_cparameters_t *parameters);\r
-\r
-#endif /* __J2K_CONVERT_H */\r
-\r
+/*
+ * 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 */
+
-/* last review : october 29th, 2002 */\r
-\r
-#ifndef _GETOPT_H_\r
-#define _GETOPT_H_\r
-\r
-extern int opterr;\r
-extern int optind;\r
-extern int optopt;\r
-extern int optreset;\r
-extern char *optarg;\r
-\r
-extern int getopt(int nargc, char *const *nargv, const char *ostr);\r
-\r
-#endif /* _GETOPT_H_ */\r
+/* 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_ */
/*
* 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
* 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.
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
- *
- *
+ *
+ *
* May 28 1998, Toni Ronkko <tronkko@messi.uku.fi>
*
* $Id: uce-dirent.h,v 1.7 2002/05/13 10:48:35 tr Exp $
* 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.
*/
#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 */
#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)
# error "missing native dirent interface"
# endif
- /*** WIN32 specifics ***/
+/*** WIN32 specifics ***/
# if defined(DIRENT_WIN32_INTERFACE)
# include <windows.h>
# if !defined(DIRENT_MAXNAMLEN)
# endif
- /*** MS-DOS specifics ***/
+/*** MS-DOS specifics ***/
# elif defined(DIRENT_MSDOS_INTERFACE)
# include <dos.h>
- /* Borland defines file length macros in dir.h */
+/* Borland defines file length macros in dir.h */
# if defined(__BORLANDC__)
# include <dir.h>
# if !defined(DIRENT_MAXNAMLEN)
# define _find_t find_t
# endif
- /* Turbo C defines ffblk structure in dir.h */
+/* Turbo C defines ffblk structure in dir.h */
# elif defined(__TURBOC__)
# include <dir.h>
# if !defined(DIRENT_MAXNAMLEN)
# 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__)
# 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
# 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 ***/
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
# define _dos_findfirst(name,flags,dest) findfirst(name,dest,flags)
#endif
-static int _initdir (DIR *p);
-static const char *_getdirname (const struct dirent *dp);
-static void _setdirname (struct DIR *dirp);
+static int _initdir(DIR *p);
+static const char *_getdirname(const struct dirent *dp);
+static void _setdirname(struct DIR *dirp);
/*
* <function name="opendir">
* internal working area that is used for retrieving individual directory
* entries. The internal working area has no fields of your interest.
*
- * <ret>Returns a pointer to the internal working area or NULL in case the
+ * <ret>Returns a pointer to the internal working area or NULL in case the
* directory stream could not be opened. Global `errno' variable will set
* in case of error as follows:
*
*/
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;
}
* </function>
*/
static struct dirent *
-readdir (DIR *dirp)
+readdir(DIR *dirp)
{
- assert(dirp != NULL);
- if (dirp == NULL) {
- errno = EBADF;
- return NULL;
- }
+ assert(dirp != NULL);
+ if (dirp == NULL) {
+ errno = EBADF;
+ return NULL;
+ }
#if defined(DIRENT_WIN32_INTERFACE)
- if (dirp->search_handle == INVALID_HANDLE_VALUE) {
- /* directory stream was opened/rewound incorrectly or it ended normally */
- errno = EBADF;
- return NULL;
- }
+ if (dirp->search_handle == INVALID_HANDLE_VALUE) {
+ /* directory stream was opened/rewound incorrectly or it ended normally */
+ errno = EBADF;
+ return NULL;
+ }
#endif
- if (dirp->dirent_filled != 0) {
- /*
- * Directory entry has already been retrieved and there is no need to
- * retrieve a new one. Directory entry will be retrieved in advance
- * when the user calls readdir function for the first time. This is so
- * because real dirent has separate functions for opening and reading
- * the stream whereas Win32 and DOS dirents open the stream
- * automatically when we retrieve the first file. Therefore, we have to
- * save the first file when opening the stream and later we have to
- * return the saved entry when the user tries to read the first entry.
- */
- dirp->dirent_filled = 0;
- } else {
- /* fill in entry and return that */
+ if (dirp->dirent_filled != 0) {
+ /*
+ * Directory entry has already been retrieved and there is no need to
+ * retrieve a new one. Directory entry will be retrieved in advance
+ * when the user calls readdir function for the first time. This is so
+ * because real dirent has separate functions for opening and reading
+ * the stream whereas Win32 and DOS dirents open the stream
+ * automatically when we retrieve the first file. Therefore, we have to
+ * save the first file when opening the stream and later we have to
+ * return the saved entry when the user tries to read the first entry.
+ */
+ dirp->dirent_filled = 0;
+ } else {
+ /* fill in entry and return that */
#if defined(DIRENT_WIN32_INTERFACE)
- if (FindNextFile (dirp->search_handle, &dirp->current.data) == FALSE) {
- /* Last file has been processed or an error occurred */
- FindClose (dirp->search_handle);
- dirp->search_handle = INVALID_HANDLE_VALUE;
- errno = ENOENT;
- return NULL;
- }
+ if (FindNextFile(dirp->search_handle, &dirp->current.data) == FALSE) {
+ /* Last file has been processed or an error occurred */
+ FindClose(dirp->search_handle);
+ dirp->search_handle = INVALID_HANDLE_VALUE;
+ errno = ENOENT;
+ return NULL;
+ }
# elif defined(DIRENT_MSDOS_INTERFACE)
- if (_dos_findnext (&dirp->current.data) != 0) {
- /* _dos_findnext and findnext will set errno to ENOENT when no
- * more entries could be retrieved. */
- return NULL;
- }
+ if (_dos_findnext(&dirp->current.data) != 0) {
+ /* _dos_findnext and findnext will set errno to ENOENT when no
+ * more entries could be retrieved. */
+ return NULL;
+ }
# endif
- _setdirname (dirp);
- assert (dirp->dirent_filled == 0);
- }
- return &dirp->current;
+ _setdirname(dirp);
+ assert(dirp->dirent_filled == 0);
+ }
+ return &dirp->current;
}
* </function>
*/
static int
-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);
+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);
+ }
#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;
}
* 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 */
+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;
+ 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*/;
+ }
}
* 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;
}
* 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
}
* 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
/*
- * The 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, 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.
/**@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 */
/* 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 */
/*
- * The 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.
*
/**
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
*/
/*
* 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
* 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.
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
- *
- *
+ *
+ *
* May 28 1998, Toni Ronkko <tronkko@messi.uku.fi>
*
* $Id: uce-dirent.h,v 1.7 2002/05/13 10:48:35 tr Exp $
* 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.
*/
#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 */
#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)
# error "missing native dirent interface"
# endif
- /*** WIN32 specifics ***/
+/*** WIN32 specifics ***/
# if defined(DIRENT_WIN32_INTERFACE)
# include <windows.h>
# if !defined(DIRENT_MAXNAMLEN)
# endif
- /*** MS-DOS specifics ***/
+/*** MS-DOS specifics ***/
# elif defined(DIRENT_MSDOS_INTERFACE)
# include <dos.h>
- /* Borland defines file length macros in dir.h */
+/* Borland defines file length macros in dir.h */
# if defined(__BORLANDC__)
# include <dir.h>
# if !defined(DIRENT_MAXNAMLEN)
# define _find_t find_t
# endif
- /* Turbo C defines ffblk structure in dir.h */
+/* Turbo C defines ffblk structure in dir.h */
# elif defined(__TURBOC__)
# include <dir.h>
# if !defined(DIRENT_MAXNAMLEN)
# 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__)
# 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
# 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 ***/
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
# define _dos_findfirst(name,flags,dest) findfirst(name,dest,flags)
#endif
-static int _initdir (DIR *p);
-static const char *_getdirname (const struct dirent *dp);
-static void _setdirname (struct DIR *dirp);
+static int _initdir(DIR *p);
+static const char *_getdirname(const struct dirent *dp);
+static void _setdirname(struct DIR *dirp);
/*
* <function name="opendir">
* internal working area that is used for retrieving individual directory
* entries. The internal working area has no fields of your interest.
*
- * <ret>Returns a pointer to the internal working area or NULL in case the
+ * <ret>Returns a pointer to the internal working area or NULL in case the
* directory stream could not be opened. Global `errno' variable will set
* in case of error as follows:
*
*/
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;
}
* </function>
*/
static struct dirent *
-readdir (DIR *dirp)
+readdir(DIR *dirp)
{
- assert(dirp != NULL);
- if (dirp == NULL) {
- errno = EBADF;
- return NULL;
- }
+ assert(dirp != NULL);
+ if (dirp == NULL) {
+ errno = EBADF;
+ return NULL;
+ }
#if defined(DIRENT_WIN32_INTERFACE)
- if (dirp->search_handle == INVALID_HANDLE_VALUE) {
- /* directory stream was opened/rewound incorrectly or it ended normally */
- errno = EBADF;
- return NULL;
- }
+ if (dirp->search_handle == INVALID_HANDLE_VALUE) {
+ /* directory stream was opened/rewound incorrectly or it ended normally */
+ errno = EBADF;
+ return NULL;
+ }
#endif
- if (dirp->dirent_filled != 0) {
- /*
- * Directory entry has already been retrieved and there is no need to
- * retrieve a new one. Directory entry will be retrieved in advance
- * when the user calls readdir function for the first time. This is so
- * because real dirent has separate functions for opening and reading
- * the stream whereas Win32 and DOS dirents open the stream
- * automatically when we retrieve the first file. Therefore, we have to
- * save the first file when opening the stream and later we have to
- * return the saved entry when the user tries to read the first entry.
- */
- dirp->dirent_filled = 0;
- } else {
- /* fill in entry and return that */
+ if (dirp->dirent_filled != 0) {
+ /*
+ * Directory entry has already been retrieved and there is no need to
+ * retrieve a new one. Directory entry will be retrieved in advance
+ * when the user calls readdir function for the first time. This is so
+ * because real dirent has separate functions for opening and reading
+ * the stream whereas Win32 and DOS dirents open the stream
+ * automatically when we retrieve the first file. Therefore, we have to
+ * save the first file when opening the stream and later we have to
+ * return the saved entry when the user tries to read the first entry.
+ */
+ dirp->dirent_filled = 0;
+ } else {
+ /* fill in entry and return that */
#if defined(DIRENT_WIN32_INTERFACE)
- if (FindNextFile (dirp->search_handle, &dirp->current.data) == FALSE) {
- /* Last file has been processed or an error occurred */
- FindClose (dirp->search_handle);
- dirp->search_handle = INVALID_HANDLE_VALUE;
- errno = ENOENT;
- return NULL;
- }
+ if (FindNextFile(dirp->search_handle, &dirp->current.data) == FALSE) {
+ /* Last file has been processed or an error occurred */
+ FindClose(dirp->search_handle);
+ dirp->search_handle = INVALID_HANDLE_VALUE;
+ errno = ENOENT;
+ return NULL;
+ }
# elif defined(DIRENT_MSDOS_INTERFACE)
- if (_dos_findnext (&dirp->current.data) != 0) {
- /* _dos_findnext and findnext will set errno to ENOENT when no
- * more entries could be retrieved. */
- return NULL;
- }
+ if (_dos_findnext(&dirp->current.data) != 0) {
+ /* _dos_findnext and findnext will set errno to ENOENT when no
+ * more entries could be retrieved. */
+ return NULL;
+ }
# endif
- _setdirname (dirp);
- assert (dirp->dirent_filled == 0);
- }
- return &dirp->current;
+ _setdirname(dirp);
+ assert(dirp->dirent_filled == 0);
+ }
+ return &dirp->current;
}
* </function>
*/
static int
-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);
+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);
+ }
#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;
}
* 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 */
+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;
+ 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*/;
+ }
}
* 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;
}
* 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
}
* 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
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);
/*
- * The 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.
*
#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__
//////////////////////////////////
class OPJViewerApp: public wxApp
{
- // public methods and variables
- public:
-
- // class constructor
- OPJViewerApp() { m_showImages = true; m_showButtons = false; }
+ // public methods and variables
+public:
- // 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);
+ // 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);
- // 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;
-
- // 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;
+ 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;
#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;
};
///////////////////////////////////////////
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()
};
///////////////////////////////////////////////////
///////////////////////////////////////////////////
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,
};
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);
/*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);*/
};
// 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));
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);
-
- OPJMarkerTreeHash m_treehash;
- OPJChildFrameHash m_childhash;
+ 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;
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);
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_BROWSEWIN = 10000,
- OPJFRAME_LOGWIN,
- OPJFRAME_TOOLBAR,
-
- OPJFRAME_THREADLOGMSG,
- OPJCANVAS_THREADSIGNAL
+ 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_THREADLOGMSG,
+ OPJCANVAS_THREADSIGNAL
};
// menu and control ids
-enum
-{
+enum {
TreeTest_Quit = wxID_EXIT,
TreeTest_About = wxID_ABOUT,
TreeTest_TogButtons = wxID_HIGHEST,
TreeTest_Unselect,
TreeTest_SelectRoot,
TreeTest_Ctrl = 1000,
- BOTTOM_NOTEBOOK_ID,
- LEFT_NOTEBOOK_ID
+ BOTTOM_NOTEBOOK_ID,
+ LEFT_NOTEBOOK_ID
};
class OPJEncoThread : public wxThread
// 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);
};
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:
// 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__
wxString htmlaboutpage = wxT(
-"<html>"
-"<body bgcolor=#FFFFFF>"
-"<table cellspacing=7 cellpadding=1 border=0 width=100%>"
-"<tr>"
-"<td rowspan=3 valign=top align=center width=70>"
-"<img src=\"memory:opj_logo.xpm\"><br><br>"
-"</td>"
-"<td align=center>"
-"<font size=+0 color=#000000><b>"
-OPJ_APPLICATION " " OPJ_APPLICATION_VERSION
-"</b></font><br>"
-"<font size=-1 color=#000000><b>A JPEG 2000 image viewer</b></font><br>"
-"<font size=-2 color=#000000><b>" OPJ_APPLICATION_PLATFORM " version</b></font>"
-"</td>"
-"</tr>"
-"<tr height=3 valign=center>"
-"<td valign=center bgcolor=#cc3300></td>"
-"</tr>"
-"<tr>"
-"<td align=justify>"
-"<center><font size=+0 color=#000000><a href=\"http://www.openjpeg.org/\">OpenJPEG</a></font></center>"
-"<p><font size=-1 color=#000000>The OpenJPEG library is an open-source JPEG 2000 codec written in C language. "
-"In addition to the basic codec, various other features are under development.</font></p><br>"
-"<font size=-2 color=red>* Build: ")
+ "<html>"
+ "<body bgcolor=#FFFFFF>"
+ "<table cellspacing=7 cellpadding=1 border=0 width=100%>"
+ "<tr>"
+ "<td rowspan=3 valign=top align=center width=70>"
+ "<img src=\"memory:opj_logo.xpm\"><br><br>"
+ "</td>"
+ "<td align=center>"
+ "<font size=+0 color=#000000><b>"
+ OPJ_APPLICATION " " OPJ_APPLICATION_VERSION
+ "</b></font><br>"
+ "<font size=-1 color=#000000><b>A JPEG 2000 image viewer</b></font><br>"
+ "<font size=-2 color=#000000><b>" OPJ_APPLICATION_PLATFORM " version</b></font>"
+ "</td>"
+ "</tr>"
+ "<tr height=3 valign=center>"
+ "<td valign=center bgcolor=#cc3300></td>"
+ "</tr>"
+ "<tr>"
+ "<td align=justify>"
+ "<center><font size=+0 color=#000000><a href=\"http://www.openjpeg.org/\">OpenJPEG</a></font></center>"
+ "<p><font size=-1 color=#000000>The OpenJPEG library is an open-source JPEG 2000 codec written in C language. "
+ "In addition to the basic codec, various other features are under development.</font></p><br>"
+ "<font size=-2 color=red>* Build: ")
#include "build.h"
-wxT(", " __DATE__ ", " __TIME__ "</font><br>")
-wxT("<font size=-2 color=red>* " wxVERSION_STRING "</font><br>")
-wxT("<font size=-2 color=red>* OpenJPEG " OPENJPEG_VERSION " (")
+ wxT(", " __DATE__ ", " __TIME__ "</font><br>")
+ wxT("<font size=-2 color=red>* " wxVERSION_STRING "</font><br>")
+ wxT("<font size=-2 color=red>* OpenJPEG " OPENJPEG_VERSION " (")
#ifdef USE_JPWL
-wxT("<font size=-2 color=green>JPWL</font> ")
+ wxT("<font size=-2 color=green>JPWL</font> ")
#endif // USE_JPWL
#ifdef USE_JPSEC
-wxT("<font size=-2 color=green>JPSEC</font> ")
+ wxT("<font size=-2 color=green>JPSEC</font> ")
#endif // USE_JPSEC
-wxT(")</font><br>")
+ wxT(")</font><br>")
#ifdef USE_MXF
-wxT("<font size=-2 color=red>* MXFLib " MXFLIB_VERSION_MAJOR "." MXFLIB_VERSION_MINOR "." MXFLIB_VERSION_TWEAK " (" MXFLIB_VERSION_BUILD ")</font><br>")
+ wxT("<font size=-2 color=red>* MXFLib " MXFLIB_VERSION_MAJOR "."
+ MXFLIB_VERSION_MINOR "." MXFLIB_VERSION_TWEAK " (" MXFLIB_VERSION_BUILD
+ ")</font><br>")
#endif // USE_MXF
-wxT("</td>"
-"</tr>"
-"<tr>"
-"<td colspan=2 bgcolor=#CC3300 height=3 valign=center></td>"
-"</tr>"
-"<tr>"
-"<td colspan=2>"
-"<font size=-2 color=#444444>OpenJPEG is © 2002-2008 <a href=\"http://www.tele.ucl.ac.be/\">TELE</a> - <a href=\"http://www.uclouvain.be/\">Universite' Catholique de Louvain</a></font><br>"
-"<font size=-2 color=#444444>OPJViewer is © 2007-2008 <a href=\"http://dsplab.diei.unipg.it/\">DSPLab</a> - <a href=\"http://www.unipg.it/\">Universita' degli studi di Perugia</a></font>"
-"</td>"
-"</tr>"
-"</table>"
-"</body>"
-"</html>"
-);
+ wxT("</td>"
+ "</tr>"
+ "<tr>"
+ "<td colspan=2 bgcolor=#CC3300 height=3 valign=center></td>"
+ "</tr>"
+ "<tr>"
+ "<td colspan=2>"
+ "<font size=-2 color=#444444>OpenJPEG is © 2002-2008 <a href=\"http://www.tele.ucl.ac.be/\">TELE</a> - <a href=\"http://www.uclouvain.be/\">Universite' Catholique de Louvain</a></font><br>"
+ "<font size=-2 color=#444444>OPJViewer is © 2007-2008 <a href=\"http://dsplab.diei.unipg.it/\">DSPLab</a> - <a href=\"http://www.unipg.it/\">Universita' degli studi di Perugia</a></font>"
+ "</td>"
+ "</tr>"
+ "</table>"
+ "</body>"
+ "</html>"
+ );
/*
- * The 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.
*
#include "openjp2/openjpeg.h"
#include "jp2/index.h"
-#define wxBITMAP_TYPE_JPEG2000 50
+#define wxBITMAP_TYPE_JPEG2000 50
class WXDLLEXPORT wxJPEG2000Handler: public wxImageHandler
{
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)
};
/*
- * The 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.
*
#include "wx/image.h"
#include "libopenjpeg/openjpeg.h"
-#define wxBITMAP_TYPE_MXF 51
+#define wxBITMAP_TYPE_MXF 51
class WXDLLEXPORT wxMXFHandler: public wxImageHandler
{
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:
/*
- * The 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, 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.
#include <stddef.h> /* ptrdiff_t */
-/**
+/**
@file bio.h
@brief Implementation of an individual bit input-output (BIO)
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);
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);
/**
/**
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);
#include "openjpeg.h"
-/*
+/*
* Write Codestream index box (superbox)
*
* @param[in] offset offset of j2k codestream
* @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
* @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_ */
/*
- * The 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, 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.
*
/* ----------------------------------------------------------------------- */
#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
/**
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;
-
- /**
- * 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;
-
- /**
- * 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 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;
-
- /**
- * 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;
+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;
+
+ /**
+ * 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 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 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;
+
+ /**
+ * 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;
/* ----------------------------------------------------------------------- */
/**
* 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);
/* ----------------------------------------------------------------------- */
/*@}*/
/*
- * The 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, 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.
@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.
*/
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.
*/
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
*/
/*
- * The 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.
*
*/
/**
Message handler object
-used for
+used for
<ul>
<li>Error messages
<li>Warning messages
<li>Debugging messages
</ul>
*/
-typedef struct opj_event_mgr
-{
- /** Data to call the event manager upon */
- void * m_error_data;
- /** Data to call the event manager upon */
- void * m_warning_data;
- /** Data to call the event manager upon */
- void * m_info_data;
- /** Error message callback if available, NULL otherwise */
- opj_msg_callback error_handler;
- /** Warning message callback if available, NULL otherwise */
- opj_msg_callback warning_handler;
- /** Debug message callback if available, NULL otherwise */
- opj_msg_callback info_handler;
+typedef struct opj_event_mgr {
+ /** Data to call the event manager upon */
+ void * m_error_data;
+ /** Data to call the event manager upon */
+ void * m_warning_data;
+ /** Data to call the event manager upon */
+ void * m_info_data;
+ /** Error message callback if available, NULL otherwise */
+ opj_msg_callback error_handler;
+ /** Warning message callback if available, NULL otherwise */
+ opj_msg_callback warning_handler;
+ /** Debug message callback if available, NULL otherwise */
+ opj_msg_callback info_handler;
} opj_event_mgr_t;
-#define EVT_ERROR 1 /**< Error event type */
-#define EVT_WARNING 2 /**< Warning event type */
-#define EVT_INFO 4 /**< Debug event type */
+#define EVT_ERROR 1 /**< Error event type */
+#define EVT_WARNING 2 /**< Warning event type */
+#define EVT_INFO 4 /**< Debug event type */
/** @defgroup EVENT EVENT - Implementation of a event callback system */
/*@{*/
/**
* 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, ...);
/* ----------------------------------------------------------------------- */
/**
/*
- * The 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.
*
#ifndef __FUNCTION_LIST_H
#define __FUNCTION_LIST_H
-/**
+/**
* @file function_list.h
* @brief Implementation of a list of procedures.
/**
* 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;
/**
* 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);
/**
* 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 */
/*
- * The 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.
*
/**
* 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);
/*@}*/
#define JPIP_PHLD 0x70686c64 /* Place holder */
-/*
+/*
* Write tile-part Index table box (superbox)
*
* @param[in] coff offset of j2k codestream
* @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
* @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
* @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
* @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
* @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
* @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_ */
/*
- * The 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.
*
* 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 */
/*
- * The 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, 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 <jerome.fimes@c-s.fr>
- * Copyright (c) 2011-2012, Centre National d'Etudes Spatiales (CNES), France
+ * Copyright (c) 2011-2012, Centre National d'Etudes Spatiales (CNES), France
* Copyright (c) 2012, CS Systemes d'Information, France
*
* All rights reserved.
/* ----------------------------------------------------------------------- */
-#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_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 */
/* 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) */
* 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_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_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_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;
/**
* 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;
/**
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;
-
-
- /***** 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;
+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;
} 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;
/**
* 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;
-
- /** 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;
-
- OPJ_BYTE *ppm_data_current;
-
- /** 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;
-
- /** tile coding parameters */
- opj_tcp_t *tcps;
-
- union
- {
- opj_decoding_param_t m_dec;
- opj_encoding_param_t m_enc;
- }
- m_specific_param;
-
-
-/* UniPG>> */
+ /** 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;
+
+ OPJ_BYTE *ppm_data_current;
+
+ /** 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;
+
+ /** tile coding parameters */
+ opj_tcp_t *tcps;
+
+ union {
+ opj_decoding_param_t m_dec;
+ opj_encoding_param_t m_enc;
+ }
+ m_specific_param;
+
+
+ /* 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;
-/* <<UniPG */
+ /******** 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;
+ /* <<UniPG */
} opj_cp_t;
-typedef struct opj_j2k_dec
-{
- /** locate in which part of the codestream the decoder is (main header, tile header, end) */
- OPJ_UINT32 m_state;
- /**
- * store decoding parameters common to all tiles (information like COD, COC in main header)
- */
- opj_tcp_t *m_default_tcp;
- OPJ_BYTE *m_header_data;
- OPJ_UINT32 m_header_data_size;
- /** to tell the tile part length */
- OPJ_UINT32 m_sot_length;
- /** Only tiles index in the correct range will be decoded.*/
- OPJ_UINT32 m_start_tile_x;
- OPJ_UINT32 m_start_tile_y;
- OPJ_UINT32 m_end_tile_x;
- OPJ_UINT32 m_end_tile_y;
- /**
- * Decoded area set by the user
- */
- OPJ_UINT32 m_DA_x0;
- OPJ_UINT32 m_DA_y0;
- OPJ_UINT32 m_DA_x1;
- OPJ_UINT32 m_DA_y1;
-
- /** Index of the tile to decode (used in get_tile) */
- OPJ_INT32 m_tile_ind_to_dec;
- /** Position of the last SOT marker read */
- OPJ_OFF_T m_last_sot_read_pos;
-
- /**
- * Indicate that the current tile-part is assume as the last tile part of the codestream.
- * It is useful in the case of PSot is equal to zero. The sot length will be compute in the
- * SOD reader function. FIXME NOT USED for the moment
- */
- OPJ_BOOL m_last_tile_part;
- /** to tell that a tile can be decoded. */
- OPJ_BITFIELD m_can_decode : 1;
- OPJ_BITFIELD m_discard_tiles : 1;
- OPJ_BITFIELD m_skip_data : 1;
- /** TNsot correction : see issue 254 **/
- OPJ_BITFIELD m_nb_tile_parts_correction_checked : 1;
- OPJ_BITFIELD m_nb_tile_parts_correction : 1;
+typedef struct opj_j2k_dec {
+ /** locate in which part of the codestream the decoder is (main header, tile header, end) */
+ OPJ_UINT32 m_state;
+ /**
+ * store decoding parameters common to all tiles (information like COD, COC in main header)
+ */
+ opj_tcp_t *m_default_tcp;
+ OPJ_BYTE *m_header_data;
+ OPJ_UINT32 m_header_data_size;
+ /** to tell the tile part length */
+ OPJ_UINT32 m_sot_length;
+ /** Only tiles index in the correct range will be decoded.*/
+ OPJ_UINT32 m_start_tile_x;
+ OPJ_UINT32 m_start_tile_y;
+ OPJ_UINT32 m_end_tile_x;
+ OPJ_UINT32 m_end_tile_y;
+ /**
+ * Decoded area set by the user
+ */
+ OPJ_UINT32 m_DA_x0;
+ OPJ_UINT32 m_DA_y0;
+ OPJ_UINT32 m_DA_x1;
+ OPJ_UINT32 m_DA_y1;
+
+ /** Index of the tile to decode (used in get_tile) */
+ OPJ_INT32 m_tile_ind_to_dec;
+ /** Position of the last SOT marker read */
+ OPJ_OFF_T m_last_sot_read_pos;
+
+ /**
+ * Indicate that the current tile-part is assume as the last tile part of the codestream.
+ * It is useful in the case of PSot is equal to zero. The sot length will be compute in the
+ * SOD reader function. FIXME NOT USED for the moment
+ */
+ OPJ_BOOL m_last_tile_part;
+ /** to tell that a tile can be decoded. */
+ OPJ_BITFIELD m_can_decode : 1;
+ OPJ_BITFIELD m_discard_tiles : 1;
+ OPJ_BITFIELD m_skip_data : 1;
+ /** TNsot correction : see issue 254 **/
+ OPJ_BITFIELD m_nb_tile_parts_correction_checked : 1;
+ OPJ_BITFIELD m_nb_tile_parts_correction : 1;
} opj_j2k_dec_t;
-typedef struct opj_j2k_enc
-{
- /** Tile part number, regardless of poc, for each new poc, tp is reset to 1*/
- OPJ_UINT32 m_current_poc_tile_part_number; /* tp_num */
+typedef struct opj_j2k_enc {
+ /** Tile part number, regardless of poc, for each new poc, tp is reset to 1*/
+ OPJ_UINT32 m_current_poc_tile_part_number; /* tp_num */
- /** Tile part number currently coding, taking into account POC. m_current_tile_part_number holds the total number of tile parts while encoding the last tile part.*/
- OPJ_UINT32 m_current_tile_part_number; /*cur_tp_num */
+ /** Tile part number currently coding, taking into account POC. m_current_tile_part_number holds the total number of tile parts while encoding the last tile part.*/
+ OPJ_UINT32 m_current_tile_part_number; /*cur_tp_num */
- /**
- locate the start position of the TLM marker
- after encoding the tilepart, a jump (in j2k_write_sod) is done to the TLM marker to store the value of its length.
- */
+ /**
+ locate the start position of the TLM marker
+ after encoding the tilepart, a jump (in j2k_write_sod) is done to the TLM marker to store the value of its length.
+ */
OPJ_OFF_T m_tlm_start;
- /**
- * Stores the sizes of the tlm.
- */
- OPJ_BYTE * m_tlm_sot_offsets_buffer;
- /**
- * The current offset of the tlm buffer.
- */
- OPJ_BYTE * m_tlm_sot_offsets_current;
+ /**
+ * Stores the sizes of the tlm.
+ */
+ OPJ_BYTE * m_tlm_sot_offsets_buffer;
+ /**
+ * The current offset of the tlm buffer.
+ */
+ OPJ_BYTE * m_tlm_sot_offsets_current;
- /** Total num of tile parts in whole image = num tiles* num tileparts in each tile*/
- /** used in TLMmarker*/
- OPJ_UINT32 m_total_tile_parts; /* totnum_tp */
+ /** Total num of tile parts in whole image = num tiles* num tileparts in each tile*/
+ /** used in TLMmarker*/
+ OPJ_UINT32 m_total_tile_parts; /* totnum_tp */
- /* encoded data for a tile */
- OPJ_BYTE * m_encoded_tile_data;
+ /* encoded data for a tile */
+ OPJ_BYTE * m_encoded_tile_data;
- /* size of the encoded_data */
- OPJ_UINT32 m_encoded_tile_size;
+ /* size of the encoded_data */
+ OPJ_UINT32 m_encoded_tile_size;
- /* encoded data for a tile */
- OPJ_BYTE * m_header_tile_data;
+ /* encoded data for a tile */
+ OPJ_BYTE * m_header_tile_data;
- /* size of the encoded_data */
- OPJ_UINT32 m_header_tile_data_size;
+ /* size of the encoded_data */
+ OPJ_UINT32 m_header_tile_data_size;
} opj_j2k_enc_t;
/**
JPEG-2000 codestream reader/writer
*/
-typedef struct opj_j2k
-{
- /* J2K codestream is decoded*/
- OPJ_BOOL m_is_decoder;
+typedef struct opj_j2k {
+ /* J2K codestream is decoded*/
+ OPJ_BOOL m_is_decoder;
- /* FIXME DOC*/
- union
- {
- opj_j2k_dec_t m_decoder;
- opj_j2k_enc_t m_encoder;
- }
- m_specific_param;
+ /* FIXME DOC*/
+ union {
+ opj_j2k_dec_t m_decoder;
+ opj_j2k_enc_t m_encoder;
+ }
+ m_specific_param;
- /** pointer to the internal/private encoded / decoded image */
- opj_image_t* m_private_image;
+ /** pointer to the internal/private encoded / decoded image */
+ opj_image_t* m_private_image;
- /* pointer to the output image (decoded)*/
- opj_image_t* m_output_image;
+ /* pointer to the output image (decoded)*/
+ opj_image_t* m_output_image;
- /** Coding parameters */
- opj_cp_t m_cp;
+ /** Coding parameters */
+ opj_cp_t m_cp;
- /** the list of procedures to exec **/
- opj_procedure_list_t * m_procedure_list;
+ /** the list of procedures to exec **/
+ opj_procedure_list_t * m_procedure_list;
- /** the list of validation procedures to follow to make sure the code is valid **/
- opj_procedure_list_t * m_validation_list;
+ /** the list of validation procedures to follow to make sure the code is valid **/
+ opj_procedure_list_t * m_validation_list;
- /** helper used to write the index file */
- opj_codestream_index_t *cstr_index;
+ /** helper used to write the index file */
+ opj_codestream_index_t *cstr_index;
- /** number of the tile curently concern by coding/decoding */
- OPJ_UINT32 m_current_tile_number;
+ /** number of the tile curently concern by coding/decoding */
+ OPJ_UINT32 m_current_tile_number;
- /** the current tile coder/decoder **/
- struct opj_tcd * m_tcd;
+ /** the current tile coder/decoder **/
+ struct opj_tcd * m_tcd;
/** Number of threads to use */
int m_num_threads;
/**
Setup the decoder decoding parameters using user parameters.
-Decoding parameters are returned in j2k->cp.
+Decoding parameters are returned in j2k->cp.
@param j2k J2K decompressor handle
@param parameters decompression parameters
*/
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
*
* @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.
/**
* 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);
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 */
/*
- * The 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, 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.
*
/* ----------------------------------------------------------------------- */
-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;
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;
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;
-
- /* 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.
- */
+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.
+ */
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;
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 */
*/
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
* @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
@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);
/**
* 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);
/* ----------------------------------------------------------------------- */
* 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);
*
* @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.
* @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.
* @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.
*
* @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
*
* @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_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_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_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 */
*@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.
/*
- * The 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, 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.
*
@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
@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);
@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
@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);
@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
@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);
/* ----------------------------------------------------------------------- */
/*@}*/
/*
- * The 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, Professor Benoit Macq
* Copyright (c) 2001-2003, David Janssens
* Copyright (c) 2002-2003, Yannick Verschueren
- * Copyright (c) 2003-2007, Francois-Olivier Devaux
+ * Copyright (c) 2003-2007, Francois-Olivier Devaux
* Copyright (c) 2003-2014, Antonin Descampe
* Copyright (c) 2005, Herve Drolon, FreeImage Team
* Copyright (c) 2008, Jerome Fimes, Communications & Systemes <jerome.fimes@c-s.fr>
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
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;
/*@{*/
/* ----------------------------------------------------------------------- */
/**
-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);
*/
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
*/
@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
@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
*/
void opj_mqc_flush(opj_mqc_t *mqc);
/**
-BYPASS mode switch, initialization operation.
-JPEG 2000 p 505.
+BYPASS mode switch, initialization operation.
+JPEG 2000 p 505.
<h2>Not fully implemented and tested !!</h2>
@param mqc MQC handle
*/
void opj_mqc_bypass_init_enc(opj_mqc_t *mqc);
/**
-BYPASS mode switch, coding operation.
-JPEG 2000 p 505.
+BYPASS mode switch, coding operation.
+JPEG 2000 p 505.
<h2>Not fully implemented and tested !!</h2>
@param mqc MQC handle
@param d The symbol to be encoded (0 or 1)
/*
- * The 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, Professor Benoit Macq
* Copyright (c) 2001-2003, David Janssens
* Copyright (c) 2002-2003, Yannick Verschueren
- * Copyright (c) 2003-2007, Francois-Olivier Devaux
+ * Copyright (c) 2003-2007, Francois-Olivier Devaux
* Copyright (c) 2003-2014, Antonin Descampe
* Copyright (c) 2005, Herve Drolon, FreeImage Team
* Copyright (c) 2008, Jerome Fimes, Communications & Systemes <jerome.fimes@c-s.fr>
@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;
}
/**
@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;
}
/**
@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
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);
}
/**
@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 */
- /*
- * The 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 <jerome.fimes@c-s.fr>
- * 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 <jerome.fimes@c-s.fr>
+* 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(<Compiler>) */
+#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(<Compiler>) */
#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;
/* Avoid compile-time warning because parameter is not used */
#define OPJ_ARG_NOT_USED(x) (void)(x)
-/*
+/*
==========================================================
Useful constant definitions
==========================================================
#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 */
* 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)
/**
* 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
==========================================================
* 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;
* 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;
* 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
==========================================================
/**
* 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
==========================================================
/**
* 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];
-
- /**@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];
- /*@}*/
-/* <<UniPG */
+ 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;
+ /*@}*/
+
+ /* 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];
+ /*@}*/
+ /* <<UniPG */
/**
* DEPRECATED: use RSIZ, OPJ_PROFILE_* and MAX_COMP_SIZE instead
* Maximum size (in bytes) for each component.
* If == 0, component size limitation is not considered
* */
- int max_comp_size;
+ int max_comp_size;
/**
* DEPRECATED: use RSIZ, OPJ_PROFILE_* and OPJ_EXTENSION_* instead
* Profile name
* */
OPJ_RSIZ_CAPABILITIES cp_rsiz;
- /** Tile part generation*/
- char tp_on;
- /** Flag for Tile part generation*/
- char tp_flag;
- /** MCT (multiple component transform) */
- char tcp_mct;
- /** Enable JPIP indexing*/
- OPJ_BOOL jpip_on;
- /** Naive implementation of MCT restricted to a single reversible array based
+ /** Tile part generation*/
+ char tp_on;
+ /** Flag for Tile part generation*/
+ char tp_flag;
+ /** MCT (multiple component transform) */
+ char tcp_mct;
+ /** Enable JPIP indexing*/
+ OPJ_BOOL jpip_on;
+ /** Naive implementation of MCT restricted to a single reversible array based
encoding without offset concerning all the components. */
- void * mct_data;
+ void * mct_data;
/**
* Maximum size (in bytes) for the whole codestream.
* If == 0, codestream size limitation is not considered
/** RSIZ value
To be used to combine OPJ_PROFILE_*, OPJ_EXTENSION_* and (sub)levels values. */
OPJ_UINT16 rsiz;
-} opj_cparameters_t;
+} opj_cparameters_t;
-#define OPJ_DPARAMETERS_IGNORE_PCLR_CMAP_CDEF_FLAG 0x0001
+#define OPJ_DPARAMETERS_IGNORE_PCLR_CMAP_CDEF_FLAG 0x0001
/**
* Decompression parameters
* */
typedef struct opj_dparameters {
- /**
- Set the number of highest resolution levels to be discarded.
- The image resolution is effectively divided by 2 to the power of the number of discarded levels.
- The reduce factor is limited by the smallest total number of decomposition levels among tiles.
- if != 0, then original dimension divided by 2^(reduce);
- if == 0 or not used, image is decoded to the full resolution
- */
- OPJ_UINT32 cp_reduce;
- /**
- Set the maximum number of quality layers to decode.
- If there are less quality layers than the specified number, all the quality layers are decoded.
- if != 0, then only the first "layer" layers are decoded;
- if == 0 or not used, all the quality layers are decoded
- */
- OPJ_UINT32 cp_layer;
-
- /**@name command line decoder parameters (not used inside the library) */
- /*@{*/
- /** input file name */
- char infile[OPJ_PATH_LEN];
- /** output file name */
- char outfile[OPJ_PATH_LEN];
- /** input file format 0: J2K, 1: JP2, 2: JPT */
- int decod_format;
- /** output file format 0: PGX, 1: PxM, 2: BMP */
- int cod_format;
-
- /** Decoding area left boundary */
- OPJ_UINT32 DA_x0;
- /** Decoding area right boundary */
- OPJ_UINT32 DA_x1;
- /** Decoding area up boundary */
- OPJ_UINT32 DA_y0;
- /** Decoding area bottom boundary */
- OPJ_UINT32 DA_y1;
- /** Verbose mode */
- OPJ_BOOL m_verbose;
-
- /** tile number ot the decoded tile*/
- OPJ_UINT32 tile_index;
- /** Nb of tile to decode */
- OPJ_UINT32 nb_tile_to_decode;
-
- /*@}*/
-
-/* UniPG>> */ /* 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;
- /*@}*/
-/* <<UniPG */
-
- unsigned int flags;
+ /**
+ Set the number of highest resolution levels to be discarded.
+ The image resolution is effectively divided by 2 to the power of the number of discarded levels.
+ The reduce factor is limited by the smallest total number of decomposition levels among tiles.
+ if != 0, then original dimension divided by 2^(reduce);
+ if == 0 or not used, image is decoded to the full resolution
+ */
+ OPJ_UINT32 cp_reduce;
+ /**
+ Set the maximum number of quality layers to decode.
+ If there are less quality layers than the specified number, all the quality layers are decoded.
+ if != 0, then only the first "layer" layers are decoded;
+ if == 0 or not used, all the quality layers are decoded
+ */
+ OPJ_UINT32 cp_layer;
+
+ /**@name command line decoder parameters (not used inside the library) */
+ /*@{*/
+ /** input file name */
+ char infile[OPJ_PATH_LEN];
+ /** output file name */
+ char outfile[OPJ_PATH_LEN];
+ /** input file format 0: J2K, 1: JP2, 2: JPT */
+ int decod_format;
+ /** output file format 0: PGX, 1: PxM, 2: BMP */
+ int cod_format;
+
+ /** Decoding area left boundary */
+ OPJ_UINT32 DA_x0;
+ /** Decoding area right boundary */
+ OPJ_UINT32 DA_x1;
+ /** Decoding area up boundary */
+ OPJ_UINT32 DA_y0;
+ /** Decoding area bottom boundary */
+ OPJ_UINT32 DA_y1;
+ /** Verbose mode */
+ OPJ_BOOL m_verbose;
+
+ /** tile number ot the decoded tile*/
+ OPJ_UINT32 tile_index;
+ /** Nb of tile to decode */
+ OPJ_UINT32 nb_tile_to_decode;
+
+ /*@}*/
+
+ /* UniPG>> */ /* 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;
+ /*@}*/
+ /* <<UniPG */
+
+ unsigned int flags;
} opj_dparameters_t;
* */
typedef void * opj_codec_t;
-/*
+/*
==========================================================
I/O stream typedef definitions
==========================================================
* Stream open flags.
* */
/** The stream was opened for reading. */
-#define OPJ_STREAM_READ OPJ_TRUE
+#define OPJ_STREAM_READ OPJ_TRUE
/** The stream was opened for writing. */
#define OPJ_STREAM_WRITE OPJ_FALSE
/*
* Callback function prototype for read function
*/
-typedef OPJ_SIZE_T (* opj_stream_read_fn) (void * p_buffer, OPJ_SIZE_T p_nb_bytes, void * p_user_data) ;
+typedef OPJ_SIZE_T(* opj_stream_read_fn)(void * p_buffer, OPJ_SIZE_T p_nb_bytes,
+ void * p_user_data) ;
/*
* Callback function prototype for write function
*/
-typedef OPJ_SIZE_T (* opj_stream_write_fn) (void * p_buffer, OPJ_SIZE_T p_nb_bytes, void * p_user_data) ;
+typedef OPJ_SIZE_T(* opj_stream_write_fn)(void * p_buffer,
+ OPJ_SIZE_T p_nb_bytes, void * p_user_data) ;
/*
* Callback function prototype for skip function
*/
-typedef OPJ_OFF_T (* opj_stream_skip_fn) (OPJ_OFF_T p_nb_bytes, void * p_user_data) ;
+typedef OPJ_OFF_T(* opj_stream_skip_fn)(OPJ_OFF_T p_nb_bytes,
+ void * p_user_data) ;
/*
* Callback function prototype for seek function
*/
-typedef OPJ_BOOL (* opj_stream_seek_fn) (OPJ_OFF_T p_nb_bytes, void * p_user_data) ;
+typedef OPJ_BOOL(* opj_stream_seek_fn)(OPJ_OFF_T p_nb_bytes,
+ void * p_user_data) ;
/*
* Callback function prototype for free user data function
*/
-typedef void (* opj_stream_free_user_data_fn) (void * p_user_data) ;
+typedef void (* opj_stream_free_user_data_fn)(void * p_user_data) ;
/*
* JPEG2000 Stream.
*/
typedef void * opj_stream_t;
-/*
+/*
==========================================================
image typedef definitions
==========================================================
* Defines a single image component
* */
typedef struct opj_image_comp {
- /** XRsiz: horizontal separation of a sample of ith component with respect to the reference grid */
- OPJ_UINT32 dx;
- /** YRsiz: vertical separation of a sample of ith component with respect to the reference grid */
- OPJ_UINT32 dy;
- /** data width */
- OPJ_UINT32 w;
- /** data height */
- OPJ_UINT32 h;
- /** x component offset compared to the whole image */
- OPJ_UINT32 x0;
- /** y component offset compared to the whole image */
- OPJ_UINT32 y0;
- /** precision */
- OPJ_UINT32 prec;
- /** image depth in bits */
- OPJ_UINT32 bpp;
- /** signed (1) / unsigned (0) */
- OPJ_UINT32 sgnd;
- /** number of decoded resolution */
- OPJ_UINT32 resno_decoded;
- /** number of division by 2 of the out image compared to the original size of image */
- OPJ_UINT32 factor;
- /** image component data */
- OPJ_INT32 *data;
- /** alpha channel */
- OPJ_UINT16 alpha;
+ /** XRsiz: horizontal separation of a sample of ith component with respect to the reference grid */
+ OPJ_UINT32 dx;
+ /** YRsiz: vertical separation of a sample of ith component with respect to the reference grid */
+ OPJ_UINT32 dy;
+ /** data width */
+ OPJ_UINT32 w;
+ /** data height */
+ OPJ_UINT32 h;
+ /** x component offset compared to the whole image */
+ OPJ_UINT32 x0;
+ /** y component offset compared to the whole image */
+ OPJ_UINT32 y0;
+ /** precision */
+ OPJ_UINT32 prec;
+ /** image depth in bits */
+ OPJ_UINT32 bpp;
+ /** signed (1) / unsigned (0) */
+ OPJ_UINT32 sgnd;
+ /** number of decoded resolution */
+ OPJ_UINT32 resno_decoded;
+ /** number of division by 2 of the out image compared to the original size of image */
+ OPJ_UINT32 factor;
+ /** image component data */
+ OPJ_INT32 *data;
+ /** alpha channel */
+ OPJ_UINT16 alpha;
} opj_image_comp_t;
-/**
+/**
* Defines image data and characteristics
* */
typedef struct opj_image {
- /** XOsiz: horizontal offset from the origin of the reference grid to the left side of the image area */
- OPJ_UINT32 x0;
- /** YOsiz: vertical offset from the origin of the reference grid to the top side of the image area */
- OPJ_UINT32 y0;
- /** Xsiz: width of the reference grid */
- OPJ_UINT32 x1;
- /** Ysiz: height of the reference grid */
- OPJ_UINT32 y1;
- /** number of components in the image */
- OPJ_UINT32 numcomps;
- /** color space: sRGB, Greyscale or YUV */
- OPJ_COLOR_SPACE color_space;
- /** image components */
- opj_image_comp_t *comps;
- /** 'restricted' ICC profile */
- OPJ_BYTE *icc_profile_buf;
- /** size of ICC profile */
- OPJ_UINT32 icc_profile_len;
+ /** XOsiz: horizontal offset from the origin of the reference grid to the left side of the image area */
+ OPJ_UINT32 x0;
+ /** YOsiz: vertical offset from the origin of the reference grid to the top side of the image area */
+ OPJ_UINT32 y0;
+ /** Xsiz: width of the reference grid */
+ OPJ_UINT32 x1;
+ /** Ysiz: height of the reference grid */
+ OPJ_UINT32 y1;
+ /** number of components in the image */
+ OPJ_UINT32 numcomps;
+ /** color space: sRGB, Greyscale or YUV */
+ OPJ_COLOR_SPACE color_space;
+ /** image components */
+ opj_image_comp_t *comps;
+ /** 'restricted' ICC profile */
+ OPJ_BYTE *icc_profile_buf;
+ /** size of ICC profile */
+ OPJ_UINT32 icc_profile_len;
} opj_image_t;
* Component parameters structure used by the opj_image_create function
* */
typedef struct opj_image_comptparm {
- /** XRsiz: horizontal separation of a sample of ith component with respect to the reference grid */
- OPJ_UINT32 dx;
- /** YRsiz: vertical separation of a sample of ith component with respect to the reference grid */
- OPJ_UINT32 dy;
- /** data width */
- OPJ_UINT32 w;
- /** data height */
- OPJ_UINT32 h;
- /** x component offset compared to the whole image */
- OPJ_UINT32 x0;
- /** y component offset compared to the whole image */
- OPJ_UINT32 y0;
- /** precision */
- OPJ_UINT32 prec;
- /** image depth in bits */
- OPJ_UINT32 bpp;
- /** signed (1) / unsigned (0) */
- OPJ_UINT32 sgnd;
+ /** XRsiz: horizontal separation of a sample of ith component with respect to the reference grid */
+ OPJ_UINT32 dx;
+ /** YRsiz: vertical separation of a sample of ith component with respect to the reference grid */
+ OPJ_UINT32 dy;
+ /** data width */
+ OPJ_UINT32 w;
+ /** data height */
+ OPJ_UINT32 h;
+ /** x component offset compared to the whole image */
+ OPJ_UINT32 x0;
+ /** y component offset compared to the whole image */
+ OPJ_UINT32 y0;
+ /** precision */
+ OPJ_UINT32 prec;
+ /** image depth in bits */
+ OPJ_UINT32 bpp;
+ /** signed (1) / unsigned (0) */
+ OPJ_UINT32 sgnd;
} opj_image_cmptparm_t;
-/*
+/*
==========================================================
Information on the JPEG 2000 codestream
==========================================================
* Index structure : Information concerning a packet inside tile
* */
typedef struct opj_packet_info {
- /** packet start position (including SOP marker if it exists) */
- OPJ_OFF_T start_pos;
- /** end of packet header position (including EPH marker if it exists)*/
- OPJ_OFF_T end_ph_pos;
- /** packet end position */
- OPJ_OFF_T end_pos;
- /** packet distorsion */
- double disto;
+ /** packet start position (including SOP marker if it exists) */
+ OPJ_OFF_T start_pos;
+ /** end of packet header position (including EPH marker if it exists)*/
+ OPJ_OFF_T end_ph_pos;
+ /** packet end position */
+ OPJ_OFF_T end_pos;
+ /** packet distorsion */
+ double disto;
} opj_packet_info_t;
* Marker structure
* */
typedef struct opj_marker_info {
- /** marker type */
- unsigned short int type;
- /** position in codestream */
- OPJ_OFF_T pos;
- /** length, marker val included */
- int len;
+ /** marker type */
+ unsigned short int type;
+ /** position in codestream */
+ OPJ_OFF_T pos;
+ /** length, marker val included */
+ int len;
} opj_marker_info_t;
/* <<UniPG */
* Index structure : Information concerning tile-parts
*/
typedef struct opj_tp_info {
- /** start position of tile part */
- int tp_start_pos;
- /** end position of tile part header */
- int tp_end_header;
- /** end position of tile part */
- int tp_end_pos;
- /** start packet of tile part */
- int tp_start_pack;
- /** number of packets of tile part */
- int tp_numpacks;
+ /** start position of tile part */
+ int tp_start_pos;
+ /** end position of tile part header */
+ int tp_end_header;
+ /** end position of tile part */
+ int tp_end_pos;
+ /** start packet of tile part */
+ int tp_start_pack;
+ /** number of packets of tile part */
+ int tp_numpacks;
} opj_tp_info_t;
/**
* Index structure : information regarding tiles
*/
typedef struct opj_tile_info {
- /** value of thresh for each layer by tile cfr. Marcela */
- double *thresh;
- /** number of tile */
- int tileno;
- /** 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) */
- int pw[33];
- /** precinct number for each resolution level (height) */
- int ph[33];
- /** precinct size (in power of 2), in X for each resolution level */
- int pdx[33];
- /** precinct size (in power of 2), in Y for each resolution level */
- int pdy[33];
- /** information concerning packets inside tile */
- opj_packet_info_t *packet;
- /** add fixed_quality */
- int numpix;
- /** add fixed_quality */
- double distotile;
- /** number of markers */
- int marknum;
- /** list of markers */
- opj_marker_info_t *marker;
- /** actual size of markers array */
- int maxmarknum;
- /** number of tile parts */
- int num_tps;
- /** information concerning tile parts */
- opj_tp_info_t *tp;
+ /** value of thresh for each layer by tile cfr. Marcela */
+ double *thresh;
+ /** number of tile */
+ int tileno;
+ /** 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) */
+ int pw[33];
+ /** precinct number for each resolution level (height) */
+ int ph[33];
+ /** precinct size (in power of 2), in X for each resolution level */
+ int pdx[33];
+ /** precinct size (in power of 2), in Y for each resolution level */
+ int pdy[33];
+ /** information concerning packets inside tile */
+ opj_packet_info_t *packet;
+ /** add fixed_quality */
+ int numpix;
+ /** add fixed_quality */
+ double distotile;
+ /** number of markers */
+ int marknum;
+ /** list of markers */
+ opj_marker_info_t *marker;
+ /** actual size of markers array */
+ int maxmarknum;
+ /** number of tile parts */
+ int num_tps;
+ /** information concerning tile parts */
+ opj_tp_info_t *tp;
} opj_tile_info_t;
/**
* Index structure of the codestream
*/
typedef struct opj_codestream_info {
- /** maximum distortion reduction on the whole image (add for Marcela) */
- double D_max;
- /** packet number */
- int packno;
- /** writing the packet in the index with t2_encode_packets */
- int index_write;
- /** image width */
- int image_w;
- /** image height */
- int image_h;
- /** progression order */
- OPJ_PROG_ORDER prog;
- /** tile size in x */
- int tile_x;
- /** tile size in y */
- int tile_y;
- /** */
- int tile_Ox;
- /** */
- int tile_Oy;
- /** number of tiles in X */
- int tw;
- /** number of tiles in Y */
- int th;
- /** component numbers */
- int numcomps;
- /** number of layer */
- int numlayers;
- /** number of decomposition for each component */
- int *numdecompos;
-/* UniPG>> */
- /** number of markers */
- int marknum;
- /** list of markers */
- opj_marker_info_t *marker;
- /** actual size of markers array */
- int maxmarknum;
-/* <<UniPG */
- /** main header position */
- int main_head_start;
- /** main header position */
- int main_head_end;
- /** codestream's size */
- int codestream_size;
- /** information regarding tiles inside image */
- opj_tile_info_t *tile;
+ /** maximum distortion reduction on the whole image (add for Marcela) */
+ double D_max;
+ /** packet number */
+ int packno;
+ /** writing the packet in the index with t2_encode_packets */
+ int index_write;
+ /** image width */
+ int image_w;
+ /** image height */
+ int image_h;
+ /** progression order */
+ OPJ_PROG_ORDER prog;
+ /** tile size in x */
+ int tile_x;
+ /** tile size in y */
+ int tile_y;
+ /** */
+ int tile_Ox;
+ /** */
+ int tile_Oy;
+ /** number of tiles in X */
+ int tw;
+ /** number of tiles in Y */
+ int th;
+ /** component numbers */
+ int numcomps;
+ /** number of layer */
+ int numlayers;
+ /** number of decomposition for each component */
+ int *numdecompos;
+ /* UniPG>> */
+ /** number of markers */
+ int marknum;
+ /** list of markers */
+ opj_marker_info_t *marker;
+ /** actual size of markers array */
+ int maxmarknum;
+ /* <<UniPG */
+ /** main header position */
+ int main_head_start;
+ /** main header position */
+ int main_head_end;
+ /** codestream's size */
+ int codestream_size;
+ /** information regarding tiles inside image */
+ opj_tile_info_t *tile;
} opj_codestream_info_t;
/* <----------------------------------------------------------- */
/**
* Tile-component coding parameters information
*/
-typedef struct opj_tccp_info
-{
- /** component index */
- OPJ_UINT32 compno;
- /** 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_UINT32 stepsizes_mant[OPJ_J2K_MAXBANDS];
- /** stepsizes used for quantization */
- OPJ_UINT32 stepsizes_expn[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];
+typedef struct opj_tccp_info {
+ /** component index */
+ OPJ_UINT32 compno;
+ /** 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_UINT32 stepsizes_mant[OPJ_J2K_MAXBANDS];
+ /** stepsizes used for quantization */
+ OPJ_UINT32 stepsizes_expn[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];
}
opj_tccp_info_t;
*/
typedef struct opj_tile_v2_info {
- /** number (index) of tile */
- int tileno;
- /** coding style */
- OPJ_UINT32 csty;
- /** progression order */
- OPJ_PROG_ORDER prg;
- /** number of layers */
- OPJ_UINT32 numlayers;
- /** multi-component transform identifier */
- OPJ_UINT32 mct;
+ /** number (index) of tile */
+ int tileno;
+ /** coding style */
+ OPJ_UINT32 csty;
+ /** progression order */
+ OPJ_PROG_ORDER prg;
+ /** number of layers */
+ OPJ_UINT32 numlayers;
+ /** multi-component transform identifier */
+ OPJ_UINT32 mct;
- /** information concerning tile component parameters*/
- opj_tccp_info_t *tccp_info;
+ /** information concerning tile component parameters*/
+ opj_tccp_info_t *tccp_info;
} opj_tile_info_v2_t;
* Information structure about the codestream (FIXME should be expand and enhance)
*/
typedef struct opj_codestream_info_v2 {
- /* Tile info */
- /** tile origin in x = XTOsiz */
- OPJ_UINT32 tx0;
- /** tile origin in y = YTOsiz */
- OPJ_UINT32 ty0;
- /** tile size in x = XTsiz */
- OPJ_UINT32 tdx;
- /** tile size in y = YTsiz */
- OPJ_UINT32 tdy;
- /** number of tiles in X */
- OPJ_UINT32 tw;
- /** number of tiles in Y */
- OPJ_UINT32 th;
-
- /** number of components*/
- OPJ_UINT32 nbcomps;
-
- /** Default information regarding tiles inside image */
- opj_tile_info_v2_t m_default_tile_info;
-
- /** information regarding tiles inside image */
- opj_tile_info_v2_t *tile_info; /* FIXME not used for the moment */
+ /* Tile info */
+ /** tile origin in x = XTOsiz */
+ OPJ_UINT32 tx0;
+ /** tile origin in y = YTOsiz */
+ OPJ_UINT32 ty0;
+ /** tile size in x = XTsiz */
+ OPJ_UINT32 tdx;
+ /** tile size in y = YTsiz */
+ OPJ_UINT32 tdy;
+ /** number of tiles in X */
+ OPJ_UINT32 tw;
+ /** number of tiles in Y */
+ OPJ_UINT32 th;
+
+ /** number of components*/
+ OPJ_UINT32 nbcomps;
+
+ /** Default information regarding tiles inside image */
+ opj_tile_info_v2_t m_default_tile_info;
+
+ /** information regarding tiles inside image */
+ opj_tile_info_v2_t *tile_info; /* FIXME not used for the moment */
} opj_codestream_info_v2_t;
* Index structure about a tile part
*/
typedef struct opj_tp_index {
- /** start position */
- OPJ_OFF_T start_pos;
- /** end position of the header */
- OPJ_OFF_T end_header;
- /** end position */
- OPJ_OFF_T end_pos;
+ /** start position */
+ OPJ_OFF_T start_pos;
+ /** end position of the header */
+ OPJ_OFF_T end_header;
+ /** end position */
+ OPJ_OFF_T end_pos;
} opj_tp_index_t;
* Index structure about a tile
*/
typedef struct opj_tile_index {
- /** tile index */
- OPJ_UINT32 tileno;
-
- /** number of tile parts */
- OPJ_UINT32 nb_tps;
- /** current nb of tile part (allocated)*/
- OPJ_UINT32 current_nb_tps;
- /** current tile-part index */
- OPJ_UINT32 current_tpsno;
- /** information concerning tile parts */
- opj_tp_index_t *tp_index;
-
- /* UniPG>> */ /* 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;
- /* <<UniPG */
-
- /** packet number */
- OPJ_UINT32 nb_packet;
- /** information concerning packets inside tile */
- opj_packet_info_t *packet_index;
+ /** tile index */
+ OPJ_UINT32 tileno;
+
+ /** number of tile parts */
+ OPJ_UINT32 nb_tps;
+ /** current nb of tile part (allocated)*/
+ OPJ_UINT32 current_nb_tps;
+ /** current tile-part index */
+ OPJ_UINT32 current_tpsno;
+ /** information concerning tile parts */
+ opj_tp_index_t *tp_index;
+
+ /* UniPG>> */ /* 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;
+ /* <<UniPG */
+
+ /** packet number */
+ OPJ_UINT32 nb_packet;
+ /** information concerning packets inside tile */
+ opj_packet_info_t *packet_index;
} opj_tile_index_t;
* Index structure of the codestream (FIXME should be expand and enhance)
*/
typedef struct opj_codestream_index {
- /** main header start position (SOC position) */
- OPJ_OFF_T main_head_start;
- /** main header end position (first SOT position) */
- OPJ_OFF_T main_head_end;
-
- /** codestream's size */
- OPJ_UINT64 codestream_size;
-
-/* UniPG>> */ /* 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;
-/* <<UniPG */
-
- /** */
- OPJ_UINT32 nb_of_tiles;
- /** */
- opj_tile_index_t *tile_index; /* FIXME not used for the moment */
-
-}opj_codestream_index_t;
+ /** main header start position (SOC position) */
+ OPJ_OFF_T main_head_start;
+ /** main header end position (first SOT position) */
+ OPJ_OFF_T main_head_end;
+
+ /** codestream's size */
+ OPJ_UINT64 codestream_size;
+
+ /* UniPG>> */ /* 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;
+ /* <<UniPG */
+
+ /** */
+ OPJ_UINT32 nb_of_tiles;
+ /** */
+ opj_tile_index_t *tile_index; /* FIXME not used for the moment */
+
+} opj_codestream_index_t;
/* -----------------------------------------------------------> */
/*
* EXPERIMENTAL FOR THE MOMENT
*/
typedef struct opj_jp2_metadata {
- /** */
- OPJ_INT32 not_used;
+ /** */
+ OPJ_INT32 not_used;
} opj_jp2_metadata_t;
* EXPERIMENTAL FOR THE MOMENT
*/
typedef struct opj_jp2_index {
- /** */
- OPJ_INT32 not_used;
+ /** */
+ OPJ_INT32 not_used;
} opj_jp2_index_t;
#endif
-/*
+/*
==========================================================
openjpeg version
==========================================================
/* Get the version of the openjpeg library*/
OPJ_API const char * OPJ_CALLCONV opj_version(void);
-/*
+/*
==========================================================
image functions definitions
==========================================================
* @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
/**
* 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
==========================================================
/**
* 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.
* @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
==========================================================
* @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
* @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
==========================================================
/**
* 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.
* @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 :
<ul>
<li>Lossless
<li>1 tile
</ul>
@param parameters Compression parameters
*/
-OPJ_API void OPJ_CALLCONV opj_set_default_encoder_parameters(opj_cparameters_t *parameters);
+OPJ_API void OPJ_CALLCONV opj_set_default_encoder_parameters(
+ opj_cparameters_t *parameters);
/**
* Setup the encoder parameters using the current 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
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);
/**
* 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);
/*
==========================================================
/*
- * The 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.
*
/*
- * The 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.
*
/**
* 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);
-
- 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,
+ 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_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*/
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;
/*
- * The 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.
*
#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)
/* Are restricted pointers available? (C99) */
#if (__STDC_VERSION__ >= 199901L)
- #define OPJ_RESTRICT restrict
+#define OPJ_RESTRICT restrict
#else
- /* Not a C99 compiler */
- #if defined(__GNUC__)
- #define OPJ_RESTRICT __restrict__
+/* Not a C99 compiler */
+#if defined(__GNUC__)
+#define OPJ_RESTRICT __restrict__
/*
vc14 (2015) outputs wrong results.
Need to check OPJ_RESTRICT usage (or a bug in vc14)
- #elif defined(_MSC_VER) && (_MSC_VER >= 1400)
- #define OPJ_RESTRICT __restrict
+ #elif defined(_MSC_VER) && (_MSC_VER >= 1400)
+ #define OPJ_RESTRICT __restrict
*/
- #else
- #define OPJ_RESTRICT /* restrict */
- #endif
+#else
+#define OPJ_RESTRICT /* restrict */
+#endif
#endif
#ifdef __has_attribute
- #if __has_attribute(no_sanitize)
- #define OPJ_NOSANITIZE(kind) __attribute__((no_sanitize(kind)))
- #endif
+#if __has_attribute(no_sanitize)
+#define OPJ_NOSANITIZE(kind) __attribute__((no_sanitize(kind)))
+#endif
#endif
#ifndef OPJ_NOSANITIZE
- #define OPJ_NOSANITIZE(kind)
+#define OPJ_NOSANITIZE(kind)
#endif
/* MSVC before 2013 and Borland C do not have lrintf */
#if defined(_MSC_VER)
#include <intrin.h>
-static INLINE long opj_lrintf(float f){
+static INLINE long opj_lrintf(float f)
+{
#ifdef _M_X64
- return _mm_cvt_ss2si(_mm_load_ss(&f));
+ return _mm_cvt_ss2si(_mm_load_ss(&f));
- /* commented out line breaks many tests */
- /* return (long)((f>0.0f) ? (f + 0.5f):(f -0.5f)); */
+ /* commented out line breaks many tests */
+ /* return (long)((f>0.0f) ? (f + 0.5f):(f -0.5f)); */
#elif defined(_M_IX86)
int i;
- _asm{
+ _asm{
fld f
fistp i
};
-
+
return i;
-#else
- return (long)((f>0.0f) ? (f + 0.5f) : (f - 0.5f));
+#else
+ return (long)((f>0.0f) ? (f + 0.5f) : (f - 0.5f));
#endif
}
#elif defined(__BORLANDC__)
-static INLINE long opj_lrintf(float f) {
+static INLINE long opj_lrintf(float f)
+{
#ifdef _M_X64
- return (long)((f>0.0f) ? (f + 0.5f):(f -0.5f));
+ return (long)((f > 0.0f) ? (f + 0.5f) : (f - 0.5f));
#else
- int i;
+ int i;
- _asm {
- fld f
- fistp i
- };
+ _asm {
+ fld f
+ fistp i
+ };
- return i;
+ return i;
#endif
}
#else
-static INLINE long opj_lrintf(float f) {
- return lrintf(f);
+static INLINE long opj_lrintf(float f)
+{
+ return lrintf(f);
}
#endif
#if defined(_MSC_VER) && (_MSC_VER < 1400)
- #define vsnprintf _vsnprintf
+#define vsnprintf _vsnprintf
#endif
/* MSVC x86 is really bad at doing int64 = int32 * int32 on its own. Use intrinsic. */
#if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(__INTEL_COMPILER) && defined(_M_IX86)
-# include <intrin.h>
-# pragma intrinsic(__emul)
+# include <intrin.h>
+# pragma intrinsic(__emul)
#endif
/* Type to use for bit-fields in internal headers */
/*
- * The 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, 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.
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;
}
/**
<ul>
<li>Returns a if (min < a < max)
<li>Returns max if (a > max)
-<li>Returns min if (a < min)
+<li>Returns min if (a < min)
</ul>
*/
-static INLINE OPJ_INT32 opj_int_clamp(OPJ_INT32 a, OPJ_INT32 min, OPJ_INT32 max) {
- if (a < min)
- return min;
- if (a > max)
- return max;
- return a;
+static INLINE OPJ_INT32 opj_int_clamp(OPJ_INT32 a, OPJ_INT32 min,
+ OPJ_INT32 max)
+{
+ if (a < min) {
+ return min;
+ }
+ if (a > max) {
+ return max;
+ }
+ return a;
}
/**
@return Get absolute value of integer
*/
-static INLINE OPJ_INT32 opj_int_abs(OPJ_INT32 a) {
- return a < 0 ? -a : a;
+static INLINE OPJ_INT32 opj_int_abs(OPJ_INT32 a)
+{
+ return a < 0 ? -a : a;
}
/**
Divide an integer and round upwards
@return Returns a divided by b
*/
-static INLINE OPJ_INT32 opj_int_ceildiv(OPJ_INT32 a, OPJ_INT32 b) {
- assert(b);
- return (a + b - 1) / b;
+static INLINE OPJ_INT32 opj_int_ceildiv(OPJ_INT32 a, OPJ_INT32 b)
+{
+ assert(b);
+ return (a + b - 1) / b;
}
/**
Divide an integer and round upwards
@return Returns a divided by b
*/
-static INLINE OPJ_UINT32 opj_uint_ceildiv(OPJ_UINT32 a, OPJ_UINT32 b) {
- assert(b);
- return (a + b - 1) / b;
+static INLINE OPJ_UINT32 opj_uint_ceildiv(OPJ_UINT32 a, OPJ_UINT32 b)
+{
+ assert(b);
+ return (a + b - 1) / b;
}
/**
Divide an integer by a power of 2 and round upwards
@return Returns a divided by 2^b
*/
-static INLINE OPJ_INT32 opj_int_ceildivpow2(OPJ_INT32 a, OPJ_INT32 b) {
- return (OPJ_INT32)((a + ((OPJ_INT64)1 << b) - 1) >> b);
+static INLINE OPJ_INT32 opj_int_ceildivpow2(OPJ_INT32 a, OPJ_INT32 b)
+{
+ return (OPJ_INT32)((a + ((OPJ_INT64)1 << b) - 1) >> b);
}
/**
Divide a 64bits integer by a power of 2 and round upwards
@return Returns a divided by 2^b
*/
-static INLINE OPJ_INT32 opj_int64_ceildivpow2(OPJ_INT64 a, OPJ_INT32 b) {
- return (OPJ_INT32)((a + ((OPJ_INT64)1 << b) - 1) >> b);
+static INLINE OPJ_INT32 opj_int64_ceildivpow2(OPJ_INT64 a, OPJ_INT32 b)
+{
+ return (OPJ_INT32)((a + ((OPJ_INT64)1 << b) - 1) >> b);
}
/**
Divide an integer by a power of 2 and round upwards
@return Returns a divided by 2^b
*/
-static INLINE OPJ_UINT32 opj_uint_ceildivpow2(OPJ_UINT32 a, OPJ_UINT32 b) {
- return (OPJ_UINT32)((a + ((OPJ_UINT64)1U << b) - 1U) >> b);
+static INLINE OPJ_UINT32 opj_uint_ceildivpow2(OPJ_UINT32 a, OPJ_UINT32 b)
+{
+ return (OPJ_UINT32)((a + ((OPJ_UINT64)1U << b) - 1U) >> b);
}
/**
Divide an integer by a power of 2 and round downwards
@return Returns a divided by 2^b
*/
-static INLINE OPJ_INT32 opj_int_floordivpow2(OPJ_INT32 a, OPJ_INT32 b) {
- return a >> b;
+static INLINE OPJ_INT32 opj_int_floordivpow2(OPJ_INT32 a, OPJ_INT32 b)
+{
+ return a >> b;
}
/**
Get logarithm of an integer and round downwards
@return Returns log2(a)
*/
-static INLINE OPJ_INT32 opj_int_floorlog2(OPJ_INT32 a) {
- OPJ_INT32 l;
- for (l = 0; a > 1; l++) {
- a >>= 1;
- }
- return l;
+static INLINE OPJ_INT32 opj_int_floorlog2(OPJ_INT32 a)
+{
+ OPJ_INT32 l;
+ for (l = 0; a > 1; l++) {
+ a >>= 1;
+ }
+ return l;
}
/**
Get logarithm of an integer and round downwards
@return Returns log2(a)
*/
-static INLINE OPJ_UINT32 opj_uint_floorlog2(OPJ_UINT32 a) {
- OPJ_UINT32 l;
- for (l = 0; a > 1; ++l)
- {
- a >>= 1;
- }
- return l;
+static INLINE OPJ_UINT32 opj_uint_floorlog2(OPJ_UINT32 a)
+{
+ OPJ_UINT32 l;
+ for (l = 0; a > 1; ++l) {
+ a >>= 1;
+ }
+ return l;
}
/**
@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)) ;
}
/* ----------------------------------------------------------------------- */
/*
- * The 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.
*
/*
- * The 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.
*
/*
- * The 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.
*
/*
- * The 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, 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.
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 */
/**
* 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
@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
@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);
/*
- * The 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.
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);
/*
- * The 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, 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.
#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 */
*/
typedef struct opj_t1 {
- /** 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;
+ /** 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_t1_t;
#define MACRO_t1_flags(x,y) t1->flags[((x)*(t1->flags_stride))+(y)]
@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
@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);
/* 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
};
/*
- * The 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, 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.
*
*/
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 */
@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
@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);
/*
- * The 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, 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.
*
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;
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;
/**
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;
/**
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
/**
* 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);
/**
@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
/*
- * The 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, Professor Benoit Macq
* Copyright (c) 2001-2003, David Janssens
* Copyright (c) 2002-2003, Yannick Verschueren
- * Copyright (c) 2003-2007, Francois-Olivier Devaux
+ * Copyright (c) 2003-2007, Francois-Olivier Devaux
* Copyright (c) 2003-2014, Antonin Descampe
* Copyright (c) 2005, Herve Drolon, FreeImage Team
* Copyright (c) 2008, Jerome Fimes, Communications & Systemes <jerome.fimes@c-s.fr>
- * Copyright (c) 2011-2012, Centre National d'Etudes Spatiales (CNES), France
+ * Copyright (c) 2011-2012, Centre National d'Etudes Spatiales (CNES), France
* Copyright (c) 2012, CS Systemes d'Information, France
* All rights reserved.
*
/**
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;
@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
@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
@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
@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);
/* ----------------------------------------------------------------------- */
/*@}*/
/*
- * The 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.
*
* @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);
/*@}*/
* @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);
/*@}*/
* @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
* @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.
*
/*
- * The 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.
*
/*
- * The 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.
*
#ifndef __BIO_H
#define __BIO_H
-/**
+/**
@file bio.h
@brief Implementation of an individual bit input-output (BIO)
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);
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);
/**
/**
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);
/*
- * The 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.
*
/*
- * The 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.
*
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 */
/*@{*/
/*
- * The 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.
*
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 */
/*@{*/
/*@{*/
/* ----------------------------------------------------------------------- */
/**
-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)
/*
- * The 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.
*
@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)) ;
}
/*@}*/
/*
- * The 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.
*
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
<ul>
<li>Returns a if (min < a < max)
<li>Returns max if (a > max)
-<li>Returns min if (a < min)
+<li>Returns min if (a < min)
</ul>
*/
-static int int_clamp(int a, int min, int max) {
- if (a < min)
- return min;
- if (a > max)
- return max;
- return a;
+static int int_clamp(int a, int min, int max)
+{
+ if (a < min) {
+ return min;
+ }
+ if (a > max) {
+ return max;
+ }
+ return a;
}
/**
@return Get absolute value of integer
*/
-static int int_abs(int a) {
- return a < 0 ? -a : a;
+static int int_abs(int a)
+{
+ return a < 0 ? -a : a;
}
-static double dbl_abs(double a) {
- return a < 0 ? -a : a;
+static double dbl_abs(double a)
+{
+ return a < 0 ? -a : a;
}
/**
Divide an integer and round upwards
@return Returns a divided by b
*/
-static int int_ceildiv(int a, int b) {
- return (a + b - 1) / b;
+static int int_ceildiv(int a, int b)
+{
+ return (a + b - 1) / b;
}
/**
Divide an integer by a power of 2 and round upwards
@return Returns a divided by 2^b
*/
-static int int_ceildivpow2(int a, int b) {
- return (a + (1 << b) - 1) >> b;
+static int int_ceildivpow2(int a, int b)
+{
+ return (a + (1 << b) - 1) >> b;
}
/**
Divide an integer by a power of 2 and round downwards
@return Returns a divided by 2^b
*/
-static int int_floordivpow2(int a, int b) {
- return a >> b;
+static int int_floordivpow2(int a, int b)
+{
+ return a >> b;
}
/**
Get logarithm of an integer and round downwards
@return Returns log2(a)
*/
-static int int_floorlog2(int a) {
- int l;
- for (l = 0; a > 1; l++) {
- a >>= 1;
- }
- return l;
+static int int_floorlog2(int a)
+{
+ int l;
+ for (l = 0; a > 1; l++) {
+ a >>= 1;
+ }
+ return l;
}
/* ----------------------------------------------------------------------- */
/*@}*/
/*
- * The 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.
*
#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 */
#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
/* ----------------------------------------------------------------------- */
/**
-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;
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;
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 */
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
*/
*/
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
@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);
/* ----------------------------------------------------------------------- */
/*@}*/
/*
- * The 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.
*
@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.
@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);
/* ----------------------------------------------------------------------- */
/*@}*/
/*
- * The 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.
*
/**
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);
/**
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);
/* ----------------------------------------------------------------------- */
/*
- * The 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.
*
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
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);
*/
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
*/
*/
void mqc_flush(opj_mqc_t *mqc);
/**
-BYPASS mode switch, initialization operation.
-JPEG 2000 p 505.
+BYPASS mode switch, initialization operation.
+JPEG 2000 p 505.
<h2>Not fully implemented and tested !!</h2>
@param mqc MQC handle
*/
void mqc_bypass_init_enc(opj_mqc_t *mqc);
/**
-BYPASS mode switch, coding operation.
-JPEG 2000 p 505.
+BYPASS mode switch, coding operation.
+JPEG 2000 p 505.
<h2>Not fully implemented and tested !!</h2>
@param mqc MQC handle
@param d The symbol to be encoded (0 or 1)
/*
- * The 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.
*
#ifndef OPENJPEG_H
#define OPENJPEG_H
-/*
+/*
==========================================================
Compiler directives
==========================================================
#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.
*/
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
==========================================================
/** 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
==========================================================
/**
Callback function prototype for events
@param msg Event message
-@param client_data
+@param client_data
*/
-typedef void (*opj_msg_callback) (const char *msg, void *client_data);
+typedef void (*opj_msg_callback)(const char *msg, void *client_data);
/**
Message handler object
-used for
+used for
<ul>
<li>Error messages
<li>Warning messages
</ul>
*/
typedef struct opj_event_mgr {
- /** Error message callback if available, NULL otherwise */
- opj_msg_callback error_handler;
- /** Warning message callback if available, NULL otherwise */
- opj_msg_callback warning_handler;
- /** Debug message callback if available, NULL otherwise */
- opj_msg_callback info_handler;
+ /** Error message callback if available, NULL otherwise */
+ opj_msg_callback error_handler;
+ /** Warning message callback if available, NULL otherwise */
+ opj_msg_callback warning_handler;
+ /** Debug message callback if available, NULL otherwise */
+ opj_msg_callback info_handler;
} opj_event_mgr_t;
-/*
+/*
==========================================================
codec typedef definitions
==========================================================
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;
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;
-
-/** 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;
-
-/** 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;
-
-/** 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 precinct size specifications */
- int res_spec;
-/** initial precinct width */
- int prct_init[3][J3D_MAXRLVLS];
-
-/** 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 */
- /*@}*/
+ /** 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;
+
+ /** 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;
+
+ /** 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 precinct size specifications */
+ int res_spec;
+ /** initial precinct width */
+ int prct_init[3][J3D_MAXRLVLS];
+
+ /** 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;
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
==========================================================
* 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
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
==========================================================
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
#endif
-/*
+/*
==========================================================
openjpeg version
==========================================================
OPJ_API const char * OPJ_CALLCONV opj_version(void);
-/*
+/*
==========================================================
volume functions definitions
==========================================================
@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
*/
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
*/
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
==========================================================
@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
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
*/
OPJ_API void OPJ_CALLCONV opj_destroy_compress(opj_cinfo_t *cinfo);
/**
-Set encoding parameters to default values, that means :
+Set encoding parameters to default values, that means :
<ul>
<li>Lossless
<li>1 tile
</ul>
@param parameters Compression parameters
*/
-OPJ_API void OPJ_CALLCONV opj_set_default_encoder_parameters(opj_cparameters_t *parameters);
+OPJ_API void OPJ_CALLCONV opj_set_default_encoder_parameters(
+ opj_cparameters_t *parameters);
/**
-Setup the encoder parameters using the current volume and using user parameters.
+Setup the encoder parameters using the current volume and using user parameters.
@param cinfo compressor handle
@param parameters compression parameters
@param volume input filled volume
*/
-OPJ_API void OPJ_CALLCONV opj_setup_encoder(opj_cinfo_t *cinfo, opj_cparameters_t *parameters, opj_volume_t *volume);
+OPJ_API void OPJ_CALLCONV opj_setup_encoder(opj_cinfo_t *cinfo,
+ opj_cparameters_t *parameters, opj_volume_t *volume);
/**
Encode an volume into a JPEG-2000 codestream
@param cinfo compressor handle
@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
}
/*
- * The 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.
*
/*
- * The 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.
*
/*@{*/
/**
-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 */
/**
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);
/* ----------------------------------------------------------------------- */
/*
- * The 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.
*
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);
/*
- * The 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.
*
/* ----------------------------------------------------------------------- */
#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)
#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)*/
/* ----------------------------------------------------------------------- */
Tier-1 coding (coding of code-block coefficients)
*/
typedef struct opj_t1 {
- /** 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;*/
+ /** 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;*/
} 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
/**
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
@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]);
/* ----------------------------------------------------------------------- */
/*@}*/
/* ----------------------------------------------------------------------- */
/* 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*/
/* ----------------------------------------------------------------------- */
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
/**
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
/*
- * The 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.
*
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 */
@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
@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
/*
- * The 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.
*
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 */
*/
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
@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
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
@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
/*
- * The 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.
*
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 */
@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
/*@}*/
/* ----------------------------------------------------------------------- */
-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 */
/*
- * The 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.
*
#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;
/**
* @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
* @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_ */
* 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;
* @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);
/**
* @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);
/**
* @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
* @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
* @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
* @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);
/**
* @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);
/**
* @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);
/**
* @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
* @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
* @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
* @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
* @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);
/**
* @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);
/**
*
* @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
* @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);
/**
* @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);
/**
*
* @param[in,out] boxlist address of the box list pointer
*/
-void delete_boxlist( boxlist_param_t **boxlist);
+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_ */
* 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;
* @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
* @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_ */
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef BYTE_MANAGER_H_
-#define BYTE_MANAGER_H_
+#ifndef BYTE_MANAGER_H_
+#define BYTE_MANAGER_H_
#include <stddef.h>
#include "openjpeg.h"
* @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);
/**
* @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
* @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
* @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
* @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);
/**
* @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
* @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
* @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
* @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_ */
* 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;
* @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
* @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);
/**
* @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);
/**
* @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);
/**
* @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);
/**
* @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
* @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);
/**
* @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);
/**
* @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);
/**
*
* @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_ */
* 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;
* @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);
/**
*
* @param[in] cachemodel cache model
*/
-void print_cachemodel( cachemodel_param_t cachemodel);
+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);
/**
* @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);
/**
*
* @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_ */
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef CHANNEL_MANAGER_H_
-# define CHANNEL_MANAGER_H_
+#ifndef CHANNEL_MANAGER_H_
+# define CHANNEL_MANAGER_H_
#include <time.h>
#include "query_parser.h"
#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;
* @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
* @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
* @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);
/**
*
* @param[in,out] channellist address of the channel list pointer
*/
-void delete_channellist( channellist_param_t **channellist);
+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);
/**
* @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_ */
* 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;
* @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);
/**
* @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
* @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
* @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
* @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);
/**
*
* @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_ */
*
* 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.
*
* 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"
* @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
* @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
* @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
* @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
* @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
* @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
* @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
* @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_ */
* 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;
* @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);
/**
*
* @param[in] faix faix box pointer
*/
-void print_faixbox( faixbox_param_t *faix);
+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
* @param[in] elem_id element id in a row (0<= <nmax)
* @param[in] row_id row id (0<= <m)
*/
-Byte8_t get_elemOff( faixbox_param_t *faix, Byte8_t elem_id, Byte8_t row_id);
+Byte8_t get_elemOff(faixbox_param_t *faix, Byte8_t elem_id, Byte8_t row_id);
/**
* get length of a element from faix box
* @param[in] elem_id element id in a row (0<= <nmax)
* @param[in] row_id row id (0<= <m)
*/
-Byte8_t get_elemLen( faixbox_param_t *faix, Byte8_t elem_id, Byte8_t row_id);
+Byte8_t get_elemLen(faixbox_param_t *faix, Byte8_t elem_id, Byte8_t row_id);
/**
* get aux of a element from faix box
* @param[in] elem_id element id in a row (0<= <nmax)
* @param[in] row_id row id (0<= <m)
*/
-Byte4_t get_elemAux( faixbox_param_t *faix, Byte8_t elem_id, Byte8_t row_id);
+Byte4_t get_elemAux(faixbox_param_t *faix, Byte8_t elem_id, Byte8_t row_id);
-#endif /* !FAIXBOX_MANAGER_H_ */
+#endif /* !FAIXBOX_MANAGER_H_ */
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef IHDRBOX_MANAGER_H_
-# define IHDRBOX_MANAGER_H_
+#ifndef IHDRBOX_MANAGER_H_
+# define IHDRBOX_MANAGER_H_
#include "byte_manager.h"
#include "box_manager.h"
#include "metadata_manager.h"
/** I.5.3.1 Image Header box*/
-typedef struct ihdrbox_param{
- Byte4_t height;
- Byte4_t width;
- Byte2_t nc; /**< number of components*/
- Byte_t bpc; /**< bits per component*/
+typedef struct ihdrbox_param {
+ Byte4_t height;
+ Byte4_t width;
+ Byte2_t nc; /**< number of components*/
+ Byte_t bpc; /**< bits per component*/
} ihdrbox_param_t;
/**
* @param[in] jpipstream JPT/JPP stream
* @return pointer to generated ihdr box
*/
-ihdrbox_param_t * gene_ihdrbox( metadatalist_param_t *metadatalist, Byte_t *jpipstream);
+ihdrbox_param_t * gene_ihdrbox(metadatalist_param_t *metadatalist,
+ Byte_t *jpipstream);
-#endif /* !IHDRBOX_MANAGER_H_ */
+#endif /* !IHDRBOX_MANAGER_H_ */
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef IMGREG_MANAGER_H_
-# define IMGREG_MANAGER_H_
+#ifndef IMGREG_MANAGER_H_
+# define IMGREG_MANAGER_H_
/** image region parameters */
-typedef struct imgreg_param{
- int xosiz, yosiz; /** offset from the origin of the reference grid
- at the decomposition level */
- int fx, fy; /** frame size (fsiz) */
- int ox, oy; /** offset (roff) */
- int sx, sy; /** region size (rsiz) */
- int level; /** decomposition level */
+typedef struct imgreg_param {
+ int xosiz, yosiz; /** offset from the origin of the reference grid
+ at the decomposition level */
+ int fx, fy; /** frame size (fsiz) */
+ int ox, oy; /** offset (roff) */
+ int sx, sy; /** region size (rsiz) */
+ int level; /** decomposition level */
} imgreg_param_t;
* @param[in] numOfreslev number of resolution levels
* @return structure of image region parameters
*/
-imgreg_param_t map_viewin2imgreg( const int fx, const int fy,
- const int rx, const int ry,
- const int rw, const int rh,
- const int XOsiz, const int YOsiz,
- const int Xsiz, const int Ysiz,
- const int numOfreslev);
+imgreg_param_t map_viewin2imgreg(const int fx, const int fy,
+ const int rx, const int ry,
+ const int rw, const int rh,
+ const int XOsiz, const int YOsiz,
+ const int Xsiz, const int Ysiz,
+ const int numOfreslev);
/**
* @param[in,out] xmax horizontal image size pointer
* @param[in,out] ymax vertical image size pointer
*/
-void find_level( int maxlev, int *lev, int *fx, int *fy, int *xmin, int *ymin, int *xmax, int *ymax);
+void find_level(int maxlev, int *lev, int *fx, int *fy, int *xmin, int *ymin,
+ int *xmax, int *ymax);
/**
* compute decomposition level (only to get the level
* @param[in] Ysiz image height
* @return decomposition level
*/
-int comp_decomplev( int fw, int fh, int Xsiz, int Ysiz);
+int comp_decomplev(int fw, int fh, int Xsiz, int Ysiz);
/**
* print image region parameters
*
* @param[in] imgreg image region structure of parameters
*/
-void print_imgreg( imgreg_param_t imgreg);
+void print_imgreg(imgreg_param_t imgreg);
-#endif /* !IMGREG_MANAGER_H_ */
+#endif /* !IMGREG_MANAGER_H_ */
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef IMGSOCK_MANAGER_H_
-# define IMGSOCK_MANAGER_H_
+#ifndef IMGSOCK_MANAGER_H_
+# define IMGSOCK_MANAGER_H_
#include "byte_manager.h"
#include "sock_manager.h"
#include "opj_includes.h"
#define NUM_OF_MSGTYPES 9
-typedef enum eMSGTYPE{ JPIPSTREAM, PNMREQ, XMLREQ, TIDREQ, CIDREQ, CIDDST, SIZREQ, JP2SAVE, QUIT, MSGERROR} msgtype_t;
+typedef enum eMSGTYPE { JPIPSTREAM, PNMREQ, XMLREQ, TIDREQ, CIDREQ, CIDDST, SIZREQ, JP2SAVE, QUIT, MSGERROR} msgtype_t;
/**
* indeitify client message type
* @param [in] connected_socket file descriptor of the connected socket
* @return message type
*/
-msgtype_t identify_clientmsg( SOCKET connected_socket);
+msgtype_t identify_clientmsg(SOCKET connected_socket);
/**
* receive a JPT- JPP- stream from client
* @param [out] streamlen length of the received codestream
* @return JPT- JPP- codestream
*/
-Byte_t * receive_JPIPstream( SOCKET connected_socket, char **target, char **tid, char **cid, OPJ_SIZE_T *streamlen);
+Byte_t * receive_JPIPstream(SOCKET connected_socket, char **target, char **tid,
+ char **cid, OPJ_SIZE_T *streamlen);
/**
* send PGM/PPM image stream to the client
* @param [in] numofcomp number of components of the image
* @param [in] maxval maximum value of the image (only 255 supported)
*/
-void send_PNMstream( SOCKET connected_socket, Byte_t *pnmstream, unsigned int width, unsigned int height, unsigned int numofcomp, Byte_t maxval);
+void send_PNMstream(SOCKET connected_socket, Byte_t *pnmstream,
+ unsigned int width, unsigned int height, unsigned int numofcomp, Byte_t maxval);
/**
* send XML data stream to the client
* @param [in] xmlstream xml data stream
* @param [in] length legnth of the xml data stream
*/
-void send_XMLstream( SOCKET connected_socket, Byte_t *xmlstream, OPJ_SIZE_T length);
+void send_XMLstream(SOCKET connected_socket, Byte_t *xmlstream,
+ OPJ_SIZE_T length);
/**
* send TID data stream to the client
* @param [in] tid tid string
* @param [in] tidlen legnth of the tid string
*/
-void send_TIDstream( SOCKET connected_socket, const char *tid, OPJ_SIZE_T tidlen);
+void send_TIDstream(SOCKET connected_socket, const char *tid,
+ OPJ_SIZE_T tidlen);
/**
* send CID data stream to the client
* @param [in] cid cid string
* @param [in] cidlen legnth of the cid string
*/
-void send_CIDstream( SOCKET connected_socket, const char *cid, OPJ_SIZE_T cidlen);
+void send_CIDstream(SOCKET connected_socket, const char *cid,
+ OPJ_SIZE_T cidlen);
/**
* send SIZ data stream to the client
* @param [in] width original width of the image
* @param [in] height original height of the image
*/
-void send_SIZstream( SOCKET connected_socket, unsigned int width, unsigned int height);
+void send_SIZstream(SOCKET connected_socket, unsigned int width,
+ unsigned int height);
/**
* send response signal to the client
* @param [in] connected_socket file descriptor of the connected socket
* @param [in] succeed whether if the requested process succeeded
*/
-void response_signal( SOCKET connected_socket, OPJ_BOOL succeed);
+void response_signal(SOCKET connected_socket, OPJ_BOOL succeed);
#endif /* !IMGSOCK_MANAGER_H_ */
*
* client -> server: JPIP-stream\\n version 1.1\\n (optional for cid registration: targetnamestring\\n tidstring\\n cidstring\\n) bytelengthvalue\\n data \n
* server -> client: 1 or 0 (of 1Byte response signal)
- *
+ *
*\section sec2 PNM request
* Get decoded PGM/PPM image
*
* 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"
/** 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;
* @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;
/**
* @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
* @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);
/**
* @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);
/**
* @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_ */
*
* 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.
*
* @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
* @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
* @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_ */
* 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_ */
*
* 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.
*
* 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"
* @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);
/**
* @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
* @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_ */
*
* 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.
*
* 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"
* @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
* @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
*
* @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)
* @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)
* @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_ */
#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);
* 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"
/** 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;
* @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);
/**
*
* @param[in,out] manf addressof the manfbox pointer
*/
-void delete_manfbox( manfbox_param_t **manf);
+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);
/**
* @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_ */
* 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;
* @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);
/**
* @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
* @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
* @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_ */
* 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;
* @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);
/**
*
* @param[in,out] list address of the metadata list pointer
*/
-void delete_metadatalist( metadatalist_param_t **list);
+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);
/**
* @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);
/**
* @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);
/**
* @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_ */
* 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;
* @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);
/**
* @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);
/**
*
* @param[in] mhix mhix box pointer
*/
-void print_mhixbox( mhixbox_param_t *mhix);
+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);
/**
*
* @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_ */
*
* 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.
*
* 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"
#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;
/**
* @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
* @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);
/**
*
* @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
* @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
* @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
* @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);
/**
* @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);
/**
* @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);
/**
* @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
* @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
* @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_ */
#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;
/**
* @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
* @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
* @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)
* @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
*==========================================================
#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;
* @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
* @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
*==========================================================
*/
/** 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;
/**
* @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
* @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
* @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
* @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
/**
* 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);
/**
*
* @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*/
* 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;
*
* @param[in,out] list address of the placeholder list pointer
*/
-void delete_placeholderlist( placeholderlist_param_t **list);
+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);
/**
*
* @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);
/**
*
* @param[in] phld placeholder pointer
*/
-void print_placeholder( placeholder_param_t *phld);
+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_ */
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef QUERY_PARSER_H_
-# define QUERY_PARSER_H_
+#ifndef QUERY_PARSER_H_
+# define QUERY_PARSER_H_
#include "opj_includes.h"
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;
* @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);
/**
*
* @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_ */
* 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;
* @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
* @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
* @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);
/**
* @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);
/**
*
* @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_ */
* 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"
* @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
* @param listening_socket listenning socket
* @return connected socket (-1 if error occurs)
*/
-SOCKET accept_socket( SOCKET listening_socket);
+SOCKET accept_socket(SOCKET listening_socket);
/**
* @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
* @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
* @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
* @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_ */
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef TARGET_MANAGER_H_
-# define TARGET_MANAGER_H_
+#ifndef TARGET_MANAGER_H_
+# define TARGET_MANAGER_H_
#include "index_manager.h"
#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;
* @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);
/**
* @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);
/**
*
* @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);
/**
* @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);
/**
*
* @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);
/**
* @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);
/**
* @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_ */
/*
- * The 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.
*
* CRC-checksum.
*
* implemented by Michael Neumann, 14.06.1998
- *
+ *
*/
void updateCRC16(unsigned short *, unsigned char);
/*
- * The 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.
*
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
@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
@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
@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
@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
/*
- * The 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.
*
* 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;
/** 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[]);
/*
- * The 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, 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.
#ifndef __BIO_H
#define __BIO_H
-/**
+/**
@file bio.h
@brief Implementation of an individual bit input-output (BIO)
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);
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);
/**
/**
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);
/*
- * The 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, 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.
@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
/*
- * The 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, 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.
*/
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
*/
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
*/
/*
- * The 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.
*
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 */
/*@{*/
/*@{*/
/* ----------------------------------------------------------------------- */
/**
-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,
+ ...);
/* ----------------------------------------------------------------------- */
/*@}*/
/*
- * The 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, 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.
@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) ;
}
/*@}*/
/*
- * The 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.
*
/*
- * The 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, 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.
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
<ul>
<li>Returns a if (min < a < max)
<li>Returns max if (a > max)
-<li>Returns min if (a < min)
+<li>Returns min if (a < min)
</ul>
*/
-static INLINE 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;
}
/* ----------------------------------------------------------------------- */
/*@}*/
/*
- * The 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, 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
/* ----------------------------------------------------------------------- */
-#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) */
/* ----------------------------------------------------------------------- */
/**
-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 */
-/* <<UniPG */
+ /* <<UniPG */
} opj_cp_t;
/**
JPEG-2000 codestream reader/writer
*/
typedef struct opj_j2k {
- /** codec context */
- opj_common_ptr cinfo;
+ /** 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;
- /** Tile part number*/
- int tp_num;
- /** Tilepart number currently coding*/
- int cur_tp_num;
- /** Total number of tileparts of the current tile*/
- int *cur_totnum_tp;
- /**
- locate the start position of the TLM marker
- after encoding the tilepart, a jump (in j2k_write_sod) is done to the TLM marker to store the value of its length.
- */
- int tlm_start;
- /** Total num of tile parts in whole image = num tiles* num tileparts in each tile*/
- /** used in TLMmarker*/
- int totnum_tp;
- /**
- locate the position of the end of the tile in the codestream,
- used to detect a truncated codestream (in j2k_read_sod)
- */
- unsigned char *eot;
- /**
- locate the start position of the SOT marker of the current coded tile:
- after encoding the tile, a jump (in j2k_write_sod) is done to the SOT marker to store the value of its length.
- */
- int sot_start;
- int sod_start;
- /**
- as the J2K-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 (information like COD, COC in main header)
- */
- opj_tcp_t *default_tcp;
- /** pointer to the encoded / decoded image */
- opj_image_t *image;
- /** pointer to the coding parameters */
- opj_cp_t *cp;
- /** helper used to write the index file */
- opj_codestream_info_t *cstr_info;
- /** pointer to the byte i/o stream */
- opj_cio_t *cio;
+ /** 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;
+ /** Tile part number*/
+ int tp_num;
+ /** Tilepart number currently coding*/
+ int cur_tp_num;
+ /** Total number of tileparts of the current tile*/
+ int *cur_totnum_tp;
+ /**
+ locate the start position of the TLM marker
+ after encoding the tilepart, a jump (in j2k_write_sod) is done to the TLM marker to store the value of its length.
+ */
+ int tlm_start;
+ /** Total num of tile parts in whole image = num tiles* num tileparts in each tile*/
+ /** used in TLMmarker*/
+ int totnum_tp;
+ /**
+ locate the position of the end of the tile in the codestream,
+ used to detect a truncated codestream (in j2k_read_sod)
+ */
+ unsigned char *eot;
+ /**
+ locate the start position of the SOT marker of the current coded tile:
+ after encoding the tile, a jump (in j2k_write_sod) is done to the SOT marker to store the value of its length.
+ */
+ int sot_start;
+ int sod_start;
+ /**
+ as the J2K-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 (information like COD, COC in main header)
+ */
+ opj_tcp_t *default_tcp;
+ /** pointer to the encoded / decoded image */
+ opj_image_t *image;
+ /** pointer to the coding parameters */
+ opj_cp_t *cp;
+ /** helper used to write the index file */
+ opj_codestream_info_t *cstr_info;
+ /** pointer to the byte i/o stream */
+ opj_cio_t *cio;
} opj_j2k_t;
/** @name Exported functions */
void j2k_destroy_decompress(opj_j2k_t *j2k);
/**
Setup the decoder decoding parameters using user parameters.
-Decoding parameters are returned in j2k->cp.
+Decoding parameters are returned in j2k->cp.
@param j2k J2K decompressor handle
@param parameters decompression parameters
*/
@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
@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
*/
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
*/
@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);
/* ----------------------------------------------------------------------- */
/*@}*/
/*
- * The 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.
*
/*
- * The 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.
*
/** @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;
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;
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 */
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
*/
@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
*/
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
@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);
/* ----------------------------------------------------------------------- */
/*@}*/
/*
- * The 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.
*
@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);
@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
/*
- * The 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, 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.
/**
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);
/**
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);
/* ----------------------------------------------------------------------- */
Decompressed format used in parameters
YUV = 0
*/
-#define YUV_DFMT 1
+#define YUV_DFMT 1
/**
Compressed format used in parameters
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;
/*@{*/
/* ----------------------------------------------------------------------- */
/**
-Write the JP box
+Write the JP box
*/
OPJ_API void OPJ_CALLCONV mj2_write_jp(opj_cio_t *cio);
/**
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
*/
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
@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
/**
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);
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);
/*
- * The 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, 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.
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
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;
/*@{*/
/* ----------------------------------------------------------------------- */
/**
-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);
*/
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
*/
@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
*/
void mqc_flush(opj_mqc_t *mqc);
/**
-BYPASS mode switch, initialization operation.
-JPEG 2000 p 505.
+BYPASS mode switch, initialization operation.
+JPEG 2000 p 505.
<h2>Not fully implemented and tested !!</h2>
@param mqc MQC handle
*/
void mqc_bypass_init_enc(opj_mqc_t *mqc);
/**
-BYPASS mode switch, coding operation.
-JPEG 2000 p 505.
+BYPASS mode switch, coding operation.
+JPEG 2000 p 505.
<h2>Not fully implemented and tested !!</h2>
@param mqc MQC handle
@param d The symbol to be encoded (0 or 1)
- /*
- * The 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
==========================================================
#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.
*/
/* Avoid compile-time warning because parameter is not used */
#define OPJ_ARG_NOT_USED(x) (void)(x)
-/*
+/*
==========================================================
Useful constant definitions
==========================================================
#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 */
#define JPWL_MAXIMUM_EPB_ROOM 65450 /**< Expect this maximum number of bytes for composition of EPBs */
/* <<UniPG */
-/*
+/*
==========================================================
enum definitions
==========================================================
*/
-/**
+/**
Rsiz Capabilities
*/
typedef enum RSIZ_CAPABILITIES {
- STD_RSIZ = 0, /** Standard JPEG2000 profile*/
- CINEMA2K = 3, /** Profile name for a 2K image*/
- CINEMA4K = 4 /** Profile name for a 4K image*/
+ STD_RSIZ = 0, /** Standard JPEG2000 profile*/
+ CINEMA2K = 3, /** Profile name for a 2K image*/
+ CINEMA4K = 4 /** Profile name for a 4K image*/
} OPJ_RSIZ_CAPABILITIES;
-/**
-Digital cinema operation mode
+/**
+Digital cinema operation mode
*/
typedef enum CINEMA_MODE {
- OFF = 0, /** Not Digital Cinema*/
- CINEMA2K_24 = 1, /** 2K Digital Cinema at 24 fps*/
- CINEMA2K_48 = 2, /** 2K Digital Cinema at 48 fps*/
- CINEMA4K_24 = 3 /** 4K Digital Cinema at 24 fps*/
-}OPJ_CINEMA_MODE;
+ OFF = 0, /** Not Digital Cinema*/
+ CINEMA2K_24 = 1, /** 2K Digital Cinema at 24 fps*/
+ CINEMA2K_48 = 2, /** 2K Digital Cinema at 48 fps*/
+ CINEMA4K_24 = 3 /** 4K Digital Cinema at 24 fps*/
+} OPJ_CINEMA_MODE;
-/**
-Progression order
+/**
+Progression order
*/
typedef enum PROG_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 */
+ 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 */
} OPJ_PROG_ORDER;
/**
Supported image color spaces
*/
typedef enum COLOR_SPACE {
- CLRSPC_UNKNOWN = -1, /**< not supported by the library */
- CLRSPC_UNSPECIFIED = 0, /**< not specified in the codestream */
- CLRSPC_SRGB = 1, /**< sRGB */
- CLRSPC_GRAY = 2, /**< grayscale */
- CLRSPC_SYCC = 3 /**< YUV */
+ CLRSPC_UNKNOWN = -1, /**< not supported by the library */
+ CLRSPC_UNSPECIFIED = 0, /**< not specified in the codestream */
+ CLRSPC_SRGB = 1, /**< sRGB */
+ CLRSPC_GRAY = 2, /**< grayscale */
+ CLRSPC_SYCC = 3 /**< YUV */
} OPJ_COLOR_SPACE;
#define ENUMCS_SRGB 16
Supported codec
*/
typedef enum CODEC_FORMAT {
- CODEC_UNKNOWN = -1, /**< place-holder */
- CODEC_J2K = 0, /**< JPEG-2000 codestream : read/write */
- CODEC_JPT = 1, /**< JPT-stream (JPEG 2000, JPIP) : read only */
- CODEC_JP2 = 2 /**< JPEG-2000 file format : read/write */
+ CODEC_UNKNOWN = -1, /**< place-holder */
+ CODEC_J2K = 0, /**< JPEG-2000 codestream : read/write */
+ CODEC_JPT = 1, /**< JPT-stream (JPEG 2000, JPIP) : read only */
+ CODEC_JP2 = 2 /**< JPEG-2000 file format : read/write */
} OPJ_CODEC_FORMAT;
-/**
-Limit decoding to certain portions of the codestream.
+/**
+Limit decoding to certain portions of the codestream.
*/
typedef enum LIMIT_DECODING {
- NO_LIMITATION = 0, /**< No limitation for the decoding. The entire codestream will de decoded */
- LIMIT_TO_MAIN_HEADER = 1, /**< The decoding is limited to the Main Header */
- DECODE_ALL_BUT_PACKETS = 2 /**< Decode everything except the JPEG 2000 packets */
+ NO_LIMITATION = 0, /**< No limitation for the decoding. The entire codestream will de decoded */
+ LIMIT_TO_MAIN_HEADER = 1, /**< The decoding is limited to the Main Header */
+ DECODE_ALL_BUT_PACKETS = 2 /**< Decode everything except the JPEG 2000 packets */
} OPJ_LIMIT_DECODING;
-/*
+/*
==========================================================
event manager typedef definitions
==========================================================
/**
Callback function prototype for events
@param msg Event message
-@param client_data
+@param client_data
*/
-typedef void (*opj_msg_callback) (const char *msg, void *client_data);
+typedef void (*opj_msg_callback)(const char *msg, void *client_data);
/**
Message handler object
-used for
+used for
<ul>
<li>Error messages
<li>Warning messages
</ul>
*/
typedef struct opj_event_mgr {
- /** Error message callback if available, NULL otherwise */
- opj_msg_callback error_handler;
- /** Warning message callback if available, NULL otherwise */
- opj_msg_callback warning_handler;
- /** Debug message callback if available, NULL otherwise */
- opj_msg_callback info_handler;
+ /** Error message callback if available, NULL otherwise */
+ opj_msg_callback error_handler;
+ /** Warning message callback if available, NULL otherwise */
+ opj_msg_callback warning_handler;
+ /** Debug message callback if available, NULL otherwise */
+ opj_msg_callback info_handler;
} opj_event_mgr_t;
-/*
+/*
==========================================================
codec typedef definitions
==========================================================
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];
-
- /**@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];
- /*@}*/
-/* <<UniPG */
-
- /** Digital Cinema compliance 0-not compliant, 1-compliant*/
- OPJ_CINEMA_MODE cp_cinema;
- /** Maximum rate for each component. If == 0, component size limitation is not considered */
- int max_comp_size;
- /** Profile name*/
- OPJ_RSIZ_CAPABILITIES cp_rsiz;
- /** Tile part generation*/
- char tp_on;
- /** Flag for Tile part generation*/
- char tp_flag;
- /** MCT (multiple component transform) */
- char tcp_mct;
+ /** 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;
+ /*@}*/
+
+ /* 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];
+ /*@}*/
+ /* <<UniPG */
+
+ /** Digital Cinema compliance 0-not compliant, 1-compliant*/
+ OPJ_CINEMA_MODE cp_cinema;
+ /** Maximum rate for each component. If == 0, component size limitation is not considered */
+ int max_comp_size;
+ /** Profile name*/
+ OPJ_RSIZ_CAPABILITIES cp_rsiz;
+ /** Tile part generation*/
+ char tp_on;
+ /** Flag for Tile part generation*/
+ char tp_flag;
+ /** MCT (multiple component transform) */
+ char tcp_mct;
} opj_cparameters_t;
-#define OPJ_DPARAMETERS_IGNORE_PCLR_CMAP_CDEF_FLAG 0x0001
+#define OPJ_DPARAMETERS_IGNORE_PCLR_CMAP_CDEF_FLAG 0x0001
/**
Decompression parameters
*/
typedef struct opj_dparameters {
- /**
- Set the number of highest resolution levels to be discarded.
- The image resolution is effectively divided by 2 to the power of the number of discarded levels.
- The reduce factor is limited by the smallest total number of decomposition levels among tiles.
- if != 0, then original dimension divided by 2^(reduce);
- if == 0 or not used, image is decoded to the full resolution
- */
- int cp_reduce;
- /**
- Set the maximum number of quality layers to decode.
- If there are less quality layers than the specified number, all the quality layers are decoded.
- if != 0, then only the first "layer" layers are decoded;
- if == 0 or not used, all the quality layers are decoded
- */
- int cp_layer;
-
- /**@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];
- /** input file format 0: J2K, 1: JP2, 2: JPT */
- int decod_format;
- /** output file format 0: PGX, 1: PxM, 2: BMP */
- int cod_format;
- /*@}*/
-
-/* UniPG>> */
- /**@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;
- /*@}*/
-/* <<UniPG */
-
- /**
- Specify whether the decoding should be done on the entire codestream, or be limited to the main header
- Limiting the decoding to the main header makes it possible to extract the characteristics of the codestream
- if == NO_LIMITATION, the entire codestream is decoded;
- if == LIMIT_TO_MAIN_HEADER, only the main header is decoded;
- */
- OPJ_LIMIT_DECODING cp_limit_decoding;
-
- unsigned int flags;
+ /**
+ Set the number of highest resolution levels to be discarded.
+ The image resolution is effectively divided by 2 to the power of the number of discarded levels.
+ The reduce factor is limited by the smallest total number of decomposition levels among tiles.
+ if != 0, then original dimension divided by 2^(reduce);
+ if == 0 or not used, image is decoded to the full resolution
+ */
+ int cp_reduce;
+ /**
+ Set the maximum number of quality layers to decode.
+ If there are less quality layers than the specified number, all the quality layers are decoded.
+ if != 0, then only the first "layer" layers are decoded;
+ if == 0 or not used, all the quality layers are decoded
+ */
+ int cp_layer;
+
+ /**@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];
+ /** input file format 0: J2K, 1: JP2, 2: JPT */
+ int decod_format;
+ /** output file format 0: PGX, 1: PxM, 2: BMP */
+ int cod_format;
+ /*@}*/
+
+ /* UniPG>> */
+ /**@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;
+ /*@}*/
+ /* <<UniPG */
+
+ /**
+ Specify whether the decoding should be done on the entire codestream, or be limited to the main header
+ Limiting the decoding to the main header makes it possible to extract the characteristics of the codestream
+ if == NO_LIMITATION, the entire codestream is decoded;
+ if == LIMIT_TO_MAIN_HEADER, only the main header is decoded;
+ */
+ OPJ_LIMIT_DECODING cp_limit_decoding;
+
+ unsigned int flags;
} 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 */\
- opj_bool is_decompressor; /**< So common code can tell which is which */\
- OPJ_CODEC_FORMAT codec_format; /**< selected codec */\
- void *j2k_handle; /**< pointer to the J2K codec */\
- void *jp2_handle; /**< pointer to the JP2 codec */\
- void *mj2_handle /**< pointer to the MJ2 codec */
-
+ opj_event_mgr_t *event_mgr; /**< pointer to the event manager */\
+ void * client_data; /**< Available for use by application */\
+ opj_bool is_decompressor; /**< So common code can tell which is which */\
+ OPJ_CODEC_FORMAT codec_format; /**< selected codec */\
+ void *j2k_handle; /**< pointer to the J2K codec */\
+ void *jp2_handle; /**< pointer to the JP2 codec */\
+ void *mj2_handle /**< pointer to the MJ2 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;
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
==========================================================
* 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
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;
-/*
+/*
==========================================================
image typedef definitions
==========================================================
Defines a single image component
*/
typedef struct opj_image_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;
- /** data width */
- int w;
- /** data height */
- int h;
- /** x component offset compared to the whole image */
- int x0;
- /** y component offset compared to the whole image */
- int y0;
- /** precision */
- int prec;
- /** image depth in bits */
- int bpp;
- /** signed (1) / unsigned (0) */
- int sgnd;
- /** number of decoded resolution */
- int resno_decoded;
- /** number of division by 2 of the out image compared to the original size of image */
- int factor;
- /** image 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;
+ /** data width */
+ int w;
+ /** data height */
+ int h;
+ /** x component offset compared to the whole image */
+ int x0;
+ /** y component offset compared to the whole image */
+ int y0;
+ /** precision */
+ int prec;
+ /** image depth in bits */
+ int bpp;
+ /** signed (1) / unsigned (0) */
+ int sgnd;
+ /** number of decoded resolution */
+ int resno_decoded;
+ /** number of division by 2 of the out image compared to the original size of image */
+ int factor;
+ /** image component data */
+ int *data;
} opj_image_comp_t;
-/**
+/**
Defines image data and characteristics
*/
typedef struct opj_image {
- /** XOsiz: horizontal offset from the origin of the reference grid to the left side of the image area */
- int x0;
- /** YOsiz: vertical offset from the origin of the reference grid to the top side of the image area */
- int y0;
- /** Xsiz: width of the reference grid */
- int x1;
- /** Ysiz: height of the reference grid */
- int y1;
- /** number of components in the image */
- int numcomps;
- /** color space: sRGB, Greyscale or YUV */
- OPJ_COLOR_SPACE color_space;
- /** image components */
- opj_image_comp_t *comps;
- /** 'restricted' ICC profile */
- unsigned char *icc_profile_buf;
- /** size of ICC profile */
- int icc_profile_len;
+ /** XOsiz: horizontal offset from the origin of the reference grid to the left side of the image area */
+ int x0;
+ /** YOsiz: vertical offset from the origin of the reference grid to the top side of the image area */
+ int y0;
+ /** Xsiz: width of the reference grid */
+ int x1;
+ /** Ysiz: height of the reference grid */
+ int y1;
+ /** number of components in the image */
+ int numcomps;
+ /** color space: sRGB, Greyscale or YUV */
+ OPJ_COLOR_SPACE color_space;
+ /** image components */
+ opj_image_comp_t *comps;
+ /** 'restricted' ICC profile */
+ unsigned char *icc_profile_buf;
+ /** size of ICC profile */
+ int icc_profile_len;
} opj_image_t;
/**
Component parameters structure used by the opj_image_create function
*/
typedef struct opj_image_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;
- /** data width */
- int w;
- /** data height */
- int h;
- /** x component offset compared to the whole image */
- int x0;
- /** y component offset compared to the whole image */
- int y0;
- /** precision */
- int prec;
- /** image depth in bits */
- int bpp;
- /** signed (1) / unsigned (0) */
- int sgnd;
+ /** 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;
+ /** data width */
+ int w;
+ /** data height */
+ int h;
+ /** x component offset compared to the whole image */
+ int x0;
+ /** y component offset compared to the whole image */
+ int y0;
+ /** precision */
+ int prec;
+ /** image depth in bits */
+ int bpp;
+ /** signed (1) / unsigned (0) */
+ int sgnd;
} opj_image_cmptparm_t;
-/*
+/*
==========================================================
Information on the JPEG 2000 codestream
==========================================================
Index structure : Information concerning a packet inside tile
*/
typedef struct opj_packet_info {
- /** packet start position (including SOP marker if it exists) */
- int start_pos;
- /** end of packet header position (including EPH marker if it exists)*/
- int end_ph_pos;
- /** packet end position */
- int end_pos;
- /** packet distorsion */
- double disto;
+ /** packet start position (including SOP marker if it exists) */
+ int start_pos;
+ /** end of packet header position (including EPH marker if it exists)*/
+ int end_ph_pos;
+ /** packet end position */
+ int end_pos;
+ /** packet distorsion */
+ double disto;
} opj_packet_info_t;
Marker structure
*/
typedef struct opj_marker_info_t {
- /** marker type */
- unsigned short int type;
- /** position in codestream */
- int pos;
- /** length, marker val included */
- int len;
+ /** marker type */
+ unsigned short int type;
+ /** position in codestream */
+ int pos;
+ /** length, marker val included */
+ int len;
} opj_marker_info_t;
/* <<UniPG */
Index structure : Information concerning tile-parts
*/
typedef struct opj_tp_info {
- /** start position of tile part */
- int tp_start_pos;
- /** end position of tile part header */
- int tp_end_header;
- /** end position of tile part */
- int tp_end_pos;
- /** start packet of tile part */
- int tp_start_pack;
- /** number of packets of tile part */
- int tp_numpacks;
+ /** start position of tile part */
+ int tp_start_pos;
+ /** end position of tile part header */
+ int tp_end_header;
+ /** end position of tile part */
+ int tp_end_pos;
+ /** start packet of tile part */
+ int tp_start_pack;
+ /** number of packets of tile part */
+ int tp_numpacks;
} opj_tp_info_t;
/**
-Index structure : information regarding tiles
+Index structure : information regarding tiles
*/
typedef struct opj_tile_info {
- /** value of thresh for each layer by tile cfr. Marcela */
- double *thresh;
- /** number of tile */
- int tileno;
- /** 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) */
- int pw[33];
- /** precinct number for each resolution level (height) */
- int ph[33];
- /** precinct size (in power of 2), in X for each resolution level */
- int pdx[33];
- /** precinct size (in power of 2), in Y for each resolution level */
- int pdy[33];
- /** information concerning packets inside tile */
- opj_packet_info_t *packet;
- /** add fixed_quality */
- int numpix;
- /** add fixed_quality */
- double distotile;
- /** number of markers */
- int marknum;
- /** list of markers */
- opj_marker_info_t *marker;
- /** actual size of markers array */
- int maxmarknum;
- /** number of tile parts */
- int num_tps;
- /** information concerning tile parts */
- opj_tp_info_t *tp;
+ /** value of thresh for each layer by tile cfr. Marcela */
+ double *thresh;
+ /** number of tile */
+ int tileno;
+ /** 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) */
+ int pw[33];
+ /** precinct number for each resolution level (height) */
+ int ph[33];
+ /** precinct size (in power of 2), in X for each resolution level */
+ int pdx[33];
+ /** precinct size (in power of 2), in Y for each resolution level */
+ int pdy[33];
+ /** information concerning packets inside tile */
+ opj_packet_info_t *packet;
+ /** add fixed_quality */
+ int numpix;
+ /** add fixed_quality */
+ double distotile;
+ /** number of markers */
+ int marknum;
+ /** list of markers */
+ opj_marker_info_t *marker;
+ /** actual size of markers array */
+ int maxmarknum;
+ /** number of tile parts */
+ int num_tps;
+ /** information concerning tile parts */
+ opj_tp_info_t *tp;
} opj_tile_info_t;
/**
Index structure of the codestream
*/
typedef struct opj_codestream_info {
- /** maximum distortion reduction on the whole image (add for Marcela) */
- double D_max;
- /** packet number */
- int packno;
- /** writing the packet in the index with t2_encode_packets */
- int index_write;
- /** image width */
- int image_w;
- /** image height */
- int image_h;
- /** progression order */
- OPJ_PROG_ORDER prog;
- /** tile size in x */
- int tile_x;
- /** tile size in y */
- int tile_y;
- /** */
- int tile_Ox;
- /** */
- int tile_Oy;
- /** number of tiles in X */
- int tw;
- /** number of tiles in Y */
- int th;
- /** component numbers */
- int numcomps;
- /** number of layer */
- int numlayers;
- /** number of decomposition for each component */
- int *numdecompos;
-/* UniPG>> */
- /** number of markers */
- int marknum;
- /** list of markers */
- opj_marker_info_t *marker;
- /** actual size of markers array */
- int maxmarknum;
-/* <<UniPG */
- /** main header position */
- int main_head_start;
- /** main header position */
- int main_head_end;
- /** codestream's size */
- int codestream_size;
- /** information regarding tiles inside image */
- opj_tile_info_t *tile;
+ /** maximum distortion reduction on the whole image (add for Marcela) */
+ double D_max;
+ /** packet number */
+ int packno;
+ /** writing the packet in the index with t2_encode_packets */
+ int index_write;
+ /** image width */
+ int image_w;
+ /** image height */
+ int image_h;
+ /** progression order */
+ OPJ_PROG_ORDER prog;
+ /** tile size in x */
+ int tile_x;
+ /** tile size in y */
+ int tile_y;
+ /** */
+ int tile_Ox;
+ /** */
+ int tile_Oy;
+ /** number of tiles in X */
+ int tw;
+ /** number of tiles in Y */
+ int th;
+ /** component numbers */
+ int numcomps;
+ /** number of layer */
+ int numlayers;
+ /** number of decomposition for each component */
+ int *numdecompos;
+ /* UniPG>> */
+ /** number of markers */
+ int marknum;
+ /** list of markers */
+ opj_marker_info_t *marker;
+ /** actual size of markers array */
+ int maxmarknum;
+ /* <<UniPG */
+ /** main header position */
+ int main_head_start;
+ /** main header position */
+ int main_head_end;
+ /** codestream's size */
+ int codestream_size;
+ /** information regarding tiles inside image */
+ opj_tile_info_t *tile;
} opj_codestream_info_t;
#ifdef __cplusplus
#endif
-/*
+/*
==========================================================
openjpeg version
==========================================================
OPJ_API const char * OPJ_CALLCONV opj_version(void);
-/*
+/*
==========================================================
image functions definitions
==========================================================
@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(int numcmpts, opj_image_cmptparm_t *cmptparms, OPJ_COLOR_SPACE clrspc);
+OPJ_API opj_image_t* OPJ_CALLCONV opj_image_create(int numcmpts,
+ opj_image_cmptparm_t *cmptparms, OPJ_COLOR_SPACE clrspc);
/**
Deallocate any resources associated with an image
*/
OPJ_API void OPJ_CALLCONV opj_image_destroy(opj_image_t *image);
-/*
+/*
==========================================================
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
*/
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
==========================================================
@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
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 j2k->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
@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
*/
OPJ_API void OPJ_CALLCONV opj_destroy_compress(opj_cinfo_t *cinfo);
/**
-Set encoding parameters to default values, that means :
+Set encoding parameters to default values, that means :
<ul>
<li>Lossless
<li>1 tile
</ul>
@param parameters Compression parameters
*/
-OPJ_API void OPJ_CALLCONV opj_set_default_encoder_parameters(opj_cparameters_t *parameters);
+OPJ_API void OPJ_CALLCONV opj_set_default_encoder_parameters(
+ opj_cparameters_t *parameters);
/**
-Setup the encoder parameters using the current 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
@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
@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
/*
- * The 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.
*
/* 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(<Compiler>) */
+#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(<Compiler>) */
#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
}
*/
/* 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 <mm_malloc.h>
- #define HAVE_MM_MALLOC
- #else /* MSVC, Intel C++ */
- #include <malloc.h>
- #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 <mm_malloc.h>
+#define HAVE_MM_MALLOC
+#else /* MSVC, Intel C++ */
+#include <malloc.h>
+#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 <malloc.h>
- #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 <malloc.h>
+#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);
-
- 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)
+#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)
#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
/**
/*
- * The 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, 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.
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 */
@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
@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
@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
/**
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);
/* ----------------------------------------------------------------------- */
/*
- * The 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.
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);
/*
- * The 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, 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.
/* ----------------------------------------------------------------------- */
#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)
#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)*/
/* ----------------------------------------------------------------------- */
Tier-1 coding (coding of code-block coefficients)
*/
typedef struct opj_t1 {
- /** codec context */
- opj_common_ptr cinfo;
-
- /** 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;
+ /** codec context */
+ opj_common_ptr cinfo;
+
+ /** 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;
} opj_t1_t;
#define MACRO_t1_flags(x,y) t1->flags[((x)*(t1->flags_stride))+(y)]
/*@{*/
/* ----------------------------------------------------------------------- */
/**
-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
/* 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
};
/*
- * The 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, 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.
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 */
@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
@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
/*
- * The 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, 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.
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 */
@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
@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
@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
@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
/*
- * The 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, 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.
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 */
@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