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

Side by Side Diff: core/src/fxcodec/fx_libopenjpeg/libopenjpeg20/t2.c

Issue 670813002: Update openjpeg to r2908 (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 6 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 | « core/src/fxcodec/fx_libopenjpeg/libopenjpeg20/jp2.c ('k') | no next file » | 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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 for (compno = 0; compno < l_max_comp; ++compno) { 235 for (compno = 0; compno < l_max_comp; ++compno) {
236 OPJ_UINT32 l_comp_len = 0; 236 OPJ_UINT32 l_comp_len = 0;
237 l_current_pi = l_pi; 237 l_current_pi = l_pi;
238 238
239 for (poc = 0; poc < pocno ; ++poc) { 239 for (poc = 0; poc < pocno ; ++poc) {
240 OPJ_UINT32 l_tp_num = compno; 240 OPJ_UINT32 l_tp_num = compno;
241 241
242 /* TODO MSD : check why this function cannot fai l (cf. v1) */ 242 /* TODO MSD : check why this function cannot fai l (cf. v1) */
243 opj_pi_create_encode(l_pi, l_cp,p_tile_no,poc,l_ tp_num,p_tp_pos,p_t2_mode); 243 opj_pi_create_encode(l_pi, l_cp,p_tile_no,poc,l_ tp_num,p_tp_pos,p_t2_mode);
244 244
245 if (l_current_pi->poc.prg == OPJ_PROG_UNKNOWN) {
246 /* TODO ADE : add an error */
247 opj_pi_destroy(l_pi, l_nb_pocs);
248 return OPJ_FALSE;
249 }
245 while (opj_pi_next(l_current_pi)) { 250 while (opj_pi_next(l_current_pi)) {
246 if (l_current_pi->layno < p_maxlayers) { 251 if (l_current_pi->layno < p_maxlayers) {
247 l_nb_bytes = 0; 252 l_nb_bytes = 0;
248 253
249 if (! opj_t2_encode_packet(p_til e_no,p_tile, l_tcp, l_current_pi, l_current_data, &l_nb_bytes, p_max_len, cstr_i nfo)) { 254 if (! opj_t2_encode_packet(p_til e_no,p_tile, l_tcp, l_current_pi, l_current_data, &l_nb_bytes, p_max_len, cstr_i nfo)) {
250 opj_pi_destroy(l_pi, l_n b_pocs); 255 opj_pi_destroy(l_pi, l_n b_pocs);
251 return OPJ_FALSE; 256 return OPJ_FALSE;
252 } 257 }
253 258
254 l_comp_len += l_nb_bytes; 259 l_comp_len += l_nb_bytes;
(...skipping 12 matching lines...) Expand all
267 } 272 }
268 273
269 ++l_current_pi; 274 ++l_current_pi;
270 } 275 }
271 } 276 }
272 } 277 }
273 else { /* t2_mode == FINAL_PASS */ 278 else { /* t2_mode == FINAL_PASS */
274 opj_pi_create_encode(l_pi, l_cp,p_tile_no,p_pino,p_tp_num,p_tp_p os,p_t2_mode); 279 opj_pi_create_encode(l_pi, l_cp,p_tile_no,p_pino,p_tp_num,p_tp_p os,p_t2_mode);
275 280
276 l_current_pi = &l_pi[p_pino]; 281 l_current_pi = &l_pi[p_pino];
277 282 if (l_current_pi->poc.prg == OPJ_PROG_UNKNOWN) {
283 /* TODO ADE : add an error */
284 opj_pi_destroy(l_pi, l_nb_pocs);
285 return OPJ_FALSE;
286 }
278 while (opj_pi_next(l_current_pi)) { 287 while (opj_pi_next(l_current_pi)) {
279 if (l_current_pi->layno < p_maxlayers) { 288 if (l_current_pi->layno < p_maxlayers) {
280 l_nb_bytes=0; 289 l_nb_bytes=0;
281 290
282 if (! opj_t2_encode_packet(p_tile_no,p_tile, l_t cp, l_current_pi, l_current_data, &l_nb_bytes, p_max_len, cstr_info)) { 291 if (! opj_t2_encode_packet(p_tile_no,p_tile, l_t cp, l_current_pi, l_current_data, &l_nb_bytes, p_max_len, cstr_info)) {
283 opj_pi_destroy(l_pi, l_nb_pocs); 292 opj_pi_destroy(l_pi, l_nb_pocs);
284 return OPJ_FALSE; 293 return OPJ_FALSE;
285 } 294 }
286 295
287 l_current_data += l_nb_bytes; 296 l_current_data += l_nb_bytes;
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 * and no l_img_comp->resno_decoded are computed 388 * and no l_img_comp->resno_decoded are computed
380 */ 389 */
381 OPJ_BOOL* first_pass_failed = (OPJ_BOOL*)opj_malloc(l_image->num comps * sizeof(OPJ_BOOL)); 390 OPJ_BOOL* first_pass_failed = (OPJ_BOOL*)opj_malloc(l_image->num comps * sizeof(OPJ_BOOL));
382 if (!first_pass_failed) 391 if (!first_pass_failed)
383 { 392 {
384 opj_pi_destroy(l_pi,l_nb_pocs); 393 opj_pi_destroy(l_pi,l_nb_pocs);
385 return OPJ_FALSE; 394 return OPJ_FALSE;
386 } 395 }
387 memset(first_pass_failed, OPJ_TRUE, l_image->numcomps * sizeof(O PJ_BOOL)); 396 memset(first_pass_failed, OPJ_TRUE, l_image->numcomps * sizeof(O PJ_BOOL));
388 397
398 if (l_current_pi->poc.prg == OPJ_PROG_UNKNOWN) {
399 /* TODO ADE : add an error */
400 opj_pi_destroy(l_pi, l_nb_pocs);
401 return OPJ_FALSE;
402 }
389 while (opj_pi_next(l_current_pi)) { 403 while (opj_pi_next(l_current_pi)) {
390 JAS_FPRINTF( stderr, "packet offset=00000166 prg=%d cmptno=%02 d rlvlno=%02d prcno=%03d lyrno=%02d\n\n", 404 JAS_FPRINTF( stderr, "packet offset=00000166 prg=%d cmptno=%02 d rlvlno=%02d prcno=%03d lyrno=%02d\n\n",
391 l_current_pi->poc.prg1, l_current_pi->compno, l_current_pi-> resno, l_current_pi->precno, l_current_pi->layno ); 405 l_current_pi->poc.prg1, l_current_pi->compno, l_current_pi-> resno, l_current_pi->precno, l_current_pi->layno );
392 406
393 if (l_tcp->num_layers_to_decode > l_current_pi->layno 407 if (l_tcp->num_layers_to_decode > l_current_pi->layno
394 && l_current_pi->resno < p_tile->comps[l _current_pi->compno].minimum_num_resolutions) { 408 && l_current_pi->resno < p_tile->comps[l _current_pi->compno].minimum_num_resolutions) {
395 l_nb_bytes_read = 0; 409 l_nb_bytes_read = 0;
396 410
397 first_pass_failed[l_current_pi->compno] = OPJ_FA LSE; 411 first_pass_failed[l_current_pi->compno] = OPJ_FA LSE;
398 412
(...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after
1258 else { 1272 else {
1259 l_seg = &l_cblk->segs[l_cblk->numsegs - 1]; 1273 l_seg = &l_cblk->segs[l_cblk->numsegs - 1];
1260 1274
1261 if (l_seg->numpasses == l_seg->maxpasses) { 1275 if (l_seg->numpasses == l_seg->maxpasses) {
1262 ++l_seg; 1276 ++l_seg;
1263 ++l_cblk->numsegs; 1277 ++l_cblk->numsegs;
1264 } 1278 }
1265 } 1279 }
1266 1280
1267 do { 1281 do {
1268 if (* p_data_read + l_seg->newlen > p_max_length ) { 1282 /* Check possible overflow then size */
1283 if (((*p_data_read + l_seg->newlen) < (*p_data_r ead)) || ((*p_data_read + l_seg->newlen) > p_max_length)) {
1269 fprintf(stderr, "skip: segment too long (%d) with max (%d) for codeblock %d (p=%d, b=%d, r=%d, c=%d)\n", 1284 fprintf(stderr, "skip: segment too long (%d) with max (%d) for codeblock %d (p=%d, b=%d, r=%d, c=%d)\n",
1270 l_seg->newlen, p_max_length, cbl kno, p_pi->precno, bandno, p_pi->resno, p_pi->compno); 1285 l_seg->newlen, p_max_length, cbl kno, p_pi->precno, bandno, p_pi->resno, p_pi->compno);
1271 return OPJ_FALSE; 1286 return OPJ_FALSE;
1272 } 1287 }
1273 1288
1274 #ifdef USE_JPWL 1289 #ifdef USE_JPWL
1275 /* we need here a j2k handle to verify if making a check to 1290 /* we need here a j2k handle to verify if making a check to
1276 the validity of cblocks parameters is selected from user (-W) */ 1291 the validity of cblocks parameters is selected from user (-W) */
1277 1292
1278 /* let's check that we are not exceeding */ 1293 /* let's check that we are not exceeding */
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1346 seg->maxpasses = 10; 1361 seg->maxpasses = 10;
1347 } else { 1362 } else {
1348 seg->maxpasses = (((seg - 1)->maxpasses == 1) || ((seg - 1)->maxpasses == 10)) ? 2 : 1; 1363 seg->maxpasses = (((seg - 1)->maxpasses == 1) || ((seg - 1)->maxpasses == 10)) ? 2 : 1;
1349 } 1364 }
1350 } else { 1365 } else {
1351 seg->maxpasses = 109; 1366 seg->maxpasses = 109;
1352 } 1367 }
1353 1368
1354 return OPJ_TRUE; 1369 return OPJ_TRUE;
1355 } 1370 }
OLDNEW
« no previous file with comments | « core/src/fxcodec/fx_libopenjpeg/libopenjpeg20/jp2.c ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698