summaryrefslogtreecommitdiff
path: root/libopenjpeg
diff options
context:
space:
mode:
authorMickael Savinaud <savmickael@users.noreply.github.com>2012-03-09 17:16:04 +0000
committerMickael Savinaud <savmickael@users.noreply.github.com>2012-03-09 17:16:04 +0000
commit4b8c29a7081756e738592fe51e888aa06dafe00d (patch)
treea4abe87ceea4146ad4e46a6180897f69e9b5683d /libopenjpeg
parent04b057d22ccedc036430059a135e95a38d74e58d (diff)
[trunk] add tcd_get_encoded_tile_size in trunk from branch v2alpha
Diffstat (limited to 'libopenjpeg')
-rw-r--r--libopenjpeg/tcd.c27
-rw-r--r--libopenjpeg/tcd.h13
2 files changed, 35 insertions, 5 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;
+}
diff --git a/libopenjpeg/tcd.h b/libopenjpeg/tcd.h
index cb9967cd..7fdf258b 100644
--- a/libopenjpeg/tcd.h
+++ b/libopenjpeg/tcd.h
@@ -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.
*/
-opj_bool tcd_update_tile_data (
- opj_tcd_v2_t *p_tcd,
- OPJ_BYTE * p_dest,
- OPJ_UINT32 p_dest_length
- );
+opj_bool tcd_update_tile_data ( opj_tcd_v2_t *p_tcd,
+ OPJ_BYTE * p_dest,
+ OPJ_UINT32 p_dest_length );
+
+/**
+ *
+ */
+OPJ_UINT32 tcd_get_encoded_tile_size ( opj_tcd_v2_t *p_tcd );
/* ----------------------------------------------------------------------- */
/*@}*/