This commit is contained in:
powturbo
2015-05-28 16:56:34 +02:00
parent 6fa33b24b5
commit 26ee9f36f7

31
vp4dc.h
View File

@ -1,5 +1,5 @@
/**
Copyright (C) powturbo 2013-2014
Copyright (C) powturbo 2013-2015
GPL v2 License
This program is free software; you can redistribute it and/or modify
@ -16,20 +16,37 @@
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- email : powturbo [AT] gmail.com
- github : https://github.com/powturbo
- homepage : https://sites.google.com/site/powturbo/
- github : https://github.com/powturbo
- twitter : https://twitter.com/powturbo
vp4dc.h - "Integer Compression" TurboPfor (see vp4dd.h for decompression)
- email : powturbo [_AT_] gmail [_DOT_] com
**/
// vp4dc.h - "Integer Compression" TurboPfor (see vp4dd.h for decompression)
#define P4DEB(__b) (__b << 1)
#define P4DEBX(__b, __bx) (__bx << 8 | __b << 1 | 1)
#define P4DSAVE(__out, __b, __bx) do { if(!__bx) *__out++ = P4DEB(__b);else *(unsigned short *)__out = P4DEBX(__b, __bx), __out += 2; } while(0)
#ifdef __cplusplus
extern "C" {
#endif
// compress integer array with n values to the buffer out. Return value = end of compressed buffer out
unsigned char *p4denc32(unsigned *__restrict in, int n, unsigned char *__restrict out);
unsigned char *p4denc16(unsigned short *__restrict in, int n, unsigned char *__restrict out);
unsigned char *p4denc32(unsigned *__restrict in, unsigned n, unsigned char *__restrict out);
unsigned char *p4denc16(unsigned short *__restrict in, unsigned n, unsigned char *__restrict out);
// SIMD compress integer array with n values to the buffer out. Return value = end of compressed buffer out
unsigned char *p4dencv32(unsigned *__restrict in, unsigned n, unsigned char *__restrict out);
//unsigned char *p4denc16(unsigned short *__restrict in, unsigned n, unsigned char *__restrict out);
// calculate the best bit size b and bx.
unsigned p4d32(unsigned *__restrict in, unsigned n, unsigned *pbx);
unsigned p4d16(unsigned short *__restrict in, unsigned n, unsigned *pbx);
// same as p4denc, but with b and bx as parameters. Call after p4d32/p4d16
unsigned char *p4de32(unsigned *__restrict in, unsigned n, unsigned char *__restrict out, unsigned b, unsigned bx);
unsigned char *p4de16(unsigned short *__restrict in, unsigned n, unsigned char *__restrict out, unsigned b, unsigned bx);
unsigned char *p4dev32(unsigned *__restrict in, unsigned n, unsigned char *__restrict out, unsigned b, unsigned bx);
#ifdef __cplusplus
}