OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 The LibYuv Project Authors. All rights reserved. | 2 * Copyright 2013 The LibYuv Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 dst[1] = (s[2] + s[3] + t[2] + t[3] + 2) >> 2; | 96 dst[1] = (s[2] + s[3] + t[2] + t[3] + 2) >> 2; |
97 dst += 2; | 97 dst += 2; |
98 s += 4; | 98 s += 4; |
99 t += 4; | 99 t += 4; |
100 } | 100 } |
101 if (dst_width & 1) { | 101 if (dst_width & 1) { |
102 dst[0] = (s[0] + s[1] + t[0] + t[1] + 2) >> 2; | 102 dst[0] = (s[0] + s[1] + t[0] + t[1] + 2) >> 2; |
103 } | 103 } |
104 } | 104 } |
105 | 105 |
| 106 void ScaleRowDown2Box_Odd_C(const uint8* src_ptr, ptrdiff_t src_stride, |
| 107 uint8* dst, int dst_width) { |
| 108 const uint8* s = src_ptr; |
| 109 const uint8* t = src_ptr + src_stride; |
| 110 int x; |
| 111 dst_width -= 1; |
| 112 for (x = 0; x < dst_width - 1; x += 2) { |
| 113 dst[0] = (s[0] + s[1] + t[0] + t[1] + 2) >> 2; |
| 114 dst[1] = (s[2] + s[3] + t[2] + t[3] + 2) >> 2; |
| 115 dst += 2; |
| 116 s += 4; |
| 117 t += 4; |
| 118 } |
| 119 if (dst_width & 1) { |
| 120 dst[0] = (s[0] + s[1] + t[0] + t[1] + 2) >> 2; |
| 121 dst += 1; |
| 122 s += 2; |
| 123 t += 2; |
| 124 } |
| 125 dst[0] = (s[0] + t[0] + 1) >> 1; |
| 126 } |
| 127 |
106 void ScaleRowDown2Box_16_C(const uint16* src_ptr, ptrdiff_t src_stride, | 128 void ScaleRowDown2Box_16_C(const uint16* src_ptr, ptrdiff_t src_stride, |
107 uint16* dst, int dst_width) { | 129 uint16* dst, int dst_width) { |
108 const uint16* s = src_ptr; | 130 const uint16* s = src_ptr; |
109 const uint16* t = src_ptr + src_stride; | 131 const uint16* t = src_ptr + src_stride; |
110 int x; | 132 int x; |
111 for (x = 0; x < dst_width - 1; x += 2) { | 133 for (x = 0; x < dst_width - 1; x += 2) { |
112 dst[0] = (s[0] + s[1] + t[0] + t[1] + 2) >> 2; | 134 dst[0] = (s[0] + s[1] + t[0] + t[1] + 2) >> 2; |
113 dst[1] = (s[2] + s[3] + t[2] + t[3] + 2) >> 2; | 135 dst[1] = (s[2] + s[3] + t[2] + t[3] + 2) >> 2; |
114 dst += 2; | 136 dst += 2; |
115 s += 4; | 137 s += 4; |
(...skipping 1004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1120 *dx = -*dx; | 1142 *dx = -*dx; |
1121 // src_width = -src_width; // Caller must do this. | 1143 // src_width = -src_width; // Caller must do this. |
1122 } | 1144 } |
1123 } | 1145 } |
1124 #undef CENTERSTART | 1146 #undef CENTERSTART |
1125 | 1147 |
1126 #ifdef __cplusplus | 1148 #ifdef __cplusplus |
1127 } // extern "C" | 1149 } // extern "C" |
1128 } // namespace libyuv | 1150 } // namespace libyuv |
1129 #endif | 1151 #endif |
OLD | NEW |