Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 5006 → Rev 5007

/programs/develop/libraries/exif/trunk/exif.asm
9,10 → 9,8
 
;---------
offs_m_or_i equ 8 ;ᬥ饭¨¥ ¯ à ¬¥âà  'MM' ¨«¨ 'II' (Motorola, Intel)
offs_tag_count equ 16 ;ᬥ饭¨¥ ª®«¨ç¥á⢠ ⥣®¢
offs_tag_0 equ 18 ;ᬥ饭¨¥ 0-£® ⥣ 
offs_tag_0 equ 2 ;ᬥ饭¨¥ 0-£® ⥣ 
tag_size equ 12 ;à §¬¥à áâàãªâãàë ⥣ 
offs_tag_child_0 equ 2 ;ᬥ饭¨¥ 0-£® ¤®ç¥à­¥£® ⥣ 
;ä®à¬ âë ¤ ­­ëå
tag_format_ui1b equ 1 ;unsigned integer 1 byte
tag_format_text equ 2 ;ascii string
466,8 → 464,10
db 0xfe,0x57,'Smoothness',0
db 0xfe,0x58,'Moire filter',0
 
dw 0
db 0x00,0x00,'GPS version ID',0
 
dd 0
 
;input:
; bof - 㪠§ â¥«ì ­  ­ ç «® ä ©« 
; app1 - 㪠§ â¥«ì ¤«ï § ¯®«­¥­¨ï exif.app1
496,8 → 496,16
cmp word[eax],0xe1ff
jne .no_exif
 
add eax,2
xor ebx,ebx
cmp word[eax+10],'II'
je @f
inc ebx ;if 'MM' edx=1
@@:
mov [edi+offs_m_or_i],ebx
add eax,18
mov [edi],eax
sub eax,8
mov [edi+4],eax
 
jmp @f
.no_exif:
520,18 → 528,16
 
xor edx,edx
mov byte[edi],dl
cmp eax,edx
cmp [eax],edx
je .end_f ;¥á«¨ ­¥ ­ ©¤¥­ 㪠§ â¥«ì ­  ­ ç «® exif.app1
cmp ecx,edx
jle .end_f ;¥á«¨ ¯®à浪®¢ë© ­®¬¥à ⥣  <= 0
 
cmp word[eax+offs_m_or_i],'II'
je @f
inc edx ;if 'MM' edx=1
@@:
movzx edx,word[eax+offs_m_or_i] ;if 'MM' edx=1
 
;¯à®¢¥à塞 ç¨á«® ⥣®¢
movzx ebx,word[eax+offs_tag_count]
mov eax,[eax]
movzx ebx,word[eax]
bt edx,0
jnc @f
ror bx,8
553,7 → 559,7
endp
 
;input:
; app1 - 㪠§ â¥«ì ­  exif.app1
; app1 - 㪠§ â¥«ì ­  exif.app1 ¨«¨ ­  exif.app1.child
; child - 㪠§ â¥«ì ¤«ï § ¯®«­¥­¨ï ­ ç «  ¤®ç¥à­¨å ⥣®¢ exif.app1.child
; c_tag - ⥣ ¤«ï ª®â®à®£® ¤¥« ¥âáï ¯®¨áª ¤®ç¥à­¨å
;output:
565,14 → 571,10
mov edi,[child]
 
xor edx,edx
mov dword[edi],edx
cmp eax,edx
je .end_f ;¥á«¨ ­¥ ­ ©¤¥­ 㪠§ â¥«ì ­  ­ ç «® exif.app1
cmp [eax],edx
je .no_found ;¥á«¨ ­¥ ­ ©¤¥­ 㪠§ â¥«ì ­  ­ ç «® exif.app1
 
cmp word[eax+offs_m_or_i],'II'
je @f
inc edx ;if 'MM' edx=1
@@:
movzx edx,word[eax+offs_m_or_i] ;if 'MM' edx=1
 
;­ ç «® ¯®¨áª 
mov ebx,[c_tag]
582,13 → 584,14
@@:
 
;¯à®¢¥à塞 ç¨á«® ⥣®¢
movzx ecx,word[eax+offs_tag_count]
mov eax,[eax]
movzx ecx,word[eax]
bt edx,0
jnc @f
ror cx,8
@@:
cmp ecx,1
jl .end_f ;¥á«¨ ç¨á«® ⥣®¢ <1
jl .no_found ;¥á«¨ ç¨á«® ⥣®¢ <1
 
;¯¥à¥å®¤¨¬ ­  1-© ⥣
add eax,offs_tag_0
597,7 → 600,7
je @f
add eax,tag_size
loop @b
jmp .end_f ;¥á«¨ ­¥ ­ ©¤¥­®
jmp .no_found ;¥á«¨ ­¥ ­ ©¤¥­®
@@: ;¥á«¨ ­ ©¤¥­®
mov ebx,dword[eax+8]
bt edx,0
606,60 → 609,15
ror ebx,16
ror bx,8
@@:
add ebx,[app1]
add ebx,offs_m_or_i
mov eax,[app1]
add ebx,[eax+4]
mov dword[edi],ebx
.end_f:
popad
ret
endp
m2m dword[edi+4],dword[eax+4]
mov dword[edi+offs_m_or_i],edx
 
;input:
; app1 - 㪠§ â¥«ì ­  ­ ç «® exif.app1
; child - 㪠§ â¥«ì ­  ­ ç «® ¤®ç¥à­¨å ⥣®¢ exif.app1.child
; num - ¯®à浪®¢ë© ­®¬¥à ⥣  (­ ç¨­ ¥âáï á 1)
; txt - 㪠§ â¥«ì ­  ⥪áâ, ªã¤  ¡ã¤¥â § ¯¨á ­® §­ ç¥­¨¥
; t_max - ¬ ªá¨¬ «ì­ë© à §¬¥à ⥪áâ 
align 4
proc exif_get_app1_child_tag, app1:dword, child:dword, num:dword, txt:dword, t_max:dword
pushad
mov eax,[app1]
mov edi,[txt]
mov ecx,[num]
 
xor edx,edx
mov byte[edi],dl
cmp eax,edx
je .end_f ;¥á«¨ ­¥ ­ ©¤¥­ 㪠§ â¥«ì ­  ­ ç «® exif.app1
cmp ecx,edx
jle .end_f ;¥á«¨ ¯®à浪®¢ë© ­®¬¥à ⥣  <= 0
 
cmp word[eax+offs_m_or_i],'II'
je @f
inc edx ;if 'MM' edx=1
@@:
 
mov eax,[child]
cmp eax,0
je .end_f ;¥á«¨ ­¥ ­ ©¤¥­ 㪠§ â¥«ì ­  ­ ç «® exif.app1.child
;¯à®¢¥à塞 ç¨á«® ⥣®¢
movzx ebx,word[eax]
bt edx,0
jnc @f
ror bx,8
@@:
cmp ecx,ebx
jg .end_f ;¥á«¨ ­®¬¥à ⥣  ¡®«ìè¥ ç¥¬ ¨å ¥áâì ¢ ä ©«¥
 
;¯¥à¥å®¤¨¬ ­  § ¤ ­­ë© ⥣
dec ecx
imul ecx,tag_size
add eax,offs_tag_child_0
add eax,ecx
 
stdcall read_tag_value,[app1],[t_max]
 
jmp .end_f
.no_found:
mov dword[edi],0
.end_f:
popad
ret
677,7 → 635,11
.next_tag:
mov bx,word[esi]
cmp bx,0
je .tag_unknown ;⥣ ­¥ ®¯®§­ ­
jne @f
cmp dword[esi],0
jne @f
jmp .tag_unknown ;⥣ ­¥ ®¯®§­ ­
@@:
bt edx,0
jc @f
ror bx,8
729,8 → 691,9
ror esi,16
ror si,8
@@:
add esi,offs_m_or_i
add esi,[app1]
mov eax,[app1]
mov eax,[eax+4]
add esi,eax
stdcall str_n_cat,edi,esi,[t_max]
jmp .end_f
.tag_02:
809,8 → 772,9
@@:
stdcall str_len,edi
add edi,eax
add ebx,offs_m_or_i
add ebx,[app1]
mov eax,[app1]
mov eax,[eax+4]
add ebx,eax
mov eax,[ebx]
bt edx,0
jnc @f
832,9 → 796,77
call convert_int_to_str ;áâ ¢¨¬ 2-¥ ç¨á«®
;.over4b_05:
;...
;jmp .end_f
jmp .end_f
.tag_05:
 
mov bx,tag_format_si2b
bt edx,0
jnc @f
ror bx,8
@@:
cmp word[eax+2],bx
jne .tag_08
stdcall str_n_cat,edi,txt_dp,[t_max]
call get_tag_data_size
cmp ebx,1
jg .over4b_08
;¥á«¨ ®¤­® 2 ¡ ©â®¢®¥ ç¨á«®
movzx ebx,word[eax+8]
bt edx,0
jnc @f
ror bx,8
@@:
stdcall str_len,edi
add edi,eax
bt bx,15
jnc @f
mov byte[edi],'-'
inc edi
neg bx
inc bx
@@:
mov eax,ebx
call convert_int_to_str ;[t_max]
.over4b_08:
;...
jmp .end_f
.tag_08:
 
mov bx,tag_format_si4b
bt edx,0
jnc @f
ror bx,8
@@:
cmp word[eax+2],bx
jne .tag_09
stdcall str_n_cat,edi,txt_dp,[t_max]
call get_tag_data_size
cmp ebx,1
jg .over4b_09
;¥á«¨ ®¤­® 4 ¡ ©â®¢®¥ ç¨á«®
mov ebx,dword[eax+8]
bt edx,0
jnc @f
ror bx,8
ror ebx,16
ror bx,8
@@:
stdcall str_len,edi
add edi,eax
bt ebx,31
jnc @f
mov byte[edi],'-'
inc edi
neg ebx
inc ebx
@@:
mov eax,ebx
call convert_int_to_str ;[t_max]
.over4b_09:
;...
jmp .end_f
.tag_09:
 
.end_f:
ret
endp
920,9 → 952,7
dd sz_exif_get_app1, exif_get_app1
dd sz_exif_get_app1_tag, exif_get_app1_tag
dd sz_exif_get_app1_child, exif_get_app1_child
dd sz_exif_get_app1_child_tag, exif_get_app1_child_tag
dd 0,0
sz_exif_get_app1 db 'exif_get_app1',0
sz_exif_get_app1_tag db 'exif_get_app1_tag',0
sz_exif_get_app1_child db 'exif_get_app1_child',0
sz_exif_get_app1_child_tag db 'exif_get_app1_child_tag',0