j2k.c
Go to the documentation of this file.
1 /*
2  * JPEG2000 encoder and decoder common functions
3  * Copyright (c) 2007 Kamil Nowosad
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * FFmpeg is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 /**
23  * JPEG2000 image encoder and decoder common functions
24  * @file
25  * @author Kamil Nowosad
26  */
27 
28 
29 #include "avcodec.h"
30 #include "j2k.h"
31 
32 #define SHL(a, n) ((n)>=0 ? (a) << (n) : (a) >> -(n))
33 
34 #if 0
35 void ff_j2k_printv(int *tab, int l)
36 {
37  int i;
38  for (i = 0; i < l; i++)
39  av_log(NULL, AV_LOG_DEBUG, "%.3d ", tab[i]);
40  av_log(NULL, AV_LOG_DEBUG, "\n");
41 }
42 
43 void ff_j2k_printu(uint8_t *tab, int l)
44 {
45  int i;
46  for (i = 0; i < l; i++)
47  av_log(NULL, AV_LOG_DEBUG, "%.3hd ", tab[i]);
48  av_log(NULL, AV_LOG_DEBUG, "\n");
49 }
50 #endif
51 
52 /* tag tree routines */
53 
54 /** allocate the memory for tag tree */
55 
56 static int tag_tree_size(int w, int h)
57 {
58  int res = 0;
59  while (w > 1 || h > 1){
60  res += w * h;
61  w = (w+1) >> 1;
62  h = (h+1) >> 1;
63  }
64  return res + 1;
65 }
66 
68 {
69  int pw = w, ph = h;
70  J2kTgtNode *res, *t, *t2;
71 
72  t = res = av_mallocz(tag_tree_size(w, h)*sizeof(J2kTgtNode));
73 
74  if (res == NULL)
75  return NULL;
76 
77  while (w > 1 || h > 1){
78  int i, j;
79  pw = w;
80  ph = h;
81 
82  w = (w+1) >> 1;
83  h = (h+1) >> 1;
84  t2 = t + pw*ph;
85 
86  for (i = 0; i < ph; i++)
87  for (j = 0; j < pw; j++){
88  t[i*pw + j].parent = &t2[(i>>1)*w + (j>>1)];
89  }
90  t = t2;
91  }
92  t[0].parent = NULL;
93  return res;
94 }
95 
96 static void tag_tree_zero(J2kTgtNode *t, int w, int h)
97 {
98  int i, siz = tag_tree_size(w, h);
99 
100  for (i = 0; i < siz; i++){
101  t[i].val = 0;
102  t[i].vis = 0;
103  }
104 }
105 
106 uint8_t ff_j2k_nbctxno_lut[256][4];
107 
108 static int getnbctxno(int flag, int bandno, int vert_causal_ctx_csty_symbol)
109 {
110  int h, v, d;
111 
112  h = ((flag & J2K_T1_SIG_E) ? 1:0)+
113  ((flag & J2K_T1_SIG_W) ? 1:0);
114  v = ((flag & J2K_T1_SIG_N) ? 1:0);
115  if (!vert_causal_ctx_csty_symbol)
116  v = v + ((flag & J2K_T1_SIG_S) ? 1:0);
117  d = ((flag & J2K_T1_SIG_NE) ? 1:0)+
118  ((flag & J2K_T1_SIG_NW) ? 1:0);
119  if (!vert_causal_ctx_csty_symbol)
120  d = d + ((flag & J2K_T1_SIG_SE) ? 1:0)+
121  ((flag & J2K_T1_SIG_SW) ? 1:0);
122  if (bandno < 3){
123  if (bandno == 1)
124  FFSWAP(int, h, v);
125  if (h == 2) return 8;
126  if (h == 1){
127  if (v >= 1) return 7;
128  if (d >= 1) return 6;
129  return 5;
130  }
131  if (v == 2) return 4;
132  if (v == 1) return 3;
133  if (d >= 2) return 2;
134  if (d == 1) return 1;
135  return 0;
136  } else{
137  if (d >= 3) return 8;
138  if (d == 2){
139  if (h+v >= 1) return 7;
140  return 6;
141  }
142  if (d == 1){
143  if (h+v >= 2) return 5;
144  if (h+v == 1) return 4;
145  return 3;
146  }
147  if (h+v >= 2) return 2;
148  if (h+v == 1) return 1;
149  return 0;
150  }
151 }
152 
153 uint8_t ff_j2k_sgnctxno_lut[16][16], ff_j2k_xorbit_lut[16][16];
154 
155 static int getsgnctxno(int flag, uint8_t *xorbit)
156 {
157  int vcontrib, hcontrib;
158  static const int contribtab[3][3] = {{0, -1, 1}, {-1, -1, 0}, {1, 0, 1}};
159  static const int ctxlbltab[3][3] = {{13, 12, 11}, {10, 9, 10}, {11, 12, 13}};
160  static const int xorbittab[3][3] = {{1, 1, 1,}, {1, 0, 0}, {0, 0, 0}};
161 
162  hcontrib = contribtab[flag & J2K_T1_SIG_E ? flag & J2K_T1_SGN_E ? 1:2:0]
163  [flag & J2K_T1_SIG_W ? flag & J2K_T1_SGN_W ? 1:2:0]+1;
164  vcontrib = contribtab[flag & J2K_T1_SIG_S ? flag & J2K_T1_SGN_S ? 1:2:0]
165  [flag & J2K_T1_SIG_N ? flag & J2K_T1_SGN_N ? 1:2:0]+1;
166  *xorbit = xorbittab[hcontrib][vcontrib];
167  return ctxlbltab[hcontrib][vcontrib];
168 }
169 
171 {
172  int i, j;
173  for (i = 0; i < 256; i++)
174  for (j = 0; j < 4; j++)
175  ff_j2k_nbctxno_lut[i][j] = getnbctxno(i, j, 0);
176  for (i = 0; i < 16; i++)
177  for (j = 0; j < 16; j++)
178  ff_j2k_sgnctxno_lut[i][j] = getsgnctxno(i + (j << 8), &ff_j2k_xorbit_lut[i][j]);
179 }
180 
181 void ff_j2k_set_significant(J2kT1Context *t1, int x, int y, int negative)
182 {
183  x++; y++;
184  t1->flags[y][x] |= J2K_T1_SIG;
185  if (negative){
186  t1->flags[y][x+1] |= J2K_T1_SIG_W | J2K_T1_SGN_W;
187  t1->flags[y][x-1] |= J2K_T1_SIG_E | J2K_T1_SGN_E;
188  t1->flags[y+1][x] |= J2K_T1_SIG_N | J2K_T1_SGN_N;
189  t1->flags[y-1][x] |= J2K_T1_SIG_S | J2K_T1_SGN_S;
190  } else{
191  t1->flags[y][x+1] |= J2K_T1_SIG_W;
192  t1->flags[y][x-1] |= J2K_T1_SIG_E;
193  t1->flags[y+1][x] |= J2K_T1_SIG_N;
194  t1->flags[y-1][x] |= J2K_T1_SIG_S;
195  }
196  t1->flags[y+1][x+1] |= J2K_T1_SIG_NW;
197  t1->flags[y+1][x-1] |= J2K_T1_SIG_NE;
198  t1->flags[y-1][x+1] |= J2K_T1_SIG_SW;
199  t1->flags[y-1][x-1] |= J2K_T1_SIG_SE;
200 }
201 
202 int ff_j2k_init_component(J2kComponent *comp, J2kCodingStyle *codsty, J2kQuantStyle *qntsty, int cbps, int dx, int dy)
203 {
204  int reslevelno, bandno, gbandno = 0, ret, i, j, csize = 1;
205 
206  if (ret=ff_j2k_dwt_init(&comp->dwt, comp->coord, codsty->nreslevels-1, codsty->transform))
207  return ret;
208  for (i = 0; i < 2; i++)
209  csize *= comp->coord[i][1] - comp->coord[i][0];
210 
211  comp->data = av_malloc(csize * sizeof(int));
212  if (!comp->data)
213  return AVERROR(ENOMEM);
214  comp->reslevel = av_malloc(codsty->nreslevels * sizeof(J2kResLevel));
215 
216  if (!comp->reslevel)
217  return AVERROR(ENOMEM);
218  for (reslevelno = 0; reslevelno < codsty->nreslevels; reslevelno++){
219  int declvl = codsty->nreslevels - reslevelno;
220  J2kResLevel *reslevel = comp->reslevel + reslevelno;
221 
222  for (i = 0; i < 2; i++)
223  for (j = 0; j < 2; j++)
224  reslevel->coord[i][j] =
225  ff_j2k_ceildivpow2(comp->coord[i][j], declvl - 1);
226 
227  if (reslevelno == 0)
228  reslevel->nbands = 1;
229  else
230  reslevel->nbands = 3;
231 
232  if (reslevel->coord[0][1] == reslevel->coord[0][0])
233  reslevel->num_precincts_x = 0;
234  else
235  reslevel->num_precincts_x = ff_j2k_ceildivpow2(reslevel->coord[0][1], codsty->log2_prec_width)
236  - (reslevel->coord[0][0] >> codsty->log2_prec_width);
237 
238  if (reslevel->coord[1][1] == reslevel->coord[1][0])
239  reslevel->num_precincts_y = 0;
240  else
241  reslevel->num_precincts_y = ff_j2k_ceildivpow2(reslevel->coord[1][1], codsty->log2_prec_height)
242  - (reslevel->coord[1][0] >> codsty->log2_prec_height);
243 
244  reslevel->band = av_malloc(reslevel->nbands * sizeof(J2kBand));
245  if (!reslevel->band)
246  return AVERROR(ENOMEM);
247  for (bandno = 0; bandno < reslevel->nbands; bandno++, gbandno++){
248  J2kBand *band = reslevel->band + bandno;
249  int cblkno, precx, precy, precno;
250  int x0, y0, x1, y1;
251  int xi0, yi0, xi1, yi1;
252  int cblkperprecw, cblkperprech;
253 
254  if (qntsty->quantsty != J2K_QSTY_NONE){
255  static const uint8_t lut_gain[2][4] = {{0, 0, 0, 0}, {0, 1, 1, 2}};
256  int numbps;
257 
258  numbps = cbps + lut_gain[codsty->transform][bandno + reslevelno>0];
259  band->stepsize = SHL(2048 + qntsty->mant[gbandno], 2 + numbps - qntsty->expn[gbandno]);
260  } else
261  band->stepsize = 1 << 13;
262 
263  if (reslevelno == 0){ // the same everywhere
264  band->codeblock_width = 1 << FFMIN(codsty->log2_cblk_width, codsty->log2_prec_width-1);
265  band->codeblock_height = 1 << FFMIN(codsty->log2_cblk_height, codsty->log2_prec_height-1);
266  for (i = 0; i < 2; i++)
267  for (j = 0; j < 2; j++)
268  band->coord[i][j] = ff_j2k_ceildivpow2(comp->coord[i][j], declvl-1);
269  } else{
270  band->codeblock_width = 1 << FFMIN(codsty->log2_cblk_width, codsty->log2_prec_width);
271  band->codeblock_height = 1 << FFMIN(codsty->log2_cblk_height, codsty->log2_prec_height);
272 
273  for (i = 0; i < 2; i++)
274  for (j = 0; j < 2; j++)
275  band->coord[i][j] = ff_j2k_ceildivpow2(comp->coord[i][j] - (((bandno+1>>i)&1) << declvl-1), declvl);
276  }
277  band->cblknx = ff_j2k_ceildiv(band->coord[0][1], band->codeblock_width) - band->coord[0][0] / band->codeblock_width;
278  band->cblkny = ff_j2k_ceildiv(band->coord[1][1], band->codeblock_height) - band->coord[1][0] / band->codeblock_height;
279 
280  for (j = 0; j < 2; j++)
281  band->coord[0][j] = ff_j2k_ceildiv(band->coord[0][j], dx);
282  for (j = 0; j < 2; j++)
283  band->coord[1][j] = ff_j2k_ceildiv(band->coord[1][j], dy);
284 
285  band->cblknx = ff_j2k_ceildiv(band->cblknx, dx);
286  band->cblkny = ff_j2k_ceildiv(band->cblkny, dy);
287 
288  band->cblk = av_malloc(sizeof(J2kCblk) * band->cblknx * band->cblkny);
289  if (!band->cblk)
290  return AVERROR(ENOMEM);
291  band->prec = av_malloc(sizeof(J2kCblk) * reslevel->num_precincts_x * reslevel->num_precincts_y);
292  if (!band->prec)
293  return AVERROR(ENOMEM);
294 
295  for (cblkno = 0; cblkno < band->cblknx * band->cblkny; cblkno++){
296  J2kCblk *cblk = band->cblk + cblkno;
297  cblk->zero = 0;
298  cblk->lblock = 3;
299  cblk->length = 0;
300  cblk->lengthinc = 0;
301  cblk->npasses = 0;
302  }
303 
304  y0 = band->coord[1][0];
305  y1 = ((band->coord[1][0] + (1<<codsty->log2_prec_height)) & ~((1<<codsty->log2_prec_height)-1)) - y0;
306  yi0 = 0;
307  yi1 = ff_j2k_ceildivpow2(y1 - y0, codsty->log2_cblk_height) << codsty->log2_cblk_height;
308  yi1 = FFMIN(yi1, band->cblkny);
309  cblkperprech = 1<<(codsty->log2_prec_height - codsty->log2_cblk_height);
310  for (precy = 0, precno = 0; precy < reslevel->num_precincts_y; precy++){
311  for (precx = 0; precx < reslevel->num_precincts_x; precx++, precno++){
312  band->prec[precno].yi0 = yi0;
313  band->prec[precno].yi1 = yi1;
314  }
315  yi1 += cblkperprech;
316  yi0 = yi1 - cblkperprech;
317  yi1 = FFMIN(yi1, band->cblkny);
318  }
319  x0 = band->coord[0][0];
320  x1 = ((band->coord[0][0] + (1<<codsty->log2_prec_width)) & ~((1<<codsty->log2_prec_width)-1)) - x0;
321  xi0 = 0;
322  xi1 = ff_j2k_ceildivpow2(x1 - x0, codsty->log2_cblk_width) << codsty->log2_cblk_width;
323  xi1 = FFMIN(xi1, band->cblknx);
324 
325  cblkperprecw = 1<<(codsty->log2_prec_width - codsty->log2_cblk_width);
326  for (precx = 0, precno = 0; precx < reslevel->num_precincts_x; precx++){
327  for (precy = 0; precy < reslevel->num_precincts_y; precy++, precno = 0){
328  J2kPrec *prec = band->prec + precno;
329  prec->xi0 = xi0;
330  prec->xi1 = xi1;
331  prec->cblkincl = ff_j2k_tag_tree_init(prec->xi1 - prec->xi0,
332  prec->yi1 - prec->yi0);
333  prec->zerobits = ff_j2k_tag_tree_init(prec->xi1 - prec->xi0,
334  prec->yi1 - prec->yi0);
335  if (!prec->cblkincl || !prec->zerobits)
336  return AVERROR(ENOMEM);
337 
338  }
339  xi1 += cblkperprecw;
340  xi0 = xi1 - cblkperprecw;
341  xi1 = FFMIN(xi1, band->cblknx);
342  }
343  }
344  }
345  return 0;
346 }
347 
349 {
350  int reslevelno, bandno, cblkno, precno;
351  for (reslevelno = 0; reslevelno < codsty->nreslevels; reslevelno++){
352  J2kResLevel *rlevel = comp->reslevel + reslevelno;
353  for (bandno = 0; bandno < rlevel->nbands; bandno++){
354  J2kBand *band = rlevel->band + bandno;
355  for(precno = 0; precno < rlevel->num_precincts_x * rlevel->num_precincts_y; precno++){
356  J2kPrec *prec = band->prec + precno;
357  tag_tree_zero(prec->zerobits, prec->xi1 - prec->xi0, prec->yi1 - prec->yi0);
358  tag_tree_zero(prec->cblkincl, prec->xi1 - prec->xi0, prec->yi1 - prec->yi0);
359  }
360  for (cblkno = 0; cblkno < band->cblknx * band->cblkny; cblkno++){
361  J2kCblk *cblk = band->cblk + cblkno;
362  cblk->length = 0;
363  cblk->lblock = 3;
364  }
365  }
366  }
367 }
368 
370 {
371  int reslevelno, bandno, precno;
372  for (reslevelno = 0; reslevelno < codsty->nreslevels; reslevelno++){
373  J2kResLevel *reslevel = comp->reslevel + reslevelno;
374 
375  for (bandno = 0; bandno < reslevel->nbands ; bandno++){
376  J2kBand *band = reslevel->band + bandno;
377  for (precno = 0; precno < reslevel->num_precincts_x * reslevel->num_precincts_y; precno++){
378  J2kPrec *prec = band->prec + precno;
379  av_freep(&prec->zerobits);
380  av_freep(&prec->cblkincl);
381  }
382  av_freep(&band->cblk);
383  av_freep(&band->prec);
384  }
385  av_freep(&reslevel->band);
386  }
387 
388  ff_j2k_dwt_destroy(&comp->dwt);
389  av_freep(&comp->reslevel);
390  av_freep(&comp->data);
391 }
void * av_malloc(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
Definition: mem.c:73
#define J2K_T1_SGN_S
Definition: j2k.h:80
float v
uint8_t log2_prec_height
precinct size
Definition: j2k.h:121
Definition: j2k.h:158
#define SHL(a, n)
Definition: j2k.c:32
int flags[64+2][64+2]
Definition: j2k.h:105
static void tag_tree_zero(J2kTgtNode *t, int w, int h)
Definition: j2k.c:96
J2kCblk * cblk
Definition: j2k.h:164
static int getsgnctxno(int flag, uint8_t *xorbit)
Definition: j2k.c:155
uint16_t cblknx
Definition: j2k.h:161
uint8_t log2_prec_width
Definition: j2k.h:121
uint8_t log2_cblk_height
exponent of codeblock size
Definition: j2k.h:117
uint16_t num_precincts_y
number of precincts in x/y direction
Definition: j2k.h:170
#define J2K_T1_SGN_E
Definition: j2k.h:82
y1
Definition: lab5.m:33
quantization style
Definition: j2k.h:58
int * data
Definition: j2k.h:178
x1
Definition: genspecsines3.m:7
uint8_t log2_cblk_width
Definition: j2k.h:117
static int ff_j2k_ceildivpow2(int a, int b)
Definition: j2k.h:191
#define J2K_T1_SIG_NE
Definition: j2k.h:72
Definition: j2k.h:140
#define J2K_T1_SIG_S
Definition: j2k.h:71
void ff_j2k_reinit(J2kComponent *comp, J2kCodingStyle *codsty)
Definition: j2k.c:348
uint32_t stepsize
quantization stepsize (* 2^13)
Definition: j2k.h:162
struct J2kTgtNode * parent
Definition: j2k.h:112
DWTContext dwt
Definition: j2k.h:177
void ff_j2k_cleanup(J2kComponent *comp, J2kCodingStyle *codsty)
Definition: j2k.c:369
output residual component w
uint16_t yi1
codeblock indexes ([xi0, xi1))
Definition: j2k.h:153
void av_freep(void *arg)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
Definition: mem.c:198
set threshold d
uint8_t npasses
Definition: j2k.h:141
J2kPrec * prec
Definition: j2k.h:163
uint8_t zero
Definition: j2k.h:147
JPEG2000 tables.
uint8_t transform
DWT type.
Definition: j2k.h:119
uint8_t vis
Definition: j2k.h:111
uint16_t codeblock_width
Definition: j2k.h:160
uint8_t ff_j2k_xorbit_lut[16][16]
Definition: j2k.c:153
J2kTgtNode * cblkincl
Definition: j2k.h:155
uint8_t ff_j2k_nbctxno_lut[256][4]
Definition: j2k.c:106
uint16_t lengthinc
Definition: j2k.h:145
void ff_j2k_set_significant(J2kT1Context *t1, int x, int y, int negative)
Definition: j2k.c:181
J2kTgtNode * zerobits
Definition: j2k.h:154
int ff_j2k_init_component(J2kComponent *comp, J2kCodingStyle *codsty, J2kQuantStyle *qntsty, int cbps, int dx, int dy)
Definition: j2k.c:202
Discrete Time axis x
#define J2K_T1_SGN_N
Definition: j2k.h:79
void ff_j2k_dwt_destroy(DWTContext *s)
Definition: j2k_dwt.c:383
#define J2K_T1_SIG_E
Definition: j2k.h:69
static int tag_tree_size(int w, int h)
allocate the memory for tag tree
Definition: j2k.c:56
uint16_t num_precincts_x
Definition: j2k.h:170
#define t1
Definition: regdef.h:29
#define J2K_T1_SIG_SW
Definition: j2k.h:75
void av_log(void *avcl, int level, const char *fmt,...)
Send the specified message to the log if the level is less than or equal to the current av_log_level...
Definition: log.c:246
J2kBand * band
Definition: j2k.h:172
external API header
uint16_t codeblock_height
Definition: j2k.h:160
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
Definition: mem.c:205
uint16_t xi0
Definition: j2k.h:153
#define FFMIN(a, b)
Definition: common.h:58
ret
Definition: avfilter.c:821
static int getnbctxno(int flag, int bandno, int vert_causal_ctx_csty_symbol)
Definition: j2k.c:108
t
Definition: genspecsines3.m:6
uint16_t mant[32 *3]
quantization mantissa
Definition: j2k.h:130
uint8_t nbands
Definition: j2k.h:168
uint8_t nreslevels
number of resolution levels
Definition: j2k.h:116
NULL
Definition: eval.c:55
static int ff_j2k_ceildiv(int a, int b)
Definition: j2k.h:196
#define J2K_T1_SIG_N
Definition: j2k.h:68
#define J2K_T1_SIG_W
Definition: j2k.h:70
synthesis window for stochastic i
const uint8_t ptrdiff_t int h
Definition: hpel_template.c:97
uint16_t length
Definition: j2k.h:144
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFilterBuffer structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later.That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another.Buffer references ownership and permissions
uint16_t cblkny
Definition: j2k.h:161
int ff_j2k_dwt_init(DWTContext *s, uint16_t border[2][2], int decomp_levels, int type)
initialize DWT
Definition: j2k_dwt.c:319
#define J2K_T1_SIG
Definition: j2k.h:85
#define J2K_T1_SIG_SE
Definition: j2k.h:74
uint16_t yi0
Definition: j2k.h:153
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:162
uint16_t coord[2][2]
border coordinates {{x0, x1}, {y0, y1}}
Definition: j2k.h:169
uint8_t val
Definition: j2k.h:110
function y
Definition: D.m:1
uint16_t coord[2][2]
border coordinates {{x0, x1}, {y0, y1}}
Definition: j2k.h:179
void ff_j2k_init_tier1_luts(void)
Definition: j2k.c:170
#define J2K_T1_SIG_NW
Definition: j2k.h:73
uint8_t lblock
Definition: j2k.h:146
uint8_t ff_j2k_sgnctxno_lut[16][16]
Definition: j2k.c:153
J2kResLevel * reslevel
Definition: j2k.h:176
J2kTgtNode * ff_j2k_tag_tree_init(int w, int h)
Definition: j2k.c:67
static const struct twinvq_data tab
uint8_t quantsty
quantization style
Definition: j2k.h:131
uint8_t expn[32 *3]
quantization exponent
Definition: j2k.h:129
static void comp(unsigned char *dst, int dst_stride, unsigned char *src, int src_stride, int add)
Definition: eamad.c:71
Definition: j2k.h:152
uint16_t xi1
Definition: j2k.h:153
uint16_t coord[2][2]
border coordinates {{x0, x1}, {y0, y1}}
Definition: j2k.h:159
#define FFSWAP(type, a, b)
Definition: common.h:61
#define J2K_T1_SGN_W
Definition: j2k.h:81
#define t2
Definition: regdef.h:30