32 #define VC1DSP_TEST(func) { #func, offsetof(VC1DSPContext, func) },
33 #define VC1DSP_SIZED_TEST(func, width, height) { #func, offsetof(VC1DSPContext, func), width, height },
49 12, 12, 12, 12, 12, 12, 12, 12,
50 16, 15, 9, 4, -4, -9, -15, -16,
51 16, 6, -6, -16, -16, -6, 6, 16,
52 15, -4, -16, -9, 9, 16, 4, -15,
53 12, -12, -12, 12, 12, -12, -12, 12,
54 9, -16, 4, 15, -15, -4, 16, -9,
55 6, -16, 16, -6, -6, 16, -16, 6,
56 4, -9, 15, -16, 16, -15, 9, -4
67 12, 16, 16, 15, 12, 9, 6, 4,
68 12, 15, 6, -4, -12, -16, -16, -9,
69 12, 9, -6, -16, -12, 4, 16, 15,
70 12, 4, -16, -9, 12, 15, -6, -16,
71 12, -4, -16, 9, 12, -15, -6, 16,
72 12, -9, -6, 16, -12, -4, 16, -15,
73 12, -15, 6, 4, -12, 16, -16, 9,
74 12, -16, 16, -15, 12, -9, 6, -4
88 fprintf(stderr,
"Memory allocation failure\n");
99 if (
a->width !=
b->height) {
100 fprintf(stderr,
"Incompatible multiplication\n");
104 for (
int j = 0; j <
out->height; ++j)
105 for (
int i = 0;
i <
out->width; ++
i) {
107 for (
int k = 0; k <
a->width; ++k)
108 sum +=
a->d[j *
a->width + k] *
b->d[k *
b->width +
i];
109 out->d[j *
out->width +
i] = sum;
116 for (
int j = 0; j <
a->height; ++j)
117 for (
int i = 0;
i <
a->width; ++
i) {
118 float *p =
a->d + j *
a->width +
i;
121 *p /= (
const unsigned[]) { 289, 292, 289, 292 } [j];
123 *p /= (
const unsigned[]) { 288, 289, 292, 289, 288, 289, 292, 289 } [j];
125 *p /= (
const unsigned[]) { 289, 292, 289, 292 } [
i];
127 *p /= (
const unsigned[]) { 288, 289, 292, 289, 288, 289, 292, 289 } [
i];
133 for (
int j = 0; j <
a->height; ++j)
134 for (
int i = 0;
i <
a->width; ++
i) {
135 float *p =
a->d + j *
a->width +
i;
142 for (
int j = 4; j <
a->height; ++j)
143 for (
int i = 0;
i <
a->width; ++
i) {
144 float *p =
a->d + j *
a->width +
i;
163 #define ATTENUATION 4
215 #define RANDOMIZE_BUFFER16(name, size) \
218 for (i = 0; i < size; ++i) { \
219 uint16_t r = rnd(); \
220 AV_WN16A(name##0 + i, r); \
221 AV_WN16A(name##1 + i, r); \
225 #define RANDOMIZE_BUFFER8(name, size) \
228 for (i = 0; i < size; ++i) { \
235 #define RANDOMIZE_BUFFER8_MID_WEIGHTED(name, size) \
237 uint8_t *p##0 = name##0, *p##1 = name##1; \
240 int x = 0x80 | (rnd() & 0x7F); \
244 *p##1++ = *p##0++ = 0x80 + x; \
262 if (
check_func(
h.vc1_inv_trans_8x8,
"vc1dsp.vc1_inv_trans_8x8")) {
267 for (
int j = 0; j < 8; ++j)
268 for (
int i = 0;
i < 8; ++
i) {
269 int idx = 8 +
i * 8 + j;
270 inv_trans_in1[idx] = inv_trans_in0[idx] = coeffs->
d[j * 8 +
i];
274 if (memcmp(inv_trans_in0, inv_trans_in1, 10 * 8 *
sizeof (int16_t)))
309 void (*
func)(uint8_t *, ptrdiff_t, int16_t *) = *(
void **)((intptr_t) &
h +
tests[t].
offset);
316 for (
int j = 0; j <
tests[t].height; ++j)
317 for (
int i = 0;
i <
tests[t].width; ++
i) {
319 inv_trans_in1[idx] = inv_trans_in0[idx] = coeffs->
d[j *
tests[t].width +
i];
321 call_ref(inv_trans_out0 + 24 + 8, 24, inv_trans_in0);
322 call_new(inv_trans_out1 + 24 + 8, 24, inv_trans_in1);
323 if (memcmp(inv_trans_out0, inv_trans_out1, 10 * 24))
325 bench_new(inv_trans_out1 + 24 + 8, 24, inv_trans_in1 + 8);
358 for (
int count = 1000; count > 0; --count) {
359 int pq =
rnd() % 31 + 1;
361 call_ref(filter_buf0 + 4 * 48 + 16, 48, pq);
362 call_new(filter_buf1 + 4 * 48 + 16, 48, pq);
363 if (memcmp(filter_buf0, filter_buf1, 24 * 48))
367 for (
int j = 0; j < 24; ++j)
368 for (
int i = 0;
i < 48; ++
i)
369 filter_buf1[j * 48 +
i] = 0x60 + 0x40 * (
i >= 16 && j >= 4);
371 bench_new(filter_buf1 + 4 * 48 + 16, 48, 1);
373 bench_new(filter_buf1 + 4 * 48 + 16, 48, 31);
377 #define TEST_UNESCAPE \
379 for (int count = 100; count > 0; --count) { \
380 escaped_offset = rnd() & 7; \
381 unescaped_offset = rnd() & 7; \
382 escaped_len = (1u << (rnd() % 8) + 3) - (rnd() & 7); \
383 RANDOMIZE_BUFFER8(unescaped, UNESCAPE_BUF_SIZE); \
384 len0 = call_ref(escaped0 + escaped_offset, escaped_len, unescaped0 + unescaped_offset); \
385 len1 = call_new(escaped1 + escaped_offset, escaped_len, unescaped1 + unescaped_offset); \
386 if (len0 != len1 || memcmp(unescaped0, unescaped1, UNESCAPE_BUF_SIZE)) \
394 #define LOG2_UNESCAPE_BUF_SIZE 17
395 #define UNESCAPE_BUF_SIZE (1u<<LOG2_UNESCAPE_BUF_SIZE)
405 if (
check_func(
h.vc1_unescape_buffer,
"vc1dsp.vc1_unescape_buffer")) {
406 int len0, len1, escaped_offset, unescaped_offset, escaped_len;
411 escaped1[x] = escaped0[x] = 3 * (x % 3 == 0);
421 escaped1[x+0] = escaped0[x+0] = 0;
422 escaped1[x+1] = escaped0[x+1] = 0;
423 escaped1[x+2] = escaped0[x+2] = 3;
424 escaped1[x+3] = escaped0[x+3] =
rnd() & 3;
425 gap_msb = 2
u << (
rnd() % 8);
426 gap = (
rnd() &~ -gap_msb) | gap_msb;
451 report(
"unescape_buffer");