Byte stuffing


Functions

int stuff_data (unsigned char *input_data, unsigned char *output_data, int input_length, int output_length)
int unstuff_data (unsigned char *input_data, unsigned char *output_data, int input_length, int output_length)

Detailed Description


Function Documentation

int stuff_data ( unsigned char *  input_data,
unsigned char *  output_data,
int  input_length,
int  output_length 
)

Byte stuffing

This function performes byte stuffing. All zero-valued bytes in the input_data will be eliminated. The result will be stored in the output_data. This operation involves some marginal data expansion, no more than 0.4% at worst case.

Parameters:
input_data Input data
output_data Output data
input_length Input data length
output_length Output data length
Returns:
Number of bytes actually used in the output_data
Note:
Caller must allocate enough space for the output_data beforehand. This value can be calculated by the following formula: input_length + (input_length / 254) + 1.

Referenced by eps_encode_grayscale_block(), and eps_encode_truecolor_block().

int unstuff_data ( unsigned char *  input_data,
unsigned char *  output_data,
int  input_length,
int  output_length 
)

Byte unstuffing

This function is inverse to the previous one. It recovers original data. The result will be stored in the output_data.

Parameters:
input_data Input data
output_data Output data
input_length Input data length
output_length Output data length
Returns:
Number of bytes actually used in the output_data
Note:
Caller must allocate enough space for the output_data beforehand. Safe value is input_length.

Referenced by eps_decode_grayscale_block(), and eps_decode_truecolor_block().


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