rotate_any.cc 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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, \
  19. uint8* dst, 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_TRANSPOSEWX8_DSPR2
  37. TANY(TransposeWx8_Any_DSPR2, TransposeWx8_DSPR2, 7)
  38. #endif
  39. #undef TANY
  40. #define TUVANY(NAMEANY, TPOS_SIMD, MASK) \
  41. void NAMEANY(const uint8* src, int src_stride, \
  42. uint8* dst_a, int dst_stride_a, \
  43. uint8* dst_b, int dst_stride_b, 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, \
  48. n); \
  49. } \
  50. TransposeUVWx8_C(src + n * 2, src_stride, \
  51. dst_a + n * dst_stride_a, dst_stride_a, \
  52. 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. #undef TUVANY
  64. #ifdef __cplusplus
  65. } // extern "C"
  66. } // namespace libyuv
  67. #endif