]>
Commit | Line | Data |
---|---|---|
39236c6e A |
1 | /* |
2 | * Copyright (c) 2000-2013 Apple Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ | |
0a7de745 | 5 | * |
39236c6e A |
6 | * This file contains Original Code and/or Modifications of Original Code |
7 | * as defined in and that are subject to the Apple Public Source License | |
8 | * Version 2.0 (the 'License'). You may not use this file except in | |
9 | * compliance with the License. The rights granted to you under the License | |
10 | * may not be used to create, or enable the creation or redistribution of, | |
11 | * unlawful or unlicensed copies of an Apple operating system, or to | |
12 | * circumvent, violate, or enable the circumvention or violation of, any | |
13 | * terms of an Apple operating system software license agreement. | |
0a7de745 | 14 | * |
39236c6e A |
15 | * Please obtain a copy of the License at |
16 | * http://www.opensource.apple.com/apsl/ and read it before using this file. | |
0a7de745 | 17 | * |
39236c6e A |
18 | * The Original Code and all software distributed under the License are |
19 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
22 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. | |
23 | * Please see the License for the specific language governing rights and | |
24 | * limitations under the License. | |
0a7de745 | 25 | * |
39236c6e A |
26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ |
27 | */ | |
28 | ||
3a60a9f5 A |
29 | /* direct-mapped partial matching compressor with simple 22/10 split |
30 | * | |
31 | * Compresses buffers using a dictionary based match and partial match | |
32 | * (high bits only or full match) scheme. | |
33 | * | |
34 | * Paul Wilson -- wilson@cs.utexas.edu | |
35 | * Scott F. Kaplan -- sfkaplan@cs.utexas.edu | |
36 | * September 1997 | |
37 | */ | |
38 | ||
39 | /* compressed output format, in memory order | |
40 | * 1. a four-word HEADER containing four one-word values: | |
41 | * i. a one-word code saying what algorithm compressed the data | |
42 | * ii. an integer WORD offset into the page saying | |
43 | * where the queue position area starts | |
44 | * iii. an integer WORD offset into the page saying where | |
45 | * the low-bits area starts | |
46 | * iv. an integer WORD offset into the page saying where the | |
47 | * low-bits area ends | |
48 | * | |
0a7de745 | 49 | * 2. a 64-word TAGS AREA holding one two-bit tag for each word in |
3a60a9f5 A |
50 | * the original (1024-word) page, packed 16 per word |
51 | * | |
52 | * 3. a variable-sized FULL WORDS AREA (always word aligned and an | |
53 | * integral number of words) holding full-word patterns that | |
54 | * were not in the dictionary when encoded (i.e., dictionary misses) | |
55 | * | |
56 | * 4. a variable-sized QUEUE POSITIONS AREA (always word aligned and | |
57 | * an integral number of words) holding four-bit queue positions, | |
58 | * packed eight per word. | |
59 | * | |
60 | * 5. a variable-sized LOW BITS AREA (always word aligned and an | |
61 | * integral number of words) holding ten-bit low-bit patterns | |
0a7de745 | 62 | * (from partial matches), packed three per word. |
3a60a9f5 A |
63 | */ |
64 | ||
3a60a9f5 A |
65 | #ifdef __cplusplus |
66 | extern "C" { | |
67 | #endif | |
68 | ||
fe8ab488 | 69 | #include <mach/vm_param.h> |
3a60a9f5 | 70 | |
3a60a9f5 | 71 | |
0a7de745 | 72 | #define WKdm_SCRATCH_BUF_SIZE_INTERNAL PAGE_SIZE |
3a60a9f5 | 73 | |
fe8ab488 | 74 | typedef unsigned int WK_word; |
39236c6e | 75 | |
5ba3f43e A |
76 | #if defined(__arm64__) |
77 | ||
78 | void | |
0a7de745 A |
79 | WKdm_decompress_4k(const WK_word* src_buf, |
80 | WK_word* dest_buf, | |
81 | WK_word* scratch, | |
82 | unsigned int bytes); | |
5ba3f43e | 83 | int |
0a7de745 A |
84 | WKdm_compress_4k(const WK_word* src_buf, |
85 | WK_word* dest_buf, | |
86 | WK_word* scratch, | |
87 | unsigned int limit); | |
5ba3f43e A |
88 | |
89 | void | |
0a7de745 A |
90 | WKdm_decompress_16k(WK_word* src_buf, |
91 | WK_word* dest_buf, | |
92 | WK_word* scratch, | |
93 | unsigned int bytes); | |
5ba3f43e | 94 | int |
0a7de745 A |
95 | WKdm_compress_16k(WK_word* src_buf, |
96 | WK_word* dest_buf, | |
97 | WK_word* scratch, | |
98 | unsigned int limit); | |
5ba3f43e | 99 | #else |
39236c6e | 100 | |
3a60a9f5 | 101 | void |
0a7de745 A |
102 | WKdm_decompress_new(WK_word* src_buf, |
103 | WK_word* dest_buf, | |
104 | WK_word* scratch, | |
105 | unsigned int bytes); | |
39236c6e | 106 | int |
0a7de745 A |
107 | WKdm_compress_new(const WK_word* src_buf, |
108 | WK_word* dest_buf, | |
109 | WK_word* scratch, | |
110 | unsigned int limit); | |
5ba3f43e | 111 | #endif |
3a60a9f5 A |
112 | |
113 | #ifdef __cplusplus | |
114 | } /* extern "C" */ | |
115 | #endif |