Grok  7.6.3
ojph_block_decoder.h
Go to the documentation of this file.
1 //***************************************************************************/
2 // This software is released under the 2-Clause BSD license, included
3 // below.
4 //
5 // Copyright (c) 2019, Aous Naman
6 // Copyright (c) 2019, Kakadu Software Pty Ltd, Australia
7 // Copyright (c) 2019, The University of New South Wales, Australia
8 //
9 // Redistribution and use in source and binary forms, with or without
10 // modification, are permitted provided that the following conditions are
11 // met:
12 //
13 // 1. Redistributions of source code must retain the above copyright
14 // notice, this list of conditions and the following disclaimer.
15 //
16 // 2. Redistributions in binary form must reproduce the above copyright
17 // notice, this list of conditions and the following disclaimer in the
18 // documentation and/or other materials provided with the distribution.
19 //
20 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
23 // PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
26 // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 //***************************************************************************/
32 // This file is part of the OpenJPH software implementation.
33 // File: ojph_block_decoder.h
34 // Author: Aous Naman
35 // Date: 28 August 2019
36 //***************************************************************************/
37 
38 
39 #ifndef OJPH_BLOCK_DECODER_H
40 #define OJPH_BLOCK_DECODER_H
41 
42 #include "ojph_defs.h"
43 
44 namespace ojph {
45  namespace local {
46 
48  //decodes the cleanup pass, significance propagation pass,
49  // and magnitude refinement pass
50  bool
51  ojph_decode_codeblock(ui8* coded_data, ui32* decoded_data,
52  ui32 missing_msbs, ui32 num_passes, ui32 lengths1, ui32 lengths2,
53  ui32 width, ui32 height, ui32 stride);
54 
56  }
57 }
58 
59 #endif // !OJPH_BLOCK_DECODER_H
ojph::ui8
uint8_t ui8
Definition: ojph_defs.h:50
ojph::size
Definition: ojph_base.h:48
ojph_message.h
ojph::count_leading_zeros
static ui32 count_leading_zeros(ui32 val)
Definition: ojph_arch.h:93
ojph::local::rev_read
void rev_read(rev_struct *vlcp)
Read and unstuff data from a backwardly-growing segment.
Definition: ojph_block_decoder.cpp:323
ojph::local::rev_struct::rev_struct
rev_struct()
Definition: ojph_block_decoder.cpp:292
ojph::local::frwd_fetch
ui32 frwd_fetch(frwd_struct *msp)
Fetches 32 bits from the frwd_struct bitstream.
Definition: ojph_block_decoder.cpp:962
ojph::local::mel_init
static void mel_init(dec_mel_st *melp, ui8 *bbuf, int lcup, int scup)
Initiates a dec_mel_st structure for MEL decoding and reads some bytes in order to get the read addre...
Definition: ojph_block_decoder.cpp:237
ojph::local::vlc_tbl0
static ui16 vlc_tbl0[1024]
vlc_tbl0 contains decoding information for initial row of quads
Definition: ojph_block_decoder.cpp:70
ojph::local::dec_mel_st::tmp
ui64 tmp
temporary buffer for read data
Definition: ojph_block_decoder.cpp:89
ojph::local::mel_decode
static void mel_decode(dec_mel_st *melp)
Decodes unstuffed MEL segment bits stored in tmp to runs.
Definition: ojph_block_decoder.cpp:186
ojph::local::dec_mel_st::bits
int bits
number of bits stored in tmp
Definition: ojph_block_decoder.cpp:90
ojph_block_decoder.h
table0.h
ojph::local::frwd_init
void frwd_init(frwd_struct *msp, const ui8 *data, int size)
Initialize frwd_struct struct and reads some bytes.
Definition: ojph_block_decoder.cpp:916
ojph::local::dec_mel_st::k
int k
state of MEL decoder
Definition: ojph_block_decoder.cpp:93
table1.h
ojph::local::rev_advance_mrp
ui32 rev_advance_mrp(rev_struct *mrp, ui32 num_bits)
Consumes num_bits from a rev_struct structure.
Definition: ojph_block_decoder.cpp:572
ojph::local::ojph_decode_codeblock
bool ojph_decode_codeblock(ui8 *coded_data, ui32 *decoded_data, ui32 missing_msbs, ui32 num_passes, ui32 lengths1, ui32 lengths2, ui32 width, ui32 height, ui32 stride)
Decodes one codeblock, processing the cleanup, siginificance propagation, and magnitude refinement pa...
Definition: ojph_block_decoder.cpp:989
ojph::local::rev_read_mrp
void rev_read_mrp(rev_struct *mrp)
Reads and unstuffs from rev_struct.
Definition: ojph_block_decoder.cpp:466
ojph::local::frwd_struct::bits
ui32 bits
number of bits stored in tmp
Definition: ojph_block_decoder.cpp:851
ojph::local::decode_init_uvlc
ui32 decode_init_uvlc(ui32 vlc, ui32 mode, ui32 *u)
Decode initial UVLC to get the u value (or u_q)
Definition: ojph_block_decoder.cpp:664
ojph::local::rev_struct::tmp
ui64 tmp
temporary buffer of read data
Definition: ojph_block_decoder.cpp:296
ojph::population_count
static ui32 population_count(ui32 val)
Definition: ojph_arch.h:73
ojph::local::frwd_read
void frwd_read(frwd_struct *msp)
Read and unstuffs 32 bits from forward-growing bitstream.
Definition: ojph_block_decoder.cpp:875
ojph::local::rev_fetch_mrp
ui32 rev_fetch_mrp(rev_struct *mrp)
Retrieves 32 bits from the head of a rev_struct structure.
Definition: ojph_block_decoder.cpp:555
ojph::local::rev_fetch
ui32 rev_fetch(rev_struct *vlcp)
Retrieves 32 bits from the head of a rev_struct structure.
Definition: ojph_block_decoder.cpp:430
ojph::local::mel_read
static void mel_read(dec_mel_st *melp)
Reads and unstuffs the MEL bitstream.
Definition: ojph_block_decoder.cpp:113
ojph::ui32
uint32_t ui32
Definition: ojph_defs.h:54
ojph_defs.h
ojph::local::dec_mel_st
MEL state structure for reading and decoding the MEL bitstream.
Definition: ojph_block_decoder.cpp:83
ojph::local::rev_struct::bits
ui32 bits
number of bits stored in tmp
Definition: ojph_block_decoder.cpp:297
ojph::local::dec_mel_st::dec_mel_st
dec_mel_st()
Definition: ojph_block_decoder.cpp:84
ojph::local::decode_vlc_init_tables
bool decode_vlc_init_tables()
Initializes vlc_tbl0 and vlc_tbl1 tables, from table0.h and table1.h.
Definition: ojph_block_decoder.cpp:585
ojph::local::dec_mel_st::unstuff
bool unstuff
true if the next bit needs to be unstuffed
Definition: ojph_block_decoder.cpp:92
ojph::local::rev_struct::size
int size
number of bytes left
Definition: ojph_block_decoder.cpp:298
ojph::local::rev_struct::unstuff
bool unstuff
true if the last byte is more than 0x8F then the current byte is unstuffed if it is 0x7F
Definition: ojph_block_decoder.cpp:299
ojph::local::frwd_struct
Initializes VLC tables vlc_tbl0 and vlc_tbl1.
Definition: ojph_block_decoder.cpp:848
ojph::local::rev_advance
ui32 rev_advance(rev_struct *vlcp, ui32 num_bits)
Consumes num_bits from a rev_struct structure.
Definition: ojph_block_decoder.cpp:447
ojph::local::dec_mel_st::size
int size
number of bytes in MEL code
Definition: ojph_block_decoder.cpp:91
ojph::local::rev_struct::data
ui8 * data
pointer to where to read data
Definition: ojph_block_decoder.cpp:295
ojph::ui64
uint64_t ui64
Definition: ojph_defs.h:56
ojph::local::rev_init_mrp
void rev_init_mrp(rev_struct *mrp, ui8 *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: ojph_block_decoder.cpp:521
ojph::local::frwd_struct::data
const ui8 * data
pointer to bitstream
Definition: ojph_block_decoder.cpp:849
ojph::ui16
uint16_t ui16
Definition: ojph_defs.h:52
ojph::local::dec_mel_st::runs
ui64 runs
runs of decoded MEL codewords (7 bits/run)
Definition: ojph_block_decoder.cpp:97
ojph::local::rev_struct
A structure for reading and unstuffing a segment that grows backward, such as VLC and MRP.
Definition: ojph_block_decoder.cpp:291
ojph_arch.h
ojph::local::frwd_advance
void frwd_advance(frwd_struct *msp, ui32 num_bits)
Consume num_bits bits from the bitstream of frwd_struct.
Definition: ojph_block_decoder.cpp:947
ojph::local::vlc_tbl1
static ui16 vlc_tbl1[1024]
vlc_tbl1 contains decoding information for non-initial row of quads
Definition: ojph_block_decoder.cpp:73
ojph::local::frwd_struct::tmp
ui64 tmp
temporary buffer of read data
Definition: ojph_block_decoder.cpp:850
ojph::local::mel_get_run
static int mel_get_run(dec_mel_st *melp)
Retrieves one run from dec_mel_st; if there are no runs stored MEL segment is decoded.
Definition: ojph_block_decoder.cpp:276
ojph
Definition: ojph_block_decoder.cpp:49
ojph::local::dec_mel_st::data
ui8 * data
the address of data (or bitstream)
Definition: ojph_block_decoder.cpp:88
ojph::local::rev_init
void rev_init(rev_struct *vlcp, ui8 *data, int lcup, int scup)
Initiates the rev_struct structure and reads a few bytes to move the read address to multiple of 4.
Definition: ojph_block_decoder.cpp:390
ojph::local::dec_mel_st::num_runs
int num_runs
number of decoded runs left in runs (maximum 8)
Definition: ojph_block_decoder.cpp:96
ojph::local::frwd_struct::unstuff
bool unstuff
true if a bit needs to be unstuffed from next byte
Definition: ojph_block_decoder.cpp:852
ojph::local::decode_noninit_uvlc
ui32 decode_noninit_uvlc(ui32 vlc, ui32 mode, ui32 *u)
Decode non-initial UVLC to get the u value (or u_q)
Definition: ojph_block_decoder.cpp:774
ojph::local::frwd_struct::size
int size
size of data
Definition: ojph_block_decoder.cpp:853