FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavcodec/vp9dsp_template.c
Date: 2026-08-11 17:55:23
Exec Total Coverage
Lines: 1374 1406 97.7%
Functions: 274 308 89.0%
Branches: 326 337 96.7%

Line Branch Exec Source
1 /*
2 * VP9 compatible video decoder
3 *
4 * Copyright (C) 2013 Ronald S. Bultje <rsbultje gmail com>
5 * Copyright (C) 2013 Clément Bœsch <u pkh me>
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 "libavutil/common.h"
25 #include "bit_depth_template.c"
26 #include "vp9dsp.h"
27
28 #if BIT_DEPTH != 12
29
30 // FIXME see whether we can merge parts of this (perhaps at least 4x4 and 8x8)
31 // back with h264pred.[ch]
32
33 127791 static void vert_4x4_c(uint8_t *restrict _dst, ptrdiff_t stride,
34 const uint8_t *left, const uint8_t *_top)
35 {
36 127791 pixel *dst = (pixel *) _dst;
37 127791 const pixel *top = (const pixel *) _top;
38 127791 pixel4 p4 = AV_RN4PA(top);
39
40 127791 stride /= sizeof(pixel);
41 127791 AV_WN4PA(dst + stride * 0, p4);
42 127791 AV_WN4PA(dst + stride * 1, p4);
43 127791 AV_WN4PA(dst + stride * 2, p4);
44 127791 AV_WN4PA(dst + stride * 3, p4);
45 127791 }
46
47 27102 static void vert_8x8_c(uint8_t *restrict _dst, ptrdiff_t stride,
48 const uint8_t *left, const uint8_t *_top)
49 {
50 27102 pixel *dst = (pixel *) _dst;
51 27102 const pixel *top = (const pixel *) _top;
52 #if BIT_DEPTH == 8
53 24057 uint64_t p8 = AV_RN64A(top);
54 #else
55 3045 pixel4 p4a = AV_RN4PA(top + 0);
56 3045 pixel4 p4b = AV_RN4PA(top + 4);
57 #endif
58 int y;
59
60 27102 stride /= sizeof(pixel);
61
2/2
✓ Branch 0 taken 216816 times.
✓ Branch 1 taken 27102 times.
243918 for (y = 0; y < 8; y++) {
62 #if BIT_DEPTH == 8
63 192456 AV_WN64A(dst, p8);
64 #else
65 24360 AV_WN4PA(dst + 0, p4a);
66 24360 AV_WN4PA(dst + 4, p4b);
67 #endif
68 216816 dst += stride;
69 }
70 27102 }
71
72 6393 static void vert_16x16_c(uint8_t *restrict _dst, ptrdiff_t stride,
73 const uint8_t *left, const uint8_t *_top)
74 {
75 6393 pixel *dst = (pixel *) _dst;
76 6393 const pixel *top = (const pixel *) _top;
77 #if BIT_DEPTH == 8
78 5606 uint64_t p8a = AV_RN64A(top);
79 5606 uint64_t p8b = AV_RN64A(top + 8);
80 #else
81 787 pixel4 p4a = AV_RN4PA(top + 0);
82 787 pixel4 p4b = AV_RN4PA(top + 4);
83 787 pixel4 p4c = AV_RN4PA(top + 8);
84 787 pixel4 p4d = AV_RN4PA(top + 12);
85 #endif
86 int y;
87
88 6393 stride /= sizeof(pixel);
89
2/2
✓ Branch 0 taken 102288 times.
✓ Branch 1 taken 6393 times.
108681 for (y = 0; y < 16; y++) {
90 #if BIT_DEPTH == 8
91 89696 AV_WN64A(dst + 0, p8a);
92 89696 AV_WN64A(dst + 8, p8b);
93 #else
94 12592 AV_WN4PA(dst + 0, p4a);
95 12592 AV_WN4PA(dst + 4, p4b);
96 12592 AV_WN4PA(dst + 8, p4c);
97 12592 AV_WN4PA(dst + 12, p4d);
98 #endif
99 102288 dst += stride;
100 }
101 6393 }
102
103 1045 static void vert_32x32_c(uint8_t *restrict _dst, ptrdiff_t stride,
104 const uint8_t *left, const uint8_t *_top)
105 {
106 1045 pixel *dst = (pixel *) _dst;
107 1045 const pixel *top = (const pixel *) _top;
108 #if BIT_DEPTH == 8
109 779 uint64_t p8a = AV_RN64A(top);
110 779 uint64_t p8b = AV_RN64A(top + 8);
111 779 uint64_t p8c = AV_RN64A(top + 16);
112 779 uint64_t p8d = AV_RN64A(top + 24);
113 #else
114 266 pixel4 p4a = AV_RN4PA(top + 0);
115 266 pixel4 p4b = AV_RN4PA(top + 4);
116 266 pixel4 p4c = AV_RN4PA(top + 8);
117 266 pixel4 p4d = AV_RN4PA(top + 12);
118 266 pixel4 p4e = AV_RN4PA(top + 16);
119 266 pixel4 p4f = AV_RN4PA(top + 20);
120 266 pixel4 p4g = AV_RN4PA(top + 24);
121 266 pixel4 p4h = AV_RN4PA(top + 28);
122 #endif
123 int y;
124
125 1045 stride /= sizeof(pixel);
126
2/2
✓ Branch 0 taken 33440 times.
✓ Branch 1 taken 1045 times.
34485 for (y = 0; y < 32; y++) {
127 #if BIT_DEPTH == 8
128 24928 AV_WN64A(dst + 0, p8a);
129 24928 AV_WN64A(dst + 8, p8b);
130 24928 AV_WN64A(dst + 16, p8c);
131 24928 AV_WN64A(dst + 24, p8d);
132 #else
133 8512 AV_WN4PA(dst + 0, p4a);
134 8512 AV_WN4PA(dst + 4, p4b);
135 8512 AV_WN4PA(dst + 8, p4c);
136 8512 AV_WN4PA(dst + 12, p4d);
137 8512 AV_WN4PA(dst + 16, p4e);
138 8512 AV_WN4PA(dst + 20, p4f);
139 8512 AV_WN4PA(dst + 24, p4g);
140 8512 AV_WN4PA(dst + 28, p4h);
141 #endif
142 33440 dst += stride;
143 }
144 1045 }
145
146 278322 static void hor_4x4_c(uint8_t *_dst, ptrdiff_t stride,
147 const uint8_t *_left, const uint8_t *top)
148 {
149 278322 pixel *dst = (pixel *) _dst;
150 278322 const pixel *left = (const pixel *) _left;
151
152 278322 stride /= sizeof(pixel);
153 278322 AV_WN4PA(dst + stride * 0, PIXEL_SPLAT_X4(left[3]));
154 278322 AV_WN4PA(dst + stride * 1, PIXEL_SPLAT_X4(left[2]));
155 278322 AV_WN4PA(dst + stride * 2, PIXEL_SPLAT_X4(left[1]));
156 278322 AV_WN4PA(dst + stride * 3, PIXEL_SPLAT_X4(left[0]));
157 278322 }
158
159 74393 static void hor_8x8_c(uint8_t *_dst, ptrdiff_t stride,
160 const uint8_t *_left, const uint8_t *top)
161 {
162 74393 pixel *dst = (pixel *) _dst;
163 74393 const pixel *left = (const pixel *) _left;
164 int y;
165
166 74393 stride /= sizeof(pixel);
167
2/2
✓ Branch 0 taken 595144 times.
✓ Branch 1 taken 74393 times.
669537 for (y = 0; y < 8; y++) {
168 595144 pixel4 p4 = PIXEL_SPLAT_X4(left[7 - y]);
169
170 595144 AV_WN4PA(dst + 0, p4);
171 595144 AV_WN4PA(dst + 4, p4);
172 595144 dst += stride;
173 }
174 74393 }
175
176 13698 static void hor_16x16_c(uint8_t *_dst, ptrdiff_t stride,
177 const uint8_t *_left, const uint8_t *top)
178 {
179 13698 pixel *dst = (pixel *) _dst;
180 13698 const pixel *left = (const pixel *) _left;
181 int y;
182
183 13698 stride /= sizeof(pixel);
184
2/2
✓ Branch 0 taken 219168 times.
✓ Branch 1 taken 13698 times.
232866 for (y = 0; y < 16; y++) {
185 219168 pixel4 p4 = PIXEL_SPLAT_X4(left[15 - y]);
186
187 219168 AV_WN4PA(dst + 0, p4);
188 219168 AV_WN4PA(dst + 4, p4);
189 219168 AV_WN4PA(dst + 8, p4);
190 219168 AV_WN4PA(dst + 12, p4);
191 219168 dst += stride;
192 }
193 13698 }
194
195 1477 static void hor_32x32_c(uint8_t *_dst, ptrdiff_t stride,
196 const uint8_t *_left, const uint8_t *top)
197 {
198 1477 pixel *dst = (pixel *) _dst;
199 1477 const pixel *left = (const pixel *) _left;
200 int y;
201
202 1477 stride /= sizeof(pixel);
203
2/2
✓ Branch 0 taken 47264 times.
✓ Branch 1 taken 1477 times.
48741 for (y = 0; y < 32; y++) {
204 47264 pixel4 p4 = PIXEL_SPLAT_X4(left[31 - y]);
205
206 47264 AV_WN4PA(dst + 0, p4);
207 47264 AV_WN4PA(dst + 4, p4);
208 47264 AV_WN4PA(dst + 8, p4);
209 47264 AV_WN4PA(dst + 12, p4);
210 47264 AV_WN4PA(dst + 16, p4);
211 47264 AV_WN4PA(dst + 20, p4);
212 47264 AV_WN4PA(dst + 24, p4);
213 47264 AV_WN4PA(dst + 28, p4);
214 47264 dst += stride;
215 }
216 1477 }
217
218 #endif /* BIT_DEPTH != 12 */
219
220 78334 static void tm_4x4_c(uint8_t *_dst, ptrdiff_t stride,
221 const uint8_t *_left, const uint8_t *_top)
222 {
223 78334 pixel *dst = (pixel *) _dst;
224 78334 const pixel *left = (const pixel *) _left;
225 78334 const pixel *top = (const pixel *) _top;
226 78334 int y, tl = top[-1];
227
228 78334 stride /= sizeof(pixel);
229
2/2
✓ Branch 0 taken 313336 times.
✓ Branch 1 taken 78334 times.
391670 for (y = 0; y < 4; y++) {
230 313336 int l_m_tl = left[3 - y] - tl;
231
232 313336 dst[0] = av_clip_pixel(top[0] + l_m_tl);
233 313336 dst[1] = av_clip_pixel(top[1] + l_m_tl);
234 313336 dst[2] = av_clip_pixel(top[2] + l_m_tl);
235 313336 dst[3] = av_clip_pixel(top[3] + l_m_tl);
236 313336 dst += stride;
237 }
238 78334 }
239
240 20024 static void tm_8x8_c(uint8_t *_dst, ptrdiff_t stride,
241 const uint8_t *_left, const uint8_t *_top)
242 {
243 20024 pixel *dst = (pixel *) _dst;
244 20024 const pixel *left = (const pixel *) _left;
245 20024 const pixel *top = (const pixel *) _top;
246 20024 int y, tl = top[-1];
247
248 20024 stride /= sizeof(pixel);
249
2/2
✓ Branch 0 taken 160192 times.
✓ Branch 1 taken 20024 times.
180216 for (y = 0; y < 8; y++) {
250 160192 int l_m_tl = left[7 - y] - tl;
251
252 160192 dst[0] = av_clip_pixel(top[0] + l_m_tl);
253 160192 dst[1] = av_clip_pixel(top[1] + l_m_tl);
254 160192 dst[2] = av_clip_pixel(top[2] + l_m_tl);
255 160192 dst[3] = av_clip_pixel(top[3] + l_m_tl);
256 160192 dst[4] = av_clip_pixel(top[4] + l_m_tl);
257 160192 dst[5] = av_clip_pixel(top[5] + l_m_tl);
258 160192 dst[6] = av_clip_pixel(top[6] + l_m_tl);
259 160192 dst[7] = av_clip_pixel(top[7] + l_m_tl);
260 160192 dst += stride;
261 }
262 20024 }
263
264 2571 static void tm_16x16_c(uint8_t *_dst, ptrdiff_t stride,
265 const uint8_t *_left, const uint8_t *_top)
266 {
267 2571 pixel *dst = (pixel *) _dst;
268 2571 const pixel *left = (const pixel *) _left;
269 2571 const pixel *top = (const pixel *) _top;
270 2571 int y, tl = top[-1];
271
272 2571 stride /= sizeof(pixel);
273
2/2
✓ Branch 0 taken 41136 times.
✓ Branch 1 taken 2571 times.
43707 for (y = 0; y < 16; y++) {
274 41136 int l_m_tl = left[15 - y] - tl;
275
276 41136 dst[ 0] = av_clip_pixel(top[ 0] + l_m_tl);
277 41136 dst[ 1] = av_clip_pixel(top[ 1] + l_m_tl);
278 41136 dst[ 2] = av_clip_pixel(top[ 2] + l_m_tl);
279 41136 dst[ 3] = av_clip_pixel(top[ 3] + l_m_tl);
280 41136 dst[ 4] = av_clip_pixel(top[ 4] + l_m_tl);
281 41136 dst[ 5] = av_clip_pixel(top[ 5] + l_m_tl);
282 41136 dst[ 6] = av_clip_pixel(top[ 6] + l_m_tl);
283 41136 dst[ 7] = av_clip_pixel(top[ 7] + l_m_tl);
284 41136 dst[ 8] = av_clip_pixel(top[ 8] + l_m_tl);
285 41136 dst[ 9] = av_clip_pixel(top[ 9] + l_m_tl);
286 41136 dst[10] = av_clip_pixel(top[10] + l_m_tl);
287 41136 dst[11] = av_clip_pixel(top[11] + l_m_tl);
288 41136 dst[12] = av_clip_pixel(top[12] + l_m_tl);
289 41136 dst[13] = av_clip_pixel(top[13] + l_m_tl);
290 41136 dst[14] = av_clip_pixel(top[14] + l_m_tl);
291 41136 dst[15] = av_clip_pixel(top[15] + l_m_tl);
292 41136 dst += stride;
293 }
294 2571 }
295
296 389 static void tm_32x32_c(uint8_t *_dst, ptrdiff_t stride,
297 const uint8_t *_left, const uint8_t *_top)
298 {
299 389 pixel *dst = (pixel *) _dst;
300 389 const pixel *left = (const pixel *) _left;
301 389 const pixel *top = (const pixel *) _top;
302 389 int y, tl = top[-1];
303
304 389 stride /= sizeof(pixel);
305
2/2
✓ Branch 0 taken 12448 times.
✓ Branch 1 taken 389 times.
12837 for (y = 0; y < 32; y++) {
306 12448 int l_m_tl = left[31 - y] - tl;
307
308 12448 dst[ 0] = av_clip_pixel(top[ 0] + l_m_tl);
309 12448 dst[ 1] = av_clip_pixel(top[ 1] + l_m_tl);
310 12448 dst[ 2] = av_clip_pixel(top[ 2] + l_m_tl);
311 12448 dst[ 3] = av_clip_pixel(top[ 3] + l_m_tl);
312 12448 dst[ 4] = av_clip_pixel(top[ 4] + l_m_tl);
313 12448 dst[ 5] = av_clip_pixel(top[ 5] + l_m_tl);
314 12448 dst[ 6] = av_clip_pixel(top[ 6] + l_m_tl);
315 12448 dst[ 7] = av_clip_pixel(top[ 7] + l_m_tl);
316 12448 dst[ 8] = av_clip_pixel(top[ 8] + l_m_tl);
317 12448 dst[ 9] = av_clip_pixel(top[ 9] + l_m_tl);
318 12448 dst[10] = av_clip_pixel(top[10] + l_m_tl);
319 12448 dst[11] = av_clip_pixel(top[11] + l_m_tl);
320 12448 dst[12] = av_clip_pixel(top[12] + l_m_tl);
321 12448 dst[13] = av_clip_pixel(top[13] + l_m_tl);
322 12448 dst[14] = av_clip_pixel(top[14] + l_m_tl);
323 12448 dst[15] = av_clip_pixel(top[15] + l_m_tl);
324 12448 dst[16] = av_clip_pixel(top[16] + l_m_tl);
325 12448 dst[17] = av_clip_pixel(top[17] + l_m_tl);
326 12448 dst[18] = av_clip_pixel(top[18] + l_m_tl);
327 12448 dst[19] = av_clip_pixel(top[19] + l_m_tl);
328 12448 dst[20] = av_clip_pixel(top[20] + l_m_tl);
329 12448 dst[21] = av_clip_pixel(top[21] + l_m_tl);
330 12448 dst[22] = av_clip_pixel(top[22] + l_m_tl);
331 12448 dst[23] = av_clip_pixel(top[23] + l_m_tl);
332 12448 dst[24] = av_clip_pixel(top[24] + l_m_tl);
333 12448 dst[25] = av_clip_pixel(top[25] + l_m_tl);
334 12448 dst[26] = av_clip_pixel(top[26] + l_m_tl);
335 12448 dst[27] = av_clip_pixel(top[27] + l_m_tl);
336 12448 dst[28] = av_clip_pixel(top[28] + l_m_tl);
337 12448 dst[29] = av_clip_pixel(top[29] + l_m_tl);
338 12448 dst[30] = av_clip_pixel(top[30] + l_m_tl);
339 12448 dst[31] = av_clip_pixel(top[31] + l_m_tl);
340 12448 dst += stride;
341 }
342 389 }
343
344 #if BIT_DEPTH != 12
345
346 353776 static void dc_4x4_c(uint8_t *_dst, ptrdiff_t stride,
347 const uint8_t *_left, const uint8_t *_top)
348 {
349 353776 pixel *dst = (pixel *) _dst;
350 353776 const pixel *left = (const pixel *) _left;
351 353776 const pixel *top = (const pixel *) _top;
352 353776 pixel4 dc = PIXEL_SPLAT_X4((left[0] + left[1] + left[2] + left[3] +
353 top[0] + top[1] + top[2] + top[3] + 4) >> 3);
354
355 353776 stride /= sizeof(pixel);
356 353776 AV_WN4PA(dst + stride * 0, dc);
357 353776 AV_WN4PA(dst + stride * 1, dc);
358 353776 AV_WN4PA(dst + stride * 2, dc);
359 353776 AV_WN4PA(dst + stride * 3, dc);
360 353776 }
361
362 142836 static void dc_8x8_c(uint8_t *_dst, ptrdiff_t stride,
363 const uint8_t *_left, const uint8_t *_top)
364 {
365 142836 pixel *dst = (pixel *) _dst;
366 142836 const pixel *left = (const pixel *) _left;
367 142836 const pixel *top = (const pixel *) _top;
368 142836 pixel4 dc = PIXEL_SPLAT_X4
369 ((left[0] + left[1] + left[2] + left[3] + left[4] + left[5] +
370 left[6] + left[7] + top[0] + top[1] + top[2] + top[3] +
371 top[4] + top[5] + top[6] + top[7] + 8) >> 4);
372 int y;
373
374 142836 stride /= sizeof(pixel);
375
2/2
✓ Branch 0 taken 1142688 times.
✓ Branch 1 taken 142836 times.
1285524 for (y = 0; y < 8; y++) {
376 1142688 AV_WN4PA(dst + 0, dc);
377 1142688 AV_WN4PA(dst + 4, dc);
378 1142688 dst += stride;
379 }
380 142836 }
381
382 20500 static void dc_16x16_c(uint8_t *_dst, ptrdiff_t stride,
383 const uint8_t *_left, const uint8_t *_top)
384 {
385 20500 pixel *dst = (pixel *) _dst;
386 20500 const pixel *left = (const pixel *) _left;
387 20500 const pixel *top = (const pixel *) _top;
388 20500 pixel4 dc = PIXEL_SPLAT_X4
389 ((left[0] + left[1] + left[2] + left[3] + left[4] + left[5] + left[6] +
390 left[7] + left[8] + left[9] + left[10] + left[11] + left[12] +
391 left[13] + left[14] + left[15] + top[0] + top[1] + top[2] + top[3] +
392 top[4] + top[5] + top[6] + top[7] + top[8] + top[9] + top[10] +
393 top[11] + top[12] + top[13] + top[14] + top[15] + 16) >> 5);
394 int y;
395
396 20500 stride /= sizeof(pixel);
397
2/2
✓ Branch 0 taken 328000 times.
✓ Branch 1 taken 20500 times.
348500 for (y = 0; y < 16; y++) {
398 328000 AV_WN4PA(dst + 0, dc);
399 328000 AV_WN4PA(dst + 4, dc);
400 328000 AV_WN4PA(dst + 8, dc);
401 328000 AV_WN4PA(dst + 12, dc);
402 328000 dst += stride;
403 }
404 20500 }
405
406 11005 static void dc_32x32_c(uint8_t *_dst, ptrdiff_t stride,
407 const uint8_t *_left, const uint8_t *_top)
408 {
409 11005 pixel *dst = (pixel *) _dst;
410 11005 const pixel *left = (const pixel *) _left;
411 11005 const pixel *top = (const pixel *) _top;
412 11005 pixel4 dc = PIXEL_SPLAT_X4
413 ((left[0] + left[1] + left[2] + left[3] + left[4] + left[5] + left[6] +
414 left[7] + left[8] + left[9] + left[10] + left[11] + left[12] +
415 left[13] + left[14] + left[15] + left[16] + left[17] + left[18] +
416 left[19] + left[20] + left[21] + left[22] + left[23] + left[24] +
417 left[25] + left[26] + left[27] + left[28] + left[29] + left[30] +
418 left[31] + top[0] + top[1] + top[2] + top[3] + top[4] + top[5] +
419 top[6] + top[7] + top[8] + top[9] + top[10] + top[11] + top[12] +
420 top[13] + top[14] + top[15] + top[16] + top[17] + top[18] + top[19] +
421 top[20] + top[21] + top[22] + top[23] + top[24] + top[25] + top[26] +
422 top[27] + top[28] + top[29] + top[30] + top[31] + 32) >> 6);
423 int y;
424
425 11005 stride /= sizeof(pixel);
426
2/2
✓ Branch 0 taken 352160 times.
✓ Branch 1 taken 11005 times.
363165 for (y = 0; y < 32; y++) {
427 352160 AV_WN4PA(dst + 0, dc);
428 352160 AV_WN4PA(dst + 4, dc);
429 352160 AV_WN4PA(dst + 8, dc);
430 352160 AV_WN4PA(dst + 12, dc);
431 352160 AV_WN4PA(dst + 16, dc);
432 352160 AV_WN4PA(dst + 20, dc);
433 352160 AV_WN4PA(dst + 24, dc);
434 352160 AV_WN4PA(dst + 28, dc);
435 352160 dst += stride;
436 }
437 11005 }
438
439 9207 static void dc_left_4x4_c(uint8_t *_dst, ptrdiff_t stride,
440 const uint8_t *_left, const uint8_t *top)
441 {
442 9207 pixel *dst = (pixel *) _dst;
443 9207 const pixel *left = (const pixel *) _left;
444 9207 pixel4 dc = PIXEL_SPLAT_X4((left[0] + left[1] + left[2] + left[3] + 2) >> 2);
445
446 9207 stride /= sizeof(pixel);
447 9207 AV_WN4PA(dst + stride * 0, dc);
448 9207 AV_WN4PA(dst + stride * 1, dc);
449 9207 AV_WN4PA(dst + stride * 2, dc);
450 9207 AV_WN4PA(dst + stride * 3, dc);
451 9207 }
452
453 3373 static void dc_left_8x8_c(uint8_t *_dst, ptrdiff_t stride,
454 const uint8_t *_left, const uint8_t *top)
455 {
456 3373 pixel *dst = (pixel *) _dst;
457 3373 const pixel *left = (const pixel *) _left;
458 3373 pixel4 dc = PIXEL_SPLAT_X4
459 ((left[0] + left[1] + left[2] + left[3] +
460 left[4] + left[5] + left[6] + left[7] + 4) >> 3);
461 int y;
462
463 3373 stride /= sizeof(pixel);
464
2/2
✓ Branch 0 taken 26984 times.
✓ Branch 1 taken 3373 times.
30357 for (y = 0; y < 8; y++) {
465 26984 AV_WN4PA(dst + 0, dc);
466 26984 AV_WN4PA(dst + 4, dc);
467 26984 dst += stride;
468 }
469 3373 }
470
471 1208 static void dc_left_16x16_c(uint8_t *_dst, ptrdiff_t stride,
472 const uint8_t *_left, const uint8_t *top)
473 {
474 1208 pixel *dst = (pixel *) _dst;
475 1208 const pixel *left = (const pixel *) _left;
476 1208 pixel4 dc = PIXEL_SPLAT_X4
477 ((left[0] + left[1] + left[2] + left[3] + left[4] + left[5] +
478 left[6] + left[7] + left[8] + left[9] + left[10] + left[11] +
479 left[12] + left[13] + left[14] + left[15] + 8) >> 4);
480 int y;
481
482 1208 stride /= sizeof(pixel);
483
2/2
✓ Branch 0 taken 19328 times.
✓ Branch 1 taken 1208 times.
20536 for (y = 0; y < 16; y++) {
484 19328 AV_WN4PA(dst + 0, dc);
485 19328 AV_WN4PA(dst + 4, dc);
486 19328 AV_WN4PA(dst + 8, dc);
487 19328 AV_WN4PA(dst + 12, dc);
488 19328 dst += stride;
489 }
490 1208 }
491
492 1569 static void dc_left_32x32_c(uint8_t *_dst, ptrdiff_t stride,
493 const uint8_t *_left, const uint8_t *top)
494 {
495 1569 pixel *dst = (pixel *) _dst;
496 1569 const pixel *left = (const pixel *) _left;
497 1569 pixel4 dc = PIXEL_SPLAT_X4
498 ((left[0] + left[1] + left[2] + left[3] + left[4] + left[5] +
499 left[6] + left[7] + left[8] + left[9] + left[10] + left[11] +
500 left[12] + left[13] + left[14] + left[15] + left[16] + left[17] +
501 left[18] + left[19] + left[20] + left[21] + left[22] + left[23] +
502 left[24] + left[25] + left[26] + left[27] + left[28] + left[29] +
503 left[30] + left[31] + 16) >> 5);
504 int y;
505
506 1569 stride /= sizeof(pixel);
507
2/2
✓ Branch 0 taken 50208 times.
✓ Branch 1 taken 1569 times.
51777 for (y = 0; y < 32; y++) {
508 50208 AV_WN4PA(dst + 0, dc);
509 50208 AV_WN4PA(dst + 4, dc);
510 50208 AV_WN4PA(dst + 8, dc);
511 50208 AV_WN4PA(dst + 12, dc);
512 50208 AV_WN4PA(dst + 16, dc);
513 50208 AV_WN4PA(dst + 20, dc);
514 50208 AV_WN4PA(dst + 24, dc);
515 50208 AV_WN4PA(dst + 28, dc);
516 50208 dst += stride;
517 }
518 1569 }
519
520 11043 static void dc_top_4x4_c(uint8_t *_dst, ptrdiff_t stride,
521 const uint8_t *left, const uint8_t *_top)
522 {
523 11043 pixel *dst = (pixel *) _dst;
524 11043 const pixel *top = (const pixel *) _top;
525 11043 pixel4 dc = PIXEL_SPLAT_X4((top[0] + top[1] + top[2] + top[3] + 2) >> 2);
526
527 11043 stride /= sizeof(pixel);
528 11043 AV_WN4PA(dst + stride * 0, dc);
529 11043 AV_WN4PA(dst + stride * 1, dc);
530 11043 AV_WN4PA(dst + stride * 2, dc);
531 11043 AV_WN4PA(dst + stride * 3, dc);
532 11043 }
533
534 7214 static void dc_top_8x8_c(uint8_t *_dst, ptrdiff_t stride,
535 const uint8_t *left, const uint8_t *_top)
536 {
537 7214 pixel *dst = (pixel *) _dst;
538 7214 const pixel *top = (const pixel *) _top;
539 7214 pixel4 dc = PIXEL_SPLAT_X4
540 ((top[0] + top[1] + top[2] + top[3] +
541 top[4] + top[5] + top[6] + top[7] + 4) >> 3);
542 int y;
543
544 7214 stride /= sizeof(pixel);
545
2/2
✓ Branch 0 taken 57712 times.
✓ Branch 1 taken 7214 times.
64926 for (y = 0; y < 8; y++) {
546 57712 AV_WN4PA(dst + 0, dc);
547 57712 AV_WN4PA(dst + 4, dc);
548 57712 dst += stride;
549 }
550 7214 }
551
552 2627 static void dc_top_16x16_c(uint8_t *_dst, ptrdiff_t stride,
553 const uint8_t *left, const uint8_t *_top)
554 {
555 2627 pixel *dst = (pixel *) _dst;
556 2627 const pixel *top = (const pixel *) _top;
557 2627 pixel4 dc = PIXEL_SPLAT_X4
558 ((top[0] + top[1] + top[2] + top[3] + top[4] + top[5] +
559 top[6] + top[7] + top[8] + top[9] + top[10] + top[11] +
560 top[12] + top[13] + top[14] + top[15] + 8) >> 4);
561 int y;
562
563 2627 stride /= sizeof(pixel);
564
2/2
✓ Branch 0 taken 42032 times.
✓ Branch 1 taken 2627 times.
44659 for (y = 0; y < 16; y++) {
565 42032 AV_WN4PA(dst + 0, dc);
566 42032 AV_WN4PA(dst + 4, dc);
567 42032 AV_WN4PA(dst + 8, dc);
568 42032 AV_WN4PA(dst + 12, dc);
569 42032 dst += stride;
570 }
571 2627 }
572
573 1343 static void dc_top_32x32_c(uint8_t *_dst, ptrdiff_t stride,
574 const uint8_t *left, const uint8_t *_top)
575 {
576 1343 pixel *dst = (pixel *) _dst;
577 1343 const pixel *top = (const pixel *) _top;
578 1343 pixel4 dc = PIXEL_SPLAT_X4
579 ((top[0] + top[1] + top[2] + top[3] + top[4] + top[5] +
580 top[6] + top[7] + top[8] + top[9] + top[10] + top[11] +
581 top[12] + top[13] + top[14] + top[15] + top[16] + top[17] +
582 top[18] + top[19] + top[20] + top[21] + top[22] + top[23] +
583 top[24] + top[25] + top[26] + top[27] + top[28] + top[29] +
584 top[30] + top[31] + 16) >> 5);
585 int y;
586
587 1343 stride /= sizeof(pixel);
588
2/2
✓ Branch 0 taken 42976 times.
✓ Branch 1 taken 1343 times.
44319 for (y = 0; y < 32; y++) {
589 42976 AV_WN4PA(dst + 0, dc);
590 42976 AV_WN4PA(dst + 4, dc);
591 42976 AV_WN4PA(dst + 8, dc);
592 42976 AV_WN4PA(dst + 12, dc);
593 42976 AV_WN4PA(dst + 16, dc);
594 42976 AV_WN4PA(dst + 20, dc);
595 42976 AV_WN4PA(dst + 24, dc);
596 42976 AV_WN4PA(dst + 28, dc);
597 42976 dst += stride;
598 }
599 1343 }
600
601 #endif /* BIT_DEPTH != 12 */
602
603 389 static void dc_128_4x4_c(uint8_t *_dst, ptrdiff_t stride,
604 const uint8_t *left, const uint8_t *top)
605 {
606 389 pixel *dst = (pixel *) _dst;
607 389 pixel4 val = PIXEL_SPLAT_X4(128 << (BIT_DEPTH - 8));
608
609 389 stride /= sizeof(pixel);
610 389 AV_WN4PA(dst + stride * 0, val);
611 389 AV_WN4PA(dst + stride * 1, val);
612 389 AV_WN4PA(dst + stride * 2, val);
613 389 AV_WN4PA(dst + stride * 3, val);
614 389 }
615
616 226 static void dc_128_8x8_c(uint8_t *_dst, ptrdiff_t stride,
617 const uint8_t *left, const uint8_t *top)
618 {
619 226 pixel *dst = (pixel *) _dst;
620 226 pixel4 val = PIXEL_SPLAT_X4(128 << (BIT_DEPTH - 8));
621 int y;
622
623 226 stride /= sizeof(pixel);
624
2/2
✓ Branch 0 taken 1808 times.
✓ Branch 1 taken 226 times.
2034 for (y = 0; y < 8; y++) {
625 1808 AV_WN4PA(dst + 0, val);
626 1808 AV_WN4PA(dst + 4, val);
627 1808 dst += stride;
628 }
629 226 }
630
631 158 static void dc_128_16x16_c(uint8_t *_dst, ptrdiff_t stride,
632 const uint8_t *left, const uint8_t *top)
633 {
634 158 pixel *dst = (pixel *) _dst;
635 158 pixel4 val = PIXEL_SPLAT_X4(128 << (BIT_DEPTH - 8));
636 int y;
637
638 158 stride /= sizeof(pixel);
639
2/2
✓ Branch 0 taken 2528 times.
✓ Branch 1 taken 158 times.
2686 for (y = 0; y < 16; y++) {
640 2528 AV_WN4PA(dst + 0, val);
641 2528 AV_WN4PA(dst + 4, val);
642 2528 AV_WN4PA(dst + 8, val);
643 2528 AV_WN4PA(dst + 12, val);
644 2528 dst += stride;
645 }
646 158 }
647
648 142 static void dc_128_32x32_c(uint8_t *_dst, ptrdiff_t stride,
649 const uint8_t *left, const uint8_t *top)
650 {
651 142 pixel *dst = (pixel *) _dst;
652 142 pixel4 val = PIXEL_SPLAT_X4(128 << (BIT_DEPTH - 8));
653 int y;
654
655 142 stride /= sizeof(pixel);
656
2/2
✓ Branch 0 taken 4544 times.
✓ Branch 1 taken 142 times.
4686 for (y = 0; y < 32; y++) {
657 4544 AV_WN4PA(dst + 0, val);
658 4544 AV_WN4PA(dst + 4, val);
659 4544 AV_WN4PA(dst + 8, val);
660 4544 AV_WN4PA(dst + 12, val);
661 4544 AV_WN4PA(dst + 16, val);
662 4544 AV_WN4PA(dst + 20, val);
663 4544 AV_WN4PA(dst + 24, val);
664 4544 AV_WN4PA(dst + 28, val);
665 4544 dst += stride;
666 }
667 142 }
668
669 2531 static void dc_127_4x4_c(uint8_t *_dst, ptrdiff_t stride,
670 const uint8_t *left, const uint8_t *top)
671 {
672 2531 pixel *dst = (pixel *) _dst;
673 2531 pixel4 val = PIXEL_SPLAT_X4((128 << (BIT_DEPTH - 8)) - 1);
674
675 2531 stride /= sizeof(pixel);
676 2531 AV_WN4PA(dst + stride * 0, val);
677 2531 AV_WN4PA(dst + stride * 1, val);
678 2531 AV_WN4PA(dst + stride * 2, val);
679 2531 AV_WN4PA(dst + stride * 3, val);}
680
681 337 static void dc_127_8x8_c(uint8_t *_dst, ptrdiff_t stride,
682 const uint8_t *left, const uint8_t *top)
683 {
684 337 pixel *dst = (pixel *) _dst;
685 337 pixel4 val = PIXEL_SPLAT_X4((128 << (BIT_DEPTH - 8)) - 1);
686 int y;
687
688 337 stride /= sizeof(pixel);
689
2/2
✓ Branch 0 taken 2696 times.
✓ Branch 1 taken 337 times.
3033 for (y = 0; y < 8; y++) {
690 2696 AV_WN4PA(dst + 0, val);
691 2696 AV_WN4PA(dst + 4, val);
692 2696 dst += stride;
693 }
694 337 }
695
696 181 static void dc_127_16x16_c(uint8_t *_dst, ptrdiff_t stride,
697 const uint8_t *left, const uint8_t *top)
698 {
699 181 pixel *dst = (pixel *) _dst;
700 181 pixel4 val = PIXEL_SPLAT_X4((128 << (BIT_DEPTH - 8)) - 1);
701 int y;
702
703 181 stride /= sizeof(pixel);
704
2/2
✓ Branch 0 taken 2896 times.
✓ Branch 1 taken 181 times.
3077 for (y = 0; y < 16; y++) {
705 2896 AV_WN4PA(dst + 0, val);
706 2896 AV_WN4PA(dst + 4, val);
707 2896 AV_WN4PA(dst + 8, val);
708 2896 AV_WN4PA(dst + 12, val);
709 2896 dst += stride;
710 }
711 181 }
712
713 86 static void dc_127_32x32_c(uint8_t *_dst, ptrdiff_t stride,
714 const uint8_t *left, const uint8_t *top)
715 {
716 86 pixel *dst = (pixel *) _dst;
717 86 pixel4 val = PIXEL_SPLAT_X4((128 << (BIT_DEPTH - 8)) - 1);
718 int y;
719
720 86 stride /= sizeof(pixel);
721
2/2
✓ Branch 0 taken 2752 times.
✓ Branch 1 taken 86 times.
2838 for (y = 0; y < 32; y++) {
722 2752 AV_WN4PA(dst + 0, val);
723 2752 AV_WN4PA(dst + 4, val);
724 2752 AV_WN4PA(dst + 8, val);
725 2752 AV_WN4PA(dst + 12, val);
726 2752 AV_WN4PA(dst + 16, val);
727 2752 AV_WN4PA(dst + 20, val);
728 2752 AV_WN4PA(dst + 24, val);
729 2752 AV_WN4PA(dst + 28, val);
730 2752 dst += stride;
731 }
732 86 }
733
734 2232 static void dc_129_4x4_c(uint8_t *_dst, ptrdiff_t stride,
735 const uint8_t *left, const uint8_t *top)
736 {
737 2232 pixel *dst = (pixel *) _dst;
738 2232 pixel4 val = PIXEL_SPLAT_X4((128 << (BIT_DEPTH - 8)) + 1);
739
740 2232 stride /= sizeof(pixel);
741 2232 AV_WN4PA(dst + stride * 0, val);
742 2232 AV_WN4PA(dst + stride * 1, val);
743 2232 AV_WN4PA(dst + stride * 2, val);
744 2232 AV_WN4PA(dst + stride * 3, val);
745 2232 }
746
747 351 static void dc_129_8x8_c(uint8_t *_dst, ptrdiff_t stride,
748 const uint8_t *left, const uint8_t *top)
749 {
750 351 pixel *dst = (pixel *) _dst;
751 351 pixel4 val = PIXEL_SPLAT_X4((128 << (BIT_DEPTH - 8)) + 1);
752 int y;
753
754 351 stride /= sizeof(pixel);
755
2/2
✓ Branch 0 taken 2808 times.
✓ Branch 1 taken 351 times.
3159 for (y = 0; y < 8; y++) {
756 2808 AV_WN4PA(dst + 0, val);
757 2808 AV_WN4PA(dst + 4, val);
758 2808 dst += stride;
759 }
760 351 }
761
762 261 static void dc_129_16x16_c(uint8_t *_dst, ptrdiff_t stride,
763 const uint8_t *left, const uint8_t *top)
764 {
765 261 pixel *dst = (pixel *) _dst;
766 261 pixel4 val = PIXEL_SPLAT_X4((128 << (BIT_DEPTH - 8)) + 1);
767 int y;
768
769 261 stride /= sizeof(pixel);
770
2/2
✓ Branch 0 taken 4176 times.
✓ Branch 1 taken 261 times.
4437 for (y = 0; y < 16; y++) {
771 4176 AV_WN4PA(dst + 0, val);
772 4176 AV_WN4PA(dst + 4, val);
773 4176 AV_WN4PA(dst + 8, val);
774 4176 AV_WN4PA(dst + 12, val);
775 4176 dst += stride;
776 }
777 261 }
778
779 143 static void dc_129_32x32_c(uint8_t *_dst, ptrdiff_t stride,
780 const uint8_t *left, const uint8_t *top)
781 {
782 143 pixel *dst = (pixel *) _dst;
783 143 pixel4 val = PIXEL_SPLAT_X4((128 << (BIT_DEPTH - 8)) + 1);
784 int y;
785
786 143 stride /= sizeof(pixel);
787
2/2
✓ Branch 0 taken 4576 times.
✓ Branch 1 taken 143 times.
4719 for (y = 0; y < 32; y++) {
788 4576 AV_WN4PA(dst + 0, val);
789 4576 AV_WN4PA(dst + 4, val);
790 4576 AV_WN4PA(dst + 8, val);
791 4576 AV_WN4PA(dst + 12, val);
792 4576 AV_WN4PA(dst + 16, val);
793 4576 AV_WN4PA(dst + 20, val);
794 4576 AV_WN4PA(dst + 24, val);
795 4576 AV_WN4PA(dst + 28, val);
796 4576 dst += stride;
797 }
798 143 }
799
800 #if BIT_DEPTH != 12
801
802 #if BIT_DEPTH == 8
803 #define memset_bpc memset
804 #else
805 8320 static inline void memset_bpc(uint16_t *dst, int val, int len) {
806 int n;
807
2/2
✓ Branch 0 taken 48128 times.
✓ Branch 1 taken 8320 times.
56448 for (n = 0; n < len; n++) {
808 48128 dst[n] = val;
809 }
810 8320 }
811 #endif
812
813 #define DST(x, y) dst[(x) + (y) * stride]
814
815 20367 static void diag_downleft_4x4_c(uint8_t *_dst, ptrdiff_t stride,
816 const uint8_t *left, const uint8_t *_top)
817 {
818 20367 pixel *dst = (pixel *) _dst;
819 20367 const pixel *top = (const pixel *) _top;
820 20367 int a0 = top[0], a1 = top[1], a2 = top[2], a3 = top[3],
821 20367 a4 = top[4], a5 = top[5], a6 = top[6], a7 = top[7];
822
823 20367 stride /= sizeof(pixel);
824 20367 DST(0,0) = (a0 + a1 * 2 + a2 + 2) >> 2;
825 20367 DST(1,0) = DST(0,1) = (a1 + a2 * 2 + a3 + 2) >> 2;
826 20367 DST(2,0) = DST(1,1) = DST(0,2) = (a2 + a3 * 2 + a4 + 2) >> 2;
827 20367 DST(3,0) = DST(2,1) = DST(1,2) = DST(0,3) = (a3 + a4 * 2 + a5 + 2) >> 2;
828 20367 DST(3,1) = DST(2,2) = DST(1,3) = (a4 + a5 * 2 + a6 + 2) >> 2;
829 20367 DST(3,2) = DST(2,3) = (a5 + a6 * 2 + a7 + 2) >> 2;
830 20367 DST(3,3) = a7; // note: this is different from vp8 and such
831 20367 }
832
833 #define def_diag_downleft(size) \
834 static void diag_downleft_##size##x##size##_c(uint8_t *_dst, ptrdiff_t stride, \
835 const uint8_t *left, const uint8_t *_top) \
836 { \
837 pixel *dst = (pixel *) _dst; \
838 const pixel *top = (const pixel *) _top; \
839 int i, j; \
840 pixel v[size - 1]; \
841 \
842 stride /= sizeof(pixel); \
843 for (i = 0; i < size - 2; i++) \
844 v[i] = (top[i] + top[i + 1] * 2 + top[i + 2] + 2) >> 2; \
845 v[size - 2] = (top[size - 2] + top[size - 1] * 3 + 2) >> 2; \
846 \
847 for (j = 0; j < size; j++) { \
848 memcpy(dst + j*stride, v + j, (size - 1 - j) * sizeof(pixel)); \
849 memset_bpc(dst + j*stride + size - 1 - j, top[size - 1], j + 1); \
850 } \
851 }
852
853
5/5
✓ Branch 0 taken 34032 times.
✓ Branch 1 taken 5672 times.
✓ Branch 2 taken 44120 times.
✓ Branch 3 taken 6771 times.
✓ Branch 4 taken 157 times.
85080 def_diag_downleft(8)
854
5/5
✓ Branch 0 taken 15834 times.
✓ Branch 1 taken 1131 times.
✓ Branch 2 taken 17872 times.
✓ Branch 3 taken 1341 times.
✓ Branch 4 taken 14 times.
35061 def_diag_downleft(16)
855
5/5
✓ Branch 0 taken 4650 times.
✓ Branch 1 taken 155 times.
✓ Branch 2 taken 4320 times.
✓ Branch 3 taken 775 times.
✓ Branch 4 taken 20 times.
9765 def_diag_downleft(32)
856
857 57830 static void diag_downright_4x4_c(uint8_t *_dst, ptrdiff_t stride,
858 const uint8_t *_left, const uint8_t *_top)
859 {
860 57830 pixel *dst = (pixel *) _dst;
861 57830 const pixel *top = (const pixel *) _top;
862 57830 const pixel *left = (const pixel *) _left;
863 57830 int tl = top[-1], a0 = top[0], a1 = top[1], a2 = top[2], a3 = top[3],
864 57830 l0 = left[3], l1 = left[2], l2 = left[1], l3 = left[0];
865
866 57830 stride /= sizeof(pixel);
867 57830 DST(0,3) = (l1 + l2 * 2 + l3 + 2) >> 2;
868 57830 DST(0,2) = DST(1,3) = (l0 + l1 * 2 + l2 + 2) >> 2;
869 57830 DST(0,1) = DST(1,2) = DST(2,3) = (tl + l0 * 2 + l1 + 2) >> 2;
870 57830 DST(0,0) = DST(1,1) = DST(2,2) = DST(3,3) = (l0 + tl * 2 + a0 + 2) >> 2;
871 57830 DST(1,0) = DST(2,1) = DST(3,2) = (tl + a0 * 2 + a1 + 2) >> 2;
872 57830 DST(2,0) = DST(3,1) = (a0 + a1 * 2 + a2 + 2) >> 2;
873 57830 DST(3,0) = (a1 + a2 * 2 + a3 + 2) >> 2;
874 57830 }
875
876 #define def_diag_downright(size) \
877 static void diag_downright_##size##x##size##_c(uint8_t *_dst, ptrdiff_t stride, \
878 const uint8_t *_left, const uint8_t *_top) \
879 { \
880 pixel *dst = (pixel *) _dst; \
881 const pixel *top = (const pixel *) _top; \
882 const pixel *left = (const pixel *) _left; \
883 int i, j; \
884 pixel v[size + size - 1]; \
885 \
886 stride /= sizeof(pixel); \
887 for (i = 0; i < size - 2; i++) { \
888 v[i ] = (left[i] + left[i + 1] * 2 + left[i + 2] + 2) >> 2; \
889 v[size + 1 + i] = (top[i] + top[i + 1] * 2 + top[i + 2] + 2) >> 2; \
890 } \
891 v[size - 2] = (left[size - 2] + left[size - 1] * 2 + top[-1] + 2) >> 2; \
892 v[size - 1] = (left[size - 1] + top[-1] * 2 + top[ 0] + 2) >> 2; \
893 v[size ] = (top[-1] + top[0] * 2 + top[ 1] + 2) >> 2; \
894 \
895 for (j = 0; j < size; j++) \
896 memcpy(dst + j*stride, v + size - 1 - j, size * sizeof(pixel)); \
897 }
898
899
4/4
✓ Branch 0 taken 41118 times.
✓ Branch 1 taken 6853 times.
✓ Branch 2 taken 54824 times.
✓ Branch 3 taken 6853 times.
102795 def_diag_downright(8)
900
4/4
✓ Branch 0 taken 12796 times.
✓ Branch 1 taken 914 times.
✓ Branch 2 taken 14624 times.
✓ Branch 3 taken 914 times.
28334 def_diag_downright(16)
901
4/4
✓ Branch 0 taken 5190 times.
✓ Branch 1 taken 173 times.
✓ Branch 2 taken 5536 times.
✓ Branch 3 taken 173 times.
10899 def_diag_downright(32)
902
903 44168 static void vert_right_4x4_c(uint8_t *_dst, ptrdiff_t stride,
904 const uint8_t *_left, const uint8_t *_top)
905 {
906 44168 pixel *dst = (pixel *) _dst;
907 44168 const pixel *top = (const pixel *) _top;
908 44168 const pixel *left = (const pixel *) _left;
909 44168 int tl = top[-1], a0 = top[0], a1 = top[1], a2 = top[2], a3 = top[3],
910 44168 l0 = left[3], l1 = left[2], l2 = left[1];
911
912 44168 stride /= sizeof(pixel);
913 44168 DST(0,3) = (l0 + l1 * 2 + l2 + 2) >> 2;
914 44168 DST(0,2) = (tl + l0 * 2 + l1 + 2) >> 2;
915 44168 DST(0,0) = DST(1,2) = (tl + a0 + 1) >> 1;
916 44168 DST(0,1) = DST(1,3) = (l0 + tl * 2 + a0 + 2) >> 2;
917 44168 DST(1,0) = DST(2,2) = (a0 + a1 + 1) >> 1;
918 44168 DST(1,1) = DST(2,3) = (tl + a0 * 2 + a1 + 2) >> 2;
919 44168 DST(2,0) = DST(3,2) = (a1 + a2 + 1) >> 1;
920 44168 DST(2,1) = DST(3,3) = (a0 + a1 * 2 + a2 + 2) >> 2;
921 44168 DST(3,0) = (a2 + a3 + 1) >> 1;
922 44168 DST(3,1) = (a1 + a2 * 2 + a3 + 2) >> 2;
923 44168 }
924
925 #define def_vert_right(size) \
926 static void vert_right_##size##x##size##_c(uint8_t *_dst, ptrdiff_t stride, \
927 const uint8_t *_left, const uint8_t *_top) \
928 { \
929 pixel *dst = (pixel *) _dst; \
930 const pixel *top = (const pixel *) _top; \
931 const pixel *left = (const pixel *) _left; \
932 int i, j; \
933 pixel ve[size + size/2 - 1], vo[size + size/2 - 1]; \
934 \
935 stride /= sizeof(pixel); \
936 for (i = 0; i < size/2 - 2; i++) { \
937 vo[i] = (left[i*2 + 3] + left[i*2 + 2] * 2 + left[i*2 + 1] + 2) >> 2; \
938 ve[i] = (left[i*2 + 4] + left[i*2 + 3] * 2 + left[i*2 + 2] + 2) >> 2; \
939 } \
940 vo[size/2 - 2] = (left[size - 1] + left[size - 2] * 2 + left[size - 3] + 2) >> 2; \
941 ve[size/2 - 2] = (top[-1] + left[size - 1] * 2 + left[size - 2] + 2) >> 2; \
942 \
943 ve[size/2 - 1] = (top[-1] + top[0] + 1) >> 1; \
944 vo[size/2 - 1] = (left[size - 1] + top[-1] * 2 + top[0] + 2) >> 2; \
945 for (i = 0; i < size - 1; i++) { \
946 ve[size/2 + i] = (top[i] + top[i + 1] + 1) >> 1; \
947 vo[size/2 + i] = (top[i - 1] + top[i] * 2 + top[i + 1] + 2) >> 2; \
948 } \
949 \
950 for (j = 0; j < size / 2; j++) { \
951 memcpy(dst + j*2 *stride, ve + size/2 - 1 - j, size * sizeof(pixel)); \
952 memcpy(dst + (j*2 + 1)*stride, vo + size/2 - 1 - j, size * sizeof(pixel)); \
953 } \
954 }
955
956
6/6
✓ Branch 0 taken 9744 times.
✓ Branch 1 taken 4872 times.
✓ Branch 2 taken 34104 times.
✓ Branch 3 taken 4872 times.
✓ Branch 4 taken 19488 times.
✓ Branch 5 taken 4872 times.
68208 def_vert_right(8)
957
6/6
✓ Branch 0 taken 5628 times.
✓ Branch 1 taken 938 times.
✓ Branch 2 taken 14070 times.
✓ Branch 3 taken 938 times.
✓ Branch 4 taken 7504 times.
✓ Branch 5 taken 938 times.
28140 def_vert_right(16)
958
6/6
✓ Branch 0 taken 2688 times.
✓ Branch 1 taken 192 times.
✓ Branch 2 taken 5952 times.
✓ Branch 3 taken 192 times.
✓ Branch 4 taken 3072 times.
✓ Branch 5 taken 192 times.
11904 def_vert_right(32)
959
960 47552 static void hor_down_4x4_c(uint8_t *_dst, ptrdiff_t stride,
961 const uint8_t *_left, const uint8_t *_top)
962 {
963 47552 pixel *dst = (pixel *) _dst;
964 47552 const pixel *top = (const pixel *) _top;
965 47552 const pixel *left = (const pixel *) _left;
966 47552 int l0 = left[3], l1 = left[2], l2 = left[1], l3 = left[0],
967 47552 tl = top[-1], a0 = top[0], a1 = top[1], a2 = top[2];
968
969 47552 stride /= sizeof(pixel);
970 47552 DST(2,0) = (tl + a0 * 2 + a1 + 2) >> 2;
971 47552 DST(3,0) = (a0 + a1 * 2 + a2 + 2) >> 2;
972 47552 DST(0,0) = DST(2,1) = (tl + l0 + 1) >> 1;
973 47552 DST(1,0) = DST(3,1) = (a0 + tl * 2 + l0 + 2) >> 2;
974 47552 DST(0,1) = DST(2,2) = (l0 + l1 + 1) >> 1;
975 47552 DST(1,1) = DST(3,2) = (tl + l0 * 2 + l1 + 2) >> 2;
976 47552 DST(0,2) = DST(2,3) = (l1 + l2 + 1) >> 1;
977 47552 DST(1,2) = DST(3,3) = (l0 + l1 * 2 + l2 + 2) >> 2;
978 47552 DST(0,3) = (l2 + l3 + 1) >> 1;
979 47552 DST(1,3) = (l1 + l2 * 2 + l3 + 2) >> 2;
980 47552 }
981
982 #define def_hor_down(size) \
983 static void hor_down_##size##x##size##_c(uint8_t *_dst, ptrdiff_t stride, \
984 const uint8_t *_left, const uint8_t *_top) \
985 { \
986 pixel *dst = (pixel *) _dst; \
987 const pixel *top = (const pixel *) _top; \
988 const pixel *left = (const pixel *) _left; \
989 int i, j; \
990 pixel v[size * 3 - 2]; \
991 \
992 stride /= sizeof(pixel); \
993 for (i = 0; i < size - 2; i++) { \
994 v[i*2 ] = (left[i + 1] + left[i + 0] + 1) >> 1; \
995 v[i*2 + 1] = (left[i + 2] + left[i + 1] * 2 + left[i + 0] + 2) >> 2; \
996 v[size*2 + i] = (top[i - 1] + top[i] * 2 + top[i + 1] + 2) >> 2; \
997 } \
998 v[size*2 - 2] = (top[-1] + left[size - 1] + 1) >> 1; \
999 v[size*2 - 4] = (left[size - 1] + left[size - 2] + 1) >> 1; \
1000 v[size*2 - 1] = (top[0] + top[-1] * 2 + left[size - 1] + 2) >> 2; \
1001 v[size*2 - 3] = (top[-1] + left[size - 1] * 2 + left[size - 2] + 2) >> 2; \
1002 \
1003 for (j = 0; j < size; j++) \
1004 memcpy(dst + j*stride, v + size*2 - 2 - j*2, size * sizeof(pixel)); \
1005 }
1006
1007
4/4
✓ Branch 0 taken 30366 times.
✓ Branch 1 taken 5061 times.
✓ Branch 2 taken 40488 times.
✓ Branch 3 taken 5061 times.
75915 def_hor_down(8)
1008
4/4
✓ Branch 0 taken 8190 times.
✓ Branch 1 taken 585 times.
✓ Branch 2 taken 9360 times.
✓ Branch 3 taken 585 times.
18135 def_hor_down(16)
1009
4/4
✓ Branch 0 taken 2400 times.
✓ Branch 1 taken 80 times.
✓ Branch 2 taken 2560 times.
✓ Branch 3 taken 80 times.
5040 def_hor_down(32)
1010
1011 36965 static void vert_left_4x4_c(uint8_t *_dst, ptrdiff_t stride,
1012 const uint8_t *left, const uint8_t *_top)
1013 {
1014 36965 pixel *dst = (pixel *) _dst;
1015 36965 const pixel *top = (const pixel *) _top;
1016 36965 int a0 = top[0], a1 = top[1], a2 = top[2], a3 = top[3],
1017 36965 a4 = top[4], a5 = top[5], a6 = top[6];
1018
1019 36965 stride /= sizeof(pixel);
1020 36965 DST(0,0) = (a0 + a1 + 1) >> 1;
1021 36965 DST(0,1) = (a0 + a1 * 2 + a2 + 2) >> 2;
1022 36965 DST(1,0) = DST(0,2) = (a1 + a2 + 1) >> 1;
1023 36965 DST(1,1) = DST(0,3) = (a1 + a2 * 2 + a3 + 2) >> 2;
1024 36965 DST(2,0) = DST(1,2) = (a2 + a3 + 1) >> 1;
1025 36965 DST(2,1) = DST(1,3) = (a2 + a3 * 2 + a4 + 2) >> 2;
1026 36965 DST(3,0) = DST(2,2) = (a3 + a4 + 1) >> 1;
1027 36965 DST(3,1) = DST(2,3) = (a3 + a4 * 2 + a5 + 2) >> 2;
1028 36965 DST(3,2) = (a4 + a5 + 1) >> 1;
1029 36965 DST(3,3) = (a4 + a5 * 2 + a6 + 2) >> 2;
1030 36965 }
1031
1032 #define def_vert_left(size) \
1033 static void vert_left_##size##x##size##_c(uint8_t *_dst, ptrdiff_t stride, \
1034 const uint8_t *left, const uint8_t *_top) \
1035 { \
1036 pixel *dst = (pixel *) _dst; \
1037 const pixel *top = (const pixel *) _top; \
1038 int i, j; \
1039 pixel ve[size - 1], vo[size - 1]; \
1040 \
1041 stride /= sizeof(pixel); \
1042 for (i = 0; i < size - 2; i++) { \
1043 ve[i] = (top[i] + top[i + 1] + 1) >> 1; \
1044 vo[i] = (top[i] + top[i + 1] * 2 + top[i + 2] + 2) >> 2; \
1045 } \
1046 ve[size - 2] = (top[size - 2] + top[size - 1] + 1) >> 1; \
1047 vo[size - 2] = (top[size - 2] + top[size - 1] * 3 + 2) >> 2; \
1048 \
1049 for (j = 0; j < size / 2; j++) { \
1050 memcpy(dst + j*2 * stride, ve + j, (size - j - 1) * sizeof(pixel)); \
1051 memset_bpc(dst + j*2 * stride + size - j - 1, top[size - 1], j + 1); \
1052 memcpy(dst + (j*2 + 1) * stride, vo + j, (size - j - 1) * sizeof(pixel)); \
1053 memset_bpc(dst + (j*2 + 1) * stride + size - j - 1, top[size - 1], j + 1); \
1054 } \
1055 }
1056
1057
6/6
✓ Branch 0 taken 39870 times.
✓ Branch 1 taken 6645 times.
✓ Branch 2 taken 25400 times.
✓ Branch 3 taken 6350 times.
✓ Branch 4 taken 1180 times.
✓ Branch 5 taken 295 times.
73095 def_vert_left(8)
1058
6/6
✓ Branch 0 taken 19432 times.
✓ Branch 1 taken 1388 times.
✓ Branch 2 taken 10384 times.
✓ Branch 3 taken 1298 times.
✓ Branch 4 taken 720 times.
✓ Branch 5 taken 90 times.
31924 def_vert_left(16)
1059
6/6
✓ Branch 0 taken 5850 times.
✓ Branch 1 taken 195 times.
✓ Branch 2 taken 2928 times.
✓ Branch 3 taken 183 times.
✓ Branch 4 taken 192 times.
✓ Branch 5 taken 12 times.
9165 def_vert_left(32)
1060
1061 51469 static void hor_up_4x4_c(uint8_t *_dst, ptrdiff_t stride,
1062 const uint8_t *_left, const uint8_t *top)
1063 {
1064 51469 pixel *dst = (pixel *) _dst;
1065 51469 const pixel *left = (const pixel *) _left;
1066 51469 int l0 = left[0], l1 = left[1], l2 = left[2], l3 = left[3];
1067
1068 51469 stride /= sizeof(pixel);
1069 51469 DST(0,0) = (l0 + l1 + 1) >> 1;
1070 51469 DST(1,0) = (l0 + l1 * 2 + l2 + 2) >> 2;
1071 51469 DST(0,1) = DST(2,0) = (l1 + l2 + 1) >> 1;
1072 51469 DST(1,1) = DST(3,0) = (l1 + l2 * 2 + l3 + 2) >> 2;
1073 51469 DST(0,2) = DST(2,1) = (l2 + l3 + 1) >> 1;
1074 51469 DST(1,2) = DST(3,1) = (l2 + l3 * 3 + 2) >> 2;
1075 51469 DST(0,3) = DST(1,3) = DST(2,2) = DST(2,3) = DST(3,2) = DST(3,3) = l3;
1076 51469 }
1077
1078 #define def_hor_up(size) \
1079 static void hor_up_##size##x##size##_c(uint8_t *_dst, ptrdiff_t stride, \
1080 const uint8_t *_left, const uint8_t *top) \
1081 { \
1082 pixel *dst = (pixel *) _dst; \
1083 const pixel *left = (const pixel *) _left; \
1084 int i, j; \
1085 pixel v[size*2 - 2]; \
1086 \
1087 stride /= sizeof(pixel); \
1088 for (i = 0; i < size - 2; i++) { \
1089 v[i*2 ] = (left[i] + left[i + 1] + 1) >> 1; \
1090 v[i*2 + 1] = (left[i] + left[i + 1] * 2 + left[i + 2] + 2) >> 2; \
1091 } \
1092 v[size*2 - 4] = (left[size - 2] + left[size - 1] + 1) >> 1; \
1093 v[size*2 - 3] = (left[size - 2] + left[size - 1] * 3 + 2) >> 2; \
1094 \
1095 for (j = 0; j < size / 2; j++) \
1096 memcpy(dst + j*stride, v + j*2, size * sizeof(pixel)); \
1097 for (j = size / 2; j < size; j++) { \
1098 memcpy(dst + j*stride, v + j*2, (size*2 - 2 - j*2) * sizeof(pixel)); \
1099 memset_bpc(dst + j*stride + size*2 - 2 - j*2, left[size - 1], \
1100 2 + j*2 - size); \
1101 } \
1102 }
1103
1104
7/7
✓ Branch 0 taken 58164 times.
✓ Branch 1 taken 9694 times.
✓ Branch 2 taken 38776 times.
✓ Branch 3 taken 9694 times.
✓ Branch 4 taken 37256 times.
✓ Branch 5 taken 10834 times.
✓ Branch 6 taken 380 times.
145410 def_hor_up(8)
1105
7/7
✓ Branch 0 taken 25018 times.
✓ Branch 1 taken 1787 times.
✓ Branch 2 taken 14296 times.
✓ Branch 3 taken 1787 times.
✓ Branch 4 taken 14088 times.
✓ Branch 5 taken 1969 times.
✓ Branch 6 taken 26 times.
55397 def_hor_up(16)
1106
7/7
✓ Branch 0 taken 5130 times.
✓ Branch 1 taken 171 times.
✓ Branch 2 taken 2736 times.
✓ Branch 3 taken 171 times.
✓ Branch 4 taken 2448 times.
✓ Branch 5 taken 441 times.
✓ Branch 6 taken 18 times.
10773 def_hor_up(32)
1107
1108 #undef DST
1109
1110 #endif /* BIT_DEPTH != 12 */
1111
1112 #if BIT_DEPTH != 8
1113 void ff_vp9dsp_intrapred_init_10(VP9DSPContext *dsp);
1114 #endif
1115 #if BIT_DEPTH != 10
1116 static
1117 #endif
1118 769 av_cold void FUNC(ff_vp9dsp_intrapred_init)(VP9DSPContext *dsp)
1119 {
1120 #define init_intra_pred_bd_aware(tx, sz) \
1121 dsp->intra_pred[tx][TM_VP8_PRED] = tm_##sz##_c; \
1122 dsp->intra_pred[tx][DC_128_PRED] = dc_128_##sz##_c; \
1123 dsp->intra_pred[tx][DC_127_PRED] = dc_127_##sz##_c; \
1124 dsp->intra_pred[tx][DC_129_PRED] = dc_129_##sz##_c
1125
1126 #if BIT_DEPTH == 12
1127 80 ff_vp9dsp_intrapred_init_10(dsp);
1128 #define init_intra_pred(tx, sz) \
1129 init_intra_pred_bd_aware(tx, sz)
1130 #else
1131 #define init_intra_pred(tx, sz) \
1132 dsp->intra_pred[tx][VERT_PRED] = vert_##sz##_c; \
1133 dsp->intra_pred[tx][HOR_PRED] = hor_##sz##_c; \
1134 dsp->intra_pred[tx][DC_PRED] = dc_##sz##_c; \
1135 dsp->intra_pred[tx][DIAG_DOWN_LEFT_PRED] = diag_downleft_##sz##_c; \
1136 dsp->intra_pred[tx][DIAG_DOWN_RIGHT_PRED] = diag_downright_##sz##_c; \
1137 dsp->intra_pred[tx][VERT_RIGHT_PRED] = vert_right_##sz##_c; \
1138 dsp->intra_pred[tx][HOR_DOWN_PRED] = hor_down_##sz##_c; \
1139 dsp->intra_pred[tx][VERT_LEFT_PRED] = vert_left_##sz##_c; \
1140 dsp->intra_pred[tx][HOR_UP_PRED] = hor_up_##sz##_c; \
1141 dsp->intra_pred[tx][LEFT_DC_PRED] = dc_left_##sz##_c; \
1142 dsp->intra_pred[tx][TOP_DC_PRED] = dc_top_##sz##_c; \
1143 init_intra_pred_bd_aware(tx, sz)
1144 #endif
1145
1146 769 init_intra_pred(TX_4X4, 4x4);
1147 769 init_intra_pred(TX_8X8, 8x8);
1148 769 init_intra_pred(TX_16X16, 16x16);
1149 769 init_intra_pred(TX_32X32, 32x32);
1150
1151 #undef init_intra_pred
1152 #undef init_intra_pred_bd_aware
1153 769 }
1154
1155 #define itxfm_wrapper(type_a, type_b, sz, bits, has_dconly) \
1156 static void type_a##_##type_b##_##sz##x##sz##_add_c(uint8_t *_dst, \
1157 ptrdiff_t stride, \
1158 int16_t *_block, int eob) \
1159 { \
1160 int i, j; \
1161 pixel *dst = (pixel *) _dst; \
1162 dctcoef *block = (dctcoef *) _block, tmp[sz * sz], out[sz]; \
1163 \
1164 stride /= sizeof(pixel); \
1165 if (has_dconly && eob == 1) { \
1166 const int t = ((((dctint) block[0] * 11585 + (1 << 13)) >> 14) \
1167 * 11585 + (1 << 13)) >> 14; \
1168 block[0] = 0; \
1169 for (i = 0; i < sz; i++) { \
1170 for (j = 0; j < sz; j++) \
1171 dst[j * stride] = av_clip_pixel(dst[j * stride] + \
1172 (bits ? \
1173 (int)(t + (1U << (bits - 1))) >> bits : \
1174 t)); \
1175 dst++; \
1176 } \
1177 return; \
1178 } \
1179 \
1180 for (i = 0; i < sz; i++) \
1181 type_a##sz##_1d(block + i, sz, tmp + i * sz, 0); \
1182 memset(block, 0, sz * sz * sizeof(*block)); \
1183 for (i = 0; i < sz; i++) { \
1184 type_b##sz##_1d(tmp + i, sz, out, 1); \
1185 for (j = 0; j < sz; j++) \
1186 dst[j * stride] = av_clip_pixel(dst[j * stride] + \
1187 (bits ? \
1188 (int)(out[j] + (1U << (bits - 1))) >> bits : \
1189 out[j])); \
1190 dst++; \
1191 } \
1192 }
1193
1194 #define itxfm_wrap(sz, bits) \
1195 itxfm_wrapper(idct, idct, sz, bits, 1) \
1196 itxfm_wrapper(iadst, idct, sz, bits, 0) \
1197 itxfm_wrapper(idct, iadst, sz, bits, 0) \
1198 itxfm_wrapper(iadst, iadst, sz, bits, 0)
1199
1200 #define IN(x) ((dctint) in[(x) * stride])
1201
1202 3507436 static av_always_inline void idct4_1d(const dctcoef *in, ptrdiff_t stride,
1203 dctcoef *out, int pass)
1204 {
1205 dctint t0, t1, t2, t3;
1206
1207 3507436 t0 = ((IN(0) + IN(2)) * 11585 + (1 << 13)) >> 14;
1208 3507436 t1 = ((IN(0) - IN(2)) * 11585 + (1 << 13)) >> 14;
1209 3507436 t2 = (IN(1) * 6270 - IN(3) * 15137 + (1 << 13)) >> 14;
1210 3507436 t3 = (IN(1) * 15137 + IN(3) * 6270 + (1 << 13)) >> 14;
1211
1212 3507436 out[0] = t0 + t3;
1213 3507436 out[1] = t1 + t2;
1214 3507436 out[2] = t1 - t2;
1215 3507436 out[3] = t0 - t3;
1216 3507436 }
1217
1218 1519068 static av_always_inline void iadst4_1d(const dctcoef *in, ptrdiff_t stride,
1219 dctcoef *out, int pass)
1220 {
1221 dctint t0, t1, t2, t3;
1222
1223 1519068 t0 = 5283 * IN(0) + 15212 * IN(2) + 9929 * IN(3);
1224 1519068 t1 = 9929 * IN(0) - 5283 * IN(2) - 15212 * IN(3);
1225 1519068 t2 = 13377 * (IN(0) - IN(2) + IN(3));
1226 1519068 t3 = 13377 * IN(1);
1227
1228 1519068 out[0] = (t0 + t3 + (1 << 13)) >> 14;
1229 1519068 out[1] = (t1 + t3 + (1 << 13)) >> 14;
1230 1519068 out[2] = (t2 + (1 << 13)) >> 14;
1231 1519068 out[3] = (t0 + t1 - t3 + (1 << 13)) >> 14;
1232 1519068 }
1233
1234
13/13
✓ Branch 0 taken 113655 times.
✓ Branch 1 taken 1514486 times.
✓ Branch 2 taken 2113871 times.
✓ Branch 3 taken 454620 times.
✓ Branch 4 taken 5180876 times.
✓ Branch 5 taken 1295219 times.
✓ Branch 6 taken 1181564 times.
✓ Branch 7 taken 1627079 times.
✓ Branch 8 taken 332922 times.
✓ Branch 10 taken 5326752 times.
✓ Branch 11 taken 1331688 times.
✓ Branch 12 taken 1331688 times.
✓ Branch 13 taken 332922 times.
36189160 itxfm_wrap(4, 4)
1235
1236 2970080 static av_always_inline void idct8_1d(const dctcoef *in, ptrdiff_t stride,
1237 dctcoef *out, int pass)
1238 {
1239 dctint t0, t0a, t1, t1a, t2, t2a, t3, t3a, t4, t4a, t5, t5a, t6, t6a, t7, t7a;
1240
1241 2970080 t0a = ((IN(0) + IN(4)) * 11585 + (1 << 13)) >> 14;
1242 2970080 t1a = ((IN(0) - IN(4)) * 11585 + (1 << 13)) >> 14;
1243 2970080 t2a = (IN(2) * 6270 - IN(6) * 15137 + (1 << 13)) >> 14;
1244 2970080 t3a = (IN(2) * 15137 + IN(6) * 6270 + (1 << 13)) >> 14;
1245 2970080 t4a = (IN(1) * 3196 - IN(7) * 16069 + (1 << 13)) >> 14;
1246 2970080 t5a = (IN(5) * 13623 - IN(3) * 9102 + (1 << 13)) >> 14;
1247 2970080 t6a = (IN(5) * 9102 + IN(3) * 13623 + (1 << 13)) >> 14;
1248 2970080 t7a = (IN(1) * 16069 + IN(7) * 3196 + (1 << 13)) >> 14;
1249
1250 2970080 t0 = t0a + t3a;
1251 2970080 t1 = t1a + t2a;
1252 2970080 t2 = t1a - t2a;
1253 2970080 t3 = t0a - t3a;
1254 2970080 t4 = t4a + t5a;
1255 2970080 t5a = t4a - t5a;
1256 2970080 t7 = t7a + t6a;
1257 2970080 t6a = t7a - t6a;
1258
1259 2970080 t5 = ((t6a - t5a) * 11585 + (1 << 13)) >> 14;
1260 2970080 t6 = ((t6a + t5a) * 11585 + (1 << 13)) >> 14;
1261
1262 2970080 out[0] = t0 + t7;
1263 2970080 out[1] = t1 + t6;
1264 2970080 out[2] = t2 + t5;
1265 2970080 out[3] = t3 + t4;
1266 2970080 out[4] = t3 - t4;
1267 2970080 out[5] = t2 - t5;
1268 2970080 out[6] = t1 - t6;
1269 2970080 out[7] = t0 - t7;
1270 2970080 }
1271
1272 761504 static av_always_inline void iadst8_1d(const dctcoef *in, ptrdiff_t stride,
1273 dctcoef *out, int pass)
1274 {
1275 dctint t0, t0a, t1, t1a, t2, t2a, t3, t3a, t4, t4a, t5, t5a, t6, t6a, t7, t7a;
1276
1277 761504 t0a = 16305 * IN(7) + 1606 * IN(0);
1278 761504 t1a = 1606 * IN(7) - 16305 * IN(0);
1279 761504 t2a = 14449 * IN(5) + 7723 * IN(2);
1280 761504 t3a = 7723 * IN(5) - 14449 * IN(2);
1281 761504 t4a = 10394 * IN(3) + 12665 * IN(4);
1282 761504 t5a = 12665 * IN(3) - 10394 * IN(4);
1283 761504 t6a = 4756 * IN(1) + 15679 * IN(6);
1284 761504 t7a = 15679 * IN(1) - 4756 * IN(6);
1285
1286 761504 t0 = (t0a + t4a + (1 << 13)) >> 14;
1287 761504 t1 = (t1a + t5a + (1 << 13)) >> 14;
1288 761504 t2 = (t2a + t6a + (1 << 13)) >> 14;
1289 761504 t3 = (t3a + t7a + (1 << 13)) >> 14;
1290 761504 t4 = (t0a - t4a + (1 << 13)) >> 14;
1291 761504 t5 = (t1a - t5a + (1 << 13)) >> 14;
1292 761504 t6 = (t2a - t6a + (1 << 13)) >> 14;
1293 761504 t7 = (t3a - t7a + (1 << 13)) >> 14;
1294
1295 761504 t4a = 15137U * t4 + 6270U * t5;
1296 761504 t5a = 6270U * t4 - 15137U * t5;
1297 761504 t6a = 15137U * t7 - 6270U * t6;
1298 761504 t7a = 6270U * t7 + 15137U * t6;
1299
1300 761504 out[0] = t0 + t2;
1301 761504 out[7] = -(t1 + t3);
1302 761504 t2 = t0 - t2;
1303 761504 t3 = t1 - t3;
1304
1305 761504 out[1] = -((dctint)((1U << 13) + t4a + t6a) >> 14);
1306 761504 out[6] = (dctint)((1U << 13) + t5a + t7a) >> 14;
1307 761504 t6 = (dctint)((1U << 13) + t4a - t6a) >> 14;
1308 761504 t7 = (dctint)((1U << 13) + t5a - t7a) >> 14;
1309
1310 761504 out[3] = -((dctint)((t2 + t3) * 11585U + (1 << 13)) >> 14);
1311 761504 out[4] = (dctint)((t2 - t3) * 11585U + (1 << 13)) >> 14;
1312 761504 out[2] = (dctint)((t6 + t7) * 11585U + (1 << 13)) >> 14;
1313 761504 out[5] = -((dctint)((t6 - t7) * 11585U + (1 << 13)) >> 14);
1314 761504 }
1315
1316
13/13
✓ Branch 0 taken 34573 times.
✓ Branch 1 taken 755270 times.
✓ Branch 2 taken 2287250 times.
✓ Branch 3 taken 276584 times.
✓ Branch 4 taken 5049576 times.
✓ Branch 5 taken 631197 times.
✓ Branch 6 taken 596624 times.
✓ Branch 7 taken 1343746 times.
✓ Branch 8 taken 158646 times.
✓ Branch 10 taken 10153344 times.
✓ Branch 11 taken 1269168 times.
✓ Branch 12 taken 1269168 times.
✓ Branch 13 taken 158646 times.
42829946 itxfm_wrap(8, 5)
1317
1318 1131152 static av_always_inline void idct16_1d(const dctcoef *in, ptrdiff_t stride,
1319 dctcoef *out, int pass)
1320 {
1321 dctint t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15;
1322 dctint t0a, t1a, t2a, t3a, t4a, t5a, t6a, t7a;
1323 dctint t8a, t9a, t10a, t11a, t12a, t13a, t14a, t15a;
1324
1325 1131152 t0a = (dctint)((IN(0) + IN(8)) * 11585U + (1 << 13)) >> 14;
1326 1131152 t1a = (dctint)((IN(0) - IN(8)) * 11585U + (1 << 13)) >> 14;
1327 1131152 t2a = (dctint)(IN(4) * 6270U - IN(12) * 15137U + (1 << 13)) >> 14;
1328 1131152 t3a = (dctint)(IN(4) * 15137U + IN(12) * 6270U + (1 << 13)) >> 14;
1329 1131152 t4a = (dctint)(IN(2) * 3196U - IN(14) * 16069U + (1 << 13)) >> 14;
1330 1131152 t7a = (dctint)(IN(2) * 16069U + IN(14) * 3196U + (1 << 13)) >> 14;
1331 1131152 t5a = (dctint)(IN(10) * 13623U - IN(6) * 9102U + (1 << 13)) >> 14;
1332 1131152 t6a = (dctint)(IN(10) * 9102U + IN(6) * 13623U + (1 << 13)) >> 14;
1333 1131152 t8a = (dctint)(IN(1) * 1606U - IN(15) * 16305U + (1 << 13)) >> 14;
1334 1131152 t15a = (dctint)(IN(1) * 16305U + IN(15) * 1606U + (1 << 13)) >> 14;
1335 1131152 t9a = (dctint)(IN(9) * 12665U - IN(7) * 10394U + (1 << 13)) >> 14;
1336 1131152 t14a = (dctint)(IN(9) * 10394U + IN(7) * 12665U + (1 << 13)) >> 14;
1337 1131152 t10a = (dctint)(IN(5) * 7723U - IN(11) * 14449U + (1 << 13)) >> 14;
1338 1131152 t13a = (dctint)(IN(5) * 14449U + IN(11) * 7723U + (1 << 13)) >> 14;
1339 1131152 t11a = (dctint)(IN(13) * 15679U - IN(3) * 4756U + (1 << 13)) >> 14;
1340 1131152 t12a = (dctint)(IN(13) * 4756U + IN(3) * 15679U + (1 << 13)) >> 14;
1341
1342 1131152 t0 = t0a + t3a;
1343 1131152 t1 = t1a + t2a;
1344 1131152 t2 = t1a - t2a;
1345 1131152 t3 = t0a - t3a;
1346 1131152 t4 = t4a + t5a;
1347 1131152 t5 = t4a - t5a;
1348 1131152 t6 = t7a - t6a;
1349 1131152 t7 = t7a + t6a;
1350 1131152 t8 = t8a + t9a;
1351 1131152 t9 = t8a - t9a;
1352 1131152 t10 = t11a - t10a;
1353 1131152 t11 = t11a + t10a;
1354 1131152 t12 = t12a + t13a;
1355 1131152 t13 = t12a - t13a;
1356 1131152 t14 = t15a - t14a;
1357 1131152 t15 = t15a + t14a;
1358
1359 1131152 t5a = (dctint)((t6 - t5) * 11585U + (1 << 13)) >> 14;
1360 1131152 t6a = (dctint)((t6 + t5) * 11585U + (1 << 13)) >> 14;
1361 1131152 t9a = (dctint)( t14 * 6270U - t9 * 15137U + (1 << 13)) >> 14;
1362 1131152 t14a = (dctint)( t14 * 15137U + t9 * 6270U + (1 << 13)) >> 14;
1363 1131152 t10a = (dctint)(-(t13 * 15137U + t10 * 6270U) + (1 << 13)) >> 14;
1364 1131152 t13a = (dctint)( t13 * 6270U - t10 * 15137U + (1 << 13)) >> 14;
1365
1366 1131152 t0a = t0 + t7;
1367 1131152 t1a = t1 + t6a;
1368 1131152 t2a = t2 + t5a;
1369 1131152 t3a = t3 + t4;
1370 1131152 t4 = t3 - t4;
1371 1131152 t5 = t2 - t5a;
1372 1131152 t6 = t1 - t6a;
1373 1131152 t7 = t0 - t7;
1374 1131152 t8a = t8 + t11;
1375 1131152 t9 = t9a + t10a;
1376 1131152 t10 = t9a - t10a;
1377 1131152 t11a = t8 - t11;
1378 1131152 t12a = t15 - t12;
1379 1131152 t13 = t14a - t13a;
1380 1131152 t14 = t14a + t13a;
1381 1131152 t15a = t15 + t12;
1382
1383 1131152 t10a = (dctint)((t13 - t10) * 11585U + (1 << 13)) >> 14;
1384 1131152 t13a = (dctint)((t13 + t10) * 11585U + (1 << 13)) >> 14;
1385 1131152 t11 = (dctint)((t12a - t11a) * 11585U + (1 << 13)) >> 14;
1386 1131152 t12 = (dctint)((t12a + t11a) * 11585U + (1 << 13)) >> 14;
1387
1388 1131152 out[ 0] = t0a + t15a;
1389 1131152 out[ 1] = t1a + t14;
1390 1131152 out[ 2] = t2a + t13a;
1391 1131152 out[ 3] = t3a + t12;
1392 1131152 out[ 4] = t4 + t11;
1393 1131152 out[ 5] = t5 + t10a;
1394 1131152 out[ 6] = t6 + t9;
1395 1131152 out[ 7] = t7 + t8a;
1396 1131152 out[ 8] = t7 - t8a;
1397 1131152 out[ 9] = t6 - t9;
1398 1131152 out[10] = t5 - t10a;
1399 1131152 out[11] = t4 - t11;
1400 1131152 out[12] = t3a - t12;
1401 1131152 out[13] = t2a - t13a;
1402 1131152 out[14] = t1a - t14;
1403 1131152 out[15] = t0a - t15a;
1404 1131152 }
1405
1406 334512 static av_always_inline void iadst16_1d(const dctcoef *in, ptrdiff_t stride,
1407 dctcoef *out, int pass)
1408 {
1409 dctint t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15;
1410 dctint t0a, t1a, t2a, t3a, t4a, t5a, t6a, t7a;
1411 dctint t8a, t9a, t10a, t11a, t12a, t13a, t14a, t15a;
1412
1413 334512 t0 = IN(15) * 16364U + IN(0) * 804U;
1414 334512 t1 = IN(15) * 804U - IN(0) * 16364U;
1415 334512 t2 = IN(13) * 15893U + IN(2) * 3981U;
1416 334512 t3 = IN(13) * 3981U - IN(2) * 15893U;
1417 334512 t4 = IN(11) * 14811U + IN(4) * 7005U;
1418 334512 t5 = IN(11) * 7005U - IN(4) * 14811U;
1419 334512 t6 = IN(9) * 13160U + IN(6) * 9760U;
1420 334512 t7 = IN(9) * 9760U - IN(6) * 13160U;
1421 334512 t8 = IN(7) * 11003U + IN(8) * 12140U;
1422 334512 t9 = IN(7) * 12140U - IN(8) * 11003U;
1423 334512 t10 = IN(5) * 8423U + IN(10) * 14053U;
1424 334512 t11 = IN(5) * 14053U - IN(10) * 8423U;
1425 334512 t12 = IN(3) * 5520U + IN(12) * 15426U;
1426 334512 t13 = IN(3) * 15426U - IN(12) * 5520U;
1427 334512 t14 = IN(1) * 2404U + IN(14) * 16207U;
1428 334512 t15 = IN(1) * 16207U - IN(14) * 2404U;
1429
1430 334512 t0a = (dctint)((1U << 13) + t0 + t8 ) >> 14;
1431 334512 t1a = (dctint)((1U << 13) + t1 + t9 ) >> 14;
1432 334512 t2a = (dctint)((1U << 13) + t2 + t10) >> 14;
1433 334512 t3a = (dctint)((1U << 13) + t3 + t11) >> 14;
1434 334512 t4a = (dctint)((1U << 13) + t4 + t12) >> 14;
1435 334512 t5a = (dctint)((1U << 13) + t5 + t13) >> 14;
1436 334512 t6a = (dctint)((1U << 13) + t6 + t14) >> 14;
1437 334512 t7a = (dctint)((1U << 13) + t7 + t15) >> 14;
1438 334512 t8a = (dctint)((1U << 13) + t0 - t8 ) >> 14;
1439 334512 t9a = (dctint)((1U << 13) + t1 - t9 ) >> 14;
1440 334512 t10a = (dctint)((1U << 13) + t2 - t10) >> 14;
1441 334512 t11a = (dctint)((1U << 13) + t3 - t11) >> 14;
1442 334512 t12a = (dctint)((1U << 13) + t4 - t12) >> 14;
1443 334512 t13a = (dctint)((1U << 13) + t5 - t13) >> 14;
1444 334512 t14a = (dctint)((1U << 13) + t6 - t14) >> 14;
1445 334512 t15a = (dctint)((1U << 13) + t7 - t15) >> 14;
1446
1447 334512 t8 = t8a * 16069U + t9a * 3196U;
1448 334512 t9 = t8a * 3196U - t9a * 16069U;
1449 334512 t10 = t10a * 9102U + t11a * 13623U;
1450 334512 t11 = t10a * 13623U - t11a * 9102U;
1451 334512 t12 = t13a * 16069U - t12a * 3196U;
1452 334512 t13 = t13a * 3196U + t12a * 16069U;
1453 334512 t14 = t15a * 9102U - t14a * 13623U;
1454 334512 t15 = t15a * 13623U + t14a * 9102U;
1455
1456 334512 t0 = t0a + t4a;
1457 334512 t1 = t1a + t5a;
1458 334512 t2 = t2a + t6a;
1459 334512 t3 = t3a + t7a;
1460 334512 t4 = t0a - t4a;
1461 334512 t5 = t1a - t5a;
1462 334512 t6 = t2a - t6a;
1463 334512 t7 = t3a - t7a;
1464 334512 t8a = (dctint)((1U << 13) + t8 + t12) >> 14;
1465 334512 t9a = (dctint)((1U << 13) + t9 + t13) >> 14;
1466 334512 t10a = (dctint)((1U << 13) + t10 + t14) >> 14;
1467 334512 t11a = (dctint)((1U << 13) + t11 + t15) >> 14;
1468 334512 t12a = (dctint)((1U << 13) + t8 - t12) >> 14;
1469 334512 t13a = (dctint)((1U << 13) + t9 - t13) >> 14;
1470 334512 t14a = (dctint)((1U << 13) + t10 - t14) >> 14;
1471 334512 t15a = (dctint)((1U << 13) + t11 - t15) >> 14;
1472
1473 334512 t4a = t4 * 15137U + t5 * 6270U;
1474 334512 t5a = t4 * 6270U - t5 * 15137U;
1475 334512 t6a = t7 * 15137U - t6 * 6270U;
1476 334512 t7a = t7 * 6270U + t6 * 15137U;
1477 334512 t12 = t12a * 15137U + t13a * 6270U;
1478 334512 t13 = t12a * 6270U - t13a * 15137U;
1479 334512 t14 = t15a * 15137U - t14a * 6270U;
1480 334512 t15 = t15a * 6270U + t14a * 15137U;
1481
1482 334512 out[ 0] = t0 + t2;
1483 334512 out[15] = -(t1 + t3);
1484 334512 t2a = t0 - t2;
1485 334512 t3a = t1 - t3;
1486 334512 out[ 3] = -((dctint)((1U << 13) + t4a + t6a) >> 14);
1487 334512 out[12] = (dctint)((1U << 13) + t5a + t7a) >> 14;
1488 334512 t6 = (dctint)((1U << 13) + t4a - t6a) >> 14;
1489 334512 t7 = (dctint)((1U << 13) + t5a - t7a) >> 14;
1490 334512 out[ 1] = -(t8a + t10a);
1491 334512 out[14] = t9a + t11a;
1492 334512 t10 = t8a - t10a;
1493 334512 t11 = t9a - t11a;
1494 334512 out[ 2] = (dctint)((1U << 13) + t12 + t14) >> 14;
1495 334512 out[13] = -((dctint)((1U << 13) + t13 + t15) >> 14);
1496 334512 t14a = (dctint)((1U << 13) + t12 - t14) >> 14;
1497 334512 t15a = (dctint)((1U << 13) + t13 - t15) >> 14;
1498
1499 334512 out[ 7] = (dctint)(-(t2a + t3a) * 11585U + (1 << 13)) >> 14;
1500 334512 out[ 8] = (dctint)( (t2a - t3a) * 11585U + (1 << 13)) >> 14;
1501 334512 out[ 4] = (dctint)( (t7 + t6) * 11585U + (1 << 13)) >> 14;
1502 334512 out[11] = (dctint)( (t7 - t6) * 11585U + (1 << 13)) >> 14;
1503 334512 out[ 6] = (dctint)( (t11 + t10) * 11585U + (1 << 13)) >> 14;
1504 334512 out[ 9] = (dctint)( (t11 - t10) * 11585U + (1 << 13)) >> 14;
1505 334512 out[ 5] = (dctint)(-(t14a + t15a) * 11585U + (1 << 13)) >> 14;
1506 334512 out[10] = (dctint)( (t14a - t15a) * 11585U + (1 << 13)) >> 14;
1507 334512 }
1508
1509
13/13
✓ Branch 0 taken 8409 times.
✓ Branch 1 taken 309997 times.
✓ Branch 2 taken 2170317 times.
✓ Branch 3 taken 134544 times.
✓ Branch 4 taken 4643472 times.
✓ Branch 5 taken 290217 times.
✓ Branch 6 taken 281808 times.
✓ Branch 7 taken 468637 times.
✓ Branch 8 taken 28189 times.
✓ Branch 10 taken 7216384 times.
✓ Branch 11 taken 451024 times.
✓ Branch 12 taken 451024 times.
✓ Branch 13 taken 28189 times.
31064870 itxfm_wrap(16, 6)
1510
1511 651264 static av_always_inline void idct32_1d(const dctcoef *in, ptrdiff_t stride,
1512 dctcoef *out, int pass)
1513 {
1514 651264 dctint t0a = (dctint)((IN(0) + IN(16)) * 11585U + (1 << 13)) >> 14;
1515 651264 dctint t1a = (dctint)((IN(0) - IN(16)) * 11585U + (1 << 13)) >> 14;
1516 651264 dctint t2a = (dctint)(IN( 8) * 6270U - IN(24) * 15137U + (1 << 13)) >> 14;
1517 651264 dctint t3a = (dctint)(IN( 8) * 15137U + IN(24) * 6270U + (1 << 13)) >> 14;
1518 651264 dctint t4a = (dctint)(IN( 4) * 3196U - IN(28) * 16069U + (1 << 13)) >> 14;
1519 651264 dctint t7a = (dctint)(IN( 4) * 16069U + IN(28) * 3196U + (1 << 13)) >> 14;
1520 651264 dctint t5a = (dctint)(IN(20) * 13623U - IN(12) * 9102U + (1 << 13)) >> 14;
1521 651264 dctint t6a = (dctint)(IN(20) * 9102U + IN(12) * 13623U + (1 << 13)) >> 14;
1522 651264 dctint t8a = (dctint)(IN( 2) * 1606U - IN(30) * 16305U + (1 << 13)) >> 14;
1523 651264 dctint t15a = (dctint)(IN( 2) * 16305U + IN(30) * 1606U + (1 << 13)) >> 14;
1524 651264 dctint t9a = (dctint)(IN(18) * 12665U - IN(14) * 10394U + (1 << 13)) >> 14;
1525 651264 dctint t14a = (dctint)(IN(18) * 10394U + IN(14) * 12665U + (1 << 13)) >> 14;
1526 651264 dctint t10a = (dctint)(IN(10) * 7723U - IN(22) * 14449U + (1 << 13)) >> 14;
1527 651264 dctint t13a = (dctint)(IN(10) * 14449U + IN(22) * 7723U + (1 << 13)) >> 14;
1528 651264 dctint t11a = (dctint)(IN(26) * 15679U - IN( 6) * 4756U + (1 << 13)) >> 14;
1529 651264 dctint t12a = (dctint)(IN(26) * 4756U + IN( 6) * 15679U + (1 << 13)) >> 14;
1530 651264 dctint t16a = (dctint)(IN( 1) * 804U - IN(31) * 16364U + (1 << 13)) >> 14;
1531 651264 dctint t31a = (dctint)(IN( 1) * 16364U + IN(31) * 804U + (1 << 13)) >> 14;
1532 651264 dctint t17a = (dctint)(IN(17) * 12140U - IN(15) * 11003U + (1 << 13)) >> 14;
1533 651264 dctint t30a = (dctint)(IN(17) * 11003U + IN(15) * 12140U + (1 << 13)) >> 14;
1534 651264 dctint t18a = (dctint)(IN( 9) * 7005U - IN(23) * 14811U + (1 << 13)) >> 14;
1535 651264 dctint t29a = (dctint)(IN( 9) * 14811U + IN(23) * 7005U + (1 << 13)) >> 14;
1536 651264 dctint t19a = (dctint)(IN(25) * 15426U - IN( 7) * 5520U + (1 << 13)) >> 14;
1537 651264 dctint t28a = (dctint)(IN(25) * 5520U + IN( 7) * 15426U + (1 << 13)) >> 14;
1538 651264 dctint t20a = (dctint)(IN( 5) * 3981U - IN(27) * 15893U + (1 << 13)) >> 14;
1539 651264 dctint t27a = (dctint)(IN( 5) * 15893U + IN(27) * 3981U + (1 << 13)) >> 14;
1540 651264 dctint t21a = (dctint)(IN(21) * 14053U - IN(11) * 8423U + (1 << 13)) >> 14;
1541 651264 dctint t26a = (dctint)(IN(21) * 8423U + IN(11) * 14053U + (1 << 13)) >> 14;
1542 651264 dctint t22a = (dctint)(IN(13) * 9760U - IN(19) * 13160U + (1 << 13)) >> 14;
1543 651264 dctint t25a = (dctint)(IN(13) * 13160U + IN(19) * 9760U + (1 << 13)) >> 14;
1544 651264 dctint t23a = (dctint)(IN(29) * 16207U - IN( 3) * 2404U + (1 << 13)) >> 14;
1545 651264 dctint t24a = (dctint)(IN(29) * 2404U + IN( 3) * 16207U + (1 << 13)) >> 14;
1546
1547 651264 dctint t0 = t0a + t3a;
1548 651264 dctint t1 = t1a + t2a;
1549 651264 dctint t2 = t1a - t2a;
1550 651264 dctint t3 = t0a - t3a;
1551 651264 dctint t4 = t4a + t5a;
1552 651264 dctint t5 = t4a - t5a;
1553 651264 dctint t6 = t7a - t6a;
1554 651264 dctint t7 = t7a + t6a;
1555 651264 dctint t8 = t8a + t9a;
1556 651264 dctint t9 = t8a - t9a;
1557 651264 dctint t10 = t11a - t10a;
1558 651264 dctint t11 = t11a + t10a;
1559 651264 dctint t12 = t12a + t13a;
1560 651264 dctint t13 = t12a - t13a;
1561 651264 dctint t14 = t15a - t14a;
1562 651264 dctint t15 = t15a + t14a;
1563 651264 dctint t16 = t16a + t17a;
1564 651264 dctint t17 = t16a - t17a;
1565 651264 dctint t18 = t19a - t18a;
1566 651264 dctint t19 = t19a + t18a;
1567 651264 dctint t20 = t20a + t21a;
1568 651264 dctint t21 = t20a - t21a;
1569 651264 dctint t22 = t23a - t22a;
1570 651264 dctint t23 = t23a + t22a;
1571 651264 dctint t24 = t24a + t25a;
1572 651264 dctint t25 = t24a - t25a;
1573 651264 dctint t26 = t27a - t26a;
1574 651264 dctint t27 = t27a + t26a;
1575 651264 dctint t28 = t28a + t29a;
1576 651264 dctint t29 = t28a - t29a;
1577 651264 dctint t30 = t31a - t30a;
1578 651264 dctint t31 = t31a + t30a;
1579
1580 651264 t5a = (dctint)((t6 - t5) * 11585U + (1 << 13)) >> 14;
1581 651264 t6a = (dctint)((t6 + t5) * 11585U + (1 << 13)) >> 14;
1582 651264 t9a = (dctint)( t14 * 6270U - t9 * 15137U + (1 << 13)) >> 14;
1583 651264 t14a = (dctint)( t14 * 15137U + t9 * 6270U + (1 << 13)) >> 14;
1584 651264 t10a = (dctint)(-(t13 * 15137U + t10 * 6270U) + (1 << 13)) >> 14;
1585 651264 t13a = (dctint)( t13 * 6270U - t10 * 15137U + (1 << 13)) >> 14;
1586 651264 t17a = (dctint)( t30 * 3196U - t17 * 16069U + (1 << 13)) >> 14;
1587 651264 t30a = (dctint)( t30 * 16069U + t17 * 3196U + (1 << 13)) >> 14;
1588 651264 t18a = (dctint)(-(t29 * 16069U + t18 * 3196U) + (1 << 13)) >> 14;
1589 651264 t29a = (dctint)( t29 * 3196U - t18 * 16069U + (1 << 13)) >> 14;
1590 651264 t21a = (dctint)( t26 * 13623U - t21 * 9102U + (1 << 13)) >> 14;
1591 651264 t26a = (dctint)( t26 * 9102U + t21 * 13623U + (1 << 13)) >> 14;
1592 651264 t22a = (dctint)(-(t25 * 9102U + t22 * 13623U) + (1 << 13)) >> 14;
1593 651264 t25a = (dctint)( t25 * 13623U - t22 * 9102U + (1 << 13)) >> 14;
1594
1595 651264 t0a = t0 + t7;
1596 651264 t1a = t1 + t6a;
1597 651264 t2a = t2 + t5a;
1598 651264 t3a = t3 + t4;
1599 651264 t4a = t3 - t4;
1600 651264 t5 = t2 - t5a;
1601 651264 t6 = t1 - t6a;
1602 651264 t7a = t0 - t7;
1603 651264 t8a = t8 + t11;
1604 651264 t9 = t9a + t10a;
1605 651264 t10 = t9a - t10a;
1606 651264 t11a = t8 - t11;
1607 651264 t12a = t15 - t12;
1608 651264 t13 = t14a - t13a;
1609 651264 t14 = t14a + t13a;
1610 651264 t15a = t15 + t12;
1611 651264 t16a = t16 + t19;
1612 651264 t17 = t17a + t18a;
1613 651264 t18 = t17a - t18a;
1614 651264 t19a = t16 - t19;
1615 651264 t20a = t23 - t20;
1616 651264 t21 = t22a - t21a;
1617 651264 t22 = t22a + t21a;
1618 651264 t23a = t23 + t20;
1619 651264 t24a = t24 + t27;
1620 651264 t25 = t25a + t26a;
1621 651264 t26 = t25a - t26a;
1622 651264 t27a = t24 - t27;
1623 651264 t28a = t31 - t28;
1624 651264 t29 = t30a - t29a;
1625 651264 t30 = t30a + t29a;
1626 651264 t31a = t31 + t28;
1627
1628 651264 t10a = (dctint)((t13 - t10) * 11585U + (1 << 13)) >> 14;
1629 651264 t13a = (dctint)((t13 + t10) * 11585U + (1 << 13)) >> 14;
1630 651264 t11 = (dctint)((t12a - t11a) * 11585U + (1 << 13)) >> 14;
1631 651264 t12 = (dctint)((t12a + t11a) * 11585U + (1 << 13)) >> 14;
1632 651264 t18a = (dctint)( t29 * 6270U - t18 * 15137U + (1 << 13)) >> 14;
1633 651264 t29a = (dctint)( t29 * 15137U + t18 * 6270U + (1 << 13)) >> 14;
1634 651264 t19 = (dctint)( t28a * 6270U - t19a * 15137U + (1 << 13)) >> 14;
1635 651264 t28 = (dctint)( t28a * 15137U + t19a * 6270U + (1 << 13)) >> 14;
1636 651264 t20 = (dctint)(-(t27a * 15137U + t20a * 6270U) + (1 << 13)) >> 14;
1637 651264 t27 = (dctint)( t27a * 6270U - t20a * 15137U + (1 << 13)) >> 14;
1638 651264 t21a = (dctint)(-(t26 * 15137U + t21 * 6270U) + (1 << 13)) >> 14;
1639 651264 t26a = (dctint)( t26 * 6270U - t21 * 15137U + (1 << 13)) >> 14;
1640
1641 651264 t0 = t0a + t15a;
1642 651264 t1 = t1a + t14;
1643 651264 t2 = t2a + t13a;
1644 651264 t3 = t3a + t12;
1645 651264 t4 = t4a + t11;
1646 651264 t5a = t5 + t10a;
1647 651264 t6a = t6 + t9;
1648 651264 t7 = t7a + t8a;
1649 651264 t8 = t7a - t8a;
1650 651264 t9a = t6 - t9;
1651 651264 t10 = t5 - t10a;
1652 651264 t11a = t4a - t11;
1653 651264 t12a = t3a - t12;
1654 651264 t13 = t2a - t13a;
1655 651264 t14a = t1a - t14;
1656 651264 t15 = t0a - t15a;
1657 651264 t16 = t16a + t23a;
1658 651264 t17a = t17 + t22;
1659 651264 t18 = t18a + t21a;
1660 651264 t19a = t19 + t20;
1661 651264 t20a = t19 - t20;
1662 651264 t21 = t18a - t21a;
1663 651264 t22a = t17 - t22;
1664 651264 t23 = t16a - t23a;
1665 651264 t24 = t31a - t24a;
1666 651264 t25a = t30 - t25;
1667 651264 t26 = t29a - t26a;
1668 651264 t27a = t28 - t27;
1669 651264 t28a = t28 + t27;
1670 651264 t29 = t29a + t26a;
1671 651264 t30a = t30 + t25;
1672 651264 t31 = t31a + t24a;
1673
1674 651264 t20 = (dctint)((t27a - t20a) * 11585U + (1 << 13)) >> 14;
1675 651264 t27 = (dctint)((t27a + t20a) * 11585U + (1 << 13)) >> 14;
1676 651264 t21a = (dctint)((t26 - t21 ) * 11585U + (1 << 13)) >> 14;
1677 651264 t26a = (dctint)((t26 + t21 ) * 11585U + (1 << 13)) >> 14;
1678 651264 t22 = (dctint)((t25a - t22a) * 11585U + (1 << 13)) >> 14;
1679 651264 t25 = (dctint)((t25a + t22a) * 11585U + (1 << 13)) >> 14;
1680 651264 t23a = (dctint)((t24 - t23 ) * 11585U + (1 << 13)) >> 14;
1681 651264 t24a = (dctint)((t24 + t23 ) * 11585U + (1 << 13)) >> 14;
1682
1683 651264 out[ 0] = t0 + t31;
1684 651264 out[ 1] = t1 + t30a;
1685 651264 out[ 2] = t2 + t29;
1686 651264 out[ 3] = t3 + t28a;
1687 651264 out[ 4] = t4 + t27;
1688 651264 out[ 5] = t5a + t26a;
1689 651264 out[ 6] = t6a + t25;
1690 651264 out[ 7] = t7 + t24a;
1691 651264 out[ 8] = t8 + t23a;
1692 651264 out[ 9] = t9a + t22;
1693 651264 out[10] = t10 + t21a;
1694 651264 out[11] = t11a + t20;
1695 651264 out[12] = t12a + t19a;
1696 651264 out[13] = t13 + t18;
1697 651264 out[14] = t14a + t17a;
1698 651264 out[15] = t15 + t16;
1699 651264 out[16] = t15 - t16;
1700 651264 out[17] = t14a - t17a;
1701 651264 out[18] = t13 - t18;
1702 651264 out[19] = t12a - t19a;
1703 651264 out[20] = t11a - t20;
1704 651264 out[21] = t10 - t21a;
1705 651264 out[22] = t9a - t22;
1706 651264 out[23] = t8 - t23a;
1707 651264 out[24] = t7 - t24a;
1708 651264 out[25] = t6a - t25;
1709 651264 out[26] = t5a - t26a;
1710 651264 out[27] = t4 - t27;
1711 651264 out[28] = t3 - t28a;
1712 651264 out[29] = t2 - t29;
1713 651264 out[30] = t1 - t30a;
1714 651264 out[31] = t0 - t31;
1715 651264 }
1716
1717
12/12
✓ Branch 0 taken 3422 times.
✓ Branch 1 taken 10176 times.
✓ Branch 2 taken 3504128 times.
✓ Branch 3 taken 109504 times.
✓ Branch 4 taken 109504 times.
✓ Branch 5 taken 3422 times.
✓ Branch 7 taken 325632 times.
✓ Branch 8 taken 10176 times.
✓ Branch 10 taken 10420224 times.
✓ Branch 11 taken 325632 times.
✓ Branch 12 taken 325632 times.
✓ Branch 13 taken 10176 times.
14698718 itxfm_wrapper(idct, idct, 32, 6, 1)
1718
1719 229456 static av_always_inline void iwht4_1d(const dctcoef *in, ptrdiff_t stride,
1720 dctcoef *out, int pass)
1721 {
1722 int t0, t1, t2, t3, t4;
1723
1724
2/2
✓ Branch 0 taken 114728 times.
✓ Branch 1 taken 114728 times.
229456 if (pass == 0) {
1725 114728 t0 = IN(0) >> 2;
1726 114728 t1 = IN(3) >> 2;
1727 114728 t2 = IN(1) >> 2;
1728 114728 t3 = IN(2) >> 2;
1729 } else {
1730 114728 t0 = IN(0);
1731 114728 t1 = IN(3);
1732 114728 t2 = IN(1);
1733 114728 t3 = IN(2);
1734 }
1735
1736 229456 t0 += t2;
1737 229456 t3 -= t1;
1738 229456 t4 = (t0 - t3) >> 1;
1739 229456 t1 = t4 - t1;
1740 229456 t2 = t4 - t2;
1741 229456 t0 -= t1;
1742 229456 t3 += t2;
1743
1744 229456 out[0] = t0;
1745 229456 out[1] = t1;
1746 229456 out[2] = t2;
1747 229456 out[3] = t3;
1748 229456 }
1749
1750
6/6
✓ Branch 1 taken 114728 times.
✓ Branch 2 taken 28682 times.
✓ Branch 4 taken 458912 times.
✓ Branch 5 taken 114728 times.
✓ Branch 6 taken 114728 times.
✓ Branch 7 taken 28682 times.
717050 itxfm_wrapper(iwht, iwht, 4, 0, 0)
1751
1752 #undef IN
1753 #undef itxfm_wrapper
1754 #undef itxfm_wrap
1755
1756 689 static av_cold void vp9dsp_itxfm_init(VP9DSPContext *dsp)
1757 {
1758 #define init_itxfm(tx, sz) \
1759 dsp->itxfm_add[tx][DCT_DCT] = idct_idct_##sz##_add_c; \
1760 dsp->itxfm_add[tx][DCT_ADST] = iadst_idct_##sz##_add_c; \
1761 dsp->itxfm_add[tx][ADST_DCT] = idct_iadst_##sz##_add_c; \
1762 dsp->itxfm_add[tx][ADST_ADST] = iadst_iadst_##sz##_add_c
1763
1764 #define init_idct(tx, nm) \
1765 dsp->itxfm_add[tx][DCT_DCT] = \
1766 dsp->itxfm_add[tx][ADST_DCT] = \
1767 dsp->itxfm_add[tx][DCT_ADST] = \
1768 dsp->itxfm_add[tx][ADST_ADST] = nm##_add_c
1769
1770 689 init_itxfm(TX_4X4, 4x4);
1771 689 init_itxfm(TX_8X8, 8x8);
1772 689 init_itxfm(TX_16X16, 16x16);
1773 689 init_idct(TX_32X32, idct_idct_32x32);
1774 689 init_idct(4 /* lossless */, iwht_iwht_4x4);
1775
1776 #undef init_itxfm
1777 #undef init_idct
1778 689 }
1779
1780 4996788 static av_always_inline void loop_filter(pixel *dst, int E, int I, int H,
1781 ptrdiff_t stridea, ptrdiff_t strideb,
1782 int wd)
1783 {
1784 4996788 int i, F = 1 << (BIT_DEPTH - 8);
1785
1786 4996788 E <<= (BIT_DEPTH - 8);
1787 4996788 I <<= (BIT_DEPTH - 8);
1788 4996788 H <<= (BIT_DEPTH - 8);
1789
2/2
✓ Branch 0 taken 39974304 times.
✓ Branch 1 taken 4996788 times.
44971092 for (i = 0; i < 8; i++, dst += stridea) {
1790 int p7, p6, p5, p4;
1791 39974304 int p3 = dst[strideb * -4], p2 = dst[strideb * -3];
1792 39974304 int p1 = dst[strideb * -2], p0 = dst[strideb * -1];
1793 39974304 int q0 = dst[strideb * +0], q1 = dst[strideb * +1];
1794 39974304 int q2 = dst[strideb * +2], q3 = dst[strideb * +3];
1795 int q4, q5, q6, q7;
1796
2/2
✓ Branch 0 taken 33441688 times.
✓ Branch 1 taken 2003639 times.
35445327 int fm = FFABS(p3 - p2) <= I && FFABS(p2 - p1) <= I &&
1797
4/4
✓ Branch 0 taken 32271354 times.
✓ Branch 1 taken 1170334 times.
✓ Branch 2 taken 30904904 times.
✓ Branch 3 taken 1366450 times.
33441688 FFABS(p1 - p0) <= I && FFABS(q1 - q0) <= I &&
1798
6/6
✓ Branch 0 taken 35445327 times.
✓ Branch 1 taken 4528977 times.
✓ Branch 2 taken 30068946 times.
✓ Branch 3 taken 835958 times.
✓ Branch 4 taken 29488145 times.
✓ Branch 5 taken 580801 times.
104907776 FFABS(q2 - q1) <= I && FFABS(q3 - q2) <= I &&
1799
2/2
✓ Branch 0 taken 29102060 times.
✓ Branch 1 taken 386085 times.
29488145 FFABS(p0 - q0) * 2 + (FFABS(p1 - q1) >> 1) <= E;
1800 int flat8out, flat8in;
1801
1802
2/2
✓ Branch 0 taken 10872244 times.
✓ Branch 1 taken 29102060 times.
39974304 if (!fm)
1803 10872244 continue;
1804
1805
2/2
✓ Branch 0 taken 8620011 times.
✓ Branch 1 taken 20482049 times.
29102060 if (wd >= 16) {
1806 8620011 p7 = dst[strideb * -8];
1807 8620011 p6 = dst[strideb * -7];
1808 8620011 p5 = dst[strideb * -6];
1809 8620011 p4 = dst[strideb * -5];
1810 8620011 q4 = dst[strideb * +4];
1811 8620011 q5 = dst[strideb * +5];
1812 8620011 q6 = dst[strideb * +6];
1813 8620011 q7 = dst[strideb * +7];
1814
1815
2/2
✓ Branch 0 taken 3512481 times.
✓ Branch 1 taken 246817 times.
12379309 flat8out = FFABS(p7 - p0) <= F && FFABS(p6 - p0) <= F &&
1816
4/4
✓ Branch 0 taken 3411960 times.
✓ Branch 1 taken 100521 times.
✓ Branch 2 taken 3355709 times.
✓ Branch 3 taken 56251 times.
3512481 FFABS(p5 - p0) <= F && FFABS(p4 - p0) <= F &&
1817
4/4
✓ Branch 0 taken 2852217 times.
✓ Branch 1 taken 503492 times.
✓ Branch 2 taken 2731482 times.
✓ Branch 3 taken 120735 times.
3355709 FFABS(q4 - q0) <= F && FFABS(q5 - q0) <= F &&
1818
6/6
✓ Branch 0 taken 3759298 times.
✓ Branch 1 taken 4860713 times.
✓ Branch 2 taken 2626657 times.
✓ Branch 3 taken 104825 times.
✓ Branch 4 taken 2532513 times.
✓ Branch 5 taken 94144 times.
12379309 FFABS(q6 - q0) <= F && FFABS(q7 - q0) <= F;
1819 }
1820
1821
2/2
✓ Branch 0 taken 19971083 times.
✓ Branch 1 taken 9130977 times.
29102060 if (wd >= 8)
1822
2/2
✓ Branch 0 taken 11060723 times.
✓ Branch 1 taken 522759 times.
31554565 flat8in = FFABS(p3 - p0) <= F && FFABS(p2 - p0) <= F &&
1823
4/4
✓ Branch 0 taken 10947353 times.
✓ Branch 1 taken 113370 times.
✓ Branch 2 taken 10101779 times.
✓ Branch 3 taken 845574 times.
11060723 FFABS(p1 - p0) <= F && FFABS(q1 - q0) <= F &&
1824
6/6
✓ Branch 0 taken 11583482 times.
✓ Branch 1 taken 8387601 times.
✓ Branch 2 taken 9431334 times.
✓ Branch 3 taken 670445 times.
✓ Branch 4 taken 8879361 times.
✓ Branch 5 taken 551973 times.
31554565 FFABS(q2 - q0) <= F && FFABS(q3 - q0) <= F;
1825
1826
6/6
✓ Branch 0 taken 8620011 times.
✓ Branch 1 taken 20482049 times.
✓ Branch 2 taken 2532513 times.
✓ Branch 3 taken 6087498 times.
✓ Branch 4 taken 2509620 times.
✓ Branch 5 taken 22893 times.
29102060 if (wd >= 16 && flat8out && flat8in) {
1827 2509620 dst[strideb * -7] = (p7 + p7 + p7 + p7 + p7 + p7 + p7 + p6 * 2 +
1828 2509620 p5 + p4 + p3 + p2 + p1 + p0 + q0 + 8) >> 4;
1829 2509620 dst[strideb * -6] = (p7 + p7 + p7 + p7 + p7 + p7 + p6 + p5 * 2 +
1830 2509620 p4 + p3 + p2 + p1 + p0 + q0 + q1 + 8) >> 4;
1831 2509620 dst[strideb * -5] = (p7 + p7 + p7 + p7 + p7 + p6 + p5 + p4 * 2 +
1832 2509620 p3 + p2 + p1 + p0 + q0 + q1 + q2 + 8) >> 4;
1833 2509620 dst[strideb * -4] = (p7 + p7 + p7 + p7 + p6 + p5 + p4 + p3 * 2 +
1834 2509620 p2 + p1 + p0 + q0 + q1 + q2 + q3 + 8) >> 4;
1835 2509620 dst[strideb * -3] = (p7 + p7 + p7 + p6 + p5 + p4 + p3 + p2 * 2 +
1836 2509620 p1 + p0 + q0 + q1 + q2 + q3 + q4 + 8) >> 4;
1837 2509620 dst[strideb * -2] = (p7 + p7 + p6 + p5 + p4 + p3 + p2 + p1 * 2 +
1838 2509620 p0 + q0 + q1 + q2 + q3 + q4 + q5 + 8) >> 4;
1839 2509620 dst[strideb * -1] = (p7 + p6 + p5 + p4 + p3 + p2 + p1 + p0 * 2 +
1840 2509620 q0 + q1 + q2 + q3 + q4 + q5 + q6 + 8) >> 4;
1841 2509620 dst[strideb * +0] = (p6 + p5 + p4 + p3 + p2 + p1 + p0 + q0 * 2 +
1842 2509620 q1 + q2 + q3 + q4 + q5 + q6 + q7 + 8) >> 4;
1843 2509620 dst[strideb * +1] = (p5 + p4 + p3 + p2 + p1 + p0 + q0 + q1 * 2 +
1844 2509620 q2 + q3 + q4 + q5 + q6 + q7 + q7 + 8) >> 4;
1845 2509620 dst[strideb * +2] = (p4 + p3 + p2 + p1 + p0 + q0 + q1 + q2 * 2 +
1846 2509620 q3 + q4 + q5 + q6 + q7 + q7 + q7 + 8) >> 4;
1847 2509620 dst[strideb * +3] = (p3 + p2 + p1 + p0 + q0 + q1 + q2 + q3 * 2 +
1848 2509620 q4 + q5 + q6 + q7 + q7 + q7 + q7 + 8) >> 4;
1849 2509620 dst[strideb * +4] = (p2 + p1 + p0 + q0 + q1 + q2 + q3 + q4 * 2 +
1850 2509620 q5 + q6 + q7 + q7 + q7 + q7 + q7 + 8) >> 4;
1851 2509620 dst[strideb * +5] = (p1 + p0 + q0 + q1 + q2 + q3 + q4 + q5 * 2 +
1852 2509620 q6 + q7 + q7 + q7 + q7 + q7 + q7 + 8) >> 4;
1853 2509620 dst[strideb * +6] = (p0 + q0 + q1 + q2 + q3 + q4 + q5 + q6 * 2 +
1854 2509620 q7 + q7 + q7 + q7 + q7 + q7 + q7 + 8) >> 4;
1855
4/4
✓ Branch 0 taken 17461463 times.
✓ Branch 1 taken 9130977 times.
✓ Branch 2 taken 6369741 times.
✓ Branch 3 taken 11091722 times.
26592440 } else if (wd >= 8 && flat8in) {
1856 6369741 dst[strideb * -3] = (p3 + p3 + p3 + 2 * p2 + p1 + p0 + q0 + 4) >> 3;
1857 6369741 dst[strideb * -2] = (p3 + p3 + p2 + 2 * p1 + p0 + q0 + q1 + 4) >> 3;
1858 6369741 dst[strideb * -1] = (p3 + p2 + p1 + 2 * p0 + q0 + q1 + q2 + 4) >> 3;
1859 6369741 dst[strideb * +0] = (p2 + p1 + p0 + 2 * q0 + q1 + q2 + q3 + 4) >> 3;
1860 6369741 dst[strideb * +1] = (p1 + p0 + q0 + 2 * q1 + q2 + q3 + q3 + 4) >> 3;
1861 6369741 dst[strideb * +2] = (p0 + q0 + q1 + 2 * q2 + q3 + q3 + q3 + 4) >> 3;
1862 } else {
1863
4/4
✓ Branch 0 taken 11557680 times.
✓ Branch 1 taken 8665019 times.
✓ Branch 2 taken 3253926 times.
✓ Branch 3 taken 8303754 times.
20222699 int hev = FFABS(p1 - p0) > H || FFABS(q1 - q0) > H;
1864
1865
2/2
✓ Branch 0 taken 11918945 times.
✓ Branch 1 taken 8303754 times.
20222699 if (hev) {
1866 11918945 int f = av_clip_intp2(p1 - q1, BIT_DEPTH - 1), f1, f2;
1867 11918945 f = av_clip_intp2(3 * (q0 - p0) + f, BIT_DEPTH - 1);
1868
1869 11918945 f1 = FFMIN(f + 4, (1 << (BIT_DEPTH - 1)) - 1) >> 3;
1870 11918945 f2 = FFMIN(f + 3, (1 << (BIT_DEPTH - 1)) - 1) >> 3;
1871
1872 11918945 dst[strideb * -1] = av_clip_pixel(p0 + f2);
1873 11918945 dst[strideb * +0] = av_clip_pixel(q0 - f1);
1874 } else {
1875 8303754 int f = av_clip_intp2(3 * (q0 - p0), BIT_DEPTH - 1), f1, f2;
1876
1877 8303754 f1 = FFMIN(f + 4, (1 << (BIT_DEPTH - 1)) - 1) >> 3;
1878 8303754 f2 = FFMIN(f + 3, (1 << (BIT_DEPTH - 1)) - 1) >> 3;
1879
1880 8303754 dst[strideb * -1] = av_clip_pixel(p0 + f2);
1881 8303754 dst[strideb * +0] = av_clip_pixel(q0 - f1);
1882
1883 8303754 f = (f1 + 1) >> 1;
1884 8303754 dst[strideb * -2] = av_clip_pixel(p1 + f);
1885 8303754 dst[strideb * +1] = av_clip_pixel(q1 - f);
1886 }
1887 }
1888 }
1889 4996788 }
1890
1891 #define lf_8_fn(dir, wd, stridea, strideb) \
1892 static void loop_filter_##dir##_##wd##_8_c(uint8_t *_dst, \
1893 ptrdiff_t stride, \
1894 int E, int I, int H) \
1895 { \
1896 pixel *dst = (pixel *) _dst; \
1897 stride /= sizeof(pixel); \
1898 loop_filter(dst, E, I, H, stridea, strideb, wd); \
1899 }
1900
1901 #define lf_8_fns(wd) \
1902 lf_8_fn(h, wd, stride, 1) \
1903 lf_8_fn(v, wd, 1, stride)
1904
1905 3267178 lf_8_fns(4)
1906 4002552 lf_8_fns(8)
1907 2723846 lf_8_fns(16)
1908
1909 #undef lf_8_fn
1910 #undef lf_8_fns
1911
1912 #define lf_16_fn(dir, stridea) \
1913 static void loop_filter_##dir##_16_16_c(uint8_t *dst, \
1914 ptrdiff_t stride, \
1915 int E, int I, int H) \
1916 { \
1917 loop_filter_##dir##_16_8_c(dst, stride, E, I, H); \
1918 loop_filter_##dir##_16_8_c(dst + 8 * stridea, stride, E, I, H); \
1919 }
1920
1921 337995 lf_16_fn(h, stride)
1922 341932 lf_16_fn(v, sizeof(pixel))
1923
1924 #undef lf_16_fn
1925
1926 #define lf_mix_fn(dir, wd1, wd2, stridea) \
1927 static void loop_filter_##dir##_##wd1##wd2##_16_c(uint8_t *dst, \
1928 ptrdiff_t stride, \
1929 int E, int I, int H) \
1930 { \
1931 loop_filter_##dir##_##wd1##_8_c(dst, stride, E & 0xff, I & 0xff, H & 0xff); \
1932 loop_filter_##dir##_##wd2##_8_c(dst + 8 * stridea, stride, E >> 8, I >> 8, H >> 8); \
1933 }
1934
1935 #define lf_mix_fns(wd1, wd2) \
1936 lf_mix_fn(h, wd1, wd2, stride) \
1937 lf_mix_fn(v, wd1, wd2, sizeof(pixel))
1938
1939 1036846 lf_mix_fns(4, 4)
1940 260888 lf_mix_fns(4, 8)
1941 266468 lf_mix_fns(8, 4)
1942 1698926 lf_mix_fns(8, 8)
1943
1944 #undef lf_mix_fn
1945 #undef lf_mix_fns
1946
1947 689 static av_cold void vp9dsp_loopfilter_init(VP9DSPContext *dsp)
1948 {
1949 689 dsp->loop_filter_8[0][0] = loop_filter_h_4_8_c;
1950 689 dsp->loop_filter_8[0][1] = loop_filter_v_4_8_c;
1951 689 dsp->loop_filter_8[1][0] = loop_filter_h_8_8_c;
1952 689 dsp->loop_filter_8[1][1] = loop_filter_v_8_8_c;
1953 689 dsp->loop_filter_8[2][0] = loop_filter_h_16_8_c;
1954 689 dsp->loop_filter_8[2][1] = loop_filter_v_16_8_c;
1955
1956 689 dsp->loop_filter_16[0] = loop_filter_h_16_16_c;
1957 689 dsp->loop_filter_16[1] = loop_filter_v_16_16_c;
1958
1959 689 dsp->loop_filter_mix2[0][0][0] = loop_filter_h_44_16_c;
1960 689 dsp->loop_filter_mix2[0][0][1] = loop_filter_v_44_16_c;
1961 689 dsp->loop_filter_mix2[0][1][0] = loop_filter_h_48_16_c;
1962 689 dsp->loop_filter_mix2[0][1][1] = loop_filter_v_48_16_c;
1963 689 dsp->loop_filter_mix2[1][0][0] = loop_filter_h_84_16_c;
1964 689 dsp->loop_filter_mix2[1][0][1] = loop_filter_v_84_16_c;
1965 689 dsp->loop_filter_mix2[1][1][0] = loop_filter_h_88_16_c;
1966 689 dsp->loop_filter_mix2[1][1][1] = loop_filter_v_88_16_c;
1967 689 }
1968
1969 #if BIT_DEPTH != 12
1970
1971 169264 static av_always_inline void copy_c(uint8_t *restrict dst, ptrdiff_t dst_stride,
1972 const uint8_t *restrict src,
1973 ptrdiff_t src_stride, int w, int h)
1974 {
1975 do {
1976 2002972 memcpy(dst, src, w * sizeof(pixel));
1977
1978 2002972 dst += dst_stride;
1979 2002972 src += src_stride;
1980
2/2
✓ Branch 0 taken 1833708 times.
✓ Branch 1 taken 169264 times.
2002972 } while (--h);
1981 169264 }
1982
1983 6651 static av_always_inline void avg_c(uint8_t *restrict _dst, ptrdiff_t dst_stride,
1984 const uint8_t *restrict _src,
1985 ptrdiff_t src_stride, int w, int h)
1986 {
1987 6651 pixel *dst = (pixel *) _dst;
1988 6651 const pixel *src = (const pixel *) _src;
1989
1990 6651 dst_stride /= sizeof(pixel);
1991 6651 src_stride /= sizeof(pixel);
1992 do {
1993 int x;
1994
1995
2/2
✓ Branch 0 taken 307856 times.
✓ Branch 1 taken 66816 times.
374672 for (x = 0; x < w; x += 4)
1996 307856 AV_WN4PA(&dst[x], rnd_avg_pixel4(AV_RN4PA(&dst[x]), AV_RN4P(&src[x])));
1997
1998 66816 dst += dst_stride;
1999 66816 src += src_stride;
2000
2/2
✓ Branch 0 taken 60165 times.
✓ Branch 1 taken 6651 times.
66816 } while (--h);
2001 6651 }
2002
2003 #define fpel_fn(type, sz) \
2004 static void type##sz##_c(uint8_t *dst, ptrdiff_t dst_stride, \
2005 const uint8_t *src, ptrdiff_t src_stride, \
2006 int h, int mx, int my) \
2007 { \
2008 type##_c(dst, dst_stride, src, src_stride, sz, h); \
2009 }
2010
2011 #define copy_avg_fn(sz) \
2012 fpel_fn(copy, sz) \
2013 fpel_fn(avg, sz)
2014
2015 9144 copy_avg_fn(64)
2016 37592 copy_avg_fn(32)
2017 74052 copy_avg_fn(16)
2018 132402 copy_avg_fn(8)
2019 98640 copy_avg_fn(4)
2020
2021 #undef fpel_fn
2022 #undef copy_avg_fn
2023
2024 #endif /* BIT_DEPTH != 12 */
2025
2026 #define FILTER_8TAP(src, x, F, stride) \
2027 av_clip_pixel((F[0] * src[x + -3 * stride] + \
2028 F[1] * src[x + -2 * stride] + \
2029 F[2] * src[x + -1 * stride] + \
2030 F[3] * src[x + +0 * stride] + \
2031 F[4] * src[x + +1 * stride] + \
2032 F[5] * src[x + +2 * stride] + \
2033 F[6] * src[x + +3 * stride] + \
2034 F[7] * src[x + +4 * stride] + 64) >> 7)
2035
2036 475647 static av_always_inline void do_8tap_1d_c(uint8_t *_dst, ptrdiff_t dst_stride,
2037 const uint8_t *_src, ptrdiff_t src_stride,
2038 int w, int h, ptrdiff_t ds,
2039 const int16_t *filter, int avg)
2040 {
2041 475647 pixel *dst = (pixel *) _dst;
2042 475647 const pixel *src = (const pixel *) _src;
2043
2044 475647 dst_stride /= sizeof(pixel);
2045 475647 src_stride /= sizeof(pixel);
2046 do {
2047 int x;
2048
2049
2/2
✓ Branch 0 taken 66158704 times.
✓ Branch 1 taken 4287640 times.
70446344 for (x = 0; x < w; x++)
2050
2/2
✓ Branch 0 taken 5480560 times.
✓ Branch 1 taken 60678144 times.
66158704 if (avg) {
2051 5480560 dst[x] = (dst[x] + FILTER_8TAP(src, x, filter, ds) + 1) >> 1;
2052 } else {
2053 60678144 dst[x] = FILTER_8TAP(src, x, filter, ds);
2054 }
2055
2056 4287640 dst += dst_stride;
2057 4287640 src += src_stride;
2058
2/2
✓ Branch 0 taken 3811993 times.
✓ Branch 1 taken 475647 times.
4287640 } while (--h);
2059 475647 }
2060
2061 #define filter_8tap_1d_fn(opn, opa, dir, ds) \
2062 static av_noinline void opn##_8tap_1d_##dir##_c(uint8_t *dst, ptrdiff_t dst_stride, \
2063 const uint8_t *src, ptrdiff_t src_stride, \
2064 int w, int h, const int16_t *filter) \
2065 { \
2066 do_8tap_1d_c(dst, dst_stride, src, src_stride, w, h, ds, filter, opa); \
2067 }
2068
2069 188128 filter_8tap_1d_fn(put, 0, v, src_stride / sizeof(pixel))
2070 261169 filter_8tap_1d_fn(put, 0, h, 1)
2071 10802 filter_8tap_1d_fn(avg, 1, v, src_stride / sizeof(pixel))
2072 15548 filter_8tap_1d_fn(avg, 1, h, 1)
2073
2074 #undef filter_8tap_1d_fn
2075
2076 1103052 static av_always_inline void do_8tap_2d_c(uint8_t *_dst, ptrdiff_t dst_stride,
2077 const uint8_t *_src, ptrdiff_t src_stride,
2078 int w, int h, const int16_t *filterx,
2079 const int16_t *filtery, int avg)
2080 {
2081 1103052 int tmp_h = h + 7;
2082 1103052 pixel tmp[64 * 71], *tmp_ptr = tmp;
2083 1103052 pixel *dst = (pixel *) _dst;
2084 1103052 const pixel *src = (const pixel *) _src;
2085
2086 1103052 dst_stride /= sizeof(pixel);
2087 1103052 src_stride /= sizeof(pixel);
2088 1103052 src -= src_stride * 3;
2089 do {
2090 int x;
2091
2092
2/2
✓ Branch 0 taken 168602936 times.
✓ Branch 1 taken 16240032 times.
184842968 for (x = 0; x < w; x++)
2093 168602936 tmp_ptr[x] = FILTER_8TAP(src, x, filterx, 1);
2094
2095 16240032 tmp_ptr += 64;
2096 16240032 src += src_stride;
2097
2/2
✓ Branch 0 taken 15136980 times.
✓ Branch 1 taken 1103052 times.
16240032 } while (--tmp_h);
2098
2099 1103052 tmp_ptr = tmp + 64 * 3;
2100 do {
2101 int x;
2102
2103
2/2
✓ Branch 0 taken 108634384 times.
✓ Branch 1 taken 8518668 times.
117153052 for (x = 0; x < w; x++)
2104
2/2
✓ Branch 0 taken 9073296 times.
✓ Branch 1 taken 99561088 times.
108634384 if (avg) {
2105 9073296 dst[x] = (dst[x] + FILTER_8TAP(tmp_ptr, x, filtery, 64) + 1) >> 1;
2106 } else {
2107 99561088 dst[x] = FILTER_8TAP(tmp_ptr, x, filtery, 64);
2108 }
2109
2110 8518668 tmp_ptr += 64;
2111 8518668 dst += dst_stride;
2112
2/2
✓ Branch 0 taken 7415616 times.
✓ Branch 1 taken 1103052 times.
8518668 } while (--h);
2113 1103052 }
2114
2115 #define filter_8tap_2d_fn(opn, opa) \
2116 static av_noinline void opn##_8tap_2d_hv_c(uint8_t *dst, ptrdiff_t dst_stride, \
2117 const uint8_t *src, ptrdiff_t src_stride, \
2118 int w, int h, const int16_t *filterx, \
2119 const int16_t *filtery) \
2120 { \
2121 do_8tap_2d_c(dst, dst_stride, src, src_stride, w, h, filterx, filtery, opa); \
2122 }
2123
2124 1051998 filter_8tap_2d_fn(put, 0)
2125 51054 filter_8tap_2d_fn(avg, 1)
2126
2127 #undef filter_8tap_2d_fn
2128
2129 #define filter_fn_1d(sz, dir, dir_m, type, type_idx, avg) \
2130 static void avg##_8tap_##type##_##sz##dir##_c(uint8_t *dst, ptrdiff_t dst_stride, \
2131 const uint8_t *src, ptrdiff_t src_stride, \
2132 int h, int mx, int my) \
2133 { \
2134 avg##_8tap_1d_##dir##_c(dst, dst_stride, src, src_stride, sz, h, \
2135 ff_vp9_subpel_filters[type_idx][dir_m]); \
2136 }
2137
2138 #define filter_fn_2d(sz, type, type_idx, avg) \
2139 static void avg##_8tap_##type##_##sz##hv_c(uint8_t *dst, ptrdiff_t dst_stride, \
2140 const uint8_t *src, ptrdiff_t src_stride, \
2141 int h, int mx, int my) \
2142 { \
2143 avg##_8tap_2d_hv_c(dst, dst_stride, src, src_stride, sz, h, \
2144 ff_vp9_subpel_filters[type_idx][mx], \
2145 ff_vp9_subpel_filters[type_idx][my]); \
2146 }
2147
2148 #if BIT_DEPTH != 12
2149
2150 #define FILTER_BILIN(src, x, mxy, stride) \
2151 (src[x] + ((mxy * (src[x + stride] - src[x]) + 8) >> 4))
2152
2153 4325 static av_always_inline void do_bilin_1d_c(uint8_t *_dst, ptrdiff_t dst_stride,
2154 const uint8_t *_src, ptrdiff_t src_stride,
2155 int w, int h, ptrdiff_t ds, int mxy, int avg)
2156 {
2157 4325 pixel *dst = (pixel *) _dst;
2158 4325 const pixel *src = (const pixel *) _src;
2159
2160 4325 dst_stride /= sizeof(pixel);
2161 4325 src_stride /= sizeof(pixel);
2162 do {
2163 int x;
2164
2165
2/2
✓ Branch 0 taken 696480 times.
✓ Branch 1 taken 42288 times.
738768 for (x = 0; x < w; x++)
2166
2/2
✓ Branch 0 taken 87296 times.
✓ Branch 1 taken 609184 times.
696480 if (avg) {
2167 87296 dst[x] = (dst[x] + FILTER_BILIN(src, x, mxy, ds) + 1) >> 1;
2168 } else {
2169 609184 dst[x] = FILTER_BILIN(src, x, mxy, ds);
2170 }
2171
2172 42288 dst += dst_stride;
2173 42288 src += src_stride;
2174
2/2
✓ Branch 0 taken 37963 times.
✓ Branch 1 taken 4325 times.
42288 } while (--h);
2175 4325 }
2176
2177 #define bilin_1d_fn(opn, opa, dir, ds) \
2178 static av_noinline void opn##_bilin_1d_##dir##_c(uint8_t *dst, ptrdiff_t dst_stride, \
2179 const uint8_t *src, ptrdiff_t src_stride, \
2180 int w, int h, int mxy) \
2181 { \
2182 do_bilin_1d_c(dst, dst_stride, src, src_stride, w, h, ds, mxy, opa); \
2183 }
2184
2185 1537 bilin_1d_fn(put, 0, v, src_stride / sizeof(pixel))
2186 2708 bilin_1d_fn(put, 0, h, 1)
2187 40 bilin_1d_fn(avg, 1, v, src_stride / sizeof(pixel))
2188 40 bilin_1d_fn(avg, 1, h, 1)
2189
2190 #undef bilin_1d_fn
2191
2192 8321 static av_always_inline void do_bilin_2d_c(uint8_t *_dst, ptrdiff_t dst_stride,
2193 const uint8_t *_src, ptrdiff_t src_stride,
2194 int w, int h, int mx, int my, int avg)
2195 {
2196 8321 pixel tmp[64 * 65], *tmp_ptr = tmp;
2197 8321 int tmp_h = h + 1;
2198 8321 pixel *dst = (pixel *) _dst;
2199 8321 const pixel *src = (const pixel *) _src;
2200
2201 8321 dst_stride /= sizeof(pixel);
2202 8321 src_stride /= sizeof(pixel);
2203 do {
2204 int x;
2205
2206
2/2
✓ Branch 0 taken 819160 times.
✓ Branch 1 taken 72393 times.
891553 for (x = 0; x < w; x++)
2207 819160 tmp_ptr[x] = FILTER_BILIN(src, x, mx, 1);
2208
2209 72393 tmp_ptr += 64;
2210 72393 src += src_stride;
2211
2/2
✓ Branch 0 taken 64072 times.
✓ Branch 1 taken 8321 times.
72393 } while (--tmp_h);
2212
2213 8321 tmp_ptr = tmp;
2214 do {
2215 int x;
2216
2217
2/2
✓ Branch 0 taken 751904 times.
✓ Branch 1 taken 64072 times.
815976 for (x = 0; x < w; x++)
2218
2/2
✓ Branch 0 taken 43648 times.
✓ Branch 1 taken 708256 times.
751904 if (avg) {
2219 43648 dst[x] = (dst[x] + FILTER_BILIN(tmp_ptr, x, my, 64) + 1) >> 1;
2220 } else {
2221 708256 dst[x] = FILTER_BILIN(tmp_ptr, x, my, 64);
2222 }
2223
2224 64072 tmp_ptr += 64;
2225 64072 dst += dst_stride;
2226
2/2
✓ Branch 0 taken 55751 times.
✓ Branch 1 taken 8321 times.
64072 } while (--h);
2227 8321 }
2228
2229 #define bilin_2d_fn(opn, opa) \
2230 static av_noinline void opn##_bilin_2d_hv_c(uint8_t *dst, ptrdiff_t dst_stride, \
2231 const uint8_t *src, ptrdiff_t src_stride, \
2232 int w, int h, int mx, int my) \
2233 { \
2234 do_bilin_2d_c(dst, dst_stride, src, src_stride, w, h, mx, my, opa); \
2235 }
2236
2237 8281 bilin_2d_fn(put, 0)
2238 40 bilin_2d_fn(avg, 1)
2239
2240 #undef bilin_2d_fn
2241
2242 #define bilinf_fn_1d(sz, dir, dir_m, avg) \
2243 static void avg##_bilin_##sz##dir##_c(uint8_t *dst, ptrdiff_t dst_stride, \
2244 const uint8_t *src, ptrdiff_t src_stride, \
2245 int h, int mx, int my) \
2246 { \
2247 avg##_bilin_1d_##dir##_c(dst, dst_stride, src, src_stride, sz, h, dir_m); \
2248 }
2249
2250 #define bilinf_fn_2d(sz, avg) \
2251 static void avg##_bilin_##sz##hv_c(uint8_t *dst, ptrdiff_t dst_stride, \
2252 const uint8_t *src, ptrdiff_t src_stride, \
2253 int h, int mx, int my) \
2254 { \
2255 avg##_bilin_2d_hv_c(dst, dst_stride, src, src_stride, sz, h, mx, my); \
2256 }
2257
2258 #else
2259
2260 #define bilinf_fn_1d(a, b, c, d)
2261 #define bilinf_fn_2d(a, b)
2262
2263 #endif
2264
2265 #define filter_fn(sz, avg) \
2266 filter_fn_1d(sz, h, mx, regular, FILTER_8TAP_REGULAR, avg) \
2267 filter_fn_1d(sz, v, my, regular, FILTER_8TAP_REGULAR, avg) \
2268 filter_fn_2d(sz, regular, FILTER_8TAP_REGULAR, avg) \
2269 filter_fn_1d(sz, h, mx, smooth, FILTER_8TAP_SMOOTH, avg) \
2270 filter_fn_1d(sz, v, my, smooth, FILTER_8TAP_SMOOTH, avg) \
2271 filter_fn_2d(sz, smooth, FILTER_8TAP_SMOOTH, avg) \
2272 filter_fn_1d(sz, h, mx, sharp, FILTER_8TAP_SHARP, avg) \
2273 filter_fn_1d(sz, v, my, sharp, FILTER_8TAP_SHARP, avg) \
2274 filter_fn_2d(sz, sharp, FILTER_8TAP_SHARP, avg) \
2275 bilinf_fn_1d(sz, h, mx, avg) \
2276 bilinf_fn_1d(sz, v, my, avg) \
2277 bilinf_fn_2d(sz, avg)
2278
2279 #define filter_fn_set(avg) \
2280 filter_fn(64, avg) \
2281 filter_fn(32, avg) \
2282 filter_fn(16, avg) \
2283 filter_fn(8, avg) \
2284 filter_fn(4, avg)
2285
2286 3027642 filter_fn_set(put)
2287 155048 filter_fn_set(avg)
2288
2289 #undef filter_fn
2290 #undef filter_fn_set
2291 #undef filter_fn_1d
2292 #undef filter_fn_2d
2293 #undef bilinf_fn_1d
2294 #undef bilinf_fn_2d
2295
2296 #if BIT_DEPTH != 8
2297 void ff_vp9dsp_mc_init_10(VP9DSPContext *dsp);
2298 #endif
2299 #if BIT_DEPTH != 10
2300 static
2301 #endif
2302 769 av_cold void FUNC(ff_vp9dsp_mc_init)(VP9DSPContext *dsp)
2303 {
2304 #if BIT_DEPTH == 12
2305 80 ff_vp9dsp_mc_init_10(dsp);
2306 #else /* BIT_DEPTH == 12 */
2307
2308 #define init_fpel(idx1, idx2, sz, type) \
2309 dsp->mc[idx1][FILTER_8TAP_SMOOTH ][idx2][0][0] = type##sz##_c; \
2310 dsp->mc[idx1][FILTER_8TAP_REGULAR][idx2][0][0] = type##sz##_c; \
2311 dsp->mc[idx1][FILTER_8TAP_SHARP ][idx2][0][0] = type##sz##_c; \
2312 dsp->mc[idx1][FILTER_BILINEAR ][idx2][0][0] = type##sz##_c
2313
2314 #define init_copy_avg(idx, sz) \
2315 init_fpel(idx, 0, sz, copy); \
2316 init_fpel(idx, 1, sz, avg)
2317
2318 689 init_copy_avg(0, 64);
2319 689 init_copy_avg(1, 32);
2320 689 init_copy_avg(2, 16);
2321 689 init_copy_avg(3, 8);
2322 689 init_copy_avg(4, 4);
2323
2324 #undef init_copy_avg
2325 #undef init_fpel
2326
2327 #endif /* BIT_DEPTH == 12 */
2328
2329 #define init_subpel1_bd_aware(idx1, idx2, idxh, idxv, sz, dir, type) \
2330 dsp->mc[idx1][FILTER_8TAP_SMOOTH ][idx2][idxh][idxv] = type##_8tap_smooth_##sz##dir##_c; \
2331 dsp->mc[idx1][FILTER_8TAP_REGULAR][idx2][idxh][idxv] = type##_8tap_regular_##sz##dir##_c; \
2332 dsp->mc[idx1][FILTER_8TAP_SHARP ][idx2][idxh][idxv] = type##_8tap_sharp_##sz##dir##_c
2333
2334 #if BIT_DEPTH == 12
2335 #define init_subpel1 init_subpel1_bd_aware
2336 #else
2337 #define init_subpel1(idx1, idx2, idxh, idxv, sz, dir, type) \
2338 init_subpel1_bd_aware(idx1, idx2, idxh, idxv, sz, dir, type); \
2339 dsp->mc[idx1][FILTER_BILINEAR ][idx2][idxh][idxv] = type##_bilin_##sz##dir##_c
2340 #endif
2341
2342 #define init_subpel2(idx, idxh, idxv, dir, type) \
2343 init_subpel1(0, idx, idxh, idxv, 64, dir, type); \
2344 init_subpel1(1, idx, idxh, idxv, 32, dir, type); \
2345 init_subpel1(2, idx, idxh, idxv, 16, dir, type); \
2346 init_subpel1(3, idx, idxh, idxv, 8, dir, type); \
2347 init_subpel1(4, idx, idxh, idxv, 4, dir, type)
2348
2349 #define init_subpel3(idx, type) \
2350 init_subpel2(idx, 1, 1, hv, type); \
2351 init_subpel2(idx, 0, 1, v, type); \
2352 init_subpel2(idx, 1, 0, h, type)
2353
2354 769 init_subpel3(0, put);
2355 769 init_subpel3(1, avg);
2356
2357 #undef init_subpel1
2358 #undef init_subpel2
2359 #undef init_subpel3
2360 #undef init_subpel1_bd_aware
2361 769 }
2362
2363 2067 static av_always_inline void do_scaled_8tap_c(uint8_t *_dst, ptrdiff_t dst_stride,
2364 const uint8_t *_src, ptrdiff_t src_stride,
2365 int w, int h, int mx, int my,
2366 int dx, int dy, int avg,
2367 const int16_t (*filters)[8])
2368 {
2369 2067 int tmp_h = (((h - 1) * dy + my) >> 4) + 8;
2370 2067 pixel tmp[64 * 135], *tmp_ptr = tmp;
2371 2067 pixel *dst = (pixel *) _dst;
2372 2067 const pixel *src = (const pixel *) _src;
2373
2374 2067 dst_stride /= sizeof(pixel);
2375 2067 src_stride /= sizeof(pixel);
2376 2067 src -= src_stride * 3;
2377 do {
2378 int x;
2379 30118 int imx = mx, ioff = 0;
2380
2381
2/2
✓ Branch 0 taken 335448 times.
✓ Branch 1 taken 30118 times.
365566 for (x = 0; x < w; x++) {
2382 335448 tmp_ptr[x] = FILTER_8TAP(src, ioff, filters[imx], 1);
2383 335448 imx += dx;
2384 335448 ioff += imx >> 4;
2385 335448 imx &= 0xf;
2386 }
2387
2388 30118 tmp_ptr += 64;
2389 30118 src += src_stride;
2390
2/2
✓ Branch 0 taken 28051 times.
✓ Branch 1 taken 2067 times.
30118 } while (--tmp_h);
2391
2392 2067 tmp_ptr = tmp + 64 * 3;
2393 do {
2394 int x;
2395 17088 const int16_t *filter = filters[my];
2396
2397
2/2
✓ Branch 0 taken 224064 times.
✓ Branch 1 taken 17088 times.
241152 for (x = 0; x < w; x++)
2398
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 224064 times.
224064 if (avg) {
2399 dst[x] = (dst[x] + FILTER_8TAP(tmp_ptr, x, filter, 64) + 1) >> 1;
2400 } else {
2401 224064 dst[x] = FILTER_8TAP(tmp_ptr, x, filter, 64);
2402 }
2403
2404 17088 my += dy;
2405 17088 tmp_ptr += (my >> 4) * 64;
2406 17088 my &= 0xf;
2407 17088 dst += dst_stride;
2408
2/2
✓ Branch 0 taken 15021 times.
✓ Branch 1 taken 2067 times.
17088 } while (--h);
2409 2067 }
2410
2411 #define scaled_filter_8tap_fn(opn, opa) \
2412 static av_noinline void opn##_scaled_8tap_c(uint8_t *dst, ptrdiff_t dst_stride, \
2413 const uint8_t *src, ptrdiff_t src_stride, \
2414 int w, int h, int mx, int my, int dx, int dy, \
2415 const int16_t (*filters)[8]) \
2416 { \
2417 do_scaled_8tap_c(dst, dst_stride, src, src_stride, w, h, mx, my, dx, dy, \
2418 opa, filters); \
2419 }
2420
2421 2067 scaled_filter_8tap_fn(put, 0)
2422 scaled_filter_8tap_fn(avg, 1)
2423
2424 #undef scaled_filter_8tap_fn
2425
2426 #undef FILTER_8TAP
2427
2428 #define scaled_filter_fn(sz, type, type_idx, avg) \
2429 static void avg##_scaled_##type##_##sz##_c(uint8_t *dst, ptrdiff_t dst_stride, \
2430 const uint8_t *src, ptrdiff_t src_stride, \
2431 int h, int mx, int my, int dx, int dy) \
2432 { \
2433 avg##_scaled_8tap_c(dst, dst_stride, src, src_stride, sz, h, mx, my, dx, dy, \
2434 ff_vp9_subpel_filters[type_idx]); \
2435 }
2436
2437 #if BIT_DEPTH != 12
2438
2439 static av_always_inline void do_scaled_bilin_c(uint8_t *_dst, ptrdiff_t dst_stride,
2440 const uint8_t *_src, ptrdiff_t src_stride,
2441 int w, int h, int mx, int my,
2442 int dx, int dy, int avg)
2443 {
2444 pixel tmp[64 * 129], *tmp_ptr = tmp;
2445 int tmp_h = (((h - 1) * dy + my) >> 4) + 2;
2446 pixel *dst = (pixel *) _dst;
2447 const pixel *src = (const pixel *) _src;
2448
2449 dst_stride /= sizeof(pixel);
2450 src_stride /= sizeof(pixel);
2451 do {
2452 int x;
2453 int imx = mx, ioff = 0;
2454
2455 for (x = 0; x < w; x++) {
2456 tmp_ptr[x] = FILTER_BILIN(src, ioff, imx, 1);
2457 imx += dx;
2458 ioff += imx >> 4;
2459 imx &= 0xf;
2460 }
2461
2462 tmp_ptr += 64;
2463 src += src_stride;
2464 } while (--tmp_h);
2465
2466 tmp_ptr = tmp;
2467 do {
2468 int x;
2469
2470 for (x = 0; x < w; x++)
2471 if (avg) {
2472 dst[x] = (dst[x] + FILTER_BILIN(tmp_ptr, x, my, 64) + 1) >> 1;
2473 } else {
2474 dst[x] = FILTER_BILIN(tmp_ptr, x, my, 64);
2475 }
2476
2477 my += dy;
2478 tmp_ptr += (my >> 4) * 64;
2479 my &= 0xf;
2480 dst += dst_stride;
2481 } while (--h);
2482 }
2483
2484 #define scaled_bilin_fn(opn, opa) \
2485 static av_noinline void opn##_scaled_bilin_c(uint8_t *dst, ptrdiff_t dst_stride, \
2486 const uint8_t *src, ptrdiff_t src_stride, \
2487 int w, int h, int mx, int my, int dx, int dy) \
2488 { \
2489 do_scaled_bilin_c(dst, dst_stride, src, src_stride, w, h, mx, my, dx, dy, opa); \
2490 }
2491
2492 scaled_bilin_fn(put, 0)
2493 scaled_bilin_fn(avg, 1)
2494
2495 #undef scaled_bilin_fn
2496
2497 #undef FILTER_BILIN
2498
2499 #define scaled_bilinf_fn(sz, avg) \
2500 static void avg##_scaled_bilin_##sz##_c(uint8_t *dst, ptrdiff_t dst_stride, \
2501 const uint8_t *src, ptrdiff_t src_stride, \
2502 int h, int mx, int my, int dx, int dy) \
2503 { \
2504 avg##_scaled_bilin_c(dst, dst_stride, src, src_stride, sz, h, mx, my, dx, dy); \
2505 }
2506
2507 #else
2508
2509 #define scaled_bilinf_fn(a, b)
2510
2511 #endif
2512
2513 #define scaled_filter_fns(sz, avg) \
2514 scaled_filter_fn(sz, regular, FILTER_8TAP_REGULAR, avg) \
2515 scaled_filter_fn(sz, smooth, FILTER_8TAP_SMOOTH, avg) \
2516 scaled_filter_fn(sz, sharp, FILTER_8TAP_SHARP, avg) \
2517 scaled_bilinf_fn(sz, avg)
2518
2519 #define scaled_filter_fn_set(avg) \
2520 scaled_filter_fns(64, avg) \
2521 scaled_filter_fns(32, avg) \
2522 scaled_filter_fns(16, avg) \
2523 scaled_filter_fns(8, avg) \
2524 scaled_filter_fns(4, avg)
2525
2526 4134 scaled_filter_fn_set(put)
2527 scaled_filter_fn_set(avg)
2528
2529 #undef scaled_filter_fns
2530 #undef scaled_filter_fn_set
2531 #undef scaled_filter_fn
2532 #undef scaled_bilinf_fn
2533
2534 #if BIT_DEPTH != 8
2535 void ff_vp9dsp_scaled_mc_init_10(VP9DSPContext *dsp);
2536 #endif
2537 #if BIT_DEPTH != 10
2538 static
2539 #endif
2540 769 av_cold void FUNC(ff_vp9dsp_scaled_mc_init)(VP9DSPContext *dsp)
2541 {
2542 #define init_scaled_bd_aware(idx1, idx2, sz, type) \
2543 dsp->smc[idx1][FILTER_8TAP_SMOOTH ][idx2] = type##_scaled_smooth_##sz##_c; \
2544 dsp->smc[idx1][FILTER_8TAP_REGULAR][idx2] = type##_scaled_regular_##sz##_c; \
2545 dsp->smc[idx1][FILTER_8TAP_SHARP ][idx2] = type##_scaled_sharp_##sz##_c
2546
2547 #if BIT_DEPTH == 12
2548 80 ff_vp9dsp_scaled_mc_init_10(dsp);
2549 #define init_scaled(a,b,c,d) init_scaled_bd_aware(a,b,c,d)
2550 #else
2551 #define init_scaled(idx1, idx2, sz, type) \
2552 init_scaled_bd_aware(idx1, idx2, sz, type); \
2553 dsp->smc[idx1][FILTER_BILINEAR ][idx2] = type##_scaled_bilin_##sz##_c
2554 #endif
2555
2556 #define init_scaled_put_avg(idx, sz) \
2557 init_scaled(idx, 0, sz, put); \
2558 init_scaled(idx, 1, sz, avg)
2559
2560 769 init_scaled_put_avg(0, 64);
2561 769 init_scaled_put_avg(1, 32);
2562 769 init_scaled_put_avg(2, 16);
2563 769 init_scaled_put_avg(3, 8);
2564 769 init_scaled_put_avg(4, 4);
2565
2566 #undef init_scaled_put_avg
2567 #undef init_scaled
2568 #undef init_scaled_bd_aware
2569 769 }
2570
2571 689 av_cold void FUNC(ff_vp9dsp_init)(VP9DSPContext *dsp)
2572 {
2573 689 FUNC(ff_vp9dsp_intrapred_init)(dsp);
2574 689 vp9dsp_itxfm_init(dsp);
2575 689 vp9dsp_loopfilter_init(dsp);
2576 689 FUNC(ff_vp9dsp_mc_init)(dsp);
2577 689 FUNC(ff_vp9dsp_scaled_mc_init)(dsp);
2578 689 }
2579