Defines | |
#define | MAX(_x, _y) ((_x) > (_y) ? (_x) : (_y)) |
#define | MIN(_x, _y) ((_x) < (_y) ? (_x) : (_y)) |
#define | ABS(_x) ((_x) >= 0 ? (_x) : -(_x)) |
#define | SQRT2 1.414213562373095 |
#define | local static |
#define | NUMBER_OF_BITS(_x) (number_of_bits_table[(_x)]) |
#define | GET_BYTE(_x, _i) (((unsigned char *) &(_x))[(_i)]) |
Typedefs | |
typedef double | coeff_t |
Functions | |
int | number_of_bits (int value) |
int | is_power_of_two (int value) |
local void | round_channel (coeff_t **in_channel, int **out_channel, int channel_size) |
local void | copy_channel (int **in_channel, coeff_t **out_channel, int channel_size) |
local void | reset_RGB (unsigned char **block_R, unsigned char **block_G, unsigned char **block_B, int width, int height) |
local void | reset_Y (unsigned char **block_Y, int width, int height) |
local filterbank_t * | get_fb (char *id) |
local int | get_block_size (int w, int h, int mode, int min) |
local int | terminate_header (unsigned char *buf, int buf_size, int n_fields) |
local void | unterminate_header (unsigned char *buf) |
local int | header_sanity_check (unsigned char *buf) |
local int | read_gs_header (unsigned char *buf, int buf_size, eps_block_header *hdr) |
local int | read_tc_header (unsigned char *buf, int buf_size, eps_block_header *hdr) |
Variables | |
local int | number_of_bits_table [256] |
#define MAX | ( | _x, | |||
_y | ) | ((_x) > (_y) ? (_x) : (_y)) |
Maximum value
Referenced by eps_encode_truecolor_block(), eps_truncate_block(), and get_block_size().
#define MIN | ( | _x, | |||
_y | ) | ((_x) < (_y) ? (_x) : (_y)) |
Minimum value
Referenced by eps_encode_grayscale_block(), eps_encode_truecolor_block(), eps_truncate_block(), merge_channels(), and split_channels().
#define ABS | ( | _x | ) | ((_x) >= 0 ? (_x) : -(_x)) |
Absolute value
Referenced by decode_refinement_pass(), encode_refinement_pass(), extend_channel(), max_coeff(), periodic_extension(), significance_test(), symmetric_H_extension(), and symmetric_W_extension().
#define SQRT2 1.414213562373095 |
Square root
Referenced by analysis_1D(), and synthesis_1D().
#define local static |
Very helpful definition
#define NUMBER_OF_BITS | ( | _x | ) | (number_of_bits_table[(_x)]) |
Number of bits in a byte value
Referenced by number_of_bits().
#define GET_BYTE | ( | _x, | |||
_i | ) | (((unsigned char *) &(_x))[(_i)]) |
Extract one byte from integer
Referenced by number_of_bits().
typedef double coeff_t |
Type definition for filter coefficients
int number_of_bits | ( | int | value | ) |
Number of bits in the value
This function computes the number of bits in the value (e.g. number_of_bits(13) = 4).
value | Target value |
References GET_BYTE, and NUMBER_OF_BITS.
Referenced by alloc_LIS_slots(), analysis_2D(), decode_sorting_pass(), encode_sorting_pass(), free_LIS_slots(), get_block_size(), is_power_of_two(), speck_encode(), split_set(), synthesis_2D(), and validate_set().
int is_power_of_two | ( | int | value | ) |
Check whether the value is a power of two or not
This function checks whether the value is a power of two or not.
value | Target value |
1
if value is a power of two and 0
otherwise References number_of_bits().
Referenced by validate_set().
local void round_channel | ( | coeff_t ** | in_channel, | |
int ** | out_channel, | |||
int | channel_size | |||
) |
Round a channel
This function rounds each in_channel element to the nearest integer and stores it in the out_channel.
in_channel | Input channel | |
out_channel | Output channel | |
channel_size | Channel size |
VOID
References ROUND.
Referenced by eps_encode_grayscale_block(), and eps_encode_truecolor_block().
local void copy_channel | ( | int ** | in_channel, | |
coeff_t ** | out_channel, | |||
int | channel_size | |||
) |
Copy a channel
This function copies in_channel into the out_channel.
in_channel | Input channel | |
out_channel | Output channel | |
channel_size | Channel size |
VOID
Referenced by eps_decode_grayscale_block(), and eps_decode_truecolor_block().
local void reset_RGB | ( | unsigned char ** | block_R, | |
unsigned char ** | block_G, | |||
unsigned char ** | block_B, | |||
int | width, | |||
int | height | |||
) |
Reset RGB channels
This function initializes arrays block_R, block_G and block_B with zero.
block_R | Red channel | |
block_G | Green channel | |
block_B | Blue channel | |
width | Block width | |
height | Block height |
VOID
Referenced by eps_decode_truecolor_block().
local void reset_Y | ( | unsigned char ** | block_Y, | |
int | width, | |||
int | height | |||
) |
Reset Y channel
This function initializes array block_Y with zero.
block_Y | Luma channel | |
width | Block width | |
height | Block height |
VOID
Referenced by eps_decode_grayscale_block().
local filterbank_t* get_fb | ( | char * | id | ) |
Get filterbank pointer from id
This function gets filterbank pointer from id.
id | Filterbank id |
NULL
if not found References filterbanks.
Referenced by eps_decode_grayscale_block(), eps_decode_truecolor_block(), eps_encode_grayscale_block(), eps_encode_truecolor_block(), read_gs_header(), and read_tc_header().
local int get_block_size | ( | int | w, | |
int | h, | |||
int | mode, | |||
int | min | |||
) |
Compute required block size
This function computes block size (width=height) required for encoding and decoding process. Depending on mode parameter, function returns nearest power of two or power of two plus one.
w | Source width | |
h | Source height | |
mode | Either EPS_MODE_NORMAL or EPS_MODE_OTLPF | |
min | Minimal block size |
References EPS_MODE_NORMAL, MAX, and number_of_bits().
Referenced by eps_decode_grayscale_block(), eps_decode_truecolor_block(), eps_encode_grayscale_block(), and eps_encode_truecolor_block().
local int terminate_header | ( | unsigned char * | buf, | |
int | buf_size, | |||
int | n_fields | |||
) |
Terminate block header
This function replaces n_fields -th occurence of ; symbol with
0
. In other words, this function zero-terminates header.
buf | Data buffer | |
buf_size | Buffer size | |
n_fields | Number of header fields |
References EPS_FORMAT_ERROR, and EPS_OK.
Referenced by eps_read_block_header(), read_gs_header(), and read_tc_header().
local void unterminate_header | ( | unsigned char * | buf | ) |
Unterminate header
This function is inverse to the previous one. It replaces first occurence of 0
with ; symbol.
buf | Data buffer |
VOID
Referenced by eps_read_block_header(), read_gs_header(), and read_tc_header().
local int header_sanity_check | ( | unsigned char * | buf | ) |
Header sanity check
This function ensures that header contains only legal symbols.
buf | Data buffer |
References EPS_FORMAT_ERROR, and EPS_OK.
Referenced by read_gs_header(), and read_tc_header().
local int read_gs_header | ( | unsigned char * | buf, | |
int | buf_size, | |||
eps_block_header * | hdr | |||
) |
Read GRAYSCALE header
This function reads and checks block header of type EPS_GRAYSCALE_BLOCK. Result is stored in the hdr structure.
buf | Data buffer | |
buf_size | Buffer size | |
hdr | Block header |
References eps_block_header_tag::chk, eps_block_header_tag::chk_flag, eps_block_header_tag::crc, eps_block_header_tag::crc_flag, eps_block_header_tag::data_size, gs_hdr_tag::dc, EPS_BAD_CRC, EPS_FORMAT_ERROR, EPS_GOOD_CRC, EPS_MAX_BLOCK_SIZE, EPS_MODE_NORMAL, EPS_MODE_OTLPF, EPS_OK, EPS_PARAM_ERROR, epsilon_crc32(), gs_hdr_tag::fb_id, get_fb(), eps_block_header_tag::gs, gs_hdr_tag::h, gs_hdr_tag::H, eps_block_header_tag::hdr_data, eps_block_header_tag::hdr_size, header_sanity_check(), filterbank_t_tag::id, gs_hdr_tag::mode, ORTHOGONAL, terminate_header(), filterbank_t_tag::type, unterminate_header(), gs_hdr_tag::w, gs_hdr_tag::W, gs_hdr_tag::x, and gs_hdr_tag::y.
Referenced by eps_read_block_header().
local int read_tc_header | ( | unsigned char * | buf, | |
int | buf_size, | |||
eps_block_header * | hdr | |||
) |
Read TRUECOLOR header
This function reads and checks block header of type EPS_TRUECOLOR_BLOCK. Result is stored in the hdr structure.
buf | Data buffer | |
buf_size | Buffer size | |
hdr | Block header |
References tc_hdr_tag::Cb_rt, eps_block_header_tag::chk, eps_block_header_tag::chk_flag, tc_hdr_tag::Cr_rt, eps_block_header_tag::crc, eps_block_header_tag::crc_flag, eps_block_header_tag::data_size, tc_hdr_tag::dc_Cb, tc_hdr_tag::dc_Cr, tc_hdr_tag::dc_Y, EPS_BAD_CRC, EPS_FORMAT_ERROR, EPS_GOOD_CRC, EPS_MAX_BLOCK_SIZE, EPS_MODE_NORMAL, EPS_MODE_OTLPF, EPS_OK, EPS_PARAM_ERROR, EPS_RESAMPLE_420, EPS_RESAMPLE_444, epsilon_crc32(), tc_hdr_tag::fb_id, get_fb(), tc_hdr_tag::h, tc_hdr_tag::H, eps_block_header_tag::hdr_data, eps_block_header_tag::hdr_size, header_sanity_check(), filterbank_t_tag::id, tc_hdr_tag::mode, ORTHOGONAL, tc_hdr_tag::resample, eps_block_header_tag::tc, terminate_header(), filterbank_t_tag::type, unterminate_header(), tc_hdr_tag::w, tc_hdr_tag::W, tc_hdr_tag::x, tc_hdr_tag::y, and tc_hdr_tag::Y_rt.
Referenced by eps_read_block_header().
local int number_of_bits_table[256] |
Initial value:
{ 0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, }