Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(518)

Side by Side Diff: third_party/libopenjpeg20/t2.c

Issue 1416783002: Merge to M46: upgrade openjpeg to commit# cf352af (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@2490
Patch Set: Fix pdfium:168 since we are already half way there Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/libopenjpeg20/t2.h ('k') | third_party/libopenjpeg20/tcd.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * The copyright in this software is being made available under the 2-clauses 2 * The copyright in this software is being made available under the 2-clauses
3 * BSD License, included below. This software may be subject to other third 3 * BSD License, included below. This software may be subject to other third
4 * party and contributor rights, including patent rights, and no such rights 4 * party and contributor rights, including patent rights, and no such rights
5 * are granted under this license. 5 * are granted under this license.
6 * 6 *
7 * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium 7 * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
8 * Copyright (c) 2002-2014, Professor Benoit Macq 8 * Copyright (c) 2002-2014, Professor Benoit Macq
9 * Copyright (c) 2001-2003, David Janssens 9 * Copyright (c) 2001-2003, David Janssens
10 * Copyright (c) 2002-2003, Yannick Verschueren 10 * Copyright (c) 2002-2003, Yannick Verschueren
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 90
91 @return FIXME DOC 91 @return FIXME DOC
92 */ 92 */
93 static OPJ_BOOL opj_t2_decode_packet( opj_t2_t* t2, 93 static OPJ_BOOL opj_t2_decode_packet( opj_t2_t* t2,
94 opj_tcd_tile_t *tile, 94 opj_tcd_tile_t *tile,
95 opj_tcp_t *tcp, 95 opj_tcp_t *tcp,
96 opj_pi_iterator_t *pi, 96 opj_pi_iterator_t *pi,
97 OPJ_BYTE *src, 97 OPJ_BYTE *src,
98 OPJ_UINT32 * data_read, 98 OPJ_UINT32 * data_read,
99 OPJ_UINT32 max_length, 99 OPJ_UINT32 max_length,
100 opj_packet_info_t *pack_info); 100 opj_packet_info_t *pack_info,
101 opj_event_mgr_t *p_manager);
101 102
102 static OPJ_BOOL opj_t2_skip_packet( opj_t2_t* p_t2, 103 static OPJ_BOOL opj_t2_skip_packet( opj_t2_t* p_t2,
103 opj_tcd_tile_t *p_tile, 104 opj_tcd_tile_t *p_tile,
104 opj_tcp_t *p_tcp, 105 opj_tcp_t *p_tcp,
105 opj_pi_iterator_t *p_pi, 106 opj_pi_iterator_t *p_pi,
106 OPJ_BYTE *p_src, 107 OPJ_BYTE *p_src,
107 OPJ_UINT32 * p_data_read, 108 OPJ_UINT32 * p_data_read,
108 OPJ_UINT32 p_max_length, 109 OPJ_UINT32 p_max_length,
109 opj_packet_info_t *p_pack_info); 110 opj_packet_info_t *p_pack_info,
111 opj_event_mgr_t *p_manager);
110 112
111 static OPJ_BOOL opj_t2_read_packet_header( opj_t2_t* p_t2, 113 static OPJ_BOOL opj_t2_read_packet_header( opj_t2_t* p_t2,
112 opj_tcd_tile_t *p_tile, 114 opj_tcd_tile_t *p_tile,
113 opj_tcp_t *p_tcp, 115 opj_tcp_t *p_tcp,
114 opj_pi_iterator_t *p_pi, 116 opj_pi_iterator_t *p_pi,
115 OPJ_BOOL * p_is_data_present, 117 OPJ_BOOL * p_is_data_present,
116 OPJ_BYTE *p_src_data, 118 OPJ_BYTE *p_src_data,
117 OPJ_UINT32 * p_data_read, 119 OPJ_UINT32 * p_data_read,
118 OPJ_UINT32 p_max_length, 120 OPJ_UINT32 p_max_length,
119 opj_packet_info_t *p_pack_info); 121 opj_packet_info_t *p_pack_info,
122 opj_event_mgr_t *p_manager);
120 123
121 static OPJ_BOOL opj_t2_read_packet_data(opj_t2_t* p_t2, 124 static OPJ_BOOL opj_t2_read_packet_data(opj_t2_t* p_t2,
122 opj_tcd_tile_t *p_tile, 125 opj_tcd_tile_t *p_tile,
123 opj_pi_iterator_t *p_pi, 126 opj_pi_iterator_t *p_pi,
124 OPJ_BYTE *p_src_data, 127 OPJ_BYTE *p_src_data,
125 OPJ_UINT32 * p_data_read, 128 OPJ_UINT32 * p_data_read,
126 OPJ_UINT32 p_max_length, 129 OPJ_UINT32 p_max_length,
127 opj_packet_info_t *pack_info); 130 opj_packet_info_t *pack_info,
131 opj_event_mgr_t *p_manager);
128 132
129 static OPJ_BOOL opj_t2_skip_packet_data(opj_t2_t* p_t2, 133 static OPJ_BOOL opj_t2_skip_packet_data(opj_t2_t* p_t2,
130 opj_tcd_tile_t *p_tile, 134 opj_tcd_tile_t *p_tile,
131 opj_pi_iterator_t *p_pi, 135 opj_pi_iterator_t *p_pi,
132 OPJ_UINT32 * p_data_read, 136 OPJ_UINT32 * p_data_read,
133 OPJ_UINT32 p_max_length, 137 OPJ_UINT32 p_max_length,
134 opj_packet_info_t *pack_info); 138 opj_packet_info_t *pack_info,
139 opj_event_mgr_t *p_manager);
135 140
136 /** 141 /**
137 @param cblk 142 @param cblk
138 @param index 143 @param index
139 @param cblksty 144 @param cblksty
140 @param first 145 @param first
141 */ 146 */
142 static OPJ_BOOL opj_t2_init_seg( opj_tcd_cblk_dec_t* cblk, 147 static OPJ_BOOL opj_t2_init_seg( opj_tcd_cblk_dec_t* cblk,
143 OPJ_UINT32 index, 148 OPJ_UINT32 index,
144 OPJ_UINT32 cblksty, 149 OPJ_UINT32 cblksty,
145 OPJ_UINT32 first); 150 OPJ_UINT32 first);
146 151
147 /*@}*/ 152 /*@}*/
148 153
149 /*@}*/ 154 /*@}*/
150 155
151 /* ----------------------------------------------------------------------- */ 156 /* ----------------------------------------------------------------------- */
152 157
153 /* #define RESTART 0x04 */ 158 /* #define RESTART 0x04 */
154 static void opj_t2_putcommacode(opj_bio_t *bio, OPJ_INT32 n) { 159 static void opj_t2_putcommacode(opj_bio_t *bio, OPJ_INT32 n) {
155 while (--n >= 0) { 160 while (--n >= 0) {
156 opj_bio_write(bio, 1, 1); 161 opj_bio_write(bio, 1, 1);
157 } 162 }
158 opj_bio_write(bio, 0, 1); 163 opj_bio_write(bio, 0, 1);
159 } 164 }
160 165
161 OPJ_UINT32 opj_t2_getcommacode(opj_bio_t *bio) 166 static OPJ_UINT32 opj_t2_getcommacode(opj_bio_t *bio)
162 { 167 {
163 OPJ_UINT32 n = 0; 168 OPJ_UINT32 n = 0;
164 while (opj_bio_read(bio, 1)) { 169 while (opj_bio_read(bio, 1)) {
165 ++n; 170 ++n;
166 } 171 }
167 return n; 172 return n;
168 } 173 }
169 174
170 void opj_t2_putnumpasses(opj_bio_t *bio, OPJ_UINT32 n) { 175 static void opj_t2_putnumpasses(opj_bio_t *bio, OPJ_UINT32 n) {
171 if (n == 1) { 176 if (n == 1) {
172 opj_bio_write(bio, 0, 1); 177 opj_bio_write(bio, 0, 1);
173 } else if (n == 2) { 178 } else if (n == 2) {
174 opj_bio_write(bio, 2, 2); 179 opj_bio_write(bio, 2, 2);
175 } else if (n <= 5) { 180 } else if (n <= 5) {
176 opj_bio_write(bio, 0xc | (n - 3), 4); 181 opj_bio_write(bio, 0xc | (n - 3), 4);
177 } else if (n <= 36) { 182 } else if (n <= 36) {
178 opj_bio_write(bio, 0x1e0 | (n - 6), 9); 183 opj_bio_write(bio, 0x1e0 | (n - 6), 9);
179 } else if (n <= 164) { 184 } else if (n <= 164) {
180 opj_bio_write(bio, 0xff80 | (n - 37), 16); 185 opj_bio_write(bio, 0xff80 | (n - 37), 16);
181 } 186 }
182 } 187 }
183 188
184 OPJ_UINT32 opj_t2_getnumpasses(opj_bio_t *bio) { 189 static OPJ_UINT32 opj_t2_getnumpasses(opj_bio_t *bio) {
185 OPJ_UINT32 n; 190 OPJ_UINT32 n;
186 if (!opj_bio_read(bio, 1)) 191 if (!opj_bio_read(bio, 1))
187 return 1; 192 return 1;
188 if (!opj_bio_read(bio, 1)) 193 if (!opj_bio_read(bio, 1))
189 return 2; 194 return 2;
190 if ((n = opj_bio_read(bio, 2)) != 3) 195 if ((n = opj_bio_read(bio, 2)) != 3)
191 return (3 + n); 196 return (3 + n);
192 if ((n = opj_bio_read(bio, 5)) != 31) 197 if ((n = opj_bio_read(bio, 5)) != 31)
193 return (6 + n); 198 return (6 + n);
194 return (37 + opj_bio_read(bio, 7)); 199 return (37 + opj_bio_read(bio, 7));
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 } 343 }
339 #define JAS_FPRINTF opj_null_jas_fprintf 344 #define JAS_FPRINTF opj_null_jas_fprintf
340 #endif 345 #endif
341 346
342 OPJ_BOOL opj_t2_decode_packets( opj_t2_t *p_t2, 347 OPJ_BOOL opj_t2_decode_packets( opj_t2_t *p_t2,
343 OPJ_UINT32 p_tile_no, 348 OPJ_UINT32 p_tile_no,
344 opj_tcd_tile_t *p_tile, 349 opj_tcd_tile_t *p_tile,
345 OPJ_BYTE *p_src, 350 OPJ_BYTE *p_src,
346 OPJ_UINT32 * p_data_read, 351 OPJ_UINT32 * p_data_read,
347 OPJ_UINT32 p_max_len, 352 OPJ_UINT32 p_max_len,
348 opj_codestream_index_t *p_cstr_index) 353 opj_codestream_index_t *p_cstr_index,
354 opj_event_mgr_t *p_manager)
349 { 355 {
350 OPJ_BYTE *l_current_data = p_src; 356 OPJ_BYTE *l_current_data = p_src;
351 opj_pi_iterator_t *l_pi = 00; 357 opj_pi_iterator_t *l_pi = 00;
352 OPJ_UINT32 pino; 358 OPJ_UINT32 pino;
353 opj_image_t *l_image = p_t2->image; 359 opj_image_t *l_image = p_t2->image;
354 opj_cp_t *l_cp = p_t2->cp; 360 opj_cp_t *l_cp = p_t2->cp;
355 opj_tcp_t *l_tcp = &(p_t2->cp->tcps[p_tile_no]); 361 opj_tcp_t *l_tcp = &(p_t2->cp->tcps[p_tile_no]);
356 OPJ_UINT32 l_nb_bytes_read; 362 OPJ_UINT32 l_nb_bytes_read;
357 OPJ_UINT32 l_nb_pocs = l_tcp->numpocs + 1; 363 OPJ_UINT32 l_nb_pocs = l_tcp->numpocs + 1;
358 opj_pi_iterator_t *l_current_pi = 00; 364 opj_pi_iterator_t *l_current_pi = 00;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 while (opj_pi_next(l_current_pi)) { 412 while (opj_pi_next(l_current_pi)) {
407 JAS_FPRINTF( stderr, "packet offset=00000166 prg=%d cmptno=%02 d rlvlno=%02d prcno=%03d lyrno=%02d\n\n", 413 JAS_FPRINTF( stderr, "packet offset=00000166 prg=%d cmptno=%02 d rlvlno=%02d prcno=%03d lyrno=%02d\n\n",
408 l_current_pi->poc.prg1, l_current_pi->compno, l_current_pi-> resno, l_current_pi->precno, l_current_pi->layno ); 414 l_current_pi->poc.prg1, l_current_pi->compno, l_current_pi-> resno, l_current_pi->precno, l_current_pi->layno );
409 415
410 if (l_tcp->num_layers_to_decode > l_current_pi->layno 416 if (l_tcp->num_layers_to_decode > l_current_pi->layno
411 && l_current_pi->resno < p_tile->comps[l _current_pi->compno].minimum_num_resolutions) { 417 && l_current_pi->resno < p_tile->comps[l _current_pi->compno].minimum_num_resolutions) {
412 l_nb_bytes_read = 0; 418 l_nb_bytes_read = 0;
413 419
414 first_pass_failed[l_current_pi->compno] = OPJ_FA LSE; 420 first_pass_failed[l_current_pi->compno] = OPJ_FA LSE;
415 421
416 if (! opj_t2_decode_packet(p_t2,p_tile,l_tcp,l_c urrent_pi,l_current_data,&l_nb_bytes_read,p_max_len,l_pack_info)) { 422 if (! opj_t2_decode_packet(p_t2,p_tile,l_tcp,l_c urrent_pi,l_current_data,&l_nb_bytes_read,p_max_len,l_pack_info, p_manager)) {
417 opj_pi_destroy(l_pi,l_nb_pocs); 423 opj_pi_destroy(l_pi,l_nb_pocs);
418 opj_free(first_pass_failed); 424 opj_free(first_pass_failed);
419 return OPJ_FALSE; 425 return OPJ_FALSE;
420 } 426 }
421 427
422 l_img_comp = &(l_image->comps[l_current_pi->comp no]); 428 l_img_comp = &(l_image->comps[l_current_pi->comp no]);
423 l_img_comp->resno_decoded = opj_uint_max(l_curre nt_pi->resno, l_img_comp->resno_decoded); 429 l_img_comp->resno_decoded = opj_uint_max(l_curre nt_pi->resno, l_img_comp->resno_decoded);
424 } 430 }
425 else { 431 else {
426 l_nb_bytes_read = 0; 432 l_nb_bytes_read = 0;
427 if (! opj_t2_skip_packet(p_t2,p_tile,l_tcp,l_cur rent_pi,l_current_data,&l_nb_bytes_read,p_max_len,l_pack_info)) { 433 if (! opj_t2_skip_packet(p_t2,p_tile,l_tcp,l_cur rent_pi,l_current_data,&l_nb_bytes_read,p_max_len,l_pack_info, p_manager)) {
428 opj_pi_destroy(l_pi,l_nb_pocs); 434 opj_pi_destroy(l_pi,l_nb_pocs);
429 opj_free(first_pass_failed); 435 opj_free(first_pass_failed);
430 return OPJ_FALSE; 436 return OPJ_FALSE;
431 } 437 }
432 } 438 }
433 439
434 if (first_pass_failed[l_current_pi->compno]) { 440 if (first_pass_failed[l_current_pi->compno]) {
435 l_img_comp = &(l_image->comps[l_current_pi->comp no]); 441 l_img_comp = &(l_image->comps[l_current_pi->comp no]);
436 if (l_img_comp->resno_decoded == 0) 442 if (l_img_comp->resno_decoded == 0)
437 l_img_comp->resno_decoded = p_tile->comp s[l_current_pi->compno].minimum_num_resolutions - 1; 443 l_img_comp->resno_decoded = p_tile->comp s[l_current_pi->compno].minimum_num_resolutions - 1;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 510
505 return l_t2; 511 return l_t2;
506 } 512 }
507 513
508 void opj_t2_destroy(opj_t2_t *t2) { 514 void opj_t2_destroy(opj_t2_t *t2) {
509 if(t2) { 515 if(t2) {
510 opj_free(t2); 516 opj_free(t2);
511 } 517 }
512 } 518 }
513 519
514 OPJ_BOOL opj_t2_decode_packet( opj_t2_t* p_t2, 520 static OPJ_BOOL opj_t2_decode_packet( opj_t2_t* p_t2,
515 opj_tcd_tile_t *p_tile, 521 opj_tcd_tile_t *p_tile,
516 opj_tcp_t *p_tcp, 522 opj_tcp_t *p_tcp,
517 opj_pi_iterator_t *p_pi, 523 opj_pi_iterator_t *p_pi,
518 OPJ_BYTE *p_src, 524 OPJ_BYTE *p_src,
519 OPJ_UINT32 * p_data_read, 525 OPJ_UINT32 * p_data_read,
520 OPJ_UINT32 p_max_length, 526 OPJ_UINT32 p_max_length,
521 opj_packet_info_t *p_pack_info) 527 opj_packet_info_t *p_pack_info,
528 opj_event_mgr_t *p_manager)
522 { 529 {
523 OPJ_BOOL l_read_data; 530 OPJ_BOOL l_read_data;
524 OPJ_UINT32 l_nb_bytes_read = 0; 531 OPJ_UINT32 l_nb_bytes_read = 0;
525 OPJ_UINT32 l_nb_total_bytes_read = 0; 532 OPJ_UINT32 l_nb_total_bytes_read = 0;
526 533
527 *p_data_read = 0; 534 *p_data_read = 0;
528 535
529 if (! opj_t2_read_packet_header(p_t2,p_tile,p_tcp,p_pi,&l_read_data,p_sr c,&l_nb_bytes_read,p_max_length,p_pack_info)) { 536 if (! opj_t2_read_packet_header(p_t2,p_tile,p_tcp,p_pi,&l_read_data,p_sr c,&l_nb_bytes_read,p_max_length,p_pack_info, p_manager)) {
530 return OPJ_FALSE; 537 return OPJ_FALSE;
531 } 538 }
532 539
533 p_src += l_nb_bytes_read; 540 p_src += l_nb_bytes_read;
534 l_nb_total_bytes_read += l_nb_bytes_read; 541 l_nb_total_bytes_read += l_nb_bytes_read;
535 p_max_length -= l_nb_bytes_read; 542 p_max_length -= l_nb_bytes_read;
536 543
537 /* we should read data for the packet */ 544 /* we should read data for the packet */
538 if (l_read_data) { 545 if (l_read_data) {
539 l_nb_bytes_read = 0; 546 l_nb_bytes_read = 0;
540 547
541 if (! opj_t2_read_packet_data(p_t2,p_tile,p_pi,p_src,&l_nb_bytes _read,p_max_length,p_pack_info)) { 548 if (! opj_t2_read_packet_data(p_t2,p_tile,p_pi,p_src,&l_nb_bytes _read,p_max_length,p_pack_info, p_manager)) {
542 return OPJ_FALSE; 549 return OPJ_FALSE;
543 } 550 }
544 551
545 l_nb_total_bytes_read += l_nb_bytes_read; 552 l_nb_total_bytes_read += l_nb_bytes_read;
546 } 553 }
547 554
548 *p_data_read = l_nb_total_bytes_read; 555 *p_data_read = l_nb_total_bytes_read;
549 556
550 return OPJ_TRUE; 557 return OPJ_TRUE;
551 } 558 }
552 559
553 OPJ_BOOL opj_t2_encode_packet( OPJ_UINT32 tileno, 560 static OPJ_BOOL opj_t2_encode_packet( OPJ_UINT32 tileno,
554 opj_tcd_tile_t * tile, 561 opj_tcd_tile_t * tile,
555 opj_tcp_t * tcp, 562 opj_tcp_t * tcp,
556 opj_pi_iterator_t *pi, 563 opj_pi_iterator_t *pi,
557 OPJ_BYTE *dest, 564 OPJ_BYTE *dest,
558 OPJ_UINT32 * p_data_written, 565 OPJ_UINT32 * p_data_written,
559 OPJ_UINT32 length, 566 OPJ_UINT32 length,
560 opj_codestream_info_t *cstr_info) 567 opj_codestream_info_t *cstr_info)
561 { 568 {
562 OPJ_UINT32 bandno, cblkno; 569 OPJ_UINT32 bandno, cblkno;
563 OPJ_BYTE* c = dest; 570 OPJ_BYTE* c = dest;
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
786 return OPJ_TRUE; 793 return OPJ_TRUE;
787 } 794 }
788 795
789 static OPJ_BOOL opj_t2_skip_packet( opj_t2_t* p_t2, 796 static OPJ_BOOL opj_t2_skip_packet( opj_t2_t* p_t2,
790 opj_tcd_tile_t *p_tile, 797 opj_tcd_tile_t *p_tile,
791 opj_tcp_t *p_tcp, 798 opj_tcp_t *p_tcp,
792 opj_pi_iterator_t *p_pi, 799 opj_pi_iterator_t *p_pi,
793 OPJ_BYTE *p_src, 800 OPJ_BYTE *p_src,
794 OPJ_UINT32 * p_data_read, 801 OPJ_UINT32 * p_data_read,
795 OPJ_UINT32 p_max_length, 802 OPJ_UINT32 p_max_length,
796 opj_packet_info_t *p_pack_info) 803 opj_packet_info_t *p_pack_info,
804 opj_event_mgr_t *p_manager)
797 { 805 {
798 OPJ_BOOL l_read_data; 806 OPJ_BOOL l_read_data;
799 OPJ_UINT32 l_nb_bytes_read = 0; 807 OPJ_UINT32 l_nb_bytes_read = 0;
800 OPJ_UINT32 l_nb_total_bytes_read = 0; 808 OPJ_UINT32 l_nb_total_bytes_read = 0;
801 809
802 *p_data_read = 0; 810 *p_data_read = 0;
803 811
804 if (! opj_t2_read_packet_header(p_t2,p_tile,p_tcp,p_pi,&l_read_data,p_sr c,&l_nb_bytes_read,p_max_length,p_pack_info)) { 812 if (! opj_t2_read_packet_header(p_t2,p_tile,p_tcp,p_pi,&l_read_data,p_sr c,&l_nb_bytes_read,p_max_length,p_pack_info, p_manager)) {
805 return OPJ_FALSE; 813 return OPJ_FALSE;
806 } 814 }
807 815
808 p_src += l_nb_bytes_read; 816 p_src += l_nb_bytes_read;
809 l_nb_total_bytes_read += l_nb_bytes_read; 817 l_nb_total_bytes_read += l_nb_bytes_read;
810 p_max_length -= l_nb_bytes_read; 818 p_max_length -= l_nb_bytes_read;
811 819
812 /* we should read data for the packet */ 820 /* we should read data for the packet */
813 if (l_read_data) { 821 if (l_read_data) {
814 l_nb_bytes_read = 0; 822 l_nb_bytes_read = 0;
815 823
816 if (! opj_t2_skip_packet_data(p_t2,p_tile,p_pi,&l_nb_bytes_read, p_max_length,p_pack_info)) { 824 if (! opj_t2_skip_packet_data(p_t2,p_tile,p_pi,&l_nb_bytes_read, p_max_length,p_pack_info, p_manager)) {
817 return OPJ_FALSE; 825 return OPJ_FALSE;
818 } 826 }
819 827
820 l_nb_total_bytes_read += l_nb_bytes_read; 828 l_nb_total_bytes_read += l_nb_bytes_read;
821 } 829 }
822 *p_data_read = l_nb_total_bytes_read; 830 *p_data_read = l_nb_total_bytes_read;
823 831
824 return OPJ_TRUE; 832 return OPJ_TRUE;
825 } 833 }
826 834
827 835
828 OPJ_BOOL opj_t2_read_packet_header( opj_t2_t* p_t2, 836 static OPJ_BOOL opj_t2_read_packet_header( opj_t2_t* p_t2,
829 opj_tcd_tile_t *p_tile, 837 opj_tcd_tile_t *p_tile,
830 opj_tcp_t *p_tcp, 838 opj_tcp_t *p_tcp,
831 opj_pi_iterator_t *p_pi, 839 opj_pi_iterator_t *p_pi,
832 OPJ_BOOL * p_is_data_present, 840 OPJ_BOOL * p_is_data_present,
833 OPJ_BYTE *p_src_data, 841 OPJ_BYTE *p_src_data,
834 OPJ_UINT32 * p_data_read, 842 OPJ_UINT32 * p_data_read,
835 OPJ_UINT32 p_max_length, 843 OPJ_UINT32 p_max_length,
836 opj_packet_info_t *p_pack_info) 844 opj_packet_info_t *p_pack_info,
845 opj_event_mgr_t *p_manager)
837 846
838 { 847 {
839 /* loop */ 848 /* loop */
840 OPJ_UINT32 bandno, cblkno; 849 OPJ_UINT32 bandno, cblkno;
841 OPJ_UINT32 l_nb_code_blocks; 850 OPJ_UINT32 l_nb_code_blocks;
842 OPJ_UINT32 l_remaining_length; 851 OPJ_UINT32 l_remaining_length;
843 OPJ_UINT32 l_header_length; 852 OPJ_UINT32 l_header_length;
844 OPJ_UINT32 * l_modified_length_ptr = 00; 853 OPJ_UINT32 * l_modified_length_ptr = 00;
845 OPJ_BYTE *l_current_data = p_src_data; 854 OPJ_BYTE *l_current_data = p_src_data;
846 opj_cp_t *l_cp = p_t2->cp; 855 opj_cp_t *l_cp = p_t2->cp;
(...skipping 28 matching lines...) Expand all
875 } 884 }
876 885
877 ++l_band; 886 ++l_band;
878 } 887 }
879 } 888 }
880 889
881 /* SOP markers */ 890 /* SOP markers */
882 891
883 if (p_tcp->csty & J2K_CP_CSTY_SOP) { 892 if (p_tcp->csty & J2K_CP_CSTY_SOP) {
884 if (p_max_length < 6) { 893 if (p_max_length < 6) {
885 /* TODO opj_event_msg(p_t2->cinfo->event_mgr, EVT_WARNIN G, "Not enough space for expected SOP marker\n"); */ 894 » » » » » » » » » » » » opj_event_msg(p_manager, EVT_WARNING, "Not enough space for expe cted SOP marker\n");
886 fprintf(stderr, "Not enough space for expected SOP marke r\n");
887 } else if ((*l_current_data) != 0xff || (*(l_current_data + 1) ! = 0x91)) { 895 } else if ((*l_current_data) != 0xff || (*(l_current_data + 1) ! = 0x91)) {
888 /* TODO opj_event_msg(p_t2->cinfo->event_mgr, EVT_WARNIN G, "Expected SOP marker\n"); */ 896 opj_event_msg(p_manager, EVT_WARNING, "Expected SOP mark er\n");
889 fprintf(stderr, "Warning: expected SOP marker\n");
890 } else { 897 } else {
891 l_current_data += 6; 898 l_current_data += 6;
892 } 899 }
893 900
894 /** TODO : check the Nsop value */ 901 /** TODO : check the Nsop value */
895 } 902 }
896 903
897 /* 904 /*
898 When the marker PPT/PPM is used the packet header are store in PPT/PPM m arker 905 When the marker PPT/PPM is used the packet header are store in PPT/PPM m arker
899 This part deal with this caracteristic 906 This part deal with this caracteristic
(...skipping 30 matching lines...) Expand all
930 JAS_FPRINTF(stderr, "present=%d \n", l_present ); 937 JAS_FPRINTF(stderr, "present=%d \n", l_present );
931 if (!l_present) { 938 if (!l_present) {
932 /* TODO MSD: no test to control the output of this function*/ 939 /* TODO MSD: no test to control the output of this function*/
933 opj_bio_inalign(l_bio); 940 opj_bio_inalign(l_bio);
934 l_header_data += opj_bio_numbytes(l_bio); 941 l_header_data += opj_bio_numbytes(l_bio);
935 opj_bio_destroy(l_bio); 942 opj_bio_destroy(l_bio);
936 943
937 /* EPH markers */ 944 /* EPH markers */
938 if (p_tcp->csty & J2K_CP_CSTY_EPH) { 945 if (p_tcp->csty & J2K_CP_CSTY_EPH) {
939 if ((*l_modified_length_ptr - (OPJ_UINT32)(l_header_data - *l_header_data_start)) < 2U) { 946 if ((*l_modified_length_ptr - (OPJ_UINT32)(l_header_data - *l_header_data_start)) < 2U) {
940 fprintf(stderr, "Not enough space for expected E PH marker\n"); 947 opj_event_msg(p_manager, EVT_WARNING, "Not enoug h space for expected EPH marker\n");
941 } else if ((*l_header_data) != 0xff || (*(l_header_data + 1) != 0x92)) { 948 } else if ((*l_header_data) != 0xff || (*(l_header_data + 1) != 0x92)) {
942 fprintf(stderr, "Error : expected EPH marker\n") ; 949 opj_event_msg(p_manager, EVT_WARNING, "Expected EPH marker\n");
943 } else { 950 } else {
944 l_header_data += 2; 951 l_header_data += 2;
945 } 952 }
946 } 953 }
947 954
948 l_header_length = (OPJ_UINT32)(l_header_data - *l_header_data_st art); 955 l_header_length = (OPJ_UINT32)(l_header_data - *l_header_data_st art);
949 *l_modified_length_ptr -= l_header_length; 956 *l_modified_length_ptr -= l_header_length;
950 *l_header_data_start += l_header_length; 957 *l_header_data_start += l_header_length;
951 958
952 /* << INDEX */ 959 /* << INDEX */
(...skipping 30 matching lines...) Expand all
983 /* else one bit */ 990 /* else one bit */
984 } 991 }
985 else { 992 else {
986 l_included = opj_bio_read(l_bio, 1); 993 l_included = opj_bio_read(l_bio, 1);
987 } 994 }
988 995
989 /* if cblk not included */ 996 /* if cblk not included */
990 if (!l_included) { 997 if (!l_included) {
991 l_cblk->numnewpasses = 0; 998 l_cblk->numnewpasses = 0;
992 ++l_cblk; 999 ++l_cblk;
993 JAS_FPRINTF(stderr, "included=%d \n", l_included); 1000 JAS_FPRINTF(stderr, "included=%d \n", l_included );
994 continue; 1001 continue;
995 } 1002 }
996 1003
997 /* if cblk not yet included --> zero-bitplane tagtree */ 1004 /* if cblk not yet included --> zero-bitplane tagtree */
998 if (!l_cblk->numsegs) { 1005 if (!l_cblk->numsegs) {
999 OPJ_UINT32 i = 0; 1006 OPJ_UINT32 i = 0;
1000 1007
1001 while (!opj_tgt_decode(l_bio, l_prc->imsbtree, c blkno, (OPJ_INT32)i)) { 1008 while (!opj_tgt_decode(l_bio, l_prc->imsbtree, c blkno, (OPJ_INT32)i)) {
1002 ++i; 1009 ++i;
1003 } 1010 }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1058 opj_bio_destroy(l_bio); 1065 opj_bio_destroy(l_bio);
1059 return OPJ_FALSE; 1066 return OPJ_FALSE;
1060 } 1067 }
1061 1068
1062 l_header_data += opj_bio_numbytes(l_bio); 1069 l_header_data += opj_bio_numbytes(l_bio);
1063 opj_bio_destroy(l_bio); 1070 opj_bio_destroy(l_bio);
1064 1071
1065 /* EPH markers */ 1072 /* EPH markers */
1066 if (p_tcp->csty & J2K_CP_CSTY_EPH) { 1073 if (p_tcp->csty & J2K_CP_CSTY_EPH) {
1067 if ((*l_modified_length_ptr - (OPJ_UINT32)(l_header_data - *l_he ader_data_start)) < 2U) { 1074 if ((*l_modified_length_ptr - (OPJ_UINT32)(l_header_data - *l_he ader_data_start)) < 2U) {
1068 fprintf(stderr, "Not enough space for expected EPH marke r\n"); 1075 opj_event_msg(p_manager, EVT_WARNING, "Not enough space for expected EPH marker\n");
1069 } else if ((*l_header_data) != 0xff || (*(l_header_data + 1) != 0x92)) { 1076 } else if ((*l_header_data) != 0xff || (*(l_header_data + 1) != 0x92)) {
1070 /* TODO opj_event_msg(t2->cinfo->event_mgr, EVT_ERROR, " Expected EPH marker\n"); */ 1077 opj_event_msg(p_manager, EVT_WARNING, "Expected EPH mark er\n");
1071 fprintf(stderr, "Error : expected EPH marker\n");
1072 } else { 1078 } else {
1073 l_header_data += 2; 1079 l_header_data += 2;
1074 } 1080 }
1075 } 1081 }
1076 1082
1077 l_header_length = (OPJ_UINT32)(l_header_data - *l_header_data_start); 1083 l_header_length = (OPJ_UINT32)(l_header_data - *l_header_data_start);
1078 JAS_FPRINTF( stderr, "hdrlen=%d \n", l_header_length ); 1084 JAS_FPRINTF( stderr, "hdrlen=%d \n", l_header_length );
1079 JAS_FPRINTF( stderr, "packet body\n"); 1085 JAS_FPRINTF( stderr, "packet body\n");
1080 *l_modified_length_ptr -= l_header_length; 1086 *l_modified_length_ptr -= l_header_length;
1081 *l_header_data_start += l_header_length; 1087 *l_header_data_start += l_header_length;
1082 1088
1083 /* << INDEX */ 1089 /* << INDEX */
1084 /* End of packet header position. Currently only represents the distance to start of packet 1090 /* End of packet header position. Currently only represents the distance to start of packet
1085 Will be updated later by incrementing with packet start value */ 1091 Will be updated later by incrementing with packet start value */
1086 if (p_pack_info) { 1092 if (p_pack_info) {
1087 p_pack_info->end_ph_pos = (OPJ_INT32)(l_current_data - p_src_dat a); 1093 p_pack_info->end_ph_pos = (OPJ_INT32)(l_current_data - p_src_dat a);
1088 } 1094 }
1089 /* INDEX >> */ 1095 /* INDEX >> */
1090 1096
1091 *p_is_data_present = OPJ_TRUE; 1097 *p_is_data_present = OPJ_TRUE;
1092 *p_data_read = (OPJ_UINT32)(l_current_data - p_src_data); 1098 *p_data_read = (OPJ_UINT32)(l_current_data - p_src_data);
1093 1099
1094 return OPJ_TRUE; 1100 return OPJ_TRUE;
1095 } 1101 }
1096 1102
1097 OPJ_BOOL opj_t2_read_packet_data( opj_t2_t* p_t2, 1103 static OPJ_BOOL opj_t2_read_packet_data( opj_t2_t* p_t2,
1098 opj_tcd_tile_t *p_tile, 1104 opj_tcd_tile_t *p_tile,
1099 opj_pi_iterator_t *p_pi, 1105 opj_pi_iterator_t *p_pi,
1100 OPJ_BYTE *p_src_data, 1106 OPJ_BYTE *p_src_data,
1101 OPJ_UINT32 * p_data_read, 1107 OPJ_UINT32 * p_data_read,
1102 OPJ_UINT32 p_max_length, 1108 OPJ_UINT32 p_max_length,
1103 opj_packet_info_t *pack_info) 1109 opj_packet_info_t *pack_info,
1110 opj_event_mgr_t* p_manager)
1104 { 1111 {
1105 OPJ_UINT32 bandno, cblkno; 1112 OPJ_UINT32 bandno, cblkno;
1106 OPJ_UINT32 l_nb_code_blocks; 1113 OPJ_UINT32 l_nb_code_blocks;
1107 OPJ_BYTE *l_current_data = p_src_data; 1114 OPJ_BYTE *l_current_data = p_src_data;
1108 opj_tcd_band_t *l_band = 00; 1115 opj_tcd_band_t *l_band = 00;
1109 opj_tcd_cblk_dec_t* l_cblk = 00; 1116 opj_tcd_cblk_dec_t* l_cblk = 00;
1110 opj_tcd_resolution_t* l_res = &p_tile->comps[p_pi->compno].resolutions[p _pi->resno]; 1117 opj_tcd_resolution_t* l_res = &p_tile->comps[p_pi->compno].resolutions[p _pi->resno];
1111 1118
1112 OPJ_ARG_NOT_USED(p_t2); 1119 OPJ_ARG_NOT_USED(p_t2);
1113 OPJ_ARG_NOT_USED(pack_info); 1120 OPJ_ARG_NOT_USED(pack_info);
(...skipping 29 matching lines...) Expand all
1143 1150
1144 if (l_seg->numpasses == l_seg->maxpasses) { 1151 if (l_seg->numpasses == l_seg->maxpasses) {
1145 ++l_seg; 1152 ++l_seg;
1146 ++l_cblk->numsegs; 1153 ++l_cblk->numsegs;
1147 } 1154 }
1148 } 1155 }
1149 1156
1150 do { 1157 do {
1151 /* Check possible overflow (on l_current_data on ly, assumes input args already checked) then size */ 1158 /* Check possible overflow (on l_current_data on ly, assumes input args already checked) then size */
1152 if ((((OPJ_SIZE_T)l_current_data + (OPJ_SIZE_T)l _seg->newlen) < (OPJ_SIZE_T)l_current_data) || (l_current_data + l_seg->newlen > p_src_data + p_max_length)) { 1159 if ((((OPJ_SIZE_T)l_current_data + (OPJ_SIZE_T)l _seg->newlen) < (OPJ_SIZE_T)l_current_data) || (l_current_data + l_seg->newlen > p_src_data + p_max_length)) {
1153 fprintf(stderr, "read: segment too long (%d) with max (%d) for codeblock %d (p=%d, b=%d, r=%d, c=%d)\n", 1160 opj_event_msg(p_manager, EVT_ERROR, "rea d: segment too long (%d) with max (%d) for codeblock %d (p=%d, b=%d, r=%d, c=%d) \n",
1154 l_seg->newlen, p_max_length, cbl kno, p_pi->precno, bandno, p_pi->resno, p_pi->compno); 1161 » » » » » » » » » » » » » » » » » » » » » » » » l_seg->newlen, p_max_length, cblkno, p_pi->precn o, bandno, p_pi->resno, p_pi->compno);
1155 return OPJ_FALSE; 1162 return OPJ_FALSE;
1156 } 1163 }
1157 1164
1158 #ifdef USE_JPWL 1165 #ifdef USE_JPWL
1159 /* we need here a j2k handle to verify if making a check to 1166 /* we need here a j2k handle to verify if making a check to
1160 the validity of cblocks parameters is selected from user (-W) */ 1167 the validity of cblocks parameters is selected from user (-W) */
1161 1168
1162 /* let's check that we are not exceeding */ 1169 /* let's check that we are not exceeding */
1163 if ((l_cblk->len + l_seg->newlen) > 8192) { 1170 if ((l_cblk->len + l_seg->newlen) > 8192) {
1164 opj_event_msg(p_t2->cinfo, EVT_WARNING, 1171 opj_event_msg(p_manager, EVT_WARNING,
1165 "JPWL: segment too long (%d) for codeblock %d (p=%d, b=%d, r=%d, c=%d)\n", 1172 "JPWL: segment too long (%d) for codeblock %d (p=%d, b=%d, r=%d, c=%d)\n",
1166 l_seg->newlen, cblkno, p_pi->pre cno, bandno, p_pi->resno, p_pi->compno); 1173 l_seg->newlen, cblkno, p_pi->pre cno, bandno, p_pi->resno, p_pi->compno);
1167 if (!JPWL_ASSUME) { 1174 if (!JPWL_ASSUME) {
1168 opj_event_msg(p_t2->cinfo, EVT_E RROR, "JPWL: giving up\n"); 1175 opj_event_msg(p_manager, EVT_ERR OR, "JPWL: giving up\n");
1169 return OPJ_FALSE; 1176 return OPJ_FALSE;
1170 } 1177 }
1171 l_seg->newlen = 8192 - l_cblk->len; 1178 l_seg->newlen = 8192 - l_cblk->len;
1172 opj_event_msg(p_t2->cinfo, EVT_WARNING, " - truncating segment to %d\n", l_seg->newlen); 1179 opj_event_msg(p_manager, EVT_WARNING, " - truncating segment to %d\n", l_seg->newlen);
1173 break; 1180 break;
1174 }; 1181 };
1175 1182
1176 #endif /* USE_JPWL */ 1183 #endif /* USE_JPWL */
1177 /* Check possible overflow on size */ 1184 /* Check possible overflow on size */
1178 if ((l_cblk->data_current_size + l_seg->newlen) < l_cblk->data_current_size) { 1185 if ((l_cblk->data_current_size + l_seg->newlen) < l_cblk->data_current_size) {
1179 fprintf(stderr, "read: segment too long (%d) with current size (%d > %d) for codeblock %d (p=%d, b=%d, r=%d, c=%d)\n", 1186 opj_event_msg(p_manager, EVT_ERROR, "rea d: segment too long (%d) with current size (%d > %d) for codeblock %d (p=%d, b=% d, r=%d, c=%d)\n",
1180 l_seg->newlen, l_cblk->data_curr ent_size, 0xFFFFFFFF - l_seg->newlen, cblkno, p_pi->precno, bandno, p_pi->resno, p_pi->compno); 1187 l_seg->newlen, l_cblk->data_curr ent_size, 0xFFFFFFFF - l_seg->newlen, cblkno, p_pi->precno, bandno, p_pi->resno, p_pi->compno);
1181 return OPJ_FALSE; 1188 return OPJ_FALSE;
1182 } 1189 }
1183 /* Check if the cblk->data have allocated enough memory */ 1190 /* Check if the cblk->data have allocated enough memory */
1184 if ((l_cblk->data_current_size + l_seg->newlen) > l_cblk->data_max_size) { 1191 if ((l_cblk->data_current_size + l_seg->newlen) > l_cblk->data_max_size) {
1185 OPJ_BYTE* new_cblk_data = (OPJ_BYTE*) opj_re alloc(l_cblk->data, l_cblk->data_current_size + l_seg->newlen); 1192 OPJ_BYTE* new_cblk_data = (OPJ_BYTE*) opj_re alloc(l_cblk->data, l_cblk->data_current_size + l_seg->newlen);
1186 if(! new_cblk_data) { 1193 if(! new_cblk_data) {
1187 opj_free(l_cblk->data); 1194 opj_free(l_cblk->data);
1188 l_cblk->data = NULL; 1195 l_cblk->data = NULL;
1189 l_cblk->data_max_size = 0; 1196 l_cblk->data_max_size = 0;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1221 1228
1222 ++l_band; 1229 ++l_band;
1223 } 1230 }
1224 1231
1225 *(p_data_read) = (OPJ_UINT32)(l_current_data - p_src_data); 1232 *(p_data_read) = (OPJ_UINT32)(l_current_data - p_src_data);
1226 1233
1227 1234
1228 return OPJ_TRUE; 1235 return OPJ_TRUE;
1229 } 1236 }
1230 1237
1231 OPJ_BOOL opj_t2_skip_packet_data( opj_t2_t* p_t2, 1238 static OPJ_BOOL opj_t2_skip_packet_data( opj_t2_t* p_t2,
1232 opj_tcd_tile_t *p_tile, 1239 opj_tcd_tile_t *p_tile,
1233 opj_pi_iterator_t *p_pi, 1240 opj_pi_iterator_t *p_pi,
1234 OPJ_UINT32 * p_data_read, 1241 OPJ_UINT32 * p_data_read,
1235 OPJ_UINT32 p_max_length, 1242 OPJ_UINT32 p_max_length,
1236 opj_packet_info_t *pack_info) 1243 opj_packet_info_t *pack_info,
1244 opj_event_mgr_t *p_manager)
1237 { 1245 {
1238 OPJ_UINT32 bandno, cblkno; 1246 OPJ_UINT32 bandno, cblkno;
1239 OPJ_UINT32 l_nb_code_blocks; 1247 OPJ_UINT32 l_nb_code_blocks;
1240 opj_tcd_band_t *l_band = 00; 1248 opj_tcd_band_t *l_band = 00;
1241 opj_tcd_cblk_dec_t* l_cblk = 00; 1249 opj_tcd_cblk_dec_t* l_cblk = 00;
1242 opj_tcd_resolution_t* l_res = &p_tile->comps[p_pi->compno].resolutions[p _pi->resno]; 1250 opj_tcd_resolution_t* l_res = &p_tile->comps[p_pi->compno].resolutions[p _pi->resno];
1243 1251
1244 OPJ_ARG_NOT_USED(p_t2); 1252 OPJ_ARG_NOT_USED(p_t2);
1245 OPJ_ARG_NOT_USED(pack_info); 1253 OPJ_ARG_NOT_USED(pack_info);
1246 1254
(...skipping 30 matching lines...) Expand all
1277 1285
1278 if (l_seg->numpasses == l_seg->maxpasses) { 1286 if (l_seg->numpasses == l_seg->maxpasses) {
1279 ++l_seg; 1287 ++l_seg;
1280 ++l_cblk->numsegs; 1288 ++l_cblk->numsegs;
1281 } 1289 }
1282 } 1290 }
1283 1291
1284 do { 1292 do {
1285 /* Check possible overflow then size */ 1293 /* Check possible overflow then size */
1286 if (((*p_data_read + l_seg->newlen) < (*p_data_r ead)) || ((*p_data_read + l_seg->newlen) > p_max_length)) { 1294 if (((*p_data_read + l_seg->newlen) < (*p_data_r ead)) || ((*p_data_read + l_seg->newlen) > p_max_length)) {
1287 fprintf(stderr, "skip: segment too long (%d) with max (%d) for codeblock %d (p=%d, b=%d, r=%d, c=%d)\n", 1295 opj_event_msg(p_manager, EVT_ERROR, "ski p: segment too long (%d) with max (%d) for codeblock %d (p=%d, b=%d, r=%d, c=%d) \n",
1288 l_seg->newlen, p_max_length, cbl kno, p_pi->precno, bandno, p_pi->resno, p_pi->compno); 1296 l_seg->newlen, p_max_length, cbl kno, p_pi->precno, bandno, p_pi->resno, p_pi->compno);
1289 return OPJ_FALSE; 1297 return OPJ_FALSE;
1290 } 1298 }
1291 1299
1292 #ifdef USE_JPWL 1300 #ifdef USE_JPWL
1293 /* we need here a j2k handle to verify if making a check to 1301 /* we need here a j2k handle to verify if making a check to
1294 the validity of cblocks parameters is selected from user (-W) */ 1302 the validity of cblocks parameters is selected from user (-W) */
1295 1303
1296 /* let's check that we are not exceeding */ 1304 /* let's check that we are not exceeding */
1297 if ((l_cblk->len + l_seg->newlen) > 8192) { 1305 if ((l_cblk->len + l_seg->newlen) > 8192) {
1298 opj_event_msg(p_t2->cinfo, EVT_WARNING, 1306 opj_event_msg(p_manager, EVT_WARNING,
1299 "JPWL: segment too long (%d) for codeblock %d (p=%d, b=%d, r=%d, c=%d)\n", 1307 "JPWL: segment too long (%d) for codeblock %d (p=%d, b=%d, r=%d, c=%d)\n",
1300 l_seg->newlen, cblkno, p_pi->pre cno, bandno, p_pi->resno, p_pi->compno); 1308 l_seg->newlen, cblkno, p_pi->pre cno, bandno, p_pi->resno, p_pi->compno);
1301 if (!JPWL_ASSUME) { 1309 if (!JPWL_ASSUME) {
1302 opj_event_msg(p_t2->cinfo, EVT_E RROR, "JPWL: giving up\n"); 1310 opj_event_msg(p_manager, EVT_ERR OR, "JPWL: giving up\n");
1303 return -999; 1311 return -999;
1304 } 1312 }
1305 l_seg->newlen = 8192 - l_cblk->len; 1313 l_seg->newlen = 8192 - l_cblk->len;
1306 opj_event_msg(p_t2->cinfo, EVT_WARNING, " - truncating segment to %d\n", l_seg->newlen); 1314 opj_event_msg(p_manager, EVT_WARNING, " - truncating segment to %d\n", l_seg->newlen);
1307 break; 1315 break;
1308 }; 1316 };
1309 1317
1310 #endif /* USE_JPWL */ 1318 #endif /* USE_JPWL */
1311 JAS_FPRINTF(stderr, "p_data_read (%d) ne wlen (%d) \n", *p_data_read, l_seg->newlen ); 1319 JAS_FPRINTF(stderr, "p_data_read (%d) ne wlen (%d) \n", *p_data_read, l_seg->newlen );
1312 *(p_data_read) += l_seg->newlen; 1320 *(p_data_read) += l_seg->newlen;
1313 1321
1314 l_seg->numpasses += l_seg->numnewpasses; 1322 l_seg->numpasses += l_seg->numnewpasses;
1315 l_cblk->numnewpasses -= l_seg->numnewpasses; 1323 l_cblk->numnewpasses -= l_seg->numnewpasses;
1316 if (l_cblk->numnewpasses > 0) 1324 if (l_cblk->numnewpasses > 0)
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1364 seg->maxpasses = 10; 1372 seg->maxpasses = 10;
1365 } else { 1373 } else {
1366 seg->maxpasses = (((seg - 1)->maxpasses == 1) || ((seg - 1)->maxpasses == 10)) ? 2 : 1; 1374 seg->maxpasses = (((seg - 1)->maxpasses == 1) || ((seg - 1)->maxpasses == 10)) ? 2 : 1;
1367 } 1375 }
1368 } else { 1376 } else {
1369 seg->maxpasses = 109; 1377 seg->maxpasses = 109;
1370 } 1378 }
1371 1379
1372 return OPJ_TRUE; 1380 return OPJ_TRUE;
1373 } 1381 }
OLDNEW
« no previous file with comments | « third_party/libopenjpeg20/t2.h ('k') | third_party/libopenjpeg20/tcd.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698