Bug Summary

File:root/firefox-clang/media/ffvpx/libavcodec/vp8dsp.c
Warning:line 575, column 1
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 vp8dsp.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/ffvpx/libavcodec -fcoverage-compilation-dir=/root/firefox-clang/obj-x86_64-pc-linux-gnu/media/ffvpx/libavcodec -resource-dir /usr/lib/llvm-23/lib/clang/23 -include /root/firefox-clang/obj-x86_64-pc-linux-gnu/mozilla-config.h -include libavutil_visibility.h -U _FORTIFY_SOURCE -D _FORTIFY_SOURCE=2 -D DEBUG=1 -D HAVE_AV_CONFIG_H -D ASSERT_LEVEL=2 -I /root/firefox-clang/media/ffvpx/libavcodec -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/media/ffvpx/libavcodec -I /root/firefox-clang/modules/fdlibm/inexact-math-override -I /root/firefox-clang/third_party/khronos/vulkan-headers/include -I /root/firefox-clang/media/mozva -I /root/firefox-clang/media/libopus/include -I /root/firefox-clang/media/libvorbis -I /root/firefox-clang/media/libvpx -I /root/firefox-clang/media/ffvpx -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 -Wno-parentheses -Wno-pointer-sign -Wno-sign-compare -Wno-switch -Wno-type-limits -Wno-unused-function -Wno-deprecated-declarations -Wno-absolute-value -Wno-incompatible-pointer-types -Wno-string-conversion -Wno-visibility -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 /root/firefox-clang/media/ffvpx/libavcodec/vp8dsp.c
1/*
2 * Copyright (C) 2010 David Conrad
3 * Copyright (C) 2010 Ronald S. Bultje
4 * Copyright (C) 2014 Peter Ross
5 *
6 * This file is part of FFmpeg.
7 *
8 * FFmpeg is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * FFmpeg is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with FFmpeg; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23/**
24 * @file
25 * VP8 compatible video decoder
26 */
27
28#include "config_components.h"
29
30#include "libavutil/common.h"
31#include "libavutil/intreadwrite.h"
32
33#include "mathops.h"
34#include "vp8dsp.h"
35
36#define MK_IDCT_DC_ADD4_C(name)static void name_idct_dc_add4uv_c(uint8_t *dst, int16_t block
[4][16], ptrdiff_t stride) { name_idct_dc_add_c(dst + stride *
0 + 0, block[0], stride); name_idct_dc_add_c(dst + stride * 0
+ 4, block[1], stride); name_idct_dc_add_c(dst + stride * 4 +
0, block[2], stride); name_idct_dc_add_c(dst + stride * 4 + 4
, block[3], stride); } static void name_idct_dc_add4y_c(uint8_t
*dst, int16_t block[4][16], ptrdiff_t stride) { name_idct_dc_add_c
(dst + 0, block[0], stride); name_idct_dc_add_c(dst + 4, block
[1], stride); name_idct_dc_add_c(dst + 8, block[2], stride); name_idct_dc_add_c
(dst + 12, block[3], stride); }
\
37static void name ## _idct_dc_add4uv_c(uint8_t *dst, int16_t block[4][16], \
38 ptrdiff_t stride) \
39{ \
40 name ## _idct_dc_add_c(dst + stride * 0 + 0, block[0], stride); \
41 name ## _idct_dc_add_c(dst + stride * 0 + 4, block[1], stride); \
42 name ## _idct_dc_add_c(dst + stride * 4 + 0, block[2], stride); \
43 name ## _idct_dc_add_c(dst + stride * 4 + 4, block[3], stride); \
44} \
45 \
46static void name ## _idct_dc_add4y_c(uint8_t *dst, int16_t block[4][16], \
47 ptrdiff_t stride) \
48{ \
49 name ## _idct_dc_add_c(dst + 0, block[0], stride); \
50 name ## _idct_dc_add_c(dst + 4, block[1], stride); \
51 name ## _idct_dc_add_c(dst + 8, block[2], stride); \
52 name ## _idct_dc_add_c(dst + 12, block[3], stride); \
53}
54
55#if CONFIG_VP7_DECODER0
56static void vp7_luma_dc_wht_c(int16_t block[4][4][16], int16_t dc[16])
57{
58 int i;
59 unsigned a1, b1, c1, d1;
60 int16_t tmp[16];
61
62 for (i = 0; i < 4; i++) {
63 a1 = (dc[i * 4 + 0] + dc[i * 4 + 2]) * 23170;
64 b1 = (dc[i * 4 + 0] - dc[i * 4 + 2]) * 23170;
65 c1 = dc[i * 4 + 1] * 12540 - dc[i * 4 + 3] * 30274;
66 d1 = dc[i * 4 + 1] * 30274 + dc[i * 4 + 3] * 12540;
67 tmp[i * 4 + 0] = (int)(a1 + d1) >> 14;
68 tmp[i * 4 + 3] = (int)(a1 - d1) >> 14;
69 tmp[i * 4 + 1] = (int)(b1 + c1) >> 14;
70 tmp[i * 4 + 2] = (int)(b1 - c1) >> 14;
71 }
72
73 for (i = 0; i < 4; i++) {
74 a1 = (tmp[i + 0] + tmp[i + 8]) * 23170;
75 b1 = (tmp[i + 0] - tmp[i + 8]) * 23170;
76 c1 = tmp[i + 4] * 12540 - tmp[i + 12] * 30274;
77 d1 = tmp[i + 4] * 30274 + tmp[i + 12] * 12540;
78 AV_ZERO64(dc + i * 4)(((av_alias64*)(dc + i * 4))->u64 = 0);
79 block[0][i][0] = (int)(a1 + d1 + 0x20000) >> 18;
80 block[3][i][0] = (int)(a1 - d1 + 0x20000) >> 18;
81 block[1][i][0] = (int)(b1 + c1 + 0x20000) >> 18;
82 block[2][i][0] = (int)(b1 - c1 + 0x20000) >> 18;
83 }
84}
85
86static void vp7_luma_dc_wht_dc_c(int16_t block[4][4][16], int16_t dc[16])
87{
88 int i, val = (23170 * (23170 * dc[0] >> 14) + 0x20000) >> 18;
89 dc[0] = 0;
90
91 for (i = 0; i < 4; i++) {
92 block[i][0][0] = val;
93 block[i][1][0] = val;
94 block[i][2][0] = val;
95 block[i][3][0] = val;
96 }
97}
98
99static void vp7_idct_add_c(uint8_t *dst, int16_t block[16], ptrdiff_t stride)
100{
101 int i;
102 unsigned a1, b1, c1, d1;
103 int16_t tmp[16];
104
105 for (i = 0; i < 4; i++) {
106 a1 = (block[i * 4 + 0] + block[i * 4 + 2]) * 23170;
107 b1 = (block[i * 4 + 0] - block[i * 4 + 2]) * 23170;
108 c1 = block[i * 4 + 1] * 12540 - block[i * 4 + 3] * 30274;
109 d1 = block[i * 4 + 1] * 30274 + block[i * 4 + 3] * 12540;
110 AV_ZERO64(block + i * 4)(((av_alias64*)(block + i * 4))->u64 = 0);
111 tmp[i * 4 + 0] = (int)(a1 + d1) >> 14;
112 tmp[i * 4 + 3] = (int)(a1 - d1) >> 14;
113 tmp[i * 4 + 1] = (int)(b1 + c1) >> 14;
114 tmp[i * 4 + 2] = (int)(b1 - c1) >> 14;
115 }
116
117 for (i = 0; i < 4; i++) {
118 a1 = (tmp[i + 0] + tmp[i + 8]) * 23170;
119 b1 = (tmp[i + 0] - tmp[i + 8]) * 23170;
120 c1 = tmp[i + 4] * 12540 - tmp[i + 12] * 30274;
121 d1 = tmp[i + 4] * 30274 + tmp[i + 12] * 12540;
122 dst[0 * stride + i] = av_clip_uint8av_clip_uint8_c(dst[0 * stride + i] +
123 ((int)(a1 + d1 + 0x20000) >> 18));
124 dst[3 * stride + i] = av_clip_uint8av_clip_uint8_c(dst[3 * stride + i] +
125 ((int)(a1 - d1 + 0x20000) >> 18));
126 dst[1 * stride + i] = av_clip_uint8av_clip_uint8_c(dst[1 * stride + i] +
127 ((int)(b1 + c1 + 0x20000) >> 18));
128 dst[2 * stride + i] = av_clip_uint8av_clip_uint8_c(dst[2 * stride + i] +
129 ((int)(b1 - c1 + 0x20000) >> 18));
130 }
131}
132
133static void vp7_idct_dc_add_c(uint8_t *dst, int16_t block[16], ptrdiff_t stride)
134{
135 int i, dc = (23170 * (23170 * block[0] >> 14) + 0x20000) >> 18;
136 block[0] = 0;
137
138 for (i = 0; i < 4; i++) {
139 dst[0] = av_clip_uint8av_clip_uint8_c(dst[0] + dc);
140 dst[1] = av_clip_uint8av_clip_uint8_c(dst[1] + dc);
141 dst[2] = av_clip_uint8av_clip_uint8_c(dst[2] + dc);
142 dst[3] = av_clip_uint8av_clip_uint8_c(dst[3] + dc);
143 dst += stride;
144 }
145}
146
147MK_IDCT_DC_ADD4_C(vp7)static void vp7_idct_dc_add4uv_c(uint8_t *dst, int16_t block[
4][16], ptrdiff_t stride) { vp7_idct_dc_add_c(dst + stride * 0
+ 0, block[0], stride); vp7_idct_dc_add_c(dst + stride * 0 +
4, block[1], stride); vp7_idct_dc_add_c(dst + stride * 4 + 0
, block[2], stride); vp7_idct_dc_add_c(dst + stride * 4 + 4, block
[3], stride); } static void vp7_idct_dc_add4y_c(uint8_t *dst,
int16_t block[4][16], ptrdiff_t stride) { vp7_idct_dc_add_c(
dst + 0, block[0], stride); vp7_idct_dc_add_c(dst + 4, block[
1], stride); vp7_idct_dc_add_c(dst + 8, block[2], stride); vp7_idct_dc_add_c
(dst + 12, block[3], stride); }
148#endif /* CONFIG_VP7_DECODER */
149
150// TODO: Maybe add dequant
151#if CONFIG_VP8_DECODER1
152static void vp8_luma_dc_wht_c(int16_t block[4][4][16], int16_t dc[16])
153{
154 int i, t0, t1, t2, t3;
155
156 for (i = 0; i < 4; i++) {
157 t0 = dc[0 * 4 + i] + dc[3 * 4 + i];
158 t1 = dc[1 * 4 + i] + dc[2 * 4 + i];
159 t2 = dc[1 * 4 + i] - dc[2 * 4 + i];
160 t3 = dc[0 * 4 + i] - dc[3 * 4 + i];
161
162 dc[0 * 4 + i] = t0 + t1;
163 dc[1 * 4 + i] = t3 + t2;
164 dc[2 * 4 + i] = t0 - t1;
165 dc[3 * 4 + i] = t3 - t2;
166 }
167
168 for (i = 0; i < 4; i++) {
169 t0 = dc[i * 4 + 0] + dc[i * 4 + 3] + 3; // rounding
170 t1 = dc[i * 4 + 1] + dc[i * 4 + 2];
171 t2 = dc[i * 4 + 1] - dc[i * 4 + 2];
172 t3 = dc[i * 4 + 0] - dc[i * 4 + 3] + 3; // rounding
173 AV_ZERO64(dc + i * 4)(((av_alias64*)(dc + i * 4))->u64 = 0);
174
175 block[i][0][0] = (t0 + t1) >> 3;
176 block[i][1][0] = (t3 + t2) >> 3;
177 block[i][2][0] = (t0 - t1) >> 3;
178 block[i][3][0] = (t3 - t2) >> 3;
179 }
180}
181
182static void vp8_luma_dc_wht_dc_c(int16_t block[4][4][16], int16_t dc[16])
183{
184 int i, val = (dc[0] + 3) >> 3;
185 dc[0] = 0;
186
187 for (i = 0; i < 4; i++) {
188 block[i][0][0] = val;
189 block[i][1][0] = val;
190 block[i][2][0] = val;
191 block[i][3][0] = val;
192 }
193}
194
195#define MUL_20091(a)((((a) * 20091) >> 16) + (a)) ((((a) * 20091) >> 16) + (a))
196#define MUL_35468(a)(((a) * 35468) >> 16) (((a) * 35468) >> 16)
197
198static void vp8_idct_add_c(uint8_t *dst, int16_t block[16], ptrdiff_t stride)
199{
200 int i, t0, t1, t2, t3;
201 int16_t tmp[16];
202
203 for (i = 0; i < 4; i++) {
204 t0 = block[0 * 4 + i] + block[2 * 4 + i];
205 t1 = block[0 * 4 + i] - block[2 * 4 + i];
206 t2 = MUL_35468(block[1 * 4 + i])(((block[1 * 4 + i]) * 35468) >> 16) - MUL_20091(block[3 * 4 + i])((((block[3 * 4 + i]) * 20091) >> 16) + (block[3 * 4 + i
]))
;
207 t3 = MUL_20091(block[1 * 4 + i])((((block[1 * 4 + i]) * 20091) >> 16) + (block[1 * 4 + i
]))
+ MUL_35468(block[3 * 4 + i])(((block[3 * 4 + i]) * 35468) >> 16);
208 block[0 * 4 + i] = 0;
209 block[1 * 4 + i] = 0;
210 block[2 * 4 + i] = 0;
211 block[3 * 4 + i] = 0;
212
213 tmp[i * 4 + 0] = t0 + t3;
214 tmp[i * 4 + 1] = t1 + t2;
215 tmp[i * 4 + 2] = t1 - t2;
216 tmp[i * 4 + 3] = t0 - t3;
217 }
218
219 for (i = 0; i < 4; i++) {
220 t0 = tmp[0 * 4 + i] + tmp[2 * 4 + i];
221 t1 = tmp[0 * 4 + i] - tmp[2 * 4 + i];
222 t2 = MUL_35468(tmp[1 * 4 + i])(((tmp[1 * 4 + i]) * 35468) >> 16) - MUL_20091(tmp[3 * 4 + i])((((tmp[3 * 4 + i]) * 20091) >> 16) + (tmp[3 * 4 + i]));
223 t3 = MUL_20091(tmp[1 * 4 + i])((((tmp[1 * 4 + i]) * 20091) >> 16) + (tmp[1 * 4 + i])) + MUL_35468(tmp[3 * 4 + i])(((tmp[3 * 4 + i]) * 35468) >> 16);
224
225 dst[0] = av_clip_uint8av_clip_uint8_c(dst[0] + ((t0 + t3 + 4) >> 3));
226 dst[1] = av_clip_uint8av_clip_uint8_c(dst[1] + ((t1 + t2 + 4) >> 3));
227 dst[2] = av_clip_uint8av_clip_uint8_c(dst[2] + ((t1 - t2 + 4) >> 3));
228 dst[3] = av_clip_uint8av_clip_uint8_c(dst[3] + ((t0 - t3 + 4) >> 3));
229 dst += stride;
230 }
231}
232
233static void vp8_idct_dc_add_c(uint8_t *dst, int16_t block[16], ptrdiff_t stride)
234{
235 int i, dc = (block[0] + 4) >> 3;
236 block[0] = 0;
237
238 for (i = 0; i < 4; i++) {
239 dst[0] = av_clip_uint8av_clip_uint8_c(dst[0] + dc);
240 dst[1] = av_clip_uint8av_clip_uint8_c(dst[1] + dc);
241 dst[2] = av_clip_uint8av_clip_uint8_c(dst[2] + dc);
242 dst[3] = av_clip_uint8av_clip_uint8_c(dst[3] + dc);
243 dst += stride;
244 }
245}
246
247MK_IDCT_DC_ADD4_C(vp8)static void vp8_idct_dc_add4uv_c(uint8_t *dst, int16_t block[
4][16], ptrdiff_t stride) { vp8_idct_dc_add_c(dst + stride * 0
+ 0, block[0], stride); vp8_idct_dc_add_c(dst + stride * 0 +
4, block[1], stride); vp8_idct_dc_add_c(dst + stride * 4 + 0
, block[2], stride); vp8_idct_dc_add_c(dst + stride * 4 + 4, block
[3], stride); } static void vp8_idct_dc_add4y_c(uint8_t *dst,
int16_t block[4][16], ptrdiff_t stride) { vp8_idct_dc_add_c(
dst + 0, block[0], stride); vp8_idct_dc_add_c(dst + 4, block[
1], stride); vp8_idct_dc_add_c(dst + 8, block[2], stride); vp8_idct_dc_add_c
(dst + 12, block[3], stride); }
248#endif /* CONFIG_VP8_DECODER */
249
250// because I like only having two parameters to pass functions...
251#define LOAD_PIXELS__attribute__((unused)) int p3 = p[-4 * stride]; __attribute__
((unused)) int p2 = p[-3 * stride]; __attribute__((unused)) int
p1 = p[-2 * stride]; __attribute__((unused)) int p0 = p[-1 *
stride]; __attribute__((unused)) int q0 = p[ 0 * stride]; __attribute__
((unused)) int q1 = p[ 1 * stride]; __attribute__((unused)) int
q2 = p[ 2 * stride]; __attribute__((unused)) int q3 = p[ 3 *
stride];
\
252 av_unused__attribute__((unused)) int p3 = p[-4 * stride]; \
253 av_unused__attribute__((unused)) int p2 = p[-3 * stride]; \
254 av_unused__attribute__((unused)) int p1 = p[-2 * stride]; \
255 av_unused__attribute__((unused)) int p0 = p[-1 * stride]; \
256 av_unused__attribute__((unused)) int q0 = p[ 0 * stride]; \
257 av_unused__attribute__((unused)) int q1 = p[ 1 * stride]; \
258 av_unused__attribute__((unused)) int q2 = p[ 2 * stride]; \
259 av_unused__attribute__((unused)) int q3 = p[ 3 * stride];
260
261#define clip_int8(n)(cm[(n) + 0x80] - 0x80) (cm[(n) + 0x80] - 0x80)
262
263static av_always_inline__attribute__((always_inline)) inline void filter_common(uint8_t *p, ptrdiff_t stride,
264 int is4tap, int is_vp7)
265{
266 LOAD_PIXELS__attribute__((unused)) int p3 = p[-4 * stride]; __attribute__
((unused)) int p2 = p[-3 * stride]; __attribute__((unused)) int
p1 = p[-2 * stride]; __attribute__((unused)) int p0 = p[-1 *
stride]; __attribute__((unused)) int q0 = p[ 0 * stride]; __attribute__
((unused)) int q1 = p[ 1 * stride]; __attribute__((unused)) int
q2 = p[ 2 * stride]; __attribute__((unused)) int q3 = p[ 3 *
stride];
267 int a, f1, f2;
268 const uint8_t *cm = ff_crop_tab + MAX_NEG_CROP1024;
269
270 a = 3 * (q0 - p0);
271
272 if (is4tap)
273 a += clip_int8(p1 - q1)(cm[(p1 - q1) + 0x80] - 0x80);
274
275 a = clip_int8(a)(cm[(a) + 0x80] - 0x80);
276
277 // We deviate from the spec here with c(a+3) >> 3
278 // since that's what libvpx does.
279 f1 = FFMIN(a + 4, 127)((a + 4) > (127) ? (127) : (a + 4)) >> 3;
280
281 if (is_vp7)
282 f2 = f1 - ((a & 7) == 4);
283 else
284 f2 = FFMIN(a + 3, 127)((a + 3) > (127) ? (127) : (a + 3)) >> 3;
285
286 // Despite what the spec says, we do need to clamp here to
287 // be bitexact with libvpx.
288 p[-1 * stride] = cm[p0 + f2];
289 p[ 0 * stride] = cm[q0 - f1];
290
291 // only used for _inner on blocks without high edge variance
292 if (!is4tap) {
293 a = (f1 + 1) >> 1;
294 p[-2 * stride] = cm[p1 + a];
295 p[ 1 * stride] = cm[q1 - a];
296 }
297}
298
299static av_always_inline__attribute__((always_inline)) inline void vp7_filter_common(uint8_t *p, ptrdiff_t stride,
300 int is4tap)
301{
302 filter_common(p, stride, is4tap, IS_VP71);
303}
304
305static av_always_inline__attribute__((always_inline)) inline void vp8_filter_common(uint8_t *p, ptrdiff_t stride,
306 int is4tap)
307{
308 filter_common(p, stride, is4tap, IS_VP80);
309}
310
311static av_always_inline__attribute__((always_inline)) inline int vp7_simple_limit(uint8_t *p, ptrdiff_t stride,
312 int flim)
313{
314 LOAD_PIXELS__attribute__((unused)) int p3 = p[-4 * stride]; __attribute__
((unused)) int p2 = p[-3 * stride]; __attribute__((unused)) int
p1 = p[-2 * stride]; __attribute__((unused)) int p0 = p[-1 *
stride]; __attribute__((unused)) int q0 = p[ 0 * stride]; __attribute__
((unused)) int q1 = p[ 1 * stride]; __attribute__((unused)) int
q2 = p[ 2 * stride]; __attribute__((unused)) int q3 = p[ 3 *
stride];
315 return FFABS(p0 - q0)((p0 - q0) >= 0 ? (p0 - q0) : (-(p0 - q0))) <= flim;
316}
317
318static av_always_inline__attribute__((always_inline)) inline int vp8_simple_limit(uint8_t *p, ptrdiff_t stride,
319 int flim)
320{
321 LOAD_PIXELS__attribute__((unused)) int p3 = p[-4 * stride]; __attribute__
((unused)) int p2 = p[-3 * stride]; __attribute__((unused)) int
p1 = p[-2 * stride]; __attribute__((unused)) int p0 = p[-1 *
stride]; __attribute__((unused)) int q0 = p[ 0 * stride]; __attribute__
((unused)) int q1 = p[ 1 * stride]; __attribute__((unused)) int
q2 = p[ 2 * stride]; __attribute__((unused)) int q3 = p[ 3 *
stride];
322 return 2 * FFABS(p0 - q0)((p0 - q0) >= 0 ? (p0 - q0) : (-(p0 - q0))) + (FFABS(p1 - q1)((p1 - q1) >= 0 ? (p1 - q1) : (-(p1 - q1))) >> 1) <= flim;
323}
324
325/**
326 * E - limit at the macroblock edge
327 * I - limit for interior difference
328 */
329#define NORMAL_LIMIT(vpn)static __attribute__((always_inline)) inline int vpvpn_normal_limit
(uint8_t *p, ptrdiff_t stride, int E, int I) { __attribute__(
(unused)) int p3 = p[-4 * stride]; __attribute__((unused)) int
p2 = p[-3 * stride]; __attribute__((unused)) int p1 = p[-2 *
stride]; __attribute__((unused)) int p0 = p[-1 * stride]; __attribute__
((unused)) int q0 = p[ 0 * stride]; __attribute__((unused)) int
q1 = p[ 1 * stride]; __attribute__((unused)) int q2 = p[ 2 *
stride]; __attribute__((unused)) int q3 = p[ 3 * stride]; return
vpvpn_simple_limit(p, stride, E) && ((p3 - p2) >=
0 ? (p3 - p2) : (-(p3 - p2))) <= I && ((p2 - p1) >=
0 ? (p2 - p1) : (-(p2 - p1))) <= I && ((p1 - p0) >=
0 ? (p1 - p0) : (-(p1 - p0))) <= I && ((q3 - q2) >=
0 ? (q3 - q2) : (-(q3 - q2))) <= I && ((q2 - q1) >=
0 ? (q2 - q1) : (-(q2 - q1))) <= I && ((q1 - q0) >=
0 ? (q1 - q0) : (-(q1 - q0))) <= I; }
\
330static av_always_inline__attribute__((always_inline)) inline int vp ## vpn ## _normal_limit(uint8_t *p, \
331 ptrdiff_t stride, \
332 int E, int I) \
333{ \
334 LOAD_PIXELS__attribute__((unused)) int p3 = p[-4 * stride]; __attribute__
((unused)) int p2 = p[-3 * stride]; __attribute__((unused)) int
p1 = p[-2 * stride]; __attribute__((unused)) int p0 = p[-1 *
stride]; __attribute__((unused)) int q0 = p[ 0 * stride]; __attribute__
((unused)) int q1 = p[ 1 * stride]; __attribute__((unused)) int
q2 = p[ 2 * stride]; __attribute__((unused)) int q3 = p[ 3 *
stride];
\
335 return vp ## vpn ## _simple_limit(p, stride, E) && \
336 FFABS(p3 - p2)((p3 - p2) >= 0 ? (p3 - p2) : (-(p3 - p2))) <= I && FFABS(p2 - p1)((p2 - p1) >= 0 ? (p2 - p1) : (-(p2 - p1))) <= I && \
337 FFABS(p1 - p0)((p1 - p0) >= 0 ? (p1 - p0) : (-(p1 - p0))) <= I && FFABS(q3 - q2)((q3 - q2) >= 0 ? (q3 - q2) : (-(q3 - q2))) <= I && \
338 FFABS(q2 - q1)((q2 - q1) >= 0 ? (q2 - q1) : (-(q2 - q1))) <= I && FFABS(q1 - q0)((q1 - q0) >= 0 ? (q1 - q0) : (-(q1 - q0))) <= I; \
339}
340
341NORMAL_LIMIT(7)static __attribute__((always_inline)) inline int vp7_normal_limit
(uint8_t *p, ptrdiff_t stride, int E, int I) { __attribute__(
(unused)) int p3 = p[-4 * stride]; __attribute__((unused)) int
p2 = p[-3 * stride]; __attribute__((unused)) int p1 = p[-2 *
stride]; __attribute__((unused)) int p0 = p[-1 * stride]; __attribute__
((unused)) int q0 = p[ 0 * stride]; __attribute__((unused)) int
q1 = p[ 1 * stride]; __attribute__((unused)) int q2 = p[ 2 *
stride]; __attribute__((unused)) int q3 = p[ 3 * stride]; return
vp7_simple_limit(p, stride, E) && ((p3 - p2) >= 0
? (p3 - p2) : (-(p3 - p2))) <= I && ((p2 - p1) >=
0 ? (p2 - p1) : (-(p2 - p1))) <= I && ((p1 - p0) >=
0 ? (p1 - p0) : (-(p1 - p0))) <= I && ((q3 - q2) >=
0 ? (q3 - q2) : (-(q3 - q2))) <= I && ((q2 - q1) >=
0 ? (q2 - q1) : (-(q2 - q1))) <= I && ((q1 - q0) >=
0 ? (q1 - q0) : (-(q1 - q0))) <= I; }
342NORMAL_LIMIT(8)static __attribute__((always_inline)) inline int vp8_normal_limit
(uint8_t *p, ptrdiff_t stride, int E, int I) { __attribute__(
(unused)) int p3 = p[-4 * stride]; __attribute__((unused)) int
p2 = p[-3 * stride]; __attribute__((unused)) int p1 = p[-2 *
stride]; __attribute__((unused)) int p0 = p[-1 * stride]; __attribute__
((unused)) int q0 = p[ 0 * stride]; __attribute__((unused)) int
q1 = p[ 1 * stride]; __attribute__((unused)) int q2 = p[ 2 *
stride]; __attribute__((unused)) int q3 = p[ 3 * stride]; return
vp8_simple_limit(p, stride, E) && ((p3 - p2) >= 0
? (p3 - p2) : (-(p3 - p2))) <= I && ((p2 - p1) >=
0 ? (p2 - p1) : (-(p2 - p1))) <= I && ((p1 - p0) >=
0 ? (p1 - p0) : (-(p1 - p0))) <= I && ((q3 - q2) >=
0 ? (q3 - q2) : (-(q3 - q2))) <= I && ((q2 - q1) >=
0 ? (q2 - q1) : (-(q2 - q1))) <= I && ((q1 - q0) >=
0 ? (q1 - q0) : (-(q1 - q0))) <= I; }
343
344// high edge variance
345static av_always_inline__attribute__((always_inline)) inline int hev(uint8_t *p, ptrdiff_t stride, int thresh)
346{
347 LOAD_PIXELS__attribute__((unused)) int p3 = p[-4 * stride]; __attribute__
((unused)) int p2 = p[-3 * stride]; __attribute__((unused)) int
p1 = p[-2 * stride]; __attribute__((unused)) int p0 = p[-1 *
stride]; __attribute__((unused)) int q0 = p[ 0 * stride]; __attribute__
((unused)) int q1 = p[ 1 * stride]; __attribute__((unused)) int
q2 = p[ 2 * stride]; __attribute__((unused)) int q3 = p[ 3 *
stride];
348 return FFABS(p1 - p0)((p1 - p0) >= 0 ? (p1 - p0) : (-(p1 - p0))) > thresh || FFABS(q1 - q0)((q1 - q0) >= 0 ? (q1 - q0) : (-(q1 - q0))) > thresh;
349}
350
351static av_always_inline__attribute__((always_inline)) inline void filter_mbedge(uint8_t *p, ptrdiff_t stride)
352{
353 int a0, a1, a2, w;
354 const uint8_t *cm = ff_crop_tab + MAX_NEG_CROP1024;
355
356 LOAD_PIXELS__attribute__((unused)) int p3 = p[-4 * stride]; __attribute__
((unused)) int p2 = p[-3 * stride]; __attribute__((unused)) int
p1 = p[-2 * stride]; __attribute__((unused)) int p0 = p[-1 *
stride]; __attribute__((unused)) int q0 = p[ 0 * stride]; __attribute__
((unused)) int q1 = p[ 1 * stride]; __attribute__((unused)) int
q2 = p[ 2 * stride]; __attribute__((unused)) int q3 = p[ 3 *
stride];
357
358 w = clip_int8(p1 - q1)(cm[(p1 - q1) + 0x80] - 0x80);
359 w = clip_int8(w + 3 * (q0 - p0))(cm[(w + 3 * (q0 - p0)) + 0x80] - 0x80);
360
361 a0 = (27 * w + 63) >> 7;
362 a1 = (18 * w + 63) >> 7;
363 a2 = (9 * w + 63) >> 7;
364
365 p[-3 * stride] = cm[p2 + a2];
366 p[-2 * stride] = cm[p1 + a1];
367 p[-1 * stride] = cm[p0 + a0];
368 p[ 0 * stride] = cm[q0 - a0];
369 p[ 1 * stride] = cm[q1 - a1];
370 p[ 2 * stride] = cm[q2 - a2];
371}
372
373#define LOOP_FILTER(vpn, dir, size, stridea, strideb, maybe_inline)static maybe_inline void vpn_dir_loop_filtersize_c(uint8_t *dst
, ptrdiff_t stride, int flim_E, int flim_I, int hev_thresh) {
int i; for (i = 0; i < size; i++) if (vpn_normal_limit(dst
+ i * stridea, strideb, flim_E, flim_I)) { if (hev(dst + i *
stridea, strideb, hev_thresh)) vpn_filter_common(dst + i * stridea
, strideb, 1); else filter_mbedge(dst + i * stridea, strideb)
; } } static maybe_inline void vpn_dir_loop_filtersize_inner_c
(uint8_t *dst, ptrdiff_t stride, int flim_E, int flim_I, int hev_thresh
) { int i; for (i = 0; i < size; i++) if (vpn_normal_limit
(dst + i * stridea, strideb, flim_E, flim_I)) { int hv = hev(
dst + i * stridea, strideb, hev_thresh); if (hv) vpn_filter_common
(dst + i * stridea, strideb, 1); else vpn_filter_common(dst +
i * stridea, strideb, 0); } }
\
374static maybe_inline \
375void vpn ## _ ## dir ## _loop_filter ## size ## _c(uint8_t *dst, \
376 ptrdiff_t stride, \
377 int flim_E, int flim_I, \
378 int hev_thresh) \
379{ \
380 int i; \
381 for (i = 0; i < size; i++) \
382 if (vpn ## _normal_limit(dst + i * stridea, strideb, \
383 flim_E, flim_I)) { \
384 if (hev(dst + i * stridea, strideb, hev_thresh)) \
385 vpn ## _filter_common(dst + i * stridea, strideb, 1); \
386 else \
387 filter_mbedge(dst + i * stridea, strideb); \
388 } \
389} \
390 \
391static maybe_inline \
392void vpn ## _ ## dir ## _loop_filter ## size ## _inner_c(uint8_t *dst, \
393 ptrdiff_t stride, \
394 int flim_E, \
395 int flim_I, \
396 int hev_thresh) \
397{ \
398 int i; \
399 for (i = 0; i < size; i++) \
400 if (vpn ## _normal_limit(dst + i * stridea, strideb, \
401 flim_E, flim_I)) { \
402 int hv = hev(dst + i * stridea, strideb, hev_thresh); \
403 if (hv) \
404 vpn ## _filter_common(dst + i * stridea, strideb, 1); \
405 else \
406 vpn ## _filter_common(dst + i * stridea, strideb, 0); \
407 } \
408}
409
410#define UV_LOOP_FILTER(vpn, dir, stridea, strideb)static __attribute__((always_inline)) inline void vpn_dir_loop_filter8_c
(uint8_t *dst, ptrdiff_t stride, int flim_E, int flim_I, int hev_thresh
) { int i; for (i = 0; i < 8; i++) if (vpn_normal_limit(dst
+ i * stridea, strideb, flim_E, flim_I)) { if (hev(dst + i *
stridea, strideb, hev_thresh)) vpn_filter_common(dst + i * stridea
, strideb, 1); else filter_mbedge(dst + i * stridea, strideb)
; } } static __attribute__((always_inline)) inline void vpn_dir_loop_filter8_inner_c
(uint8_t *dst, ptrdiff_t stride, int flim_E, int flim_I, int hev_thresh
) { int i; for (i = 0; i < 8; i++) if (vpn_normal_limit(dst
+ i * stridea, strideb, flim_E, flim_I)) { int hv = hev(dst +
i * stridea, strideb, hev_thresh); if (hv) vpn_filter_common
(dst + i * stridea, strideb, 1); else vpn_filter_common(dst +
i * stridea, strideb, 0); } } static void vpn_dir_loop_filter8uv_c
(uint8_t *dstU, uint8_t *dstV, ptrdiff_t stride, int fE, int fI
, int hev_thresh) { vpn_dir_loop_filter8_c(dstU, stride, fE, fI
, hev_thresh); vpn_dir_loop_filter8_c(dstV, stride, fE, fI, hev_thresh
); } static void vpn_dir_loop_filter8uv_inner_c(uint8_t *dstU
, uint8_t *dstV, ptrdiff_t stride, int fE, int fI, int hev_thresh
) { vpn_dir_loop_filter8_inner_c(dstU, stride, fE, fI, hev_thresh
); vpn_dir_loop_filter8_inner_c(dstV, stride, fE, fI, hev_thresh
); }
\static __attribute__((always_inline)) inline void vpn_dir_loop_filter8_c
(uint8_t *dst, ptrdiff_t stride, int flim_E, int flim_I, int hev_thresh
) { int i; for (i = 0; i < 8; i++) if (vpn_normal_limit(dst
+ i * stridea, strideb, flim_E, flim_I)) { if (hev(dst + i *
stridea, strideb, hev_thresh)) vpn_filter_common(dst + i * stridea
, strideb, 1); else filter_mbedge(dst + i * stridea, strideb)
; } } static __attribute__((always_inline)) inline void vpn_dir_loop_filter8_inner_c
(uint8_t *dst, ptrdiff_t stride, int flim_E, int flim_I, int hev_thresh
) { int i; for (i = 0; i < 8; i++) if (vpn_normal_limit(dst
+ i * stridea, strideb, flim_E, flim_I)) { int hv = hev(dst +
i * stridea, strideb, hev_thresh); if (hv) vpn_filter_common
(dst + i * stridea, strideb, 1); else vpn_filter_common(dst +
i * stridea, strideb, 0); } }
411LOOP_FILTER(vpn, dir, 8, stridea, strideb, av_always_inline)static __attribute__((always_inline)) inline void vpn_dir_loop_filter8_c
(uint8_t *dst, ptrdiff_t stride, int flim_E, int flim_I, int hev_thresh
) { int i; for (i = 0; i < 8; i++) if (vpn_normal_limit(dst
+ i * stridea, strideb, flim_E, flim_I)) { if (hev(dst + i *
stridea, strideb, hev_thresh)) vpn_filter_common(dst + i * stridea
, strideb, 1); else filter_mbedge(dst + i * stridea, strideb)
; } } static __attribute__((always_inline)) inline void vpn_dir_loop_filter8_inner_c
(uint8_t *dst, ptrdiff_t stride, int flim_E, int flim_I, int hev_thresh
) { int i; for (i = 0; i < 8; i++) if (vpn_normal_limit(dst
+ i * stridea, strideb, flim_E, flim_I)) { int hv = hev(dst +
i * stridea, strideb, hev_thresh); if (hv) vpn_filter_common
(dst + i * stridea, strideb, 1); else vpn_filter_common(dst +
i * stridea, strideb, 0); } }
\
412static void vpn ## _ ## dir ## _loop_filter8uv_c(uint8_t *dstU, \
413 uint8_t *dstV, \
414 ptrdiff_t stride, int fE, \
415 int fI, int hev_thresh) \
416{ \
417 vpn ## _ ## dir ## _loop_filter8_c(dstU, stride, fE, fI, hev_thresh); \
418 vpn ## _ ## dir ## _loop_filter8_c(dstV, stride, fE, fI, hev_thresh); \
419} \
420 \
421static void vpn ## _ ## dir ## _loop_filter8uv_inner_c(uint8_t *dstU, \
422 uint8_t *dstV, \
423 ptrdiff_t stride, \
424 int fE, int fI, \
425 int hev_thresh) \
426{ \
427 vpn ## _ ## dir ## _loop_filter8_inner_c(dstU, stride, fE, fI, \
428 hev_thresh); \
429 vpn ## _ ## dir ## _loop_filter8_inner_c(dstV, stride, fE, fI, \
430 hev_thresh); \
431}
432
433#define LOOP_FILTER_SIMPLE(vpn)static void vpn_v_loop_filter_simple_c(uint8_t *dst, ptrdiff_t
stride, int flim) { int i; for (i = 0; i < 16; i++) if (vpn_simple_limit
(dst + i, stride, flim)) vpn_filter_common(dst + i, stride, 1
); } static void vpn_h_loop_filter_simple_c(uint8_t *dst, ptrdiff_t
stride, int flim) { int i; for (i = 0; i < 16; i++) if (vpn_simple_limit
(dst + i * stride, 1, flim)) vpn_filter_common(dst + i * stride
, 1, 1); }
\
434static void vpn ## _v_loop_filter_simple_c(uint8_t *dst, ptrdiff_t stride, \
435 int flim) \
436{ \
437 int i; \
438 for (i = 0; i < 16; i++) \
439 if (vpn ## _simple_limit(dst + i, stride, flim)) \
440 vpn ## _filter_common(dst + i, stride, 1); \
441} \
442 \
443static void vpn ## _h_loop_filter_simple_c(uint8_t *dst, ptrdiff_t stride, \
444 int flim) \
445{ \
446 int i; \
447 for (i = 0; i < 16; i++) \
448 if (vpn ## _simple_limit(dst + i * stride, 1, flim)) \
449 vpn ## _filter_common(dst + i * stride, 1, 1); \
450}
451
452#define LOOP_FILTERS(vpn)static void vpn_v_loop_filter16_c(uint8_t *dst, ptrdiff_t stride
, int flim_E, int flim_I, int hev_thresh) { int i; for (i = 0
; i < 16; i++) if (vpn_normal_limit(dst + i * 1, stride, flim_E
, flim_I)) { if (hev(dst + i * 1, stride, hev_thresh)) vpn_filter_common
(dst + i * 1, stride, 1); else filter_mbedge(dst + i * 1, stride
); } } static void vpn_v_loop_filter16_inner_c(uint8_t *dst, ptrdiff_t
stride, int flim_E, int flim_I, int hev_thresh) { int i; for
(i = 0; i < 16; i++) if (vpn_normal_limit(dst + i * 1, stride
, flim_E, flim_I)) { int hv = hev(dst + i * 1, stride, hev_thresh
); if (hv) vpn_filter_common(dst + i * 1, stride, 1); else vpn_filter_common
(dst + i * 1, stride, 0); } } static void vpn_h_loop_filter16_c
(uint8_t *dst, ptrdiff_t stride, int flim_E, int flim_I, int hev_thresh
) { int i; for (i = 0; i < 16; i++) if (vpn_normal_limit(dst
+ i * stride, 1, flim_E, flim_I)) { if (hev(dst + i * stride
, 1, hev_thresh)) vpn_filter_common(dst + i * stride, 1, 1); else
filter_mbedge(dst + i * stride, 1); } } static void vpn_h_loop_filter16_inner_c
(uint8_t *dst, ptrdiff_t stride, int flim_E, int flim_I, int hev_thresh
) { int i; for (i = 0; i < 16; i++) if (vpn_normal_limit(dst
+ i * stride, 1, flim_E, flim_I)) { int hv = hev(dst + i * stride
, 1, hev_thresh); if (hv) vpn_filter_common(dst + i * stride,
1, 1); else vpn_filter_common(dst + i * stride, 1, 0); } } static
__attribute__((always_inline)) inline void vpn_v_loop_filter8_c
(uint8_t *dst, ptrdiff_t stride, int flim_E, int flim_I, int hev_thresh
) { int i; for (i = 0; i < 8; i++) if (vpn_normal_limit(dst
+ i * 1, stride, flim_E, flim_I)) { if (hev(dst + i * 1, stride
, hev_thresh)) vpn_filter_common(dst + i * 1, stride, 1); else
filter_mbedge(dst + i * 1, stride); } } static __attribute__
((always_inline)) inline void vpn_v_loop_filter8_inner_c(uint8_t
*dst, ptrdiff_t stride, int flim_E, int flim_I, int hev_thresh
) { int i; for (i = 0; i < 8; i++) if (vpn_normal_limit(dst
+ i * 1, stride, flim_E, flim_I)) { int hv = hev(dst + i * 1
, stride, hev_thresh); if (hv) vpn_filter_common(dst + i * 1,
stride, 1); else vpn_filter_common(dst + i * 1, stride, 0); }
} static void vpn_v_loop_filter8uv_c(uint8_t *dstU, uint8_t *
dstV, ptrdiff_t stride, int fE, int fI, int hev_thresh) { vpn_v_loop_filter8_c
(dstU, stride, fE, fI, hev_thresh); vpn_v_loop_filter8_c(dstV
, stride, fE, fI, hev_thresh); } static void vpn_v_loop_filter8uv_inner_c
(uint8_t *dstU, uint8_t *dstV, ptrdiff_t stride, int fE, int fI
, int hev_thresh) { vpn_v_loop_filter8_inner_c(dstU, stride, fE
, fI, hev_thresh); vpn_v_loop_filter8_inner_c(dstV, stride, fE
, fI, hev_thresh); } static __attribute__((always_inline)) inline
void vpn_h_loop_filter8_c(uint8_t *dst, ptrdiff_t stride, int
flim_E, int flim_I, int hev_thresh) { int i; for (i = 0; i <
8; i++) if (vpn_normal_limit(dst + i * stride, 1, flim_E, flim_I
)) { if (hev(dst + i * stride, 1, hev_thresh)) vpn_filter_common
(dst + i * stride, 1, 1); else filter_mbedge(dst + i * stride
, 1); } } static __attribute__((always_inline)) inline void vpn_h_loop_filter8_inner_c
(uint8_t *dst, ptrdiff_t stride, int flim_E, int flim_I, int hev_thresh
) { int i; for (i = 0; i < 8; i++) if (vpn_normal_limit(dst
+ i * stride, 1, flim_E, flim_I)) { int hv = hev(dst + i * stride
, 1, hev_thresh); if (hv) vpn_filter_common(dst + i * stride,
1, 1); else vpn_filter_common(dst + i * stride, 1, 0); } } static
void vpn_h_loop_filter8uv_c(uint8_t *dstU, uint8_t *dstV, ptrdiff_t
stride, int fE, int fI, int hev_thresh) { vpn_h_loop_filter8_c
(dstU, stride, fE, fI, hev_thresh); vpn_h_loop_filter8_c(dstV
, stride, fE, fI, hev_thresh); } static void vpn_h_loop_filter8uv_inner_c
(uint8_t *dstU, uint8_t *dstV, ptrdiff_t stride, int fE, int fI
, int hev_thresh) { vpn_h_loop_filter8_inner_c(dstU, stride, fE
, fI, hev_thresh); vpn_h_loop_filter8_inner_c(dstV, stride, fE
, fI, hev_thresh); } static void vpn_v_loop_filter_simple_c(uint8_t
*dst, ptrdiff_t stride, int flim) { int i; for (i = 0; i <
16; i++) if (vpn_simple_limit(dst + i, stride, flim)) vpn_filter_common
(dst + i, stride, 1); } static void vpn_h_loop_filter_simple_c
(uint8_t *dst, ptrdiff_t stride, int flim) { int i; for (i = 0
; i < 16; i++) if (vpn_simple_limit(dst + i * stride, 1, flim
)) vpn_filter_common(dst + i * stride, 1, 1); }
\
453 LOOP_FILTER(vpn, v, 16, 1, stride, )static void vpn_v_loop_filter16_c(uint8_t *dst, ptrdiff_t stride
, int flim_E, int flim_I, int hev_thresh) { int i; for (i = 0
; i < 16; i++) if (vpn_normal_limit(dst + i * 1, stride, flim_E
, flim_I)) { if (hev(dst + i * 1, stride, hev_thresh)) vpn_filter_common
(dst + i * 1, stride, 1); else filter_mbedge(dst + i * 1, stride
); } } static void vpn_v_loop_filter16_inner_c(uint8_t *dst, ptrdiff_t
stride, int flim_E, int flim_I, int hev_thresh) { int i; for
(i = 0; i < 16; i++) if (vpn_normal_limit(dst + i * 1, stride
, flim_E, flim_I)) { int hv = hev(dst + i * 1, stride, hev_thresh
); if (hv) vpn_filter_common(dst + i * 1, stride, 1); else vpn_filter_common
(dst + i * 1, stride, 0); } }
\
454 LOOP_FILTER(vpn, h, 16, stride, 1, )static void vpn_h_loop_filter16_c(uint8_t *dst, ptrdiff_t stride
, int flim_E, int flim_I, int hev_thresh) { int i; for (i = 0
; i < 16; i++) if (vpn_normal_limit(dst + i * stride, 1, flim_E
, flim_I)) { if (hev(dst + i * stride, 1, hev_thresh)) vpn_filter_common
(dst + i * stride, 1, 1); else filter_mbedge(dst + i * stride
, 1); } } static void vpn_h_loop_filter16_inner_c(uint8_t *dst
, ptrdiff_t stride, int flim_E, int flim_I, int hev_thresh) {
int i; for (i = 0; i < 16; i++) if (vpn_normal_limit(dst +
i * stride, 1, flim_E, flim_I)) { int hv = hev(dst + i * stride
, 1, hev_thresh); if (hv) vpn_filter_common(dst + i * stride,
1, 1); else vpn_filter_common(dst + i * stride, 1, 0); } }
\
455 UV_LOOP_FILTER(vpn, v, 1, stride)static __attribute__((always_inline)) inline void vpn_v_loop_filter8_c
(uint8_t *dst, ptrdiff_t stride, int flim_E, int flim_I, int hev_thresh
) { int i; for (i = 0; i < 8; i++) if (vpn_normal_limit(dst
+ i * 1, stride, flim_E, flim_I)) { if (hev(dst + i * 1, stride
, hev_thresh)) vpn_filter_common(dst + i * 1, stride, 1); else
filter_mbedge(dst + i * 1, stride); } } static __attribute__
((always_inline)) inline void vpn_v_loop_filter8_inner_c(uint8_t
*dst, ptrdiff_t stride, int flim_E, int flim_I, int hev_thresh
) { int i; for (i = 0; i < 8; i++) if (vpn_normal_limit(dst
+ i * 1, stride, flim_E, flim_I)) { int hv = hev(dst + i * 1
, stride, hev_thresh); if (hv) vpn_filter_common(dst + i * 1,
stride, 1); else vpn_filter_common(dst + i * 1, stride, 0); }
} static void vpn_v_loop_filter8uv_c(uint8_t *dstU, uint8_t *
dstV, ptrdiff_t stride, int fE, int fI, int hev_thresh) { vpn_v_loop_filter8_c
(dstU, stride, fE, fI, hev_thresh); vpn_v_loop_filter8_c(dstV
, stride, fE, fI, hev_thresh); } static void vpn_v_loop_filter8uv_inner_c
(uint8_t *dstU, uint8_t *dstV, ptrdiff_t stride, int fE, int fI
, int hev_thresh) { vpn_v_loop_filter8_inner_c(dstU, stride, fE
, fI, hev_thresh); vpn_v_loop_filter8_inner_c(dstV, stride, fE
, fI, hev_thresh); }
\
456 UV_LOOP_FILTER(vpn, h, stride, 1)static __attribute__((always_inline)) inline void vpn_h_loop_filter8_c
(uint8_t *dst, ptrdiff_t stride, int flim_E, int flim_I, int hev_thresh
) { int i; for (i = 0; i < 8; i++) if (vpn_normal_limit(dst
+ i * stride, 1, flim_E, flim_I)) { if (hev(dst + i * stride
, 1, hev_thresh)) vpn_filter_common(dst + i * stride, 1, 1); else
filter_mbedge(dst + i * stride, 1); } } static __attribute__
((always_inline)) inline void vpn_h_loop_filter8_inner_c(uint8_t
*dst, ptrdiff_t stride, int flim_E, int flim_I, int hev_thresh
) { int i; for (i = 0; i < 8; i++) if (vpn_normal_limit(dst
+ i * stride, 1, flim_E, flim_I)) { int hv = hev(dst + i * stride
, 1, hev_thresh); if (hv) vpn_filter_common(dst + i * stride,
1, 1); else vpn_filter_common(dst + i * stride, 1, 0); } } static
void vpn_h_loop_filter8uv_c(uint8_t *dstU, uint8_t *dstV, ptrdiff_t
stride, int fE, int fI, int hev_thresh) { vpn_h_loop_filter8_c
(dstU, stride, fE, fI, hev_thresh); vpn_h_loop_filter8_c(dstV
, stride, fE, fI, hev_thresh); } static void vpn_h_loop_filter8uv_inner_c
(uint8_t *dstU, uint8_t *dstV, ptrdiff_t stride, int fE, int fI
, int hev_thresh) { vpn_h_loop_filter8_inner_c(dstU, stride, fE
, fI, hev_thresh); vpn_h_loop_filter8_inner_c(dstV, stride, fE
, fI, hev_thresh); }
\
457 LOOP_FILTER_SIMPLE(vpn)static void vpn_v_loop_filter_simple_c(uint8_t *dst, ptrdiff_t
stride, int flim) { int i; for (i = 0; i < 16; i++) if (vpn_simple_limit
(dst + i, stride, flim)) vpn_filter_common(dst + i, stride, 1
); } static void vpn_h_loop_filter_simple_c(uint8_t *dst, ptrdiff_t
stride, int flim) { int i; for (i = 0; i < 16; i++) if (vpn_simple_limit
(dst + i * stride, 1, flim)) vpn_filter_common(dst + i * stride
, 1, 1); }
\
458
459static const uint8_t subpel_filters[7][6] = {
460 { 0, 6, 123, 12, 1, 0 },
461 { 2, 11, 108, 36, 8, 1 },
462 { 0, 9, 93, 50, 6, 0 },
463 { 3, 16, 77, 77, 16, 3 },
464 { 0, 6, 50, 93, 9, 0 },
465 { 1, 8, 36, 108, 11, 2 },
466 { 0, 1, 12, 123, 6, 0 },
467};
468
469#define PUT_PIXELS(WIDTH)static void put_vp8_pixelsWIDTH_c(uint8_t *dst, ptrdiff_t dststride
, const uint8_t *src, ptrdiff_t srcstride, int h, int x, int y
) { int i; for (i = 0; i < h; i++, dst += dststride, src +=
srcstride) memcpy(dst, src, WIDTH); }
\
470static void put_vp8_pixels ## WIDTH ## _c(uint8_t *dst, ptrdiff_t dststride, \
471 const uint8_t *src, ptrdiff_t srcstride, \
472 int h, int x, int y) \
473{ \
474 int i; \
475 for (i = 0; i < h; i++, dst += dststride, src += srcstride) \
476 memcpy(dst, src, WIDTH); \
477}
478
479PUT_PIXELS(16)static void put_vp8_pixels16_c(uint8_t *dst, ptrdiff_t dststride
, const uint8_t *src, ptrdiff_t srcstride, int h, int x, int y
) { int i; for (i = 0; i < h; i++, dst += dststride, src +=
srcstride) memcpy(dst, src, 16); }
480PUT_PIXELS(8)static void put_vp8_pixels8_c(uint8_t *dst, ptrdiff_t dststride
, const uint8_t *src, ptrdiff_t srcstride, int h, int x, int y
) { int i; for (i = 0; i < h; i++, dst += dststride, src +=
srcstride) memcpy(dst, src, 8); }
481PUT_PIXELS(4)static void put_vp8_pixels4_c(uint8_t *dst, ptrdiff_t dststride
, const uint8_t *src, ptrdiff_t srcstride, int h, int x, int y
) { int i; for (i = 0; i < h; i++, dst += dststride, src +=
srcstride) memcpy(dst, src, 4); }
482
483#define FILTER_6TAP(src, F, stride)cm[(F[2] * src[x + 0 * stride] - F[1] * src[x - 1 * stride] +
F[0] * src[x - 2 * stride] + F[3] * src[x + 1 * stride] - F[
4] * src[x + 2 * stride] + F[5] * src[x + 3 * stride] + 64) >>
7]
\
484 cm[(F[2] * src[x + 0 * stride] - F[1] * src[x - 1 * stride] + \
485 F[0] * src[x - 2 * stride] + F[3] * src[x + 1 * stride] - \
486 F[4] * src[x + 2 * stride] + F[5] * src[x + 3 * stride] + 64) >> 7]
487
488#define FILTER_4TAP(src, F, stride)cm[(F[2] * src[x + 0 * stride] - F[1] * src[x - 1 * stride] +
F[3] * src[x + 1 * stride] - F[4] * src[x + 2 * stride] + 64
) >> 7]
\
489 cm[(F[2] * src[x + 0 * stride] - F[1] * src[x - 1 * stride] + \
490 F[3] * src[x + 1 * stride] - F[4] * src[x + 2 * stride] + 64) >> 7]
491
492#define VP8_EPEL_H(SIZE, TAPS)static void put_vp8_epelSIZE_hTAPS_c(uint8_t *dst, ptrdiff_t dststride
, const uint8_t *src, ptrdiff_t srcstride, int h, int mx, int
my) { const uint8_t *filter = subpel_filters[mx - 1]; const uint8_t
*cm = ff_crop_tab + 1024; int x, y; for (y = 0; y < h; y++
) { for (x = 0; x < SIZE; x++) dst[x] = FILTER_TAPSTAP(src
, filter, 1); dst += dststride; src += srcstride; } }
\
493static void put_vp8_epel ## SIZE ## _h ## TAPS ## _c(uint8_t *dst, \
494 ptrdiff_t dststride, \
495 const uint8_t *src, \
496 ptrdiff_t srcstride, \
497 int h, int mx, int my) \
498{ \
499 const uint8_t *filter = subpel_filters[mx - 1]; \
500 const uint8_t *cm = ff_crop_tab + MAX_NEG_CROP1024; \
501 int x, y; \
502 for (y = 0; y < h; y++) { \
503 for (x = 0; x < SIZE; x++) \
504 dst[x] = FILTER_ ## TAPS ## TAP(src, filter, 1); \
505 dst += dststride; \
506 src += srcstride; \
507 } \
508}
509
510#define VP8_EPEL_V(SIZE, TAPS)static void put_vp8_epelSIZE_vTAPS_c(uint8_t *dst, ptrdiff_t dststride
, const uint8_t *src, ptrdiff_t srcstride, int h, int mx, int
my) { const uint8_t *filter = subpel_filters[my - 1]; const uint8_t
*cm = ff_crop_tab + 1024; int x, y; for (y = 0; y < h; y++
) { for (x = 0; x < SIZE; x++) dst[x] = FILTER_TAPSTAP(src
, filter, srcstride); dst += dststride; src += srcstride; } }
\
511static void put_vp8_epel ## SIZE ## _v ## TAPS ## _c(uint8_t *dst, \
512 ptrdiff_t dststride, \
513 const uint8_t *src, \
514 ptrdiff_t srcstride, \
515 int h, int mx, int my) \
516{ \
517 const uint8_t *filter = subpel_filters[my - 1]; \
518 const uint8_t *cm = ff_crop_tab + MAX_NEG_CROP1024; \
519 int x, y; \
520 for (y = 0; y < h; y++) { \
521 for (x = 0; x < SIZE; x++) \
522 dst[x] = FILTER_ ## TAPS ## TAP(src, filter, srcstride); \
523 dst += dststride; \
524 src += srcstride; \
525 } \
526}
527
528#define VP8_EPEL_HV(SIZE, HTAPS, VTAPS)static void put_vp8_epelSIZE_hHTAPSvVTAPS_c(uint8_t *dst, ptrdiff_t
dststride, const uint8_t *src, ptrdiff_t srcstride, int h, int
mx, int my) { const uint8_t *filter = subpel_filters[mx - 1]
; const uint8_t *cm = ff_crop_tab + 1024; int x, y; uint8_t tmp_array
[(2 * SIZE + VTAPS - 1) * SIZE]; uint8_t *tmp = tmp_array; src
-= (2 - (VTAPS == 4)) * srcstride; for (y = 0; y < h + VTAPS
- 1; y++) { for (x = 0; x < SIZE; x++) tmp[x] = FILTER_HTAPSTAP
(src, filter, 1); tmp += SIZE; src += srcstride; } tmp = tmp_array
+ (2 - (VTAPS == 4)) * SIZE; filter = subpel_filters[my - 1]
; for (y = 0; y < h; y++) { for (x = 0; x < SIZE; x++) dst
[x] = FILTER_VTAPSTAP(tmp, filter, SIZE); dst += dststride; tmp
+= SIZE; } }
\
529static void \
530put_vp8_epel ## SIZE ## _h ## HTAPS ## v ## VTAPS ## _c(uint8_t *dst, \
531 ptrdiff_t dststride, \
532 const uint8_t *src, \
533 ptrdiff_t srcstride, \
534 int h, int mx, \
535 int my) \
536{ \
537 const uint8_t *filter = subpel_filters[mx - 1]; \
538 const uint8_t *cm = ff_crop_tab + MAX_NEG_CROP1024; \
539 int x, y; \
540 uint8_t tmp_array[(2 * SIZE + VTAPS - 1) * SIZE]; \
541 uint8_t *tmp = tmp_array; \
542 src -= (2 - (VTAPS == 4)) * srcstride; \
543 \
544 for (y = 0; y < h + VTAPS - 1; y++) { \
545 for (x = 0; x < SIZE; x++) \
546 tmp[x] = FILTER_ ## HTAPS ## TAP(src, filter, 1); \
547 tmp += SIZE; \
548 src += srcstride; \
549 } \
550 tmp = tmp_array + (2 - (VTAPS == 4)) * SIZE; \
551 filter = subpel_filters[my - 1]; \
552 \
553 for (y = 0; y < h; y++) { \
554 for (x = 0; x < SIZE; x++) \
555 dst[x] = FILTER_ ## VTAPS ## TAP(tmp, filter, SIZE); \
556 dst += dststride; \
557 tmp += SIZE; \
558 } \
559}
560
561VP8_EPEL_H(8, 4)static void put_vp8_epel8_h4_c(uint8_t *dst, ptrdiff_t dststride
, const uint8_t *src, ptrdiff_t srcstride, int h, int mx, int
my) { const uint8_t *filter = subpel_filters[mx - 1]; const uint8_t
*cm = ff_crop_tab + 1024; int x, y; for (y = 0; y < h; y++
) { for (x = 0; x < 8; x++) dst[x] = cm[(filter[2] * src[x
+ 0 * 1] - filter[1] * src[x - 1 * 1] + filter[3] * src[x + 1
* 1] - filter[4] * src[x + 2 * 1] + 64) >> 7]; dst += dststride
; src += srcstride; } }
562VP8_EPEL_H(4, 4)static void put_vp8_epel4_h4_c(uint8_t *dst, ptrdiff_t dststride
, const uint8_t *src, ptrdiff_t srcstride, int h, int mx, int
my) { const uint8_t *filter = subpel_filters[mx - 1]; const uint8_t
*cm = ff_crop_tab + 1024; int x, y; for (y = 0; y < h; y++
) { for (x = 0; x < 4; x++) dst[x] = cm[(filter[2] * src[x
+ 0 * 1] - filter[1] * src[x - 1 * 1] + filter[3] * src[x + 1
* 1] - filter[4] * src[x + 2 * 1] + 64) >> 7]; dst += dststride
; src += srcstride; } }
563VP8_EPEL_H(16, 6)static void put_vp8_epel16_h6_c(uint8_t *dst, ptrdiff_t dststride
, const uint8_t *src, ptrdiff_t srcstride, int h, int mx, int
my) { const uint8_t *filter = subpel_filters[mx - 1]; const uint8_t
*cm = ff_crop_tab + 1024; int x, y; for (y = 0; y < h; y++
) { for (x = 0; x < 16; x++) dst[x] = cm[(filter[2] * src[
x + 0 * 1] - filter[1] * src[x - 1 * 1] + filter[0] * src[x -
2 * 1] + filter[3] * src[x + 1 * 1] - filter[4] * src[x + 2 *
1] + filter[5] * src[x + 3 * 1] + 64) >> 7]; dst += dststride
; src += srcstride; } }
564VP8_EPEL_H(8, 6)static void put_vp8_epel8_h6_c(uint8_t *dst, ptrdiff_t dststride
, const uint8_t *src, ptrdiff_t srcstride, int h, int mx, int
my) { const uint8_t *filter = subpel_filters[mx - 1]; const uint8_t
*cm = ff_crop_tab + 1024; int x, y; for (y = 0; y < h; y++
) { for (x = 0; x < 8; x++) dst[x] = cm[(filter[2] * src[x
+ 0 * 1] - filter[1] * src[x - 1 * 1] + filter[0] * src[x - 2
* 1] + filter[3] * src[x + 1 * 1] - filter[4] * src[x + 2 * 1
] + filter[5] * src[x + 3 * 1] + 64) >> 7]; dst += dststride
; src += srcstride; } }
565VP8_EPEL_H(4, 6)static void put_vp8_epel4_h6_c(uint8_t *dst, ptrdiff_t dststride
, const uint8_t *src, ptrdiff_t srcstride, int h, int mx, int
my) { const uint8_t *filter = subpel_filters[mx - 1]; const uint8_t
*cm = ff_crop_tab + 1024; int x, y; for (y = 0; y < h; y++
) { for (x = 0; x < 4; x++) dst[x] = cm[(filter[2] * src[x
+ 0 * 1] - filter[1] * src[x - 1 * 1] + filter[0] * src[x - 2
* 1] + filter[3] * src[x + 1 * 1] - filter[4] * src[x + 2 * 1
] + filter[5] * src[x + 3 * 1] + 64) >> 7]; dst += dststride
; src += srcstride; } }
566VP8_EPEL_V(8, 4)static void put_vp8_epel8_v4_c(uint8_t *dst, ptrdiff_t dststride
, const uint8_t *src, ptrdiff_t srcstride, int h, int mx, int
my) { const uint8_t *filter = subpel_filters[my - 1]; const uint8_t
*cm = ff_crop_tab + 1024; int x, y; for (y = 0; y < h; y++
) { for (x = 0; x < 8; x++) dst[x] = cm[(filter[2] * src[x
+ 0 * srcstride] - filter[1] * src[x - 1 * srcstride] + filter
[3] * src[x + 1 * srcstride] - filter[4] * src[x + 2 * srcstride
] + 64) >> 7]; dst += dststride; src += srcstride; } }
567VP8_EPEL_V(4, 4)static void put_vp8_epel4_v4_c(uint8_t *dst, ptrdiff_t dststride
, const uint8_t *src, ptrdiff_t srcstride, int h, int mx, int
my) { const uint8_t *filter = subpel_filters[my - 1]; const uint8_t
*cm = ff_crop_tab + 1024; int x, y; for (y = 0; y < h; y++
) { for (x = 0; x < 4; x++) dst[x] = cm[(filter[2] * src[x
+ 0 * srcstride] - filter[1] * src[x - 1 * srcstride] + filter
[3] * src[x + 1 * srcstride] - filter[4] * src[x + 2 * srcstride
] + 64) >> 7]; dst += dststride; src += srcstride; } }
568VP8_EPEL_V(16, 6)static void put_vp8_epel16_v6_c(uint8_t *dst, ptrdiff_t dststride
, const uint8_t *src, ptrdiff_t srcstride, int h, int mx, int
my) { const uint8_t *filter = subpel_filters[my - 1]; const uint8_t
*cm = ff_crop_tab + 1024; int x, y; for (y = 0; y < h; y++
) { for (x = 0; x < 16; x++) dst[x] = cm[(filter[2] * src[
x + 0 * srcstride] - filter[1] * src[x - 1 * srcstride] + filter
[0] * src[x - 2 * srcstride] + filter[3] * src[x + 1 * srcstride
] - filter[4] * src[x + 2 * srcstride] + filter[5] * src[x + 3
* srcstride] + 64) >> 7]; dst += dststride; src += srcstride
; } }
569VP8_EPEL_V(8, 6)static void put_vp8_epel8_v6_c(uint8_t *dst, ptrdiff_t dststride
, const uint8_t *src, ptrdiff_t srcstride, int h, int mx, int
my) { const uint8_t *filter = subpel_filters[my - 1]; const uint8_t
*cm = ff_crop_tab + 1024; int x, y; for (y = 0; y < h; y++
) { for (x = 0; x < 8; x++) dst[x] = cm[(filter[2] * src[x
+ 0 * srcstride] - filter[1] * src[x - 1 * srcstride] + filter
[0] * src[x - 2 * srcstride] + filter[3] * src[x + 1 * srcstride
] - filter[4] * src[x + 2 * srcstride] + filter[5] * src[x + 3
* srcstride] + 64) >> 7]; dst += dststride; src += srcstride
; } }
570VP8_EPEL_V(4, 6)static void put_vp8_epel4_v6_c(uint8_t *dst, ptrdiff_t dststride
, const uint8_t *src, ptrdiff_t srcstride, int h, int mx, int
my) { const uint8_t *filter = subpel_filters[my - 1]; const uint8_t
*cm = ff_crop_tab + 1024; int x, y; for (y = 0; y < h; y++
) { for (x = 0; x < 4; x++) dst[x] = cm[(filter[2] * src[x
+ 0 * srcstride] - filter[1] * src[x - 1 * srcstride] + filter
[0] * src[x - 2 * srcstride] + filter[3] * src[x + 1 * srcstride
] - filter[4] * src[x + 2 * srcstride] + filter[5] * src[x + 3
* srcstride] + 64) >> 7]; dst += dststride; src += srcstride
; } }
571
572VP8_EPEL_HV(8, 4, 4)static void put_vp8_epel8_h4v4_c(uint8_t *dst, ptrdiff_t dststride
, const uint8_t *src, ptrdiff_t srcstride, int h, int mx, int
my) { const uint8_t *filter = subpel_filters[mx - 1]; const uint8_t
*cm = ff_crop_tab + 1024; int x, y; uint8_t tmp_array[(2 * 8
+ 4 - 1) * 8]; uint8_t *tmp = tmp_array; src -= (2 - (4 == 4
)) * srcstride; for (y = 0; y < h + 4 - 1; y++) { for (x =
0; x < 8; x++) tmp[x] = cm[(filter[2] * src[x + 0 * 1] - filter
[1] * src[x - 1 * 1] + filter[3] * src[x + 1 * 1] - filter[4]
* src[x + 2 * 1] + 64) >> 7]; tmp += 8; src += srcstride
; } tmp = tmp_array + (2 - (4 == 4)) * 8; filter = subpel_filters
[my - 1]; for (y = 0; y < h; y++) { for (x = 0; x < 8; x
++) dst[x] = cm[(filter[2] * tmp[x + 0 * 8] - filter[1] * tmp
[x - 1 * 8] + filter[3] * tmp[x + 1 * 8] - filter[4] * tmp[x +
2 * 8] + 64) >> 7]; dst += dststride; tmp += 8; } }
573VP8_EPEL_HV(4, 4, 4)static void put_vp8_epel4_h4v4_c(uint8_t *dst, ptrdiff_t dststride
, const uint8_t *src, ptrdiff_t srcstride, int h, int mx, int
my) { const uint8_t *filter = subpel_filters[mx - 1]; const uint8_t
*cm = ff_crop_tab + 1024; int x, y; uint8_t tmp_array[(2 * 4
+ 4 - 1) * 4]; uint8_t *tmp = tmp_array; src -= (2 - (4 == 4
)) * srcstride; for (y = 0; y < h + 4 - 1; y++) { for (x =
0; x < 4; x++) tmp[x] = cm[(filter[2] * src[x + 0 * 1] - filter
[1] * src[x - 1 * 1] + filter[3] * src[x + 1 * 1] - filter[4]
* src[x + 2 * 1] + 64) >> 7]; tmp += 4; src += srcstride
; } tmp = tmp_array + (2 - (4 == 4)) * 4; filter = subpel_filters
[my - 1]; for (y = 0; y < h; y++) { for (x = 0; x < 4; x
++) dst[x] = cm[(filter[2] * tmp[x + 0 * 4] - filter[1] * tmp
[x - 1 * 4] + filter[3] * tmp[x + 1 * 4] - filter[4] * tmp[x +
2 * 4] + 64) >> 7]; dst += dststride; tmp += 4; } }
574VP8_EPEL_HV(8, 4, 6)static void put_vp8_epel8_h4v6_c(uint8_t *dst, ptrdiff_t dststride
, const uint8_t *src, ptrdiff_t srcstride, int h, int mx, int
my) { const uint8_t *filter = subpel_filters[mx - 1]; const uint8_t
*cm = ff_crop_tab + 1024; int x, y; uint8_t tmp_array[(2 * 8
+ 6 - 1) * 8]; uint8_t *tmp = tmp_array; src -= (2 - (6 == 4
)) * srcstride; for (y = 0; y < h + 6 - 1; y++) { for (x =
0; x < 8; x++) tmp[x] = cm[(filter[2] * src[x + 0 * 1] - filter
[1] * src[x - 1 * 1] + filter[3] * src[x + 1 * 1] - filter[4]
* src[x + 2 * 1] + 64) >> 7]; tmp += 8; src += srcstride
; } tmp = tmp_array + (2 - (6 == 4)) * 8; filter = subpel_filters
[my - 1]; for (y = 0; y < h; y++) { for (x = 0; x < 8; x
++) dst[x] = cm[(filter[2] * tmp[x + 0 * 8] - filter[1] * tmp
[x - 1 * 8] + filter[0] * tmp[x - 2 * 8] + filter[3] * tmp[x +
1 * 8] - filter[4] * tmp[x + 2 * 8] + filter[5] * tmp[x + 3 *
8] + 64) >> 7]; dst += dststride; tmp += 8; } }
575VP8_EPEL_HV(4, 4, 6)static void put_vp8_epel4_h4v6_c(uint8_t *dst, ptrdiff_t dststride
, const uint8_t *src, ptrdiff_t srcstride, int h, int mx, int
my) { const uint8_t *filter = subpel_filters[mx - 1]; const uint8_t
*cm = ff_crop_tab + 1024; int x, y; uint8_t tmp_array[(2 * 4
+ 6 - 1) * 4]; uint8_t *tmp = tmp_array; src -= (2 - (6 == 4
)) * srcstride; for (y = 0; y < h + 6 - 1; y++) { for (x =
0; x < 4; x++) tmp[x] = cm[(filter[2] * src[x + 0 * 1] - filter
[1] * src[x - 1 * 1] + filter[3] * src[x + 1 * 1] - filter[4]
* src[x + 2 * 1] + 64) >> 7]; tmp += 4; src += srcstride
; } tmp = tmp_array + (2 - (6 == 4)) * 4; filter = subpel_filters
[my - 1]; for (y = 0; y < h; y++) { for (x = 0; x < 4; x
++) dst[x] = cm[(filter[2] * tmp[x + 0 * 4] - filter[1] * tmp
[x - 1 * 4] + filter[0] * tmp[x - 2 * 4] + filter[3] * tmp[x +
1 * 4] - filter[4] * tmp[x + 2 * 4] + filter[5] * tmp[x + 3 *
4] + 64) >> 7]; dst += dststride; tmp += 4; } }
1
Assuming the condition is false
2
Loop condition is false. Execution continues on line 575
3
Assuming 'y' is < 'h'
4
Loop condition is true. Entering loop body
5
Loop condition is true. Entering loop body
6
The right operand of '*' is a garbage value
576VP8_EPEL_HV(8, 6, 4)static void put_vp8_epel8_h6v4_c(uint8_t *dst, ptrdiff_t dststride
, const uint8_t *src, ptrdiff_t srcstride, int h, int mx, int
my) { const uint8_t *filter = subpel_filters[mx - 1]; const uint8_t
*cm = ff_crop_tab + 1024; int x, y; uint8_t tmp_array[(2 * 8
+ 4 - 1) * 8]; uint8_t *tmp = tmp_array; src -= (2 - (4 == 4
)) * srcstride; for (y = 0; y < h + 4 - 1; y++) { for (x =
0; x < 8; x++) tmp[x] = cm[(filter[2] * src[x + 0 * 1] - filter
[1] * src[x - 1 * 1] + filter[0] * src[x - 2 * 1] + filter[3]
* src[x + 1 * 1] - filter[4] * src[x + 2 * 1] + filter[5] * src
[x + 3 * 1] + 64) >> 7]; tmp += 8; src += srcstride; } tmp
= tmp_array + (2 - (4 == 4)) * 8; filter = subpel_filters[my
- 1]; for (y = 0; y < h; y++) { for (x = 0; x < 8; x++
) dst[x] = cm[(filter[2] * tmp[x + 0 * 8] - filter[1] * tmp[x
- 1 * 8] + filter[3] * tmp[x + 1 * 8] - filter[4] * tmp[x + 2
* 8] + 64) >> 7]; dst += dststride; tmp += 8; } }
577VP8_EPEL_HV(4, 6, 4)static void put_vp8_epel4_h6v4_c(uint8_t *dst, ptrdiff_t dststride
, const uint8_t *src, ptrdiff_t srcstride, int h, int mx, int
my) { const uint8_t *filter = subpel_filters[mx - 1]; const uint8_t
*cm = ff_crop_tab + 1024; int x, y; uint8_t tmp_array[(2 * 4
+ 4 - 1) * 4]; uint8_t *tmp = tmp_array; src -= (2 - (4 == 4
)) * srcstride; for (y = 0; y < h + 4 - 1; y++) { for (x =
0; x < 4; x++) tmp[x] = cm[(filter[2] * src[x + 0 * 1] - filter
[1] * src[x - 1 * 1] + filter[0] * src[x - 2 * 1] + filter[3]
* src[x + 1 * 1] - filter[4] * src[x + 2 * 1] + filter[5] * src
[x + 3 * 1] + 64) >> 7]; tmp += 4; src += srcstride; } tmp
= tmp_array + (2 - (4 == 4)) * 4; filter = subpel_filters[my
- 1]; for (y = 0; y < h; y++) { for (x = 0; x < 4; x++
) dst[x] = cm[(filter[2] * tmp[x + 0 * 4] - filter[1] * tmp[x
- 1 * 4] + filter[3] * tmp[x + 1 * 4] - filter[4] * tmp[x + 2
* 4] + 64) >> 7]; dst += dststride; tmp += 4; } }
578VP8_EPEL_HV(16, 6, 6)static void put_vp8_epel16_h6v6_c(uint8_t *dst, ptrdiff_t dststride
, const uint8_t *src, ptrdiff_t srcstride, int h, int mx, int
my) { const uint8_t *filter = subpel_filters[mx - 1]; const uint8_t
*cm = ff_crop_tab + 1024; int x, y; uint8_t tmp_array[(2 * 16
+ 6 - 1) * 16]; uint8_t *tmp = tmp_array; src -= (2 - (6 == 4
)) * srcstride; for (y = 0; y < h + 6 - 1; y++) { for (x =
0; x < 16; x++) tmp[x] = cm[(filter[2] * src[x + 0 * 1] -
filter[1] * src[x - 1 * 1] + filter[0] * src[x - 2 * 1] + filter
[3] * src[x + 1 * 1] - filter[4] * src[x + 2 * 1] + filter[5]
* src[x + 3 * 1] + 64) >> 7]; tmp += 16; src += srcstride
; } tmp = tmp_array + (2 - (6 == 4)) * 16; filter = subpel_filters
[my - 1]; for (y = 0; y < h; y++) { for (x = 0; x < 16;
x++) dst[x] = cm[(filter[2] * tmp[x + 0 * 16] - filter[1] * tmp
[x - 1 * 16] + filter[0] * tmp[x - 2 * 16] + filter[3] * tmp[
x + 1 * 16] - filter[4] * tmp[x + 2 * 16] + filter[5] * tmp[x
+ 3 * 16] + 64) >> 7]; dst += dststride; tmp += 16; } }
579VP8_EPEL_HV(8, 6, 6)static void put_vp8_epel8_h6v6_c(uint8_t *dst, ptrdiff_t dststride
, const uint8_t *src, ptrdiff_t srcstride, int h, int mx, int
my) { const uint8_t *filter = subpel_filters[mx - 1]; const uint8_t
*cm = ff_crop_tab + 1024; int x, y; uint8_t tmp_array[(2 * 8
+ 6 - 1) * 8]; uint8_t *tmp = tmp_array; src -= (2 - (6 == 4
)) * srcstride; for (y = 0; y < h + 6 - 1; y++) { for (x =
0; x < 8; x++) tmp[x] = cm[(filter[2] * src[x + 0 * 1] - filter
[1] * src[x - 1 * 1] + filter[0] * src[x - 2 * 1] + filter[3]
* src[x + 1 * 1] - filter[4] * src[x + 2 * 1] + filter[5] * src
[x + 3 * 1] + 64) >> 7]; tmp += 8; src += srcstride; } tmp
= tmp_array + (2 - (6 == 4)) * 8; filter = subpel_filters[my
- 1]; for (y = 0; y < h; y++) { for (x = 0; x < 8; x++
) dst[x] = cm[(filter[2] * tmp[x + 0 * 8] - filter[1] * tmp[x
- 1 * 8] + filter[0] * tmp[x - 2 * 8] + filter[3] * tmp[x + 1
* 8] - filter[4] * tmp[x + 2 * 8] + filter[5] * tmp[x + 3 * 8
] + 64) >> 7]; dst += dststride; tmp += 8; } }
580VP8_EPEL_HV(4, 6, 6)static void put_vp8_epel4_h6v6_c(uint8_t *dst, ptrdiff_t dststride
, const uint8_t *src, ptrdiff_t srcstride, int h, int mx, int
my) { const uint8_t *filter = subpel_filters[mx - 1]; const uint8_t
*cm = ff_crop_tab + 1024; int x, y; uint8_t tmp_array[(2 * 4
+ 6 - 1) * 4]; uint8_t *tmp = tmp_array; src -= (2 - (6 == 4
)) * srcstride; for (y = 0; y < h + 6 - 1; y++) { for (x =
0; x < 4; x++) tmp[x] = cm[(filter[2] * src[x + 0 * 1] - filter
[1] * src[x - 1 * 1] + filter[0] * src[x - 2 * 1] + filter[3]
* src[x + 1 * 1] - filter[4] * src[x + 2 * 1] + filter[5] * src
[x + 3 * 1] + 64) >> 7]; tmp += 4; src += srcstride; } tmp
= tmp_array + (2 - (6 == 4)) * 4; filter = subpel_filters[my
- 1]; for (y = 0; y < h; y++) { for (x = 0; x < 4; x++
) dst[x] = cm[(filter[2] * tmp[x + 0 * 4] - filter[1] * tmp[x
- 1 * 4] + filter[0] * tmp[x - 2 * 4] + filter[3] * tmp[x + 1
* 4] - filter[4] * tmp[x + 2 * 4] + filter[5] * tmp[x + 3 * 4
] + 64) >> 7]; dst += dststride; tmp += 4; } }
581
582#define VP8_BILINEAR(SIZE)static void put_vp8_bilinearSIZE_h_c(uint8_t *dst, ptrdiff_t dstride
, const uint8_t *src, ptrdiff_t sstride, int h, int mx, int my
) { int a = 8 - mx, b = mx; int x, y; for (y = 0; y < h; y
++) { for (x = 0; x < SIZE; x++) dst[x] = (a * src[x] + b *
src[x + 1] + 4) >> 3; dst += dstride; src += sstride; }
} static void put_vp8_bilinearSIZE_v_c(uint8_t *dst, ptrdiff_t
dstride, const uint8_t *src, ptrdiff_t sstride, int h, int mx
, int my) { int c = 8 - my, d = my; int x, y; for (y = 0; y <
h; y++) { for (x = 0; x < SIZE; x++) dst[x] = (c * src[x]
+ d * src[x + sstride] + 4) >> 3; dst += dstride; src +=
sstride; } } static void put_vp8_bilinearSIZE_hv_c(uint8_t *
dst, ptrdiff_t dstride, const uint8_t *src, ptrdiff_t sstride
, int h, int mx, int my) { int a = 8 - mx, b = mx; int c = 8 -
my, d = my; int x, y; uint8_t tmp_array[(2 * SIZE + 1) * SIZE
]; uint8_t *tmp = tmp_array; for (y = 0; y < h + 1; y++) {
for (x = 0; x < SIZE; x++) tmp[x] = (a * src[x] + b * src
[x + 1] + 4) >> 3; tmp += SIZE; src += sstride; } tmp =
tmp_array; for (y = 0; y < h; y++) { for (x = 0; x < SIZE
; x++) dst[x] = (c * tmp[x] + d * tmp[x + SIZE] + 4) >>
3; dst += dstride; tmp += SIZE; } }
\
583static void put_vp8_bilinear ## SIZE ## _h_c(uint8_t *dst, ptrdiff_t dstride, \
584 const uint8_t *src, ptrdiff_t sstride, \
585 int h, int mx, int my) \
586{ \
587 int a = 8 - mx, b = mx; \
588 int x, y; \
589 for (y = 0; y < h; y++) { \
590 for (x = 0; x < SIZE; x++) \
591 dst[x] = (a * src[x] + b * src[x + 1] + 4) >> 3; \
592 dst += dstride; \
593 src += sstride; \
594 } \
595} \
596 \
597static void put_vp8_bilinear ## SIZE ## _v_c(uint8_t *dst, ptrdiff_t dstride, \
598 const uint8_t *src, ptrdiff_t sstride, \
599 int h, int mx, int my) \
600{ \
601 int c = 8 - my, d = my; \
602 int x, y; \
603 for (y = 0; y < h; y++) { \
604 for (x = 0; x < SIZE; x++) \
605 dst[x] = (c * src[x] + d * src[x + sstride] + 4) >> 3; \
606 dst += dstride; \
607 src += sstride; \
608 } \
609} \
610 \
611static void put_vp8_bilinear ## SIZE ## _hv_c(uint8_t *dst, \
612 ptrdiff_t dstride, \
613 const uint8_t *src, \
614 ptrdiff_t sstride, \
615 int h, int mx, int my) \
616{ \
617 int a = 8 - mx, b = mx; \
618 int c = 8 - my, d = my; \
619 int x, y; \
620 uint8_t tmp_array[(2 * SIZE + 1) * SIZE]; \
621 uint8_t *tmp = tmp_array; \
622 for (y = 0; y < h + 1; y++) { \
623 for (x = 0; x < SIZE; x++) \
624 tmp[x] = (a * src[x] + b * src[x + 1] + 4) >> 3; \
625 tmp += SIZE; \
626 src += sstride; \
627 } \
628 tmp = tmp_array; \
629 for (y = 0; y < h; y++) { \
630 for (x = 0; x < SIZE; x++) \
631 dst[x] = (c * tmp[x] + d * tmp[x + SIZE] + 4) >> 3; \
632 dst += dstride; \
633 tmp += SIZE; \
634 } \
635}
636
637VP8_BILINEAR(16)static void put_vp8_bilinear16_h_c(uint8_t *dst, ptrdiff_t dstride
, const uint8_t *src, ptrdiff_t sstride, int h, int mx, int my
) { int a = 8 - mx, b = mx; int x, y; for (y = 0; y < h; y
++) { for (x = 0; x < 16; x++) dst[x] = (a * src[x] + b * src
[x + 1] + 4) >> 3; dst += dstride; src += sstride; } } static
void put_vp8_bilinear16_v_c(uint8_t *dst, ptrdiff_t dstride,
const uint8_t *src, ptrdiff_t sstride, int h, int mx, int my
) { int c = 8 - my, d = my; int x, y; for (y = 0; y < h; y
++) { for (x = 0; x < 16; x++) dst[x] = (c * src[x] + d * src
[x + sstride] + 4) >> 3; dst += dstride; src += sstride
; } } static void put_vp8_bilinear16_hv_c(uint8_t *dst, ptrdiff_t
dstride, const uint8_t *src, ptrdiff_t sstride, int h, int mx
, int my) { int a = 8 - mx, b = mx; int c = 8 - my, d = my; int
x, y; uint8_t tmp_array[(2 * 16 + 1) * 16]; uint8_t *tmp = tmp_array
; for (y = 0; y < h + 1; y++) { for (x = 0; x < 16; x++
) tmp[x] = (a * src[x] + b * src[x + 1] + 4) >> 3; tmp +=
16; src += sstride; } tmp = tmp_array; for (y = 0; y < h;
y++) { for (x = 0; x < 16; x++) dst[x] = (c * tmp[x] + d *
tmp[x + 16] + 4) >> 3; dst += dstride; tmp += 16; } }
638VP8_BILINEAR(8)static void put_vp8_bilinear8_h_c(uint8_t *dst, ptrdiff_t dstride
, const uint8_t *src, ptrdiff_t sstride, int h, int mx, int my
) { int a = 8 - mx, b = mx; int x, y; for (y = 0; y < h; y
++) { for (x = 0; x < 8; x++) dst[x] = (a * src[x] + b * src
[x + 1] + 4) >> 3; dst += dstride; src += sstride; } } static
void put_vp8_bilinear8_v_c(uint8_t *dst, ptrdiff_t dstride, const
uint8_t *src, ptrdiff_t sstride, int h, int mx, int my) { int
c = 8 - my, d = my; int x, y; for (y = 0; y < h; y++) { for
(x = 0; x < 8; x++) dst[x] = (c * src[x] + d * src[x + sstride
] + 4) >> 3; dst += dstride; src += sstride; } } static
void put_vp8_bilinear8_hv_c(uint8_t *dst, ptrdiff_t dstride,
const uint8_t *src, ptrdiff_t sstride, int h, int mx, int my
) { int a = 8 - mx, b = mx; int c = 8 - my, d = my; int x, y;
uint8_t tmp_array[(2 * 8 + 1) * 8]; uint8_t *tmp = tmp_array
; for (y = 0; y < h + 1; y++) { for (x = 0; x < 8; x++)
tmp[x] = (a * src[x] + b * src[x + 1] + 4) >> 3; tmp +=
8; src += sstride; } tmp = tmp_array; for (y = 0; y < h; y
++) { for (x = 0; x < 8; x++) dst[x] = (c * tmp[x] + d * tmp
[x + 8] + 4) >> 3; dst += dstride; tmp += 8; } }
639VP8_BILINEAR(4)static void put_vp8_bilinear4_h_c(uint8_t *dst, ptrdiff_t dstride
, const uint8_t *src, ptrdiff_t sstride, int h, int mx, int my
) { int a = 8 - mx, b = mx; int x, y; for (y = 0; y < h; y
++) { for (x = 0; x < 4; x++) dst[x] = (a * src[x] + b * src
[x + 1] + 4) >> 3; dst += dstride; src += sstride; } } static
void put_vp8_bilinear4_v_c(uint8_t *dst, ptrdiff_t dstride, const
uint8_t *src, ptrdiff_t sstride, int h, int mx, int my) { int
c = 8 - my, d = my; int x, y; for (y = 0; y < h; y++) { for
(x = 0; x < 4; x++) dst[x] = (c * src[x] + d * src[x + sstride
] + 4) >> 3; dst += dstride; src += sstride; } } static
void put_vp8_bilinear4_hv_c(uint8_t *dst, ptrdiff_t dstride,
const uint8_t *src, ptrdiff_t sstride, int h, int mx, int my
) { int a = 8 - mx, b = mx; int c = 8 - my, d = my; int x, y;
uint8_t tmp_array[(2 * 4 + 1) * 4]; uint8_t *tmp = tmp_array
; for (y = 0; y < h + 1; y++) { for (x = 0; x < 4; x++)
tmp[x] = (a * src[x] + b * src[x + 1] + 4) >> 3; tmp +=
4; src += sstride; } tmp = tmp_array; for (y = 0; y < h; y
++) { for (x = 0; x < 4; x++) dst[x] = (c * tmp[x] + d * tmp
[x + 4] + 4) >> 3; dst += dstride; tmp += 4; } }
640
641#define VP78_MC_FUNC(IDX, SIZE)dsp->put_vp8_epel_pixels_tab[IDX][0][0] = put_vp8_pixelsSIZE_c
; dsp->put_vp8_epel_pixels_tab[IDX][0][1] = put_vp8_epelSIZE_h4_c
; dsp->put_vp8_epel_pixels_tab[IDX][0][2] = put_vp8_epelSIZE_h6_c
; dsp->put_vp8_epel_pixels_tab[IDX][1][0] = put_vp8_epelSIZE_v4_c
; dsp->put_vp8_epel_pixels_tab[IDX][1][1] = put_vp8_epelSIZE_h4v4_c
; dsp->put_vp8_epel_pixels_tab[IDX][1][2] = put_vp8_epelSIZE_h6v4_c
; dsp->put_vp8_epel_pixels_tab[IDX][2][0] = put_vp8_epelSIZE_v6_c
; dsp->put_vp8_epel_pixels_tab[IDX][2][1] = put_vp8_epelSIZE_h4v6_c
; dsp->put_vp8_epel_pixels_tab[IDX][2][2] = put_vp8_epelSIZE_h6v6_c
\
642 dsp->put_vp8_epel_pixels_tab[IDX][0][0] = put_vp8_pixels ## SIZE ## _c; \
643 dsp->put_vp8_epel_pixels_tab[IDX][0][1] = put_vp8_epel ## SIZE ## _h4_c; \
644 dsp->put_vp8_epel_pixels_tab[IDX][0][2] = put_vp8_epel ## SIZE ## _h6_c; \
645 dsp->put_vp8_epel_pixels_tab[IDX][1][0] = put_vp8_epel ## SIZE ## _v4_c; \
646 dsp->put_vp8_epel_pixels_tab[IDX][1][1] = put_vp8_epel ## SIZE ## _h4v4_c; \
647 dsp->put_vp8_epel_pixels_tab[IDX][1][2] = put_vp8_epel ## SIZE ## _h6v4_c; \
648 dsp->put_vp8_epel_pixels_tab[IDX][2][0] = put_vp8_epel ## SIZE ## _v6_c; \
649 dsp->put_vp8_epel_pixels_tab[IDX][2][1] = put_vp8_epel ## SIZE ## _h4v6_c; \
650 dsp->put_vp8_epel_pixels_tab[IDX][2][2] = put_vp8_epel ## SIZE ## _h6v6_c
651
652#define VP78_BILINEAR_MC_FUNC(IDX, SIZE)dsp->put_vp8_bilinear_pixels_tab[IDX][0][0] = put_vp8_pixelsSIZE_c
; dsp->put_vp8_bilinear_pixels_tab[IDX][0][1] = put_vp8_bilinearSIZE_h_c
; dsp->put_vp8_bilinear_pixels_tab[IDX][0][2] = put_vp8_bilinearSIZE_h_c
; dsp->put_vp8_bilinear_pixels_tab[IDX][1][0] = put_vp8_bilinearSIZE_v_c
; dsp->put_vp8_bilinear_pixels_tab[IDX][1][1] = put_vp8_bilinearSIZE_hv_c
; dsp->put_vp8_bilinear_pixels_tab[IDX][1][2] = put_vp8_bilinearSIZE_hv_c
; dsp->put_vp8_bilinear_pixels_tab[IDX][2][0] = put_vp8_bilinearSIZE_v_c
; dsp->put_vp8_bilinear_pixels_tab[IDX][2][1] = put_vp8_bilinearSIZE_hv_c
; dsp->put_vp8_bilinear_pixels_tab[IDX][2][2] = put_vp8_bilinearSIZE_hv_c
\
653 dsp->put_vp8_bilinear_pixels_tab[IDX][0][0] = put_vp8_pixels ## SIZE ## _c; \
654 dsp->put_vp8_bilinear_pixels_tab[IDX][0][1] = put_vp8_bilinear ## SIZE ## _h_c; \
655 dsp->put_vp8_bilinear_pixels_tab[IDX][0][2] = put_vp8_bilinear ## SIZE ## _h_c; \
656 dsp->put_vp8_bilinear_pixels_tab[IDX][1][0] = put_vp8_bilinear ## SIZE ## _v_c; \
657 dsp->put_vp8_bilinear_pixels_tab[IDX][1][1] = put_vp8_bilinear ## SIZE ## _hv_c; \
658 dsp->put_vp8_bilinear_pixels_tab[IDX][1][2] = put_vp8_bilinear ## SIZE ## _hv_c; \
659 dsp->put_vp8_bilinear_pixels_tab[IDX][2][0] = put_vp8_bilinear ## SIZE ## _v_c; \
660 dsp->put_vp8_bilinear_pixels_tab[IDX][2][1] = put_vp8_bilinear ## SIZE ## _hv_c; \
661 dsp->put_vp8_bilinear_pixels_tab[IDX][2][2] = put_vp8_bilinear ## SIZE ## _hv_c
662
663av_cold__attribute__((cold)) void ff_vp78dsp_init(VP8DSPContext *dsp)
664{
665 dsp->put_vp8_epel_pixels_tab[0][0][0] = put_vp8_pixels16_c;
666 dsp->put_vp8_epel_pixels_tab[0][0][2] = put_vp8_epel16_h6_c;
667 dsp->put_vp8_epel_pixels_tab[0][2][0] = put_vp8_epel16_v6_c;
668 dsp->put_vp8_epel_pixels_tab[0][2][2] = put_vp8_epel16_h6v6_c;
669
670 VP78_MC_FUNC(1, 8)dsp->put_vp8_epel_pixels_tab[1][0][0] = put_vp8_pixels8_c;
dsp->put_vp8_epel_pixels_tab[1][0][1] = put_vp8_epel8_h4_c
; dsp->put_vp8_epel_pixels_tab[1][0][2] = put_vp8_epel8_h6_c
; dsp->put_vp8_epel_pixels_tab[1][1][0] = put_vp8_epel8_v4_c
; dsp->put_vp8_epel_pixels_tab[1][1][1] = put_vp8_epel8_h4v4_c
; dsp->put_vp8_epel_pixels_tab[1][1][2] = put_vp8_epel8_h6v4_c
; dsp->put_vp8_epel_pixels_tab[1][2][0] = put_vp8_epel8_v6_c
; dsp->put_vp8_epel_pixels_tab[1][2][1] = put_vp8_epel8_h4v6_c
; dsp->put_vp8_epel_pixels_tab[1][2][2] = put_vp8_epel8_h6v6_c
;
671 VP78_MC_FUNC(2, 4)dsp->put_vp8_epel_pixels_tab[2][0][0] = put_vp8_pixels4_c;
dsp->put_vp8_epel_pixels_tab[2][0][1] = put_vp8_epel4_h4_c
; dsp->put_vp8_epel_pixels_tab[2][0][2] = put_vp8_epel4_h6_c
; dsp->put_vp8_epel_pixels_tab[2][1][0] = put_vp8_epel4_v4_c
; dsp->put_vp8_epel_pixels_tab[2][1][1] = put_vp8_epel4_h4v4_c
; dsp->put_vp8_epel_pixels_tab[2][1][2] = put_vp8_epel4_h6v4_c
; dsp->put_vp8_epel_pixels_tab[2][2][0] = put_vp8_epel4_v6_c
; dsp->put_vp8_epel_pixels_tab[2][2][1] = put_vp8_epel4_h4v6_c
; dsp->put_vp8_epel_pixels_tab[2][2][2] = put_vp8_epel4_h6v6_c
;
672
673 VP78_BILINEAR_MC_FUNC(0, 16)dsp->put_vp8_bilinear_pixels_tab[0][0][0] = put_vp8_pixels16_c
; dsp->put_vp8_bilinear_pixels_tab[0][0][1] = put_vp8_bilinear16_h_c
; dsp->put_vp8_bilinear_pixels_tab[0][0][2] = put_vp8_bilinear16_h_c
; dsp->put_vp8_bilinear_pixels_tab[0][1][0] = put_vp8_bilinear16_v_c
; dsp->put_vp8_bilinear_pixels_tab[0][1][1] = put_vp8_bilinear16_hv_c
; dsp->put_vp8_bilinear_pixels_tab[0][1][2] = put_vp8_bilinear16_hv_c
; dsp->put_vp8_bilinear_pixels_tab[0][2][0] = put_vp8_bilinear16_v_c
; dsp->put_vp8_bilinear_pixels_tab[0][2][1] = put_vp8_bilinear16_hv_c
; dsp->put_vp8_bilinear_pixels_tab[0][2][2] = put_vp8_bilinear16_hv_c
;
674 VP78_BILINEAR_MC_FUNC(1, 8)dsp->put_vp8_bilinear_pixels_tab[1][0][0] = put_vp8_pixels8_c
; dsp->put_vp8_bilinear_pixels_tab[1][0][1] = put_vp8_bilinear8_h_c
; dsp->put_vp8_bilinear_pixels_tab[1][0][2] = put_vp8_bilinear8_h_c
; dsp->put_vp8_bilinear_pixels_tab[1][1][0] = put_vp8_bilinear8_v_c
; dsp->put_vp8_bilinear_pixels_tab[1][1][1] = put_vp8_bilinear8_hv_c
; dsp->put_vp8_bilinear_pixels_tab[1][1][2] = put_vp8_bilinear8_hv_c
; dsp->put_vp8_bilinear_pixels_tab[1][2][0] = put_vp8_bilinear8_v_c
; dsp->put_vp8_bilinear_pixels_tab[1][2][1] = put_vp8_bilinear8_hv_c
; dsp->put_vp8_bilinear_pixels_tab[1][2][2] = put_vp8_bilinear8_hv_c
;
675 VP78_BILINEAR_MC_FUNC(2, 4)dsp->put_vp8_bilinear_pixels_tab[2][0][0] = put_vp8_pixels4_c
; dsp->put_vp8_bilinear_pixels_tab[2][0][1] = put_vp8_bilinear4_h_c
; dsp->put_vp8_bilinear_pixels_tab[2][0][2] = put_vp8_bilinear4_h_c
; dsp->put_vp8_bilinear_pixels_tab[2][1][0] = put_vp8_bilinear4_v_c
; dsp->put_vp8_bilinear_pixels_tab[2][1][1] = put_vp8_bilinear4_hv_c
; dsp->put_vp8_bilinear_pixels_tab[2][1][2] = put_vp8_bilinear4_hv_c
; dsp->put_vp8_bilinear_pixels_tab[2][2][0] = put_vp8_bilinear4_v_c
; dsp->put_vp8_bilinear_pixels_tab[2][2][1] = put_vp8_bilinear4_hv_c
; dsp->put_vp8_bilinear_pixels_tab[2][2][2] = put_vp8_bilinear4_hv_c
;
676
677#if ARCH_AARCH640
678 ff_vp78dsp_init_aarch64(dsp);
679#elif ARCH_ARM0
680 ff_vp78dsp_init_arm(dsp);
681#elif ARCH_PPC0
682 ff_vp78dsp_init_ppc(dsp);
683#elif ARCH_RISCV0
684 ff_vp78dsp_init_riscv(dsp);
685#elif ARCH_X861 && HAVE_X86ASM1
686 ff_vp78dsp_init_x86(dsp);
687#endif
688}
689
690#if CONFIG_VP7_DECODER0
691LOOP_FILTERS(vp7)static void vp7_v_loop_filter16_c(uint8_t *dst, ptrdiff_t stride
, int flim_E, int flim_I, int hev_thresh) { int i; for (i = 0
; i < 16; i++) if (vp7_normal_limit(dst + i * 1, stride, flim_E
, flim_I)) { if (hev(dst + i * 1, stride, hev_thresh)) vp7_filter_common
(dst + i * 1, stride, 1); else filter_mbedge(dst + i * 1, stride
); } } static void vp7_v_loop_filter16_inner_c(uint8_t *dst, ptrdiff_t
stride, int flim_E, int flim_I, int hev_thresh) { int i; for
(i = 0; i < 16; i++) if (vp7_normal_limit(dst + i * 1, stride
, flim_E, flim_I)) { int hv = hev(dst + i * 1, stride, hev_thresh
); if (hv) vp7_filter_common(dst + i * 1, stride, 1); else vp7_filter_common
(dst + i * 1, stride, 0); } } static void vp7_h_loop_filter16_c
(uint8_t *dst, ptrdiff_t stride, int flim_E, int flim_I, int hev_thresh
) { int i; for (i = 0; i < 16; i++) if (vp7_normal_limit(dst
+ i * stride, 1, flim_E, flim_I)) { if (hev(dst + i * stride
, 1, hev_thresh)) vp7_filter_common(dst + i * stride, 1, 1); else
filter_mbedge(dst + i * stride, 1); } } static void vp7_h_loop_filter16_inner_c
(uint8_t *dst, ptrdiff_t stride, int flim_E, int flim_I, int hev_thresh
) { int i; for (i = 0; i < 16; i++) if (vp7_normal_limit(dst
+ i * stride, 1, flim_E, flim_I)) { int hv = hev(dst + i * stride
, 1, hev_thresh); if (hv) vp7_filter_common(dst + i * stride,
1, 1); else vp7_filter_common(dst + i * stride, 1, 0); } } static
__attribute__((always_inline)) inline void vp7_v_loop_filter8_c
(uint8_t *dst, ptrdiff_t stride, int flim_E, int flim_I, int hev_thresh
) { int i; for (i = 0; i < 8; i++) if (vp7_normal_limit(dst
+ i * 1, stride, flim_E, flim_I)) { if (hev(dst + i * 1, stride
, hev_thresh)) vp7_filter_common(dst + i * 1, stride, 1); else
filter_mbedge(dst + i * 1, stride); } } static __attribute__
((always_inline)) inline void vp7_v_loop_filter8_inner_c(uint8_t
*dst, ptrdiff_t stride, int flim_E, int flim_I, int hev_thresh
) { int i; for (i = 0; i < 8; i++) if (vp7_normal_limit(dst
+ i * 1, stride, flim_E, flim_I)) { int hv = hev(dst + i * 1
, stride, hev_thresh); if (hv) vp7_filter_common(dst + i * 1,
stride, 1); else vp7_filter_common(dst + i * 1, stride, 0); }
} static void vp7_v_loop_filter8uv_c(uint8_t *dstU, uint8_t *
dstV, ptrdiff_t stride, int fE, int fI, int hev_thresh) { vp7_v_loop_filter8_c
(dstU, stride, fE, fI, hev_thresh); vp7_v_loop_filter8_c(dstV
, stride, fE, fI, hev_thresh); } static void vp7_v_loop_filter8uv_inner_c
(uint8_t *dstU, uint8_t *dstV, ptrdiff_t stride, int fE, int fI
, int hev_thresh) { vp7_v_loop_filter8_inner_c(dstU, stride, fE
, fI, hev_thresh); vp7_v_loop_filter8_inner_c(dstV, stride, fE
, fI, hev_thresh); } static __attribute__((always_inline)) inline
void vp7_h_loop_filter8_c(uint8_t *dst, ptrdiff_t stride, int
flim_E, int flim_I, int hev_thresh) { int i; for (i = 0; i <
8; i++) if (vp7_normal_limit(dst + i * stride, 1, flim_E, flim_I
)) { if (hev(dst + i * stride, 1, hev_thresh)) vp7_filter_common
(dst + i * stride, 1, 1); else filter_mbedge(dst + i * stride
, 1); } } static __attribute__((always_inline)) inline void vp7_h_loop_filter8_inner_c
(uint8_t *dst, ptrdiff_t stride, int flim_E, int flim_I, int hev_thresh
) { int i; for (i = 0; i < 8; i++) if (vp7_normal_limit(dst
+ i * stride, 1, flim_E, flim_I)) { int hv = hev(dst + i * stride
, 1, hev_thresh); if (hv) vp7_filter_common(dst + i * stride,
1, 1); else vp7_filter_common(dst + i * stride, 1, 0); } } static
void vp7_h_loop_filter8uv_c(uint8_t *dstU, uint8_t *dstV, ptrdiff_t
stride, int fE, int fI, int hev_thresh) { vp7_h_loop_filter8_c
(dstU, stride, fE, fI, hev_thresh); vp7_h_loop_filter8_c(dstV
, stride, fE, fI, hev_thresh); } static void vp7_h_loop_filter8uv_inner_c
(uint8_t *dstU, uint8_t *dstV, ptrdiff_t stride, int fE, int fI
, int hev_thresh) { vp7_h_loop_filter8_inner_c(dstU, stride, fE
, fI, hev_thresh); vp7_h_loop_filter8_inner_c(dstV, stride, fE
, fI, hev_thresh); } static void vp7_v_loop_filter_simple_c(uint8_t
*dst, ptrdiff_t stride, int flim) { int i; for (i = 0; i <
16; i++) if (vp7_simple_limit(dst + i, stride, flim)) vp7_filter_common
(dst + i, stride, 1); } static void vp7_h_loop_filter_simple_c
(uint8_t *dst, ptrdiff_t stride, int flim) { int i; for (i = 0
; i < 16; i++) if (vp7_simple_limit(dst + i * stride, 1, flim
)) vp7_filter_common(dst + i * stride, 1, 1); }
692
693av_cold__attribute__((cold)) void ff_vp7dsp_init(VP8DSPContext *dsp)
694{
695 dsp->vp8_luma_dc_wht = vp7_luma_dc_wht_c;
696 dsp->vp8_luma_dc_wht_dc = vp7_luma_dc_wht_dc_c;
697 dsp->vp8_idct_add = vp7_idct_add_c;
698 dsp->vp8_idct_dc_add = vp7_idct_dc_add_c;
699 dsp->vp8_idct_dc_add4y = vp7_idct_dc_add4y_c;
700 dsp->vp8_idct_dc_add4uv = vp7_idct_dc_add4uv_c;
701
702 dsp->vp8_v_loop_filter16y = vp7_v_loop_filter16_c;
703 dsp->vp8_h_loop_filter16y = vp7_h_loop_filter16_c;
704 dsp->vp8_v_loop_filter8uv = vp7_v_loop_filter8uv_c;
705 dsp->vp8_h_loop_filter8uv = vp7_h_loop_filter8uv_c;
706
707 dsp->vp8_v_loop_filter16y_inner = vp7_v_loop_filter16_inner_c;
708 dsp->vp8_h_loop_filter16y_inner = vp7_h_loop_filter16_inner_c;
709 dsp->vp8_v_loop_filter8uv_inner = vp7_v_loop_filter8uv_inner_c;
710 dsp->vp8_h_loop_filter8uv_inner = vp7_h_loop_filter8uv_inner_c;
711
712 dsp->vp8_v_loop_filter_simple = vp7_v_loop_filter_simple_c;
713 dsp->vp8_h_loop_filter_simple = vp7_h_loop_filter_simple_c;
714
715#if ARCH_RISCV0
716 ff_vp7dsp_init_riscv(dsp);
717#endif
718}
719#endif /* CONFIG_VP7_DECODER */
720
721#if CONFIG_VP8_DECODER1
722LOOP_FILTERS(vp8)static void vp8_v_loop_filter16_c(uint8_t *dst, ptrdiff_t stride
, int flim_E, int flim_I, int hev_thresh) { int i; for (i = 0
; i < 16; i++) if (vp8_normal_limit(dst + i * 1, stride, flim_E
, flim_I)) { if (hev(dst + i * 1, stride, hev_thresh)) vp8_filter_common
(dst + i * 1, stride, 1); else filter_mbedge(dst + i * 1, stride
); } } static void vp8_v_loop_filter16_inner_c(uint8_t *dst, ptrdiff_t
stride, int flim_E, int flim_I, int hev_thresh) { int i; for
(i = 0; i < 16; i++) if (vp8_normal_limit(dst + i * 1, stride
, flim_E, flim_I)) { int hv = hev(dst + i * 1, stride, hev_thresh
); if (hv) vp8_filter_common(dst + i * 1, stride, 1); else vp8_filter_common
(dst + i * 1, stride, 0); } } static void vp8_h_loop_filter16_c
(uint8_t *dst, ptrdiff_t stride, int flim_E, int flim_I, int hev_thresh
) { int i; for (i = 0; i < 16; i++) if (vp8_normal_limit(dst
+ i * stride, 1, flim_E, flim_I)) { if (hev(dst + i * stride
, 1, hev_thresh)) vp8_filter_common(dst + i * stride, 1, 1); else
filter_mbedge(dst + i * stride, 1); } } static void vp8_h_loop_filter16_inner_c
(uint8_t *dst, ptrdiff_t stride, int flim_E, int flim_I, int hev_thresh
) { int i; for (i = 0; i < 16; i++) if (vp8_normal_limit(dst
+ i * stride, 1, flim_E, flim_I)) { int hv = hev(dst + i * stride
, 1, hev_thresh); if (hv) vp8_filter_common(dst + i * stride,
1, 1); else vp8_filter_common(dst + i * stride, 1, 0); } } static
__attribute__((always_inline)) inline void vp8_v_loop_filter8_c
(uint8_t *dst, ptrdiff_t stride, int flim_E, int flim_I, int hev_thresh
) { int i; for (i = 0; i < 8; i++) if (vp8_normal_limit(dst
+ i * 1, stride, flim_E, flim_I)) { if (hev(dst + i * 1, stride
, hev_thresh)) vp8_filter_common(dst + i * 1, stride, 1); else
filter_mbedge(dst + i * 1, stride); } } static __attribute__
((always_inline)) inline void vp8_v_loop_filter8_inner_c(uint8_t
*dst, ptrdiff_t stride, int flim_E, int flim_I, int hev_thresh
) { int i; for (i = 0; i < 8; i++) if (vp8_normal_limit(dst
+ i * 1, stride, flim_E, flim_I)) { int hv = hev(dst + i * 1
, stride, hev_thresh); if (hv) vp8_filter_common(dst + i * 1,
stride, 1); else vp8_filter_common(dst + i * 1, stride, 0); }
} static void vp8_v_loop_filter8uv_c(uint8_t *dstU, uint8_t *
dstV, ptrdiff_t stride, int fE, int fI, int hev_thresh) { vp8_v_loop_filter8_c
(dstU, stride, fE, fI, hev_thresh); vp8_v_loop_filter8_c(dstV
, stride, fE, fI, hev_thresh); } static void vp8_v_loop_filter8uv_inner_c
(uint8_t *dstU, uint8_t *dstV, ptrdiff_t stride, int fE, int fI
, int hev_thresh) { vp8_v_loop_filter8_inner_c(dstU, stride, fE
, fI, hev_thresh); vp8_v_loop_filter8_inner_c(dstV, stride, fE
, fI, hev_thresh); } static __attribute__((always_inline)) inline
void vp8_h_loop_filter8_c(uint8_t *dst, ptrdiff_t stride, int
flim_E, int flim_I, int hev_thresh) { int i; for (i = 0; i <
8; i++) if (vp8_normal_limit(dst + i * stride, 1, flim_E, flim_I
)) { if (hev(dst + i * stride, 1, hev_thresh)) vp8_filter_common
(dst + i * stride, 1, 1); else filter_mbedge(dst + i * stride
, 1); } } static __attribute__((always_inline)) inline void vp8_h_loop_filter8_inner_c
(uint8_t *dst, ptrdiff_t stride, int flim_E, int flim_I, int hev_thresh
) { int i; for (i = 0; i < 8; i++) if (vp8_normal_limit(dst
+ i * stride, 1, flim_E, flim_I)) { int hv = hev(dst + i * stride
, 1, hev_thresh); if (hv) vp8_filter_common(dst + i * stride,
1, 1); else vp8_filter_common(dst + i * stride, 1, 0); } } static
void vp8_h_loop_filter8uv_c(uint8_t *dstU, uint8_t *dstV, ptrdiff_t
stride, int fE, int fI, int hev_thresh) { vp8_h_loop_filter8_c
(dstU, stride, fE, fI, hev_thresh); vp8_h_loop_filter8_c(dstV
, stride, fE, fI, hev_thresh); } static void vp8_h_loop_filter8uv_inner_c
(uint8_t *dstU, uint8_t *dstV, ptrdiff_t stride, int fE, int fI
, int hev_thresh) { vp8_h_loop_filter8_inner_c(dstU, stride, fE
, fI, hev_thresh); vp8_h_loop_filter8_inner_c(dstV, stride, fE
, fI, hev_thresh); } static void vp8_v_loop_filter_simple_c(uint8_t
*dst, ptrdiff_t stride, int flim) { int i; for (i = 0; i <
16; i++) if (vp8_simple_limit(dst + i, stride, flim)) vp8_filter_common
(dst + i, stride, 1); } static void vp8_h_loop_filter_simple_c
(uint8_t *dst, ptrdiff_t stride, int flim) { int i; for (i = 0
; i < 16; i++) if (vp8_simple_limit(dst + i * stride, 1, flim
)) vp8_filter_common(dst + i * stride, 1, 1); }
723
724av_cold__attribute__((cold)) void ff_vp8dsp_init(VP8DSPContext *dsp)
725{
726 dsp->vp8_luma_dc_wht = vp8_luma_dc_wht_c;
727 dsp->vp8_luma_dc_wht_dc = vp8_luma_dc_wht_dc_c;
728 dsp->vp8_idct_add = vp8_idct_add_c;
729 dsp->vp8_idct_dc_add = vp8_idct_dc_add_c;
730 dsp->vp8_idct_dc_add4y = vp8_idct_dc_add4y_c;
731 dsp->vp8_idct_dc_add4uv = vp8_idct_dc_add4uv_c;
732
733 dsp->vp8_v_loop_filter16y = vp8_v_loop_filter16_c;
734 dsp->vp8_h_loop_filter16y = vp8_h_loop_filter16_c;
735 dsp->vp8_v_loop_filter8uv = vp8_v_loop_filter8uv_c;
736 dsp->vp8_h_loop_filter8uv = vp8_h_loop_filter8uv_c;
737
738 dsp->vp8_v_loop_filter16y_inner = vp8_v_loop_filter16_inner_c;
739 dsp->vp8_h_loop_filter16y_inner = vp8_h_loop_filter16_inner_c;
740 dsp->vp8_v_loop_filter8uv_inner = vp8_v_loop_filter8uv_inner_c;
741 dsp->vp8_h_loop_filter8uv_inner = vp8_h_loop_filter8uv_inner_c;
742
743 dsp->vp8_v_loop_filter_simple = vp8_v_loop_filter_simple_c;
744 dsp->vp8_h_loop_filter_simple = vp8_h_loop_filter_simple_c;
745
746#if ARCH_AARCH640
747 ff_vp8dsp_init_aarch64(dsp);
748#elif ARCH_ARM0
749 ff_vp8dsp_init_arm(dsp);
750#elif ARCH_RISCV0
751 ff_vp8dsp_init_riscv(dsp);
752#elif ARCH_X861 && HAVE_X86ASM1
753 ff_vp8dsp_init_x86(dsp);
754#elif ARCH_MIPS0
755 ff_vp8dsp_init_mips(dsp);
756#elif ARCH_LOONGARCH0
757 ff_vp8dsp_init_loongarch(dsp);
758#endif
759}
760#endif /* CONFIG_VP8_DECODER */