OpenJPEG: msgqueue_manager.c File Reference

OpenJPEG 2.5.4

Macros | Functions
msgqueue_manager.c File Reference
`#include <stdio.h>`
`#include <stdlib.h>`
`#include <sys/types.h>`
`#include <sys/stat.h>`
`#include <string.h>`
`#include <ctype.h>`
`#include <assert.h>`
`#include <limits.h>`
`#include <inttypes.h>`
`#include <unistd.h>`
`#include "msgqueue_manager.h"`
`#include "metadata_manager.h"`
`#include "index_manager.h"`

## Macros
#define | FCGI_stdout stdout
#define | FCGI_stderr stderr
#define | logstream stderr

## Functions
msgqueue_param_t * | gene_msgqueue (OPJ_BOOL stateless, cachemodel_param_t *cachemodel)
| generate message queue
void | delete_msgqueue (msgqueue_param_t **msgqueue)
| delete message queue
void | print_msgqueue (msgqueue_param_t *msgqueue)
| print message queue
void | enqueue_message (message_param_t *msg, msgqueue_param_t *msgqueue)
void | enqueue_mainheader (msgqueue_param_t *msgqueue)
| enqueue main header data-bin into message queue
void | enqueue_tileheader (int tile_id, msgqueue_param_t *msgqueue)
| enqueue tile headers data-bin into message queue
void | enqueue_tile (Byte4_t tile_id, int level, msgqueue_param_t *msgqueue)
| enqueue tile data-bin into message queue
void | enqueue_precinct (int seq_id, int tile_id, int comp_id, int layers, msgqueue_param_t *msgqueue)
| enqueue precinct data-bin into message queue
Byte8_t | comp_precinct_id (int t, int c, int s, int num_components, int num_tiles)
| compute precinct ID A.3.2.1
void | enqueue_box (Byte8_t meta_id, boxlist_param_t *boxlist, msgqueue_param_t *msgqueue, Byte8_t *binOffset)
void | enqueue_phld (Byte8_t meta_id, placeholderlist_param_t *phldlist, msgqueue_param_t *msgqueue, Byte8_t *binOffset)
void | enqueue_boxcontents (Byte8_t meta_id, boxcontents_param_t *boxcontents, msgqueue_param_t *msgqueue, Byte8_t *binOffset)
void | enqueue_metadata (Byte8_t meta_id, msgqueue_param_t *msgqueue)
| enqueue Metadata-bin into message queue
message_param_t * | gene_metamsg (Byte8_t meta_id, Byte8_t binoffset, Byte8_t length, OPJ_OFF_T res_offset, placeholder_param_t *phld, Byte8_t csn)
void | add_bin_id_vbas_stream (Byte_t bb, Byte_t c, Byte8_t in_class_id, int tmpfd)
void | add_vbas_stream (Byte8_t code, int tmpfd)
void | add_body_stream (message_param_t *msg, int fd, int tmpfd)
void | add_placeholder_stream (placeholder_param_t *phld, int tmpfd)
void | recons_stream_from_msgqueue (msgqueue_param_t *msgqueue, int tmpfd)
| reconstruct JPT/JPP-stream from message queue
void | add_vbas_with_bytelen_stream (Byte8_t code, int bytelength, int tmpfd)
void | print_binarycode (Byte8_t n, int segmentlen)
void | add_bigendian_bytestream (Byte8_t code, int bytelength, int tmpfd)
Byte_t * | parse_bin_id_vbas (Byte_t *streamptr, Byte_t *bb, Byte_t *c, Byte8_t *in_class_id)
Byte_t * | parse_vbas (Byte_t *streamptr, Byte8_t *elem)
void | parse_JPIPstream (Byte_t *JPIPstream, Byte8_t streamlen, OPJ_OFF_T offset, msgqueue_param_t *msgqueue)
| parse JPT- JPP- stream to message queue
void | parse_metadata (metadata_param_t *metadata, message_param_t *msg, Byte_t *stream)
void | parse_metamsg (msgqueue_param_t *msgqueue, Byte_t *stream, Byte8_t streamlen, metadatalist_param_t *metadatalist)
| parse JPT- JPP- stream to message queue
placeholder_param_t * | parse_phld (Byte_t *datastream, Byte8_t metalength)
void | delete_message_in_msgqueue (message_param_t **msg, msgqueue_param_t *msgqueue)
| delete a message in msgqueue

## Macro Definition Documentation

## ◆ FCGI_stderr

#define FCGI_stderr stderr

## ◆ FCGI_stdout

#define FCGI_stdout stdout

## ◆ logstream

#define logstream stderr

## Function Documentation

## ◆ add_bigendian_bytestream()

void add_bigendian_bytestream | ( | Byte8_t | code,
|  | int | bytelength,
|  | int | tmpfd )

References FCGI_stderr.

Referenced by add_placeholder_stream().

## ◆ add_bin_id_vbas_stream()

void add_bin_id_vbas_stream | ( | Byte_t | bb,
|  | Byte_t | c,
|  | Byte8_t | in_class_id,
|  | int | tmpfd )

References add_vbas_with_bytelen_stream().

Referenced by recons_stream_from_msgqueue().

## ◆ add_body_stream()

void add_body_stream | ( | message_param_t * | msg,
|  | int | fd,
|  | int | tmpfd )

References FCGI_stderr, fetch_bytes(), message_param::length, opj_free(), and message_param::res_offset.

Referenced by recons_stream_from_msgqueue().

## ◆ add_placeholder_stream()

void add_placeholder_stream | ( | placeholder_param_t * | phld,
|  | int | tmpfd )

References add_bigendian_bytestream(), FCGI_stderr, placeholder_param::Flags, placeholder_param::LBox, placeholder_param::OrigBH, placeholder_param::OrigBHlen, placeholder_param::OrigID, and placeholder_param::TBox.

Referenced by recons_stream_from_msgqueue().

## ◆ add_vbas_stream()

void add_vbas_stream | ( | Byte8_t | code,
|  | int | tmpfd )

References add_vbas_with_bytelen_stream().

Referenced by recons_stream_from_msgqueue().

## ◆ add_vbas_with_bytelen_stream()

void add_vbas_with_bytelen_stream | ( | Byte8_t | code,
|  | int | bytelength,
|  | int | tmpfd )

References FCGI_stderr.

Referenced by add_bin_id_vbas_stream(), and add_vbas_stream().

## ◆ comp_precinct_id()

Byte8_t comp_precinct_id | ( | int | t,
|  | int | c,
|  | int | s,
|  | int | num_components,
|  | int | num_tiles )

compute precinct ID A.3.2.1

Parameters

  [in] | t | tile index
  [in] | c | component index
  [in] | s | sequence number
  [in] | num_components | total number of components
  [in] | num_tiles | total number of tiles

Returns
  precicnt id

Referenced by enqueue_precinct(), recons_packet(), and recons_precinct().

## ◆ delete_message_in_msgqueue()

void delete_message_in_msgqueue | ( | message_param_t ** | message,
|  | msgqueue_param_t * | msgqueue )

delete a message in msgqueue

Parameters

  [in] | message | address of the deleting message pointer
  [in] | msgqueue | message queue pointer

References msgqueue_param::first, msgqueue_param::last, message_param::next, and opj_free().

## ◆ delete_msgqueue()

void delete_msgqueue | ( | msgqueue_param_t ** | msgqueue | ) |

delete message queue

Parameters

  [in] | msgqueue | address of the message queue pointer

References delete_cachemodel(), message_param::next, and opj_free().

Referenced by destroy_jpipdecoder(), and terminate_dec_server().

## ◆ enqueue_box()

void enqueue_box | ( | Byte8_t | meta_id,
|  | boxlist_param_t * | boxlist,
|  | msgqueue_param_t * | msgqueue,
|  | Byte8_t * | binOffset )

References msgqueue_param::cachemodel, target_param::csn, enqueue_message(), boxlist_param::first, gene_metamsg(), box_param::length, box_param::next, box_param::offset, and cachemodel_param::target.

Referenced by enqueue_metadata().

## ◆ enqueue_boxcontents()

void enqueue_boxcontents | ( | Byte8_t | meta_id,
|  | boxcontents_param_t * | boxcontents,
|  | msgqueue_param_t * | msgqueue,
|  | Byte8_t * | binOffset )

References msgqueue_param::cachemodel, target_param::csn, enqueue_message(), gene_metamsg(), boxcontents_param::length, boxcontents_param::offset, and cachemodel_param::target.

Referenced by enqueue_metadata().

## ◆ enqueue_mainheader()

void enqueue_mainheader | ( | msgqueue_param_t * | msgqueue | ) |

enqueue main header data-bin into message queue

Parameters

  [in,out] | msgqueue | message queue pointer

References message_param::aux, message_param::bin_offset, msgqueue_param::cachemodel, message_param::class_id, target_param::codeidx, message_param::csn, target_param::csn, enqueue_message(), message_param::in_class_id, message_param::last_byte, message_param::length, MAINHEADER_MSG, index_param::mhead_length, cachemodel_param::mhead_model, message_param::next, index_param::offset, opj_malloc(), OPJ_TRUE, message_param::phld, message_param::res_offset, and cachemodel_param::target.

Referenced by gene_JPIPstream().

## ◆ enqueue_message()

void enqueue_message | ( | message_param_t * | msg,
|  | msgqueue_param_t * | msgqueue )

References msgqueue_param::first, msgqueue_param::last, and message_param::next.

Referenced by enqueue_box(), enqueue_boxcontents(), enqueue_mainheader(), enqueue_phld(), enqueue_precinct(), enqueue_tile(), and enqueue_tileheader().

## ◆ enqueue_metadata()

void enqueue_metadata | ( | Byte8_t | meta_id,
|  | msgqueue_param_t * | msgqueue )

enqueue Metadata-bin into message queue

Parameters

  [in] | meta_id | metadata-bin id
  [in,out] | msgqueue | message queue pointer

References metadata_param::boxcontents, metadata_param::boxlist, msgqueue_param::cachemodel, target_param::codeidx, enqueue_box(), enqueue_boxcontents(), enqueue_phld(), FCGI_stderr, msgqueue_param::last, message_param::last_byte, index_param::metadatalist, OPJ_TRUE, metadata_param::placeholderlist, search_metadata(), and cachemodel_param::target.

Referenced by enqueue_metabins().

## ◆ enqueue_phld()

void enqueue_phld | ( | Byte8_t | meta_id,
|  | placeholderlist_param_t * | phldlist,
|  | msgqueue_param_t * | msgqueue,
|  | Byte8_t * | binOffset )

References msgqueue_param::cachemodel, target_param::csn, enqueue_message(), placeholderlist_param::first, gene_metamsg(), placeholder_param::LBox, placeholder_param::next, and cachemodel_param::target.

Referenced by enqueue_metadata().

## ◆ enqueue_precinct()

void enqueue_precinct | ( | int | seq_id,
|  | int | tile_id,
|  | int | comp_id,
|  | int | layers,
|  | msgqueue_param_t * | msgqueue )

enqueue precinct data-bin into message queue

Parameters

  [in] | seq_id | precinct sequence number within its tile
  [in] | tile_id | tile index
  [in] | comp_id | component number
  [in] | layers | num of layers
  [in,out] | msgqueue | message queue

References message_param::aux, message_param::bin_offset, msgqueue_param::cachemodel, message_param::class_id, index_param::COD, target_param::codeidx, comp_precinct_id(), SIZmarker_param::Csiz, message_param::csn, target_param::csn, enqueue_message(), get_elemLen(), get_elemOff(), get_nmax(), message_param::in_class_id, message_param::last_byte, message_param::length, message_param::next, CODmarker_param::numOflayers, index_param::offset, opj_malloc(), OPJ_TRUE, message_param::phld, cachemodel_param::pp_model, PRECINCT_MSG, index_param::precpacket, message_param::res_offset, index_param::SIZ, cachemodel_param::target, SIZmarker_param::XTnum, and SIZmarker_param::YTnum.

Referenced by enqueue_allprecincts(), and enqueue_precincts().

## ◆ enqueue_tile()

void enqueue_tile | ( | Byte4_t | tile_id,
|  | int | level,
|  | msgqueue_param_t * | msgqueue )

enqueue tile data-bin into message queue

Parameters

  [in] | tile_id | tile id starting from 0
  [in] | level | decomposition level
  [in,out] | msgqueue | message queue pointer

References message_param::aux, message_param::bin_offset, msgqueue_param::cachemodel, message_param::class_id, target_param::codeidx, message_param::csn, target_param::csn, enqueue_message(), EXT_TILE_MSG, FCGI_stderr, get_elemLen(), get_elemOff(), get_m(), get_nmax(), message_param::in_class_id, message_param::last_byte, message_param::length, message_param::next, index_param::offset, opj_malloc(), OPJ_TRUE, message_param::phld, message_param::res_offset, cachemodel_param::target, TILE_MSG, index_param::tilepart, and cachemodel_param::tp_model.

Referenced by enqueue_imagedata().

## ◆ enqueue_tileheader()

void enqueue_tileheader | ( | int | tile_id,
|  | msgqueue_param_t * | msgqueue )

enqueue tile headers data-bin into message queue

Parameters

  [in] | tile_id | tile id starting from 0
  [in,out] | msgqueue | message queue pointer

References message_param::aux, message_param::bin_offset, msgqueue_param::cachemodel, message_param::class_id, target_param::codeidx, message_param::csn, target_param::csn, enqueue_message(), get_elemOff(), message_param::in_class_id, message_param::last_byte, message_param::length, message_param::next, index_param::offset, opj_malloc(), OPJ_TRUE, message_param::phld, message_param::res_offset, cachemodel_param::target, cachemodel_param::th_model, TILE_HEADER_MSG, index_param::tileheader, index_param::tilepart, and mhixbox_param::tlen.

Referenced by enqueue_imagedata().

## ◆ gene_metamsg()

message_param_t * gene_metamsg | ( | Byte8_t | meta_id,
|  | Byte8_t | binoffset,
|  | Byte8_t | length,
|  | OPJ_OFF_T | res_offset,
|  | placeholder_param_t * | phld,
|  | Byte8_t | csn )

References message_param::aux, message_param::bin_offset, message_param::class_id, message_param::csn, message_param::in_class_id, message_param::last_byte, message_param::length, METADATA_MSG, message_param::next, OPJ_FALSE, opj_malloc(), message_param::phld, and message_param::res_offset.

Referenced by enqueue_box(), enqueue_boxcontents(), and enqueue_phld().

## ◆ gene_msgqueue()

msgqueue_param_t * gene_msgqueue | ( | OPJ_BOOL | stateless,
|  | cachemodel_param_t * | cachemodel )

generate message queue

Parameters

  [in] | stateless | if this is a stateless message queue
  [in] | cachemodel | cachemodel pointer

Returns
  generated message queue pointer

References msgqueue_param::cachemodel, msgqueue_param::first, msgqueue_param::last, opj_malloc(), and msgqueue_param::stateless.

Referenced by gene_JPIPstream(), init_dec_server(), and init_jpipdecoder().

## ◆ parse_bin_id_vbas()

Byte_t * parse_bin_id_vbas | ( | Byte_t * | streamptr,
|  | Byte_t * | bb,
|  | Byte_t * | c,
|  | Byte8_t * | in_class_id )

Referenced by parse_JPIPstream().

## ◆ parse_JPIPstream()

void parse_JPIPstream | ( | Byte_t * | JPIPstream,
|  | Byte8_t | streamlen,
|  | OPJ_OFF_T | offset,
|  | msgqueue_param_t * | msgqueue )

parse JPT- JPP- stream to message queue

Parameters

  [in] | JPIPstream | JPT- JPP- stream data pointer
  [in] | streamlen | JPIPstream length
  [in] | offset | offset of the stream from the whole beginning
  [in,out] | msgqueue | adding message queue pointer

References message_param::aux, message_param::bin_offset, message_param::class_id, message_param::csn, msgqueue_param::first, message_param::in_class_id, msgqueue_param::last, message_param::last_byte, message_param::length, message_param::next, OPJ_FALSE, opj_malloc(), OPJ_TRUE, parse_bin_id_vbas(), parse_vbas(), message_param::phld, and message_param::res_offset.

Referenced by decode_jpip(), and handle_JPIPstreamMSG().

## ◆ parse_metadata()

void parse_metadata | ( | metadata_param_t * | metadata,
|  | message_param_t * | msg,
|  | Byte_t * | stream )

References metadata_param::boxcontents, metadata_param::boxlist, gene_boxbyOffinStream(), gene_boxcontents(), gene_boxlist(), gene_placeholderlist(), insert_box_into_list(), insert_placeholder_into_list(), message_param::length, parse_phld(), message_param::phld, metadata_param::placeholderlist, and message_param::res_offset.

Referenced by parse_metamsg().

## ◆ parse_metamsg()

void parse_metamsg | ( | msgqueue_param_t * | msgqueue,
|  | Byte_t * | stream,
|  | Byte8_t | streamlen,
|  | metadatalist_param_t * | metadatalist )

parse JPT- JPP- stream to message queue

Parameters

  [in] | msgqueue | reference message queue pointer
  [in] | stream | stream data pointer
  [in] | streamlen | stream length
  [in] | metadatalist | adding metadata list pointer

References message_param::class_id, msgqueue_param::first, gene_metadata(), message_param::in_class_id, insert_metadata_into_list(), METADATA_MSG, message_param::next, parse_metadata(), and message_param::res_offset.

Referenced by decode_jpip(), and handle_JPIPstreamMSG().

## ◆ parse_phld()

placeholder_param_t * parse_phld | ( | Byte_t * | datastream,
|  | Byte8_t | metalength )

References big4(), big8(), placeholder_param::Flags, placeholder_param::LBox, placeholder_param::next, opj_malloc(), placeholder_param::OrigBH, placeholder_param::OrigBHlen, placeholder_param::OrigID, and placeholder_param::TBox.

Referenced by parse_metadata().

## ◆ parse_vbas()

Byte_t * parse_vbas | ( | Byte_t * | streamptr,
|  | Byte8_t * | elem )

Referenced by parse_JPIPstream().

## ◆ print_binarycode()

void print_binarycode | ( | Byte8_t | n,
|  | int | segmentlen )

## ◆ print_msgqueue()

void print_msgqueue | ( | msgqueue_param_t * | msgqueue | ) |

print message queue

Parameters

  [in] | msgqueue | message queue pointer

References message_param::aux, message_param::bin_offset, message_param::class_id, message_param::csn, msgqueue_param::first, message_param::in_class_id, message_param::last_byte, message_param::length, logstream, message_param::next, message_param::phld, print_placeholder(), and message_param::res_offset.

Referenced by output_log().

## ◆ recons_stream_from_msgqueue()

void recons_stream_from_msgqueue | ( | msgqueue_param_t * | msgqueue,
|  | int | tmpfd )

reconstruct JPT/JPP-stream from message queue

Parameters

  [in] | msgqueue | message queue pointer
  [in] | tmpfd | file descriptor to write JPT/JPP-stream

References add_bin_id_vbas_stream(), add_body_stream(), add_placeholder_stream(), add_vbas_stream(), message_param::aux, message_param::bin_offset, msgqueue_param::cachemodel, message_param::class_id, message_param::csn, target_param::fd, msgqueue_param::first, message_param::in_class_id, message_param::last_byte, message_param::length, message_param::next, message_param::phld, and cachemodel_param::target.