123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610 |
- /*
- * Copyright (c) 2015 Henrik Gramner
- * Copyright (c) 2021 Josh Dekker
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or modify
- * 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.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * 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
- * with FFmpeg; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
- #include <string.h>
- #include "checkasm.h"
- #include "libavcodec/hevc/dsp.h"
- #include "libavutil/common.h"
- #include "libavutil/internal.h"
- #include "libavutil/intreadwrite.h"
- static const uint32_t pixel_mask[] = { 0xffffffff, 0x01ff01ff, 0x03ff03ff, 0x07ff07ff, 0x0fff0fff };
- static const uint32_t pixel_mask16[] = { 0x00ff00ff, 0x01ff01ff, 0x03ff03ff, 0x07ff07ff, 0x0fff0fff };
- static const int sizes[] = { -1, 4, 6, 8, 12, 16, 24, 32, 48, 64 };
- static const int weights[] = { 0, 128, 255, -1 };
- static const int denoms[] = {0, 7, 12, -1 };
- static const int offsets[] = {0, 255, -1 };
- #define SIZEOF_PIXEL ((bit_depth + 7) / 8)
- #define BUF_SIZE (2 * MAX_PB_SIZE * (2 * 4 + MAX_PB_SIZE))
- #define randomize_buffers() \
- do { \
- uint32_t mask = pixel_mask[bit_depth - 8]; \
- int k; \
- for (k = 0; k < BUF_SIZE + SRC_EXTRA; k += 4) { \
- uint32_t r = rnd() & mask; \
- AV_WN32A(buf0 + k, r); \
- AV_WN32A(buf1 + k, r); \
- if (k >= BUF_SIZE) \
- continue; \
- r = rnd(); \
- AV_WN32A(dst0 + k, r); \
- AV_WN32A(dst1 + k, r); \
- } \
- } while (0)
- #define randomize_buffers_ref() \
- randomize_buffers(); \
- do { \
- uint32_t mask = pixel_mask16[bit_depth - 8]; \
- int k; \
- for (k = 0; k < BUF_SIZE; k += 2) { \
- uint32_t r = rnd() & mask; \
- AV_WN32A(ref0 + k, r); \
- AV_WN32A(ref1 + k, r); \
- } \
- } while (0)
- #define src0 (buf0 + 2 * 4 * MAX_PB_SIZE) /* hevc qpel functions read data from negative src pointer offsets */
- #define src1 (buf1 + 2 * 4 * MAX_PB_SIZE)
- /* FIXME: Does the need for SRC_EXTRA for these tests indicate a bug? */
- #define SRC_EXTRA 8
- static void checkasm_check_hevc_qpel(void)
- {
- LOCAL_ALIGNED_32(uint8_t, buf0, [BUF_SIZE + SRC_EXTRA]);
- LOCAL_ALIGNED_32(uint8_t, buf1, [BUF_SIZE + SRC_EXTRA]);
- LOCAL_ALIGNED_32(uint8_t, dst0, [BUF_SIZE]);
- LOCAL_ALIGNED_32(uint8_t, dst1, [BUF_SIZE]);
- HEVCDSPContext h;
- int size, bit_depth, i, j;
- declare_func(void, int16_t *dst, const uint8_t *src, ptrdiff_t srcstride,
- int height, intptr_t mx, intptr_t my, int width);
- for (bit_depth = 8; bit_depth <= 12; bit_depth++) {
- ff_hevc_dsp_init(&h, bit_depth);
- for (i = 0; i < 2; i++) {
- for (j = 0; j < 2; j++) {
- for (size = 1; size < 10; size++) {
- const char *type;
- switch ((j << 1) | i) {
- case 0: type = "pel_pixels"; break; // 0 0
- case 1: type = "qpel_h"; break; // 0 1
- case 2: type = "qpel_v"; break; // 1 0
- case 3: type = "qpel_hv"; break; // 1 1
- }
- if (check_func(h.put_hevc_qpel[size][j][i],
- "put_hevc_%s%d_%d", type, sizes[size], bit_depth)) {
- int16_t *dstw0 = (int16_t *) dst0, *dstw1 = (int16_t *) dst1;
- randomize_buffers();
- call_ref(dstw0, src0, sizes[size] * SIZEOF_PIXEL, sizes[size], i, j, sizes[size]);
- call_new(dstw1, src1, sizes[size] * SIZEOF_PIXEL, sizes[size], i, j, sizes[size]);
- checkasm_check(int16_t, dstw0, MAX_PB_SIZE * sizeof(int16_t),
- dstw1, MAX_PB_SIZE * sizeof(int16_t),
- size[sizes], size[sizes], "dst");
- bench_new(dstw1, src1, sizes[size] * SIZEOF_PIXEL, sizes[size], i, j, sizes[size]);
- }
- }
- }
- }
- }
- report("qpel");
- }
- static void checkasm_check_hevc_qpel_uni(void)
- {
- LOCAL_ALIGNED_32(uint8_t, buf0, [BUF_SIZE + SRC_EXTRA]);
- LOCAL_ALIGNED_32(uint8_t, buf1, [BUF_SIZE + SRC_EXTRA]);
- LOCAL_ALIGNED_32(uint8_t, dst0, [BUF_SIZE]);
- LOCAL_ALIGNED_32(uint8_t, dst1, [BUF_SIZE]);
- HEVCDSPContext h;
- int size, bit_depth, i, j;
- declare_func(void, uint8_t *dst, ptrdiff_t dststride, const uint8_t *src, ptrdiff_t srcstride,
- int height, intptr_t mx, intptr_t my, int width);
- for (bit_depth = 8; bit_depth <= 12; bit_depth++) {
- ff_hevc_dsp_init(&h, bit_depth);
- for (i = 0; i < 2; i++) {
- for (j = 0; j < 2; j++) {
- for (size = 1; size < 10; size++) {
- const char *type;
- switch ((j << 1) | i) {
- case 0: type = "pel_uni_pixels"; break; // 0 0
- case 1: type = "qpel_uni_h"; break; // 0 1
- case 2: type = "qpel_uni_v"; break; // 1 0
- case 3: type = "qpel_uni_hv"; break; // 1 1
- }
- if (check_func(h.put_hevc_qpel_uni[size][j][i],
- "put_hevc_%s%d_%d", type, sizes[size], bit_depth)) {
- randomize_buffers();
- call_ref(dst0, sizes[size] * SIZEOF_PIXEL,
- src0, sizes[size] * SIZEOF_PIXEL,
- sizes[size], i, j, sizes[size]);
- call_new(dst1, sizes[size] * SIZEOF_PIXEL,
- src1, sizes[size] * SIZEOF_PIXEL,
- sizes[size], i, j, sizes[size]);
- checkasm_check_pixel(dst0, sizes[size] * SIZEOF_PIXEL,
- dst1, sizes[size] * SIZEOF_PIXEL,
- size[sizes], size[sizes], "dst");
- bench_new(dst1, sizes[size] * SIZEOF_PIXEL,
- src1, sizes[size] * SIZEOF_PIXEL,
- sizes[size], i, j, sizes[size]);
- }
- }
- }
- }
- }
- report("qpel_uni");
- }
- static void checkasm_check_hevc_qpel_uni_w(void)
- {
- LOCAL_ALIGNED_32(uint8_t, buf0, [BUF_SIZE + SRC_EXTRA]);
- LOCAL_ALIGNED_32(uint8_t, buf1, [BUF_SIZE + SRC_EXTRA]);
- LOCAL_ALIGNED_32(uint8_t, dst0, [BUF_SIZE]);
- LOCAL_ALIGNED_32(uint8_t, dst1, [BUF_SIZE]);
- HEVCDSPContext h;
- int size, bit_depth, i, j;
- const int *denom, *wx, *ox;
- declare_func(void, uint8_t *dst, ptrdiff_t dststride, const uint8_t *src, ptrdiff_t srcstride,
- int height, int denom, int wx, int ox, intptr_t mx, intptr_t my, int width);
- for (bit_depth = 8; bit_depth <= 12; bit_depth++) {
- ff_hevc_dsp_init(&h, bit_depth);
- for (i = 0; i < 2; i++) {
- for (j = 0; j < 2; j++) {
- for (size = 1; size < 10; size++) {
- const char *type;
- switch ((j << 1) | i) {
- case 0: type = "pel_uni_w_pixels"; break; // 0 0
- case 1: type = "qpel_uni_w_h"; break; // 0 1
- case 2: type = "qpel_uni_w_v"; break; // 1 0
- case 3: type = "qpel_uni_w_hv"; break; // 1 1
- }
- if (check_func(h.put_hevc_qpel_uni_w[size][j][i],
- "put_hevc_%s%d_%d", type, sizes[size], bit_depth)) {
- for (denom = denoms; *denom >= 0; denom++) {
- for (wx = weights; *wx >= 0; wx++) {
- for (ox = offsets; *ox >= 0; ox++) {
- randomize_buffers();
- call_ref(dst0, sizes[size] * SIZEOF_PIXEL,
- src0, sizes[size] * SIZEOF_PIXEL,
- sizes[size], *denom, *wx, *ox, i, j, sizes[size]);
- call_new(dst1, sizes[size] * SIZEOF_PIXEL,
- src1, sizes[size] * SIZEOF_PIXEL,
- sizes[size], *denom, *wx, *ox, i, j, sizes[size]);
- checkasm_check_pixel(dst0, sizes[size] * SIZEOF_PIXEL,
- dst1, sizes[size] * SIZEOF_PIXEL,
- size[sizes], size[sizes], "dst");
- bench_new(dst1, sizes[size] * SIZEOF_PIXEL,
- src1, sizes[size] * SIZEOF_PIXEL,
- sizes[size], *denom, *wx, *ox, i, j, sizes[size]);
- }
- }
- }
- }
- }
- }
- }
- }
- report("qpel_uni_w");
- }
- static void checkasm_check_hevc_qpel_bi(void)
- {
- LOCAL_ALIGNED_32(uint8_t, buf0, [BUF_SIZE + SRC_EXTRA]);
- LOCAL_ALIGNED_32(uint8_t, buf1, [BUF_SIZE + SRC_EXTRA]);
- LOCAL_ALIGNED_32(uint8_t, dst0, [BUF_SIZE]);
- LOCAL_ALIGNED_32(uint8_t, dst1, [BUF_SIZE]);
- LOCAL_ALIGNED_32(int16_t, ref0, [BUF_SIZE]);
- LOCAL_ALIGNED_32(int16_t, ref1, [BUF_SIZE]);
- HEVCDSPContext h;
- int size, bit_depth, i, j;
- declare_func(void, uint8_t *dst, ptrdiff_t dststride, const uint8_t *src, ptrdiff_t srcstride,
- const int16_t *src2,
- int height, intptr_t mx, intptr_t my, int width);
- for (bit_depth = 8; bit_depth <= 12; bit_depth++) {
- ff_hevc_dsp_init(&h, bit_depth);
- for (i = 0; i < 2; i++) {
- for (j = 0; j < 2; j++) {
- for (size = 1; size < 10; size++) {
- const char *type;
- switch ((j << 1) | i) {
- case 0: type = "pel_bi_pixels"; break; // 0 0
- case 1: type = "qpel_bi_h"; break; // 0 1
- case 2: type = "qpel_bi_v"; break; // 1 0
- case 3: type = "qpel_bi_hv"; break; // 1 1
- }
- if (check_func(h.put_hevc_qpel_bi[size][j][i],
- "put_hevc_%s%d_%d", type, sizes[size], bit_depth)) {
- randomize_buffers_ref();
- call_ref(dst0, sizes[size] * SIZEOF_PIXEL,
- src0, sizes[size] * SIZEOF_PIXEL,
- ref0, sizes[size], i, j, sizes[size]);
- call_new(dst1, sizes[size] * SIZEOF_PIXEL,
- src1, sizes[size] * SIZEOF_PIXEL,
- ref1, sizes[size], i, j, sizes[size]);
- checkasm_check_pixel(dst0, sizes[size] * SIZEOF_PIXEL,
- dst1, sizes[size] * SIZEOF_PIXEL,
- size[sizes], size[sizes], "dst");
- bench_new(dst1, sizes[size] * SIZEOF_PIXEL,
- src1, sizes[size] * SIZEOF_PIXEL,
- ref1, sizes[size], i, j, sizes[size]);
- }
- }
- }
- }
- }
- report("qpel_bi");
- }
- static void checkasm_check_hevc_qpel_bi_w(void)
- {
- LOCAL_ALIGNED_32(uint8_t, buf0, [BUF_SIZE + SRC_EXTRA]);
- LOCAL_ALIGNED_32(uint8_t, buf1, [BUF_SIZE + SRC_EXTRA]);
- LOCAL_ALIGNED_32(uint8_t, dst0, [BUF_SIZE]);
- LOCAL_ALIGNED_32(uint8_t, dst1, [BUF_SIZE]);
- LOCAL_ALIGNED_32(int16_t, ref0, [BUF_SIZE]);
- LOCAL_ALIGNED_32(int16_t, ref1, [BUF_SIZE]);
- HEVCDSPContext h;
- int size, bit_depth, i, j;
- const int *denom, *wx, *ox;
- declare_func(void, uint8_t *dst, ptrdiff_t dststride, const uint8_t *src, ptrdiff_t srcstride,
- const int16_t *src2,
- int height, int denom, int wx0, int wx1,
- int ox0, int ox1, intptr_t mx, intptr_t my, int width);
- for (bit_depth = 8; bit_depth <= 12; bit_depth++) {
- ff_hevc_dsp_init(&h, bit_depth);
- for (i = 0; i < 2; i++) {
- for (j = 0; j < 2; j++) {
- for (size = 1; size < 10; size++) {
- const char *type;
- switch ((j << 1) | i) {
- case 0: type = "pel_bi_w_pixels"; break; // 0 0
- case 1: type = "qpel_bi_w_h"; break; // 0 1
- case 2: type = "qpel_bi_w_v"; break; // 1 0
- case 3: type = "qpel_bi_w_hv"; break; // 1 1
- }
- if (check_func(h.put_hevc_qpel_bi_w[size][j][i],
- "put_hevc_%s%d_%d", type, sizes[size], bit_depth)) {
- for (denom = denoms; *denom >= 0; denom++) {
- for (wx = weights; *wx >= 0; wx++) {
- for (ox = offsets; *ox >= 0; ox++) {
- randomize_buffers_ref();
- call_ref(dst0, sizes[size] * SIZEOF_PIXEL,
- src0, sizes[size] * SIZEOF_PIXEL,
- ref0, sizes[size], *denom, *wx, *wx, *ox, *ox, i, j, sizes[size]);
- call_new(dst1, sizes[size] * SIZEOF_PIXEL,
- src1, sizes[size] * SIZEOF_PIXEL,
- ref1, sizes[size], *denom, *wx, *wx, *ox, *ox, i, j, sizes[size]);
- checkasm_check_pixel(dst0, sizes[size] * SIZEOF_PIXEL,
- dst1, sizes[size] * SIZEOF_PIXEL,
- size[sizes], size[sizes], "dst");
- bench_new(dst1, sizes[size] * SIZEOF_PIXEL,
- src1, sizes[size] * SIZEOF_PIXEL,
- ref1, sizes[size], *denom, *wx, *wx, *ox, *ox, i, j, sizes[size]);
- }
- }
- }
- }
- }
- }
- }
- }
- report("qpel_bi_w");
- }
- #undef SRC_EXTRA
- #define SRC_EXTRA 0
- static void checkasm_check_hevc_epel(void)
- {
- LOCAL_ALIGNED_32(uint8_t, buf0, [BUF_SIZE]);
- LOCAL_ALIGNED_32(uint8_t, buf1, [BUF_SIZE]);
- LOCAL_ALIGNED_32(uint8_t, dst0, [BUF_SIZE]);
- LOCAL_ALIGNED_32(uint8_t, dst1, [BUF_SIZE]);
- HEVCDSPContext h;
- int size, bit_depth, i, j;
- declare_func(void, int16_t *dst, const uint8_t *src, ptrdiff_t srcstride,
- int height, intptr_t mx, intptr_t my, int width);
- for (bit_depth = 8; bit_depth <= 12; bit_depth++) {
- ff_hevc_dsp_init(&h, bit_depth);
- for (i = 0; i < 2; i++) {
- for (j = 0; j < 2; j++) {
- for (size = 1; size < 10; size++) {
- const char *type;
- switch ((j << 1) | i) {
- case 0: type = "pel_pixels"; break; // 0 0
- case 1: type = "epel_h"; break; // 0 1
- case 2: type = "epel_v"; break; // 1 0
- case 3: type = "epel_hv"; break; // 1 1
- }
- if (check_func(h.put_hevc_epel[size][j][i],
- "put_hevc_%s%d_%d", type, sizes[size], bit_depth)) {
- int16_t *dstw0 = (int16_t *) dst0, *dstw1 = (int16_t *) dst1;
- randomize_buffers();
- call_ref(dstw0, src0, sizes[size] * SIZEOF_PIXEL, sizes[size], i, j, sizes[size]);
- call_new(dstw1, src1, sizes[size] * SIZEOF_PIXEL, sizes[size], i, j, sizes[size]);
- checkasm_check(int16_t, dstw0, MAX_PB_SIZE * sizeof(int16_t),
- dstw1, MAX_PB_SIZE * sizeof(int16_t),
- size[sizes], size[sizes], "dst");
- bench_new(dstw1, src1, sizes[size] * SIZEOF_PIXEL, sizes[size], i, j, sizes[size]);
- }
- }
- }
- }
- }
- report("epel");
- }
- static void checkasm_check_hevc_epel_uni(void)
- {
- LOCAL_ALIGNED_32(uint8_t, buf0, [BUF_SIZE]);
- LOCAL_ALIGNED_32(uint8_t, buf1, [BUF_SIZE]);
- LOCAL_ALIGNED_32(uint8_t, dst0, [BUF_SIZE]);
- LOCAL_ALIGNED_32(uint8_t, dst1, [BUF_SIZE]);
- HEVCDSPContext h;
- int size, bit_depth, i, j;
- declare_func(void, uint8_t *dst, ptrdiff_t dststride, const uint8_t *src, ptrdiff_t srcstride,
- int height, intptr_t mx, intptr_t my, int width);
- for (bit_depth = 8; bit_depth <= 12; bit_depth++) {
- ff_hevc_dsp_init(&h, bit_depth);
- for (i = 0; i < 2; i++) {
- for (j = 0; j < 2; j++) {
- for (size = 1; size < 10; size++) {
- const char *type;
- switch ((j << 1) | i) {
- case 0: type = "pel_uni_pixels"; break; // 0 0
- case 1: type = "epel_uni_h"; break; // 0 1
- case 2: type = "epel_uni_v"; break; // 1 0
- case 3: type = "epel_uni_hv"; break; // 1 1
- }
- if (check_func(h.put_hevc_epel_uni[size][j][i],
- "put_hevc_%s%d_%d", type, sizes[size], bit_depth)) {
- randomize_buffers();
- call_ref(dst0, sizes[size] * SIZEOF_PIXEL,
- src0, sizes[size] * SIZEOF_PIXEL,
- sizes[size], i, j, sizes[size]);
- call_new(dst1, sizes[size] * SIZEOF_PIXEL,
- src1, sizes[size] * SIZEOF_PIXEL,
- sizes[size], i, j, sizes[size]);
- checkasm_check_pixel(dst0, sizes[size] * SIZEOF_PIXEL,
- dst1, sizes[size] * SIZEOF_PIXEL,
- size[sizes], size[sizes], "dst");
- bench_new(dst1, sizes[size] * SIZEOF_PIXEL,
- src1, sizes[size] * SIZEOF_PIXEL,
- sizes[size], i, j, sizes[size]);
- }
- }
- }
- }
- }
- report("epel_uni");
- }
- static void checkasm_check_hevc_epel_uni_w(void)
- {
- LOCAL_ALIGNED_32(uint8_t, buf0, [BUF_SIZE]);
- LOCAL_ALIGNED_32(uint8_t, buf1, [BUF_SIZE]);
- LOCAL_ALIGNED_32(uint8_t, dst0, [BUF_SIZE]);
- LOCAL_ALIGNED_32(uint8_t, dst1, [BUF_SIZE]);
- HEVCDSPContext h;
- int size, bit_depth, i, j;
- const int *denom, *wx, *ox;
- declare_func(void, uint8_t *dst, ptrdiff_t dststride, const uint8_t *src, ptrdiff_t srcstride,
- int height, int denom, int wx, int ox, intptr_t mx, intptr_t my, int width);
- for (bit_depth = 8; bit_depth <= 12; bit_depth++) {
- ff_hevc_dsp_init(&h, bit_depth);
- for (i = 0; i < 2; i++) {
- for (j = 0; j < 2; j++) {
- for (size = 1; size < 10; size++) {
- const char *type;
- switch ((j << 1) | i) {
- case 0: type = "pel_uni_w_pixels"; break; // 0 0
- case 1: type = "epel_uni_w_h"; break; // 0 1
- case 2: type = "epel_uni_w_v"; break; // 1 0
- case 3: type = "epel_uni_w_hv"; break; // 1 1
- }
- if (check_func(h.put_hevc_epel_uni_w[size][j][i],
- "put_hevc_%s%d_%d", type, sizes[size], bit_depth)) {
- for (denom = denoms; *denom >= 0; denom++) {
- for (wx = weights; *wx >= 0; wx++) {
- for (ox = offsets; *ox >= 0; ox++) {
- randomize_buffers();
- call_ref(dst0, sizes[size] * SIZEOF_PIXEL,
- src0, sizes[size] * SIZEOF_PIXEL,
- sizes[size], *denom, *wx, *ox, i, j, sizes[size]);
- call_new(dst1, sizes[size] * SIZEOF_PIXEL,
- src1, sizes[size] * SIZEOF_PIXEL,
- sizes[size], *denom, *wx, *ox, i, j, sizes[size]);
- checkasm_check_pixel(dst0, sizes[size] * SIZEOF_PIXEL,
- dst1, sizes[size] * SIZEOF_PIXEL,
- size[sizes], size[sizes], "dst");
- bench_new(dst1, sizes[size] * SIZEOF_PIXEL,
- src1, sizes[size] * SIZEOF_PIXEL,
- sizes[size], *denom, *wx, *ox, i, j, sizes[size]);
- }
- }
- }
- }
- }
- }
- }
- }
- report("epel_uni_w");
- }
- static void checkasm_check_hevc_epel_bi(void)
- {
- LOCAL_ALIGNED_32(uint8_t, buf0, [BUF_SIZE]);
- LOCAL_ALIGNED_32(uint8_t, buf1, [BUF_SIZE]);
- LOCAL_ALIGNED_32(uint8_t, dst0, [BUF_SIZE]);
- LOCAL_ALIGNED_32(uint8_t, dst1, [BUF_SIZE]);
- LOCAL_ALIGNED_32(int16_t, ref0, [BUF_SIZE]);
- LOCAL_ALIGNED_32(int16_t, ref1, [BUF_SIZE]);
- HEVCDSPContext h;
- int size, bit_depth, i, j;
- declare_func(void, uint8_t *dst, ptrdiff_t dststride, const uint8_t *src, ptrdiff_t srcstride,
- const int16_t *src2,
- int height, intptr_t mx, intptr_t my, int width);
- for (bit_depth = 8; bit_depth <= 12; bit_depth++) {
- ff_hevc_dsp_init(&h, bit_depth);
- for (i = 0; i < 2; i++) {
- for (j = 0; j < 2; j++) {
- for (size = 1; size < 10; size++) {
- const char *type;
- switch ((j << 1) | i) {
- case 0: type = "pel_bi_pixels"; break; // 0 0
- case 1: type = "epel_bi_h"; break; // 0 1
- case 2: type = "epel_bi_v"; break; // 1 0
- case 3: type = "epel_bi_hv"; break; // 1 1
- }
- if (check_func(h.put_hevc_epel_bi[size][j][i],
- "put_hevc_%s%d_%d", type, sizes[size], bit_depth)) {
- randomize_buffers_ref();
- call_ref(dst0, sizes[size] * SIZEOF_PIXEL,
- src0, sizes[size] * SIZEOF_PIXEL,
- ref0, sizes[size], i, j, sizes[size]);
- call_new(dst1, sizes[size] * SIZEOF_PIXEL,
- src1, sizes[size] * SIZEOF_PIXEL,
- ref1, sizes[size], i, j, sizes[size]);
- checkasm_check_pixel(dst0, sizes[size] * SIZEOF_PIXEL,
- dst1, sizes[size] * SIZEOF_PIXEL,
- size[sizes], size[sizes], "dst");
- bench_new(dst1, sizes[size] * SIZEOF_PIXEL,
- src1, sizes[size] * SIZEOF_PIXEL,
- ref1, sizes[size], i, j, sizes[size]);
- }
- }
- }
- }
- }
- report("epel_bi");
- }
- static void checkasm_check_hevc_epel_bi_w(void)
- {
- LOCAL_ALIGNED_32(uint8_t, buf0, [BUF_SIZE]);
- LOCAL_ALIGNED_32(uint8_t, buf1, [BUF_SIZE]);
- LOCAL_ALIGNED_32(uint8_t, dst0, [BUF_SIZE]);
- LOCAL_ALIGNED_32(uint8_t, dst1, [BUF_SIZE]);
- LOCAL_ALIGNED_32(int16_t, ref0, [BUF_SIZE]);
- LOCAL_ALIGNED_32(int16_t, ref1, [BUF_SIZE]);
- HEVCDSPContext h;
- int size, bit_depth, i, j;
- const int *denom, *wx, *ox;
- declare_func(void, uint8_t *dst, ptrdiff_t dststride, const uint8_t *src, ptrdiff_t srcstride,
- const int16_t *src2,
- int height, int denom, int wx0, int wx1,
- int ox0, int ox1, intptr_t mx, intptr_t my, int width);
- for (bit_depth = 8; bit_depth <= 12; bit_depth++) {
- ff_hevc_dsp_init(&h, bit_depth);
- for (i = 0; i < 2; i++) {
- for (j = 0; j < 2; j++) {
- for (size = 1; size < 10; size++) {
- const char *type;
- switch ((j << 1) | i) {
- case 0: type = "pel_bi_w_pixels"; break; // 0 0
- case 1: type = "epel_bi_w_h"; break; // 0 1
- case 2: type = "epel_bi_w_v"; break; // 1 0
- case 3: type = "epel_bi_w_hv"; break; // 1 1
- }
- if (check_func(h.put_hevc_epel_bi_w[size][j][i],
- "put_hevc_%s%d_%d", type, sizes[size], bit_depth)) {
- for (denom = denoms; *denom >= 0; denom++) {
- for (wx = weights; *wx >= 0; wx++) {
- for (ox = offsets; *ox >= 0; ox++) {
- randomize_buffers_ref();
- call_ref(dst0, sizes[size] * SIZEOF_PIXEL,
- src0, sizes[size] * SIZEOF_PIXEL,
- ref0, sizes[size], *denom, *wx, *wx, *ox, *ox, i, j, sizes[size]);
- call_new(dst1, sizes[size] * SIZEOF_PIXEL,
- src1, sizes[size] * SIZEOF_PIXEL,
- ref1, sizes[size], *denom, *wx, *wx, *ox, *ox, i, j, sizes[size]);
- checkasm_check_pixel(dst0, sizes[size] * SIZEOF_PIXEL,
- dst1, sizes[size] * SIZEOF_PIXEL,
- size[sizes], size[sizes], "dst");
- bench_new(dst1, sizes[size] * SIZEOF_PIXEL,
- src1, sizes[size] * SIZEOF_PIXEL,
- ref1, sizes[size], *denom, *wx, *wx, *ox, *ox, i, j, sizes[size]);
- }
- }
- }
- }
- }
- }
- }
- }
- report("epel_bi_w");
- }
- void checkasm_check_hevc_pel(void)
- {
- checkasm_check_hevc_qpel();
- checkasm_check_hevc_qpel_uni();
- checkasm_check_hevc_qpel_uni_w();
- checkasm_check_hevc_qpel_bi();
- checkasm_check_hevc_qpel_bi_w();
- checkasm_check_hevc_epel();
- checkasm_check_hevc_epel_uni();
- checkasm_check_hevc_epel_uni_w();
- checkasm_check_hevc_epel_bi();
- checkasm_check_hevc_epel_bi_w();
- }
|