rotate_any.cc 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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* src, int src_stride, uint8* dst, int dst_stride, \
  19. 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_TRANSPOSEWX8_DSPR2
  37. TANY(TransposeWx8_Any_DSPR2, TransposeWx8_DSPR2, 7)
  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* src, int src_stride, uint8* dst_a, \
  45. int dst_stride_a, uint8* dst_b, int dst_stride_b, int width) { \
  46. int r = width & MASK; \
  47. int n = width - r; \
  48. if (n > 0) { \
  49. TPOS_SIMD(src, src_stride, dst_a, dst_stride_a, dst_b, dst_stride_b, n); \
  50. } \
  51. TransposeUVWx8_C(src + n * 2, src_stride, dst_a + n * dst_stride_a, \
  52. dst_stride_a, dst_b + n * dst_stride_b, dst_stride_b, r); \
  53. }
  54. #ifdef HAS_TRANSPOSEUVWX8_NEON
  55. TUVANY(TransposeUVWx8_Any_NEON, TransposeUVWx8_NEON, 7)
  56. #endif
  57. #ifdef HAS_TRANSPOSEUVWX8_SSE2
  58. TUVANY(TransposeUVWx8_Any_SSE2, TransposeUVWx8_SSE2, 7)
  59. #endif
  60. #ifdef HAS_TRANSPOSEUVWX8_DSPR2
  61. TUVANY(TransposeUVWx8_Any_DSPR2, TransposeUVWx8_DSPR2, 7)
  62. #endif
  63. #ifdef HAS_TRANSPOSEUVWX16_MSA
  64. TUVANY(TransposeUVWx16_Any_MSA, TransposeUVWx16_MSA, 7)
  65. #endif
  66. #undef TUVANY
  67. #ifdef __cplusplus
  68. } // extern "C"
  69. } // namespace libyuv
  70. #endif