OpenJPEG  2.4.0
Macros | Functions
byte_manager.c File Reference
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/stat.h>
#include "byte_manager.h"

Macros

#define FCGI_stdout   stdout
 
#define FCGI_stderr   stderr
 
#define logstream   stderr
 

Functions

Byte_tfetch_bytes (int fd, OPJ_OFF_T offset, OPJ_SIZE_T size)
 fetch bytes of data in file stream More...
 
Byte_t fetch_1byte (int fd, OPJ_OFF_T offset)
 fetch a 1-byte Byte codes in file stream More...
 
Byte2_t fetch_2bytebigendian (int fd, OPJ_OFF_T offset)
 fetch a 2-byte big endian Byte codes in file stream More...
 
Byte4_t fetch_4bytebigendian (int fd, OPJ_OFF_T offset)
 fetch a 4-byte big endian Byte codes in file stream More...
 
Byte8_t fetch_8bytebigendian (int fd, OPJ_OFF_T offset)
 fetch a 8-byte big endian Byte codes in file stream More...
 
Byte2_t big2 (Byte_t *buf)
 convert 2-byte big endian Byte codes to number More...
 
Byte4_t big4 (Byte_t *buf)
 convert 4-byte big endian Byte codes to number More...
 
Byte8_t big8 (Byte_t *buf)
 convert 8-byte big endian Byte codes to number More...
 
void modify_4Bytecode (Byte4_t code, Byte_t *stream)
 modify 4Byte code in a codestream More...
 
OPJ_OFF_T get_filesize (int fd)
 Get file size. More...
 

Macro Definition Documentation

#define FCGI_stderr   stderr
#define FCGI_stdout   stdout
#define logstream   stderr

Function Documentation

Byte2_t big2 ( Byte_t buf)

convert 2-byte big endian Byte codes to number

Parameters
[in]bufByte codes
Returns
resolved number

Referenced by fetch_2bytebigendian(), gene_ihdrbox(), get_CODmkrdata_from_j2kstream(), get_mainheader_from_j2kstream(), get_SIZmkrdata_from_j2kstream(), and modify_COCmkrstream().

Byte4_t big4 ( Byte_t buf)

convert 4-byte big endian Byte codes to number

Parameters
[in]bufByte codes
Returns
resolved number

Referenced by add_emptyboxstream(), big8(), fetch_4bytebigendian(), gene_boxbyOffinStream(), gene_boxbyOffset(), gene_boxbyType(), gene_boxbyTypeinStream(), gene_ihdrbox(), get_SIZmkrdata_from_j2kstream(), and parse_phld().

Byte8_t big8 ( Byte_t buf)

convert 8-byte big endian Byte codes to number

Parameters
[in]bufByte codes
Returns
resolved number

References big4().

Referenced by add_emptyboxstream(), fetch_8bytebigendian(), gene_boxbyOffinStream(), gene_boxbyOffset(), gene_boxbyType(), gene_boxbyTypeinStream(), and parse_phld().

Byte_t fetch_1byte ( int  fd,
OPJ_OFF_T  offset 
)

fetch a 1-byte Byte codes in file stream

Parameters
[in]fdfile discriptor
[in]offsetstart Byte position
Returns
fetched codes

References FCGI_stderr, and FCGI_stdout.

Referenced by fetch_codestream1byte(), and fetch_DBox1byte().

Byte2_t fetch_2bytebigendian ( int  fd,
OPJ_OFF_T  offset 
)

fetch a 2-byte big endian Byte codes in file stream

Parameters
[in]fdfile discriptor
[in]offsetstart Byte position
Returns
fetched codes

References big2(), FCGI_stderr, and fetch_bytes().

Referenced by fetch_codestream2bytebigendian(), and fetch_DBox2bytebigendian().

Byte4_t fetch_4bytebigendian ( int  fd,
OPJ_OFF_T  offset 
)

fetch a 4-byte big endian Byte codes in file stream

Parameters
[in]fdfile discriptor
[in]offsetstart Byte position
Returns
fetched codes

References big4(), FCGI_stderr, and fetch_bytes().

Referenced by fetch_codestream4bytebigendian(), fetch_DBox4bytebigendian(), and gene_boxheader().

Byte8_t fetch_8bytebigendian ( int  fd,
OPJ_OFF_T  offset 
)

fetch a 8-byte big endian Byte codes in file stream

Parameters
[in]fdfile discriptor
[in]offsetstart Byte position
Returns
fetched codes

References big8(), FCGI_stderr, and fetch_bytes().

Referenced by fetch_DBox8bytebigendian(), and gene_boxheader().

Byte_t* fetch_bytes ( int  fd,
OPJ_OFF_T  offset,
OPJ_SIZE_T  size 
)

fetch bytes of data in file stream

Parameters
[in]fdfile discriptor
[in]offsetstart Byte position
[in]sizeByte length
Returns
pointer to the fetched data

References FCGI_stderr, and FCGI_stdout.

Referenced by add_body_stream(), fetch_2bytebigendian(), fetch_4bytebigendian(), fetch_8bytebigendian(), fetch_codestreambytes(), fetch_DBoxbytes(), fetch_headbytes(), gene_boxbyOffset(), gene_boxbyType(), and gene_boxheader().

OPJ_OFF_T get_filesize ( int  fd)

Get file size.

Parameters
[in]fdfile discriptor
Returns
file size

References FCGI_stderr, and FCGI_stdout.

Referenced by const_metadatalist(), fread_jpip(), gene_boxbyType(), and parse_jp2file().

void modify_4Bytecode ( Byte4_t  code,
Byte_t stream 
)

modify 4Byte code in a codestream

Parameters
[in]codecode value
[out]streammodifying codestream

Referenced by modify_SIZmkrstream(), and modify_tileheader().