31 static const uint32_t
pixel_mask[3] = { 0xffffffff, 0x03ff03ff, 0x0fff0fff };
32 #define SIZEOF_PIXEL ((bit_depth + 7) / 8)
34 #define randomize_buffers() \
36 uint32_t mask = pixel_mask[(bit_depth - 8) >> 1]; \
38 for (k = -4; k < SIZEOF_PIXEL * FFMAX(8, size); k += 4) { \
39 uint32_t r = rnd() & mask; \
42 for (k = 0; k < size * SIZEOF_PIXEL; k += 4) { \
43 uint32_t r = rnd() & mask; \
77 for (bit_depth = 8; bit_depth <= 12; bit_depth += 2) {
79 for (tx = 0; tx < 4; tx++) {
84 mode_names[mode], size, size, bit_depth)) {
87 call_new(dst1, size * SIZEOF_PIXEL, l, a);
88 if (memcmp(dst0, dst1, size * size * SIZEOF_PIXEL))
90 bench_new(dst1, size * SIZEOF_PIXEL,l, a);
98 #undef randomize_buffers
100 #define randomize_buffers() \
102 uint32_t mask = pixel_mask[(bit_depth - 8) >> 1]; \
103 for (y = 0; y < sz; y++) { \
104 for (x = 0; x < sz * SIZEOF_PIXEL; x += 4) { \
105 uint32_t r = rnd() & mask; \
106 AV_WN32A(dst + y * sz * SIZEOF_PIXEL + x, r); \
107 AV_WN32A(src + y * sz * SIZEOF_PIXEL + x, rnd() & mask); \
109 for (x = 0; x < sz; x++) { \
110 if (bit_depth == 8) { \
111 coef[y * sz + x] = src[y * sz + x] - dst[y * sz + x]; \
113 ((int32_t *) coef)[y * sz + x] = \
114 ((uint16_t *) src)[y * sz + x] - \
115 ((uint16_t *) dst)[y * sz + x]; \
124 double t0 = in[0] + in[1];
125 double t3 = in[3] - in[2];
126 double t4 =
trunc((t0 - t3) * 0.5);
127 double t1 = t4 - in[1];
128 double t2 = t4 - in[2];
141 for (k = 0; k < sz; k++) {
143 for (n = 0; n < sz; n++)
144 out[k] += in[n] * cos(
M_PI * (2 * n + 1) * k / (sz * 2.0));
156 for (k = 0; k < sz; k++) {
158 for (n = 0; n < sz; n++)
159 out[k] += in[n] * sin(
M_PI * (n + 1) * (2 * k + 1) / (sz * 2.0 + 1.0));
170 for (k = 0; k < sz; k++) {
172 for (n = 0; n < sz; n++)
173 out[k] += in[n] * sin(
M_PI * (2 * n + 1) * (2 * k + 1) / (sz * 4.0));
181 static const double scaling_factors[5][4] = {
183 { 2.0, 2.0, 2.0, 2.0 },
184 { 1.0, 1.0, 1.0, 1.0 },
188 static const ftx1d_fn ftx1d_tbl[5][4][2] = {
211 double scaling_factor = scaling_factors[tx][txtp];
215 for (i = 0; i < sz; ++i) {
218 ftx1d_tbl[tx][txtp][0](temp_out, &in[i * sz], sz);
220 for (j = 0; j < sz; ++j)
221 temp[j * sz + i] = temp_out[j] * scaling_factor;
225 for (i = 0; i < sz; i++)
226 ftx1d_tbl[tx][txtp][1](&out[i * sz], &temp[i * sz], sz);
232 double ind[1024], outd[1024];
236 for (n = 0; n < sz * sz; n++) {
242 ftx_2d(outd, ind, tx, txtp, sz);
243 for (n = 0; n < sz * sz; n++) {
265 for (n = 0; n < sz * sz; n++) {
266 int rc = scan[
n], rcx = rc % sz, rcy = rc / sz;
269 if (rcx >= sub || rcy >= sub)
273 if (bit_depth == 8) {
282 for (; n < sz * sz; n++) {
286 if (bit_depth == 8) {
300 for (n = 0; n < sz /
sizeof(int16_t); n += 2)
307 #define SIZEOF_COEF (2 * ((bit_depth + 7) / 8))
326 for (bit_depth = 8; bit_depth <= 12; bit_depth += 2) {
330 int sz = 4 << (tx & 3);
333 for (txtp = 0; txtp < n_txtps; txtp++) {
339 for (sub = (txtp == 0 && tx < 4) ? 1 : sz; sub <= sz;
340 sub < 4 ? (sub <<= 1) : (sub += 4)) {
342 "vp9_inv_%s_%dx%d_sub%d_add_%d",
343 tx == 4 ?
"wht_wht" : txtp_types[txtp],
344 sz, sz, sub, bit_depth)) {
348 ftx(coef, tx, txtp, sz, bit_depth);
359 memcpy(dst1, dst, sz * sz * SIZEOF_PIXEL);
361 call_ref(dst0, sz * SIZEOF_PIXEL, subcoef0, eob);
362 call_new(dst1, sz * SIZEOF_PIXEL, subcoef1, eob);
363 if (memcmp(dst0, dst1, sz * sz * SIZEOF_PIXEL) ||
364 !
iszero(subcoef0, sz * sz * SIZEOF_COEF) ||
365 !
iszero(subcoef1, sz * sz * SIZEOF_COEF))
368 bench_new(dst, sz * SIZEOF_PIXEL, coef, eob);
377 #undef randomize_buffers
379 #define setpx(a,b,c) \
381 if (SIZEOF_PIXEL == 1) { \
382 buf0[(a) + (b) * jstride] = av_clip_uint8(c); \
384 ((uint16_t *)buf0)[(a) + (b) * jstride] = av_clip_uintp2(c, bit_depth); \
389 #define setdx(a,b,c,d) setpx(a,b,c-(d)+(rnd()%((d)*2+1)))
390 #define setsx(a,b,c,d) setdx(a,b,c,(d) << (bit_depth - 8))
393 const int *
F,
const int *
H,
const int *I,
397 int off = dir ? lineoff : lineoff * 16;
398 int istride = dir ? 1 : 16;
399 int jstride = dir ? str : 1;
401 for (i = 0; i < 2; i++) {
402 int idx = off + i * istride, p0,
q0;
404 setsx(idx, -1, p0 = q0, E[bidx] >> 2);
405 for (j = 1; j < 8; j++) {
406 setsx(idx, -1 - j, p0, F[bidx]);
407 setsx(idx, j, q0, F[bidx]);
410 for (i = 2; i < 4; i++) {
411 int idx = off + i * istride, p0,
q0;
413 setsx(idx, -1, p0 = q0, E[bidx] >> 2);
414 for (j = 1; j < 4; j++) {
415 setsx(idx, -1 - j, p0, F[bidx]);
416 setsx(idx, j, q0, F[bidx]);
418 for (j = 4; j < 8; j++) {
423 for (i = 4; i < 6; i++) {
424 int idx = off + i * istride, p2, p1, p0,
q0,
q1, q2;
426 setsx(idx, 1, q1 = q0, I[bidx]);
427 setsx(idx, 2, q2 = q1, I[bidx]);
428 setsx(idx, 3, q2, I[bidx]);
429 setsx(idx, -1, p0 = q0, E[bidx] >> 2);
430 setsx(idx, -2, p1 = p0, I[bidx]);
431 setsx(idx, -3, p2 = p1, I[bidx]);
432 setsx(idx, -4, p2, I[bidx]);
433 for (j = 4; j < 8; j++) {
438 for (i = 6; i < 8; i++) {
439 int idx = off + i * istride;
440 for (j = 0; j < 8; j++) {
446 #define randomize_buffers(bidx, lineoff, str) \
447 randomize_loopfilter_buffers(bidx, lineoff, str, bit_depth, dir, \
448 E, F, H, I, buf0, buf1)
456 static const char *
const dir_name[2] = {
"h",
"v" };
457 static const int E[2] = { 20, 28 }, I[2] = { 10, 16 };
458 static const int H[2] = { 7, 11 },
F[2] = { 1, 1 };
461 for (bit_depth = 8; bit_depth <= 12; bit_depth += 2) {
464 for (dir = 0; dir < 2; dir++) {
467 uint8_t *buf0 = base0 + midoff_aligned;
468 uint8_t *buf1 = base1 + midoff_aligned;
470 for (wd = 0; wd < 3; wd++) {
473 "vp9_loop_filter_%s_%d_8_%dbpp",
474 dir_name[dir], 4 << wd, bit_depth)) {
476 memcpy(buf1 - midoff, buf0 - midoff,
480 if (memcmp(buf0 - midoff, buf1 - midoff, 16 * 8 *
SIZEOF_PIXEL))
489 buf0 = base0 + midoff_aligned;
490 buf1 = base1 + midoff_aligned;
494 "vp9_loop_filter_%s_16_16_%dbpp",
495 dir_name[dir], bit_depth)) {
498 memcpy(buf1 - midoff, buf0 - midoff, 16 * 16 *
SIZEOF_PIXEL);
501 if (memcmp(buf0 - midoff, buf1 - midoff, 16 * 16 *
SIZEOF_PIXEL))
506 for (wd = 0; wd < 2; wd++) {
507 for (wd2 = 0; wd2 < 2; wd2++) {
510 "vp9_loop_filter_mix2_%s_%d%d_16_%dbpp",
511 dir_name[dir], 4 << wd, 4 << wd2, bit_depth)) {
514 memcpy(buf1 - midoff, buf0 - midoff, 16 * 16 *
SIZEOF_PIXEL);
515 #define M(a) (((a)[1] << 8) | (a)[0])
518 if (memcmp(buf0 - midoff, buf1 - midoff, 16 * 16 *
SIZEOF_PIXEL))
533 #undef randomize_buffers
535 #define DST_BUF_SIZE (size * size * SIZEOF_PIXEL)
536 #define SRC_BUF_STRIDE 72
537 #define SRC_BUF_SIZE ((size + 7) * SRC_BUF_STRIDE * SIZEOF_PIXEL)
538 #define src (buf + 3 * SIZEOF_PIXEL * (SRC_BUF_STRIDE + 1))
540 #define randomize_buffers() \
542 uint32_t mask = pixel_mask[(bit_depth - 8) >> 1]; \
544 for (k = 0; k < SRC_BUF_SIZE; k += 4) { \
545 uint32_t r = rnd() & mask; \
546 AV_WN32A(buf + k, r); \
549 for (k = 0; k < DST_BUF_SIZE; k += 4) { \
550 uint32_t r = rnd() & mask; \
551 AV_WN32A(dst0 + k, r); \
552 AV_WN32A(dst1 + k, r); \
566 int h,
int mx,
int my);
567 static const char *
const filter_names[4] = {
568 "8tap_smooth",
"8tap_regular",
"8tap_sharp",
"bilin"
570 static const char *
const subpel_names[2][2] = { {
"",
"h" }, {
"v",
"hv" } };
571 static const char *
const op_names[2] = {
"put",
"avg" };
574 for (op = 0; op < 2; op++) {
575 for (bit_depth = 8; bit_depth <= 12; bit_depth += 2) {
577 for (hsize = 0; hsize < 5; hsize++) {
578 int size = 64 >> hsize;
580 for (filter = 0; filter < 4; filter++) {
581 for (dx = 0; dx < 2; dx++) {
582 for (dy = 0; dy < 2; dy++) {
585 "%s_%s_%d%s", op_names[op],
586 filter_names[filter], size,
587 subpel_names[dy][dx]);
590 "%s%d", op_names[op], size);
593 "vp9_%s_%dbpp", str, bit_depth)) {
594 int mx = dx ? 1 + (
rnd() % 14) : 0;
595 int my = dy ? 1 + (
rnd() % 14) : 0;
608 if (filter >= 1 && filter <= 2)
continue;
610 if (bit_depth == 12 && filter == 3)
continue;
vp9_mc_func mc[5][N_FILTERS][2][2][2]
static void check_loopfilter(void)
static int copy_subcoefs(int16_t *out, const int16_t *in, enum TxfmMode tx, enum TxfmType txtp, int sz, int sub, int bit_depth)
void(* intra_pred[N_TXFM_SIZES][N_INTRA_PRED_MODES])(uint8_t *dst, ptrdiff_t stride, const uint8_t *left, const uint8_t *top)
static const uint8_t q1[256]
#define setsx(a, b, c, d)
static void filter(int16_t *output, ptrdiff_t out_stride, int16_t *low, ptrdiff_t low_stride, int16_t *high, ptrdiff_t high_stride, int len, int clip)
static void randomize_loopfilter_buffers(int bidx, int lineoff, int str, int bit_depth, int dir, const int *E, const int *F, const int *H, const int *I, uint8_t *buf0, uint8_t *buf1)
static void fadst4_1d(double *out, const double *in, int sz)
#define AV_CPU_FLAG_MMXEXT
SSE integer functions or AMD MMX ext.
static void ftx(int16_t *buf, enum TxfmMode tx, enum TxfmType txtp, int sz, int bit_depth)
const int16_t *const ff_vp9_scans[5][4]
static void fwht_1d(double *out, const double *in, int sz)
av_cold void ff_vp9dsp_init(VP9DSPContext *dsp, int bpp, int bitexact)
static int iszero(const int16_t *c, int sz)
static const uint16_t mask[17]
static void fadst_1d(double *out, const double *in, int sz)
static const uint8_t q0[256]
common internal API header
typedef void(APIENTRY *FF_PFNGLACTIVETEXTUREPROC)(GLenum texture)
static av_always_inline av_const double trunc(double x)
static void bit_depth(AudioStatsContext *s, uint64_t mask, uint64_t imask, AVRational *depth)
void(* loop_filter_16[2])(uint8_t *dst, ptrdiff_t stride, int mb_lim, int lim, int hev_thr)
void(* ftx1d_fn)(double *out, const double *in, int sz)
#define declare_func_emms(cpu_flags, ret,...)
static void check_mc(void)
void(* loop_filter_mix2[2][2][2])(uint8_t *dst, ptrdiff_t stride, int mb_lim, int lim, int hev_thr)
void(* loop_filter_8[3][2])(uint8_t *dst, ptrdiff_t stride, int mb_lim, int lim, int hev_thr)
#define AV_CPU_FLAG_MMX
standard MMX
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(constint16_t *) pi >>8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(constint32_t *) pi >>24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(constfloat *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(constfloat *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(constfloat *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(constdouble *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(constdouble *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(constdouble *) pi *(1U<< 31))))#defineSET_CONV_FUNC_GROUP(ofmt, ifmt) staticvoidset_generic_function(AudioConvert *ac){}voidff_audio_convert_free(AudioConvert **ac){if(!*ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);}AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enumAVSampleFormatout_fmt, enumAVSampleFormatin_fmt, intchannels, intsample_rate, intapply_map){AudioConvert *ac;intin_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) returnNULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method!=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt)>2){ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc){av_free(ac);returnNULL;}returnac;}in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar){ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar?ac->channels:1;}elseif(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;elseac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);returnac;}intff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in){intuse_generic=1;intlen=in->nb_samples;intp;if(ac->dc){av_log(ac->avr, AV_LOG_TRACE,"%dsamples-audio_convert:%sto%s(dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));returnff_convert_dither(ac-> in
static const uint32_t pixel_mask[3]
#define check_func(func,...)
static void ftx_2d(double *out, const double *in, enum TxfmMode tx, enum TxfmType txtp, int sz)
#define LOCAL_ALIGNED_32(t, v,...)
#define randomize_buffers()
static int op(uint8_t **dst, const uint8_t *dst_end, GetByteContext *gb, int pixel, int count, int *x, int width, int linesize)
Perform decode operation.
GLint GLenum GLboolean GLsizei stride
void(* itxfm_add[N_TXFM_SIZES+1][N_TXFM_TYPES])(uint8_t *dst, ptrdiff_t stride, int16_t *block, int eob)
static void fdct_1d(double *out, const double *in, int sz)
common internal and external API header
static int ref[MAX_W *MAX_W]
void checkasm_check_vp9dsp(void)
static void check_ipred(void)
static void check_itxfm(void)
mode
Use these values in ebur128_init (or'ed).