Index: core/src/fxcodec/fx_libopenjpeg/libopenjpeg20/tcd.c |
diff --git a/core/src/fxcodec/fx_libopenjpeg/libopenjpeg20/tcd.c b/core/src/fxcodec/fx_libopenjpeg/libopenjpeg20/tcd.c |
index 7dd93e99168600adec87d2efc26796414f0cfbe1..1720b8efa54edd04041616213c549514c5cbaaf2 100644 |
--- a/core/src/fxcodec/fx_libopenjpeg/libopenjpeg20/tcd.c |
+++ b/core/src/fxcodec/fx_libopenjpeg/libopenjpeg20/tcd.c |
@@ -676,7 +676,7 @@ OPJ_BOOL FUNCTION ( opj_tcd_t *p_tcd, \ |
/*tile->numcomps = image->numcomps; */ \ |
for(compno = 0; compno < l_tile->numcomps; ++compno) { \ |
/*fprintf(stderr, "compno = %d/%d\n", compno, l_tile->numcomps);*/ \ |
- \ |
+ l_image_comp->resno_decoded = 0; \ |
/* border of each l_tile component (global) */ \ |
l_tilec->x0 = opj_int_ceildiv(l_tile->x0, (OPJ_INT32)l_image_comp->dx); \ |
l_tilec->y0 = opj_int_ceildiv(l_tile->y0, (OPJ_INT32)l_image_comp->dy); \ |
@@ -970,15 +970,14 @@ OPJ_BOOL FUNCTION ( opj_tcd_t *p_tcd, \ |
OPJ_INT32 cblkxend = cblkxstart + (1 << cblkwidthexpn); \ |
OPJ_INT32 cblkyend = cblkystart + (1 << cblkheightexpn); \ |
\ |
+ if (! FUNCTION_ELEMENT(l_code_block)) { \ |
+ return OPJ_FALSE; \ |
+ } \ |
/* code-block size (global) */ \ |
l_code_block->x0 = opj_int_max(cblkxstart, l_current_precinct->x0); \ |
l_code_block->y0 = opj_int_max(cblkystart, l_current_precinct->y0); \ |
l_code_block->x1 = opj_int_min(cblkxend, l_current_precinct->x1); \ |
l_code_block->y1 = opj_int_min(cblkyend, l_current_precinct->y1); \ |
- \ |
- if (! FUNCTION_ELEMENT(l_code_block)) { \ |
- return OPJ_FALSE; \ |
- } \ |
++l_code_block; \ |
} \ |
++l_current_precinct; \ |
@@ -1054,9 +1053,19 @@ OPJ_BOOL opj_tcd_code_block_dec_allocate (opj_tcd_cblk_dec_t * p_code_block) |
p_code_block->m_current_max_segs = OPJ_J2K_DEFAULT_NB_SEGS; |
/*fprintf(stderr, "m_current_max_segs of code_block->data = %d\n", p_code_block->m_current_max_segs);*/ |
- } |
- /* TODO */ |
- /*p_code_block->numsegs = 0; */ |
+ } else { |
+ /* sanitize */ |
+ OPJ_BYTE* l_data = p_code_block->data; |
+ OPJ_UINT32 l_data_max_size = p_code_block->data_max_size; |
+ opj_tcd_seg_t * l_segs = p_code_block->segs; |
+ OPJ_UINT32 l_current_max_segs = p_code_block->m_current_max_segs; |
+ |
+ memset(p_code_block, 0, sizeof(opj_tcd_cblk_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
|
+ p_code_block->data = l_data; |
+ p_code_block->data_max_size = l_data_max_size; |
+ p_code_block->segs = l_segs; |
+ p_code_block->m_current_max_segs = l_current_max_segs; |
+ } |
return OPJ_TRUE; |
} |