1 ;******************************************************************************
2 ;* Copyright (c) 2012 Michael Niedermayer
4 ;* This file is part of FFmpeg.
6 ;* FFmpeg is free software; you can redistribute it and/or
7 ;* modify it under the terms of the GNU Lesser General Public
8 ;* License as published by the Free Software Foundation; either
9 ;* version 2.1 of the License, or (at your option) any later version.
11 ;* FFmpeg is distributed in the hope that it will be useful,
12 ;* but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 ;* Lesser General Public License for more details.
16 ;* You should have received a copy of the GNU Lesser General Public
17 ;* License along with FFmpeg; if not, write to the Free Software
18 ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 ;******************************************************************************
21 %include "libavutil/x86/x86inc.asm"
22 %include "libavutil/x86/x86util.asm"
26 flt2pm31: times 8 dd 4.6566129e-10
27 flt2p31 : times 8 dd 2147483648.0
28 flt2p15 : times 8 dd 32768.0
33 ;to, from, a/u, log2_outsize, log_intsize, const
35 cglobal pack_2ch_%2_to_%1_%3, 3, 4, 6, dst, src, len, src2
36 mov src2q , [srcq+gprsize]
41 jne pack_2ch_%2_to_%1_u_int %+ SUFFIX
43 jne pack_2ch_%2_to_%1_u_int %+ SUFFIX
45 jne pack_2ch_%2_to_%1_u_int %+ SUFFIX
47 pack_2ch_%2_to_%1_u_int %+ SUFFIX
49 lea srcq , [srcq + (1<<%5)*lenq]
50 lea src2q, [src2q + (1<<%5)*lenq]
51 lea dstq , [dstq + (2<<%4)*lenq]
55 mov%3 m0, [ srcq +(1<<%5)*lenq]
57 mov%3 m2, [ src2q+(1<<%5)*lenq]
66 mov%3 m2, [mmsize + srcq +(1<<%5)*lenq]
68 mov%3 m4, [mmsize + src2q+(1<<%5)*lenq]
73 mov%3 [ dstq+(2<<%4)*lenq], m0
74 mov%3 [ mmsize + dstq+(2<<%4)*lenq], m1
76 mov%3 [2*mmsize + dstq+(2<<%4)*lenq], m2
77 mov%3 [3*mmsize + dstq+(2<<%4)*lenq], m3
78 add lenq, 4*mmsize/(2<<%4)
80 add lenq, 2*mmsize/(2<<%4)
87 cglobal %2_to_%1_%3, 3, 3, 6, dst, src, len
92 jne %2_to_%1_u_int %+ SUFFIX
94 jne %2_to_%1_u_int %+ SUFFIX
96 %2_to_%1_u_int %+ SUFFIX
98 lea srcq , [srcq + (1<<%5)*lenq]
99 lea dstq , [dstq + (1<<%4)*lenq]
103 mov%3 m0, [ srcq +(1<<%5)*lenq]
104 mov%3 m1, [ mmsize + srcq +(1<<%5)*lenq]
106 mov%3 m2, [2*mmsize + srcq +(1<<%5)*lenq]
107 mov%3 m3, [3*mmsize + srcq +(1<<%5)*lenq]
110 mov%3 [ dstq+(1<<%4)*lenq], m0
111 mov%3 [ mmsize + dstq+(1<<%4)*lenq], m1
113 mov%3 [2*mmsize + dstq+(1<<%4)*lenq], m2
114 mov%3 [3*mmsize + dstq+(1<<%4)*lenq], m3
115 add lenq, 4*mmsize/(1<<%4)
117 add lenq, 2*mmsize/(1<<%4)
123 %macro INT16_TO_INT32_N 0
135 %macro INT32_TO_INT16_N 0
145 %macro INT32_TO_FLOAT_INIT 0
148 %macro INT32_TO_FLOAT_N 0
155 %macro FLOAT_TO_INT32_INIT 0
158 %macro FLOAT_TO_INT32_N 0
169 %macro INT16_TO_FLOAT_INIT 0
172 %macro INT16_TO_FLOAT_N 0
184 %macro FLOAT_TO_INT16_INIT 0
187 %macro FLOAT_TO_INT16_N 0
201 CONV int32, int16, u, 2, 1, INT16_TO_INT32_N
202 CONV int32, int16, a, 2, 1, INT16_TO_INT32_N
203 CONV int16, int32, u, 1, 2, INT32_TO_INT16_N
204 CONV int16, int32, a, 1, 2, INT32_TO_INT16_N
207 CONV int32, int16, u, 2, 1, INT16_TO_INT32_N
208 CONV int32, int16, a, 2, 1, INT16_TO_INT32_N
209 CONV int16, int32, u, 1, 2, INT32_TO_INT16_N
210 CONV int16, int32, a, 1, 2, INT32_TO_INT16_N
212 PACK_2CH int16, int16, u, 1, 1
213 PACK_2CH int16, int16, a, 1, 1
214 PACK_2CH int32, int32, u, 2, 2
215 PACK_2CH int32, int32, a, 2, 2
216 PACK_2CH int32, int16, u, 2, 1, INT16_TO_INT32_N
217 PACK_2CH int32, int16, a, 2, 1, INT16_TO_INT32_N
218 PACK_2CH int16, int32, u, 1, 2, INT32_TO_INT16_N
219 PACK_2CH int16, int32, a, 1, 2, INT32_TO_INT16_N
222 CONV float, int32, u, 2, 2, INT32_TO_FLOAT_N, INT32_TO_FLOAT_INIT
223 CONV float, int32, a, 2, 2, INT32_TO_FLOAT_N, INT32_TO_FLOAT_INIT
224 CONV int32, float, u, 2, 2, FLOAT_TO_INT32_N, FLOAT_TO_INT32_INIT
225 CONV int32, float, a, 2, 2, FLOAT_TO_INT32_N, FLOAT_TO_INT32_INIT
226 CONV float, int16, u, 2, 1, INT16_TO_FLOAT_N, INT16_TO_FLOAT_INIT
227 CONV float, int16, a, 2, 1, INT16_TO_FLOAT_N, INT16_TO_FLOAT_INIT
228 CONV int16, float, u, 1, 2, FLOAT_TO_INT16_N, FLOAT_TO_INT16_INIT
229 CONV int16, float, a, 1, 2, FLOAT_TO_INT16_N, FLOAT_TO_INT16_INIT
231 PACK_2CH float, int32, u, 2, 2, INT32_TO_FLOAT_N, INT32_TO_FLOAT_INIT
232 PACK_2CH float, int32, a, 2, 2, INT32_TO_FLOAT_N, INT32_TO_FLOAT_INIT
233 PACK_2CH int32, float, u, 2, 2, FLOAT_TO_INT32_N, FLOAT_TO_INT32_INIT
234 PACK_2CH int32, float, a, 2, 2, FLOAT_TO_INT32_N, FLOAT_TO_INT32_INIT
235 PACK_2CH float, int16, u, 2, 1, INT16_TO_FLOAT_N, INT16_TO_FLOAT_INIT
236 PACK_2CH float, int16, a, 2, 1, INT16_TO_FLOAT_N, INT16_TO_FLOAT_INIT
237 PACK_2CH int16, float, u, 1, 2, FLOAT_TO_INT16_N, FLOAT_TO_INT16_INIT
238 PACK_2CH int16, float, a, 1, 2, FLOAT_TO_INT16_N, FLOAT_TO_INT16_INIT
243 CONV float, int32, u, 2, 2, INT32_TO_FLOAT_N, INT32_TO_FLOAT_INIT
244 CONV float, int32, a, 2, 2, INT32_TO_FLOAT_N, INT32_TO_FLOAT_INIT