23 #ifndef AVCODEC_JPEG2000_H 24 #define AVCODEC_JPEG2000_H 38 enum Jpeg2000Markers {
39 JPEG2000_SOC = 0xff4f,
40 JPEG2000_SIZ = 0xff51,
43 JPEG2000_TLM = 0xff55,
44 JPEG2000_PLM = 0xff57,
46 JPEG2000_QCD = 0xff5c,
52 JPEG2000_CRG = 0xff63,
54 JPEG2000_SOT = 0xff90,
58 JPEG2000_EOC = 0xffd9,
61 #define JPEG2000_SOP_FIXED_BYTES 0xFF910004 62 #define JPEG2000_SOP_BYTE_LENGTH 6 64 enum Jpeg2000Quantsty {
70 #define JPEG2000_MAX_DECLEVELS 33 71 #define JPEG2000_MAX_RESLEVELS (JPEG2000_MAX_DECLEVELS + 1) 73 #define JPEG2000_MAX_PASSES 100 77 #define JPEG2000_T1_SIG_N 0x0001 78 #define JPEG2000_T1_SIG_E 0x0002 79 #define JPEG2000_T1_SIG_W 0x0004 80 #define JPEG2000_T1_SIG_S 0x0008 81 #define JPEG2000_T1_SIG_NE 0x0010 82 #define JPEG2000_T1_SIG_NW 0x0020 83 #define JPEG2000_T1_SIG_SE 0x0040 84 #define JPEG2000_T1_SIG_SW 0x0080 85 #define JPEG2000_T1_SIG_NB (JPEG2000_T1_SIG_N | JPEG2000_T1_SIG_E | \ 86 JPEG2000_T1_SIG_S | JPEG2000_T1_SIG_W | \ 87 JPEG2000_T1_SIG_NE | JPEG2000_T1_SIG_NW | \ 88 JPEG2000_T1_SIG_SE | JPEG2000_T1_SIG_SW) 90 #define JPEG2000_T1_SGN_N 0x0100 91 #define JPEG2000_T1_SGN_S 0x0200 92 #define JPEG2000_T1_SGN_W 0x0400 93 #define JPEG2000_T1_SGN_E 0x0800 95 #define JPEG2000_T1_VIS 0x1000 96 #define JPEG2000_T1_SIG 0x2000 97 #define JPEG2000_T1_REF 0x4000 99 #define JPEG2000_T1_SGN 0x8000 102 #define JPEG2000_CBLK_BYPASS 0x01 // Selective arithmetic coding bypass 103 #define JPEG2000_CBLK_RESET 0x02 // Reset context probabilities 104 #define JPEG2000_CBLK_TERMALL 0x04 // Terminate after each coding pass 105 #define JPEG2000_CBLK_VSC 0x08 // Vertical stripe causal context formation 106 #define JPEG2000_CBLK_PREDTERM 0x10 // Predictable termination 107 #define JPEG2000_CBLK_SEGSYM 0x20 // Segmentation symbols present 110 #define JPEG2000_CSTY_PREC 0x01 // Precincts defined in coding style 111 #define JPEG2000_CSTY_SOP 0x02 // SOP marker present 112 #define JPEG2000_CSTY_EPH 0x04 // EPH marker present 115 #define JPEG2000_PGOD_LRCP 0x00 // Layer-resolution level-component-position progression 116 #define JPEG2000_PGOD_RLCP 0x01 // Resolution level-layer-component-position progression 117 #define JPEG2000_PGOD_RPCL 0x02 // Resolution level-position-component-layer progression 118 #define JPEG2000_PGOD_PCRL 0x03 // Position-component-resolution level-layer progression 119 #define JPEG2000_PGOD_CPRL 0x04 // Component-position-resolution level-layer progression 123 uint16_t flags[6156];
136 int nreslevels2decode;
137 uint8_t log2_cblk_width,
145 uint8_t log2_prec_widths[JPEG2000_MAX_RESLEVELS];
146 uint8_t log2_prec_heights[JPEG2000_MAX_RESLEVELS];
150 uint8_t expn[JPEG2000_MAX_DECLEVELS * 3];
151 uint16_t mant[JPEG2000_MAX_DECLEVELS * 3];
169 uint8_t nb_lengthinc;
172 size_t data_allocated;
174 int nb_terminationsinc;
181 int nb_codeblocks_width;
182 int nb_codeblocks_height;
192 uint16_t log2_cblk_width, log2_cblk_height;
201 int num_precincts_x, num_precincts_y;
202 uint8_t log2_prec_width, log2_prec_height;
216 static inline int ff_jpeg2000_ceildivpow2(
int a,
int b)
218 return -((-(int64_t)a) >> b);
221 static inline int ff_jpeg2000_ceildiv(
int a,
int b)
223 return (a + (int64_t)b - 1) / b;
229 void ff_jpeg2000_init_tier1_luts(
void);
234 int x,
int y,
int negative);
236 extern uint8_t ff_jpeg2000_sigctxno_lut[256][4];
240 static inline int ff_jpeg2000_getsigctxno(
int flag,
int bandno)
242 return ff_jpeg2000_sigctxno_lut[flag & 255][bandno];
245 static const uint8_t refctxno_lut[2][2] = { { 14, 15 }, { 16, 16 } };
249 static inline int ff_jpeg2000_getrefctxno(
int flag)
251 return refctxno_lut[(flag >> 14) & 1][(flag & 255) != 0];
254 extern uint8_t ff_jpeg2000_sgnctxno_lut[16][16];
255 extern uint8_t ff_jpeg2000_xorbit_lut[16][16];
258 static inline int ff_jpeg2000_getsgnctxno(
int flag,
int *xorbit)
260 *xorbit = ff_jpeg2000_xorbit_lut[flag & 15][(flag >> 8) & 15];
261 return ff_jpeg2000_sgnctxno_lut[flag & 15][(flag >> 8) & 15];
267 int cbps,
int dx,
int dy,
274 static inline int needs_termination(
int style,
int passno) {
275 if (style & JPEG2000_CBLK_BYPASS) {
276 int type = passno % 3;
278 if (type == 0 && passno > 2)
280 if (type == 2 && passno > 2)
282 if (style & JPEG2000_CBLK_TERMALL) {
283 return passno > 2 ? 2 : 1;
286 if (style & JPEG2000_CBLK_TERMALL)
Definition: jpeg2000.h:156
Discrete wavelet transform.
Definition: jpeg2000.h:128
Definition: jpeg2000.h:149
Definition: jpeg2000.h:206
Definition: dirac_dwt.h:54
Definition: jpeg2000.h:134
Definition: jpeg2000.h:180
Libavcodec external API header.
Definition: jpeg2000.h:198
main external API structure.
Definition: avcodec.h:1518
Definition: jpeg2000.h:190
Definition: jpeg2000.h:121
Definition: jpeg2000.h:163