]> git.sesse.net Git - ffmpeg/blob - libavfilter/x86/vf_maskedclamp.asm
avcodec/parser: Remove deprecated av_parser_change
[ffmpeg] / libavfilter / x86 / vf_maskedclamp.asm
1 ;*****************************************************************************
2 ;* x86-optimized functions for maskedclamp filter
3 ;*
4 ;* Copyright (c) 2019 Paul B Mahol
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 .text
26
27 ;------------------------------------------------------------------------------
28 ; void ff_maskedclamp(const uint8_t *src, uint8_t *dst,
29 ;                     const uint8_t *darksrc,
30 ;                     const uint8_t *brightsrc,
31 ;                     int w, int undershoot, int overshoot)
32 ;------------------------------------------------------------------------------
33
34 INIT_XMM sse2
35 cglobal maskedclamp8, 5,5,5, src, dst, dark, bright, w, undershoot, overshoot
36     movsxdifnidn wq, wd
37
38     add        srcq, wq
39     add       darkq, wq
40     add     brightq, wq
41     add        dstq, wq
42     neg          wq
43
44     movd         m3, r5m
45     punpcklbw    m3, m3
46     SPLATW       m3, m3
47
48     movd         m4, r6m
49     punpcklbw    m4, m4
50     SPLATW       m4, m4
51
52     .loop:
53         movu                  m0, [srcq + wq]
54         movu                  m1, [darkq + wq]
55         movu                  m2, [brightq + wq]
56
57         psubusb               m1, m3
58         paddusb               m2, m4
59         CLIPUB                m0, m1, m2
60         mova         [dstq + wq], m0
61
62         add                   wq, mmsize
63         jl .loop
64     RET
65
66 INIT_XMM sse4
67 cglobal maskedclamp16, 5,5,5, src, dst, dark, bright, w, undershoot, overshoot
68     shl          wd, 1
69
70     add        srcq, wq
71     add       darkq, wq
72     add     brightq, wq
73     add        dstq, wq
74     neg          wq
75
76     movd         m3, r5m
77     SPLATW       m3, m3
78
79     movd         m4, r6m
80     SPLATW       m4, m4
81
82     .loop:
83         movu                  m0, [srcq + wq]
84         movu                  m1, [darkq + wq]
85         movu                  m2, [brightq + wq]
86
87         psubusw               m1, m3
88         paddusw               m2, m4
89         pmaxuw                m0, m1
90         pminuw                m0, m2
91         mova         [dstq + wq], m0
92
93         add                   wq, mmsize
94         jl .loop
95     RET