OpenJPEG  2.1.0
Functions
openjpeg.c File Reference
#include "opj_includes.h"

Functions

OPJ_BOOL OPJ_CALLCONV opj_set_info_handler (opj_codec_t *p_codec, opj_msg_callback p_callback, void *p_user_data)
 Set the info handler use by openjpeg. More...
 
OPJ_BOOL OPJ_CALLCONV opj_set_warning_handler (opj_codec_t *p_codec, opj_msg_callback p_callback, void *p_user_data)
 Set the warning handler use by openjpeg. More...
 
OPJ_BOOL OPJ_CALLCONV opj_set_error_handler (opj_codec_t *p_codec, opj_msg_callback p_callback, void *p_user_data)
 Set the error handler use by openjpeg. More...
 
static OPJ_SIZE_T opj_read_from_file (void *p_buffer, OPJ_SIZE_T p_nb_bytes, FILE *p_file)
 
static OPJ_UINT64 opj_get_data_length_from_file (FILE *p_file)
 
static OPJ_SIZE_T opj_write_from_file (void *p_buffer, OPJ_SIZE_T p_nb_bytes, FILE *p_file)
 
static OPJ_OFF_T opj_skip_from_file (OPJ_OFF_T p_nb_bytes, FILE *p_user_data)
 
static OPJ_BOOL opj_seek_from_file (OPJ_OFF_T p_nb_bytes, FILE *p_user_data)
 
const char *OPJ_CALLCONV opj_version (void)
 
opj_codec_t *OPJ_CALLCONV opj_create_decompress (OPJ_CODEC_FORMAT p_format)
 Creates a J2K/JP2 decompression structure. More...
 
void OPJ_CALLCONV opj_set_default_decoder_parameters (opj_dparameters_t *parameters)
 Set decoding parameters to default values. More...
 
OPJ_BOOL OPJ_CALLCONV opj_setup_decoder (opj_codec_t *p_codec, opj_dparameters_t *parameters)
 Setup the decoder with decompression parameters provided by the user and with the message handler provided by the user. More...
 
OPJ_BOOL OPJ_CALLCONV opj_read_header (opj_stream_t *p_stream, opj_codec_t *p_codec, opj_image_t **p_image)
 Decodes an image header. More...
 
OPJ_BOOL OPJ_CALLCONV opj_decode (opj_codec_t *p_codec, opj_stream_t *p_stream, opj_image_t *p_image)
 Decode an image from a JPEG-2000 codestream. More...
 
OPJ_BOOL OPJ_CALLCONV opj_set_decode_area (opj_codec_t *p_codec, opj_image_t *p_image, OPJ_INT32 p_start_x, OPJ_INT32 p_start_y, OPJ_INT32 p_end_x, OPJ_INT32 p_end_y)
 Sets the given area to be decoded. More...
 
OPJ_BOOL OPJ_CALLCONV opj_read_tile_header (opj_codec_t *p_codec, opj_stream_t *p_stream, OPJ_UINT32 *p_tile_index, OPJ_UINT32 *p_data_size, OPJ_INT32 *p_tile_x0, OPJ_INT32 *p_tile_y0, OPJ_INT32 *p_tile_x1, OPJ_INT32 *p_tile_y1, OPJ_UINT32 *p_nb_comps, OPJ_BOOL *p_should_go_on)
 Reads a tile header. More...
 
OPJ_BOOL OPJ_CALLCONV opj_decode_tile_data (opj_codec_t *p_codec, OPJ_UINT32 p_tile_index, OPJ_BYTE *p_data, OPJ_UINT32 p_data_size, opj_stream_t *p_stream)
 Reads a tile data. More...
 
OPJ_BOOL OPJ_CALLCONV opj_get_decoded_tile (opj_codec_t *p_codec, opj_stream_t *p_stream, opj_image_t *p_image, OPJ_UINT32 tile_index)
 Get the decoded tile from the codec. More...
 
OPJ_BOOL OPJ_CALLCONV opj_set_decoded_resolution_factor (opj_codec_t *p_codec, OPJ_UINT32 res_factor)
 Set the resolution factor of the decoded image. More...
 
opj_codec_t *OPJ_CALLCONV opj_create_compress (OPJ_CODEC_FORMAT p_format)
 Creates a J2K/JP2 compression structure. More...
 
void OPJ_CALLCONV opj_set_default_encoder_parameters (opj_cparameters_t *parameters)
 Set encoding parameters to default values, that means : More...
 
OPJ_BOOL OPJ_CALLCONV opj_setup_encoder (opj_codec_t *p_codec, opj_cparameters_t *parameters, opj_image_t *p_image)
 Setup the encoder parameters using the current image and using user parameters. More...
 
OPJ_BOOL OPJ_CALLCONV opj_start_compress (opj_codec_t *p_codec, opj_image_t *p_image, opj_stream_t *p_stream)
 Start to compress the current image. More...
 
OPJ_BOOL OPJ_CALLCONV opj_encode (opj_codec_t *p_info, opj_stream_t *p_stream)
 Encode an image into a JPEG-2000 codestream. More...
 
OPJ_BOOL OPJ_CALLCONV opj_end_compress (opj_codec_t *p_codec, opj_stream_t *p_stream)
 End to compress the current image. More...
 
OPJ_BOOL OPJ_CALLCONV opj_end_decompress (opj_codec_t *p_codec, opj_stream_t *p_stream)
 Read after the codestream if necessary. More...
 
OPJ_BOOL OPJ_CALLCONV opj_set_MCT (opj_cparameters_t *parameters, OPJ_FLOAT32 *pEncodingMatrix, OPJ_INT32 *p_dc_shift, OPJ_UINT32 pNbComp)
 Sets the MCT matrix to use. More...
 
OPJ_BOOL OPJ_CALLCONV opj_write_tile (opj_codec_t *p_codec, OPJ_UINT32 p_tile_index, OPJ_BYTE *p_data, OPJ_UINT32 p_data_size, opj_stream_t *p_stream)
 Writes a tile with the given data. More...
 
void OPJ_CALLCONV opj_destroy_codec (opj_codec_t *p_codec)
 Destroy a decompressor handle. More...
 
void OPJ_CALLCONV opj_dump_codec (opj_codec_t *p_codec, OPJ_INT32 info_flag, FILE *output_stream)
 Dump the codec information into the output stream. More...
 
opj_codestream_info_v2_t *OPJ_CALLCONV opj_get_cstr_info (opj_codec_t *p_codec)
 Get the codestream information from the codec. More...
 
void OPJ_CALLCONV opj_destroy_cstr_info (opj_codestream_info_v2_t **cstr_info)
 Destroy Codestream information after compression or decompression. More...
 
opj_codestream_index_t *OPJ_CALLCONV opj_get_cstr_index (opj_codec_t *p_codec)
 Get the codestream index from the codec. More...
 
void OPJ_CALLCONV opj_destroy_cstr_index (opj_codestream_index_t **p_cstr_index)
 
opj_stream_t *OPJ_CALLCONV opj_stream_create_default_file_stream (const char *fname, OPJ_BOOL p_is_read_stream)
 Create a stream from a file identified with its filename with default parameters (helper function) More...
 
opj_stream_t *OPJ_CALLCONV opj_stream_create_file_stream (const char *fname, OPJ_SIZE_T p_size, OPJ_BOOL p_is_read_stream)
 Create a stream from a file identified with its filename with a specific buffer size. More...
 

Function Documentation

opj_codec_t* OPJ_CALLCONV opj_create_compress ( OPJ_CODEC_FORMAT  format)
opj_codec_t* OPJ_CALLCONV opj_create_decompress ( OPJ_CODEC_FORMAT  format)
OPJ_BOOL OPJ_CALLCONV opj_decode ( opj_codec_t p_decompressor,
opj_stream_t p_stream,
opj_image_t p_image 
)

Decode an image from a JPEG-2000 codestream.

Parameters
p_decompressordecompressor handle
p_streamInput buffer stream
p_imagethe decoded image
Returns
true if success, otherwise false

References opj_codec_private::is_decompressor, opj_codec_private::m_codec, opj_codec_private::m_codec_data, opj_codec_private::m_decompression, opj_codec_private::m_event_mgr, and OPJ_FALSE.

Referenced by j2k_to_pnm().

OPJ_BOOL OPJ_CALLCONV opj_decode_tile_data ( opj_codec_t p_codec,
OPJ_UINT32  p_tile_index,
OPJ_BYTE p_data,
OPJ_UINT32  p_data_size,
opj_stream_t p_stream 
)

Reads a tile data.

This function is compulsory and allows one to decode tile data. opj_read_tile_header should be called before. The user may need to refer to the image got by opj_read_header to understand the size being taken by the tile.

Parameters
p_codecthe jpeg2000 codec.
p_tile_indexthe index of the tile being decoded, this should be the value set by opj_read_tile_header.
p_datapointer to a memory block that will hold the decoded data.
p_data_sizesize of p_data. p_data_size should be bigger or equal to the value set by opj_read_tile_header.
p_streamthe stream to decode.
Returns
true if the data could be decoded.

References opj_codec_private::is_decompressor, opj_codec_private::m_codec, opj_codec_private::m_codec_data, opj_codec_private::m_decompression, opj_codec_private::m_event_mgr, and OPJ_FALSE.

void OPJ_CALLCONV opj_destroy_codec ( opj_codec_t p_codec)

Destroy a decompressor handle.

Parameters
p_codecdecompressor handle to destroy

References opj_codec_private::is_decompressor, opj_codec_private::m_codec, opj_codec_private::m_codec_data, opj_codec_private::m_compression, opj_codec_private::m_decompression, and opj_free.

Referenced by j2k_to_pnm().

void OPJ_CALLCONV opj_destroy_cstr_index ( opj_codestream_index_t **  p_cstr_index)
void OPJ_CALLCONV opj_destroy_cstr_info ( opj_codestream_info_v2_t **  cstr_info)

Destroy Codestream information after compression or decompression.

Parameters
cstr_infoCodestream information structure

References opj_free.

Referenced by j2k_get_cstr_info().

void OPJ_CALLCONV opj_dump_codec ( opj_codec_t p_codec,
OPJ_INT32  info_flag,
FILE *  output_stream 
)

Dump the codec information into the output stream.

Parameters
p_codecthe jpeg2000 codec.
info_flagtype of information dump.
output_streamoutput stream where dump the informations get from the codec.

References opj_codec_private::m_codec, and opj_codec_private::opj_dump_codec.

OPJ_BOOL OPJ_CALLCONV opj_encode ( opj_codec_t p_codec,
opj_stream_t p_stream 
)

Encode an image into a JPEG-2000 codestream.

Parameters
p_codeccompressor handle
p_streamOutput buffer stream
Returns
Returns true if successful, returns false otherwise

References opj_codec_private::is_decompressor, opj_codec_private::m_codec, opj_codec_private::m_codec_data, opj_codec_private::m_compression, opj_codec_private::m_event_mgr, and OPJ_FALSE.

OPJ_BOOL OPJ_CALLCONV opj_end_compress ( opj_codec_t p_codec,
opj_stream_t p_stream 
)

End to compress the current image.

Parameters
p_codecCompressor handle
p_streamInput stgream

References opj_codec_private::is_decompressor, opj_codec_private::m_codec, opj_codec_private::m_codec_data, opj_codec_private::m_compression, opj_codec_private::m_event_mgr, and OPJ_FALSE.

OPJ_BOOL OPJ_CALLCONV opj_end_decompress ( opj_codec_t p_codec,
opj_stream_t p_stream 
)

Read after the codestream if necessary.

Parameters
p_codecthe JPEG2000 codec to read.
p_streamthe JPEG2000 stream.

References opj_codec_private::is_decompressor, opj_codec_private::m_codec, opj_codec_private::m_codec_data, opj_codec_private::m_decompression, opj_codec_private::m_event_mgr, and OPJ_FALSE.

Referenced by j2k_to_pnm().

opj_codestream_index_t* OPJ_CALLCONV opj_get_cstr_index ( opj_codec_t p_codec)

Get the codestream index from the codec.

Parameters
p_codecthe jpeg2000 codec.
Returns
a pointer to a codestream index structure.

References opj_codec_private::m_codec, and opj_codec_private::opj_get_codec_index.

opj_codestream_info_v2_t* OPJ_CALLCONV opj_get_cstr_info ( opj_codec_t p_codec)

Get the codestream information from the codec.

Parameters
p_codecthe jpeg2000 codec.
Returns
a pointer to a codestream information structure.

References opj_codec_private::m_codec, and opj_codec_private::opj_get_codec_info.

static OPJ_UINT64 opj_get_data_length_from_file ( FILE *  p_file)
static

References OPJ_FSEEK, and OPJ_FTELL.

Referenced by opj_stream_create_file_stream().

OPJ_BOOL OPJ_CALLCONV opj_get_decoded_tile ( opj_codec_t p_codec,
opj_stream_t p_stream,
opj_image_t p_image,
OPJ_UINT32  tile_index 
)

Get the decoded tile from the codec.

Parameters
p_codecthe jpeg2000 codec.
p_streaminput streamm
p_imageoutput image
tile_indexindex of the tile which will be decode
Returns
true if success, otherwise false

References opj_codec_private::is_decompressor, opj_codec_private::m_codec, opj_codec_private::m_codec_data, opj_codec_private::m_decompression, opj_codec_private::m_event_mgr, and OPJ_FALSE.

static OPJ_SIZE_T opj_read_from_file ( void *  p_buffer,
OPJ_SIZE_T  p_nb_bytes,
FILE *  p_file 
)
static
OPJ_BOOL OPJ_CALLCONV opj_read_header ( opj_stream_t p_stream,
opj_codec_t p_codec,
opj_image_t **  p_image 
)

Decodes an image header.

Parameters
p_streamthe jpeg2000 stream.
p_codecthe jpeg2000 codec to read.
p_imagethe image structure initialized with the characteristics of encoded image.
Returns
true if the main header of the codestream and the JP2 header is correctly read.

References EVT_ERROR, opj_codec_private::is_decompressor, opj_codec_private::m_codec, opj_codec_private::m_codec_data, opj_codec_private::m_decompression, opj_codec_private::m_event_mgr, opj_event_msg(), and OPJ_FALSE.

Referenced by j2k_to_pnm().

OPJ_BOOL OPJ_CALLCONV opj_read_tile_header ( opj_codec_t p_codec,
opj_stream_t p_stream,
OPJ_UINT32 p_tile_index,
OPJ_UINT32 p_data_size,
OPJ_INT32 p_tile_x0,
OPJ_INT32 p_tile_y0,
OPJ_INT32 p_tile_x1,
OPJ_INT32 p_tile_y1,
OPJ_UINT32 p_nb_comps,
OPJ_BOOL p_should_go_on 
)

Reads a tile header.

This function is compulsory and allows one to know the size of the tile thta will be decoded. The user may need to refer to the image got by opj_read_header to understand the size being taken by the tile.

Parameters
p_codecthe jpeg2000 codec.
p_tile_indexpointer to a value that will hold the index of the tile being decoded, in case of success.
p_data_sizepointer to a value that will hold the maximum size of the decoded data, in case of success. In case of truncated codestreams, the actual number of bytes decoded may be lower. The computation of the size is the same as depicted in opj_write_tile.
p_tile_x0pointer to a value that will hold the x0 pos of the tile (in the image).
p_tile_y0pointer to a value that will hold the y0 pos of the tile (in the image).
p_tile_x1pointer to a value that will hold the x1 pos of the tile (in the image).
p_tile_y1pointer to a value that will hold the y1 pos of the tile (in the image).
p_nb_compspointer to a value that will hold the number of components in the tile.
p_should_go_onpointer to a boolean that will hold the fact that the decoding should go on. In case the codestream is over at the time of the call, the value will be set to false. The user should then stop the decoding.
p_streamthe stream to decode.
Returns
true if the tile header could be decoded. In case the decoding should end, the returned value is still true. returning false may be the result of a shortage of memory or an internal error.

References opj_codec_private::is_decompressor, opj_codec_private::m_codec, opj_codec_private::m_codec_data, opj_codec_private::m_decompression, opj_codec_private::m_event_mgr, and OPJ_FALSE.

static OPJ_BOOL opj_seek_from_file ( OPJ_OFF_T  p_nb_bytes,
FILE *  p_user_data 
)
static

References OPJ_FALSE, OPJ_FSEEK, and OPJ_TRUE.

Referenced by opj_stream_create_file_stream().

OPJ_BOOL OPJ_CALLCONV opj_set_decode_area ( opj_codec_t p_codec,
opj_image_t p_image,
OPJ_INT32  p_start_x,
OPJ_INT32  p_start_y,
OPJ_INT32  p_end_x,
OPJ_INT32  p_end_y 
)

Sets the given area to be decoded.

This function should be called right after opj_read_header and before any tile header reading.

Parameters
p_codecthe jpeg2000 codec.
p_imagethe decoded image previously setted by opj_read_header
p_start_xthe left position of the rectangle to decode (in image coordinates).
p_end_xthe right position of the rectangle to decode (in image coordinates).
p_start_ythe up position of the rectangle to decode (in image coordinates).
p_end_ythe bottom position of the rectangle to decode (in image coordinates).
Returns
true if the area could be set.

References opj_codec_private::is_decompressor, opj_codec_private::m_codec, opj_codec_private::m_codec_data, opj_codec_private::m_decompression, opj_codec_private::m_event_mgr, and OPJ_FALSE.

Referenced by j2k_to_pnm().

OPJ_BOOL OPJ_CALLCONV opj_set_decoded_resolution_factor ( opj_codec_t p_codec,
OPJ_UINT32  res_factor 
)

Set the resolution factor of the decoded image.

Parameters
p_codecthe jpeg2000 codec.
res_factorresolution factor to set
Returns
true if success, otherwise false

References opj_codec_private::m_codec, opj_codec_private::m_codec_data, opj_codec_private::m_decompression, opj_codec_private::m_event_mgr, and OPJ_FALSE.

void OPJ_CALLCONV opj_set_default_decoder_parameters ( opj_dparameters_t parameters)
void OPJ_CALLCONV opj_set_default_encoder_parameters ( opj_cparameters_t parameters)

Set encoding parameters to default values, that means :

  • Lossless
  • 1 tile
  • Size of precinct : 2^15 x 2^15 (means 1 precinct)
  • Size of code-block : 64 x 64
  • Number of resolutions: 6
  • No SOP marker in the codestream
  • No EPH marker in the codestream
  • No sub-sampling in x or y direction
  • No mode switch activated
  • Progression order: LRCP
  • No index file
  • No ROI upshifted
  • No offset of the origin of the image
  • No offset of the origin of the tiles
  • Reversible DWT 5-3
Parameters
parametersCompression parameters

References opj_cparameters::cblockh_init, opj_cparameters::cblockw_init, opj_cparameters::cod_format, opj_cparameters::cp_cinema, opj_cparameters::cp_disto_alloc, opj_cparameters::cp_fixed_alloc, opj_cparameters::cp_fixed_quality, opj_cparameters::cp_rsiz, opj_cparameters::decod_format, opj_cparameters::jpip_on, opj_cparameters::jpwl_epc_on, opj_cparameters::jpwl_hprot_MH, opj_cparameters::jpwl_hprot_TPH, opj_cparameters::jpwl_hprot_TPH_tileno, JPWL_MAX_NO_PACKSPECS, JPWL_MAX_NO_TILESPECS, opj_cparameters::jpwl_pprot, opj_cparameters::jpwl_pprot_packno, opj_cparameters::jpwl_pprot_tileno, opj_cparameters::jpwl_sens_addr, opj_cparameters::jpwl_sens_MH, opj_cparameters::jpwl_sens_range, opj_cparameters::jpwl_sens_size, opj_cparameters::jpwl_sens_TPH, opj_cparameters::jpwl_sens_TPH_tileno, opj_cparameters::max_comp_size, opj_cparameters::numresolution, OPJ_FALSE, OPJ_LRCP, OPJ_OFF, OPJ_PROFILE_NONE, OPJ_STD_RSIZ, opj_cparameters::prog_order, opj_cparameters::roi_compno, opj_cparameters::rsiz, opj_cparameters::subsampling_dx, opj_cparameters::subsampling_dy, opj_cparameters::tcp_numlayers, opj_cparameters::tcp_rates, and opj_cparameters::tp_on.

OPJ_BOOL OPJ_CALLCONV opj_set_error_handler ( opj_codec_t p_codec,
opj_msg_callback  p_callback,
void *  p_user_data 
)

Set the error handler use by openjpeg.

Parameters
p_codecthe codec previously initialise
p_callbackthe callback function which will be used
p_user_dataclient object where will be returned the message

References opj_event_mgr::error_handler, opj_event_mgr::m_error_data, opj_codec_private::m_event_mgr, OPJ_FALSE, and OPJ_TRUE.

Referenced by j2k_to_pnm().

OPJ_BOOL OPJ_CALLCONV opj_set_info_handler ( opj_codec_t p_codec,
opj_msg_callback  p_callback,
void *  p_user_data 
)

Set the info handler use by openjpeg.

Parameters
p_codecthe codec previously initialise
p_callbackthe callback function which will be used
p_user_dataclient object where will be returned the message

References opj_event_mgr::info_handler, opj_codec_private::m_event_mgr, opj_event_mgr::m_info_data, OPJ_FALSE, and OPJ_TRUE.

Referenced by j2k_to_pnm().

OPJ_BOOL OPJ_CALLCONV opj_set_MCT ( opj_cparameters_t parameters,
OPJ_FLOAT32 pEncodingMatrix,
OPJ_INT32 p_dc_shift,
OPJ_UINT32  pNbComp 
)

Sets the MCT matrix to use.

Parameters
parametersthe parameters to change.
pEncodingMatrixthe encoding matrix.
p_dc_shiftthe dc shift coefficients to use.
pNbCompthe number of components of the image.
Returns
true if the parameters could be set.

References opj_cparameters::irreversible, opj_cparameters::mct_data, OPJ_EXTENSION_MCT, OPJ_FALSE, OPJ_IS_PART2, opj_malloc, OPJ_PROFILE_PART2, OPJ_TRUE, opj_cparameters::rsiz, and opj_cparameters::tcp_mct.

OPJ_BOOL OPJ_CALLCONV opj_set_warning_handler ( opj_codec_t p_codec,
opj_msg_callback  p_callback,
void *  p_user_data 
)

Set the warning handler use by openjpeg.

Parameters
p_codecthe codec previously initialise
p_callbackthe callback function which will be used
p_user_dataclient object where will be returned the message

References opj_codec_private::m_event_mgr, opj_event_mgr::m_warning_data, OPJ_FALSE, OPJ_TRUE, and opj_event_mgr::warning_handler.

Referenced by j2k_to_pnm().

OPJ_BOOL OPJ_CALLCONV opj_setup_decoder ( opj_codec_t p_codec,
opj_dparameters_t parameters 
)

Setup the decoder with decompression parameters provided by the user and with the message handler provided by the user.

Parameters
p_codecdecompressor handler
parametersdecompression parameters
Returns
true if the decoder is correctly set

References EVT_ERROR, opj_codec_private::is_decompressor, opj_codec_private::m_codec, opj_codec_private::m_codec_data, opj_codec_private::m_decompression, opj_codec_private::m_event_mgr, opj_event_msg(), OPJ_FALSE, and OPJ_TRUE.

Referenced by j2k_to_pnm().

OPJ_BOOL OPJ_CALLCONV opj_setup_encoder ( opj_codec_t p_codec,
opj_cparameters_t parameters,
opj_image_t image 
)

Setup the encoder parameters using the current image and using user parameters.

Parameters
p_codecCompressor handle
parametersCompression parameters
imageInput filled image

References opj_codec_private::is_decompressor, opj_codec_private::m_codec, opj_codec_private::m_codec_data, opj_codec_private::m_compression, opj_codec_private::m_event_mgr, and OPJ_FALSE.

static OPJ_OFF_T opj_skip_from_file ( OPJ_OFF_T  p_nb_bytes,
FILE *  p_user_data 
)
static

References OPJ_FSEEK.

Referenced by opj_stream_create_file_stream().

OPJ_BOOL OPJ_CALLCONV opj_start_compress ( opj_codec_t p_codec,
opj_image_t p_image,
opj_stream_t p_stream 
)

Start to compress the current image.

Parameters
p_codecCompressor handle
imageInput filled image
p_streamInput stgream

References opj_codec_private::is_decompressor, opj_codec_private::m_codec, opj_codec_private::m_codec_data, opj_codec_private::m_compression, opj_codec_private::m_event_mgr, and OPJ_FALSE.

opj_stream_t* OPJ_CALLCONV opj_stream_create_default_file_stream ( const char *  fname,
OPJ_BOOL  p_is_read_stream 
)

Create a stream from a file identified with its filename with default parameters (helper function)

Parameters
fnamethe filename of the file to stream
p_is_read_streamwhether the stream is a read stream (true) or not (false)

References OPJ_J2K_STREAM_CHUNK_SIZE, and opj_stream_create_file_stream().

Referenced by j2k_to_pnm().

opj_stream_t* OPJ_CALLCONV opj_stream_create_file_stream ( const char *  fname,
OPJ_SIZE_T  p_buffer_size,
OPJ_BOOL  p_is_read_stream 
)

Create a stream from a file identified with its filename with a specific buffer size.

Parameters
fnamethe filename of the file to stream
p_buffer_sizesize of the chunk used to stream
p_is_read_streamwhether the stream is a read stream (true) or not (false)

References opj_get_data_length_from_file(), opj_read_from_file(), opj_seek_from_file(), opj_skip_from_file(), opj_stream_create(), opj_stream_set_read_function(), opj_stream_set_seek_function(), opj_stream_set_skip_function(), opj_stream_set_user_data(), opj_stream_set_user_data_length(), opj_stream_set_write_function(), and opj_write_from_file().

Referenced by opj_stream_create_default_file_stream().

const char* OPJ_CALLCONV opj_version ( void  )

Referenced by opj_j2k_setup_encoder().

static OPJ_SIZE_T opj_write_from_file ( void *  p_buffer,
OPJ_SIZE_T  p_nb_bytes,
FILE *  p_file 
)
static
OPJ_BOOL OPJ_CALLCONV opj_write_tile ( opj_codec_t p_codec,
OPJ_UINT32  p_tile_index,
OPJ_BYTE p_data,
OPJ_UINT32  p_data_size,
opj_stream_t p_stream 
)

Writes a tile with the given data.

Parameters
p_codecthe jpeg2000 codec.
p_tile_indexthe index of the tile to write. At the moment, the tiles must be written from 0 to n-1 in sequence.
p_datapointer to the data to write. Data is arranged in sequence, data_comp0, then data_comp1, then ... NO INTERLEAVING should be set.
p_data_sizethis value os used to make sure the data being written is correct. The size must be equal to the sum for each component of tile_width * tile_height * component_size. component_size can be 1,2 or 4 bytes, depending on the precision of the given component.
p_streamthe stream to write data to.
Returns
true if the data could be written.

References opj_codec_private::is_decompressor, opj_codec_private::m_codec, opj_codec_private::m_codec_data, opj_codec_private::m_compression, opj_codec_private::m_event_mgr, and OPJ_FALSE.