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, ptrdiff_t dststride,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, ptrdiff_t src2stride, 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, ptrdiff_t src2stride, 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, ptrdiff_t _src2stride, 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 ///////////////////////////////////////////////////////////////////////////////
99 // EPEL
100 ///////////////////////////////////////////////////////////////////////////////
101 EPEL_PROTOTYPES(epel_h , 8, sse4);
102 EPEL_PROTOTYPES(epel_h , 10, sse4);
103 
104 EPEL_PROTOTYPES(epel_v , 8, sse4);
105 EPEL_PROTOTYPES(epel_v , 10, sse4);
106 
107 EPEL_PROTOTYPES(epel_hv , 8, sse4);
108 EPEL_PROTOTYPES(epel_hv , 10, sse4);
109 
110 ///////////////////////////////////////////////////////////////////////////////
111 // QPEL
112 ///////////////////////////////////////////////////////////////////////////////
113 QPEL_PROTOTYPES(qpel_h , 8, sse4);
114 QPEL_PROTOTYPES(qpel_h , 10, sse4);
115 
116 QPEL_PROTOTYPES(qpel_v, 8, sse4);
117 QPEL_PROTOTYPES(qpel_v, 10, sse4);
118 
119 QPEL_PROTOTYPES(qpel_hv, 8, sse4);
120 QPEL_PROTOTYPES(qpel_hv, 10, sse4);
121 
122 
123 WEIGHTING_PROTOTYPES(8, sse4);
124 WEIGHTING_PROTOTYPES(10, sse4);
125 
126 ///////////////////////////////////////////////////////////////////////////////
127 // IDCT
128 ///////////////////////////////////////////////////////////////////////////////
129 
130 
131 idct_dc_proto(4, 8,mmxext);
132 idct_dc_proto(8, 8,mmxext);
133 idct_dc_proto(16,8, sse2);
134 idct_dc_proto(32,8, sse2);
135 
136 idct_dc_proto(32,8, avx2);
137 
138 
139 idct_dc_proto(4, 10,mmxext);
140 idct_dc_proto(8, 10, sse2);
141 idct_dc_proto(16,10, sse2);
142 idct_dc_proto(32,10, sse2);
143 idct_dc_proto(8, 10, avx);
144 idct_dc_proto(16,10, avx);
145 idct_dc_proto(32,10, avx);
146 
147 idct_dc_proto(16,10, avx2);
148 idct_dc_proto(32,10, avx2);
149 
150 
151 
152 
153 
154 #endif // AVCODEC_X86_HEVCDSP_H