Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 669 /* testcase 1888.pdf.asan.35.988 */ \ | 669 /* testcase 1888.pdf.asan.35.988 */ \ |
| 670 if (l_tccp->numresolutions == 0) { \ | 670 if (l_tccp->numresolutions == 0) { \ |
| 671 fprintf(stderr, "tiles require at least one resolution\n"); \ | 671 fprintf(stderr, "tiles require at least one resolution\n"); \ |
| 672 return OPJ_FALSE; \ | 672 return OPJ_FALSE; \ |
| 673 } \ | 673 } \ |
| 674 /*fprintf(stderr, "Tile border = %d,%d,%d,%d\n", l_tile->x0, l_tile->y0, l_tile->x1,l_tile->y1);*/ \ | 674 /*fprintf(stderr, "Tile border = %d,%d,%d,%d\n", l_tile->x0, l_tile->y0, l_tile->x1,l_tile->y1);*/ \ |
| 675 \ | 675 \ |
| 676 /*tile->numcomps = image->numcomps; */ \ | 676 /*tile->numcomps = image->numcomps; */ \ |
| 677 for(compno = 0; compno < l_tile->numcomps; ++compno) { \ | 677 for(compno = 0; compno < l_tile->numcomps; ++compno) { \ |
| 678 /*fprintf(stderr, "compno = %d/%d\n", compno, l_tile->numcomps); */ \ | 678 /*fprintf(stderr, "compno = %d/%d\n", compno, l_tile->numcomps); */ \ |
| 679 \ | 679 l_image_comp->resno_decoded = 0; \ |
| 680 /* border of each l_tile component (global) */ \ | 680 /* border of each l_tile component (global) */ \ |
| 681 l_tilec->x0 = opj_int_ceildiv(l_tile->x0, (OPJ_INT32)l_image_com p->dx); \ | 681 l_tilec->x0 = opj_int_ceildiv(l_tile->x0, (OPJ_INT32)l_image_com p->dx); \ |
| 682 l_tilec->y0 = opj_int_ceildiv(l_tile->y0, (OPJ_INT32)l_image_com p->dy); \ | 682 l_tilec->y0 = opj_int_ceildiv(l_tile->y0, (OPJ_INT32)l_image_com p->dy); \ |
| 683 l_tilec->x1 = opj_int_ceildiv(l_tile->x1, (OPJ_INT32)l_image_com p->dx); \ | 683 l_tilec->x1 = opj_int_ceildiv(l_tile->x1, (OPJ_INT32)l_image_com p->dx); \ |
| 684 l_tilec->y1 = opj_int_ceildiv(l_tile->y1, (OPJ_INT32)l_image_com p->dy); \ | 684 l_tilec->y1 = opj_int_ceildiv(l_tile->y1, (OPJ_INT32)l_image_com p->dy); \ |
| 685 /*fprintf(stderr, "\tTile compo border = %d,%d,%d,%d\n", l_tilec ->x0, l_tilec->y0,l_tilec->x1,l_tilec->y1);*/ \ | 685 /*fprintf(stderr, "\tTile compo border = %d,%d,%d,%d\n", l_tilec ->x0, l_tilec->y0,l_tilec->x1,l_tilec->y1);*/ \ |
| 686 \ | 686 \ |
| 687 l_data_size = (OPJ_UINT32)(l_tilec->x1 - l_tilec->x0) \ | 687 l_data_size = (OPJ_UINT32)(l_tilec->x1 - l_tilec->x0) \ |
| 688 * (OPJ_UINT32)(l_tilec->y1 - l_tilec->y0) * (OPJ_UINT32)sizeof(O PJ_UINT32 );\ | 688 * (OPJ_UINT32)(l_tilec->y1 - l_tilec->y0) * (OPJ_UINT32)sizeof(O PJ_UINT32 );\ |
| 689 l_tilec->numresolutions = l_tccp->numresolutions; \ | 689 l_tilec->numresolutions = l_tccp->numresolutions; \ |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 963 } \ | 963 } \ |
| 964 \ | 964 \ |
| 965 l_code_block = l_current_precinct->cblks .ELEMENT; \ | 965 l_code_block = l_current_precinct->cblks .ELEMENT; \ |
| 966 \ | 966 \ |
| 967 for (cblkno = 0; cblkno < l_nb_code_bloc ks; ++cblkno) { \ | 967 for (cblkno = 0; cblkno < l_nb_code_bloc ks; ++cblkno) { \ |
| 968 OPJ_INT32 cblkxstart = tlcblkxst art + (OPJ_INT32)(cblkno % l_current_precinct->cw) * (1 << cblkwidthexpn); \ | 968 OPJ_INT32 cblkxstart = tlcblkxst art + (OPJ_INT32)(cblkno % l_current_precinct->cw) * (1 << cblkwidthexpn); \ |
| 969 OPJ_INT32 cblkystart = tlcblkyst art + (OPJ_INT32)(cblkno / l_current_precinct->cw) * (1 << cblkheightexpn); \ | 969 OPJ_INT32 cblkystart = tlcblkyst art + (OPJ_INT32)(cblkno / l_current_precinct->cw) * (1 << cblkheightexpn); \ |
| 970 OPJ_INT32 cblkxend = cblkxstart + (1 << cblkwidthexpn); \ | 970 OPJ_INT32 cblkxend = cblkxstart + (1 << cblkwidthexpn); \ |
| 971 OPJ_INT32 cblkyend = cblkystart + (1 << cblkheightexpn); \ | 971 OPJ_INT32 cblkyend = cblkystart + (1 << cblkheightexpn); \ |
| 972 \ | 972 \ |
| 973 if (! FUNCTION_ELEMENT(l_code_bl ock)) { \ | |
| 974 return OPJ_FALSE; \ | |
| 975 } \ | |
| 973 /* code-block size (global) */ \ | 976 /* code-block size (global) */ \ |
| 974 l_code_block->x0 = opj_int_max(c blkxstart, l_current_precinct->x0); \ | 977 l_code_block->x0 = opj_int_max(c blkxstart, l_current_precinct->x0); \ |
| 975 l_code_block->y0 = opj_int_max(c blkystart, l_current_precinct->y0); \ | 978 l_code_block->y0 = opj_int_max(c blkystart, l_current_precinct->y0); \ |
| 976 l_code_block->x1 = opj_int_min(c blkxend, l_current_precinct->x1); \ | 979 l_code_block->x1 = opj_int_min(c blkxend, l_current_precinct->x1); \ |
| 977 l_code_block->y1 = opj_int_min(c blkyend, l_current_precinct->y1); \ | 980 l_code_block->y1 = opj_int_min(c blkyend, l_current_precinct->y1); \ |
| 978 \ | |
| 979 if (! FUNCTION_ELEMENT(l_code_bl ock)) { \ | |
| 980 return OPJ_FALSE; \ | |
| 981 } \ | |
| 982 ++l_code_block; \ | 981 ++l_code_block; \ |
| 983 } \ | 982 } \ |
| 984 ++l_current_precinct; \ | 983 ++l_current_precinct; \ |
| 985 } /* precno */ \ | 984 } /* precno */ \ |
| 986 ++l_band; \ | 985 ++l_band; \ |
| 987 ++l_step_size; \ | 986 ++l_step_size; \ |
| 988 } /* bandno */ \ | 987 } /* bandno */ \ |
| 989 ++l_res; \ | 988 ++l_res; \ |
| 990 --l_level_no; \ | 989 --l_level_no; \ |
| 991 } /* resno */ \ | 990 } /* resno */ \ |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1047 /*fprintf(stderr, "Allocate 8192 elements of code_block->data\n" );*/ | 1046 /*fprintf(stderr, "Allocate 8192 elements of code_block->data\n" );*/ |
| 1048 | 1047 |
| 1049 p_code_block->segs = (opj_tcd_seg_t *) opj_calloc(OPJ_J2K_DEFAUL T_NB_SEGS,sizeof(opj_tcd_seg_t)); | 1048 p_code_block->segs = (opj_tcd_seg_t *) opj_calloc(OPJ_J2K_DEFAUL T_NB_SEGS,sizeof(opj_tcd_seg_t)); |
| 1050 if (! p_code_block->segs) { | 1049 if (! p_code_block->segs) { |
| 1051 return OPJ_FALSE; | 1050 return OPJ_FALSE; |
| 1052 } | 1051 } |
| 1053 /*fprintf(stderr, "Allocate %d elements of code_block->data\n", OPJ_J2K_DEFAULT_NB_SEGS * sizeof(opj_tcd_seg_t));*/ | 1052 /*fprintf(stderr, "Allocate %d elements of code_block->data\n", OPJ_J2K_DEFAULT_NB_SEGS * sizeof(opj_tcd_seg_t));*/ |
| 1054 | 1053 |
| 1055 p_code_block->m_current_max_segs = OPJ_J2K_DEFAULT_NB_SEGS; | 1054 p_code_block->m_current_max_segs = OPJ_J2K_DEFAULT_NB_SEGS; |
| 1056 /*fprintf(stderr, "m_current_max_segs of code_block->data = %d\n ", p_code_block->m_current_max_segs);*/ | 1055 /*fprintf(stderr, "m_current_max_segs of code_block->data = %d\n ", p_code_block->m_current_max_segs);*/ |
| 1057 } | 1056 } else { |
| 1058 /* TODO */ | 1057 » » » » » /* sanitize */ |
| 1059 /*p_code_block->numsegs = 0; */ | 1058 » » » » » OPJ_BYTE* l_data = p_code_block->data; |
| 1059 » » » » » OPJ_UINT32 l_data_max_size = p_code_bloc k->data_max_size; | |
| 1060 » » » » » opj_tcd_seg_t * l_segs = p_code_block->s egs; | |
| 1061 » » » » » OPJ_UINT32 l_current_max_segs = p_code_b lock->m_current_max_segs; | |
| 1062 | |
| 1063 » » » » » memset(p_code_block, 0, sizeof(opj_tcd_c blk_dec_t)); | |
|
Tom Sepez
2014/10/22 19:03:06
How do we know that p_code_block can accomodate si
Bo Xu
2014/10/22 22:29:03
I am asking openjpeg team to cc you in their bug t
| |
| 1064 » » » » » p_code_block->data = l_data; | |
| 1065 » » » » » p_code_block->data_max_size = l_data_max _size; | |
| 1066 » » » » » p_code_block->segs = l_segs; | |
| 1067 » » » » » p_code_block->m_current_max_segs = l_cur rent_max_segs; | |
| 1068 » » » » } | |
| 1060 | 1069 |
| 1061 return OPJ_TRUE; | 1070 return OPJ_TRUE; |
| 1062 } | 1071 } |
| 1063 | 1072 |
| 1064 OPJ_UINT32 opj_tcd_get_decoded_tile_size ( opj_tcd_t *p_tcd ) | 1073 OPJ_UINT32 opj_tcd_get_decoded_tile_size ( opj_tcd_t *p_tcd ) |
| 1065 { | 1074 { |
| 1066 OPJ_UINT32 i; | 1075 OPJ_UINT32 i; |
| 1067 OPJ_UINT32 l_data_size = 0; | 1076 OPJ_UINT32 l_data_size = 0; |
| 1068 opj_image_comp_t * l_img_comp = 00; | 1077 opj_image_comp_t * l_img_comp = 00; |
| 1069 opj_tcd_tilecomp_t * l_tile_comp = 00; | 1078 opj_tcd_tilecomp_t * l_tile_comp = 00; |
| (...skipping 1044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2114 } | 2123 } |
| 2115 break; | 2124 break; |
| 2116 } | 2125 } |
| 2117 | 2126 |
| 2118 ++l_img_comp; | 2127 ++l_img_comp; |
| 2119 ++l_tilec; | 2128 ++l_tilec; |
| 2120 } | 2129 } |
| 2121 | 2130 |
| 2122 return OPJ_TRUE; | 2131 return OPJ_TRUE; |
| 2123 } | 2132 } |
| OLD | NEW |