dca.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. * Copyright (c) 2011 Mans Rullgard <mans@mansr.com>
  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. #ifndef AVCODEC_ARM_DCA_H
  21. #define AVCODEC_ARM_DCA_H
  22. #include <stdint.h>
  23. #include "config.h"
  24. #include "libavcodec/mathops.h"
  25. #if HAVE_ARMV6_INLINE && AV_GCC_VERSION_AT_LEAST(4,4) && !CONFIG_THUMB
  26. #define decode_blockcodes decode_blockcodes
  27. static inline int decode_blockcodes(int code1, int code2, int levels,
  28. int32_t *values)
  29. {
  30. int32_t v0, v1, v2, v3, v4, v5;
  31. __asm__ ("smmul %0, %6, %10 \n"
  32. "smmul %3, %7, %10 \n"
  33. "smlabb %6, %0, %9, %6 \n"
  34. "smlabb %7, %3, %9, %7 \n"
  35. "smmul %1, %0, %10 \n"
  36. "smmul %4, %3, %10 \n"
  37. "sub %6, %6, %8, lsr #1 \n"
  38. "sub %7, %7, %8, lsr #1 \n"
  39. "smlabb %0, %1, %9, %0 \n"
  40. "smlabb %3, %4, %9, %3 \n"
  41. "smmul %2, %1, %10 \n"
  42. "smmul %5, %4, %10 \n"
  43. "str %6, [%11, #0] \n"
  44. "str %7, [%11, #16] \n"
  45. "sub %0, %0, %8, lsr #1 \n"
  46. "sub %3, %3, %8, lsr #1 \n"
  47. "smlabb %1, %2, %9, %1 \n"
  48. "smlabb %4, %5, %9, %4 \n"
  49. "smmul %6, %2, %10 \n"
  50. "smmul %7, %5, %10 \n"
  51. "str %0, [%11, #4] \n"
  52. "str %3, [%11, #20] \n"
  53. "sub %1, %1, %8, lsr #1 \n"
  54. "sub %4, %4, %8, lsr #1 \n"
  55. "smlabb %2, %6, %9, %2 \n"
  56. "smlabb %5, %7, %9, %5 \n"
  57. "str %1, [%11, #8] \n"
  58. "str %4, [%11, #24] \n"
  59. "sub %2, %2, %8, lsr #1 \n"
  60. "sub %5, %5, %8, lsr #1 \n"
  61. "str %2, [%11, #12] \n"
  62. "str %5, [%11, #28] \n"
  63. : "=&r"(v0), "=&r"(v1), "=&r"(v2),
  64. "=&r"(v3), "=&r"(v4), "=&r"(v5),
  65. "+&r"(code1), "+&r"(code2)
  66. : "r"(levels - 1), "r"(-levels),
  67. "r"(ff_inverse[levels]), "r"(values)
  68. : "memory");
  69. return code1 | code2;
  70. }
  71. #endif
  72. #endif /* AVCODEC_ARM_DCA_H */