24#include "config_components.h"
33#define PIXEL_STRIDE 16
35#define randomize_buffers(src, dst, stride, coef) \
38 for (y = 0; y < 4; y++) { \
39 AV_WN32A((src) + y * (stride), rnd()); \
40 AV_WN32A((dst) + y * (stride), rnd()); \
41 for (x = 0; x < 4; x++) \
42 (coef)[y * 4 + x] = (src)[y * (stride) + x] - \
43 (dst)[y * (stride) + x]; \
50 for (
i = 0;
i < 4;
i++) {
51 const int a1 = (coef[
i*4 + 0] + coef[
i*4 + 3]) * 8;
52 const int b1 = (coef[
i*4 + 1] + coef[
i*4 + 2]) * 8;
53 const int c1 = (coef[
i*4 + 1] - coef[
i*4 + 2]) * 8;
54 const int d1 = (coef[
i*4 + 0] - coef[
i*4 + 3]) * 8;
55 coef[
i*4 + 0] =
a1 +
b1;
56 coef[
i*4 + 1] = (
c1 * 2217 + d1 * 5352 + 14500) >> 12;
57 coef[
i*4 + 2] =
a1 -
b1;
58 coef[
i*4 + 3] = (d1 * 2217 -
c1 * 5352 + 7500) >> 12;
60 for (
i = 0;
i < 4;
i++) {
61 const int a1 = coef[
i + 0*4] + coef[
i + 3*4];
62 const int b1 = coef[
i + 1*4] + coef[
i + 2*4];
63 const int c1 = coef[
i + 1*4] - coef[
i + 2*4];
64 const int d1 = coef[
i + 0*4] - coef[
i + 3*4];
65 coef[
i + 0*4] = (
a1 +
b1 + 7) >> 4;
66 coef[
i + 1*4] = ((
c1 * 2217 + d1 * 5352 + 12000) >> 16) + !!d1;
67 coef[
i + 2*4] = (
a1 -
b1 + 7) >> 4;
68 coef[
i + 3*4] = (d1 * 2217 -
c1 * 5352 + 51000) >> 16;
75 for (
i = 0;
i < 4;
i++) {
76 int a1 = coef[0 * 4 +
i];
77 int b1 = coef[1 * 4 +
i];
78 int c1 = coef[2 * 4 +
i];
79 int d1 = coef[3 * 4 +
i];
93 for (
i = 0;
i < 4;
i++) {
94 int a1 = coef[
i * 4 + 0];
95 int b1 = coef[
i * 4 + 1];
96 int c1 = coef[
i * 4 + 2];
97 int d1 = coef[
i * 4 + 3];
106 coef[
i * 4 + 0] =
a1 * 2;
107 coef[
i * 4 + 1] =
c1 * 2;
108 coef[
i * 4 + 2] = d1 * 2;
109 coef[
i * 4 + 3] =
b1 * 2;
129 for (dc = 0; dc <= 1; dc++) {
132 if (
check_func(
idct,
"vp%d_idct_%sadd", 8 - is_vp7, dc ?
"dc_" :
"")) {
134 memset(subcoef0, 0, 4 * 4 *
sizeof(int16_t));
135 subcoef0[0] = coef[0];
137 memcpy(subcoef0, coef, 4 * 4 *
sizeof(int16_t));
139 memcpy(dst0,
dst, 4 * 4);
140 memcpy(dst1,
dst, 4 * 4);
141 memcpy(subcoef1, subcoef0, 4 * 4 *
sizeof(int16_t));
147 if (memcmp(dst0, dst1, 4 * 4) ||
148 memcmp(subcoef0, subcoef1, 4 * 4 *
sizeof(int16_t)))
170 if (
check_func(idct4dc,
"vp%d_idct_dc_add4%s", 8 - is_vp7,
chroma ?
"uv" :
"y")) {
173 for (
i = 0;
i < 4;
i++) {
174 int blockx = 4 * (
i %
w);
175 int blocky = 4 * (
i /
w);
178 memset(&coef[
i][1], 0, 15 *
sizeof(int16_t));
181 memcpy(dst0,
dst, 4 * 4 * 4);
182 memcpy(dst1,
dst, 4 * 4 * 4);
183 memcpy(subcoef0, coef, 4 * 4 * 4 *
sizeof(int16_t));
184 memcpy(subcoef1, coef, 4 * 4 * 4 *
sizeof(int16_t));
187 if (memcmp(dst0, dst1, 4 * 4 * 4) ||
188 memcmp(subcoef0, subcoef1, 4 * 4 * 4 *
sizeof(int16_t)))
201 int16_t
block[4][4][16];
208 for (blocky = 0; blocky < 4; blocky++) {
209 for (blockx = 0; blockx < 4; blockx++) {
214 dc[blocky * 4 + blockx] =
block[blocky][blockx][0];
220 for (dc_only = 0; dc_only <= 1; dc_only++) {
223 if (
check_func(
idct,
"vp%d_luma_dc_wht%s", 8 - is_vp7, dc_only ?
"_dc" :
"")) {
225 memset(dc0, 0, 16 *
sizeof(int16_t));
228 memcpy(dc0, dc, 16 *
sizeof(int16_t));
230 memcpy(dc1, dc0, 16 *
sizeof(int16_t));
231 memcpy(block0,
block, 4 * 4 * 16 *
sizeof(int16_t));
232 memcpy(
block1,
block, 4 * 4 * 16 *
sizeof(int16_t));
235 if (memcmp(block0,
block1, 4 * 4 * 16 *
sizeof(int16_t)) ||
236 memcmp(dc0, dc1, 16 *
sizeof(int16_t)))
243#define SRC_BUF_STRIDE 32
244#define SRC_BUF_SIZE (((size << (size < 16)) + 5) * SRC_BUF_STRIDE)
248#define src (buf + 2 * SRC_BUF_STRIDE + 2 + 1)
250#undef randomize_buffers
251#define randomize_buffers() \
254 for (k = 0; k < SRC_BUF_SIZE; k += 4) { \
255 AV_WN32A(buf + k, rnd()); \
266 const uint8_t *, ptrdiff_t,
int,
int,
int);
269 for (k = 1; k < 8; k++) {
271 int size = 16 >> hsize;
273 for (dy = 0; dy < 3; dy++) {
274 for (dx = 0; dx < 3; dx++) {
280 static const char *dx_names[] = {
"",
"h4",
"h6" };
281 static const char *dy_names[] = {
"",
"v4",
"v6" };
282 snprintf(str,
sizeof(str),
"epel%d_%s%s",
size, dx_names[dx], dy_names[dy]);
284 snprintf(str,
sizeof(str),
"bilin%d_%s%s",
size, dx ?
"h" :
"", dy ?
"v" :
"");
294 mx = dx == 2 ? 2 + 2 * (
rnd() % 3) : dx == 1 ? 1 + 2 * (
rnd() % 4) : 0;
295 my = dy == 2 ? 2 + 2 * (
rnd() % 3) : dy == 1 ? 1 + 2 * (
rnd() % 4) : 0;
297 mx = dx ? 1 + (
rnd() % 7) : 0;
298 my = dy ? 1 + (
rnd() % 7) : 0;
301 for (
i = -2;
i <= 3;
i++) {
302 int val = (
i == -1 ||
i == 2) ? 0 : 0xff;
321#undef randomize_buffers
323#define setpx(a, b, c) buf[(a) + (b) * jstride] = av_clip_uint8(c)
325#define setdx(a, b, c, d) setpx(a, b, c - (d) + (rnd() % ((d) * 2 + 1)))
327#define setdx2(a, b, o, c, d, e) setpx(a, b, o = c + ((d) + (rnd() % (e))) * (c >= 128 ? -1 : 1))
330 int dir,
int flim_E,
int flim_I,
331 int hev_thresh, uint8_t *buf,
334 uint32_t
mask = 0xff;
335 int off = dir ? lineoff : lineoff * str;
336 int istride = dir ? 1 : str;
337 int jstride = dir ? str : 1;
339 for (
i = 0;
i < 8;
i += 2) {
344 int idx = off +
i * istride, p2, p1, p0,
q0,
q1, q2;
346 if (
i == 0 && force_hev >= 0 || force_hev > 0)
347 setdx2(idx, 1,
q1,
q0, hev_thresh + 1, flim_I - hev_thresh - 1);
350 setdx(idx, 2, q2 =
q1, flim_I);
351 setdx(idx, 3, q2, flim_I);
352 setdx(idx, -1, p0 =
q0, flim_E >> 2);
353 if (
i == 2 && force_hev >= 0 || force_hev > 0)
354 setdx2(idx, -2, p1, p0, hev_thresh + 1, flim_I - hev_thresh - 1);
356 setdx(idx, -2, p1 = p0, hev_thresh);
357 setdx(idx, -3, p2 = p1, flim_I);
358 setdx(idx, -4, p2, flim_I);
366 for (y = 0; y <
h; y++)
367 for (x = 0; x <
w; x++)
371#define randomize_buffers(buf, lineoff, str, force_hev) \
372 randomize_loopfilter_buffers(lineoff, str, dir, flim_E, flim_I, hev_thresh, buf, force_hev)
378 int dir, edge, force_hev;
379 int flim_E = 20, flim_I = 10, hev_thresh = 7;
380 declare_func(
void, uint8_t *, ptrdiff_t,
int,
int,
int);
382 for (dir = 0; dir < 2; dir++) {
383 int midoff = dir ? 4 * 16 : 4;
384 int midoff_aligned = dir ? 4 * 16 : 16;
385 uint8_t *buf0 = base0 + midoff_aligned;
386 uint8_t *buf1 = base1 + midoff_aligned;
387 for (edge = 0; edge < 2; edge++) {
388 void (*
func)(uint8_t *, ptrdiff_t, int, int, int) =
NULL;
389 switch (dir << 1 | edge) {
395 if (
check_func(
func,
"vp%d_loop_filter16y%s_%s", 8 - is_vp7, edge ?
"_inner" :
"", dir ?
"v" :
"h")) {
396 for (force_hev = -1; force_hev <= 1; force_hev++) {
400 memcpy(buf1 - midoff, buf0 - midoff, 16 * 16);
401 call_ref(buf0, 16, flim_E, flim_I, hev_thresh);
402 call_new(buf1, 16, flim_E, flim_I, hev_thresh);
403 if (memcmp(buf0 - midoff, buf1 - midoff, 16 * 16))
409 bench_new(buf0, 16, flim_E, flim_I, hev_thresh);
421 int dir, edge, force_hev;
422 int flim_E = 20, flim_I = 10, hev_thresh = 7;
423 declare_func(
void, uint8_t *, uint8_t *, ptrdiff_t,
int,
int,
int);
425 for (dir = 0; dir < 2; dir++) {
426 int midoff = dir ? 4 * 16 : 4;
427 int midoff_aligned = dir ? 4 * 16 : 16;
428 uint8_t *buf0u = base0u + midoff_aligned;
429 uint8_t *buf0v = base0v + midoff_aligned;
430 uint8_t *buf1u = base1u + midoff_aligned;
431 uint8_t *buf1v = base1v + midoff_aligned;
432 for (edge = 0; edge < 2; edge++) {
433 void (*
func)(uint8_t *, uint8_t *, ptrdiff_t, int, int, int) =
NULL;
434 switch (dir << 1 | edge) {
440 if (
check_func(
func,
"vp%d_loop_filter8uv%s_%s", 8 - is_vp7, edge ?
"_inner" :
"", dir ?
"v" :
"h")) {
441 for (force_hev = -1; force_hev <= 1; force_hev++) {
446 memcpy(buf1u - midoff, buf0u - midoff, 16 * 16);
447 memcpy(buf1v - midoff, buf0v - midoff, 16 * 16);
449 call_ref(buf0u, buf0v, 16, flim_E, flim_I, hev_thresh);
450 call_new(buf1u, buf1v, 16, flim_E, flim_I, hev_thresh);
451 if (memcmp(buf0u - midoff, buf1u - midoff, 16 * 16) ||
452 memcmp(buf0v - midoff, buf1v - midoff, 16 * 16))
459 bench_new(buf0u, buf0v, 16, flim_E, flim_I, hev_thresh);
470 int flim_E = 20, flim_I = 30, hev_thresh = 0;
473 for (dir = 0; dir < 2; dir++) {
474 int midoff = dir ? 4 * 16 : 4;
475 int midoff_aligned = dir ? 4 * 16 : 16;
476 uint8_t *buf0 = base0 + midoff_aligned;
477 uint8_t *buf1 = base1 + midoff_aligned;
479 if (
check_func(
func,
"vp%d_loop_filter_simple_%s", 8 - is_vp7, dir ?
"v" :
"h")) {
483 memcpy(buf1 - midoff, buf0 - midoff, 16 * 16);
486 if (memcmp(buf0 - midoff, buf1 - midoff, 16 * 16))
495#if CONFIG_VP7_DECODER
520#if CONFIG_VP7_DECODER
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t my
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t mx
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
static double val(void *priv, double ch)
#define i(width, name, range_min, range_max)
common internal and external API header
static int16_t block1[64]
#define declare_func_emms
#define BUF_RECT(type, name, w, h)
#define CLEAR_BUF_RECT(name)
Clear a rectangular buffer (including padding)
#define checkasm_check_rect_padded(rect1,...)
Compare two rectangular buffers including padding.
static void idct(int16_t block[64])
int(* func)(AVBPrint *dst, const char *in, const char *arg)
av_cold void ff_vp78dsp_init(VP8DSPContext *dsp)
#define AV_CPU_FLAG_MMX
standard MMX
static const uint16_t mask[17]
#define LOCAL_ALIGNED_16(t, v,...)
void(* vp8_h_loop_filter8uv_inner)(uint8_t *dstU, uint8_t *dstV, ptrdiff_t stride, int flim_E, int flim_I, int hev_thresh)
void(* vp8_v_loop_filter_simple)(uint8_t *dst, ptrdiff_t stride, int flim)
void(* vp8_v_loop_filter16y)(uint8_t *dst, ptrdiff_t stride, int flim_E, int flim_I, int hev_thresh)
void(* vp8_luma_dc_wht_dc)(int16_t block[4][4][16], int16_t dc[16])
void(* vp8_idct_dc_add)(uint8_t *dst, int16_t block[16], ptrdiff_t stride)
void(* vp8_idct_dc_add4uv)(uint8_t *dst, int16_t block[4][16], ptrdiff_t stride)
void(* vp8_h_loop_filter16y)(uint8_t *dst, ptrdiff_t stride, int flim_E, int flim_I, int hev_thresh)
void(* vp8_luma_dc_wht)(int16_t block[4][4][16], int16_t dc[16])
vp8_mc_func put_vp8_bilinear_pixels_tab[3][3][3]
void(* vp8_v_loop_filter8uv_inner)(uint8_t *dstU, uint8_t *dstV, ptrdiff_t stride, int flim_E, int flim_I, int hev_thresh)
void(* vp8_h_loop_filter8uv)(uint8_t *dstU, uint8_t *dstV, ptrdiff_t stride, int flim_E, int flim_I, int hev_thresh)
void(* vp8_h_loop_filter16y_inner)(uint8_t *dst, ptrdiff_t stride, int flim_E, int flim_I, int hev_thresh)
void(* vp8_idct_dc_add4y)(uint8_t *dst, int16_t block[4][16], ptrdiff_t stride)
void(* vp8_h_loop_filter_simple)(uint8_t *dst, ptrdiff_t stride, int flim)
void(* vp8_v_loop_filter8uv)(uint8_t *dstU, uint8_t *dstV, ptrdiff_t stride, int flim_E, int flim_I, int hev_thresh)
void(* vp8_v_loop_filter16y_inner)(uint8_t *dst, ptrdiff_t stride, int flim_E, int flim_I, int hev_thresh)
void(* vp8_idct_add)(uint8_t *dst, int16_t block[16], ptrdiff_t stride)
vp8_mc_func put_vp8_epel_pixels_tab[3][3][3]
first dimension: 4-log2(width) second dimension: 0 if no vertical interpolation is needed; 1 4-tap ve...
static void check_idct(void)
static void check_loopfilter_8uv(VP8DSPContext *d, bool is_vp7)
static void check_luma_dc_wht(VP8DSPContext *d, bool is_vp7)
static void check_loopfilter_simple(VP8DSPContext *d, bool is_vp7)
#define setdx(a, b, c, d)
void checkasm_check_vp8dsp(void)
static void check_loopfilter_16y(VP8DSPContext *d, bool is_vp7)
static void checkasm_check_vp78dsp(VP8DSPContext *d, bool is_vp7)
#define randomize_buffers(src, dst, stride, coef)
static void randomize_loopfilter_buffers(int lineoff, int str, int dir, int flim_E, int flim_I, int hev_thresh, uint8_t *buf, int force_hev)
static void wht4x4(int16_t *coef)
static void fill_loopfilter_buffers(uint8_t *buf, ptrdiff_t stride, int w, int h)
static void check_idct_dc4(VP8DSPContext *d, bool is_vp7)
static void dct4x4(int16_t *coef)
#define setdx2(a, b, o, c, d, e)
static void check_mc(void)
static const uint8_t q1[256]
static const uint8_t q0[256]
static double b1(void *priv, double x, double y)
static double a1(void *priv, double x, double y)
VP8 compatible video decoder.
void(* vp8_mc_func)(uint8_t *dst, ptrdiff_t dstStride, const uint8_t *src, ptrdiff_t srcStride, int h, int x, int y)
void ff_vp7dsp_init(VP8DSPContext *c)
void ff_vp8dsp_init(VP8DSPContext *c)