1 ;******************************************************************************
2 ;* AAC Spectral Band Replication decoding functions
3 ;* Copyright (C) 2012 Christophe Gisquet <christophe.gisquet@gmail.com>
5 ;* This file is part of Libav.
7 ;* Libav is free software; you can redistribute it and/or
8 ;* modify it under the terms of the GNU Lesser General Public
9 ;* License as published by the Free Software Foundation; either
10 ;* version 2.1 of the License, or (at your option) any later version.
12 ;* Libav is distributed in the hope that it will be useful,
13 ;* but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 ;* Lesser General Public License for more details.
17 ;* You should have received a copy of the GNU Lesser General Public
18 ;* License along with Libav; if not, write to the Free Software
19 ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 ;******************************************************************************
22 %include "libavutil/x86/x86util.asm"
25 ; mask equivalent for multiply by -1.0 1.0
26 ps_mask times
2 dd 1<<31, 0
27 ps_mask2 times
2 dd 0, 1<<31
28 ps_neg times
4 dd 1<<31
33 cglobal sbr_sum_square
, 2, 3, 6
59 ; len is a multiple of 2, thus there are at least 4 elements to process
81 cglobal sbr_hf_g_filt
, 5, 6, 5
82 lea r1
, [r1
+ 8*r4
] ; offset by ixh elements into X_high
90 movlps m0
, [r2
+ 4*r3
+ 0]
91 movlps m1
, [r2
+ 4*r3
+ 8]
92 movlps m2
, [r1
+ 0*STEP
]
93 movlps m3
, [r1
+ 2*STEP
]
94 movhps m2
, [r1
+ 1*STEP
]
95 movhps m3
, [r1
+ 3*STEP
]
100 movu
[r0
+ 8*r3
+ 0], m0
101 movu
[r0
+ 8*r3
+ 16], m1
105 and r5
, 3 ; number of single element loops
107 .
loop1: ; element 0 and 1 can be computed at the same time
121 ; void ff_sbr_hf_gen_sse(float (*X_high)[2], const float (*X_low)[2],
122 ; const float alpha0[2], const float alpha1[2],
123 ; float bw, int start, int end)
125 cglobal sbr_hf_gen
, 4,4,8, X_high
, X_low
, alpha0
, alpha1
, BW
, S
, E
128 %if ARCH_X86_64
== 0 || WIN64
134 mulps m2
, bw
; (a1[0] a1[1])*bw
135 mulps m1
, bw
; (a0[0] a0[1])*bw = (a2 a3)
136 mulps m2
, bw
; (a1[0] a1[1])*bw*bw = (a0 a1)
142 %if ARCH_X86_64
== 0 || WIN64
143 ; start and end 6th and 7th args on stack
149 ; BW does not actually occupy a register, so shift by 1
153 sub start
, end ; neg num of loops
154 lea X_highq
, [X_highq
+ end*2*4]
155 lea X_lowq
, [X_lowq
+ end*2*4 - 2*2*4]
156 shl start
, 3 ; offset from num loops
158 mova m0
, [X_lowq
+ start
]
159 movlhps m1
, m1
; (a2 a3 a2 a3)
160 movlhps m2
, m2
; (a0 a1 a0 a1)
161 shufps m3
, m3
, q0101
; (a3 a2 a3 a2)
162 shufps m4
, m4
, q0101
; (a1 a0 a1 a0)
163 xorps m3
, m7
; (-a3 a2 -a3 a2)
164 xorps m4
, m7
; (-a1 a0 -a1 a0)
168 shufps m0
, m0
, q2200
; {Xl[-2][0],",Xl[-1][0],"}
169 shufps m5
, m5
, q3311
; {Xl[-2][1],",Xl[-1][1],"}
174 mova m0
, [X_lowq
+ start
+ 2*2*4]
175 shufps m6
, m0
, q0022
; {Xl[-1][0],",Xl[0][0],"}
176 shufps m7
, m0
, q1133
; {Xl[-1][1],",Xl[1][1],"}
182 mova
[X_highq
+ start
], m5
187 cglobal sbr_sum64x5
, 1,2,4,z
210 cglobal sbr_qmf_post_shuffle
, 2,3,4,W
,z
211 lea r2q
, [zq
+ (64-4)*4]
216 shufps m0
, m0
, m0
, q0123
229 cglobal sbr_neg_odd_64
, 1,2,4,z
250 ; void ff_sbr_qmf_deint_bfly_sse2(float *v, const float *src0, const float *src1)
251 cglobal sbr_qmf_deint_bfly
, 3,5,8, v
,src0
,src1
,vrev
,c
252 mov cq
, 64*4-2*mmsize
253 lea vrevq
, [vq
+ 64*4]
257 mova m2
, [src0q
+cq
+mmsize
]
258 mova m3
, [src1q
+mmsize
]
268 mova
[vrevq
+mmsize
], m3
270 mova
[vq
+cq
+mmsize
], m2
278 cglobal sbr_qmf_pre_shuffle
, 1,4,6,z
279 %define
OFFSET (32*4-2*mmsize
)
281 lea r1q
, [zq
+ (32+1)*4]
286 movu m2
, [r1q
+ mmsize
]
287 movu m1
, [zq
+ r3q
+ 4 + mmsize
]
288 movu m3
, [zq
+ r3q
+ 4]
294 SBUTTERFLY
dq, 2, 3, 4
295 SBUTTERFLY
dq, 0, 1, 4
296 mova
[r2q
+ 2*r3q
+ 0*mmsize
], m2
297 mova
[r2q
+ 2*r3q
+ 1*mmsize
], m3
298 mova
[r2q
+ 2*r3q
+ 2*mmsize
], m0
299 mova
[r2q
+ 2*r3q
+ 3*mmsize
], m1