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

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

Issue 1231353003: Merge to M44: Cleanup if early return from opj_j2k_copy_default_tcp_and_create_tcd(). (Closed) Base URL: https://pdfium.googlesource.com/pdfium@2403
Patch Set: Created 5 years, 5 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 | « no previous file | 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 7334 matching lines...) Expand 10 before | Expand all | Expand 10 after
7345 7345
7346 /* For each tile */ 7346 /* For each tile */
7347 for (i=0; i<l_nb_tiles; ++i) { 7347 for (i=0; i<l_nb_tiles; ++i) {
7348 /* keep the tile-compo coding parameters pointer of the current tile coding parameters*/ 7348 /* keep the tile-compo coding parameters pointer of the current tile coding parameters*/
7349 l_current_tccp = l_tcp->tccps; 7349 l_current_tccp = l_tcp->tccps;
7350 /*Copy default coding parameters into the current tile coding pa rameters*/ 7350 /*Copy default coding parameters into the current tile coding pa rameters*/
7351 memcpy(l_tcp, l_default_tcp, sizeof(opj_tcp_t)); 7351 memcpy(l_tcp, l_default_tcp, sizeof(opj_tcp_t));
7352 /* Initialize some values of the current tile coding parameters* / 7352 /* Initialize some values of the current tile coding parameters* /
7353 l_tcp->ppt = 0; 7353 l_tcp->ppt = 0;
7354 l_tcp->ppt_data = 00; 7354 l_tcp->ppt_data = 00;
7355 /* Remove memory not owned by this tile in case of early error r eturn. */
7356 l_tcp->m_mct_decoding_matrix = 00;
7357 l_tcp->m_nb_max_mct_records = 0;
7358 l_tcp->m_mct_records = 00;
7359 l_tcp->m_nb_max_mcc_records = 0;
7360 l_tcp->m_mcc_records = 00;
7355 /* Reconnect the tile-compo coding parameters pointer to the cur rent tile coding parameters*/ 7361 /* Reconnect the tile-compo coding parameters pointer to the cur rent tile coding parameters*/
7356 l_tcp->tccps = l_current_tccp; 7362 l_tcp->tccps = l_current_tccp;
7357 7363
7358 /* Get the mct_decoding_matrix of the dflt_tile_cp and copy them into the current tile cp*/ 7364 /* Get the mct_decoding_matrix of the dflt_tile_cp and copy them into the current tile cp*/
7359 if (l_default_tcp->m_mct_decoding_matrix) { 7365 if (l_default_tcp->m_mct_decoding_matrix) {
7360 l_tcp->m_mct_decoding_matrix = (OPJ_FLOAT32*)opj_malloc( l_mct_size); 7366 l_tcp->m_mct_decoding_matrix = (OPJ_FLOAT32*)opj_malloc( l_mct_size);
7361 if (! l_tcp->m_mct_decoding_matrix ) { 7367 if (! l_tcp->m_mct_decoding_matrix ) {
7362 return OPJ_FALSE; 7368 return OPJ_FALSE;
7363 } 7369 }
7364 memcpy(l_tcp->m_mct_decoding_matrix,l_default_tcp->m_mct _decoding_matrix,l_mct_size); 7370 memcpy(l_tcp->m_mct_decoding_matrix,l_default_tcp->m_mct _decoding_matrix,l_mct_size);
(...skipping 17 matching lines...) Expand all
7382 7388
7383 l_dest_mct_rec->m_data = (OPJ_BYTE*) opj_malloc( l_src_mct_rec->m_data_size); 7389 l_dest_mct_rec->m_data = (OPJ_BYTE*) opj_malloc( l_src_mct_rec->m_data_size);
7384 if(! l_dest_mct_rec->m_data) { 7390 if(! l_dest_mct_rec->m_data) {
7385 return OPJ_FALSE; 7391 return OPJ_FALSE;
7386 } 7392 }
7387 memcpy(l_dest_mct_rec->m_data,l_src_mct_rec->m_d ata,l_src_mct_rec->m_data_size); 7393 memcpy(l_dest_mct_rec->m_data,l_src_mct_rec->m_d ata,l_src_mct_rec->m_data_size);
7388 } 7394 }
7389 7395
7390 ++l_src_mct_rec; 7396 ++l_src_mct_rec;
7391 ++l_dest_mct_rec; 7397 ++l_dest_mct_rec;
7398
7399 /* Update with each pass to free exactly what has been a llocated on early return. */
7400 l_tcp->m_nb_max_mct_records += 1;
7392 } 7401 }
7393 7402
7394 /* Get the mcc_record of the dflt_tile_cp and copy them into the current tile cp*/ 7403 /* Get the mcc_record of the dflt_tile_cp and copy them into the current tile cp*/
7395 l_mcc_records_size = l_default_tcp->m_nb_max_mcc_records * (OPJ_ UINT32)sizeof(opj_simple_mcc_decorrelation_data_t); 7404 l_mcc_records_size = l_default_tcp->m_nb_max_mcc_records * (OPJ_ UINT32)sizeof(opj_simple_mcc_decorrelation_data_t);
7396 l_tcp->m_mcc_records = (opj_simple_mcc_decorrelation_data_t*) op j_malloc(l_mcc_records_size); 7405 l_tcp->m_mcc_records = (opj_simple_mcc_decorrelation_data_t*) op j_malloc(l_mcc_records_size);
7397 if (! l_tcp->m_mcc_records) { 7406 if (! l_tcp->m_mcc_records) {
7398 return OPJ_FALSE; 7407 return OPJ_FALSE;
7399 } 7408 }
7400 memcpy(l_tcp->m_mcc_records,l_default_tcp->m_mcc_records,l_mcc_r ecords_size); 7409 memcpy(l_tcp->m_mcc_records,l_default_tcp->m_mcc_records,l_mcc_r ecords_size);
7410 l_tcp->m_nb_max_mcc_records = l_default_tcp->m_nb_max_mcc_record s;
7401 7411
7402 /* Copy the mcc record data from dflt_tile_cp to the current til e*/ 7412 /* Copy the mcc record data from dflt_tile_cp to the current til e*/
7403 l_src_mcc_rec = l_default_tcp->m_mcc_records; 7413 l_src_mcc_rec = l_default_tcp->m_mcc_records;
7404 l_dest_mcc_rec = l_tcp->m_mcc_records; 7414 l_dest_mcc_rec = l_tcp->m_mcc_records;
7405 7415
7406 for (j=0;j<l_default_tcp->m_nb_max_mcc_records;++j) { 7416 for (j=0;j<l_default_tcp->m_nb_max_mcc_records;++j) {
7407 7417
7408 if (l_src_mcc_rec->m_decorrelation_array) { 7418 if (l_src_mcc_rec->m_decorrelation_array) {
7409 l_offset = (OPJ_UINT32)(l_src_mcc_rec->m_decorre lation_array - l_default_tcp->m_mct_records); 7419 l_offset = (OPJ_UINT32)(l_src_mcc_rec->m_decorre lation_array - l_default_tcp->m_mct_records);
7410 l_dest_mcc_rec->m_decorrelation_array = l_tcp->m _mct_records + l_offset; 7420 l_dest_mcc_rec->m_decorrelation_array = l_tcp->m _mct_records + l_offset;
(...skipping 3167 matching lines...) Expand 10 before | Expand all | Expand 10 after
10578 return OPJ_FALSE; 10588 return OPJ_FALSE;
10579 } 10589 }
10580 if (! opj_j2k_post_write_tile(p_j2k,p_stream,p_manager)) { 10590 if (! opj_j2k_post_write_tile(p_j2k,p_stream,p_manager)) {
10581 opj_event_msg(p_manager, EVT_ERROR, "Error while opj_j2k _post_write_tile with tile index = %d\n", p_tile_index); 10591 opj_event_msg(p_manager, EVT_ERROR, "Error while opj_j2k _post_write_tile with tile index = %d\n", p_tile_index);
10582 return OPJ_FALSE; 10592 return OPJ_FALSE;
10583 } 10593 }
10584 } 10594 }
10585 10595
10586 return OPJ_TRUE; 10596 return OPJ_TRUE;
10587 } 10597 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698