Subversion Repositories Kolibri OS

Rev

Rev 593 | Rev 750 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 593 Rev 709
Line 3... Line 3...
3
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
4
;; Distributed under terms of the GNU General Public License    ;;
4
;; Distributed under terms of the GNU General Public License    ;;
5
;;                                                              ;;
5
;;                                                              ;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 7... Line 7...
7
 
7
 
Line 8... Line 8...
8
$Revision: 593 $
8
$Revision: 709 $
9
 
9
 
10
 
10
 
Line 164... Line 164...
164
	stosd
164
	stosd
165
; int len=0;
165
; int len=0;
166
; result=0;
166
; result=0;
167
	mov	ecx, .Literal + (.LZMA_LIT_SIZE shl (.lc+.lp))
167
	mov	ecx, .Literal + (.LZMA_LIT_SIZE shl (.lc+.lp))
168
	mov	eax, .kBitModelTotal/2
168
	mov	eax, .kBitModelTotal/2
169
	mov	edi, .p
169
	mov	edi, [.p]
170
	rep	stosd
170
	rep	stosd
171
; RangeDecoderInit
171
; RangeDecoderInit
172
; rd->ExtraBytes = 0
172
; rd->ExtraBytes = 0
173
; rd->Buffer = stream
173
; rd->Buffer = stream
174
; rd->BufferLim = stream+bufferSize
174
; rd->BufferLim = stream+bufferSize
Line 185... Line 185...
185
	jae	.main_loop_done
185
	jae	.main_loop_done
186
	mov	edx, edi
186
	mov	edx, edi
187
	and	edx, .posStateMask
187
	and	edx, .posStateMask
188
	mov	eax, ebx
188
	mov	eax, ebx
189
	shl	eax, .kNumPosBitsMax+2
189
	shl	eax, .kNumPosBitsMax+2
190
	lea	eax, [.p + .IsMatch*4 + eax + edx*4]
190
	lea	eax, [.IsMatch*4 + eax + edx*4]
-
 
191
	add	eax, [.p]
191
	call	.RangeDecoderBitDecode
192
	call	.RangeDecoderBitDecode
192
	jc	.1
193
	jc	.1
193
	movzx	eax, [.previousByte]
194
	movzx	eax, [.previousByte]
194
if .literalPosMask
195
if .literalPosMask
195
	mov	ah, dl
196
	mov	ah, dl
196
	and	ah, .literalPosMask
197
	and	ah, .literalPosMask
197
end if
198
end if
198
	shr	eax, 8-.lc
199
	shr	eax, 8-.lc
199
	imul	eax, .LZMA_LIT_SIZE*4
200
	imul	eax, .LZMA_LIT_SIZE*4
200
	add	eax, .p+.Literal*4
201
	add	eax, .Literal*4
-
 
202
	add	eax, [.p]
201
	cmp	ebx, .kNumLitStates
203
	cmp	ebx, .kNumLitStates
202
	jb	.literal
204
	jb	.literal
203
	xor	edx, edx
205
	xor	edx, edx
204
	sub	edx, [.rep0]
206
	sub	edx, [.rep0]
205
	mov	dl, [edi + edx]
207
	mov	dl, [edi + edx]
Line 218... Line 220...
218
	jb	@f
220
	jb	@f
219
	mov	al, 6
221
	mov	al, 6
220
@@:	sub	bl, al
222
@@:	sub	bl, al
221
	jmp	.main_loop
223
	jmp	.main_loop
222
.1:
224
.1:
223
	lea	eax, [.p + .IsRep*4 + ebx*4]
225
	lea	eax, [.IsRep*4 + ebx*4]
-
 
226
	add	eax, [.p]
224
	call	.RangeDecoderBitDecode
227
	call	.RangeDecoderBitDecode
225
	jnc	.10
228
	jnc	.10
226
	lea	eax, [.p + .IsRepG0*4 + ebx*4]
229
	lea	eax, [.IsRepG0*4 + ebx*4]
-
 
230
	add	eax, [.p]
227
	call	.RangeDecoderBitDecode
231
	call	.RangeDecoderBitDecode
228
	jc	.111
232
	jc	.111
229
	mov	eax, ebx
233
	mov	eax, ebx
230
	shl	eax, .kNumPosBitsMax+2
234
	shl	eax, .kNumPosBitsMax+2
231
	lea	eax, [.p + .IsRep0Long*4 + eax + edx*4]
235
	lea	eax, [.IsRep0Long*4 + eax + edx*4]
-
 
236
	add	eax, [.p]
232
	call	.RangeDecoderBitDecode
237
	call	.RangeDecoderBitDecode
233
	jc	.1101
238
	jc	.1101
234
	cmp	bl, 7
239
	cmp	bl, 7
235
	setae	bl
240
	setae	bl
236
	lea	ebx, [9 + ebx + ebx]
241
	lea	ebx, [9 + ebx + ebx]
Line 239... Line 244...
239
	mov	al, [edi + edx]
244
	mov	al, [edi + edx]
240
	stosb
245
	stosb
241
	mov	[.previousByte], al
246
	mov	[.previousByte], al
242
	jmp	.main_loop
247
	jmp	.main_loop
243
.111:
248
.111:
244
	lea	eax, [.p + .IsRepG1*4 + ebx*4]
249
	lea	eax, [.IsRepG1*4 + ebx*4]
-
 
250
	add	eax, [.p]
245
	call	.RangeDecoderBitDecode
251
	call	.RangeDecoderBitDecode
246
	mov	eax, [.rep1]
252
	mov	eax, [.rep1]
247
	jnc	.l3
253
	jnc	.l3
248
.l1:
254
.l1:
249
	lea	eax, [.p + .IsRepG2*4 + ebx*4]
255
	lea	eax, [.IsRepG2*4 + ebx*4]
-
 
256
	add	eax, [.p]
250
	call	.RangeDecoderBitDecode
257
	call	.RangeDecoderBitDecode
251
	mov	eax, [.rep2]
258
	mov	eax, [.rep2]
252
	jnc	.l2
259
	jnc	.l2
253
	xchg	[.rep3], eax
260
	xchg	[.rep3], eax
254
.l2:
261
.l2:
Line 256... Line 263...
256
	pop	[.rep2]
263
	pop	[.rep2]
257
.l3:
264
.l3:
258
	xchg	eax, [.rep0]
265
	xchg	eax, [.rep0]
259
	mov	[.rep1], eax
266
	mov	[.rep1], eax
260
.1101:
267
.1101:
261
	mov	eax, .p + .RepLencoder*4
268
	mov	eax, .RepLencoder*4
-
 
269
	add	eax, [.p]
262
	call	.LzmaLenDecode
270
	call	.LzmaLenDecode
263
	cmp	bl, 7
271
	cmp	bl, 7
264
	setc	bl
272
	setc	bl
265
	adc	bl, bl
273
	adc	bl, bl
266
	xor	bl, 3
274
	xor	bl, 3
Line 274... Line 282...
274
	cmp	bl, 7
282
	cmp	bl, 7
275
	setc	bl
283
	setc	bl
276
	adc	bl, bl
284
	adc	bl, bl
277
	xor	bl, 3
285
	xor	bl, 3
278
	add	bl, 7
286
	add	bl, 7
279
	mov	eax, .p + .Lencoder*4
287
	mov	eax, .Lencoder*4
-
 
288
	add	eax, [.p]
280
	call	.LzmaLenDecode
289
	call	.LzmaLenDecode
281
	mov	eax, .kNumLenToPosStates-1
290
	mov	eax, .kNumLenToPosStates-1
282
	cmp	eax, ecx
291
	cmp	eax, ecx
283
	jb	@f
292
	jb	@f
284
	mov	eax, ecx
293
	mov	eax, ecx
285
@@:
294
@@:
286
	push	ecx
295
	push	ecx
287
	mov	ecx, .kNumPosSlotBits
296
	mov	ecx, .kNumPosSlotBits
288
	shl	eax, cl
297
	shl	eax, cl
289
	shl	eax, 2
298
	shl	eax, 2
290
	add	eax, .p+.PosSlot*4
299
	add	eax, .PosSlot*4
-
 
300
	add	eax, [.p]
291
	call	.RangeDecoderBitTreeDecode
301
	call	.RangeDecoderBitTreeDecode
292
	mov	[.rep0], ecx
302
	mov	[.rep0], ecx
293
	cmp	ecx, .kStartPosModelIndex
303
	cmp	ecx, .kStartPosModelIndex
294
	jb	.l6
304
	jb	.l6
295
	push	ecx
305
	push	ecx
Line 303... Line 313...
303
	pop	edx
313
	pop	edx
304
	cmp	edx, .kEndPosModelIndex
314
	cmp	edx, .kEndPosModelIndex
305
	jae	.l5
315
	jae	.l5
306
	sub	eax, edx
316
	sub	eax, edx
307
	shl	eax, 2
317
	shl	eax, 2
308
	add	eax, .p + (.SpecPos - 1)*4
318
	add	eax, (.SpecPos - 1)*4
-
 
319
	add	eax, [.p]
309
	call	.RangeDecoderReverseBitTreeDecode
320
	call	.RangeDecoderReverseBitTreeDecode
310
	add	[.rep0], ecx
321
	add	[.rep0], ecx
311
	jmp	.l6
322
	jmp	.l6
312
.l5:
323
.l5:
313
	sub	ecx, .kNumAlignBits
324
	sub	ecx, .kNumAlignBits
314
	call	.RangeDecoderDecodeDirectBits
325
	call	.RangeDecoderDecodeDirectBits
315
	mov	ecx, .kNumAlignBits
326
	mov	ecx, .kNumAlignBits
316
	shl	eax, cl
327
	shl	eax, cl
317
	add	[.rep0], eax
328
	add	[.rep0], eax
318
	mov	eax, .p+.Align_*4
329
	mov	eax, .Align_*4
-
 
330
	add	eax, [.p]
319
	call	.RangeDecoderReverseBitTreeDecode
331
	call	.RangeDecoderReverseBitTreeDecode
320
	add	[.rep0], ecx
332
	add	[.rep0], ecx
321
.l6:
333
.l6:
322
	pop	ecx
334
	pop	ecx
323
	inc	[.rep0]
335
	inc	[.rep0]
Line 501... Line 513...
501
	pop	ebx
513
	pop	ebx
502
	ret
514
	ret
Line 503... Line 515...
503
 
515
 
504
uglobal
516
uglobal
505
align 4
517
align 4
-
 
518
;unpack.p	rd	unpack.LZMA_BASE_SIZE + (unpack.LZMA_LIT_SIZE shl (unpack.lc+unpack.lp))
506
unpack.p	rd	unpack.LZMA_BASE_SIZE + (unpack.LZMA_LIT_SIZE shl (unpack.lc+unpack.lp))
519
unpack.p	dd	?
507
unpack.code_	dd	?
520
unpack.code_	dd	?
508
unpack.range	dd	?
521
unpack.range	dd	?
509
unpack.rep0	dd	?
522
unpack.rep0	dd	?
510
unpack.rep1	dd	?
523
unpack.rep1	dd	?