]> git.sesse.net Git - ffmpeg/blob - libavcodec/x86/aacencdsp.asm
avfilter/vf_psnr: remove unnecessary check
[ffmpeg] / libavcodec / x86 / aacencdsp.asm
1 ;******************************************************************************
2 ;* SIMD optimized AAC encoder DSP functions
3 ;*
4 ;* Copyright (C) 2016 Rostislav Pehlivanov <atomnuker@gmail.com>
5 ;*
6 ;* This file is part of FFmpeg.
7 ;*
8 ;* FFmpeg is free software; you can redistribute it and/or
9 ;* modify it under the terms of the GNU Lesser General Public
10 ;* License as published by the Free Software Foundation; either
11 ;* version 2.1 of the License, or (at your option) any later version.
12 ;*
13 ;* FFmpeg is distributed in the hope that it will be useful,
14 ;* but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 ;* Lesser General Public License for more details.
17 ;*
18 ;* You should have received a copy of the GNU Lesser General Public
19 ;* License along with FFmpeg; if not, write to the Free Software
20 ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 ;******************************************************************************
22
23 %include "libavutil/x86/x86util.asm"
24
25 SECTION_RODATA
26
27 float_abs_mask: times 4 dd 0x7fffffff
28
29 SECTION .text
30
31 ;*******************************************************************
32 ;void ff_abs_pow34(float *out, const float *in, const int size);
33 ;*******************************************************************
34 INIT_XMM sse
35 cglobal abs_pow34, 3, 3, 3, out, in, size
36     mova   m2, [float_abs_mask]
37     shl    sizeq, 2
38     add    inq, sizeq
39     add    outq, sizeq
40     neg    sizeq
41 .loop:
42     andps  m0, m2, [inq+sizeq]
43     sqrtps m1, m0
44     mulps  m0, m1
45     sqrtps m0, m0
46     mova   [outq+sizeq], m0
47     add    sizeq, mmsize
48     jl    .loop
49     RET
50
51 ;*******************************************************************
52 ;void ff_aac_quantize_bands(int *out, const float *in, const float *scaled,
53 ;                           int size, int is_signed, int maxval, const float Q34,
54 ;                           const float rounding)
55 ;*******************************************************************
56 INIT_XMM sse2
57 cglobal aac_quantize_bands, 5, 5, 6, out, in, scaled, size, is_signed, maxval, Q34, rounding
58 %if UNIX64 == 0
59     movss     m0, Q34m
60     movss     m1, roundingm
61     cvtsi2ss  m3, dword maxvalm
62 %else
63     cvtsi2ss  m3, maxvald
64 %endif
65     shufps    m0, m0, 0
66     shufps    m1, m1, 0
67     shufps    m3, m3, 0
68     shl       is_signedd, 31
69     movd      m4, is_signedd
70     shufps    m4, m4, 0
71     shl       sized,   2
72     add       inq, sizeq
73     add       outq, sizeq
74     add       scaledq, sizeq
75     neg       sizeq
76 .loop:
77     mulps     m2, m0, [scaledq+sizeq]
78     addps     m2, m1
79     minps     m2, m3
80     andps     m5, m4, [inq+sizeq]
81     orps      m2, m5
82     cvttps2dq m2, m2
83     mova      [outq+sizeq], m2
84     add       sizeq, mmsize
85     jl       .loop
86     RET