]> git.sesse.net Git - ffmpeg/blob - libavfilter/x86/vf_yadif_init.c
vf_yadif: fix out-of line reads
[ffmpeg] / libavfilter / x86 / vf_yadif_init.c
1 /*
2  * Copyright (C) 2006 Michael Niedermayer <michaelni@gmx.at>
3  *
4  * This file is part of Libav.
5  *
6  * Libav is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * Libav is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with Libav; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19  */
20
21 #include "libavutil/attributes.h"
22 #include "libavutil/cpu.h"
23 #include "libavutil/internal.h"
24 #include "libavutil/mem.h"
25 #include "libavutil/x86/asm.h"
26 #include "libavutil/x86/cpu.h"
27 #include "libavcodec/x86/dsputil_mmx.h"
28 #include "libavfilter/yadif.h"
29
30 void ff_yadif_filter_line_mmxext(void *dst, void *prev, void *cur,
31                                  void *next, int w, int prefs,
32                                  int mrefs, int parity, int mode);
33 void ff_yadif_filter_line_sse2(void *dst, void *prev, void *cur,
34                                void *next, int w, int prefs,
35                                int mrefs, int parity, int mode);
36 void ff_yadif_filter_line_ssse3(void *dst, void *prev, void *cur,
37                                 void *next, int w, int prefs,
38                                 int mrefs, int parity, int mode);
39
40 av_cold void ff_yadif_init_x86(YADIFContext *yadif)
41 {
42     int cpu_flags = av_get_cpu_flags();
43
44 #if HAVE_YASM
45 #if ARCH_X86_32
46     if (EXTERNAL_MMXEXT(cpu_flags)) {
47         yadif->filter_line = ff_yadif_filter_line_mmxext;
48         yadif->req_align   = 8;
49     }
50 #endif /* ARCH_X86_32 */
51     if (EXTERNAL_SSE2(cpu_flags)) {
52         yadif->filter_line = ff_yadif_filter_line_sse2;
53         yadif->req_align   = 16;
54     }
55     if (EXTERNAL_SSSE3(cpu_flags)) {
56         yadif->filter_line = ff_yadif_filter_line_ssse3;
57         yadif->req_align   = 16;
58     }
59 #endif /* HAVE_YASM */
60 }