TurboPFor: Integer Compression c/c++ header
This commit is contained in:
88
include/ic.h
Normal file → Executable file
88
include/ic.h
Normal file → Executable file
@ -537,6 +537,35 @@ void bitzdec(unsigned char *in, unsigned n, unsigned esize);
|
||||
#define FLOAT2INT(fval, scalse, bias) round(fval * scale + bias)
|
||||
#define INT2FLOAT(ival, scalse, bias) ((ival - bias) / scale)
|
||||
|
||||
//------- Quantization : b number of bits quantized in out ----------------
|
||||
#if defined(FLT16_BUILTIN)
|
||||
void fpquant8e16( _Float16 *in, size_t n, uint8_t *out, unsigned b, _Float16 *pfmin, _Float16 *pfmax);
|
||||
void fpquant16e16(_Float16 *in, size_t n, uint16_t *out, unsigned b, _Float16 *pfmin, _Float16 *pfmax);
|
||||
#endif
|
||||
|
||||
void fpquant8e32( float *in, size_t n, uint8_t *out, unsigned b, float *pfmin, float *pfmax);
|
||||
void fpquant16e32( float *in, size_t n, uint16_t *out, unsigned b, float *pfmin, float *pfmax);
|
||||
void fpquant32e32( float *in, size_t n, uint32_t *out, unsigned b, float *pfmin, float *pfmax);
|
||||
|
||||
void fpquant8e64( double *in, size_t n, uint8_t *out, unsigned b, double *pfmin, double *pfmax);
|
||||
void fpquant16e64( double *in, size_t n, uint16_t *out, unsigned b, double *pfmin, double *pfmax);
|
||||
void fpquant32e64( double *in, size_t n, uint32_t *out, unsigned b, double *pfmin, double *pfmax);
|
||||
void fpquant64e64( double *in, size_t n, uint64_t *out, unsigned b, double *pfmin, double *pfmax);
|
||||
|
||||
#if defined(FLT16_BUILTIN)
|
||||
void fpquant8d16( uint8_t *in, size_t n, _Float16 *out, unsigned b, _Float16 fmin, _Float16 fmax);
|
||||
void fpquant16d16(uint16_t *in, size_t n, _Float16 *out, unsigned b, _Float16 fmin, _Float16 fmax);
|
||||
#endif
|
||||
|
||||
void fpquant8d32( uint8_t *in, size_t n, float *out, unsigned b, float fmin, float fmax);
|
||||
void fpquant16d32(uint16_t *in, size_t n, float *out, unsigned b, float fmin, float fmax);
|
||||
void fpquant32d32(uint32_t *in, size_t n, float *out, unsigned b, float fmin, float fmax);
|
||||
|
||||
void fpquant8d64( uint8_t *in, size_t n, double *out, unsigned b, double fmin, double fmax);
|
||||
void fpquant16d64(uint16_t *in, size_t n, double *out, unsigned b, double fmin, double fmax);
|
||||
void fpquant32d64(uint32_t *in, size_t n, double *out, unsigned b, double fmin, double fmax);
|
||||
void fpquant64d64(uint64_t *in, size_t n, double *out, unsigned b, double fmin, double fmax);
|
||||
|
||||
//------- Lossy floating point transform: pad the trailing mantissa bits with zeros according to the error e (ex. e=0.00001)
|
||||
// must include float.h to use _Float16 (see icapp.c)
|
||||
#if defined(__clang__) && defined(__is_identifier)
|
||||
@ -983,35 +1012,35 @@ unsigned trled( const unsigned char *__restrict in, unsigned inlen, unsigned c
|
||||
}
|
||||
#endif
|
||||
|
||||
//-- "Integer Compression" variable length encoding with bitio ------------------
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
//-- Gamma coding (length limited) : Full 32 bit range
|
||||
size_t bitgenc32( unsigned char *_in, size_t _inlen, unsigned char *out);
|
||||
size_t bitgdec32( unsigned char *in, size_t _outlen, unsigned char *_out);
|
||||
|
||||
//-- Rice Coding (adaptive length limited) : Full 32 bit range ---
|
||||
size_t bitrenc32( unsigned char *_in, size_t _inlen, unsigned char *out);
|
||||
size_t bitrdec32( unsigned char *in, size_t _outlen, unsigned char *_out);
|
||||
|
||||
size_t vlcenc32( unsigned char *_in, size_t _inlen, unsigned char *out); // TurboVLC 32 bits
|
||||
size_t vlcdec32( unsigned char *in, size_t _outlen, unsigned char *_out);
|
||||
|
||||
size_t vlcenc16( unsigned char *_in, size_t _inlen, unsigned char *out); // TurboVLC 16 bits
|
||||
size_t vlcdec16( unsigned char *in, size_t _outlen, unsigned char *_out);
|
||||
|
||||
size_t vlczenc16( unsigned char *_in, size_t _inlen, unsigned char *out); // TurboVLC 16 bits zigzag
|
||||
size_t vlczdec16( unsigned char *in, size_t _outlen, unsigned char *_out);
|
||||
|
||||
size_t vlczenc32( unsigned char *_in, size_t _inlen, unsigned char *out); // TurboVLC 32 bits zigzag
|
||||
size_t vlczdec32( unsigned char *in, size_t _outlen, unsigned char *_out);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
//-- "Integer Compression" variable length encoding with bitio ------------------
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
//-- Gamma coding (length limited) : Full 32 bit range
|
||||
size_t bitgenc32( unsigned char *_in, size_t _inlen, unsigned char *out);
|
||||
size_t bitgdec32( unsigned char *in, size_t _outlen, unsigned char *_out);
|
||||
|
||||
//-- Rice Coding (adaptive length limited) : Full 32 bit range ---
|
||||
size_t bitrenc32( unsigned char *_in, size_t _inlen, unsigned char *out);
|
||||
size_t bitrdec32( unsigned char *in, size_t _outlen, unsigned char *_out);
|
||||
|
||||
size_t vlcenc32( unsigned char *_in, size_t _inlen, unsigned char *out); // TurboVLC 32 bits
|
||||
size_t vlcdec32( unsigned char *in, size_t _outlen, unsigned char *_out);
|
||||
|
||||
size_t vlcenc16( unsigned char *_in, size_t _inlen, unsigned char *out); // TurboVLC 16 bits
|
||||
size_t vlcdec16( unsigned char *in, size_t _outlen, unsigned char *_out);
|
||||
|
||||
size_t vlczenc16( unsigned char *_in, size_t _inlen, unsigned char *out); // TurboVLC 16 bits zigzag
|
||||
size_t vlczdec16( unsigned char *in, size_t _outlen, unsigned char *_out);
|
||||
|
||||
size_t vlczenc32( unsigned char *_in, size_t _inlen, unsigned char *out); // TurboVLC 32 bits zigzag
|
||||
size_t vlczdec32( unsigned char *in, size_t _outlen, unsigned char *_out);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
//-- "Integer Compression" variable byte (scalar TurboVByte+ SIMD TurboByte) ---------------------------------------------------------------
|
||||
|
||||
#ifdef __cplusplus
|
||||
@ -1632,4 +1661,3 @@ unsigned char *vsdec64(unsigned char *__restrict in, size_t n, uint64_t *
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user