rotate_any.cc 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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_MMI
  34. TANY(TransposeWx8_Any_MMI, TransposeWx8_MMI, 7)
  35. #endif
  36. #ifdef HAS_TRANSPOSEWX8_FAST_SSSE3
  37. TANY(TransposeWx8_Fast_Any_SSSE3, TransposeWx8_Fast_SSSE3, 15)
  38. #endif
  39. #ifdef HAS_TRANSPOSEWX16_MSA
  40. TANY(TransposeWx16_Any_MSA, TransposeWx16_MSA, 15)
  41. #endif
  42. #undef TANY
  43. #define TUVANY(NAMEANY, TPOS_SIMD, MASK) \
  44. void NAMEANY(const uint8_t* src, int src_stride, uint8_t* dst_a, \
  45. int dst_stride_a, uint8_t* dst_b, int dst_stride_b, \
  46. int width) { \
  47. int r = width & MASK; \
  48. int n = width - r; \
  49. if (n > 0) { \
  50. TPOS_SIMD(src, src_stride, dst_a, dst_stride_a, dst_b, dst_stride_b, n); \
  51. } \
  52. TransposeUVWx8_C(src + n * 2, src_stride, dst_a + n * dst_stride_a, \
  53. dst_stride_a, dst_b + n * dst_stride_b, dst_stride_b, r); \
  54. }
  55. #ifdef HAS_TRANSPOSEUVWX8_NEON
  56. TUVANY(TransposeUVWx8_Any_NEON, TransposeUVWx8_NEON, 7)
  57. #endif
  58. #ifdef HAS_TRANSPOSEUVWX8_SSE2
  59. TUVANY(TransposeUVWx8_Any_SSE2, TransposeUVWx8_SSE2, 7)
  60. #endif
  61. #ifdef HAS_TRANSPOSEUVWX8_MMI
  62. TUVANY(TransposeUVWx8_Any_MMI, TransposeUVWx8_MMI, 7)
  63. #endif
  64. #ifdef HAS_TRANSPOSEUVWX16_MSA
  65. TUVANY(TransposeUVWx16_Any_MSA, TransposeUVWx16_MSA, 7)
  66. #endif
  67. #undef TUVANY
  68. #ifdef __cplusplus
  69. } // extern "C"
  70. } // namespace libyuv
  71. #endif