ARB
Classes | Macros | Functions | Variables
adcompr.cxx File Reference
#include <climits>
#include <arbdbt.h>
#include "gb_key.h"
#include "gb_t_prot.h"
#include "gb_compress.h"
#include "gb_localdata.h"
#include <stdint.h>
Include dependency graph for adcompr.cxx:

Go to the source code of this file.

Classes

struct  huffmann_list
 

Macros

#define GBTUM_COMPRESS_TREE_SIZE   32
 
#define GB_READ_BIT(p, c, bp, result)   if (!bp) { c = *(p++); bp = 8; }; result = (c>>7); result &= 1; c <<= 1; bp--
 
#define GB_INIT_WRITE_BITS(p, bp)   *p = 0; bp = 8
 
#define GB_WRITE_BITS(p, bp, bitc, bits, i)
 
#define GB_READ_BITS(p, c, bp, bitc, bits)
 
#define GB_COPY_NONRUN(dest, source, len)
 

Functions

static __ATTR__USERESULT GB_ERROR gb_check_huffmann_tree (gb_compress_tree *t)
 
gb_compress_treegb_build_uncompress_tree (const unsigned char *data, long short_flag, char **end)
 
void gb_free_compress_tree (gb_compress_tree *tree)
 
gb_compress_listgb_build_compress_list (const unsigned char *data, long short_flag, long *size)
 
chargb_compress_bits (const char *source, long size, const unsigned char *c_0, long *msize)
 
GB_BUFFER gb_uncompress_bits (const char *source, long size, char c_0, char c_1)
 
static charg_b_write_run (char *dest, int scount, int lastbyte)
 
void gb_compress_equal_bytes_2 (const char *source, size_t size, size_t *msize, char *dest)
 
static GB_BUFFER gb_compress_equal_bytes (const char *source, size_t size, size_t *msize, int last_flag)
 
static void gb_compress_huffmann_add_to_list (long val, gb_compress_list *element)
 
static long gb_compress_huffmann_pop (long *val, gb_compress_list **element)
 
static chargb_compress_huffmann_rek (gb_compress_list *bc, int bits, int bitcnt, char *dest)
 
static GB_BUFFER gb_compress_huffmann (GB_CBUFFER source, size_t size, size_t *msize, int last_flag)
 
static GB_BUFFER gb_uncompress_equal_bytes (GB_CBUFFER s, size_t size, size_t *new_size)
 
static GB_BUFFER gb_uncompress_huffmann (GB_CBUFFER source, size_t maxsize, size_t *new_size)
 
GB_BUFFER gb_uncompress_bytes (GB_CBUFFER source, size_t size, size_t *new_size)
 
GB_BUFFER gb_uncompress_longs_old (GB_CBUFFER source, size_t size, size_t *new_size)
 
static GB_BUFFER gb_uncompress_longs (GB_CBUFFER data, size_t size, size_t *new_size)
 
static GB_BUFFER gb_compress_longs (GB_CBUFFER source, long size, int last_flag)
 
GB_DICTIONARYgb_get_dictionary (GB_MAIN_TYPE *Main, GBQUARK key)
 
bool GB_is_dictionary_compressed (GBDATA *gbd)
 
GB_BUFFER gb_compress_data (GBDATA *gbd, int key, GB_CBUFFER source, size_t size, size_t *msize, GB_COMPRESSION_MASK max_compr, bool pre_compressed)
 
GB_CBUFFER gb_uncompress_data (GBDATA *gbd, GB_CBUFFER source, size_t size)
 

Variables

static huffmann_listhuffmann_listhead = NULp
 

Macro Definition Documentation

#define GBTUM_COMPRESS_TREE_SIZE   32

Definition at line 26 of file adcompr.cxx.

Referenced by gb_compress_huffmann().

#define GB_READ_BIT (   p,
  c,
  bp,
  result 
)    if (!bp) { c = *(p++); bp = 8; }; result = (c>>7); result &= 1; c <<= 1; bp--

Definition at line 29 of file adcompr.cxx.

Referenced by gb_uncompress_bits(), and gb_uncompress_huffmann().

#define GB_INIT_WRITE_BITS (   p,
  bp 
)    *p = 0; bp = 8

Definition at line 31 of file adcompr.cxx.

Referenced by gb_compress_bits(), and gb_compress_huffmann().

#define GB_WRITE_BITS (   p,
  bp,
  bitc,
  bits,
 
)
Value:
if (bp<=0) { bp += 8; p++; *p = 0; } \
if ((i=bp-bitc)<0) { \
*p |= bits>>(-i); \
i += 8; \
bp += 8; p++; *p = 0; \
} \
*p |= bits<<i; \
bp-=bitc;
GB_write_int const char GB_write_autoconv_string WRITE_SKELETON(write_pointer, GBDATA *,"%p", GB_write_pointer) char *AW_awa if)(!gb_var) return strdup("")
Definition: AW_awar.cxx:163

Definition at line 33 of file adcompr.cxx.

Referenced by gb_compress_bits(), and gb_compress_huffmann().

#define GB_READ_BITS (   p,
  c,
  bp,
  bitc,
  bits 
)
Value:
{ \
long _i; \
int _r; \
bits = 0; \
for (_i=bitc-1; _i>=0; _i--) { \
GB_READ_BIT(p, c, bp, _r); \
bits = (bits<<1) + _r; \
} }
#define GB_READ_BIT(p, c, bp, result)
Definition: adcompr.cxx:29
long
Definition: AW_awar.cxx:152

Definition at line 43 of file adcompr.cxx.

Referenced by gb_uncompress_huffmann().

#define GB_COPY_NONRUN (   dest,
  source,
  len 
)
Value:
while (len > 120) { \
int _i = 120; \
char *_p; \
len -= _i; \
*(dest++) = _i; \
_p = dest; dest+=_i; \
while (_i--) { \
*(_p++) = *(source++); \
} \
} \
if (len >0) { \
int _i = len; \
char *_p; \
len = 0; \
*(dest++) = _i; \
_p = dest; dest+=_i; \
while (_i--) { \
*(_p++) = *(source++); \
} \
}
GB_write_int const char GB_write_autoconv_string WRITE_SKELETON(write_pointer, GBDATA *,"%p", GB_write_pointer) char *AW_awa if)(!gb_var) return strdup("")
Definition: AW_awar.cxx:163
while(1)

Definition at line 370 of file adcompr.cxx.

Referenced by gb_compress_equal_bytes_2().

Function Documentation

static __ATTR__USERESULT GB_ERROR gb_check_huffmann_tree ( gb_compress_tree t)
static

Definition at line 53 of file adcompr.cxx.

References GB_export_error(), gb_compress_tree::leaf, NULp, and gb_compress_tree::son.

Referenced by gb_build_uncompress_tree().

gb_compress_tree* gb_build_uncompress_tree ( const unsigned char data,
long  short_flag,
char **  end 
)
void gb_free_compress_tree ( gb_compress_tree tree)
gb_compress_list* gb_build_compress_list ( const unsigned char data,
long  short_flag,
long size 
)
char* gb_compress_bits ( const char source,
long  size,
const unsigned char c_0,
long msize 
)
GB_BUFFER gb_uncompress_bits ( const char source,
long  size,
char  c_0,
char  c_1 
)
static char* g_b_write_run ( char dest,
int  scount,
int  lastbyte 
)
static

Definition at line 341 of file adcompr.cxx.

Referenced by gb_compress_equal_bytes_2().

void gb_compress_equal_bytes_2 ( const char source,
size_t  size,
size_t msize,
char dest 
)
static GB_BUFFER gb_compress_equal_bytes ( const char source,
size_t  size,
size_t msize,
int  last_flag 
)
static
static void gb_compress_huffmann_add_to_list ( long  val,
gb_compress_list element 
)
static
static long gb_compress_huffmann_pop ( long val,
gb_compress_list **  element 
)
static
static char* gb_compress_huffmann_rek ( gb_compress_list bc,
int  bits,
int  bitcnt,
char dest 
)
static
static GB_BUFFER gb_compress_huffmann ( GB_CBUFFER  source,
size_t  size,
size_t msize,
int  last_flag 
)
static
static GB_BUFFER gb_uncompress_equal_bytes ( GB_CBUFFER  s,
size_t  size,
size_t new_size 
)
static
static GB_BUFFER gb_uncompress_huffmann ( GB_CBUFFER  source,
size_t  maxsize,
size_t new_size 
)
static
GB_BUFFER gb_uncompress_bytes ( GB_CBUFFER  source,
size_t  size,
size_t new_size 
)

Definition at line 761 of file adcompr.cxx.

References gb_assert, gb_uncompress_equal_bytes(), and gb_uncompress_huffmann().

Referenced by gb_convert_compression().

GB_BUFFER gb_uncompress_longs_old ( GB_CBUFFER  source,
size_t  size,
size_t new_size 
)
static GB_BUFFER gb_uncompress_longs ( GB_CBUFFER  data,
size_t  size,
size_t new_size 
)
static

Definition at line 806 of file adcompr.cxx.

References GB_give_other_buffer(), and STATIC_ASSERT.

Referenced by GB_is_dictionary_compressed(), and gb_uncompress_data().

static GB_BUFFER gb_compress_longs ( GB_CBUFFER  source,
long  size,
int  last_flag 
)
static

Definition at line 832 of file adcompr.cxx.

References GB_COMPRESSION_SORTBYTES, and GB_give_other_buffer().

Referenced by gb_compress_data().

GB_DICTIONARY* gb_get_dictionary ( GB_MAIN_TYPE Main,
GBQUARK  key 
)
bool GB_is_dictionary_compressed ( GBDATA gbd)
GB_BUFFER gb_compress_data ( GBDATA gbd,
int  key,
GB_CBUFFER  source,
size_t  size,
size_t msize,
GB_COMPRESSION_MASK  max_compr,
bool  pre_compressed 
)
GB_CBUFFER gb_uncompress_data ( GBDATA gbd,
GB_CBUFFER  source,
size_t  size 
)

Variable Documentation

huffmann_list* huffmann_listhead = NULp
static

Definition at line 464 of file adcompr.cxx.

Referenced by gb_compress_huffmann_add_to_list().