32 #define randomize_buffers(buf, size) \
35 for (j = 0; j < size; j+=4) \
36 AV_WN32(buf + j, rnd()); \
40 const int16_t **
src, uint8_t *dest,
int dstW,
45 for (
i = 0;
i < dstW;
i++) {
48 for (j = 0; j < filterSize; j++)
57 for (
size_t i = 0;
i < n;
i++) {
67 for (;
i <
len;
i++) {
71 printf(
"0x%02x ", (uint32_t) p[
i]);
83 for (
size_t i = 0;
i <
len;
i++) {
85 size_t offset_of_mismatch =
i;
94 return offset_of_mismatch;
107 const int input_sizes[] = {8, 24, 128, 144, 256, 512};
108 #define LARGEST_INPUT_SIZE 512
110 const int offsets[] = {0, 3, 8, 11, 16, 19};
112 const char *accurate_str = (accurate) ?
"accurate" :
"approximate";
115 const int16_t *
src, uint8_t *dest,
135 for (osi = 0; osi < OFFSET_SIZES; osi++) {
143 if (
cmp_off_by_n(dst0, dst1, dstW *
sizeof(dst0[0]), accurate ? 0 : 2)) {
145 printf(
"failed: yuv2yuv1_%d_%di_%s\n",
offset, dstW, accurate_str);
147 printf(
"failing values: src: 0x%04x dither: 0x%02x dst-c: %02x dst-asm: %02x\n",
148 (
int) src_pixels[fail_offset],
149 (
int)
dither[(fail_offset + fail_offset) & 7],
150 (
int) dst0[fail_offset],
151 (
int) dst1[fail_offset]);
165 int fsi, osi, isi,
i, j;
167 #define LARGEST_FILTER 16
169 const int filter_sizes[] = {2, 4, 8, 16};
170 const int FILTER_SIZES =
sizeof(filter_sizes)/
sizeof(filter_sizes[0]);
171 #define LARGEST_INPUT_SIZE 512
172 static const int input_sizes[] = {8, 24, 128, 144, 256, 512};
173 const char *accurate_str = (accurate) ?
"accurate" :
"approximate";
176 int filterSize,
const int16_t **
src, uint8_t *dest,
189 uint8_t d_val =
rnd();
202 for(osi = 0; osi < 64; osi += 16){
217 for (
i = 0;
i < filter_sizes[fsi]; ++
i)
218 filter_coeff[
i] = -((1 << 12) / (filter_sizes[fsi] - 1));
219 filter_coeff[
rnd() % filter_sizes[fsi]] = (1 << 13) - 1;
222 vFilterData =
av_malloc((filter_sizes[fsi] + 2) *
sizeof(
union VFilterData));
223 memset(vFilterData, 0, (filter_sizes[fsi] + 2) *
sizeof(
union VFilterData));
224 for (
i = 0;
i < filter_sizes[fsi]; ++
i) {
226 vFilterData[
i].src =
src[
i] - osi;
227 for(j = 0; j < 4; ++j)
228 vFilterData[
i].
coeff[j + 4] = filter_coeff[
i];
230 if (
check_func(
c->yuv2planeX,
"yuv2yuvX_%d_%d_%d_%s", filter_sizes[fsi], osi, dstW, accurate_str)){
232 const int16_t *
filter =
c->use_mmx_vfilter ? (
const int16_t*)vFilterData : &filter_coeff[0];
243 printf(
"failed: yuv2yuvX_%d_%d_%d_%s\n", filter_sizes[fsi], osi, dstW, accurate_str);
247 bench_new((
const int16_t*)vFilterData, filter_sizes[fsi],
src, dst1, dstW - osi,
dither, osi);
263 #define LARGEST_FILTER 16
264 const int filter_sizes[] = {2, 4, 8, 16};
265 #define LARGEST_INPUT_SIZE 512
266 static const int input_sizes[] = {8, 24, 128, 144, 256, 512};
267 const char *accurate_str = (accurate) ?
"accurate" :
"approximate";
270 const uint8_t *chrDither,
const int16_t *chrFilter,
271 int chrFilterSize,
const int16_t **chrUSrc,
272 const int16_t **chrVSrc, uint8_t *dest,
int dstW);
281 uint8_t d_val =
rnd();
302 const int filter_size = filter_sizes[fsi];
303 for (
int i = 0;
i < filter_size;
i++)
304 filter_coeff[
i] = -((1 << 12) / (filter_size - 1));
305 filter_coeff[
rnd() % filter_size] = (1 << 13) - 1;
307 if (
check_func(
c->yuv2nv12cX,
"yuv2nv12cX_%d_%d_%s", filter_size, dstW, accurate_str)){
314 if (
cmp_off_by_n(dst0, dst1, dstW * 2 *
sizeof(dst0[0]), accurate ? 0 : 2)) {
316 printf(
"failed: yuv2nv12wX_%d_%d_%s\n", filter_size, dstW, accurate_str);
327 #undef LARGEST_FILTER
328 #undef LARGEST_INPUT_SIZE
331 #define SRC_PIXELS 512
335 #define MAX_FILTER_WIDTH 40
336 #define FILTER_SIZES 6
337 static const int filter_sizes[
FILTER_SIZES] = { 4, 8, 12, 16, 32, 40 };
339 #define HSCALE_PAIRS 2
345 #define LARGEST_INPUT_SIZE 512
346 static const int input_sizes[] = {8, 24, 128, 144, 256, 512};
348 int i, j, fsi, hpi,
width, dstWi;
366 const uint8_t *
src,
const int16_t *
filter,
367 const int32_t *filterPos,
int filterSize);
379 width = filter_sizes[fsi];
381 c->srcBpc = hscale_pairs[hpi][0];
382 c->dstBpc = hscale_pairs[hpi][1];
383 c->hLumFilterSize =
c->hChrFilterSize =
width;
402 for (j = 0; j <
width; j++) {
422 memset(dst0, 0,
SRC_PIXELS *
sizeof(dst0[0]));
423 memset(dst1, 0,
SRC_PIXELS *
sizeof(dst1[0]));
427 if (memcmp(dst0, dst1,
sws->
dst_w *
sizeof(dst0[0])))