FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavcodec/vc1dsp.c
Date: 2026-09-04 04:29:05
Exec Total Coverage
Lines: 437 505 86.5%
Functions: 94 102 92.2%
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 2456 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 2456 int rnd1 = 4, rnd2 = 3;
93
2/2
✓ Branch 0 taken 19648 times.
✓ Branch 1 taken 2456 times.
22104 for (i = 0; i < 8; i++) {
94 19648 a = top[48];
95 19648 b = top[56];
96 19648 c = bottom[0];
97 19648 d = bottom[8];
98 19648 d1 = a - d;
99 19648 d2 = a - d + b - c;
100
101 19648 top[48] = ((a * 8) - d1 + rnd1) >> 3;
102 19648 top[56] = ((b * 8) - d2 + rnd2) >> 3;
103 19648 bottom[0] = ((c * 8) + d2 + rnd1) >> 3;
104 19648 bottom[8] = ((d * 8) + d1 + rnd2) >> 3;
105
106 19648 bottom++;
107 19648 top++;
108 19648 rnd2 = 7 - rnd2;
109 19648 rnd1 = 7 - rnd1;
110 }
111 2456 }
112
113 2688 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 2688 times.
2688 int rnd1 = flags & 2 ? 3 : 4;
119 2688 int rnd2 = 7 - rnd1;
120
2/2
✓ Branch 0 taken 21504 times.
✓ Branch 1 taken 2688 times.
24192 for (i = 0; i < 8; i++) {
121 21504 a = left[6];
122 21504 b = left[7];
123 21504 c = right[0];
124 21504 d = right[1];
125 21504 d1 = a - d;
126 21504 d2 = a - d + b - c;
127
128 21504 left[6] = ((a * 8) - d1 + rnd1) >> 3;
129 21504 left[7] = ((b * 8) - d2 + rnd2) >> 3;
130 21504 right[0] = ((c * 8) + d2 + rnd1) >> 3;
131 21504 right[1] = ((d * 8) + d1 + rnd2) >> 3;
132
133 21504 right += right_stride;
134 21504 left += left_stride;
135
1/2
✓ Branch 0 taken 21504 times.
✗ Branch 1 not taken.
21504 if (flags & 1) {
136 21504 rnd2 = 7 - rnd2;
137 21504 rnd1 = 7 - rnd1;
138 }
139 }
140 2688 }
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 13368945 static av_always_inline int vc1_filter_line(uint8_t *src, ptrdiff_t stride, int pq)
151 {
152 13368945 int a0 = (2 * (src[-2 * stride] - src[1 * stride]) -
153 13368945 5 * (src[-1 * stride] - src[0 * stride]) + 4) >> 3;
154 13368945 int a0_sign = a0 >> 31; /* Store sign */
155
156 13368945 a0 = (a0 ^ a0_sign) - a0_sign; /* a0 = FFABS(a0); */
157
2/2
✓ Branch 0 taken 11873543 times.
✓ Branch 1 taken 1495402 times.
13368945 if (a0 < pq) {
158 11873543 int a1 = FFABS((2 * (src[-4 * stride] - src[-1 * stride]) -
159 5 * (src[-3 * stride] - src[-2 * stride]) + 4) >> 3);
160 11873543 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 6371021 times.
✓ Branch 1 taken 5502522 times.
✓ Branch 2 taken 1394284 times.
✓ Branch 3 taken 4976737 times.
11873543 if (a1 < a0 || a2 < a0) {
163 6896806 int clip = src[-1 * stride] - src[0 * stride];
164 6896806 int clip_sign = clip >> 31;
165
166 6896806 clip = ((clip ^ clip_sign) - clip_sign) >> 1;
167
2/2
✓ Branch 0 taken 5574346 times.
✓ Branch 1 taken 1322460 times.
6896806 if (clip) {
168 5574346 int a3 = FFMIN(a1, a2);
169 5574346 int d = (5 * (a0 - a3)) >> 3;
170
171
2/2
✓ Branch 0 taken 5239925 times.
✓ Branch 1 taken 334421 times.
5574346 if (a0_sign ^ clip_sign) {
172 5239925 d = FFMIN(d, clip);
173 5239925 d = (d ^ clip_sign) - clip_sign; /* Restore sign */
174 5239925 src[-1 * stride] = av_clip_uint8(src[-1 * stride] - d);
175 5239925 src[ 0 * stride] = av_clip_uint8(src[ 0 * stride] + d);
176 }
177 5574346 return 1;
178 }
179 }
180 }
181 7794599 return 0;
182 }
183
184 /**
185 * VC-1 in-loop deblocking filter
186 * @param src source block type
187 * @param step distance between horizontally adjacent elements
188 * @param stride distance between vertically adjacent elements
189 * @param len edge length to filter (4 or 8 pixels)
190 * @param pq block quantizer
191 * @see 8.6
192 */
193 4018793 static av_always_inline void vc1_loop_filter(uint8_t *src, ptrdiff_t step,
194 ptrdiff_t stride, int len, int pq)
195 {
196 int i;
197 int filt3;
198
199
2/2
✓ Branch 0 taken 6936114 times.
✓ Branch 1 taken 4018793 times.
10954907 for (i = 0; i < len; i += 4) {
200 6936114 filt3 = vc1_filter_line(src + 2 * step, stride, pq);
201
2/2
✓ Branch 0 taken 2144277 times.
✓ Branch 1 taken 4791837 times.
6936114 if (filt3) {
202 2144277 vc1_filter_line(src + 0 * step, stride, pq);
203 2144277 vc1_filter_line(src + 1 * step, stride, pq);
204 2144277 vc1_filter_line(src + 3 * step, stride, pq);
205 }
206 6936114 src += step * 4;
207 }
208 4018793 }
209
210 430497 static void vc1_v_loop_filter4_c(uint8_t *src, ptrdiff_t stride, int pq)
211 {
212 430497 vc1_loop_filter(src, 1, stride, 4, pq);
213 430497 }
214
215 995839 static void vc1_h_loop_filter4_c(uint8_t *src, ptrdiff_t stride, int pq)
216 {
217 995839 vc1_loop_filter(src, stride, 1, 4, pq);
218 995839 }
219
220 1402639 static void vc1_v_loop_filter8_c(uint8_t *src, ptrdiff_t stride, int pq)
221 {
222 1402639 vc1_loop_filter(src, 1, stride, 8, pq);
223 1402639 }
224
225 1027386 static void vc1_h_loop_filter8_c(uint8_t *src, ptrdiff_t stride, int pq)
226 {
227 1027386 vc1_loop_filter(src, stride, 1, 8, pq);
228 1027386 }
229
230 107646 static void vc1_v_loop_filter16_c(uint8_t *src, ptrdiff_t stride, int pq)
231 {
232 107646 vc1_loop_filter(src, 1, stride, 16, pq);
233 107646 }
234
235 54786 static void vc1_h_loop_filter16_c(uint8_t *src, ptrdiff_t stride, int pq)
236 {
237 54786 vc1_loop_filter(src, stride, 1, 16, pq);
238 54786 }
239
240 /* Do inverse transform on 8x8 block */
241 48605 static void vc1_inv_trans_8x8_dc_c(uint8_t *dest, ptrdiff_t stride, int16_t *block)
242 {
243 int i;
244 48605 int dc = block[0];
245
246 48605 dc = (3 * dc + 1) >> 1;
247 48605 dc = (3 * dc + 16) >> 5;
248
249
2/2
✓ Branch 0 taken 388840 times.
✓ Branch 1 taken 48605 times.
437445 for (i = 0; i < 8; i++) {
250 388840 dest[0] = av_clip_uint8(dest[0] + dc);
251 388840 dest[1] = av_clip_uint8(dest[1] + dc);
252 388840 dest[2] = av_clip_uint8(dest[2] + dc);
253 388840 dest[3] = av_clip_uint8(dest[3] + dc);
254 388840 dest[4] = av_clip_uint8(dest[4] + dc);
255 388840 dest[5] = av_clip_uint8(dest[5] + dc);
256 388840 dest[6] = av_clip_uint8(dest[6] + dc);
257 388840 dest[7] = av_clip_uint8(dest[7] + dc);
258 388840 dest += stride;
259 }
260 48605 }
261
262 801158 static void vc1_inv_trans_8x8_c(int16_t block[64])
263 {
264 int i;
265 register int t1, t2, t3, t4, t5, t6, t7, t8;
266 int16_t *src, *dst, temp[64];
267
268 801158 src = block;
269 801158 dst = temp;
270
2/2
✓ Branch 0 taken 6409264 times.
✓ Branch 1 taken 801158 times.
7210422 for (i = 0; i < 8; i++) {
271 6409264 t1 = 12 * (src[ 0] + src[32]) + 4;
272 6409264 t2 = 12 * (src[ 0] - src[32]) + 4;
273 6409264 t3 = 16 * src[16] + 6 * src[48];
274 6409264 t4 = 6 * src[16] - 16 * src[48];
275
276 6409264 t5 = t1 + t3;
277 6409264 t6 = t2 + t4;
278 6409264 t7 = t2 - t4;
279 6409264 t8 = t1 - t3;
280
281 6409264 t1 = 16 * src[ 8] + 15 * src[24] + 9 * src[40] + 4 * src[56];
282 6409264 t2 = 15 * src[ 8] - 4 * src[24] - 16 * src[40] - 9 * src[56];
283 6409264 t3 = 9 * src[ 8] - 16 * src[24] + 4 * src[40] + 15 * src[56];
284 6409264 t4 = 4 * src[ 8] - 9 * src[24] + 15 * src[40] - 16 * src[56];
285
286 6409264 dst[0] = (t5 + t1) >> 3;
287 6409264 dst[1] = (t6 + t2) >> 3;
288 6409264 dst[2] = (t7 + t3) >> 3;
289 6409264 dst[3] = (t8 + t4) >> 3;
290 6409264 dst[4] = (t8 - t4) >> 3;
291 6409264 dst[5] = (t7 - t3) >> 3;
292 6409264 dst[6] = (t6 - t2) >> 3;
293 6409264 dst[7] = (t5 - t1) >> 3;
294
295 6409264 src += 1;
296 6409264 dst += 8;
297 }
298
299 801158 src = temp;
300 801158 dst = block;
301
2/2
✓ Branch 0 taken 6409264 times.
✓ Branch 1 taken 801158 times.
7210422 for (i = 0; i < 8; i++) {
302 6409264 t1 = 12 * (src[ 0] + src[32]) + 64;
303 6409264 t2 = 12 * (src[ 0] - src[32]) + 64;
304 6409264 t3 = 16 * src[16] + 6 * src[48];
305 6409264 t4 = 6 * src[16] - 16 * src[48];
306
307 6409264 t5 = t1 + t3;
308 6409264 t6 = t2 + t4;
309 6409264 t7 = t2 - t4;
310 6409264 t8 = t1 - t3;
311
312 6409264 t1 = 16 * src[ 8] + 15 * src[24] + 9 * src[40] + 4 * src[56];
313 6409264 t2 = 15 * src[ 8] - 4 * src[24] - 16 * src[40] - 9 * src[56];
314 6409264 t3 = 9 * src[ 8] - 16 * src[24] + 4 * src[40] + 15 * src[56];
315 6409264 t4 = 4 * src[ 8] - 9 * src[24] + 15 * src[40] - 16 * src[56];
316
317 6409264 dst[ 0] = (t5 + t1) >> 7;
318 6409264 dst[ 8] = (t6 + t2) >> 7;
319 6409264 dst[16] = (t7 + t3) >> 7;
320 6409264 dst[24] = (t8 + t4) >> 7;
321 6409264 dst[32] = (t8 - t4 + 1) >> 7;
322 6409264 dst[40] = (t7 - t3 + 1) >> 7;
323 6409264 dst[48] = (t6 - t2 + 1) >> 7;
324 6409264 dst[56] = (t5 - t1 + 1) >> 7;
325
326 6409264 src++;
327 6409264 dst++;
328 }
329 801158 }
330
331 /* Do inverse transform on 8x4 part of block */
332 15851 static void vc1_inv_trans_8x4_dc_c(uint8_t *dest, ptrdiff_t stride, int16_t *block)
333 {
334 int i;
335 15851 int dc = block[0];
336
337 15851 dc = (3 * dc + 1) >> 1;
338 15851 dc = (17 * dc + 64) >> 7;
339
340
2/2
✓ Branch 0 taken 63404 times.
✓ Branch 1 taken 15851 times.
79255 for (i = 0; i < 4; i++) {
341 63404 dest[0] = av_clip_uint8(dest[0] + dc);
342 63404 dest[1] = av_clip_uint8(dest[1] + dc);
343 63404 dest[2] = av_clip_uint8(dest[2] + dc);
344 63404 dest[3] = av_clip_uint8(dest[3] + dc);
345 63404 dest[4] = av_clip_uint8(dest[4] + dc);
346 63404 dest[5] = av_clip_uint8(dest[5] + dc);
347 63404 dest[6] = av_clip_uint8(dest[6] + dc);
348 63404 dest[7] = av_clip_uint8(dest[7] + dc);
349 63404 dest += stride;
350 }
351 15851 }
352
353 207388 static void vc1_inv_trans_8x4_c(uint8_t *dest, ptrdiff_t stride, int16_t *block)
354 {
355 int i;
356 register int t1, t2, t3, t4, t5, t6, t7, t8;
357 int16_t *src, *dst;
358
359 207388 src = block;
360 207388 dst = block;
361
362
2/2
✓ Branch 0 taken 829552 times.
✓ Branch 1 taken 207388 times.
1036940 for (i = 0; i < 4; i++) {
363 829552 t1 = 12 * (src[0] + src[4]) + 4;
364 829552 t2 = 12 * (src[0] - src[4]) + 4;
365 829552 t3 = 16 * src[2] + 6 * src[6];
366 829552 t4 = 6 * src[2] - 16 * src[6];
367
368 829552 t5 = t1 + t3;
369 829552 t6 = t2 + t4;
370 829552 t7 = t2 - t4;
371 829552 t8 = t1 - t3;
372
373 829552 t1 = 16 * src[1] + 15 * src[3] + 9 * src[5] + 4 * src[7];
374 829552 t2 = 15 * src[1] - 4 * src[3] - 16 * src[5] - 9 * src[7];
375 829552 t3 = 9 * src[1] - 16 * src[3] + 4 * src[5] + 15 * src[7];
376 829552 t4 = 4 * src[1] - 9 * src[3] + 15 * src[5] - 16 * src[7];
377
378 829552 dst[0] = (t5 + t1) >> 3;
379 829552 dst[1] = (t6 + t2) >> 3;
380 829552 dst[2] = (t7 + t3) >> 3;
381 829552 dst[3] = (t8 + t4) >> 3;
382 829552 dst[4] = (t8 - t4) >> 3;
383 829552 dst[5] = (t7 - t3) >> 3;
384 829552 dst[6] = (t6 - t2) >> 3;
385 829552 dst[7] = (t5 - t1) >> 3;
386
387 829552 src += 8;
388 829552 dst += 8;
389 }
390
391 207388 src = block;
392
2/2
✓ Branch 0 taken 1659104 times.
✓ Branch 1 taken 207388 times.
1866492 for (i = 0; i < 8; i++) {
393 1659104 t1 = 17 * (src[ 0] + src[16]) + 64;
394 1659104 t2 = 17 * (src[ 0] - src[16]) + 64;
395 1659104 t3 = 22 * src[ 8] + 10 * src[24];
396 1659104 t4 = 22 * src[24] - 10 * src[ 8];
397
398 1659104 dest[0 * stride] = av_clip_uint8(dest[0 * stride] + ((t1 + t3) >> 7));
399 1659104 dest[1 * stride] = av_clip_uint8(dest[1 * stride] + ((t2 - t4) >> 7));
400 1659104 dest[2 * stride] = av_clip_uint8(dest[2 * stride] + ((t2 + t4) >> 7));
401 1659104 dest[3 * stride] = av_clip_uint8(dest[3 * stride] + ((t1 - t3) >> 7));
402
403 1659104 src++;
404 1659104 dest++;
405 }
406 207388 }
407
408 /* Do inverse transform on 4x8 parts of block */
409 17938 static void vc1_inv_trans_4x8_dc_c(uint8_t *dest, ptrdiff_t stride, int16_t *block)
410 {
411 int i;
412 17938 int dc = block[0];
413
414 17938 dc = (17 * dc + 4) >> 3;
415 17938 dc = (12 * dc + 64) >> 7;
416
417
2/2
✓ Branch 0 taken 143504 times.
✓ Branch 1 taken 17938 times.
161442 for (i = 0; i < 8; i++) {
418 143504 dest[0] = av_clip_uint8(dest[0] + dc);
419 143504 dest[1] = av_clip_uint8(dest[1] + dc);
420 143504 dest[2] = av_clip_uint8(dest[2] + dc);
421 143504 dest[3] = av_clip_uint8(dest[3] + dc);
422 143504 dest += stride;
423 }
424 17938 }
425
426 209108 static void vc1_inv_trans_4x8_c(uint8_t *dest, ptrdiff_t stride, int16_t *block)
427 {
428 int i;
429 register int t1, t2, t3, t4, t5, t6, t7, t8;
430 int16_t *src, *dst;
431
432 209108 src = block;
433 209108 dst = block;
434
435
2/2
✓ Branch 0 taken 1672864 times.
✓ Branch 1 taken 209108 times.
1881972 for (i = 0; i < 8; i++) {
436 1672864 t1 = 17 * (src[0] + src[2]) + 4;
437 1672864 t2 = 17 * (src[0] - src[2]) + 4;
438 1672864 t3 = 22 * src[1] + 10 * src[3];
439 1672864 t4 = 22 * src[3] - 10 * src[1];
440
441 1672864 dst[0] = (t1 + t3) >> 3;
442 1672864 dst[1] = (t2 - t4) >> 3;
443 1672864 dst[2] = (t2 + t4) >> 3;
444 1672864 dst[3] = (t1 - t3) >> 3;
445
446 1672864 src += 8;
447 1672864 dst += 8;
448 }
449
450 209108 src = block;
451
2/2
✓ Branch 0 taken 836432 times.
✓ Branch 1 taken 209108 times.
1045540 for (i = 0; i < 4; i++) {
452 836432 t1 = 12 * (src[ 0] + src[32]) + 64;
453 836432 t2 = 12 * (src[ 0] - src[32]) + 64;
454 836432 t3 = 16 * src[16] + 6 * src[48];
455 836432 t4 = 6 * src[16] - 16 * src[48];
456
457 836432 t5 = t1 + t3;
458 836432 t6 = t2 + t4;
459 836432 t7 = t2 - t4;
460 836432 t8 = t1 - t3;
461
462 836432 t1 = 16 * src[ 8] + 15 * src[24] + 9 * src[40] + 4 * src[56];
463 836432 t2 = 15 * src[ 8] - 4 * src[24] - 16 * src[40] - 9 * src[56];
464 836432 t3 = 9 * src[ 8] - 16 * src[24] + 4 * src[40] + 15 * src[56];
465 836432 t4 = 4 * src[ 8] - 9 * src[24] + 15 * src[40] - 16 * src[56];
466
467 836432 dest[0 * stride] = av_clip_uint8(dest[0 * stride] + ((t5 + t1) >> 7));
468 836432 dest[1 * stride] = av_clip_uint8(dest[1 * stride] + ((t6 + t2) >> 7));
469 836432 dest[2 * stride] = av_clip_uint8(dest[2 * stride] + ((t7 + t3) >> 7));
470 836432 dest[3 * stride] = av_clip_uint8(dest[3 * stride] + ((t8 + t4) >> 7));
471 836432 dest[4 * stride] = av_clip_uint8(dest[4 * stride] + ((t8 - t4 + 1) >> 7));
472 836432 dest[5 * stride] = av_clip_uint8(dest[5 * stride] + ((t7 - t3 + 1) >> 7));
473 836432 dest[6 * stride] = av_clip_uint8(dest[6 * stride] + ((t6 - t2 + 1) >> 7));
474 836432 dest[7 * stride] = av_clip_uint8(dest[7 * stride] + ((t5 - t1 + 1) >> 7));
475
476 836432 src++;
477 836432 dest++;
478 }
479 209108 }
480
481 /* Do inverse transform on 4x4 part of block */
482 21253 static void vc1_inv_trans_4x4_dc_c(uint8_t *dest, ptrdiff_t stride, int16_t *block)
483 {
484 int i;
485 21253 int dc = block[0];
486
487 21253 dc = (17 * dc + 4) >> 3;
488 21253 dc = (17 * dc + 64) >> 7;
489
490
2/2
✓ Branch 0 taken 85012 times.
✓ Branch 1 taken 21253 times.
106265 for (i = 0; i < 4; i++) {
491 85012 dest[0] = av_clip_uint8(dest[0] + dc);
492 85012 dest[1] = av_clip_uint8(dest[1] + dc);
493 85012 dest[2] = av_clip_uint8(dest[2] + dc);
494 85012 dest[3] = av_clip_uint8(dest[3] + dc);
495 85012 dest += stride;
496 }
497 21253 }
498
499 170155 static void vc1_inv_trans_4x4_c(uint8_t *dest, ptrdiff_t stride, int16_t *block)
500 {
501 int i;
502 register int t1, t2, t3, t4;
503 int16_t *src, *dst;
504
505 170155 src = block;
506 170155 dst = block;
507
2/2
✓ Branch 0 taken 680620 times.
✓ Branch 1 taken 170155 times.
850775 for (i = 0; i < 4; i++) {
508 680620 t1 = 17 * (src[0] + src[2]) + 4;
509 680620 t2 = 17 * (src[0] - src[2]) + 4;
510 680620 t3 = 22 * src[1] + 10 * src[3];
511 680620 t4 = 22 * src[3] - 10 * src[1];
512
513 680620 dst[0] = (t1 + t3) >> 3;
514 680620 dst[1] = (t2 - t4) >> 3;
515 680620 dst[2] = (t2 + t4) >> 3;
516 680620 dst[3] = (t1 - t3) >> 3;
517
518 680620 src += 8;
519 680620 dst += 8;
520 }
521
522 170155 src = block;
523
2/2
✓ Branch 0 taken 680620 times.
✓ Branch 1 taken 170155 times.
850775 for (i = 0; i < 4; i++) {
524 680620 t1 = 17 * (src[0] + src[16]) + 64;
525 680620 t2 = 17 * (src[0] - src[16]) + 64;
526 680620 t3 = 22 * src[8] + 10 * src[24];
527 680620 t4 = 22 * src[24] - 10 * src[8];
528
529 680620 dest[0 * stride] = av_clip_uint8(dest[0 * stride] + ((t1 + t3) >> 7));
530 680620 dest[1 * stride] = av_clip_uint8(dest[1 * stride] + ((t2 - t4) >> 7));
531 680620 dest[2 * stride] = av_clip_uint8(dest[2 * stride] + ((t2 + t4) >> 7));
532 680620 dest[3 * stride] = av_clip_uint8(dest[3 * stride] + ((t1 - t3) >> 7));
533
534 680620 src++;
535 680620 dest++;
536 }
537 170155 }
538
539 /* motion compensation functions */
540
541 /* Filter in case of 2 filters */
542 #define VC1_MSPEL_FILTER_16B(DIR, TYPE) \
543 static av_always_inline int vc1_mspel_ ## DIR ## _filter_16bits(const TYPE *src, \
544 ptrdiff_t stride, \
545 int mode) \
546 { \
547 switch(mode) { \
548 case 0: /* no shift - should not occur */ \
549 return 0; \
550 case 1: /* 1/4 shift */ \
551 return -4 * src[-stride] + 53 * src[0] + \
552 18 * src[stride] - 3 * src[stride * 2]; \
553 case 2: /* 1/2 shift */ \
554 return -1 * src[-stride] + 9 * src[0] + \
555 9 * src[stride] - 1 * src[stride * 2]; \
556 case 3: /* 3/4 shift */ \
557 return -3 * src[-stride] + 18 * src[0] + \
558 53 * src[stride] - 4 * src[stride * 2]; \
559 } \
560 return 0; /* should not occur */ \
561 }
562
563
3/5
✗ Branch 0 not taken.
✓ Branch 1 taken 9649944 times.
✓ Branch 2 taken 15680088 times.
✓ Branch 3 taken 9163096 times.
✗ Branch 4 not taken.
34493128 VC1_MSPEL_FILTER_16B(ver, uint8_t)
564
3/5
✗ Branch 0 not taken.
✓ Branch 1 taken 7467200 times.
✓ Branch 2 taken 12937280 times.
✓ Branch 3 taken 7296960 times.
✗ Branch 4 not taken.
27701440 VC1_MSPEL_FILTER_16B(hor, int16_t)
565
566 /* Filter used to interpolate fractional pel values */
567 18756416 static av_always_inline int vc1_mspel_filter(const uint8_t *src, ptrdiff_t stride,
568 int mode, int r)
569 {
570
3/5
✗ Branch 0 not taken.
✓ Branch 1 taken 5374592 times.
✓ Branch 2 taken 8450816 times.
✓ Branch 3 taken 4931008 times.
✗ Branch 4 not taken.
18756416 switch (mode) {
571 case 0: // no shift
572 return src[0];
573 5374592 case 1: // 1/4 shift
574 5374592 return (-4 * src[-stride] + 53 * src[0] +
575 5374592 18 * src[stride] - 3 * src[stride * 2] + 32 - r) >> 6;
576 8450816 case 2: // 1/2 shift
577 8450816 return (-1 * src[-stride] + 9 * src[0] +
578 8450816 9 * src[stride] - 1 * src[stride * 2] + 8 - r) >> 4;
579 4931008 case 3: // 3/4 shift
580 4931008 return (-3 * src[-stride] + 18 * src[0] +
581 4931008 53 * src[stride] - 4 * src[stride * 2] + 32 - r) >> 6;
582 }
583 return 0; // should not occur
584 }
585
586 /* Function used to do motion compensation with bicubic interpolation */
587 #define VC1_MSPEL_MC(OP, OP4, OPNAME) \
588 static av_always_inline void OPNAME ## vc1_mspel_mc(uint8_t *dst, \
589 const uint8_t *src, \
590 ptrdiff_t stride, \
591 int hmode, \
592 int vmode, \
593 int rnd) \
594 { \
595 int i, j; \
596 \
597 if (vmode) { /* Horizontal filter to apply */ \
598 int r; \
599 \
600 if (hmode) { /* Vertical filter to apply, output to tmp */ \
601 static const int shift_value[] = { 0, 5, 1, 5 }; \
602 int shift = (shift_value[hmode] + shift_value[vmode]) >> 1; \
603 int16_t tmp[11 * 8], *tptr = tmp; \
604 \
605 r = (1 << (shift - 1)) + rnd - 1; \
606 \
607 src -= 1; \
608 for (j = 0; j < 8; j++) { \
609 for (i = 0; i < 11; i++) \
610 tptr[i] = (vc1_mspel_ver_filter_16bits(src + i, stride, vmode) + r) >> shift; \
611 src += stride; \
612 tptr += 11; \
613 } \
614 \
615 r = 64 - rnd; \
616 tptr = tmp + 1; \
617 for (j = 0; j < 8; j++) { \
618 for (i = 0; i < 8; i++) \
619 OP(dst[i], (vc1_mspel_hor_filter_16bits(tptr + i, 1, hmode) + r) >> 7); \
620 dst += stride; \
621 tptr += 11; \
622 } \
623 \
624 return; \
625 } else { /* No horizontal filter, output 8 lines to dst */ \
626 r = 1 - rnd; \
627 \
628 for (j = 0; j < 8; j++) { \
629 for (i = 0; i < 8; i++) \
630 OP(dst[i], vc1_mspel_filter(src + i, stride, vmode, r)); \
631 src += stride; \
632 dst += stride; \
633 } \
634 return; \
635 } \
636 } \
637 \
638 /* Horizontal mode with no vertical mode */ \
639 for (j = 0; j < 8; j++) { \
640 for (i = 0; i < 8; i++) \
641 OP(dst[i], vc1_mspel_filter(src + i, 1, hmode, rnd)); \
642 dst += stride; \
643 src += stride; \
644 } \
645 }\
646 static av_always_inline void OPNAME ## vc1_mspel_mc_16(uint8_t *dst, \
647 const uint8_t *src, \
648 ptrdiff_t stride, \
649 int hmode, \
650 int vmode, \
651 int rnd) \
652 { \
653 int i, j; \
654 \
655 if (vmode) { /* Horizontal filter to apply */ \
656 int r; \
657 \
658 if (hmode) { /* Vertical filter to apply, output to tmp */ \
659 static const int shift_value[] = { 0, 5, 1, 5 }; \
660 int shift = (shift_value[hmode] + shift_value[vmode]) >> 1; \
661 int16_t tmp[19 * 16], *tptr = tmp; \
662 \
663 r = (1 << (shift - 1)) + rnd - 1; \
664 \
665 src -= 1; \
666 for (j = 0; j < 16; j++) { \
667 for (i = 0; i < 19; i++) \
668 tptr[i] = (vc1_mspel_ver_filter_16bits(src + i, stride, vmode) + r) >> shift; \
669 src += stride; \
670 tptr += 19; \
671 } \
672 \
673 r = 64 - rnd; \
674 tptr = tmp + 1; \
675 for (j = 0; j < 16; j++) { \
676 for (i = 0; i < 16; i++) \
677 OP(dst[i], (vc1_mspel_hor_filter_16bits(tptr + i, 1, hmode) + r) >> 7); \
678 dst += stride; \
679 tptr += 19; \
680 } \
681 \
682 return; \
683 } else { /* No horizontal filter, output 8 lines to dst */ \
684 r = 1 - rnd; \
685 \
686 for (j = 0; j < 16; j++) { \
687 for (i = 0; i < 16; i++) \
688 OP(dst[i], vc1_mspel_filter(src + i, stride, vmode, r)); \
689 src += stride; \
690 dst += stride; \
691 } \
692 return; \
693 } \
694 } \
695 \
696 /* Horizontal mode with no vertical mode */ \
697 for (j = 0; j < 16; j++) { \
698 for (i = 0; i < 16; i++) \
699 OP(dst[i], vc1_mspel_filter(src + i, 1, hmode, rnd)); \
700 dst += stride; \
701 src += stride; \
702 } \
703 }\
704 static void OPNAME ## pixels8x8_c(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int rnd){\
705 int i;\
706 for(i=0; i<8; i++){\
707 OP4(*(uint32_t*)(block ), AV_RN32(pixels ));\
708 OP4(*(uint32_t*)(block+4), AV_RN32(pixels+4));\
709 pixels+=line_size;\
710 block +=line_size;\
711 }\
712 }\
713 static void OPNAME ## pixels16x16_c(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int rnd){\
714 int i;\
715 for(i=0; i<16; i++){\
716 OP4(*(uint32_t*)(block ), AV_RN32(pixels ));\
717 OP4(*(uint32_t*)(block+ 4), AV_RN32(pixels+ 4));\
718 OP4(*(uint32_t*)(block+ 8), AV_RN32(pixels+ 8));\
719 OP4(*(uint32_t*)(block+12), AV_RN32(pixels+12));\
720 pixels+=line_size;\
721 block +=line_size;\
722 }\
723 }
724
725 #define op_put(a, b) (a) = av_clip_uint8(b)
726 #define op_avg(a, b) (a) = ((a) + av_clip_uint8(b) + 1) >> 1
727 #define op4_avg(a, b) (a) = rnd_avg32(a, b)
728 #define op4_put(a, b) (a) = (b)
729
730
20/20
✓ Branch 0 taken 926825 times.
✓ Branch 1 taken 118487 times.
✓ Branch 2 taken 185321 times.
✓ Branch 3 taken 78440 times.
✓ Branch 5 taken 30358832 times.
✓ Branch 6 taken 2002960 times.
✓ Branch 7 taken 2002960 times.
✓ Branch 8 taken 185321 times.
✓ Branch 10 taken 24349952 times.
✓ Branch 11 taken 2002960 times.
✓ Branch 12 taken 2002960 times.
✓ Branch 13 taken 185321 times.
✓ Branch 15 taken 9516416 times.
✓ Branch 16 taken 814864 times.
✓ Branch 17 taken 814864 times.
✓ Branch 18 taken 78440 times.
✓ Branch 20 taken 6932160 times.
✓ Branch 21 taken 572040 times.
✓ Branch 22 taken 572040 times.
✓ Branch 23 taken 53100 times.
155190992 VC1_MSPEL_MC(op_put, op4_put, put_)
731
21/21
✓ Branch 0 taken 30563 times.
✓ Branch 1 taken 6057 times.
✓ Branch 2 taken 31454 times.
✓ Branch 3 taken 8910 times.
✓ Branch 4 taken 71360 times.
✓ Branch 5 taken 4138756 times.
✓ Branch 6 taken 260936 times.
✓ Branch 7 taken 260936 times.
✓ Branch 8 taken 22742 times.
✓ Branch 10 taken 3351488 times.
✓ Branch 11 taken 260936 times.
✓ Branch 12 taken 260936 times.
✓ Branch 13 taken 22742 times.
✓ Branch 15 taken 1329600 times.
✓ Branch 16 taken 97112 times.
✓ Branch 17 taken 97112 times.
✓ Branch 18 taken 7821 times.
✓ Branch 20 taken 978240 times.
✓ Branch 21 taken 73064 times.
✓ Branch 22 taken 73064 times.
✓ Branch 23 taken 6057 times.
21215826 VC1_MSPEL_MC(op_avg, op4_avg, avg_)
732
733 /* pixel functions - really are entry points to vc1_mspel_mc */
734
735 #define PUT_VC1_MSPEL(a, b) \
736 static void put_vc1_mspel_mc ## a ## b ## _c(uint8_t *dst, \
737 const uint8_t *src, \
738 ptrdiff_t stride, int rnd) \
739 { \
740 put_vc1_mspel_mc(dst, src, stride, a, b, rnd); \
741 } \
742 static void avg_vc1_mspel_mc ## a ## b ## _c(uint8_t *dst, \
743 const uint8_t *src, \
744 ptrdiff_t stride, int rnd) \
745 { \
746 avg_vc1_mspel_mc(dst, src, stride, a, b, rnd); \
747 } \
748 static void put_vc1_mspel_mc ## a ## b ## _16_c(uint8_t *dst, \
749 const uint8_t *src, \
750 ptrdiff_t stride, int rnd) \
751 { \
752 put_vc1_mspel_mc_16(dst, src, stride, a, b, rnd); \
753 } \
754 static void avg_vc1_mspel_mc ## a ## b ## _16_c(uint8_t *dst, \
755 const uint8_t *src, \
756 ptrdiff_t stride, int rnd) \
757 { \
758 avg_vc1_mspel_mc_16(dst, src, stride, a, b, rnd); \
759 }
760
761 38348 PUT_VC1_MSPEL(1, 0)
762 46594 PUT_VC1_MSPEL(2, 0)
763 33372 PUT_VC1_MSPEL(3, 0)
764
765 40502 PUT_VC1_MSPEL(0, 1)
766 31544 PUT_VC1_MSPEL(1, 1)
767 54640 PUT_VC1_MSPEL(2, 1)
768 28962 PUT_VC1_MSPEL(3, 1)
769
770 94002 PUT_VC1_MSPEL(0, 2)
771 48410 PUT_VC1_MSPEL(1, 2)
772 92494 PUT_VC1_MSPEL(2, 2)
773 49662 PUT_VC1_MSPEL(3, 2)
774
775 38018 PUT_VC1_MSPEL(0, 3)
776 30048 PUT_VC1_MSPEL(1, 3)
777 51980 PUT_VC1_MSPEL(2, 3)
778 28386 PUT_VC1_MSPEL(3, 3)
779
780 #define chroma_mc(a) \
781 ((A * src[a] + B * src[a + 1] + \
782 C * src[stride + a] + D * src[stride + a + 1] + 32 - 4) >> 6)
783 244032 static void put_no_rnd_vc1_chroma_mc8_c(uint8_t *dst /* align 8 */,
784 const uint8_t *src /* align 1 */,
785 ptrdiff_t stride, int h, int x, int y)
786 {
787 244032 const int A = (8 - x) * (8 - y);
788 244032 const int B = (x) * (8 - y);
789 244032 const int C = (8 - x) * (y);
790 244032 const int D = (x) * (y);
791 int i;
792
793 av_assert2(x < 8 && y < 8 && x >= 0 && y >= 0);
794
795
2/2
✓ Branch 0 taken 1952256 times.
✓ Branch 1 taken 244032 times.
2196288 for (i = 0; i < h; i++) {
796 1952256 dst[0] = chroma_mc(0);
797 1952256 dst[1] = chroma_mc(1);
798 1952256 dst[2] = chroma_mc(2);
799 1952256 dst[3] = chroma_mc(3);
800 1952256 dst[4] = chroma_mc(4);
801 1952256 dst[5] = chroma_mc(5);
802 1952256 dst[6] = chroma_mc(6);
803 1952256 dst[7] = chroma_mc(7);
804 1952256 dst += stride;
805 1952256 src += stride;
806 }
807 244032 }
808
809 86192 static void put_no_rnd_vc1_chroma_mc4_c(uint8_t *dst, const uint8_t *src,
810 ptrdiff_t stride, int h, int x, int y)
811 {
812 86192 const int A = (8 - x) * (8 - y);
813 86192 const int B = (x) * (8 - y);
814 86192 const int C = (8 - x) * (y);
815 86192 const int D = (x) * (y);
816 int i;
817
818 av_assert2(x < 8 && y < 8 && x >= 0 && y >= 0);
819
820
2/2
✓ Branch 0 taken 344768 times.
✓ Branch 1 taken 86192 times.
430960 for (i = 0; i < h; i++) {
821 344768 dst[0] = chroma_mc(0);
822 344768 dst[1] = chroma_mc(1);
823 344768 dst[2] = chroma_mc(2);
824 344768 dst[3] = chroma_mc(3);
825 344768 dst += stride;
826 344768 src += stride;
827 }
828 86192 }
829
830 #define avg2(a, b) (((a) + (b) + 1) >> 1)
831 21934 static void avg_no_rnd_vc1_chroma_mc8_c(uint8_t *dst /* align 8 */,
832 const uint8_t *src /* align 1 */,
833 ptrdiff_t stride, int h, int x, int y)
834 {
835 21934 const int A = (8 - x) * (8 - y);
836 21934 const int B = (x) * (8 - y);
837 21934 const int C = (8 - x) * (y);
838 21934 const int D = (x) * (y);
839 int i;
840
841 av_assert2(x < 8 && y < 8 && x >= 0 && y >= 0);
842
843
2/2
✓ Branch 0 taken 175472 times.
✓ Branch 1 taken 21934 times.
197406 for (i = 0; i < h; i++) {
844 175472 dst[0] = avg2(dst[0], chroma_mc(0));
845 175472 dst[1] = avg2(dst[1], chroma_mc(1));
846 175472 dst[2] = avg2(dst[2], chroma_mc(2));
847 175472 dst[3] = avg2(dst[3], chroma_mc(3));
848 175472 dst[4] = avg2(dst[4], chroma_mc(4));
849 175472 dst[5] = avg2(dst[5], chroma_mc(5));
850 175472 dst[6] = avg2(dst[6], chroma_mc(6));
851 175472 dst[7] = avg2(dst[7], chroma_mc(7));
852 175472 dst += stride;
853 175472 src += stride;
854 }
855 21934 }
856
857 18992 static void avg_no_rnd_vc1_chroma_mc4_c(uint8_t *dst /* align 8 */,
858 const uint8_t *src /* align 1 */,
859 ptrdiff_t stride, int h, int x, int y)
860 {
861 18992 const int A = (8 - x) * (8 - y);
862 18992 const int B = ( x) * (8 - y);
863 18992 const int C = (8 - x) * ( y);
864 18992 const int D = ( x) * ( y);
865 int i;
866
867 av_assert2(x < 8 && y < 8 && x >= 0 && y >= 0);
868
869
2/2
✓ Branch 0 taken 75968 times.
✓ Branch 1 taken 18992 times.
94960 for (i = 0; i < h; i++) {
870 75968 dst[0] = avg2(dst[0], chroma_mc(0));
871 75968 dst[1] = avg2(dst[1], chroma_mc(1));
872 75968 dst[2] = avg2(dst[2], chroma_mc(2));
873 75968 dst[3] = avg2(dst[3], chroma_mc(3));
874 75968 dst += stride;
875 75968 src += stride;
876 }
877 18992 }
878
879 #if CONFIG_WMV3IMAGE_DECODER || CONFIG_VC1IMAGE_DECODER
880
881 static void sprite_h_c(uint8_t *dst, const uint8_t *src, int offset,
882 int advance, int count)
883 {
884 while (count--) {
885 int a = src[(offset >> 16)];
886 int b = src[(offset >> 16) + 1];
887 *dst++ = a + ((b - a) * (offset & 0xFFFF) >> 16);
888 offset += advance;
889 }
890 }
891
892 static av_always_inline void sprite_v_template(uint8_t *dst,
893 const uint8_t *src1a,
894 const uint8_t *src1b,
895 int offset1,
896 int two_sprites,
897 const uint8_t *src2a,
898 const uint8_t *src2b,
899 int offset2,
900 int alpha, int scaled,
901 int width)
902 {
903 int a1, b1, a2, b2;
904 while (width--) {
905 a1 = *src1a++;
906 if (scaled) {
907 b1 = *src1b++;
908 a1 = a1 + ((b1 - a1) * offset1 >> 16);
909 }
910 if (two_sprites) {
911 a2 = *src2a++;
912 if (scaled > 1) {
913 b2 = *src2b++;
914 a2 = a2 + ((b2 - a2) * offset2 >> 16);
915 }
916 a1 = a1 + ((a2 - a1) * alpha >> 16);
917 }
918 *dst++ = a1;
919 }
920 }
921
922 static void sprite_v_single_c(uint8_t *dst, const uint8_t *src1a,
923 const uint8_t *src1b,
924 int offset, int width)
925 {
926 sprite_v_template(dst, src1a, src1b, offset, 0, NULL, NULL, 0, 0, 1, width);
927 }
928
929 static void sprite_v_double_noscale_c(uint8_t *dst, const uint8_t *src1a,
930 const uint8_t *src2a,
931 int alpha, int width)
932 {
933 sprite_v_template(dst, src1a, NULL, 0, 1, src2a, NULL, 0, alpha, 0, width);
934 }
935
936 static void sprite_v_double_onescale_c(uint8_t *dst,
937 const uint8_t *src1a,
938 const uint8_t *src1b,
939 int offset1,
940 const uint8_t *src2a,
941 int alpha, int width)
942 {
943 sprite_v_template(dst, src1a, src1b, offset1, 1, src2a, NULL, 0, alpha, 1,
944 width);
945 }
946
947 static void sprite_v_double_twoscale_c(uint8_t *dst,
948 const uint8_t *src1a,
949 const uint8_t *src1b,
950 int offset1,
951 const uint8_t *src2a,
952 const uint8_t *src2b,
953 int offset2,
954 int alpha,
955 int width)
956 {
957 sprite_v_template(dst, src1a, src1b, offset1, 1, src2a, src2b, offset2,
958 alpha, 2, width);
959 }
960
961 #endif /* CONFIG_WMV3IMAGE_DECODER || CONFIG_VC1IMAGE_DECODER */
962 #define FN_ASSIGN(X, Y) \
963 dsp->put_vc1_mspel_pixels_tab[1][X+4*Y] = put_vc1_mspel_mc##X##Y##_c; \
964 dsp->put_vc1_mspel_pixels_tab[0][X+4*Y] = put_vc1_mspel_mc##X##Y##_16_c; \
965 dsp->avg_vc1_mspel_pixels_tab[1][X+4*Y] = avg_vc1_mspel_mc##X##Y##_c; \
966 dsp->avg_vc1_mspel_pixels_tab[0][X+4*Y] = avg_vc1_mspel_mc##X##Y##_16_c
967
968 112 av_cold void ff_vc1dsp_init(VC1DSPContext *dsp)
969 {
970 112 dsp->vc1_inv_trans_8x8 = vc1_inv_trans_8x8_c;
971 112 dsp->vc1_inv_trans_4x8 = vc1_inv_trans_4x8_c;
972 112 dsp->vc1_inv_trans_8x4 = vc1_inv_trans_8x4_c;
973 112 dsp->vc1_inv_trans_4x4 = vc1_inv_trans_4x4_c;
974 112 dsp->vc1_inv_trans_8x8_dc = vc1_inv_trans_8x8_dc_c;
975 112 dsp->vc1_inv_trans_4x8_dc = vc1_inv_trans_4x8_dc_c;
976 112 dsp->vc1_inv_trans_8x4_dc = vc1_inv_trans_8x4_dc_c;
977 112 dsp->vc1_inv_trans_4x4_dc = vc1_inv_trans_4x4_dc_c;
978
979 112 dsp->vc1_h_overlap = vc1_h_overlap_c;
980 112 dsp->vc1_v_overlap = vc1_v_overlap_c;
981 112 dsp->vc1_h_s_overlap = vc1_h_s_overlap_c;
982 112 dsp->vc1_v_s_overlap = vc1_v_s_overlap_c;
983
984 112 dsp->vc1_v_loop_filter4 = vc1_v_loop_filter4_c;
985 112 dsp->vc1_h_loop_filter4 = vc1_h_loop_filter4_c;
986 112 dsp->vc1_v_loop_filter8 = vc1_v_loop_filter8_c;
987 112 dsp->vc1_h_loop_filter8 = vc1_h_loop_filter8_c;
988 112 dsp->vc1_v_loop_filter16 = vc1_v_loop_filter16_c;
989 112 dsp->vc1_h_loop_filter16 = vc1_h_loop_filter16_c;
990
991 112 dsp->put_vc1_mspel_pixels_tab[0][0] = put_pixels16x16_c;
992 112 dsp->avg_vc1_mspel_pixels_tab[0][0] = avg_pixels16x16_c;
993 112 dsp->put_vc1_mspel_pixels_tab[1][0] = put_pixels8x8_c;
994 112 dsp->avg_vc1_mspel_pixels_tab[1][0] = avg_pixels8x8_c;
995 112 FN_ASSIGN(0, 1);
996 112 FN_ASSIGN(0, 2);
997 112 FN_ASSIGN(0, 3);
998
999 112 FN_ASSIGN(1, 0);
1000 112 FN_ASSIGN(1, 1);
1001 112 FN_ASSIGN(1, 2);
1002 112 FN_ASSIGN(1, 3);
1003
1004 112 FN_ASSIGN(2, 0);
1005 112 FN_ASSIGN(2, 1);
1006 112 FN_ASSIGN(2, 2);
1007 112 FN_ASSIGN(2, 3);
1008
1009 112 FN_ASSIGN(3, 0);
1010 112 FN_ASSIGN(3, 1);
1011 112 FN_ASSIGN(3, 2);
1012 112 FN_ASSIGN(3, 3);
1013
1014 112 dsp->put_no_rnd_vc1_chroma_pixels_tab[0] = put_no_rnd_vc1_chroma_mc8_c;
1015 112 dsp->avg_no_rnd_vc1_chroma_pixels_tab[0] = avg_no_rnd_vc1_chroma_mc8_c;
1016 112 dsp->put_no_rnd_vc1_chroma_pixels_tab[1] = put_no_rnd_vc1_chroma_mc4_c;
1017 112 dsp->avg_no_rnd_vc1_chroma_pixels_tab[1] = avg_no_rnd_vc1_chroma_mc4_c;
1018
1019 #if CONFIG_WMV3IMAGE_DECODER || CONFIG_VC1IMAGE_DECODER
1020 112 dsp->sprite_h = sprite_h_c;
1021 112 dsp->sprite_v_single = sprite_v_single_c;
1022 112 dsp->sprite_v_double_noscale = sprite_v_double_noscale_c;
1023 112 dsp->sprite_v_double_onescale = sprite_v_double_onescale_c;
1024 112 dsp->sprite_v_double_twoscale = sprite_v_double_twoscale_c;
1025 #endif /* CONFIG_WMV3IMAGE_DECODER || CONFIG_VC1IMAGE_DECODER */
1026
1027 112 dsp->startcode_find_candidate = ff_startcode_find_candidate_c;
1028 112 dsp->vc1_unescape_buffer = vc1_unescape_buffer;
1029
1030 #if ARCH_AARCH64
1031 ff_vc1dsp_init_aarch64(dsp);
1032 #elif ARCH_ARM
1033 ff_vc1dsp_init_arm(dsp);
1034 #elif ARCH_PPC
1035 ff_vc1dsp_init_ppc(dsp);
1036 #elif ARCH_RISCV
1037 ff_vc1dsp_init_riscv(dsp);
1038 #elif ARCH_X86 && HAVE_X86ASM
1039 112 ff_vc1dsp_init_x86(dsp);
1040 #elif ARCH_MIPS
1041 ff_vc1dsp_init_mips(dsp);
1042 #elif ARCH_LOONGARCH
1043 ff_vc1dsp_init_loongarch(dsp);
1044 #endif
1045 112 }
1046