vf_bwdif_init.c 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * Copyright (C) 2016 Thomas Mundt <loudmax@yahoo.de>
  3. *
  4. * This file is part of FFmpeg.
  5. *
  6. * FFmpeg is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2.1 of the License, or (at your option) any later version.
  10. *
  11. * FFmpeg is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public
  17. * License along with FFmpeg; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  19. */
  20. #include "libavutil/attributes.h"
  21. #include "libavutil/cpu.h"
  22. #include "libavutil/mem.h"
  23. #include "libavutil/x86/asm.h"
  24. #include "libavutil/x86/cpu.h"
  25. #include "libavfilter/bwdif.h"
  26. void ff_bwdif_filter_line_mmxext(void *dst, void *prev, void *cur, void *next,
  27. int w, int prefs, int mrefs, int prefs2,
  28. int mrefs2, int prefs3, int mrefs3, int prefs4,
  29. int mrefs4, int parity, int clip_max);
  30. void ff_bwdif_filter_line_sse2(void *dst, void *prev, void *cur, void *next,
  31. int w, int prefs, int mrefs, int prefs2,
  32. int mrefs2, int prefs3, int mrefs3, int prefs4,
  33. int mrefs4, int parity, int clip_max);
  34. void ff_bwdif_filter_line_ssse3(void *dst, void *prev, void *cur, void *next,
  35. int w, int prefs, int mrefs, int prefs2,
  36. int mrefs2, int prefs3, int mrefs3, int prefs4,
  37. int mrefs4, int parity, int clip_max);
  38. void ff_bwdif_filter_line_12bit_mmxext(void *dst, void *prev, void *cur, void *next,
  39. int w, int prefs, int mrefs, int prefs2,
  40. int mrefs2, int prefs3, int mrefs3, int prefs4,
  41. int mrefs4, int parity, int clip_max);
  42. void ff_bwdif_filter_line_12bit_sse2(void *dst, void *prev, void *cur, void *next,
  43. int w, int prefs, int mrefs, int prefs2,
  44. int mrefs2, int prefs3, int mrefs3, int prefs4,
  45. int mrefs4, int parity, int clip_max);
  46. void ff_bwdif_filter_line_12bit_ssse3(void *dst, void *prev, void *cur, void *next,
  47. int w, int prefs, int mrefs, int prefs2,
  48. int mrefs2, int prefs3, int mrefs3, int prefs4,
  49. int mrefs4, int parity, int clip_max);
  50. av_cold void ff_bwdif_init_x86(BWDIFContext *bwdif)
  51. {
  52. int cpu_flags = av_get_cpu_flags();
  53. int bit_depth = (!bwdif->csp) ? 8 : bwdif->csp->comp[0].depth;
  54. if (bit_depth <= 8) {
  55. #if ARCH_X86_32
  56. if (EXTERNAL_MMXEXT(cpu_flags))
  57. bwdif->filter_line = ff_bwdif_filter_line_mmxext;
  58. #endif /* ARCH_X86_32 */
  59. if (EXTERNAL_SSE2(cpu_flags))
  60. bwdif->filter_line = ff_bwdif_filter_line_sse2;
  61. if (EXTERNAL_SSSE3(cpu_flags))
  62. bwdif->filter_line = ff_bwdif_filter_line_ssse3;
  63. } else if (bit_depth <= 12) {
  64. #if ARCH_X86_32
  65. if (EXTERNAL_MMXEXT(cpu_flags))
  66. bwdif->filter_line = ff_bwdif_filter_line_12bit_mmxext;
  67. #endif /* ARCH_X86_32 */
  68. if (EXTERNAL_SSE2(cpu_flags))
  69. bwdif->filter_line = ff_bwdif_filter_line_12bit_sse2;
  70. if (EXTERNAL_SSSE3(cpu_flags))
  71. bwdif->filter_line = ff_bwdif_filter_line_12bit_ssse3;
  72. }
  73. }