Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various Minor fixes #537

Merged
merged 2 commits into from
Jul 18, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/bin/jp2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@
# First thing define the common source:
set(common_SRCS
convert.c
convert.h
convertbmp.c
index.c
index.h
${OPENJPEG_SOURCE_DIR}/src/bin/common/color.c
${OPENJPEG_SOURCE_DIR}/src/bin/common/color.h
${OPENJPEG_SOURCE_DIR}/src/bin/common/opj_getopt.c
${OPENJPEG_SOURCE_DIR}/src/bin/common/opj_getopt.h
)

if(OPJ_HAVE_LIBTIFF)
Expand Down
26 changes: 26 additions & 0 deletions src/lib/openjp2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,60 @@ include_directories(
# Defines the source code for the library
set(OPENJPEG_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/bio.c
${CMAKE_CURRENT_SOURCE_DIR}/bio.h
${CMAKE_CURRENT_SOURCE_DIR}/cio.c
${CMAKE_CURRENT_SOURCE_DIR}/cio.h
${CMAKE_CURRENT_SOURCE_DIR}/dwt.c
${CMAKE_CURRENT_SOURCE_DIR}/dwt.h
${CMAKE_CURRENT_SOURCE_DIR}/event.c
${CMAKE_CURRENT_SOURCE_DIR}/event.h
${CMAKE_CURRENT_SOURCE_DIR}/image.c
${CMAKE_CURRENT_SOURCE_DIR}/image.h
${CMAKE_CURRENT_SOURCE_DIR}/invert.c
${CMAKE_CURRENT_SOURCE_DIR}/invert.h
${CMAKE_CURRENT_SOURCE_DIR}/j2k.c
${CMAKE_CURRENT_SOURCE_DIR}/j2k.h
${CMAKE_CURRENT_SOURCE_DIR}/jp2.c
${CMAKE_CURRENT_SOURCE_DIR}/jp2.h
${CMAKE_CURRENT_SOURCE_DIR}/mct.c
${CMAKE_CURRENT_SOURCE_DIR}/mct.h
${CMAKE_CURRENT_SOURCE_DIR}/mqc.c
${CMAKE_CURRENT_SOURCE_DIR}/mqc.h
${CMAKE_CURRENT_SOURCE_DIR}/openjpeg.c
${CMAKE_CURRENT_SOURCE_DIR}/openjpeg.h
${CMAKE_CURRENT_SOURCE_DIR}/opj_clock.c
${CMAKE_CURRENT_SOURCE_DIR}/opj_clock.h
${CMAKE_CURRENT_SOURCE_DIR}/pi.c
${CMAKE_CURRENT_SOURCE_DIR}/pi.h
${CMAKE_CURRENT_SOURCE_DIR}/raw.c
${CMAKE_CURRENT_SOURCE_DIR}/raw.h
${CMAKE_CURRENT_SOURCE_DIR}/t1.c
${CMAKE_CURRENT_SOURCE_DIR}/t1.h
${CMAKE_CURRENT_SOURCE_DIR}/t2.c
${CMAKE_CURRENT_SOURCE_DIR}/t2.h
${CMAKE_CURRENT_SOURCE_DIR}/tcd.c
${CMAKE_CURRENT_SOURCE_DIR}/tcd.h
${CMAKE_CURRENT_SOURCE_DIR}/tgt.c
${CMAKE_CURRENT_SOURCE_DIR}/tgt.h
${CMAKE_CURRENT_SOURCE_DIR}/function_list.c
${CMAKE_CURRENT_SOURCE_DIR}/function_list.h
${CMAKE_CURRENT_SOURCE_DIR}/opj_codec.h
${CMAKE_CURRENT_SOURCE_DIR}/opj_includes.h
${CMAKE_CURRENT_SOURCE_DIR}/opj_intmath.h
${CMAKE_CURRENT_SOURCE_DIR}/opj_malloc.h
${CMAKE_CURRENT_SOURCE_DIR}/opj_stdint.h
)
if(BUILD_JPIP)
add_definitions(-DUSE_JPIP)
set(OPENJPEG_SRCS
${OPENJPEG_SRCS}
${CMAKE_CURRENT_SOURCE_DIR}/cidx_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/cidx_manager.h
${CMAKE_CURRENT_SOURCE_DIR}/phix_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/ppix_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/thix_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/tpix_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/indexbox_manager.h
)
endif()

Expand Down
8 changes: 4 additions & 4 deletions src/lib/openjp2/bio.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ static OPJ_BOOL opj_bio_bytein(opj_bio_t *bio);
==========================================================
*/

OPJ_BOOL opj_bio_byteout(opj_bio_t *bio) {
static OPJ_BOOL opj_bio_byteout(opj_bio_t *bio) {
bio->buf = (bio->buf << 8) & 0xffff;
bio->ct = bio->buf == 0xff00 ? 7 : 8;
if ((OPJ_SIZE_T)bio->bp >= (OPJ_SIZE_T)bio->end) {
Expand All @@ -88,7 +88,7 @@ OPJ_BOOL opj_bio_byteout(opj_bio_t *bio) {
return OPJ_TRUE;
}

OPJ_BOOL opj_bio_bytein(opj_bio_t *bio) {
static OPJ_BOOL opj_bio_bytein(opj_bio_t *bio) {
bio->buf = (bio->buf << 8) & 0xffff;
bio->ct = bio->buf == 0xff00 ? 7 : 8;
if ((OPJ_SIZE_T)bio->bp >= (OPJ_SIZE_T)bio->end) {
Expand All @@ -98,15 +98,15 @@ OPJ_BOOL opj_bio_bytein(opj_bio_t *bio) {
return OPJ_TRUE;
}

void opj_bio_putbit(opj_bio_t *bio, OPJ_UINT32 b) {
static void opj_bio_putbit(opj_bio_t *bio, OPJ_UINT32 b) {
if (bio->ct == 0) {
opj_bio_byteout(bio); /* MSD: why not check the return value of this function ? */
}
bio->ct--;
bio->buf |= b << bio->ct;
}

OPJ_UINT32 opj_bio_getbit(opj_bio_t *bio) {
static OPJ_UINT32 opj_bio_getbit(opj_bio_t *bio) {
if (bio->ct == 0) {
opj_bio_bytein(bio); /* MSD: why not check the return value of this function ? */
}
Expand Down
34 changes: 17 additions & 17 deletions src/lib/openjp2/dwt.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ static const OPJ_FLOAT64 opj_dwt_norms_real[4][10] = {
/* <summary> */
/* Forward lazy transform (horizontal). */
/* </summary> */
void opj_dwt_deinterleave_h(OPJ_INT32 *a, OPJ_INT32 *b, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 cas) {
static void opj_dwt_deinterleave_h(OPJ_INT32 *a, OPJ_INT32 *b, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 cas) {
OPJ_INT32 i;
OPJ_INT32 * l_dest = b;
OPJ_INT32 * l_src = a+cas;
Expand All @@ -215,7 +215,7 @@ void opj_dwt_deinterleave_h(OPJ_INT32 *a, OPJ_INT32 *b, OPJ_INT32 dn, OPJ_INT32
/* <summary> */
/* Forward lazy transform (vertical). */
/* </summary> */
void opj_dwt_deinterleave_v(OPJ_INT32 *a, OPJ_INT32 *b, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 x, OPJ_INT32 cas) {
static void opj_dwt_deinterleave_v(OPJ_INT32 *a, OPJ_INT32 *b, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 x, OPJ_INT32 cas) {
OPJ_INT32 i = sn;
OPJ_INT32 * l_dest = b;
OPJ_INT32 * l_src = a+cas;
Expand All @@ -240,7 +240,7 @@ void opj_dwt_deinterleave_v(OPJ_INT32 *a, OPJ_INT32 *b, OPJ_INT32 dn, OPJ_INT32
/* <summary> */
/* Inverse lazy transform (horizontal). */
/* </summary> */
void opj_dwt_interleave_h(opj_dwt_t* h, OPJ_INT32 *a) {
static 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;
Expand All @@ -260,7 +260,7 @@ void opj_dwt_interleave_h(opj_dwt_t* h, OPJ_INT32 *a) {
/* <summary> */
/* Inverse lazy transform (vertical). */
/* </summary> */
void opj_dwt_interleave_v(opj_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) {
OPJ_INT32 *ai = a;
OPJ_INT32 *bi = v->mem + v->cas;
OPJ_INT32 i = v->sn;
Expand All @@ -283,7 +283,7 @@ void opj_dwt_interleave_v(opj_dwt_t* v, OPJ_INT32 *a, OPJ_INT32 x) {
/* <summary> */
/* Forward 5-3 wavelet transform in 1-D. */
/* </summary> */
void opj_dwt_encode_1(OPJ_INT32 *a, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 cas) {
static void opj_dwt_encode_1(OPJ_INT32 *a, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 cas) {
OPJ_INT32 i;

if (!cas) {
Expand All @@ -304,7 +304,7 @@ void opj_dwt_encode_1(OPJ_INT32 *a, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 cas) {
/* <summary> */
/* Inverse 5-3 wavelet transform in 1-D. */
/* </summary> */
void opj_dwt_decode_1_(OPJ_INT32 *a, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 cas) {
static void opj_dwt_decode_1_(OPJ_INT32 *a, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 cas) {
OPJ_INT32 i;

if (!cas) {
Expand All @@ -325,14 +325,14 @@ void opj_dwt_decode_1_(OPJ_INT32 *a, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 cas)
/* <summary> */
/* Inverse 5-3 wavelet transform in 1-D. */
/* </summary> */
void opj_dwt_decode_1(opj_dwt_t *v) {
static void opj_dwt_decode_1(opj_dwt_t *v) {
opj_dwt_decode_1_(v->mem, v->dn, v->sn, v->cas);
}

/* <summary> */
/* Forward 9-7 wavelet transform in 1-D. */
/* </summary> */
void opj_dwt_encode_1_real(OPJ_INT32 *a, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 cas) {
static void opj_dwt_encode_1_real(OPJ_INT32 *a, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 cas) {
OPJ_INT32 i;
if (!cas) {
if ((dn > 0) || (sn > 1)) { /* NEW : CASE ONE ELEMENT */
Expand Down Expand Up @@ -367,7 +367,7 @@ void opj_dwt_encode_1_real(OPJ_INT32 *a, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 c
}
}

void opj_dwt_encode_stepsize(OPJ_INT32 stepsize, OPJ_INT32 numbps, opj_stepsize_t *bandno_stepsize) {
static void opj_dwt_encode_stepsize(OPJ_INT32 stepsize, OPJ_INT32 numbps, opj_stepsize_t *bandno_stepsize) {
OPJ_INT32 p, n;
p = opj_int_floorlog2(stepsize) - 13;
n = 11 - opj_int_floorlog2(stepsize);
Expand All @@ -385,7 +385,7 @@ void opj_dwt_encode_stepsize(OPJ_INT32 stepsize, OPJ_INT32 numbps, opj_stepsize_
/* <summary> */
/* Forward 5-3 wavelet transform in 2-D. */
/* </summary> */
INLINE OPJ_BOOL opj_dwt_encode_procedure(opj_tcd_tilecomp_t * tilec,void (*p_function)(OPJ_INT32 *, OPJ_INT32,OPJ_INT32,OPJ_INT32) )
static INLINE OPJ_BOOL opj_dwt_encode_procedure(opj_tcd_tilecomp_t * tilec,void (*p_function)(OPJ_INT32 *, OPJ_INT32,OPJ_INT32,OPJ_INT32) )
{
OPJ_INT32 i, j, k;
OPJ_INT32 *a = 00;
Expand Down Expand Up @@ -541,7 +541,7 @@ void opj_dwt_calc_explicit_stepsizes(opj_tccp_t * tccp, OPJ_UINT32 prec) {
/* <summary> */
/* Determine maximum computed resolution level for inverse wavelet transform */
/* </summary> */
OPJ_UINT32 opj_dwt_max_resolution(opj_tcd_resolution_t* restrict r, OPJ_UINT32 i) {
static OPJ_UINT32 opj_dwt_max_resolution(opj_tcd_resolution_t* restrict r, OPJ_UINT32 i) {
OPJ_UINT32 mr = 0;
OPJ_UINT32 w;
while( --i ) {
Expand All @@ -557,7 +557,7 @@ OPJ_UINT32 opj_dwt_max_resolution(opj_tcd_resolution_t* restrict r, OPJ_UINT32 i
/* <summary> */
/* Inverse wavelet transform in 2-D. */
/* </summary> */
OPJ_BOOL opj_dwt_decode_tile(opj_tcd_tilecomp_t* tilec, OPJ_UINT32 numres, DWT1DFN dwt_1D) {
static OPJ_BOOL opj_dwt_decode_tile(opj_tcd_tilecomp_t* tilec, OPJ_UINT32 numres, DWT1DFN dwt_1D) {
opj_dwt_t h;
opj_dwt_t v;

Expand Down Expand Up @@ -613,7 +613,7 @@ OPJ_BOOL opj_dwt_decode_tile(opj_tcd_tilecomp_t* tilec, OPJ_UINT32 numres, DWT1D
return OPJ_TRUE;
}

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_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;
Expand Down Expand Up @@ -656,7 +656,7 @@ void opj_v4dwt_interleave_h(opj_v4dwt_t* restrict w, OPJ_FLOAT32* restrict a, OP
}
}

void opj_v4dwt_interleave_v(opj_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){
opj_v4_t* restrict bi = v->wavelet + v->cas;
OPJ_INT32 i;

Expand All @@ -674,7 +674,7 @@ void opj_v4dwt_interleave_v(opj_v4dwt_t* restrict v , OPJ_FLOAT32* restrict a ,

#ifdef __SSE__

void opj_v4dwt_decode_step1_sse(opj_v4_t* w, OPJ_INT32 count, const __m128 c){
static 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 */
Expand Down Expand Up @@ -723,7 +723,7 @@ void opj_v4dwt_decode_step2_sse(opj_v4_t* l, opj_v4_t* w, OPJ_INT32 k, OPJ_INT32

#else

void opj_v4dwt_decode_step1(opj_v4_t* 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)
{
OPJ_FLOAT32* restrict fw = (OPJ_FLOAT32*) w;
OPJ_INT32 i;
Expand All @@ -739,7 +739,7 @@ void opj_v4dwt_decode_step1(opj_v4_t* w, OPJ_INT32 count, const 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)
static 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;
Expand Down
6 changes: 3 additions & 3 deletions src/lib/openjp2/invert.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ OPJ_BOOL opj_matrix_inversion_f(OPJ_FLOAT32 * pSrcMatrix,
Local functions
==========================================================
*/
OPJ_BOOL opj_lupDecompose(OPJ_FLOAT32 * matrix,OPJ_UINT32 * permutations,
static OPJ_BOOL opj_lupDecompose(OPJ_FLOAT32 * matrix,OPJ_UINT32 * permutations,
OPJ_FLOAT32 * p_swap_area,
OPJ_UINT32 nb_compo)
{
Expand Down Expand Up @@ -204,7 +204,7 @@ OPJ_BOOL opj_lupDecompose(OPJ_FLOAT32 * matrix,OPJ_UINT32 * permutations,
return OPJ_TRUE;
}

void opj_lupSolve (OPJ_FLOAT32 * pResult,
static void opj_lupSolve (OPJ_FLOAT32 * pResult,
OPJ_FLOAT32 * pMatrix,
OPJ_FLOAT32 * pVector,
OPJ_UINT32* pPermutations,
Expand Down Expand Up @@ -266,7 +266,7 @@ void opj_lupSolve (OPJ_FLOAT32 * pResult,
}


void opj_lupInvert (OPJ_FLOAT32 * pSrcMatrix,
static void opj_lupInvert (OPJ_FLOAT32 * pSrcMatrix,
OPJ_FLOAT32 * pDestMatrix,
OPJ_UINT32 nb_compo,
OPJ_UINT32 * pPermutations,
Expand Down
10 changes: 5 additions & 5 deletions src/lib/openjp2/mqc.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ static opj_mqc_state_t mqc_states[47 * 2] = {
==========================================================
*/

void opj_mqc_byteout(opj_mqc_t *mqc) {
static void opj_mqc_byteout(opj_mqc_t *mqc) {
if (*mqc->bp == 0xff) {
mqc->bp++;
*mqc->bp = (OPJ_BYTE)(mqc->c >> 20);
Expand Down Expand Up @@ -232,7 +232,7 @@ void opj_mqc_byteout(opj_mqc_t *mqc) {
}
}

void opj_mqc_renorme(opj_mqc_t *mqc) {
static void opj_mqc_renorme(opj_mqc_t *mqc) {
do {
mqc->a <<= 1;
mqc->c <<= 1;
Expand All @@ -243,7 +243,7 @@ void opj_mqc_renorme(opj_mqc_t *mqc) {
} while ((mqc->a & 0x8000) == 0);
}

void opj_mqc_codemps(opj_mqc_t *mqc) {
static void opj_mqc_codemps(opj_mqc_t *mqc) {
mqc->a -= (*mqc->curctx)->qeval;
if ((mqc->a & 0x8000) == 0) {
if (mqc->a < (*mqc->curctx)->qeval) {
Expand All @@ -258,7 +258,7 @@ void opj_mqc_codemps(opj_mqc_t *mqc) {
}
}

void opj_mqc_codelps(opj_mqc_t *mqc) {
static void opj_mqc_codelps(opj_mqc_t *mqc) {
mqc->a -= (*mqc->curctx)->qeval;
if (mqc->a < (*mqc->curctx)->qeval) {
mqc->c += (*mqc->curctx)->qeval;
Expand All @@ -269,7 +269,7 @@ void opj_mqc_codelps(opj_mqc_t *mqc) {
opj_mqc_renorme(mqc);
}

void opj_mqc_setbits(opj_mqc_t *mqc) {
static void opj_mqc_setbits(opj_mqc_t *mqc) {
OPJ_UINT32 tempc = mqc->c + mqc->a;
mqc->c |= 0xffff;
if (mqc->c >= tempc) {
Expand Down
Loading