1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164
|
; CTV!
bits 32
section .text
;extern "C" int blur_bitmap_16
; (unsigned char *dest,int len);
global _blur_bitmap_16
global _test_ctv
times ($$-$) & 3 db 0
_blur_bitmap_16:
push edi ; point to screen
push edx ; temporary for unwrapping
push ecx ; count
push ebx ; last pixel
; ax = current pixel
xor ebx,ebx ; Last pixel
mov edi,[esp+20] ; edi is a pointer to the bitmap
mov ecx,[esp+24] ; ecx is the amount of pixels to blur
blur16_loop:
mov ax,word[edi]
mov dx,ax
and ax,0x07e0
and dx,0xf81f
rol eax,16
mov ax,dx
; Now we have unwrapped the green middle out of eax
mov edx,eax ; ebx=this pixel (unwrapped) before we changed it
add eax,ebx ; add last pixel to this one
mov ebx,edx ; ebx=this pixel for next time
sar eax,1
; wrap up again
mov edx,eax
ror edx,16
and dx,0x07e0
and ax,0xf81f
or ax,dx
;finished pixel in ax
;mov word[edi],ax
;add edi,2
stosw
loop blur16_loop
pop ebx
pop ecx
pop edx
pop edi
xor eax,eax
ret
; --------------------------------------
bits 32
section .text
;extern "C" int blur_bitmap_15
; (unsigned char *dest,int len);
global _blur_bitmap_15
times ($$-$) & 3 db 0
_blur_bitmap_15:
push edi ; point to screen
push edx ; temporary for unwrapping
push ecx ; count
push ebx ; last pixel
; ax = current pixel
xor ebx,ebx ; Last pixel
mov edi,[esp+20] ; edi is a pointer to the bitmap
mov ecx,[esp+24] ; ecx is the amount of pixels to blur
blur15_loop:
mov ax,word[edi]
mov dx,ax
and ax,0x03e0
and dx,0x7c1f
rol eax,16
mov ax,dx
; Now we have unwrapped the green middle out of eax
mov edx,eax ; ebx=this pixel (unwrapped) before we changed it
add eax,ebx ; add last pixel to this one
mov ebx,edx ; ebx=this pixel for next time
sar eax,1
; wrap up again
mov edx,eax
ror edx,16
and dx,0x03e0
and ax,0x7c1f
or ax,dx
;finished pixel in ax
;mov word[edi],ax
;add edi,2
stosw
loop blur15_loop
pop ebx
pop ecx
pop edx
pop edi
xor eax,eax
ret
; ----------------------------
bits 32
section .text
;extern "C" int test_ctv
; (unsigned char *dest,int len);
global _test_ctv
times ($$-$) & 3 db 0
_test_ctv:
push edi ; point to screen
push edx ; temporary for unwrapping
push ecx ; count
push ebx ; last pixel
; ax = current pixel
xor ebx,ebx ; Last pixel
mov edi,[esp+20] ; edi is a pointer to the bitmap
mov ecx,[esp+24] ; ecx is the amount of pixels to blur
test_loop:
mov ax,word[edi]
mov dx,ax
rol eax,16
mov ax,dx
mov edx,eax ; ebx=this pixel (unwrapped) before we changed it
mov ebx,edx ; ebx=this pixel for next time
sar eax,1
mov edx,eax
ror edx,16
;finished pixel in ax
;mov word[edi],ax
;add edi,2
stosw
loop test_loop
pop ebx
pop ecx
pop edx
pop edi
xor eax,eax
ret
|