1 /*
2 * Copyright 2011 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
11 #include "libyuv/rotate_row.h"
12 #include "libyuv/row.h"
13
14 #ifdef __cplusplus
15 namespace libyuv {
16 extern "C" {
17 #endif
18
TransposeWx8_C(const uint8_t * src,int src_stride,uint8_t * dst,int dst_stride,int width)19 void TransposeWx8_C(const uint8_t* src,
20 int src_stride,
21 uint8_t* dst,
22 int dst_stride,
23 int width) {
24 int i;
25 for (i = 0; i < width; ++i) {
26 dst[0] = src[0 * src_stride];
27 dst[1] = src[1 * src_stride];
28 dst[2] = src[2 * src_stride];
29 dst[3] = src[3 * src_stride];
30 dst[4] = src[4 * src_stride];
31 dst[5] = src[5 * src_stride];
32 dst[6] = src[6 * src_stride];
33 dst[7] = src[7 * src_stride];
34 ++src;
35 dst += dst_stride;
36 }
37 }
38
TransposeUVWx8_C(const uint8_t * src,int src_stride,uint8_t * dst_a,int dst_stride_a,uint8_t * dst_b,int dst_stride_b,int width)39 void TransposeUVWx8_C(const uint8_t* src,
40 int src_stride,
41 uint8_t* dst_a,
42 int dst_stride_a,
43 uint8_t* dst_b,
44 int dst_stride_b,
45 int width) {
46 int i;
47 for (i = 0; i < width; ++i) {
48 dst_a[0] = src[0 * src_stride + 0];
49 dst_b[0] = src[0 * src_stride + 1];
50 dst_a[1] = src[1 * src_stride + 0];
51 dst_b[1] = src[1 * src_stride + 1];
52 dst_a[2] = src[2 * src_stride + 0];
53 dst_b[2] = src[2 * src_stride + 1];
54 dst_a[3] = src[3 * src_stride + 0];
55 dst_b[3] = src[3 * src_stride + 1];
56 dst_a[4] = src[4 * src_stride + 0];
57 dst_b[4] = src[4 * src_stride + 1];
58 dst_a[5] = src[5 * src_stride + 0];
59 dst_b[5] = src[5 * src_stride + 1];
60 dst_a[6] = src[6 * src_stride + 0];
61 dst_b[6] = src[6 * src_stride + 1];
62 dst_a[7] = src[7 * src_stride + 0];
63 dst_b[7] = src[7 * src_stride + 1];
64 src += 2;
65 dst_a += dst_stride_a;
66 dst_b += dst_stride_b;
67 }
68 }
69
TransposeWxH_C(const uint8_t * src,int src_stride,uint8_t * dst,int dst_stride,int width,int height)70 void TransposeWxH_C(const uint8_t* src,
71 int src_stride,
72 uint8_t* dst,
73 int dst_stride,
74 int width,
75 int height) {
76 int i;
77 for (i = 0; i < width; ++i) {
78 int j;
79 for (j = 0; j < height; ++j) {
80 dst[i * dst_stride + j] = src[j * src_stride + i];
81 }
82 }
83 }
84
TransposeUVWxH_C(const uint8_t * src,int src_stride,uint8_t * dst_a,int dst_stride_a,uint8_t * dst_b,int dst_stride_b,int width,int height)85 void TransposeUVWxH_C(const uint8_t* src,
86 int src_stride,
87 uint8_t* dst_a,
88 int dst_stride_a,
89 uint8_t* dst_b,
90 int dst_stride_b,
91 int width,
92 int height) {
93 int i;
94 for (i = 0; i < width * 2; i += 2) {
95 int j;
96 for (j = 0; j < height; ++j) {
97 dst_a[j + ((i >> 1) * dst_stride_a)] = src[i + (j * src_stride)];
98 dst_b[j + ((i >> 1) * dst_stride_b)] = src[i + (j * src_stride) + 1];
99 }
100 }
101 }
102
103 #ifdef __cplusplus
104 } // extern "C"
105 } // namespace libyuv
106 #endif
107