FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
hevcdsp.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_HEVCDSP_H
26 #define AVCODEC_X86_HEVCDSP_H
27 
28 #include <stddef.h>
29 #include <stdint.h>
30 
31 
32 #define idct_dc_proto(size, bitd, opt) \
33  void ff_hevc_idct##size##_dc_add_##bitd##_##opt(uint8_t *dst, int16_t *coeffs, ptrdiff_t stride)
34 
35 #define PEL_LINK(dst, idx1, idx2, idx3, name, D, opt) \
36 dst[idx1][idx2][idx3] = ff_hevc_put_hevc_ ## name ## _ ## D ## _##opt; \
37 dst ## _bi[idx1][idx2][idx3] = ff_hevc_put_hevc_bi_ ## name ## _ ## D ## _##opt; \
38 dst ## _uni[idx1][idx2][idx3] = ff_hevc_put_hevc_uni_ ## name ## _ ## D ## _##opt; \
39 dst ## _uni_w[idx1][idx2][idx3] = ff_hevc_put_hevc_uni_w_ ## name ## _ ## D ## _##opt; \
40 dst ## _bi_w[idx1][idx2][idx3] = ff_hevc_put_hevc_bi_w_ ## name ## _ ## D ## _##opt
41 
42 
43 #define PEL_PROTOTYPE(name, D, opt) \
44 void ff_hevc_put_hevc_ ## name ## _ ## D ## _##opt(int16_t *dst, uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my,int width); \
45 void ff_hevc_put_hevc_bi_ ## name ## _ ## D ## _##opt(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, int16_t *src2, int height, intptr_t mx, intptr_t my, int width); \
46 void ff_hevc_put_hevc_uni_ ## name ## _ ## D ## _##opt(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my, int width); \
47 void ff_hevc_put_hevc_uni_w_ ## name ## _ ## D ## _##opt(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, int height, int denom, int wx, int ox, intptr_t mx, intptr_t my, int width); \
48 void ff_hevc_put_hevc_bi_w_ ## name ## _ ## D ## _##opt(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, int16_t *src2, int height, int denom, int wx0, int wx1, int ox0, int ox1, intptr_t mx, intptr_t my, int width)
49 
50 
51 ///////////////////////////////////////////////////////////////////////////////
52 // MC functions
53 ///////////////////////////////////////////////////////////////////////////////
54 
55 #define EPEL_PROTOTYPES(fname, bitd, opt) \
56  PEL_PROTOTYPE(fname##4, bitd, opt); \
57  PEL_PROTOTYPE(fname##6, bitd, opt); \
58  PEL_PROTOTYPE(fname##8, bitd, opt); \
59  PEL_PROTOTYPE(fname##12, bitd, opt); \
60  PEL_PROTOTYPE(fname##16, bitd, opt); \
61  PEL_PROTOTYPE(fname##24, bitd, opt); \
62  PEL_PROTOTYPE(fname##32, bitd, opt); \
63  PEL_PROTOTYPE(fname##48, bitd, opt); \
64  PEL_PROTOTYPE(fname##64, bitd, opt)
65 
66 #define QPEL_PROTOTYPES(fname, bitd, opt) \
67  PEL_PROTOTYPE(fname##4, bitd, opt); \
68  PEL_PROTOTYPE(fname##8, bitd, opt); \
69  PEL_PROTOTYPE(fname##12, bitd, opt); \
70  PEL_PROTOTYPE(fname##16, bitd, opt); \
71  PEL_PROTOTYPE(fname##24, bitd, opt); \
72  PEL_PROTOTYPE(fname##32, bitd, opt); \
73  PEL_PROTOTYPE(fname##48, bitd, opt); \
74  PEL_PROTOTYPE(fname##64, bitd, opt)
75 
76 #define WEIGHTING_PROTOTYPE(width, bitd, opt) \
77 void ff_hevc_put_hevc_uni_w##width##_##bitd##_##opt(uint8_t *dst, ptrdiff_t dststride, int16_t *_src, ptrdiff_t _srcstride, int height, int denom, int _wx, int _ox); \
78 void ff_hevc_put_hevc_bi_w##width##_##bitd##_##opt(uint8_t *dst, ptrdiff_t dststride, int16_t *_src, ptrdiff_t _srcstride, int16_t *_src2, int height, int denom, int _wx0, int _wx1, int _ox0, int _ox1)
79 
80 #define WEIGHTING_PROTOTYPES(bitd, opt) \
81  WEIGHTING_PROTOTYPE(2, bitd, opt); \
82  WEIGHTING_PROTOTYPE(4, bitd, opt); \
83  WEIGHTING_PROTOTYPE(6, bitd, opt); \
84  WEIGHTING_PROTOTYPE(8, bitd, opt); \
85  WEIGHTING_PROTOTYPE(12, bitd, opt); \
86  WEIGHTING_PROTOTYPE(16, bitd, opt); \
87  WEIGHTING_PROTOTYPE(24, bitd, opt); \
88  WEIGHTING_PROTOTYPE(32, bitd, opt); \
89  WEIGHTING_PROTOTYPE(48, bitd, opt); \
90  WEIGHTING_PROTOTYPE(64, bitd, opt)
91 
92 
93 ///////////////////////////////////////////////////////////////////////////////
94 // QPEL_PIXELS EPEL_PIXELS
95 ///////////////////////////////////////////////////////////////////////////////
96 EPEL_PROTOTYPES(pel_pixels , 8, sse4);
97 EPEL_PROTOTYPES(pel_pixels , 10, sse4);
98 EPEL_PROTOTYPES(pel_pixels , 12, sse4);
99 ///////////////////////////////////////////////////////////////////////////////
100 // EPEL
101 ///////////////////////////////////////////////////////////////////////////////
102 EPEL_PROTOTYPES(epel_h , 8, sse4);
103 EPEL_PROTOTYPES(epel_h , 10, sse4);
104 EPEL_PROTOTYPES(epel_h , 12, sse4);
105 
106 EPEL_PROTOTYPES(epel_v , 8, sse4);
107 EPEL_PROTOTYPES(epel_v , 10, sse4);
108 EPEL_PROTOTYPES(epel_v , 12, sse4);
109 
110 EPEL_PROTOTYPES(epel_hv , 8, sse4);
111 EPEL_PROTOTYPES(epel_hv , 10, sse4);
112 EPEL_PROTOTYPES(epel_hv , 12, sse4);
113 
114 ///////////////////////////////////////////////////////////////////////////////
115 // QPEL
116 ///////////////////////////////////////////////////////////////////////////////
117 QPEL_PROTOTYPES(qpel_h , 8, sse4);
118 QPEL_PROTOTYPES(qpel_h , 10, sse4);
119 QPEL_PROTOTYPES(qpel_h , 12, sse4);
120 
121 QPEL_PROTOTYPES(qpel_v, 8, sse4);
122 QPEL_PROTOTYPES(qpel_v, 10, sse4);
123 QPEL_PROTOTYPES(qpel_v, 12, sse4);
124 
125 QPEL_PROTOTYPES(qpel_hv, 8, sse4);
126 QPEL_PROTOTYPES(qpel_hv, 10, sse4);
127 QPEL_PROTOTYPES(qpel_hv, 12, sse4);
128 
129 
130 WEIGHTING_PROTOTYPES(8, sse4);
131 WEIGHTING_PROTOTYPES(10, sse4);
132 WEIGHTING_PROTOTYPES(12, sse4);
133 
134 ///////////////////////////////////////////////////////////////////////////////
135 // TRANSFORM_ADD
136 ///////////////////////////////////////////////////////////////////////////////
137 void ff_hevc_transform_add4_8_mmxext(uint8_t *dst, int16_t *coeffs, ptrdiff_t stride);
138 void ff_hevc_transform_add8_8_sse2(uint8_t *dst, int16_t *coeffs, ptrdiff_t stride);
139 void ff_hevc_transform_add16_8_sse2(uint8_t *dst, int16_t *coeffs, ptrdiff_t stride);
140 void ff_hevc_transform_add32_8_sse2(uint8_t *dst, int16_t *coeffs, ptrdiff_t stride);
141 
142 void ff_hevc_transform_add8_8_avx(uint8_t *dst, int16_t *coeffs, ptrdiff_t stride);
143 void ff_hevc_transform_add16_8_avx(uint8_t *dst, int16_t *coeffs, ptrdiff_t stride);
144 void ff_hevc_transform_add32_8_avx(uint8_t *dst, int16_t *coeffs, ptrdiff_t stride);
145 
146 void ff_hevc_transform_add32_8_avx2(uint8_t *dst, int16_t *coeffs, ptrdiff_t stride);
147 
148 void ff_hevc_transform_add4_10_mmxext(uint8_t *dst, int16_t *coeffs, ptrdiff_t stride);
149 void ff_hevc_transform_add8_10_sse2(uint8_t *dst, int16_t *coeffs, ptrdiff_t stride);
150 void ff_hevc_transform_add16_10_sse2(uint8_t *dst, int16_t *coeffs, ptrdiff_t stride);
151 void ff_hevc_transform_add32_10_sse2(uint8_t *dst, int16_t *coeffs, ptrdiff_t stride);
152 
153 void ff_hevc_transform_add16_10_avx2(uint8_t *dst, int16_t *coeffs, ptrdiff_t stride);
154 void ff_hevc_transform_add32_10_avx2(uint8_t *dst, int16_t *coeffs, ptrdiff_t stride);
155 
156 #endif // AVCODEC_X86_HEVCDSP_H