1 2 #ifndef _SCHRO_PACK_H_ 3 #define _SCHRO_PACK_H_ 4 5 #include <schroedinger/schroutils.h> 6 #include <schroedinger/schrobuffer.h> 7 8 SCHRO_BEGIN_DECLS 9 10 typedef struct _SchroPack SchroPack; 11 12 struct _SchroPack { 13 SchroBuffer *buffer; 14 15 int n; 16 int shift; 17 int n_pack; 18 19 uint32_t value; 20 21 int error; 22 }; 23 24 #ifdef SCHRO_ENABLE_UNSTABLE_API 25 26 SchroPack * schro_pack_new (void); 27 void schro_pack_free (SchroPack *pack); 28 29 void schro_pack_encode_init (SchroPack *pack, SchroBuffer *buffer); 30 void schro_pack_copy (SchroPack *dest, SchroPack *src); 31 32 void schro_pack_sync (SchroPack *pack); 33 void schro_pack_flush (SchroPack *pack); 34 int schro_pack_get_offset (SchroPack *pack); 35 int schro_pack_get_bit_offset (SchroPack *pack); 36 37 void schro_pack_append (SchroPack *pack, const uint8_t *data, int len); 38 void schro_pack_append_zero (SchroPack *pack, int len); 39 40 void schro_pack_encode_bit (SchroPack *pack, int value); 41 void schro_pack_encode_bits (SchroPack *pack, int n, unsigned int value); 42 void schro_pack_encode_uint (SchroPack *pack, int value); 43 void schro_pack_encode_sint (SchroPack *pack, int value); 44 void schro_pack_encode_sint_s16 (SchroPack *pack, int16_t *values, int n); 45 void schro_pack_encode_sint_s32 (SchroPack *pack, int32_t *values, int n); 46 47 int schro_pack_estimate_uint (int value); 48 int schro_pack_estimate_sint (int value); 49 50 #endif 51 52 SCHRO_END_DECLS 53 54 #endif 55 56 57