diff options
author | Ronald S. Bultje <rsbultje@gmail.com> | 2015-09-16 16:07:46 -0400 |
---|---|---|
committer | Ronald S. Bultje <rsbultje@gmail.com> | 2015-09-16 21:11:34 -0400 |
commit | 344d519040f03515bb915bf418f3ab9e38ada33b (patch) | |
tree | 5ec8ab2d2d64ff4cd16c1f55cade61ab9f0be885 /libavcodec/x86/vp9dsp_init.c | |
parent | 77f359670fdbfcd7ac2a464b3bc000b1ceb54763 (diff) | |
download | ffmpeg-344d519040f03515bb915bf418f3ab9e38ada33b.tar.gz |
vp9: add subpel MC SIMD for 10/12bpp.
Diffstat (limited to 'libavcodec/x86/vp9dsp_init.c')
-rw-r--r-- | libavcodec/x86/vp9dsp_init.c | 197 |
1 files changed, 43 insertions, 154 deletions
diff --git a/libavcodec/x86/vp9dsp_init.c b/libavcodec/x86/vp9dsp_init.c index 244f5f0f40..cd4af992d0 100644 --- a/libavcodec/x86/vp9dsp_init.c +++ b/libavcodec/x86/vp9dsp_init.c @@ -44,144 +44,52 @@ decl_fpel_func(put, 64, , avx); decl_fpel_func(avg, 32, _8, avx2); decl_fpel_func(avg, 64, _8, avx2); -#define mc_func(avg, sz, dir, opt, type, f_sz) \ -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 type (*filter)[f_sz]) -#define mc_funcs(sz, opt, type, fsz) \ -mc_func(put, sz, h, opt, type, fsz); \ -mc_func(avg, sz, h, opt, type, fsz); \ -mc_func(put, sz, v, opt, type, fsz); \ -mc_func(avg, sz, v, opt, type, fsz) - -mc_funcs(4, mmxext, int16_t, 8); -mc_funcs(8, sse2, int16_t, 8); -mc_funcs(4, ssse3, int8_t, 32); -mc_funcs(8, ssse3, int8_t, 32); +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); #if ARCH_X86_64 -mc_funcs(16, ssse3, int8_t, 32); -mc_funcs(32, avx2, int8_t, 32); +decl_mc_funcs(16, ssse3, int8_t, 32, 8); +decl_mc_funcs(32, avx2, int8_t, 32, 8); #endif -#undef mc_funcs -#undef mc_func - -#define mc_rep_func(avg, sz, hsz, dir, opt, type, f_sz) \ -static av_always_inline 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 type (*filter)[f_sz]) \ -{ \ - 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); \ -} - -#define mc_rep_funcs(sz, hsz, opt, type, fsz) \ -mc_rep_func(put, sz, hsz, h, opt, type, fsz); \ -mc_rep_func(avg, sz, hsz, h, opt, type, fsz); \ -mc_rep_func(put, sz, hsz, v, opt, type, fsz); \ -mc_rep_func(avg, sz, hsz, v, opt, type, fsz) - -mc_rep_funcs(16, 8, sse2, int16_t, 8); +mc_rep_funcs(16, 8, 8, sse2, int16_t, 8, 8); #if ARCH_X86_32 -mc_rep_funcs(16, 8, ssse3, int8_t, 32); +mc_rep_funcs(16, 8, 8, ssse3, int8_t, 32, 8); #endif -mc_rep_funcs(32, 16, sse2, int16_t, 8); -mc_rep_funcs(32, 16, ssse3, int8_t, 32); -mc_rep_funcs(64, 32, sse2, int16_t, 8); -mc_rep_funcs(64, 32, ssse3, int8_t, 32); +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); #if ARCH_X86_64 && HAVE_AVX2_EXTERNAL -mc_rep_funcs(64, 32, avx2, int8_t, 32); +mc_rep_funcs(64, 32, 32, avx2, int8_t, 32, 8); #endif -#undef mc_rep_funcs -#undef mc_rep_func - extern const int8_t ff_filters_ssse3[3][15][4][32]; extern const int16_t ff_filters_sse2[3][15][8][8]; -#define filter_8tap_2d_fn(op, sz, f, f_opt, fname, align, opt) \ -static void op##_8tap_##fname##_##sz##hv_##opt(uint8_t *dst, ptrdiff_t dst_stride, \ - const uint8_t *src, ptrdiff_t src_stride, \ - int h, int mx, int my) \ -{ \ - LOCAL_ALIGNED_##align(uint8_t, temp, [71 * 64]); \ - ff_vp9_put_8tap_1d_h_##sz##_##opt(temp, 64, src - 3 * src_stride, src_stride, \ - h + 7, ff_filters_##f_opt[f][mx - 1]); \ - ff_vp9_##op##_8tap_1d_v_##sz##_##opt(dst, dst_stride, temp + 3 * 64, 64, \ - h, ff_filters_##f_opt[f][my - 1]); \ -} - -#define filters_8tap_2d_fn(op, sz, align, opt, f_opt) \ -filter_8tap_2d_fn(op, sz, FILTER_8TAP_REGULAR, f_opt, regular, align, opt) \ -filter_8tap_2d_fn(op, sz, FILTER_8TAP_SHARP, f_opt, sharp, align, opt) \ -filter_8tap_2d_fn(op, sz, FILTER_8TAP_SMOOTH, f_opt, smooth, align, opt) - -#define filters_8tap_2d_fn2(op, align, opt4, opt8, f_opt) \ -filters_8tap_2d_fn(op, 64, align, opt8, f_opt) \ -filters_8tap_2d_fn(op, 32, align, opt8, f_opt) \ -filters_8tap_2d_fn(op, 16, align, opt8, f_opt) \ -filters_8tap_2d_fn(op, 8, align, opt8, f_opt) \ -filters_8tap_2d_fn(op, 4, align, opt4, f_opt) - -filters_8tap_2d_fn2(put, 16, mmxext, sse2, sse2) -filters_8tap_2d_fn2(avg, 16, mmxext, sse2, sse2) -filters_8tap_2d_fn2(put, 16, ssse3, ssse3, ssse3) -filters_8tap_2d_fn2(avg, 16, ssse3, ssse3, ssse3) +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) #if ARCH_X86_64 && HAVE_AVX2_EXTERNAL -filters_8tap_2d_fn(put, 64, 32, avx2, ssse3) -filters_8tap_2d_fn(put, 32, 32, avx2, ssse3) -filters_8tap_2d_fn(avg, 64, 32, avx2, ssse3) -filters_8tap_2d_fn(avg, 32, 32, avx2, ssse3) +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) #endif -#undef filters_8tap_2d_fn2 -#undef filters_8tap_2d_fn -#undef filter_8tap_2d_fn - -#define filter_8tap_1d_fn(op, sz, f, f_opt, fname, dir, dvar, opt) \ -static void op##_8tap_##fname##_##sz##dir##_##opt(uint8_t *dst, ptrdiff_t dst_stride, \ - const uint8_t *src, ptrdiff_t src_stride, \ - int h, int mx, int my) \ -{ \ - ff_vp9_##op##_8tap_1d_##dir##_##sz##_##opt(dst, dst_stride, src, src_stride, \ - h, ff_filters_##f_opt[f][dvar - 1]); \ -} - -#define filters_8tap_1d_fn(op, sz, dir, dvar, opt, f_opt) \ -filter_8tap_1d_fn(op, sz, FILTER_8TAP_REGULAR, f_opt, regular, dir, dvar, opt) \ -filter_8tap_1d_fn(op, sz, FILTER_8TAP_SHARP, f_opt, sharp, dir, dvar, opt) \ -filter_8tap_1d_fn(op, sz, FILTER_8TAP_SMOOTH, f_opt, smooth, dir, dvar, opt) - -#define filters_8tap_1d_fn2(op, sz, opt, f_opt) \ -filters_8tap_1d_fn(op, sz, h, mx, opt, f_opt) \ -filters_8tap_1d_fn(op, sz, v, my, opt, f_opt) - -#define filters_8tap_1d_fn3(op, opt4, opt8, f_opt) \ -filters_8tap_1d_fn2(op, 64, opt8, f_opt) \ -filters_8tap_1d_fn2(op, 32, opt8, f_opt) \ -filters_8tap_1d_fn2(op, 16, opt8, f_opt) \ -filters_8tap_1d_fn2(op, 8, opt8, f_opt) \ -filters_8tap_1d_fn2(op, 4, opt4, f_opt) - -filters_8tap_1d_fn3(put, mmxext, sse2, sse2) -filters_8tap_1d_fn3(avg, mmxext, sse2, sse2) -filters_8tap_1d_fn3(put, ssse3, ssse3, ssse3) -filters_8tap_1d_fn3(avg, ssse3, ssse3, ssse3) +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) #if ARCH_X86_64 && HAVE_AVX2_EXTERNAL -filters_8tap_1d_fn2(put, 64, avx2, ssse3) -filters_8tap_1d_fn2(put, 32, avx2, ssse3) -filters_8tap_1d_fn2(avg, 64, avx2, ssse3) -filters_8tap_1d_fn2(avg, 32, avx2, ssse3) +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) #endif -#undef filters_8tap_1d_fn -#undef filters_8tap_1d_fn2 -#undef filters_8tap_1d_fn3 -#undef filter_8tap_1d_fn - #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) @@ -306,36 +214,17 @@ av_cold void ff_vp9dsp_init_x86(VP9DSPContext *dsp, int bpp, int bitexact) { #if HAVE_YASM int cpu_flags; - if (bpp != 8) { - ff_vp9dsp_init_16bpp_x86(dsp, bpp); + + if (bpp == 10) { + ff_vp9dsp_init_10bpp_x86(dsp); + return; + } else if (bpp == 12) { + ff_vp9dsp_init_12bpp_x86(dsp); return; } cpu_flags = av_get_cpu_flags(); -#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(idx1, idx2, sz, type, opt) \ - init_subpel1(idx1, idx2, 1, 1, sz, hv, type, opt); \ - init_subpel1(idx1, idx2, 0, 1, sz, v, type, opt); \ - init_subpel1(idx1, idx2, 1, 0, sz, h, type, opt) - -#define init_subpel3_32_64(idx, type, opt) \ - init_subpel2(0, idx, 64, type, opt); \ - init_subpel2(1, idx, 32, type, opt) - -#define init_subpel3_8to64(idx, type, opt) \ - init_subpel3_32_64(idx, type, opt); \ - init_subpel2(2, idx, 16, type, opt); \ - init_subpel2(3, idx, 8, type, opt) - -#define init_subpel3(idx, type, opt) \ - init_subpel3_8to64(idx, type, opt); \ - init_subpel2(4, idx, 4, type, opt) - #define init_lpf(opt) do { \ 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; \ @@ -390,8 +279,8 @@ av_cold void ff_vp9dsp_init_x86(VP9DSPContext *dsp, int bpp, int bitexact) } if (EXTERNAL_MMXEXT(cpu_flags)) { - init_subpel2(4, 0, 4, put, mmxext); - init_subpel2(4, 1, 4, avg, mmxext); + init_subpel2(4, 0, 4, put, 8, mmxext); + init_subpel2(4, 1, 4, avg, 8, mmxext); init_fpel_func(4, 1, 4, avg, _8, mmxext); init_fpel_func(3, 1, 8, avg, _8, mmxext); dsp->itxfm_add[TX_4X4][DCT_DCT] = ff_vp9_idct_idct_4x4_add_mmxext; @@ -409,8 +298,8 @@ av_cold void ff_vp9dsp_init_x86(VP9DSPContext *dsp, int bpp, int bitexact) } if (EXTERNAL_SSE2(cpu_flags)) { - init_subpel3_8to64(0, put, sse2); - init_subpel3_8to64(1, avg, sse2); + init_subpel3_8to64(0, put, 8, sse2); + init_subpel3_8to64(1, avg, 8, sse2); 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); @@ -439,8 +328,8 @@ av_cold void ff_vp9dsp_init_x86(VP9DSPContext *dsp, int bpp, int bitexact) } if (EXTERNAL_SSSE3(cpu_flags)) { - init_subpel3(0, put, ssse3); - init_subpel3(1, avg, ssse3); + init_subpel3(0, put, 8, ssse3); + init_subpel3(1, avg, 8, ssse3); dsp->itxfm_add[TX_4X4][DCT_DCT] = ff_vp9_idct_idct_4x4_add_ssse3; 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; @@ -493,8 +382,8 @@ av_cold void ff_vp9dsp_init_x86(VP9DSPContext *dsp, int bpp, int bitexact) init_fpel_func(0, 1, 64, avg, _8, avx2); if (ARCH_X86_64) { #if ARCH_X86_64 && HAVE_AVX2_EXTERNAL - init_subpel3_32_64(0, put, avx2); - init_subpel3_32_64(1, avg, avx2); + init_subpel3_32_64(0, put, 8, avx2); + init_subpel3_32_64(1, avg, 8, avx2); #endif } init_dc_ipred(32, avx2); |