28 const uint8_t *block2, ptrdiff_t stride2,
36 case 0: block1++; block2++;
break;
37 case 1: block2++;
break;
41 out = f_out(block1, stride1, block2, stride2);
42 ref = f_ref(block1, stride1, block2, stride2);
43 printf(
"[%s] [%c%c] SAD [%s] %dx%d=%d ref=%d\n",
44 out == ref ?
"OK" :
"FAIL",
45 align ?
'A' :
'U', align == 2 ?
'A' :
'U',
46 test, 1<<n, 1<<n, out, ref);
55 for (a = 0; a < 3; a++) {
60 case 0: block1++; block2++;
break;
61 case 1: block2++;
break;
81 fprintf(stderr,
"malloc failure\n");
88 #define RANDOM_INIT(buf, size) do { \ 90 for (k = 0; k < size; k++) { \ 91 state = state * 1664525 + 1013904223; \ 99 ret =
run_test(
"random", buf1, buf2);
104 memset(buf1, 0xff,
W1*H1);
105 memset(buf2, 0x00,
W2*H2);
111 memset(buf1, 0x90,
W1*H1);
112 memset(buf2, 0x90,
W2*H2);
118 for (i = 1; i <= 4; i++) {
119 for (align = 0; align < 3; align++) {
125 size1 = size2 = 1 << (i << 1);
128 case 0: size1++; size2++;
break;
129 case 1: size2++;
break;
135 if (!buf1 || !buf2) {
136 fprintf(stderr,
"malloc failure\n");
static av_cold int end(AVCodecContext *avctx)
static int run_test(const char *test, const uint8_t *b1, const uint8_t *b2)
int(* av_pixelutils_sad_fn)(const uint8_t *src1, ptrdiff_t stride1, const uint8_t *src2, ptrdiff_t stride2)
Sum of abs(src1[x] - src2[x])
static int run_single_test(const char *test, const uint8_t *block1, ptrdiff_t stride1, const uint8_t *block2, ptrdiff_t stride2, int align, int n)
#define RANDOM_INIT(buf, size)
#define FF_ARRAY_ELEMS(a)
const AVS_VideoInfo int align
static void test(const char *pattern, const char *host)
av_pixelutils_sad_fn av_pixelutils_get_sad_fn(int w_bits, int h_bits, int aligned, void *log_ctx)
Get a potentially optimized pointer to a Sum-of-absolute-differences function (see the av_pixelutils_...
static int ref[MAX_W *MAX_W]
void ff_check_pixfmt_descriptors(void)
static int16_t block1[64]