"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "xdelta3-fgk.h" between
xdelta3-3.0.11.tar.gz and xdelta3-3.1.0.tar.gz

About: xdelta is a tool and library for differential compression (supports VCDIFF encoding and decoding). Beta version.

xdelta3-fgk.h  (xdelta3-3.0.11):xdelta3-fgk.h  (xdelta3-3.1.0)
skipping to change at line 112 skipping to change at line 112
}; };
/*********************************************************************/ /*********************************************************************/
/* Encoder */ /* Encoder */
/*********************************************************************/ /*********************************************************************/
static fgk_stream* fgk_alloc (xd3_stream *stream /*, usize_t alpha bet_size */); static fgk_stream* fgk_alloc (xd3_stream *stream /*, usize_t alpha bet_size */);
static int fgk_init (xd3_stream *stream, static int fgk_init (xd3_stream *stream,
fgk_stream *h, fgk_stream *h,
int is_encode); int is_encode);
static int fgk_encode_data (fgk_stream *h, static usize_t fgk_encode_data (fgk_stream *h,
usize_t n); usize_t n);
static inline fgk_bit fgk_get_encoded_bit (fgk_stream *h); static inline fgk_bit fgk_get_encoded_bit (fgk_stream *h);
static int xd3_encode_fgk (xd3_stream *stream, static int xd3_encode_fgk (xd3_stream *stream,
fgk_stream *sec_stream, fgk_stream *sec_stream,
xd3_output *input, xd3_output *input,
xd3_output *output, xd3_output *output,
xd3_sec_cfg *cfg); xd3_sec_cfg *cfg);
/*********************************************************************/ /*********************************************************************/
/* Decoder */ /* Decoder */
/*********************************************************************/ /*********************************************************************/
static inline int fgk_decode_bit (fgk_stream *h, static inline int fgk_decode_bit (fgk_stream *h,
fgk_bit b); fgk_bit b);
static int fgk_decode_data (fgk_stream *h); static usize_t fgk_decode_data (fgk_stream *h);
static void fgk_destroy (xd3_stream *stream, static void fgk_destroy (xd3_stream *stream,
fgk_stream *h); fgk_stream *h);
static int xd3_decode_fgk (xd3_stream *stream, static int xd3_decode_fgk (xd3_stream *stream,
fgk_stream *sec_stream, fgk_stream *sec_stream,
const uint8_t **input, const uint8_t **input,
const uint8_t *const input_end, const uint8_t *const input_end,
uint8_t **output, uint8_t **output,
const uint8_t *const output_end); const uint8_t *const output_end);
skipping to change at line 237 skipping to change at line 237
static void fgk_swap_ptrs(fgk_node **one, fgk_node **two) static void fgk_swap_ptrs(fgk_node **one, fgk_node **two)
{ {
fgk_node *tmp = *one; fgk_node *tmp = *one;
*one = *two; *one = *two;
*two = tmp; *two = tmp;
} }
/* Takes huffman transmitter h and n, the nth elt in the alphabet, and /* Takes huffman transmitter h and n, the nth elt in the alphabet, and
* returns the number of required to encode n. */ * returns the number of required to encode n. */
static int fgk_encode_data (fgk_stream* h, usize_t n) static usize_t fgk_encode_data (fgk_stream* h, usize_t n)
{ {
fgk_node *target_ptr = h->alphabet + n; fgk_node *target_ptr = h->alphabet + n;
XD3_ASSERT (n < h->alphabet_size); XD3_ASSERT (n < h->alphabet_size);
h->coded_depth = 0; h->coded_depth = 0;
/* First encode the binary representation of the nth remaining /* First encode the binary representation of the nth remaining
* zero frequency element in reverse such that bit, which will be * zero frequency element in reverse such that bit, which will be
* encoded from h->coded_depth down to 0 will arrive in increasing * encoded from h->coded_depth down to 0 will arrive in increasing
* order following the tree path. If there is only one left, it * order following the tree path. If there is only one left, it
* is not neccesary to encode these bits. */ * is not neccesary to encode these bits. */
if (IS_ADAPTIVE && target_ptr->weight == 0) if (IS_ADAPTIVE && target_ptr->weight == 0)
{ {
unsigned int where, shift; usize_t where, shift;
int bits; usize_t bits;
where = fgk_find_nth_zero(h, n); where = fgk_find_nth_zero(h, n);
shift = 1; shift = 1;
if (h->zero_freq_rem == 0) if (h->zero_freq_rem == 0)
{ {
bits = h->zero_freq_exp; bits = h->zero_freq_exp;
} }
else else
{ {
skipping to change at line 737 skipping to change at line 737
ret = ret->right_child; ret = ret->right_child;
} }
return (usize_t)(ret - h->alphabet); return (usize_t)(ret - h->alphabet);
} }
/* once fgk_decode_bit returns 1, this retrieves an index into the /* once fgk_decode_bit returns 1, this retrieves an index into the
* alphabet otherwise this returns 0, indicating more bits are * alphabet otherwise this returns 0, indicating more bits are
* required. * required.
*/ */
static int fgk_decode_data (fgk_stream* h) static usize_t fgk_decode_data (fgk_stream* h)
{ {
usize_t elt = (usize_t)(h->decode_ptr - h->alphabet); usize_t elt = (usize_t)(h->decode_ptr - h->alphabet);
if (IS_ADAPTIVE && h->decode_ptr->weight == 0) { if (IS_ADAPTIVE && h->decode_ptr->weight == 0) {
usize_t i = 0; usize_t i = 0;
usize_t n = 0; usize_t n = 0;
if (h->coded_depth > 0) if (h->coded_depth > 0)
{ {
for (; i < h->coded_depth - 1; i += 1) for (; i < h->coded_depth - 1; i += 1)
 End of changes. 5 change blocks. 
6 lines changed or deleted 6 lines changed or added

Home  |  About  |  All  |  Newest  |  Fossies Dox  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTPS