Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: unit_test/convert_test.cc

Issue 2626123003: Libyuv MIPS DSPR2 optimizations. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « source/scale_mips.cc ('k') | util/psnr_main.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 The LibYuv Project Authors. All rights reserved. 2 * Copyright 2011 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 12 matching lines...) Expand all
23 #endif 23 #endif
24 #include "../unit_test/unit_test.h" 24 #include "../unit_test/unit_test.h"
25 #include "libyuv/planar_functions.h" 25 #include "libyuv/planar_functions.h"
26 #include "libyuv/rotate.h" 26 #include "libyuv/rotate.h"
27 #include "libyuv/video_common.h" 27 #include "libyuv/video_common.h"
28 28
29 namespace libyuv { 29 namespace libyuv {
30 30
31 #define SUBSAMPLE(v, a) ((((v) + (a)-1)) / (a)) 31 #define SUBSAMPLE(v, a) ((((v) + (a)-1)) / (a))
32 32
33 #define TESTPLANARTOPI(SRC_FMT_PLANAR, SRC_SUBSAMP_X, SRC_SUBSAMP_Y, \ 33 #define TESTPLANARTOPI(SRC_FMT_PLANAR, SRC_SUBSAMP_X, SRC_SUBSAMP_Y, \
34 FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, W1280, N, NEG, OFF) \ 34 FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, W1280, N, NEG, OFF) \
35 TEST_F(LibYUVConvertTest, SRC_FMT_PLANAR##To##FMT_PLANAR##N) { \ 35 TEST_F(LibYUVConvertTest, SRC_FMT_PLANAR##To##FMT_PLANAR##N) { \
36 const int kWidth = ((W1280) > 0) ? (W1280) : 1; \ 36 const int kWidth = ((W1280) > 0) ? (W1280) : 1; \
37 const int kHeight = benchmark_height_; \ 37 const int kHeight = benchmark_height_; \
38 align_buffer_page_end(src_y, kWidth* kHeight + OFF); \ 38 align_buffer_page_end(src_y, kWidth* kHeight + OFF); \
39 align_buffer_page_end(src_u, SUBSAMPLE(kWidth, SRC_SUBSAMP_X) * \ 39 align_buffer_page_end( \
40 SUBSAMPLE(kHeight, SRC_SUBSAMP_Y) + \ 40 src_u, \
41 OFF); \ 41 SUBSAMPLE(kWidth, SRC_SUBSAMP_X) * SUBSAMPLE(kHeight, SRC_SUBSAMP_Y) + \
42 align_buffer_page_end(src_v, SUBSAMPLE(kWidth, SRC_SUBSAMP_X) * \ 42 OFF); \
43 SUBSAMPLE(kHeight, SRC_SUBSAMP_Y) + \ 43 align_buffer_page_end( \
44 OFF); \ 44 src_v, \
45 align_buffer_page_end(dst_y_c, kWidth* kHeight); \ 45 SUBSAMPLE(kWidth, SRC_SUBSAMP_X) * SUBSAMPLE(kHeight, SRC_SUBSAMP_Y) + \
46 align_buffer_page_end(dst_u_c, SUBSAMPLE(kWidth, SUBSAMP_X) * \ 46 OFF); \
47 SUBSAMPLE(kHeight, SUBSAMP_Y)); \ 47 align_buffer_page_end(dst_y_c, kWidth* kHeight); \
48 align_buffer_page_end(dst_v_c, SUBSAMPLE(kWidth, SUBSAMP_X) * \ 48 align_buffer_page_end( \
49 SUBSAMPLE(kHeight, SUBSAMP_Y)); \ 49 dst_u_c, \
50 align_buffer_page_end(dst_y_opt, kWidth* kHeight); \ 50 SUBSAMPLE(kWidth, SUBSAMP_X) * SUBSAMPLE(kHeight, SUBSAMP_Y)); \
51 align_buffer_page_end(dst_u_opt, SUBSAMPLE(kWidth, SUBSAMP_X) * \ 51 align_buffer_page_end( \
52 SUBSAMPLE(kHeight, SUBSAMP_Y)); \ 52 dst_v_c, \
53 align_buffer_page_end(dst_v_opt, SUBSAMPLE(kWidth, SUBSAMP_X) * \ 53 SUBSAMPLE(kWidth, SUBSAMP_X) * SUBSAMPLE(kHeight, SUBSAMP_Y)); \
54 SUBSAMPLE(kHeight, SUBSAMP_Y)); \ 54 align_buffer_page_end(dst_y_opt, kWidth* kHeight); \
55 for (int i = 0; i < kHeight; ++i) \ 55 align_buffer_page_end( \
56 for (int j = 0; j < kWidth; ++j) \ 56 dst_u_opt, \
57 src_y[i * kWidth + j + OFF] = (fastrand() & 0xff); \ 57 SUBSAMPLE(kWidth, SUBSAMP_X) * SUBSAMPLE(kHeight, SUBSAMP_Y)); \
58 for (int i = 0; i < SUBSAMPLE(kHeight, SRC_SUBSAMP_Y); ++i) { \ 58 align_buffer_page_end( \
59 for (int j = 0; j < SUBSAMPLE(kWidth, SRC_SUBSAMP_X); ++j) { \ 59 dst_v_opt, \
60 src_u[(i * SUBSAMPLE(kWidth, SRC_SUBSAMP_X)) + j + OFF] = \ 60 SUBSAMPLE(kWidth, SUBSAMP_X) * SUBSAMPLE(kHeight, SUBSAMP_Y)); \
61 (fastrand() & 0xff); \ 61 for (int i = 0; i < kHeight; ++i) \
62 src_v[(i * SUBSAMPLE(kWidth, SRC_SUBSAMP_X)) + j + OFF] = \ 62 for (int j = 0; j < kWidth; ++j) \
63 (fastrand() & 0xff); \ 63 src_y[i * kWidth + j + OFF] = (fastrand() & 0xff); \
64 } \ 64 for (int i = 0; i < SUBSAMPLE(kHeight, SRC_SUBSAMP_Y); ++i) { \
65 } \ 65 for (int j = 0; j < SUBSAMPLE(kWidth, SRC_SUBSAMP_X); ++j) { \
66 memset(dst_y_c, 1, kWidth* kHeight); \ 66 src_u[(i * SUBSAMPLE(kWidth, SRC_SUBSAMP_X)) + j + OFF] = \
67 memset(dst_u_c, 2, \ 67 (fastrand() & 0xff); \
68 SUBSAMPLE(kWidth, SUBSAMP_X) * SUBSAMPLE(kHeight, SUBSAMP_Y)); \ 68 src_v[(i * SUBSAMPLE(kWidth, SRC_SUBSAMP_X)) + j + OFF] = \
69 memset(dst_v_c, 3, \ 69 (fastrand() & 0xff); \
70 SUBSAMPLE(kWidth, SUBSAMP_X) * SUBSAMPLE(kHeight, SUBSAMP_Y)); \ 70 } \
71 memset(dst_y_opt, 101, kWidth* kHeight); \ 71 } \
72 memset(dst_u_opt, 102, \ 72 memset(dst_y_c, 1, kWidth* kHeight); \
73 SUBSAMPLE(kWidth, SUBSAMP_X) * SUBSAMPLE(kHeight, SUBSAMP_Y)); \ 73 memset(dst_u_c, 2, \
74 memset(dst_v_opt, 103, \ 74 SUBSAMPLE(kWidth, SUBSAMP_X) * SUBSAMPLE(kHeight, SUBSAMP_Y)); \
75 SUBSAMPLE(kWidth, SUBSAMP_X) * SUBSAMPLE(kHeight, SUBSAMP_Y)); \ 75 memset(dst_v_c, 3, \
76 MaskCpuFlags(disable_cpu_flags_); \ 76 SUBSAMPLE(kWidth, SUBSAMP_X) * SUBSAMPLE(kHeight, SUBSAMP_Y)); \
77 SRC_FMT_PLANAR##To##FMT_PLANAR( \ 77 memset(dst_y_opt, 101, kWidth* kHeight); \
78 src_y + OFF, kWidth, src_u + OFF, SUBSAMPLE(kWidth, SRC_SUBSAMP_X), \ 78 memset(dst_u_opt, 102, \
79 src_v + OFF, SUBSAMPLE(kWidth, SRC_SUBSAMP_X), dst_y_c, kWidth, \ 79 SUBSAMPLE(kWidth, SUBSAMP_X) * SUBSAMPLE(kHeight, SUBSAMP_Y)); \
80 dst_u_c, SUBSAMPLE(kWidth, SUBSAMP_X), dst_v_c, \ 80 memset(dst_v_opt, 103, \
81 SUBSAMPLE(kWidth, SUBSAMP_X), kWidth, NEG kHeight); \ 81 SUBSAMPLE(kWidth, SUBSAMP_X) * SUBSAMPLE(kHeight, SUBSAMP_Y)); \
82 MaskCpuFlags(benchmark_cpu_info_); \ 82 MaskCpuFlags(disable_cpu_flags_); \
83 for (int i = 0; i < benchmark_iterations_; ++i) { \ 83 SRC_FMT_PLANAR##To##FMT_PLANAR( \
84 SRC_FMT_PLANAR##To##FMT_PLANAR( \ 84 src_y + OFF, kWidth, src_u + OFF, SUBSAMPLE(kWidth, SRC_SUBSAMP_X), \
85 src_y + OFF, kWidth, src_u + OFF, SUBSAMPLE(kWidth, SRC_SUBSAMP_X), \ 85 src_v + OFF, SUBSAMPLE(kWidth, SRC_SUBSAMP_X), dst_y_c, kWidth, \
86 src_v + OFF, SUBSAMPLE(kWidth, SRC_SUBSAMP_X), dst_y_opt, kWidth, \ 86 dst_u_c, SUBSAMPLE(kWidth, SUBSAMP_X), dst_v_c, \
87 dst_u_opt, SUBSAMPLE(kWidth, SUBSAMP_X), dst_v_opt, \ 87 SUBSAMPLE(kWidth, SUBSAMP_X), kWidth, NEG kHeight); \
88 SUBSAMPLE(kWidth, SUBSAMP_X), kWidth, NEG kHeight); \ 88 MaskCpuFlags(benchmark_cpu_info_); \
89 } \ 89 for (int i = 0; i < benchmark_iterations_; ++i) { \
90 int max_diff = 0; \ 90 SRC_FMT_PLANAR##To##FMT_PLANAR( \
91 for (int i = 0; i < kHeight; ++i) { \ 91 src_y + OFF, kWidth, src_u + OFF, SUBSAMPLE(kWidth, SRC_SUBSAMP_X), \
92 for (int j = 0; j < kWidth; ++j) { \ 92 src_v + OFF, SUBSAMPLE(kWidth, SRC_SUBSAMP_X), dst_y_opt, kWidth, \
93 int abs_diff = abs(static_cast<int>(dst_y_c[i * kWidth + j]) - \ 93 dst_u_opt, SUBSAMPLE(kWidth, SUBSAMP_X), dst_v_opt, \
94 static_cast<int>(dst_y_opt[i * kWidth + j])); \ 94 SUBSAMPLE(kWidth, SUBSAMP_X), kWidth, NEG kHeight); \
95 if (abs_diff > max_diff) { \ 95 } \
96 max_diff = abs_diff; \ 96 int max_diff = 0; \
97 } \ 97 for (int i = 0; i < kHeight; ++i) { \
98 } \ 98 for (int j = 0; j < kWidth; ++j) { \
99 } \ 99 int abs_diff = abs(static_cast<int>(dst_y_c[i * kWidth + j]) - \
100 EXPECT_EQ(0, max_diff); \ 100 static_cast<int>(dst_y_opt[i * kWidth + j])); \
101 for (int i = 0; i < SUBSAMPLE(kHeight, SUBSAMP_Y); ++i) { \ 101 if (abs_diff > max_diff) { \
102 for (int j = 0; j < SUBSAMPLE(kWidth, SUBSAMP_X); ++j) { \ 102 max_diff = abs_diff; \
103 int abs_diff = abs( \ 103 } \
104 static_cast<int>(dst_u_c[i * SUBSAMPLE(kWidth, SUBSAMP_X) + j]) - \ 104 } \
105 static_cast<int>( \ 105 } \
106 dst_u_opt[i * SUBSAMPLE(kWidth, SUBSAMP_X) + j])); \ 106 EXPECT_EQ(0, max_diff); \
107 if (abs_diff > max_diff) { \ 107 for (int i = 0; i < SUBSAMPLE(kHeight, SUBSAMP_Y); ++i) { \
108 max_diff = abs_diff; \ 108 for (int j = 0; j < SUBSAMPLE(kWidth, SUBSAMP_X); ++j) { \
109 } \ 109 int abs_diff = abs( \
110 } \ 110 static_cast<int>(dst_u_c[i * SUBSAMPLE(kWidth, SUBSAMP_X) + j]) - \
111 } \ 111 static_cast<int>( \
112 EXPECT_LE(max_diff, 3); \ 112 dst_u_opt[i * SUBSAMPLE(kWidth, SUBSAMP_X) + j])); \
113 for (int i = 0; i < SUBSAMPLE(kHeight, SUBSAMP_Y); ++i) { \ 113 if (abs_diff > max_diff) { \
114 for (int j = 0; j < SUBSAMPLE(kWidth, SUBSAMP_X); ++j) { \ 114 max_diff = abs_diff; \
115 int abs_diff = abs( \ 115 } \
116 static_cast<int>(dst_v_c[i * SUBSAMPLE(kWidth, SUBSAMP_X) + j]) - \ 116 } \
117 static_cast<int>( \ 117 } \
118 dst_v_opt[i * SUBSAMPLE(kWidth, SUBSAMP_X) + j])); \ 118 EXPECT_LE(max_diff, 3); \
119 if (abs_diff > max_diff) { \ 119 for (int i = 0; i < SUBSAMPLE(kHeight, SUBSAMP_Y); ++i) { \
120 max_diff = abs_diff; \ 120 for (int j = 0; j < SUBSAMPLE(kWidth, SUBSAMP_X); ++j) { \
121 } \ 121 int abs_diff = abs( \
122 } \ 122 static_cast<int>(dst_v_c[i * SUBSAMPLE(kWidth, SUBSAMP_X) + j]) - \
123 } \ 123 static_cast<int>( \
124 EXPECT_LE(max_diff, 3); \ 124 dst_v_opt[i * SUBSAMPLE(kWidth, SUBSAMP_X) + j])); \
125 free_aligned_buffer_page_end(dst_y_c); \ 125 if (abs_diff > max_diff) { \
126 free_aligned_buffer_page_end(dst_u_c); \ 126 max_diff = abs_diff; \
127 free_aligned_buffer_page_end(dst_v_c); \ 127 } \
128 free_aligned_buffer_page_end(dst_y_opt); \ 128 } \
129 free_aligned_buffer_page_end(dst_u_opt); \ 129 } \
130 free_aligned_buffer_page_end(dst_v_opt); \ 130 EXPECT_LE(max_diff, 3); \
131 free_aligned_buffer_page_end(src_y); \ 131 free_aligned_buffer_page_end(dst_y_c); \
132 free_aligned_buffer_page_end(src_u); \ 132 free_aligned_buffer_page_end(dst_u_c); \
133 free_aligned_buffer_page_end(src_v); \ 133 free_aligned_buffer_page_end(dst_v_c); \
134 free_aligned_buffer_page_end(dst_y_opt); \
135 free_aligned_buffer_page_end(dst_u_opt); \
136 free_aligned_buffer_page_end(dst_v_opt); \
137 free_aligned_buffer_page_end(src_y); \
138 free_aligned_buffer_page_end(src_u); \
139 free_aligned_buffer_page_end(src_v); \
134 } 140 }
135 141
136 #define TESTPLANARTOP(SRC_FMT_PLANAR, SRC_SUBSAMP_X, SRC_SUBSAMP_Y, \ 142 #define TESTPLANARTOP(SRC_FMT_PLANAR, SRC_SUBSAMP_X, SRC_SUBSAMP_Y, \
137 FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y) \ 143 FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y) \
138 TESTPLANARTOPI(SRC_FMT_PLANAR, SRC_SUBSAMP_X, SRC_SUBSAMP_Y, FMT_PLANAR, \ 144 TESTPLANARTOPI(SRC_FMT_PLANAR, SRC_SUBSAMP_X, SRC_SUBSAMP_Y, FMT_PLANAR, \
139 SUBSAMP_X, SUBSAMP_Y, benchmark_width_ - 4, _Any, +, 0) \ 145 SUBSAMP_X, SUBSAMP_Y, benchmark_width_ - 4, _Any, +, 0) \
140 TESTPLANARTOPI(SRC_FMT_PLANAR, SRC_SUBSAMP_X, SRC_SUBSAMP_Y, FMT_PLANAR, \ 146 TESTPLANARTOPI(SRC_FMT_PLANAR, SRC_SUBSAMP_X, SRC_SUBSAMP_Y, FMT_PLANAR, \
141 SUBSAMP_X, SUBSAMP_Y, benchmark_width_, _Unaligned, +, 1) \ 147 SUBSAMP_X, SUBSAMP_Y, benchmark_width_, _Unaligned, +, 1) \
142 TESTPLANARTOPI(SRC_FMT_PLANAR, SRC_SUBSAMP_X, SRC_SUBSAMP_Y, FMT_PLANAR, \ 148 TESTPLANARTOPI(SRC_FMT_PLANAR, SRC_SUBSAMP_X, SRC_SUBSAMP_Y, FMT_PLANAR, \
143 SUBSAMP_X, SUBSAMP_Y, benchmark_width_, _Invert, -, 0) \ 149 SUBSAMP_X, SUBSAMP_Y, benchmark_width_, _Invert, -, 0) \
(...skipping 15 matching lines...) Expand all
159 W1280, N, NEG, OFF, PN, OFF_U, OFF_V) \ 165 W1280, N, NEG, OFF, PN, OFF_U, OFF_V) \
160 TEST_F(LibYUVConvertTest, SRC_FMT_PLANAR##To##FMT_PLANAR##_##PN##N) { \ 166 TEST_F(LibYUVConvertTest, SRC_FMT_PLANAR##To##FMT_PLANAR##_##PN##N) { \
161 const int kWidth = ((W1280) > 0) ? (W1280) : 1; \ 167 const int kWidth = ((W1280) > 0) ? (W1280) : 1; \
162 const int kHeight = benchmark_height_; \ 168 const int kHeight = benchmark_height_; \
163 const int kSizeUV = \ 169 const int kSizeUV = \
164 SUBSAMPLE(kWidth, SRC_SUBSAMP_X) * SUBSAMPLE(kHeight, SRC_SUBSAMP_Y); \ 170 SUBSAMPLE(kWidth, SRC_SUBSAMP_X) * SUBSAMPLE(kHeight, SRC_SUBSAMP_Y); \
165 align_buffer_page_end(src_y, kWidth* kHeight + OFF); \ 171 align_buffer_page_end(src_y, kWidth* kHeight + OFF); \
166 align_buffer_page_end(src_uv, \ 172 align_buffer_page_end(src_uv, \
167 kSizeUV*((PIXEL_STRIDE == 3) ? 3 : 2) + OFF); \ 173 kSizeUV*((PIXEL_STRIDE == 3) ? 3 : 2) + OFF); \
168 align_buffer_page_end(dst_y_c, kWidth* kHeight); \ 174 align_buffer_page_end(dst_y_c, kWidth* kHeight); \
169 align_buffer_page_end(dst_u_c, SUBSAMPLE(kWidth, SUBSAMP_X) * \ 175 align_buffer_page_end( \
170 SUBSAMPLE(kHeight, SUBSAMP_Y)); \ 176 dst_u_c, \
171 align_buffer_page_end(dst_v_c, SUBSAMPLE(kWidth, SUBSAMP_X) * \ 177 SUBSAMPLE(kWidth, SUBSAMP_X) * SUBSAMPLE(kHeight, SUBSAMP_Y)); \
172 SUBSAMPLE(kHeight, SUBSAMP_Y)); \ 178 align_buffer_page_end( \
179 dst_v_c, \
180 SUBSAMPLE(kWidth, SUBSAMP_X) * SUBSAMPLE(kHeight, SUBSAMP_Y)); \
173 align_buffer_page_end(dst_y_opt, kWidth* kHeight); \ 181 align_buffer_page_end(dst_y_opt, kWidth* kHeight); \
174 align_buffer_page_end(dst_u_opt, SUBSAMPLE(kWidth, SUBSAMP_X) * \ 182 align_buffer_page_end( \
175 SUBSAMPLE(kHeight, SUBSAMP_Y)); \ 183 dst_u_opt, \
176 align_buffer_page_end(dst_v_opt, SUBSAMPLE(kWidth, SUBSAMP_X) * \ 184 SUBSAMPLE(kWidth, SUBSAMP_X) * SUBSAMPLE(kHeight, SUBSAMP_Y)); \
177 SUBSAMPLE(kHeight, SUBSAMP_Y)); \ 185 align_buffer_page_end( \
186 dst_v_opt, \
187 SUBSAMPLE(kWidth, SUBSAMP_X) * SUBSAMPLE(kHeight, SUBSAMP_Y)); \
178 uint8* src_u = src_uv + OFF_U; \ 188 uint8* src_u = src_uv + OFF_U; \
179 uint8* src_v = src_uv + (PIXEL_STRIDE == 1 ? kSizeUV : OFF_V); \ 189 uint8* src_v = src_uv + (PIXEL_STRIDE == 1 ? kSizeUV : OFF_V); \
180 int src_stride_uv = SUBSAMPLE(kWidth, SUBSAMP_X) * PIXEL_STRIDE; \ 190 int src_stride_uv = SUBSAMPLE(kWidth, SUBSAMP_X) * PIXEL_STRIDE; \
181 for (int i = 0; i < kHeight; ++i) \ 191 for (int i = 0; i < kHeight; ++i) \
182 for (int j = 0; j < kWidth; ++j) \ 192 for (int j = 0; j < kWidth; ++j) \
183 src_y[i * kWidth + j + OFF] = (fastrand() & 0xff); \ 193 src_y[i * kWidth + j + OFF] = (fastrand() & 0xff); \
184 for (int i = 0; i < SUBSAMPLE(kHeight, SRC_SUBSAMP_Y); ++i) { \ 194 for (int i = 0; i < SUBSAMPLE(kHeight, SRC_SUBSAMP_Y); ++i) { \
185 for (int j = 0; j < SUBSAMPLE(kWidth, SRC_SUBSAMP_X); ++j) { \ 195 for (int j = 0; j < SUBSAMPLE(kWidth, SRC_SUBSAMP_X); ++j) { \
186 src_u[(i * src_stride_uv) + j * PIXEL_STRIDE + OFF] = \ 196 src_u[(i * src_stride_uv) + j * PIXEL_STRIDE + OFF] = \
187 (fastrand() & 0xff); \ 197 (fastrand() & 0xff); \
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, benchmark_width_, _Invert, \ 281 FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, benchmark_width_, _Invert, \
272 -, 0, PN, OFF_U, OFF_V) \ 282 -, 0, PN, OFF_U, OFF_V) \
273 TESTAPLANARTOPI(SRC_FMT_PLANAR, PIXEL_STRIDE, SRC_SUBSAMP_X, SRC_SUBSAMP_Y, \ 283 TESTAPLANARTOPI(SRC_FMT_PLANAR, PIXEL_STRIDE, SRC_SUBSAMP_X, SRC_SUBSAMP_Y, \
274 FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, benchmark_width_, _Opt, +, \ 284 FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, benchmark_width_, _Opt, +, \
275 0, PN, OFF_U, OFF_V) 285 0, PN, OFF_U, OFF_V)
276 286
277 TESTAPLANARTOP(Android420, I420, 1, 0, 0, 2, 2, I420, 2, 2) 287 TESTAPLANARTOP(Android420, I420, 1, 0, 0, 2, 2, I420, 2, 2)
278 TESTAPLANARTOP(Android420, NV12, 2, 0, 1, 2, 2, I420, 2, 2) 288 TESTAPLANARTOP(Android420, NV12, 2, 0, 1, 2, 2, I420, 2, 2)
279 TESTAPLANARTOP(Android420, NV21, 2, 1, 0, 2, 2, I420, 2, 2) 289 TESTAPLANARTOP(Android420, NV21, 2, 1, 0, 2, 2, I420, 2, 2)
280 290
281 #define TESTPLANARTOBPI(SRC_FMT_PLANAR, SRC_SUBSAMP_X, SRC_SUBSAMP_Y, \ 291 #define TESTPLANARTOBPI(SRC_FMT_PLANAR, SRC_SUBSAMP_X, SRC_SUBSAMP_Y, \
282 FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, W1280, N, NEG, OFF) \ 292 FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, W1280, N, NEG, OFF) \
283 TEST_F(LibYUVConvertTest, SRC_FMT_PLANAR##To##FMT_PLANAR##N) { \ 293 TEST_F(LibYUVConvertTest, SRC_FMT_PLANAR##To##FMT_PLANAR##N) { \
284 const int kWidth = ((W1280) > 0) ? (W1280) : 1; \ 294 const int kWidth = ((W1280) > 0) ? (W1280) : 1; \
285 const int kHeight = benchmark_height_; \ 295 const int kHeight = benchmark_height_; \
286 align_buffer_page_end(src_y, kWidth* kHeight + OFF); \ 296 align_buffer_page_end(src_y, kWidth* kHeight + OFF); \
287 align_buffer_page_end(src_u, SUBSAMPLE(kWidth, SRC_SUBSAMP_X) * \ 297 align_buffer_page_end( \
288 SUBSAMPLE(kHeight, SRC_SUBSAMP_Y) + \ 298 src_u, \
289 OFF); \ 299 SUBSAMPLE(kWidth, SRC_SUBSAMP_X) * SUBSAMPLE(kHeight, SRC_SUBSAMP_Y) + \
290 align_buffer_page_end(src_v, SUBSAMPLE(kWidth, SRC_SUBSAMP_X) * \ 300 OFF); \
291 SUBSAMPLE(kHeight, SRC_SUBSAMP_Y) + \ 301 align_buffer_page_end( \
292 OFF); \ 302 src_v, \
293 align_buffer_page_end(dst_y_c, kWidth* kHeight); \ 303 SUBSAMPLE(kWidth, SRC_SUBSAMP_X) * SUBSAMPLE(kHeight, SRC_SUBSAMP_Y) + \
294 align_buffer_page_end(dst_uv_c, SUBSAMPLE(kWidth * 2, SUBSAMP_X) * \ 304 OFF); \
295 SUBSAMPLE(kHeight, SUBSAMP_Y)); \ 305 align_buffer_page_end(dst_y_c, kWidth* kHeight); \
296 align_buffer_page_end(dst_y_opt, kWidth* kHeight); \ 306 align_buffer_page_end( \
297 align_buffer_page_end(dst_uv_opt, SUBSAMPLE(kWidth * 2, SUBSAMP_X) * \ 307 dst_uv_c, \
298 SUBSAMPLE(kHeight, SUBSAMP_Y)); \ 308 SUBSAMPLE(kWidth * 2, SUBSAMP_X) * SUBSAMPLE(kHeight, SUBSAMP_Y)); \
299 for (int i = 0; i < kHeight; ++i) \ 309 align_buffer_page_end(dst_y_opt, kWidth* kHeight); \
300 for (int j = 0; j < kWidth; ++j) \ 310 align_buffer_page_end( \
301 src_y[i * kWidth + j + OFF] = (fastrand() & 0xff); \ 311 dst_uv_opt, \
302 for (int i = 0; i < SUBSAMPLE(kHeight, SRC_SUBSAMP_Y); ++i) { \ 312 SUBSAMPLE(kWidth * 2, SUBSAMP_X) * SUBSAMPLE(kHeight, SUBSAMP_Y)); \
303 for (int j = 0; j < SUBSAMPLE(kWidth, SRC_SUBSAMP_X); ++j) { \ 313 for (int i = 0; i < kHeight; ++i) \
304 src_u[(i * SUBSAMPLE(kWidth, SRC_SUBSAMP_X)) + j + OFF] = \ 314 for (int j = 0; j < kWidth; ++j) \
305 (fastrand() & 0xff); \ 315 src_y[i * kWidth + j + OFF] = (fastrand() & 0xff); \
306 src_v[(i * SUBSAMPLE(kWidth, SRC_SUBSAMP_X)) + j + OFF] = \ 316 for (int i = 0; i < SUBSAMPLE(kHeight, SRC_SUBSAMP_Y); ++i) { \
307 (fastrand() & 0xff); \ 317 for (int j = 0; j < SUBSAMPLE(kWidth, SRC_SUBSAMP_X); ++j) { \
308 } \ 318 src_u[(i * SUBSAMPLE(kWidth, SRC_SUBSAMP_X)) + j + OFF] = \
309 } \ 319 (fastrand() & 0xff); \
310 memset(dst_y_c, 1, kWidth* kHeight); \ 320 src_v[(i * SUBSAMPLE(kWidth, SRC_SUBSAMP_X)) + j + OFF] = \
311 memset(dst_uv_c, 2, \ 321 (fastrand() & 0xff); \
312 SUBSAMPLE(kWidth * 2, SUBSAMP_X) * SUBSAMPLE(kHeight, SUBSAMP_Y)); \ 322 } \
313 memset(dst_y_opt, 101, kWidth* kHeight); \ 323 } \
314 memset(dst_uv_opt, 102, \ 324 memset(dst_y_c, 1, kWidth* kHeight); \
315 SUBSAMPLE(kWidth * 2, SUBSAMP_X) * SUBSAMPLE(kHeight, SUBSAMP_Y)); \ 325 memset(dst_uv_c, 2, \
316 MaskCpuFlags(disable_cpu_flags_); \ 326 SUBSAMPLE(kWidth * 2, SUBSAMP_X) * SUBSAMPLE(kHeight, SUBSAMP_Y)); \
317 SRC_FMT_PLANAR##To##FMT_PLANAR( \ 327 memset(dst_y_opt, 101, kWidth* kHeight); \
318 src_y + OFF, kWidth, src_u + OFF, SUBSAMPLE(kWidth, SRC_SUBSAMP_X), \ 328 memset(dst_uv_opt, 102, \
319 src_v + OFF, SUBSAMPLE(kWidth, SRC_SUBSAMP_X), dst_y_c, kWidth, \ 329 SUBSAMPLE(kWidth * 2, SUBSAMP_X) * SUBSAMPLE(kHeight, SUBSAMP_Y)); \
320 dst_uv_c, SUBSAMPLE(kWidth * 2, SUBSAMP_X), kWidth, NEG kHeight); \ 330 MaskCpuFlags(disable_cpu_flags_); \
321 MaskCpuFlags(benchmark_cpu_info_); \ 331 SRC_FMT_PLANAR##To##FMT_PLANAR( \
322 for (int i = 0; i < benchmark_iterations_; ++i) { \ 332 src_y + OFF, kWidth, src_u + OFF, SUBSAMPLE(kWidth, SRC_SUBSAMP_X), \
323 SRC_FMT_PLANAR##To##FMT_PLANAR( \ 333 src_v + OFF, SUBSAMPLE(kWidth, SRC_SUBSAMP_X), dst_y_c, kWidth, \
324 src_y + OFF, kWidth, src_u + OFF, SUBSAMPLE(kWidth, SRC_SUBSAMP_X), \ 334 dst_uv_c, SUBSAMPLE(kWidth * 2, SUBSAMP_X), kWidth, NEG kHeight); \
325 src_v + OFF, SUBSAMPLE(kWidth, SRC_SUBSAMP_X), dst_y_opt, kWidth, \ 335 MaskCpuFlags(benchmark_cpu_info_); \
326 dst_uv_opt, SUBSAMPLE(kWidth * 2, SUBSAMP_X), kWidth, NEG kHeight); \ 336 for (int i = 0; i < benchmark_iterations_; ++i) { \
327 } \ 337 SRC_FMT_PLANAR##To##FMT_PLANAR( \
328 int max_diff = 0; \ 338 src_y + OFF, kWidth, src_u + OFF, SUBSAMPLE(kWidth, SRC_SUBSAMP_X), \
329 for (int i = 0; i < kHeight; ++i) { \ 339 src_v + OFF, SUBSAMPLE(kWidth, SRC_SUBSAMP_X), dst_y_opt, kWidth, \
330 for (int j = 0; j < kWidth; ++j) { \ 340 dst_uv_opt, SUBSAMPLE(kWidth * 2, SUBSAMP_X), kWidth, NEG kHeight); \
331 int abs_diff = abs(static_cast<int>(dst_y_c[i * kWidth + j]) - \ 341 } \
332 static_cast<int>(dst_y_opt[i * kWidth + j])); \ 342 int max_diff = 0; \
333 if (abs_diff > max_diff) { \ 343 for (int i = 0; i < kHeight; ++i) { \
334 max_diff = abs_diff; \ 344 for (int j = 0; j < kWidth; ++j) { \
335 } \ 345 int abs_diff = abs(static_cast<int>(dst_y_c[i * kWidth + j]) - \
336 } \ 346 static_cast<int>(dst_y_opt[i * kWidth + j])); \
337 } \ 347 if (abs_diff > max_diff) { \
338 EXPECT_LE(max_diff, 1); \ 348 max_diff = abs_diff; \
339 for (int i = 0; i < SUBSAMPLE(kHeight, SUBSAMP_Y); ++i) { \ 349 } \
340 for (int j = 0; j < SUBSAMPLE(kWidth * 2, SUBSAMP_X); ++j) { \ 350 } \
341 int abs_diff = \ 351 } \
342 abs(static_cast<int>( \ 352 EXPECT_LE(max_diff, 1); \
343 dst_uv_c[i * SUBSAMPLE(kWidth * 2, SUBSAMP_X) + j]) - \ 353 for (int i = 0; i < SUBSAMPLE(kHeight, SUBSAMP_Y); ++i) { \
344 static_cast<int>( \ 354 for (int j = 0; j < SUBSAMPLE(kWidth * 2, SUBSAMP_X); ++j) { \
345 dst_uv_opt[i * SUBSAMPLE(kWidth * 2, SUBSAMP_X) + j])); \ 355 int abs_diff = \
346 if (abs_diff > max_diff) { \ 356 abs(static_cast<int>( \
347 max_diff = abs_diff; \ 357 dst_uv_c[i * SUBSAMPLE(kWidth * 2, SUBSAMP_X) + j]) - \
348 } \ 358 static_cast<int>( \
349 } \ 359 dst_uv_opt[i * SUBSAMPLE(kWidth * 2, SUBSAMP_X) + j])); \
350 } \ 360 if (abs_diff > max_diff) { \
351 EXPECT_LE(max_diff, 1); \ 361 max_diff = abs_diff; \
352 free_aligned_buffer_page_end(dst_y_c); \ 362 } \
353 free_aligned_buffer_page_end(dst_uv_c); \ 363 } \
354 free_aligned_buffer_page_end(dst_y_opt); \ 364 } \
355 free_aligned_buffer_page_end(dst_uv_opt); \ 365 EXPECT_LE(max_diff, 1); \
356 free_aligned_buffer_page_end(src_y); \ 366 free_aligned_buffer_page_end(dst_y_c); \
357 free_aligned_buffer_page_end(src_u); \ 367 free_aligned_buffer_page_end(dst_uv_c); \
358 free_aligned_buffer_page_end(src_v); \ 368 free_aligned_buffer_page_end(dst_y_opt); \
369 free_aligned_buffer_page_end(dst_uv_opt); \
370 free_aligned_buffer_page_end(src_y); \
371 free_aligned_buffer_page_end(src_u); \
372 free_aligned_buffer_page_end(src_v); \
359 } 373 }
360 374
361 #define TESTPLANARTOBP(SRC_FMT_PLANAR, SRC_SUBSAMP_X, SRC_SUBSAMP_Y, \ 375 #define TESTPLANARTOBP(SRC_FMT_PLANAR, SRC_SUBSAMP_X, SRC_SUBSAMP_Y, \
362 FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y) \ 376 FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y) \
363 TESTPLANARTOBPI(SRC_FMT_PLANAR, SRC_SUBSAMP_X, SRC_SUBSAMP_Y, FMT_PLANAR, \ 377 TESTPLANARTOBPI(SRC_FMT_PLANAR, SRC_SUBSAMP_X, SRC_SUBSAMP_Y, FMT_PLANAR, \
364 SUBSAMP_X, SUBSAMP_Y, benchmark_width_ - 4, _Any, +, 0) \ 378 SUBSAMP_X, SUBSAMP_Y, benchmark_width_ - 4, _Any, +, 0) \
365 TESTPLANARTOBPI(SRC_FMT_PLANAR, SRC_SUBSAMP_X, SRC_SUBSAMP_Y, FMT_PLANAR, \ 379 TESTPLANARTOBPI(SRC_FMT_PLANAR, SRC_SUBSAMP_X, SRC_SUBSAMP_Y, FMT_PLANAR, \
366 SUBSAMP_X, SUBSAMP_Y, benchmark_width_, _Unaligned, +, 1) \ 380 SUBSAMP_X, SUBSAMP_Y, benchmark_width_, _Unaligned, +, 1) \
367 TESTPLANARTOBPI(SRC_FMT_PLANAR, SRC_SUBSAMP_X, SRC_SUBSAMP_Y, FMT_PLANAR, \ 381 TESTPLANARTOBPI(SRC_FMT_PLANAR, SRC_SUBSAMP_X, SRC_SUBSAMP_Y, FMT_PLANAR, \
368 SUBSAMP_X, SUBSAMP_Y, benchmark_width_, _Invert, -, 0) \ 382 SUBSAMP_X, SUBSAMP_Y, benchmark_width_, _Invert, -, 0) \
369 TESTPLANARTOBPI(SRC_FMT_PLANAR, SRC_SUBSAMP_X, SRC_SUBSAMP_Y, FMT_PLANAR, \ 383 TESTPLANARTOBPI(SRC_FMT_PLANAR, SRC_SUBSAMP_X, SRC_SUBSAMP_Y, FMT_PLANAR, \
370 SUBSAMP_X, SUBSAMP_Y, benchmark_width_, _Opt, +, 0) 384 SUBSAMP_X, SUBSAMP_Y, benchmark_width_, _Opt, +, 0)
371 385
372 TESTPLANARTOBP(I420, 2, 2, NV12, 2, 2) 386 TESTPLANARTOBP(I420, 2, 2, NV12, 2, 2)
373 TESTPLANARTOBP(I420, 2, 2, NV21, 2, 2) 387 TESTPLANARTOBP(I420, 2, 2, NV21, 2, 2)
374 388
375 #define TESTBIPLANARTOPI(SRC_FMT_PLANAR, SRC_SUBSAMP_X, SRC_SUBSAMP_Y, \ 389 #define TESTBIPLANARTOPI(SRC_FMT_PLANAR, SRC_SUBSAMP_X, SRC_SUBSAMP_Y, \
376 FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, W1280, N, NEG, OFF, \ 390 FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, W1280, N, NEG, OFF, \
377 DOY) \ 391 DOY) \
378 TEST_F(LibYUVConvertTest, SRC_FMT_PLANAR##To##FMT_PLANAR##N) { \ 392 TEST_F(LibYUVConvertTest, SRC_FMT_PLANAR##To##FMT_PLANAR##N) { \
379 const int kWidth = ((W1280) > 0) ? (W1280) : 1; \ 393 const int kWidth = ((W1280) > 0) ? (W1280) : 1; \
380 const int kHeight = benchmark_height_; \ 394 const int kHeight = benchmark_height_; \
381 align_buffer_page_end(src_y, kWidth* kHeight + OFF); \ 395 align_buffer_page_end(src_y, kWidth* kHeight + OFF); \
382 align_buffer_page_end(src_uv, 2 * SUBSAMPLE(kWidth, SRC_SUBSAMP_X) * \ 396 align_buffer_page_end(src_uv, \
383 SUBSAMPLE(kHeight, SRC_SUBSAMP_Y) + \ 397 2 * SUBSAMPLE(kWidth, SRC_SUBSAMP_X) * \
384 OFF); \ 398 SUBSAMPLE(kHeight, SRC_SUBSAMP_Y) + \
399 OFF); \
385 align_buffer_page_end(dst_y_c, kWidth* kHeight); \ 400 align_buffer_page_end(dst_y_c, kWidth* kHeight); \
386 align_buffer_page_end(dst_u_c, SUBSAMPLE(kWidth, SUBSAMP_X) * \ 401 align_buffer_page_end( \
387 SUBSAMPLE(kHeight, SUBSAMP_Y)); \ 402 dst_u_c, \
388 align_buffer_page_end(dst_v_c, SUBSAMPLE(kWidth, SUBSAMP_X) * \ 403 SUBSAMPLE(kWidth, SUBSAMP_X) * SUBSAMPLE(kHeight, SUBSAMP_Y)); \
389 SUBSAMPLE(kHeight, SUBSAMP_Y)); \ 404 align_buffer_page_end( \
405 dst_v_c, \
406 SUBSAMPLE(kWidth, SUBSAMP_X) * SUBSAMPLE(kHeight, SUBSAMP_Y)); \
390 align_buffer_page_end(dst_y_opt, kWidth* kHeight); \ 407 align_buffer_page_end(dst_y_opt, kWidth* kHeight); \
391 align_buffer_page_end(dst_u_opt, SUBSAMPLE(kWidth, SUBSAMP_X) * \ 408 align_buffer_page_end( \
392 SUBSAMPLE(kHeight, SUBSAMP_Y)); \ 409 dst_u_opt, \
393 align_buffer_page_end(dst_v_opt, SUBSAMPLE(kWidth, SUBSAMP_X) * \ 410 SUBSAMPLE(kWidth, SUBSAMP_X) * SUBSAMPLE(kHeight, SUBSAMP_Y)); \
394 SUBSAMPLE(kHeight, SUBSAMP_Y)); \ 411 align_buffer_page_end( \
412 dst_v_opt, \
413 SUBSAMPLE(kWidth, SUBSAMP_X) * SUBSAMPLE(kHeight, SUBSAMP_Y)); \
395 for (int i = 0; i < kHeight; ++i) \ 414 for (int i = 0; i < kHeight; ++i) \
396 for (int j = 0; j < kWidth; ++j) \ 415 for (int j = 0; j < kWidth; ++j) \
397 src_y[i * kWidth + j + OFF] = (fastrand() & 0xff); \ 416 src_y[i * kWidth + j + OFF] = (fastrand() & 0xff); \
398 for (int i = 0; i < SUBSAMPLE(kHeight, SRC_SUBSAMP_Y); ++i) { \ 417 for (int i = 0; i < SUBSAMPLE(kHeight, SRC_SUBSAMP_Y); ++i) { \
399 for (int j = 0; j < 2 * SUBSAMPLE(kWidth, SRC_SUBSAMP_X); ++j) { \ 418 for (int j = 0; j < 2 * SUBSAMPLE(kWidth, SRC_SUBSAMP_X); ++j) { \
400 src_uv[(i * 2 * SUBSAMPLE(kWidth, SRC_SUBSAMP_X)) + j + OFF] = \ 419 src_uv[(i * 2 * SUBSAMPLE(kWidth, SRC_SUBSAMP_X)) + j + OFF] = \
401 (fastrand() & 0xff); \ 420 (fastrand() & 0xff); \
402 } \ 421 } \
403 } \ 422 } \
404 memset(dst_y_c, 1, kWidth* kHeight); \ 423 memset(dst_y_c, 1, kWidth* kHeight); \
(...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after
1362 1381
1363 TEST_F(LibYUVConvertTest, MJPGToI420) { 1382 TEST_F(LibYUVConvertTest, MJPGToI420) {
1364 const int kOff = 10; 1383 const int kOff = 10;
1365 const int kMinJpeg = 64; 1384 const int kMinJpeg = 64;
1366 const int kImageSize = benchmark_width_ * benchmark_height_ >= kMinJpeg 1385 const int kImageSize = benchmark_width_ * benchmark_height_ >= kMinJpeg
1367 ? benchmark_width_ * benchmark_height_ 1386 ? benchmark_width_ * benchmark_height_
1368 : kMinJpeg; 1387 : kMinJpeg;
1369 const int kSize = kImageSize + kOff; 1388 const int kSize = kImageSize + kOff;
1370 align_buffer_page_end(orig_pixels, kSize); 1389 align_buffer_page_end(orig_pixels, kSize);
1371 align_buffer_page_end(dst_y_opt, benchmark_width_ * benchmark_height_); 1390 align_buffer_page_end(dst_y_opt, benchmark_width_ * benchmark_height_);
1372 align_buffer_page_end(dst_u_opt, SUBSAMPLE(benchmark_width_, 2) * 1391 align_buffer_page_end(
1373 SUBSAMPLE(benchmark_height_, 2)); 1392 dst_u_opt,
1374 align_buffer_page_end(dst_v_opt, SUBSAMPLE(benchmark_width_, 2) * 1393 SUBSAMPLE(benchmark_width_, 2) * SUBSAMPLE(benchmark_height_, 2));
1375 SUBSAMPLE(benchmark_height_, 2)); 1394 align_buffer_page_end(
1395 dst_v_opt,
1396 SUBSAMPLE(benchmark_width_, 2) * SUBSAMPLE(benchmark_height_, 2));
1376 1397
1377 // EOI, SOI to make MJPG appear valid. 1398 // EOI, SOI to make MJPG appear valid.
1378 memset(orig_pixels, 0, kSize); 1399 memset(orig_pixels, 0, kSize);
1379 orig_pixels[0] = 0xff; 1400 orig_pixels[0] = 0xff;
1380 orig_pixels[1] = 0xd8; // SOI. 1401 orig_pixels[1] = 0xd8; // SOI.
1381 orig_pixels[kSize - kOff + 0] = 0xff; 1402 orig_pixels[kSize - kOff + 0] = 0xff;
1382 orig_pixels[kSize - kOff + 1] = 0xd9; // EOI. 1403 orig_pixels[kSize - kOff + 1] = 0xd9; // EOI.
1383 1404
1384 for (int times = 0; times < benchmark_iterations_; ++times) { 1405 for (int times = 0; times < benchmark_iterations_; ++times) {
1385 int ret = 1406 int ret =
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1437 ((benchmark_height_ - (benchmark_height_ * 360 / 480)) / 2 + 1) & ~1; 1458 ((benchmark_height_ - (benchmark_height_ * 360 / 480)) / 2 + 1) & ~1;
1438 const int kDestWidth = benchmark_width_; 1459 const int kDestWidth = benchmark_width_;
1439 const int kDestHeight = benchmark_height_ - crop_y * 2; 1460 const int kDestHeight = benchmark_height_ - crop_y * 2;
1440 const int kStrideUV = SUBSAMPLE(kWidth, SUBSAMP_X); 1461 const int kStrideUV = SUBSAMPLE(kWidth, SUBSAMP_X);
1441 const int sample_size = 1462 const int sample_size =
1442 kWidth * kHeight + kStrideUV * SUBSAMPLE(kHeight, SUBSAMP_Y) * 2; 1463 kWidth * kHeight + kStrideUV * SUBSAMPLE(kHeight, SUBSAMP_Y) * 2;
1443 align_buffer_page_end(src_y, sample_size); 1464 align_buffer_page_end(src_y, sample_size);
1444 uint8* src_uv = src_y + kWidth * kHeight; 1465 uint8* src_uv = src_y + kWidth * kHeight;
1445 1466
1446 align_buffer_page_end(dst_y, kDestWidth * kDestHeight); 1467 align_buffer_page_end(dst_y, kDestWidth * kDestHeight);
1447 align_buffer_page_end(dst_u, SUBSAMPLE(kDestWidth, SUBSAMP_X) * 1468 align_buffer_page_end(
1448 SUBSAMPLE(kDestHeight, SUBSAMP_Y)); 1469 dst_u,
1449 align_buffer_page_end(dst_v, SUBSAMPLE(kDestWidth, SUBSAMP_X) * 1470 SUBSAMPLE(kDestWidth, SUBSAMP_X) * SUBSAMPLE(kDestHeight, SUBSAMP_Y));
1450 SUBSAMPLE(kDestHeight, SUBSAMP_Y)); 1471 align_buffer_page_end(
1472 dst_v,
1473 SUBSAMPLE(kDestWidth, SUBSAMP_X) * SUBSAMPLE(kDestHeight, SUBSAMP_Y));
1451 1474
1452 align_buffer_page_end(dst_y_2, kDestWidth * kDestHeight); 1475 align_buffer_page_end(dst_y_2, kDestWidth * kDestHeight);
1453 align_buffer_page_end(dst_u_2, SUBSAMPLE(kDestWidth, SUBSAMP_X) * 1476 align_buffer_page_end(
1454 SUBSAMPLE(kDestHeight, SUBSAMP_Y)); 1477 dst_u_2,
1455 align_buffer_page_end(dst_v_2, SUBSAMPLE(kDestWidth, SUBSAMP_X) * 1478 SUBSAMPLE(kDestWidth, SUBSAMP_X) * SUBSAMPLE(kDestHeight, SUBSAMP_Y));
1456 SUBSAMPLE(kDestHeight, SUBSAMP_Y)); 1479 align_buffer_page_end(
1480 dst_v_2,
1481 SUBSAMPLE(kDestWidth, SUBSAMP_X) * SUBSAMPLE(kDestHeight, SUBSAMP_Y));
1457 1482
1458 for (int i = 0; i < kHeight * kWidth; ++i) { 1483 for (int i = 0; i < kHeight * kWidth; ++i) {
1459 src_y[i] = (fastrand() & 0xff); 1484 src_y[i] = (fastrand() & 0xff);
1460 } 1485 }
1461 for (int i = 0; i < (SUBSAMPLE(kHeight, SUBSAMP_Y) * kStrideUV) * 2; ++i) { 1486 for (int i = 0; i < (SUBSAMPLE(kHeight, SUBSAMP_Y) * kStrideUV) * 2; ++i) {
1462 src_uv[i] = (fastrand() & 0xff); 1487 src_uv[i] = (fastrand() & 0xff);
1463 } 1488 }
1464 memset(dst_y, 1, kDestWidth * kDestHeight); 1489 memset(dst_y, 1, kDestWidth * kDestHeight);
1465 memset(dst_u, 2, 1490 memset(dst_u, 2,
1466 SUBSAMPLE(kDestWidth, SUBSAMP_X) * SUBSAMPLE(kDestHeight, SUBSAMP_Y)); 1491 SUBSAMPLE(kDestWidth, SUBSAMP_X) * SUBSAMPLE(kDestHeight, SUBSAMP_Y));
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
1879 benchmark_width_, _Invert, -, 0, FMT_C, BPP_C, 0) \ 1904 benchmark_width_, _Invert, -, 0, FMT_C, BPP_C, 0) \
1880 TESTQPLANARTOEI(FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, FMT_B, SUB_B, BPP_B, \ 1905 TESTQPLANARTOEI(FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, FMT_B, SUB_B, BPP_B, \
1881 benchmark_width_, _Opt, +, 0, FMT_C, BPP_C, 0) \ 1906 benchmark_width_, _Opt, +, 0, FMT_C, BPP_C, 0) \
1882 TESTQPLANARTOEI(FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, FMT_B, SUB_B, BPP_B, \ 1907 TESTQPLANARTOEI(FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, FMT_B, SUB_B, BPP_B, \
1883 benchmark_width_, _Premult, +, 0, FMT_C, BPP_C, 1) 1908 benchmark_width_, _Premult, +, 0, FMT_C, BPP_C, 1)
1884 1909
1885 TESTQPLANARTOE(I420Alpha, 2, 2, ARGB, 1, 4, ABGR, 4) 1910 TESTQPLANARTOE(I420Alpha, 2, 2, ARGB, 1, 4, ABGR, 4)
1886 TESTQPLANARTOE(I420Alpha, 2, 2, ABGR, 1, 4, ARGB, 4) 1911 TESTQPLANARTOE(I420Alpha, 2, 2, ABGR, 1, 4, ARGB, 4)
1887 1912
1888 } // namespace libyuv 1913 } // namespace libyuv
OLDNEW
« no previous file with comments | « source/scale_mips.cc ('k') | util/psnr_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698