home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / Tools / vg-2.03 / histogram.s < prev    next >
Encoding:
Text File  |  1995-05-03  |  1.7 KB  |  101 lines

  1. /
  2. / Copyright (C) 1990-1992 Michael Davidson.
  3. / All rights reserved.
  4. /
  5. / Permission to use, copy, modify, and distribute this software
  6. / and its documentation for any purpose and without fee is hereby
  7. / granted, provided that the above copyright notice appear in all
  8. / copies and that both that copyright notice and this permission
  9. / notice appear in supporting documentation.
  10. /
  11. / This software is provided "as is" without express or implied warranty.
  12. /
  13.     .text
  14.  
  15.  
  16. /
  17. / CreateHistogram24()
  18. /    pixel24_t    **image,
  19. /    int        width,
  20. /    int        height,
  21. /    long        *histogram
  22. /    )
  23. /
  24.     .globl    CreateHistogram24
  25.  
  26. IMAGE    =    8
  27. WIDTH    =    12
  28. HEIGHT    =    16
  29. HIST    =    20
  30.  
  31. CreateHistogram24:
  32.     pushl  %ebp
  33.     movl   %esp, %ebp
  34.     pushl  %esi
  35.     pushl  %edi
  36.     pushl  %ebx
  37. /
  38. / zero the histogram
  39. /
  40.     movl   HIST(%ebp), %ebx
  41.     movl   $4096, %ecx
  42.     xorl   %eax, %eax
  43.  
  44.     .align    4
  45. L40:
  46.     movl   %eax, (%ebx)
  47.     movl   %eax, 4(%ebx)
  48.     movl   %eax, 8(%ebx)
  49.     movl   %eax, 12(%ebx)
  50.     movl   %eax, 16(%ebx)
  51.     movl   %eax, 20(%ebx)
  52.     movl   %eax, 24(%ebx)
  53.     movl   %eax, 28(%ebx)
  54.     decl   %ecx
  55.     leal   32(%ebx), %ebx
  56.     jg     L40
  57.  
  58.     movl   IMAGE(%ebp),%edi
  59.     movl   HIST(%ebp),%ebx
  60.     jmp    L44
  61.  
  62.     .align    4
  63. L41:
  64.     movl   (%edi), %esi
  65.     leal   4(%edi), %edi
  66.     movl   WIDTH(%ebp), %ecx
  67.     shrl   %ecx
  68.  
  69.     .align    4
  70. L42:
  71.     xorl   %eax, %eax
  72.     xorl   %edx, %edx
  73.     movb   (%esi), %al
  74.     movb   3(%esi), %dl
  75.     shll   $5, %eax
  76.     shll   $5, %edx
  77.     movb   1(%esi), %al
  78.     movb   4(%esi), %dl
  79.     shll   $5, %eax
  80.     shll   $5, %edx
  81.     movb   2(%esi), %al
  82.     movb   5(%esi), %dl
  83.     shrl   $3, %eax
  84.     shrl   $3, %edx
  85.     incl   (%ebx,%eax,4)
  86.     incl   (%ebx,%edx,4)
  87.     leal   0x6(%esi),%esi
  88. L43:
  89.     decl   %ecx
  90.     jge    L42
  91. L44:
  92.     decl   HEIGHT(%ebp)
  93.     jge    L41
  94.  
  95.     popl   %ebx
  96.     popl   %edi
  97.     popl   %esi
  98.     popl   %ebp
  99.     ret    
  100.     
  101.