2015-07-13 21:11:25 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2015 Henrik Gramner
|
|
|
|
*
|
2015-07-15 20:43:43 +00:00
|
|
|
* This file is part of FFmpeg.
|
2015-07-13 21:11:25 +00:00
|
|
|
*
|
2015-07-15 20:43:43 +00:00
|
|
|
* FFmpeg is free software; you can redistribute it and/or modify
|
2015-07-13 21:11:25 +00:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
2015-07-15 20:43:43 +00:00
|
|
|
* FFmpeg is distributed in the hope that it will be useful,
|
2015-07-13 21:11:25 +00:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
2015-07-15 20:43:43 +00:00
|
|
|
* with FFmpeg; if not, write to the Free Software Foundation, Inc.,
|
2015-07-13 21:11:25 +00:00
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
#include "checkasm.h"
|
|
|
|
#include "libavcodec/h264qpel.h"
|
|
|
|
#include "libavutil/common.h"
|
2015-07-22 22:35:18 +00:00
|
|
|
#include "libavutil/internal.h"
|
2015-07-13 21:11:25 +00:00
|
|
|
#include "libavutil/intreadwrite.h"
|
2020-06-10 13:38:08 +00:00
|
|
|
#include "libavutil/mem_internal.h"
|
2015-07-13 21:11:25 +00:00
|
|
|
|
|
|
|
static const uint32_t pixel_mask[3] = { 0xffffffff, 0x01ff01ff, 0x03ff03ff };
|
|
|
|
|
|
|
|
#define SIZEOF_PIXEL ((bit_depth + 7) / 8)
|
2015-07-17 18:07:26 +00:00
|
|
|
#define BUF_SIZE (2 * 16 * (16 + 3 + 4))
|
2015-07-13 21:11:25 +00:00
|
|
|
|
2015-07-17 18:07:26 +00:00
|
|
|
#define randomize_buffers() \
|
|
|
|
do { \
|
|
|
|
uint32_t mask = pixel_mask[bit_depth - 8]; \
|
|
|
|
int k; \
|
|
|
|
for (k = 0; k < BUF_SIZE; k += 4) { \
|
|
|
|
uint32_t r = rnd() & mask; \
|
|
|
|
AV_WN32A(buf0 + k, r); \
|
|
|
|
AV_WN32A(buf1 + k, r); \
|
|
|
|
r = rnd(); \
|
|
|
|
AV_WN32A(dst0 + k, r); \
|
|
|
|
AV_WN32A(dst1 + k, r); \
|
|
|
|
} \
|
2015-07-13 21:11:25 +00:00
|
|
|
} while (0)
|
|
|
|
|
2015-07-17 18:07:26 +00:00
|
|
|
#define src0 (buf0 + 3 * 2 * 16) /* h264qpel functions read data from negative src pointer offsets */
|
|
|
|
#define src1 (buf1 + 3 * 2 * 16)
|
2015-07-13 21:11:25 +00:00
|
|
|
|
|
|
|
void checkasm_check_h264qpel(void)
|
|
|
|
{
|
2015-07-22 22:35:18 +00:00
|
|
|
LOCAL_ALIGNED_16(uint8_t, buf0, [BUF_SIZE]);
|
|
|
|
LOCAL_ALIGNED_16(uint8_t, buf1, [BUF_SIZE]);
|
|
|
|
LOCAL_ALIGNED_16(uint8_t, dst0, [BUF_SIZE]);
|
|
|
|
LOCAL_ALIGNED_16(uint8_t, dst1, [BUF_SIZE]);
|
2015-07-13 21:11:25 +00:00
|
|
|
H264QpelContext h;
|
|
|
|
int op, bit_depth, i, j;
|
2015-12-11 13:06:38 +00:00
|
|
|
declare_func_emms(AV_CPU_FLAG_MMX | AV_CPU_FLAG_MMXEXT, void, uint8_t *dst, const uint8_t *src, ptrdiff_t stride);
|
2015-07-13 21:11:25 +00:00
|
|
|
|
|
|
|
for (op = 0; op < 2; op++) {
|
|
|
|
qpel_mc_func (*tab)[16] = op ? h.avg_h264_qpel_pixels_tab : h.put_h264_qpel_pixels_tab;
|
|
|
|
const char *op_name = op ? "avg" : "put";
|
|
|
|
|
|
|
|
for (bit_depth = 8; bit_depth <= 10; bit_depth++) {
|
|
|
|
ff_h264qpel_init(&h, bit_depth);
|
|
|
|
for (i = 0; i < (op ? 3 : 4); i++) {
|
|
|
|
int size = 16 >> i;
|
2015-07-17 18:07:26 +00:00
|
|
|
for (j = 0; j < 16; j++)
|
|
|
|
if (check_func(tab[i][j], "%s_h264_qpel_%d_mc%d%d_%d", op_name, size, j & 3, j >> 2, bit_depth)) {
|
2015-07-13 21:11:25 +00:00
|
|
|
randomize_buffers();
|
2015-08-16 11:00:21 +00:00
|
|
|
call_ref(dst0, src0, size * SIZEOF_PIXEL);
|
|
|
|
call_new(dst1, src1, size * SIZEOF_PIXEL);
|
2015-07-13 21:11:25 +00:00
|
|
|
if (memcmp(buf0, buf1, BUF_SIZE) || memcmp(dst0, dst1, BUF_SIZE))
|
|
|
|
fail();
|
2015-08-16 11:00:21 +00:00
|
|
|
bench_new(dst1, src1, size * SIZEOF_PIXEL);
|
2015-07-13 21:11:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-07-24 21:46:20 +00:00
|
|
|
report("%s", op_name);
|
2015-07-13 21:11:25 +00:00
|
|
|
}
|
|
|
|
}
|