OpenJPEG  2.5.0
ihdrbox_manager.h
Go to the documentation of this file.
1 /*
2  * $Id$
3  *
4  * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
5  * Copyright (c) 2002-2014, Professor Benoit Macq
6  * Copyright (c) 2010-2011, Kaori Hagihara
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  * 1. Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * 2. Redistributions in binary form must reproduce the above copyright
15  * notice, this list of conditions and the following disclaimer in the
16  * documentation and/or other materials provided with the distribution.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
19  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
22  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28  * POSSIBILITY OF SUCH DAMAGE.
29  */
30 
31 #ifndef IHDRBOX_MANAGER_H_
32 # define IHDRBOX_MANAGER_H_
33 
34 #include "byte_manager.h"
35 #include "box_manager.h"
36 #include "metadata_manager.h"
37 
39 typedef struct ihdrbox_param {
45 
54  Byte_t *jpipstream);
55 
56 
57 #endif /* !IHDRBOX_MANAGER_H_ */
OPJ_BYTE
unsigned char OPJ_BYTE
Definition: openjpeg.h:123
mel_init
static INLINE void mel_init(dec_mel_t *melp, OPJ_UINT8 *bbuf, int lcup, int scup)
Initiates a dec_mel_t structure for MEL decoding and reads some bytes in order to get the read addres...
Definition: ht_dec.c:297
opj_t1::flags
opj_flag_t * flags
Flags used by decoder and encoder.
Definition: t1.h:195
frwd_struct_t
struct frwd_struct frwd_struct_t
State structure for reading and unstuffing of forward-growing bitstreams; these are: MagSgn and SPP b...
vlc_tbl1
int vlc_tbl1[1024]
vlc_tbl1 contains decoding information for non-initial row of quads
Definition: t1_ht_generate_luts.c:904
opj_tcd_cblk_dec::numchunks
OPJ_UINT32 numchunks
Definition: tcd.h:140
count_leading_zeros
static INLINE OPJ_UINT32 count_leading_zeros(OPJ_UINT32 val)
Counts the number of leading zeros.
Definition: ht_dec.c:95
opj_tcd_cblk_dec::x1
OPJ_INT32 x1
Definition: tcd.h:124
big4
Byte4_t big4(Byte_t *buf)
convert 4-byte big endian Byte codes to number
Definition: byte_manager.c:147
opj_event_msg
OPJ_BOOL opj_event_msg(opj_event_mgr_t *p_event_mgr, OPJ_INT32 event_type, const char *fmt,...)
Write formatted data to a string and send the string to a user callback.
Definition: event.c:91
frwd_struct::unstuff
OPJ_BOOL unstuff
true if a bit needs to be unstuffed from next byte
Definition: ht_dec.c:874
metadata_manager.h
Byte_t
uint8_t Byte_t
Definition: byte_manager.h:37
opj_tcd_cblk_dec::Mb
OPJ_UINT32 Mb
Definition: tcd.h:128
rev_struct_t
struct rev_struct rev_struct_t
A structure for reading and unstuffing a segment that grows backward, such as VLC and MRP.
opj_t1_allocate_buffers
static OPJ_BOOL opj_t1_allocate_buffers(opj_t1_t *t1, OPJ_UINT32 w, OPJ_UINT32 h)
Allocates T1 buffers.
Definition: ht_dec.c:1023
dec_mel::bits
int bits
number of bits stored in tmp
Definition: ht_dec.c:142
opj_t1::w
OPJ_UINT32 w
Definition: t1.h:197
opj_t1::h
OPJ_UINT32 h
Definition: t1.h:198
box_param
box parameters
Definition: box_manager.h:37
opj_event_mgr
Message handler object used for.
Definition: event.h:50
INLINE
#define INLINE
Definition: openjpeg.h:65
rev_fetch_mrp
static INLINE OPJ_UINT32 rev_fetch_mrp(rev_struct_t *mrp)
Retrieves 32 bits from the head of a rev_struct structure.
Definition: ht_dec.c:650
metadatalist_param::first
metadata_param_t * first
first metadata-bin pointer of the list
Definition: metadata_manager.h:55
opj_tcd_cblk_dec::y1
OPJ_INT32 y1
Definition: tcd.h:124
OPJ_UINT8
uint8_t OPJ_UINT8
Definition: openjpeg.h:128
rev_struct::bits
OPJ_UINT32 bits
number of bits stored in tmp
Definition: ht_dec.c:365
rev_fetch
static INLINE OPJ_UINT32 rev_fetch(rev_struct_t *vlcp)
Retrieves 32 bits from the head of a rev_struct structure.
Definition: ht_dec.c:505
dec_mel_t
struct dec_mel dec_mel_t
MEL state structure for reading and decoding the MEL bitstream.
metadata_param::boxlist
boxlist_param_t * boxlist
box list
Definition: metadata_manager.h:45
opj_tcd_cblk_dec::x0
OPJ_INT32 x0
Definition: tcd.h:124
frwd_read
static INLINE void frwd_read(frwd_struct_t *msp)
Read and unstuffs 32 bits from forward-growing bitstream.
Definition: ht_dec.c:897
gene_boxbyTypeinStream
box_param_t * gene_boxbyTypeinStream(Byte_t *stream, OPJ_OFF_T offset, OPJ_SIZE_T length, const char TBox[])
generate(search) box from code stream
Definition: box_manager.c:243
decode_init_uvlc
static INLINE OPJ_UINT32 decode_init_uvlc(OPJ_UINT32 vlc, OPJ_UINT32 mode, OPJ_UINT32 *u)
Decode initial UVLC to get the u value (or u_q)
Definition: ht_dec.c:688
ihdrbox_param::bpc
Byte_t bpc
bits per component
Definition: ihdrbox_manager.h:43
metadatalist_param
metadata-bin list parameters
Definition: metadata_manager.h:54
gene_ihdrbox
ihdrbox_param_t * gene_ihdrbox(metadatalist_param_t *metadatalist, Byte_t *jpipstream)
generate ihdr box
Definition: ihdrbox_manager.c:36
EVT_WARNING
#define EVT_WARNING
Warning event type.
Definition: event.h:67
opj_t1
Tier-1 coding (coding of code-block coefficients)
Definition: t1.h:184
rev_struct::unstuff
OPJ_BOOL unstuff
true if the last byte is more than 0x8F
Definition: ht_dec.c:367
decode_noninit_uvlc
static INLINE OPJ_UINT32 decode_noninit_uvlc(OPJ_UINT32 vlc, OPJ_UINT32 mode, OPJ_UINT32 *u)
Decode non-initial UVLC to get the u value (or u_q)
Definition: ht_dec.c:801
OPJ_BOOL
int OPJ_BOOL
Definition: openjpeg.h:116
opj_flag_t
OPJ_UINT32 opj_flag_t
Flags for 4 consecutive rows of a column.
Definition: t1.h:179
rev_read_mrp
static INLINE void rev_read_mrp(rev_struct_t *mrp)
Reads and unstuffs from rev_struct.
Definition: ht_dec.c:543
dec_mel::tmp
OPJ_UINT64 tmp
temporary buffer for read data
Definition: ht_dec.c:141
opj_includes.h
rev_read
static INLINE void rev_read(rev_struct_t *vlcp)
Read and unstuff data from a backwardly-growing segment.
Definition: ht_dec.c:392
big2
Byte2_t big2(Byte_t *buf)
convert 2-byte big endian Byte codes to number
Definition: byte_manager.c:142
metadata_param::next
struct metadata_param * next
pointer to the next metadata-bin
Definition: metadata_manager.h:49
opj_mutex_lock
void opj_mutex_lock(opj_mutex_t *mutex)
Lock/acquire the mutex.
Definition: thread.c:448
OPJ_UINT64
uint64_t OPJ_UINT64
Definition: openjpeg.h:134
opj_t1::data
OPJ_INT32 * data
Definition: t1.h:189
OPJ_INT32
int32_t OPJ_INT32
Definition: openjpeg.h:131
dec_mel::k
int k
state of MEL decoder
Definition: ht_dec.c:145
rev_struct::data
OPJ_UINT8 * data
pointer to where to read data
Definition: ht_dec.c:363
t1_ht_luts.h
opj_t1::datasize
OPJ_UINT32 datasize
Definition: t1.h:199
ihdrbox_param::width
Byte4_t width
Definition: ihdrbox_manager.h:41
rev_init_mrp
static INLINE void rev_init_mrp(rev_struct_t *mrp, OPJ_UINT8 *data, int lcup, int len2)
Initialized rev_struct structure for MRP segment, and reads a number of bytes such that the next 32 b...
Definition: ht_dec.c:612
opj_realloc
void * opj_realloc(void *ptr, size_t new_size)
Reallocate memory blocks.
Definition: opj_malloc.c:239
dec_mel::runs
OPJ_UINT64 runs
runs of decoded MEL codewords (7 bits/run)
Definition: ht_dec.c:149
metadata_param
metadata-bin parameters
Definition: metadata_manager.h:43
rev_advance_mrp
static INLINE OPJ_UINT32 rev_advance_mrp(rev_struct_t *mrp, OPJ_UINT32 num_bits)
Consumes num_bits from a rev_struct structure.
Definition: ht_dec.c:668
dec_mel::num_runs
int num_runs
number of decoded runs left in runs (maximum 8)
Definition: ht_dec.c:148
OPJ_TRUE
#define OPJ_TRUE
Definition: openjpeg.h:117
gene_ihdrbox
ihdrbox_param_t * gene_ihdrbox(metadatalist_param_t *metadatalist, Byte_t *jpipstream)
generate ihdr box
Definition: ihdrbox_manager.c:36
get_DBoxlen
OPJ_SIZE_T get_DBoxlen(box_param_t *box)
get DBox length
Definition: box_manager.c:311
frwd_struct::size
int size
size of data
Definition: ht_dec.c:875
dec_mel
MEL state structure for reading and decoding the MEL bitstream.
Definition: ht_dec.c:138
Byte4_t
uint32_t Byte4_t
Definition: byte_manager.h:39
frwd_struct::X
OPJ_UINT32 X
0 or 0xFF, X's are inserted at end of bitstream
Definition: ht_dec.c:876
ihdrbox_manager.h
opj_mutex_unlock
void opj_mutex_unlock(opj_mutex_t *mutex)
Unlock/release the mutex.
Definition: thread.c:453
frwd_struct::tmp
OPJ_UINT64 tmp
temporary buffer of read data
Definition: ht_dec.c:872
opj_tcd_seg_data_chunk::len
OPJ_UINT32 len
Definition: tcd.h:99
frwd_struct
State structure for reading and unstuffing of forward-growing bitstreams; these are: MagSgn and SPP b...
Definition: ht_dec.c:870
mel_get_run
static INLINE int mel_get_run(dec_mel_t *melp)
Retrieves one run from dec_mel_t; if there are no runs stored MEL segment is decoded.
Definition: ht_dec.c:344
rev_advance
static INLINE OPJ_UINT32 rev_advance(rev_struct_t *vlcp, OPJ_UINT32 num_bits)
Consumes num_bits from a rev_struct structure.
Definition: ht_dec.c:523
opj_mutex_t
struct opj_mutex_t opj_mutex_t
Opaque type for a mutex.
Definition: thread.h:52
opj_tcd_cblk_dec
Code-block for decoding.
Definition: tcd.h:120
mel_read
static INLINE void mel_read(dec_mel_t *melp)
Reads and unstuffs the MEL bitstream.
Definition: ht_dec.c:165
rev_init
static INLINE void rev_init(rev_struct_t *vlcp, OPJ_UINT8 *data, int lcup, int scup)
Initiates the rev_struct_t structure and reads a few bytes to move the read address to multiple of 4.
Definition: ht_dec.c:460
ihdrbox_param_t
struct ihdrbox_param ihdrbox_param_t
I.5.3.1 Image Header box.
opj_aligned_free
void opj_aligned_free(void *ptr)
Definition: opj_malloc.c:225
frwd_fetch
static INLINE OPJ_UINT32 frwd_fetch(frwd_struct_t *msp)
Fetches 32 bits from the frwd_struct_t bitstream.
Definition: ht_dec.c:1005
read_le_uint32
static INLINE OPJ_UINT32 read_le_uint32(const void *dataIn)
Read a little-endian serialized UINT32.
Definition: ht_dec.c:118
opj_tcd_cblk_dec::y0
OPJ_INT32 y0
Definition: tcd.h:124
opj_aligned_malloc
void * opj_aligned_malloc(size_t size)
Allocate memory aligned to a 16 byte boundary.
Definition: opj_malloc.c:207
byte_manager.h
frwd_advance
static INLINE void frwd_advance(frwd_struct_t *msp, OPJ_UINT32 num_bits)
Consume num_bits bits from the bitstream of frwd_struct_t.
Definition: ht_dec.c:992
EVT_ERROR
#define EVT_ERROR
Error event type.
Definition: event.h:66
rev_struct
A structure for reading and unstuffing a segment that grows backward, such as VLC and MRP.
Definition: ht_dec.c:361
OPJ_UINT32
uint32_t OPJ_UINT32
Definition: openjpeg.h:132
only_cleanup_pass_is_decoded
static OPJ_BOOL only_cleanup_pass_is_decoded
Displays the error message for disabling the decoding of SPP and MRP passes.
Definition: ht_dec.c:62
frwd_init
static INLINE void frwd_init(frwd_struct_t *msp, const OPJ_UINT8 *data, int size, OPJ_UINT32 X)
Initialize frwd_struct_t struct and reads some bytes.
Definition: ht_dec.c:956
opj_tcd_cblk_dec::chunks
opj_tcd_seg_data_chunk_t * chunks
Definition: tcd.h:122
Byte2_t
uint16_t Byte2_t
Definition: byte_manager.h:38
dec_mel::data
OPJ_UINT8 * data
the address of data (or bitstream)
Definition: ht_dec.c:140
ihdrbox_param::height
Byte4_t height
Definition: ihdrbox_manager.h:40
frwd_struct::data
const OPJ_UINT8 * data
pointer to bitstream
Definition: ht_dec.c:871
OPJ_FALSE
#define OPJ_FALSE
Definition: openjpeg.h:118
search_box
box_param_t * search_box(const char type[], boxlist_param_t *boxlist)
search a box by box type
Definition: box_manager.c:346
rev_struct::tmp
OPJ_UINT64 tmp
temporary buffer of read data
Definition: ht_dec.c:364
ihdrbox_param
I.5.3.1 Image Header box.
Definition: ihdrbox_manager.h:39
rev_struct::size
int size
number of bytes left
Definition: ht_dec.c:366
box_manager.h
opj_tcd_cblk_dec::numbps
OPJ_UINT32 numbps
Definition: tcd.h:130
frwd_struct::bits
OPJ_UINT32 bits
number of bits stored in tmp
Definition: ht_dec.c:873
population_count
static INLINE OPJ_UINT32 population_count(OPJ_UINT32 val)
Generates population count (i.e., the number of set bits)
Definition: ht_dec.c:70
get_DBoxoff
OPJ_OFF_T get_DBoxoff(box_param_t *box)
get DBox offset
Definition: box_manager.c:306
dec_mel::size
int size
number of bytes in MEL code
Definition: ht_dec.c:143
dec_mel::unstuff
OPJ_BOOL unstuff
true if the next bit needs to be unstuffed
Definition: ht_dec.c:144
opj_t1_ht_decode_cblk
OPJ_BOOL opj_t1_ht_decode_cblk(opj_t1_t *t1, opj_tcd_cblk_dec_t *cblk, OPJ_UINT32 orient, OPJ_UINT32 roishift, OPJ_UINT32 cblksty, opj_event_mgr_t *p_manager, opj_mutex_t *p_manager_mutex, OPJ_BOOL check_pterm)
Decodes one codeblock, processing the cleanup, siginificance propagation, and magnitude refinement pa...
Definition: ht_dec.c:1096
opj_t1::flagssize
OPJ_UINT32 flagssize
Definition: t1.h:200
vlc_tbl0
int vlc_tbl0[1024]
vlc_tbl0 contains decoding information for initial row of quads
Definition: t1_ht_generate_luts.c:901
mel_decode
static INLINE void mel_decode(dec_mel_t *melp)
Decodes unstuffed MEL segment bits stored in tmp to runs.
Definition: ht_dec.c:247
J2K_CCP_CBLKSTY_VSC
#define J2K_CCP_CBLKSTY_VSC
Vertically stripe causal context.
Definition: j2k.h:61
ihdrbox_param::nc
Byte2_t nc
number of components
Definition: ihdrbox_manager.h:42