mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-30 03:12:08 +00:00
checkasm: pass context as pointer
Signed-off-by: xufuji456 <839789740@qq.com> Signed-off-by: Martin Storsjö <martin@martin.st>
This commit is contained in:
parent
30def6365d
commit
1e91a39502
@ -66,7 +66,7 @@ static void compare_add_res(int size, ptrdiff_t stride, int overflow_test, int m
|
||||
bench_new(dst1, res1, stride);
|
||||
}
|
||||
|
||||
static void check_add_res(HEVCDSPContext h, int bit_depth)
|
||||
static void check_add_res(HEVCDSPContext *h, int bit_depth)
|
||||
{
|
||||
int i;
|
||||
int mask = bit_depth == 8 ? 0xFFFF : bit_depth == 10 ? 0x03FF : 0x07FF;
|
||||
@ -76,7 +76,7 @@ static void check_add_res(HEVCDSPContext h, int bit_depth)
|
||||
int size = block_size * block_size;
|
||||
ptrdiff_t stride = block_size << (bit_depth > 8);
|
||||
|
||||
if (check_func(h.add_residual[i - 2], "hevc_add_res_%dx%d_%d", block_size, block_size, bit_depth)) {
|
||||
if (check_func(h->add_residual[i - 2], "hevc_add_res_%dx%d_%d", block_size, block_size, bit_depth)) {
|
||||
compare_add_res(size, stride, 0, mask);
|
||||
// overflow test for res = -32768
|
||||
compare_add_res(size, stride, 1, mask);
|
||||
@ -92,7 +92,7 @@ void checkasm_check_hevc_add_res(void)
|
||||
HEVCDSPContext h;
|
||||
|
||||
ff_hevc_dsp_init(&h, bit_depth);
|
||||
check_add_res(h, bit_depth);
|
||||
check_add_res(&h, bit_depth);
|
||||
}
|
||||
report("add_residual");
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ static const uint32_t pixel_mask[3] = { 0xffffffff, 0x03ff03ff, 0x0fff0fff };
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
static void check_deblock_chroma(HEVCDSPContext h, int bit_depth)
|
||||
static void check_deblock_chroma(HEVCDSPContext *h, int bit_depth)
|
||||
{
|
||||
int32_t tc[2] = { 0, 0 };
|
||||
// no_p, no_q can only be { 0,0 } for the simpler assembly (non *_c
|
||||
@ -57,7 +57,7 @@ static void check_deblock_chroma(HEVCDSPContext h, int bit_depth)
|
||||
|
||||
declare_func_emms(AV_CPU_FLAG_MMX, void, uint8_t *pix, ptrdiff_t stride, int32_t *tc, uint8_t *no_p, uint8_t *no_q);
|
||||
|
||||
if (check_func(h.hevc_h_loop_filter_chroma, "hevc_h_loop_filter_chroma%d", bit_depth)) {
|
||||
if (check_func(h->hevc_h_loop_filter_chroma, "hevc_h_loop_filter_chroma%d", bit_depth)) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
randomize_buffers(buf0, buf1, BUF_SIZE);
|
||||
// see betatable[] in hevc_filter.c
|
||||
@ -72,7 +72,7 @@ static void check_deblock_chroma(HEVCDSPContext h, int bit_depth)
|
||||
bench_new(buf1 + BUF_OFFSET, BUF_STRIDE, tc, no_p, no_q);
|
||||
}
|
||||
|
||||
if (check_func(h.hevc_v_loop_filter_chroma, "hevc_v_loop_filter_chroma%d", bit_depth)) {
|
||||
if (check_func(h->hevc_v_loop_filter_chroma, "hevc_v_loop_filter_chroma%d", bit_depth)) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
randomize_buffers(buf0, buf1, BUF_SIZE);
|
||||
// see betatable[] in hevc_filter.c
|
||||
@ -95,7 +95,7 @@ void checkasm_check_hevc_deblock(void)
|
||||
for (bit_depth = 8; bit_depth <= 12; bit_depth += 2) {
|
||||
HEVCDSPContext h;
|
||||
ff_hevc_dsp_init(&h, bit_depth);
|
||||
check_deblock_chroma(h, bit_depth);
|
||||
check_deblock_chroma(&h, bit_depth);
|
||||
}
|
||||
report("chroma");
|
||||
}
|
||||
|
@ -36,7 +36,7 @@
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
static void check_idct(HEVCDSPContext h, int bit_depth)
|
||||
static void check_idct(HEVCDSPContext *h, int bit_depth)
|
||||
{
|
||||
int i;
|
||||
LOCAL_ALIGNED(32, int16_t, coeffs0, [32 * 32]);
|
||||
@ -50,7 +50,7 @@ static void check_idct(HEVCDSPContext h, int bit_depth)
|
||||
|
||||
randomize_buffers(coeffs0, size);
|
||||
memcpy(coeffs1, coeffs0, sizeof(*coeffs0) * size);
|
||||
if (check_func(h.idct[i - 2], "hevc_idct_%dx%d_%d", block_size, block_size, bit_depth)) {
|
||||
if (check_func(h->idct[i - 2], "hevc_idct_%dx%d_%d", block_size, block_size, bit_depth)) {
|
||||
call_ref(coeffs0, col_limit);
|
||||
call_new(coeffs1, col_limit);
|
||||
if (memcmp(coeffs0, coeffs1, sizeof(*coeffs0) * size))
|
||||
@ -60,7 +60,7 @@ static void check_idct(HEVCDSPContext h, int bit_depth)
|
||||
}
|
||||
}
|
||||
|
||||
static void check_idct_dc(HEVCDSPContext h, int bit_depth)
|
||||
static void check_idct_dc(HEVCDSPContext *h, int bit_depth)
|
||||
{
|
||||
int i;
|
||||
LOCAL_ALIGNED(32, int16_t, coeffs0, [32 * 32]);
|
||||
@ -74,7 +74,7 @@ static void check_idct_dc(HEVCDSPContext h, int bit_depth)
|
||||
randomize_buffers(coeffs0, size);
|
||||
memcpy(coeffs1, coeffs0, sizeof(*coeffs0) * size);
|
||||
|
||||
if (check_func(h.idct_dc[i - 2], "hevc_idct_%dx%d_dc_%d", block_size, block_size, bit_depth)) {
|
||||
if (check_func(h->idct_dc[i - 2], "hevc_idct_%dx%d_dc_%d", block_size, block_size, bit_depth)) {
|
||||
call_ref(coeffs0);
|
||||
call_new(coeffs1);
|
||||
if (memcmp(coeffs0, coeffs1, sizeof(*coeffs0) * size))
|
||||
@ -113,7 +113,7 @@ void checkasm_check_hevc_idct(void)
|
||||
HEVCDSPContext h;
|
||||
|
||||
ff_hevc_dsp_init(&h, bit_depth);
|
||||
check_idct_dc(h, bit_depth);
|
||||
check_idct_dc(&h, bit_depth);
|
||||
}
|
||||
report("idct_dc");
|
||||
|
||||
@ -121,7 +121,7 @@ void checkasm_check_hevc_idct(void)
|
||||
HEVCDSPContext h;
|
||||
|
||||
ff_hevc_dsp_init(&h, bit_depth);
|
||||
check_idct(h, bit_depth);
|
||||
check_idct(&h, bit_depth);
|
||||
}
|
||||
report("idct");
|
||||
|
||||
|
@ -66,7 +66,7 @@ static const uint32_t sao_size[5] = {8, 16, 32, 48, 64};
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
static void check_sao_band(HEVCDSPContext h, int bit_depth)
|
||||
static void check_sao_band(HEVCDSPContext *h, int bit_depth)
|
||||
{
|
||||
int i;
|
||||
LOCAL_ALIGNED_32(uint8_t, dst0, [BUF_SIZE]);
|
||||
@ -83,7 +83,7 @@ static void check_sao_band(HEVCDSPContext h, int bit_depth)
|
||||
declare_func_emms(AV_CPU_FLAG_MMX, void, uint8_t *dst, uint8_t *src, ptrdiff_t dst_stride, ptrdiff_t src_stride,
|
||||
int16_t *sao_offset_val, int sao_left_class, int width, int height);
|
||||
|
||||
if (check_func(h.sao_band_filter[i], "hevc_sao_band_%d_%d", block_size, bit_depth)) {
|
||||
if (check_func(h->sao_band_filter[i], "hevc_sao_band_%d_%d", block_size, bit_depth)) {
|
||||
|
||||
for (int w = prev_size + 4; w <= block_size; w += 4) {
|
||||
randomize_buffers(src0, src1, BUF_SIZE);
|
||||
@ -103,7 +103,7 @@ static void check_sao_band(HEVCDSPContext h, int bit_depth)
|
||||
}
|
||||
}
|
||||
|
||||
static void check_sao_edge(HEVCDSPContext h, int bit_depth)
|
||||
static void check_sao_edge(HEVCDSPContext *h, int bit_depth)
|
||||
{
|
||||
int i;
|
||||
LOCAL_ALIGNED_32(uint8_t, dst0, [BUF_SIZE]);
|
||||
@ -127,7 +127,7 @@ static void check_sao_edge(HEVCDSPContext h, int bit_depth)
|
||||
memset(dst0, 0, BUF_SIZE);
|
||||
memset(dst1, 0, BUF_SIZE);
|
||||
|
||||
if (check_func(h.sao_edge_filter[i], "hevc_sao_edge_%d_%d", block_size, bit_depth)) {
|
||||
if (check_func(h->sao_edge_filter[i], "hevc_sao_edge_%d_%d", block_size, bit_depth)) {
|
||||
call_ref(dst0, src0 + offset, stride, offset_val, eo, w, block_size);
|
||||
call_new(dst1, src1 + offset, stride, offset_val, eo, w, block_size);
|
||||
for (int j = 0; j < block_size; j++) {
|
||||
@ -148,7 +148,7 @@ void checkasm_check_hevc_sao(void)
|
||||
HEVCDSPContext h;
|
||||
|
||||
ff_hevc_dsp_init(&h, bit_depth);
|
||||
check_sao_band(h, bit_depth);
|
||||
check_sao_band(&h, bit_depth);
|
||||
}
|
||||
report("sao_band");
|
||||
|
||||
@ -156,7 +156,7 @@ void checkasm_check_hevc_sao(void)
|
||||
HEVCDSPContext h;
|
||||
|
||||
ff_hevc_dsp_init(&h, bit_depth);
|
||||
check_sao_edge(h, bit_depth);
|
||||
check_sao_edge(&h, bit_depth);
|
||||
}
|
||||
report("sao_edge");
|
||||
}
|
||||
|
@ -35,7 +35,7 @@
|
||||
buf[j] = rnd() & 0xFFFF; \
|
||||
} while (0)
|
||||
|
||||
static void check_add_int16(HuffYUVDSPContext c, unsigned mask, int width, const char * name)
|
||||
static void check_add_int16(HuffYUVDSPContext *c, unsigned mask, int width, const char * name)
|
||||
{
|
||||
uint16_t *src0 = av_mallocz(width * sizeof(uint16_t));
|
||||
uint16_t *src1 = av_mallocz(width * sizeof(uint16_t));
|
||||
@ -50,7 +50,7 @@ static void check_add_int16(HuffYUVDSPContext c, unsigned mask, int width, const
|
||||
randomize_buffers(src0, width);
|
||||
memcpy(src1, src0, width * sizeof(uint16_t));
|
||||
|
||||
if (check_func(c.add_int16, "%s", name)) {
|
||||
if (check_func(c->add_int16, "%s", name)) {
|
||||
call_ref(dst0, src0, mask, width);
|
||||
call_new(dst1, src1, mask, width);
|
||||
if (memcmp(dst0, dst1, width * sizeof(uint16_t)))
|
||||
@ -72,10 +72,10 @@ void checkasm_check_huffyuvdsp(void)
|
||||
ff_huffyuvdsp_init(&c, AV_PIX_FMT_YUV422P);
|
||||
|
||||
/*! test width not multiple of mmsize */
|
||||
check_add_int16(c, 65535, width, "add_int16_rnd_width");
|
||||
check_add_int16(&c, 65535, width, "add_int16_rnd_width");
|
||||
report("add_int16_rnd_width");
|
||||
|
||||
/*! test always with the same size (for perf test) */
|
||||
check_add_int16(c, 65535, 16*128, "add_int16_128");
|
||||
check_add_int16(&c, 65535, 16*128, "add_int16_128");
|
||||
report("add_int16_128");
|
||||
}
|
||||
|
@ -42,7 +42,7 @@
|
||||
randomize_buffers(a0, width * sizeof(type));\
|
||||
memcpy(a1, a0, width*sizeof(type));\
|
||||
|
||||
static void check_add_bytes(LLVidDSPContext c, int width)
|
||||
static void check_add_bytes(LLVidDSPContext *c, int width)
|
||||
{
|
||||
uint8_t *dst0 = av_mallocz(width);
|
||||
uint8_t *dst1 = av_mallocz(width);
|
||||
@ -56,7 +56,7 @@ static void check_add_bytes(LLVidDSPContext c, int width)
|
||||
fail();
|
||||
|
||||
|
||||
if (check_func(c.add_bytes, "add_bytes")) {
|
||||
if (check_func(c->add_bytes, "add_bytes")) {
|
||||
call_ref(dst0, src0, width);
|
||||
call_new(dst1, src1, width);
|
||||
if (memcmp(dst0, dst1, width))
|
||||
@ -70,7 +70,7 @@ static void check_add_bytes(LLVidDSPContext c, int width)
|
||||
av_free(dst1);
|
||||
}
|
||||
|
||||
static void check_add_median_pred(LLVidDSPContext c, int width) {
|
||||
static void check_add_median_pred(LLVidDSPContext *c, int width) {
|
||||
int A0, A1, B0, B1;
|
||||
uint8_t *dst0 = av_mallocz(width);
|
||||
uint8_t *dst1 = av_mallocz(width);
|
||||
@ -91,7 +91,7 @@ static void check_add_median_pred(LLVidDSPContext c, int width) {
|
||||
B1 = B0;
|
||||
|
||||
|
||||
if (check_func(c.add_median_pred, "add_median_pred")) {
|
||||
if (check_func(c->add_median_pred, "add_median_pred")) {
|
||||
call_ref(dst0, src0, diff0, width, &A0, &B0);
|
||||
call_new(dst1, src1, diff1, width, &A1, &B1);
|
||||
if (memcmp(dst0, dst1, width) || (A0 != A1) || (B0 != B1))
|
||||
@ -107,7 +107,7 @@ static void check_add_median_pred(LLVidDSPContext c, int width) {
|
||||
av_free(dst1);
|
||||
}
|
||||
|
||||
static void check_add_left_pred(LLVidDSPContext c, int width, int acc, const char * report)
|
||||
static void check_add_left_pred(LLVidDSPContext *c, int width, int acc, const char * report)
|
||||
{
|
||||
int res0, res1;
|
||||
uint8_t *dst0 = av_mallocz(width);
|
||||
@ -121,7 +121,7 @@ static void check_add_left_pred(LLVidDSPContext c, int width, int acc, const cha
|
||||
if (!dst0 || !dst1)
|
||||
fail();
|
||||
|
||||
if (check_func(c.add_left_pred, "%s", report)) {
|
||||
if (check_func(c->add_left_pred, "%s", report)) {
|
||||
res0 = call_ref(dst0, src0, width, acc);
|
||||
res1 = call_new(dst1, src1, width, acc);
|
||||
if ((res0 & 0xFF) != (res1 & 0xFF)||\
|
||||
@ -136,7 +136,7 @@ static void check_add_left_pred(LLVidDSPContext c, int width, int acc, const cha
|
||||
av_free(dst1);
|
||||
}
|
||||
|
||||
static void check_add_left_pred_16(LLVidDSPContext c, unsigned mask, int width, unsigned acc, const char * report)
|
||||
static void check_add_left_pred_16(LLVidDSPContext *c, unsigned mask, int width, unsigned acc, const char * report)
|
||||
{
|
||||
int res0, res1;
|
||||
uint16_t *dst0 = av_calloc(width, sizeof(*dst0));
|
||||
@ -150,7 +150,7 @@ static void check_add_left_pred_16(LLVidDSPContext c, unsigned mask, int width,
|
||||
if (!dst0 || !dst1)
|
||||
fail();
|
||||
|
||||
if (check_func(c.add_left_pred_int16, "%s", report)) {
|
||||
if (check_func(c->add_left_pred_int16, "%s", report)) {
|
||||
res0 = call_ref(dst0, src0, mask, width, acc);
|
||||
res1 = call_new(dst1, src1, mask, width, acc);
|
||||
if ((res0 &0xFFFF) != (res1 &0xFFFF)||\
|
||||
@ -165,7 +165,7 @@ static void check_add_left_pred_16(LLVidDSPContext c, unsigned mask, int width,
|
||||
av_free(dst1);
|
||||
}
|
||||
|
||||
static void check_add_gradient_pred(LLVidDSPContext c, int w) {
|
||||
static void check_add_gradient_pred(LLVidDSPContext *c, int w) {
|
||||
int src_size, stride;
|
||||
uint8_t *src0, *src1;
|
||||
declare_func(void, uint8_t *src, const ptrdiff_t stride,
|
||||
@ -178,7 +178,7 @@ static void check_add_gradient_pred(LLVidDSPContext c, int w) {
|
||||
|
||||
init_buffer(src0, src1, uint8_t, src_size);
|
||||
|
||||
if (check_func(c.add_gradient_pred, "add_gradient_pred")) {
|
||||
if (check_func(c->add_gradient_pred, "add_gradient_pred")) {
|
||||
call_ref(src0 + stride + 32, stride, w);
|
||||
call_new(src1 + stride + 32, stride, w);
|
||||
if (memcmp(src0, src1, stride)||/* previous line doesn't change */
|
||||
@ -200,21 +200,21 @@ void checkasm_check_llviddsp(void)
|
||||
|
||||
ff_llviddsp_init(&c);
|
||||
|
||||
check_add_bytes(c, width);
|
||||
check_add_bytes(&c, width);
|
||||
report("add_bytes");
|
||||
|
||||
check_add_median_pred(c, width);
|
||||
check_add_median_pred(&c, width);
|
||||
report("add_median_pred");
|
||||
|
||||
check_add_left_pred(c, width, 0, "add_left_pred_zero");
|
||||
check_add_left_pred(&c, width, 0, "add_left_pred_zero");
|
||||
report("add_left_pred_zero");
|
||||
|
||||
check_add_left_pred(c, width, accRnd, "add_left_pred_rnd_acc");
|
||||
check_add_left_pred(&c, width, accRnd, "add_left_pred_rnd_acc");
|
||||
report("add_left_pred_rnd_acc");
|
||||
|
||||
check_add_left_pred_16(c, 255, width, accRnd, "add_left_pred_int16");
|
||||
check_add_left_pred_16(&c, 255, width, accRnd, "add_left_pred_int16");
|
||||
report("add_left_pred_int16");
|
||||
|
||||
check_add_gradient_pred(c, width);
|
||||
check_add_gradient_pred(&c, width);
|
||||
report("add_gradient_pred");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user