Subversion Repositories Kolibri OS

Rev

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

Rev 5002 Rev 5007
Line 7... Line 7...
7
 
7
 
8
 
8
 
9
 
-
 
10
;---------
9
 
11
offs_m_or_i    equ 8 ;ᬥ饭¨¥ ¯ à ¬¥âà  'MM' ¨«¨ 'II' (Motorola, Intel)
10
;---------
12
offs_tag_count equ 16 ;ᬥ饭¨¥ ª®«¨ç¥á⢠ ⥣®¢
-
 
13
offs_tag_0     equ 18 ;ᬥ饭¨¥ 0-£® ⥣ 
11
offs_m_or_i    equ 8 ;ᬥ饭¨¥ ¯ à ¬¥âà  'MM' ¨«¨ 'II' (Motorola, Intel)
14
tag_size       equ 12 ;à §¬¥à áâàãªâãàë ⥣ 
12
offs_tag_0     equ 2 ;ᬥ饭¨¥ 0-£® ⥣ 
15
offs_tag_child_0 equ 2 ;ᬥ饭¨¥ 0-£® ¤®ç¥à­¥£® ⥣ 
13
tag_size       equ 12 ;à §¬¥à áâàãªâãàë ⥣ 
16
;ä®à¬ âë ¤ ­­ëå
14
;ä®à¬ âë ¤ ­­ëå
17
tag_format_ui1b  equ  1 ;unsigned integer 1 byte
15
tag_format_ui1b  equ  1 ;unsigned integer 1 byte
Line 464... Line 462...
464
db 0xfe,0x55,'Saturation',0
462
db 0xfe,0x55,'Saturation',0
465
db 0xfe,0x56,'Sharpness',0
463
db 0xfe,0x56,'Sharpness',0
466
db 0xfe,0x57,'Smoothness',0
464
db 0xfe,0x57,'Smoothness',0
467
db 0xfe,0x58,'Moire filter',0
465
db 0xfe,0x58,'Moire filter',0
Line -... Line 466...
-
 
466
 
-
 
467
db 0x00,0x00,'GPS version ID',0
468
 
468
 
Line 469... Line 469...
469
dw 0
469
dd 0
470
 
470
 
471
;input:
471
;input:
472
; bof - 㪠§ â¥«ì ­  ­ ç «® ä ©« 
472
; bof - 㪠§ â¥«ì ­  ­ ç «® ä ©« 
Line 494... Line 494...
494
 
494
 
495
	;ä ©« ᮤ¥à¦¨â exif.app1?
495
	;ä ©« ᮤ¥à¦¨â exif.app1?
496
	cmp word[eax],0xe1ff
496
	cmp word[eax],0xe1ff
Line -... Line 497...
-
 
497
	jne .no_exif
-
 
498
 
-
 
499
	xor ebx,ebx
-
 
500
	cmp word[eax+10],'II'
-
 
501
	je @f
-
 
502
		inc ebx ;if 'MM' edx=1
497
	jne .no_exif
503
	@@:
498
 
504
	mov [edi+offs_m_or_i],ebx
-
 
505
	add eax,18
-
 
506
	mov [edi],eax
Line 499... Line 507...
499
	add eax,2
507
	sub eax,8
500
	mov [edi],eax
508
	mov [edi+4],eax
501
 
509
 
502
	jmp @f
510
	jmp @f
Line 518... Line 526...
518
	mov edi,[txt]
526
	mov edi,[txt]
519
	mov ecx,[num]
527
	mov ecx,[num]
Line 520... Line 528...
520
 
528
 
521
	xor edx,edx
529
	xor edx,edx
522
	mov byte[edi],dl
530
	mov byte[edi],dl
523
	cmp eax,edx
531
	cmp [eax],edx
524
	je .end_f ;¥á«¨ ­¥ ­ ©¤¥­ 㪠§ â¥«ì ­  ­ ç «® exif.app1
532
	je .end_f ;¥á«¨ ­¥ ­ ©¤¥­ 㪠§ â¥«ì ­  ­ ç «® exif.app1
525
	cmp ecx,edx
533
	cmp ecx,edx
Line 526... Line 534...
526
	jle .end_f ;¥á«¨ ¯®à浪®¢ë© ­®¬¥à ⥣  <= 0
534
	jle .end_f ;¥á«¨ ¯®à浪®¢ë© ­®¬¥à ⥣  <= 0
527
 
-
 
528
	cmp word[eax+offs_m_or_i],'II'
-
 
529
	je @f
-
 
Line 530... Line 535...
530
		inc edx ;if 'MM' edx=1
535
 
-
 
536
	movzx edx,word[eax+offs_m_or_i] ;if 'MM' edx=1
531
	@@:
537
 
532
 
538
	;¯à®¢¥à塞 ç¨á«® ⥣®¢
533
	;¯à®¢¥à塞 ç¨á«® ⥣®¢
539
	mov eax,[eax]
534
	movzx ebx,word[eax+offs_tag_count]
540
	movzx ebx,word[eax]
535
	bt edx,0
541
	bt edx,0
536
	jnc @f
542
	jnc @f
Line 551... Line 557...
551
popad
557
popad
552
	ret
558
	ret
553
endp
559
endp
Line 554... Line 560...
554
 
560
 
555
;input:
561
;input:
556
; app1 - 㪠§ â¥«ì ­  exif.app1
562
; app1 - 㪠§ â¥«ì ­  exif.app1 ¨«¨ ­  exif.app1.child
557
; child - 㪠§ â¥«ì ¤«ï § ¯®«­¥­¨ï ­ ç «  ¤®ç¥à­¨å ⥣®¢ exif.app1.child
563
; child - 㪠§ â¥«ì ¤«ï § ¯®«­¥­¨ï ­ ç «  ¤®ç¥à­¨å ⥣®¢ exif.app1.child
558
; c_tag - ⥣ ¤«ï ª®â®à®£® ¤¥« ¥âáï ¯®¨áª ¤®ç¥à­¨å
564
; c_tag - ⥣ ¤«ï ª®â®à®£® ¤¥« ¥âáï ¯®¨áª ¤®ç¥à­¨å
559
;output:
565
;output:
560
; child - 㪠§ â¥«ì ­  ­ ç «® ¤®ç¥à­¨å ⥣®¢
566
; child - 㪠§ â¥«ì ­  ­ ç «® ¤®ç¥à­¨å ⥣®¢
Line 563... Line 569...
563
pushad
569
pushad
564
	mov eax,[app1]
570
	mov eax,[app1]
565
	mov edi,[child]
571
	mov edi,[child]
Line 566... Line 572...
566
 
572
 
567
	xor edx,edx
-
 
568
	mov dword[edi],edx
573
	xor edx,edx
569
	cmp eax,edx
574
	cmp [eax],edx
Line 570... Line 575...
570
	je .end_f ;¥á«¨ ­¥ ­ ©¤¥­ 㪠§ â¥«ì ­  ­ ç «® exif.app1
575
	je .no_found ;¥á«¨ ­¥ ­ ©¤¥­ 㪠§ â¥«ì ­  ­ ç «® exif.app1
571
 
-
 
572
	cmp word[eax+offs_m_or_i],'II'
-
 
573
	je @f
-
 
Line 574... Line 576...
574
		inc edx ;if 'MM' edx=1
576
 
575
	@@:
577
	movzx edx,word[eax+offs_m_or_i] ;if 'MM' edx=1
576
 
578
 
577
	;­ ç «® ¯®¨áª 
579
	;­ ç «® ¯®¨áª 
578
	mov ebx,[c_tag]
580
	mov ebx,[c_tag]
579
	bt edx,0
581
	bt edx,0
Line 580... Line 582...
580
	jnc @f
582
	jnc @f
-
 
583
		ror bx,8
581
		ror bx,8
584
	@@:
582
	@@:
585
 
583
 
586
	;¯à®¢¥à塞 ç¨á«® ⥣®¢
584
	;¯à®¢¥à塞 ç¨á«® ⥣®¢
587
	mov eax,[eax]
585
	movzx ecx,word[eax+offs_tag_count]
588
	movzx ecx,word[eax]
586
	bt edx,0
589
	bt edx,0
587
	jnc @f
590
	jnc @f
Line 588... Line 591...
588
		ror cx,8
591
		ror cx,8
589
	@@:
592
	@@:
590
	cmp ecx,1
593
	cmp ecx,1
591
	jl .end_f ;¥á«¨ ç¨á«® ⥣®¢ <1
594
	jl .no_found ;¥á«¨ ç¨á«® ⥣®¢ <1
592
 
595
 
593
	;¯¥à¥å®¤¨¬ ­  1-© ⥣
596
	;¯¥à¥å®¤¨¬ ­  1-© ⥣
594
	add eax,offs_tag_0
597
	add eax,offs_tag_0
595
	@@:
598
	@@:
596
		cmp word[eax],bx
599
		cmp word[eax],bx
597
		je @f
600
		je @f
598
		add eax,tag_size
601
		add eax,tag_size
599
		loop @b
602
		loop @b
600
	jmp .end_f ;¥á«¨ ­¥ ­ ©¤¥­®
603
	jmp .no_found ;¥á«¨ ­¥ ­ ©¤¥­®
601
	@@: ;¥á«¨ ­ ©¤¥­®
604
	@@: ;¥á«¨ ­ ©¤¥­®
602
		mov ebx,dword[eax+8]
605
		mov ebx,dword[eax+8]
603
		bt edx,0
606
		bt edx,0
604
		jnc @f
-
 
605
			ror bx,8
-
 
606
			ror ebx,16
-
 
607
			ror bx,8
-
 
608
		@@:
-
 
609
		add ebx,[app1]
-
 
610
		add ebx,offs_m_or_i
-
 
611
		mov dword[edi],ebx
-
 
612
	.end_f:
-
 
613
popad
-
 
614
	ret
-
 
615
endp
-
 
616
 
-
 
617
;input:
-
 
618
; app1 - 㪠§ â¥«ì ­  ­ ç «® exif.app1
-
 
619
; child - 㪠§ â¥«ì ­  ­ ç «® ¤®ç¥à­¨å ⥣®¢ exif.app1.child
-
 
620
; num - ¯®à浪®¢ë© ­®¬¥à ⥣  (­ ç¨­ ¥âáï á 1)
-
 
621
; txt - 㪠§ â¥«ì ­  ⥪áâ, ªã¤  ¡ã¤¥â § ¯¨á ­® §­ ç¥­¨¥
607
		jnc @f
622
; t_max - ¬ ªá¨¬ «ì­ë© à §¬¥à ⥪áâ 
-
 
623
align 4
608
			ror bx,8
624
proc exif_get_app1_child_tag, app1:dword, child:dword, num:dword, txt:dword, t_max:dword
-
 
625
pushad
-
 
626
	mov eax,[app1]
609
			ror ebx,16
627
	mov edi,[txt]
-
 
628
	mov ecx,[num]
-
 
629
 
610
			ror bx,8
630
	xor edx,edx
-
 
631
	mov byte[edi],dl
-
 
632
	cmp eax,edx
611
		@@:
633
	je .end_f ;¥á«¨ ­¥ ­ ©¤¥­ 㪠§ â¥«ì ­  ­ ç «® exif.app1
-
 
634
	cmp ecx,edx
-
 
635
	jle .end_f ;¥á«¨ ¯®à浪®¢ë© ­®¬¥à ⥣  <= 0
-
 
636
 
-
 
637
	cmp word[eax+offs_m_or_i],'II'
-
 
638
	je @f
-
 
639
		inc edx ;if 'MM' edx=1
-
 
640
	@@:
-
 
641
 
-
 
642
	mov eax,[child]
-
 
643
	cmp eax,0
-
 
644
	je .end_f ;¥á«¨ ­¥ ­ ©¤¥­ 㪠§ â¥«ì ­  ­ ç «® exif.app1.child
-
 
645
	
-
 
646
	;¯à®¢¥à塞 ç¨á«® ⥣®¢
-
 
647
	movzx ebx,word[eax]
-
 
648
	bt edx,0
-
 
649
	jnc @f
-
 
650
		ror bx,8
-
 
651
	@@:
-
 
652
	cmp ecx,ebx
-
 
653
	jg .end_f ;¥á«¨ ­®¬¥à ⥣  ¡®«ìè¥ ç¥¬ ¨å ¥áâì ¢ ä ©«¥
-
 
654
 
-
 
655
	;¯¥à¥å®¤¨¬ ­  § ¤ ­­ë© ⥣
-
 
656
	dec ecx
-
 
Line -... Line 612...
-
 
612
		mov eax,[app1]
-
 
613
		add ebx,[eax+4]
-
 
614
		mov dword[edi],ebx
657
	imul ecx,tag_size
615
		m2m dword[edi+4],dword[eax+4]
658
	add eax,offs_tag_child_0
616
		mov dword[edi+offs_m_or_i],edx
659
	add eax,ecx
617
 
660
 
618
	jmp .end_f
Line 675... Line 633...
675
	push exif_tag_numbers
633
	push exif_tag_numbers
676
	pop esi
634
	pop esi
677
	.next_tag:
635
	.next_tag:
678
	mov bx,word[esi]
636
	mov bx,word[esi]
679
	cmp bx,0
637
	cmp bx,0
-
 
638
	jne @f
-
 
639
		cmp dword[esi],0
-
 
640
		jne @f
680
	je .tag_unknown ;⥣ ­¥ ®¯®§­ ­
641
		jmp .tag_unknown ;⥣ ­¥ ®¯®§­ ­
-
 
642
	@@:
681
	bt edx,0
643
	bt edx,0
682
	jc @f
644
	jc @f
683
		ror bx,8
645
		ror bx,8
684
	@@:
646
	@@:
685
	cmp word[eax],bx
647
	cmp word[eax],bx
Line 727... Line 689...
727
		jnc @f
689
		jnc @f
728
			ror si,8
690
			ror si,8
729
			ror esi,16
691
			ror esi,16
730
			ror si,8
692
			ror si,8
731
		@@:
693
		@@:
-
 
694
		mov eax,[app1]
732
		add esi,offs_m_or_i
695
		mov eax,[eax+4]
733
		add esi,[app1]
696
		add esi,eax
734
		stdcall str_n_cat,edi,esi,[t_max]
697
		stdcall str_n_cat,edi,esi,[t_max]
735
		jmp .end_f
698
		jmp .end_f
736
	.tag_02:
699
	.tag_02:
Line 737... Line 700...
737
 
700
 
Line 807... Line 770...
807
				ror ebx,16
770
				ror ebx,16
808
				ror bx,8
771
				ror bx,8
809
			@@:
772
			@@:
810
			stdcall str_len,edi
773
			stdcall str_len,edi
811
			add edi,eax
774
			add edi,eax
-
 
775
			mov eax,[app1]
812
			add ebx,offs_m_or_i
776
			mov eax,[eax+4]
813
			add ebx,[app1]
777
			add ebx,eax
814
			mov eax,[ebx]
778
			mov eax,[ebx]
815
			bt edx,0
779
			bt edx,0
816
			jnc @f
780
			jnc @f
817
				ror ax,8
781
				ror ax,8
818
				ror eax,16
782
				ror eax,16
Line 830... Line 794...
830
				ror ax,8
794
				ror ax,8
831
			@@:
795
			@@:
832
			call convert_int_to_str ;áâ ¢¨¬ 2-¥ ç¨á«®
796
			call convert_int_to_str ;áâ ¢¨¬ 2-¥ ç¨á«®
833
		;.over4b_05:
797
		;.over4b_05:
834
			;...
798
			;...
835
		;jmp .end_f
799
		jmp .end_f
836
	.tag_05:
800
	.tag_05:
Line -... Line 801...
-
 
801
 
-
 
802
	mov bx,tag_format_si2b
-
 
803
	bt edx,0
-
 
804
	jnc @f
-
 
805
		ror bx,8
-
 
806
	@@:
-
 
807
	cmp word[eax+2],bx
-
 
808
	jne .tag_08
-
 
809
		stdcall str_n_cat,edi,txt_dp,[t_max]
-
 
810
		call get_tag_data_size
-
 
811
		cmp ebx,1
-
 
812
		jg .over4b_08
-
 
813
			;¥á«¨ ®¤­® 2 ¡ ©â®¢®¥ ç¨á«®
-
 
814
			movzx ebx,word[eax+8]
-
 
815
			bt edx,0
-
 
816
			jnc @f
-
 
817
				ror bx,8
-
 
818
			@@:
-
 
819
			stdcall str_len,edi
-
 
820
			add edi,eax
-
 
821
			bt bx,15
-
 
822
			jnc @f
-
 
823
				mov byte[edi],'-'
-
 
824
				inc edi
-
 
825
				neg bx
-
 
826
				inc bx
-
 
827
			@@:
-
 
828
			mov eax,ebx
-
 
829
			call convert_int_to_str ;[t_max]
-
 
830
		.over4b_08:
-
 
831
			;...
-
 
832
		jmp .end_f
-
 
833
	.tag_08:
-
 
834
 
-
 
835
	mov bx,tag_format_si4b
-
 
836
	bt edx,0
-
 
837
	jnc @f
-
 
838
		ror bx,8
-
 
839
	@@:
-
 
840
	cmp word[eax+2],bx
-
 
841
	jne .tag_09
-
 
842
		stdcall str_n_cat,edi,txt_dp,[t_max]
-
 
843
		call get_tag_data_size
-
 
844
		cmp ebx,1
-
 
845
		jg .over4b_09
-
 
846
			;¥á«¨ ®¤­® 4 ¡ ©â®¢®¥ ç¨á«®
-
 
847
			mov ebx,dword[eax+8]
-
 
848
			bt edx,0
-
 
849
			jnc @f
-
 
850
				ror bx,8
-
 
851
				ror ebx,16
-
 
852
				ror bx,8
-
 
853
			@@:
-
 
854
			stdcall str_len,edi
-
 
855
			add edi,eax
-
 
856
			bt ebx,31
-
 
857
			jnc @f
-
 
858
				mov byte[edi],'-'
-
 
859
				inc edi
-
 
860
				neg ebx
-
 
861
				inc ebx
-
 
862
			@@:
-
 
863
			mov eax,ebx
-
 
864
			call convert_int_to_str ;[t_max]
-
 
865
		.over4b_09:
-
 
866
			;...
-
 
867
		jmp .end_f
-
 
868
	.tag_09:
837
 
869
 
838
	.end_f:
870
	.end_f:
839
	ret
871
	ret
Line 840... Line 872...
840
endp
872
endp
Line 918... Line 950...
918
align 16
950
align 16
919
EXPORTS:
951
EXPORTS:
920
	dd sz_exif_get_app1, exif_get_app1
952
	dd sz_exif_get_app1, exif_get_app1
921
	dd sz_exif_get_app1_tag, exif_get_app1_tag
953
	dd sz_exif_get_app1_tag, exif_get_app1_tag
922
	dd sz_exif_get_app1_child, exif_get_app1_child
954
	dd sz_exif_get_app1_child, exif_get_app1_child
923
	dd sz_exif_get_app1_child_tag, exif_get_app1_child_tag
-
 
924
	dd 0,0
955
	dd 0,0
925
	sz_exif_get_app1 db 'exif_get_app1',0
956
	sz_exif_get_app1 db 'exif_get_app1',0
926
	sz_exif_get_app1_tag db 'exif_get_app1_tag',0
957
	sz_exif_get_app1_tag db 'exif_get_app1_tag',0
927
	sz_exif_get_app1_child db 'exif_get_app1_child',0
958
	sz_exif_get_app1_child db 'exif_get_app1_child',0
928
	sz_exif_get_app1_child_tag db 'exif_get_app1_child_tag',0
-