Grok 12.0.1
|
Classes | |
struct | dec_mel_st |
MEL state structure for reading and decoding the MEL bitstream. More... | |
struct | frwd_struct |
State structure for reading and unstuffing of forward-growing bitstreams; these are: MagSgn and SPP bitstreams. More... | |
struct | mel_struct |
struct | ms_struct |
struct | rev_struct |
A structure for reading and unstuffing a segment that grows backward, such as VLC and MRP. More... | |
struct | vlc_struct |
Functions | |
static bool | vlc_init_tables () |
Initializes vlc_tbl0 and vlc_tbl1 tables, from table0.h and table1.h. | |
static bool | uvlc_init_tables () |
Initializes uvlc_tbl0 and uvlc_tbl1 tables. | |
static void | mel_read (dec_mel_st *melp) |
Reads and unstuffs the MEL bitstream. | |
static void | mel_decode (dec_mel_st *melp) |
Decodes unstuffed MEL segment bits stored in tmp to runs. | |
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 address to a multiple of 4. | |
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. | |
static void | rev_read (rev_struct *vlcp) |
Read and unstuff data from a backwardly-growing segment. | |
static 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. | |
static ui32 | rev_fetch (rev_struct *vlcp) |
Retrieves 32 bits from the head of a rev_struct structure. | |
static ui32 | rev_advance (rev_struct *vlcp, ui32 num_bits) |
Consumes num_bits from a rev_struct structure. | |
static void | rev_read_mrp (rev_struct *mrp) |
Reads and unstuffs from rev_struct. | |
static 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 bits read are from an address that is a multiple of 4. | |
static ui32 | rev_fetch_mrp (rev_struct *mrp) |
Retrieves 32 bits from the head of a rev_struct structure. | |
static ui32 | rev_advance_mrp (rev_struct *mrp, ui32 num_bits) |
Consumes num_bits from a rev_struct structure. | |
template<int X> | |
static void | frwd_read (frwd_struct *msp) |
Read and unstuffs 32 bits from forward-growing bitstream. | |
template<int X> | |
static void | frwd_init (frwd_struct *msp, const ui8 *data, int size) |
Initialize frwd_struct struct and reads some bytes. | |
static void | frwd_advance (frwd_struct *msp, ui32 num_bits) |
Consume num_bits bits from the bitstream of frwd_struct. | |
template<int X> | |
static ui32 | frwd_fetch (frwd_struct *msp) |
Fetches 32 bits from the frwd_struct bitstream. | |
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, bool stripe_causal) |
Decodes one codeblock, processing the cleanup, siginificance propagation, and magnitude refinement pass. | |
bool | ojph_decode_codeblock_ssse3 (ui8 *coded_data, ui32 *decoded_data, ui32 missing_msbs, ui32 num_passes, ui32 lengths1, ui32 lengths2, ui32 width, ui32 height, ui32 stride, bool stripe_causal) |
Decodes one codeblock, processing the cleanup, siginificance propagation, and magnitude refinement pass. | |
bool | ojph_decode_codeblock_wasm (ui8 *coded_data, ui32 *decoded_data, ui32 missing_msbs, ui32 num_passes, ui32 lengths1, ui32 lengths2, ui32 width, ui32 height, ui32 stride, bool stripe_causal) |
Decodes one codeblock, processing the cleanup, siginificance propagation, and magnitude refinement pass. | |
static void | mel_read (dec_mel_st *melp) |
Reads and unstuffs the MEL bitstream. | |
static void | mel_decode (dec_mel_st *melp) |
Decodes unstuffed MEL segment bits stored in tmp to runs. | |
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 address to a multiple of 4. | |
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. | |
static void | rev_read (rev_struct *vlcp) |
Read and unstuff data from a backwardly-growing segment. | |
static 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. | |
static ui32 | rev_fetch (rev_struct *vlcp) |
Retrieves 32 bits from the head of a rev_struct structure. | |
static ui32 | rev_advance (rev_struct *vlcp, ui32 num_bits) |
Consumes num_bits from a rev_struct structure. | |
static void | rev_read_mrp (rev_struct *mrp) |
Reads and unstuffs from rev_struct. | |
static 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 bits read are from an address that is a multiple of 4. | |
static ui32 | rev_fetch_mrp (rev_struct *mrp) |
Retrieves 32 bits from the head of a rev_struct structure. | |
template<int X> | |
static void | frwd_read (frwd_struct *msp) |
Read and unstuffs 16 bytes from forward-growing bitstream. | |
template<int X> | |
static void | frwd_init (frwd_struct *msp, const ui8 *data, int size) |
Initialize frwd_struct struct and reads some bytes. | |
static void | frwd_advance (frwd_struct *msp, ui32 num_bits) |
Consume num_bits bits from the bitstream of frwd_struct. | |
template<int X> | |
static __m128i | frwd_fetch (frwd_struct *msp) |
Fetches 32 bits from the frwd_struct bitstream. | |
template<int N> | |
static __m128i | decode_one_quad32 (const __m128i inf_u_q, __m128i U_q, frwd_struct *magsgn, ui32 p, __m128i &vn) |
decodes one quad, using 32 bit data | |
static __m128i | decode_two_quad16 (const __m128i inf_u_q, __m128i U_q, frwd_struct *magsgn, ui32 p, __m128i &vn) |
decodes twos consecutive quads (one octet), using 16 bit data | |
static void | mel_read (dec_mel_st *melp) |
Reads and unstuffs the MEL bitstream. | |
static void | mel_decode (dec_mel_st *melp) |
Decodes unstuffed MEL segment bits stored in tmp to runs. | |
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 address to a multiple of 4. | |
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. | |
static void | rev_read (rev_struct *vlcp) |
Read and unstuff data from a backwardly-growing segment. | |
static 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. | |
static ui32 | rev_fetch (rev_struct *vlcp) |
Retrieves 32 bits from the head of a rev_struct structure. | |
static ui32 | rev_advance (rev_struct *vlcp, ui32 num_bits) |
Consumes num_bits from a rev_struct structure. | |
static void | rev_read_mrp (rev_struct *mrp) |
Reads and unstuffs from rev_struct. | |
static 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 bits read are from an address that is a multiple of 4. | |
static ui32 | rev_fetch_mrp (rev_struct *mrp) |
Retrieves 32 bits from the head of a rev_struct structure. | |
template<int X> | |
static void | frwd_read (frwd_struct *msp) |
Read and unstuffs 16 bytes from forward-growing bitstream. | |
template<int X> | |
static void | frwd_init (frwd_struct *msp, const ui8 *data, int size) |
Initialize frwd_struct struct and reads some bytes. | |
static void | frwd_advance (frwd_struct *msp, ui32 num_bits) |
Consume num_bits bits from the bitstream of frwd_struct. | |
template<int X> | |
static v128_t | frwd_fetch (frwd_struct *msp) |
Fetches 32 bits from the frwd_struct bitstream. | |
template<int N> | |
static v128_t | decode_one_quad32 (const v128_t inf_u_q, v128_t U_q, frwd_struct *magsgn, ui32 p, v128_t &vn) |
decodes one quad, using 32 bit data | |
static v128_t | decode_two_quad16 (const v128_t inf_u_q, v128_t U_q, frwd_struct *magsgn, ui32 p, v128_t &vn) |
decodes twos consecutive quads (one octet), using 16 bit data | |
static bool | vlc_init_tables () |
static bool | uvlc_init_tables () |
static void | mel_init (mel_struct *melp, ui32 buffer_size, ui8 *data) |
static void | mel_emit_bit (mel_struct *melp, int v) |
static void | mel_encode (mel_struct *melp, bool bit) |
static void | vlc_init (vlc_struct *vlcp, ui32 buffer_size, ui8 *data) |
static void | vlc_encode (vlc_struct *vlcp, int cwd, int cwd_len) |
static void | terminate_mel_vlc (mel_struct *melp, vlc_struct *vlcp) |
static void | ms_init (ms_struct *msp, ui32 buffer_size, ui8 *data) |
static void | ms_encode (ms_struct *msp, ui32 cwd, int cwd_len) |
static void | ms_terminate (ms_struct *msp) |
void | ojph_encode_codeblock (ui32 *buf, ui32 missing_msbs, ui32 num_passes, ui32 width, ui32 height, ui32 stride, ui32 *lengths, ojph::mem_elastic_allocator *elastic, ojph::coded_lists *&coded) |
Variables | |
ui16 | vlc_tbl0 [1024] = { 0 } |
vlc_tbl0 contains decoding information for initial row of quads | |
ui16 | vlc_tbl1 [1024] = { 0 } |
vlc_tbl1 contains decoding information for non-initial row of quads | |
ui16 | uvlc_tbl0 [256+64] = { 0 } |
uvlc_tbl0 contains decoding information for initial row of quads | |
ui16 | uvlc_tbl1 [256] = { 0 } |
uvlc_tbl1 contains decoding information for non-initial row of quads | |
static bool | vlc_tables_initialized = vlc_init_tables() |
Initializes VLC tables vlc_tbl0 and vlc_tbl1. | |
static bool | uvlc_tables_initialized = uvlc_init_tables() |
Initializes UVLC tables uvlc_tbl0 and uvlc_tbl1. | |
static int | ulvc_cwd_pre [33] |
static int | ulvc_cwd_pre_len [33] |
static int | ulvc_cwd_suf [33] |
static int | ulvc_cwd_suf_len [33] |
static bool | vlc_tables_initialized = vlc_init_tables() |
static bool | uvlc_tables_initialized = uvlc_init_tables() |
|
inlinestatic |
decodes one quad, using 32 bit data
N | 0 for the first quad and 1 for the second quad in an octet |
inf_u_q | decoded VLC code, with interleaved u values |
U_q | U values |
magsgn | structure for forward data buffer |
p | bitplane at which we are decoding |
vn | used for handling E values (stores v_n values) |
References frwd_advance().
|
inlinestatic |
decodes one quad, using 32 bit data
N | 0 for the first quad and 1 for the second quad in an octet |
inf_u_q | decoded VLC code, with interleaved u values |
U_q | U values |
magsgn | structure for forward data buffer |
p | bitplane at which we are decoding |
vn | used for handling E values (stores v_n values) |
References frwd_advance(), OJPH_REPEAT4, and OJPH_REPEAT8.
|
inlinestatic |
decodes twos consecutive quads (one octet), using 16 bit data
inf_u_q | decoded VLC code, with interleaved u values |
U_q | U values |
magsgn | structure for forward data buffer |
p | bitplane at which we are decoding |
vn | used for handling E values (stores v_n values) |
References frwd_advance().
Referenced by ojph_decode_codeblock_ssse3(), and ojph_decode_codeblock_wasm().
|
inlinestatic |
decodes twos consecutive quads (one octet), using 16 bit data
inf_u_q | decoded VLC code, with interleaved u values |
U_q | U values |
magsgn | structure for forward data buffer |
p | bitplane at which we are decoding |
vn | used for handling E values (stores v_n values) |
References frwd_advance(), and OJPH_REPEAT8.
|
inlinestatic |
Consume num_bits bits from the bitstream of frwd_struct.
[in] | msp | is a pointer to frwd_struct |
[in] | num_bits | is the number of bit to consume |
References ojph::local::frwd_struct::bits, and ojph::local::frwd_struct::tmp.
Referenced by decode_one_quad32(), decode_one_quad32(), decode_two_quad16(), decode_two_quad16(), ojph_decode_codeblock(), ojph_decode_codeblock_ssse3(), and ojph_decode_codeblock_wasm().
|
inlinestatic |
Consume num_bits bits from the bitstream of frwd_struct.
[in] | msp | is a pointer to frwd_struct |
[in] | num_bits | is the number of bit to consume |
|
inlinestatic |
Consume num_bits bits from the bitstream of frwd_struct.
[in] | msp | is a pointer to frwd_struct |
[in] | num_bits | is the number of bit to consume |
|
inlinestatic |
Fetches 32 bits from the frwd_struct bitstream.
X | is the value fed in when the bitstream is exhausted. See frwd_read regarding the template |
[in] | msp | is a pointer to frwd_struct |
References ojph::local::frwd_struct::bits, and ojph::local::frwd_struct::tmp.
|
inlinestatic |
Fetches 32 bits from the frwd_struct bitstream.
X | is the value fed in when the bitstream is exhausted. See frwd_read regarding the template |
[in] | msp | is a pointer to frwd_struct |
|
inlinestatic |
Fetches 32 bits from the frwd_struct bitstream.
X | is the value fed in when the bitstream is exhausted. See frwd_read regarding the template |
[in] | msp | is a pointer to frwd_struct |
|
inlinestatic |
Initialize frwd_struct struct and reads some bytes.
X | is the value fed in when the bitstream is exhausted. See frwd_read regarding the template |
[in] | msp | is a pointer to frwd_struct |
[in] | data | is a pointer to the start of data |
[in] | size | is the number of byte in the bitstream |
References ojph::local::frwd_struct::bits, ojph::local::frwd_struct::data, ojph::local::frwd_struct::size, ojph::local::frwd_struct::tmp, and ojph::local::frwd_struct::unstuff.
|
inlinestatic |
Initialize frwd_struct struct and reads some bytes.
X | is the value fed in when the bitstream is exhausted. See frwd_read regarding the template |
[in] | msp | is a pointer to frwd_struct |
[in] | data | is a pointer to the start of data |
[in] | size | is the number of byte in the bitstream |
|
inlinestatic |
Initialize frwd_struct struct and reads some bytes.
X | is the value fed in when the bitstream is exhausted. See frwd_read regarding the template |
[in] | msp | is a pointer to frwd_struct |
[in] | data | is a pointer to the start of data |
[in] | size | is the number of byte in the bitstream |
|
inlinestatic |
Read and unstuffs 32 bits from forward-growing bitstream.
A template is used to accommodate a different requirement for MagSgn and SPP bitstreams; in particular, when MagSgn bitstream is consumed, 0xFF's are fed, while when SPP is exhausted 0's are fed in. X controls this value.
Unstuffing prevent sequences that are more than 0xFF7F from appearing in the conpressed sequence. So whenever a value of 0xFF is coded, the MSB of the next byte is set 0 and must be ignored during decoding.
Reading can go beyond the end of buffer by up to 3 bytes.
X | is the value fed in when the bitstream is exhausted |
[in] | msp | is a pointer to frwd_struct structure |
References ojph::local::frwd_struct::bits, ojph::local::frwd_struct::data, ojph::local::frwd_struct::size, ojph::local::frwd_struct::tmp, and ojph::local::frwd_struct::unstuff.
|
inlinestatic |
Read and unstuffs 16 bytes from forward-growing bitstream.
A template is used to accommodate a different requirement for MagSgn and SPP bitstreams; in particular, when MagSgn bitstream is consumed, 0xFF's are fed, while when SPP is exhausted 0's are fed in. X controls this value.
Unstuffing prevent sequences that are more than 0xFF7F from appearing in the conpressed sequence. So whenever a value of 0xFF is coded, the MSB of the next byte is set 0 and must be ignored during decoding.
Reading can go beyond the end of buffer by up to 16 bytes.
X | is the value fed in when the bitstream is exhausted |
[in] | msp | is a pointer to frwd_struct structure |
References ojph::count_leading_zeros().
|
inlinestatic |
Read and unstuffs 16 bytes from forward-growing bitstream.
A template is used to accommodate a different requirement for MagSgn and SPP bitstreams; in particular, when MagSgn bitstream is consumed, 0xFF's are fed, while when SPP is exhausted 0's are fed in. X controls this value.
Unstuffing prevent sequences that are more than 0xFF7F from appearing in the conpressed sequence. So whenever a value of 0xFF is coded, the MSB of the next byte is set 0 and must be ignored during decoding.
Reading can go beyond the end of buffer by up to 16 bytes.
X | is the value fed in when the bitstream is exhausted |
[in] | msp | is a pointer to frwd_struct structure |
References ojph::count_leading_zeros(), and OJPH_REPEAT16.
|
inlinestatic |
Decodes unstuffed MEL segment bits stored in tmp to runs.
Runs are stored in "runs" and the number of runs in "num_runs". Each run represents a number of zero events that may or may not terminate in a 1 event. Each run is stored in 7 bits. The LSB is 1 if the run terminates in a 1 event, 0 otherwise. The next 6 bits, for the case terminating with 1, contain the number of consecutive 0 zero events * 2; for the case terminating with 0, they store (number of consecutive 0 zero events - 1) * 2. A total of 6 bits (made up of 1 + 5) should have been enough.
[in] | melp | is a pointer to dec_mel_st structure |
References ojph::local::dec_mel_st::bits, ojph::local::dec_mel_st::k, mel_read(), ojph::local::dec_mel_st::num_runs, ojph::local::dec_mel_st::runs, and ojph::local::dec_mel_st::tmp.
Referenced by mel_get_run().
|
inlinestatic |
Decodes unstuffed MEL segment bits stored in tmp to runs.
Runs are stored in "runs" and the number of runs in "num_runs". Each run represents a number of zero events that may or may not terminate in a 1 event. Each run is stored in 7 bits. The LSB is 1 if the run terminates in a 1 event, 0 otherwise. The next 6 bits, for the case terminating with 1, contain the number of consecutive 0 zero events * 2; for the case terminating with 0, they store (number of consecutive 0 zero events - 1) * 2. A total of 6 bits (made up of 1 + 5) should have been enough.
[in] | melp | is a pointer to dec_mel_st structure |
References mel_read().
|
inlinestatic |
Decodes unstuffed MEL segment bits stored in tmp to runs.
Runs are stored in "runs" and the number of runs in "num_runs". Each run represents a number of zero events that may or may not terminate in a 1 event. Each run is stored in 7 bits. The LSB is 1 if the run terminates in a 1 event, 0 otherwise. The next 6 bits, for the case terminating with 1, contain the number of consecutive 0 zero events * 2; for the case terminating with 0, they store (number of consecutive 0 zero events - 1) * 2. A total of 6 bits (made up of 1 + 5) should have been enough.
[in] | melp | is a pointer to dec_mel_st structure |
References mel_read().
|
inlinestatic |
|
inlinestatic |
References ojph::local::mel_struct::k, mel_emit_bit(), ojph_max, ojph_min, ojph::local::mel_struct::run, and ojph::local::mel_struct::threshold.
Referenced by ojph_encode_codeblock().
|
inlinestatic |
Retrieves one run from dec_mel_st; if there are no runs stored MEL segment is decoded.
[in] | melp | is a pointer to dec_mel_st structure |
References mel_decode(), ojph::local::dec_mel_st::num_runs, and ojph::local::dec_mel_st::runs.
Referenced by ojph_decode_codeblock(), ojph_decode_codeblock_ssse3(), and ojph_decode_codeblock_wasm().
|
inlinestatic |
Retrieves one run from dec_mel_st; if there are no runs stored MEL segment is decoded.
[in] | melp | is a pointer to dec_mel_st structure |
References mel_decode().
|
inlinestatic |
Retrieves one run from dec_mel_st; if there are no runs stored MEL segment is decoded.
[in] | melp | is a pointer to dec_mel_st structure |
References mel_decode().
|
inlinestatic |
Initiates a dec_mel_st structure for MEL decoding and reads some bytes in order to get the read address to a multiple of 4.
[in] | melp | is a pointer to dec_mel_st structure |
[in] | bbuf | is a pointer to byte buffer |
[in] | lcup | is the length of MagSgn+MEL+VLC segments |
[in] | scup | is the length of MEL+VLC segments |
References ojph::local::dec_mel_st::bits, ojph::local::dec_mel_st::data, ojph::local::dec_mel_st::k, ojph::local::dec_mel_st::num_runs, ojph::local::dec_mel_st::runs, ojph::local::dec_mel_st::size, ojph::local::dec_mel_st::tmp, and ojph::local::dec_mel_st::unstuff.
Referenced by ojph_decode_codeblock(), ojph_decode_codeblock_ssse3(), ojph_decode_codeblock_wasm(), and ojph_encode_codeblock().
|
inlinestatic |
Initiates a dec_mel_st structure for MEL decoding and reads some bytes in order to get the read address to a multiple of 4.
[in] | melp | is a pointer to dec_mel_st structure |
[in] | bbuf | is a pointer to byte buffer |
[in] | lcup | is the length of MagSgn+MEL+VLC segments |
[in] | scup | is the length of MEL+VLC segments |
|
inlinestatic |
Initiates a dec_mel_st structure for MEL decoding and reads some bytes in order to get the read address to a multiple of 4.
[in] | melp | is a pointer to dec_mel_st structure |
[in] | bbuf | is a pointer to byte buffer |
[in] | lcup | is the length of MagSgn+MEL+VLC segments |
[in] | scup | is the length of MEL+VLC segments |
|
inlinestatic |
|
inlinestatic |
Reads and unstuffs the MEL bitstream.
This design needs more bytes in the codeblock buffer than the length of the cleanup pass by up to 2 bytes.
Unstuffing removes the MSB of the byte following a byte whose value is 0xFF; this prevents sequences larger than 0xFF7F in value from appearing the bitstream.
[in] | melp | is a pointer to dec_mel_st structure |
References ojph::local::dec_mel_st::bits, ojph::local::dec_mel_st::data, ojph::local::dec_mel_st::size, ojph::local::dec_mel_st::tmp, and ojph::local::dec_mel_st::unstuff.
Referenced by mel_decode().
|
inlinestatic |
Reads and unstuffs the MEL bitstream.
This design needs more bytes in the codeblock buffer than the length of the cleanup pass by up to 2 bytes.
Unstuffing removes the MSB of the byte following a byte whose value is 0xFF; this prevents sequences larger than 0xFF7F in value from appearing the bitstream.
[in] | melp | is a pointer to dec_mel_st structure |
|
inlinestatic |
Reads and unstuffs the MEL bitstream.
This design needs more bytes in the codeblock buffer than the length of the cleanup pass by up to 2 bytes.
Unstuffing removes the MSB of the byte following a byte whose value is 0xFF; this prevents sequences larger than 0xFF7F in value from appearing the bitstream.
[in] | melp | is a pointer to dec_mel_st structure |
|
inlinestatic |
bool ojph::local::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, | ||
bool | stripe_causal ) |
Decodes one codeblock, processing the cleanup, siginificance propagation, and magnitude refinement pass.
[in] | coded_data | is a pointer to bitstream |
[in] | decoded_data | is a pointer to decoded codeblock data buf. |
[in] | missing_msbs | is the number of missing MSBs |
[in] | num_passes | is the number of passes: 1 if CUP only, 2 for CUP+SPP, and 3 for CUP+SPP+MRP |
[in] | lengths1 | is the length of cleanup pass |
[in] | lengths2 | is the length of refinement passes (either SPP only or SPP+MRP) |
[in] | width | is the decoded codeblock width |
[in] | height | is the decoded codeblock height |
[in] | stride | is the decoded codeblock buffer stride |
[in] | stripe_causal | is true for stripe causal mode |
References ojph::count_leading_zeros(), frwd_advance(), grk::Logger::logger_, mel_get_run(), mel_init(), ojph_max, ojph::population_count(), rev_advance(), rev_advance_mrp(), rev_fetch(), rev_fetch_mrp(), rev_init(), rev_init_mrp(), uvlc_tbl0, uvlc_tbl1, vlc_tbl0, vlc_tbl1, and grk::Logger::warn().
Referenced by ojph::T1OJPH::decompress().
bool ojph::local::ojph_decode_codeblock_ssse3 | ( | ui8 * | coded_data, |
ui32 * | decoded_data, | ||
ui32 | missing_msbs, | ||
ui32 | num_passes, | ||
ui32 | lengths1, | ||
ui32 | lengths2, | ||
ui32 | width, | ||
ui32 | height, | ||
ui32 | stride, | ||
bool | stripe_causal ) |
Decodes one codeblock, processing the cleanup, siginificance propagation, and magnitude refinement pass.
[in] | coded_data | is a pointer to bitstream |
[in] | decoded_data | is a pointer to decoded codeblock data buf. |
[in] | missing_msbs | is the number of missing MSBs |
[in] | num_passes | is the number of passes: 1 if CUP only, 2 for CUP+SPP, and 3 for CUP+SPP+MRP |
[in] | lengths1 | is the length of cleanup pass |
[in] | lengths2 | is the length of refinement passes (either SPP only or SPP+MRP) |
[in] | width | is the decoded codeblock width |
[in] | height | is the decoded codeblock height |
[in] | stride | is the decoded codeblock buffer stride |
[in] | stripe_causal | is true for stripe causal mode |
References decode_two_quad16(), frwd_advance(), grk::Logger::logger_, mel_get_run(), mel_init(), ojph_max, rev_advance(), rev_advance_mrp(), rev_fetch(), rev_fetch_mrp(), rev_init(), rev_init_mrp(), uvlc_tbl0, uvlc_tbl1, vlc_tbl0, vlc_tbl1, and grk::Logger::warn().
bool ojph::local::ojph_decode_codeblock_wasm | ( | ui8 * | coded_data, |
ui32 * | decoded_data, | ||
ui32 | missing_msbs, | ||
ui32 | num_passes, | ||
ui32 | lengths1, | ||
ui32 | lengths2, | ||
ui32 | width, | ||
ui32 | height, | ||
ui32 | stride, | ||
bool | stripe_causal ) |
Decodes one codeblock, processing the cleanup, siginificance propagation, and magnitude refinement pass.
[in] | coded_data | is a pointer to bitstream |
[in] | decoded_data | is a pointer to decoded codeblock data buf. |
[in] | missing_msbs | is the number of missing MSBs |
[in] | num_passes | is the number of passes: 1 if CUP only, 2 for CUP+SPP, and 3 for CUP+SPP+MRP |
[in] | lengths1 | is the length of cleanup pass |
[in] | lengths2 | is the length of refinement passes (either SPP only or SPP+MRP) |
[in] | width | is the decoded codeblock width |
[in] | height | is the decoded codeblock height |
[in] | stride | is the decoded codeblock buffer stride |
[in] | stripe_causal | is true for stripe causal mode |
References decode_two_quad16(), frwd_advance(), mel_get_run(), mel_init(), ojph_max, OJPH_REPEAT16, OJPH_REPEAT2, OJPH_REPEAT4, OJPH_REPEAT8, rev_advance(), rev_advance_mrp(), rev_fetch(), rev_fetch_mrp(), rev_init(), rev_init_mrp(), uvlc_tbl0, uvlc_tbl1, vlc_tbl0, and vlc_tbl1.
void ojph::local::ojph_encode_codeblock | ( | ui32 * | buf, |
ui32 | missing_msbs, | ||
ui32 | num_passes, | ||
ui32 | width, | ||
ui32 | height, | ||
ui32 | stride, | ||
ui32 * | lengths, | ||
ojph::mem_elastic_allocator * | elastic, | ||
ojph::coded_lists *& | coded ) |
References ojph::coded_lists::avail_size, ojph::local::mel_struct::buf, ojph::local::vlc_struct::buf, ojph::local::ms_struct::buf, ojph::coded_lists::buf, ojph::count_leading_zeros(), ojph::mem_elastic_allocator::get_buffer(), mel_encode(), mel_init(), ms_encode(), ms_init(), ms_terminate(), ojph_max, ojph_min, ojph::local::mel_struct::pos, ojph::local::vlc_struct::pos, ojph::local::ms_struct::pos, terminate_mel_vlc(), ulvc_cwd_pre, ulvc_cwd_pre_len, ulvc_cwd_suf, ulvc_cwd_suf_len, vlc_encode(), vlc_init(), vlc_tbl0, and vlc_tbl1.
Referenced by ojph::T1OJPH::compress().
|
inlinestatic |
Consumes num_bits from a rev_struct structure.
[in] | vlcp | is a pointer to rev_struct structure |
[in] | num_bits | is the number of bits to be removed |
References ojph::local::rev_struct::bits, and ojph::local::rev_struct::tmp.
Referenced by ojph_decode_codeblock(), ojph_decode_codeblock_ssse3(), and ojph_decode_codeblock_wasm().
|
inlinestatic |
Consumes num_bits from a rev_struct structure.
[in] | vlcp | is a pointer to rev_struct structure |
[in] | num_bits | is the number of bits to be removed |
|
inlinestatic |
Consumes num_bits from a rev_struct structure.
[in] | vlcp | is a pointer to rev_struct structure |
[in] | num_bits | is the number of bits to be removed |
|
inlinestatic |
Consumes num_bits from a rev_struct structure.
[in] | mrp | is a pointer to rev_struct structure |
[in] | num_bits | is the number of bits to be removed |
References ojph::local::rev_struct::bits, and ojph::local::rev_struct::tmp.
Referenced by ojph_decode_codeblock(), ojph_decode_codeblock_ssse3(), and ojph_decode_codeblock_wasm().
|
inlinestatic |
Retrieves 32 bits from the head of a rev_struct structure.
By the end of this call, vlcp->tmp must have no less than 33 bits
[in] | vlcp | is a pointer to rev_struct structure |
References ojph::local::rev_struct::bits, rev_read(), and ojph::local::rev_struct::tmp.
Referenced by ojph_decode_codeblock(), ojph_decode_codeblock_ssse3(), and ojph_decode_codeblock_wasm().
|
inlinestatic |
Retrieves 32 bits from the head of a rev_struct structure.
By the end of this call, vlcp->tmp must have no less than 33 bits
[in] | vlcp | is a pointer to rev_struct structure |
References rev_read().
|
inlinestatic |
Retrieves 32 bits from the head of a rev_struct structure.
By the end of this call, vlcp->tmp must have no less than 33 bits
[in] | vlcp | is a pointer to rev_struct structure |
References rev_read().
|
inlinestatic |
Retrieves 32 bits from the head of a rev_struct structure.
By the end of this call, mrp->tmp must have no less than 33 bits
[in] | mrp | is a pointer to rev_struct structure |
References ojph::local::rev_struct::bits, rev_read_mrp(), and ojph::local::rev_struct::tmp.
Referenced by ojph_decode_codeblock(), ojph_decode_codeblock_ssse3(), and ojph_decode_codeblock_wasm().
|
inlinestatic |
Retrieves 32 bits from the head of a rev_struct structure.
By the end of this call, mrp->tmp must have no less than 33 bits
[in] | mrp | is a pointer to rev_struct structure |
References rev_read_mrp().
|
inlinestatic |
Retrieves 32 bits from the head of a rev_struct structure.
By the end of this call, mrp->tmp must have no less than 33 bits
[in] | mrp | is a pointer to rev_struct structure |
References rev_read_mrp().
|
inlinestatic |
Initiates the rev_struct structure and reads a few bytes to move the read address to multiple of 4.
There is another similar rev_init_mrp subroutine. The difference is that this one, rev_init, discards the first 12 bits (they have the sum of the lengths of VLC and MEL segments), and first unstuff depends on first 4 bits.
[in] | vlcp | is a pointer to rev_struct structure |
[in] | data | is a pointer to byte at the start of the cleanup pass |
[in] | lcup | is the length of MagSgn+MEL+VLC segments |
[in] | scup | is the length of MEL+VLC segments |
References ojph::local::rev_struct::bits, ojph::local::rev_struct::data, rev_read(), ojph::local::rev_struct::size, ojph::local::rev_struct::tmp, and ojph::local::rev_struct::unstuff.
Referenced by ojph_decode_codeblock(), ojph_decode_codeblock_ssse3(), and ojph_decode_codeblock_wasm().
|
inlinestatic |
Initiates the rev_struct structure and reads a few bytes to move the read address to multiple of 4.
There is another similar rev_init_mrp subroutine. The difference is that this one, rev_init, discards the first 12 bits (they have the sum of the lengths of VLC and MEL segments), and first unstuff depends on first 4 bits.
[in] | vlcp | is a pointer to rev_struct structure |
[in] | data | is a pointer to byte at the start of the cleanup pass |
[in] | lcup | is the length of MagSgn+MEL+VLC segments |
[in] | scup | is the length of MEL+VLC segments |
References rev_read().
|
inlinestatic |
Initiates the rev_struct structure and reads a few bytes to move the read address to multiple of 4.
There is another similar rev_init_mrp subroutine. The difference is that this one, rev_init, discards the first 12 bits (they have the sum of the lengths of VLC and MEL segments), and first unstuff depends on first 4 bits.
[in] | vlcp | is a pointer to rev_struct structure |
[in] | data | is a pointer to byte at the start of the cleanup pass |
[in] | lcup | is the length of MagSgn+MEL+VLC segments |
[in] | scup | is the length of MEL+VLC segments |
References rev_read().
|
inlinestatic |
Initialized rev_struct structure for MRP segment, and reads a number of bytes such that the next 32 bits read are from an address that is a multiple of 4.
Note this is designed for an architecture that read size must be compatible with the alignment of the read address
There is another simiar subroutine rev_init. This subroutine does NOT skip the first 12 bits, and starts with unstuff set to true.
[in] | mrp | is a pointer to rev_struct structure |
[in] | data | is a pointer to byte at the start of the cleanup pass |
[in] | lcup | is the length of MagSgn+MEL+VLC segments |
[in] | len2 | is the length of SPP+MRP segments |
References ojph::local::rev_struct::bits, ojph::local::rev_struct::data, rev_read_mrp(), ojph::local::rev_struct::size, ojph::local::rev_struct::tmp, and ojph::local::rev_struct::unstuff.
Referenced by ojph_decode_codeblock(), ojph_decode_codeblock_ssse3(), and ojph_decode_codeblock_wasm().
|
inlinestatic |
Initialized rev_struct structure for MRP segment, and reads a number of bytes such that the next 32 bits read are from an address that is a multiple of 4.
Note this is designed for an architecture that read size must be compatible with the alignment of the read address
There is another simiar subroutine rev_init. This subroutine does NOT skip the first 12 bits, and starts with unstuff set to true.
[in] | mrp | is a pointer to rev_struct structure |
[in] | data | is a pointer to byte at the start of the cleanup pass |
[in] | lcup | is the length of MagSgn+MEL+VLC segments |
[in] | len2 | is the length of SPP+MRP segments |
References rev_read_mrp().
|
inlinestatic |
Initialized rev_struct structure for MRP segment, and reads a number of bytes such that the next 32 bits read are from an address that is a multiple of 4.
Note this is designed for an architecture that read size must be compatible with the alignment of the read address
There is another simiar subroutine rev_init. This subroutine does NOT skip the first 12 bits, and starts with unstuff set to true.
[in] | mrp | is a pointer to rev_struct structure |
[in] | data | is a pointer to byte at the start of the cleanup pass |
[in] | lcup | is the length of MagSgn+MEL+VLC segments |
[in] | len2 | is the length of SPP+MRP segments |
References rev_read_mrp().
|
inlinestatic |
Read and unstuff data from a backwardly-growing segment.
This reader can read up to 8 bytes from before the VLC segment. Care must be taken not read from unreadable memory, causing a segmentation fault.
Note that there is another subroutine rev_read_mrp that is slightly different. The other one fills zeros when the buffer is exhausted. This one basically does not care if the bytes are consumed, because any extra data should not be used in the actual decoding.
Unstuffing is needed to prevent sequences more than 0xFF8F from appearing in the bits stream; since we are reading backward, we keep watch when a value larger than 0x8F appears in the bitstream. If the byte following this is 0x7F, we unstuff this byte (ignore the MSB of that byte, which should be 0).
[in] | vlcp | is a pointer to rev_struct structure |
References ojph::local::rev_struct::bits, ojph::local::rev_struct::data, ojph::local::rev_struct::size, ojph::local::rev_struct::tmp, and ojph::local::rev_struct::unstuff.
Referenced by rev_fetch(), and rev_init().
|
inlinestatic |
Read and unstuff data from a backwardly-growing segment.
This reader can read up to 8 bytes from before the VLC segment. Care must be taken not read from unreadable memory, causing a segmentation fault.
Note that there is another subroutine rev_read_mrp that is slightly different. The other one fills zeros when the buffer is exhausted. This one basically does not care if the bytes are consumed, because any extra data should not be used in the actual decoding.
Unstuffing is needed to prevent sequences more than 0xFF8F from appearing in the bits stream; since we are reading backward, we keep watch when a value larger than 0x8F appears in the bitstream. If the byte following this is 0x7F, we unstuff this byte (ignore the MSB of that byte, which should be 0).
[in] | vlcp | is a pointer to rev_struct structure |
|
inlinestatic |
Read and unstuff data from a backwardly-growing segment.
This reader can read up to 8 bytes from before the VLC segment. Care must be taken not read from unreadable memory, causing a segmentation fault.
Note that there is another subroutine rev_read_mrp that is slightly different. The other one fills zeros when the buffer is exhausted. This one basically does not care if the bytes are consumed, because any extra data should not be used in the actual decoding.
Unstuffing is needed to prevent sequences more than 0xFF8F from appearing in the bits stream; since we are reading backward, we keep watch when a value larger than 0x8F appears in the bitstream. If the byte following this is 0x7F, we unstuff this byte (ignore the MSB of that byte, which should be 0).
[in] | vlcp | is a pointer to rev_struct structure |
|
inlinestatic |
Reads and unstuffs from rev_struct.
This is different than rev_read in that this fills in zeros when the the available data is consumed. The other does not care about the values when all data is consumed.
See rev_read for more information about unstuffing
[in] | mrp | is a pointer to rev_struct structure |
References ojph::local::rev_struct::bits, ojph::local::rev_struct::data, ojph::local::rev_struct::size, ojph::local::rev_struct::tmp, and ojph::local::rev_struct::unstuff.
Referenced by rev_fetch_mrp(), and rev_init_mrp().
|
inlinestatic |
Reads and unstuffs from rev_struct.
This is different than rev_read in that this fills in zeros when the the available data is consumed. The other does not care about the values when all data is consumed.
See rev_read for more information about unstuffing
[in] | mrp | is a pointer to rev_struct structure |
|
inlinestatic |
Reads and unstuffs from rev_struct.
This is different than rev_read in that this fills in zeros when the the available data is consumed. The other does not care about the values when all data is consumed.
See rev_read for more information about unstuffing
[in] | mrp | is a pointer to rev_struct structure |
|
inlinestatic |
References ojph::local::mel_struct::buf, ojph::local::vlc_struct::buf, ojph::local::mel_struct::buf_size, ojph::local::vlc_struct::buf_size, grk::Logger::error(), grk::Logger::logger_, mel_emit_bit(), ojph::local::mel_struct::pos, ojph::local::vlc_struct::pos, ojph::local::mel_struct::remaining_bits, ojph::local::mel_struct::run, ojph::local::mel_struct::tmp, ojph::local::vlc_struct::tmp, and ojph::local::vlc_struct::used_bits.
Referenced by ojph_encode_codeblock().
|
static |
References ulvc_cwd_pre, ulvc_cwd_pre_len, ulvc_cwd_suf, and ulvc_cwd_suf_len.
|
inlinestatic |
References ojph::local::vlc_struct::buf, ojph::local::vlc_struct::buf_size, grk::Logger::error(), ojph::local::vlc_struct::last_greater_than_8F, grk::Logger::logger_, ojph_min, ojph::local::vlc_struct::pos, ojph::local::vlc_struct::tmp, and ojph::local::vlc_struct::used_bits.
Referenced by ojph_encode_codeblock().
|
inlinestatic |
|
static |
References ojph::population_count(), vlc_tbl0, and vlc_tbl1.
|
static |
Referenced by ojph_encode_codeblock(), and uvlc_init_tables().
|
static |
Referenced by ojph_encode_codeblock(), and uvlc_init_tables().
|
static |
Referenced by ojph_encode_codeblock(), and uvlc_init_tables().
|
static |
Referenced by ojph_encode_codeblock(), and uvlc_init_tables().
|
static |
|
static |