diff --git a/src/lib/openjp2/dwt.c b/src/lib/openjp2/dwt.c index 161a01a3..7d87a9f8 100644 --- a/src/lib/openjp2/dwt.c +++ b/src/lib/openjp2/dwt.c @@ -40,8 +40,8 @@ /** @defgroup DWT DWT - Implementation of a discrete wavelet transform */ /*@{*/ -#define WS(i) v->mem[(i)*2] -#define WD(i) v->mem[(1+(i)*2)] +#define OPJ_WS(i) v->mem[(i)*2] +#define OPJ_WD(i) v->mem[(1+(i)*2)] /** @name Local data structures */ /*@{*/ @@ -51,18 +51,18 @@ typedef struct dwt_local { OPJ_INT32 dn; OPJ_INT32 sn; OPJ_INT32 cas; -} dwt_t; +} opj_dwt_t; typedef union { OPJ_FLOAT32 f[4]; -} v4; +} opj_v4_t; typedef struct v4dwt_local { - v4* wavelet ; + opj_v4_t* wavelet ; OPJ_INT32 dn ; OPJ_INT32 sn ; OPJ_INT32 cas ; -} v4dwt_t ; +} opj_v4dwt_t ; static const OPJ_FLOAT32 opj_dwt_alpha = 1.586134342f; /* 12994 */ static const OPJ_FLOAT32 opj_dwt_beta = 0.052980118f; /* 434 */ @@ -77,7 +77,7 @@ static const OPJ_FLOAT32 opj_c13318 = 1.625732422f; /** Virtual function type for wavelet transform in 1-D */ -typedef void (*DWT1DFN)(dwt_t* v); +typedef void (*DWT1DFN)(opj_dwt_t* v); /** @name Local static functions */ /*@{*/ @@ -93,11 +93,11 @@ static void opj_dwt_deinterleave_v(OPJ_INT32 *a, OPJ_INT32 *b, OPJ_INT32 dn, OPJ /** Inverse lazy transform (horizontal) */ -static void opj_dwt_interleave_h(dwt_t* h, OPJ_INT32 *a); +static void opj_dwt_interleave_h(opj_dwt_t* h, OPJ_INT32 *a); /** Inverse lazy transform (vertical) */ -static void opj_dwt_interleave_v(dwt_t* v, OPJ_INT32 *a, OPJ_INT32 x); +static void opj_dwt_interleave_v(opj_dwt_t* v, OPJ_INT32 *a, OPJ_INT32 x); /** Forward 5-3 wavelet transform in 1-D */ @@ -105,7 +105,7 @@ static void opj_dwt_encode_1(OPJ_INT32 *a, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 /** Inverse 5-3 wavelet transform in 1-D */ -static void opj_dwt_decode_1(dwt_t *v); +static void opj_dwt_decode_1(opj_dwt_t *v); static void opj_dwt_decode_1_(OPJ_INT32 *a, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 cas); /** Forward 9-7 wavelet transform in 1-D @@ -128,21 +128,21 @@ static OPJ_UINT32 opj_dwt_max_resolution(opj_tcd_resolution_t* restrict r, OPJ_U /* */ /* Inverse 9-7 wavelet transform in 1-D. */ /* */ -static void opj_v4dwt_decode(v4dwt_t* restrict dwt); +static void opj_v4dwt_decode(opj_v4dwt_t* restrict dwt); -static void opj_v4dwt_interleave_h(v4dwt_t* restrict w, OPJ_FLOAT32* restrict a, OPJ_INT32 x, OPJ_INT32 size); +static void opj_v4dwt_interleave_h(opj_v4dwt_t* restrict w, OPJ_FLOAT32* restrict a, OPJ_INT32 x, OPJ_INT32 size); -static void opj_v4dwt_interleave_v(v4dwt_t* restrict v , OPJ_FLOAT32* restrict a , OPJ_INT32 x, OPJ_INT32 nb_elts_read); +static void opj_v4dwt_interleave_v(opj_v4dwt_t* restrict v , OPJ_FLOAT32* restrict a , OPJ_INT32 x, OPJ_INT32 nb_elts_read); #ifdef __SSE__ -static void opj_v4dwt_decode_step1_sse(v4* w, OPJ_INT32 count, const __m128 c); +static void opj_v4dwt_decode_step1_sse(opj_v4_t* w, OPJ_INT32 count, const __m128 c); -static void opj_v4dwt_decode_step2_sse(v4* l, v4* w, OPJ_INT32 k, OPJ_INT32 m, __m128 c); +static void opj_v4dwt_decode_step2_sse(opj_v4_t* l, opj_v4_t* w, OPJ_INT32 k, OPJ_INT32 m, __m128 c); #else -static void opj_v4dwt_decode_step1(v4* w, OPJ_INT32 count, const OPJ_FLOAT32 c); +static void opj_v4dwt_decode_step1(opj_v4_t* w, OPJ_INT32 count, const OPJ_FLOAT32 c); -static void opj_v4dwt_decode_step2(v4* l, v4* w, OPJ_INT32 k, OPJ_INT32 m, OPJ_FLOAT32 c); +static void opj_v4dwt_decode_step2(opj_v4_t* l, opj_v4_t* w, OPJ_INT32 k, OPJ_INT32 m, OPJ_FLOAT32 c); #endif @@ -150,13 +150,13 @@ static void opj_v4dwt_decode_step2(v4* l, v4* w, OPJ_INT32 k, OPJ_INT32 m, OPJ_F /*@}*/ -#define S(i) a[(i)*2] -#define D(i) a[(1+(i)*2)] -#define S_(i) ((i)<0?S(0):((i)>=sn?S(sn-1):S(i))) -#define D_(i) ((i)<0?D(0):((i)>=dn?D(dn-1):D(i))) +#define OPJ_S(i) a[(i)*2] +#define OPJ_D(i) a[(1+(i)*2)] +#define OPJ_S_(i) ((i)<0?OPJ_S(0):((i)>=sn?OPJ_S(sn-1):OPJ_S(i))) +#define OPJ_D_(i) ((i)<0?OPJ_D(0):((i)>=dn?OPJ_D(dn-1):OPJ_D(i))) /* new */ -#define SS_(i) ((i)<0?S(0):((i)>=dn?S(dn-1):S(i))) -#define DD_(i) ((i)<0?D(0):((i)>=sn?D(sn-1):D(i))) +#define OPJ_SS_(i) ((i)<0?OPJ_S(0):((i)>=dn?OPJ_S(dn-1):OPJ_S(i))) +#define OPJ_DD_(i) ((i)<0?OPJ_D(0):((i)>=sn?OPJ_D(sn-1):OPJ_D(i))) /* */ /* This table contains the norms of the 5-3 wavelets for different bands. */ @@ -234,7 +234,7 @@ void opj_dwt_deinterleave_v(OPJ_INT32 *a, OPJ_INT32 *b, OPJ_INT32 dn, OPJ_INT32 /* */ /* Inverse lazy transform (horizontal). */ /* */ -void opj_dwt_interleave_h(dwt_t* h, OPJ_INT32 *a) { +void opj_dwt_interleave_h(opj_dwt_t* h, OPJ_INT32 *a) { OPJ_INT32 *ai = a; OPJ_INT32 *bi = h->mem + h->cas; OPJ_INT32 i = h->sn; @@ -254,7 +254,7 @@ void opj_dwt_interleave_h(dwt_t* h, OPJ_INT32 *a) { /* */ /* Inverse lazy transform (vertical). */ /* */ -void opj_dwt_interleave_v(dwt_t* v, OPJ_INT32 *a, OPJ_INT32 x) { +void opj_dwt_interleave_v(opj_dwt_t* v, OPJ_INT32 *a, OPJ_INT32 x) { OPJ_INT32 *ai = a; OPJ_INT32 *bi = v->mem + v->cas; OPJ_INT32 i = v->sn; @@ -282,15 +282,15 @@ void opj_dwt_encode_1(OPJ_INT32 *a, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 cas) { if (!cas) { if ((dn > 0) || (sn > 1)) { /* NEW : CASE ONE ELEMENT */ - for (i = 0; i < dn; i++) D(i) -= (S_(i) + S_(i + 1)) >> 1; - for (i = 0; i < sn; i++) S(i) += (D_(i - 1) + D_(i) + 2) >> 2; + for (i = 0; i < dn; i++) OPJ_D(i) -= (OPJ_S_(i) + OPJ_S_(i + 1)) >> 1; + for (i = 0; i < sn; i++) OPJ_S(i) += (OPJ_D_(i - 1) + OPJ_D_(i) + 2) >> 2; } } else { if (!sn && dn == 1) /* NEW : CASE ONE ELEMENT */ - S(0) *= 2; + OPJ_S(0) *= 2; else { - for (i = 0; i < dn; i++) S(i) -= (DD_(i) + DD_(i - 1)) >> 1; - for (i = 0; i < sn; i++) D(i) += (SS_(i) + SS_(i + 1) + 2) >> 2; + for (i = 0; i < dn; i++) OPJ_S(i) -= (OPJ_DD_(i) + OPJ_DD_(i - 1)) >> 1; + for (i = 0; i < sn; i++) OPJ_D(i) += (OPJ_SS_(i) + OPJ_SS_(i + 1) + 2) >> 2; } } } @@ -303,15 +303,15 @@ void opj_dwt_decode_1_(OPJ_INT32 *a, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 cas) if (!cas) { if ((dn > 0) || (sn > 1)) { /* NEW : CASE ONE ELEMENT */ - for (i = 0; i < sn; i++) S(i) -= (D_(i - 1) + D_(i) + 2) >> 2; - for (i = 0; i < dn; i++) D(i) += (S_(i) + S_(i + 1)) >> 1; + for (i = 0; i < sn; i++) OPJ_S(i) -= (OPJ_D_(i - 1) + OPJ_D_(i) + 2) >> 2; + for (i = 0; i < dn; i++) OPJ_D(i) += (OPJ_S_(i) + OPJ_S_(i + 1)) >> 1; } } else { if (!sn && dn == 1) /* NEW : CASE ONE ELEMENT */ - S(0) /= 2; + OPJ_S(0) /= 2; else { - for (i = 0; i < sn; i++) D(i) -= (SS_(i) + SS_(i + 1) + 2) >> 2; - for (i = 0; i < dn; i++) S(i) += (DD_(i) + DD_(i - 1)) >> 1; + for (i = 0; i < sn; i++) OPJ_D(i) -= (OPJ_SS_(i) + OPJ_SS_(i + 1) + 2) >> 2; + for (i = 0; i < dn; i++) OPJ_S(i) += (OPJ_DD_(i) + OPJ_DD_(i - 1)) >> 1; } } } @@ -319,7 +319,7 @@ void opj_dwt_decode_1_(OPJ_INT32 *a, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 cas) /* */ /* Inverse 5-3 wavelet transform in 1-D. */ /* */ -void opj_dwt_decode_1(dwt_t *v) { +void opj_dwt_decode_1(opj_dwt_t *v) { opj_dwt_decode_1_(v->mem, v->dn, v->sn, v->cas); } @@ -331,32 +331,32 @@ void opj_dwt_encode_1_real(OPJ_INT32 *a, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 c if (!cas) { if ((dn > 0) || (sn > 1)) { /* NEW : CASE ONE ELEMENT */ for (i = 0; i < dn; i++) - D(i) -= opj_int_fix_mul(S_(i) + S_(i + 1), 12993); + OPJ_D(i) -= opj_int_fix_mul(OPJ_S_(i) + OPJ_S_(i + 1), 12993); for (i = 0; i < sn; i++) - S(i) -= opj_int_fix_mul(D_(i - 1) + D_(i), 434); + OPJ_S(i) -= opj_int_fix_mul(OPJ_D_(i - 1) + OPJ_D_(i), 434); for (i = 0; i < dn; i++) - D(i) += opj_int_fix_mul(S_(i) + S_(i + 1), 7233); + OPJ_D(i) += opj_int_fix_mul(OPJ_S_(i) + OPJ_S_(i + 1), 7233); for (i = 0; i < sn; i++) - S(i) += opj_int_fix_mul(D_(i - 1) + D_(i), 3633); + OPJ_S(i) += opj_int_fix_mul(OPJ_D_(i - 1) + OPJ_D_(i), 3633); for (i = 0; i < dn; i++) - D(i) = opj_int_fix_mul(D(i), 5038); /*5038 */ + OPJ_D(i) = opj_int_fix_mul(OPJ_D(i), 5038); /*5038 */ for (i = 0; i < sn; i++) - S(i) = opj_int_fix_mul(S(i), 6659); /*6660 */ + OPJ_S(i) = opj_int_fix_mul(OPJ_S(i), 6659); /*6660 */ } } else { if ((sn > 0) || (dn > 1)) { /* NEW : CASE ONE ELEMENT */ for (i = 0; i < dn; i++) - S(i) -= opj_int_fix_mul(DD_(i) + DD_(i - 1), 12993); + OPJ_S(i) -= opj_int_fix_mul(OPJ_DD_(i) + OPJ_DD_(i - 1), 12993); for (i = 0; i < sn; i++) - D(i) -= opj_int_fix_mul(SS_(i) + SS_(i + 1), 434); + OPJ_D(i) -= opj_int_fix_mul(OPJ_SS_(i) + OPJ_SS_(i + 1), 434); for (i = 0; i < dn; i++) - S(i) += opj_int_fix_mul(DD_(i) + DD_(i - 1), 7233); + OPJ_S(i) += opj_int_fix_mul(OPJ_DD_(i) + OPJ_DD_(i - 1), 7233); for (i = 0; i < sn; i++) - D(i) += opj_int_fix_mul(SS_(i) + SS_(i + 1), 3633); + OPJ_D(i) += opj_int_fix_mul(OPJ_SS_(i) + OPJ_SS_(i + 1), 3633); for (i = 0; i < dn; i++) - S(i) = opj_int_fix_mul(S(i), 5038); /*5038 */ + OPJ_S(i) = opj_int_fix_mul(OPJ_S(i), 5038); /*5038 */ for (i = 0; i < sn; i++) - D(i) = opj_int_fix_mul(D(i), 6659); /*6660 */ + OPJ_D(i) = opj_int_fix_mul(OPJ_D(i), 6659); /*6660 */ } } } @@ -555,8 +555,8 @@ OPJ_UINT32 opj_dwt_max_resolution(opj_tcd_resolution_t* restrict r, OPJ_UINT32 i /* Inverse wavelet transform in 2-D. */ /* */ OPJ_BOOL opj_dwt_decode_tile(opj_tcd_tilecomp_t* tilec, OPJ_UINT32 numres, DWT1DFN dwt_1D) { - dwt_t h; - dwt_t v; + opj_dwt_t h; + opj_dwt_t v; opj_tcd_resolution_t* tr = tilec->resolutions; @@ -609,7 +609,7 @@ OPJ_BOOL opj_dwt_decode_tile(opj_tcd_tilecomp_t* tilec, OPJ_UINT32 numres, DWT1D return OPJ_TRUE; } -void opj_v4dwt_interleave_h(v4dwt_t* restrict w, OPJ_FLOAT32* restrict a, OPJ_INT32 x, OPJ_INT32 size){ +void opj_v4dwt_interleave_h(opj_v4dwt_t* restrict w, OPJ_FLOAT32* restrict a, OPJ_INT32 x, OPJ_INT32 size){ OPJ_FLOAT32* restrict bi = (OPJ_FLOAT32*) (w->wavelet + w->cas); OPJ_INT32 count = w->sn; OPJ_INT32 i, k; @@ -645,15 +645,15 @@ void opj_v4dwt_interleave_h(v4dwt_t* restrict w, OPJ_FLOAT32* restrict a, OPJ_IN } } - bi = (float*) (w->wavelet + 1 - w->cas); + bi = (OPJ_FLOAT32*) (w->wavelet + 1 - w->cas); a += w->sn; size -= w->sn; count = w->dn; } } -void opj_v4dwt_interleave_v(v4dwt_t* restrict v , OPJ_FLOAT32* restrict a , OPJ_INT32 x, OPJ_INT32 nb_elts_read){ - v4* restrict bi = v->wavelet + v->cas; +void opj_v4dwt_interleave_v(opj_v4dwt_t* restrict v , OPJ_FLOAT32* restrict a , OPJ_INT32 x, OPJ_INT32 nb_elts_read){ + opj_v4_t* restrict bi = v->wavelet + v->cas; OPJ_INT32 i; for(i = 0; i < v->sn; ++i){ @@ -670,7 +670,7 @@ void opj_v4dwt_interleave_v(v4dwt_t* restrict v , OPJ_FLOAT32* restrict a , OPJ_ #ifdef __SSE__ -void opj_v4dwt_decode_step1_sse(v4* w, int count, const __m128 c){ +void opj_v4dwt_decode_step1_sse(opj_v4_t* w, OPJ_INT32 count, const __m128 c){ __m128* restrict vw = (__m128*) w; OPJ_INT32 i; /* 4x unrolled loop */ @@ -691,10 +691,10 @@ void opj_v4dwt_decode_step1_sse(v4* w, int count, const __m128 c){ } } -void opj_v4dwt_decode_step2_sse(v4* l, v4* w, int k, int m, __m128 c){ +void opj_v4dwt_decode_step2_sse(opj_v4_t* l, opj_v4_t* w, OPJ_INT32 k, OPJ_INT32 m, __m128 c){ __m128* restrict vl = (__m128*) l; __m128* restrict vw = (__m128*) w; - int i; + OPJ_INT32 i; __m128 tmp1, tmp2, tmp3; tmp1 = vl[0]; for(i = 0; i < m; ++i){ @@ -719,7 +719,7 @@ void opj_v4dwt_decode_step2_sse(v4* l, v4* w, int k, int m, __m128 c){ #else -void opj_v4dwt_decode_step1(v4* w, OPJ_INT32 count, const OPJ_FLOAT32 c) +void opj_v4dwt_decode_step1(opj_v4_t* w, OPJ_INT32 count, const OPJ_FLOAT32 c) { OPJ_FLOAT32* restrict fw = (OPJ_FLOAT32*) w; OPJ_INT32 i; @@ -735,11 +735,11 @@ void opj_v4dwt_decode_step1(v4* w, OPJ_INT32 count, const OPJ_FLOAT32 c) } } -void opj_v4dwt_decode_step2(v4* l, v4* w, OPJ_INT32 k, OPJ_INT32 m, OPJ_FLOAT32 c) +void opj_v4dwt_decode_step2(opj_v4_t* l, opj_v4_t* w, OPJ_INT32 k, OPJ_INT32 m, OPJ_FLOAT32 c) { OPJ_FLOAT32* restrict fl = (OPJ_FLOAT32*) l; OPJ_FLOAT32* restrict fw = (OPJ_FLOAT32*) w; - int i; + OPJ_INT32 i; for(i = 0; i < m; ++i){ OPJ_FLOAT32 tmp1_1 = fl[0]; OPJ_FLOAT32 tmp1_2 = fl[1]; @@ -789,9 +789,9 @@ void opj_v4dwt_decode_step2(v4* l, v4* w, OPJ_INT32 k, OPJ_INT32 m, OPJ_FLOAT32 /* */ /* Inverse 9-7 wavelet transform in 1-D. */ /* */ -void opj_v4dwt_decode(v4dwt_t* restrict dwt) +void opj_v4dwt_decode(opj_v4dwt_t* restrict dwt) { - int a, b; + OPJ_INT32 a, b; if(dwt->cas == 0) { if(!((dwt->dn > 0) || (dwt->sn > 1))){ return; @@ -828,8 +828,8 @@ void opj_v4dwt_decode(v4dwt_t* restrict dwt) /* */ OPJ_BOOL opj_dwt_decode_real(opj_tcd_tilecomp_t* restrict tilec, OPJ_UINT32 numres) { - v4dwt_t h; - v4dwt_t v; + opj_v4dwt_t h; + opj_v4dwt_t v; opj_tcd_resolution_t* res = tilec->resolutions; @@ -838,7 +838,7 @@ OPJ_BOOL opj_dwt_decode_real(opj_tcd_tilecomp_t* restrict tilec, OPJ_UINT32 numr OPJ_UINT32 w = tilec->x1 - tilec->x0; - h.wavelet = (v4*) opj_aligned_malloc((opj_dwt_max_resolution(res, numres)+5) * sizeof(v4)); + h.wavelet = (opj_v4_t*) opj_aligned_malloc((opj_dwt_max_resolution(res, numres)+5) * sizeof(opj_v4_t)); v.wavelet = h.wavelet; while( --numres) { diff --git a/src/lib/openjp2/event.c b/src/lib/openjp2/event.c index d23907dd..6c53515b 100644 --- a/src/lib/openjp2/event.c +++ b/src/lib/openjp2/event.c @@ -78,8 +78,8 @@ static void opj_default_callback (const char *msg, void *client_data) /* ----------------------------------------------------------------------- */ -OPJ_BOOL opj_event_msg(opj_event_mgr_t* p_event_mgr, int event_type, const char *fmt, ...) { -#define MSG_SIZE 512 /* 512 bytes should be more than enough for a short message */ +OPJ_BOOL opj_event_msg(opj_event_mgr_t* p_event_mgr, OPJ_INT32 event_type, const char *fmt, ...) { +#define OPJ_MSG_SIZE 512 /* 512 bytes should be more than enough for a short message */ opj_msg_callback msg_handler = 00; void * l_data = 00; @@ -110,12 +110,12 @@ OPJ_BOOL opj_event_msg(opj_event_mgr_t* p_event_mgr, int event_type, const char if ((fmt != 00) && (p_event_mgr != 00)) { va_list arg; size_t str_length/*, i, j*/; /* UniPG */ - char message[MSG_SIZE]; - memset(message, 0, MSG_SIZE); + char message[OPJ_MSG_SIZE]; + memset(message, 0, OPJ_MSG_SIZE); /* initialize the optional parameter list */ va_start(arg, fmt); /* check the length of the format string */ - str_length = (strlen(fmt) > MSG_SIZE) ? MSG_SIZE : strlen(fmt); + str_length = (strlen(fmt) > OPJ_MSG_SIZE) ? OPJ_MSG_SIZE : strlen(fmt); (void)str_length; /* parse the format string and put the result in 'message' */ vsprintf(message, fmt, arg); /* UniPG */ diff --git a/src/lib/openjp2/event.h b/src/lib/openjp2/event.h index bc1d575d..4d89576a 100644 --- a/src/lib/openjp2/event.h +++ b/src/lib/openjp2/event.h @@ -82,7 +82,7 @@ typedef struct opj_event_mgr * * @return Returns true if successful, returns false otherwise */ -OPJ_BOOL opj_event_msg(opj_event_mgr_t* event_mgr, int event_type, const char *fmt, ...); +OPJ_BOOL opj_event_msg(opj_event_mgr_t* event_mgr, OPJ_INT32 event_type, const char *fmt, ...); /* ----------------------------------------------------------------------- */ /** diff --git a/src/lib/openjp2/image.c b/src/lib/openjp2/image.c index d0bcebee..7e48de1a 100644 --- a/src/lib/openjp2/image.c +++ b/src/lib/openjp2/image.c @@ -58,7 +58,7 @@ opj_image_t* OPJ_CALLCONV opj_image_create(OPJ_UINT32 numcmpts, opj_image_cmptpa comp->prec = cmptparms[compno].prec; comp->bpp = cmptparms[compno].bpp; comp->sgnd = cmptparms[compno].sgnd; - comp->data = (int*) opj_calloc(comp->w * comp->h, sizeof(int)); + comp->data = (OPJ_INT32*) opj_calloc(comp->w * comp->h, sizeof(OPJ_INT32)); if(!comp->data) { fprintf(stderr,"Unable to allocate memory for image.\n"); opj_image_destroy(image); diff --git a/src/lib/openjp2/j2k.c b/src/lib/openjp2/j2k.c index ad8b5b8f..1b116680 100644 --- a/src/lib/openjp2/j2k.c +++ b/src/lib/openjp2/j2k.c @@ -4484,7 +4484,7 @@ OPJ_BOOL opj_j2k_update_rates( opj_j2k_t *p_j2k, /* Modification of the RATE >> */ if (*l_rates) { - *l_rates = (( (float) (l_size_pixel * (l_x1 - l_x0) * (l_y1 - l_y0))) + *l_rates = (( (OPJ_FLOAT32) (l_size_pixel * (l_x1 - l_x0) * (l_y1 - l_y0))) / ((*l_rates) * l_bits_empty) ) @@ -5997,9 +5997,9 @@ void opj_j2k_setup_encoder( opj_j2k_t *p_j2k, } } else { - int res_spec = parameters->res_spec; - int size_prcw = 0; - int size_prch = 0; + OPJ_INT32 res_spec = parameters->res_spec; + OPJ_INT32 size_prcw = 0; + OPJ_INT32 size_prch = 0; assert(res_spec>0); /* issue 189 */ size_prcw = parameters->prcw_init[res_spec - 1] >> (p - (res_spec - 1)); @@ -6046,7 +6046,7 @@ static OPJ_BOOL opj_j2k_add_mhmarker(opj_codestream_index_t *cstr_index, OPJ_UIN /* expand the list? */ if ((cstr_index->marknum + 1) > cstr_index->maxmarknum) { opj_marker_info_t *new_marker; - cstr_index->maxmarknum = 100 + (int) ((float) cstr_index->maxmarknum * 1.0F); + cstr_index->maxmarknum = 100 + (OPJ_INT32) ((OPJ_FLOAT32) cstr_index->maxmarknum * 1.0F); new_marker = (opj_marker_info_t *) opj_realloc(cstr_index->marker, cstr_index->maxmarknum *sizeof(opj_marker_info_t)); if (! new_marker) { opj_free(cstr_index->marker); @@ -6075,7 +6075,7 @@ static OPJ_BOOL opj_j2k_add_tlmarker(OPJ_UINT32 tileno, opj_codestream_index_t * /* expand the list? */ if ((cstr_index->tile_index[tileno].marknum + 1) > cstr_index->tile_index[tileno].maxmarknum) { opj_marker_info_t *new_marker; - cstr_index->tile_index[tileno].maxmarknum = 100 + (int) ((float) cstr_index->tile_index[tileno].maxmarknum * 1.0F); + cstr_index->tile_index[tileno].maxmarknum = 100 + (OPJ_INT32) ((OPJ_FLOAT32) cstr_index->tile_index[tileno].maxmarknum * 1.0F); new_marker = (opj_marker_info_t *) opj_realloc( cstr_index->tile_index[tileno].marker, cstr_index->tile_index[tileno].maxmarknum *sizeof(opj_marker_info_t)); @@ -9022,9 +9022,9 @@ OPJ_BOOL opj_j2k_set_decoded_resolution_factor(opj_j2k_t *p_j2k, return OPJ_FALSE; } -OPJ_BOOL opj_j2k_encode_v2( opj_j2k_t * p_j2k, - opj_stream_private_t *p_stream, - opj_event_mgr_t * p_manager ) +OPJ_BOOL opj_j2k_encode(opj_j2k_t * p_j2k, + opj_stream_private_t *p_stream, + opj_event_mgr_t * p_manager ) { OPJ_UINT32 i; OPJ_UINT32 l_nb_tiles; diff --git a/src/lib/openjp2/j2k.h b/src/lib/openjp2/j2k.h index dda4db5d..be341724 100644 --- a/src/lib/openjp2/j2k.h +++ b/src/lib/openjp2/j2k.h @@ -157,9 +157,9 @@ typedef enum T2_MODE { */ typedef struct opj_stepsize { /** exponent */ - int expn; + OPJ_INT32 expn; /** mantissa */ - int mant; + OPJ_INT32 mant; } opj_stepsize_t; /** @@ -803,7 +803,7 @@ OPJ_BOOL opj_j2k_write_tile ( opj_j2k_t * p_j2k, /** * Encodes an image into a JPEG-2000 codestream */ -OPJ_BOOL opj_j2k_encode_v2( opj_j2k_t * p_j2k, +OPJ_BOOL opj_j2k_encode( opj_j2k_t * p_j2k, opj_stream_private_t *cio, opj_event_mgr_t * p_manager ); diff --git a/src/lib/openjp2/jp2.c b/src/lib/openjp2/jp2.c index b4a33638..2d4acc29 100644 --- a/src/lib/openjp2/jp2.c +++ b/src/lib/openjp2/jp2.c @@ -36,7 +36,7 @@ /** @defgroup JP2 JP2 - JPEG-2000 file format reader/writer */ /*@{*/ -#define BOX_SIZE 1024 +#define OPJ_BOX_SIZE 1024 /** @name Local static functions */ /*@{*/ @@ -1497,7 +1497,7 @@ OPJ_BOOL opj_jp2_encode(opj_jp2_t *jp2, opj_stream_private_t *stream, opj_event_mgr_t * p_manager) { - return opj_j2k_encode_v2(jp2->j2k, stream, p_manager); + return opj_j2k_encode(jp2->j2k, stream, p_manager); } OPJ_BOOL opj_jp2_end_decompress(opj_jp2_t *jp2, @@ -1632,7 +1632,7 @@ OPJ_BOOL opj_jp2_read_header_procedure( opj_jp2_t *jp2, opj_jp2_box_t box; OPJ_UINT32 l_nb_bytes_read; const opj_jp2_header_handler_t * l_current_handler; - OPJ_UINT32 l_last_data_size = BOX_SIZE; + OPJ_UINT32 l_last_data_size = OPJ_BOX_SIZE; OPJ_UINT32 l_current_data_size; OPJ_BYTE * l_current_data = 00; diff --git a/src/lib/openjp2/openjpeg.c b/src/lib/openjp2/openjpeg.c index da034c5e..0ed7e67a 100644 --- a/src/lib/openjp2/openjpeg.c +++ b/src/lib/openjp2/openjpeg.c @@ -667,7 +667,7 @@ opj_codec_t* OPJ_CALLCONV opj_create_compress(OPJ_CODEC_FORMAT p_format) case OPJ_CODEC_J2K: l_codec->m_codec_data.m_compression.opj_encode = (OPJ_BOOL (*) (void *, struct opj_stream_private *, - struct opj_event_mgr * )) opj_j2k_encode_v2; + struct opj_event_mgr * )) opj_j2k_encode; l_codec->m_codec_data.m_compression.opj_end_compress = (OPJ_BOOL (*) ( void *, struct opj_stream_private *, @@ -907,7 +907,7 @@ OPJ_BOOL OPJ_CALLCONV opj_set_MCT(opj_cparameters_t *parameters, OPJ_UINT32 l_mct_total_size = l_matrix_size + l_dc_shift_size; /* add MCT capability */ - int rsiz = (int)parameters->cp_rsiz | (int)OPJ_MCT; + OPJ_INT32 rsiz = (OPJ_INT32)parameters->cp_rsiz | (OPJ_INT32)OPJ_MCT; parameters->cp_rsiz = (OPJ_RSIZ_CAPABILITIES)rsiz; parameters->irreversible = 1; diff --git a/src/lib/openjp2/t1.c b/src/lib/openjp2/t1.c index fe6ad367..6e2b557f 100644 --- a/src/lib/openjp2/t1.c +++ b/src/lib/openjp2/t1.c @@ -1323,11 +1323,11 @@ OPJ_BOOL opj_t1_decode_cblks( opj_t1_t* t1, } } } else { /* if (tccp->qmfbid == 0) */ - float* restrict tiledp = (float*) &tilec->data[(y * tile_w) + x]; + OPJ_FLOAT32* restrict tiledp = (OPJ_FLOAT32*) &tilec->data[(y * tile_w) + x]; for (j = 0; j < cblk_h; ++j) { - float* restrict tiledp2 = tiledp; + OPJ_FLOAT32* restrict tiledp2 = tiledp; for (i = 0; i < cblk_w; ++i) { - float tmp = *datap * band->stepsize; + OPJ_FLOAT32 tmp = *datap * band->stepsize; *tiledp2 = tmp; datap++; tiledp2++; diff --git a/src/lib/openjp2/tcd.c b/src/lib/openjp2/tcd.c index 9bc9d611..18ebd077 100644 --- a/src/lib/openjp2/tcd.c +++ b/src/lib/openjp2/tcd.c @@ -609,7 +609,7 @@ void opj_tcd_destroy(opj_tcd_t *tcd) { } /* ----------------------------------------------------------------------- */ -#define MACRO_TCD_ALLOCATE(FUNCTION,TYPE,FRACTION,ELEMENT,FUNCTION_ELEMENT) \ +#define OPJ_MACRO_TCD_ALLOCATE(FUNCTION,TYPE,FRACTION,ELEMENT,FUNCTION_ELEMENT) \ OPJ_BOOL FUNCTION ( opj_tcd_t *p_tcd, \ OPJ_UINT32 p_tile_no \ ) \ @@ -989,10 +989,10 @@ OPJ_BOOL FUNCTION ( opj_tcd_t *p_tcd, \ } \ -MACRO_TCD_ALLOCATE(opj_tcd_init_encode_tile, opj_tcd_cblk_enc_t, 1.f, enc, opj_tcd_code_block_enc_allocate) -MACRO_TCD_ALLOCATE(opj_tcd_init_decode_tile, opj_tcd_cblk_dec_t, 0.5f, dec, opj_tcd_code_block_dec_allocate) +OPJ_MACRO_TCD_ALLOCATE(opj_tcd_init_encode_tile, opj_tcd_cblk_enc_t, 1.f, enc, opj_tcd_code_block_enc_allocate) +OPJ_MACRO_TCD_ALLOCATE(opj_tcd_init_decode_tile, opj_tcd_cblk_dec_t, 0.5f, dec, opj_tcd_code_block_dec_allocate) -#undef MACRO_TCD_ALLOCATE +#undef OPJ_MACRO_TCD_ALLOCATE /** * Allocates memory for an encoding code block. @@ -1614,10 +1614,10 @@ OPJ_BOOL opj_tcd_mct_decode ( opj_tcd_t *p_tcd ) l_samples); } else { - opj_mct_decode_real( (float*)l_tile->comps[0].data, - (float*)l_tile->comps[1].data, - (float*)l_tile->comps[2].data, - l_samples); + opj_mct_decode_real((OPJ_FLOAT32*)l_tile->comps[0].data, + (OPJ_FLOAT32*)l_tile->comps[1].data, + (OPJ_FLOAT32*)l_tile->comps[2].data, + l_samples); } } }