Miscellanea


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_tget_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]

Detailed Description


Define Documentation

#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

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 Documentation

typedef double coeff_t

Type definition for filter coefficients


Function Documentation

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).

Parameters:
value Target value
Returns:
Number of bits

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.

Parameters:
value Target value
Returns:
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.

Parameters:
in_channel Input channel
out_channel Output channel
channel_size Channel size
Returns:
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.

Parameters:
in_channel Input channel
out_channel Output channel
channel_size Channel size
Returns:
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.

Parameters:
block_R Red channel
block_G Green channel
block_B Blue channel
width Block width
height Block height
Returns:
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.

Parameters:
block_Y Luma channel
width Block width
height Block height
Returns:
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.

Parameters:
id Filterbank id
Returns:
Filterbank pointer or 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.

Parameters:
w Source width
h Source height
mode Either EPS_MODE_NORMAL or EPS_MODE_OTLPF
min Minimal block size
Returns:
Block size (width = height)

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.

Parameters:
buf Data buffer
buf_size Buffer size
n_fields Number of header fields
Returns:
Either EPS_OK or EPS_FORMAT_ERROR

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.

Parameters:
buf Data buffer
Returns:
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.

Parameters:
buf Data buffer
Returns:
Either EPS_OK or EPS_FORMAT_ERROR

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 
)

local int read_tc_header ( unsigned char *  buf,
int  buf_size,
eps_block_header hdr 
)


Variable Documentation

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,
}
Table to speed-up number_of_bits() calculation


Generated on Fri May 27 14:50:00 2011 for EPSILON by  doxygen 1.5.6