Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4758 | right-hear | 1 | /* |
2 | * Copyright (c) 2007, Digital Signal Processing Laboratory, Università degli studi di Perugia (UPG), Italy |
||
3 | * All rights reserved. |
||
4 | * |
||
5 | * Redistribution and use in source and binary forms, with or without |
||
6 | * modification, are permitted provided that the following conditions |
||
7 | * are met: |
||
8 | * 1. Redistributions of source code must retain the above copyright |
||
9 | * notice, this list of conditions and the following disclaimer. |
||
10 | * 2. Redistributions in binary form must reproduce the above copyright |
||
11 | * notice, this list of conditions and the following disclaimer in the |
||
12 | * documentation and/or other materials provided with the distribution. |
||
13 | * |
||
14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' |
||
15 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
||
16 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
||
17 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
||
18 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
||
19 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
||
20 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
||
21 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
||
22 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
||
23 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
||
24 | * POSSIBILITY OF SUCH DAMAGE. |
||
25 | */ |
||
26 | ///////////////////////////////////////////////////////////////////////////// |
||
27 | // Name: imagalljpeg2000.h |
||
28 | // Purpose: wxImage JPEG 2000 family file format handler |
||
29 | // Author: G. Baruffa - based on imagjpeg.h, Vaclav Slavik |
||
30 | // RCS-ID: $Id: imagalljpeg2000.h,v 0.0 2008/01/31 11:22:00 VZ Exp $ |
||
31 | // Copyright: (c) Giuseppe Baruffa |
||
32 | // Licence: wxWindows licence |
||
33 | ///////////////////////////////////////////////////////////////////////////// |
||
34 | |||
35 | #ifndef _WX_IMAGJPEG2000_H_ |
||
36 | #define _WX_IMAGJPEG2000_H_ |
||
37 | |||
38 | #include "wx/defs.h" |
||
39 | |||
40 | //----------------------------------------------------------------------------- |
||
41 | // wxJPEG2000Handler |
||
42 | //----------------------------------------------------------------------------- |
||
43 | |||
44 | #if wxUSE_LIBOPENJPEG |
||
45 | |||
46 | #include "wx/image.h" |
||
47 | #include "libopenjpeg/openjpeg.h" |
||
48 | #include "codec/index.h" |
||
49 | |||
50 | #define wxBITMAP_TYPE_JPEG2000 50 |
||
51 | |||
52 | class WXDLLEXPORT wxJPEG2000Handler: public wxImageHandler |
||
53 | { |
||
54 | public: |
||
55 | inline wxJPEG2000Handler() |
||
56 | { |
||
57 | m_name = wxT("JPEG 2000 family file format"); |
||
58 | m_extension = wxT("mj2"); |
||
59 | m_type = wxBITMAP_TYPE_JPEG2000; |
||
60 | m_mime = wxT("image/mj2"); |
||
61 | |||
62 | /* decoding */ |
||
63 | m_reducefactor = 0; |
||
64 | m_qualitylayers = 0; |
||
65 | m_components = 0; |
||
66 | #ifdef USE_JPWL |
||
67 | m_enablejpwl = true; |
||
68 | m_expcomps = JPWL_EXPECTED_COMPONENTS; |
||
69 | m_maxtiles = JPWL_MAXIMUM_TILES; |
||
70 | #endif // USE_JPWL |
||
71 | |||
72 | /* encoding */ |
||
73 | m_subsampling = wxT("1,1"); |
||
74 | m_origin = wxT("0,0"); |
||
75 | m_rates = wxT("20,10,5"); |
||
76 | m_quality = wxT("30,35,40"); |
||
77 | m_enablequality = false; |
||
78 | m_multicomp = false; |
||
79 | m_irreversible = false; |
||
80 | m_resolutions = 6; |
||
81 | m_progression = 0; |
||
82 | m_cbsize = wxT("32,32"); |
||
83 | m_prsize = wxT("[128,128],[128,128]"); |
||
84 | m_tsize = wxT(""); |
||
85 | m_torigin = wxT("0,0"); |
||
86 | /*m_progression |
||
87 | m_resilience*/ |
||
88 | m_enablesop = false; |
||
89 | m_enableeph = false; |
||
90 | m_enablereset = false; |
||
91 | m_enablesegmark = false; |
||
92 | m_enablevsc = false; |
||
93 | m_enablerestart = false; |
||
94 | m_enableerterm = false; |
||
95 | m_enablebypass = false; |
||
96 | /*m_roicompo |
||
97 | m_roiup |
||
98 | m_indexfname*/ |
||
99 | m_enableidx = false; |
||
100 | m_index = wxT("index.txt"); |
||
101 | m_enablepoc = false; |
||
102 | m_poc = wxT("T1=0,0,1,5,3,CPRL/T1=5,0,1,6,3,CPRL"); |
||
103 | m_enablecomm = true; |
||
104 | |||
105 | #if defined __WXMSW__ |
||
106 | m_comment = wxT("Created by OPJViewer Win32 - OpenJPEG version "); |
||
107 | #elif defined __WXGTK__ |
||
108 | m_comment = wxT("Created by OPJViewer Lin32 - OpenJPEG version "); |
||
109 | #else |
||
110 | m_comment = wxT("Created by OPJViewer - OpenJPEG version "); |
||
111 | #endif |
||
112 | |||
113 | #ifdef USE_JPWL |
||
114 | m_comment += wxString::Format(wxT("%s with JPWL"), (char *) opj_version()); |
||
115 | #else |
||
116 | m_comment += wxString::Format(wxT("%s"), (char *) opj_version()); |
||
117 | #endif |
||
118 | |||
119 | } |
||
120 | |||
121 | // decoding engine parameters |
||
122 | int m_reducefactor, m_qualitylayers, m_components, m_framenum; |
||
123 | #ifdef USE_JPWL |
||
124 | bool m_enablejpwl; |
||
125 | int m_expcomps, m_maxtiles; |
||
126 | #endif // USE_JPWL |
||
127 | |||
128 | // encoding engine parameters |
||
129 | wxString m_subsampling; |
||
130 | wxString m_origin; |
||
131 | wxString m_rates; |
||
132 | wxString m_quality; |
||
133 | bool m_enablequality; |
||
134 | bool m_multicomp; |
||
135 | bool m_irreversible; |
||
136 | int m_resolutions; |
||
137 | int m_progression; |
||
138 | wxString m_cbsize; |
||
139 | wxString m_prsize; |
||
140 | wxString m_tsize; |
||
141 | wxString m_torigin; |
||
142 | /*m_progression |
||
143 | m_resilience*/ |
||
144 | bool m_enablesop; |
||
145 | bool m_enableeph; |
||
146 | bool m_enablebypass; |
||
147 | bool m_enableerterm; |
||
148 | bool m_enablerestart; |
||
149 | bool m_enablereset; |
||
150 | bool m_enablesegmark; |
||
151 | bool m_enablevsc; |
||
152 | /*m_roicompo |
||
153 | m_roiup |
||
154 | m_indexfname*/ |
||
155 | bool m_enableidx; |
||
156 | wxString m_index; |
||
157 | bool m_enablecomm; |
||
158 | wxString m_comment; |
||
159 | bool m_enablepoc; |
||
160 | wxString m_poc; |
||
161 | |||
162 | #if wxUSE_STREAMS |
||
163 | virtual bool LoadFile(wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1); |
||
164 | virtual bool SaveFile(wxImage *image, wxOutputStream& stream, bool verbose=true); |
||
165 | protected: |
||
166 | virtual bool DoCanRead(wxInputStream& stream); |
||
167 | #endif |
||
168 | |||
169 | private: |
||
170 | OPJ_PROG_ORDER give_progression(char progression[4]); |
||
171 | DECLARE_DYNAMIC_CLASS(wxJPEG2000Handler) |
||
172 | }; |
||
173 | |||
174 | #endif // wxUSE_LIBOPENJPEG |
||
175 | |||
176 | #endif // _WX_IMAGJPEG2000_H_ |
||
177 |