]> git.sesse.net Git - ffmpeg/blob - libavcodec/x86/hevcdsp_init.c
04203c22a04f563236791ec1a126a247e44156ea
[ffmpeg] / libavcodec / x86 / hevcdsp_init.c
1 /*
2  * Copyright (c) 2013 Seppo Tomperi
3  * Copyright (c) 2013 - 2014 Pierre-Edouard Lepere
4  *
5  * This file is part of Libav.
6  *
7  * Libav is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * Libav is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with Libav; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21
22 #include "config.h"
23
24 #include "libavutil/cpu.h"
25 #include "libavutil/x86/cpu.h"
26
27 #include "libavcodec/hevcdsp.h"
28
29 #define LFC_FUNC(DIR, DEPTH, OPT) \
30 void ff_hevc_ ## DIR ## _loop_filter_chroma_ ## DEPTH ## _ ## OPT(uint8_t *pix, ptrdiff_t stride, int *tc, uint8_t *no_p, uint8_t *no_q);
31
32 #define LFL_FUNC(DIR, DEPTH, OPT) \
33 void ff_hevc_ ## DIR ## _loop_filter_luma_ ## DEPTH ## _ ## OPT(uint8_t *pix, ptrdiff_t stride, int beta, int *tc, uint8_t *no_p, uint8_t *no_q);
34
35 #define LFC_FUNCS(type, depth) \
36     LFC_FUNC(h, depth, sse2)   \
37     LFC_FUNC(v, depth, sse2)
38
39 #define LFL_FUNCS(type, depth) \
40     LFL_FUNC(h, depth, ssse3)  \
41     LFL_FUNC(v, depth, ssse3)
42
43 LFC_FUNCS(uint8_t, 8)
44 LFC_FUNCS(uint8_t, 10)
45 LFL_FUNCS(uint8_t, 8)
46 LFL_FUNCS(uint8_t, 10)
47
48 void ff_hevc_dsp_init_x86(HEVCDSPContext *c, const int bit_depth)
49 {
50     int cpu_flags = av_get_cpu_flags();
51
52     if (bit_depth == 8) {
53         if (EXTERNAL_SSE2(cpu_flags)) {
54             c->hevc_v_loop_filter_chroma = ff_hevc_v_loop_filter_chroma_8_sse2;
55             c->hevc_h_loop_filter_chroma = ff_hevc_h_loop_filter_chroma_8_sse2;
56         }
57         if (EXTERNAL_SSSE3(cpu_flags) && ARCH_X86_64) {
58             c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_8_ssse3;
59             c->hevc_h_loop_filter_luma = ff_hevc_h_loop_filter_luma_8_ssse3;
60         }
61     } else if (bit_depth == 10) {
62         if (EXTERNAL_SSE2(cpu_flags)) {
63             c->hevc_v_loop_filter_chroma = ff_hevc_v_loop_filter_chroma_10_sse2;
64             c->hevc_h_loop_filter_chroma = ff_hevc_h_loop_filter_chroma_10_sse2;
65         }
66         if (EXTERNAL_SSSE3(cpu_flags) && ARCH_X86_64) {
67             c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_10_ssse3;
68             c->hevc_h_loop_filter_luma = ff_hevc_h_loop_filter_luma_10_ssse3;
69         }
70     }
71 }