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.

64 lines
2.3KB

  1. /*
  2. * This file is part of Libav.
  3. *
  4. * Libav is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Lesser General Public
  6. * License as published by the Free Software Foundation; either
  7. * version 2.1 of the License, or (at your option) any later version.
  8. *
  9. * Libav is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public
  15. * License along with Libav; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  17. */
  18. #include "config.h"
  19. #include "libavutil/attributes.h"
  20. #include "libavutil/cpu.h"
  21. #include "libavutil/x86/asm.h"
  22. #include "libavutil/x86/cpu.h"
  23. #include "libavcodec/huffyuvdsp.h"
  24. void ff_add_bytes_mmx(uint8_t *dst, uint8_t *src, int w);
  25. void ff_add_hfyu_median_pred_cmov(uint8_t *dst, const uint8_t *top,
  26. const uint8_t *diff, int w,
  27. int *left, int *left_top);
  28. void ff_add_hfyu_median_pred_mmxext(uint8_t *dst, const uint8_t *top,
  29. const uint8_t *diff, int w,
  30. int *left, int *left_top);
  31. int ff_add_hfyu_left_pred_ssse3(uint8_t *dst, const uint8_t *src,
  32. int w, int left);
  33. int ff_add_hfyu_left_pred_sse4(uint8_t *dst, const uint8_t *src,
  34. int w, int left);
  35. av_cold void ff_huffyuvdsp_init_x86(HuffYUVDSPContext *c)
  36. {
  37. int cpu_flags = av_get_cpu_flags();
  38. #if HAVE_7REGS && HAVE_INLINE_ASM
  39. if (cpu_flags & AV_CPU_FLAG_CMOV)
  40. c->add_hfyu_median_pred = ff_add_hfyu_median_pred_cmov;
  41. #endif
  42. if (INLINE_MMX(cpu_flags))
  43. c->add_bytes = ff_add_bytes_mmx;
  44. if (EXTERNAL_MMXEXT(cpu_flags)) {
  45. /* slower than cmov version on AMD */
  46. if (!(cpu_flags & AV_CPU_FLAG_3DNOW))
  47. c->add_hfyu_median_pred = ff_add_hfyu_median_pred_mmxext;
  48. }
  49. if (EXTERNAL_SSSE3(cpu_flags)) {
  50. c->add_hfyu_left_pred = ff_add_hfyu_left_pred_ssse3;
  51. if (cpu_flags & AV_CPU_FLAG_SSE4) // not really SSE4, just slow on Conroe
  52. c->add_hfyu_left_pred = ff_add_hfyu_left_pred_sse4;
  53. }
  54. }