JunkBox_Lib  1.10.2
jp2k_tool.h
Go to the documentation of this file.
1 #ifndef __JBXL_JP2K_TOOL_H_
2 #define __JBXL_JP2K_TOOL_H_
3 
16 #include "xtools.h"
17 
18 #ifndef HAVE_OPENJPEG_H
19 #ifndef DISABLE_OPENJPEG
20 #define DISABLE_OPENJPEG
21 #endif
22 #endif
23 
24 #ifdef DISABLE_OPENJPEG
25 #undef ENABLE_OPENJPEG
26 #endif
27 
28 
29 #ifdef ENABLE_OPENJPEG
30 
31 #ifndef OPENJPEG_VER
32  #define OPENJPEG_VER 12
33 #endif
34 
35 #define JP2K_VER_12 12
36 #define JP2K_VER_14 14
37 #define JP2K_VER_15 15
38 #define JP2K_VER_20 20
39 #define JP2K_VER_21 21
40 
41 
42 #include "gdata.h"
43 
44 
45 #if OPENJPEG_VER <= JP2K_VER_15
46  #undef OFF
47  #ifdef WIN32
48  #ifdef _DEBUG
49  #pragma comment(lib, "LibOpenJPEGd.lib")
50  #else
51  #pragma comment(lib, "LibOpenJPEG.lib")
52  #endif
53  #endif
54 #elif OPENJPEG_VER == JP2K_VER_21
55  #ifdef WIN32
56  #pragma comment(lib, "openjp2.lib")
57  #endif
58 #else // default JP2K_VER_20
59  #ifdef WIN32
60  #pragma comment(lib, "openjp2.lib")
61  #endif
62 #endif
63 
64 #include <openjpeg.h>
65 
66 
67 #define JP2K_MAGIC_RFC3745_JP2 "\x00\x00\x00\x0c\x6a\x50\x20\x20\x0d\x0a\x87\x0a"
68 #define JP2K_MAGIC_JP2 "\x0d\x0a\x87\x0a"
69 #define JP2K_MAGIC_J2K "\xff\x4f\xff\x51"
70 
71 #define JP2K_FMT_NONE 0
72 #define JP2K_FMT_JP2 1
73 #define JP2K_FMT_J2K 2
74 #define JP2K_FMT_JPT 3
75 
76 
77 typedef struct
78 {
79  int xs;
80  int ys;
81  int ws;
82  int hs;
83  int col;
84  int cmode;
85  int state;
86  opj_image_t* image;
87  //
88 } JP2KImage;
89 
90 
92 void init_jp2k(JP2KImage* jp);
93 void free_jp2k(JP2KImage* jp);
94 void setup_jp2k(JP2KImage* jp);
95 int get_jp2k_format(uByte* header);
96 
97 JP2KImage read_jp2k_file(const char* fname);
98 
99 #if OPENJPEG_VER <= JP2K_VER_15
100 JP2KImage read_jp2k_data(unsigned char* data, int len, int format);
101 #elif OPENJPEG_VER >= JP2K_VER_21
102 JP2KImage read_jp2k_data(const char* fname, int format);
103 #else //JP2K_VER_20
104 JP2KImage read_jp2k_data(FILE* fp, int format);
105 #endif
106 
107 //int write_jp2k_file(const char* fname, JP2KImage* jp, int qulty);
108 //int write_jp2k_mem(unsigned char** buf, unsigned long* len, JP2KImage* jp, int qulty);
109 
110 BSGraph jp2k_toBSGraph(JP2KImage jp);
111 //JP2KImage BSGraph2_jp2k(BSGraph vp);
112 //JP2KImage make_jp2k(int xs, int ys, int col);
113 
114 
115 #endif // ENABLE_OPENJPEG
116 #endif // __JBXL_JP2K_TOOL_H_
117 
unsigned char uByte
1Byte
Definition: common.h:332
グラフィックデータ定義用ヘッダ
void free_jp2k(JP2KImage *jp)
Definition: jp2k_tool2.c:36
void init_jp2k(JP2KImage *jp)
Definition: jp2k_tool2.c:21
int get_jp2k_format(uByte *buf)
Definition: jp2k_tool2.c:102
BSGraph jp2k_toBSGraph(JP2KImage jp)
Definition: jp2k_tool2.c:249
JP2KImage read_jp2k_file(const char *fname)
Definition: jp2k_tool2.c:116
JP2KImage read_jp2k_data(const char *fname, int format)
Definition: jp2k_tool2.c:156
void setup_jp2k(JP2KImage *jp)
Definition: jp2k_tool2.c:47
unsigned char unsigned long * len
Definition: jpeg_tool.h:96
Definition: gdata.h:27
汎用拡張ツールヘッダ