OpenJPEG
2.4.0
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <assert.h>
#include "jp2k_encoder.h"
#include "j2kheader_manager.h"
#include "imgreg_manager.h"
#include "opj_inttypes.h"
Macros | |
#define | FCGI_stdout stdout |
#define | FCGI_stderr stderr |
#define | logstream stderr |
Functions | |
message_param_t * | search_message (Byte8_t class_id, Byte8_t in_class_id, Byte8_t csn, message_param_t *msg) |
search a message by class_id More... | |
Byte_t * | recons_codestream (msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte8_t csn, int fw, int fh, Byte8_t *codelen) |
reconstruct j2k codestream from JPT- (in future, JPP-) stream More... | |
Byte_t * | recons_j2k (msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte8_t csn, int fw, int fh, Byte8_t *j2klen) |
reconstruct j2k codestream from message queue More... | |
Byte_t * | add_emptyboxstream (placeholder_param_t *phld, Byte_t *jp2stream, Byte8_t *jp2len) |
Byte_t * | add_msgstream (message_param_t *message, Byte_t *origstream, Byte_t *j2kstream, Byte8_t *j2klen) |
Byte_t * | recons_jp2 (msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte8_t csn, Byte8_t *jp2len) |
reconstruct jp2 file codestream from message queue More... | |
OPJ_BOOL | isJPPstream (Byte8_t csn, msgqueue_param_t *msgqueue) |
Byte_t * | recons_codestream_from_JPTstream (msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte8_t csn, int fw, int fh, Byte8_t *j2klen) |
Byte_t * | recons_codestream_from_JPPstream (msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte8_t csn, int fw, int fh, Byte8_t *j2klen) |
Byte_t * | add_EOC (Byte_t *j2kstream, Byte8_t *j2klen) |
Byte_t * | add_mainhead_msgstream (msgqueue_param_t *msgqueue, Byte_t *origstream, Byte_t *j2kstream, Byte8_t csn, Byte8_t *j2klen) |
Byte8_t | get_last_tileID (msgqueue_param_t *msgqueue, Byte8_t csn, OPJ_BOOL isJPPstream) |
Byte_t * | add_emptytilestream (const Byte8_t tileID, Byte_t *j2kstream, Byte8_t *j2klen) |
Byte_t * | add_SOTmkr (Byte_t *j2kstream, Byte8_t *j2klen) |
Byte_t * | recons_bitstream (msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte_t *j2kstream, Byte8_t csn, Byte8_t tileID, SIZmarker_param_t SIZ, CODmarker_param_t COD, int mindeclev, int *max_reslev, Byte8_t *j2klen) |
Byte_t * | recons_LRCPbitstream (msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte_t *j2kstream, Byte8_t csn, Byte8_t tileID, SIZmarker_param_t SIZ, CODmarker_param_t COD, int mindeclev, int *max_reslev, Byte8_t *j2klen) |
Byte_t * | recons_RLCPbitstream (msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte_t *j2kstream, Byte8_t csn, Byte8_t tileID, SIZmarker_param_t SIZ, CODmarker_param_t COD, int mindeclev, int *max_reslev, Byte8_t *j2klen) |
Byte_t * | recons_RPCLbitstream (msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte_t *j2kstream, Byte8_t csn, Byte8_t tileID, SIZmarker_param_t SIZ, CODmarker_param_t COD, int mindeclev, int *max_reslev, Byte8_t *j2klen) |
Byte_t * | recons_PCRLbitstream (msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte_t *j2kstream, Byte8_t csn, Byte8_t tileID, SIZmarker_param_t SIZ, CODmarker_param_t COD, int mindeclev, int *max_reslev, Byte8_t *j2klen) |
Byte_t * | recons_CPRLbitstream (msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte_t *j2kstream, Byte8_t csn, Byte8_t tileID, SIZmarker_param_t SIZ, CODmarker_param_t COD, int mindeclev, int *max_reslev, Byte8_t *j2klen) |
int | comp_numOfprcts (Byte8_t tileID, SIZmarker_param_t SIZ, CODmarker_param_t COD, int r) |
Byte8_t | comp_seqID (Byte8_t tileID, SIZmarker_param_t SIZ, CODmarker_param_t COD, int r, int p) |
Byte_t * | recons_packet (msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte_t *j2kstream, Byte8_t csn, Byte8_t tileID, SIZmarker_param_t SIZ, CODmarker_param_t COD, int *max_reslev, int comp_idx, int res_idx, int prct_idx, int lay_idx, Byte8_t *j2klen) |
Byte_t * | recons_precinct (msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte_t *j2kstream, Byte8_t csn, Byte8_t tileID, SIZmarker_param_t SIZ, CODmarker_param_t COD, int *max_reslev, int comp_idx, int res_idx, Byte8_t seqID, Byte8_t *j2klen) |
Byte_t * | add_padding (Byte8_t padding, Byte_t *j2kstream, Byte8_t *j2klen) |
Byte_t * | gene_msgstream (message_param_t *message, Byte_t *stream, Byte8_t *length) |
Byte_t * | gene_emptytilestream (const Byte8_t tileID, Byte8_t *length) |
Byte_t * | recons_j2kmainhead (msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte8_t csn, Byte8_t *j2klen) |
reconstruct j2k codestream of mainheader from message queue More... | |
#define FCGI_stderr stderr |
Referenced by isJPPstream(), and recons_bitstream().
#define FCGI_stdout stdout |
#define logstream stderr |
Byte_t * add_emptyboxstream | ( | placeholder_param_t * | phld, |
Byte_t * | jp2stream, | ||
Byte8_t * | jp2len | ||
) |
References big4(), big8(), opj_free(), opj_malloc(), placeholder_param::OrigBH, and placeholder_param::OrigBHlen.
Referenced by recons_j2k(), and recons_jp2().
References gene_emptytilestream(), opj_free(), and opj_malloc().
Referenced by isJPPstream(), recons_codestream_from_JPPstream(), and recons_codestream_from_JPTstream().
References opj_free(), and opj_malloc().
Referenced by recons_codestream_from_JPPstream(), recons_codestream_from_JPTstream(), and recons_jp2().
Byte_t * add_msgstream | ( | message_param_t * | message, |
Byte_t * | origstream, | ||
Byte_t * | j2kstream, | ||
Byte8_t * | j2klen | ||
) |
References gene_msgstream(), opj_free(), and opj_malloc().
Referenced by add_mainhead_msgstream(), recons_codestream_from_JPPstream(), recons_codestream_from_JPTstream(), recons_j2k(), recons_jp2(), recons_packet(), and recons_precinct().
References opj_free(), and opj_malloc().
Referenced by comp_numOfprcts(), recons_packet(), and recons_precinct().
References opj_free(), opj_malloc(), recons_CPRLbitstream(), recons_LRCPbitstream(), recons_PCRLbitstream(), recons_RLCPbitstream(), and recons_RPCLbitstream().
Referenced by recons_codestream_from_JPPstream(), and recons_codestream_from_JPTstream().
int comp_numOfprcts | ( | Byte8_t | tileID, |
SIZmarker_param_t | SIZ, | ||
CODmarker_param_t | COD, | ||
int | r | ||
) |
References add_padding(), get_tile_XSiz(), get_tile_YSiz(), CODmarker_param::numOfdecomp, CODmarker_param::XPsiz, and CODmarker_param::YPsiz.
Referenced by comp_seqID(), recons_bitstream(), recons_CPRLbitstream(), recons_LRCPbitstream(), recons_PCRLbitstream(), recons_RLCPbitstream(), and recons_RPCLbitstream().
Byte8_t comp_seqID | ( | Byte8_t | tileID, |
SIZmarker_param_t | SIZ, | ||
CODmarker_param_t | COD, | ||
int | r, | ||
int | p | ||
) |
References comp_numOfprcts().
Referenced by recons_bitstream(), recons_CPRLbitstream(), recons_packet(), and recons_PCRLbitstream().
References opj_malloc().
Referenced by add_emptytilestream(), and search_message().
Byte_t * gene_msgstream | ( | message_param_t * | message, |
Byte_t * | stream, | ||
Byte8_t * | length | ||
) |
References message_param::length, opj_malloc(), and message_param::res_offset.
Referenced by add_msgstream(), and search_message().
Byte8_t get_last_tileID | ( | msgqueue_param_t * | msgqueue, |
Byte8_t | csn, | ||
OPJ_BOOL | isJPPstream | ||
) |
OPJ_BOOL isJPPstream | ( | Byte8_t | csn, |
msgqueue_param_t * | msgqueue | ||
) |
References add_emptytilestream(), add_mainhead_msgstream(), message_param::class_id, message_param::csn, FCGI_stderr, msgqueue_param::first, get_last_tileID(), message_param::next, OPJ_FALSE, and OPJ_TRUE.
Referenced by recons_codestream(), and recons_jp2().
Byte_t * recons_bitstream | ( | msgqueue_param_t * | msgqueue, |
Byte_t * | jpipstream, | ||
Byte_t * | j2kstream, | ||
Byte8_t | csn, | ||
Byte8_t | tileID, | ||
SIZmarker_param_t | SIZ, | ||
CODmarker_param_t | COD, | ||
int | mindeclev, | ||
int * | max_reslev, | ||
Byte8_t * | j2klen | ||
) |
References comp_numOfprcts(), comp_seqID(), FCGI_stderr, OPJ_CPRL, OPJ_LRCP, OPJ_PCRL, OPJ_RLCP, OPJ_RPCL, CODmarker_param::prog_order, recons_CPRLbitstream(), recons_LRCPbitstream(), recons_packet(), recons_PCRLbitstream(), recons_RLCPbitstream(), and recons_RPCLbitstream().
Referenced by recons_codestream_from_JPPstream(), and recons_codestream_from_JPTstream().
Byte_t * recons_codestream | ( | msgqueue_param_t * | msgqueue, |
Byte_t * | jpipstream, | ||
Byte8_t | csn, | ||
int | fw, | ||
int | fh, | ||
Byte8_t * | codelen | ||
) |
reconstruct j2k codestream from JPT- (in future, JPP-) stream
[in] | msgqueue | message queue pointer |
[in] | jpipstream | original JPT- JPP- stream |
[in] | csn | codestream number |
[in] | fw | reconstructing image frame width |
[in] | fh | reconstructing image frame height |
[out] | codelen | codestream length |
References isJPPstream(), recons_codestream_from_JPPstream(), and recons_codestream_from_JPTstream().
Referenced by recons_j2k(), and recons_jp2().
Byte_t * recons_codestream_from_JPPstream | ( | msgqueue_param_t * | msgqueue, |
Byte_t * | jpipstream, | ||
Byte8_t | csn, | ||
int | fw, | ||
int | fh, | ||
Byte8_t * | j2klen | ||
) |
References add_emptytilestream(), add_EOC(), add_mainhead_msgstream(), add_msgstream(), add_SOTmkr(), message_param::bin_offset, comp_decomplev(), SIZmarker_param::Csiz, delete_COD(), msgqueue_param::first, get_last_tileID(), get_mainheader_from_j2kstream(), message_param::length, modify_mainheader(), modify_tileheader(), message_param::next, CODmarker_param::numOfdecomp, OPJ_FALSE, OPJ_TRUE, recons_bitstream(), search_message(), TILE_HEADER_MSG, SIZmarker_param::Xsiz, and SIZmarker_param::Ysiz.
Referenced by recons_codestream(), and recons_jp2().
Byte_t * recons_codestream_from_JPTstream | ( | msgqueue_param_t * | msgqueue, |
Byte_t * | jpipstream, | ||
Byte8_t | csn, | ||
int | fw, | ||
int | fh, | ||
Byte8_t * | j2klen | ||
) |
References add_emptytilestream(), add_EOC(), add_mainhead_msgstream(), add_msgstream(), add_SOTmkr(), message_param::aux, message_param::bin_offset, comp_decomplev(), EXT_TILE_MSG, msgqueue_param::first, get_last_tileID(), get_mainheader_from_j2kstream(), message_param::length, message_param::next, OPJ_FALSE, OPJ_TRUE, recons_bitstream(), search_message(), TILE_MSG, SIZmarker_param::Xsiz, and SIZmarker_param::Ysiz.
Referenced by recons_codestream(), and recons_jp2().
Byte_t * recons_CPRLbitstream | ( | msgqueue_param_t * | msgqueue, |
Byte_t * | jpipstream, | ||
Byte_t * | j2kstream, | ||
Byte8_t | csn, | ||
Byte8_t | tileID, | ||
SIZmarker_param_t | SIZ, | ||
CODmarker_param_t | COD, | ||
int | mindeclev, | ||
int * | max_reslev, | ||
Byte8_t * | j2klen | ||
) |
References comp_numOfprcts(), comp_seqID(), SIZmarker_param::Csiz, CODmarker_param::numOfdecomp, recons_precinct(), and CODmarker_param::Scod.
Referenced by add_SOTmkr(), and recons_bitstream().
Byte_t* recons_j2k | ( | msgqueue_param_t * | msgqueue, |
Byte_t * | jpipstream, | ||
Byte8_t | csn, | ||
int | fw, | ||
int | fh, | ||
Byte8_t * | j2klen | ||
) |
reconstruct j2k codestream from message queue
[in] | msgqueue | message queue pointer |
[in] | jpipstream | original jpt- jpp- stream |
[in] | csn | codestream number |
[in] | fw | reconstructing image frame width |
[in] | fh | reconstructing image frame height |
[out] | j2klen | pointer to the j2k codestream length |
References add_emptyboxstream(), add_msgstream(), and recons_codestream().
Referenced by decode_jpip(), and jpipstream_to_pnm().
Byte_t* recons_j2kmainhead | ( | msgqueue_param_t * | msgqueue, |
Byte_t * | jpipstream, | ||
Byte8_t | csn, | ||
Byte8_t * | j2klen | ||
) |
reconstruct j2k codestream of mainheader from message queue
[in] | msgqueue | message queue pointer |
[in] | jpipstream | original jpt- jpp- stream |
[in] | csn | codestream number |
[out] | j2klen | pointer to the j2k codestream length |
References add_mainhead_msgstream().
Referenced by get_SIZ_from_jpipstream().
Byte_t* recons_jp2 | ( | msgqueue_param_t * | msgqueue, |
Byte_t * | jpipstream, | ||
Byte8_t | csn, | ||
Byte8_t * | jp2len | ||
) |
reconstruct jp2 file codestream from message queue
[in] | msgqueue | message queue pointer |
[in] | jpipstream | original jpt- jpp- stream |
[in] | csn | codestream number |
[out] | jp2len | pointer to the jp2 codestream length |
References add_emptyboxstream(), add_EOC(), add_msgstream(), msgqueue_param::first, isJPPstream(), METADATA_MSG, message_param::next, opj_free(), placeholder_param::OrigBH, placeholder_param::OrigBHlen, message_param::phld, recons_codestream(), recons_codestream_from_JPPstream(), recons_codestream_from_JPTstream(), and search_message().
Referenced by decode_jpip(), and handle_JP2saveMSG().
Byte_t * recons_LRCPbitstream | ( | msgqueue_param_t * | msgqueue, |
Byte_t * | jpipstream, | ||
Byte_t * | j2kstream, | ||
Byte8_t | csn, | ||
Byte8_t | tileID, | ||
SIZmarker_param_t | SIZ, | ||
CODmarker_param_t | COD, | ||
int | mindeclev, | ||
int * | max_reslev, | ||
Byte8_t * | j2klen | ||
) |
References comp_numOfprcts(), SIZmarker_param::Csiz, CODmarker_param::numOfdecomp, CODmarker_param::numOflayers, recons_packet(), and CODmarker_param::Scod.
Referenced by add_SOTmkr(), and recons_bitstream().
Byte_t * recons_packet | ( | msgqueue_param_t * | msgqueue, |
Byte_t * | jpipstream, | ||
Byte_t * | j2kstream, | ||
Byte8_t | csn, | ||
Byte8_t | tileID, | ||
SIZmarker_param_t | SIZ, | ||
CODmarker_param_t | COD, | ||
int * | max_reslev, | ||
int | comp_idx, | ||
int | res_idx, | ||
int | prct_idx, | ||
int | lay_idx, | ||
Byte8_t * | j2klen | ||
) |
References add_msgstream(), add_padding(), message_param::bin_offset, comp_precinct_id(), comp_seqID(), SIZmarker_param::Csiz, msgqueue_param::first, message_param::length, message_param::next, OPJ_FALSE, OPJ_TRUE, PRECINCT_MSG, CODmarker_param::Scod, search_message(), SIZmarker_param::XTnum, and SIZmarker_param::YTnum.
Referenced by recons_bitstream(), recons_LRCPbitstream(), and recons_RLCPbitstream().
Byte_t * recons_PCRLbitstream | ( | msgqueue_param_t * | msgqueue, |
Byte_t * | jpipstream, | ||
Byte_t * | j2kstream, | ||
Byte8_t | csn, | ||
Byte8_t | tileID, | ||
SIZmarker_param_t | SIZ, | ||
CODmarker_param_t | COD, | ||
int | mindeclev, | ||
int * | max_reslev, | ||
Byte8_t * | j2klen | ||
) |
References comp_numOfprcts(), comp_seqID(), SIZmarker_param::Csiz, CODmarker_param::numOfdecomp, recons_precinct(), and CODmarker_param::Scod.
Referenced by add_SOTmkr(), and recons_bitstream().
Byte_t * recons_precinct | ( | msgqueue_param_t * | msgqueue, |
Byte_t * | jpipstream, | ||
Byte_t * | j2kstream, | ||
Byte8_t | csn, | ||
Byte8_t | tileID, | ||
SIZmarker_param_t | SIZ, | ||
CODmarker_param_t | COD, | ||
int * | max_reslev, | ||
int | comp_idx, | ||
int | res_idx, | ||
Byte8_t | seqID, | ||
Byte8_t * | j2klen | ||
) |
References add_msgstream(), add_padding(), message_param::bin_offset, comp_precinct_id(), SIZmarker_param::Csiz, msgqueue_param::first, message_param::last_byte, message_param::length, message_param::next, CODmarker_param::numOflayers, OPJ_FALSE, OPJ_TRUE, PRECINCT_MSG, CODmarker_param::Scod, search_message(), SIZmarker_param::XTnum, and SIZmarker_param::YTnum.
Referenced by recons_CPRLbitstream(), recons_PCRLbitstream(), recons_RLCPbitstream(), and recons_RPCLbitstream().
Byte_t * recons_RLCPbitstream | ( | msgqueue_param_t * | msgqueue, |
Byte_t * | jpipstream, | ||
Byte_t * | j2kstream, | ||
Byte8_t | csn, | ||
Byte8_t | tileID, | ||
SIZmarker_param_t | SIZ, | ||
CODmarker_param_t | COD, | ||
int | mindeclev, | ||
int * | max_reslev, | ||
Byte8_t * | j2klen | ||
) |
References comp_numOfprcts(), SIZmarker_param::Csiz, CODmarker_param::numOfdecomp, CODmarker_param::numOflayers, recons_packet(), recons_precinct(), and CODmarker_param::Scod.
Referenced by add_SOTmkr(), and recons_bitstream().
Byte_t * recons_RPCLbitstream | ( | msgqueue_param_t * | msgqueue, |
Byte_t * | jpipstream, | ||
Byte_t * | j2kstream, | ||
Byte8_t | csn, | ||
Byte8_t | tileID, | ||
SIZmarker_param_t | SIZ, | ||
CODmarker_param_t | COD, | ||
int | mindeclev, | ||
int * | max_reslev, | ||
Byte8_t * | j2klen | ||
) |
References comp_numOfprcts(), SIZmarker_param::Csiz, CODmarker_param::numOfdecomp, recons_precinct(), and CODmarker_param::Scod.
Referenced by add_SOTmkr(), and recons_bitstream().
message_param_t * search_message | ( | Byte8_t | class_id, |
Byte8_t | in_class_id, | ||
Byte8_t | csn, | ||
message_param_t * | msg | ||
) |
search a message by class_id
[in] | class_id | class identifiers |
[in] | in_class_id | in-class identifiers, -1 means any |
[in] | csn | codestream number |
[in] | msg | first message pointer of the searching list |
References message_param::class_id, message_param::csn, gene_emptytilestream(), gene_msgstream(), message_param::in_class_id, and message_param::next.
Referenced by add_mainhead_msgstream(), recons_codestream_from_JPPstream(), recons_codestream_from_JPTstream(), recons_jp2(), recons_packet(), and recons_precinct().