32 #define BUF_SIZE (FFALIGN(64 + 7, 16) * (64 + 7) * 2) 34 #define PIXEL_SIZE(depth) ((depth + 7) / 8) 36 #define randomize_buffers(buf, size, depth) \ 38 uint32_t mask = pixel_mask[depth - 8]; \ 40 for (i = 0; i < size; i += 4) { \ 41 uint32_t r = rnd() & mask; \ 42 AV_WN32A(buf + i, r); \ 46 static const uint32_t
pixel_mask[3] = { 0xffffffff, 0x01ff01ff, 0x03ff03ff };
50 [4] = { 16, 8, 4, 2, 0 },
52 [8] = { 32, 16, 8, 4, 2, 0 },
54 [16] = { 64, 32, 16, 12, 8, 4, 0 },
56 [32] = { 64, 32, 24, 16, 8, 0 },
58 [64] = { 64, 48, 32, 16, 0 },
61 static const int pred_widths[] = { 4, 8, 12, 16, 24, 32, 48, 64 };
63 static const char *
interp_names[2][2] = { {
"pixels",
"h" }, {
"v",
"hv" } };
65 #define UNWEIGHTED_PRED(dst0, dst1, src0, width, bit_depth) \ 68 for (i = 0; i < FF_ARRAY_ELEMS(pred_heights[i]); i++) { \ 69 int height = pred_heights[width][i]; \ 72 call_ref(dst0, dststride, src0, srcstride, height); \ 73 call_new(dst1, dststride, src0, srcstride, height); \ 74 if (memcmp(dst0, dst1, dststride * height)) \ 76 bench_new(dst1, dststride, src0, srcstride, height); \ 80 #define UNWEIGHTED_PRED_AVG(dst0, dst1, src0, src1, width, bit_depth) \ 83 for (i = 0; i < FF_ARRAY_ELEMS(pred_heights[i]); i++) { \ 84 int height = pred_heights[width][i]; \ 87 call_ref(dst0, dststride, src0, src1, srcstride, height); \ 88 call_new(dst1, dststride, src0, src1, srcstride, height); \ 89 if (memcmp(dst0, dst1, dststride * height)) \ 91 bench_new(dst1, dststride, src0, src1, srcstride, height); \ 96 int16_t *
src0, int16_t *
src1,
int bit_depth)
103 memset(dst0, 0,
BUF_SIZE *
sizeof(*dst0));
104 memset(dst1, 0,
BUF_SIZE *
sizeof(*dst1));
108 const int srcstride =
FFALIGN(width, 16) *
sizeof(*src0);
120 int16_t *src0, int16_t *src1, ptrdiff_t srcstride,
int height);
129 #define WEIGHTED_PRED(dst0, dst1, src0, width, bit_depth) \ 132 for (i = 0; i < FF_ARRAY_ELEMS(pred_heights[i]); i++) { \ 133 int height = pred_heights[width][i]; \ 136 call_ref(denom, weight0, offset0, dst0, dststride, src0, srcstride, height); \ 137 call_new(denom, weight0, offset0, dst1, dststride, src0, srcstride, height); \ 138 if (memcmp(dst0, dst1, dststride * height)) \ 140 bench_new(denom, weight0, offset0, dst1, dststride, src0, srcstride, height); \ 144 #define WEIGHTED_PRED_AVG(dst0, dst1, src0, src1, width, bit_depth) \ 147 for (i = 0; i < FF_ARRAY_ELEMS(pred_heights[i]); i++) { \ 148 int height = pred_heights[width][i]; \ 151 call_ref(denom, weight0, weight1, offset0, offset1, dst0, dststride, src0, src1, srcstride, height); \ 152 call_new(denom, weight0, weight1, offset0, offset1, dst1, dststride, src0, src1, srcstride, height); \ 153 if (memcmp(dst0, dst1, dststride * height)) \ 155 bench_new(denom, weight0, weight1, offset0, offset1, dst1, dststride, src0, src1, srcstride, height); \ 160 int16_t *
src0, int16_t *
src1,
int bit_depth)
163 int16_t weight0, weight1, offset0, offset1;
170 weight0 = denom + ((
rnd() & 255) - 128);
171 weight1 = denom + ((
rnd() & 255) - 128);
172 offset0 = (
rnd() & 255) - 128;
173 offset1 = (
rnd() & 255) - 128;
175 memset(dst0, 0,
BUF_SIZE *
sizeof(*dst0));
176 memset(dst1, 0,
BUF_SIZE *
sizeof(*dst1));
180 const int srcstride =
FFALIGN(width, 16) *
sizeof(*src0);
185 uint8_t *dst, ptrdiff_t dststride, int16_t *
src, ptrdiff_t srcstride,
int height);
192 declare_func(
void,
uint8_t denom, int16_t weight0, int16_t weight1, int16_t offset0, int16_t offset1,
193 uint8_t *dst, ptrdiff_t dststride, int16_t *src0, int16_t *src1, ptrdiff_t srcstride,
int height);
203 uint8_t *
src, int16_t *mcbuffer,
int bit_depth)
205 int i, j, k, l, mx, my;
208 int height,
int mx,
int my, int16_t *mcbuffer);
212 memset(dst0, 0,
BUF_SIZE *
sizeof(*dst0));
213 memset(dst1, 0,
BUF_SIZE *
sizeof(*dst1));
215 for (i = 0; i < 2; i++) {
216 for (j = 0; j < 2; j++) {
219 int dststride =
FFALIGN(width, 16) *
sizeof(*dst0);
231 for (my = i; my < (i ? 8 : 1); my++)
232 for (mx = j; mx < (j ? 8 : 1); mx++) {
233 call_ref(dst0, dststride, src + srcstride +
PIXEL_SIZE(bit_depth), srcstride, height, mx, my, mcbuffer);
234 call_new(dst1, dststride, src + srcstride +
PIXEL_SIZE(bit_depth), srcstride, height, mx, my, mcbuffer);
236 if (memcmp(dst0, dst1, dststride * height *
sizeof(*dst0)))
239 bench_new(dst1, dststride, src + srcstride +
PIXEL_SIZE(bit_depth), srcstride, height, mx, my, mcbuffer);
248 uint8_t *
src, int16_t *mcbuffer,
int bit_depth)
250 int i, j, k, l, mx, my;
253 int height,
int mx,
int my, int16_t *mcbuffer);
257 memset(dst0, 0,
BUF_SIZE *
sizeof(*dst0));
258 memset(dst1, 0,
BUF_SIZE *
sizeof(*dst1));
260 for (i = 0; i < 2; i++) {
261 for (j = 0; j < 2; j++) {
264 int dststride =
FFALIGN(width, 16) *
sizeof(*dst0);
276 for (my = i; my < (i ? 2 : 1); my++)
277 for (mx = j; mx < (j ? 2 : 1); mx++) {
278 call_ref(dst0, dststride, src + 3 * srcstride + 3 *
PIXEL_SIZE(bit_depth), srcstride, height, mx, my, mcbuffer);
279 call_new(dst1, dststride, src + 3 * srcstride + 3 *
PIXEL_SIZE(bit_depth), srcstride, height, mx, my, mcbuffer);
281 if (memcmp(dst0, dst1, dststride * height *
sizeof(*dst0)))
284 bench_new(dst1, dststride, src + 3 * srcstride + 3 *
PIXEL_SIZE(bit_depth), srcstride, height, mx, my, mcbuffer);
305 for (bit_depth = 8; bit_depth <= 10; bit_depth++) {
307 check_qpel(&h, buf16_0, buf16_1, buf8_0, mcbuffer, bit_depth);
311 for (bit_depth = 8; bit_depth <= 10; bit_depth++) {
313 check_epel(&h, buf16_0, buf16_1, buf8_0, mcbuffer, bit_depth);
317 for (bit_depth = 8; bit_depth <= 10; bit_depth++) {
321 report(
"unweighted_pred");
323 for (bit_depth = 8; bit_depth <= 10; bit_depth++) {
#define WEIGHTED_PRED_AVG(dst0, dst1, src0, src1, width, bit_depth)
void(* put_unweighted_pred_avg[8])(uint8_t *dst, ptrdiff_t dststride, int16_t *src1, int16_t *src2, ptrdiff_t srcstride, int height)
void(* put_hevc_epel[2][2][8])(int16_t *dst, ptrdiff_t dststride, uint8_t *src, ptrdiff_t srcstride, int height, int mx, int my, int16_t *mcbuffer)
void(* put_unweighted_pred[8])(uint8_t *dst, ptrdiff_t dststride, int16_t *src, ptrdiff_t srcstride, int height)
#define DECLARE_ALIGNED(n, t, v)
#define FF_ARRAY_ELEMS(a)
void(* weighted_pred_chroma[8])(uint8_t denom, int16_t wlxFlag, int16_t olxFlag, uint8_t *dst, ptrdiff_t dststride, int16_t *src, ptrdiff_t srcstride, int height)
void(* weighted_pred_avg_chroma[8])(uint8_t denom, int16_t wl0Flag, int16_t wl1Flag, int16_t ol0Flag, int16_t ol1Flag, uint8_t *dst, ptrdiff_t dststride, int16_t *src1, int16_t *src2, ptrdiff_t srcstride, int height)
void(* weighted_pred_avg[8])(uint8_t denom, int16_t wl0Flag, int16_t wl1Flag, int16_t ol0Flag, int16_t ol1Flag, uint8_t *dst, ptrdiff_t dststride, int16_t *src1, int16_t *src2, ptrdiff_t srcstride, int height)
#define UNWEIGHTED_PRED_AVG(dst0, dst1, src0, src1, width, bit_depth)
void checkasm_check_hevc_mc(void)
void(* put_unweighted_pred_chroma[8])(uint8_t *dst, ptrdiff_t dststride, int16_t *src, ptrdiff_t srcstride, int height)
static const char * interp_names[2][2]
#define declare_func(ret,...)
static void check_weighted_pred(HEVCDSPContext *h, uint8_t *dst0, uint8_t *dst1, int16_t *src0, int16_t *src1, int bit_depth)
#define WEIGHTED_PRED(dst0, dst1, src0, width, bit_depth)
static const int pred_widths[]
void(* put_hevc_qpel[2][2][8])(int16_t *dst, ptrdiff_t dststride, uint8_t *src, ptrdiff_t srcstride, int height, int mx, int my, int16_t *mcbuffer)
static void check_qpel(HEVCDSPContext *h, int16_t *dst0, int16_t *dst1, uint8_t *src, int16_t *mcbuffer, int bit_depth)
#define UNWEIGHTED_PRED(dst0, dst1, src0, width, bit_depth)
static const int pred_heights[][7]
void ff_hevc_dsp_init(HEVCDSPContext *hevcdsp, int bit_depth)
Libavcodec external API header.
static void check_epel(HEVCDSPContext *h, int16_t *dst0, int16_t *dst1, uint8_t *src, int16_t *mcbuffer, int bit_depth)
void(* weighted_pred[8])(uint8_t denom, int16_t wlxFlag, int16_t olxFlag, uint8_t *dst, ptrdiff_t dststride, int16_t *src, ptrdiff_t srcstride, int height)
#define check_func(func,...)
#define PIXEL_SIZE(depth)
static const uint32_t pixel_mask[3]
static void check_unweighted_pred(HEVCDSPContext *h, uint8_t *dst0, uint8_t *dst1, int16_t *src0, int16_t *src1, int bit_depth)
common internal and external API header
void(* put_unweighted_pred_avg_chroma[8])(uint8_t *dst, ptrdiff_t dststride, int16_t *src1, int16_t *src2, ptrdiff_t srcstride, int height)
#define randomize_buffers(buf, size, depth)