rotate_any.cc 2.96 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
/*
 *  Copyright 2015 The LibYuv Project Authors. All rights reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree. An additional intellectual property rights grant can be found
 *  in the file PATENTS. All contributing project authors may
 *  be found in the AUTHORS file in the root of the source tree.
 */

#include "libyuv/rotate.h"
#include "libyuv/rotate_row.h"

#include "libyuv/basic_types.h"

#ifdef __cplusplus
namespace libyuv {
extern "C" {
#endif

Frank Barchard's avatar
Frank Barchard committed
21 22 23 24 25 26 27 28 29 30
#define TANY(NAMEANY, TPOS_SIMD, MASK)                                        \
  void NAMEANY(const uint8* src, int src_stride, uint8* dst, int dst_stride,  \
               int width) {                                                   \
    int r = width & MASK;                                                     \
    int n = width - r;                                                        \
    if (n > 0) {                                                              \
      TPOS_SIMD(src, src_stride, dst, dst_stride, n);                         \
    }                                                                         \
    TransposeWx8_C(src + n, src_stride, dst + n * dst_stride, dst_stride, r); \
  }
31

32
#ifdef HAS_TRANSPOSEWX8_NEON
Frank Barchard's avatar
Frank Barchard committed
33
TANY(TransposeWx8_Any_NEON, TransposeWx8_NEON, 7)
34 35
#endif
#ifdef HAS_TRANSPOSEWX8_SSSE3
Frank Barchard's avatar
Frank Barchard committed
36
TANY(TransposeWx8_Any_SSSE3, TransposeWx8_SSSE3, 7)
37 38
#endif
#ifdef HAS_TRANSPOSEWX8_FAST_SSSE3
Frank Barchard's avatar
Frank Barchard committed
39
TANY(TransposeWx8_Fast_Any_SSSE3, TransposeWx8_Fast_SSSE3, 15)
40
#endif
41 42
#ifdef HAS_TRANSPOSEWX8_DSPR2
TANY(TransposeWx8_Any_DSPR2, TransposeWx8_DSPR2, 7)
43
#endif
44 45
#ifdef HAS_TRANSPOSEWX16_MSA
TANY(TransposeWx16_Any_MSA, TransposeWx16_MSA, 15)
46
#endif
47 48
#undef TANY

Frank Barchard's avatar
Frank Barchard committed
49
#define TUVANY(NAMEANY, TPOS_SIMD, MASK)                                       \
Frank Barchard's avatar
Frank Barchard committed
50 51 52 53 54 55 56 57 58 59
  void NAMEANY(const uint8* src, int src_stride, uint8* dst_a,                 \
               int dst_stride_a, uint8* dst_b, int dst_stride_b, int width) {  \
    int r = width & MASK;                                                      \
    int n = width - r;                                                         \
    if (n > 0) {                                                               \
      TPOS_SIMD(src, src_stride, dst_a, dst_stride_a, dst_b, dst_stride_b, n); \
    }                                                                          \
    TransposeUVWx8_C(src + n * 2, src_stride, dst_a + n * dst_stride_a,        \
                     dst_stride_a, dst_b + n * dst_stride_b, dst_stride_b, r); \
  }
Frank Barchard's avatar
Frank Barchard committed
60 61 62 63 64 65 66

#ifdef HAS_TRANSPOSEUVWX8_NEON
TUVANY(TransposeUVWx8_Any_NEON, TransposeUVWx8_NEON, 7)
#endif
#ifdef HAS_TRANSPOSEUVWX8_SSE2
TUVANY(TransposeUVWx8_Any_SSE2, TransposeUVWx8_SSE2, 7)
#endif
67 68
#ifdef HAS_TRANSPOSEUVWX8_DSPR2
TUVANY(TransposeUVWx8_Any_DSPR2, TransposeUVWx8_DSPR2, 7)
Frank Barchard's avatar
Frank Barchard committed
69
#endif
70 71
#ifdef HAS_TRANSPOSEUVWX16_MSA
TUVANY(TransposeUVWx16_Any_MSA, TransposeUVWx16_MSA, 7)
72
#endif
Frank Barchard's avatar
Frank Barchard committed
73 74
#undef TUVANY

75 76 77 78
#ifdef __cplusplus
}  // extern "C"
}  // namespace libyuv
#endif