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.

66 lines
2.3KB

  1. /*
  2. * Copyright (c) 2009 Loren Merritt <lorenm@u.washington.edu>
  3. *
  4. * This file is part of Libav.
  5. *
  6. * Libav 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. * Libav 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 Libav; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  19. */
  20. #include "config.h"
  21. #include "libavutil/x86/asm.h"
  22. #include "dsputil_x86.h"
  23. #if HAVE_INLINE_ASM
  24. #if HAVE_7REGS
  25. void ff_add_hfyu_median_prediction_cmov(uint8_t *dst, const uint8_t *top,
  26. const uint8_t *diff, int w,
  27. int *left, int *left_top)
  28. {
  29. x86_reg w2 = -w;
  30. x86_reg x;
  31. int l = *left & 0xff;
  32. int tl = *left_top & 0xff;
  33. int t;
  34. __asm__ volatile (
  35. "mov %7, %3 \n"
  36. "1: \n"
  37. "movzbl (%3, %4), %2 \n"
  38. "mov %2, %k3 \n"
  39. "sub %b1, %b3 \n"
  40. "add %b0, %b3 \n"
  41. "mov %2, %1 \n"
  42. "cmp %0, %2 \n"
  43. "cmovg %0, %2 \n"
  44. "cmovg %1, %0 \n"
  45. "cmp %k3, %0 \n"
  46. "cmovg %k3, %0 \n"
  47. "mov %7, %3 \n"
  48. "cmp %2, %0 \n"
  49. "cmovl %2, %0 \n"
  50. "add (%6, %4), %b0 \n"
  51. "mov %b0, (%5, %4) \n"
  52. "inc %4 \n"
  53. "jl 1b \n"
  54. : "+&q"(l), "+&q"(tl), "=&r"(t), "=&q"(x), "+&r"(w2)
  55. : "r"(dst + w), "r"(diff + w), "rm"(top + w)
  56. );
  57. *left = l;
  58. *left_top = tl;
  59. }
  60. #endif
  61. #endif /* HAVE_INLINE_ASM */