forked from uviespace/airs-compression
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcmp_header.h
More file actions
65 lines (55 loc) · 2.14 KB
/
cmp_header.h
File metadata and controls
65 lines (55 loc) · 2.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/**
* @file
* @author Dominik Loidolt ([email protected])
* @date 2025
*
* @copyright GPL-2.0
*
* @brief Compression header definitions
*
* Based on ARIEL-UVIE-PL-TN-004 Issue 0.2
*/
#ifndef CMP_HEADER_H
#define CMP_HEADER_H
/*
* Bit length of the different header fields
*/
#define CMP_HDR_BITS_VERSION 16
#define CMP_HDR_BITS_COMPRESSED_SIZE 24
#define CMP_HDR_BITS_ORIGINAL_SIZE 24
#define CMP_HDR_BITS_CHECKSUM 32
#define CMP_HDR_BITS_IDENTIFIER 32
#define CMP_HDR_BITS_SEQUENCE_NUMBER 8
#define CMP_HDR_BITS_PREPROCESSING 3
#define CMP_HDR_BITS_ENCODER_TYPE 2
#define CMP_HDR_BITS_ORIGINAL_DTYPE 3
#define CMP_HDR_BITS_ENCODER_PARAM 16
#define CMP_HDR_BITS_ENCODER_OUTLIER 24
#define CMP_HDR_BITS_PREPROCESS_PARAM 8
/*
* Byte offsets of the different header fields
*/
#define CMP_HDR_OFFSET_VERSION 0
#define CMP_HDR_OFFSET_COMPRESSED_SIZE 2
#define CMP_HDR_OFFSET_ORIGINAL_SIZE 5
#define CMP_HDR_OFFSET_CHECKSUM 8
#define CMP_HDR_OFFSET_IDENTIFIER 12
#define CMP_HDR_OFFSET_SEQUENCE_NUMBER 16
#define CMP_HDR_OFFSET_PED_FIELDS 17 /* combined: preprocessing, encoder type, original dtype */
#define CMP_HDR_OFFSET_ENCODER_PARAM 18
#define CMP_HDR_OFFSET_OUTLIER_PARAM 20
#define CMP_HDR_OFFSET_PREPROCESS_PARAM 23
/*
* Maximum values that can be stored in the size fields
*/
#define CMP_HDR_MAX_COMPRESSED_SIZE ((1UL << CMP_HDR_BITS_COMPRESSED_SIZE) - 1)
#define CMP_HDR_MAX_ORIGINAL_SIZE ((1UL << CMP_HDR_BITS_ORIGINAL_SIZE) - 1)
/** Size of the compression header in bytes */
#define CMP_HDR_SIZE \
((CMP_HDR_BITS_VERSION + CMP_HDR_BITS_COMPRESSED_SIZE + CMP_HDR_BITS_ORIGINAL_SIZE + \
CMP_HDR_BITS_CHECKSUM + CMP_HDR_BITS_IDENTIFIER + CMP_HDR_BITS_SEQUENCE_NUMBER + \
CMP_HDR_BITS_PREPROCESSING + CMP_HDR_BITS_ENCODER_TYPE + CMP_HDR_BITS_ENCODER_PARAM + \
CMP_HDR_BITS_ENCODER_OUTLIER + CMP_HDR_BITS_ORIGINAL_DTYPE + \
CMP_HDR_BITS_PREPROCESS_PARAM) / \
8)
#endif /* CMP_HEADER_H */