2 * Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
3 * Copyright (c) 2002-2007, Professor Benoit Macq
4 * Copyright (c) 2001-2003, David Janssens
5 * Copyright (c) 2002-2003, Yannick Verschueren
6 * Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
7 * Copyright (c) 2005, Herve Drolon, FreeImage Team
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
32 #include "opj_includes.h"
34 /** @defgroup T2 T2 - Implementation of a tier-2 coding */
37 /** @name Local static functions */
40 static void t2_putcommacode(opj_bio_t *bio, int n);
41 static int t2_getcommacode(opj_bio_t *bio);
43 Variable length code for signalling delta Zil (truncation point)
44 @param bio Bit Input/Output component
47 static void t2_putnumpasses(opj_bio_t *bio, int n);
48 static int t2_getnumpasses(opj_bio_t *bio);
50 Encode a packet of a tile to a destination buffer
51 @param tile Tile for which to write the packets
52 @param tcp Tile coding parameters
53 @param pi Packet identity
54 @param dest Destination buffer
55 @param len Length of the destination buffer
56 @param cstr_info Codestream information structure
57 @param tileno Number of the tile encoded
60 static int t2_encode_packet(opj_tcd_tile_t *tile, opj_tcp_t *tcp, opj_pi_iterator_t *pi, unsigned char *dest, int len, opj_codestream_info_t *cstr_info, int tileno);
67 static opj_bool t2_init_seg(opj_tcd_cblk_dec_t* cblk, int index, int cblksty, int first);
69 Decode a packet of a tile from a source buffer
71 @param src Source buffer
72 @param len Length of the source buffer
73 @param tile Tile for which to write the packets
74 @param tcp Tile coding parameters
75 @param pi Packet identity
76 @param pack_info Packet information
79 static int t2_decode_packet(opj_t2_t* t2, unsigned char *src, int len, opj_tcd_tile_t *tile,
80 opj_tcp_t *tcp, opj_pi_iterator_t *pi, opj_packet_info_t *pack_info);
86 /* ----------------------------------------------------------------------- */
88 /* #define RESTART 0x04 */
90 static void t2_putcommacode(opj_bio_t *bio, int n) {
97 static int t2_getcommacode(opj_bio_t *bio) {
99 for (n = 0; bio_read(bio, 1); n++) {
105 static void t2_putnumpasses(opj_bio_t *bio, int n) {
107 bio_write(bio, 0, 1);
109 bio_write(bio, 2, 2);
111 bio_write(bio, 0xc | (n - 3), 4);
112 } else if (n <= 36) {
113 bio_write(bio, 0x1e0 | (n - 6), 9);
114 } else if (n <= 164) {
115 bio_write(bio, 0xff80 | (n - 37), 16);
119 static int t2_getnumpasses(opj_bio_t *bio) {
121 if (!bio_read(bio, 1))
123 if (!bio_read(bio, 1))
125 if ((n = bio_read(bio, 2)) != 3)
127 if ((n = bio_read(bio, 5)) != 31)
129 return (37 + bio_read(bio, 7));
132 static int t2_encode_packet(opj_tcd_tile_t * tile, opj_tcp_t * tcp, opj_pi_iterator_t *pi, unsigned char *dest, int length, opj_codestream_info_t *cstr_info, int tileno) {
134 unsigned char *c = dest;
136 int compno = pi->compno; /* component value */
137 int resno = pi->resno; /* resolution level value */
138 int precno = pi->precno; /* precinct value */
139 int layno = pi->layno; /* quality layer value */
141 opj_tcd_tilecomp_t *tilec = &tile->comps[compno];
142 opj_tcd_resolution_t *res = &tilec->resolutions[resno];
144 opj_bio_t *bio = NULL; /* BIO component */
147 if (tcp->csty & J2K_CP_CSTY_SOP) {
152 c[4] = (unsigned char)((tile->packno % 65536) / 256);
153 c[5] = (unsigned char)((tile->packno % 65536) % 256);
159 for (bandno = 0; bandno < res->numbands; bandno++) {
160 opj_tcd_band_t *band = &res->bands[bandno];
161 opj_tcd_precinct_t *prc = &band->precincts[precno];
162 tgt_reset(prc->incltree);
163 tgt_reset(prc->imsbtree);
164 for (cblkno = 0; cblkno < prc->cw * prc->ch; cblkno++) {
165 opj_tcd_cblk_enc_t* cblk = &prc->cblks.enc[cblkno];
167 tgt_setvalue(prc->imsbtree, cblkno, band->numbps - cblk->numbps);
173 bio_init_enc(bio, c, length);
174 bio_write(bio, 1, 1); /* Empty header bit */
176 /* Writing Packet header */
177 for (bandno = 0; bandno < res->numbands; bandno++) {
178 opj_tcd_band_t *band = &res->bands[bandno];
179 opj_tcd_precinct_t *prc = &band->precincts[precno];
180 for (cblkno = 0; cblkno < prc->cw * prc->ch; cblkno++) {
181 opj_tcd_cblk_enc_t* cblk = &prc->cblks.enc[cblkno];
182 opj_tcd_layer_t *layer = &cblk->layers[layno];
183 if (!cblk->numpasses && layer->numpasses) {
184 tgt_setvalue(prc->incltree, cblkno, layno);
187 for (cblkno = 0; cblkno < prc->cw * prc->ch; cblkno++) {
188 opj_tcd_cblk_enc_t* cblk = &prc->cblks.enc[cblkno];
189 opj_tcd_layer_t *layer = &cblk->layers[layno];
193 /* cblk inclusion bits */
194 if (!cblk->numpasses) {
195 tgt_encode(bio, prc->incltree, cblkno, layno + 1);
197 bio_write(bio, layer->numpasses != 0, 1);
199 /* if cblk not included, go to the next cblk */
200 if (!layer->numpasses) {
203 /* if first instance of cblk --> zero bit-planes information */
204 if (!cblk->numpasses) {
205 cblk->numlenbits = 3;
206 tgt_encode(bio, prc->imsbtree, cblkno, 999);
208 /* number of coding passes included */
209 t2_putnumpasses(bio, layer->numpasses);
211 /* computation of the increase of the length indicator and insertion in the header */
212 for (passno = cblk->numpasses; passno < cblk->numpasses + layer->numpasses; passno++) {
213 opj_tcd_pass_t *pass = &cblk->passes[passno];
216 if (pass->term || passno == (cblk->numpasses + layer->numpasses) - 1) {
217 increment = int_max(increment, int_floorlog2(len) + 1 - (cblk->numlenbits + int_floorlog2(nump)));
222 t2_putcommacode(bio, increment);
224 /* computation of the new Length indicator */
225 cblk->numlenbits += increment;
227 /* insertion of the codeword segment length */
228 for (passno = cblk->numpasses; passno < cblk->numpasses + layer->numpasses; passno++) {
229 opj_tcd_pass_t *pass = &cblk->passes[passno];
232 if (pass->term || passno == (cblk->numpasses + layer->numpasses) - 1) {
233 bio_write(bio, len, cblk->numlenbits + int_floorlog2(nump));
241 if (bio_flush(bio)) {
243 return -999; /* modified to eliminate longjmp !! */
246 c += bio_numbytes(bio);
250 if (tcp->csty & J2K_CP_CSTY_EPH) {
258 /* End of packet header position. Currently only represents the distance to start of packet
259 // Will be updated later by incrementing with packet start value */
260 if(cstr_info && cstr_info->index_write) {
261 opj_packet_info_t *info_PK = &cstr_info->tile[tileno].packet[cstr_info->packno];
262 info_PK->end_ph_pos = (int)(c - dest);
266 /* Writing the packet body */
268 for (bandno = 0; bandno < res->numbands; bandno++) {
269 opj_tcd_band_t *band = &res->bands[bandno];
270 opj_tcd_precinct_t *prc = &band->precincts[precno];
271 for (cblkno = 0; cblkno < prc->cw * prc->ch; cblkno++) {
272 opj_tcd_cblk_enc_t* cblk = &prc->cblks.enc[cblkno];
273 opj_tcd_layer_t *layer = &cblk->layers[layno];
274 if (!layer->numpasses) {
277 if (c + layer->len > dest + length) {
281 memcpy(c, layer->data, layer->len);
282 cblk->numpasses += layer->numpasses;
285 if(cstr_info && cstr_info->index_write) {
286 opj_packet_info_t *info_PK = &cstr_info->tile[tileno].packet[cstr_info->packno];
287 info_PK->disto += layer->disto;
288 if (cstr_info->D_max < info_PK->disto) {
289 cstr_info->D_max = info_PK->disto;
299 static opj_bool t2_init_seg(opj_tcd_cblk_dec_t* cblk, int index, int cblksty, int first) {
302 segs = (opj_tcd_seg_t*) opj_realloc(cblk->segs, (index + 1) * sizeof(opj_tcd_seg_t));
310 seg = &cblk->segs[index];
315 if (cblksty & J2K_CCP_CBLKSTY_TERMALL) {
318 else if (cblksty & J2K_CCP_CBLKSTY_LAZY) {
322 seg->maxpasses = (((seg - 1)->maxpasses == 1) || ((seg - 1)->maxpasses == 10)) ? 2 : 1;
325 seg->maxpasses = 109;
331 static int t2_decode_packet(opj_t2_t* t2, unsigned char *src, int len, opj_tcd_tile_t *tile,
332 opj_tcp_t *tcp, opj_pi_iterator_t *pi, opj_packet_info_t *pack_info) {
334 unsigned char *c = src;
336 opj_cp_t *cp = t2->cp;
338 int compno = pi->compno; /* component value */
339 int resno = pi->resno; /* resolution level value */
340 int precno = pi->precno; /* precinct value */
341 int layno = pi->layno; /* quality layer value */
343 opj_tcd_resolution_t* res = &tile->comps[compno].resolutions[resno];
345 unsigned char *hd = NULL;
348 opj_bio_t *bio = NULL; /* BIO component */
351 for (bandno = 0; bandno < res->numbands; bandno++) {
352 opj_tcd_band_t *band = &res->bands[bandno];
353 opj_tcd_precinct_t *prc = &band->precincts[precno];
355 if ((band->x1-band->x0 == 0)||(band->y1-band->y0 == 0)) continue;
357 tgt_reset(prc->incltree);
358 tgt_reset(prc->imsbtree);
359 for (cblkno = 0; cblkno < prc->cw * prc->ch; cblkno++) {
360 opj_tcd_cblk_dec_t* cblk = &prc->cblks.dec[cblkno];
368 if (tcp->csty & J2K_CP_CSTY_SOP) {
369 if ((*c) != 0xff || (*(c + 1) != 0x91)) {
370 opj_event_msg(t2->cinfo, EVT_WARNING, "Expected SOP marker\n");
375 /** TODO : check the Nsop value */
379 When the marker PPT/PPM is used the packet header are store in PPT/PPM marker
380 This part deal with this caracteristic
381 step 1: Read packet header in the saved structure
382 step 2: Return to codestream for decoding
387 if (cp->ppm == 1) { /* PPM */
389 bio_init_dec(bio, hd, cp->ppm_len);
390 } else if (tcp->ppt == 1) { /* PPT */
392 bio_init_dec(bio, hd, tcp->ppt_len);
393 } else { /* Normal Case */
395 bio_init_dec(bio, hd, src+len-hd);
398 present = bio_read(bio, 1);
402 hd += bio_numbytes(bio);
407 if (tcp->csty & J2K_CP_CSTY_EPH) {
408 if ((*hd) != 0xff || (*(hd + 1) != 0x92)) {
409 printf("Error : expected EPH marker\n");
416 /* End of packet header position. Currently only represents the distance to start of packet
417 // Will be updated later by incrementing with packet start value*/
419 pack_info->end_ph_pos = (int)(c - src);
423 if (cp->ppm == 1) { /* PPM case */
424 cp->ppm_len += cp->ppm_data-hd;
428 if (tcp->ppt == 1) { /* PPT case */
429 tcp->ppt_len+=tcp->ppt_data-hd;
437 for (bandno = 0; bandno < res->numbands; bandno++) {
438 opj_tcd_band_t *band = &res->bands[bandno];
439 opj_tcd_precinct_t *prc = &band->precincts[precno];
441 if ((band->x1-band->x0 == 0)||(band->y1-band->y0 == 0)) continue;
443 for (cblkno = 0; cblkno < prc->cw * prc->ch; cblkno++) {
444 int included, increment, n, segno;
445 opj_tcd_cblk_dec_t* cblk = &prc->cblks.dec[cblkno];
446 /* if cblk not yet included before --> inclusion tagtree */
447 if (!cblk->numsegs) {
448 included = tgt_decode(bio, prc->incltree, cblkno, layno + 1);
451 included = bio_read(bio, 1);
453 /* if cblk not included */
455 cblk->numnewpasses = 0;
458 /* if cblk not yet included --> zero-bitplane tagtree */
459 if (!cblk->numsegs) {
461 for (i = 0; !tgt_decode(bio, prc->imsbtree, cblkno, i); i++) {
465 cblk->numbps = band->numbps - numimsbs;
466 cblk->numlenbits = 3;
468 /* number of coding passes */
469 cblk->numnewpasses = t2_getnumpasses(bio);
470 increment = t2_getcommacode(bio);
471 /* length indicator increment */
472 cblk->numlenbits += increment;
474 if (!cblk->numsegs) {
475 if (!t2_init_seg(cblk, segno, tcp->tccps[compno].cblksty, 1))
477 opj_event_msg(t2->cinfo, EVT_ERROR, "Out of memory\n");
482 segno = cblk->numsegs - 1;
483 if (cblk->segs[segno].numpasses == cblk->segs[segno].maxpasses) {
485 if (!t2_init_seg(cblk, segno, tcp->tccps[compno].cblksty, 0))
487 opj_event_msg(t2->cinfo, EVT_ERROR, "Out of memory\n");
493 n = cblk->numnewpasses;
496 cblk->segs[segno].numnewpasses = int_min(cblk->segs[segno].maxpasses - cblk->segs[segno].numpasses, n);
497 cblk->segs[segno].newlen = bio_read(bio, cblk->numlenbits + int_floorlog2(cblk->segs[segno].numnewpasses));
498 n -= cblk->segs[segno].numnewpasses;
501 if (!t2_init_seg(cblk, segno, tcp->tccps[compno].cblksty, 0))
503 opj_event_msg(t2->cinfo, EVT_ERROR, "Out of memory\n");
512 if (bio_inalign(bio)) {
517 hd += bio_numbytes(bio);
521 if (tcp->csty & J2K_CP_CSTY_EPH) {
522 if ((*hd) != 0xff || (*(hd + 1) != 0x92)) {
523 opj_event_msg(t2->cinfo, EVT_ERROR, "Expected EPH marker\n");
531 /* End of packet header position. Currently only represents the distance to start of packet
532 // Will be updated later by incrementing with packet start value*/
534 pack_info->end_ph_pos = (int)(hd - src);
539 cp->ppm_len+=cp->ppm_data-hd;
541 } else if (tcp->ppt == 1) {
542 tcp->ppt_len+=tcp->ppt_data-hd;
548 for (bandno = 0; bandno < res->numbands; bandno++) {
549 opj_tcd_band_t *band = &res->bands[bandno];
550 opj_tcd_precinct_t *prc = &band->precincts[precno];
552 if ((band->x1-band->x0 == 0)||(band->y1-band->y0 == 0)) continue;
554 for (cblkno = 0; cblkno < prc->cw * prc->ch; cblkno++) {
555 opj_tcd_cblk_dec_t* cblk = &prc->cblks.dec[cblkno];
556 opj_tcd_seg_t *seg = NULL;
557 if (!cblk->numnewpasses)
559 if (!cblk->numsegs) {
560 seg = &cblk->segs[0];
564 seg = &cblk->segs[cblk->numsegs - 1];
565 if (seg->numpasses == seg->maxpasses) {
572 if (c + seg->newlen > src + len) {
577 /* we need here a j2k handle to verify if making a check to
578 the validity of cblocks parameters is selected from user (-W) */
580 /* let's check that we are not exceeding */
581 if ((cblk->len + seg->newlen) > 8192) {
582 opj_event_msg(t2->cinfo, EVT_WARNING,
583 "JPWL: segment too long (%d) for codeblock %d (p=%d, b=%d, r=%d, c=%d)\n",
584 seg->newlen, cblkno, precno, bandno, resno, compno);
586 opj_event_msg(t2->cinfo, EVT_ERROR, "JPWL: giving up\n");
589 seg->newlen = 8192 - cblk->len;
590 opj_event_msg(t2->cinfo, EVT_WARNING, " - truncating segment to %d\n", seg->newlen);
594 #endif /* USE_JPWL */
596 cblk->data = (unsigned char*) opj_realloc(cblk->data, (cblk->len + seg->newlen) * sizeof(unsigned char));
597 memcpy(cblk->data + cblk->len, c, seg->newlen);
598 if (seg->numpasses == 0) {
599 seg->data = &cblk->data;
600 seg->dataindex = cblk->len;
603 cblk->len += seg->newlen;
604 seg->len += seg->newlen;
605 seg->numpasses += seg->numnewpasses;
606 cblk->numnewpasses -= seg->numnewpasses;
607 if (cblk->numnewpasses > 0) {
611 } while (cblk->numnewpasses > 0);
618 /* ----------------------------------------------------------------------- */
620 int t2_encode_packets(opj_t2_t* t2,int tileno, opj_tcd_tile_t *tile, int maxlayers, unsigned char *dest, int len, opj_codestream_info_t *cstr_info,int tpnum, int tppos,int pino, J2K_T2_MODE t2_mode, int cur_totnum_tp){
621 unsigned char *c = dest;
624 opj_pi_iterator_t *pi = NULL;
626 opj_image_t *image = t2->image;
627 opj_cp_t *cp = t2->cp;
628 opj_tcp_t *tcp = &cp->tcps[tileno];
629 int pocno = cp->cinema == CINEMA4K_24? 2: 1;
630 int maxcomp = cp->max_comp_size > 0 ? image->numcomps : 1;
632 pi = pi_initialise_encode(image, cp, tileno, t2_mode);
634 /* TODO: throw an error */
638 if(t2_mode == THRESH_CALC ){ /* Calculating threshold */
639 for(compno = 0; compno < maxcomp; compno++ ){
640 for(poc = 0; poc < pocno ; poc++){
643 if (pi_create_encode(pi, cp,tileno,poc,tpnum,tppos,t2_mode,cur_totnum_tp)) {
644 opj_event_msg(t2->cinfo, EVT_ERROR, "Error initializing Packet Iterator\n");
645 pi_destroy(pi, cp, tileno);
648 while (pi_next(&pi[poc])) {
649 if (pi[poc].layno < maxlayers) {
650 e = t2_encode_packet(tile, &cp->tcps[tileno], &pi[poc], c, dest + len - c, cstr_info, tileno);
651 comp_len = comp_len + e;
659 if (e == -999) break;
660 if (cp->max_comp_size){
661 if (comp_len > cp->max_comp_size){
667 if (e == -999) break;
669 }else{ /* t2_mode == FINAL_PASS */
670 pi_create_encode(pi, cp,tileno,pino,tpnum,tppos,t2_mode,cur_totnum_tp);
671 while (pi_next(&pi[pino])) {
672 if (pi[pino].layno < maxlayers) {
673 e = t2_encode_packet(tile, &cp->tcps[tileno], &pi[pino], c, dest + len - c, cstr_info, tileno);
681 if(cstr_info->index_write) {
682 opj_tile_info_t *info_TL = &cstr_info->tile[tileno];
683 opj_packet_info_t *info_PK = &info_TL->packet[cstr_info->packno];
684 if (!cstr_info->packno) {
685 info_PK->start_pos = info_TL->end_header + 1;
687 info_PK->start_pos = ((cp->tp_on | tcp->POC)&& info_PK->start_pos) ? info_PK->start_pos : info_TL->packet[cstr_info->packno - 1].end_pos + 1;
689 info_PK->end_pos = info_PK->start_pos + e - 1;
690 info_PK->end_ph_pos += info_PK->start_pos - 1; /* End of packet header which now only represents the distance
691 // to start of packet is incremented by value of start of packet*/
702 pi_destroy(pi, cp, tileno);
711 int t2_decode_packets(opj_t2_t *t2, unsigned char *src, int len, int tileno, opj_tcd_tile_t *tile, opj_codestream_info_t *cstr_info) {
712 unsigned char *c = src;
713 opj_pi_iterator_t *pi;
715 int n = 0, curtp = 0;
718 opj_image_t *image = t2->image;
719 opj_cp_t *cp = t2->cp;
721 /* create a packet iterator */
722 pi = pi_create_decode(image, cp, tileno);
724 /* TODO: throw an error */
730 for (pino = 0; pino <= cp->tcps[tileno].numpocs; pino++) {
731 while (pi_next(&pi[pino])) {
732 if ((cp->layer==0) || (cp->layer>=((pi[pino].layno)+1))) {
733 opj_packet_info_t *pack_info;
735 pack_info = &cstr_info->tile[tileno].packet[cstr_info->packno];
738 e = t2_decode_packet(t2, c, src + len - c, tile, &cp->tcps[tileno], &pi[pino], pack_info);
744 pi_destroy(pi, cp, tileno);
747 /* progression in resolution */
748 image->comps[pi[pino].compno].resno_decoded =
750 int_max(pi[pino].resno, image->comps[pi[pino].compno].resno_decoded)
751 : image->comps[pi[pino].compno].resno_decoded;
756 opj_tile_info_t *info_TL = &cstr_info->tile[tileno];
757 opj_packet_info_t *info_PK = &info_TL->packet[cstr_info->packno];
758 if (!cstr_info->packno) {
759 info_PK->start_pos = info_TL->end_header + 1;
760 } else if (info_TL->packet[cstr_info->packno-1].end_pos >= (int)cstr_info->tile[tileno].tp[curtp].tp_end_pos){ /* New tile part*/
761 info_TL->tp[curtp].tp_numpacks = cstr_info->packno - tp_start_packno; /* Number of packets in previous tile-part*/
762 info_TL->tp[curtp].tp_start_pack = tp_start_packno;
763 tp_start_packno = cstr_info->packno;
765 info_PK->start_pos = cstr_info->tile[tileno].tp[curtp].tp_end_header+1;
767 info_PK->start_pos = (cp->tp_on && info_PK->start_pos) ? info_PK->start_pos : info_TL->packet[cstr_info->packno - 1].end_pos + 1;
769 info_PK->end_pos = info_PK->start_pos + e - 1;
770 info_PK->end_ph_pos += info_PK->start_pos - 1; /* End of packet header which now only represents the distance
771 // to start of packet is incremented by value of start of packet*/
776 if (e == -999) { /* ADD */
785 cstr_info->tile[tileno].tp[curtp].tp_numpacks = cstr_info->packno - tp_start_packno; /* Number of packets in last tile-part*/
786 cstr_info->tile[tileno].tp[curtp].tp_start_pack = tp_start_packno;
790 /* don't forget to release pi */
791 pi_destroy(pi, cp, tileno);
800 /* ----------------------------------------------------------------------- */
802 opj_t2_t* t2_create(opj_common_ptr cinfo, opj_image_t *image, opj_cp_t *cp) {
803 /* create the tcd structure */
804 opj_t2_t *t2 = (opj_t2_t*)opj_malloc(sizeof(opj_t2_t));
813 void t2_destroy(opj_t2_t *t2) {