diff options
| author | Mickael Savinaud <savmickael@users.noreply.github.com> | 2012-03-09 17:16:04 +0000 |
|---|---|---|
| committer | Mickael Savinaud <savmickael@users.noreply.github.com> | 2012-03-09 17:16:04 +0000 |
| commit | 4b8c29a7081756e738592fe51e888aa06dafe00d (patch) | |
| tree | a4abe87ceea4146ad4e46a6180897f69e9b5683d /libopenjpeg/tcd.c | |
| parent | 04b057d22ccedc036430059a135e95a38d74e58d (diff) | |
[trunk] add tcd_get_encoded_tile_size in trunk from branch v2alpha
Diffstat (limited to 'libopenjpeg/tcd.c')
| -rw-r--r-- | libopenjpeg/tcd.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/libopenjpeg/tcd.c b/libopenjpeg/tcd.c index ea09a17f..706d2654 100644 --- a/libopenjpeg/tcd.c +++ b/libopenjpeg/tcd.c @@ -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; +} |
