summaryrefslogtreecommitdiff
path: root/src/libaec.h
diff options
context:
space:
mode:
authorMathis Rosenhauer <rosenhauer@dkrz.de>2014-08-01 13:51:04 +0200
committerMathis Rosenhauer <rosenhauer@dkrz.de>2014-08-01 15:16:51 +0200
commit6f2ffa1769746b622c4860d2491b0f7ff3407259 (patch)
tree73e8a136791ab6eef469cca33ae6ee1eaf5ccc1f /src/libaec.h
parent8e055aaa334e5d41828932bc898e0cb42870b6af (diff)
downloadlibaec-6f2ffa1769746b622c4860d2491b0f7ff3407259.tar.gz
libaec-6f2ffa1769746b622c4860d2491b0f7ff3407259.tar.bz2
libaec-6f2ffa1769746b622c4860d2491b0f7ff3407259.zip
More explicit casting to shup up VS.
Diffstat (limited to 'src/libaec.h')
-rw-r--r--src/libaec.h123
1 files changed, 71 insertions, 52 deletions
diff --git a/src/libaec.h b/src/libaec.h
index 736a069..dc3d236 100644
--- a/src/libaec.h
+++ b/src/libaec.h
@@ -69,71 +69,88 @@ struct internal_state;
struct aec_stream {
const unsigned char *next_in;
- size_t avail_in; /* number of bytes available at
- * next_in
- */
- size_t total_in; /* total number of input bytes read so
- * far
- */
+
+ /* number of bytes available at next_in */
+ size_t avail_in;
+
+ /* total number of input bytes read so far */
+ size_t total_in;
+
unsigned char *next_out;
- size_t avail_out; /* remaining free space at next_out */
- size_t total_out; /* total number of bytes output so far */
- int bits_per_sample; /* resolution in bits per sample (n =
- * 1, ..., 32)
- */
- int block_size; /* block size in samples */
- int rsi; /* Reference sample interval, the
- * number of Coded Data Sets between
- * consecutive reference samples (up
- * to 4096).
- */
- int flags;
+
+ /* remaining free space at next_out */
+ size_t avail_out;
+
+ /* total number of bytes output so far */
+ size_t total_out;
+
+ /* resolution in bits per sample (n = 1, ..., 32) */
+ unsigned int bits_per_sample;
+
+ /* block size in samples */
+ unsigned int block_size;
+
+ /* Reference sample interval, the number of Coded Data Sets
+ * between consecutive reference samples (up to 4096). */
+ unsigned int rsi;
+
+ unsigned int flags;
struct internal_state *state;
};
+/*********************************/
/* Sample data description flags */
-#define AEC_DATA_SIGNED 1 /* Samples are signed. Telling libaec
- * this results in a slightly better
- * compression ratio. Default is
- * unsigned.
- */
-#define AEC_DATA_3BYTE 2 /* 24 bit samples are coded in 3 bytes */
-#define AEC_DATA_MSB 4 /* Samples are stored with their most
- * significant bit first. This has
- * nothing to do with the endianness
- * of the host. Default is LSB.
- */
-#define AEC_DATA_PREPROCESS 8 /* Set if preprocessor should be used */
-
-#define AEC_RESTRICTED 16 /* Use restricted set of code options */
-#define AEC_PAD_RSI 32 /* Pad RSI to byte boundary. Only for
- * decoding CCSDS sample data. */
+/*********************************/
+/* Samples are signed. Telling libaec this results in a slightly
+ * better compression ratio. Default is unsigned. */
+#define AEC_DATA_SIGNED 1
+
+/* 24 bit samples are coded in 3 bytes */
+#define AEC_DATA_3BYTE 2
+
+/* Samples are stored with their most significant bit first. This has
+ * nothing to do with the endianness of the host. Default is LSB. */
+#define AEC_DATA_MSB 4
+
+/* Set if preprocessor should be used */
+#define AEC_DATA_PREPROCESS 8
+
+/* Use restricted set of code options */
+#define AEC_RESTRICTED 16
+
+/* Pad RSI to byte boundary. Only for decoding CCSDS sample data. */
+#define AEC_PAD_RSI 32
+
+/*************************************/
/* Return codes of library functions */
-#define AEC_OK 0
-#define AEC_CONF_ERROR (-1)
+/*************************************/
+#define AEC_OK 0
+#define AEC_CONF_ERROR (-1)
#define AEC_STREAM_ERROR (-2)
-#define AEC_DATA_ERROR (-3)
-#define AEC_MEM_ERROR (-4)
+#define AEC_DATA_ERROR (-3)
+#define AEC_MEM_ERROR (-4)
+/************************/
/* Options for flushing */
-#define AEC_NO_FLUSH 0 /* Do not enforce output
- * flushing. More input may be
- * provided with later calls. So far
- * only relevant for encoding.
- */
-#define AEC_FLUSH 1 /* Flush output and end encoding. The
- * last call to aec_encode() must set
- * AEC_FLUSH to drain all output.
- *
- * It is not possible to continue
- * encoding of the same stream after it
- * has been flushed because the last byte
- * may be padded with fill bits.
- */
+/************************/
+
+/* Do not enforce output flushing. More input may be provided with
+ * later calls. So far only relevant for encoding. */
+#define AEC_NO_FLUSH 0
+
+/* Flush output and end encoding. The last call to aec_encode() must
+ * set AEC_FLUSH to drain all output.
+ *
+ * It is not possible to continue encoding of the same stream after it
+ * has been flushed because the last byte may be padded with fill
+ * bits. */
+#define AEC_FLUSH 1
+/*********************************************/
/* Streaming encoding and decoding functions */
+/*********************************************/
AEC_SCOPE int aec_encode_init(struct aec_stream *strm);
AEC_SCOPE int aec_encode(struct aec_stream *strm, int flush);
AEC_SCOPE int aec_encode_end(struct aec_stream *strm);
@@ -142,7 +159,9 @@ AEC_SCOPE int aec_decode_init(struct aec_stream *strm);
AEC_SCOPE int aec_decode(struct aec_stream *strm, int flush);
AEC_SCOPE int aec_decode_end(struct aec_stream *strm);
+/***************************************************************/
/* Utility functions for encoding or decoding a memory buffer. */
+/***************************************************************/
AEC_SCOPE int aec_buffer_encode(struct aec_stream *strm);
AEC_SCOPE int aec_buffer_decode(struct aec_stream *strm);