home *** CD-ROM | disk | FTP | other *** search
- /
- / Copyright (C) 1990-1992 Michael Davidson.
- / All rights reserved.
- /
- / Permission to use, copy, modify, and distribute this software
- / and its documentation for any purpose and without fee is hereby
- / granted, provided that the above copyright notice appear in all
- / copies and that both that copyright notice and this permission
- / notice appear in supporting documentation.
- /
- / This software is provided "as is" without express or implied warranty.
- /
- .text
-
-
- /
- / CreateHistogram24()
- / pixel24_t **image,
- / int width,
- / int height,
- / long *histogram
- / )
- /
- .globl CreateHistogram24
-
- IMAGE = 8
- WIDTH = 12
- HEIGHT = 16
- HIST = 20
-
- CreateHistogram24:
- pushl %ebp
- movl %esp, %ebp
- pushl %esi
- pushl %edi
- pushl %ebx
- /
- / zero the histogram
- /
- movl HIST(%ebp), %ebx
- movl $4096, %ecx
- xorl %eax, %eax
-
- .align 4
- L40:
- movl %eax, (%ebx)
- movl %eax, 4(%ebx)
- movl %eax, 8(%ebx)
- movl %eax, 12(%ebx)
- movl %eax, 16(%ebx)
- movl %eax, 20(%ebx)
- movl %eax, 24(%ebx)
- movl %eax, 28(%ebx)
- decl %ecx
- leal 32(%ebx), %ebx
- jg L40
-
- movl IMAGE(%ebp),%edi
- movl HIST(%ebp),%ebx
- jmp L44
-
- .align 4
- L41:
- movl (%edi), %esi
- leal 4(%edi), %edi
- movl WIDTH(%ebp), %ecx
- shrl %ecx
-
- .align 4
- L42:
- xorl %eax, %eax
- xorl %edx, %edx
- movb (%esi), %al
- movb 3(%esi), %dl
- shll $5, %eax
- shll $5, %edx
- movb 1(%esi), %al
- movb 4(%esi), %dl
- shll $5, %eax
- shll $5, %edx
- movb 2(%esi), %al
- movb 5(%esi), %dl
- shrl $3, %eax
- shrl $3, %edx
- incl (%ebx,%eax,4)
- incl (%ebx,%edx,4)
- leal 0x6(%esi),%esi
- L43:
- decl %ecx
- jge L42
- L44:
- decl HEIGHT(%ebp)
- jge L41
-
- popl %ebx
- popl %edi
- popl %esi
- popl %ebp
- ret
-
-