rotate_any.cc 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * Copyright 2015 The LibYuv Project Authors. All rights reserved.
  3. *
  4. * Use of this source code is governed by a BSD-style license
  5. * that can be found in the LICENSE file in the root of the source
  6. * tree. An additional intellectual property rights grant can be found
  7. * in the file PATENTS. All contributing project authors may
  8. * be found in the AUTHORS file in the root of the source tree.
  9. */
  10. #include "libyuv/rotate.h"
  11. #include "libyuv/rotate_row.h"
  12. #include "libyuv/basic_types.h"
  13. #ifdef __cplusplus
  14. namespace libyuv {
  15. extern "C" {
  16. #endif
  17. #define TANY(NAMEANY, TPOS_SIMD, MASK) \
  18. void NAMEANY(const uint8_t* src, int src_stride, uint8_t* dst, \
  19. int dst_stride, int width) { \
  20. int r = width & MASK; \
  21. int n = width - r; \
  22. if (n > 0) { \
  23. TPOS_SIMD(src, src_stride, dst, dst_stride, n); \
  24. } \
  25. TransposeWx8_C(src + n, src_stride, dst + n * dst_stride, dst_stride, r); \
  26. }
  27. #ifdef HAS_TRANSPOSEWX8_NEON
  28. TANY(TransposeWx8_Any_NEON, TransposeWx8_NEON, 7)
  29. #endif
  30. #ifdef HAS_TRANSPOSEWX8_SSSE3
  31. TANY(TransposeWx8_Any_SSSE3, TransposeWx8_SSSE3, 7)
  32. #endif
  33. #ifdef HAS_TRANSPOSEWX8_FAST_SSSE3
  34. TANY(TransposeWx8_Fast_Any_SSSE3, TransposeWx8_Fast_SSSE3, 15)
  35. #endif
  36. #ifdef HAS_TRANSPOSEWX16_MSA
  37. TANY(TransposeWx16_Any_MSA, TransposeWx16_MSA, 15)
  38. #endif
  39. #undef TANY
  40. #define TUVANY(NAMEANY, TPOS_SIMD, MASK) \
  41. void NAMEANY(const uint8_t* src, int src_stride, uint8_t* dst_a, \
  42. int dst_stride_a, uint8_t* dst_b, int dst_stride_b, \
  43. int width) { \
  44. int r = width & MASK; \
  45. int n = width - r; \
  46. if (n > 0) { \
  47. TPOS_SIMD(src, src_stride, dst_a, dst_stride_a, dst_b, dst_stride_b, n); \
  48. } \
  49. TransposeUVWx8_C(src + n * 2, src_stride, dst_a + n * dst_stride_a, \
  50. dst_stride_a, dst_b + n * dst_stride_b, dst_stride_b, r); \
  51. }
  52. #ifdef HAS_TRANSPOSEUVWX8_NEON
  53. TUVANY(TransposeUVWx8_Any_NEON, TransposeUVWx8_NEON, 7)
  54. #endif
  55. #ifdef HAS_TRANSPOSEUVWX8_SSE2
  56. TUVANY(TransposeUVWx8_Any_SSE2, TransposeUVWx8_SSE2, 7)
  57. #endif
  58. #ifdef HAS_TRANSPOSEUVWX16_MSA
  59. TUVANY(TransposeUVWx16_Any_MSA, TransposeUVWx16_MSA, 7)
  60. #endif
  61. #undef TUVANY
  62. #ifdef __cplusplus
  63. } // extern "C"
  64. } // namespace libyuv
  65. #endif