You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
2.6KB

  1. /*
  2. * Copyright (c) 2013 Seppo Tomperi
  3. * Copyright (c) 2013 - 2014 Pierre-Edouard Lepere
  4. *
  5. * This file is part of Libav.
  6. *
  7. * Libav is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2.1 of the License, or (at your option) any later version.
  11. *
  12. * Libav is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with Libav; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. */
  21. #include "config.h"
  22. #include "libavutil/cpu.h"
  23. #include "libavutil/x86/cpu.h"
  24. #include "libavcodec/hevcdsp.h"
  25. #define LFC_FUNC(DIR, DEPTH, OPT) \
  26. void ff_hevc_ ## DIR ## _loop_filter_chroma_ ## DEPTH ## _ ## OPT(uint8_t *pix, ptrdiff_t stride, int *tc, uint8_t *no_p, uint8_t *no_q);
  27. #define LFL_FUNC(DIR, DEPTH, OPT) \
  28. void ff_hevc_ ## DIR ## _loop_filter_luma_ ## DEPTH ## _ ## OPT(uint8_t *pix, ptrdiff_t stride, int beta, int *tc, uint8_t *no_p, uint8_t *no_q);
  29. #define LFC_FUNCS(type, depth) \
  30. LFC_FUNC(h, depth, sse2) \
  31. LFC_FUNC(v, depth, sse2)
  32. #define LFL_FUNCS(type, depth) \
  33. LFL_FUNC(h, depth, ssse3) \
  34. LFL_FUNC(v, depth, ssse3)
  35. LFC_FUNCS(uint8_t, 8)
  36. LFC_FUNCS(uint8_t, 10)
  37. LFL_FUNCS(uint8_t, 8)
  38. LFL_FUNCS(uint8_t, 10)
  39. void ff_hevc_dsp_init_x86(HEVCDSPContext *c, const int bit_depth)
  40. {
  41. int cpu_flags = av_get_cpu_flags();
  42. if (bit_depth == 8) {
  43. if (EXTERNAL_SSE2(cpu_flags)) {
  44. c->hevc_v_loop_filter_chroma = ff_hevc_v_loop_filter_chroma_8_sse2;
  45. c->hevc_h_loop_filter_chroma = ff_hevc_h_loop_filter_chroma_8_sse2;
  46. }
  47. if (EXTERNAL_SSSE3(cpu_flags) && ARCH_X86_64) {
  48. c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_8_ssse3;
  49. c->hevc_h_loop_filter_luma = ff_hevc_h_loop_filter_luma_8_ssse3;
  50. }
  51. } else if (bit_depth == 10) {
  52. if (EXTERNAL_SSE2(cpu_flags)) {
  53. c->hevc_v_loop_filter_chroma = ff_hevc_v_loop_filter_chroma_10_sse2;
  54. c->hevc_h_loop_filter_chroma = ff_hevc_h_loop_filter_chroma_10_sse2;
  55. }
  56. if (EXTERNAL_SSSE3(cpu_flags) && ARCH_X86_64) {
  57. c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_10_ssse3;
  58. c->hevc_h_loop_filter_luma = ff_hevc_h_loop_filter_luma_10_ssse3;
  59. }
  60. }
  61. }