OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 The LibYuv Project Authors. All rights reserved. | 2 * Copyright 2012 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 // Rotation should be exact. | 76 // Rotation should be exact. |
77 for (int i = 0; i < dst_i420_size; ++i) { | 77 for (int i = 0; i < dst_i420_size; ++i) { |
78 EXPECT_EQ(dst_i420_c[i], dst_i420_opt[i]); | 78 EXPECT_EQ(dst_i420_c[i], dst_i420_opt[i]); |
79 } | 79 } |
80 | 80 |
81 free_aligned_buffer_64(dst_i420_c); | 81 free_aligned_buffer_64(dst_i420_c); |
82 free_aligned_buffer_64(dst_i420_opt); | 82 free_aligned_buffer_64(dst_i420_opt); |
83 free_aligned_buffer_64(src_i420); | 83 free_aligned_buffer_64(src_i420); |
84 } | 84 } |
85 | 85 |
86 TEST_F(LibYUVRotateTest, I420Rotate0) { | 86 TEST_F(LibYUVRotateTest, I420Rotate0_Opt) { |
87 I420TestRotate(benchmark_width_, benchmark_height_, | 87 I420TestRotate(benchmark_width_, benchmark_height_, |
88 benchmark_width_, benchmark_height_, | 88 benchmark_width_, benchmark_height_, |
89 kRotate0, benchmark_iterations_, | 89 kRotate0, benchmark_iterations_, |
90 disable_cpu_flags_, benchmark_cpu_info_); | 90 disable_cpu_flags_, benchmark_cpu_info_); |
91 } | 91 } |
92 | 92 |
93 TEST_F(LibYUVRotateTest, I420Rotate90) { | 93 TEST_F(LibYUVRotateTest, I420Rotate90_Opt) { |
94 I420TestRotate(benchmark_width_, benchmark_height_, | 94 I420TestRotate(benchmark_width_, benchmark_height_, |
95 benchmark_height_, benchmark_width_, | 95 benchmark_height_, benchmark_width_, |
96 kRotate90, benchmark_iterations_, | 96 kRotate90, benchmark_iterations_, |
97 disable_cpu_flags_, benchmark_cpu_info_); | 97 disable_cpu_flags_, benchmark_cpu_info_); |
98 } | 98 } |
99 | 99 |
100 TEST_F(LibYUVRotateTest, I420Rotate180) { | 100 TEST_F(LibYUVRotateTest, I420Rotate180_Opt) { |
101 I420TestRotate(benchmark_width_, benchmark_height_, | 101 I420TestRotate(benchmark_width_, benchmark_height_, |
102 benchmark_width_, benchmark_height_, | 102 benchmark_width_, benchmark_height_, |
103 kRotate180, benchmark_iterations_, | 103 kRotate180, benchmark_iterations_, |
104 disable_cpu_flags_, benchmark_cpu_info_); | 104 disable_cpu_flags_, benchmark_cpu_info_); |
105 } | 105 } |
106 | 106 |
107 TEST_F(LibYUVRotateTest, I420Rotate270) { | 107 TEST_F(LibYUVRotateTest, I420Rotate270_Opt) { |
108 I420TestRotate(benchmark_width_, benchmark_height_, | 108 I420TestRotate(benchmark_width_, benchmark_height_, |
109 benchmark_height_, benchmark_width_, | 109 benchmark_height_, benchmark_width_, |
110 kRotate270, benchmark_iterations_, | 110 kRotate270, benchmark_iterations_, |
111 disable_cpu_flags_, benchmark_cpu_info_); | 111 disable_cpu_flags_, benchmark_cpu_info_); |
112 } | 112 } |
113 | 113 |
114 TEST_F(LibYUVRotateTest, I420Rotate0_Odd) { | 114 // TODO(fbarchard): Remove odd width tests. |
| 115 // Odd width tests work but disabled because they use C code and can be |
| 116 // tested by passing an odd width command line or environment variable. |
| 117 TEST_F(LibYUVRotateTest, DISABLED_I420Rotate0_Odd) { |
115 I420TestRotate(benchmark_width_ - 3, benchmark_height_ - 1, | 118 I420TestRotate(benchmark_width_ - 3, benchmark_height_ - 1, |
116 benchmark_width_ - 3, benchmark_height_ - 1, | 119 benchmark_width_ - 3, benchmark_height_ - 1, |
117 kRotate0, benchmark_iterations_, | 120 kRotate0, benchmark_iterations_, |
118 disable_cpu_flags_, benchmark_cpu_info_); | 121 disable_cpu_flags_, benchmark_cpu_info_); |
119 } | 122 } |
120 | 123 |
121 TEST_F(LibYUVRotateTest, I420Rotate90_Odd) { | 124 TEST_F(LibYUVRotateTest, DISABLED_I420Rotate90_Odd) { |
122 I420TestRotate(benchmark_width_ - 3, benchmark_height_ - 1, | 125 I420TestRotate(benchmark_width_ - 3, benchmark_height_ - 1, |
123 benchmark_height_ - 1, benchmark_width_ - 3, | 126 benchmark_height_ - 1, benchmark_width_ - 3, |
124 kRotate90, benchmark_iterations_, | 127 kRotate90, benchmark_iterations_, |
125 disable_cpu_flags_, benchmark_cpu_info_); | 128 disable_cpu_flags_, benchmark_cpu_info_); |
126 } | 129 } |
127 | 130 |
128 TEST_F(LibYUVRotateTest, I420Rotate180_Odd) { | 131 TEST_F(LibYUVRotateTest, DISABLED_I420Rotate180_Odd) { |
129 I420TestRotate(benchmark_width_ - 3, benchmark_height_ - 1, | 132 I420TestRotate(benchmark_width_ - 3, benchmark_height_ - 1, |
130 benchmark_width_ - 3, benchmark_height_ - 1, | 133 benchmark_width_ - 3, benchmark_height_ - 1, |
131 kRotate180, benchmark_iterations_, | 134 kRotate180, benchmark_iterations_, |
132 disable_cpu_flags_, benchmark_cpu_info_); | 135 disable_cpu_flags_, benchmark_cpu_info_); |
133 } | 136 } |
134 | 137 |
135 TEST_F(LibYUVRotateTest, I420Rotate270_Odd) { | 138 TEST_F(LibYUVRotateTest, DISABLED_I420Rotate270_Odd) { |
136 I420TestRotate(benchmark_width_ - 3, benchmark_height_ - 1, | 139 I420TestRotate(benchmark_width_ - 3, benchmark_height_ - 1, |
137 benchmark_height_ - 1, benchmark_width_ - 3, | 140 benchmark_height_ - 1, benchmark_width_ - 3, |
138 kRotate270, benchmark_iterations_, | 141 kRotate270, benchmark_iterations_, |
139 disable_cpu_flags_, benchmark_cpu_info_); | 142 disable_cpu_flags_, benchmark_cpu_info_); |
140 } | 143 } |
141 | 144 |
142 static void NV12TestRotate(int src_width, int src_height, | 145 static void NV12TestRotate(int src_width, int src_height, |
143 int dst_width, int dst_height, | 146 int dst_width, int dst_height, |
144 libyuv::RotationMode mode, | 147 libyuv::RotationMode mode, |
145 int benchmark_iterations, | 148 int benchmark_iterations, |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 // Rotation should be exact. | 199 // Rotation should be exact. |
197 for (int i = 0; i < dst_i420_size; ++i) { | 200 for (int i = 0; i < dst_i420_size; ++i) { |
198 EXPECT_EQ(dst_i420_c[i], dst_i420_opt[i]); | 201 EXPECT_EQ(dst_i420_c[i], dst_i420_opt[i]); |
199 } | 202 } |
200 | 203 |
201 free_aligned_buffer_64(dst_i420_c); | 204 free_aligned_buffer_64(dst_i420_c); |
202 free_aligned_buffer_64(dst_i420_opt); | 205 free_aligned_buffer_64(dst_i420_opt); |
203 free_aligned_buffer_64(src_nv12); | 206 free_aligned_buffer_64(src_nv12); |
204 } | 207 } |
205 | 208 |
206 TEST_F(LibYUVRotateTest, NV12Rotate0) { | 209 TEST_F(LibYUVRotateTest, NV12Rotate0_Opt) { |
207 NV12TestRotate(benchmark_width_, benchmark_height_, | 210 NV12TestRotate(benchmark_width_, benchmark_height_, |
208 benchmark_width_, benchmark_height_, | 211 benchmark_width_, benchmark_height_, |
209 kRotate0, benchmark_iterations_, | 212 kRotate0, benchmark_iterations_, |
210 disable_cpu_flags_, benchmark_cpu_info_); | 213 disable_cpu_flags_, benchmark_cpu_info_); |
211 } | 214 } |
212 | 215 |
213 TEST_F(LibYUVRotateTest, NV12Rotate90) { | 216 TEST_F(LibYUVRotateTest, NV12Rotate90_Opt) { |
214 NV12TestRotate(benchmark_width_, benchmark_height_, | 217 NV12TestRotate(benchmark_width_, benchmark_height_, |
215 benchmark_height_, benchmark_width_, | 218 benchmark_height_, benchmark_width_, |
216 kRotate90, benchmark_iterations_, | 219 kRotate90, benchmark_iterations_, |
217 disable_cpu_flags_, benchmark_cpu_info_); | 220 disable_cpu_flags_, benchmark_cpu_info_); |
218 } | 221 } |
219 | 222 |
220 TEST_F(LibYUVRotateTest, NV12Rotate180) { | 223 TEST_F(LibYUVRotateTest, NV12Rotate180_Opt) { |
221 NV12TestRotate(benchmark_width_, benchmark_height_, | 224 NV12TestRotate(benchmark_width_, benchmark_height_, |
222 benchmark_width_, benchmark_height_, | 225 benchmark_width_, benchmark_height_, |
223 kRotate180, benchmark_iterations_, | 226 kRotate180, benchmark_iterations_, |
224 disable_cpu_flags_, benchmark_cpu_info_); | 227 disable_cpu_flags_, benchmark_cpu_info_); |
225 } | 228 } |
226 | 229 |
227 TEST_F(LibYUVRotateTest, NV12Rotate270) { | 230 TEST_F(LibYUVRotateTest, NV12Rotate270_Opt) { |
228 NV12TestRotate(benchmark_width_, benchmark_height_, | 231 NV12TestRotate(benchmark_width_, benchmark_height_, |
229 benchmark_height_, benchmark_width_, | 232 benchmark_height_, benchmark_width_, |
230 kRotate270, benchmark_iterations_, | 233 kRotate270, benchmark_iterations_, |
231 disable_cpu_flags_, benchmark_cpu_info_); | 234 disable_cpu_flags_, benchmark_cpu_info_); |
232 } | 235 } |
233 | 236 |
234 TEST_F(LibYUVRotateTest, NV12Rotate0_Odd) { | 237 TEST_F(LibYUVRotateTest, DISABLED_NV12Rotate0_Odd) { |
235 NV12TestRotate(benchmark_width_ - 3, benchmark_height_ - 1, | 238 NV12TestRotate(benchmark_width_ - 3, benchmark_height_ - 1, |
236 benchmark_width_ - 3, benchmark_height_ - 1, | 239 benchmark_width_ - 3, benchmark_height_ - 1, |
237 kRotate0, benchmark_iterations_, | 240 kRotate0, benchmark_iterations_, |
238 disable_cpu_flags_, benchmark_cpu_info_); | 241 disable_cpu_flags_, benchmark_cpu_info_); |
239 } | 242 } |
240 | 243 |
241 TEST_F(LibYUVRotateTest, NV12Rotate90_Odd) { | 244 TEST_F(LibYUVRotateTest, DISABLED_NV12Rotate90_Odd) { |
242 NV12TestRotate(benchmark_width_ - 3, benchmark_height_ - 1, | 245 NV12TestRotate(benchmark_width_ - 3, benchmark_height_ - 1, |
243 benchmark_height_ - 1, benchmark_width_ - 3, | 246 benchmark_height_ - 1, benchmark_width_ - 3, |
244 kRotate90, benchmark_iterations_, | 247 kRotate90, benchmark_iterations_, |
245 disable_cpu_flags_, benchmark_cpu_info_); | 248 disable_cpu_flags_, benchmark_cpu_info_); |
246 } | 249 } |
247 | 250 |
248 TEST_F(LibYUVRotateTest, NV12Rotate180_Odd) { | 251 TEST_F(LibYUVRotateTest, DISABLED_NV12Rotate180_Odd) { |
249 NV12TestRotate(benchmark_width_ - 3, benchmark_height_ - 1, | 252 NV12TestRotate(benchmark_width_ - 3, benchmark_height_ - 1, |
250 benchmark_width_ - 3, benchmark_height_ - 1, | 253 benchmark_width_ - 3, benchmark_height_ - 1, |
251 kRotate180, benchmark_iterations_, | 254 kRotate180, benchmark_iterations_, |
252 disable_cpu_flags_, benchmark_cpu_info_); | 255 disable_cpu_flags_, benchmark_cpu_info_); |
253 } | 256 } |
254 | 257 |
255 TEST_F(LibYUVRotateTest, NV12Rotate270_Odd) { | 258 TEST_F(LibYUVRotateTest, DISABLED_NV12Rotate270_Odd) { |
256 NV12TestRotate(benchmark_width_ - 3, benchmark_height_ - 1, | 259 NV12TestRotate(benchmark_width_ - 3, benchmark_height_ - 1, |
257 benchmark_height_ - 1, benchmark_width_ - 3, | 260 benchmark_height_ - 1, benchmark_width_ - 3, |
258 kRotate270, benchmark_iterations_, | 261 kRotate270, benchmark_iterations_, |
259 disable_cpu_flags_, benchmark_cpu_info_); | 262 disable_cpu_flags_, benchmark_cpu_info_); |
260 } | 263 } |
261 | 264 |
262 TEST_F(LibYUVRotateTest, NV12Rotate0_Inverted) { | 265 TEST_F(LibYUVRotateTest, NV12Rotate0_Inverted) { |
263 NV12TestRotate(benchmark_width_, -benchmark_height_, | 266 NV12TestRotate(benchmark_width_, -benchmark_height_, |
264 benchmark_width_, benchmark_height_, | 267 benchmark_width_, benchmark_height_, |
265 kRotate0, benchmark_iterations_, | 268 kRotate0, benchmark_iterations_, |
(...skipping 19 matching lines...) Expand all Loading... |
285 benchmark_height_, benchmark_width_, | 288 benchmark_height_, benchmark_width_, |
286 kRotate270, benchmark_iterations_, | 289 kRotate270, benchmark_iterations_, |
287 disable_cpu_flags_, benchmark_cpu_info_); | 290 disable_cpu_flags_, benchmark_cpu_info_); |
288 } | 291 } |
289 | 292 |
290 | 293 |
291 | 294 |
292 | 295 |
293 | 296 |
294 } // namespace libyuv | 297 } // namespace libyuv |
OLD | NEW |