[trunk] add tcd_get_encoded_tile_size in trunk from branch v2alpha

This commit is contained in:
Mickael Savinaud 2012-03-09 17:16:04 +00:00
parent 04b057d22c
commit 4b8c29a708
2 changed files with 35 additions and 5 deletions

View File

@ -2623,4 +2623,31 @@ void tcd_code_block_dec_deallocate (opj_tcd_precinct_v2_t * p_precinct)
} }
} }
OPJ_UINT32 tcd_get_encoded_tile_size ( opj_tcd_v2_t *p_tcd )
{
OPJ_UINT32 i,l_data_size = 0;
opj_image_comp_t * l_img_comp = 00;
opj_tcd_tilecomp_t * l_tilec = 00;
OPJ_UINT32 l_size_comp, l_remaining;
l_tilec = p_tcd->tcd_image->tiles->comps;
l_img_comp = p_tcd->image->comps;
for (i=0;i<p_tcd->image->numcomps;++i) {
l_size_comp = l_img_comp->prec >> 3; /*(/ 8)*/
l_remaining = l_img_comp->prec & 7; /* (%8) */
if (l_remaining) {
++l_size_comp;
}
if (l_size_comp == 3) {
l_size_comp = 4;
}
l_data_size += l_size_comp * (l_tilec->x1 - l_tilec->x0) * (l_tilec->y1 - l_tilec->y0);
++l_img_comp;
++l_tilec;
}
return l_data_size;
}

View File

@ -486,11 +486,14 @@ opj_bool tcd_decode_tile_v2(opj_tcd_v2_t *tcd,
/** /**
* Copies tile data from the system onto the given memory block. * Copies tile data from the system onto the given memory block.
*/ */
opj_bool tcd_update_tile_data ( opj_bool tcd_update_tile_data ( opj_tcd_v2_t *p_tcd,
opj_tcd_v2_t *p_tcd,
OPJ_BYTE * p_dest, OPJ_BYTE * p_dest,
OPJ_UINT32 p_dest_length OPJ_UINT32 p_dest_length );
);
/**
*
*/
OPJ_UINT32 tcd_get_encoded_tile_size ( opj_tcd_v2_t *p_tcd );
/* ----------------------------------------------------------------------- */ /* ----------------------------------------------------------------------- */
/*@}*/ /*@}*/