Distance (magnitude) from the center of the image to the current pixel
Syntax
m
Synonyms
m0
m1
Original Machine Code (in OPER resource) of Filter Factory 3.0 and 3.0.4 for Photoshop/Win32
Ratio a==b: 27146/65536 = 0,414215087890625 ~= sqrt(2)-1
8B 47 44 | mov eax,[edi+$44] (xmin) | . |
8B 5F 50 | mov ebx,[edi+$50] (ymin) | . |
2B 47 48 | sub eax,[edi+$48] (X) | . |
2B 5F 54 | sub ebx,[edi+$54] (Y) | . |
D1 F8 | sar eax,1 | . |
D1 FB | sar ebx,1 | . |
03 47 40 | add eax,[edi+$40] (x) | a = x + (xmin-X)/2; |
03 5F 4C | add ebx,[edi+$4c] (y) | b = y + (ymin-Y)/2; |
8B D0 | mov edx,eax | . |
C1 FA 1F | sar edx,$1f (31) | // d = (a<0) ? -1 : 0; |
33 C2 | xor eax,edx | . |
2B C2 | sub eax,edx | a = abs(a); // = abs(x - (X-xmin)/2); |
8B D3 | mov edx,ebx | . |
C1 FA 1F | sar edx,$1f (31) | d = (b<0) ? -1 : 0; |
33 DA | xor ebx,edx | . |
2B DA | sub ebx,edx | b = abs(b); // = abs(y - (Y-ymin)/2); |
3B C3 | cmp eax,ebx | . |
75 07 | jnz +$07 (@@1) | if (a != b) goto @@1; |
B8 0A 6A 00 00 | mov eax,$00006a0a (27146) | a = 27146; // verhältnis für a==b . Gedachtes C2M_LOOKUP[1024] |
EB 11 | jmp +$11 (@@3) | goto @@3; |
@@1: | @@1: // a != b | |
7E 01 | jle +$01 (@@2) | if (a <= b) goto @@2; // effective: < ? |
93 | xchg eax,ebx | tmp=a; a=b; b=tmp; |
@@2: | @@2: // a <= b, effektiv: a<b ? | |
C1 E0 0A | shl eax,$0a (10) | a *= 1024; // 360 deg |
99 | cdq | d = (a<0) ? -1 : 0; |
F7 F3 | div ebx | a /= b; |
0F B7 84 47 78 15 00 00 | movzx eax,[edi+eax*2+$00001578] (C2M_LOOKUP) | a = C2M_LOOKUP[a]; // C2M_LOOKUP[1024*a/b] |
@@3: | @@3: | |
F7 E3 | mul ebx | a *= b; |
0F AC D0 10 | shrd eax,edx,$10 (16) | Shift EAX right by 16 bits Store lower 16 bits of EDX into the upper 16 bits of EAX |
03 C3 | add eax,ebx | a += b; |
50 | push eax | return a; |
int x, X, xmin, y, Y, ymin; int factory_m() { int eax, ebx; eax = x + (xmin-X)/2; ebx = y + (ymin-Y)/2; eax = eax < 0 ? -eax : eax; ebx = ebx < 0 ? -ebx : ebx; if (eax == ebx) { eax = 27146; // 27146/65536 == sqrt(2)-1 } else { if (eax > ebx) { int tmp = eax; eax = ebx; ebx = tmp; } eax = C2M_LOOKUP[1024 * eax / ebx]; } eax = ((int64_t)eax * (int64_t)ebx) >> 16; eax += ebx; return eax; }