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.

89 lines
3.1KB

  1. /*
  2. * Copyright (c) 2011 Mans Rullgard <mans@mansr.com>
  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. #ifndef AVCODEC_ARM_DCA_H
  21. #define AVCODEC_ARM_DCA_H
  22. #include <stdint.h>
  23. #include "config.h"
  24. #include "libavutil/intmath.h"
  25. #if HAVE_ARMV6 && HAVE_INLINE_ASM
  26. #define decode_blockcode decode_blockcode
  27. static inline int decode_blockcode(int code, int levels, int *values)
  28. {
  29. int v0, v1, v2, v3;
  30. __asm__ ("smmul %4, %8, %11 \n"
  31. "smlabb %8, %4, %10, %8 \n"
  32. "smmul %5, %4, %11 \n"
  33. "sub %8, %8, %9, lsr #1 \n"
  34. "smlabb %4, %5, %10, %4 \n"
  35. "smmul %6, %5, %11 \n"
  36. "str %8, %0 \n"
  37. "sub %4, %4, %9, lsr #1 \n"
  38. "smlabb %5, %6, %10, %5 \n"
  39. "smmul %7, %6, %11 \n"
  40. "str %4, %1 \n"
  41. "sub %5, %5, %9, lsr #1 \n"
  42. "smlabb %6, %7, %10, %6 \n"
  43. "cmp %7, #0 \n"
  44. "str %5, %2 \n"
  45. "sub %6, %6, %9, lsr #1 \n"
  46. "it eq \n"
  47. "mvneq %7, #0 \n"
  48. "str %6, %3 \n"
  49. : "=m"(values[0]), "=m"(values[1]),
  50. "=m"(values[2]), "=m"(values[3]),
  51. "=&r"(v0), "=&r"(v1), "=&r"(v2), "=&r"(v3),
  52. "+&r"(code)
  53. : "r"(levels - 1), "r"(-levels), "r"(ff_inverse[levels])
  54. : "cc");
  55. return v3;
  56. }
  57. #endif
  58. #if HAVE_NEON && HAVE_INLINE_ASM && HAVE_ASM_MOD_Y
  59. #define int8x8_fmul_int32 int8x8_fmul_int32
  60. static inline void int8x8_fmul_int32(float *dst, const int8_t *src, int scale)
  61. {
  62. __asm__ ("vcvt.f32.s32 %2, %2, #4 \n"
  63. "vld1.8 {d0}, [%1,:64] \n"
  64. "vmovl.s8 q0, d0 \n"
  65. "vmovl.s16 q1, d1 \n"
  66. "vmovl.s16 q0, d0 \n"
  67. "vcvt.f32.s32 q0, q0 \n"
  68. "vcvt.f32.s32 q1, q1 \n"
  69. "vmul.f32 q0, q0, %y2 \n"
  70. "vmul.f32 q1, q1, %y2 \n"
  71. "vst1.32 {q0-q1}, [%m0,:128] \n"
  72. : "=Um"(*(float (*)[8])dst)
  73. : "r"(src), "x"(scale)
  74. : "d0", "d1", "d2", "d3");
  75. }
  76. #endif
  77. #endif /* AVCODEC_ARM_DCA_H */