FFmpeg
Loading...
Searching...
No Matches
h2656dsp.c
Go to the documentation of this file.
1/*
2 * DSP for HEVC/VVC
3 *
4 * Copyright (C) 2022-2024 Nuo Mi
5 * Copyright (c) 2023-2024 Wu Jianhua
6 *
7 * This file is part of FFmpeg.
8 *
9 * FFmpeg is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
13 *
14 * FFmpeg is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with FFmpeg; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 */
23
24#include "config.h"
25
26#include "h2656dsp.h"
27
28#define mc_rep_func(name, bitd, step, W, opt) \
29void ff_h2656_put_##name##W##_##bitd##_##opt(int16_t *_dst, ptrdiff_t dststride, \
30 const uint8_t *_src, ptrdiff_t _srcstride, int height, const int8_t *hf, const int8_t *vf, int width) \
31{ \
32 int i; \
33 int16_t *dst; \
34 for (i = 0; i < W; i += step) { \
35 const uint8_t *src = _src + (i * ((bitd + 7) / 8)); \
36 dst = _dst + i; \
37 ff_h2656_put_##name##step##_##bitd##_##opt(dst, dststride, src, _srcstride, height, hf, vf, width); \
38 } \
39}
40
41#define mc_rep_uni_func(name, bitd, step, W, opt) \
42void ff_h2656_put_uni_##name##W##_##bitd##_##opt(uint8_t *_dst, ptrdiff_t dststride, \
43 const uint8_t *_src, ptrdiff_t _srcstride, int height, const int8_t *hf, const int8_t *vf, int width) \
44{ \
45 int i; \
46 uint8_t *dst; \
47 for (i = 0; i < W; i += step) { \
48 const uint8_t *src = _src + (i * ((bitd + 7) / 8)); \
49 dst = _dst + (i * ((bitd + 7) / 8)); \
50 ff_h2656_put_uni_##name##step##_##bitd##_##opt(dst, dststride, src, _srcstride, \
51 height, hf, vf, width); \
52 } \
53}
54
55#define mc_rep_funcs(name, bitd, step, W, opt) \
56 mc_rep_func(name, bitd, step, W, opt) \
57 mc_rep_uni_func(name, bitd, step, W, opt)
58
59#define MC_REP_FUNCS_SSE4(fname) \
60 mc_rep_funcs(fname, 8, 16,128, sse4) \
61 mc_rep_funcs(fname, 8, 16, 64, sse4) \
62 mc_rep_funcs(fname, 8, 16, 32, sse4) \
63 mc_rep_funcs(fname, 10, 8,128, sse4) \
64 mc_rep_funcs(fname, 10, 8, 64, sse4) \
65 mc_rep_funcs(fname, 10, 8, 32, sse4) \
66 mc_rep_funcs(fname, 10, 8, 16, sse4) \
67 mc_rep_funcs(fname, 12, 8,128, sse4) \
68 mc_rep_funcs(fname, 12, 8, 64, sse4) \
69 mc_rep_funcs(fname, 12, 8, 32, sse4) \
70 mc_rep_funcs(fname, 12, 8, 16, sse4) \
71
72#if ARCH_X86_64 && HAVE_SSE4_EXTERNAL
73
77MC_REP_FUNCS_SSE4(4tap_hv)
80MC_REP_FUNCS_SSE4(8tap_hv)
81mc_rep_funcs(8tap_hv, 8, 8, 16, sse4)
82
83#if HAVE_AVX2_EXTERNAL
84
85#define MC_REP_FUNCS_AVX2_NO8(fname) \
86 mc_rep_funcs(fname,10, 16, 32, avx2) \
87 mc_rep_funcs(fname,10, 16, 64, avx2) \
88 mc_rep_funcs(fname,10, 16,128, avx2) \
89 mc_rep_funcs(fname,12, 16, 32, avx2) \
90 mc_rep_funcs(fname,12, 16, 64, avx2) \
91 mc_rep_funcs(fname,12, 16,128, avx2) \
92
93#define MC_REP_FUNCS_AVX2(fname) \
94 mc_rep_funcs(fname, 8, 32, 64, avx2) \
95 mc_rep_funcs(fname, 8, 32,128, avx2) \
96 MC_REP_FUNCS_AVX2_NO8(fname)
97
98MC_REP_FUNCS_AVX2(pixels)
99MC_REP_FUNCS_AVX2(8tap_h)
100MC_REP_FUNCS_AVX2(8tap_v)
101MC_REP_FUNCS_AVX2_NO8(8tap_hv)
102MC_REP_FUNCS_AVX2(4tap_h)
103MC_REP_FUNCS_AVX2(4tap_v)
104MC_REP_FUNCS_AVX2_NO8(4tap_hv)
105#endif
106#endif
#define MC_REP_FUNCS_SSE4(fname)
Definition h2656dsp.c:59
#define mc_rep_funcs(name, bitd, step, W, opt)
Definition h2656dsp.c:55