2013-09-22 03:24:03 +02:00
|
|
|
/*
|
|
|
|
* VP9 SIMD optimizations
|
|
|
|
*
|
|
|
|
* Copyright (c) 2013 Ronald S. Bultje <rsbultje gmail com>
|
|
|
|
*
|
|
|
|
* This file is part of FFmpeg.
|
|
|
|
*
|
|
|
|
* FFmpeg is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 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
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser 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
|
|
|
|
*/
|
|
|
|
|
2014-01-09 14:06:31 +01:00
|
|
|
#include "libavutil/attributes.h"
|
2013-09-22 03:24:03 +02:00
|
|
|
#include "libavutil/cpu.h"
|
|
|
|
#include "libavutil/mem.h"
|
|
|
|
#include "libavutil/x86/asm.h"
|
2013-11-16 16:58:13 +01:00
|
|
|
#include "libavutil/x86/cpu.h"
|
2013-09-22 03:24:03 +02:00
|
|
|
#include "libavcodec/vp9dsp.h"
|
|
|
|
|
|
|
|
#if HAVE_YASM
|
|
|
|
|
2013-09-22 04:03:00 +02:00
|
|
|
#define fpel_func(avg, sz, opt) \
|
2014-03-28 22:33:51 +01:00
|
|
|
void ff_vp9_##avg##sz##_##opt(uint8_t *dst, ptrdiff_t dst_stride, \
|
|
|
|
const uint8_t *src, ptrdiff_t src_stride, \
|
|
|
|
int h, int mx, int my)
|
2013-09-22 04:03:00 +02:00
|
|
|
fpel_func(put, 4, mmx);
|
|
|
|
fpel_func(put, 8, mmx);
|
|
|
|
fpel_func(put, 16, sse);
|
|
|
|
fpel_func(put, 32, sse);
|
|
|
|
fpel_func(put, 64, sse);
|
2014-01-18 06:29:22 +01:00
|
|
|
fpel_func(avg, 4, mmxext);
|
|
|
|
fpel_func(avg, 8, mmxext);
|
2013-09-22 04:03:00 +02:00
|
|
|
fpel_func(avg, 16, sse2);
|
|
|
|
fpel_func(avg, 32, sse2);
|
|
|
|
fpel_func(avg, 64, sse2);
|
|
|
|
#undef fpel_func
|
|
|
|
|
2013-09-22 03:24:03 +02:00
|
|
|
#define mc_func(avg, sz, dir, opt) \
|
2014-03-28 22:33:51 +01:00
|
|
|
void ff_vp9_##avg##_8tap_1d_##dir##_##sz##_##opt(uint8_t *dst, ptrdiff_t dst_stride, \
|
|
|
|
const uint8_t *src, ptrdiff_t src_stride, \
|
|
|
|
int h, const int8_t (*filter)[16])
|
2013-09-22 03:24:03 +02:00
|
|
|
#define mc_funcs(sz) \
|
|
|
|
mc_func(put, sz, h, ssse3); \
|
|
|
|
mc_func(avg, sz, h, ssse3); \
|
|
|
|
mc_func(put, sz, v, ssse3); \
|
|
|
|
mc_func(avg, sz, v, ssse3)
|
|
|
|
|
|
|
|
mc_funcs(4);
|
|
|
|
mc_funcs(8);
|
2013-12-24 22:17:03 +01:00
|
|
|
#if ARCH_X86_64
|
|
|
|
mc_funcs(16);
|
|
|
|
#endif
|
2013-09-22 03:24:03 +02:00
|
|
|
|
|
|
|
#undef mc_funcs
|
|
|
|
#undef mc_func
|
|
|
|
|
|
|
|
#define mc_rep_func(avg, sz, hsz, dir, opt) \
|
|
|
|
static av_always_inline void \
|
2014-03-28 22:33:51 +01:00
|
|
|
ff_vp9_##avg##_8tap_1d_##dir##_##sz##_##opt(uint8_t *dst, ptrdiff_t dst_stride, \
|
|
|
|
const uint8_t *src, ptrdiff_t src_stride, \
|
|
|
|
int h, const int8_t (*filter)[16]) \
|
2013-09-22 03:24:03 +02:00
|
|
|
{ \
|
2014-03-28 22:33:51 +01:00
|
|
|
ff_vp9_##avg##_8tap_1d_##dir##_##hsz##_##opt(dst, dst_stride, src, \
|
|
|
|
src_stride, h, filter); \
|
|
|
|
ff_vp9_##avg##_8tap_1d_##dir##_##hsz##_##opt(dst + hsz, dst_stride, src + hsz, \
|
|
|
|
src_stride, h, filter); \
|
2013-09-22 03:24:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#define mc_rep_funcs(sz, hsz) \
|
|
|
|
mc_rep_func(put, sz, hsz, h, ssse3); \
|
|
|
|
mc_rep_func(avg, sz, hsz, h, ssse3); \
|
|
|
|
mc_rep_func(put, sz, hsz, v, ssse3); \
|
|
|
|
mc_rep_func(avg, sz, hsz, v, ssse3)
|
|
|
|
|
2013-12-24 22:17:03 +01:00
|
|
|
#if ARCH_X86_32
|
2013-09-22 03:24:03 +02:00
|
|
|
mc_rep_funcs(16, 8);
|
2013-12-24 22:17:03 +01:00
|
|
|
#endif
|
2013-09-22 03:24:03 +02:00
|
|
|
mc_rep_funcs(32, 16);
|
|
|
|
mc_rep_funcs(64, 32);
|
|
|
|
|
|
|
|
#undef mc_rep_funcs
|
|
|
|
#undef mc_rep_func
|
|
|
|
|
|
|
|
extern const int8_t ff_filters_ssse3[3][15][4][16];
|
|
|
|
|
|
|
|
#define filter_8tap_2d_fn(op, sz, f, fname) \
|
|
|
|
static void op##_8tap_##fname##_##sz##hv_ssse3(uint8_t *dst, ptrdiff_t dst_stride, \
|
|
|
|
const uint8_t *src, ptrdiff_t src_stride, \
|
|
|
|
int h, int mx, int my) \
|
|
|
|
{ \
|
|
|
|
LOCAL_ALIGNED_16(uint8_t, temp, [71 * 64]); \
|
2014-03-28 22:33:51 +01:00
|
|
|
ff_vp9_put_8tap_1d_h_##sz##_ssse3(temp, 64, src - 3 * src_stride, src_stride, \
|
|
|
|
h + 7, ff_filters_ssse3[f][mx - 1]); \
|
|
|
|
ff_vp9_##op##_8tap_1d_v_##sz##_ssse3(dst, dst_stride, temp + 3 * 64, 64, \
|
|
|
|
h, ff_filters_ssse3[f][my - 1]); \
|
2013-09-22 03:24:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#define filters_8tap_2d_fn(op, sz) \
|
|
|
|
filter_8tap_2d_fn(op, sz, FILTER_8TAP_REGULAR, regular) \
|
|
|
|
filter_8tap_2d_fn(op, sz, FILTER_8TAP_SHARP, sharp) \
|
|
|
|
filter_8tap_2d_fn(op, sz, FILTER_8TAP_SMOOTH, smooth)
|
|
|
|
|
|
|
|
#define filters_8tap_2d_fn2(op) \
|
|
|
|
filters_8tap_2d_fn(op, 64) \
|
|
|
|
filters_8tap_2d_fn(op, 32) \
|
|
|
|
filters_8tap_2d_fn(op, 16) \
|
|
|
|
filters_8tap_2d_fn(op, 8) \
|
|
|
|
filters_8tap_2d_fn(op, 4)
|
|
|
|
|
|
|
|
filters_8tap_2d_fn2(put)
|
|
|
|
filters_8tap_2d_fn2(avg)
|
|
|
|
|
|
|
|
#undef filters_8tap_2d_fn2
|
|
|
|
#undef filters_8tap_2d_fn
|
|
|
|
#undef filter_8tap_2d_fn
|
|
|
|
|
|
|
|
#define filter_8tap_1d_fn(op, sz, f, fname, dir, dvar) \
|
|
|
|
static void op##_8tap_##fname##_##sz##dir##_ssse3(uint8_t *dst, ptrdiff_t dst_stride, \
|
|
|
|
const uint8_t *src, ptrdiff_t src_stride, \
|
|
|
|
int h, int mx, int my) \
|
|
|
|
{ \
|
2014-03-28 22:33:51 +01:00
|
|
|
ff_vp9_##op##_8tap_1d_##dir##_##sz##_ssse3(dst, dst_stride, src, src_stride, \
|
|
|
|
h, ff_filters_ssse3[f][dvar - 1]); \
|
2013-09-22 03:24:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#define filters_8tap_1d_fn(op, sz, dir, dvar) \
|
|
|
|
filter_8tap_1d_fn(op, sz, FILTER_8TAP_REGULAR, regular, dir, dvar) \
|
|
|
|
filter_8tap_1d_fn(op, sz, FILTER_8TAP_SHARP, sharp, dir, dvar) \
|
|
|
|
filter_8tap_1d_fn(op, sz, FILTER_8TAP_SMOOTH, smooth, dir, dvar)
|
|
|
|
|
|
|
|
#define filters_8tap_1d_fn2(op, sz) \
|
|
|
|
filters_8tap_1d_fn(op, sz, h, mx) \
|
|
|
|
filters_8tap_1d_fn(op, sz, v, my)
|
|
|
|
|
|
|
|
#define filters_8tap_1d_fn3(op) \
|
|
|
|
filters_8tap_1d_fn2(op, 64) \
|
|
|
|
filters_8tap_1d_fn2(op, 32) \
|
|
|
|
filters_8tap_1d_fn2(op, 16) \
|
|
|
|
filters_8tap_1d_fn2(op, 8) \
|
|
|
|
filters_8tap_1d_fn2(op, 4)
|
|
|
|
|
|
|
|
filters_8tap_1d_fn3(put)
|
|
|
|
filters_8tap_1d_fn3(avg)
|
|
|
|
|
|
|
|
#undef filters_8tap_1d_fn
|
|
|
|
#undef filters_8tap_1d_fn2
|
|
|
|
#undef filters_8tap_1d_fn3
|
|
|
|
#undef filter_8tap_1d_fn
|
|
|
|
|
2014-01-16 13:30:15 +01:00
|
|
|
#define itxfm_func(typea, typeb, size, opt) \
|
|
|
|
void ff_vp9_##typea##_##typeb##_##size##x##size##_add_##opt(uint8_t *dst, ptrdiff_t stride, \
|
|
|
|
int16_t *block, int eob)
|
|
|
|
#define itxfm_funcs(size, opt) \
|
|
|
|
itxfm_func(idct, idct, size, opt); \
|
|
|
|
itxfm_func(iadst, idct, size, opt); \
|
|
|
|
itxfm_func(idct, iadst, size, opt); \
|
|
|
|
itxfm_func(iadst, iadst, size, opt)
|
|
|
|
|
2014-01-20 21:30:22 +01:00
|
|
|
itxfm_funcs(4, ssse3);
|
2014-01-20 23:11:48 +01:00
|
|
|
itxfm_funcs(8, ssse3);
|
|
|
|
itxfm_funcs(8, avx);
|
2014-01-16 13:30:15 +01:00
|
|
|
itxfm_funcs(16, ssse3);
|
|
|
|
itxfm_funcs(16, avx);
|
|
|
|
itxfm_func(idct, idct, 32, ssse3);
|
|
|
|
itxfm_func(idct, idct, 32, avx);
|
2014-01-21 02:04:48 +01:00
|
|
|
itxfm_func(iwht, iwht, 4, mmx);
|
2014-01-16 13:30:15 +01:00
|
|
|
|
|
|
|
#undef itxfm_func
|
|
|
|
#undef itxfm_funcs
|
avcodec/vp9: add ff_vp9_idct_idct_{4x4,8x8}_ssse3().
1789 decicycles in idct_idct_4x4_add_c, 262136 runs, 8 skips
1839 decicycles in idct_idct_4x4_add_c, 524270 runs, 18 skips
1864 decicycles in idct_idct_4x4_add_c, 1048548 runs, 28 skips
529 decicycles in ff_vp9_idct_idct_4x4_add_ssse3, 262138 runs, 6 skips
516 decicycles in ff_vp9_idct_idct_4x4_add_ssse3, 524282 runs, 6 skips
474 decicycles in ff_vp9_idct_idct_4x4_add_ssse3, 1048565 runs, 11 skips
(~3.9x faster)
7726 decicycles in idct_idct_8x8_add_c, 1048433 runs, 143 skips
7732 decicycles in idct_idct_8x8_add_c, 2096882 runs, 270 skips
7731 decicycles in idct_idct_8x8_add_c, 4193772 runs, 532 skips
1145 decicycles in ff_vp9_idct_idct_8x8_add_ssse3, 1048549 runs, 27 skips
1137 decicycles in ff_vp9_idct_idct_8x8_add_ssse3, 2097097 runs, 55 skips
1086 decicycles in ff_vp9_idct_idct_8x8_add_ssse3, 4194188 runs, 116 skips
(~7.1x faster)
Overall decode time before commit:
16.48s user 0.03s system 99% cpu 16.526 total
16.54s user 0.01s system 99% cpu 16.566 total
16.46s user 0.03s system 99% cpu 16.511 total
Overall decode time after commit:
16.34s user 0.02s system 99% cpu 16.378 total
16.28s user 0.02s system 99% cpu 16.315 total
16.32s user 0.03s system 99% cpu 16.366 total
Tested on i7 920 with 40s 1080p footage.
2013-11-03 18:17:36 +01:00
|
|
|
|
2014-01-17 07:55:44 +01:00
|
|
|
#define lpf_funcs(size1, size2, opt) \
|
|
|
|
void ff_vp9_loop_filter_v_##size1##_##size2##_##opt(uint8_t *dst, ptrdiff_t stride, \
|
|
|
|
int E, int I, int H); \
|
|
|
|
void ff_vp9_loop_filter_h_##size1##_##size2##_##opt(uint8_t *dst, ptrdiff_t stride, \
|
|
|
|
int E, int I, int H)
|
|
|
|
|
|
|
|
lpf_funcs(16, 16, sse2);
|
|
|
|
lpf_funcs(16, 16, ssse3);
|
|
|
|
lpf_funcs(16, 16, avx);
|
2014-02-05 07:21:06 +01:00
|
|
|
lpf_funcs(44, 16, sse2);
|
|
|
|
lpf_funcs(44, 16, ssse3);
|
|
|
|
lpf_funcs(44, 16, avx);
|
2014-01-30 19:01:30 +01:00
|
|
|
lpf_funcs(84, 16, sse2);
|
|
|
|
lpf_funcs(84, 16, ssse3);
|
|
|
|
lpf_funcs(84, 16, avx);
|
|
|
|
lpf_funcs(48, 16, sse2);
|
|
|
|
lpf_funcs(48, 16, ssse3);
|
|
|
|
lpf_funcs(48, 16, avx);
|
2014-01-28 08:59:45 +01:00
|
|
|
lpf_funcs(88, 16, sse2);
|
x86/vp9lpf: add ff_vp9_loop_filter_[vh]_88_16_{ssse3,avx}.
9680 decicycles in loop_filter_v_88_16_c, 4193765 runs, 539 skips
9233 decicycles in loop_filter_h_88_16_c, 4193751 runs, 553 skips
1929 decicycles in ff_vp9_loop_filter_v_88_16_ssse3, 4194118 runs, 186 skips
2738 decicycles in ff_vp9_loop_filter_h_88_16_ssse3, 4193861 runs, 443 skips
5.978 → 5.417 overall decode time on ped1080p.webm (-threads 1)
Adding SSE2 support should be relatively trivial (just a matter of
changing the pshufb [mask_mix] with something else), patch welcome.
2014-01-25 17:38:42 +01:00
|
|
|
lpf_funcs(88, 16, ssse3);
|
|
|
|
lpf_funcs(88, 16, avx);
|
2014-01-17 07:55:44 +01:00
|
|
|
|
|
|
|
#undef lpf_funcs
|
2014-01-05 21:00:40 +01:00
|
|
|
|
2014-02-16 19:30:50 +01:00
|
|
|
#define ipred_func(size, type, opt) \
|
|
|
|
void ff_vp9_ipred_##type##_##size##x##size##_##opt(uint8_t *dst, ptrdiff_t stride, \
|
|
|
|
const uint8_t *l, const uint8_t *a)
|
|
|
|
|
|
|
|
#define ipred_funcs(type, opt) \
|
|
|
|
ipred_func(4, type, opt); \
|
|
|
|
ipred_func(8, type, opt); \
|
|
|
|
ipred_func(16, type, opt); \
|
|
|
|
ipred_func(32, type, opt)
|
|
|
|
|
|
|
|
ipred_funcs(dc, ssse3);
|
|
|
|
ipred_funcs(dc_left, ssse3);
|
|
|
|
ipred_funcs(dc_top, ssse3);
|
|
|
|
|
|
|
|
#undef ipred_funcs
|
|
|
|
|
|
|
|
ipred_func(8, v, mmx);
|
|
|
|
ipred_func(16, v, sse2);
|
|
|
|
ipred_func(32, v, sse2);
|
|
|
|
|
|
|
|
#define ipred_func_set(size, type, opt1, opt2) \
|
|
|
|
ipred_func(size, type, opt1); \
|
|
|
|
ipred_func(size, type, opt2)
|
|
|
|
|
|
|
|
#define ipred_funcs(type, opt1, opt2) \
|
|
|
|
ipred_func(4, type, opt1); \
|
|
|
|
ipred_func_set(8, type, opt1, opt2); \
|
|
|
|
ipred_func_set(16, type, opt1, opt2); \
|
|
|
|
ipred_func_set(32, type, opt1, opt2)
|
|
|
|
|
|
|
|
ipred_funcs(h, ssse3, avx);
|
|
|
|
ipred_funcs(tm, ssse3, avx);
|
|
|
|
ipred_funcs(dl, ssse3, avx);
|
|
|
|
ipred_funcs(dr, ssse3, avx);
|
|
|
|
ipred_funcs(hu, ssse3, avx);
|
|
|
|
ipred_funcs(hd, ssse3, avx);
|
|
|
|
ipred_funcs(vl, ssse3, avx);
|
|
|
|
ipred_funcs(vr, ssse3, avx);
|
|
|
|
|
|
|
|
#undef ipred_funcs
|
|
|
|
#undef ipred_func_set
|
|
|
|
#undef ipred_func
|
|
|
|
|
2013-09-22 03:24:03 +02:00
|
|
|
#endif /* HAVE_YASM */
|
|
|
|
|
|
|
|
av_cold void ff_vp9dsp_init_x86(VP9DSPContext *dsp)
|
|
|
|
{
|
|
|
|
#if HAVE_YASM
|
|
|
|
int cpu_flags = av_get_cpu_flags();
|
|
|
|
|
2013-09-22 04:03:00 +02:00
|
|
|
#define init_fpel(idx1, idx2, sz, type, opt) \
|
|
|
|
dsp->mc[idx1][FILTER_8TAP_SMOOTH ][idx2][0][0] = \
|
|
|
|
dsp->mc[idx1][FILTER_8TAP_REGULAR][idx2][0][0] = \
|
|
|
|
dsp->mc[idx1][FILTER_8TAP_SHARP ][idx2][0][0] = \
|
2014-03-28 22:33:51 +01:00
|
|
|
dsp->mc[idx1][FILTER_BILINEAR ][idx2][0][0] = ff_vp9_##type##sz##_##opt
|
2013-09-22 04:03:00 +02:00
|
|
|
|
2013-09-22 03:24:03 +02:00
|
|
|
#define init_subpel1(idx1, idx2, idxh, idxv, sz, dir, type, opt) \
|
|
|
|
dsp->mc[idx1][FILTER_8TAP_SMOOTH ][idx2][idxh][idxv] = type##_8tap_smooth_##sz##dir##_##opt; \
|
|
|
|
dsp->mc[idx1][FILTER_8TAP_REGULAR][idx2][idxh][idxv] = type##_8tap_regular_##sz##dir##_##opt; \
|
|
|
|
dsp->mc[idx1][FILTER_8TAP_SHARP ][idx2][idxh][idxv] = type##_8tap_sharp_##sz##dir##_##opt
|
|
|
|
|
|
|
|
#define init_subpel2(idx, idxh, idxv, dir, type, opt) \
|
|
|
|
init_subpel1(0, idx, idxh, idxv, 64, dir, type, opt); \
|
|
|
|
init_subpel1(1, idx, idxh, idxv, 32, dir, type, opt); \
|
|
|
|
init_subpel1(2, idx, idxh, idxv, 16, dir, type, opt); \
|
|
|
|
init_subpel1(3, idx, idxh, idxv, 8, dir, type, opt); \
|
|
|
|
init_subpel1(4, idx, idxh, idxv, 4, dir, type, opt)
|
|
|
|
|
|
|
|
#define init_subpel3(idx, type, opt) \
|
|
|
|
init_subpel2(idx, 1, 1, hv, type, opt); \
|
|
|
|
init_subpel2(idx, 0, 1, v, type, opt); \
|
|
|
|
init_subpel2(idx, 1, 0, h, type, opt)
|
|
|
|
|
2014-01-30 19:01:30 +01:00
|
|
|
#define init_lpf(opt) do { \
|
|
|
|
if (ARCH_X86_64) { \
|
|
|
|
dsp->loop_filter_16[0] = ff_vp9_loop_filter_h_16_16_##opt; \
|
|
|
|
dsp->loop_filter_16[1] = ff_vp9_loop_filter_v_16_16_##opt; \
|
2014-02-05 07:21:06 +01:00
|
|
|
dsp->loop_filter_mix2[0][0][0] = ff_vp9_loop_filter_h_44_16_##opt; \
|
|
|
|
dsp->loop_filter_mix2[0][0][1] = ff_vp9_loop_filter_v_44_16_##opt; \
|
2014-01-30 19:01:30 +01:00
|
|
|
dsp->loop_filter_mix2[0][1][0] = ff_vp9_loop_filter_h_48_16_##opt; \
|
|
|
|
dsp->loop_filter_mix2[0][1][1] = ff_vp9_loop_filter_v_48_16_##opt; \
|
|
|
|
dsp->loop_filter_mix2[1][0][0] = ff_vp9_loop_filter_h_84_16_##opt; \
|
|
|
|
dsp->loop_filter_mix2[1][0][1] = ff_vp9_loop_filter_v_84_16_##opt; \
|
|
|
|
dsp->loop_filter_mix2[1][1][0] = ff_vp9_loop_filter_h_88_16_##opt; \
|
|
|
|
dsp->loop_filter_mix2[1][1][1] = ff_vp9_loop_filter_v_88_16_##opt; \
|
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
|
2014-02-16 19:30:50 +01:00
|
|
|
#define init_ipred(tx, sz, opt) do { \
|
|
|
|
dsp->intra_pred[tx][HOR_PRED] = ff_vp9_ipred_h_##sz##x##sz##_##opt; \
|
|
|
|
dsp->intra_pred[tx][DIAG_DOWN_LEFT_PRED] = ff_vp9_ipred_dl_##sz##x##sz##_##opt; \
|
|
|
|
dsp->intra_pred[tx][DIAG_DOWN_RIGHT_PRED] = ff_vp9_ipred_dr_##sz##x##sz##_##opt; \
|
|
|
|
dsp->intra_pred[tx][HOR_DOWN_PRED] = ff_vp9_ipred_hd_##sz##x##sz##_##opt; \
|
|
|
|
dsp->intra_pred[tx][VERT_LEFT_PRED] = ff_vp9_ipred_vl_##sz##x##sz##_##opt; \
|
|
|
|
dsp->intra_pred[tx][HOR_UP_PRED] = ff_vp9_ipred_hu_##sz##x##sz##_##opt; \
|
|
|
|
if (ARCH_X86_64 || tx != TX_32X32) { \
|
|
|
|
dsp->intra_pred[tx][VERT_RIGHT_PRED] = ff_vp9_ipred_vr_##sz##x##sz##_##opt; \
|
|
|
|
dsp->intra_pred[tx][TM_VP8_PRED] = ff_vp9_ipred_tm_##sz##x##sz##_##opt; \
|
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
#define init_dc_ipred(tx, sz, opt) do { \
|
|
|
|
init_ipred(tx, sz, opt); \
|
|
|
|
dsp->intra_pred[tx][DC_PRED] = ff_vp9_ipred_dc_##sz##x##sz##_##opt; \
|
|
|
|
dsp->intra_pred[tx][LEFT_DC_PRED] = ff_vp9_ipred_dc_left_##sz##x##sz##_##opt; \
|
|
|
|
dsp->intra_pred[tx][TOP_DC_PRED] = ff_vp9_ipred_dc_top_##sz##x##sz##_##opt; \
|
|
|
|
} while (0)
|
|
|
|
|
2013-11-16 16:58:13 +01:00
|
|
|
if (EXTERNAL_MMX(cpu_flags)) {
|
2013-09-22 04:03:00 +02:00
|
|
|
init_fpel(4, 0, 4, put, mmx);
|
|
|
|
init_fpel(3, 0, 8, put, mmx);
|
2014-01-21 02:04:48 +01:00
|
|
|
dsp->itxfm_add[4 /* lossless */][DCT_DCT] =
|
|
|
|
dsp->itxfm_add[4 /* lossless */][ADST_DCT] =
|
|
|
|
dsp->itxfm_add[4 /* lossless */][DCT_ADST] =
|
|
|
|
dsp->itxfm_add[4 /* lossless */][ADST_ADST] = ff_vp9_iwht_iwht_4x4_add_mmx;
|
2014-02-16 19:30:50 +01:00
|
|
|
dsp->intra_pred[TX_8X8][VERT_PRED] = ff_vp9_ipred_v_8x8_mmx;
|
2013-09-22 04:03:00 +02:00
|
|
|
}
|
|
|
|
|
2014-01-18 06:29:22 +01:00
|
|
|
if (EXTERNAL_MMXEXT(cpu_flags)) {
|
|
|
|
init_fpel(4, 1, 4, avg, mmxext);
|
|
|
|
init_fpel(3, 1, 8, avg, mmxext);
|
|
|
|
}
|
|
|
|
|
2013-11-16 16:58:13 +01:00
|
|
|
if (EXTERNAL_SSE(cpu_flags)) {
|
2013-09-22 04:03:00 +02:00
|
|
|
init_fpel(2, 0, 16, put, sse);
|
|
|
|
init_fpel(1, 0, 32, put, sse);
|
|
|
|
init_fpel(0, 0, 64, put, sse);
|
|
|
|
}
|
|
|
|
|
2013-11-16 16:58:13 +01:00
|
|
|
if (EXTERNAL_SSE2(cpu_flags)) {
|
2013-09-22 04:03:00 +02:00
|
|
|
init_fpel(2, 1, 16, avg, sse2);
|
|
|
|
init_fpel(1, 1, 32, avg, sse2);
|
|
|
|
init_fpel(0, 1, 64, avg, sse2);
|
2014-01-30 19:01:30 +01:00
|
|
|
init_lpf(sse2);
|
2014-02-16 19:30:50 +01:00
|
|
|
dsp->intra_pred[TX_16X16][VERT_PRED] = ff_vp9_ipred_v_16x16_sse2;
|
|
|
|
dsp->intra_pred[TX_32X32][VERT_PRED] = ff_vp9_ipred_v_32x32_sse2;
|
2013-09-22 04:03:00 +02:00
|
|
|
}
|
|
|
|
|
2013-11-16 16:58:13 +01:00
|
|
|
if (EXTERNAL_SSSE3(cpu_flags)) {
|
2013-09-22 03:24:03 +02:00
|
|
|
init_subpel3(0, put, ssse3);
|
|
|
|
init_subpel3(1, avg, ssse3);
|
avcodec/vp9: add ff_vp9_idct_idct_{4x4,8x8}_ssse3().
1789 decicycles in idct_idct_4x4_add_c, 262136 runs, 8 skips
1839 decicycles in idct_idct_4x4_add_c, 524270 runs, 18 skips
1864 decicycles in idct_idct_4x4_add_c, 1048548 runs, 28 skips
529 decicycles in ff_vp9_idct_idct_4x4_add_ssse3, 262138 runs, 6 skips
516 decicycles in ff_vp9_idct_idct_4x4_add_ssse3, 524282 runs, 6 skips
474 decicycles in ff_vp9_idct_idct_4x4_add_ssse3, 1048565 runs, 11 skips
(~3.9x faster)
7726 decicycles in idct_idct_8x8_add_c, 1048433 runs, 143 skips
7732 decicycles in idct_idct_8x8_add_c, 2096882 runs, 270 skips
7731 decicycles in idct_idct_8x8_add_c, 4193772 runs, 532 skips
1145 decicycles in ff_vp9_idct_idct_8x8_add_ssse3, 1048549 runs, 27 skips
1137 decicycles in ff_vp9_idct_idct_8x8_add_ssse3, 2097097 runs, 55 skips
1086 decicycles in ff_vp9_idct_idct_8x8_add_ssse3, 4194188 runs, 116 skips
(~7.1x faster)
Overall decode time before commit:
16.48s user 0.03s system 99% cpu 16.526 total
16.54s user 0.01s system 99% cpu 16.566 total
16.46s user 0.03s system 99% cpu 16.511 total
Overall decode time after commit:
16.34s user 0.02s system 99% cpu 16.378 total
16.28s user 0.02s system 99% cpu 16.315 total
16.32s user 0.03s system 99% cpu 16.366 total
Tested on i7 920 with 40s 1080p footage.
2013-11-03 18:17:36 +01:00
|
|
|
dsp->itxfm_add[TX_4X4][DCT_DCT] = ff_vp9_idct_idct_4x4_add_ssse3;
|
2014-01-20 21:30:22 +01:00
|
|
|
dsp->itxfm_add[TX_4X4][ADST_DCT] = ff_vp9_idct_iadst_4x4_add_ssse3;
|
|
|
|
dsp->itxfm_add[TX_4X4][DCT_ADST] = ff_vp9_iadst_idct_4x4_add_ssse3;
|
|
|
|
dsp->itxfm_add[TX_4X4][ADST_ADST] = ff_vp9_iadst_iadst_4x4_add_ssse3;
|
2013-12-14 14:09:18 +01:00
|
|
|
if (ARCH_X86_64) {
|
avcodec/vp9: add ff_vp9_idct_idct_{4x4,8x8}_ssse3().
1789 decicycles in idct_idct_4x4_add_c, 262136 runs, 8 skips
1839 decicycles in idct_idct_4x4_add_c, 524270 runs, 18 skips
1864 decicycles in idct_idct_4x4_add_c, 1048548 runs, 28 skips
529 decicycles in ff_vp9_idct_idct_4x4_add_ssse3, 262138 runs, 6 skips
516 decicycles in ff_vp9_idct_idct_4x4_add_ssse3, 524282 runs, 6 skips
474 decicycles in ff_vp9_idct_idct_4x4_add_ssse3, 1048565 runs, 11 skips
(~3.9x faster)
7726 decicycles in idct_idct_8x8_add_c, 1048433 runs, 143 skips
7732 decicycles in idct_idct_8x8_add_c, 2096882 runs, 270 skips
7731 decicycles in idct_idct_8x8_add_c, 4193772 runs, 532 skips
1145 decicycles in ff_vp9_idct_idct_8x8_add_ssse3, 1048549 runs, 27 skips
1137 decicycles in ff_vp9_idct_idct_8x8_add_ssse3, 2097097 runs, 55 skips
1086 decicycles in ff_vp9_idct_idct_8x8_add_ssse3, 4194188 runs, 116 skips
(~7.1x faster)
Overall decode time before commit:
16.48s user 0.03s system 99% cpu 16.526 total
16.54s user 0.01s system 99% cpu 16.566 total
16.46s user 0.03s system 99% cpu 16.511 total
Overall decode time after commit:
16.34s user 0.02s system 99% cpu 16.378 total
16.28s user 0.02s system 99% cpu 16.315 total
16.32s user 0.03s system 99% cpu 16.366 total
Tested on i7 920 with 40s 1080p footage.
2013-11-03 18:17:36 +01:00
|
|
|
dsp->itxfm_add[TX_8X8][DCT_DCT] = ff_vp9_idct_idct_8x8_add_ssse3;
|
2014-01-20 23:11:48 +01:00
|
|
|
dsp->itxfm_add[TX_8X8][ADST_DCT] = ff_vp9_idct_iadst_8x8_add_ssse3;
|
|
|
|
dsp->itxfm_add[TX_8X8][DCT_ADST] = ff_vp9_iadst_idct_8x8_add_ssse3;
|
|
|
|
dsp->itxfm_add[TX_8X8][ADST_ADST] = ff_vp9_iadst_iadst_8x8_add_ssse3;
|
2014-01-16 13:30:15 +01:00
|
|
|
dsp->itxfm_add[TX_16X16][DCT_DCT] = ff_vp9_idct_idct_16x16_add_ssse3;
|
|
|
|
dsp->itxfm_add[TX_16X16][ADST_DCT] = ff_vp9_idct_iadst_16x16_add_ssse3;
|
|
|
|
dsp->itxfm_add[TX_16X16][DCT_ADST] = ff_vp9_iadst_idct_16x16_add_ssse3;
|
|
|
|
dsp->itxfm_add[TX_16X16][ADST_ADST] = ff_vp9_iadst_iadst_16x16_add_ssse3;
|
2014-01-04 16:08:47 +01:00
|
|
|
dsp->itxfm_add[TX_32X32][ADST_ADST] =
|
|
|
|
dsp->itxfm_add[TX_32X32][ADST_DCT] =
|
|
|
|
dsp->itxfm_add[TX_32X32][DCT_ADST] =
|
|
|
|
dsp->itxfm_add[TX_32X32][DCT_DCT] = ff_vp9_idct_idct_32x32_add_ssse3;
|
2013-12-14 14:09:18 +01:00
|
|
|
}
|
2014-01-30 19:01:30 +01:00
|
|
|
init_lpf(ssse3);
|
2014-02-16 19:30:50 +01:00
|
|
|
init_dc_ipred(TX_4X4, 4, ssse3);
|
|
|
|
init_dc_ipred(TX_8X8, 8, ssse3);
|
|
|
|
init_dc_ipred(TX_16X16, 16, ssse3);
|
|
|
|
init_dc_ipred(TX_32X32, 32, ssse3);
|
2013-09-22 03:24:03 +02:00
|
|
|
}
|
|
|
|
|
vp9/x86: add AVX for itxfm and lpf.
4412 decicycles in ff_vp9_loop_filter_h_16_16_ssse3, 4193462 runs, 842 skips
3600 decicycles in ff_vp9_loop_filter_h_16_16_avx, 4193621 runs, 683 skips
3010 decicycles in ff_vp9_loop_filter_v_16_16_ssse3, 4193528 runs, 776 skips
2678 decicycles in ff_vp9_loop_filter_v_16_16_avx, 4193742 runs, 562 skips
23025 decicycles in ff_vp9_idct_idct_32x32_add_ssse3, 2096871 runs, 281 skips
19943 decicycles in ff_vp9_idct_idct_32x32_add_avx, 2096815 runs, 337 skips
4675 decicycles in ff_vp9_idct_idct_16x16_add_ssse3, 4194018 runs, 286 skips
3980 decicycles in ff_vp9_idct_idct_16x16_add_avx, 4194022 runs, 282 skips
967 decicycles in ff_vp9_idct_idct_8x8_add_ssse3, 16776972 runs, 244 skips
887 decicycles in ff_vp9_idct_idct_8x8_add_avx, 16777002 runs, 214 skips
2014-01-14 08:09:48 +01:00
|
|
|
if (EXTERNAL_AVX(cpu_flags)) {
|
|
|
|
if (ARCH_X86_64) {
|
|
|
|
dsp->itxfm_add[TX_8X8][DCT_DCT] = ff_vp9_idct_idct_8x8_add_avx;
|
2014-01-20 23:11:48 +01:00
|
|
|
dsp->itxfm_add[TX_8X8][ADST_DCT] = ff_vp9_idct_iadst_8x8_add_avx;
|
|
|
|
dsp->itxfm_add[TX_8X8][DCT_ADST] = ff_vp9_iadst_idct_8x8_add_avx;
|
|
|
|
dsp->itxfm_add[TX_8X8][ADST_ADST] = ff_vp9_iadst_iadst_8x8_add_avx;
|
vp9/x86: add AVX for itxfm and lpf.
4412 decicycles in ff_vp9_loop_filter_h_16_16_ssse3, 4193462 runs, 842 skips
3600 decicycles in ff_vp9_loop_filter_h_16_16_avx, 4193621 runs, 683 skips
3010 decicycles in ff_vp9_loop_filter_v_16_16_ssse3, 4193528 runs, 776 skips
2678 decicycles in ff_vp9_loop_filter_v_16_16_avx, 4193742 runs, 562 skips
23025 decicycles in ff_vp9_idct_idct_32x32_add_ssse3, 2096871 runs, 281 skips
19943 decicycles in ff_vp9_idct_idct_32x32_add_avx, 2096815 runs, 337 skips
4675 decicycles in ff_vp9_idct_idct_16x16_add_ssse3, 4194018 runs, 286 skips
3980 decicycles in ff_vp9_idct_idct_16x16_add_avx, 4194022 runs, 282 skips
967 decicycles in ff_vp9_idct_idct_8x8_add_ssse3, 16776972 runs, 244 skips
887 decicycles in ff_vp9_idct_idct_8x8_add_avx, 16777002 runs, 214 skips
2014-01-14 08:09:48 +01:00
|
|
|
dsp->itxfm_add[TX_16X16][DCT_DCT] = ff_vp9_idct_idct_16x16_add_avx;
|
2014-01-16 13:30:15 +01:00
|
|
|
dsp->itxfm_add[TX_16X16][ADST_DCT] = ff_vp9_idct_iadst_16x16_add_avx;
|
|
|
|
dsp->itxfm_add[TX_16X16][DCT_ADST] = ff_vp9_iadst_idct_16x16_add_avx;
|
|
|
|
dsp->itxfm_add[TX_16X16][ADST_ADST] = ff_vp9_iadst_iadst_16x16_add_avx;
|
vp9/x86: add AVX for itxfm and lpf.
4412 decicycles in ff_vp9_loop_filter_h_16_16_ssse3, 4193462 runs, 842 skips
3600 decicycles in ff_vp9_loop_filter_h_16_16_avx, 4193621 runs, 683 skips
3010 decicycles in ff_vp9_loop_filter_v_16_16_ssse3, 4193528 runs, 776 skips
2678 decicycles in ff_vp9_loop_filter_v_16_16_avx, 4193742 runs, 562 skips
23025 decicycles in ff_vp9_idct_idct_32x32_add_ssse3, 2096871 runs, 281 skips
19943 decicycles in ff_vp9_idct_idct_32x32_add_avx, 2096815 runs, 337 skips
4675 decicycles in ff_vp9_idct_idct_16x16_add_ssse3, 4194018 runs, 286 skips
3980 decicycles in ff_vp9_idct_idct_16x16_add_avx, 4194022 runs, 282 skips
967 decicycles in ff_vp9_idct_idct_8x8_add_ssse3, 16776972 runs, 244 skips
887 decicycles in ff_vp9_idct_idct_8x8_add_avx, 16777002 runs, 214 skips
2014-01-14 08:09:48 +01:00
|
|
|
dsp->itxfm_add[TX_32X32][ADST_ADST] =
|
|
|
|
dsp->itxfm_add[TX_32X32][ADST_DCT] =
|
|
|
|
dsp->itxfm_add[TX_32X32][DCT_ADST] =
|
|
|
|
dsp->itxfm_add[TX_32X32][DCT_DCT] = ff_vp9_idct_idct_32x32_add_avx;
|
|
|
|
}
|
2014-01-30 19:01:30 +01:00
|
|
|
init_lpf(avx);
|
2014-02-16 19:30:50 +01:00
|
|
|
init_ipred(TX_8X8, 8, avx);
|
|
|
|
init_ipred(TX_16X16, 16, avx);
|
|
|
|
init_ipred(TX_32X32, 32, avx);
|
vp9/x86: add AVX for itxfm and lpf.
4412 decicycles in ff_vp9_loop_filter_h_16_16_ssse3, 4193462 runs, 842 skips
3600 decicycles in ff_vp9_loop_filter_h_16_16_avx, 4193621 runs, 683 skips
3010 decicycles in ff_vp9_loop_filter_v_16_16_ssse3, 4193528 runs, 776 skips
2678 decicycles in ff_vp9_loop_filter_v_16_16_avx, 4193742 runs, 562 skips
23025 decicycles in ff_vp9_idct_idct_32x32_add_ssse3, 2096871 runs, 281 skips
19943 decicycles in ff_vp9_idct_idct_32x32_add_avx, 2096815 runs, 337 skips
4675 decicycles in ff_vp9_idct_idct_16x16_add_ssse3, 4194018 runs, 286 skips
3980 decicycles in ff_vp9_idct_idct_16x16_add_avx, 4194022 runs, 282 skips
967 decicycles in ff_vp9_idct_idct_8x8_add_ssse3, 16776972 runs, 244 skips
887 decicycles in ff_vp9_idct_idct_8x8_add_avx, 16777002 runs, 214 skips
2014-01-14 08:09:48 +01:00
|
|
|
}
|
|
|
|
|
2013-09-22 04:03:00 +02:00
|
|
|
#undef init_fpel
|
2013-09-22 03:24:03 +02:00
|
|
|
#undef init_subpel1
|
|
|
|
#undef init_subpel2
|
|
|
|
#undef init_subpel3
|
|
|
|
|
|
|
|
#endif /* HAVE_YASM */
|
|
|
|
}
|