]> git.sesse.net Git - ffmpeg/blob - libavfilter/x86/vf_framerate.asm
avformat/mov, movenc: Stop exporting rotation via metadata
[ffmpeg] / libavfilter / x86 / vf_framerate.asm
1 ;*****************************************************************************
2 ;* x86-optimized functions for framerate filter
3 ;*
4 ;* Copyright (C) 2018 Marton Balint
5 ;*
6 ;* Based on vf_blend.asm, Copyright (C) 2015 Paul B Mahol
7 ;*
8 ;* This file is part of FFmpeg.
9 ;*
10 ;* FFmpeg is free software; you can redistribute it and/or
11 ;* modify it under the terms of the GNU Lesser General Public
12 ;* License as published by the Free Software Foundation; either
13 ;* version 2.1 of the License, or (at your option) any later version.
14 ;*
15 ;* FFmpeg is distributed in the hope that it will be useful,
16 ;* but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18 ;* Lesser General Public License for more details.
19 ;*
20 ;* You should have received a copy of the GNU Lesser General Public
21 ;* License along with FFmpeg; if not, write to the Free Software
22 ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 ;******************************************************************************
24
25 %include "libavutil/x86/x86util.asm"
26
27 SECTION .text
28
29
30 %macro XSPLAT 3
31 %if cpuflag(avx2)
32     vpbroadcast%3  %1, %2
33 %else
34     movd           %1, %2
35 %ifidn %3, d
36     SPLATD         %1
37 %else
38     SPLATW         %1, %1
39 %endif
40 %endif
41 %endmacro
42
43
44 %macro BLEND_INIT 0-1
45 %if ARCH_X86_64
46 cglobal blend_frames%1, 6, 9, 5, src1, src1_linesize, src2, src2_linesize, dst, dst_linesize, width, end, x
47     mov    widthd, dword widthm
48 %else
49 cglobal blend_frames%1, 5, 7, 5, src1, src1_linesize, src2, src2_linesize, dst, end, x
50 %define dst_linesizeq r5mp
51 %define widthq r6mp
52 %endif
53     mov      endd, dword r7m
54     add     src1q, widthq
55     add     src2q, widthq
56     add      dstq, widthq
57     neg    widthq
58 %endmacro
59
60
61 %macro BLEND_LOOP 4
62 .nextrow:
63     mov        xq, widthq
64
65     .loop:
66         movu            m0, [src1q + xq]
67         movu            m1, [src2q + xq]
68         SBUTTERFLY    %1%2, 0, 1, 4         ; aAbBcCdD
69                                             ; eEfFgGhH
70         pmadd%3         m0, m2
71         pmadd%3         m1, m2
72
73         padd%2          m0, m3
74         padd%2          m1, m3
75         psrl%2          m0, %4              ; 0A0B0C0D
76         psrl%2          m1, %4              ; 0E0F0G0H
77
78         packus%2%1      m0, m1              ; ABCDEFGH
79         movu   [dstq + xq], m0
80         add             xq, mmsize
81     jl .loop
82     add     src1q, src1_linesizeq
83     add     src2q, src2_linesizeq
84     add      dstq, dst_linesizeq
85     sub      endd, 1
86     jg .nextrow
87 REP_RET
88 %endmacro
89
90
91 %macro BLEND_FRAMES 0
92     BLEND_INIT
93
94     XSPLAT     m2, r8m, w                   ; factor1
95     XSPLAT     m3, r9m, w                   ; factor2
96
97     psllw      m3, 8
98     por        m2, m3                       ; interleaved factors
99
100     XSPLAT     m3, r10m, w                  ; half
101
102     BLEND_LOOP  b, w, ubsw, 7
103 %endmacro
104
105
106 %macro BLEND_FRAMES16 0
107     BLEND_INIT 16
108
109     XSPLAT     m2, r8m, d                   ; factor1
110     XSPLAT     m3, r9m, d                   ; factor2
111
112     pslld      m3, 16
113     por        m2, m3                       ; interleaved factors
114
115     XSPLAT     m3, r10m, d                  ; half
116
117     BLEND_LOOP  w, d, wd, 15
118 %endmacro
119
120
121 INIT_XMM ssse3
122 BLEND_FRAMES
123
124 INIT_XMM sse4
125 BLEND_FRAMES16
126
127
128 %if HAVE_AVX2_EXTERNAL
129
130 INIT_YMM avx2
131 BLEND_FRAMES
132 BLEND_FRAMES16
133
134 %endif