FFmpeg
dsp.h
Go to the documentation of this file.
1 /*
2  * HEVC video decoder
3  *
4  * Copyright (C) 2012 - 2013 Guillaume Martres
5  * Copyright (C) 2013 - 2014 Pierre-Edouard Lepere
6  *
7  *
8  * This file is part of FFmpeg.
9  *
10  * FFmpeg is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public
12  * License as published by the Free Software Foundation; either
13  * version 2.1 of the License, or (at your option) any later version.
14  *
15  * FFmpeg is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  * Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public
21  * License along with FFmpeg; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23  */
24 
25 #ifndef AVCODEC_X86_HEVC_DSP_H
26 #define AVCODEC_X86_HEVC_DSP_H
27 
28 #include <stddef.h>
29 #include <stdint.h>
30 
31 typedef void bi_pel_func(uint8_t *_dst, ptrdiff_t _dststride,
32  const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2,
33  int height, intptr_t mx, intptr_t my, int width);
34 
35 #define BI_PEL_PROTOTYPE(name, W, D, opt) \
36 bi_pel_func ff_hevc_put_bi_ ## name ## W ## _ ## D ## _##opt
37 
38 ///////////////////////////////////////////////////////////////////////////////
39 // MC functions
40 ///////////////////////////////////////////////////////////////////////////////
41 
42 #define WEIGHTING_PROTOTYPE(width, bitd, opt) \
43 void ff_hevc_put_uni_w##width##_##bitd##_##opt(uint8_t *dst, ptrdiff_t dststride, const int16_t *_src, int height, int denom, int _wx, int _ox); \
44 void ff_hevc_put_bi_w##width##_##bitd##_##opt(uint8_t *dst, ptrdiff_t dststride, const int16_t *_src, const int16_t *_src2, int height, int denom, int _wx0, int _wx1, int _ox0, int _ox1)
45 
46 #define WEIGHTING_PROTOTYPES(bitd, opt) \
47  WEIGHTING_PROTOTYPE(4, bitd, opt); \
48  WEIGHTING_PROTOTYPE(6, bitd, opt); \
49  WEIGHTING_PROTOTYPE(8, bitd, opt); \
50  WEIGHTING_PROTOTYPE(12, bitd, opt); \
51  WEIGHTING_PROTOTYPE(16, bitd, opt); \
52  WEIGHTING_PROTOTYPE(24, bitd, opt); \
53  WEIGHTING_PROTOTYPE(32, bitd, opt); \
54  WEIGHTING_PROTOTYPE(48, bitd, opt); \
55  WEIGHTING_PROTOTYPE(64, bitd, opt)
56 
57 
58 ///////////////////////////////////////////////////////////////////////////////
59 // EPEL_PIXELS
60 ///////////////////////////////////////////////////////////////////////////////
61 
62 BI_PEL_PROTOTYPE(pel_pixels, 4, 8, sse4);
63 BI_PEL_PROTOTYPE(pel_pixels, 4, 10, sse4);
64 BI_PEL_PROTOTYPE(pel_pixels, 4, 12, sse4);
65 BI_PEL_PROTOTYPE(pel_pixels, 6, 8, sse4);
66 BI_PEL_PROTOTYPE(pel_pixels, 6, 10, sse4);
67 BI_PEL_PROTOTYPE(pel_pixels, 6, 12, sse4);
68 BI_PEL_PROTOTYPE(pel_pixels, 8, 8, sse4);
69 BI_PEL_PROTOTYPE(pel_pixels, 8, 10, sse4);
70 BI_PEL_PROTOTYPE(pel_pixels, 8, 12, sse4);
71 BI_PEL_PROTOTYPE(pel_pixels, 12, 8, sse4);
72 BI_PEL_PROTOTYPE(pel_pixels, 16, 8, sse4);
73 BI_PEL_PROTOTYPE(pel_pixels, 16, 10, avx2);
74 BI_PEL_PROTOTYPE(pel_pixels, 32, 8, avx2);
75 
76 ///////////////////////////////////////////////////////////////////////////////
77 // EPEL
78 ///////////////////////////////////////////////////////////////////////////////
79 
80 BI_PEL_PROTOTYPE(epel_h, 4, 8, sse4);
81 BI_PEL_PROTOTYPE(epel_h, 4, 10, sse4);
82 BI_PEL_PROTOTYPE(epel_h, 4, 12, sse4);
83 BI_PEL_PROTOTYPE(epel_h, 6, 8, sse4);
84 BI_PEL_PROTOTYPE(epel_h, 6, 10, sse4);
85 BI_PEL_PROTOTYPE(epel_h, 6, 12, sse4);
86 BI_PEL_PROTOTYPE(epel_h, 8, 8, sse4);
87 BI_PEL_PROTOTYPE(epel_h, 8, 10, sse4);
88 BI_PEL_PROTOTYPE(epel_h, 8, 12, sse4);
89 BI_PEL_PROTOTYPE(epel_h, 12, 8, sse4);
90 BI_PEL_PROTOTYPE(epel_h, 16, 8, sse4);
91 BI_PEL_PROTOTYPE(epel_h, 16, 10, avx2);
92 BI_PEL_PROTOTYPE(epel_h, 32, 8, avx2);
93 
94 BI_PEL_PROTOTYPE(epel_hv, 4, 8, sse4);
95 BI_PEL_PROTOTYPE(epel_hv, 4, 10, sse4);
96 BI_PEL_PROTOTYPE(epel_hv, 4, 12, sse4);
97 BI_PEL_PROTOTYPE(epel_hv, 6, 8, sse4);
98 BI_PEL_PROTOTYPE(epel_hv, 6, 10, sse4);
99 BI_PEL_PROTOTYPE(epel_hv, 6, 12, sse4);
100 BI_PEL_PROTOTYPE(epel_hv, 8, 8, sse4);
101 BI_PEL_PROTOTYPE(epel_hv, 8, 10, sse4);
102 BI_PEL_PROTOTYPE(epel_hv, 8, 12, sse4);
103 BI_PEL_PROTOTYPE(epel_hv, 16, 8, sse4);
104 BI_PEL_PROTOTYPE(epel_hv, 16, 10, avx2);
105 BI_PEL_PROTOTYPE(epel_hv, 32, 8, avx2);
106 
107 BI_PEL_PROTOTYPE(epel_v, 4, 8, sse4);
108 BI_PEL_PROTOTYPE(epel_v, 4, 10, sse4);
109 BI_PEL_PROTOTYPE(epel_v, 4, 12, sse4);
110 BI_PEL_PROTOTYPE(epel_v, 6, 8, sse4);
111 BI_PEL_PROTOTYPE(epel_v, 6, 10, sse4);
112 BI_PEL_PROTOTYPE(epel_v, 6, 12, sse4);
113 BI_PEL_PROTOTYPE(epel_v, 8, 8, sse4);
114 BI_PEL_PROTOTYPE(epel_v, 8, 10, sse4);
115 BI_PEL_PROTOTYPE(epel_v, 8, 12, sse4);
116 BI_PEL_PROTOTYPE(epel_v, 12, 8, sse4);
117 BI_PEL_PROTOTYPE(epel_v, 16, 8, sse4);
118 BI_PEL_PROTOTYPE(epel_v, 16, 10, avx2);
119 BI_PEL_PROTOTYPE(epel_v, 32, 8, avx2);
120 
121 ///////////////////////////////////////////////////////////////////////////////
122 // QPEL
123 ///////////////////////////////////////////////////////////////////////////////
124 
125 BI_PEL_PROTOTYPE(qpel_h, 4, 8, sse4);
126 BI_PEL_PROTOTYPE(qpel_h, 4, 10, sse4);
127 BI_PEL_PROTOTYPE(qpel_h, 4, 12, sse4);
128 BI_PEL_PROTOTYPE(qpel_h, 8, 8, sse4);
129 BI_PEL_PROTOTYPE(qpel_h, 8, 10, sse4);
130 BI_PEL_PROTOTYPE(qpel_h, 8, 12, sse4);
131 BI_PEL_PROTOTYPE(qpel_h, 12, 8, sse4);
132 BI_PEL_PROTOTYPE(qpel_h, 16, 8, sse4);
133 BI_PEL_PROTOTYPE(qpel_h, 16, 10, avx2);
134 BI_PEL_PROTOTYPE(qpel_h, 32, 8, avx2);
135 
136 BI_PEL_PROTOTYPE(qpel_hv, 4, 8, sse4);
137 BI_PEL_PROTOTYPE(qpel_hv, 4, 10, sse4);
138 BI_PEL_PROTOTYPE(qpel_hv, 4, 12, sse4);
139 BI_PEL_PROTOTYPE(qpel_hv, 8, 8, sse4);
140 BI_PEL_PROTOTYPE(qpel_hv, 8, 10, sse4);
141 BI_PEL_PROTOTYPE(qpel_hv, 8, 12, sse4);
142 BI_PEL_PROTOTYPE(qpel_hv, 16, 10, avx2);
143 
144 BI_PEL_PROTOTYPE(qpel_v, 4, 8, sse4);
145 BI_PEL_PROTOTYPE(qpel_v, 4, 10, sse4);
146 BI_PEL_PROTOTYPE(qpel_v, 4, 12, sse4);
147 BI_PEL_PROTOTYPE(qpel_v, 8, 8, sse4);
148 BI_PEL_PROTOTYPE(qpel_v, 8, 10, sse4);
149 BI_PEL_PROTOTYPE(qpel_v, 8, 12, sse4);
150 BI_PEL_PROTOTYPE(qpel_v, 12, 8, sse4);
151 BI_PEL_PROTOTYPE(qpel_v, 16, 8, sse4);
152 BI_PEL_PROTOTYPE(qpel_v, 16, 10, avx2);
153 BI_PEL_PROTOTYPE(qpel_v, 32, 8, avx2);
154 
155 WEIGHTING_PROTOTYPES(8, sse4);
156 WEIGHTING_PROTOTYPES(10, sse4);
157 WEIGHTING_PROTOTYPES(12, sse4);
158 
159 void ff_hevc_put_qpel_h4_8_avx512icl(int16_t *dst, const uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my, int width);
160 void ff_hevc_put_qpel_h8_8_avx512icl(int16_t *dst, const uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my, int width);
161 void ff_hevc_put_qpel_h16_8_avx512icl(int16_t *dst, const uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my, int width);
162 void ff_hevc_put_qpel_h32_8_avx512icl(int16_t *dst, const uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my, int width);
163 void ff_hevc_put_qpel_h64_8_avx512icl(int16_t *dst, const uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my, int width);
164 void ff_hevc_put_qpel_hv8_8_avx512icl(int16_t *dst, const uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my, int width);
165 
166 ///////////////////////////////////////////////////////////////////////////////
167 // TRANSFORM_ADD
168 ///////////////////////////////////////////////////////////////////////////////
169 
170 void ff_hevc_add_residual_4_8_mmxext(uint8_t *dst, const int16_t *res, ptrdiff_t stride);
171 void ff_hevc_add_residual_8_8_sse2(uint8_t *dst, const int16_t *res, ptrdiff_t stride);
172 void ff_hevc_add_residual_16_8_sse2(uint8_t *dst, const int16_t *res, ptrdiff_t stride);
173 void ff_hevc_add_residual_32_8_sse2(uint8_t *dst, const int16_t *res, ptrdiff_t stride);
174 
175 void ff_hevc_add_residual_8_8_avx(uint8_t *dst, const int16_t *res, ptrdiff_t stride);
176 void ff_hevc_add_residual_16_8_avx(uint8_t *dst, const int16_t *res, ptrdiff_t stride);
177 void ff_hevc_add_residual_32_8_avx(uint8_t *dst, const int16_t *res, ptrdiff_t stride);
178 
179 void ff_hevc_add_residual_32_8_avx2(uint8_t *dst, const int16_t *res, ptrdiff_t stride);
180 
181 void ff_hevc_add_residual_4_10_mmxext(uint8_t *dst, const int16_t *res, ptrdiff_t stride);
182 void ff_hevc_add_residual_8_10_sse2(uint8_t *dst, const int16_t *res, ptrdiff_t stride);
183 void ff_hevc_add_residual_16_10_sse2(uint8_t *dst, const int16_t *res, ptrdiff_t stride);
184 void ff_hevc_add_residual_32_10_sse2(uint8_t *dst, const int16_t *res, ptrdiff_t stride);
185 
186 void ff_hevc_add_residual_16_10_avx2(uint8_t *dst, const int16_t *res, ptrdiff_t stride);
187 void ff_hevc_add_residual_32_10_avx2(uint8_t *dst, const int16_t *res, ptrdiff_t stride);
188 
189 #endif // AVCODEC_X86_HEVC_DSP_H
_dst
uint8_t * _dst
Definition: dsp.h:52
ff_hevc_add_residual_4_10_mmxext
void ff_hevc_add_residual_4_10_mmxext(uint8_t *dst, const int16_t *res, ptrdiff_t stride)
ff_hevc_put_qpel_h8_8_avx512icl
void ff_hevc_put_qpel_h8_8_avx512icl(int16_t *dst, const uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my, int width)
height
uint8_t ptrdiff_t const uint8_t ptrdiff_t int height
Definition: dsp.h:53
_src
uint8_t ptrdiff_t const uint8_t * _src
Definition: dsp.h:52
mx
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t mx
Definition: dsp.h:53
ff_hevc_add_residual_32_8_avx
void ff_hevc_add_residual_32_8_avx(uint8_t *dst, const int16_t *res, ptrdiff_t stride)
WEIGHTING_PROTOTYPES
#define WEIGHTING_PROTOTYPES(bitd, opt)
Definition: dsp.h:46
ff_hevc_put_qpel_h32_8_avx512icl
void ff_hevc_put_qpel_h32_8_avx512icl(int16_t *dst, const uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my, int width)
_srcstride
uint8_t ptrdiff_t const uint8_t ptrdiff_t _srcstride
Definition: dsp.h:53
bi_pel_func
void bi_pel_func(uint8_t *_dst, ptrdiff_t _dststride, const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2, int height, intptr_t mx, intptr_t my, int width)
Definition: dsp.h:31
ff_hevc_add_residual_16_10_sse2
void ff_hevc_add_residual_16_10_sse2(uint8_t *dst, const int16_t *res, ptrdiff_t stride)
ff_hevc_add_residual_32_10_sse2
void ff_hevc_add_residual_32_10_sse2(uint8_t *dst, const int16_t *res, ptrdiff_t stride)
my
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t my
Definition: dsp.h:53
ff_hevc_add_residual_8_8_sse2
void ff_hevc_add_residual_8_8_sse2(uint8_t *dst, const int16_t *res, ptrdiff_t stride)
ff_hevc_add_residual_8_10_sse2
void ff_hevc_add_residual_8_10_sse2(uint8_t *dst, const int16_t *res, ptrdiff_t stride)
width
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int width
Definition: dsp.h:53
_dststride
uint8_t ptrdiff_t _dststride
Definition: dsp.h:52
ff_hevc_add_residual_16_10_avx2
void ff_hevc_add_residual_16_10_avx2(uint8_t *dst, const int16_t *res, ptrdiff_t stride)
ff_hevc_put_qpel_h64_8_avx512icl
void ff_hevc_put_qpel_h64_8_avx512icl(int16_t *dst, const uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my, int width)
ff_hevc_add_residual_4_8_mmxext
void ff_hevc_add_residual_4_8_mmxext(uint8_t *dst, const int16_t *res, ptrdiff_t stride)
ff_hevc_add_residual_32_10_avx2
void ff_hevc_add_residual_32_10_avx2(uint8_t *dst, const int16_t *res, ptrdiff_t stride)
ff_hevc_add_residual_8_8_avx
void ff_hevc_add_residual_8_8_avx(uint8_t *dst, const int16_t *res, ptrdiff_t stride)
dst
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition: dsp.h:83
ff_hevc_add_residual_32_8_sse2
void ff_hevc_add_residual_32_8_sse2(uint8_t *dst, const int16_t *res, ptrdiff_t stride)
ff_hevc_add_residual_16_8_sse2
void ff_hevc_add_residual_16_8_sse2(uint8_t *dst, const int16_t *res, ptrdiff_t stride)
BI_PEL_PROTOTYPE
#define BI_PEL_PROTOTYPE(name, W, D, opt)
Definition: dsp.h:35
src2
const pixel * src2
Definition: h264pred_template.c:421
ff_hevc_add_residual_32_8_avx2
void ff_hevc_add_residual_32_8_avx2(uint8_t *dst, const int16_t *res, ptrdiff_t stride)
ff_hevc_put_qpel_h4_8_avx512icl
void ff_hevc_put_qpel_h4_8_avx512icl(int16_t *dst, const uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my, int width)
stride
#define stride
Definition: h264pred_template.c:536
ff_hevc_put_qpel_h16_8_avx512icl
void ff_hevc_put_qpel_h16_8_avx512icl(int16_t *dst, const uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my, int width)
ff_hevc_put_qpel_hv8_8_avx512icl
void ff_hevc_put_qpel_hv8_8_avx512icl(int16_t *dst, const uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my, int width)
ff_hevc_add_residual_16_8_avx
void ff_hevc_add_residual_16_8_avx(uint8_t *dst, const int16_t *res, ptrdiff_t stride)