]> git.sesse.net Git - ffmpeg/blob - libavfilter/x86/vf_eq.asm
avformat: Remove deprecated av_demuxer_open()
[ffmpeg] / libavfilter / x86 / vf_eq.asm
1 ;*****************************************************************************
2 ;* x86-optimized functions for eq filter
3 ;*
4 ;* Original MPlayer filters by Richard Felker.
5 ;*
6 ;* This file is part of FFmpeg.
7 ;*
8 ;* FFmpeg is free software; you can redistribute it and/or modify
9 ;* it under the terms of the GNU General Public License as published by
10 ;* the Free Software Foundation; either version 2 of the License, or
11 ;* (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
16 ;* GNU General Public License for more details.
17 ;*
18 ;* You should have received a copy of the GNU General Public License along
19 ;* with FFmpeg; if not, write to the Free Software Foundation, Inc.,
20 ;* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 ;*****************************************************************************
22
23 %include "libavutil/x86/x86util.asm"
24
25 SECTION .text
26
27 %macro PROCESS_ONE_LINE 1
28 cglobal process_one_line, 5, 7, 5, src, dst, contrast, brightness, w
29     movd m3, contrastd
30     movd m4, brightnessd
31     movsx r5d, contrastw
32     movsx r6d, brightnessw
33     SPLATW m3, m3, 0
34     SPLATW m4, m4, 0
35
36     DEFINE_ARGS src, dst, tmp, scalar, w
37     xor tmpd, tmpd
38     pxor m0, m0
39     pxor m1, m1
40     mov scalard, wd
41     and scalard, mmsize-1
42     sar wd, %1
43     cmp wd, 1
44     jl .loop1
45
46     .loop0:
47         movu m1, [srcq]
48         mova m2, m1
49         punpcklbw m1, m0
50         punpckhbw m2, m0
51         psllw m1, 4
52         psllw m2, 4
53         pmulhw m1, m3
54         pmulhw m2, m3
55         paddw m1, m4
56         paddw m2, m4
57         packuswb m1, m2
58         movu [dstq], m1
59         add srcq, mmsize
60         add dstq, mmsize
61         sub wd, 1
62         cmp wd, 0
63         jne .loop0
64
65     .loop1:
66         cmp scalard, 0
67         je .end
68         movzx tmpd, byte [srcq]
69         imul tmpd, r5d
70         sar tmpd, 12
71         add tmpd, r6d
72         movd m1, tmpd
73         packuswb m1, m0
74         movd tmpd, m1
75         mov [dstq], tmpb
76         inc srcq
77         inc dstq
78         dec scalard
79         jmp .loop1
80
81     .end:
82         RET
83
84 %endmacro
85
86 INIT_MMX mmxext
87 PROCESS_ONE_LINE 3
88
89 INIT_XMM sse2
90 PROCESS_ONE_LINE 4