diff options
| author | Young_X <YangX92@hotmail.com> | 2018-11-23 16:24:19 +0800 |
|---|---|---|
| committer | Young Xiao <YangX92@hotmail.com> | 2018-11-28 14:39:14 +0800 |
| commit | c58df149900df862806d0e892859b41115875845 (patch) | |
| tree | 99013bb7267fa447b1056f7a123614c58f9f7711 /src/lib | |
| parent | c277159986c80142180fbe5efb256bbf3bdf3edc (diff) | |
[OPENJP2] change the way to compute *p_tx0, *p_tx1, *p_ty0, *p_ty1 in function
opj_get_encoding_parameters
Signed-off-by: Young_X <YangX92@hotmail.com>
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/openjp2/pi.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/lib/openjp2/pi.c b/src/lib/openjp2/pi.c index 91642ee4..4a6ed68e 100644 --- a/src/lib/openjp2/pi.c +++ b/src/lib/openjp2/pi.c @@ -748,6 +748,9 @@ static void opj_get_encoding_parameters(const opj_image_t *p_image, /* position in x and y of tile */ OPJ_UINT32 p, q; + /* non-corrected (in regard to image offset) tile offset */ + OPJ_UINT32 l_tx0, l_ty0; + /* preconditions */ assert(p_cp != 00); assert(p_image != 00); @@ -763,14 +766,14 @@ static void opj_get_encoding_parameters(const opj_image_t *p_image, q = p_tileno / p_cp->tw; /* find extent of tile */ - *p_tx0 = opj_int_max((OPJ_INT32)(p_cp->tx0 + p * p_cp->tdx), - (OPJ_INT32)p_image->x0); - *p_tx1 = opj_int_min((OPJ_INT32)(p_cp->tx0 + (p + 1) * p_cp->tdx), - (OPJ_INT32)p_image->x1); - *p_ty0 = opj_int_max((OPJ_INT32)(p_cp->ty0 + q * p_cp->tdy), - (OPJ_INT32)p_image->y0); - *p_ty1 = opj_int_min((OPJ_INT32)(p_cp->ty0 + (q + 1) * p_cp->tdy), - (OPJ_INT32)p_image->y1); + l_tx0 = p_cp->tx0 + p * + p_cp->tdx; /* can't be greater than p_image->x1 so won't overflow */ + *p_tx0 = (OPJ_INT32)opj_uint_max(l_tx0, p_image->x0); + *p_tx1 = (OPJ_INT32)opj_uint_min(opj_uint_adds(l_tx0, p_cp->tdx), p_image->x1); + l_ty0 = p_cp->ty0 + q * + p_cp->tdy; /* can't be greater than p_image->y1 so won't overflow */ + *p_ty0 = (OPJ_INT32)opj_uint_max(l_ty0, p_image->y0); + *p_ty1 = (OPJ_INT32)opj_uint_min(opj_uint_adds(l_ty0, p_cp->tdy), p_image->y1); /* max precision is 0 (can only grow) */ *p_max_prec = 0; |
