33 #define VC1DSP_TEST(func) { #func, offsetof(VC1DSPContext, func) },
34 #define VC1DSP_SIZED_TEST(func, width, height) { #func, offsetof(VC1DSPContext, func), width, height },
50 12, 12, 12, 12, 12, 12, 12, 12,
51 16, 15, 9, 4, -4, -9, -15, -16,
52 16, 6, -6, -16, -16, -6, 6, 16,
53 15, -4, -16, -9, 9, 16, 4, -15,
54 12, -12, -12, 12, 12, -12, -12, 12,
55 9, -16, 4, 15, -15, -4, 16, -9,
56 6, -16, 16, -6, -6, 16, -16, 6,
57 4, -9, 15, -16, 16, -15, 9, -4
68 12, 16, 16, 15, 12, 9, 6, 4,
69 12, 15, 6, -4, -12, -16, -16, -9,
70 12, 9, -6, -16, -12, 4, 16, 15,
71 12, 4, -16, -9, 12, 15, -6, -16,
72 12, -4, -16, 9, 12, -15, -6, 16,
73 12, -9, -6, 16, -12, -4, 16, -15,
74 12, -15, 6, 4, -12, 16, -16, 9,
75 12, -16, 16, -15, 12, -9, 6, -4
89 fprintf(stderr,
"Memory allocation failure\n");
100 if (
a->width !=
b->height) {
101 fprintf(stderr,
"Incompatible multiplication\n");
105 for (
int j = 0; j <
out->height; ++j)
106 for (
int i = 0;
i <
out->width; ++
i) {
108 for (
int k = 0; k <
a->width; ++k)
109 sum +=
a->d[j *
a->width + k] *
b->d[k *
b->width +
i];
110 out->d[j *
out->width +
i] = sum;
117 for (
int j = 0; j <
a->height; ++j)
118 for (
int i = 0;
i <
a->width; ++
i) {
119 float *p =
a->d + j *
a->width +
i;
122 *p /= (
const unsigned[]) { 289, 292, 289, 292 } [j];
124 *p /= (
const unsigned[]) { 288, 289, 292, 289, 288, 289, 292, 289 } [j];
126 *p /= (
const unsigned[]) { 289, 292, 289, 292 } [
i];
128 *p /= (
const unsigned[]) { 288, 289, 292, 289, 288, 289, 292, 289 } [
i];
134 for (
int j = 0; j <
a->height; ++j)
135 for (
int i = 0;
i <
a->width; ++
i) {
136 float *p =
a->d + j *
a->width +
i;
143 for (
int j = 4; j <
a->height; ++j)
144 for (
int i = 0;
i <
a->width; ++
i) {
145 float *p =
a->d + j *
a->width +
i;
164 #define ATTENUATION 4
216 #define RANDOMIZE_BUFFER16(name, size) \
219 for (i = 0; i < size; ++i) { \
220 uint16_t r = rnd(); \
221 AV_WN16A(name##0 + i, r); \
222 AV_WN16A(name##1 + i, r); \
226 #define RANDOMIZE_BUFFER8(name, size) \
229 for (i = 0; i < size; ++i) { \
236 #define RANDOMIZE_BUFFER8_MID_WEIGHTED(name, size) \
238 uint8_t *p##0 = name##0, *p##1 = name##1; \
241 int x = 0x80 | (rnd() & 0x7F); \
245 *p##1++ = *p##0++ = 0x80 + x; \
263 if (
check_func(
h.vc1_inv_trans_8x8,
"vc1dsp.vc1_inv_trans_8x8")) {
268 for (
int j = 0; j < 8; ++j)
269 for (
int i = 0;
i < 8; ++
i) {
270 int idx = 8 +
i * 8 + j;
271 inv_trans_in1[idx] = inv_trans_in0[idx] = coeffs->
d[j * 8 +
i];
275 if (memcmp(inv_trans_in0, inv_trans_in1, 10 * 8 *
sizeof (int16_t)))
310 void (*
func)(uint8_t *, ptrdiff_t, int16_t *) = *(
void **)((intptr_t) &
h +
tests[t].
offset);
317 for (
int j = 0; j <
tests[t].height; ++j)
318 for (
int i = 0;
i <
tests[t].width; ++
i) {
320 inv_trans_in1[idx] = inv_trans_in0[idx] = coeffs->
d[j *
tests[t].width +
i];
322 call_ref(inv_trans_out0 + 24 + 8, 24, inv_trans_in0);
323 call_new(inv_trans_out1 + 24 + 8, 24, inv_trans_in1);
324 if (memcmp(inv_trans_out0, inv_trans_out1, 10 * 24))
326 bench_new(inv_trans_out1 + 24 + 8, 24, inv_trans_in1 + 8);
356 void (*
func)(uint8_t *, ptrdiff_t, int) = *(
void **)((intptr_t) &
h +
tests[t].
offset);
359 for (
int count = 1000; count > 0; --count) {
360 int pq =
rnd() % 31 + 1;
362 call_ref(filter_buf0 + 4 * 48 + 16, 48, pq);
363 call_new(filter_buf1 + 4 * 48 + 16, 48, pq);
364 if (memcmp(filter_buf0, filter_buf1, 24 * 48))
368 for (
int j = 0; j < 24; ++j)
369 for (
int i = 0;
i < 48; ++
i)
370 filter_buf1[j * 48 +
i] = 0x60 + 0x40 * (
i >= 16 && j >= 4);
372 bench_new(filter_buf1 + 4 * 48 + 16, 48, 1);
374 bench_new(filter_buf1 + 4 * 48 + 16, 48, 31);
378 #define TEST_UNESCAPE \
380 for (int count = 100; count > 0; --count) { \
381 escaped_offset = rnd() & 7; \
382 unescaped_offset = rnd() & 7; \
383 escaped_len = (1u << (rnd() % 8) + 3) - (rnd() & 7); \
384 RANDOMIZE_BUFFER8(unescaped, UNESCAPE_BUF_SIZE); \
385 len0 = call_ref(escaped0 + escaped_offset, escaped_len, unescaped0 + unescaped_offset); \
386 len1 = call_new(escaped1 + escaped_offset, escaped_len, unescaped1 + unescaped_offset); \
387 if (len0 != len1 || memcmp(unescaped0, unescaped1, UNESCAPE_BUF_SIZE)) \
395 #define LOG2_UNESCAPE_BUF_SIZE 17
396 #define UNESCAPE_BUF_SIZE (1u<<LOG2_UNESCAPE_BUF_SIZE)
406 if (
check_func(
h.vc1_unescape_buffer,
"vc1dsp.vc1_unescape_buffer")) {
407 int len0, len1, escaped_offset, unescaped_offset, escaped_len;
412 escaped1[x] = escaped0[x] = 3 * (x % 3 == 0);
422 escaped1[x+0] = escaped0[x+0] = 0;
423 escaped1[x+1] = escaped0[x+1] = 0;
424 escaped1[x+2] = escaped0[x+2] = 3;
425 escaped1[x+3] = escaped0[x+3] =
rnd() & 3;
426 gap_msb = 2
u << (
rnd() % 8);
427 gap = (
rnd() &~ -gap_msb) | gap_msb;
461 void (*
func)(uint8_t *,
const uint8_t*, ptrdiff_t, int) = *(
void **)((intptr_t) &
h +
tests[t].
offset);
468 if (memcmp(dst0, dst1, 32 * 32)) {
486 report(
"unescape_buffer");