8334
|
1 /*
|
|
2 * ARM NEON optimised DSP functions
|
|
3 * Copyright (c) 2008 Mans Rullgard <mans@mansr.com>
|
|
4 *
|
|
5 * This file is part of FFmpeg.
|
|
6 *
|
|
7 * FFmpeg 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.
|
|
11 *
|
|
12 * FFmpeg 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.
|
|
16 *
|
|
17 * You should have received a copy of the GNU Lesser General Public
|
|
18 * License along with FFmpeg; if not, write to the Free Software
|
|
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
20 */
|
|
21
|
|
22 #include <stdint.h>
|
|
23
|
|
24 #include "libavcodec/avcodec.h"
|
|
25 #include "libavcodec/dsputil.h"
|
|
26
|
|
27 void ff_put_pixels16_neon(uint8_t *, const uint8_t *, int, int);
|
|
28 void ff_put_pixels16_x2_neon(uint8_t *, const uint8_t *, int, int);
|
|
29 void ff_put_pixels16_y2_neon(uint8_t *, const uint8_t *, int, int);
|
|
30 void ff_put_pixels16_xy2_neon(uint8_t *, const uint8_t *, int, int);
|
|
31 void ff_put_pixels8_neon(uint8_t *, const uint8_t *, int, int);
|
|
32 void ff_put_pixels8_x2_neon(uint8_t *, const uint8_t *, int, int);
|
|
33 void ff_put_pixels8_y2_neon(uint8_t *, const uint8_t *, int, int);
|
|
34 void ff_put_pixels8_xy2_neon(uint8_t *, const uint8_t *, int, int);
|
|
35 void ff_put_pixels16_x2_no_rnd_neon(uint8_t *, const uint8_t *, int, int);
|
|
36 void ff_put_pixels16_y2_no_rnd_neon(uint8_t *, const uint8_t *, int, int);
|
|
37 void ff_put_pixels16_xy2_no_rnd_neon(uint8_t *, const uint8_t *, int, int);
|
|
38 void ff_put_pixels8_x2_no_rnd_neon(uint8_t *, const uint8_t *, int, int);
|
|
39 void ff_put_pixels8_y2_no_rnd_neon(uint8_t *, const uint8_t *, int, int);
|
|
40 void ff_put_pixels8_xy2_no_rnd_neon(uint8_t *, const uint8_t *, int, int);
|
|
41
|
|
42 void ff_avg_pixels16_neon(uint8_t *, const uint8_t *, int, int);
|
|
43
|
9344
|
44 void ff_add_pixels_clamped_neon(const DCTELEM *, uint8_t *, int);
|
9345
|
45 void ff_put_signed_pixels_clamped_neon(const DCTELEM *, uint8_t *, int);
|
9344
|
46
|
8334
|
47 void ff_put_h264_qpel16_mc00_neon(uint8_t *, uint8_t *, int);
|
8338
|
48 void ff_put_h264_qpel16_mc10_neon(uint8_t *, uint8_t *, int);
|
|
49 void ff_put_h264_qpel16_mc20_neon(uint8_t *, uint8_t *, int);
|
|
50 void ff_put_h264_qpel16_mc30_neon(uint8_t *, uint8_t *, int);
|
|
51 void ff_put_h264_qpel16_mc01_neon(uint8_t *, uint8_t *, int);
|
|
52 void ff_put_h264_qpel16_mc11_neon(uint8_t *, uint8_t *, int);
|
|
53 void ff_put_h264_qpel16_mc21_neon(uint8_t *, uint8_t *, int);
|
|
54 void ff_put_h264_qpel16_mc31_neon(uint8_t *, uint8_t *, int);
|
|
55 void ff_put_h264_qpel16_mc02_neon(uint8_t *, uint8_t *, int);
|
|
56 void ff_put_h264_qpel16_mc12_neon(uint8_t *, uint8_t *, int);
|
|
57 void ff_put_h264_qpel16_mc22_neon(uint8_t *, uint8_t *, int);
|
|
58 void ff_put_h264_qpel16_mc32_neon(uint8_t *, uint8_t *, int);
|
|
59 void ff_put_h264_qpel16_mc03_neon(uint8_t *, uint8_t *, int);
|
|
60 void ff_put_h264_qpel16_mc13_neon(uint8_t *, uint8_t *, int);
|
|
61 void ff_put_h264_qpel16_mc23_neon(uint8_t *, uint8_t *, int);
|
|
62 void ff_put_h264_qpel16_mc33_neon(uint8_t *, uint8_t *, int);
|
|
63
|
8334
|
64 void ff_put_h264_qpel8_mc00_neon(uint8_t *, uint8_t *, int);
|
8338
|
65 void ff_put_h264_qpel8_mc10_neon(uint8_t *, uint8_t *, int);
|
|
66 void ff_put_h264_qpel8_mc20_neon(uint8_t *, uint8_t *, int);
|
|
67 void ff_put_h264_qpel8_mc30_neon(uint8_t *, uint8_t *, int);
|
|
68 void ff_put_h264_qpel8_mc01_neon(uint8_t *, uint8_t *, int);
|
|
69 void ff_put_h264_qpel8_mc11_neon(uint8_t *, uint8_t *, int);
|
|
70 void ff_put_h264_qpel8_mc21_neon(uint8_t *, uint8_t *, int);
|
|
71 void ff_put_h264_qpel8_mc31_neon(uint8_t *, uint8_t *, int);
|
|
72 void ff_put_h264_qpel8_mc02_neon(uint8_t *, uint8_t *, int);
|
|
73 void ff_put_h264_qpel8_mc12_neon(uint8_t *, uint8_t *, int);
|
|
74 void ff_put_h264_qpel8_mc22_neon(uint8_t *, uint8_t *, int);
|
|
75 void ff_put_h264_qpel8_mc32_neon(uint8_t *, uint8_t *, int);
|
|
76 void ff_put_h264_qpel8_mc03_neon(uint8_t *, uint8_t *, int);
|
|
77 void ff_put_h264_qpel8_mc13_neon(uint8_t *, uint8_t *, int);
|
|
78 void ff_put_h264_qpel8_mc23_neon(uint8_t *, uint8_t *, int);
|
|
79 void ff_put_h264_qpel8_mc33_neon(uint8_t *, uint8_t *, int);
|
8334
|
80
|
|
81 void ff_avg_h264_qpel16_mc00_neon(uint8_t *, uint8_t *, int);
|
|
82
|
8336
|
83 void ff_put_h264_chroma_mc8_neon(uint8_t *, uint8_t *, int, int, int, int);
|
|
84 void ff_put_h264_chroma_mc4_neon(uint8_t *, uint8_t *, int, int, int, int);
|
|
85
|
|
86 void ff_avg_h264_chroma_mc8_neon(uint8_t *, uint8_t *, int, int, int, int);
|
|
87 void ff_avg_h264_chroma_mc4_neon(uint8_t *, uint8_t *, int, int, int, int);
|
|
88
|
8337
|
89 void ff_h264_v_loop_filter_luma_neon(uint8_t *pix, int stride, int alpha,
|
|
90 int beta, int8_t *tc0);
|
|
91 void ff_h264_h_loop_filter_luma_neon(uint8_t *pix, int stride, int alpha,
|
|
92 int beta, int8_t *tc0);
|
|
93 void ff_h264_v_loop_filter_chroma_neon(uint8_t *pix, int stride, int alpha,
|
|
94 int beta, int8_t *tc0);
|
|
95 void ff_h264_h_loop_filter_chroma_neon(uint8_t *pix, int stride, int alpha,
|
|
96 int beta, int8_t *tc0);
|
|
97
|
8664
|
98 void ff_weight_h264_pixels_16x16_neon(uint8_t *ds, int stride, int log2_den,
|
|
99 int weight, int offset);
|
|
100 void ff_weight_h264_pixels_16x8_neon(uint8_t *ds, int stride, int log2_den,
|
|
101 int weight, int offset);
|
|
102 void ff_weight_h264_pixels_8x16_neon(uint8_t *ds, int stride, int log2_den,
|
|
103 int weight, int offset);
|
|
104 void ff_weight_h264_pixels_8x8_neon(uint8_t *ds, int stride, int log2_den,
|
|
105 int weight, int offset);
|
|
106 void ff_weight_h264_pixels_8x4_neon(uint8_t *ds, int stride, int log2_den,
|
|
107 int weight, int offset);
|
|
108 void ff_weight_h264_pixels_4x8_neon(uint8_t *ds, int stride, int log2_den,
|
|
109 int weight, int offset);
|
|
110 void ff_weight_h264_pixels_4x4_neon(uint8_t *ds, int stride, int log2_den,
|
|
111 int weight, int offset);
|
|
112 void ff_weight_h264_pixels_4x2_neon(uint8_t *ds, int stride, int log2_den,
|
|
113 int weight, int offset);
|
|
114
|
8663
|
115 void ff_biweight_h264_pixels_16x16_neon(uint8_t *dst, uint8_t *src, int stride,
|
|
116 int log2_den, int weightd, int weights,
|
|
117 int offset);
|
|
118 void ff_biweight_h264_pixels_16x8_neon(uint8_t *dst, uint8_t *src, int stride,
|
|
119 int log2_den, int weightd, int weights,
|
|
120 int offset);
|
|
121 void ff_biweight_h264_pixels_8x16_neon(uint8_t *dst, uint8_t *src, int stride,
|
|
122 int log2_den, int weightd, int weights,
|
|
123 int offset);
|
|
124 void ff_biweight_h264_pixels_8x8_neon(uint8_t *dst, uint8_t *src, int stride,
|
|
125 int log2_den, int weightd, int weights,
|
|
126 int offset);
|
|
127 void ff_biweight_h264_pixels_8x4_neon(uint8_t *dst, uint8_t *src, int stride,
|
|
128 int log2_den, int weightd, int weights,
|
|
129 int offset);
|
|
130 void ff_biweight_h264_pixels_4x8_neon(uint8_t *dst, uint8_t *src, int stride,
|
|
131 int log2_den, int weightd, int weights,
|
|
132 int offset);
|
|
133 void ff_biweight_h264_pixels_4x4_neon(uint8_t *dst, uint8_t *src, int stride,
|
|
134 int log2_den, int weightd, int weights,
|
|
135 int offset);
|
|
136 void ff_biweight_h264_pixels_4x2_neon(uint8_t *dst, uint8_t *src, int stride,
|
|
137 int log2_den, int weightd, int weights,
|
|
138 int offset);
|
|
139
|
8339
|
140 void ff_h264_idct_add_neon(uint8_t *dst, DCTELEM *block, int stride);
|
8340
|
141 void ff_h264_idct_dc_add_neon(uint8_t *dst, DCTELEM *block, int stride);
|
8462
|
142 void ff_h264_idct_add16_neon(uint8_t *dst, const int *block_offset,
|
|
143 DCTELEM *block, int stride,
|
|
144 const uint8_t nnzc[6*8]);
|
|
145 void ff_h264_idct_add16intra_neon(uint8_t *dst, const int *block_offset,
|
|
146 DCTELEM *block, int stride,
|
|
147 const uint8_t nnzc[6*8]);
|
|
148 void ff_h264_idct_add8_neon(uint8_t **dest, const int *block_offset,
|
|
149 DCTELEM *block, int stride,
|
|
150 const uint8_t nnzc[6*8]);
|
8339
|
151
|
8697
|
152 void ff_vector_fmul_neon(float *dst, const float *src, int len);
|
8698
|
153 void ff_vector_fmul_window_neon(float *dst, const float *src0,
|
|
154 const float *src1, const float *win,
|
|
155 float add_bias, int len);
|
8697
|
156
|
8492
|
157 void ff_float_to_int16_neon(int16_t *, const float *, long);
|
|
158 void ff_float_to_int16_interleave_neon(int16_t *, const float **, long, int);
|
|
159
|
8334
|
160 void ff_dsputil_init_neon(DSPContext *c, AVCodecContext *avctx)
|
|
161 {
|
|
162 c->put_pixels_tab[0][0] = ff_put_pixels16_neon;
|
|
163 c->put_pixels_tab[0][1] = ff_put_pixels16_x2_neon;
|
|
164 c->put_pixels_tab[0][2] = ff_put_pixels16_y2_neon;
|
|
165 c->put_pixels_tab[0][3] = ff_put_pixels16_xy2_neon;
|
|
166 c->put_pixels_tab[1][0] = ff_put_pixels8_neon;
|
|
167 c->put_pixels_tab[1][1] = ff_put_pixels8_x2_neon;
|
|
168 c->put_pixels_tab[1][2] = ff_put_pixels8_y2_neon;
|
|
169 c->put_pixels_tab[1][3] = ff_put_pixels8_xy2_neon;
|
|
170
|
|
171 c->put_no_rnd_pixels_tab[0][0] = ff_put_pixels16_neon;
|
|
172 c->put_no_rnd_pixels_tab[0][1] = ff_put_pixels16_x2_no_rnd_neon;
|
|
173 c->put_no_rnd_pixels_tab[0][2] = ff_put_pixels16_y2_no_rnd_neon;
|
|
174 c->put_no_rnd_pixels_tab[0][3] = ff_put_pixels16_xy2_no_rnd_neon;
|
|
175 c->put_no_rnd_pixels_tab[1][0] = ff_put_pixels8_neon;
|
|
176 c->put_no_rnd_pixels_tab[1][1] = ff_put_pixels8_x2_no_rnd_neon;
|
|
177 c->put_no_rnd_pixels_tab[1][2] = ff_put_pixels8_y2_no_rnd_neon;
|
|
178 c->put_no_rnd_pixels_tab[1][3] = ff_put_pixels8_xy2_no_rnd_neon;
|
|
179
|
|
180 c->avg_pixels_tab[0][0] = ff_avg_pixels16_neon;
|
|
181
|
9344
|
182 c->add_pixels_clamped = ff_add_pixels_clamped_neon;
|
9345
|
183 c->put_signed_pixels_clamped = ff_put_signed_pixels_clamped_neon;
|
9344
|
184
|
8336
|
185 c->put_h264_chroma_pixels_tab[0] = ff_put_h264_chroma_mc8_neon;
|
|
186 c->put_h264_chroma_pixels_tab[1] = ff_put_h264_chroma_mc4_neon;
|
|
187
|
|
188 c->avg_h264_chroma_pixels_tab[0] = ff_avg_h264_chroma_mc8_neon;
|
|
189 c->avg_h264_chroma_pixels_tab[1] = ff_avg_h264_chroma_mc4_neon;
|
|
190
|
8338
|
191 c->put_h264_qpel_pixels_tab[0][ 0] = ff_put_h264_qpel16_mc00_neon;
|
|
192 c->put_h264_qpel_pixels_tab[0][ 1] = ff_put_h264_qpel16_mc10_neon;
|
|
193 c->put_h264_qpel_pixels_tab[0][ 2] = ff_put_h264_qpel16_mc20_neon;
|
|
194 c->put_h264_qpel_pixels_tab[0][ 3] = ff_put_h264_qpel16_mc30_neon;
|
|
195 c->put_h264_qpel_pixels_tab[0][ 4] = ff_put_h264_qpel16_mc01_neon;
|
|
196 c->put_h264_qpel_pixels_tab[0][ 5] = ff_put_h264_qpel16_mc11_neon;
|
|
197 c->put_h264_qpel_pixels_tab[0][ 6] = ff_put_h264_qpel16_mc21_neon;
|
|
198 c->put_h264_qpel_pixels_tab[0][ 7] = ff_put_h264_qpel16_mc31_neon;
|
|
199 c->put_h264_qpel_pixels_tab[0][ 8] = ff_put_h264_qpel16_mc02_neon;
|
|
200 c->put_h264_qpel_pixels_tab[0][ 9] = ff_put_h264_qpel16_mc12_neon;
|
|
201 c->put_h264_qpel_pixels_tab[0][10] = ff_put_h264_qpel16_mc22_neon;
|
|
202 c->put_h264_qpel_pixels_tab[0][11] = ff_put_h264_qpel16_mc32_neon;
|
|
203 c->put_h264_qpel_pixels_tab[0][12] = ff_put_h264_qpel16_mc03_neon;
|
|
204 c->put_h264_qpel_pixels_tab[0][13] = ff_put_h264_qpel16_mc13_neon;
|
|
205 c->put_h264_qpel_pixels_tab[0][14] = ff_put_h264_qpel16_mc23_neon;
|
|
206 c->put_h264_qpel_pixels_tab[0][15] = ff_put_h264_qpel16_mc33_neon;
|
|
207
|
|
208 c->put_h264_qpel_pixels_tab[1][ 0] = ff_put_h264_qpel8_mc00_neon;
|
|
209 c->put_h264_qpel_pixels_tab[1][ 1] = ff_put_h264_qpel8_mc10_neon;
|
|
210 c->put_h264_qpel_pixels_tab[1][ 2] = ff_put_h264_qpel8_mc20_neon;
|
|
211 c->put_h264_qpel_pixels_tab[1][ 3] = ff_put_h264_qpel8_mc30_neon;
|
|
212 c->put_h264_qpel_pixels_tab[1][ 4] = ff_put_h264_qpel8_mc01_neon;
|
|
213 c->put_h264_qpel_pixels_tab[1][ 5] = ff_put_h264_qpel8_mc11_neon;
|
|
214 c->put_h264_qpel_pixels_tab[1][ 6] = ff_put_h264_qpel8_mc21_neon;
|
|
215 c->put_h264_qpel_pixels_tab[1][ 7] = ff_put_h264_qpel8_mc31_neon;
|
|
216 c->put_h264_qpel_pixels_tab[1][ 8] = ff_put_h264_qpel8_mc02_neon;
|
|
217 c->put_h264_qpel_pixels_tab[1][ 9] = ff_put_h264_qpel8_mc12_neon;
|
|
218 c->put_h264_qpel_pixels_tab[1][10] = ff_put_h264_qpel8_mc22_neon;
|
|
219 c->put_h264_qpel_pixels_tab[1][11] = ff_put_h264_qpel8_mc32_neon;
|
|
220 c->put_h264_qpel_pixels_tab[1][12] = ff_put_h264_qpel8_mc03_neon;
|
|
221 c->put_h264_qpel_pixels_tab[1][13] = ff_put_h264_qpel8_mc13_neon;
|
|
222 c->put_h264_qpel_pixels_tab[1][14] = ff_put_h264_qpel8_mc23_neon;
|
|
223 c->put_h264_qpel_pixels_tab[1][15] = ff_put_h264_qpel8_mc33_neon;
|
8334
|
224
|
|
225 c->avg_h264_qpel_pixels_tab[0][ 0] = ff_avg_h264_qpel16_mc00_neon;
|
8337
|
226
|
|
227 c->h264_v_loop_filter_luma = ff_h264_v_loop_filter_luma_neon;
|
|
228 c->h264_h_loop_filter_luma = ff_h264_h_loop_filter_luma_neon;
|
|
229 c->h264_v_loop_filter_chroma = ff_h264_v_loop_filter_chroma_neon;
|
|
230 c->h264_h_loop_filter_chroma = ff_h264_h_loop_filter_chroma_neon;
|
8339
|
231
|
8664
|
232 c->weight_h264_pixels_tab[0] = ff_weight_h264_pixels_16x16_neon;
|
|
233 c->weight_h264_pixels_tab[1] = ff_weight_h264_pixels_16x8_neon;
|
|
234 c->weight_h264_pixels_tab[2] = ff_weight_h264_pixels_8x16_neon;
|
|
235 c->weight_h264_pixels_tab[3] = ff_weight_h264_pixels_8x8_neon;
|
|
236 c->weight_h264_pixels_tab[4] = ff_weight_h264_pixels_8x4_neon;
|
|
237 c->weight_h264_pixels_tab[5] = ff_weight_h264_pixels_4x8_neon;
|
|
238 c->weight_h264_pixels_tab[6] = ff_weight_h264_pixels_4x4_neon;
|
|
239 c->weight_h264_pixels_tab[7] = ff_weight_h264_pixels_4x2_neon;
|
|
240
|
8663
|
241 c->biweight_h264_pixels_tab[0] = ff_biweight_h264_pixels_16x16_neon;
|
|
242 c->biweight_h264_pixels_tab[1] = ff_biweight_h264_pixels_16x8_neon;
|
|
243 c->biweight_h264_pixels_tab[2] = ff_biweight_h264_pixels_8x16_neon;
|
|
244 c->biweight_h264_pixels_tab[3] = ff_biweight_h264_pixels_8x8_neon;
|
|
245 c->biweight_h264_pixels_tab[4] = ff_biweight_h264_pixels_8x4_neon;
|
|
246 c->biweight_h264_pixels_tab[5] = ff_biweight_h264_pixels_4x8_neon;
|
|
247 c->biweight_h264_pixels_tab[6] = ff_biweight_h264_pixels_4x4_neon;
|
|
248 c->biweight_h264_pixels_tab[7] = ff_biweight_h264_pixels_4x2_neon;
|
|
249
|
8339
|
250 c->h264_idct_add = ff_h264_idct_add_neon;
|
8340
|
251 c->h264_idct_dc_add = ff_h264_idct_dc_add_neon;
|
8462
|
252 c->h264_idct_add16 = ff_h264_idct_add16_neon;
|
|
253 c->h264_idct_add16intra = ff_h264_idct_add16intra_neon;
|
|
254 c->h264_idct_add8 = ff_h264_idct_add8_neon;
|
8492
|
255
|
8697
|
256 c->vector_fmul = ff_vector_fmul_neon;
|
8698
|
257 c->vector_fmul_window = ff_vector_fmul_window_neon;
|
8697
|
258
|
8492
|
259 if (!(avctx->flags & CODEC_FLAG_BITEXACT)) {
|
|
260 c->float_to_int16 = ff_float_to_int16_neon;
|
|
261 c->float_to_int16_interleave = ff_float_to_int16_interleave_neon;
|
|
262 }
|
8334
|
263 }
|