aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/Pillow/py2/libImaging/Jpeg2K.h
blob: 7bb14eb2c0ddb34f8e4f02721539e94d5aac3581 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/*
 * The Python Imaging Library
 * $Id$
 *
 * declarations for the OpenJPEG codec interface.
 *
 * Copyright (c) 2014 by Coriolis Systems Limited
 * Copyright (c) 2014 by Alastair Houghton
 */

#include <openjpeg.h>

/* 1MB for now */
#define BUFFER_SIZE OPJ_J2K_STREAM_CHUNK_SIZE

/* -------------------------------------------------------------------- */
/* Decoder								*/
/* -------------------------------------------------------------------- */

typedef struct {
    /* CONFIGURATION */

    /* File descriptor, if available; otherwise, -1 */
    int fd;

    /* File pointer, when opened */
    FILE * pfile;

    /* Length of data, if available; otherwise, -1 */
    off_t length;

    /* Specify the desired format */
    OPJ_CODEC_FORMAT format;

    /* Set to divide image resolution by 2**reduce. */
    int            reduce;

    /* Set to limit the number of quality layers to decode (0 = all layers) */
    int            layers;

    /* PRIVATE CONTEXT (set by decoder) */
    const char    *error_msg;

} JPEG2KDECODESTATE;

/* -------------------------------------------------------------------- */
/* Encoder								*/
/* -------------------------------------------------------------------- */

typedef struct {
    /* CONFIGURATION */

    /* File descriptor, if available; otherwise, -1 */
    int           fd;

    /* File pointer, when opened */
    FILE * pfile;

    /* Specify the desired format */
    OPJ_CODEC_FORMAT format;

    /* Image offset */
    int            offset_x, offset_y;

    /* Tile information */
    int            tile_offset_x, tile_offset_y;
    int            tile_size_x, tile_size_y;

    /* Quality layers (a sequence of numbers giving *either* rates or dB) */
    int            quality_is_in_db;
    PyObject      *quality_layers;

    /* Number of resolutions (DWT decompositions + 1 */
    int            num_resolutions;

    /* Code block size */
    int            cblk_width, cblk_height;

    /* Precinct size */
    int            precinct_width, precinct_height;

    /* Compression style */
    int            irreversible;

    /* Progression order (LRCP/RLCP/RPCL/PCRL/CPRL) */
    OPJ_PROG_ORDER progression;

    /* Cinema mode */
    OPJ_CINEMA_MODE cinema_mode;

    /* PRIVATE CONTEXT (set by decoder) */
    const char    *error_msg;


} JPEG2KENCODESTATE;

/*
 * Local Variables:
 * c-basic-offset: 4
 * End:
 *
 */