32 static const uint32_t
pixel_mask[3] = { 0xffffffff, 0x03ff03ff, 0x0fff0fff };
33 #define SIZEOF_PIXEL ((bit_depth + 7) / 8)
35 #define randomize_buffers() \
37 uint32_t mask = pixel_mask[(bit_depth - 8) >> 1]; \
39 for (k = -4; k < SIZEOF_PIXEL * FFMAX(8, size); k += 4) { \
40 uint32_t r = rnd() & mask; \
43 for (k = 0; k < size * SIZEOF_PIXEL; k += 4) { \
44 uint32_t r = rnd() & mask; \
80 for (tx = 0; tx < 4; tx++) {
99 #undef randomize_buffers
101 #define randomize_buffers() \
103 uint32_t mask = pixel_mask[(bit_depth - 8) >> 1]; \
104 for (y = 0; y < sz; y++) { \
105 for (x = 0; x < sz * SIZEOF_PIXEL; x += 4) { \
106 uint32_t r = rnd() & mask; \
107 AV_WN32A(dst + y * sz * SIZEOF_PIXEL + x, r); \
108 AV_WN32A(src + y * sz * SIZEOF_PIXEL + x, rnd() & mask); \
110 for (x = 0; x < sz; x++) { \
111 if (bit_depth == 8) { \
112 coef[y * sz + x] = src[y * sz + x] - dst[y * sz + x]; \
114 ((int32_t *) coef)[y * sz + x] = \
115 ((uint16_t *) src)[y * sz + x] - \
116 ((uint16_t *) dst)[y * sz + x]; \
125 double t0 =
in[0] +
in[1];
126 double t3 =
in[3] -
in[2];
142 for (k = 0; k < sz; k++) {
144 for (n = 0; n < sz; n++)
145 out[k] +=
in[n] * cos(
M_PI * (2 * n + 1) * k / (sz * 2.0));
157 for (k = 0; k < sz; k++) {
159 for (n = 0; n < sz; n++)
160 out[k] +=
in[n] * sin(
M_PI * (n + 1) * (2 * k + 1) / (sz * 2.0 + 1.0));
171 for (k = 0; k < sz; k++) {
173 for (n = 0; n < sz; n++)
174 out[k] +=
in[n] * sin(
M_PI * (2 * n + 1) * (2 * k + 1) / (sz * 4.0));
182 static const double scaling_factors[5][4] = {
184 { 2.0, 2.0, 2.0, 2.0 },
185 { 1.0, 1.0, 1.0, 1.0 },
189 static const ftx1d_fn ftx1d_tbl[5][4][2] = {
212 double scaling_factor = scaling_factors[tx][txtp];
216 for (
i = 0;
i < sz; ++
i) {
219 ftx1d_tbl[tx][txtp][0](temp_out, &
in[
i * sz], sz);
221 for (j = 0; j < sz; ++j)
222 temp[j * sz +
i] = temp_out[j] * scaling_factor;
226 for (
i = 0;
i < sz;
i++)
227 ftx1d_tbl[tx][txtp][1](&
out[
i * sz], &
temp[
i * sz], sz);
233 double ind[1024], outd[1024];
237 for (n = 0; n < sz * sz; n++) {
243 ftx_2d(outd, ind, tx, txtp, sz);
244 for (n = 0; n < sz * sz; n++) {
246 buf[n] =
lrint(outd[n]);
266 for (n = 0; n < sz * sz; n++) {
267 int rc = scan[n], rcx = rc % sz, rcy = rc / sz;
270 if (rcx >=
sub || rcy >=
sub)
283 for (; n < sz * sz; n++) {
301 for (n = 0; n < sz /
sizeof(int16_t); n += 2)
308 #define SIZEOF_COEF (2 * ((bit_depth + 7) / 8))
331 int sz = 4 << (tx & 3);
334 for (txtp = 0; txtp < n_txtps; txtp++) {
340 for (
sub = (txtp == 0 && tx < 4) ? 1 : sz;
sub <= sz;
343 "vp9_inv_%s_%dx%d_sub%d_add_%d",
344 tx == 4 ?
"wht_wht" : txtp_types[txtp],
378 #undef randomize_buffers
380 #define setpx(a,b,c) \
382 if (SIZEOF_PIXEL == 1) { \
383 buf0[(a) + (b) * jstride] = av_clip_uint8(c); \
385 ((uint16_t *)buf0)[(a) + (b) * jstride] = av_clip_uintp2(c, bit_depth); \
390 #define setdx(a,b,c,d) setpx(a,b,c-(d)+(rnd()%((d)*2+1)))
391 #define setsx(a,b,c,d) setdx(a,b,c,(d) << (bit_depth - 8))
394 const int *
F,
const int *
H,
const int *I,
398 int off = dir ? lineoff : lineoff * 16;
399 int istride = dir ? 1 : 16;
400 int jstride = dir ?
str : 1;
402 for (
i = 0;
i < 2;
i++) {
403 int idx = off +
i * istride, p0,
q0;
405 setsx(idx, -1, p0 =
q0,
E[bidx] >> 2);
406 for (j = 1; j < 8; j++) {
407 setsx(idx, -1 - j, p0,
F[bidx]);
411 for (
i = 2;
i < 4;
i++) {
412 int idx = off +
i * istride, p0,
q0;
414 setsx(idx, -1, p0 =
q0,
E[bidx] >> 2);
415 for (j = 1; j < 4; j++) {
416 setsx(idx, -1 - j, p0,
F[bidx]);
419 for (j = 4; j < 8; j++) {
424 for (
i = 4;
i < 6;
i++) {
425 int idx = off +
i * istride, p2, p1, p0,
q0,
q1, q2;
428 setsx(idx, 2, q2 =
q1, I[bidx]);
429 setsx(idx, 3, q2, I[bidx]);
430 setsx(idx, -1, p0 =
q0,
E[bidx] >> 2);
431 setsx(idx, -2, p1 = p0, I[bidx]);
432 setsx(idx, -3, p2 = p1, I[bidx]);
433 setsx(idx, -4, p2, I[bidx]);
434 for (j = 4; j < 8; j++) {
439 for (
i = 6;
i < 8;
i++) {
440 int idx = off +
i * istride;
441 for (j = 0; j < 8; j++) {
447 #define randomize_buffers(bidx, lineoff, str) \
448 randomize_loopfilter_buffers(bidx, lineoff, str, bit_depth, dir, \
449 E, F, H, I, buf0, buf1)
457 static const char *
const dir_name[2] = {
"h",
"v" };
458 static const int E[2] = { 20, 28 }, I[2] = { 10, 16 };
459 static const int H[2] = { 7, 11 },
F[2] = { 1, 1 };
465 for (dir = 0; dir < 2; dir++) {
468 uint8_t *buf0 = base0 + midoff_aligned;
469 uint8_t *buf1 = base1 + midoff_aligned;
471 for (wd = 0; wd < 3; wd++) {
474 "vp9_loop_filter_%s_%d_8_%dbpp",
477 memcpy(buf1 - midoff, buf0 - midoff,
481 if (memcmp(buf0 - midoff, buf1 - midoff, 16 * 8 *
SIZEOF_PIXEL))
490 buf0 = base0 + midoff_aligned;
491 buf1 = base1 + midoff_aligned;
495 "vp9_loop_filter_%s_16_16_%dbpp",
499 memcpy(buf1 - midoff, buf0 - midoff, 16 * 16 *
SIZEOF_PIXEL);
502 if (memcmp(buf0 - midoff, buf1 - midoff, 16 * 16 *
SIZEOF_PIXEL))
507 for (wd = 0; wd < 2; wd++) {
508 for (wd2 = 0; wd2 < 2; wd2++) {
511 "vp9_loop_filter_mix2_%s_%d%d_16_%dbpp",
512 dir_name[dir], 4 << wd, 4 << wd2,
bit_depth)) {
515 memcpy(buf1 - midoff, buf0 - midoff, 16 * 16 *
SIZEOF_PIXEL);
516 #define M(a) (((a)[1] << 8) | (a)[0])
519 if (memcmp(buf0 - midoff, buf1 - midoff, 16 * 16 *
SIZEOF_PIXEL))
534 #undef randomize_buffers
536 #define DST_BUF_SIZE (size * size * SIZEOF_PIXEL)
537 #define SRC_BUF_STRIDE 72
538 #define SRC_BUF_SIZE ((size + 7) * SRC_BUF_STRIDE * SIZEOF_PIXEL)
539 #define src (buf + 3 * SIZEOF_PIXEL * (SRC_BUF_STRIDE + 1))
541 #define randomize_buffers() \
543 uint32_t mask = pixel_mask[(bit_depth - 8) >> 1]; \
545 for (k = 0; k < SRC_BUF_SIZE; k += 4) { \
546 uint32_t r = rnd() & mask; \
547 AV_WN32A(buf + k, r); \
550 for (k = 0; k < DST_BUF_SIZE; k += 4) { \
551 uint32_t r = rnd() & mask; \
552 AV_WN32A(dst0 + k, r); \
553 AV_WN32A(dst1 + k, r); \
567 int h,
int mx,
int my);
568 static const char *
const filter_names[4] = {
569 "8tap_smooth",
"8tap_regular",
"8tap_sharp",
"bilin"
571 static const char *
const subpel_names[2][2] = { {
"",
"h" }, {
"v",
"hv" } };
572 static const char *
const op_names[2] = {
"put",
"avg" };
575 for (
op = 0;
op < 2;
op++) {
578 for (hsize = 0; hsize < 5; hsize++) {
579 int size = 64 >> hsize;
582 for (dx = 0; dx < 2; dx++) {
583 for (dy = 0; dy < 2; dy++) {
586 "%s_%s_%d%s", op_names[
op],
588 subpel_names[dy][dx]);
591 "%s%d", op_names[
op],
size);
595 int mx = dx ? 1 + (
rnd() % 14) : 0;
596 int my = dy ? 1 + (
rnd() % 14) : 0;
static void bit_depth(AudioStatsContext *s, uint64_t mask, uint64_t imask, AVRational *depth)
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi - 0x80) *(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi - 0x80) *(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(const int16_t *) pi >> 8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(const int32_t *) pi >> 24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(const float *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(const float *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(const float *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(const double *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(const double *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(const double *) pi *(1U<< 31)))) #define SET_CONV_FUNC_GROUP(ofmt, ifmt) static void set_generic_function(AudioConvert *ac) { } void ff_audio_convert_free(AudioConvert **ac) { if(! *ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);} AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels, int sample_rate, int apply_map) { AudioConvert *ac;int in_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) return NULL;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);return NULL;} return ac;} 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;} else if(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;else ac->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);return ac;} int ff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in) { int use_generic=1;int len=in->nb_samples;int p;if(ac->dc) { av_log(ac->avr, AV_LOG_TRACE, "%d samples - audio_convert: %s to %s (dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));return ff_convert_dither(ac-> in
static av_always_inline void filter(int16_t *output, ptrdiff_t out_stride, const int16_t *low, ptrdiff_t low_stride, const int16_t *high, ptrdiff_t high_stride, int len, int clip)
#define declare_func_emms(cpu_flags, ret,...)
#define check_func(func,...)
common internal and external API header
#define AV_CPU_FLAG_MMXEXT
SSE integer functions or AMD MMX ext.
#define AV_CPU_FLAG_MMX
standard MMX
static __device__ float trunc(float a)
static float sub(float src0, float src1)
mode
Use these values in ebur128_init (or'ed).
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.
av_cold void ff_vp9dsp_init(VP9DSPContext *dsp, int bpp, int bitexact)
common internal API header
static const uint16_t mask[17]
#define LOCAL_ALIGNED_32(t, v,...)
typedef void(RENAME(mix_any_func_type))
void(* intra_pred[N_TXFM_SIZES][N_INTRA_PRED_MODES])(uint8_t *dst, ptrdiff_t stride, const uint8_t *left, const uint8_t *top)
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)
void(* itxfm_add[N_TXFM_SIZES+1][N_TXFM_TYPES])(uint8_t *dst, ptrdiff_t stride, int16_t *block, int eob)
void(* loop_filter_16[2])(uint8_t *dst, ptrdiff_t stride, int mb_lim, int lim, int hev_thr)
vp9_mc_func mc[5][N_FILTERS][2][2][2]
static void check_ipred(void)
#define randomize_buffers()
static void check_mc(void)
static int iszero(const int16_t *c, int sz)
#define setsx(a, b, c, d)
static void fadst_1d(double *out, const double *in, int sz)
static void ftx(int16_t *buf, enum TxfmMode tx, enum TxfmType txtp, int sz, int bit_depth)
static void check_itxfm(void)
static void check_loopfilter(void)
static void fadst4_1d(double *out, const double *in, int sz)
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 const uint32_t pixel_mask[3]
void checkasm_check_vp9dsp(void)
static void fwht_1d(double *out, const double *in, int sz)
static int copy_subcoefs(int16_t *out, const int16_t *in, enum TxfmMode tx, enum TxfmType txtp, int sz, int sub, int bit_depth)
static void fdct_1d(double *out, const double *in, int sz)
static void ftx_2d(double *out, const double *in, enum TxfmMode tx, enum TxfmType txtp, int sz)
void(* ftx1d_fn)(double *out, const double *in, int sz)
static int ref[MAX_W *MAX_W]
static const uint8_t q1[256]
static const uint8_t q0[256]
const int16_t *const ff_vp9_scans[5][4]