FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavcodec/vc1dsp.c
Date: 2022-07-07 01:21:54
Exec Total Coverage
Lines: 441 501 88.0%
Branches: 102 124 82.3%

Line Branch Exec Source
1 /*
2 * VC-1 and WMV3 decoder - DSP functions
3 * Copyright (c) 2006 Konstantin Shishkov
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22 /**
23 * @file
24 * VC-1 and WMV3 decoder
25 */
26
27 #include "config_components.h"
28
29 #include "libavutil/avassert.h"
30 #include "libavutil/common.h"
31 #include "libavutil/intreadwrite.h"
32 #include "h264chroma.h"
33 #include "qpeldsp.h"
34 #include "rnd_avg.h"
35 #include "vc1dsp.h"
36 #include "startcode.h"
37 #include "vc1_common.h"
38
39 /* Apply overlap transform to horizontal edge */
40 static void vc1_v_overlap_c(uint8_t *src, ptrdiff_t stride)
41 {
42 int i;
43 int a, b, c, d;
44 int d1, d2;
45 int rnd = 1;
46 for (i = 0; i < 8; i++) {
47 a = src[-2 * stride];
48 b = src[-stride];
49 c = src[0];
50 d = src[stride];
51 d1 = (a - d + 3 + rnd) >> 3;
52 d2 = (a - d + b - c + 4 - rnd) >> 3;
53
54 src[-2 * stride] = a - d1;
55 src[-stride] = av_clip_uint8(b - d2);
56 src[0] = av_clip_uint8(c + d2);
57 src[stride] = d + d1;
58 src++;
59 rnd = !rnd;
60 }
61 }
62
63 /* Apply overlap transform to vertical edge */
64 static void vc1_h_overlap_c(uint8_t *src, ptrdiff_t stride)
65 {
66 int i;
67 int a, b, c, d;
68 int d1, d2;
69 int rnd = 1;
70 for (i = 0; i < 8; i++) {
71 a = src[-2];
72 b = src[-1];
73 c = src[0];
74 d = src[1];
75 d1 = (a - d + 3 + rnd) >> 3;
76 d2 = (a - d + b - c + 4 - rnd) >> 3;
77
78 src[-2] = a - d1;
79 src[-1] = av_clip_uint8(b - d2);
80 src[0] = av_clip_uint8(c + d2);
81 src[1] = d + d1;
82 src += stride;
83 rnd = !rnd;
84 }
85 }
86
87 1228 static void vc1_v_s_overlap_c(int16_t *top, int16_t *bottom)
88 {
89 int i;
90 int a, b, c, d;
91 int d1, d2;
92 1228 int rnd1 = 4, rnd2 = 3;
93
2/2
✓ Branch 0 taken 9824 times.
✓ Branch 1 taken 1228 times.
11052 for (i = 0; i < 8; i++) {
94 9824 a = top[48];
95 9824 b = top[56];
96 9824 c = bottom[0];
97 9824 d = bottom[8];
98 9824 d1 = a - d;
99 9824 d2 = a - d + b - c;
100
101 9824 top[48] = ((a * 8) - d1 + rnd1) >> 3;
102 9824 top[56] = ((b * 8) - d2 + rnd2) >> 3;
103 9824 bottom[0] = ((c * 8) + d2 + rnd1) >> 3;
104 9824 bottom[8] = ((d * 8) + d1 + rnd2) >> 3;
105
106 9824 bottom++;
107 9824 top++;
108 9824 rnd2 = 7 - rnd2;
109 9824 rnd1 = 7 - rnd1;
110 }
111 1228 }
112
113 1344 static void vc1_h_s_overlap_c(int16_t *left, int16_t *right, ptrdiff_t left_stride, ptrdiff_t right_stride, int flags)
114 {
115 int i;
116 int a, b, c, d;
117 int d1, d2;
118
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1344 times.
1344 int rnd1 = flags & 2 ? 3 : 4;
119 1344 int rnd2 = 7 - rnd1;
120
2/2
✓ Branch 0 taken 10752 times.
✓ Branch 1 taken 1344 times.
12096 for (i = 0; i < 8; i++) {
121 10752 a = left[6];
122 10752 b = left[7];
123 10752 c = right[0];
124 10752 d = right[1];
125 10752 d1 = a - d;
126 10752 d2 = a - d + b - c;
127
128 10752 left[6] = ((a * 8) - d1 + rnd1) >> 3;
129 10752 left[7] = ((b * 8) - d2 + rnd2) >> 3;
130 10752 right[0] = ((c * 8) + d2 + rnd1) >> 3;
131 10752 right[1] = ((d * 8) + d1 + rnd2) >> 3;
132
133 10752 right += right_stride;
134 10752 left += left_stride;
135
1/2
✓ Branch 0 taken 10752 times.
✗ Branch 1 not taken.
10752 if (flags & 1) {
136 10752 rnd2 = 7 - rnd2;
137 10752 rnd1 = 7 - rnd1;
138 }
139 }
140 1344 }
141
142 /**
143 * VC-1 in-loop deblocking filter for one line
144 * @param src source block type
145 * @param stride block stride
146 * @param pq block quantizer
147 * @return whether other 3 pairs should be filtered or not
148 * @see 8.6
149 */
150 12707932 static av_always_inline int vc1_filter_line(uint8_t *src, ptrdiff_t stride, int pq)
151 {
152 12707932 int a0 = (2 * (src[-2 * stride] - src[1 * stride]) -
153 12707932 5 * (src[-1 * stride] - src[0 * stride]) + 4) >> 3;
154 12707932 int a0_sign = a0 >> 31; /* Store sign */
155
156 12707932 a0 = (a0 ^ a0_sign) - a0_sign; /* a0 = FFABS(a0); */
157
2/2
✓ Branch 0 taken 11357682 times.
✓ Branch 1 taken 1350250 times.
12707932 if (a0 < pq) {
158 11357682 int a1 = FFABS((2 * (src[-4 * stride] - src[-1 * stride]) -
159 5 * (src[-3 * stride] - src[-2 * stride]) + 4) >> 3);
160 11357682 int a2 = FFABS((2 * (src[ 0 * stride] - src[ 3 * stride]) -
161 5 * (src[ 1 * stride] - src[ 2 * stride]) + 4) >> 3);
162
4/4
✓ Branch 0 taken 6046070 times.
✓ Branch 1 taken 5311612 times.
✓ Branch 2 taken 1325610 times.
✓ Branch 3 taken 4720460 times.
11357682 if (a1 < a0 || a2 < a0) {
163 6637222 int clip = src[-1 * stride] - src[0 * stride];
164 6637222 int clip_sign = clip >> 31;
165
166 6637222 clip = ((clip ^ clip_sign) - clip_sign) >> 1;
167
2/2
✓ Branch 0 taken 5378649 times.
✓ Branch 1 taken 1258573 times.
6637222 if (clip) {
168 5378649 int a3 = FFMIN(a1, a2);
169 5378649 int d = 5 * (a3 - a0);
170 5378649 int d_sign = (d >> 31);
171
172 5378649 d = ((d ^ d_sign) - d_sign) >> 3;
173 5378649 d_sign ^= a0_sign;
174
175
2/2
✓ Branch 0 taken 326919 times.
✓ Branch 1 taken 5051730 times.
5378649 if (d_sign ^ clip_sign)
176 326919 d = 0;
177 else {
178 5051730 d = FFMIN(d, clip);
179 5051730 d = (d ^ d_sign) - d_sign; /* Restore sign */
180 5051730 src[-1 * stride] = av_clip_uint8(src[-1 * stride] - d);
181 5051730 src[ 0 * stride] = av_clip_uint8(src[ 0 * stride] + d);
182 }
183 5378649 return 1;
184 }
185 }
186 }
187 7329283 return 0;
188 }
189
190 /**
191 * VC-1 in-loop deblocking filter
192 * @param src source block type
193 * @param step distance between horizontally adjacent elements
194 * @param stride distance between vertically adjacent elements
195 * @param len edge length to filter (4 or 8 pixels)
196 * @param pq block quantizer
197 * @see 8.6
198 */
199 3850084 static inline void vc1_loop_filter(uint8_t *src, int step, ptrdiff_t stride,
200 int len, int pq)
201 {
202 int i;
203 int filt3;
204
205
2/2
✓ Branch 0 taken 6549103 times.
✓ Branch 1 taken 3850084 times.
10399187 for (i = 0; i < len; i += 4) {
206 6549103 filt3 = vc1_filter_line(src + 2 * step, stride, pq);
207
2/2
✓ Branch 0 taken 2052943 times.
✓ Branch 1 taken 4496160 times.
6549103 if (filt3) {
208 2052943 vc1_filter_line(src + 0 * step, stride, pq);
209 2052943 vc1_filter_line(src + 1 * step, stride, pq);
210 2052943 vc1_filter_line(src + 3 * step, stride, pq);
211 }
212 6549103 src += step * 4;
213 }
214 3850084 }
215
216 427296 static void vc1_v_loop_filter4_c(uint8_t *src, ptrdiff_t stride, int pq)
217 {
218 427296 vc1_loop_filter(src, 1, stride, 4, pq);
219 427296 }
220
221 960369 static void vc1_h_loop_filter4_c(uint8_t *src, ptrdiff_t stride, int pq)
222 {
223 960369 vc1_loop_filter(src, stride, 1, 4, pq);
224 960369 }
225
226 1360229 static void vc1_v_loop_filter8_c(uint8_t *src, ptrdiff_t stride, int pq)
227 {
228 1360229 vc1_loop_filter(src, 1, stride, 8, pq);
229 1360229 }
230
231 983890 static void vc1_h_loop_filter8_c(uint8_t *src, ptrdiff_t stride, int pq)
232 {
233 983890 vc1_loop_filter(src, stride, 1, 8, pq);
234 983890 }
235
236 72192 static void vc1_v_loop_filter16_c(uint8_t *src, ptrdiff_t stride, int pq)
237 {
238 72192 vc1_loop_filter(src, 1, stride, 16, pq);
239 72192 }
240
241 46108 static void vc1_h_loop_filter16_c(uint8_t *src, ptrdiff_t stride, int pq)
242 {
243 46108 vc1_loop_filter(src, stride, 1, 16, pq);
244 46108 }
245
246 /* Do inverse transform on 8x8 block */
247 48586 static void vc1_inv_trans_8x8_dc_c(uint8_t *dest, ptrdiff_t stride, int16_t *block)
248 {
249 int i;
250 48586 int dc = block[0];
251
252 48586 dc = (3 * dc + 1) >> 1;
253 48586 dc = (3 * dc + 16) >> 5;
254
255
2/2
✓ Branch 0 taken 388688 times.
✓ Branch 1 taken 48586 times.
437274 for (i = 0; i < 8; i++) {
256 388688 dest[0] = av_clip_uint8(dest[0] + dc);
257 388688 dest[1] = av_clip_uint8(dest[1] + dc);
258 388688 dest[2] = av_clip_uint8(dest[2] + dc);
259 388688 dest[3] = av_clip_uint8(dest[3] + dc);
260 388688 dest[4] = av_clip_uint8(dest[4] + dc);
261 388688 dest[5] = av_clip_uint8(dest[5] + dc);
262 388688 dest[6] = av_clip_uint8(dest[6] + dc);
263 388688 dest[7] = av_clip_uint8(dest[7] + dc);
264 388688 dest += stride;
265 }
266 48586 }
267
268 704275 static void vc1_inv_trans_8x8_c(int16_t block[64])
269 {
270 int i;
271 register int t1, t2, t3, t4, t5, t6, t7, t8;
272 int16_t *src, *dst, temp[64];
273
274 704275 src = block;
275 704275 dst = temp;
276
2/2
✓ Branch 0 taken 5634200 times.
✓ Branch 1 taken 704275 times.
6338475 for (i = 0; i < 8; i++) {
277 5634200 t1 = 12 * (src[ 0] + src[32]) + 4;
278 5634200 t2 = 12 * (src[ 0] - src[32]) + 4;
279 5634200 t3 = 16 * src[16] + 6 * src[48];
280 5634200 t4 = 6 * src[16] - 16 * src[48];
281
282 5634200 t5 = t1 + t3;
283 5634200 t6 = t2 + t4;
284 5634200 t7 = t2 - t4;
285 5634200 t8 = t1 - t3;
286
287 5634200 t1 = 16 * src[ 8] + 15 * src[24] + 9 * src[40] + 4 * src[56];
288 5634200 t2 = 15 * src[ 8] - 4 * src[24] - 16 * src[40] - 9 * src[56];
289 5634200 t3 = 9 * src[ 8] - 16 * src[24] + 4 * src[40] + 15 * src[56];
290 5634200 t4 = 4 * src[ 8] - 9 * src[24] + 15 * src[40] - 16 * src[56];
291
292 5634200 dst[0] = (t5 + t1) >> 3;
293 5634200 dst[1] = (t6 + t2) >> 3;
294 5634200 dst[2] = (t7 + t3) >> 3;
295 5634200 dst[3] = (t8 + t4) >> 3;
296 5634200 dst[4] = (t8 - t4) >> 3;
297 5634200 dst[5] = (t7 - t3) >> 3;
298 5634200 dst[6] = (t6 - t2) >> 3;
299 5634200 dst[7] = (t5 - t1) >> 3;
300
301 5634200 src += 1;
302 5634200 dst += 8;
303 }
304
305 704275 src = temp;
306 704275 dst = block;
307
2/2
✓ Branch 0 taken 5634200 times.
✓ Branch 1 taken 704275 times.
6338475 for (i = 0; i < 8; i++) {
308 5634200 t1 = 12 * (src[ 0] + src[32]) + 64;
309 5634200 t2 = 12 * (src[ 0] - src[32]) + 64;
310 5634200 t3 = 16 * src[16] + 6 * src[48];
311 5634200 t4 = 6 * src[16] - 16 * src[48];
312
313 5634200 t5 = t1 + t3;
314 5634200 t6 = t2 + t4;
315 5634200 t7 = t2 - t4;
316 5634200 t8 = t1 - t3;
317
318 5634200 t1 = 16 * src[ 8] + 15 * src[24] + 9 * src[40] + 4 * src[56];
319 5634200 t2 = 15 * src[ 8] - 4 * src[24] - 16 * src[40] - 9 * src[56];
320 5634200 t3 = 9 * src[ 8] - 16 * src[24] + 4 * src[40] + 15 * src[56];
321 5634200 t4 = 4 * src[ 8] - 9 * src[24] + 15 * src[40] - 16 * src[56];
322
323 5634200 dst[ 0] = (t5 + t1) >> 7;
324 5634200 dst[ 8] = (t6 + t2) >> 7;
325 5634200 dst[16] = (t7 + t3) >> 7;
326 5634200 dst[24] = (t8 + t4) >> 7;
327 5634200 dst[32] = (t8 - t4 + 1) >> 7;
328 5634200 dst[40] = (t7 - t3 + 1) >> 7;
329 5634200 dst[48] = (t6 - t2 + 1) >> 7;
330 5634200 dst[56] = (t5 - t1 + 1) >> 7;
331
332 5634200 src++;
333 5634200 dst++;
334 }
335 704275 }
336
337 /* Do inverse transform on 8x4 part of block */
338 15801 static void vc1_inv_trans_8x4_dc_c(uint8_t *dest, ptrdiff_t stride, int16_t *block)
339 {
340 int i;
341 15801 int dc = block[0];
342
343 15801 dc = (3 * dc + 1) >> 1;
344 15801 dc = (17 * dc + 64) >> 7;
345
346
2/2
✓ Branch 0 taken 63204 times.
✓ Branch 1 taken 15801 times.
79005 for (i = 0; i < 4; i++) {
347 63204 dest[0] = av_clip_uint8(dest[0] + dc);
348 63204 dest[1] = av_clip_uint8(dest[1] + dc);
349 63204 dest[2] = av_clip_uint8(dest[2] + dc);
350 63204 dest[3] = av_clip_uint8(dest[3] + dc);
351 63204 dest[4] = av_clip_uint8(dest[4] + dc);
352 63204 dest[5] = av_clip_uint8(dest[5] + dc);
353 63204 dest[6] = av_clip_uint8(dest[6] + dc);
354 63204 dest[7] = av_clip_uint8(dest[7] + dc);
355 63204 dest += stride;
356 }
357 15801 }
358
359 206617 static void vc1_inv_trans_8x4_c(uint8_t *dest, ptrdiff_t stride, int16_t *block)
360 {
361 int i;
362 register int t1, t2, t3, t4, t5, t6, t7, t8;
363 int16_t *src, *dst;
364
365 206617 src = block;
366 206617 dst = block;
367
368
2/2
✓ Branch 0 taken 826468 times.
✓ Branch 1 taken 206617 times.
1033085 for (i = 0; i < 4; i++) {
369 826468 t1 = 12 * (src[0] + src[4]) + 4;
370 826468 t2 = 12 * (src[0] - src[4]) + 4;
371 826468 t3 = 16 * src[2] + 6 * src[6];
372 826468 t4 = 6 * src[2] - 16 * src[6];
373
374 826468 t5 = t1 + t3;
375 826468 t6 = t2 + t4;
376 826468 t7 = t2 - t4;
377 826468 t8 = t1 - t3;
378
379 826468 t1 = 16 * src[1] + 15 * src[3] + 9 * src[5] + 4 * src[7];
380 826468 t2 = 15 * src[1] - 4 * src[3] - 16 * src[5] - 9 * src[7];
381 826468 t3 = 9 * src[1] - 16 * src[3] + 4 * src[5] + 15 * src[7];
382 826468 t4 = 4 * src[1] - 9 * src[3] + 15 * src[5] - 16 * src[7];
383
384 826468 dst[0] = (t5 + t1) >> 3;
385 826468 dst[1] = (t6 + t2) >> 3;
386 826468 dst[2] = (t7 + t3) >> 3;
387 826468 dst[3] = (t8 + t4) >> 3;
388 826468 dst[4] = (t8 - t4) >> 3;
389 826468 dst[5] = (t7 - t3) >> 3;
390 826468 dst[6] = (t6 - t2) >> 3;
391 826468 dst[7] = (t5 - t1) >> 3;
392
393 826468 src += 8;
394 826468 dst += 8;
395 }
396
397 206617 src = block;
398
2/2
✓ Branch 0 taken 1652936 times.
✓ Branch 1 taken 206617 times.
1859553 for (i = 0; i < 8; i++) {
399 1652936 t1 = 17 * (src[ 0] + src[16]) + 64;
400 1652936 t2 = 17 * (src[ 0] - src[16]) + 64;
401 1652936 t3 = 22 * src[ 8] + 10 * src[24];
402 1652936 t4 = 22 * src[24] - 10 * src[ 8];
403
404 1652936 dest[0 * stride] = av_clip_uint8(dest[0 * stride] + ((t1 + t3) >> 7));
405 1652936 dest[1 * stride] = av_clip_uint8(dest[1 * stride] + ((t2 - t4) >> 7));
406 1652936 dest[2 * stride] = av_clip_uint8(dest[2 * stride] + ((t2 + t4) >> 7));
407 1652936 dest[3 * stride] = av_clip_uint8(dest[3 * stride] + ((t1 - t3) >> 7));
408
409 1652936 src++;
410 1652936 dest++;
411 }
412 206617 }
413
414 /* Do inverse transform on 4x8 parts of block */
415 17901 static void vc1_inv_trans_4x8_dc_c(uint8_t *dest, ptrdiff_t stride, int16_t *block)
416 {
417 int i;
418 17901 int dc = block[0];
419
420 17901 dc = (17 * dc + 4) >> 3;
421 17901 dc = (12 * dc + 64) >> 7;
422
423
2/2
✓ Branch 0 taken 143208 times.
✓ Branch 1 taken 17901 times.
161109 for (i = 0; i < 8; i++) {
424 143208 dest[0] = av_clip_uint8(dest[0] + dc);
425 143208 dest[1] = av_clip_uint8(dest[1] + dc);
426 143208 dest[2] = av_clip_uint8(dest[2] + dc);
427 143208 dest[3] = av_clip_uint8(dest[3] + dc);
428 143208 dest += stride;
429 }
430 17901 }
431
432 208456 static void vc1_inv_trans_4x8_c(uint8_t *dest, ptrdiff_t stride, int16_t *block)
433 {
434 int i;
435 register int t1, t2, t3, t4, t5, t6, t7, t8;
436 int16_t *src, *dst;
437
438 208456 src = block;
439 208456 dst = block;
440
441
2/2
✓ Branch 0 taken 1667648 times.
✓ Branch 1 taken 208456 times.
1876104 for (i = 0; i < 8; i++) {
442 1667648 t1 = 17 * (src[0] + src[2]) + 4;
443 1667648 t2 = 17 * (src[0] - src[2]) + 4;
444 1667648 t3 = 22 * src[1] + 10 * src[3];
445 1667648 t4 = 22 * src[3] - 10 * src[1];
446
447 1667648 dst[0] = (t1 + t3) >> 3;
448 1667648 dst[1] = (t2 - t4) >> 3;
449 1667648 dst[2] = (t2 + t4) >> 3;
450 1667648 dst[3] = (t1 - t3) >> 3;
451
452 1667648 src += 8;
453 1667648 dst += 8;
454 }
455
456 208456 src = block;
457
2/2
✓ Branch 0 taken 833824 times.
✓ Branch 1 taken 208456 times.
1042280 for (i = 0; i < 4; i++) {
458 833824 t1 = 12 * (src[ 0] + src[32]) + 64;
459 833824 t2 = 12 * (src[ 0] - src[32]) + 64;
460 833824 t3 = 16 * src[16] + 6 * src[48];
461 833824 t4 = 6 * src[16] - 16 * src[48];
462
463 833824 t5 = t1 + t3;
464 833824 t6 = t2 + t4;
465 833824 t7 = t2 - t4;
466 833824 t8 = t1 - t3;
467
468 833824 t1 = 16 * src[ 8] + 15 * src[24] + 9 * src[40] + 4 * src[56];
469 833824 t2 = 15 * src[ 8] - 4 * src[24] - 16 * src[40] - 9 * src[56];
470 833824 t3 = 9 * src[ 8] - 16 * src[24] + 4 * src[40] + 15 * src[56];
471 833824 t4 = 4 * src[ 8] - 9 * src[24] + 15 * src[40] - 16 * src[56];
472
473 833824 dest[0 * stride] = av_clip_uint8(dest[0 * stride] + ((t5 + t1) >> 7));
474 833824 dest[1 * stride] = av_clip_uint8(dest[1 * stride] + ((t6 + t2) >> 7));
475 833824 dest[2 * stride] = av_clip_uint8(dest[2 * stride] + ((t7 + t3) >> 7));
476 833824 dest[3 * stride] = av_clip_uint8(dest[3 * stride] + ((t8 + t4) >> 7));
477 833824 dest[4 * stride] = av_clip_uint8(dest[4 * stride] + ((t8 - t4 + 1) >> 7));
478 833824 dest[5 * stride] = av_clip_uint8(dest[5 * stride] + ((t7 - t3 + 1) >> 7));
479 833824 dest[6 * stride] = av_clip_uint8(dest[6 * stride] + ((t6 - t2 + 1) >> 7));
480 833824 dest[7 * stride] = av_clip_uint8(dest[7 * stride] + ((t5 - t1 + 1) >> 7));
481
482 833824 src++;
483 833824 dest++;
484 }
485 208456 }
486
487 /* Do inverse transform on 4x4 part of block */
488 21187 static void vc1_inv_trans_4x4_dc_c(uint8_t *dest, ptrdiff_t stride, int16_t *block)
489 {
490 int i;
491 21187 int dc = block[0];
492
493 21187 dc = (17 * dc + 4) >> 3;
494 21187 dc = (17 * dc + 64) >> 7;
495
496
2/2
✓ Branch 0 taken 84748 times.
✓ Branch 1 taken 21187 times.
105935 for (i = 0; i < 4; i++) {
497 84748 dest[0] = av_clip_uint8(dest[0] + dc);
498 84748 dest[1] = av_clip_uint8(dest[1] + dc);
499 84748 dest[2] = av_clip_uint8(dest[2] + dc);
500 84748 dest[3] = av_clip_uint8(dest[3] + dc);
501 84748 dest += stride;
502 }
503 21187 }
504
505 168949 static void vc1_inv_trans_4x4_c(uint8_t *dest, ptrdiff_t stride, int16_t *block)
506 {
507 int i;
508 register int t1, t2, t3, t4;
509 int16_t *src, *dst;
510
511 168949 src = block;
512 168949 dst = block;
513
2/2
✓ Branch 0 taken 675796 times.
✓ Branch 1 taken 168949 times.
844745 for (i = 0; i < 4; i++) {
514 675796 t1 = 17 * (src[0] + src[2]) + 4;
515 675796 t2 = 17 * (src[0] - src[2]) + 4;
516 675796 t3 = 22 * src[1] + 10 * src[3];
517 675796 t4 = 22 * src[3] - 10 * src[1];
518
519 675796 dst[0] = (t1 + t3) >> 3;
520 675796 dst[1] = (t2 - t4) >> 3;
521 675796 dst[2] = (t2 + t4) >> 3;
522 675796 dst[3] = (t1 - t3) >> 3;
523
524 675796 src += 8;
525 675796 dst += 8;
526 }
527
528 168949 src = block;
529
2/2
✓ Branch 0 taken 675796 times.
✓ Branch 1 taken 168949 times.
844745 for (i = 0; i < 4; i++) {
530 675796 t1 = 17 * (src[0] + src[16]) + 64;
531 675796 t2 = 17 * (src[0] - src[16]) + 64;
532 675796 t3 = 22 * src[8] + 10 * src[24];
533 675796 t4 = 22 * src[24] - 10 * src[8];
534
535 675796 dest[0 * stride] = av_clip_uint8(dest[0 * stride] + ((t1 + t3) >> 7));
536 675796 dest[1 * stride] = av_clip_uint8(dest[1 * stride] + ((t2 - t4) >> 7));
537 675796 dest[2 * stride] = av_clip_uint8(dest[2 * stride] + ((t2 + t4) >> 7));
538 675796 dest[3 * stride] = av_clip_uint8(dest[3 * stride] + ((t1 - t3) >> 7));
539
540 675796 src++;
541 675796 dest++;
542 }
543 168949 }
544
545 /* motion compensation functions */
546
547 /* Filter in case of 2 filters */
548 #define VC1_MSPEL_FILTER_16B(DIR, TYPE) \
549 static av_always_inline int vc1_mspel_ ## DIR ## _filter_16bits(const TYPE *src, \
550 int stride, \
551 int mode) \
552 { \
553 switch(mode) { \
554 case 0: /* no shift - should not occur */ \
555 return 0; \
556 case 1: /* 1/4 shift */ \
557 return -4 * src[-stride] + 53 * src[0] + \
558 18 * src[stride] - 3 * src[stride * 2]; \
559 case 2: /* 1/2 shift */ \
560 return -1 * src[-stride] + 9 * src[0] + \
561 9 * src[stride] - 1 * src[stride * 2]; \
562 case 3: /* 3/4 shift */ \
563 return -3 * src[-stride] + 18 * src[0] + \
564 53 * src[stride] - 4 * src[stride * 2]; \
565 } \
566 return 0; /* should not occur */ \
567 }
568
569
3/5
✗ Branch 0 not taken.
✓ Branch 1 taken 9624176 times.
✓ Branch 2 taken 15644280 times.
✓ Branch 3 taken 9138336 times.
✗ Branch 4 not taken.
34406792 VC1_MSPEL_FILTER_16B(ver, uint8_t)
570
3/5
✗ Branch 0 not taken.
✓ Branch 1 taken 7445568 times.
✓ Branch 2 taken 12913152 times.
✓ Branch 3 taken 7273088 times.
✗ Branch 4 not taken.
27631808 VC1_MSPEL_FILTER_16B(hor, int16_t)
571
572 /* Filter used to interpolate fractional pel values */
573 18643904 static av_always_inline int vc1_mspel_filter(const uint8_t *src, int stride,
574 int mode, int r)
575 {
576
3/5
✗ Branch 0 not taken.
✓ Branch 1 taken 5356480 times.
✓ Branch 2 taken 8374016 times.
✓ Branch 3 taken 4913408 times.
✗ Branch 4 not taken.
18643904 switch (mode) {
577 case 0: // no shift
578 return src[0];
579 5356480 case 1: // 1/4 shift
580 5356480 return (-4 * src[-stride] + 53 * src[0] +
581 5356480 18 * src[stride] - 3 * src[stride * 2] + 32 - r) >> 6;
582 8374016 case 2: // 1/2 shift
583 8374016 return (-1 * src[-stride] + 9 * src[0] +
584 8374016 9 * src[stride] - 1 * src[stride * 2] + 8 - r) >> 4;
585 4913408 case 3: // 3/4 shift
586 4913408 return (-3 * src[-stride] + 18 * src[0] +
587 4913408 53 * src[stride] - 4 * src[stride * 2] + 32 - r) >> 6;
588 }
589 return 0; // should not occur
590 }
591
592 /* Function used to do motion compensation with bicubic interpolation */
593 #define VC1_MSPEL_MC(OP, OP4, OPNAME) \
594 static av_always_inline void OPNAME ## vc1_mspel_mc(uint8_t *dst, \
595 const uint8_t *src, \
596 ptrdiff_t stride, \
597 int hmode, \
598 int vmode, \
599 int rnd) \
600 { \
601 int i, j; \
602 \
603 if (vmode) { /* Horizontal filter to apply */ \
604 int r; \
605 \
606 if (hmode) { /* Vertical filter to apply, output to tmp */ \
607 static const int shift_value[] = { 0, 5, 1, 5 }; \
608 int shift = (shift_value[hmode] + shift_value[vmode]) >> 1; \
609 int16_t tmp[11 * 8], *tptr = tmp; \
610 \
611 r = (1 << (shift - 1)) + rnd - 1; \
612 \
613 src -= 1; \
614 for (j = 0; j < 8; j++) { \
615 for (i = 0; i < 11; i++) \
616 tptr[i] = (vc1_mspel_ver_filter_16bits(src + i, stride, vmode) + r) >> shift; \
617 src += stride; \
618 tptr += 11; \
619 } \
620 \
621 r = 64 - rnd; \
622 tptr = tmp + 1; \
623 for (j = 0; j < 8; j++) { \
624 for (i = 0; i < 8; i++) \
625 OP(dst[i], (vc1_mspel_hor_filter_16bits(tptr + i, 1, hmode) + r) >> 7); \
626 dst += stride; \
627 tptr += 11; \
628 } \
629 \
630 return; \
631 } else { /* No horizontal filter, output 8 lines to dst */ \
632 r = 1 - rnd; \
633 \
634 for (j = 0; j < 8; j++) { \
635 for (i = 0; i < 8; i++) \
636 OP(dst[i], vc1_mspel_filter(src + i, stride, vmode, r)); \
637 src += stride; \
638 dst += stride; \
639 } \
640 return; \
641 } \
642 } \
643 \
644 /* Horizontal mode with no vertical mode */ \
645 for (j = 0; j < 8; j++) { \
646 for (i = 0; i < 8; i++) \
647 OP(dst[i], vc1_mspel_filter(src + i, 1, hmode, rnd)); \
648 dst += stride; \
649 src += stride; \
650 } \
651 }\
652 static av_always_inline void OPNAME ## vc1_mspel_mc_16(uint8_t *dst, \
653 const uint8_t *src, \
654 ptrdiff_t stride, \
655 int hmode, \
656 int vmode, \
657 int rnd) \
658 { \
659 int i, j; \
660 \
661 if (vmode) { /* Horizontal filter to apply */ \
662 int r; \
663 \
664 if (hmode) { /* Vertical filter to apply, output to tmp */ \
665 static const int shift_value[] = { 0, 5, 1, 5 }; \
666 int shift = (shift_value[hmode] + shift_value[vmode]) >> 1; \
667 int16_t tmp[19 * 16], *tptr = tmp; \
668 \
669 r = (1 << (shift - 1)) + rnd - 1; \
670 \
671 src -= 1; \
672 for (j = 0; j < 16; j++) { \
673 for (i = 0; i < 19; i++) \
674 tptr[i] = (vc1_mspel_ver_filter_16bits(src + i, stride, vmode) + r) >> shift; \
675 src += stride; \
676 tptr += 19; \
677 } \
678 \
679 r = 64 - rnd; \
680 tptr = tmp + 1; \
681 for (j = 0; j < 16; j++) { \
682 for (i = 0; i < 16; i++) \
683 OP(dst[i], (vc1_mspel_hor_filter_16bits(tptr + i, 1, hmode) + r) >> 7); \
684 dst += stride; \
685 tptr += 19; \
686 } \
687 \
688 return; \
689 } else { /* No horizontal filter, output 8 lines to dst */ \
690 r = 1 - rnd; \
691 \
692 for (j = 0; j < 16; j++) { \
693 for (i = 0; i < 16; i++) \
694 OP(dst[i], vc1_mspel_filter(src + i, stride, vmode, r)); \
695 src += stride; \
696 dst += stride; \
697 } \
698 return; \
699 } \
700 } \
701 \
702 /* Horizontal mode with no vertical mode */ \
703 for (j = 0; j < 16; j++) { \
704 for (i = 0; i < 16; i++) \
705 OP(dst[i], vc1_mspel_filter(src + i, 1, hmode, rnd)); \
706 dst += stride; \
707 src += stride; \
708 } \
709 }\
710 static void OPNAME ## pixels8x8_c(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int rnd){\
711 int i;\
712 for(i=0; i<8; i++){\
713 OP4(*(uint32_t*)(block ), AV_RN32(pixels ));\
714 OP4(*(uint32_t*)(block+4), AV_RN32(pixels+4));\
715 pixels+=line_size;\
716 block +=line_size;\
717 }\
718 }\
719 static void OPNAME ## pixels16x16_c(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int rnd){\
720 int i;\
721 for(i=0; i<16; i++){\
722 OP4(*(uint32_t*)(block ), AV_RN32(pixels ));\
723 OP4(*(uint32_t*)(block+ 4), AV_RN32(pixels+ 4));\
724 OP4(*(uint32_t*)(block+ 8), AV_RN32(pixels+ 8));\
725 OP4(*(uint32_t*)(block+12), AV_RN32(pixels+12));\
726 pixels+=line_size;\
727 block +=line_size;\
728 }\
729 }
730
731 #define op_put(a, b) (a) = av_clip_uint8(b)
732 #define op_avg(a, b) (a) = ((a) + av_clip_uint8(b) + 1) >> 1
733 #define op4_avg(a, b) (a) = rnd_avg32(a, b)
734 #define op4_put(a, b) (a) = (b)
735
736
20/20
✓ Branch 0 taken 925166 times.
✓ Branch 1 taken 118334 times.
✓ Branch 2 taken 184947 times.
✓ Branch 3 taken 77627 times.
✓ Branch 5 taken 30297192 times.
✓ Branch 6 taken 1998904 times.
✓ Branch 7 taken 1998904 times.
✓ Branch 8 taken 184947 times.
✓ Branch 10 taken 24300480 times.
✓ Branch 11 taken 1998904 times.
✓ Branch 12 taken 1998904 times.
✓ Branch 13 taken 184947 times.
✓ Branch 15 taken 9430208 times.
✓ Branch 16 taken 806936 times.
✓ Branch 17 taken 806936 times.
✓ Branch 18 taken 77627 times.
✓ Branch 20 taken 6919296 times.
✓ Branch 21 taken 570928 times.
✓ Branch 22 taken 570928 times.
✓ Branch 23 taken 52992 times.
154732696 VC1_MSPEL_MC(op_put, op4_put, put_)
737
21/21
✓ Branch 0 taken 30395 times.
✓ Branch 1 taken 6015 times.
✓ Branch 2 taken 31272 times.
✓ Branch 3 taken 8861 times.
✓ Branch 4 taken 71248 times.
✓ Branch 5 taken 4114053 times.
✓ Branch 6 taken 259424 times.
✓ Branch 7 taken 259424 times.
✓ Branch 8 taken 22616 times.
✓ Branch 10 taken 3331328 times.
✓ Branch 11 taken 259424 times.
✓ Branch 12 taken 259424 times.
✓ Branch 13 taken 22616 times.
✓ Branch 15 taken 1322880 times.
✓ Branch 16 taken 96608 times.
✓ Branch 17 taken 96608 times.
✓ Branch 18 taken 7779 times.
✓ Branch 20 taken 971520 times.
✓ Branch 21 taken 72560 times.
✓ Branch 22 taken 72560 times.
✓ Branch 23 taken 6015 times.
10545193 VC1_MSPEL_MC(op_avg, op4_avg, avg_)
738
739 /* pixel functions - really are entry points to vc1_mspel_mc */
740
741 #define PUT_VC1_MSPEL(a, b) \
742 static void put_vc1_mspel_mc ## a ## b ## _c(uint8_t *dst, \
743 const uint8_t *src, \
744 ptrdiff_t stride, int rnd) \
745 { \
746 put_vc1_mspel_mc(dst, src, stride, a, b, rnd); \
747 } \
748 static void avg_vc1_mspel_mc ## a ## b ## _c(uint8_t *dst, \
749 const uint8_t *src, \
750 ptrdiff_t stride, int rnd) \
751 { \
752 avg_vc1_mspel_mc(dst, src, stride, a, b, rnd); \
753 } \
754 static void put_vc1_mspel_mc ## a ## b ## _16_c(uint8_t *dst, \
755 const uint8_t *src, \
756 ptrdiff_t stride, int rnd) \
757 { \
758 put_vc1_mspel_mc_16(dst, src, stride, a, b, rnd); \
759 } \
760 static void avg_vc1_mspel_mc ## a ## b ## _16_c(uint8_t *dst, \
761 const uint8_t *src, \
762 ptrdiff_t stride, int rnd) \
763 { \
764 avg_vc1_mspel_mc_16(dst, src, stride, a, b, rnd); \
765 }
766
767 38252 PUT_VC1_MSPEL(1, 0)
768 23246 PUT_VC1_MSPEL(2, 0)
769 16635 PUT_VC1_MSPEL(3, 0)
770
771 40344 PUT_VC1_MSPEL(0, 1)
772 15728 PUT_VC1_MSPEL(1, 1)
773 27258 PUT_VC1_MSPEL(2, 1)
774 14439 PUT_VC1_MSPEL(3, 1)
775
776 92622 PUT_VC1_MSPEL(0, 2)
777 24148 PUT_VC1_MSPEL(1, 2)
778 46181 PUT_VC1_MSPEL(2, 2)
779 24741 PUT_VC1_MSPEL(3, 2)
780
781 37846 PUT_VC1_MSPEL(0, 3)
782 14982 PUT_VC1_MSPEL(1, 3)
783 25930 PUT_VC1_MSPEL(2, 3)
784 14156 PUT_VC1_MSPEL(3, 3)
785
786 #define chroma_mc(a) \
787 ((A * src[a] + B * src[a + 1] + \
788 C * src[stride + a] + D * src[stride + a + 1] + 32 - 4) >> 6)
789 243988 static void put_no_rnd_vc1_chroma_mc8_c(uint8_t *dst /* align 8 */,
790 uint8_t *src /* align 1 */,
791 ptrdiff_t stride, int h, int x, int y)
792 {
793 243988 const int A = (8 - x) * (8 - y);
794 243988 const int B = (x) * (8 - y);
795 243988 const int C = (8 - x) * (y);
796 243988 const int D = (x) * (y);
797 int i;
798
799 av_assert2(x < 8 && y < 8 && x >= 0 && y >= 0);
800
801
2/2
✓ Branch 0 taken 1951904 times.
✓ Branch 1 taken 243988 times.
2195892 for (i = 0; i < h; i++) {
802 1951904 dst[0] = chroma_mc(0);
803 1951904 dst[1] = chroma_mc(1);
804 1951904 dst[2] = chroma_mc(2);
805 1951904 dst[3] = chroma_mc(3);
806 1951904 dst[4] = chroma_mc(4);
807 1951904 dst[5] = chroma_mc(5);
808 1951904 dst[6] = chroma_mc(6);
809 1951904 dst[7] = chroma_mc(7);
810 1951904 dst += stride;
811 1951904 src += stride;
812 }
813 243988 }
814
815 86192 static void put_no_rnd_vc1_chroma_mc4_c(uint8_t *dst, uint8_t *src,
816 ptrdiff_t stride, int h, int x, int y)
817 {
818 86192 const int A = (8 - x) * (8 - y);
819 86192 const int B = (x) * (8 - y);
820 86192 const int C = (8 - x) * (y);
821 86192 const int D = (x) * (y);
822 int i;
823
824 av_assert2(x < 8 && y < 8 && x >= 0 && y >= 0);
825
826
2/2
✓ Branch 0 taken 344768 times.
✓ Branch 1 taken 86192 times.
430960 for (i = 0; i < h; i++) {
827 344768 dst[0] = chroma_mc(0);
828 344768 dst[1] = chroma_mc(1);
829 344768 dst[2] = chroma_mc(2);
830 344768 dst[3] = chroma_mc(3);
831 344768 dst += stride;
832 344768 src += stride;
833 }
834 86192 }
835
836 #define avg2(a, b) (((a) + (b) + 1) >> 1)
837 21934 static void avg_no_rnd_vc1_chroma_mc8_c(uint8_t *dst /* align 8 */,
838 uint8_t *src /* align 1 */,
839 ptrdiff_t stride, int h, int x, int y)
840 {
841 21934 const int A = (8 - x) * (8 - y);
842 21934 const int B = (x) * (8 - y);
843 21934 const int C = (8 - x) * (y);
844 21934 const int D = (x) * (y);
845 int i;
846
847 av_assert2(x < 8 && y < 8 && x >= 0 && y >= 0);
848
849
2/2
✓ Branch 0 taken 175472 times.
✓ Branch 1 taken 21934 times.
197406 for (i = 0; i < h; i++) {
850 175472 dst[0] = avg2(dst[0], chroma_mc(0));
851 175472 dst[1] = avg2(dst[1], chroma_mc(1));
852 175472 dst[2] = avg2(dst[2], chroma_mc(2));
853 175472 dst[3] = avg2(dst[3], chroma_mc(3));
854 175472 dst[4] = avg2(dst[4], chroma_mc(4));
855 175472 dst[5] = avg2(dst[5], chroma_mc(5));
856 175472 dst[6] = avg2(dst[6], chroma_mc(6));
857 175472 dst[7] = avg2(dst[7], chroma_mc(7));
858 175472 dst += stride;
859 175472 src += stride;
860 }
861 21934 }
862
863 18992 static void avg_no_rnd_vc1_chroma_mc4_c(uint8_t *dst /* align 8 */,
864 uint8_t *src /* align 1 */,
865 ptrdiff_t stride, int h, int x, int y)
866 {
867 18992 const int A = (8 - x) * (8 - y);
868 18992 const int B = ( x) * (8 - y);
869 18992 const int C = (8 - x) * ( y);
870 18992 const int D = ( x) * ( y);
871 int i;
872
873 av_assert2(x < 8 && y < 8 && x >= 0 && y >= 0);
874
875
2/2
✓ Branch 0 taken 75968 times.
✓ Branch 1 taken 18992 times.
94960 for (i = 0; i < h; i++) {
876 75968 dst[0] = avg2(dst[0], chroma_mc(0));
877 75968 dst[1] = avg2(dst[1], chroma_mc(1));
878 75968 dst[2] = avg2(dst[2], chroma_mc(2));
879 75968 dst[3] = avg2(dst[3], chroma_mc(3));
880 75968 dst += stride;
881 75968 src += stride;
882 }
883 18992 }
884
885 #if CONFIG_WMV3IMAGE_DECODER || CONFIG_VC1IMAGE_DECODER
886
887 static void sprite_h_c(uint8_t *dst, const uint8_t *src, int offset,
888 int advance, int count)
889 {
890 while (count--) {
891 int a = src[(offset >> 16)];
892 int b = src[(offset >> 16) + 1];
893 *dst++ = a + ((b - a) * (offset & 0xFFFF) >> 16);
894 offset += advance;
895 }
896 }
897
898 static av_always_inline void sprite_v_template(uint8_t *dst,
899 const uint8_t *src1a,
900 const uint8_t *src1b,
901 int offset1,
902 int two_sprites,
903 const uint8_t *src2a,
904 const uint8_t *src2b,
905 int offset2,
906 int alpha, int scaled,
907 int width)
908 {
909 int a1, b1, a2, b2;
910 while (width--) {
911 a1 = *src1a++;
912 if (scaled) {
913 b1 = *src1b++;
914 a1 = a1 + ((b1 - a1) * offset1 >> 16);
915 }
916 if (two_sprites) {
917 a2 = *src2a++;
918 if (scaled > 1) {
919 b2 = *src2b++;
920 a2 = a2 + ((b2 - a2) * offset2 >> 16);
921 }
922 a1 = a1 + ((a2 - a1) * alpha >> 16);
923 }
924 *dst++ = a1;
925 }
926 }
927
928 static void sprite_v_single_c(uint8_t *dst, const uint8_t *src1a,
929 const uint8_t *src1b,
930 int offset, int width)
931 {
932 sprite_v_template(dst, src1a, src1b, offset, 0, NULL, NULL, 0, 0, 1, width);
933 }
934
935 static void sprite_v_double_noscale_c(uint8_t *dst, const uint8_t *src1a,
936 const uint8_t *src2a,
937 int alpha, int width)
938 {
939 sprite_v_template(dst, src1a, NULL, 0, 1, src2a, NULL, 0, alpha, 0, width);
940 }
941
942 static void sprite_v_double_onescale_c(uint8_t *dst,
943 const uint8_t *src1a,
944 const uint8_t *src1b,
945 int offset1,
946 const uint8_t *src2a,
947 int alpha, int width)
948 {
949 sprite_v_template(dst, src1a, src1b, offset1, 1, src2a, NULL, 0, alpha, 1,
950 width);
951 }
952
953 static void sprite_v_double_twoscale_c(uint8_t *dst,
954 const uint8_t *src1a,
955 const uint8_t *src1b,
956 int offset1,
957 const uint8_t *src2a,
958 const uint8_t *src2b,
959 int offset2,
960 int alpha,
961 int width)
962 {
963 sprite_v_template(dst, src1a, src1b, offset1, 1, src2a, src2b, offset2,
964 alpha, 2, width);
965 }
966
967 #endif /* CONFIG_WMV3IMAGE_DECODER || CONFIG_VC1IMAGE_DECODER */
968 #define FN_ASSIGN(X, Y) \
969 dsp->put_vc1_mspel_pixels_tab[1][X+4*Y] = put_vc1_mspel_mc##X##Y##_c; \
970 dsp->put_vc1_mspel_pixels_tab[0][X+4*Y] = put_vc1_mspel_mc##X##Y##_16_c; \
971 dsp->avg_vc1_mspel_pixels_tab[1][X+4*Y] = avg_vc1_mspel_mc##X##Y##_c; \
972 dsp->avg_vc1_mspel_pixels_tab[0][X+4*Y] = avg_vc1_mspel_mc##X##Y##_16_c
973
974 92 av_cold void ff_vc1dsp_init(VC1DSPContext *dsp)
975 {
976 92 dsp->vc1_inv_trans_8x8 = vc1_inv_trans_8x8_c;
977 92 dsp->vc1_inv_trans_4x8 = vc1_inv_trans_4x8_c;
978 92 dsp->vc1_inv_trans_8x4 = vc1_inv_trans_8x4_c;
979 92 dsp->vc1_inv_trans_4x4 = vc1_inv_trans_4x4_c;
980 92 dsp->vc1_inv_trans_8x8_dc = vc1_inv_trans_8x8_dc_c;
981 92 dsp->vc1_inv_trans_4x8_dc = vc1_inv_trans_4x8_dc_c;
982 92 dsp->vc1_inv_trans_8x4_dc = vc1_inv_trans_8x4_dc_c;
983 92 dsp->vc1_inv_trans_4x4_dc = vc1_inv_trans_4x4_dc_c;
984
985 92 dsp->vc1_h_overlap = vc1_h_overlap_c;
986 92 dsp->vc1_v_overlap = vc1_v_overlap_c;
987 92 dsp->vc1_h_s_overlap = vc1_h_s_overlap_c;
988 92 dsp->vc1_v_s_overlap = vc1_v_s_overlap_c;
989
990 92 dsp->vc1_v_loop_filter4 = vc1_v_loop_filter4_c;
991 92 dsp->vc1_h_loop_filter4 = vc1_h_loop_filter4_c;
992 92 dsp->vc1_v_loop_filter8 = vc1_v_loop_filter8_c;
993 92 dsp->vc1_h_loop_filter8 = vc1_h_loop_filter8_c;
994 92 dsp->vc1_v_loop_filter16 = vc1_v_loop_filter16_c;
995 92 dsp->vc1_h_loop_filter16 = vc1_h_loop_filter16_c;
996
997 92 dsp->put_vc1_mspel_pixels_tab[0][0] = put_pixels16x16_c;
998 92 dsp->avg_vc1_mspel_pixels_tab[0][0] = avg_pixels16x16_c;
999 92 dsp->put_vc1_mspel_pixels_tab[1][0] = put_pixels8x8_c;
1000 92 dsp->avg_vc1_mspel_pixels_tab[1][0] = avg_pixels8x8_c;
1001 92 FN_ASSIGN(0, 1);
1002 92 FN_ASSIGN(0, 2);
1003 92 FN_ASSIGN(0, 3);
1004
1005 92 FN_ASSIGN(1, 0);
1006 92 FN_ASSIGN(1, 1);
1007 92 FN_ASSIGN(1, 2);
1008 92 FN_ASSIGN(1, 3);
1009
1010 92 FN_ASSIGN(2, 0);
1011 92 FN_ASSIGN(2, 1);
1012 92 FN_ASSIGN(2, 2);
1013 92 FN_ASSIGN(2, 3);
1014
1015 92 FN_ASSIGN(3, 0);
1016 92 FN_ASSIGN(3, 1);
1017 92 FN_ASSIGN(3, 2);
1018 92 FN_ASSIGN(3, 3);
1019
1020 92 dsp->put_no_rnd_vc1_chroma_pixels_tab[0] = put_no_rnd_vc1_chroma_mc8_c;
1021 92 dsp->avg_no_rnd_vc1_chroma_pixels_tab[0] = avg_no_rnd_vc1_chroma_mc8_c;
1022 92 dsp->put_no_rnd_vc1_chroma_pixels_tab[1] = put_no_rnd_vc1_chroma_mc4_c;
1023 92 dsp->avg_no_rnd_vc1_chroma_pixels_tab[1] = avg_no_rnd_vc1_chroma_mc4_c;
1024
1025 #if CONFIG_WMV3IMAGE_DECODER || CONFIG_VC1IMAGE_DECODER
1026 92 dsp->sprite_h = sprite_h_c;
1027 92 dsp->sprite_v_single = sprite_v_single_c;
1028 92 dsp->sprite_v_double_noscale = sprite_v_double_noscale_c;
1029 92 dsp->sprite_v_double_onescale = sprite_v_double_onescale_c;
1030 92 dsp->sprite_v_double_twoscale = sprite_v_double_twoscale_c;
1031 #endif /* CONFIG_WMV3IMAGE_DECODER || CONFIG_VC1IMAGE_DECODER */
1032
1033 92 dsp->startcode_find_candidate = ff_startcode_find_candidate_c;
1034 92 dsp->vc1_unescape_buffer = vc1_unescape_buffer;
1035
1036 #if ARCH_AARCH64
1037 ff_vc1dsp_init_aarch64(dsp);
1038 #elif ARCH_ARM
1039 ff_vc1dsp_init_arm(dsp);
1040 #elif ARCH_PPC
1041 ff_vc1dsp_init_ppc(dsp);
1042 #elif ARCH_X86
1043 92 ff_vc1dsp_init_x86(dsp);
1044 #elif ARCH_MIPS
1045 ff_vc1dsp_init_mips(dsp);
1046 #elif ARCH_LOONGARCH
1047 ff_vc1dsp_init_loongarch(dsp);
1048 #endif
1049 92 }
1050