2 * Copyright (c) 2013 Seppo Tomperi
3 * Copyright (c) 2013 - 2014 Pierre-Edouard Lepere
5 * This file is part of Libav.
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.
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.
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
24 #include "libavutil/cpu.h"
25 #include "libavutil/x86/cpu.h"
27 #include "libavcodec/hevcdsp.h"
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);
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);
35 #define LFC_FUNCS(type, depth) \
36 LFC_FUNC(h, depth, sse2) \
37 LFC_FUNC(v, depth, sse2)
39 #define LFL_FUNCS(type, depth) \
40 LFL_FUNC(h, depth, ssse3) \
41 LFL_FUNC(v, depth, ssse3)
44 LFC_FUNCS(uint8_t, 10)
46 LFL_FUNCS(uint8_t, 10)
48 void ff_hevc_dsp_init_x86(HEVCDSPContext *c, const int bit_depth)
50 int cpu_flags = av_get_cpu_flags();
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;
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;
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;
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;