| 1 | /* |
| 2 | * VP9 SIMD optimizations |
| 3 | * |
| 4 | * Copyright (c) 2013 Ronald S. Bultje <rsbultje gmail com> |
| 5 | * |
| 6 | * This file is part of FFmpeg. |
| 7 | * |
| 8 | * FFmpeg is free software; you can redistribute it and/or |
| 9 | * modify it under the terms of the GNU Lesser General Public |
| 10 | * License as published by the Free Software Foundation; either |
| 11 | * version 2.1 of the License, or (at your option) any later version. |
| 12 | * |
| 13 | * FFmpeg is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 | * Lesser General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU Lesser General Public |
| 19 | * License along with FFmpeg; if not, write to the Free Software |
| 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 21 | */ |
| 22 | |
| 23 | #include "libavutil/attributes.h" |
| 24 | #include "libavutil/cpu.h" |
| 25 | #include "libavutil/mem.h" |
| 26 | #include "libavutil/x86/asm.h" |
| 27 | #include "libavutil/x86/cpu.h" |
| 28 | #include "libavcodec/vp9dsp.h" |
| 29 | |
| 30 | #if HAVE_YASM |
| 31 | |
| 32 | #define fpel_func(avg, sz, opt) \ |
| 33 | void ff_vp9_##avg##sz##_##opt(uint8_t *dst, ptrdiff_t dst_stride, \ |
| 34 | const uint8_t *src, ptrdiff_t src_stride, \ |
| 35 | int h, int mx, int my) |
| 36 | fpel_func(put, 4, mmx); |
| 37 | fpel_func(put, 8, mmx); |
| 38 | fpel_func(put, 16, sse); |
| 39 | fpel_func(put, 32, sse); |
| 40 | fpel_func(put, 64, sse); |
| 41 | fpel_func(avg, 4, mmxext); |
| 42 | fpel_func(avg, 8, mmxext); |
| 43 | fpel_func(avg, 16, sse2); |
| 44 | fpel_func(avg, 32, sse2); |
| 45 | fpel_func(avg, 64, sse2); |
| 46 | fpel_func(put, 32, avx); |
| 47 | fpel_func(put, 64, avx); |
| 48 | fpel_func(avg, 32, avx2); |
| 49 | fpel_func(avg, 64, avx2); |
| 50 | #undef fpel_func |
| 51 | |
| 52 | #define mc_func(avg, sz, dir, opt) \ |
| 53 | void ff_vp9_##avg##_8tap_1d_##dir##_##sz##_##opt(uint8_t *dst, ptrdiff_t dst_stride, \ |
| 54 | const uint8_t *src, ptrdiff_t src_stride, \ |
| 55 | int h, const int8_t (*filter)[32]) |
| 56 | #define mc_funcs(sz, opt) \ |
| 57 | mc_func(put, sz, h, opt); \ |
| 58 | mc_func(avg, sz, h, opt); \ |
| 59 | mc_func(put, sz, v, opt); \ |
| 60 | mc_func(avg, sz, v, opt) |
| 61 | |
| 62 | mc_funcs(4, ssse3); |
| 63 | mc_funcs(8, ssse3); |
| 64 | #if ARCH_X86_64 |
| 65 | mc_funcs(16, ssse3); |
| 66 | mc_funcs(32, avx2); |
| 67 | #endif |
| 68 | |
| 69 | #undef mc_funcs |
| 70 | #undef mc_func |
| 71 | |
| 72 | #define mc_rep_func(avg, sz, hsz, dir, opt) \ |
| 73 | static av_always_inline void \ |
| 74 | ff_vp9_##avg##_8tap_1d_##dir##_##sz##_##opt(uint8_t *dst, ptrdiff_t dst_stride, \ |
| 75 | const uint8_t *src, ptrdiff_t src_stride, \ |
| 76 | int h, const int8_t (*filter)[32]) \ |
| 77 | { \ |
| 78 | ff_vp9_##avg##_8tap_1d_##dir##_##hsz##_##opt(dst, dst_stride, src, \ |
| 79 | src_stride, h, filter); \ |
| 80 | ff_vp9_##avg##_8tap_1d_##dir##_##hsz##_##opt(dst + hsz, dst_stride, src + hsz, \ |
| 81 | src_stride, h, filter); \ |
| 82 | } |
| 83 | |
| 84 | #define mc_rep_funcs(sz, hsz, opt) \ |
| 85 | mc_rep_func(put, sz, hsz, h, opt); \ |
| 86 | mc_rep_func(avg, sz, hsz, h, opt); \ |
| 87 | mc_rep_func(put, sz, hsz, v, opt); \ |
| 88 | mc_rep_func(avg, sz, hsz, v, opt) |
| 89 | |
| 90 | #if ARCH_X86_32 |
| 91 | mc_rep_funcs(16, 8, ssse3); |
| 92 | #endif |
| 93 | mc_rep_funcs(32, 16, ssse3); |
| 94 | mc_rep_funcs(64, 32, ssse3); |
| 95 | #if ARCH_X86_64 && HAVE_AVX2_EXTERNAL |
| 96 | mc_rep_funcs(64, 32, avx2); |
| 97 | #endif |
| 98 | |
| 99 | #undef mc_rep_funcs |
| 100 | #undef mc_rep_func |
| 101 | |
| 102 | extern const int8_t ff_filters_ssse3[3][15][4][32]; |
| 103 | |
| 104 | #define filter_8tap_2d_fn(op, sz, f, fname, align, opt) \ |
| 105 | static void op##_8tap_##fname##_##sz##hv_##opt(uint8_t *dst, ptrdiff_t dst_stride, \ |
| 106 | const uint8_t *src, ptrdiff_t src_stride, \ |
| 107 | int h, int mx, int my) \ |
| 108 | { \ |
| 109 | LOCAL_ALIGNED_##align(uint8_t, temp, [71 * 64]); \ |
| 110 | ff_vp9_put_8tap_1d_h_##sz##_##opt(temp, 64, src - 3 * src_stride, src_stride, \ |
| 111 | h + 7, ff_filters_ssse3[f][mx - 1]); \ |
| 112 | ff_vp9_##op##_8tap_1d_v_##sz##_##opt(dst, dst_stride, temp + 3 * 64, 64, \ |
| 113 | h, ff_filters_ssse3[f][my - 1]); \ |
| 114 | } |
| 115 | |
| 116 | #define filters_8tap_2d_fn(op, sz, align, opt) \ |
| 117 | filter_8tap_2d_fn(op, sz, FILTER_8TAP_REGULAR, regular, align, opt) \ |
| 118 | filter_8tap_2d_fn(op, sz, FILTER_8TAP_SHARP, sharp, align, opt) \ |
| 119 | filter_8tap_2d_fn(op, sz, FILTER_8TAP_SMOOTH, smooth, align, opt) |
| 120 | |
| 121 | #define filters_8tap_2d_fn2(op, align, opt) \ |
| 122 | filters_8tap_2d_fn(op, 64, align, opt) \ |
| 123 | filters_8tap_2d_fn(op, 32, align, opt) \ |
| 124 | filters_8tap_2d_fn(op, 16, align, opt) \ |
| 125 | filters_8tap_2d_fn(op, 8, align, opt) \ |
| 126 | filters_8tap_2d_fn(op, 4, align, opt) |
| 127 | |
| 128 | filters_8tap_2d_fn2(put, 16, ssse3) |
| 129 | filters_8tap_2d_fn2(avg, 16, ssse3) |
| 130 | #if ARCH_X86_64 && HAVE_AVX2_EXTERNAL |
| 131 | filters_8tap_2d_fn(put, 64, 32, avx2) |
| 132 | filters_8tap_2d_fn(put, 32, 32, avx2) |
| 133 | filters_8tap_2d_fn(avg, 64, 32, avx2) |
| 134 | filters_8tap_2d_fn(avg, 32, 32, avx2) |
| 135 | #endif |
| 136 | |
| 137 | #undef filters_8tap_2d_fn2 |
| 138 | #undef filters_8tap_2d_fn |
| 139 | #undef filter_8tap_2d_fn |
| 140 | |
| 141 | #define filter_8tap_1d_fn(op, sz, f, fname, dir, dvar, opt) \ |
| 142 | static void op##_8tap_##fname##_##sz##dir##_##opt(uint8_t *dst, ptrdiff_t dst_stride, \ |
| 143 | const uint8_t *src, ptrdiff_t src_stride, \ |
| 144 | int h, int mx, int my) \ |
| 145 | { \ |
| 146 | ff_vp9_##op##_8tap_1d_##dir##_##sz##_##opt(dst, dst_stride, src, src_stride, \ |
| 147 | h, ff_filters_ssse3[f][dvar - 1]); \ |
| 148 | } |
| 149 | |
| 150 | #define filters_8tap_1d_fn(op, sz, dir, dvar, opt) \ |
| 151 | filter_8tap_1d_fn(op, sz, FILTER_8TAP_REGULAR, regular, dir, dvar, opt) \ |
| 152 | filter_8tap_1d_fn(op, sz, FILTER_8TAP_SHARP, sharp, dir, dvar, opt) \ |
| 153 | filter_8tap_1d_fn(op, sz, FILTER_8TAP_SMOOTH, smooth, dir, dvar, opt) |
| 154 | |
| 155 | #define filters_8tap_1d_fn2(op, sz, opt) \ |
| 156 | filters_8tap_1d_fn(op, sz, h, mx, opt) \ |
| 157 | filters_8tap_1d_fn(op, sz, v, my, opt) |
| 158 | |
| 159 | #define filters_8tap_1d_fn3(op, opt) \ |
| 160 | filters_8tap_1d_fn2(op, 64, opt) \ |
| 161 | filters_8tap_1d_fn2(op, 32, opt) \ |
| 162 | filters_8tap_1d_fn2(op, 16, opt) \ |
| 163 | filters_8tap_1d_fn2(op, 8, opt) \ |
| 164 | filters_8tap_1d_fn2(op, 4, opt) |
| 165 | |
| 166 | filters_8tap_1d_fn3(put, ssse3) |
| 167 | filters_8tap_1d_fn3(avg, ssse3) |
| 168 | #if ARCH_X86_64 && HAVE_AVX2_EXTERNAL |
| 169 | filters_8tap_1d_fn2(put, 64, avx2) |
| 170 | filters_8tap_1d_fn2(put, 32, avx2) |
| 171 | filters_8tap_1d_fn2(avg, 64, avx2) |
| 172 | filters_8tap_1d_fn2(avg, 32, avx2) |
| 173 | #endif |
| 174 | |
| 175 | #undef filters_8tap_1d_fn |
| 176 | #undef filters_8tap_1d_fn2 |
| 177 | #undef filters_8tap_1d_fn3 |
| 178 | #undef filter_8tap_1d_fn |
| 179 | |
| 180 | #define itxfm_func(typea, typeb, size, opt) \ |
| 181 | void ff_vp9_##typea##_##typeb##_##size##x##size##_add_##opt(uint8_t *dst, ptrdiff_t stride, \ |
| 182 | int16_t *block, int eob) |
| 183 | #define itxfm_funcs(size, opt) \ |
| 184 | itxfm_func(idct, idct, size, opt); \ |
| 185 | itxfm_func(iadst, idct, size, opt); \ |
| 186 | itxfm_func(idct, iadst, size, opt); \ |
| 187 | itxfm_func(iadst, iadst, size, opt) |
| 188 | |
| 189 | itxfm_funcs(4, ssse3); |
| 190 | itxfm_funcs(8, ssse3); |
| 191 | itxfm_funcs(8, avx); |
| 192 | itxfm_funcs(16, ssse3); |
| 193 | itxfm_funcs(16, avx); |
| 194 | itxfm_func(idct, idct, 32, ssse3); |
| 195 | itxfm_func(idct, idct, 32, avx); |
| 196 | itxfm_func(iwht, iwht, 4, mmx); |
| 197 | |
| 198 | #undef itxfm_func |
| 199 | #undef itxfm_funcs |
| 200 | |
| 201 | #define lpf_funcs(size1, size2, opt) \ |
| 202 | void ff_vp9_loop_filter_v_##size1##_##size2##_##opt(uint8_t *dst, ptrdiff_t stride, \ |
| 203 | int E, int I, int H); \ |
| 204 | void ff_vp9_loop_filter_h_##size1##_##size2##_##opt(uint8_t *dst, ptrdiff_t stride, \ |
| 205 | int E, int I, int H) |
| 206 | |
| 207 | lpf_funcs(16, 16, sse2); |
| 208 | lpf_funcs(16, 16, ssse3); |
| 209 | lpf_funcs(16, 16, avx); |
| 210 | lpf_funcs(44, 16, sse2); |
| 211 | lpf_funcs(44, 16, ssse3); |
| 212 | lpf_funcs(44, 16, avx); |
| 213 | lpf_funcs(84, 16, sse2); |
| 214 | lpf_funcs(84, 16, ssse3); |
| 215 | lpf_funcs(84, 16, avx); |
| 216 | lpf_funcs(48, 16, sse2); |
| 217 | lpf_funcs(48, 16, ssse3); |
| 218 | lpf_funcs(48, 16, avx); |
| 219 | lpf_funcs(88, 16, sse2); |
| 220 | lpf_funcs(88, 16, ssse3); |
| 221 | lpf_funcs(88, 16, avx); |
| 222 | |
| 223 | #undef lpf_funcs |
| 224 | |
| 225 | #define ipred_func(size, type, opt) \ |
| 226 | void ff_vp9_ipred_##type##_##size##x##size##_##opt(uint8_t *dst, ptrdiff_t stride, \ |
| 227 | const uint8_t *l, const uint8_t *a) |
| 228 | |
| 229 | #define ipred_funcs(type, opt) \ |
| 230 | ipred_func(4, type, opt); \ |
| 231 | ipred_func(8, type, opt); \ |
| 232 | ipred_func(16, type, opt); \ |
| 233 | ipred_func(32, type, opt) |
| 234 | |
| 235 | ipred_funcs(dc, ssse3); |
| 236 | ipred_funcs(dc_left, ssse3); |
| 237 | ipred_funcs(dc_top, ssse3); |
| 238 | |
| 239 | #undef ipred_funcs |
| 240 | |
| 241 | ipred_func(8, v, mmx); |
| 242 | ipred_func(16, v, sse2); |
| 243 | ipred_func(32, v, sse2); |
| 244 | |
| 245 | #define ipred_func_set(size, type, opt1, opt2) \ |
| 246 | ipred_func(size, type, opt1); \ |
| 247 | ipred_func(size, type, opt2) |
| 248 | |
| 249 | #define ipred_funcs(type, opt1, opt2) \ |
| 250 | ipred_func(4, type, opt1); \ |
| 251 | ipred_func_set(8, type, opt1, opt2); \ |
| 252 | ipred_func_set(16, type, opt1, opt2); \ |
| 253 | ipred_func_set(32, type, opt1, opt2) |
| 254 | |
| 255 | ipred_funcs(h, ssse3, avx); |
| 256 | ipred_funcs(tm, ssse3, avx); |
| 257 | ipred_funcs(dl, ssse3, avx); |
| 258 | ipred_funcs(dr, ssse3, avx); |
| 259 | ipred_funcs(hu, ssse3, avx); |
| 260 | ipred_funcs(hd, ssse3, avx); |
| 261 | ipred_funcs(vl, ssse3, avx); |
| 262 | ipred_funcs(vr, ssse3, avx); |
| 263 | |
| 264 | ipred_func(32, dc, avx2); |
| 265 | ipred_func(32, dc_left, avx2); |
| 266 | ipred_func(32, dc_top, avx2); |
| 267 | ipred_func(32, v, avx2); |
| 268 | ipred_func(32, h, avx2); |
| 269 | ipred_func(32, tm, avx2); |
| 270 | |
| 271 | #undef ipred_funcs |
| 272 | #undef ipred_func_set |
| 273 | #undef ipred_func |
| 274 | |
| 275 | #endif /* HAVE_YASM */ |
| 276 | |
| 277 | av_cold void ff_vp9dsp_init_x86(VP9DSPContext *dsp) |
| 278 | { |
| 279 | #if HAVE_YASM |
| 280 | int cpu_flags = av_get_cpu_flags(); |
| 281 | |
| 282 | #define init_fpel(idx1, idx2, sz, type, opt) \ |
| 283 | dsp->mc[idx1][FILTER_8TAP_SMOOTH ][idx2][0][0] = \ |
| 284 | dsp->mc[idx1][FILTER_8TAP_REGULAR][idx2][0][0] = \ |
| 285 | dsp->mc[idx1][FILTER_8TAP_SHARP ][idx2][0][0] = \ |
| 286 | dsp->mc[idx1][FILTER_BILINEAR ][idx2][0][0] = ff_vp9_##type##sz##_##opt |
| 287 | |
| 288 | #define init_subpel1(idx1, idx2, idxh, idxv, sz, dir, type, opt) \ |
| 289 | dsp->mc[idx1][FILTER_8TAP_SMOOTH ][idx2][idxh][idxv] = type##_8tap_smooth_##sz##dir##_##opt; \ |
| 290 | dsp->mc[idx1][FILTER_8TAP_REGULAR][idx2][idxh][idxv] = type##_8tap_regular_##sz##dir##_##opt; \ |
| 291 | dsp->mc[idx1][FILTER_8TAP_SHARP ][idx2][idxh][idxv] = type##_8tap_sharp_##sz##dir##_##opt |
| 292 | |
| 293 | #define init_subpel2_32_64(idx, idxh, idxv, dir, type, opt) \ |
| 294 | init_subpel1(0, idx, idxh, idxv, 64, dir, type, opt); \ |
| 295 | init_subpel1(1, idx, idxh, idxv, 32, dir, type, opt) |
| 296 | |
| 297 | #define init_subpel2(idx, idxh, idxv, dir, type, opt) \ |
| 298 | init_subpel2_32_64(idx, idxh, idxv, dir, type, opt); \ |
| 299 | init_subpel1(2, idx, idxh, idxv, 16, dir, type, opt); \ |
| 300 | init_subpel1(3, idx, idxh, idxv, 8, dir, type, opt); \ |
| 301 | init_subpel1(4, idx, idxh, idxv, 4, dir, type, opt) |
| 302 | |
| 303 | #define init_subpel3(idx, type, opt) \ |
| 304 | init_subpel2(idx, 1, 1, hv, type, opt); \ |
| 305 | init_subpel2(idx, 0, 1, v, type, opt); \ |
| 306 | init_subpel2(idx, 1, 0, h, type, opt) |
| 307 | |
| 308 | #define init_lpf(opt) do { \ |
| 309 | if (ARCH_X86_64) { \ |
| 310 | dsp->loop_filter_16[0] = ff_vp9_loop_filter_h_16_16_##opt; \ |
| 311 | dsp->loop_filter_16[1] = ff_vp9_loop_filter_v_16_16_##opt; \ |
| 312 | dsp->loop_filter_mix2[0][0][0] = ff_vp9_loop_filter_h_44_16_##opt; \ |
| 313 | dsp->loop_filter_mix2[0][0][1] = ff_vp9_loop_filter_v_44_16_##opt; \ |
| 314 | dsp->loop_filter_mix2[0][1][0] = ff_vp9_loop_filter_h_48_16_##opt; \ |
| 315 | dsp->loop_filter_mix2[0][1][1] = ff_vp9_loop_filter_v_48_16_##opt; \ |
| 316 | dsp->loop_filter_mix2[1][0][0] = ff_vp9_loop_filter_h_84_16_##opt; \ |
| 317 | dsp->loop_filter_mix2[1][0][1] = ff_vp9_loop_filter_v_84_16_##opt; \ |
| 318 | dsp->loop_filter_mix2[1][1][0] = ff_vp9_loop_filter_h_88_16_##opt; \ |
| 319 | dsp->loop_filter_mix2[1][1][1] = ff_vp9_loop_filter_v_88_16_##opt; \ |
| 320 | } \ |
| 321 | } while (0) |
| 322 | |
| 323 | #define init_ipred(tx, sz, opt) do { \ |
| 324 | dsp->intra_pred[tx][HOR_PRED] = ff_vp9_ipred_h_##sz##x##sz##_##opt; \ |
| 325 | dsp->intra_pred[tx][DIAG_DOWN_LEFT_PRED] = ff_vp9_ipred_dl_##sz##x##sz##_##opt; \ |
| 326 | dsp->intra_pred[tx][DIAG_DOWN_RIGHT_PRED] = ff_vp9_ipred_dr_##sz##x##sz##_##opt; \ |
| 327 | dsp->intra_pred[tx][HOR_DOWN_PRED] = ff_vp9_ipred_hd_##sz##x##sz##_##opt; \ |
| 328 | dsp->intra_pred[tx][VERT_LEFT_PRED] = ff_vp9_ipred_vl_##sz##x##sz##_##opt; \ |
| 329 | dsp->intra_pred[tx][HOR_UP_PRED] = ff_vp9_ipred_hu_##sz##x##sz##_##opt; \ |
| 330 | if (ARCH_X86_64 || tx != TX_32X32) { \ |
| 331 | dsp->intra_pred[tx][VERT_RIGHT_PRED] = ff_vp9_ipred_vr_##sz##x##sz##_##opt; \ |
| 332 | dsp->intra_pred[tx][TM_VP8_PRED] = ff_vp9_ipred_tm_##sz##x##sz##_##opt; \ |
| 333 | } \ |
| 334 | } while (0) |
| 335 | #define init_dc_ipred(tx, sz, opt) do { \ |
| 336 | init_ipred(tx, sz, opt); \ |
| 337 | dsp->intra_pred[tx][DC_PRED] = ff_vp9_ipred_dc_##sz##x##sz##_##opt; \ |
| 338 | dsp->intra_pred[tx][LEFT_DC_PRED] = ff_vp9_ipred_dc_left_##sz##x##sz##_##opt; \ |
| 339 | dsp->intra_pred[tx][TOP_DC_PRED] = ff_vp9_ipred_dc_top_##sz##x##sz##_##opt; \ |
| 340 | } while (0) |
| 341 | |
| 342 | if (EXTERNAL_MMX(cpu_flags)) { |
| 343 | init_fpel(4, 0, 4, put, mmx); |
| 344 | init_fpel(3, 0, 8, put, mmx); |
| 345 | dsp->itxfm_add[4 /* lossless */][DCT_DCT] = |
| 346 | dsp->itxfm_add[4 /* lossless */][ADST_DCT] = |
| 347 | dsp->itxfm_add[4 /* lossless */][DCT_ADST] = |
| 348 | dsp->itxfm_add[4 /* lossless */][ADST_ADST] = ff_vp9_iwht_iwht_4x4_add_mmx; |
| 349 | dsp->intra_pred[TX_8X8][VERT_PRED] = ff_vp9_ipred_v_8x8_mmx; |
| 350 | } |
| 351 | |
| 352 | if (EXTERNAL_MMXEXT(cpu_flags)) { |
| 353 | init_fpel(4, 1, 4, avg, mmxext); |
| 354 | init_fpel(3, 1, 8, avg, mmxext); |
| 355 | } |
| 356 | |
| 357 | if (EXTERNAL_SSE(cpu_flags)) { |
| 358 | init_fpel(2, 0, 16, put, sse); |
| 359 | init_fpel(1, 0, 32, put, sse); |
| 360 | init_fpel(0, 0, 64, put, sse); |
| 361 | } |
| 362 | |
| 363 | if (EXTERNAL_SSE2(cpu_flags)) { |
| 364 | init_fpel(2, 1, 16, avg, sse2); |
| 365 | init_fpel(1, 1, 32, avg, sse2); |
| 366 | init_fpel(0, 1, 64, avg, sse2); |
| 367 | init_lpf(sse2); |
| 368 | dsp->intra_pred[TX_16X16][VERT_PRED] = ff_vp9_ipred_v_16x16_sse2; |
| 369 | dsp->intra_pred[TX_32X32][VERT_PRED] = ff_vp9_ipred_v_32x32_sse2; |
| 370 | } |
| 371 | |
| 372 | if (EXTERNAL_SSSE3(cpu_flags)) { |
| 373 | init_subpel3(0, put, ssse3); |
| 374 | init_subpel3(1, avg, ssse3); |
| 375 | dsp->itxfm_add[TX_4X4][DCT_DCT] = ff_vp9_idct_idct_4x4_add_ssse3; |
| 376 | dsp->itxfm_add[TX_4X4][ADST_DCT] = ff_vp9_idct_iadst_4x4_add_ssse3; |
| 377 | dsp->itxfm_add[TX_4X4][DCT_ADST] = ff_vp9_iadst_idct_4x4_add_ssse3; |
| 378 | dsp->itxfm_add[TX_4X4][ADST_ADST] = ff_vp9_iadst_iadst_4x4_add_ssse3; |
| 379 | if (ARCH_X86_64) { |
| 380 | dsp->itxfm_add[TX_8X8][DCT_DCT] = ff_vp9_idct_idct_8x8_add_ssse3; |
| 381 | dsp->itxfm_add[TX_8X8][ADST_DCT] = ff_vp9_idct_iadst_8x8_add_ssse3; |
| 382 | dsp->itxfm_add[TX_8X8][DCT_ADST] = ff_vp9_iadst_idct_8x8_add_ssse3; |
| 383 | dsp->itxfm_add[TX_8X8][ADST_ADST] = ff_vp9_iadst_iadst_8x8_add_ssse3; |
| 384 | dsp->itxfm_add[TX_16X16][DCT_DCT] = ff_vp9_idct_idct_16x16_add_ssse3; |
| 385 | dsp->itxfm_add[TX_16X16][ADST_DCT] = ff_vp9_idct_iadst_16x16_add_ssse3; |
| 386 | dsp->itxfm_add[TX_16X16][DCT_ADST] = ff_vp9_iadst_idct_16x16_add_ssse3; |
| 387 | dsp->itxfm_add[TX_16X16][ADST_ADST] = ff_vp9_iadst_iadst_16x16_add_ssse3; |
| 388 | dsp->itxfm_add[TX_32X32][ADST_ADST] = |
| 389 | dsp->itxfm_add[TX_32X32][ADST_DCT] = |
| 390 | dsp->itxfm_add[TX_32X32][DCT_ADST] = |
| 391 | dsp->itxfm_add[TX_32X32][DCT_DCT] = ff_vp9_idct_idct_32x32_add_ssse3; |
| 392 | } |
| 393 | init_lpf(ssse3); |
| 394 | init_dc_ipred(TX_4X4, 4, ssse3); |
| 395 | init_dc_ipred(TX_8X8, 8, ssse3); |
| 396 | init_dc_ipred(TX_16X16, 16, ssse3); |
| 397 | init_dc_ipred(TX_32X32, 32, ssse3); |
| 398 | } |
| 399 | |
| 400 | if (EXTERNAL_AVX(cpu_flags)) { |
| 401 | if (ARCH_X86_64) { |
| 402 | dsp->itxfm_add[TX_8X8][DCT_DCT] = ff_vp9_idct_idct_8x8_add_avx; |
| 403 | dsp->itxfm_add[TX_8X8][ADST_DCT] = ff_vp9_idct_iadst_8x8_add_avx; |
| 404 | dsp->itxfm_add[TX_8X8][DCT_ADST] = ff_vp9_iadst_idct_8x8_add_avx; |
| 405 | dsp->itxfm_add[TX_8X8][ADST_ADST] = ff_vp9_iadst_iadst_8x8_add_avx; |
| 406 | dsp->itxfm_add[TX_16X16][DCT_DCT] = ff_vp9_idct_idct_16x16_add_avx; |
| 407 | dsp->itxfm_add[TX_16X16][ADST_DCT] = ff_vp9_idct_iadst_16x16_add_avx; |
| 408 | dsp->itxfm_add[TX_16X16][DCT_ADST] = ff_vp9_iadst_idct_16x16_add_avx; |
| 409 | dsp->itxfm_add[TX_16X16][ADST_ADST] = ff_vp9_iadst_iadst_16x16_add_avx; |
| 410 | dsp->itxfm_add[TX_32X32][ADST_ADST] = |
| 411 | dsp->itxfm_add[TX_32X32][ADST_DCT] = |
| 412 | dsp->itxfm_add[TX_32X32][DCT_ADST] = |
| 413 | dsp->itxfm_add[TX_32X32][DCT_DCT] = ff_vp9_idct_idct_32x32_add_avx; |
| 414 | } |
| 415 | init_fpel(1, 0, 32, put, avx); |
| 416 | init_fpel(0, 0, 64, put, avx); |
| 417 | init_lpf(avx); |
| 418 | init_ipred(TX_8X8, 8, avx); |
| 419 | init_ipred(TX_16X16, 16, avx); |
| 420 | init_ipred(TX_32X32, 32, avx); |
| 421 | } |
| 422 | |
| 423 | if (EXTERNAL_AVX2(cpu_flags)) { |
| 424 | init_fpel(1, 1, 32, avg, avx2); |
| 425 | init_fpel(0, 1, 64, avg, avx2); |
| 426 | if (ARCH_X86_64) { |
| 427 | #if ARCH_X86_64 && HAVE_AVX2_EXTERNAL |
| 428 | init_subpel2_32_64(0, 1, 1, hv, put, avx2); |
| 429 | init_subpel2_32_64(0, 0, 1, v, put, avx2); |
| 430 | init_subpel2_32_64(0, 1, 0, h, put, avx2); |
| 431 | init_subpel2_32_64(1, 1, 1, hv, avg, avx2); |
| 432 | init_subpel2_32_64(1, 0, 1, v, avg, avx2); |
| 433 | init_subpel2_32_64(1, 1, 0, h, avg, avx2); |
| 434 | #endif |
| 435 | } |
| 436 | dsp->intra_pred[TX_32X32][DC_PRED] = ff_vp9_ipred_dc_32x32_avx2; |
| 437 | dsp->intra_pred[TX_32X32][LEFT_DC_PRED] = ff_vp9_ipred_dc_left_32x32_avx2; |
| 438 | dsp->intra_pred[TX_32X32][TOP_DC_PRED] = ff_vp9_ipred_dc_top_32x32_avx2; |
| 439 | dsp->intra_pred[TX_32X32][VERT_PRED] = ff_vp9_ipred_v_32x32_avx2; |
| 440 | dsp->intra_pred[TX_32X32][HOR_PRED] = ff_vp9_ipred_h_32x32_avx2; |
| 441 | dsp->intra_pred[TX_32X32][TM_VP8_PRED] = ff_vp9_ipred_tm_32x32_avx2; |
| 442 | } |
| 443 | |
| 444 | #undef init_fpel |
| 445 | #undef init_subpel1 |
| 446 | #undef init_subpel2 |
| 447 | #undef init_subpel3 |
| 448 | |
| 449 | #endif /* HAVE_YASM */ |
| 450 | } |