~kamalmostafa/ubuntu/lucid/pdp/fix-504941-ftbfs

« back to all changes in this revision

Viewing changes to system/mmx/pixel_gain_s16.s

  • Committer: Bazaar Package Importer
  • Author(s): Guenter Geiger (Debian/GNU)
  • Date: 2005-03-15 22:21:05 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050315222105-1q287rsihmd9j1tb
Tags: 1:0.12.4-2
* fixed the hardcoded depends
* added 3dp library

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#    Pure Data Packet mmx routine.
2
 
#    Copyright (c) by Tom Schouten <pdp@zzz.kotnet.org>
3
 
4
 
#    This program is free software; you can redistribute it and/or modify
5
 
#    it under the terms of the GNU General Public License as published by
6
 
#    the Free Software Foundation; either version 2 of the License, or
7
 
#    (at your option) any later version.
8
 
9
 
#    This program is distributed in the hope that it will be useful,
10
 
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 
#    GNU General Public License for more details.
13
 
14
 
#    You should have received a copy of the GNU General Public License
15
 
#    along with this program; if not, write to the Free Software
16
 
#    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
 
#
18
 
.globl pixel_gain_s16
19
 
.type  pixel_gain_s16,@function
20
 
 
21
 
# gain is integer, shift count is down  
22
 
# void pixel_gain_s16(int *buf, int nb_8pixel_vectors, short int gain[4], unsigned long long *shift)
23
 
 
24
 
pixel_gain_s16:
25
 
        pushl %ebp
26
 
        movl %esp, %ebp
27
 
        push %esi
28
 
        push %edi
29
 
 
30
 
        movl 20(%ebp), %edi
31
 
        movq (%edi), %mm6       # get shift vector
32
 
 
33
 
        movl 16(%ebp), %edi
34
 
        movq (%edi), %mm7       # get gain vector
35
 
        
36
 
        movl 8(%ebp),  %esi     # input array
37
 
        movl 12(%ebp), %ecx     # pixel count
38
 
 
39
 
        
40
 
        .align 16
41
 
        .loop_gain:     
42
 
 
43
 
        movq (%esi), %mm0       # load 4 pixels from memory
44
 
        movq %mm0, %mm1         
45
 
        pmulhw %mm7, %mm1       # apply gain (s15.0) fixed point, high word
46
 
        pmullw %mm7, %mm0       # low word
47
 
 
48
 
        movq %mm0, %mm2         # copy
49
 
        movq %mm1, %mm3
50
 
 
51
 
        punpcklwd %mm1, %mm0    # unpack lsw components
52
 
        punpckhwd %mm3, %mm2    # unpack msw components
53
 
 
54
 
        psrad %mm6, %mm0        # apply signed shift
55
 
        psrad %mm6, %mm2
56
 
 
57
 
        packssdw %mm2, %mm0     # pack result & saturate
58
 
        movq %mm0, (%esi)       # store result
59
 
        
60
 
 
61
 
        addl $8, %esi           # increment source pointer
62
 
        decl %ecx
63
 
        jnz .loop_gain          # loop
64
 
 
65
 
        emms
66
 
        
67
 
        pop %edi
68
 
        pop %esi
69
 
        leave
70
 
        ret
71