2013-09-22 04:24:03 +03: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 16:06:31 +03:00
|
|
|
#include "libavutil/attributes.h"
|
2013-09-22 04:24:03 +03:00
|
|
|
#include "libavutil/cpu.h"
|
|
|
|
#include "libavutil/mem.h"
|
2013-11-16 18:58:13 +03:00
|
|
|
#include "libavutil/x86/cpu.h"
|
2017-03-27 22:47:46 +02:00
|
|
|
#include "libavcodec/vp9dsp.h"
|
2015-09-16 15:08:04 +02:00
|
|
|
#include "libavcodec/x86/vp9dsp_init.h"
|
2013-09-22 04:24:03 +03:00
|
|
|
|
2016-10-08 16:18:33 +02:00
|
|
|
#if HAVE_X86ASM
|
2013-09-22 04:24:03 +03:00
|
|
|
|
2015-09-16 15:12:27 +02:00
|
|
|
decl_fpel_func(put, 4, , mmx);
|
|
|
|
decl_fpel_func(put, 8, , mmx);
|
|
|
|
decl_fpel_func(put, 16, , sse);
|
|
|
|
decl_fpel_func(put, 32, , sse);
|
|
|
|
decl_fpel_func(put, 64, , sse);
|
|
|
|
decl_fpel_func(avg, 4, _8, mmxext);
|
|
|
|
decl_fpel_func(avg, 8, _8, mmxext);
|
|
|
|
decl_fpel_func(avg, 16, _8, sse2);
|
|
|
|
decl_fpel_func(avg, 32, _8, sse2);
|
|
|
|
decl_fpel_func(avg, 64, _8, sse2);
|
|
|
|
decl_fpel_func(put, 32, , avx);
|
|
|
|
decl_fpel_func(put, 64, , avx);
|
|
|
|
decl_fpel_func(avg, 32, _8, avx2);
|
|
|
|
decl_fpel_func(avg, 64, _8, avx2);
|
2013-09-22 05:03:00 +03:00
|
|
|
|
2015-09-16 22:07:46 +02:00
|
|
|
decl_mc_funcs(4, mmxext, int16_t, 8, 8);
|
|
|
|
decl_mc_funcs(8, sse2, int16_t, 8, 8);
|
|
|
|
decl_mc_funcs(4, ssse3, int8_t, 32, 8);
|
|
|
|
decl_mc_funcs(8, ssse3, int8_t, 32, 8);
|
2013-12-25 00:17:03 +03:00
|
|
|
#if ARCH_X86_64
|
2015-09-16 22:07:46 +02:00
|
|
|
decl_mc_funcs(16, ssse3, int8_t, 32, 8);
|
|
|
|
decl_mc_funcs(32, avx2, int8_t, 32, 8);
|
2013-12-25 00:17:03 +03:00
|
|
|
#endif
|
2013-09-22 04:24:03 +03:00
|
|
|
|
2015-10-23 17:23:42 +02:00
|
|
|
mc_rep_funcs(16, 8, 8, sse2, int16_t, 8, 8)
|
2013-12-25 00:17:03 +03:00
|
|
|
#if ARCH_X86_32
|
2015-10-23 17:23:42 +02:00
|
|
|
mc_rep_funcs(16, 8, 8, ssse3, int8_t, 32, 8)
|
2014-09-23 03:55:13 +03:00
|
|
|
#endif
|
2015-10-23 17:23:42 +02:00
|
|
|
mc_rep_funcs(32, 16, 16, sse2, int16_t, 8, 8)
|
|
|
|
mc_rep_funcs(32, 16, 16, ssse3, int8_t, 32, 8)
|
|
|
|
mc_rep_funcs(64, 32, 32, sse2, int16_t, 8, 8)
|
|
|
|
mc_rep_funcs(64, 32, 32, ssse3, int8_t, 32, 8)
|
2014-09-23 03:55:13 +03:00
|
|
|
#if ARCH_X86_64 && HAVE_AVX2_EXTERNAL
|
2015-10-23 17:23:42 +02:00
|
|
|
mc_rep_funcs(64, 32, 32, avx2, int8_t, 32, 8)
|
2013-12-25 00:17:03 +03:00
|
|
|
#endif
|
2013-09-22 04:24:03 +03:00
|
|
|
|
2014-09-23 03:55:13 +03:00
|
|
|
extern const int8_t ff_filters_ssse3[3][15][4][32];
|
2014-12-15 03:13:24 +02:00
|
|
|
extern const int16_t ff_filters_sse2[3][15][8][8];
|
2013-09-22 04:24:03 +03:00
|
|
|
|
2015-09-16 22:07:46 +02:00
|
|
|
filters_8tap_2d_fn2(put, 16, 8, 1, mmxext, sse2, sse2)
|
|
|
|
filters_8tap_2d_fn2(avg, 16, 8, 1, mmxext, sse2, sse2)
|
|
|
|
filters_8tap_2d_fn2(put, 16, 8, 1, ssse3, ssse3, ssse3)
|
|
|
|
filters_8tap_2d_fn2(avg, 16, 8, 1, ssse3, ssse3, ssse3)
|
2014-09-23 03:55:13 +03:00
|
|
|
#if ARCH_X86_64 && HAVE_AVX2_EXTERNAL
|
2015-09-16 22:07:46 +02:00
|
|
|
filters_8tap_2d_fn(put, 64, 32, 8, 1, avx2, ssse3)
|
|
|
|
filters_8tap_2d_fn(put, 32, 32, 8, 1, avx2, ssse3)
|
|
|
|
filters_8tap_2d_fn(avg, 64, 32, 8, 1, avx2, ssse3)
|
|
|
|
filters_8tap_2d_fn(avg, 32, 32, 8, 1, avx2, ssse3)
|
2014-09-23 03:55:13 +03:00
|
|
|
#endif
|
2013-09-22 04:24:03 +03:00
|
|
|
|
2015-09-16 22:07:46 +02:00
|
|
|
filters_8tap_1d_fn3(put, 8, mmxext, sse2, sse2)
|
|
|
|
filters_8tap_1d_fn3(avg, 8, mmxext, sse2, sse2)
|
|
|
|
filters_8tap_1d_fn3(put, 8, ssse3, ssse3, ssse3)
|
|
|
|
filters_8tap_1d_fn3(avg, 8, ssse3, ssse3, ssse3)
|
2014-09-23 03:55:13 +03:00
|
|
|
#if ARCH_X86_64 && HAVE_AVX2_EXTERNAL
|
2015-09-16 22:07:46 +02:00
|
|
|
filters_8tap_1d_fn2(put, 64, 8, avx2, ssse3)
|
|
|
|
filters_8tap_1d_fn2(put, 32, 8, avx2, ssse3)
|
|
|
|
filters_8tap_1d_fn2(avg, 64, 8, avx2, ssse3)
|
|
|
|
filters_8tap_1d_fn2(avg, 32, 8, avx2, ssse3)
|
2014-09-23 03:55:13 +03:00
|
|
|
#endif
|
2013-09-22 04:24:03 +03:00
|
|
|
|
2014-01-16 15:30:15 +03: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-12-15 01:25:10 +02:00
|
|
|
itxfm_func(idct, idct, 4, mmxext);
|
|
|
|
itxfm_func(idct, iadst, 4, sse2);
|
|
|
|
itxfm_func(iadst, idct, 4, sse2);
|
|
|
|
itxfm_func(iadst, iadst, 4, sse2);
|
2014-01-20 23:30:22 +03:00
|
|
|
itxfm_funcs(4, ssse3);
|
2014-12-15 01:25:10 +02:00
|
|
|
itxfm_funcs(8, sse2);
|
2014-01-21 01:11:48 +03:00
|
|
|
itxfm_funcs(8, ssse3);
|
|
|
|
itxfm_funcs(8, avx);
|
2014-12-15 01:25:10 +02:00
|
|
|
itxfm_funcs(16, sse2);
|
2014-01-16 15:30:15 +03:00
|
|
|
itxfm_funcs(16, ssse3);
|
|
|
|
itxfm_funcs(16, avx);
|
2014-12-15 01:25:10 +02:00
|
|
|
itxfm_func(idct, idct, 32, sse2);
|
2014-01-16 15:30:15 +03:00
|
|
|
itxfm_func(idct, idct, 32, ssse3);
|
|
|
|
itxfm_func(idct, idct, 32, avx);
|
2014-01-21 04:04:48 +03:00
|
|
|
itxfm_func(iwht, iwht, 4, mmx);
|
2016-11-08 21:43:59 +02:00
|
|
|
itxfm_funcs(16, avx2);
|
2016-07-13 18:37:21 +02:00
|
|
|
itxfm_func(idct, idct, 32, avx2);
|
2014-01-16 15:30:15 +03: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 20:17:36 +03:00
|
|
|
|
2014-01-17 09:55:44 +03: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)
|
|
|
|
|
2016-07-19 18:06:32 +02:00
|
|
|
lpf_funcs(4, 8, mmxext);
|
2016-07-19 21:37:46 +02:00
|
|
|
lpf_funcs(8, 8, mmxext);
|
2014-01-17 09:55:44 +03:00
|
|
|
lpf_funcs(16, 16, sse2);
|
|
|
|
lpf_funcs(16, 16, ssse3);
|
|
|
|
lpf_funcs(16, 16, avx);
|
2014-02-05 09:21:06 +03:00
|
|
|
lpf_funcs(44, 16, sse2);
|
|
|
|
lpf_funcs(44, 16, ssse3);
|
|
|
|
lpf_funcs(44, 16, avx);
|
2014-01-30 21:01:30 +03: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 10:59:45 +03: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 19:38:42 +03:00
|
|
|
lpf_funcs(88, 16, ssse3);
|
|
|
|
lpf_funcs(88, 16, avx);
|
2014-01-17 09:55:44 +03:00
|
|
|
|
|
|
|
#undef lpf_funcs
|
2014-01-05 23:00:40 +03:00
|
|
|
|
2014-02-16 21:30:50 +03: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)
|
|
|
|
|
2014-12-16 05:13:52 +02:00
|
|
|
ipred_func(8, v, mmx);
|
2014-02-16 21:30:50 +03:00
|
|
|
|
2014-12-16 05:13:52 +02:00
|
|
|
#define ipred_dc_funcs(size, opt) \
|
|
|
|
ipred_func(size, dc, opt); \
|
|
|
|
ipred_func(size, dc_left, opt); \
|
|
|
|
ipred_func(size, dc_top, opt)
|
2014-02-16 21:30:50 +03:00
|
|
|
|
2014-12-16 05:13:52 +02:00
|
|
|
ipred_dc_funcs(4, mmxext);
|
|
|
|
ipred_dc_funcs(8, mmxext);
|
2014-02-16 21:30:50 +03:00
|
|
|
|
2014-12-16 05:13:52 +02:00
|
|
|
#define ipred_dir_tm_funcs(size, opt) \
|
|
|
|
ipred_func(size, tm, opt); \
|
|
|
|
ipred_func(size, dl, opt); \
|
|
|
|
ipred_func(size, dr, opt); \
|
|
|
|
ipred_func(size, hd, opt); \
|
|
|
|
ipred_func(size, hu, opt); \
|
|
|
|
ipred_func(size, vl, opt); \
|
|
|
|
ipred_func(size, vr, opt)
|
|
|
|
|
|
|
|
ipred_dir_tm_funcs(4, mmxext);
|
|
|
|
|
|
|
|
ipred_func(16, v, sse);
|
|
|
|
ipred_func(32, v, sse);
|
|
|
|
|
|
|
|
ipred_dc_funcs(16, sse2);
|
|
|
|
ipred_dc_funcs(32, sse2);
|
|
|
|
|
|
|
|
#define ipred_dir_tm_h_funcs(size, opt) \
|
|
|
|
ipred_dir_tm_funcs(size, opt); \
|
|
|
|
ipred_func(size, h, opt)
|
|
|
|
|
|
|
|
ipred_dir_tm_h_funcs(8, sse2);
|
|
|
|
ipred_dir_tm_h_funcs(16, sse2);
|
|
|
|
ipred_dir_tm_h_funcs(32, sse2);
|
|
|
|
|
|
|
|
ipred_func(4, h, sse2);
|
|
|
|
|
|
|
|
#define ipred_all_funcs(size, opt) \
|
|
|
|
ipred_dc_funcs(size, opt); \
|
|
|
|
ipred_dir_tm_h_funcs(size, opt)
|
|
|
|
|
|
|
|
// FIXME hd/vl_4x4_ssse3 does not exist
|
|
|
|
ipred_all_funcs(4, ssse3);
|
|
|
|
ipred_all_funcs(8, ssse3);
|
|
|
|
ipred_all_funcs(16, ssse3);
|
|
|
|
ipred_all_funcs(32, ssse3);
|
|
|
|
|
|
|
|
ipred_dir_tm_h_funcs(8, avx);
|
|
|
|
ipred_dir_tm_h_funcs(16, avx);
|
|
|
|
ipred_dir_tm_h_funcs(32, avx);
|
|
|
|
|
|
|
|
ipred_func(32, v, avx);
|
2014-02-16 21:30:50 +03:00
|
|
|
|
2014-12-16 05:13:52 +02:00
|
|
|
ipred_dc_funcs(32, avx2);
|
|
|
|
ipred_func(32, h, avx2);
|
|
|
|
ipred_func(32, tm, avx2);
|
|
|
|
|
2014-02-16 21:30:50 +03:00
|
|
|
#undef ipred_func
|
2014-12-16 05:13:52 +02:00
|
|
|
#undef ipred_dir_tm_h_funcs
|
|
|
|
#undef ipred_dir_tm_funcs
|
|
|
|
#undef ipred_dc_funcs
|
2014-02-16 21:30:50 +03:00
|
|
|
|
2016-10-08 16:18:33 +02:00
|
|
|
#endif /* HAVE_X86ASM */
|
2013-09-22 04:24:03 +03:00
|
|
|
|
2015-09-09 20:10:41 +02:00
|
|
|
av_cold void ff_vp9dsp_init_x86(VP9DSPContext *dsp, int bpp, int bitexact)
|
2013-09-22 04:24:03 +03:00
|
|
|
{
|
2016-10-08 16:18:33 +02:00
|
|
|
#if HAVE_X86ASM
|
2015-05-07 13:46:48 +02:00
|
|
|
int cpu_flags;
|
2015-09-16 22:07:46 +02:00
|
|
|
|
|
|
|
if (bpp == 10) {
|
2015-10-06 17:01:48 +02:00
|
|
|
ff_vp9dsp_init_10bpp_x86(dsp, bitexact);
|
2015-09-16 22:07:46 +02:00
|
|
|
return;
|
|
|
|
} else if (bpp == 12) {
|
2015-10-06 17:01:48 +02:00
|
|
|
ff_vp9dsp_init_12bpp_x86(dsp, bitexact);
|
2015-09-16 15:08:04 +02:00
|
|
|
return;
|
|
|
|
}
|
2015-05-06 14:50:43 +02:00
|
|
|
|
2015-05-07 13:46:48 +02:00
|
|
|
cpu_flags = av_get_cpu_flags();
|
2013-09-22 04:24:03 +03:00
|
|
|
|
2014-01-30 21:01:30 +03:00
|
|
|
#define init_lpf(opt) do { \
|
2014-12-27 00:50:38 +02:00
|
|
|
dsp->loop_filter_16[0] = ff_vp9_loop_filter_h_16_16_##opt; \
|
2014-12-26 21:05:23 +02:00
|
|
|
dsp->loop_filter_16[1] = ff_vp9_loop_filter_v_16_16_##opt; \
|
2014-12-26 21:48:01 +02:00
|
|
|
dsp->loop_filter_mix2[0][0][0] = ff_vp9_loop_filter_h_44_16_##opt; \
|
2014-12-27 22:08:48 +02:00
|
|
|
dsp->loop_filter_mix2[0][0][1] = ff_vp9_loop_filter_v_44_16_##opt; \
|
2014-12-26 22:15:50 +02:00
|
|
|
dsp->loop_filter_mix2[0][1][0] = ff_vp9_loop_filter_h_48_16_##opt; \
|
2014-12-26 19:10:26 +02:00
|
|
|
dsp->loop_filter_mix2[0][1][1] = ff_vp9_loop_filter_v_48_16_##opt; \
|
2014-12-26 22:15:50 +02:00
|
|
|
dsp->loop_filter_mix2[1][0][0] = ff_vp9_loop_filter_h_84_16_##opt; \
|
2014-12-26 19:10:26 +02:00
|
|
|
dsp->loop_filter_mix2[1][0][1] = ff_vp9_loop_filter_v_84_16_##opt; \
|
2014-12-26 22:15:50 +02:00
|
|
|
dsp->loop_filter_mix2[1][1][0] = ff_vp9_loop_filter_h_88_16_##opt; \
|
2014-12-27 22:12:01 +02:00
|
|
|
dsp->loop_filter_mix2[1][1][1] = ff_vp9_loop_filter_v_88_16_##opt; \
|
2014-01-30 21:01:30 +03:00
|
|
|
} while (0)
|
|
|
|
|
2014-12-16 05:13:52 +02:00
|
|
|
#define init_ipred(sz, opt, t, e) \
|
|
|
|
dsp->intra_pred[TX_##sz##X##sz][e##_PRED] = ff_vp9_ipred_##t##_##sz##x##sz##_##opt
|
|
|
|
|
|
|
|
#define ff_vp9_ipred_hd_4x4_ssse3 ff_vp9_ipred_hd_4x4_mmxext
|
|
|
|
#define ff_vp9_ipred_vl_4x4_ssse3 ff_vp9_ipred_vl_4x4_mmxext
|
|
|
|
#define init_dir_tm_ipred(sz, opt) do { \
|
|
|
|
init_ipred(sz, opt, dl, DIAG_DOWN_LEFT); \
|
|
|
|
init_ipred(sz, opt, dr, DIAG_DOWN_RIGHT); \
|
|
|
|
init_ipred(sz, opt, hd, HOR_DOWN); \
|
|
|
|
init_ipred(sz, opt, vl, VERT_LEFT); \
|
|
|
|
init_ipred(sz, opt, hu, HOR_UP); \
|
|
|
|
init_ipred(sz, opt, tm, TM_VP8); \
|
|
|
|
init_ipred(sz, opt, vr, VERT_RIGHT); \
|
|
|
|
} while (0)
|
|
|
|
#define init_dir_tm_h_ipred(sz, opt) do { \
|
|
|
|
init_dir_tm_ipred(sz, opt); \
|
|
|
|
init_ipred(sz, opt, h, HOR); \
|
|
|
|
} while (0)
|
|
|
|
#define init_dc_ipred(sz, opt) do { \
|
|
|
|
init_ipred(sz, opt, dc, DC); \
|
|
|
|
init_ipred(sz, opt, dc_left, LEFT_DC); \
|
|
|
|
init_ipred(sz, opt, dc_top, TOP_DC); \
|
2014-02-16 21:30:50 +03:00
|
|
|
} while (0)
|
2014-12-16 05:13:52 +02:00
|
|
|
#define init_all_ipred(sz, opt) do { \
|
|
|
|
init_dc_ipred(sz, opt); \
|
|
|
|
init_dir_tm_h_ipred(sz, opt); \
|
2014-02-16 21:30:50 +03:00
|
|
|
} while (0)
|
|
|
|
|
2013-11-16 18:58:13 +03:00
|
|
|
if (EXTERNAL_MMX(cpu_flags)) {
|
2015-09-16 15:12:27 +02:00
|
|
|
init_fpel_func(4, 0, 4, put, , mmx);
|
|
|
|
init_fpel_func(3, 0, 8, put, , mmx);
|
2015-09-09 20:10:41 +02:00
|
|
|
if (!bitexact) {
|
|
|
|
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-12-16 05:13:52 +02:00
|
|
|
init_ipred(8, mmx, v, VERT);
|
2013-09-22 05:03:00 +03:00
|
|
|
}
|
|
|
|
|
2014-01-18 08:29:22 +03:00
|
|
|
if (EXTERNAL_MMXEXT(cpu_flags)) {
|
2016-07-19 18:06:32 +02:00
|
|
|
dsp->loop_filter_8[0][0] = ff_vp9_loop_filter_h_4_8_mmxext;
|
|
|
|
dsp->loop_filter_8[0][1] = ff_vp9_loop_filter_v_4_8_mmxext;
|
2016-07-19 21:37:46 +02:00
|
|
|
dsp->loop_filter_8[1][0] = ff_vp9_loop_filter_h_8_8_mmxext;
|
|
|
|
dsp->loop_filter_8[1][1] = ff_vp9_loop_filter_v_8_8_mmxext;
|
2015-09-16 22:07:46 +02:00
|
|
|
init_subpel2(4, 0, 4, put, 8, mmxext);
|
|
|
|
init_subpel2(4, 1, 4, avg, 8, mmxext);
|
2015-09-16 15:12:27 +02:00
|
|
|
init_fpel_func(4, 1, 4, avg, _8, mmxext);
|
|
|
|
init_fpel_func(3, 1, 8, avg, _8, mmxext);
|
2014-12-15 01:25:10 +02:00
|
|
|
dsp->itxfm_add[TX_4X4][DCT_DCT] = ff_vp9_idct_idct_4x4_add_mmxext;
|
2014-12-16 05:13:52 +02:00
|
|
|
init_dc_ipred(4, mmxext);
|
|
|
|
init_dc_ipred(8, mmxext);
|
|
|
|
init_dir_tm_ipred(4, mmxext);
|
2014-01-18 08:29:22 +03:00
|
|
|
}
|
|
|
|
|
2013-11-16 18:58:13 +03:00
|
|
|
if (EXTERNAL_SSE(cpu_flags)) {
|
2015-09-16 15:12:27 +02:00
|
|
|
init_fpel_func(2, 0, 16, put, , sse);
|
|
|
|
init_fpel_func(1, 0, 32, put, , sse);
|
|
|
|
init_fpel_func(0, 0, 64, put, , sse);
|
2014-12-16 05:13:52 +02:00
|
|
|
init_ipred(16, sse, v, VERT);
|
|
|
|
init_ipred(32, sse, v, VERT);
|
2013-09-22 05:03:00 +03:00
|
|
|
}
|
|
|
|
|
2013-11-16 18:58:13 +03:00
|
|
|
if (EXTERNAL_SSE2(cpu_flags)) {
|
2015-09-16 22:07:46 +02:00
|
|
|
init_subpel3_8to64(0, put, 8, sse2);
|
|
|
|
init_subpel3_8to64(1, avg, 8, sse2);
|
2015-09-16 15:12:27 +02:00
|
|
|
init_fpel_func(2, 1, 16, avg, _8, sse2);
|
|
|
|
init_fpel_func(1, 1, 32, avg, _8, sse2);
|
|
|
|
init_fpel_func(0, 1, 64, avg, _8, sse2);
|
2014-01-30 21:01:30 +03:00
|
|
|
init_lpf(sse2);
|
2014-12-15 01:25:10 +02:00
|
|
|
dsp->itxfm_add[TX_4X4][ADST_DCT] = ff_vp9_idct_iadst_4x4_add_sse2;
|
|
|
|
dsp->itxfm_add[TX_4X4][DCT_ADST] = ff_vp9_iadst_idct_4x4_add_sse2;
|
|
|
|
dsp->itxfm_add[TX_4X4][ADST_ADST] = ff_vp9_iadst_iadst_4x4_add_sse2;
|
|
|
|
dsp->itxfm_add[TX_8X8][DCT_DCT] = ff_vp9_idct_idct_8x8_add_sse2;
|
|
|
|
dsp->itxfm_add[TX_8X8][ADST_DCT] = ff_vp9_idct_iadst_8x8_add_sse2;
|
|
|
|
dsp->itxfm_add[TX_8X8][DCT_ADST] = ff_vp9_iadst_idct_8x8_add_sse2;
|
|
|
|
dsp->itxfm_add[TX_8X8][ADST_ADST] = ff_vp9_iadst_iadst_8x8_add_sse2;
|
|
|
|
dsp->itxfm_add[TX_16X16][DCT_DCT] = ff_vp9_idct_idct_16x16_add_sse2;
|
|
|
|
dsp->itxfm_add[TX_16X16][ADST_DCT] = ff_vp9_idct_iadst_16x16_add_sse2;
|
|
|
|
dsp->itxfm_add[TX_16X16][DCT_ADST] = ff_vp9_iadst_idct_16x16_add_sse2;
|
|
|
|
dsp->itxfm_add[TX_16X16][ADST_ADST] = ff_vp9_iadst_iadst_16x16_add_sse2;
|
|
|
|
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_sse2;
|
2014-12-16 05:13:52 +02:00
|
|
|
init_dc_ipred(16, sse2);
|
|
|
|
init_dc_ipred(32, sse2);
|
|
|
|
init_dir_tm_h_ipred(8, sse2);
|
|
|
|
init_dir_tm_h_ipred(16, sse2);
|
|
|
|
init_dir_tm_h_ipred(32, sse2);
|
|
|
|
init_ipred(4, sse2, h, HOR);
|
2013-09-22 05:03:00 +03:00
|
|
|
}
|
|
|
|
|
2013-11-16 18:58:13 +03:00
|
|
|
if (EXTERNAL_SSSE3(cpu_flags)) {
|
2015-09-16 22:07:46 +02:00
|
|
|
init_subpel3(0, put, 8, ssse3);
|
|
|
|
init_subpel3(1, avg, 8, 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 20:17:36 +03:00
|
|
|
dsp->itxfm_add[TX_4X4][DCT_DCT] = ff_vp9_idct_idct_4x4_add_ssse3;
|
2014-01-20 23:30:22 +03: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;
|
2014-12-15 01:25:10 +02:00
|
|
|
dsp->itxfm_add[TX_8X8][DCT_DCT] = ff_vp9_idct_idct_8x8_add_ssse3;
|
|
|
|
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;
|
|
|
|
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;
|
|
|
|
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;
|
2014-01-30 21:01:30 +03:00
|
|
|
init_lpf(ssse3);
|
2014-12-16 05:13:52 +02:00
|
|
|
init_all_ipred(4, ssse3);
|
|
|
|
init_all_ipred(8, ssse3);
|
|
|
|
init_all_ipred(16, ssse3);
|
|
|
|
init_all_ipred(32, ssse3);
|
2013-09-22 04:24:03 +03: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 10:09:48 +03:00
|
|
|
if (EXTERNAL_AVX(cpu_flags)) {
|
2014-12-15 01:25:10 +02:00
|
|
|
dsp->itxfm_add[TX_8X8][DCT_DCT] = ff_vp9_idct_idct_8x8_add_avx;
|
|
|
|
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;
|
|
|
|
dsp->itxfm_add[TX_16X16][DCT_DCT] = ff_vp9_idct_idct_16x16_add_avx;
|
|
|
|
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;
|
|
|
|
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 21:01:30 +03:00
|
|
|
init_lpf(avx);
|
2014-12-16 05:13:52 +02:00
|
|
|
init_dir_tm_h_ipred(8, avx);
|
|
|
|
init_dir_tm_h_ipred(16, avx);
|
|
|
|
init_dir_tm_h_ipred(32, avx);
|
2015-05-31 19:20:29 +02:00
|
|
|
}
|
|
|
|
if (EXTERNAL_AVX_FAST(cpu_flags)) {
|
2015-09-16 15:12:27 +02:00
|
|
|
init_fpel_func(1, 0, 32, put, , avx);
|
|
|
|
init_fpel_func(0, 0, 64, put, , avx);
|
2014-12-16 05:13:52 +02:00
|
|
|
init_ipred(32, avx, v, VERT);
|
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 10:09:48 +03:00
|
|
|
}
|
|
|
|
|
2016-02-07 05:52:06 +02:00
|
|
|
if (EXTERNAL_AVX2_FAST(cpu_flags)) {
|
2015-09-16 15:12:27 +02:00
|
|
|
init_fpel_func(1, 1, 32, avg, _8, avx2);
|
|
|
|
init_fpel_func(0, 1, 64, avg, _8, avx2);
|
2014-09-23 03:55:13 +03:00
|
|
|
if (ARCH_X86_64) {
|
|
|
|
#if ARCH_X86_64 && HAVE_AVX2_EXTERNAL
|
2016-07-08 23:51:56 +02:00
|
|
|
dsp->itxfm_add[TX_16X16][DCT_DCT] = ff_vp9_idct_idct_16x16_add_avx2;
|
2016-11-08 21:43:59 +02:00
|
|
|
dsp->itxfm_add[TX_16X16][ADST_DCT] = ff_vp9_idct_iadst_16x16_add_avx2;
|
|
|
|
dsp->itxfm_add[TX_16X16][DCT_ADST] = ff_vp9_iadst_idct_16x16_add_avx2;
|
|
|
|
dsp->itxfm_add[TX_16X16][ADST_ADST] = ff_vp9_iadst_iadst_16x16_add_avx2;
|
|
|
|
dsp->itxfm_add[TX_32X32][ADST_ADST] =
|
|
|
|
dsp->itxfm_add[TX_32X32][ADST_DCT] =
|
|
|
|
dsp->itxfm_add[TX_32X32][DCT_ADST] =
|
2016-07-13 18:37:21 +02:00
|
|
|
dsp->itxfm_add[TX_32X32][DCT_DCT] = ff_vp9_idct_idct_32x32_add_avx2;
|
2015-09-16 22:07:46 +02:00
|
|
|
init_subpel3_32_64(0, put, 8, avx2);
|
|
|
|
init_subpel3_32_64(1, avg, 8, avx2);
|
2014-09-23 03:55:13 +03:00
|
|
|
#endif
|
|
|
|
}
|
2014-12-16 05:13:52 +02:00
|
|
|
init_dc_ipred(32, avx2);
|
|
|
|
init_ipred(32, avx2, h, HOR);
|
|
|
|
init_ipred(32, avx2, tm, TM_VP8);
|
x86/vp9: inital AVX2 intra_pred
tos3k-vp9-b10000.webm on a Core i5-4200U @1.6GHz
1219 decicycles in ff_vp9_ipred_dc_32x32_ssse3, 131070 runs, 2 skips
439 decicycles in ff_vp9_ipred_dc_32x32_avx2, 131070 runs, 2 skips
3570 decicycles in ff_vp9_ipred_dc_top_32x32_ssse3, 4096 runs, 0 skips
2494 decicycles in ff_vp9_ipred_dc_top_32x32_avx2, 4096 runs, 0 skips
1419 decicycles in ff_vp9_ipred_dc_left_32x32_ssse3, 16384 runs, 0 skips
717 decicycles in ff_vp9_ipred_dc_left_32x32_avx2, 16384 runs, 0 skips
2737 decicycles in ff_vp9_ipred_tm_32x32_avx, 1024 runs, 0 skips
2088 decicycles in ff_vp9_ipred_tm_32x32_avx2, 1024 runs, 0 skips
3090 decicycles in ff_vp9_ipred_v_32x32_avx, 512 runs, 0 skips
2226 decicycles in ff_vp9_ipred_v_32x32_avx2, 512 runs, 0 skips
1565 decicycles in ff_vp9_ipred_h_32x32_avx, 1024 runs, 0 skips
922 decicycles in ff_vp9_ipred_h_32x32_avx2, 1024 runs, 0 skips
Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-19 06:02:21 +03:00
|
|
|
}
|
|
|
|
|
2013-09-22 05:03:00 +03:00
|
|
|
#undef init_fpel
|
2013-09-22 04:24:03 +03:00
|
|
|
#undef init_subpel1
|
|
|
|
#undef init_subpel2
|
|
|
|
#undef init_subpel3
|
|
|
|
|
2016-10-08 16:18:33 +02:00
|
|
|
#endif /* HAVE_X86ASM */
|
2013-09-22 04:24:03 +03:00
|
|
|
}
|