|
1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Name : CDeflateCompBytecode.cpp |
|
15 // Part of : deflatecomp |
|
16 // deflate ECOM plugin, CSigCompBytecode implementation |
|
17 // Version : 1. |
|
18 // |
|
19 |
|
20 |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <badesca.h> |
|
24 #include <hash.h> |
|
25 |
|
26 #include "DeflateCompBytecode.h" |
|
27 |
|
28 |
|
29 /** bytecode for static compression with optional dictionary */ |
|
30 static const TUint8 KStaticDeflateBytecode[] = |
|
31 { |
|
32 0x1c, 0x0a, 0xa0, 0x75, 0x0a, 0x0f, 0x86, 0x04, 0xa1, 0x6a, 0x00, 0x05, |
|
33 0xa1, 0x6a, 0x1c, 0x02, 0xa0, 0x42, 0xfc, 0x17, 0xc0, 0x7b, 0x00, 0x07, |
|
34 0x15, 0x07, 0x1f, 0xa0, 0x75, 0x06, 0x00, 0xc0, 0x7b, 0x63, 0x00, 0x13, |
|
35 0x63, 0xc0, 0x7b, 0x23, 0x1d, 0x03, 0x2a, 0xe2, 0x1e, 0x20, 0x27, 0x04, |
|
36 0x07, 0x00, 0x17, 0x00, 0x01, 0x30, 0xa0, 0xbf, 0x88, 0x00, 0xa0, 0xc0, |
|
37 0xa0, 0xc7, 0x18, 0x01, 0x00, 0x89, 0x00, 0x17, 0x50, 0x88, 0x20, 0x06, |
|
38 0x06, 0x22, 0x21, 0x01, 0x13, 0x21, 0x01, 0x23, 0x16, 0x9f, 0xdc, 0x0e, |
|
39 0x2c, 0xa4, 0x01, 0x23, 0x2c, 0xa0, 0x7d, 0xa0, 0xf5, 0xa0, 0x75, 0xa0, |
|
40 0x85, 0x06, 0x00, 0x0e, 0x26, 0x01, 0x07, 0x13, 0x50, 0x01, 0x13, 0x01, |
|
41 0x05, 0x10, 0x01, 0x07, 0x10, 0x53, 0x17, 0x50, 0x0e, 0x06, 0x1e, 0xe1, |
|
42 0x0e, 0x22, 0x50, 0x09, 0x11, 0x02, 0x0e, 0x24, 0x50, 0x01, 0x12, 0x01, |
|
43 0x02, 0x12, 0x02, 0x04, 0x12, 0x51, 0x17, 0x50, 0x01, 0x0a, 0x0d, 0x10, |
|
44 0x0e, 0x26, 0xa0, 0xff, 0x0e, 0x24, 0x00, 0x0e, 0x22, 0x01, 0x06, 0x12, |
|
45 0x02, 0x02, 0x12, 0x01, 0x07, 0x11, 0x01, 0x04, 0x13, 0x51, 0x06, 0x12, |
|
46 0x53, 0x1d, 0x51, 0x2a, 0xed, 0x06, 0x12, 0x55, 0x1e, 0x20, 0xe6, 0x01, |
|
47 0x05, 0x00, 0xff, 0x00, 0x0e, 0x28, 0x01, 0x17, 0x50, 0x04, 0x1f, 0x06, |
|
48 0x06, 0x0e, 0x26, 0x01, 0x01, 0x13, 0x50, 0x02, 0x13, 0x02, 0x05, 0x10, |
|
49 0x01, 0x07, 0x10, 0x01, 0x04, 0x13, 0x50, 0x06, 0x14, 0x53, 0x1d, 0x50, |
|
50 0x20, 0xe1, 0x06, 0x14, 0x50, 0x0e, 0x2a, 0x63, 0x14, 0x54, 0x52, 0x23, |
|
51 0x22, 0x55, 0x52, 0x16, 0x9f, 0x45 |
|
52 }; |
|
53 |
|
54 /** bytecode for static compression with uploaded dictionary */ |
|
55 static const TUint8 KStaticUploadDeflateBytecode[] = |
|
56 { |
|
57 0x0f, 0x86, 0x04, 0xa1, 0xcf, 0x00, 0x05, 0xa1, 0xcf, 0x1c, 0x02, 0xa0, |
|
58 0x42, 0xfc, 0x1c, 0x02, 0xa0, 0x7b, 0xf7, 0x1c, 0xc0, 0x7b, 0xa1, 0xcf, |
|
59 0xf2, 0x13, 0x63, 0xc0, 0x7b, 0x23, 0x0e, 0x28, 0x61, 0x07, 0x14, 0xa1, |
|
60 0xcd, 0x0e, 0x2a, 0x54, 0x06, 0x15, 0x08, 0x0f, 0xa1, 0xc5, 0x04, 0x54, |
|
61 0xa1, 0xcd, 0x00, 0x06, 0x0e, 0xa1, 0xcd, 0x63, 0x0e, 0xa0, 0x7b, 0x54, |
|
62 0x20, 0x54, 0xa1, 0xcd, 0x00, 0x06, 0x01, 0x0d, 0xa1, 0xc5, 0x55, 0x20, |
|
63 0x12, 0x20, 0x06, 0xa0, 0x75, 0x1c, 0x02, 0xa0, 0x7d, 0xe5, 0x16, 0x1f, |
|
64 0x0f, 0x86, 0x04, 0xa1, 0xcf, 0x00, 0x05, 0xa1, 0xcf, 0x1c, 0x02, 0xa0, |
|
65 0x42, 0xe3, 0x1f, 0xa0, 0x75, 0x06, 0x00, 0xc0, 0x7b, 0xa1, 0xcd, 0x00, |
|
66 0x0e, 0xa0, 0x46, 0xc1, 0xcd, 0x1d, 0x03, 0x2a, 0xe8, 0x1e, 0x20, 0x27, |
|
67 0x04, 0x07, 0x00, 0x17, 0x00, 0x01, 0x30, 0xa0, 0xbf, 0x88, 0x00, 0xa0, |
|
68 0xc0, 0xa0, 0xc7, 0x18, 0x01, 0x00, 0x89, 0x00, 0x17, 0x50, 0x88, 0x31, |
|
69 0x06, 0x06, 0x22, 0x21, 0x01, 0x13, 0x21, 0x01, 0x23, 0x16, 0x9f, 0xdc, |
|
70 0x0e, 0x22, 0xa4, 0x86, 0x0f, 0xa0, 0x6d, 0x04, 0xa1, 0x50, 0xa0, 0x75, |
|
71 0xa0, 0xd4, 0x06, 0x0d, 0xa0, 0x6d, 0xa1, 0x58, 0x24, 0x23, 0x22, 0xa0, |
|
72 0x7d, 0xa1, 0x50, 0xa0, 0x75, 0xa0, 0xd4, 0x06, 0x00, 0x0e, 0x26, 0x01, |
|
73 0x07, 0x13, 0x50, 0x01, 0x13, 0x01, 0x05, 0x10, 0x01, 0x07, 0x10, 0x53, |
|
74 0x17, 0x50, 0x0e, 0x07, 0x1f, 0x9f, 0xd0, 0x0e, 0x22, 0x50, 0x09, 0x11, |
|
75 0x02, 0x0e, 0x24, 0x50, 0x01, 0x12, 0x01, 0x02, 0x12, 0x02, 0x04, 0x12, |
|
76 0x51, 0x17, 0x50, 0x01, 0x0a, 0x0d, 0x10, 0x0e, 0x26, 0xa0, 0xff, 0x0e, |
|
77 0x24, 0x00, 0x0e, 0x22, 0x01, 0x06, 0x12, 0x02, 0x02, 0x12, 0x01, 0x07, |
|
78 0x11, 0x01, 0x04, 0x13, 0x51, 0x06, 0x12, 0x53, 0x1d, 0x51, 0x2a, 0xed, |
|
79 0x06, 0x12, 0x55, 0x1e, 0x20, 0xe6, 0x01, 0x05, 0x00, 0xff, 0x00, 0x0e, |
|
80 0x28, 0x01, 0x17, 0x50, 0x04, 0x1f, 0x06, 0x06, 0x0e, 0x26, 0x01, 0x01, |
|
81 0x13, 0x50, 0x02, 0x13, 0x02, 0x05, 0x10, 0x01, 0x07, 0x10, 0x01, 0x04, |
|
82 0x13, 0x50, 0x06, 0x14, 0x53, 0x1d, 0x50, 0x20, 0xe1, 0x06, 0x14, 0x50, |
|
83 0x0e, 0x2a, 0x63, 0x14, 0x54, 0x52, 0x23, 0x22, 0x55, 0x52, 0x16, 0x9f, |
|
84 0x33 |
|
85 }; |
|
86 |
|
87 /** bytecode for dynamic compression with optional dictionary */ |
|
88 static const TUint8 KDynamicDeflateBytecode[] = |
|
89 { |
|
90 0x1c, 0x02, 0xa0, 0x7d, 0x13, 0x20, 0xa1, 0x36, 0xa0, 0x7d, 0xa0, 0x8e, |
|
91 0x06, 0x01, 0x0f, 0x86, 0x04, 0xa1, 0xbd, 0x00, 0x05, 0xa1, 0xbd, 0x1c, |
|
92 0x02, 0xa0, 0x42, 0xfc, 0x1c, 0x02, 0x2c, 0xf7, 0x17, 0x56, 0x00, 0x06, |
|
93 0x15, 0x06, 0x1c, 0x06, 0x2e, 0xed, 0x1f, 0x2e, 0x06, 0x00, 0x56, 0x63, |
|
94 0x00, 0x13, 0x63, 0x56, 0x23, 0x1c, 0x02, 0x2c, 0xed, 0x17, 0x56, 0x00, |
|
95 0x06, 0x17, 0x06, 0x1c, 0x06, 0x2e, 0xe3, 0x1f, 0x2e, 0x06, 0x00, 0x56, |
|
96 0xa1, 0xbb, 0x00, 0x0e, 0xa0, 0x46, 0xc1, 0xbb, 0x1d, 0x03, 0x2a, 0xeb, |
|
97 0x1e, 0x20, 0x27, 0x04, 0x07, 0x00, 0x17, 0x00, 0x01, 0x30, 0xa0, 0xbf, |
|
98 0x88, 0x00, 0xa0, 0xc0, 0xa0, 0xc7, 0x18, 0x01, 0x00, 0x89, 0x00, 0x17, |
|
99 0x50, 0x88, 0x86, 0x06, 0x06, 0x22, 0x21, 0x01, 0x13, 0x21, 0x01, 0x23, |
|
100 0x16, 0x9f, 0xdc, 0x0e, 0x2c, 0xa4, 0x88, 0x0e, 0x20, 0x61, 0x07, 0x10, |
|
101 0xa1, 0xbb, 0x0e, 0x22, 0x50, 0x06, 0x11, 0x08, 0x0f, 0xa1, 0xb3, 0x04, |
|
102 0x50, 0xa1, 0xbb, 0x00, 0x06, 0x0e, 0xa1, 0xbb, 0x63, 0x0d, 0xa1, 0xb3, |
|
103 0x51, 0x2e, 0x0e, 0x34, 0x50, 0x23, 0x2c, 0xa0, 0x7d, 0x50, 0xa1, 0xbb, |
|
104 0x00, 0x06, 0x00, 0x0e, 0x26, 0x01, 0x07, 0x13, 0x50, 0x01, 0x13, 0x01, |
|
105 0x05, 0x10, 0x01, 0x07, 0x10, 0x53, 0x17, 0x50, 0x0e, 0x07, 0x1f, 0x9f, |
|
106 0xc1, 0x0e, 0x22, 0x50, 0x09, 0x11, 0x02, 0x0e, 0x24, 0x50, 0x01, 0x12, |
|
107 0x01, 0x02, 0x12, 0x02, 0x04, 0x12, 0x51, 0x17, 0x50, 0x01, 0x0a, 0x0d, |
|
108 0x10, 0x0e, 0x26, 0xa0, 0xff, 0x0e, 0x24, 0x00, 0x0e, 0x22, 0x01, 0x06, |
|
109 0x12, 0x02, 0x02, 0x12, 0x01, 0x07, 0x11, 0x01, 0x04, 0x13, 0x51, 0x06, |
|
110 0x12, 0x53, 0x1d, 0x51, 0x2a, 0xed, 0x06, 0x12, 0x55, 0x1e, 0x20, 0xe6, |
|
111 0x01, 0x05, 0x00, 0xff, 0x00, 0x0e, 0x28, 0x01, 0x17, 0x50, 0x04, 0x1f, |
|
112 0x06, 0x06, 0x0e, 0x26, 0x01, 0x01, 0x13, 0x50, 0x02, 0x13, 0x02, 0x05, |
|
113 0x10, 0x01, 0x07, 0x10, 0x01, 0x04, 0x13, 0x50, 0x06, 0x14, 0x53, 0x1d, |
|
114 0x50, 0x20, 0xe1, 0x06, 0x14, 0x50, 0x0e, 0x2a, 0x63, 0x14, 0x54, 0x52, |
|
115 0x23, 0x22, 0x55, 0x52, 0x16, 0x9f, 0x24 |
|
116 }; |
|
117 |
|
118 /** bytecode for dynamic compression with uploaded dictionary */ |
|
119 static const TUint8 KDynamicUploadDeflateBytecode[] = |
|
120 { |
|
121 0x0f, 0x86, 0x04, 0xa2, 0x13, 0x00, 0x05, 0xa2, 0x13, 0x1c, 0x02, 0xa0, |
|
122 0x42, 0xfc, 0x1c, 0x02, 0xa0, 0x7b, 0xf7, 0x1c, 0xc0, 0x7b, 0xa2, 0x13, |
|
123 0xf2, 0x13, 0x63, 0xc0, 0x7b, 0x23, 0x0e, 0x2a, 0xc0, 0x7b, 0x06, 0x15, |
|
124 0x08, 0x0f, 0xa2, 0x09, 0x04, 0xc0, 0x7b, 0xa2, 0x11, 0x00, 0x06, 0x0e, |
|
125 0xa2, 0x11, 0x63, 0x20, 0xc0, 0x7b, 0xa2, 0x11, 0x00, 0x06, 0x01, 0x0d, |
|
126 0xa2, 0x09, 0x55, 0x20, 0x12, 0x20, 0x06, 0xa0, 0x75, 0x1c, 0x02, 0xa0, |
|
127 0x7d, 0xe8, 0x0f, 0xa0, 0x6d, 0x04, 0xa1, 0x94, 0xa0, 0x75, 0xa0, 0xeb, |
|
128 0x06, 0x0d, 0xa0, 0x6d, 0xa1, 0x9c, 0x20, 0x12, 0x20, 0x06, 0xa0, 0x67, |
|
129 0x20, 0xa1, 0x94, 0xa0, 0x75, 0xa0, 0xeb, 0x06, 0x01, 0x16, 0x37, 0x0f, |
|
130 0x86, 0x04, 0xa2, 0x13, 0x00, 0x05, 0xa2, 0x13, 0x1c, 0x02, 0xa0, 0x42, |
|
131 0xfc, 0x1c, 0x02, 0x20, 0xf7, 0x17, 0x50, 0x00, 0x06, 0x14, 0x06, 0x1c, |
|
132 0x06, 0x22, 0xed, 0x1f, 0x22, 0x06, 0x00, 0x50, 0xa2, 0x11, 0x00, 0x16, |
|
133 0x0c, 0x1f, 0xa0, 0x75, 0x06, 0x00, 0xc0, 0x7b, 0xa2, 0x11, 0x00, 0x0e, |
|
134 0xa0, 0x46, 0xc2, 0x11, 0x1d, 0x03, 0x2a, 0xea, 0x1e, 0x20, 0x28, 0x04, |
|
135 0x07, 0x00, 0x17, 0x00, 0x01, 0x30, 0xa0, 0xbf, 0x88, 0x00, 0xa0, 0xc0, |
|
136 0xa0, 0xc7, 0x18, 0x01, 0x00, 0x89, 0x00, 0x17, 0x50, 0x88, 0xa0, 0x46, |
|
137 0x07, 0x07, 0x22, 0x21, 0x01, 0x13, 0x21, 0x01, 0x23, 0x16, 0x9f, 0xdb, |
|
138 0x0e, 0x24, 0xa4, 0x8e, 0x0e, 0x20, 0x61, 0x07, 0x10, 0xa2, 0x11, 0x0e, |
|
139 0x22, 0x50, 0x06, 0x11, 0x08, 0x0f, 0xa2, 0x09, 0x04, 0x50, 0xa2, 0x11, |
|
140 0x00, 0x06, 0x0e, 0xa2, 0x11, 0x63, 0x0d, 0xa2, 0x09, 0x51, 0x26, 0x0e, |
|
141 0x2c, 0x50, 0x12, 0xa0, 0x67, 0x06, 0x2e, 0x23, 0x24, 0xa0, 0x7d, 0x50, |
|
142 0xa2, 0x11, 0x00, 0x06, 0x00, 0x0e, 0x26, 0x01, 0x07, 0x13, 0x50, 0x01, |
|
143 0x13, 0x01, 0x05, 0x10, 0x01, 0x07, 0x10, 0x53, 0x17, 0x50, 0x0e, 0x07, |
|
144 0x1f, 0x9f, 0xbc, 0x0e, 0x22, 0x50, 0x09, 0x11, 0x02, 0x0e, 0x24, 0x50, |
|
145 0x01, 0x12, 0x01, 0x02, 0x12, 0x02, 0x04, 0x12, 0x51, 0x17, 0x50, 0x01, |
|
146 0x0a, 0x0d, 0x10, 0x0e, 0x26, 0xa0, 0xff, 0x0e, 0x24, 0x00, 0x0e, 0x22, |
|
147 0x01, 0x06, 0x12, 0x02, 0x02, 0x12, 0x01, 0x07, 0x11, 0x01, 0x04, 0x13, |
|
148 0x51, 0x06, 0x12, 0x53, 0x1d, 0x51, 0x2a, 0xed, 0x06, 0x12, 0x55, 0x1e, |
|
149 0x20, 0xe6, 0x01, 0x05, 0x00, 0xff, 0x00, 0x0e, 0x28, 0x01, 0x17, 0x50, |
|
150 0x04, 0x1f, 0x06, 0x06, 0x0e, 0x26, 0x01, 0x01, 0x13, 0x50, 0x02, 0x13, |
|
151 0x02, 0x05, 0x10, 0x01, 0x07, 0x10, 0x01, 0x04, 0x13, 0x50, 0x06, 0x14, |
|
152 0x53, 0x1d, 0x50, 0x20, 0xe1, 0x06, 0x14, 0x50, 0x0e, 0x2a, 0x63, 0x14, |
|
153 0x54, 0x52, 0x23, 0x22, 0x55, 0x52, 0x16, 0x9f, 0x1e |
|
154 }; |
|
155 |
|
156 /** bytecodes parameters */ |
|
157 const TDeflateCompBytecode KDeflateBytecodes[] = |
|
158 { |
|
159 // iBytecode, iBytecodeSize, |
|
160 // iBytecodeInit, iBytecodeStart, iStateStart, iStateSize, iCBufStart |
|
161 { |
|
162 KStaticDeflateBytecode, sizeof(KStaticDeflateBytecode), |
|
163 0x80, 0x85, 0x75, 0x16a-0x75, 0x16a |
|
164 }, |
|
165 { |
|
166 KStaticUploadDeflateBytecode, sizeof(KStaticUploadDeflateBytecode), |
|
167 0x80, 0xd4, 0x75, 0x1c5-0x75, 0x1cf |
|
168 }, |
|
169 { |
|
170 KDynamicDeflateBytecode, sizeof(KDynamicDeflateBytecode), |
|
171 0x80, 0x8e, 0x7d, 0x1b3-0x7d, 0x1bd |
|
172 }, |
|
173 { |
|
174 KDynamicUploadDeflateBytecode, sizeof(KDynamicUploadDeflateBytecode), |
|
175 0x80, 0xeb, 0x75, 0x209-0x75, 0x213 |
|
176 } |
|
177 }; |