Bug Summary

File:root/firefox-clang/obj-x86_64-pc-linux-gnu/media/libdav1d/8bd_mc_tmpl.c
Warning:line 274, column 29
The right operand of '*' is a garbage value

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-pc-linux-gnu -O2 -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name 8bd_mc_tmpl.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -analyzer-config-compatibility-mode=true -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=all -relaxed-aliasing -ffp-contract=off -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/root/firefox-clang/obj-x86_64-pc-linux-gnu/media/libdav1d -fcoverage-compilation-dir=/root/firefox-clang/obj-x86_64-pc-linux-gnu/media/libdav1d -resource-dir /usr/lib/llvm-23/lib/clang/23 -include /root/firefox-clang/config/gcc_hidden.h -include /root/firefox-clang/obj-x86_64-pc-linux-gnu/mozilla-config.h -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/dist/system_wrappers -U _FORTIFY_SOURCE -D _FORTIFY_SOURCE=2 -D DEBUG=1 -D DAV1D_API= -D STACK_ALIGNMENT=16 -D MOZ_HAS_MOZGLUE -D MOZILLA_INTERNAL_API -D IMPL_LIBXUL -D MOZ_SUPPORT_LEAKCHECKING -D STATIC_EXPORTABLE_JS_API -I /root/firefox-clang/media/libdav1d -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/media/libdav1d -I /root/firefox-clang/third_party/dav1d -I /root/firefox-clang/third_party/dav1d/include -I /root/firefox-clang/third_party/dav1d/include/dav1d -I /root/firefox-clang/third_party/dav1d/src -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/dist/include -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/dist/include/nspr -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/dist/include/nss -D MOZILLA_CLIENT -internal-isystem /usr/lib/llvm-23/lib/clang/23/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/16/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -Wno-error=tautological-type-limit-compare -Wno-range-loop-analysis -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wno-error=free-nonheap-object -Wno-error=atomic-alignment -Wno-error=deprecated-builtins -Wno-psabi -Wno-error=builtin-macro-redefined -Wno-unknown-warning-option -Wno-character-conversion -ferror-limit 19 -fstrict-flex-arrays=1 -stack-protector 2 -fstack-clash-protection -ftrivial-auto-var-init=pattern -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fdiagnostics-absolute-paths -vectorize-loops -vectorize-slp -analyzer-checker optin.performance.Padding -analyzer-output=html -analyzer-config stable-report-filename=true -mllvm -dwarf-linkage-names=Abstract -faddrsig -fdwarf2-cfi-asm -o /tmp/scan-build-2026-09-01-224014-2642839-1 -x c 8bd_mc_tmpl.c
1#define BITDEPTH8 8
2/*
3 * Copyright © 2018, VideoLAN and dav1d authors
4 * Copyright © 2018, Two Orioles, LLC
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are met:
9 *
10 * 1. Redistributions of source code must retain the above copyright notice, this
11 * list of conditions and the following disclaimer.
12 *
13 * 2. Redistributions in binary form must reproduce the above copyright notice,
14 * this list of conditions and the following disclaimer in the documentation
15 * and/or other materials provided with the distribution.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
21 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#include "config.h"
30
31#include <stdlib.h>
32#include <string.h>
33
34#include "common/attributes.h"
35#include "common/intops.h"
36
37#include "src/mc.h"
38#include "src/tables.h"
39
40#if BITDEPTH8 == 8
41#define get_intermediate_bits(bitdepth_max)4 4
42// Output in interval [-5132, 9212], fits in int16_t as is
43#define PREP_BIAS0 0
44#else
45// 4 for 10 bits/component, 2 for 12 bits/component
46#define get_intermediate_bits(bitdepth_max)4 (14 - bitdepth_from_max(bitdepth_max)8)
47// Output in interval [-20588, 36956] (10-bit), [-20602, 36983] (12-bit)
48// Subtract a bias to ensure the output fits in int16_t
49#define PREP_BIAS0 8192
50#endif
51
52static NOINLINE__attribute__((noinline)) void
53put_c(pixel *dst, const ptrdiff_t dst_stride,
54 const pixel *src, const ptrdiff_t src_stride, const int w, int h)
55{
56 do {
57 pixel_copymemcpy(dst, src, w);
58
59 dst += dst_stride;
60 src += src_stride;
61 } while (--h);
62}
63
64static NOINLINE__attribute__((noinline)) void
65prep_c(int16_t *tmp, const pixel *src, const ptrdiff_t src_stride,
66 const int w, int h HIGHBD_DECL_SUFFIX)
67{
68 const int intermediate_bits = get_intermediate_bits(bitdepth_max)4;
69 do {
70 for (int x = 0; x < w; x++)
71 tmp[x] = (src[x] << intermediate_bits) - PREP_BIAS0;
72
73 tmp += w;
74 src += src_stride;
75 } while (--h);
76}
77
78#define FILTER_8TAP(src, x, F, stride)(F[0] * src[x + -3 * stride] + F[1] * src[x + -2 * stride] + F
[2] * src[x + -1 * stride] + F[3] * src[x + +0 * stride] + F[
4] * src[x + +1 * stride] + F[5] * src[x + +2 * stride] + F[6
] * src[x + +3 * stride] + F[7] * src[x + +4 * stride])
\
79 (F[0] * src[x + -3 * stride] + \
80 F[1] * src[x + -2 * stride] + \
81 F[2] * src[x + -1 * stride] + \
82 F[3] * src[x + +0 * stride] + \
83 F[4] * src[x + +1 * stride] + \
84 F[5] * src[x + +2 * stride] + \
85 F[6] * src[x + +3 * stride] + \
86 F[7] * src[x + +4 * stride])
87
88#define FILTER_8TAP2(src, x, F)(F[0] * src[0][x] + F[1] * src[1][x] + F[2] * src[2][x] + F[3
] * src[3][x] + F[4] * src[4][x] + F[5] * src[5][x] + F[6] * src
[6][x] + F[7] * src[7][x])
\
89 (F[0] * src[0][x] + \
90 F[1] * src[1][x] + \
91 F[2] * src[2][x] + \
92 F[3] * src[3][x] + \
93 F[4] * src[4][x] + \
94 F[5] * src[5][x] + \
95 F[6] * src[6][x] + \
96 F[7] * src[7][x])
97
98#define DAV1D_FILTER_8TAP_RND(src, x, F, stride, sh)(((F[0] * src[x + -3 * stride] + F[1] * src[x + -2 * stride] +
F[2] * src[x + -1 * stride] + F[3] * src[x + +0 * stride] + F
[4] * src[x + +1 * stride] + F[5] * src[x + +2 * stride] + F[
6] * src[x + +3 * stride] + F[7] * src[x + +4 * stride]) + ((
1 << (sh)) >> 1)) >> (sh))
\
99 ((FILTER_8TAP(src, x, F, stride)(F[0] * src[x + -3 * stride] + F[1] * src[x + -2 * stride] + F
[2] * src[x + -1 * stride] + F[3] * src[x + +0 * stride] + F[
4] * src[x + +1 * stride] + F[5] * src[x + +2 * stride] + F[6
] * src[x + +3 * stride] + F[7] * src[x + +4 * stride])
+ ((1 << (sh)) >> 1)) >> (sh))
100
101#define DAV1D_FILTER_8TAP_RND2(src, x, F, stride, rnd, sh)(((F[0] * src[x + -3 * stride] + F[1] * src[x + -2 * stride] +
F[2] * src[x + -1 * stride] + F[3] * src[x + +0 * stride] + F
[4] * src[x + +1 * stride] + F[5] * src[x + +2 * stride] + F[
6] * src[x + +3 * stride] + F[7] * src[x + +4 * stride]) + (rnd
)) >> (sh))
\
102 ((FILTER_8TAP(src, x, F, stride)(F[0] * src[x + -3 * stride] + F[1] * src[x + -2 * stride] + F
[2] * src[x + -1 * stride] + F[3] * src[x + +0 * stride] + F[
4] * src[x + +1 * stride] + F[5] * src[x + +2 * stride] + F[6
] * src[x + +3 * stride] + F[7] * src[x + +4 * stride])
+ (rnd)) >> (sh))
103
104#define DAV1D_FILTER_8TAP_RND3(src, x, F, sh)(((F[0] * src[0][x] + F[1] * src[1][x] + F[2] * src[2][x] + F
[3] * src[3][x] + F[4] * src[4][x] + F[5] * src[5][x] + F[6] *
src[6][x] + F[7] * src[7][x]) + ((1 << (sh)) >> 1
)) >> (sh))
\
105 ((FILTER_8TAP2(src, x, F)(F[0] * src[0][x] + F[1] * src[1][x] + F[2] * src[2][x] + F[3
] * src[3][x] + F[4] * src[4][x] + F[5] * src[5][x] + F[6] * src
[6][x] + F[7] * src[7][x])
+ ((1 << (sh)) >> 1)) >> (sh))
106
107#define DAV1D_FILTER_8TAP_CLIP(src, x, F, stride, sh)iclip_u8((((F[0] * src[x + -3 * stride] + F[1] * src[x + -2 *
stride] + F[2] * src[x + -1 * stride] + F[3] * src[x + +0 * stride
] + F[4] * src[x + +1 * stride] + F[5] * src[x + +2 * stride]
+ F[6] * src[x + +3 * stride] + F[7] * src[x + +4 * stride])
+ ((1 << (sh)) >> 1)) >> (sh)))
\
108 iclip_pixeliclip_u8(DAV1D_FILTER_8TAP_RND(src, x, F, stride, sh)(((F[0] * src[x + -3 * stride] + F[1] * src[x + -2 * stride] +
F[2] * src[x + -1 * stride] + F[3] * src[x + +0 * stride] + F
[4] * src[x + +1 * stride] + F[5] * src[x + +2 * stride] + F[
6] * src[x + +3 * stride] + F[7] * src[x + +4 * stride]) + ((
1 << (sh)) >> 1)) >> (sh))
)
109
110#define DAV1D_FILTER_8TAP_CLIP2(src, x, F, stride, rnd, sh)iclip_u8((((F[0] * src[x + -3 * stride] + F[1] * src[x + -2 *
stride] + F[2] * src[x + -1 * stride] + F[3] * src[x + +0 * stride
] + F[4] * src[x + +1 * stride] + F[5] * src[x + +2 * stride]
+ F[6] * src[x + +3 * stride] + F[7] * src[x + +4 * stride])
+ (rnd)) >> (sh)))
\
111 iclip_pixeliclip_u8(DAV1D_FILTER_8TAP_RND2(src, x, F, stride, rnd, sh)(((F[0] * src[x + -3 * stride] + F[1] * src[x + -2 * stride] +
F[2] * src[x + -1 * stride] + F[3] * src[x + +0 * stride] + F
[4] * src[x + +1 * stride] + F[5] * src[x + +2 * stride] + F[
6] * src[x + +3 * stride] + F[7] * src[x + +4 * stride]) + (rnd
)) >> (sh))
)
112
113#define DAV1D_FILTER_8TAP_CLIP3(src, x, F, sh)iclip_u8((((F[0] * src[0][x] + F[1] * src[1][x] + F[2] * src[
2][x] + F[3] * src[3][x] + F[4] * src[4][x] + F[5] * src[5][x
] + F[6] * src[6][x] + F[7] * src[7][x]) + ((1 << (sh))
>> 1)) >> (sh)))
\
114 iclip_pixeliclip_u8(DAV1D_FILTER_8TAP_RND3(src, x, F, sh)(((F[0] * src[0][x] + F[1] * src[1][x] + F[2] * src[2][x] + F
[3] * src[3][x] + F[4] * src[4][x] + F[5] * src[5][x] + F[6] *
src[6][x] + F[7] * src[7][x]) + ((1 << (sh)) >> 1
)) >> (sh))
)
115
116#define GET_H_FILTER(mx)const int8_t *const fh = !(mx) ? ((void*)0) : w > 4 ? dav1d_mc_subpel_filters
[filter_type & 3][(mx) - 1] : dav1d_mc_subpel_filters[3 +
(filter_type & 1)][(mx) - 1]
\
117 const int8_t *const fh = !(mx) ? NULL((void*)0) : w > 4 ? \
118 dav1d_mc_subpel_filters[filter_type & 3][(mx) - 1] : \
119 dav1d_mc_subpel_filters[3 + (filter_type & 1)][(mx) - 1]
120
121#define GET_V_FILTER(my)const int8_t *const fv = !(my) ? ((void*)0) : h > 4 ? dav1d_mc_subpel_filters
[filter_type >> 2][(my) - 1] : dav1d_mc_subpel_filters[
3 + ((filter_type >> 2) & 1)][(my) - 1]
\
122 const int8_t *const fv = !(my) ? NULL((void*)0) : h > 4 ? \
123 dav1d_mc_subpel_filters[filter_type >> 2][(my) - 1] : \
124 dav1d_mc_subpel_filters[3 + ((filter_type >> 2) & 1)][(my) - 1]
125
126#define GET_FILTERS()const int8_t *const fh = !(mx) ? ((void*)0) : w > 4 ? dav1d_mc_subpel_filters
[filter_type & 3][(mx) - 1] : dav1d_mc_subpel_filters[3 +
(filter_type & 1)][(mx) - 1]; const int8_t *const fv = !
(my) ? ((void*)0) : h > 4 ? dav1d_mc_subpel_filters[filter_type
>> 2][(my) - 1] : dav1d_mc_subpel_filters[3 + ((filter_type
>> 2) & 1)][(my) - 1]
\
127 GET_H_FILTER(mx)const int8_t *const fh = !(mx) ? ((void*)0) : w > 4 ? dav1d_mc_subpel_filters
[filter_type & 3][(mx) - 1] : dav1d_mc_subpel_filters[3 +
(filter_type & 1)][(mx) - 1]
; \
128 GET_V_FILTER(my)const int8_t *const fv = !(my) ? ((void*)0) : h > 4 ? dav1d_mc_subpel_filters
[filter_type >> 2][(my) - 1] : dav1d_mc_subpel_filters[
3 + ((filter_type >> 2) & 1)][(my) - 1]
129
130static NOINLINE__attribute__((noinline)) void
131put_8tap_c(pixel *dst, ptrdiff_t dst_stride,
132 const pixel *src, ptrdiff_t src_stride,
133 const int w, int h, const int mx, const int my,
134 const int filter_type HIGHBD_DECL_SUFFIX)
135{
136 const int intermediate_bits = get_intermediate_bits(bitdepth_max)4;
137 const int intermediate_rnd = 32 + ((1 << (6 - intermediate_bits)) >> 1);
138
139 GET_FILTERS()const int8_t *const fh = !(mx) ? ((void*)0) : w > 4 ? dav1d_mc_subpel_filters
[filter_type & 3][(mx) - 1] : dav1d_mc_subpel_filters[3 +
(filter_type & 1)][(mx) - 1]; const int8_t *const fv = !
(my) ? ((void*)0) : h > 4 ? dav1d_mc_subpel_filters[filter_type
>> 2][(my) - 1] : dav1d_mc_subpel_filters[3 + ((filter_type
>> 2) & 1)][(my) - 1]
;
140 dst_stride = PXSTRIDE(dst_stride)(dst_stride);
141 src_stride = PXSTRIDE(src_stride)(src_stride);
142
143 if (fh) {
144 if (fv) {
145 int tmp_h = h + 7;
146 int16_t mid[128 * 135], *mid_ptr = mid;
147
148 src -= src_stride * 3;
149 do {
150 for (int x = 0; x < w; x++)
151 mid_ptr[x] = DAV1D_FILTER_8TAP_RND(src, x, fh, 1,(((fh[0] * src[x + -3 * 1] + fh[1] * src[x + -2 * 1] + fh[2] *
src[x + -1 * 1] + fh[3] * src[x + +0 * 1] + fh[4] * src[x + +
1 * 1] + fh[5] * src[x + +2 * 1] + fh[6] * src[x + +3 * 1] + fh
[7] * src[x + +4 * 1]) + ((1 << (6 - intermediate_bits)
) >> 1)) >> (6 - intermediate_bits))
152 6 - intermediate_bits)(((fh[0] * src[x + -3 * 1] + fh[1] * src[x + -2 * 1] + fh[2] *
src[x + -1 * 1] + fh[3] * src[x + +0 * 1] + fh[4] * src[x + +
1 * 1] + fh[5] * src[x + +2 * 1] + fh[6] * src[x + +3 * 1] + fh
[7] * src[x + +4 * 1]) + ((1 << (6 - intermediate_bits)
) >> 1)) >> (6 - intermediate_bits))
;
153
154 mid_ptr += 128;
155 src += src_stride;
156 } while (--tmp_h);
157
158 mid_ptr = mid + 128 * 3;
159 do {
160 for (int x = 0; x < w; x++)
161 dst[x] = DAV1D_FILTER_8TAP_CLIP(mid_ptr, x, fv, 128,iclip_u8((((fv[0] * mid_ptr[x + -3 * 128] + fv[1] * mid_ptr[x
+ -2 * 128] + fv[2] * mid_ptr[x + -1 * 128] + fv[3] * mid_ptr
[x + +0 * 128] + fv[4] * mid_ptr[x + +1 * 128] + fv[5] * mid_ptr
[x + +2 * 128] + fv[6] * mid_ptr[x + +3 * 128] + fv[7] * mid_ptr
[x + +4 * 128]) + ((1 << (6 + intermediate_bits)) >>
1)) >> (6 + intermediate_bits)))
162 6 + intermediate_bits)iclip_u8((((fv[0] * mid_ptr[x + -3 * 128] + fv[1] * mid_ptr[x
+ -2 * 128] + fv[2] * mid_ptr[x + -1 * 128] + fv[3] * mid_ptr
[x + +0 * 128] + fv[4] * mid_ptr[x + +1 * 128] + fv[5] * mid_ptr
[x + +2 * 128] + fv[6] * mid_ptr[x + +3 * 128] + fv[7] * mid_ptr
[x + +4 * 128]) + ((1 << (6 + intermediate_bits)) >>
1)) >> (6 + intermediate_bits)))
;
163
164 mid_ptr += 128;
165 dst += dst_stride;
166 } while (--h);
167 } else {
168 do {
169 for (int x = 0; x < w; x++) {
170 dst[x] = DAV1D_FILTER_8TAP_CLIP2(src, x, fh, 1,iclip_u8((((fh[0] * src[x + -3 * 1] + fh[1] * src[x + -2 * 1]
+ fh[2] * src[x + -1 * 1] + fh[3] * src[x + +0 * 1] + fh[4] *
src[x + +1 * 1] + fh[5] * src[x + +2 * 1] + fh[6] * src[x + +
3 * 1] + fh[7] * src[x + +4 * 1]) + (intermediate_rnd)) >>
(6)))
171 intermediate_rnd, 6)iclip_u8((((fh[0] * src[x + -3 * 1] + fh[1] * src[x + -2 * 1]
+ fh[2] * src[x + -1 * 1] + fh[3] * src[x + +0 * 1] + fh[4] *
src[x + +1 * 1] + fh[5] * src[x + +2 * 1] + fh[6] * src[x + +
3 * 1] + fh[7] * src[x + +4 * 1]) + (intermediate_rnd)) >>
(6)))
;
172 }
173
174 dst += dst_stride;
175 src += src_stride;
176 } while (--h);
177 }
178 } else if (fv) {
179 do {
180 for (int x = 0; x < w; x++)
181 dst[x] = DAV1D_FILTER_8TAP_CLIP(src, x, fv, src_stride, 6)iclip_u8((((fv[0] * src[x + -3 * src_stride] + fv[1] * src[x +
-2 * src_stride] + fv[2] * src[x + -1 * src_stride] + fv[3] *
src[x + +0 * src_stride] + fv[4] * src[x + +1 * src_stride] +
fv[5] * src[x + +2 * src_stride] + fv[6] * src[x + +3 * src_stride
] + fv[7] * src[x + +4 * src_stride]) + ((1 << (6)) >>
1)) >> (6)))
;
182
183 dst += dst_stride;
184 src += src_stride;
185 } while (--h);
186 } else
187 put_c(dst, dst_stride, src, src_stride, w, h);
188}
189
190static NOINLINE__attribute__((noinline)) void
191put_8tap_scaled_c(pixel *dst, const ptrdiff_t dst_stride,
192 const pixel *src, ptrdiff_t src_stride,
193 const int w, int h, const int mx, int my,
194 const int dx, const int dy, const int filter_type
195 HIGHBD_DECL_SUFFIX)
196{
197 const int intermediate_bits = get_intermediate_bits(bitdepth_max)4;
198 const int intermediate_rnd = (1 << intermediate_bits) >> 1;
199 int16_t mid[128 * 8];
200 int16_t *mid_ptrs[8];
201 int in_y = -8;
202 src_stride = PXSTRIDE(src_stride)(src_stride);
203
204 for (int i = 0; i < 8; i++)
205 mid_ptrs[i] = &mid[128 * i];
206
207 src -= src_stride * 3;
208
209 for (int y = 0; y < h; y++) {
210 int x;
211 int src_y = my >> 10;
212 GET_V_FILTER((my & 0x3ff) >> 6)const int8_t *const fv = !((my & 0x3ff) >> 6) ? ((void
*)0) : h > 4 ? dav1d_mc_subpel_filters[filter_type >>
2][((my & 0x3ff) >> 6) - 1] : dav1d_mc_subpel_filters
[3 + ((filter_type >> 2) & 1)][((my & 0x3ff) >>
6) - 1]
;
213
214 while (in_y < src_y) {
215 int imx = mx, ioff = 0;
216 int16_t *mid_ptr = mid_ptrs[0];
217
218 for (int i = 0; i < 7; i++)
219 mid_ptrs[i] = mid_ptrs[i + 1];
220 mid_ptrs[7] = mid_ptr;
221
222 for (x = 0; x < w; x++) {
223 GET_H_FILTER(imx >> 6)const int8_t *const fh = !(imx >> 6) ? ((void*)0) : w >
4 ? dav1d_mc_subpel_filters[filter_type & 3][(imx >>
6) - 1] : dav1d_mc_subpel_filters[3 + (filter_type & 1)]
[(imx >> 6) - 1]
;
224 mid_ptr[x] = fh ? DAV1D_FILTER_8TAP_RND(src, ioff, fh, 1,(((fh[0] * src[ioff + -3 * 1] + fh[1] * src[ioff + -2 * 1] + fh
[2] * src[ioff + -1 * 1] + fh[3] * src[ioff + +0 * 1] + fh[4]
* src[ioff + +1 * 1] + fh[5] * src[ioff + +2 * 1] + fh[6] * src
[ioff + +3 * 1] + fh[7] * src[ioff + +4 * 1]) + ((1 << (
6 - intermediate_bits)) >> 1)) >> (6 - intermediate_bits
))
225 6 - intermediate_bits)(((fh[0] * src[ioff + -3 * 1] + fh[1] * src[ioff + -2 * 1] + fh
[2] * src[ioff + -1 * 1] + fh[3] * src[ioff + +0 * 1] + fh[4]
* src[ioff + +1 * 1] + fh[5] * src[ioff + +2 * 1] + fh[6] * src
[ioff + +3 * 1] + fh[7] * src[ioff + +4 * 1]) + ((1 << (
6 - intermediate_bits)) >> 1)) >> (6 - intermediate_bits
))
:
226 src[ioff] << intermediate_bits;
227 imx += dx;
228 ioff += imx >> 10;
229 imx &= 0x3ff;
230 }
231
232 src += src_stride;
233 in_y++;
234 }
235
236 for (x = 0; x < w; x++)
237 dst[x] = fv ? DAV1D_FILTER_8TAP_CLIP3(mid_ptrs, x, fv,iclip_u8((((fv[0] * mid_ptrs[0][x] + fv[1] * mid_ptrs[1][x] +
fv[2] * mid_ptrs[2][x] + fv[3] * mid_ptrs[3][x] + fv[4] * mid_ptrs
[4][x] + fv[5] * mid_ptrs[5][x] + fv[6] * mid_ptrs[6][x] + fv
[7] * mid_ptrs[7][x]) + ((1 << (6 + intermediate_bits))
>> 1)) >> (6 + intermediate_bits)))
238 6 + intermediate_bits)iclip_u8((((fv[0] * mid_ptrs[0][x] + fv[1] * mid_ptrs[1][x] +
fv[2] * mid_ptrs[2][x] + fv[3] * mid_ptrs[3][x] + fv[4] * mid_ptrs
[4][x] + fv[5] * mid_ptrs[5][x] + fv[6] * mid_ptrs[6][x] + fv
[7] * mid_ptrs[7][x]) + ((1 << (6 + intermediate_bits))
>> 1)) >> (6 + intermediate_bits)))
:
239 iclip_pixeliclip_u8((mid_ptrs[3][x] + intermediate_rnd) >>
240 intermediate_bits);
241
242 my += dy;
243 dst += PXSTRIDE(dst_stride)(dst_stride);
244 }
245}
246
247static NOINLINE__attribute__((noinline)) void
248prep_8tap_c(int16_t *tmp, const pixel *src, ptrdiff_t src_stride,
249 const int w, int h, const int mx, const int my,
250 const int filter_type HIGHBD_DECL_SUFFIX)
251{
252 const int intermediate_bits = get_intermediate_bits(bitdepth_max)4;
253 GET_FILTERS()const int8_t *const fh = !(mx) ? ((void*)0) : w > 4 ? dav1d_mc_subpel_filters
[filter_type & 3][(mx) - 1] : dav1d_mc_subpel_filters[3 +
(filter_type & 1)][(mx) - 1]; const int8_t *const fv = !
(my) ? ((void*)0) : h > 4 ? dav1d_mc_subpel_filters[filter_type
>> 2][(my) - 1] : dav1d_mc_subpel_filters[3 + ((filter_type
>> 2) & 1)][(my) - 1]
;
2
Assuming 'mx' is not equal to 0
3
'?' condition is false
4
Assuming 'w' is <= 4
5
'?' condition is false
6
Assuming 'my' is not equal to 0
7
'?' condition is false
8
Assuming 'h' is <= 4
9
'?' condition is false
254 src_stride = PXSTRIDE(src_stride)(src_stride);
255
256 if (fh
9.1
'fh' is non-null
) {
10
Taking true branch
257 if (fv
10.1
'fv' is non-null
) {
11
Taking true branch
258 int tmp_h = h + 7;
259 int16_t mid[128 * 135], *mid_ptr = mid;
260
261 src -= src_stride * 3;
262 do {
16
Loop condition is false. Exiting loop
263 for (int x = 0; x < w; x++)
12
Assuming 'x' is < 'w'
13
Loop condition is true. Entering loop body
14
Assuming 'x' is >= 'w'
15
Loop condition is false. Execution continues on line 267
264 mid_ptr[x] = DAV1D_FILTER_8TAP_RND(src, x, fh, 1,(((fh[0] * src[x + -3 * 1] + fh[1] * src[x + -2 * 1] + fh[2] *
src[x + -1 * 1] + fh[3] * src[x + +0 * 1] + fh[4] * src[x + +
1 * 1] + fh[5] * src[x + +2 * 1] + fh[6] * src[x + +3 * 1] + fh
[7] * src[x + +4 * 1]) + ((1 << (6 - intermediate_bits)
) >> 1)) >> (6 - intermediate_bits))
265 6 - intermediate_bits)(((fh[0] * src[x + -3 * 1] + fh[1] * src[x + -2 * 1] + fh[2] *
src[x + -1 * 1] + fh[3] * src[x + +0 * 1] + fh[4] * src[x + +
1 * 1] + fh[5] * src[x + +2 * 1] + fh[6] * src[x + +3 * 1] + fh
[7] * src[x + +4 * 1]) + ((1 << (6 - intermediate_bits)
) >> 1)) >> (6 - intermediate_bits))
;
266
267 mid_ptr += 128;
268 src += src_stride;
269 } while (--tmp_h);
270
271 mid_ptr = mid + 128 * 3;
272 do {
273 for (int x = 0; x < w; x++) {
17
Loop condition is true. Entering loop body
274 int t = DAV1D_FILTER_8TAP_RND(mid_ptr, x, fv, 128, 6)(((fv[0] * mid_ptr[x + -3 * 128] + fv[1] * mid_ptr[x + -2 * 128
] + fv[2] * mid_ptr[x + -1 * 128] + fv[3] * mid_ptr[x + +0 * 128
] + fv[4] * mid_ptr[x + +1 * 128] + fv[5] * mid_ptr[x + +2 * 128
] + fv[6] * mid_ptr[x + +3 * 128] + fv[7] * mid_ptr[x + +4 * 128
]) + ((1 << (6)) >> 1)) >> (6))
-
18
The right operand of '*' is a garbage value
275 PREP_BIAS0;
276 assert(t >= INT16_MIN && t <= INT16_MAX)((void) sizeof ((t >= (-32767-1) && t <= (32767
)) ? 1 : 0), __extension__ ({ if (t >= (-32767-1) &&
t <= (32767)) ; else __assert_fail ("t >= INT16_MIN && t <= INT16_MAX"
, "8bd_mc_tmpl.c", 276, __extension__ __PRETTY_FUNCTION__); }
))
;
277 tmp[x] = t;
278 }
279
280 mid_ptr += 128;
281 tmp += w;
282 } while (--h);
283 } else {
284 do {
285 for (int x = 0; x < w; x++)
286 tmp[x] = DAV1D_FILTER_8TAP_RND(src, x, fh, 1,(((fh[0] * src[x + -3 * 1] + fh[1] * src[x + -2 * 1] + fh[2] *
src[x + -1 * 1] + fh[3] * src[x + +0 * 1] + fh[4] * src[x + +
1 * 1] + fh[5] * src[x + +2 * 1] + fh[6] * src[x + +3 * 1] + fh
[7] * src[x + +4 * 1]) + ((1 << (6 - intermediate_bits)
) >> 1)) >> (6 - intermediate_bits))
287 6 - intermediate_bits)(((fh[0] * src[x + -3 * 1] + fh[1] * src[x + -2 * 1] + fh[2] *
src[x + -1 * 1] + fh[3] * src[x + +0 * 1] + fh[4] * src[x + +
1 * 1] + fh[5] * src[x + +2 * 1] + fh[6] * src[x + +3 * 1] + fh
[7] * src[x + +4 * 1]) + ((1 << (6 - intermediate_bits)
) >> 1)) >> (6 - intermediate_bits))
-
288 PREP_BIAS0;
289
290 tmp += w;
291 src += src_stride;
292 } while (--h);
293 }
294 } else if (fv) {
295 do {
296 for (int x = 0; x < w; x++)
297 tmp[x] = DAV1D_FILTER_8TAP_RND(src, x, fv, src_stride,(((fv[0] * src[x + -3 * src_stride] + fv[1] * src[x + -2 * src_stride
] + fv[2] * src[x + -1 * src_stride] + fv[3] * src[x + +0 * src_stride
] + fv[4] * src[x + +1 * src_stride] + fv[5] * src[x + +2 * src_stride
] + fv[6] * src[x + +3 * src_stride] + fv[7] * src[x + +4 * src_stride
]) + ((1 << (6 - intermediate_bits)) >> 1)) >>
(6 - intermediate_bits))
298 6 - intermediate_bits)(((fv[0] * src[x + -3 * src_stride] + fv[1] * src[x + -2 * src_stride
] + fv[2] * src[x + -1 * src_stride] + fv[3] * src[x + +0 * src_stride
] + fv[4] * src[x + +1 * src_stride] + fv[5] * src[x + +2 * src_stride
] + fv[6] * src[x + +3 * src_stride] + fv[7] * src[x + +4 * src_stride
]) + ((1 << (6 - intermediate_bits)) >> 1)) >>
(6 - intermediate_bits))
-
299 PREP_BIAS0;
300
301 tmp += w;
302 src += src_stride;
303 } while (--h);
304 } else
305 prep_c(tmp, src, src_stride, w, h HIGHBD_TAIL_SUFFIX);
306}
307
308static NOINLINE__attribute__((noinline)) void
309prep_8tap_scaled_c(int16_t *tmp, const pixel *src, ptrdiff_t src_stride,
310 const int w, int h, const int mx, int my,
311 const int dx, const int dy, const int filter_type
312 HIGHBD_DECL_SUFFIX)
313{
314 const int intermediate_bits = get_intermediate_bits(bitdepth_max)4;
315 int16_t mid[128 * 8];
316 int16_t *mid_ptrs[8];
317 int in_y = -8;
318 src_stride = PXSTRIDE(src_stride)(src_stride);
319
320 for (int i = 0; i < 8; i++)
321 mid_ptrs[i] = &mid[128 * i];
322
323 src -= src_stride * 3;
324
325 for (int y = 0; y < h; y++) {
326 int x;
327 int src_y = my >> 10;
328 GET_V_FILTER((my & 0x3ff) >> 6)const int8_t *const fv = !((my & 0x3ff) >> 6) ? ((void
*)0) : h > 4 ? dav1d_mc_subpel_filters[filter_type >>
2][((my & 0x3ff) >> 6) - 1] : dav1d_mc_subpel_filters
[3 + ((filter_type >> 2) & 1)][((my & 0x3ff) >>
6) - 1]
;
329
330 while (in_y < src_y) {
331 int imx = mx, ioff = 0;
332 int16_t *mid_ptr = mid_ptrs[0];
333
334 for (int i = 0; i < 7; i++)
335 mid_ptrs[i] = mid_ptrs[i + 1];
336 mid_ptrs[7] = mid_ptr;
337
338 for (x = 0; x < w; x++) {
339 GET_H_FILTER(imx >> 6)const int8_t *const fh = !(imx >> 6) ? ((void*)0) : w >
4 ? dav1d_mc_subpel_filters[filter_type & 3][(imx >>
6) - 1] : dav1d_mc_subpel_filters[3 + (filter_type & 1)]
[(imx >> 6) - 1]
;
340 mid_ptr[x] = fh ? DAV1D_FILTER_8TAP_RND(src, ioff, fh, 1,(((fh[0] * src[ioff + -3 * 1] + fh[1] * src[ioff + -2 * 1] + fh
[2] * src[ioff + -1 * 1] + fh[3] * src[ioff + +0 * 1] + fh[4]
* src[ioff + +1 * 1] + fh[5] * src[ioff + +2 * 1] + fh[6] * src
[ioff + +3 * 1] + fh[7] * src[ioff + +4 * 1]) + ((1 << (
6 - intermediate_bits)) >> 1)) >> (6 - intermediate_bits
))
341 6 - intermediate_bits)(((fh[0] * src[ioff + -3 * 1] + fh[1] * src[ioff + -2 * 1] + fh
[2] * src[ioff + -1 * 1] + fh[3] * src[ioff + +0 * 1] + fh[4]
* src[ioff + +1 * 1] + fh[5] * src[ioff + +2 * 1] + fh[6] * src
[ioff + +3 * 1] + fh[7] * src[ioff + +4 * 1]) + ((1 << (
6 - intermediate_bits)) >> 1)) >> (6 - intermediate_bits
))
:
342 src[ioff] << intermediate_bits;
343 imx += dx;
344 ioff += imx >> 10;
345 imx &= 0x3ff;
346 }
347
348 src += src_stride;
349 in_y++;
350 }
351
352 for (x = 0; x < w; x++)
353 tmp[x] = (fv ? DAV1D_FILTER_8TAP_RND3(mid_ptrs, x, fv, 6)(((fv[0] * mid_ptrs[0][x] + fv[1] * mid_ptrs[1][x] + fv[2] * mid_ptrs
[2][x] + fv[3] * mid_ptrs[3][x] + fv[4] * mid_ptrs[4][x] + fv
[5] * mid_ptrs[5][x] + fv[6] * mid_ptrs[6][x] + fv[7] * mid_ptrs
[7][x]) + ((1 << (6)) >> 1)) >> (6))
354 : mid_ptrs[3][x]) - PREP_BIAS0;
355
356 my += dy;
357 tmp += w;
358 }
359}
360
361#define filter_fns(type, type_h, type_v)static void put_8tap_type_c(pixel *const dst, const ptrdiff_t
dst_stride, const pixel *const src, const ptrdiff_t src_stride
, const int w, const int h, const int mx, const int my ) { put_8tap_c
(dst, dst_stride, src, src_stride, w, h, mx, my, type_h | (type_v
<< 2) ); } static void put_8tap_type_scaled_c(pixel *const
dst, const ptrdiff_t dst_stride, const pixel *const src, const
ptrdiff_t src_stride, const int w, const int h, const int mx
, const int my, const int dx, const int dy ) { put_8tap_scaled_c
(dst, dst_stride, src, src_stride, w, h, mx, my, dx, dy, type_h
| (type_v << 2) ); } static void prep_8tap_type_c(int16_t
*const tmp, const pixel *const src, const ptrdiff_t src_stride
, const int w, const int h, const int mx, const int my ) { prep_8tap_c
(tmp, src, src_stride, w, h, mx, my, type_h | (type_v <<
2) ); } static void prep_8tap_type_scaled_c(int16_t *const tmp
, const pixel *const src, const ptrdiff_t src_stride, const int
w, const int h, const int mx, const int my, const int dx, const
int dy ) { prep_8tap_scaled_c(tmp, src, src_stride, w, h, mx
, my, dx, dy, type_h | (type_v << 2) ); }
\
362static void put_8tap_##type##_c(pixel *const dst, \
363 const ptrdiff_t dst_stride, \
364 const pixel *const src, \
365 const ptrdiff_t src_stride, \
366 const int w, const int h, \
367 const int mx, const int my \
368 HIGHBD_DECL_SUFFIX) \
369{ \
370 put_8tap_c(dst, dst_stride, src, src_stride, w, h, mx, my, \
371 type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
372} \
373static void put_8tap_##type##_scaled_c(pixel *const dst, \
374 const ptrdiff_t dst_stride, \
375 const pixel *const src, \
376 const ptrdiff_t src_stride, \
377 const int w, const int h, \
378 const int mx, const int my, \
379 const int dx, const int dy \
380 HIGHBD_DECL_SUFFIX) \
381{ \
382 put_8tap_scaled_c(dst, dst_stride, src, src_stride, w, h, mx, my, dx, dy, \
383 type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
384} \
385static void prep_8tap_##type##_c(int16_t *const tmp, \
386 const pixel *const src, \
387 const ptrdiff_t src_stride, \
388 const int w, const int h, \
389 const int mx, const int my \
390 HIGHBD_DECL_SUFFIX) \
391{ \
392 prep_8tap_c(tmp, src, src_stride, w, h, mx, my, \
393 type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
394} \
395static void prep_8tap_##type##_scaled_c(int16_t *const tmp, \
396 const pixel *const src, \
397 const ptrdiff_t src_stride, \
398 const int w, const int h, \
399 const int mx, const int my, \
400 const int dx, const int dy \
401 HIGHBD_DECL_SUFFIX) \
402{ \
403 prep_8tap_scaled_c(tmp, src, src_stride, w, h, mx, my, dx, dy, \
404 type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
405}
406
407filter_fns(regular, DAV1D_FILTER_8TAP_REGULAR, DAV1D_FILTER_8TAP_REGULAR)static void put_8tap_regular_c(pixel *const dst, const ptrdiff_t
dst_stride, const pixel *const src, const ptrdiff_t src_stride
, const int w, const int h, const int mx, const int my ) { put_8tap_c
(dst, dst_stride, src, src_stride, w, h, mx, my, DAV1D_FILTER_8TAP_REGULAR
| (DAV1D_FILTER_8TAP_REGULAR << 2) ); } static void put_8tap_regular_scaled_c
(pixel *const dst, const ptrdiff_t dst_stride, const pixel *const
src, const ptrdiff_t src_stride, const int w, const int h, const
int mx, const int my, const int dx, const int dy ) { put_8tap_scaled_c
(dst, dst_stride, src, src_stride, w, h, mx, my, dx, dy, DAV1D_FILTER_8TAP_REGULAR
| (DAV1D_FILTER_8TAP_REGULAR << 2) ); } static void prep_8tap_regular_c
(int16_t *const tmp, const pixel *const src, const ptrdiff_t src_stride
, const int w, const int h, const int mx, const int my ) { prep_8tap_c
(tmp, src, src_stride, w, h, mx, my, DAV1D_FILTER_8TAP_REGULAR
| (DAV1D_FILTER_8TAP_REGULAR << 2) ); } static void prep_8tap_regular_scaled_c
(int16_t *const tmp, const pixel *const src, const ptrdiff_t src_stride
, const int w, const int h, const int mx, const int my, const
int dx, const int dy ) { prep_8tap_scaled_c(tmp, src, src_stride
, w, h, mx, my, dx, dy, DAV1D_FILTER_8TAP_REGULAR | (DAV1D_FILTER_8TAP_REGULAR
<< 2) ); }
408filter_fns(regular_sharp, DAV1D_FILTER_8TAP_REGULAR, DAV1D_FILTER_8TAP_SHARP)static void put_8tap_regular_sharp_c(pixel *const dst, const ptrdiff_t
dst_stride, const pixel *const src, const ptrdiff_t src_stride
, const int w, const int h, const int mx, const int my ) { put_8tap_c
(dst, dst_stride, src, src_stride, w, h, mx, my, DAV1D_FILTER_8TAP_REGULAR
| (DAV1D_FILTER_8TAP_SHARP << 2) ); } static void put_8tap_regular_sharp_scaled_c
(pixel *const dst, const ptrdiff_t dst_stride, const pixel *const
src, const ptrdiff_t src_stride, const int w, const int h, const
int mx, const int my, const int dx, const int dy ) { put_8tap_scaled_c
(dst, dst_stride, src, src_stride, w, h, mx, my, dx, dy, DAV1D_FILTER_8TAP_REGULAR
| (DAV1D_FILTER_8TAP_SHARP << 2) ); } static void prep_8tap_regular_sharp_c
(int16_t *const tmp, const pixel *const src, const ptrdiff_t src_stride
, const int w, const int h, const int mx, const int my ) { prep_8tap_c
(tmp, src, src_stride, w, h, mx, my, DAV1D_FILTER_8TAP_REGULAR
| (DAV1D_FILTER_8TAP_SHARP << 2) ); } static void prep_8tap_regular_sharp_scaled_c
(int16_t *const tmp, const pixel *const src, const ptrdiff_t src_stride
, const int w, const int h, const int mx, const int my, const
int dx, const int dy ) { prep_8tap_scaled_c(tmp, src, src_stride
, w, h, mx, my, dx, dy, DAV1D_FILTER_8TAP_REGULAR | (DAV1D_FILTER_8TAP_SHARP
<< 2) ); }
409filter_fns(regular_smooth, DAV1D_FILTER_8TAP_REGULAR, DAV1D_FILTER_8TAP_SMOOTH)static void put_8tap_regular_smooth_c(pixel *const dst, const
ptrdiff_t dst_stride, const pixel *const src, const ptrdiff_t
src_stride, const int w, const int h, const int mx, const int
my ) { put_8tap_c(dst, dst_stride, src, src_stride, w, h, mx
, my, DAV1D_FILTER_8TAP_REGULAR | (DAV1D_FILTER_8TAP_SMOOTH <<
2) ); } static void put_8tap_regular_smooth_scaled_c(pixel *
const dst, const ptrdiff_t dst_stride, const pixel *const src
, const ptrdiff_t src_stride, const int w, const int h, const
int mx, const int my, const int dx, const int dy ) { put_8tap_scaled_c
(dst, dst_stride, src, src_stride, w, h, mx, my, dx, dy, DAV1D_FILTER_8TAP_REGULAR
| (DAV1D_FILTER_8TAP_SMOOTH << 2) ); } static void prep_8tap_regular_smooth_c
(int16_t *const tmp, const pixel *const src, const ptrdiff_t src_stride
, const int w, const int h, const int mx, const int my ) { prep_8tap_c
(tmp, src, src_stride, w, h, mx, my, DAV1D_FILTER_8TAP_REGULAR
| (DAV1D_FILTER_8TAP_SMOOTH << 2) ); } static void prep_8tap_regular_smooth_scaled_c
(int16_t *const tmp, const pixel *const src, const ptrdiff_t src_stride
, const int w, const int h, const int mx, const int my, const
int dx, const int dy ) { prep_8tap_scaled_c(tmp, src, src_stride
, w, h, mx, my, dx, dy, DAV1D_FILTER_8TAP_REGULAR | (DAV1D_FILTER_8TAP_SMOOTH
<< 2) ); }
410filter_fns(smooth, DAV1D_FILTER_8TAP_SMOOTH, DAV1D_FILTER_8TAP_SMOOTH)static void put_8tap_smooth_c(pixel *const dst, const ptrdiff_t
dst_stride, const pixel *const src, const ptrdiff_t src_stride
, const int w, const int h, const int mx, const int my ) { put_8tap_c
(dst, dst_stride, src, src_stride, w, h, mx, my, DAV1D_FILTER_8TAP_SMOOTH
| (DAV1D_FILTER_8TAP_SMOOTH << 2) ); } static void put_8tap_smooth_scaled_c
(pixel *const dst, const ptrdiff_t dst_stride, const pixel *const
src, const ptrdiff_t src_stride, const int w, const int h, const
int mx, const int my, const int dx, const int dy ) { put_8tap_scaled_c
(dst, dst_stride, src, src_stride, w, h, mx, my, dx, dy, DAV1D_FILTER_8TAP_SMOOTH
| (DAV1D_FILTER_8TAP_SMOOTH << 2) ); } static void prep_8tap_smooth_c
(int16_t *const tmp, const pixel *const src, const ptrdiff_t src_stride
, const int w, const int h, const int mx, const int my ) { prep_8tap_c
(tmp, src, src_stride, w, h, mx, my, DAV1D_FILTER_8TAP_SMOOTH
| (DAV1D_FILTER_8TAP_SMOOTH << 2) ); } static void prep_8tap_smooth_scaled_c
(int16_t *const tmp, const pixel *const src, const ptrdiff_t src_stride
, const int w, const int h, const int mx, const int my, const
int dx, const int dy ) { prep_8tap_scaled_c(tmp, src, src_stride
, w, h, mx, my, dx, dy, DAV1D_FILTER_8TAP_SMOOTH | (DAV1D_FILTER_8TAP_SMOOTH
<< 2) ); }
411filter_fns(smooth_regular, DAV1D_FILTER_8TAP_SMOOTH, DAV1D_FILTER_8TAP_REGULAR)static void put_8tap_smooth_regular_c(pixel *const dst, const
ptrdiff_t dst_stride, const pixel *const src, const ptrdiff_t
src_stride, const int w, const int h, const int mx, const int
my ) { put_8tap_c(dst, dst_stride, src, src_stride, w, h, mx
, my, DAV1D_FILTER_8TAP_SMOOTH | (DAV1D_FILTER_8TAP_REGULAR <<
2) ); } static void put_8tap_smooth_regular_scaled_c(pixel *
const dst, const ptrdiff_t dst_stride, const pixel *const src
, const ptrdiff_t src_stride, const int w, const int h, const
int mx, const int my, const int dx, const int dy ) { put_8tap_scaled_c
(dst, dst_stride, src, src_stride, w, h, mx, my, dx, dy, DAV1D_FILTER_8TAP_SMOOTH
| (DAV1D_FILTER_8TAP_REGULAR << 2) ); } static void prep_8tap_smooth_regular_c
(int16_t *const tmp, const pixel *const src, const ptrdiff_t src_stride
, const int w, const int h, const int mx, const int my ) { prep_8tap_c
(tmp, src, src_stride, w, h, mx, my, DAV1D_FILTER_8TAP_SMOOTH
| (DAV1D_FILTER_8TAP_REGULAR << 2) ); } static void prep_8tap_smooth_regular_scaled_c
(int16_t *const tmp, const pixel *const src, const ptrdiff_t src_stride
, const int w, const int h, const int mx, const int my, const
int dx, const int dy ) { prep_8tap_scaled_c(tmp, src, src_stride
, w, h, mx, my, dx, dy, DAV1D_FILTER_8TAP_SMOOTH | (DAV1D_FILTER_8TAP_REGULAR
<< 2) ); }
412filter_fns(smooth_sharp, DAV1D_FILTER_8TAP_SMOOTH, DAV1D_FILTER_8TAP_SHARP)static void put_8tap_smooth_sharp_c(pixel *const dst, const ptrdiff_t
dst_stride, const pixel *const src, const ptrdiff_t src_stride
, const int w, const int h, const int mx, const int my ) { put_8tap_c
(dst, dst_stride, src, src_stride, w, h, mx, my, DAV1D_FILTER_8TAP_SMOOTH
| (DAV1D_FILTER_8TAP_SHARP << 2) ); } static void put_8tap_smooth_sharp_scaled_c
(pixel *const dst, const ptrdiff_t dst_stride, const pixel *const
src, const ptrdiff_t src_stride, const int w, const int h, const
int mx, const int my, const int dx, const int dy ) { put_8tap_scaled_c
(dst, dst_stride, src, src_stride, w, h, mx, my, dx, dy, DAV1D_FILTER_8TAP_SMOOTH
| (DAV1D_FILTER_8TAP_SHARP << 2) ); } static void prep_8tap_smooth_sharp_c
(int16_t *const tmp, const pixel *const src, const ptrdiff_t src_stride
, const int w, const int h, const int mx, const int my ) { prep_8tap_c
(tmp, src, src_stride, w, h, mx, my, DAV1D_FILTER_8TAP_SMOOTH
| (DAV1D_FILTER_8TAP_SHARP << 2) ); } static void prep_8tap_smooth_sharp_scaled_c
(int16_t *const tmp, const pixel *const src, const ptrdiff_t src_stride
, const int w, const int h, const int mx, const int my, const
int dx, const int dy ) { prep_8tap_scaled_c(tmp, src, src_stride
, w, h, mx, my, dx, dy, DAV1D_FILTER_8TAP_SMOOTH | (DAV1D_FILTER_8TAP_SHARP
<< 2) ); }
413filter_fns(sharp, DAV1D_FILTER_8TAP_SHARP, DAV1D_FILTER_8TAP_SHARP)static void put_8tap_sharp_c(pixel *const dst, const ptrdiff_t
dst_stride, const pixel *const src, const ptrdiff_t src_stride
, const int w, const int h, const int mx, const int my ) { put_8tap_c
(dst, dst_stride, src, src_stride, w, h, mx, my, DAV1D_FILTER_8TAP_SHARP
| (DAV1D_FILTER_8TAP_SHARP << 2) ); } static void put_8tap_sharp_scaled_c
(pixel *const dst, const ptrdiff_t dst_stride, const pixel *const
src, const ptrdiff_t src_stride, const int w, const int h, const
int mx, const int my, const int dx, const int dy ) { put_8tap_scaled_c
(dst, dst_stride, src, src_stride, w, h, mx, my, dx, dy, DAV1D_FILTER_8TAP_SHARP
| (DAV1D_FILTER_8TAP_SHARP << 2) ); } static void prep_8tap_sharp_c
(int16_t *const tmp, const pixel *const src, const ptrdiff_t src_stride
, const int w, const int h, const int mx, const int my ) { prep_8tap_c
(tmp, src, src_stride, w, h, mx, my, DAV1D_FILTER_8TAP_SHARP |
(DAV1D_FILTER_8TAP_SHARP << 2) ); } static void prep_8tap_sharp_scaled_c
(int16_t *const tmp, const pixel *const src, const ptrdiff_t src_stride
, const int w, const int h, const int mx, const int my, const
int dx, const int dy ) { prep_8tap_scaled_c(tmp, src, src_stride
, w, h, mx, my, dx, dy, DAV1D_FILTER_8TAP_SHARP | (DAV1D_FILTER_8TAP_SHARP
<< 2) ); }
414filter_fns(sharp_regular, DAV1D_FILTER_8TAP_SHARP, DAV1D_FILTER_8TAP_REGULAR)static void put_8tap_sharp_regular_c(pixel *const dst, const ptrdiff_t
dst_stride, const pixel *const src, const ptrdiff_t src_stride
, const int w, const int h, const int mx, const int my ) { put_8tap_c
(dst, dst_stride, src, src_stride, w, h, mx, my, DAV1D_FILTER_8TAP_SHARP
| (DAV1D_FILTER_8TAP_REGULAR << 2) ); } static void put_8tap_sharp_regular_scaled_c
(pixel *const dst, const ptrdiff_t dst_stride, const pixel *const
src, const ptrdiff_t src_stride, const int w, const int h, const
int mx, const int my, const int dx, const int dy ) { put_8tap_scaled_c
(dst, dst_stride, src, src_stride, w, h, mx, my, dx, dy, DAV1D_FILTER_8TAP_SHARP
| (DAV1D_FILTER_8TAP_REGULAR << 2) ); } static void prep_8tap_sharp_regular_c
(int16_t *const tmp, const pixel *const src, const ptrdiff_t src_stride
, const int w, const int h, const int mx, const int my ) { prep_8tap_c
(tmp, src, src_stride, w, h, mx, my, DAV1D_FILTER_8TAP_SHARP |
(DAV1D_FILTER_8TAP_REGULAR << 2) ); } static void prep_8tap_sharp_regular_scaled_c
(int16_t *const tmp, const pixel *const src, const ptrdiff_t src_stride
, const int w, const int h, const int mx, const int my, const
int dx, const int dy ) { prep_8tap_scaled_c(tmp, src, src_stride
, w, h, mx, my, dx, dy, DAV1D_FILTER_8TAP_SHARP | (DAV1D_FILTER_8TAP_REGULAR
<< 2) ); }
415filter_fns(sharp_smooth, DAV1D_FILTER_8TAP_SHARP, DAV1D_FILTER_8TAP_SMOOTH)static void put_8tap_sharp_smooth_c(pixel *const dst, const ptrdiff_t
dst_stride, const pixel *const src, const ptrdiff_t src_stride
, const int w, const int h, const int mx, const int my ) { put_8tap_c
(dst, dst_stride, src, src_stride, w, h, mx, my, DAV1D_FILTER_8TAP_SHARP
| (DAV1D_FILTER_8TAP_SMOOTH << 2) ); } static void put_8tap_sharp_smooth_scaled_c
(pixel *const dst, const ptrdiff_t dst_stride, const pixel *const
src, const ptrdiff_t src_stride, const int w, const int h, const
int mx, const int my, const int dx, const int dy ) { put_8tap_scaled_c
(dst, dst_stride, src, src_stride, w, h, mx, my, dx, dy, DAV1D_FILTER_8TAP_SHARP
| (DAV1D_FILTER_8TAP_SMOOTH << 2) ); } static void prep_8tap_sharp_smooth_c
(int16_t *const tmp, const pixel *const src, const ptrdiff_t src_stride
, const int w, const int h, const int mx, const int my ) { prep_8tap_c
(tmp, src, src_stride, w, h, mx, my, DAV1D_FILTER_8TAP_SHARP |
(DAV1D_FILTER_8TAP_SMOOTH << 2) ); } static void prep_8tap_sharp_smooth_scaled_c
(int16_t *const tmp, const pixel *const src, const ptrdiff_t src_stride
, const int w, const int h, const int mx, const int my, const
int dx, const int dy ) { prep_8tap_scaled_c(tmp, src, src_stride
, w, h, mx, my, dx, dy, DAV1D_FILTER_8TAP_SHARP | (DAV1D_FILTER_8TAP_SMOOTH
<< 2) ); }
1
Calling 'prep_8tap_c'
416
417#define FILTER_BILIN(src, x, mxy, stride)(16 * src[x] + ((mxy) * (src[x + stride] - src[x]))) \
418 (16 * src[x] + ((mxy) * (src[x + stride] - src[x])))
419
420#define FILTER_BILIN_RND(src, x, mxy, stride, sh)(((16 * src[x] + ((mxy) * (src[x + stride] - src[x]))) + ((1 <<
(sh)) >> 1)) >> (sh))
\
421 ((FILTER_BILIN(src, x, mxy, stride)(16 * src[x] + ((mxy) * (src[x + stride] - src[x]))) + ((1 << (sh)) >> 1)) >> (sh))
422
423#define FILTER_BILIN_CLIP(src, x, mxy, stride, sh)iclip_u8((((16 * src[x] + ((mxy) * (src[x + stride] - src[x])
)) + ((1 << (sh)) >> 1)) >> (sh)))
\
424 iclip_pixeliclip_u8(FILTER_BILIN_RND(src, x, mxy, stride, sh)(((16 * src[x] + ((mxy) * (src[x + stride] - src[x]))) + ((1 <<
(sh)) >> 1)) >> (sh))
)
425
426#define FILTER_BILIN2(src1, src2, x, mxy)(16 * src1[x] + ((mxy) * (src2[x] - src1[x]))) \
427 (16 * src1[x] + ((mxy) * (src2[x] - src1[x])))
428
429#define FILTER_BILIN_RND2(src1, src2, x, mxy, sh)(((16 * src1[x] + ((mxy) * (src2[x] - src1[x]))) + ((1 <<
(sh)) >> 1)) >> (sh))
\
430 ((FILTER_BILIN2(src1, src2, x, mxy)(16 * src1[x] + ((mxy) * (src2[x] - src1[x]))) + ((1 << (sh)) >> 1)) >> (sh))
431
432#define FILTER_BILIN_CLIP2(src1, src2, x, mxy, sh)iclip_u8((((16 * src1[x] + ((mxy) * (src2[x] - src1[x]))) + (
(1 << (sh)) >> 1)) >> (sh)))
\
433 iclip_pixeliclip_u8(FILTER_BILIN_RND2(src1, src2, x, mxy, sh)(((16 * src1[x] + ((mxy) * (src2[x] - src1[x]))) + ((1 <<
(sh)) >> 1)) >> (sh))
)
434
435static void put_bilin_c(pixel *dst, ptrdiff_t dst_stride,
436 const pixel *src, ptrdiff_t src_stride,
437 const int w, int h, const int mx, const int my
438 HIGHBD_DECL_SUFFIX)
439{
440 const int intermediate_bits = get_intermediate_bits(bitdepth_max)4;
441 const int intermediate_rnd = (1 << intermediate_bits) >> 1;
442 dst_stride = PXSTRIDE(dst_stride)(dst_stride);
443 src_stride = PXSTRIDE(src_stride)(src_stride);
444
445 if (mx) {
446 if (my) {
447 int16_t mid[128 * 129], *mid_ptr = mid;
448 int tmp_h = h + 1;
449
450 do {
451 for (int x = 0; x < w; x++)
452 mid_ptr[x] = FILTER_BILIN_RND(src, x, mx, 1,(((16 * src[x] + ((mx) * (src[x + 1] - src[x]))) + ((1 <<
(4 - intermediate_bits)) >> 1)) >> (4 - intermediate_bits
))
453 4 - intermediate_bits)(((16 * src[x] + ((mx) * (src[x + 1] - src[x]))) + ((1 <<
(4 - intermediate_bits)) >> 1)) >> (4 - intermediate_bits
))
;
454
455 mid_ptr += 128;
456 src += src_stride;
457 } while (--tmp_h);
458
459 mid_ptr = mid;
460 do {
461 for (int x = 0; x < w; x++)
462 dst[x] = FILTER_BILIN_CLIP(mid_ptr, x, my, 128,iclip_u8((((16 * mid_ptr[x] + ((my) * (mid_ptr[x + 128] - mid_ptr
[x]))) + ((1 << (4 + intermediate_bits)) >> 1)) >>
(4 + intermediate_bits)))
463 4 + intermediate_bits)iclip_u8((((16 * mid_ptr[x] + ((my) * (mid_ptr[x + 128] - mid_ptr
[x]))) + ((1 << (4 + intermediate_bits)) >> 1)) >>
(4 + intermediate_bits)))
;
464
465 mid_ptr += 128;
466 dst += dst_stride;
467 } while (--h);
468 } else {
469 do {
470 for (int x = 0; x < w; x++) {
471 const int px = FILTER_BILIN_RND(src, x, mx, 1,(((16 * src[x] + ((mx) * (src[x + 1] - src[x]))) + ((1 <<
(4 - intermediate_bits)) >> 1)) >> (4 - intermediate_bits
))
472 4 - intermediate_bits)(((16 * src[x] + ((mx) * (src[x + 1] - src[x]))) + ((1 <<
(4 - intermediate_bits)) >> 1)) >> (4 - intermediate_bits
))
;
473 dst[x] = iclip_pixeliclip_u8((px + intermediate_rnd) >> intermediate_bits);
474 }
475
476 dst += dst_stride;
477 src += src_stride;
478 } while (--h);
479 }
480 } else if (my) {
481 do {
482 for (int x = 0; x < w; x++)
483 dst[x] = FILTER_BILIN_CLIP(src, x, my, src_stride, 4)iclip_u8((((16 * src[x] + ((my) * (src[x + src_stride] - src[
x]))) + ((1 << (4)) >> 1)) >> (4)))
;
484
485 dst += dst_stride;
486 src += src_stride;
487 } while (--h);
488 } else
489 put_c(dst, dst_stride, src, src_stride, w, h);
490}
491
492static void put_bilin_scaled_c(pixel *dst, ptrdiff_t dst_stride,
493 const pixel *src, ptrdiff_t src_stride,
494 const int w, int h, const int mx, int my,
495 const int dx, const int dy
496 HIGHBD_DECL_SUFFIX)
497{
498 const int intermediate_bits = get_intermediate_bits(bitdepth_max)4;
499 int16_t mid[128 * 2];
500 int in_y = -2;
501
502 do {
503 int x;
504 int y = my >> 10;
505 int16_t *mid1 = &mid[(y & 1) * 128];
506 int16_t *mid2 = &mid[((y + 1) & 1) * 128];
507 int dmy = my & 0x3ff;
508
509 while (in_y < y) {
510 int imx = mx, ioff = 0;
511 int16_t *mid_ptr = &mid[(in_y & 1) * 128];
512
513 for (x = 0; x < w; x++) {
514 mid_ptr[x] = FILTER_BILIN_RND(src, ioff, imx >> 6, 1,(((16 * src[ioff] + ((imx >> 6) * (src[ioff + 1] - src[
ioff]))) + ((1 << (4 - intermediate_bits)) >> 1))
>> (4 - intermediate_bits))
515 4 - intermediate_bits)(((16 * src[ioff] + ((imx >> 6) * (src[ioff + 1] - src[
ioff]))) + ((1 << (4 - intermediate_bits)) >> 1))
>> (4 - intermediate_bits))
;
516 imx += dx;
517 ioff += imx >> 10;
518 imx &= 0x3ff;
519 }
520
521 src += PXSTRIDE(src_stride)(src_stride);
522 in_y++;
523 }
524
525 for (x = 0; x < w; x++)
526 dst[x] = FILTER_BILIN_CLIP2(mid1, mid2, x, dmy >> 6,iclip_u8((((16 * mid1[x] + ((dmy >> 6) * (mid2[x] - mid1
[x]))) + ((1 << (4 + intermediate_bits)) >> 1)) >>
(4 + intermediate_bits)))
527 4 + intermediate_bits)iclip_u8((((16 * mid1[x] + ((dmy >> 6) * (mid2[x] - mid1
[x]))) + ((1 << (4 + intermediate_bits)) >> 1)) >>
(4 + intermediate_bits)))
;
528
529 my += dy;
530 dst += PXSTRIDE(dst_stride)(dst_stride);
531 } while (--h);
532}
533
534static void prep_bilin_c(int16_t *tmp,
535 const pixel *src, ptrdiff_t src_stride,
536 const int w, int h, const int mx, const int my
537 HIGHBD_DECL_SUFFIX)
538{
539 const int intermediate_bits = get_intermediate_bits(bitdepth_max)4;
540 src_stride = PXSTRIDE(src_stride)(src_stride);
541
542 if (mx) {
543 if (my) {
544 int16_t mid[128 * 129], *mid_ptr = mid;
545 int tmp_h = h + 1;
546
547 do {
548 for (int x = 0; x < w; x++)
549 mid_ptr[x] = FILTER_BILIN_RND(src, x, mx, 1,(((16 * src[x] + ((mx) * (src[x + 1] - src[x]))) + ((1 <<
(4 - intermediate_bits)) >> 1)) >> (4 - intermediate_bits
))
550 4 - intermediate_bits)(((16 * src[x] + ((mx) * (src[x + 1] - src[x]))) + ((1 <<
(4 - intermediate_bits)) >> 1)) >> (4 - intermediate_bits
))
;
551
552 mid_ptr += 128;
553 src += src_stride;
554 } while (--tmp_h);
555
556 mid_ptr = mid;
557 do {
558 for (int x = 0; x < w; x++)
559 tmp[x] = FILTER_BILIN_RND(mid_ptr, x, my, 128, 4)(((16 * mid_ptr[x] + ((my) * (mid_ptr[x + 128] - mid_ptr[x]))
) + ((1 << (4)) >> 1)) >> (4))
-
560 PREP_BIAS0;
561
562 mid_ptr += 128;
563 tmp += w;
564 } while (--h);
565 } else {
566 do {
567 for (int x = 0; x < w; x++)
568 tmp[x] = FILTER_BILIN_RND(src, x, mx, 1,(((16 * src[x] + ((mx) * (src[x + 1] - src[x]))) + ((1 <<
(4 - intermediate_bits)) >> 1)) >> (4 - intermediate_bits
))
569 4 - intermediate_bits)(((16 * src[x] + ((mx) * (src[x + 1] - src[x]))) + ((1 <<
(4 - intermediate_bits)) >> 1)) >> (4 - intermediate_bits
))
-
570 PREP_BIAS0;
571
572 tmp += w;
573 src += src_stride;
574 } while (--h);
575 }
576 } else if (my) {
577 do {
578 for (int x = 0; x < w; x++)
579 tmp[x] = FILTER_BILIN_RND(src, x, my, src_stride,(((16 * src[x] + ((my) * (src[x + src_stride] - src[x]))) + (
(1 << (4 - intermediate_bits)) >> 1)) >> (4
- intermediate_bits))
580 4 - intermediate_bits)(((16 * src[x] + ((my) * (src[x + src_stride] - src[x]))) + (
(1 << (4 - intermediate_bits)) >> 1)) >> (4
- intermediate_bits))
- PREP_BIAS0;
581
582 tmp += w;
583 src += src_stride;
584 } while (--h);
585 } else
586 prep_c(tmp, src, src_stride, w, h HIGHBD_TAIL_SUFFIX);
587}
588
589static void prep_bilin_scaled_c(int16_t *tmp,
590 const pixel *src, ptrdiff_t src_stride,
591 const int w, int h, const int mx, int my,
592 const int dx, const int dy HIGHBD_DECL_SUFFIX)
593{
594 const int intermediate_bits = get_intermediate_bits(bitdepth_max)4;
595 int16_t mid[128 * 2];
596 int in_y = -2;
597
598 do {
599 int x;
600 int y = my >> 10;
601 int16_t *mid1 = &mid[(y & 1) * 128];
602 int16_t *mid2 = &mid[((y + 1) & 1) * 128];
603 int dmy = my & 0x3ff;
604
605 while (in_y < y) {
606 int imx = mx, ioff = 0;
607 int16_t *mid_ptr = &mid[(in_y & 1) * 128];
608
609 for (x = 0; x < w; x++) {
610 mid_ptr[x] = FILTER_BILIN_RND(src, ioff, imx >> 6, 1,(((16 * src[ioff] + ((imx >> 6) * (src[ioff + 1] - src[
ioff]))) + ((1 << (4 - intermediate_bits)) >> 1))
>> (4 - intermediate_bits))
611 4 - intermediate_bits)(((16 * src[ioff] + ((imx >> 6) * (src[ioff + 1] - src[
ioff]))) + ((1 << (4 - intermediate_bits)) >> 1))
>> (4 - intermediate_bits))
;
612 imx += dx;
613 ioff += imx >> 10;
614 imx &= 0x3ff;
615 }
616
617 src += PXSTRIDE(src_stride)(src_stride);
618 in_y++;
619 }
620
621 for (x = 0; x < w; x++)
622 tmp[x] = FILTER_BILIN_RND2(mid1, mid2, x, dmy >> 6, 4)(((16 * mid1[x] + ((dmy >> 6) * (mid2[x] - mid1[x]))) +
((1 << (4)) >> 1)) >> (4))
- PREP_BIAS0;
623
624 my += dy;
625 tmp += w;
626 } while (--h);
627}
628
629static void avg_c(pixel *dst, const ptrdiff_t dst_stride,
630 const int16_t *tmp1, const int16_t *tmp2, const int w, int h
631 HIGHBD_DECL_SUFFIX)
632{
633 const int intermediate_bits = get_intermediate_bits(bitdepth_max)4;
634 const int sh = intermediate_bits + 1;
635 const int rnd = (1 << intermediate_bits) + PREP_BIAS0 * 2;
636 do {
637 for (int x = 0; x < w; x++)
638 dst[x] = iclip_pixeliclip_u8((tmp1[x] + tmp2[x] + rnd) >> sh);
639
640 tmp1 += w;
641 tmp2 += w;
642 dst += PXSTRIDE(dst_stride)(dst_stride);
643 } while (--h);
644}
645
646static void w_avg_c(pixel *dst, const ptrdiff_t dst_stride,
647 const int16_t *tmp1, const int16_t *tmp2, const int w, int h,
648 const int weight HIGHBD_DECL_SUFFIX)
649{
650 const int intermediate_bits = get_intermediate_bits(bitdepth_max)4;
651 const int sh = intermediate_bits + 4;
652 const int rnd = (8 << intermediate_bits) + PREP_BIAS0 * 16;
653 do {
654 for (int x = 0; x < w; x++)
655 dst[x] = iclip_pixeliclip_u8((tmp1[x] * weight +
656 tmp2[x] * (16 - weight) + rnd) >> sh);
657
658 tmp1 += w;
659 tmp2 += w;
660 dst += PXSTRIDE(dst_stride)(dst_stride);
661 } while (--h);
662}
663
664static void mask_c(pixel *dst, const ptrdiff_t dst_stride,
665 const int16_t *tmp1, const int16_t *tmp2, const int w, int h,
666 const uint8_t *mask HIGHBD_DECL_SUFFIX)
667{
668 const int intermediate_bits = get_intermediate_bits(bitdepth_max)4;
669 const int sh = intermediate_bits + 6;
670 const int rnd = (32 << intermediate_bits) + PREP_BIAS0 * 64;
671 do {
672 for (int x = 0; x < w; x++)
673 dst[x] = iclip_pixeliclip_u8((tmp1[x] * mask[x] +
674 tmp2[x] * (64 - mask[x]) + rnd) >> sh);
675
676 tmp1 += w;
677 tmp2 += w;
678 mask += w;
679 dst += PXSTRIDE(dst_stride)(dst_stride);
680 } while (--h);
681}
682
683#define blend_px(a, b, m)(((a * (64 - m) + b * m) + 32) >> 6) (((a * (64 - m) + b * m) + 32) >> 6)
684static void blend_c(pixel *dst, const ptrdiff_t dst_stride, const pixel *tmp,
685 const int w, int h, const uint8_t *mask)
686{
687 do {
688 for (int x = 0; x < w; x++) {
689 dst[x] = blend_px(dst[x], tmp[x], mask[x])(((dst[x] * (64 - mask[x]) + tmp[x] * mask[x]) + 32) >>
6)
;
690 }
691 dst += PXSTRIDE(dst_stride)(dst_stride);
692 tmp += w;
693 mask += w;
694 } while (--h);
695}
696
697static void blend_v_c(pixel *dst, const ptrdiff_t dst_stride, const pixel *tmp,
698 const int w, int h)
699{
700 const uint8_t *const mask = &dav1d_obmc_masks[w];
701 do {
702 for (int x = 0; x < (w * 3) >> 2; x++) {
703 dst[x] = blend_px(dst[x], tmp[x], mask[x])(((dst[x] * (64 - mask[x]) + tmp[x] * mask[x]) + 32) >>
6)
;
704 }
705 dst += PXSTRIDE(dst_stride)(dst_stride);
706 tmp += w;
707 } while (--h);
708}
709
710static void blend_h_c(pixel *dst, const ptrdiff_t dst_stride, const pixel *tmp,
711 const int w, int h)
712{
713 const uint8_t *mask = &dav1d_obmc_masks[h];
714 h = (h * 3) >> 2;
715 do {
716 const int m = *mask++;
717 for (int x = 0; x < w; x++) {
718 dst[x] = blend_px(dst[x], tmp[x], m)(((dst[x] * (64 - m) + tmp[x] * m) + 32) >> 6);
719 }
720 dst += PXSTRIDE(dst_stride)(dst_stride);
721 tmp += w;
722 } while (--h);
723}
724
725static void w_mask_c(pixel *dst, const ptrdiff_t dst_stride,
726 const int16_t *tmp1, const int16_t *tmp2, const int w, int h,
727 uint8_t *mask, const int sign,
728 const int ss_hor, const int ss_ver HIGHBD_DECL_SUFFIX)
729{
730 // store mask at 2x2 resolution, i.e. store 2x1 sum for even rows,
731 // and then load this intermediate to calculate final value for odd rows
732 const int intermediate_bits = get_intermediate_bits(bitdepth_max)4;
733 const int bitdepth = bitdepth_from_max(bitdepth_max)8;
734 const int sh = intermediate_bits + 6;
735 const int rnd = (32 << intermediate_bits) + PREP_BIAS0 * 64;
736 const int mask_sh = bitdepth + intermediate_bits - 4;
737 const int mask_rnd = 1 << (mask_sh - 5);
738 do {
739 for (int x = 0; x < w; x++) {
740 const int tmpdiff = tmp1[x] - tmp2[x];
741 const int m = imin(38 + ((abs(tmpdiff) + mask_rnd) >> mask_sh), 64);
742 dst[x] = iclip_pixeliclip_u8((tmpdiff * m + tmp2[x] * 64 + rnd) >> sh);
743
744 if (ss_hor) {
745 x++;
746
747 const int tmpdiff = tmp1[x] - tmp2[x];
748 const int n = imin(38 + ((abs(tmpdiff) + mask_rnd) >> mask_sh), 64);
749 dst[x] = iclip_pixeliclip_u8((tmpdiff * n + tmp2[x] * 64 + rnd) >> sh);
750
751 if (h & ss_ver) {
752 mask[x >> 1] = (m + n + mask[x >> 1] + 2 - sign) >> 2;
753 } else if (ss_ver) {
754 mask[x >> 1] = m + n;
755 } else {
756 mask[x >> 1] = (m + n + 1 - sign) >> 1;
757 }
758 } else {
759 mask[x] = m;
760 }
761 }
762
763 tmp1 += w;
764 tmp2 += w;
765 dst += PXSTRIDE(dst_stride)(dst_stride);
766 if (!ss_ver || (h & 1)) mask += w >> ss_hor;
767 } while (--h);
768}
769
770#define w_mask_fns(ssn, ss_hor, ss_ver) \
771static void w_mask_##ssn##_c(pixel *const dst, const ptrdiff_t dst_stride, \
772 const int16_t *const tmp1, const int16_t *const tmp2, \
773 const int w, const int h, uint8_t *mask, \
774 const int sign HIGHBD_DECL_SUFFIX) \
775{ \
776 w_mask_c(dst, dst_stride, tmp1, tmp2, w, h, mask, sign, ss_hor, ss_ver \
777 HIGHBD_TAIL_SUFFIX); \
778}
779
780w_mask_fns(444, 0, 0);
781w_mask_fns(422, 1, 0);
782w_mask_fns(420, 1, 1);
783
784#undef w_mask_fns
785
786#define FILTER_WARP_RND(src, x, F, stride, sh)((F[0] * src[x - 3 * stride] + F[1] * src[x - 2 * stride] + F
[2] * src[x - 1 * stride] + F[3] * src[x + 0 * stride] + F[4]
* src[x + 1 * stride] + F[5] * src[x + 2 * stride] + F[6] * src
[x + 3 * stride] + F[7] * src[x + 4 * stride] + ((1 << (
sh)) >> 1)) >> (sh))
\
787 ((F[0] * src[x - 3 * stride] + \
788 F[1] * src[x - 2 * stride] + \
789 F[2] * src[x - 1 * stride] + \
790 F[3] * src[x + 0 * stride] + \
791 F[4] * src[x + 1 * stride] + \
792 F[5] * src[x + 2 * stride] + \
793 F[6] * src[x + 3 * stride] + \
794 F[7] * src[x + 4 * stride] + \
795 ((1 << (sh)) >> 1)) >> (sh))
796
797#define FILTER_WARP_CLIP(src, x, F, stride, sh)iclip_u8(((F[0] * src[x - 3 * stride] + F[1] * src[x - 2 * stride
] + F[2] * src[x - 1 * stride] + F[3] * src[x + 0 * stride] +
F[4] * src[x + 1 * stride] + F[5] * src[x + 2 * stride] + F[
6] * src[x + 3 * stride] + F[7] * src[x + 4 * stride] + ((1 <<
(sh)) >> 1)) >> (sh)))
\
798 iclip_pixeliclip_u8(FILTER_WARP_RND(src, x, F, stride, sh)((F[0] * src[x - 3 * stride] + F[1] * src[x - 2 * stride] + F
[2] * src[x - 1 * stride] + F[3] * src[x + 0 * stride] + F[4]
* src[x + 1 * stride] + F[5] * src[x + 2 * stride] + F[6] * src
[x + 3 * stride] + F[7] * src[x + 4 * stride] + ((1 << (
sh)) >> 1)) >> (sh))
)
799
800static void warp_affine_8x8_c(pixel *dst, const ptrdiff_t dst_stride,
801 const pixel *src, const ptrdiff_t src_stride,
802 const int16_t *const abcd, int mx, int my
803 HIGHBD_DECL_SUFFIX)
804{
805 const int intermediate_bits = get_intermediate_bits(bitdepth_max)4;
806 int16_t mid[15 * 8], *mid_ptr = mid;
807
808 src -= 3 * PXSTRIDE(src_stride)(src_stride);
809 for (int y = 0; y < 15; y++, mx += abcd[1]) {
810 for (int x = 0, tmx = mx; x < 8; x++, tmx += abcd[0]) {
811 const int8_t *const filter =
812 dav1d_mc_warp_filter[64 + ((tmx + 512) >> 10)];
813
814 mid_ptr[x] = FILTER_WARP_RND(src, x, filter, 1,((filter[0] * src[x - 3 * 1] + filter[1] * src[x - 2 * 1] + filter
[2] * src[x - 1 * 1] + filter[3] * src[x + 0 * 1] + filter[4]
* src[x + 1 * 1] + filter[5] * src[x + 2 * 1] + filter[6] * src
[x + 3 * 1] + filter[7] * src[x + 4 * 1] + ((1 << (7 - intermediate_bits
)) >> 1)) >> (7 - intermediate_bits))
815 7 - intermediate_bits)((filter[0] * src[x - 3 * 1] + filter[1] * src[x - 2 * 1] + filter
[2] * src[x - 1 * 1] + filter[3] * src[x + 0 * 1] + filter[4]
* src[x + 1 * 1] + filter[5] * src[x + 2 * 1] + filter[6] * src
[x + 3 * 1] + filter[7] * src[x + 4 * 1] + ((1 << (7 - intermediate_bits
)) >> 1)) >> (7 - intermediate_bits))
;
816 }
817 src += PXSTRIDE(src_stride)(src_stride);
818 mid_ptr += 8;
819 }
820
821 mid_ptr = &mid[3 * 8];
822 for (int y = 0; y < 8; y++, my += abcd[3]) {
823 for (int x = 0, tmy = my; x < 8; x++, tmy += abcd[2]) {
824 const int8_t *const filter =
825 dav1d_mc_warp_filter[64 + ((tmy + 512) >> 10)];
826
827 dst[x] = FILTER_WARP_CLIP(mid_ptr, x, filter, 8,iclip_u8(((filter[0] * mid_ptr[x - 3 * 8] + filter[1] * mid_ptr
[x - 2 * 8] + filter[2] * mid_ptr[x - 1 * 8] + filter[3] * mid_ptr
[x + 0 * 8] + filter[4] * mid_ptr[x + 1 * 8] + filter[5] * mid_ptr
[x + 2 * 8] + filter[6] * mid_ptr[x + 3 * 8] + filter[7] * mid_ptr
[x + 4 * 8] + ((1 << (7 + intermediate_bits)) >> 1
)) >> (7 + intermediate_bits)))
828 7 + intermediate_bits)iclip_u8(((filter[0] * mid_ptr[x - 3 * 8] + filter[1] * mid_ptr
[x - 2 * 8] + filter[2] * mid_ptr[x - 1 * 8] + filter[3] * mid_ptr
[x + 0 * 8] + filter[4] * mid_ptr[x + 1 * 8] + filter[5] * mid_ptr
[x + 2 * 8] + filter[6] * mid_ptr[x + 3 * 8] + filter[7] * mid_ptr
[x + 4 * 8] + ((1 << (7 + intermediate_bits)) >> 1
)) >> (7 + intermediate_bits)))
;
829 }
830 mid_ptr += 8;
831 dst += PXSTRIDE(dst_stride)(dst_stride);
832 }
833}
834
835static void warp_affine_8x8t_c(int16_t *tmp, const ptrdiff_t tmp_stride,
836 const pixel *src, const ptrdiff_t src_stride,
837 const int16_t *const abcd, int mx, int my
838 HIGHBD_DECL_SUFFIX)
839{
840 const int intermediate_bits = get_intermediate_bits(bitdepth_max)4;
841 int16_t mid[15 * 8], *mid_ptr = mid;
842
843 src -= 3 * PXSTRIDE(src_stride)(src_stride);
844 for (int y = 0; y < 15; y++, mx += abcd[1]) {
845 for (int x = 0, tmx = mx; x < 8; x++, tmx += abcd[0]) {
846 const int8_t *const filter =
847 dav1d_mc_warp_filter[64 + ((tmx + 512) >> 10)];
848
849 mid_ptr[x] = FILTER_WARP_RND(src, x, filter, 1,((filter[0] * src[x - 3 * 1] + filter[1] * src[x - 2 * 1] + filter
[2] * src[x - 1 * 1] + filter[3] * src[x + 0 * 1] + filter[4]
* src[x + 1 * 1] + filter[5] * src[x + 2 * 1] + filter[6] * src
[x + 3 * 1] + filter[7] * src[x + 4 * 1] + ((1 << (7 - intermediate_bits
)) >> 1)) >> (7 - intermediate_bits))
850 7 - intermediate_bits)((filter[0] * src[x - 3 * 1] + filter[1] * src[x - 2 * 1] + filter
[2] * src[x - 1 * 1] + filter[3] * src[x + 0 * 1] + filter[4]
* src[x + 1 * 1] + filter[5] * src[x + 2 * 1] + filter[6] * src
[x + 3 * 1] + filter[7] * src[x + 4 * 1] + ((1 << (7 - intermediate_bits
)) >> 1)) >> (7 - intermediate_bits))
;
851 }
852 src += PXSTRIDE(src_stride)(src_stride);
853 mid_ptr += 8;
854 }
855
856 mid_ptr = &mid[3 * 8];
857 for (int y = 0; y < 8; y++, my += abcd[3]) {
858 for (int x = 0, tmy = my; x < 8; x++, tmy += abcd[2]) {
859 const int8_t *const filter =
860 dav1d_mc_warp_filter[64 + ((tmy + 512) >> 10)];
861
862 tmp[x] = FILTER_WARP_RND(mid_ptr, x, filter, 8, 7)((filter[0] * mid_ptr[x - 3 * 8] + filter[1] * mid_ptr[x - 2 *
8] + filter[2] * mid_ptr[x - 1 * 8] + filter[3] * mid_ptr[x +
0 * 8] + filter[4] * mid_ptr[x + 1 * 8] + filter[5] * mid_ptr
[x + 2 * 8] + filter[6] * mid_ptr[x + 3 * 8] + filter[7] * mid_ptr
[x + 4 * 8] + ((1 << (7)) >> 1)) >> (7))
- PREP_BIAS0;
863 }
864 mid_ptr += 8;
865 tmp += tmp_stride;
866 }
867}
868
869static void emu_edge_c(const intptr_t bw, const intptr_t bh,
870 const intptr_t iw, const intptr_t ih,
871 const intptr_t x, const intptr_t y,
872 pixel *dst, const ptrdiff_t dst_stride,
873 const pixel *ref, const ptrdiff_t ref_stride)
874{
875 // find offset in reference of visible block to copy
876 ref += iclip((int) y, 0, (int) ih - 1) * PXSTRIDE(ref_stride)(ref_stride) +
877 iclip((int) x, 0, (int) iw - 1);
878
879 // number of pixels to extend (left, right, top, bottom)
880 const int left_ext = iclip((int) -x, 0, (int) bw - 1);
881 const int right_ext = iclip((int) (x + bw - iw), 0, (int) bw - 1);
882 assert(left_ext + right_ext < bw)((void) sizeof ((left_ext + right_ext < bw) ? 1 : 0), __extension__
({ if (left_ext + right_ext < bw) ; else __assert_fail ("left_ext + right_ext < bw"
, "8bd_mc_tmpl.c", 882, __extension__ __PRETTY_FUNCTION__); }
))
;
883 const int top_ext = iclip((int) -y, 0, (int) bh - 1);
884 const int bottom_ext = iclip((int) (y + bh - ih), 0, (int) bh - 1);
885 assert(top_ext + bottom_ext < bh)((void) sizeof ((top_ext + bottom_ext < bh) ? 1 : 0), __extension__
({ if (top_ext + bottom_ext < bh) ; else __assert_fail ("top_ext + bottom_ext < bh"
, "8bd_mc_tmpl.c", 885, __extension__ __PRETTY_FUNCTION__); }
))
;
886
887 // copy visible portion first
888 pixel *blk = dst + top_ext * PXSTRIDE(dst_stride)(dst_stride);
889 const int center_w = (int) (bw - left_ext - right_ext);
890 const int center_h = (int) (bh - top_ext - bottom_ext);
891 for (int y = 0; y < center_h; y++) {
892 pixel_copymemcpy(blk + left_ext, ref, center_w);
893 // extend left edge for this line
894 if (left_ext)
895 pixel_setmemset(blk, blk[left_ext], left_ext);
896 // extend right edge for this line
897 if (right_ext)
898 pixel_setmemset(blk + left_ext + center_w, blk[left_ext + center_w - 1],
899 right_ext);
900 ref += PXSTRIDE(ref_stride)(ref_stride);
901 blk += PXSTRIDE(dst_stride)(dst_stride);
902 }
903
904 // copy top
905 blk = dst + top_ext * PXSTRIDE(dst_stride)(dst_stride);
906 for (int y = 0; y < top_ext; y++) {
907 pixel_copymemcpy(dst, blk, bw);
908 dst += PXSTRIDE(dst_stride)(dst_stride);
909 }
910
911 // copy bottom
912 dst += center_h * PXSTRIDE(dst_stride)(dst_stride);
913 for (int y = 0; y < bottom_ext; y++) {
914 pixel_copymemcpy(dst, &dst[-PXSTRIDE(dst_stride)(dst_stride)], bw);
915 dst += PXSTRIDE(dst_stride)(dst_stride);
916 }
917}
918
919static void resize_c(pixel *dst, const ptrdiff_t dst_stride,
920 const pixel *src, const ptrdiff_t src_stride,
921 const int dst_w, int h, const int src_w,
922 const int dx, const int mx0 HIGHBD_DECL_SUFFIX)
923{
924 do {
925 int mx = mx0, src_x = -1;
926 for (int x = 0; x < dst_w; x++) {
927 const int8_t *const F = dav1d_resize_filter[mx >> 8];
928 dst[x] = iclip_pixeliclip_u8((-(F[0] * src[iclip(src_x - 3, 0, src_w - 1)] +
929 F[1] * src[iclip(src_x - 2, 0, src_w - 1)] +
930 F[2] * src[iclip(src_x - 1, 0, src_w - 1)] +
931 F[3] * src[iclip(src_x + 0, 0, src_w - 1)] +
932 F[4] * src[iclip(src_x + 1, 0, src_w - 1)] +
933 F[5] * src[iclip(src_x + 2, 0, src_w - 1)] +
934 F[6] * src[iclip(src_x + 3, 0, src_w - 1)] +
935 F[7] * src[iclip(src_x + 4, 0, src_w - 1)]) +
936 64) >> 7);
937 mx += dx;
938 src_x += mx >> 14;
939 mx &= 0x3fff;
940 }
941
942 dst += PXSTRIDE(dst_stride)(dst_stride);
943 src += PXSTRIDE(src_stride)(src_stride);
944 } while (--h);
945}
946
947#if HAVE_ASM1
948#if ARCH_AARCH640 || ARCH_ARM0
949#include "src/arm/mc.h"
950#elif ARCH_LOONGARCH64
951#include "src/loongarch/mc.h"
952#elif ARCH_PPC64LE
953#include "src/ppc/mc.h"
954#elif ARCH_RISCV
955#include "src/riscv/mc.h"
956#elif ARCH_X861
957#include "src/x86/mc.h"
958#endif
959#endif
960
961COLD__attribute__((cold)) void bitfn(dav1d_mc_dsp_init)dav1d_mc_dsp_init_8bpc(Dav1dMCDSPContext *const c) {
962#define init_mc_fns(type, name)do { c->mc [type] = put_name_c; c->mc_scaled [type] = put_name_scaled_c
; c->mct [type] = prep_name_c; c->mct_scaled[type] = prep_name_scaled_c
; } while (0)
do { \
963 c->mc [type] = put_##name##_c; \
964 c->mc_scaled [type] = put_##name##_scaled_c; \
965 c->mct [type] = prep_##name##_c; \
966 c->mct_scaled[type] = prep_##name##_scaled_c; \
967} while (0)
968
969 init_mc_fns(FILTER_2D_8TAP_REGULAR, 8tap_regular)do { c->mc [FILTER_2D_8TAP_REGULAR] = put_8tap_regular_c; c
->mc_scaled [FILTER_2D_8TAP_REGULAR] = put_8tap_regular_scaled_c
; c->mct [FILTER_2D_8TAP_REGULAR] = prep_8tap_regular_c; c
->mct_scaled[FILTER_2D_8TAP_REGULAR] = prep_8tap_regular_scaled_c
; } while (0)
;
970 init_mc_fns(FILTER_2D_8TAP_REGULAR_SMOOTH, 8tap_regular_smooth)do { c->mc [FILTER_2D_8TAP_REGULAR_SMOOTH] = put_8tap_regular_smooth_c
; c->mc_scaled [FILTER_2D_8TAP_REGULAR_SMOOTH] = put_8tap_regular_smooth_scaled_c
; c->mct [FILTER_2D_8TAP_REGULAR_SMOOTH] = prep_8tap_regular_smooth_c
; c->mct_scaled[FILTER_2D_8TAP_REGULAR_SMOOTH] = prep_8tap_regular_smooth_scaled_c
; } while (0)
;
971 init_mc_fns(FILTER_2D_8TAP_REGULAR_SHARP, 8tap_regular_sharp)do { c->mc [FILTER_2D_8TAP_REGULAR_SHARP] = put_8tap_regular_sharp_c
; c->mc_scaled [FILTER_2D_8TAP_REGULAR_SHARP] = put_8tap_regular_sharp_scaled_c
; c->mct [FILTER_2D_8TAP_REGULAR_SHARP] = prep_8tap_regular_sharp_c
; c->mct_scaled[FILTER_2D_8TAP_REGULAR_SHARP] = prep_8tap_regular_sharp_scaled_c
; } while (0)
;
972 init_mc_fns(FILTER_2D_8TAP_SHARP_REGULAR, 8tap_sharp_regular)do { c->mc [FILTER_2D_8TAP_SHARP_REGULAR] = put_8tap_sharp_regular_c
; c->mc_scaled [FILTER_2D_8TAP_SHARP_REGULAR] = put_8tap_sharp_regular_scaled_c
; c->mct [FILTER_2D_8TAP_SHARP_REGULAR] = prep_8tap_sharp_regular_c
; c->mct_scaled[FILTER_2D_8TAP_SHARP_REGULAR] = prep_8tap_sharp_regular_scaled_c
; } while (0)
;
973 init_mc_fns(FILTER_2D_8TAP_SHARP_SMOOTH, 8tap_sharp_smooth)do { c->mc [FILTER_2D_8TAP_SHARP_SMOOTH] = put_8tap_sharp_smooth_c
; c->mc_scaled [FILTER_2D_8TAP_SHARP_SMOOTH] = put_8tap_sharp_smooth_scaled_c
; c->mct [FILTER_2D_8TAP_SHARP_SMOOTH] = prep_8tap_sharp_smooth_c
; c->mct_scaled[FILTER_2D_8TAP_SHARP_SMOOTH] = prep_8tap_sharp_smooth_scaled_c
; } while (0)
;
974 init_mc_fns(FILTER_2D_8TAP_SHARP, 8tap_sharp)do { c->mc [FILTER_2D_8TAP_SHARP] = put_8tap_sharp_c; c->
mc_scaled [FILTER_2D_8TAP_SHARP] = put_8tap_sharp_scaled_c; c
->mct [FILTER_2D_8TAP_SHARP] = prep_8tap_sharp_c; c->mct_scaled
[FILTER_2D_8TAP_SHARP] = prep_8tap_sharp_scaled_c; } while (0
)
;
975 init_mc_fns(FILTER_2D_8TAP_SMOOTH_REGULAR, 8tap_smooth_regular)do { c->mc [FILTER_2D_8TAP_SMOOTH_REGULAR] = put_8tap_smooth_regular_c
; c->mc_scaled [FILTER_2D_8TAP_SMOOTH_REGULAR] = put_8tap_smooth_regular_scaled_c
; c->mct [FILTER_2D_8TAP_SMOOTH_REGULAR] = prep_8tap_smooth_regular_c
; c->mct_scaled[FILTER_2D_8TAP_SMOOTH_REGULAR] = prep_8tap_smooth_regular_scaled_c
; } while (0)
;
976 init_mc_fns(FILTER_2D_8TAP_SMOOTH, 8tap_smooth)do { c->mc [FILTER_2D_8TAP_SMOOTH] = put_8tap_smooth_c; c->
mc_scaled [FILTER_2D_8TAP_SMOOTH] = put_8tap_smooth_scaled_c;
c->mct [FILTER_2D_8TAP_SMOOTH] = prep_8tap_smooth_c; c->
mct_scaled[FILTER_2D_8TAP_SMOOTH] = prep_8tap_smooth_scaled_c
; } while (0)
;
977 init_mc_fns(FILTER_2D_8TAP_SMOOTH_SHARP, 8tap_smooth_sharp)do { c->mc [FILTER_2D_8TAP_SMOOTH_SHARP] = put_8tap_smooth_sharp_c
; c->mc_scaled [FILTER_2D_8TAP_SMOOTH_SHARP] = put_8tap_smooth_sharp_scaled_c
; c->mct [FILTER_2D_8TAP_SMOOTH_SHARP] = prep_8tap_smooth_sharp_c
; c->mct_scaled[FILTER_2D_8TAP_SMOOTH_SHARP] = prep_8tap_smooth_sharp_scaled_c
; } while (0)
;
978 init_mc_fns(FILTER_2D_BILINEAR, bilin)do { c->mc [FILTER_2D_BILINEAR] = put_bilin_c; c->mc_scaled
[FILTER_2D_BILINEAR] = put_bilin_scaled_c; c->mct [FILTER_2D_BILINEAR
] = prep_bilin_c; c->mct_scaled[FILTER_2D_BILINEAR] = prep_bilin_scaled_c
; } while (0)
;
979
980 c->avg = avg_c;
981 c->w_avg = w_avg_c;
982 c->mask = mask_c;
983 c->blend = blend_c;
984 c->blend_v = blend_v_c;
985 c->blend_h = blend_h_c;
986 c->w_mask[0] = w_mask_444_c;
987 c->w_mask[1] = w_mask_422_c;
988 c->w_mask[2] = w_mask_420_c;
989 c->warp8x8 = warp_affine_8x8_c;
990 c->warp8x8t = warp_affine_8x8t_c;
991 c->emu_edge = emu_edge_c;
992 c->resize = resize_c;
993
994#if HAVE_ASM1
995#if ARCH_AARCH640 || ARCH_ARM0
996 mc_dsp_init_arm(c);
997#elif ARCH_LOONGARCH64
998 mc_dsp_init_loongarch(c);
999#elif ARCH_PPC64LE
1000 mc_dsp_init_ppc(c);
1001#elif ARCH_RISCV
1002 mc_dsp_init_riscv(c);
1003#elif ARCH_X861
1004 mc_dsp_init_x86(c);
1005#endif
1006#endif
1007}