2014-03-12 20:25:59 +04:00
|
|
|
/*
|
|
|
|
* The Python Imaging Library
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* declarations for the OpenJPEG codec interface.
|
|
|
|
*
|
|
|
|
* Copyright (c) 2014 by Coriolis Systems Limited
|
|
|
|
* Copyright (c) 2014 by Alastair Houghton
|
|
|
|
*/
|
|
|
|
|
2014-05-27 15:43:54 +04:00
|
|
|
#include <openjpeg.h>
|
2014-03-12 20:25:59 +04:00
|
|
|
|
2016-05-29 01:07:36 +03:00
|
|
|
/* 1MB for now */
|
|
|
|
#define BUFFER_SIZE OPJ_J2K_STREAM_CHUNK_SIZE
|
|
|
|
|
2014-03-12 20:25:59 +04:00
|
|
|
/* -------------------------------------------------------------------- */
|
2020-05-01 15:08:57 +03:00
|
|
|
/* Decoder */
|
2014-03-13 22:27:16 +04:00
|
|
|
/* -------------------------------------------------------------------- */
|
2014-03-12 20:25:59 +04:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
/* CONFIGURATION */
|
|
|
|
|
2014-03-14 15:21:08 +04:00
|
|
|
/* File descriptor, if available; otherwise, -1 */
|
|
|
|
int fd;
|
|
|
|
|
2016-05-29 01:07:36 +03:00
|
|
|
/* File pointer, when opened */
|
2021-01-03 06:17:51 +03:00
|
|
|
FILE *pfile;
|
2016-05-29 01:07:36 +03:00
|
|
|
|
2014-05-27 15:43:54 +04:00
|
|
|
/* Length of data, if available; otherwise, -1 */
|
|
|
|
off_t length;
|
|
|
|
|
2014-03-12 20:25:59 +04:00
|
|
|
/* Specify the desired format */
|
|
|
|
OPJ_CODEC_FORMAT format;
|
|
|
|
|
|
|
|
/* Set to divide image resolution by 2**reduce. */
|
2021-01-03 06:17:51 +03:00
|
|
|
int reduce;
|
2014-03-12 20:25:59 +04:00
|
|
|
|
|
|
|
/* Set to limit the number of quality layers to decode (0 = all layers) */
|
2021-01-03 06:17:51 +03:00
|
|
|
int layers;
|
2014-03-12 20:25:59 +04:00
|
|
|
|
|
|
|
/* PRIVATE CONTEXT (set by decoder) */
|
2021-01-03 06:17:51 +03:00
|
|
|
const char *error_msg;
|
2016-09-03 05:23:42 +03:00
|
|
|
|
2014-03-13 22:27:16 +04:00
|
|
|
} JPEG2KDECODESTATE;
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
2020-05-01 15:08:57 +03:00
|
|
|
/* Encoder */
|
2014-03-13 22:27:16 +04:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
/* CONFIGURATION */
|
|
|
|
|
2014-03-14 15:21:08 +04:00
|
|
|
/* File descriptor, if available; otherwise, -1 */
|
2021-01-03 06:17:51 +03:00
|
|
|
int fd;
|
2014-03-14 15:21:08 +04:00
|
|
|
|
2016-05-29 01:07:36 +03:00
|
|
|
/* File pointer, when opened */
|
2021-01-03 06:17:51 +03:00
|
|
|
FILE *pfile;
|
2016-05-29 01:07:36 +03:00
|
|
|
|
2014-03-13 22:27:16 +04:00
|
|
|
/* Specify the desired format */
|
|
|
|
OPJ_CODEC_FORMAT format;
|
|
|
|
|
|
|
|
/* Image offset */
|
2021-01-03 06:17:51 +03:00
|
|
|
int offset_x, offset_y;
|
2014-03-13 22:27:16 +04:00
|
|
|
|
|
|
|
/* Tile information */
|
2021-01-03 06:17:51 +03:00
|
|
|
int tile_offset_x, tile_offset_y;
|
|
|
|
int tile_size_x, tile_size_y;
|
2014-03-13 22:27:16 +04:00
|
|
|
|
|
|
|
/* Quality layers (a sequence of numbers giving *either* rates or dB) */
|
2021-01-03 06:17:51 +03:00
|
|
|
int quality_is_in_db;
|
|
|
|
PyObject *quality_layers;
|
2014-03-13 22:27:16 +04:00
|
|
|
|
|
|
|
/* Number of resolutions (DWT decompositions + 1 */
|
2021-01-03 06:17:51 +03:00
|
|
|
int num_resolutions;
|
2014-03-13 22:27:16 +04:00
|
|
|
|
|
|
|
/* Code block size */
|
2021-01-03 06:17:51 +03:00
|
|
|
int cblk_width, cblk_height;
|
2014-03-13 22:27:16 +04:00
|
|
|
|
2014-03-14 19:40:30 +04:00
|
|
|
/* Precinct size */
|
2021-01-03 06:17:51 +03:00
|
|
|
int precinct_width, precinct_height;
|
2014-03-14 19:40:30 +04:00
|
|
|
|
2014-03-13 22:27:16 +04:00
|
|
|
/* Compression style */
|
2021-01-03 06:17:51 +03:00
|
|
|
int irreversible;
|
2014-03-13 22:27:16 +04:00
|
|
|
|
2021-05-11 13:01:35 +03:00
|
|
|
/* Set multiple component transformation */
|
|
|
|
char mct;
|
|
|
|
|
2014-03-13 22:27:16 +04:00
|
|
|
/* Progression order (LRCP/RLCP/RPCL/PCRL/CPRL) */
|
|
|
|
OPJ_PROG_ORDER progression;
|
|
|
|
|
|
|
|
/* Cinema mode */
|
|
|
|
OPJ_CINEMA_MODE cinema_mode;
|
|
|
|
|
|
|
|
/* PRIVATE CONTEXT (set by decoder) */
|
2021-01-03 06:17:51 +03:00
|
|
|
const char *error_msg;
|
2016-05-29 01:07:36 +03:00
|
|
|
|
2014-03-13 22:27:16 +04:00
|
|
|
} JPEG2KENCODESTATE;
|
2014-03-12 20:25:59 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Local Variables:
|
|
|
|
* c-basic-offset: 4
|
|
|
|
* End:
|
|
|
|
*
|
|
|
|
*/
|