1 ;******************************************************************************
2 ;* x86 optimized Format Conversion Utils
3 ;* Copyright (c) 2008 Loren Merritt
5 ;* This file is part of FFmpeg.
7 ;* FFmpeg 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 ;* FFmpeg 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 FFmpeg; 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"
26 ;------------------------------------------------------------------------------
27 ; void ff_int32_to_float_fmul_scalar(float *dst, const int32_t *src, float mul,
29 ;------------------------------------------------------------------------------
30 %macro INT32_TO_FLOAT_FMUL_SCALAR 1
32 cglobal int32_to_float_fmul_scalar, 3, 3, %1, dst, src, len
34 cglobal int32_to_float_fmul_scalar, 4, 4, %1, dst, src, mul, len
48 cvtdq2ps m1, [srcq+lenq ]
49 cvtdq2ps m2, [srcq+lenq+16]
51 cvtpi2ps m1, [srcq+lenq ]
52 cvtpi2ps m3, [srcq+lenq+ 8]
53 cvtpi2ps m2, [srcq+lenq+16]
54 cvtpi2ps m4, [srcq+lenq+24]
61 mova [dstq+lenq+16], m2
65 ;; cvtpi2ps switches to MMX even if the source is a memory location
66 ;; possible an error in documentation since every tested CPU disagrees with
67 ;; that. Use emms anyway since the vast majority of machines will use the
75 INT32_TO_FLOAT_FMUL_SCALAR 5
77 INT32_TO_FLOAT_FMUL_SCALAR 3
79 ;------------------------------------------------------------------------------
80 ; void ff_int32_to_float_fmul_array8(FmtConvertContext *c, float *dst, const int32_t *src,
81 ; const float *mul, int len);
82 ;------------------------------------------------------------------------------
83 %macro INT32_TO_FLOAT_FMUL_ARRAY8 0
84 cglobal int32_to_float_fmul_array8, 5, 5, 5, c, dst, src, mul, len
93 cvtdq2ps m1, [srcq+lenq ]
94 cvtdq2ps m2, [srcq+lenq+16]
96 cvtpi2ps m1, [srcq+lenq ]
97 cvtpi2ps m3, [srcq+lenq+ 8]
98 cvtpi2ps m2, [srcq+lenq+16]
99 cvtpi2ps m4, [srcq+lenq+24]
105 mova [dstq+lenq ], m1
106 mova [dstq+lenq+16], m2
111 ;; cvtpi2ps switches to MMX even if the source is a memory location
112 ;; possible an error in documentation since every tested CPU disagrees with
113 ;; that. Use emms anyway since the vast majority of machines will use the
121 INT32_TO_FLOAT_FMUL_ARRAY8
123 INT32_TO_FLOAT_FMUL_ARRAY8