${TIFF_INCLUDE_DIRNAME}
)
-IF(WIN32)
- IF(BUILD_SHARED_LIBS)
- ADD_DEFINITIONS(-DOPJ_EXPORTS)
- ELSE(BUILD_SHARED_LIBS)
- ADD_DEFINITIONS(-DOPJ_STATIC)
- ENDIF(BUILD_SHARED_LIBS)
-ENDIF(WIN32)
+if(WIN32)
+ if(BUILD_SHARED_LIBS)
+ add_definitions(-DOPJ_EXPORTS)
+ else()
+ add_definitions(-DOPJ_STATIC)
+ endif()
+endif()
# Loop over all executables:
FOREACH(exe opj_jp3d_compress opj_jp3d_decompress)
EXPORT OpenJP3DTargets
DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications
)
-ENDFOREACH(exe)
+endforeach()
)
foreach(exe ${EXES})
if(${exe} STREQUAL "opj_jpip_compress")
+ include_directories(
+ ${Z_INCLUDE_DIRNAME}
+ ${PNG_INCLUDE_DIRNAME}
+ ${TIFF_INCLUDE_DIRNAME}
+ )
add_executable(${exe} ${exe}.c
${OPENJPEG_SOURCE_DIR}/src/bin/common/opj_getopt.c
${OPENJPEG_SOURCE_DIR}/src/bin/jp2/convert.c
#include <stdio.h>
#include <stdlib.h>
+#include "opj_config.h"
#include "openjpip.h"
#ifdef _WIN32
set(common_SRCS ${OPENJPEG_SOURCE_DIR}/src/bin/common/opj_getopt.c)
if(WIN32)
- add_definitions(-DOPJ_STATIC)
+ if(BUILD_SHARED_LIBS)
+ add_definitions(-DOPJ_EXPORTS)
+ else()
+ add_definitions(-DOPJ_STATIC)
+ endif()
endif()
# Headers file are located here:
#include <stdlib.h>
#include <string.h>
+#include "opj_config.h"
#include "openjpeg.h"
#include "j2k_lib.h"
#include "cio.h"
${CMAKE_CURRENT_SOURCE_DIR}/t2.c
${CMAKE_CURRENT_SOURCE_DIR}/tcd.c
${CMAKE_CURRENT_SOURCE_DIR}/tgt.c
- ${CMAKE_CURRENT_SOURCE_DIR}/function_list.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/function_list.c
)
# Build the library
* v : value to write
* n : number of bytes to write
*/
-unsigned int cio_write(opj_cio_t *cio, unsigned long long int v, int n) {
+unsigned int OPJ_CALLCONV cio_write(opj_cio_t *cio, unsigned long long int v, int n) {
int i;
for (i = n - 1; i >= 0; i--) {
if( !cio_byteout(cio, (unsigned char) ((v >> (i << 3)) & 0xff)) )
*
* return : value of the n bytes read
*/
-unsigned int cio_read(opj_cio_t *cio, int n) {
+unsigned int OPJ_CALLCONV cio_read(opj_cio_t *cio, int n) {
int i;
unsigned int v = 0;
for (i = n - 1; i >= 0; i--) {
*
* n : number of bytes to skip
*/
-void cio_skip(opj_cio_t *cio, int n) {
+void OPJ_CALLCONV cio_skip(opj_cio_t *cio, int n) {
cio->bp += n;
}
/* ----------------------------------------------------------------------- */
-void opj_write_bytes_BE (OPJ_BYTE * p_buffer, OPJ_UINT32 p_value, OPJ_UINT32 p_nb_bytes)
+void OPJ_CALLCONV opj_write_bytes_BE (OPJ_BYTE * p_buffer, OPJ_UINT32 p_value, OPJ_UINT32 p_nb_bytes)
{
const OPJ_BYTE * l_data_ptr = ((const OPJ_BYTE *) &p_value) + p_nb_bytes;
memcpy(p_buffer,l_data_ptr,p_nb_bytes);
}
-void opj_write_bytes_LE (OPJ_BYTE * p_buffer, OPJ_UINT32 p_value, OPJ_UINT32 p_nb_bytes)
+void OPJ_CALLCONV opj_write_bytes_LE (OPJ_BYTE * p_buffer, OPJ_UINT32 p_value, OPJ_UINT32 p_nb_bytes)
{
const OPJ_BYTE * l_data_ptr = ((const OPJ_BYTE *) &p_value) + p_nb_bytes - 1;
OPJ_UINT32 i;
}
}
-void opj_read_bytes_BE(const OPJ_BYTE * p_buffer, OPJ_UINT32 * p_value, OPJ_UINT32 p_nb_bytes)
+void OPJ_CALLCONV opj_read_bytes_BE(const OPJ_BYTE * p_buffer, OPJ_UINT32 * p_value, OPJ_UINT32 p_nb_bytes)
{
OPJ_BYTE * l_data_ptr = ((OPJ_BYTE *) p_value);
memcpy(l_data_ptr+4-p_nb_bytes,p_buffer,p_nb_bytes);
}
-void opj_read_bytes_LE(const OPJ_BYTE * p_buffer, OPJ_UINT32 * p_value, OPJ_UINT32 p_nb_bytes)
+void OPJ_CALLCONV opj_read_bytes_LE(const OPJ_BYTE * p_buffer, OPJ_UINT32 * p_value, OPJ_UINT32 p_nb_bytes)
{
OPJ_BYTE * l_data_ptr = ((OPJ_BYTE *) p_value) + p_nb_bytes-1;
OPJ_UINT32 i;
memcpy(p_buffer,l_data_ptr,sizeof(OPJ_FLOAT64));
}
-void opj_write_double_LE(OPJ_BYTE * p_buffer, OPJ_FLOAT64 p_value)
+void OPJ_CALLCONV opj_write_double_LE(OPJ_BYTE * p_buffer, OPJ_FLOAT64 p_value)
{
const OPJ_BYTE * l_data_ptr = ((const OPJ_BYTE *) &p_value) + sizeof(OPJ_FLOAT64) - 1;
OPJ_UINT32 i;
l_stream->m_user_data_length = data_length;
}
-OPJ_SIZE_T opj_stream_read_data (opj_stream_private_t * p_stream,OPJ_BYTE * p_buffer, OPJ_SIZE_T p_size, opj_event_mgr_t * p_event_mgr)
+OPJ_SIZE_T OPJ_CALLCONV opj_stream_read_data (opj_stream_private_t * p_stream,OPJ_BYTE * p_buffer, OPJ_SIZE_T p_size, opj_event_mgr_t * p_event_mgr)
{
OPJ_SIZE_T l_read_nb_bytes = 0;
if (p_stream->m_bytes_in_buffer >= p_size) {
}
}
-OPJ_SIZE_T opj_stream_write_data (opj_stream_private_t * p_stream,
+OPJ_SIZE_T OPJ_CALLCONV opj_stream_write_data (opj_stream_private_t * p_stream,
const OPJ_BYTE * p_buffer,
OPJ_SIZE_T p_size,
opj_event_mgr_t * p_event_mgr)
return l_skip_nb_bytes;
}
-OPJ_OFF_T opj_stream_tell (const opj_stream_private_t * p_stream)
+OPJ_OFF_T OPJ_CALLCONV opj_stream_tell (const opj_stream_private_t * p_stream)
{
return p_stream->m_byte_offset;
}
0;
}
-OPJ_OFF_T opj_stream_skip (opj_stream_private_t * p_stream, OPJ_OFF_T p_size, opj_event_mgr_t * p_event_mgr)
+OPJ_OFF_T OPJ_CALLCONV opj_stream_skip (opj_stream_private_t * p_stream, OPJ_OFF_T p_size, opj_event_mgr_t * p_event_mgr)
{
assert(p_size >= 0);
return p_stream->m_opj_skip(p_stream,p_size,p_event_mgr);
return OPJ_TRUE;
}
-opj_bool opj_stream_seek (opj_stream_private_t * p_stream, OPJ_OFF_T p_size, struct opj_event_mgr * p_event_mgr)
+opj_bool OPJ_CALLCONV opj_stream_seek (opj_stream_private_t * p_stream, OPJ_OFF_T p_size, struct opj_event_mgr * p_event_mgr)
{
assert(p_size >= 0);
return p_stream->m_opj_seek(p_stream,p_size,p_event_mgr);
}
-opj_bool opj_stream_has_seek (const opj_stream_private_t * p_stream)
+opj_bool OPJ_CALLCONV opj_stream_has_seek (const opj_stream_private_t * p_stream)
{
return p_stream->m_seek_fn != opj_stream_default_seek;
}
@param n Number of bytes to write
@return Returns the number of bytes written or 0 if an error occured
*/
-unsigned int cio_write(opj_cio_t *cio, unsigned long long int v, int n);
+OPJ_API unsigned int OPJ_CALLCONV cio_write(opj_cio_t *cio, unsigned long long int v, int n);
/**
Read some bytes
@param cio CIO handle
@param n Number of bytes to read
@return Returns the value of the n bytes read
*/
-unsigned int cio_read(opj_cio_t *cio, int n);
+OPJ_API unsigned int OPJ_CALLCONV cio_read(opj_cio_t *cio, int n);
/**
Skip some bytes
@param cio CIO handle
@param n Number of bytes to skip
*/
-void cio_skip(opj_cio_t *cio, int n);
+OPJ_API void OPJ_CALLCONV cio_skip(opj_cio_t *cio, int n);
/* ----------------------------------------------------------------------- */
/*@}*/
* @param p_value the value to write
* @param p_nb_bytes the number of bytes to write
*/
-void opj_write_bytes_BE (OPJ_BYTE * p_buffer, OPJ_UINT32 p_value, OPJ_UINT32 p_nb_bytes);
+OPJ_API void OPJ_CALLCONV opj_write_bytes_BE (OPJ_BYTE * p_buffer, OPJ_UINT32 p_value, OPJ_UINT32 p_nb_bytes);
/**
* Reads some bytes from the given data buffer, this function is used in Big Endian cpus.
* @param p_nb_bytes the nb bytes to read.
* @return the number of bytes read or -1 if an error occured.
*/
-void opj_read_bytes_BE(const OPJ_BYTE * p_buffer, OPJ_UINT32 * p_value, OPJ_UINT32 p_nb_bytes);
+OPJ_API void OPJ_CALLCONV opj_read_bytes_BE(const OPJ_BYTE * p_buffer, OPJ_UINT32 * p_value, OPJ_UINT32 p_nb_bytes);
/**
* Write some bytes to the given data buffer, this function is used in Little Endian cpus.
* @param p_nb_bytes the number of bytes to write
* @return the number of bytes written or -1 if an error occured
*/
-void opj_write_bytes_LE (OPJ_BYTE * p_buffer, OPJ_UINT32 p_value, OPJ_UINT32 p_nb_bytes);
+OPJ_API void OPJ_CALLCONV opj_write_bytes_LE (OPJ_BYTE * p_buffer, OPJ_UINT32 p_value, OPJ_UINT32 p_nb_bytes);
/**
* Reads some bytes from the given data buffer, this function is used in Little Endian cpus.
* @param p_nb_bytes the nb bytes to read.
* @return the number of bytes read or -1 if an error occured.
*/
-void opj_read_bytes_LE(const OPJ_BYTE * p_buffer, OPJ_UINT32 * p_value, OPJ_UINT32 p_nb_bytes);
+OPJ_API void OPJ_CALLCONV opj_read_bytes_LE(const OPJ_BYTE * p_buffer, OPJ_UINT32 * p_value, OPJ_UINT32 p_nb_bytes);
/**
* @param p_buffer pointer the data buffer to write data to.
* @param p_value the value to write
*/
-void opj_write_double_LE(OPJ_BYTE * p_buffer, OPJ_FLOAT64 p_value);
+OPJ_API void OPJ_CALLCONV opj_write_double_LE(OPJ_BYTE * p_buffer, OPJ_FLOAT64 p_value);
/***
* Write some bytes to the given data buffer, this function is used in Big Endian cpus.
* @param p_event_mgr the user event manager to be notified of special events.
* @return the number of bytes read, or -1 if an error occured or if the stream is at the end.
*/
-OPJ_SIZE_T opj_stream_read_data (opj_stream_private_t * p_stream,OPJ_BYTE * p_buffer, OPJ_SIZE_T p_size, struct opj_event_mgr * p_event_mgr);
+OPJ_API OPJ_SIZE_T OPJ_CALLCONV opj_stream_read_data (opj_stream_private_t * p_stream,OPJ_BYTE * p_buffer, OPJ_SIZE_T p_size, struct opj_event_mgr * p_event_mgr);
/**
* Writes some bytes to the stream.
* @param p_event_mgr the user event manager to be notified of special events.
* @return the number of bytes writtent, or -1 if an error occured.
*/
-OPJ_SIZE_T opj_stream_write_data (opj_stream_private_t * p_stream,const OPJ_BYTE * p_buffer, OPJ_SIZE_T p_size, struct opj_event_mgr * p_event_mgr);
+OPJ_API OPJ_SIZE_T OPJ_CALLCONV opj_stream_write_data (opj_stream_private_t * p_stream,const OPJ_BYTE * p_buffer, OPJ_SIZE_T p_size, struct opj_event_mgr * p_event_mgr);
/**
* Writes the content of the stream buffer to the stream.
* @param p_event_mgr the user event manager to be notified of special events.
* @return the number of bytes skipped, or -1 if an error occured.
*/
-OPJ_OFF_T opj_stream_skip (opj_stream_private_t * p_stream,OPJ_OFF_T p_size, struct opj_event_mgr * p_event_mgr);
+OPJ_API OPJ_OFF_T OPJ_CALLCONV opj_stream_skip (opj_stream_private_t * p_stream,OPJ_OFF_T p_size, struct opj_event_mgr * p_event_mgr);
/**
* Tells the byte offset on the stream (similar to ftell).
*
* @return the current position o fthe stream.
*/
-OPJ_OFF_T opj_stream_tell (const opj_stream_private_t * p_stream);
+OPJ_API OPJ_OFF_T OPJ_CALLCONV opj_stream_tell (const opj_stream_private_t * p_stream);
/**
* @param p_event_mgr the user event manager to be notified of special events.
* @return true if the stream is seekable.
*/
-opj_bool opj_stream_seek (opj_stream_private_t * p_stream, OPJ_OFF_T p_size, struct opj_event_mgr * p_event_mgr);
+OPJ_API opj_bool OPJ_CALLCONV opj_stream_seek (opj_stream_private_t * p_stream, OPJ_OFF_T p_size, struct opj_event_mgr * p_event_mgr);
/**
* Tells if the given stream is seekable.
*/
-opj_bool opj_stream_has_seek (const opj_stream_private_t * p_stream);
+OPJ_API opj_bool OPJ_CALLCONV opj_stream_has_seek (const opj_stream_private_t * p_stream);
OPJ_SIZE_T opj_stream_default_read (void * p_buffer, OPJ_SIZE_T p_nb_bytes, void * p_user_data);
OPJ_SIZE_T opj_stream_default_write (void * p_buffer, OPJ_SIZE_T p_nb_bytes, void * p_user_data);
}
/* ----------------------------------------------------------------------- */
-opj_bool opj_event_msg_v2(opj_event_mgr_t* p_event_mgr, int event_type, const char *fmt, ...) {
+opj_bool OPJ_CALLCONV opj_event_msg_v2(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_msg_callback msg_handler = 00;
void * l_data = 00;
return OPJ_TRUE;
}
-void opj_set_default_event_handler(opj_event_mgr_t * p_manager)
+void OPJ_CALLCONV opj_set_default_event_handler(opj_event_mgr_t * p_manager)
{
p_manager->m_error_data = 00;
p_manager->m_warning_data = 00;
*
* @return Returns true if successful, returns false otherwise
*/
-opj_bool opj_event_msg_v2(opj_event_mgr_t* event_mgr, int event_type, const char *fmt, ...);
+OPJ_API opj_bool OPJ_CALLCONV opj_event_msg_v2(opj_event_mgr_t* event_mgr, int event_type, const char *fmt, ...);
/* ----------------------------------------------------------------------- */
/**
* Set the event manager with the default callback function for the 3 levels.
*/
-void opj_set_default_event_handler(opj_event_mgr_t * p_manager);
+OPJ_API void OPJ_CALLCONV opj_set_default_event_handler(opj_event_mgr_t * p_manager);
/*@}*/
opj_free(p_list);
}
-opj_bool opj_procedure_list_add_procedure (opj_procedure_list_t * p_validation_list, opj_procedure p_procedure)
+opj_bool OPJ_CALLCONV opj_procedure_list_add_procedure (opj_procedure_list_t * p_validation_list, opj_procedure p_procedure)
{
if (p_validation_list->m_nb_max_procedures == p_validation_list->m_nb_procedures)
{
return OPJ_TRUE;
}
-OPJ_UINT32 opj_procedure_list_get_nb_procedures (opj_procedure_list_t * p_validation_list)
+OPJ_UINT32 OPJ_CALLCONV opj_procedure_list_get_nb_procedures (opj_procedure_list_t * p_validation_list)
{
return p_validation_list->m_nb_procedures;
}
-opj_procedure* opj_procedure_list_get_first_procedure (opj_procedure_list_t * p_validation_list)
+opj_procedure* OPJ_CALLCONV opj_procedure_list_get_first_procedure (opj_procedure_list_t * p_validation_list)
{
return p_validation_list->m_procedures;
}
-void opj_procedure_list_clear (opj_procedure_list_t * p_validation_list)
+void OPJ_CALLCONV opj_procedure_list_clear (opj_procedure_list_t * p_validation_list)
{
p_validation_list->m_nb_procedures = 0;
}
*
* @return OPJ_FALSE if the procedure could ne added.
*/
-opj_bool opj_procedure_list_add_procedure (opj_procedure_list_t * p_validation_list, opj_procedure p_procedure);
+OPJ_API opj_bool OPJ_CALLCONV opj_procedure_list_add_procedure (opj_procedure_list_t * p_validation_list, opj_procedure p_procedure);
/**
* Gets the number of validation procedures.
*
* @return the number of validation procedures.
*/
-OPJ_UINT32 opj_procedure_list_get_nb_procedures (opj_procedure_list_t * p_validation_list);
+OPJ_API OPJ_UINT32 OPJ_CALLCONV opj_procedure_list_get_nb_procedures (opj_procedure_list_t * p_validation_list);
/**
* Gets the pointer on the first validation procedure. This function is similar to the C++
*
* @return a pointer to the first procedure.
*/
-opj_procedure* opj_procedure_list_get_first_procedure (opj_procedure_list_t * p_validation_list);
+OPJ_API opj_procedure* OPJ_CALLCONV opj_procedure_list_get_first_procedure (opj_procedure_list_t * p_validation_list);
/**
* @param p_validation_list the list of procedure to clear.
*
*/
-void opj_procedure_list_clear (opj_procedure_list_t * p_validation_list);
+OPJ_API void OPJ_CALLCONV opj_procedure_list_clear (opj_procedure_list_t * p_validation_list);
/*@}*/
#endif /* __FUNCTION_LIST_H */
return OPJ_TRUE;
}
-opj_bool opj_j2k_end_compress( opj_j2k_v2_t *p_j2k,
+opj_bool OPJ_CALLCONV opj_j2k_end_compress( opj_j2k_v2_t *p_j2k,
opj_stream_private_t *p_stream,
opj_event_mgr_t * p_manager)
{
return OPJ_TRUE;
}
-opj_bool opj_j2k_start_compress(opj_j2k_v2_t *p_j2k,
+OPJ_API opj_bool OPJ_CALLCONV opj_j2k_start_compress(opj_j2k_v2_t *p_j2k,
opj_stream_private_t *p_stream,
opj_image_t * p_image,
opj_event_mgr_t * p_manager)
*
* @return true if the codec is valid.
*/
-opj_bool opj_j2k_start_compress(opj_j2k_v2_t *p_j2k,
+opj_bool OPJ_CALLCONV opj_j2k_start_compress(opj_j2k_v2_t *p_j2k,
opj_stream_private_t *p_stream,
opj_image_t * p_image,
opj_event_mgr_t * p_manager);
* Ends the compression procedures and possibiliy add data to be read after the
* codestream.
*/
-opj_bool opj_j2k_end_compress( opj_j2k_v2_t *p_j2k,
+OPJ_API opj_bool OPJ_CALLCONV opj_j2k_end_compress( opj_j2k_v2_t *p_j2k,
opj_stream_private_t *cio,
opj_event_mgr_t * p_manager);
return OPJ_TRUE;
}
-opj_bool opj_jp2_write_jp2h(opj_jp2_v2_t *jp2,
+opj_bool OPJ_CALLCONV opj_jp2_write_jp2h(opj_jp2_v2_t *jp2,
opj_stream_private_t *stream,
opj_event_mgr_t * p_manager
)
/* JP2 encoder interface */
/* ----------------------------------------------------------------------- */
-void opj_jp2_setup_encoder( opj_jp2_v2_t *jp2,
+void OPJ_CALLCONV opj_jp2_setup_encoder( opj_jp2_v2_t *jp2,
opj_cparameters_t *parameters,
opj_image_t *image,
opj_event_mgr_t * p_manager)
jp2->approx = 0; /* APPROX */
}
-opj_bool opj_jp2_encode(opj_jp2_v2_t *jp2,
+opj_bool OPJ_CALLCONV opj_jp2_encode(opj_jp2_v2_t *jp2,
opj_stream_private_t *stream,
opj_event_mgr_t * p_manager)
{
p_manager);
}
-opj_bool opj_jp2_write_tile ( opj_jp2_v2_t *p_jp2,
+opj_bool OPJ_CALLCONV opj_jp2_write_tile ( opj_jp2_v2_t *p_jp2,
OPJ_UINT32 p_tile_index,
OPJ_BYTE * p_data,
OPJ_UINT32 p_data_size,
return opj_j2k_decode_tile (p_jp2->j2k,p_tile_index,p_data,p_data_size,p_stream,p_manager);
}
-void opj_jp2_destroy(opj_jp2_v2_t *jp2)
+void OPJ_CALLCONV opj_jp2_destroy(opj_jp2_v2_t *jp2)
{
if (jp2) {
/* destroy the J2K codec */
/* JP2 encoder interface */
/* ----------------------------------------------------------------------- */
-opj_jp2_v2_t* opj_jp2_create(opj_bool p_is_decoder)
+opj_jp2_v2_t* OPJ_CALLCONV opj_jp2_create(opj_bool p_is_decoder)
{
opj_jp2_v2_t *jp2 = (opj_jp2_v2_t*)opj_malloc(sizeof(opj_jp2_v2_t));
if (jp2) {
return j2k_get_cstr_index(p_jp2->j2k);
}
-opj_codestream_info_v2_t* jp2_get_cstr_info(opj_jp2_v2_t* p_jp2)
+opj_codestream_info_v2_t* OPJ_CALLCONV jp2_get_cstr_info(opj_jp2_v2_t* p_jp2)
{
return j2k_get_cstr_info(p_jp2->j2k);
}
*
* @return true if writing was successful.
*/
-opj_bool opj_jp2_write_jp2h(opj_jp2_v2_t *jp2,
+OPJ_API opj_bool OPJ_CALLCONV opj_jp2_write_jp2h(opj_jp2_v2_t *jp2,
opj_stream_private_t *stream,
opj_event_mgr_t * p_manager );
* @param image input filled image
* @param p_manager FIXME DOC
*/
-void opj_jp2_setup_encoder( opj_jp2_v2_t *jp2,
+OPJ_API void OPJ_CALLCONV opj_jp2_setup_encoder( opj_jp2_v2_t *jp2,
opj_cparameters_t *parameters,
opj_image_t *image,
opj_event_mgr_t * p_manager);
@param p_manager event manager
@return Returns true if successful, returns false otherwise
*/
-opj_bool opj_jp2_encode( opj_jp2_v2_t *jp2,
+OPJ_API opj_bool OPJ_CALLCONV opj_jp2_encode( opj_jp2_v2_t *jp2,
opj_stream_private_t *stream,
opj_event_mgr_t * p_manager);
* @param p_stream the stream to write data to.
* @param p_manager the user event manager.
*/
-opj_bool opj_jp2_write_tile ( opj_jp2_v2_t *p_jp2,
+OPJ_API opj_bool OPJ_CALLCONV opj_jp2_write_tile ( opj_jp2_v2_t *p_jp2,
OPJ_UINT32 p_tile_index,
OPJ_BYTE * p_data,
OPJ_UINT32 p_data_size,
*
* @return an empty jpeg2000 file codec.
*/
-opj_jp2_v2_t* opj_jp2_create (opj_bool p_is_decoder);
+OPJ_API opj_jp2_v2_t* OPJ_CALLCONV opj_jp2_create (opj_bool p_is_decoder);
/**
Destroy a JP2 decompressor handle
@param jp2 JP2 decompressor handle to destroy
*/
-void opj_jp2_destroy(opj_jp2_v2_t *jp2);
+OPJ_API void OPJ_CALLCONV opj_jp2_destroy(opj_jp2_v2_t *jp2);
/**
*
*@return the codestream information extract from the jpg2000 codec
*/
-opj_codestream_info_v2_t* jp2_get_cstr_info(opj_jp2_v2_t* p_jp2);
+OPJ_API opj_codestream_info_v2_t* OPJ_CALLCONV jp2_get_cstr_info(opj_jp2_v2_t* p_jp2);
/**
* Get the codestream index from a JPEG2000 codec.
+# openjp3d
+include_regular_expression("^.*$")
-INCLUDE_REGULAR_EXPRESSION("^.*$")
+include_directories(
+ ${OPENJPEG_BINARY_DIR}/src/lib/openjp2 # opj_config.h
+ )
SET(OPENJP3D_LIBRARY_NAME openjp3d)
# Defines the source code for the library
SET(OPENJP3D_SRCS
-bio.c cio.c dwt.c event.c jp3d.c jp3d_lib.c mct.c mqc.c openjp3d.c pi.c raw.c t1.c t1_3d.c t2.c tcd.c tgt.c volume.c
+bio.c cio.c dwt.c event.c jp3d.c jp3d_lib.c mct.c mqc.c openjp3d.c
+pi.c raw.c t1.c t1_3d.c t2.c tcd.c tgt.c volume.c
)
# Build the library
-IF(WIN32)
- IF(BUILD_SHARED_LIBS)
- ADD_DEFINITIONS(-DOPJ_EXPORTS)
- ELSE(BUILD_SHARED_LIBS)
- ADD_DEFINITIONS(-DOPJ_STATIC)
- ENDIF(BUILD_SHARED_LIBS)
-ENDIF(WIN32)
+if(WIN32)
+ if(BUILD_SHARED_LIBS)
+ add_definitions(-DOPJ_EXPORTS)
+ else()
+ add_definitions(-DOPJ_STATIC)
+ endif()
+endif()
# build jp3d lib:
-ADD_LIBRARY(${OPENJP3D_LIBRARY_NAME} ${OPENJP3D_SRCS})
-IF(UNIX)
- TARGET_LINK_LIBRARIES(${OPENJP3D_LIBRARY_NAME} m)
-ENDIF(UNIX)
-SET_TARGET_PROPERTIES(${OPENJP3D_LIBRARY_NAME} PROPERTIES ${OPENJPEG_LIBRARY_PROPERTIES})
+add_library(${OPENJP3D_LIBRARY_NAME} ${OPENJP3D_SRCS})
+if(UNIX)
+ target_link_libraries(${OPENJP3D_LIBRARY_NAME} m)
+endif()
+set_target_properties(${OPENJP3D_LIBRARY_NAME} PROPERTIES ${OPENJPEG_LIBRARY_PROPERTIES})
# Install library
-INSTALL(TARGETS ${OPENJP3D_LIBRARY_NAME}
+install(TARGETS ${OPENJP3D_LIBRARY_NAME}
EXPORT OpenJP3DTargets
DESTINATION ${OPENJPEG_INSTALL_LIB_DIR}
COMPONENT Libraries
)
# Install includes files
-INSTALL(FILES openjp3d.h
+install(FILES openjp3d.h
DESTINATION ${OPENJPEG_INSTALL_INCLUDE_DIR}
COMPONENT Headers
)
#endif /* _WIN32 */\r
\r
#include "opj_includes.h"\r
+#include "openjp3d.h"\r
#define JP3D_VERSION "1.3.0"\r
/* ---------------------------------------------------------------------- */\r
#ifdef _WIN32\r
*/\r
\r
#if defined(OPJ_STATIC) || !defined(_WIN32)\r
+/* http://gcc.gnu.org/wiki/Visibility */\r
+#if __GNUC__ >= 4\r
+#define OPJ_API __attribute__ ((visibility ("default")))\r
+#define OPJ_LOCAL __attribute__ ((visibility ("hidden")))\r
+#else\r
#define OPJ_API\r
+#define OPJ_LOCAL\r
+#endif\r
#define OPJ_CALLCONV\r
#else\r
#define OPJ_CALLCONV __stdcall\r
+\r
/*\r
The following ifdef block is the standard way of creating macros which make exporting \r
from a DLL simpler. All files within this DLL are compiled with the OPJ_EXPORTS\r
*/\r
\r
#include "opj_includes.h"\r
+#include "volume.h"\r
+#include "openjp3d.h"\r
\r
opj_volume_t* OPJ_CALLCONV opj_volume_create(int numcmpts, opj_volume_cmptparm_t *cmptparms, OPJ_COLOR_SPACE clrspc) {\r
int compno;\r
#ifndef SERVER
-dec_server_record_t * init_dec_server( int port)
+dec_server_record_t * OPJ_CALLCONV init_dec_server( int port)
{
dec_server_record_t *record = (dec_server_record_t *)opj_malloc( sizeof(dec_server_record_t));
return record;
}
-void terminate_dec_server( dec_server_record_t **rec)
+void OPJ_CALLCONV terminate_dec_server( dec_server_record_t **rec)
{
delete_cachelist( &(*rec)->cachelist);
opj_free( (*rec)->jpipstream);
opj_free( *rec);
}
-client_t accept_connection( dec_server_record_t *rec)
+client_t OPJ_CALLCONV accept_connection( dec_server_record_t *rec)
{
client_t client;
return client;
}
-bool handle_clientreq( client_t client, dec_server_record_t *rec)
+bool OPJ_CALLCONV handle_clientreq( client_t client, dec_server_record_t *rec)
{
bool quit = false;
msgtype_t msgtype = identify_clientmsg( client);
}
-jpip_dec_param_t * init_jpipdecoder( bool jp2)
+jpip_dec_param_t * OPJ_CALLCONV init_jpipdecoder( bool jp2)
{
jpip_dec_param_t *dec;
}
-bool fread_jpip( const char fname[], jpip_dec_param_t *dec)
+bool OPJ_CALLCONV fread_jpip( const char fname[], jpip_dec_param_t *dec)
{
int infd;
return true;
}
-void decode_jpip( jpip_dec_param_t *dec)
+void OPJ_CALLCONV decode_jpip( jpip_dec_param_t *dec)
{
parse_JPIPstream( dec->jpipstream, dec->jpiplen, 0, dec->msgqueue);
dec->jp2kstream = recons_j2k( dec->msgqueue, dec->jpipstream, dec->msgqueue->first->csn, 0, 0, &dec->jp2klen);
}
-bool fwrite_jp2k( const char fname[], jpip_dec_param_t *dec)
+bool OPJ_CALLCONV fwrite_jp2k( const char fname[], jpip_dec_param_t *dec)
{
int outfd;
return true;
}
-void output_log( bool messages, bool metadata, bool ihdrbox, jpip_dec_param_t *dec)
+void OPJ_CALLCONV output_log( bool messages, bool metadata, bool ihdrbox, jpip_dec_param_t *dec)
{
if( messages)
print_msgqueue( dec->msgqueue);
}
}
-void destroy_jpipdecoder( jpip_dec_param_t **dec)
+void OPJ_CALLCONV destroy_jpipdecoder( jpip_dec_param_t **dec)
{
opj_free( (*dec)->jpipstream);
delete_msgqueue( &(*dec)->msgqueue);
opj_free( *dec);
}
-index_t * get_index_from_JP2file( int fd)
+index_t * OPJ_CALLCONV get_index_from_JP2file( int fd)
{
char *data;
return parse_jp2file( fd);
}
-void destroy_index( index_t **idx)
+void OPJ_CALLCONV destroy_index( index_t **idx)
{
delete_index( idx);
}
-void output_index( index_t *index)
+void OPJ_CALLCONV output_index( index_t *index)
{
print_index( *index);
}
* @param[in] port opening tcp port (valid No. 49152-65535)
* @return intialized decoding server record pointer
*/
-dec_server_record_t * init_dec_server( int port);
+OPJ_API dec_server_record_t * OPJ_CALLCONV init_dec_server( int port);
/**
* Terminate the image decoding server
*
* @param[in] rec address of deleting decoding server static record pointer
*/
-void terminate_dec_server( dec_server_record_t **rec);
+OPJ_API void OPJ_CALLCONV terminate_dec_server( dec_server_record_t **rec);
/**
* Accept client connection
* @param[in] rec decoding server static record pointer
* @return client socket ID, -1 if failed
*/
-client_t accept_connection( dec_server_record_t *rec);
+OPJ_API client_t OPJ_CALLCONV accept_connection( dec_server_record_t *rec);
/**
* Handle client request
* @param[in] rec decoding server static record pointer
* @return true if succeed
*/
-bool handle_clientreq( client_t client, dec_server_record_t *rec);
+OPJ_API bool OPJ_CALLCONV handle_clientreq( client_t client, dec_server_record_t *rec);
#endif /*SERVER*/
* @param[in] jp2 true in case of jp2 file encoding, else j2k file encoding
* @return JPIP decoding parameters pointer
*/
-jpip_dec_param_t * init_jpipdecoder( bool jp2);
+OPJ_API jpip_dec_param_t * OPJ_CALLCONV init_jpipdecoder( bool jp2);
/**
* Destroy jpip decoding parameters
*
* @param[in] dec address of JPIP decoding parameters pointer
*/
-void destroy_jpipdecoder( jpip_dec_param_t **dec);
+OPJ_API void OPJ_CALLCONV destroy_jpipdecoder( jpip_dec_param_t **dec);
/**
* Read jpip codestream from a file
* @param[in] dec JPIP decoding parameters pointer
* @return true if succeed
*/
-bool fread_jpip( const char fname[], jpip_dec_param_t *dec);
+OPJ_API bool OPJ_CALLCONV fread_jpip( const char fname[], jpip_dec_param_t *dec);
/**
* Decode jpip codestream
*
* @param[in] dec JPIP decoding parameters pointer
*/
-void decode_jpip( jpip_dec_param_t *dec);
+OPJ_API void OPJ_CALLCONV decode_jpip( jpip_dec_param_t *dec);
/**
* Write J2K/JP2 codestream to a file
* @param[in] dec JPIP decoding parameters pointer
* @return true if succeed
*/
-bool fwrite_jp2k( const char fname[], jpip_dec_param_t *dec);
+OPJ_API bool OPJ_CALLCONV fwrite_jp2k( const char fname[], jpip_dec_param_t *dec);
/**
* Option; print out parameter values to stderr
* @param[in] ihdrbox true if image header data is to be printed out
* @param[in] dec JPIP decoding parameters pointer
*/
-void output_log( bool messages, bool metadata, bool ihdrbox, jpip_dec_param_t *dec);
+OPJ_API void OPJ_CALLCONV output_log( bool messages, bool metadata, bool ihdrbox, jpip_dec_param_t *dec);
/*
* test the format of index (cidx) box in JP2 file
* @param[in] fd file descriptor of the JP2 file
* @return pointer to the generated structure of index parameters
*/
-index_t * get_index_from_JP2file( int fd);
+OPJ_API index_t * OPJ_CALLCONV get_index_from_JP2file( int fd);
/**
* Destroy index parameters
*
* @param[in,out] idx addressof the index pointer
*/
-void destroy_index( index_t **idx);
+OPJ_API void OPJ_CALLCONV destroy_index( index_t **idx);
/**
*
* @param[in] index index parameters
*/
-void output_index( index_t *index);
+OPJ_API void OPJ_CALLCONV output_index( index_t *index);
OPJ_API opj_codec_t* OPJ_CALLCONV opj_jpip_create_compress(OPJ_CODEC_FORMAT format);
+# openmj2:
set(OPENMJ2_LIBRARY_NAME openmj2)
+
+include_directories(
+ ${OPENJPEG_BINARY_DIR}/src/lib/openjp2 # opj_config.h
+ )
+
set(OPENMJ2_SRCS
mj2.c
mj2_convert.c
if(WIN32)
if(BUILD_SHARED_LIBS)
add_definitions(-DOPJ_EXPORTS)
- else(BUILD_SHARED_LIBS)
+ else()
add_definitions(-DOPJ_STATIC)
- endif(BUILD_SHARED_LIBS)
-endif(WIN32)
-
-include_directories(
- ${OPENJPEG_BINARY_DIR}/src/lib/openjp2 # opj_config.h
- #${OPENJPEG_SOURCE_DIR}/src/lib/openjp2
- )
+ endif()
+endif()
# build mj2 lib:
add_library(${OPENMJ2_LIBRARY_NAME} ${OPENMJ2_SRCS})
* v : value to write
* n : number of bytes to write
*/
-unsigned int cio_write(opj_cio_t *cio, unsigned int64 v, int n) {
+unsigned int OPJ_CALLCONV cio_write(opj_cio_t *cio, unsigned int64 v, int n) {
int i;
for (i = n - 1; i >= 0; i--) {
if( !cio_byteout(cio, (unsigned char) ((v >> (i << 3)) & 0xff)) )
*
* return : value of the n bytes read
*/
-unsigned int cio_read(opj_cio_t *cio, int n) {
+unsigned int OPJ_CALLCONV cio_read(opj_cio_t *cio, int n) {
int i;
unsigned int v;
v = 0;
*
* n : number of bytes to skip
*/
-void cio_skip(opj_cio_t *cio, int n) {
+void OPJ_CALLCONV cio_skip(opj_cio_t *cio, int n) {
cio->bp += n;
}
@param n Number of bytes to write
@return Returns the number of bytes written or 0 if an error occured
*/
-unsigned int cio_write(opj_cio_t *cio, unsigned int64 v, int n);
+OPJ_API unsigned int OPJ_CALLCONV cio_write(opj_cio_t *cio, unsigned int64 v, int n);
/**
Read some bytes
@param cio CIO handle
@param n Number of bytes to read
@return Returns the value of the n bytes read
*/
-unsigned int cio_read(opj_cio_t *cio, int n);
+OPJ_API unsigned int OPJ_CALLCONV cio_read(opj_cio_t *cio, int n);
/**
Skip some bytes
@param cio CIO handle
@param n Number of bytes to skip
*/
-void cio_skip(opj_cio_t *cio, int n);
+OPJ_API void OPJ_CALLCONV cio_skip(opj_cio_t *cio, int n);
/* ----------------------------------------------------------------------- */
/*@}*/
#endif /* _WIN32 */
#include "opj_includes.h"
-double opj_clock(void) {
+double OPJ_CALLCONV opj_clock(void) {
#ifdef _WIN32
/* _WIN32: use QueryPerformance (very accurate) */
LARGE_INTEGER freq , t ;
Difference in successive opj_clock() calls tells you the elapsed time
@return Returns time in seconds
*/
-double opj_clock(void);
+OPJ_API double OPJ_CALLCONV opj_clock(void);
/* ----------------------------------------------------------------------- */
/*@}*/
*
*/
-int mj2_init_stdmovie(opj_mj2_t * movie)
+int OPJ_CALLCONV mj2_init_stdmovie(opj_mj2_t * movie)
{
mj2_tk_t *tk0;
int i, w, h, prec;
* JP Signature box
*
*/
-void mj2_write_jp(opj_cio_t *cio)
+void OPJ_CALLCONV mj2_write_jp(opj_cio_t *cio)
{
mj2_box_t box;
box.init_pos = cio_tell(cio);
* File type box
*
*/
-void mj2_write_ftyp(opj_mj2_t * movie, opj_cio_t *cio)
+void OPJ_CALLCONV mj2_write_ftyp(opj_mj2_t * movie, opj_cio_t *cio)
{
int i;
mj2_box_t box;
* Movie Box
*
*/
-void mj2_write_moov(opj_mj2_t * movie, opj_cio_t *cio)
+void OPJ_CALLCONV mj2_write_moov(opj_mj2_t * movie, opj_cio_t *cio)
{
int i;
mj2_box_t box;
return 0;
}
-int mj2_read_struct(FILE *file, opj_mj2_t *movie) {
+int OPJ_CALLCONV mj2_read_struct(FILE *file, opj_mj2_t *movie) {
mj2_box_t box;
opj_image_t img;
unsigned char * src;
/* MJ2 decoder interface */
/* ----------------------------------------------------------------------- */
-opj_dinfo_t* mj2_create_decompress() {
+opj_dinfo_t* OPJ_CALLCONV mj2_create_decompress() {
opj_mj2_t* mj2;
opj_dinfo_t *dinfo = (opj_dinfo_t*) opj_calloc(1, sizeof(opj_dinfo_t));
if(!dinfo) return NULL;
return dinfo;
}
-void mj2_setup_decoder(opj_mj2_t *movie, mj2_dparameters_t *mj2_parameters) {
+void OPJ_CALLCONV mj2_setup_decoder(opj_mj2_t *movie, mj2_dparameters_t *mj2_parameters) {
movie->num_vtk=0;
movie->num_stk=0;
movie->num_htk=0;
}
-void mj2_destroy_decompress(opj_mj2_t *movie) {
+void OPJ_CALLCONV mj2_destroy_decompress(opj_mj2_t *movie) {
if(movie) {
int i;
mj2_tk_t *tk=NULL;
/* MJ2 encoder interface */
/* ----------------------------------------------------------------------- */
-
-opj_cinfo_t* mj2_create_compress() {
+opj_cinfo_t* OPJ_CALLCONV mj2_create_compress() {
opj_mj2_t* mj2;
opj_cinfo_t *cinfo = (opj_cinfo_t*) opj_calloc(1, sizeof(opj_cinfo_t));
if(!cinfo) return NULL;
return cinfo;
}
-void mj2_setup_encoder(opj_mj2_t *movie, mj2_cparameters_t *parameters) {
+void OPJ_CALLCONV mj2_setup_encoder(opj_mj2_t *movie, mj2_cparameters_t *parameters) {
if(movie && parameters) {
opj_jp2_t *jp2_struct;
}
}
-void mj2_destroy_compress(opj_mj2_t *movie) {
+void OPJ_CALLCONV mj2_destroy_compress(opj_mj2_t *movie) {
if(movie) {
int i;
mj2_tk_t *tk=NULL;
/**
Write the JP box
*/
-void mj2_write_jp(opj_cio_t *cio);
+OPJ_API void OPJ_CALLCONV mj2_write_jp(opj_cio_t *cio);
/**
Write the FTYP box
@param movie MJ2 movie
@param cio Output buffer stream
*/
-void mj2_write_ftyp(opj_mj2_t *movie, opj_cio_t *cio);
+OPJ_API void OPJ_CALLCONV mj2_write_ftyp(opj_mj2_t *movie, opj_cio_t *cio);
/**
Creates an MJ2 decompression structure
@return Returns a handle to a MJ2 decompressor if successful, returns NULL otherwise
*/
-opj_dinfo_t* mj2_create_decompress();
+OPJ_API opj_dinfo_t* OPJ_CALLCONV mj2_create_decompress();
/**
Destroy a MJ2 decompressor handle
@param movie MJ2 decompressor handle to destroy
*/
-void mj2_destroy_decompress(opj_mj2_t *movie);
+OPJ_API void OPJ_CALLCONV mj2_destroy_decompress(opj_mj2_t *movie);
/**
Setup the decoder decoding parameters using user parameters.
Decoding parameters are returned in mj2->j2k->cp.
@param movie MJ2 decompressor handle
@param mj2_parameters decompression parameters
*/
-void mj2_setup_decoder(opj_mj2_t *movie, mj2_dparameters_t *mj2_parameters);
+OPJ_API void OPJ_CALLCONV mj2_setup_decoder(opj_mj2_t *movie, mj2_dparameters_t *mj2_parameters);
/**
Decode an image from a JPEG-2000 file stream
@param movie MJ2 decompressor handle
Creates a MJ2 compression structure
@return Returns a handle to a MJ2 compressor if successful, returns NULL otherwise
*/
-opj_cinfo_t* mj2_create_compress();
+OPJ_API opj_cinfo_t* OPJ_CALLCONV mj2_create_compress();
/**
Destroy a MJ2 compressor handle
@param movie MJ2 compressor handle to destroy
*/
-void mj2_destroy_compress(opj_mj2_t *movie);
+OPJ_API void OPJ_CALLCONV mj2_destroy_compress(opj_mj2_t *movie);
/**
Setup the encoder parameters using the current image and using user parameters.
Coding parameters are returned in mj2->j2k->cp.
@param movie MJ2 compressor handle
@param parameters compression parameters
*/
-void mj2_setup_encoder(opj_mj2_t *movie, mj2_cparameters_t *parameters);
+OPJ_API void OPJ_CALLCONV mj2_setup_encoder(opj_mj2_t *movie, mj2_cparameters_t *parameters);
/**
Encode an image into a JPEG-2000 file stream
@param movie MJ2 compressor handle
@param movie MJ2 Movie
@return Returns 0 if successful, returns 1 otherwise
*/
-int mj2_init_stdmovie(opj_mj2_t *movie);
+OPJ_API int OPJ_CALLCONV mj2_init_stdmovie(opj_mj2_t *movie);
/**
Read the structure of an MJ2 file
@param file MJ2 input File
@param mj2 J2 movie structure
@return Returns 0 if successful, returns 1 otherwise
*/
-int mj2_read_struct(FILE *file, opj_mj2_t *mj2);
+OPJ_API int OPJ_CALLCONV mj2_read_struct(FILE *file, opj_mj2_t *mj2);
/**
Write the the MOOV box to an output buffer stream
@param movie MJ2 movie structure
@param cio Output buffer stream
*/
-void mj2_write_moov(opj_mj2_t *movie, opj_cio_t *cio);
+OPJ_API void OPJ_CALLCONV mj2_write_moov(opj_mj2_t *movie, opj_cio_t *cio);
/* ----------------------------------------------------------------------- */
*/
#include "opj_includes.h"
-#include "mj2.h"
+#include "mj2_convert.h"
/* ----------------------- */
/* */
/* */
/* ----------------------- */
-unsigned int yuv_num_frames(mj2_tk_t * tk, char *infile)
+unsigned int OPJ_CALLCONV yuv_num_frames(mj2_tk_t * tk, char *infile)
{
unsigned int prec_size;
long end_of_f, frame_size;
/* */
/* ----------------------- */
-opj_image_t *mj2_image_create(mj2_tk_t * tk, opj_cparameters_t *parameters)
+opj_image_t * OPJ_CALLCONV mj2_image_create(mj2_tk_t * tk, opj_cparameters_t *parameters)
{
opj_image_cmptparm_t cmptparm[3];
opj_image_t * img;
return img;
}
-char yuvtoimage(mj2_tk_t * tk, opj_image_t * img, int frame_num, opj_cparameters_t *parameters, char* infile)
+char OPJ_CALLCONV yuvtoimage(mj2_tk_t * tk, opj_image_t * img, int frame_num, opj_cparameters_t *parameters, char* infile)
{
int i, compno;
int offset, size, max, prec_bytes, is_16, v;
/* ----------------------- */
-opj_bool imagetoyuv(opj_image_t * img, char *outfile)
+opj_bool OPJ_CALLCONV imagetoyuv(opj_image_t * img, char *outfile)
{
FILE *f;
int *data;
/* */
/* ----------------------- */
-int imagetobmp(opj_image_t * img, char *outfile) {
+int OPJ_CALLCONV imagetobmp(opj_image_t * img, char *outfile) {
int w,wr,h,hr,i,pad;
FILE *f;
#ifndef __MJ2_CONVERT_H
#define __MJ2_CONVERT_H
-int imagetoyuv(opj_image_t * img, char *outfile);
+OPJ_API int OPJ_CALLCONV imagetoyuv(opj_image_t * img, char *outfile);
-int imagetobmp(opj_image_t * img, char *outfile);
+OPJ_API int OPJ_CALLCONV imagetobmp(opj_image_t * img, char *outfile);
-opj_image_t *mj2_image_create(mj2_tk_t * tk, opj_cparameters_t *parameters);
+OPJ_API opj_image_t * OPJ_CALLCONV mj2_image_create(mj2_tk_t * tk, opj_cparameters_t *parameters);
-char yuvtoimage(mj2_tk_t * tk, opj_image_t * img, int frame_num, opj_cparameters_t *parameters, char* infile);
+OPJ_API char OPJ_CALLCONV yuvtoimage(mj2_tk_t * tk, opj_image_t * img, int frame_num, opj_cparameters_t *parameters, char* infile);
-unsigned int yuv_num_frames(mj2_tk_t * tk, char *infile);
+OPJ_API unsigned int OPJ_CALLCONV yuv_num_frames(mj2_tk_t * tk, char *infile);
#endif
#ifndef OPENJPEG_H
#define OPENJPEG_H
-
/*
==========================================================
Compiler directives
*/
#if defined(OPJ_STATIC) || !defined(_WIN32)
+/* http://gcc.gnu.org/wiki/Visibility */
+#if __GNUC__ >= 4
+#define OPJ_API __attribute__ ((visibility ("default")))
+#define OPJ_LOCAL __attribute__ ((visibility ("hidden")))
+#else
#define OPJ_API
+#define OPJ_LOCAL
+#endif
#define OPJ_CALLCONV
#else
#define OPJ_CALLCONV __stdcall