Subversion Repositories Kolibri OS

Rev

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

Rev 3053 Rev 3499
Line 191... Line 191...
191
  .decompressor_defined:
191
  .decompressor_defined:
Line 192... Line 192...
192
 
192
 
Line 193... Line 193...
193
	push	esi		; fixme!!
193
	push	esi		; fixme!!
194
 
194
 
195
	mov	ecx, [edx + Image.Type]
195
	mov	ecx, [edx + Image.Type]
196
	dec	ecx
196
        cmp     ecx, Image.bpp8i
197
	jz	.bpp8i
197
        je	.bpp8i
198
	dec	ecx
198
        cmp     ecx, Image.bpp24
199
	jz	.bpp24
199
	je	.bpp24
-
 
200
        cmp     ecx, Image.bpp32
200
	dec	ecx
201
	je	.bpp32
201
	jz	.bpp32
202
        cmp     ecx, Image.bpp16
202
	dec	ecx
203
	je	.bpp16
203
	dec	ecx		; tiff doesn't handle 15bpp images
204
        cmp     ecx, Image.bpp1
204
	jz	.bpp16
205
	je	.bpp1
205
	dec	ecx
206
        cmp     ecx, Image.bpp8g
206
	jz	.bpp1
207
	je	.bpp8g
-
 
208
        cmp     ecx, Image.bpp8a
207
	dec	ecx
209
	je	.bpp8a
-
 
210
;        cmp     ecx, Image.bpp2
208
	jz	.bpp8g
211
;	je	.bpp2
-
 
212
;        cmp     ecx, Image.bpp4
209
	dec	ecx
213
;	je	.bpp4
Line 210... Line 214...
210
	jz	.bpp8a
214
        jmp     .quit
211
;error report!!
215
;error report!!
212
 
216
 
Line 222... Line 226...
222
  .bpp1.white_is_zero:
226
  .bpp1.white_is_zero:
223
	mov	[edi], dword 0x00ffffff
227
	mov	[edi], dword 0x00ffffff
224
	mov	[edi + 4], dword 0x00000000
228
	mov	[edi + 4], dword 0x00000000
225
	jmp	.common
229
	jmp	.common
Line -... Line 230...
-
 
230
 
-
 
231
  .bpp2:
-
 
232
	jmp	.common
226
 
233
 
227
  .bpp4:
234
  .bpp4:
Line 228... Line 235...
228
	jmp	.common
235
	jmp	.common
229
 
236
 
Line 349... Line 356...
349
	jnz	.l_l
356
	jnz	.l_l
350
	jmp	.decoded
357
	jmp	.decoded
Line 351... Line 358...
351
 
358
 
-
 
359
 
-
 
360
  .decoded:
-
 
361
        cmp     [ebx + tiff_extra.planar_configuration], TIFF.PLANAR.PLANAR
352
 
362
        jne     .post.rgb_bgr
353
  .decoded:
363
        stdcall tiff._.planar_to_separate, [retvalue]
354
  .post.rgb_bgr:
364
  .post.rgb_bgr:
355
	cmp	[ebx + tiff_extra.samples_per_pixel], 3
365
	cmp	[ebx + tiff_extra.samples_per_pixel], 3
356
	jne	.post.rgba_bgra
366
	jne	.post.rgba_bgra
Line 615... Line 625...
615
	lodsd_
625
	lodsd_
616
	add	eax, [_data]
626
	add	eax, [_data]
617
	mov	[ebx + tiff_extra.strip_byte_counts], eax
627
	mov	[ebx + tiff_extra.strip_byte_counts], eax
618
	jmp	.quit
628
	jmp	.quit
Line -... Line 629...
-
 
629
 
-
 
630
  .tag_11c:						; Planar configuration
-
 
631
	cmp	ax, TIFF.IFDE_TYPE.SHORT
-
 
632
	jne	@f
-
 
633
	lodsd
-
 
634
	xor	eax, eax
-
 
635
	lodsw_
-
 
636
	mov	[ebx + tiff_extra.planar_configuration], eax
-
 
637
;debug_print 'planar_configuration: '
-
 
638
;debug_print_dec eax
-
 
639
;newline
-
 
640
	lodsw
-
 
641
    @@:
-
 
642
	jmp	.quit
-
 
643
 
619
 
644
 
620
  .tag_13d:						; Predictor
645
  .tag_13d:						; Predictor
621
	cmp	ax, TIFF.IFDE_TYPE.SHORT
646
	cmp	ax, TIFF.IFDE_TYPE.SHORT
622
	jne	@f
647
	jne	@f
623
	lodsd
648
	lodsd
Line 708... Line 733...
708
endp
733
endp
Line 709... Line 734...
709
 
734
 
Line 710... Line 735...
710
 
735
 
Line 711... Line 736...
711
proc tiff._.decompress.packbits _image
736
proc tiff._.decompress.packbits _image
Line 712... Line 737...
712
 
737
 
713
	push	ebx ecx edx esi
738
	push	edx
714
 
739
 
715
	mov	edx, ecx
-
 
716
 
-
 
717
  .decode:
740
	mov	edx, ecx
-
 
741
 
718
	lodsb
742
  .decode:
719
	dec	edx
743
	lodsb
720
	cmp	al, 0x7f
744
	dec	edx
721
	jbe	.different
745
	cmp	al, 0x80
Line 722... Line 746...
722
	cmp	al, 0x80
746
	jb	.different
Line 743... Line 767...
743
	rep	movsb
767
	rep	movsb
744
	test	edx, edx
768
	test	edx, edx
745
	jnz	.decode
769
	jnz	.decode
Line 746... Line 770...
746
 
770
 
747
  .quit:
771
  .quit:
748
	pop	esi edx ecx ebx
772
	pop	edx
749
	ret
773
	ret
Line 750... Line 774...
750
endp
774
endp
Line 1165... Line 1189...
1165
	dec	ecx
1189
	dec	ecx
1166
	jnz	@b
1190
	jnz	@b
1167
	ret
1191
	ret
1168
endp
1192
endp
Line -... Line 1193...
-
 
1193
 
-
 
1194
 
-
 
1195
proc tiff._.planar_to_separate _img
-
 
1196
locals
-
 
1197
        pixels          rd 1
-
 
1198
        tmp_image       rd 1
-
 
1199
        channels        rd 1
-
 
1200
        channel_padding rd 1
-
 
1201
endl
-
 
1202
        pushad
-
 
1203
        mov     ebx, [_img]
-
 
1204
        mov     ecx, [ebx + Image.Width]
-
 
1205
        imul    ecx, [ebx + Image.Height]
-
 
1206
        mov     [pixels], ecx
-
 
1207
        cmp     [ebx + Image.Type], Image.bpp24
-
 
1208
        je      .bpp24
-
 
1209
        cmp     [ebx + Image.Type], Image.bpp32
-
 
1210
        je      .bpp32
-
 
1211
;        cmp     [ebx + Image.Type], Image.bpp4
-
 
1212
;        je      .bpp4
-
 
1213
        jmp     .quit
-
 
1214
  .bpp24:
-
 
1215
        mov     [channels], 3
-
 
1216
        mov     [channel_padding], 2
-
 
1217
        lea     eax, [ecx*3]
-
 
1218
        jmp     .proceed
-
 
1219
  .bpp32:
-
 
1220
        mov     [channels], 4
-
 
1221
        mov     [channel_padding], 3
-
 
1222
        shl     eax, 2
-
 
1223
        jmp     .proceed
-
 
1224
  .bpp4:
-
 
1225
        mov     [channels], 3
-
 
1226
        mov     [channel_padding], 2
-
 
1227
        shr     eax, 1
-
 
1228
        jmp     .proceed
-
 
1229
  .proceed:
-
 
1230
        invoke  mem.alloc, eax
-
 
1231
        test    eax, eax
-
 
1232
        jz      .quit
-
 
1233
        mov     [tmp_image], eax
-
 
1234
  .channel:
-
 
1235
        mov     esi, [ebx + Image.Data]
-
 
1236
        mov     edi, [tmp_image]
-
 
1237
        mov     ecx, [pixels]
-
 
1238
        mov     eax, [channel_padding]
-
 
1239
        inc     eax
-
 
1240
        sub     eax, [channels]
-
 
1241
        add     edi, eax
-
 
1242
        mov     eax, [channels]
-
 
1243
        dec     eax
-
 
1244
        imul    eax, [pixels]
-
 
1245
        add     esi, eax
-
 
1246
    @@:
-
 
1247
        lodsb
-
 
1248
        stosb
-
 
1249
        add     edi, [channel_padding]
-
 
1250
        dec     ecx
-
 
1251
        jnz     @b
-
 
1252
        dec     [channels]
-
 
1253
        jnz     .channel
-
 
1254
 
-
 
1255
  .quit:
-
 
1256
        mov     eax, [tmp_image]
-
 
1257
        xchg    [ebx + Image.Data], eax
-
 
1258
        invoke  mem.free, eax
-
 
1259
        popad
-
 
1260
        ret
-
 
1261
endp
1169
 
1262
 
1170
;;================================================================================================;;
1263
;;================================================================================================;;
1171
;;////////////////////////////////////////////////////////////////////////////////////////////////;;
1264
;;////////////////////////////////////////////////////////////////////////////////////////////////;;
1172
;;================================================================================================;;
1265
;;================================================================================================;;
1173
;! Below is private data you should never use directly from your code                             ;;
1266
;! Below is private data you should never use directly from your code                             ;;
Line 1182... Line 1275...
1182
  .tag_106:		dd	0x0106,	tiff._.parse_IFDE.tag_106		; photometric interpretation
1275
  .tag_106:		dd	0x0106,	tiff._.parse_IFDE.tag_106		; photometric interpretation
1183
  .tag_111:		dd	0x0111,	tiff._.parse_IFDE.tag_111		; strip offsets
1276
  .tag_111:		dd	0x0111,	tiff._.parse_IFDE.tag_111		; strip offsets
1184
  .tag_115:		dd	0x0115,	tiff._.parse_IFDE.tag_115		; samples per pixel
1277
  .tag_115:		dd	0x0115,	tiff._.parse_IFDE.tag_115		; samples per pixel
1185
  .tag_116:		dd	0x0116,	tiff._.parse_IFDE.tag_116		; rows per strip
1278
  .tag_116:		dd	0x0116,	tiff._.parse_IFDE.tag_116		; rows per strip
1186
  .tag_117:		dd	0x0117,	tiff._.parse_IFDE.tag_117		; strip byte counts
1279
  .tag_117:		dd	0x0117,	tiff._.parse_IFDE.tag_117		; strip byte counts
-
 
1280
  .tag_11c:		dd	0x011c,	tiff._.parse_IFDE.tag_11c		; planar configuration
1187
  .tag_13d:		dd	0x013d,	tiff._.parse_IFDE.tag_13d		; predictor
1281
  .tag_13d:		dd	0x013d,	tiff._.parse_IFDE.tag_13d		; predictor
1188
  .tag_140:		dd	0x0140,	tiff._.parse_IFDE.tag_140		; color map
1282
  .tag_140:		dd	0x0140,	tiff._.parse_IFDE.tag_140		; color map
1189
  .tag_152:		dd	0x0152,	tiff._.parse_IFDE.tag_152		; extra samples
1283
  .tag_152:		dd	0x0152,	tiff._.parse_IFDE.tag_152		; extra samples
1190
tiff.IFDE_tag_table.end:
1284
tiff.IFDE_tag_table.end: