OLD | NEW |
1 # Getting Started | 1 # Getting Started |
2 | 2 |
3 How to get and build the libyuv code. | 3 How to get and build the libyuv code. |
4 | 4 |
5 ## Pre-requisites | 5 ## Pre-requisites |
6 | 6 |
7 You'll need to have depot tools installed: https://www.chromium.org/developers/h
ow-tos/install-depot-tools | 7 You'll need to have depot tools installed: https://www.chromium.org/developers/h
ow-tos/install-depot-tools |
8 Refer to chromium instructions for each platform for other prerequisites. | 8 Refer to chromium instructions for each platform for other prerequisites. |
9 | 9 |
10 ## Getting the Code | 10 ## Getting the Code |
11 | 11 |
12 Create a working directory, enter it, and run: | 12 Create a working directory, enter it, and run: |
13 | 13 |
14 gclient config https://chromium.googlesource.com/libyuv/libyuv | 14 gclient config https://chromium.googlesource.com/libyuv/libyuv |
15 gclient sync | 15 gclient sync |
16 | 16 |
17 | |
18 Then you'll get a .gclient file like: | 17 Then you'll get a .gclient file like: |
19 | 18 |
20 solutions = [ | 19 solutions = [ |
21 { "name" : "libyuv", | 20 { "name" : "libyuv", |
22 "url" : "https://chromium.googlesource.com/libyuv/libyuv", | 21 "url" : "https://chromium.googlesource.com/libyuv/libyuv", |
23 "deps_file" : "DEPS", | 22 "deps_file" : "DEPS", |
24 "managed" : True, | 23 "managed" : True, |
25 "custom_deps" : { | 24 "custom_deps" : { |
26 }, | 25 }, |
27 "safesync_url": "", | 26 "safesync_url": "", |
28 }, | 27 }, |
29 ]; | 28 ]; |
30 | 29 |
31 | |
32 For iOS add `;target_os=['ios'];` to your OSX .gclient and run `GYP_DEFINES="OS=
ios" gclient sync.` | 30 For iOS add `;target_os=['ios'];` to your OSX .gclient and run `GYP_DEFINES="OS=
ios" gclient sync.` |
33 | 31 |
34 Browse the Git reprository: https://chromium.googlesource.com/libyuv/libyuv/+/ma
ster | 32 Browse the Git reprository: https://chromium.googlesource.com/libyuv/libyuv/+/ma
ster |
35 | 33 |
36 ### Android | 34 ### Android |
37 For Android add `;target_os=['android'];` to your Linux .gclient | 35 For Android add `;target_os=['android'];` to your Linux .gclient |
38 | 36 |
39 | |
40 solutions = [ | 37 solutions = [ |
41 { "name" : "libyuv", | 38 { "name" : "libyuv", |
42 "url" : "https://chromium.googlesource.com/libyuv/libyuv", | 39 "url" : "https://chromium.googlesource.com/libyuv/libyuv", |
43 "deps_file" : "DEPS", | 40 "deps_file" : "DEPS", |
44 "managed" : True, | 41 "managed" : True, |
45 "custom_deps" : { | 42 "custom_deps" : { |
46 }, | 43 }, |
47 "safesync_url": "", | 44 "safesync_url": "", |
48 }, | 45 }, |
49 ]; | 46 ]; |
(...skipping 16 matching lines...) Expand all Loading... |
66 | 63 |
67 To get just the source (not buildable): | 64 To get just the source (not buildable): |
68 | 65 |
69 git clone https://chromium.googlesource.com/libyuv/libyuv | 66 git clone https://chromium.googlesource.com/libyuv/libyuv |
70 | 67 |
71 | 68 |
72 ## Building the Library and Unittests | 69 ## Building the Library and Unittests |
73 | 70 |
74 ### Windows | 71 ### Windows |
75 | 72 |
76 set GYP_DEFINES=target_arch=ia32 | 73 call gn gen out/Release "--args=is_debug=false target_cpu=\"x86\"" |
77 call python gyp_libyuv -fninja -G msvs_version=2013 | 74 call gn gen out/Debug "--args=is_debug=true target_cpu=\"x86\"" |
78 ninja -j7 -C out\Release | 75 ninja -j7 -v -C out/Release |
79 ninja -j7 -C out\Debug | 76 ninja -j7 -v -C out/Debug |
80 | 77 |
81 set GYP_DEFINES=target_arch=x64 | 78 call gn gen out/Release "--args=is_debug=false target_cpu=\"x64\"" |
82 call python gyp_libyuv -fninja -G msvs_version=2013 | 79 call gn gen out/Debug "--args=is_debug=true target_cpu=\"x64\"" |
83 ninja -C out\Debug_x64 | 80 ninja -j7 -v -C out/Release |
84 ninja -C out\Release_x64 | 81 ninja -j7 -v -C out/Debug |
85 | 82 |
86 #### Building with clangcl | 83 #### Building with clang-cl |
| 84 |
87 set GYP_DEFINES=clang=1 target_arch=ia32 | 85 set GYP_DEFINES=clang=1 target_arch=ia32 |
88 call python tools\clang\scripts\update.py | 86 call python tools\clang\scripts\update.py |
89 call python gyp_libyuv -fninja libyuv_test.gyp | |
90 ninja -C out\Debug | |
91 ninja -C out\Release | |
92 | 87 |
93 ### OSX | 88 call gn gen out/Release "--args=is_debug=false is_official_build=false is_cl
ang=true target_cpu=\"x86\"" |
| 89 call gn gen out/Debug "--args=is_debug=true is_official_build=false is_clang
=true target_cpu=\"x86\"" |
| 90 ninja -j7 -v -C out/Release |
| 91 ninja -j7 -v -C out/Debug |
94 | 92 |
95 Clang 64 bit shown. Remove `clang=1` for GCC and change x64 to ia32 for 32 bit. | 93 call gn gen out/Release "--args=is_debug=false is_official_build=false is_cl
ang=true target_cpu=\"x64\"" |
| 94 call gn gen out/Debug "--args=is_debug=true is_official_build=false is_clang
=true target_cpu=\"x64\"" |
| 95 ninja -j7 -v -C out/Release |
| 96 ninja -j7 -v -C out/Debug |
96 | 97 |
97 GYP_DEFINES="clang=1 target_arch=x64" ./gyp_libyuv | 98 ### macOS and Linux |
98 ninja -j7 -C out/Debug | |
99 ninja -j7 -C out/Release | |
100 | 99 |
101 GYP_DEFINES="clang=1 target_arch=ia32" ./gyp_libyuv | 100 gn gen out/Release "--args=is_debug=false" |
102 ninja -j7 -C out/Debug | 101 gn gen out/Debug "--args=is_debug=true" |
103 ninja -j7 -C out/Release | 102 ninja -j7 -v -C out/Release |
| 103 ninja -j7 -v -C out/Debug |
| 104 |
| 105 ### Building Offical with GN |
| 106 |
| 107 gn gen out/Official "--args=is_debug=false is_official_build=true is_chrome_
branded=true" |
| 108 ninja -C out/Official |
104 | 109 |
105 ### iOS | 110 ### iOS |
| 111 This section needs an update to GN build documentation. |
106 http://www.chromium.org/developers/how-tos/build-instructions-ios | 112 http://www.chromium.org/developers/how-tos/build-instructions-ios |
107 | 113 |
108 Add to .gclient last line: `target_os=['ios'];` | 114 Add to .gclient last line: `target_os=['ios'];` |
109 | 115 |
110 armv7 | 116 armv7 |
111 | 117 |
112 GYP_DEFINES="OS=ios target_arch=armv7 target_subarch=arm32" GYP_CROSSCOMPILE
=1 GYP_GENERATOR_FLAGS="output_dir=out_ios" ./gyp_libyuv | 118 GYP_DEFINES="OS=ios target_arch=armv7 target_subarch=arm32" GYP_CROSSCOMPILE
=1 GYP_GENERATOR_FLAGS="output_dir=out_ios" ./gyp_libyuv |
113 ninja -j7 -C out_ios/Debug-iphoneos libyuv_unittest | 119 ninja -j7 -C out_ios/Debug-iphoneos libyuv_unittest |
114 ninja -j7 -C out_ios/Release-iphoneos libyuv_unittest | 120 ninja -j7 -C out_ios/Release-iphoneos libyuv_unittest |
115 | 121 |
(...skipping 15 matching lines...) Expand all Loading... |
131 ninja -j7 -C out_sim/Debug-iphonesimulator libyuv_unittest | 137 ninja -j7 -C out_sim/Debug-iphonesimulator libyuv_unittest |
132 ninja -j7 -C out_sim/Release-iphonesimulator libyuv_unittest | 138 ninja -j7 -C out_sim/Release-iphonesimulator libyuv_unittest |
133 | 139 |
134 ### Android | 140 ### Android |
135 https://code.google.com/p/chromium/wiki/AndroidBuildInstructions | 141 https://code.google.com/p/chromium/wiki/AndroidBuildInstructions |
136 | 142 |
137 Add to .gclient last line: `target_os=['android'];` | 143 Add to .gclient last line: `target_os=['android'];` |
138 | 144 |
139 armv7 | 145 armv7 |
140 | 146 |
141 GYP_DEFINES="OS=android" GYP_CROSSCOMPILE=1 ./gyp_libyuv | 147 gn gen out/Release "--args=is_debug=false target_os=\"android\" target_cpu=\
"arm\"" |
142 ninja -j7 -C out/Debug yuv_unittest_apk | 148 gn gen out/Debug "--args=is_debug=true target_os=\"android\" target_cpu=\"ar
m\"" |
143 ninja -j7 -C out/Release yuv_unittest_apk | 149 ninja -j7 -v -C out/Debug libyuv_unittest |
| 150 ninja -j7 -v -C out/Release libyuv_unittest |
144 | 151 |
145 arm64 | 152 arm64 |
146 | 153 |
147 GYP_DEFINES="OS=android target_arch=arm64 target_subarch=arm64" GYP_CROSSCOM
PILE=1 ./gyp_libyuv | 154 gn gen out/Release "--args=is_debug=false target_os=\"android\" target_cpu=\
"arm64\"" |
148 ninja -j7 -C out/Debug yuv_unittest_apk | 155 gn gen out/Debug "--args=is_debug=true target_os=\"android\" target_cpu=\"ar
m64\"" |
149 ninja -j7 -C out/Release yuv_unittest_apk | 156 ninja -j7 -v -C out/Debug libyuv_unittest |
| 157 ninja -j7 -v -C out/Release libyuv_unittest |
150 | 158 |
151 ia32 | 159 ia32 |
152 | 160 |
153 GYP_DEFINES="OS=android target_arch=ia32" GYP_CROSSCOMPILE=1 ./gyp_libyuv | 161 gn gen out/Release "--args=is_debug=false target_os=\"android\" target_cpu=\
"x86\"" |
154 ninja -j7 -C out/Debug yuv_unittest_apk | 162 gn gen out/Debug "--args=is_debug=true target_os=\"android\" target_cpu=\"x8
6\"" |
155 ninja -j7 -C out/Release yuv_unittest_apk | 163 ninja -j7 -v -C out/Debug libyuv_unittest |
156 | 164 ninja -j7 -v -C out/Release libyuv_unittest |
157 GYP_DEFINES="OS=android target_arch=ia32 android_full_debug=1" GYP_CROSSCOMP
ILE=1 ./gyp_libyuv | |
158 ninja -j7 -C out/Debug yuv_unittest_apk | |
159 | 165 |
160 mipsel | 166 mipsel |
161 | 167 |
162 GYP_DEFINES="OS=android target_arch=mipsel" GYP_CROSSCOMPILE=1 ./gyp_libyuv | 168 gn gen out/Release "--args=is_debug=false target_os=\"android\" target_cpu=\
"mipsel\" mips_arch_variant=\"r6\" mips_use_msa=true is_component_build=true is_
clang=false" |
163 ninja -j7 -C out/Debug yuv_unittest_apk | 169 gn gen out/Debug "--args=is_debug=true target_os=\"android\" target_cpu=\"mi
psel\"" mips_arch_variant=\"r6\" mips_use_msa=true is_component_build=true is_cl
ang=false" |
164 ninja -j7 -C out/Release yuv_unittest_apk | 170 ninja -j7 -v -C out/Debug libyuv_unittest |
| 171 ninja -j7 -v -C out/Release libyuv_unittest |
165 | 172 |
166 arm32 disassembly: | 173 gn gen out/Release "--args=is_debug=false target_os=\"android\" target_cpu=\
"mips64el\"" mips_arch_variant=\"r6\" mips_use_msa=true is_component_build=true
is_clang=false" |
| 174 gn gen out/Debug "--args=is_debug=true target_os=\"android\" target_cpu=\"mi
ps64el\"" mips_arch_variant=\"r6\" mips_use_msa=true is_component_build=true is_
clang=false" |
| 175 ninja -j7 -v -C out/Debug libyuv_unittest |
| 176 ninja -j7 -v -C out/Release libyuv_unittest |
167 | 177 |
168 third_party/android_tools/ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/
linux-x86_64/bin/arm-linux-androideabi-objdump -d out/Release/obj/source/libyuv.
row_neon.o | 178 arm disassembly: |
169 | 179 |
170 arm64 disassembly: | 180 third_party/android_tools/ndk/toolchains/aarch64-linux-android-4.9/prebuilt/
linux-x86_64/bin/aarch64-linux-android-objdump -d ./out/Release/obj/libyuv/row_c
ommon.o >row_common.txt |
171 | 181 |
172 third_party/android_tools/ndk/toolchains/aarch64-linux-android-4.9/prebuilt/
linux-x86_64/bin/aarch64-linux-android-objdump -d out/Release/obj/source/libyuv.
row_neon64.o | 182 third_party/android_tools/ndk/toolchains/aarch64-linux-android-4.9/prebuilt/
linux-x86_64/bin/aarch64-linux-android-objdump -d ./out/Release/obj/libyuv_neon/
row_neon.o >row_neon.txt |
| 183 |
| 184 third_party/android_tools/ndk/toolchains/aarch64-linux-android-4.9/prebuilt/
linux-x86_64/bin/aarch64-linux-android-objdump -d ./out/Release/obj/libyuv_neon/
row_neon64.o >row_neon64.txt |
173 | 185 |
174 Running tests: | 186 Running tests: |
175 | 187 |
176 util/android/test_runner.py gtest -s libyuv_unittest -t 7200 --verbose --rel
ease --gtest_filter=* | 188 util/android/test_runner.py gtest -s libyuv_unittest -t 7200 --verbose --rel
ease --gtest_filter=* |
177 | 189 |
178 Running test as benchmark: | 190 Running test as benchmark: |
179 | 191 |
180 util/android/test_runner.py gtest -s libyuv_unittest -t 7200 --verbose --rel
ease --gtest_filter=* -a "--libyuv_width=1280 --libyuv_height=720 --libyuv_repea
t=999 --libyuv_flags=-1" | 192 util/android/test_runner.py gtest -s libyuv_unittest -t 7200 --verbose --rel
ease --gtest_filter=* -a "--libyuv_width=1280 --libyuv_height=720 --libyuv_repea
t=999 --libyuv_flags=-1 --libyuv_cpu_info=-1" |
181 | 193 |
182 Running test with C code: | 194 Running test with C code: |
183 | 195 |
184 util/android/test_runner.py gtest -s libyuv_unittest -t 7200 --verbose --rel
ease --gtest_filter=* -a "--libyuv_width=1280 --libyuv_height=720 --libyuv_repea
t=999 --libyuv_flags=1 --libyuv_cpu_info=1" | 196 util/android/test_runner.py gtest -s libyuv_unittest -t 7200 --verbose --rel
ease --gtest_filter=* -a "--libyuv_width=1280 --libyuv_height=720 --libyuv_repea
t=999 --libyuv_flags=1 --libyuv_cpu_info=1" |
185 | 197 |
186 #### Building with GN | |
187 | |
188 gn gen out/Release "--args=is_debug=false target_cpu=\"x86\"" | |
189 gn gen out/Debug "--args=is_debug=true target_cpu=\"x86\"" | |
190 ninja -C out/Release | |
191 ninja -C out/Debug | |
192 | |
193 ### Building Offical with GN | |
194 | |
195 gn gen out/Official "--args=is_debug=false is_official_build=true is_chrome_
branded=true" | |
196 ninja -C out/Official | |
197 | |
198 #### Building mips with GN | |
199 | |
200 mipsel | |
201 gn gen out/Default "--args=is_debug=false target_cpu=\"mipsel\" target_os =
\"android\" mips_arch_variant = \"r6\" mips_use_msa = true is_component_build =
true is_clang = false" | |
202 ninja -C out/Default | |
203 | |
204 mips64el | |
205 gn gen out/Default "--args=is_debug=false target_cpu=\"mips64el\" target_os
= \"android\" mips_arch_variant = \"r6\" mips_use_msa = true is_component_build
= true is_clang = false" | |
206 ninja -C out/Default | |
207 | |
208 ### Linux | |
209 | |
210 GYP_DEFINES="target_arch=x64" ./gyp_libyuv | |
211 ninja -j7 -C out/Debug | |
212 ninja -j7 -C out/Release | |
213 | |
214 GYP_DEFINES="target_arch=ia32" ./gyp_libyuv | |
215 ninja -j7 -C out/Debug | |
216 ninja -j7 -C out/Release | |
217 | |
218 #### CentOS | |
219 | |
220 On CentOS 32 bit the following work around allows a sync: | |
221 | |
222 export GYP_DEFINES="host_arch=ia32" | |
223 gclient sync | |
224 | |
225 ### Windows Shared Library | |
226 | |
227 Modify libyuv.gyp from 'static_library' to 'shared_library', and add 'LIBYUV_BUI
LDING_SHARED_LIBRARY' to 'defines'. | |
228 | |
229 gclient runhooks | |
230 | |
231 After this command follow the building the library instructions above. | |
232 | |
233 If you get a compile error for atlthunk.lib on Windows, read http://www.chromium
.org/developers/how-tos/build-instructions-windows | |
234 | |
235 | |
236 ### Build targets | 198 ### Build targets |
237 | 199 |
238 ninja -C out/Debug libyuv | 200 ninja -C out/Debug libyuv |
239 ninja -C out/Debug libyuv_unittest | 201 ninja -C out/Debug libyuv_unittest |
240 ninja -C out/Debug compare | 202 ninja -C out/Debug compare |
241 ninja -C out/Debug convert | 203 ninja -C out/Debug convert |
242 ninja -C out/Debug psnr | 204 ninja -C out/Debug psnr |
243 ninja -C out/Debug cpuid | 205 ninja -C out/Debug cpuid |
244 | 206 |
| 207 ### ARM Linux |
| 208 |
| 209 gn gen out/Release "--args=is_debug=false target_cpu=\"arm64\"" |
| 210 gn gen out/Debug "--args=is_debug=true target_cpu=\"arm64\"" |
| 211 ninja -j7 -v -C out/Debug libyuv_unittest |
| 212 ninja -j7 -v -C out/Release libyuv_unittest |
245 | 213 |
246 ## Building the Library with make | 214 ## Building the Library with make |
247 | 215 |
248 ### Linux | 216 ### Linux |
249 | 217 |
250 make -j7 V=1 -f linux.mk | 218 make -j7 V=1 -f linux.mk |
251 make -j7 V=1 -f linux.mk clean | 219 make -j7 V=1 -f linux.mk clean |
252 make -j7 V=1 -f linux.mk CXX=clang++ | 220 make -j7 V=1 -f linux.mk CXX=clang++ |
253 | 221 |
254 ## Building the Library with cmake | 222 ## Building the Library with cmake |
255 | 223 |
256 Install cmake: http://www.cmake.org/ | 224 Install cmake: http://www.cmake.org/ |
257 | 225 |
258 Default debug build: | 226 Default debug build: |
259 | 227 |
260 mkdir out | 228 mkdir out |
261 cd out | 229 cd out |
262 cmake .. | 230 cmake .. |
263 cmake --build . | 231 cmake --build . |
264 | 232 |
265 Release build/install | 233 Release build/install |
266 | 234 |
267 mkdir out | 235 mkdir out |
268 cd out | 236 cd out |
269 cmake -DCMAKE_INSTALL_PREFIX="/usr/lib" -DCMAKE_BUILD_TYPE="Release" .. | 237 cmake -DCMAKE_INSTALL_PREFIX="/usr/lib" -DCMAKE_BUILD_TYPE="Release" .. |
270 cmake --build . --config Release | 238 cmake --build . --config Release |
271 sudo cmake --build . --target install --config Release | 239 sudo cmake --build . --target install --config Release |
272 | 240 |
273 ### Windows 8 Phone | |
274 | |
275 Pre-requisite: | |
276 | |
277 * Install Visual Studio 2012 and Arm to your environment.<br> | |
278 | |
279 Then: | |
280 | |
281 call "c:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\x86_arm\vcv
arsx86_arm.bat" | |
282 | |
283 or with Visual Studio 2013: | |
284 | |
285 call "c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\x86_arm\vcv
arsx86_arm.bat" | |
286 nmake /f winarm.mk clean | |
287 nmake /f winarm.mk | |
288 | |
289 ### Windows Shared Library | |
290 | |
291 Modify libyuv.gyp from 'static_library' to 'shared_library', and add 'LIBYUV_BUI
LDING_SHARED_LIBRARY' to 'defines'. Then run this. | |
292 | |
293 gclient runhooks | |
294 | |
295 After this command follow the building the library instructions above. | |
296 | |
297 If you get a compile error for atlthunk.lib on Windows, read http://www.chromium
.org/developers/how-tos/build-instructions-windows | |
298 | |
299 ### 64 bit Windows | |
300 | |
301 set GYP_DEFINES=target_arch=x64 | |
302 gclient runhooks V=1 | |
303 | |
304 ### ARM Linux | |
305 | |
306 export GYP_DEFINES="target_arch=arm" | |
307 export CROSSTOOL=`<path>`/arm-none-linux-gnueabi | |
308 export CXX=$CROSSTOOL-g++ | |
309 export CC=$CROSSTOOL-gcc | |
310 export AR=$CROSSTOOL-ar | |
311 export AS=$CROSSTOOL-as | |
312 export RANLIB=$CROSSTOOL-ranlib | |
313 gclient runhooks | |
314 | |
315 ## Running Unittests | 241 ## Running Unittests |
316 | 242 |
317 ### Windows | 243 ### Windows |
318 | 244 |
319 out\Release\libyuv_unittest.exe --gtest_catch_exceptions=0 --gtest_filter="*
" | 245 out\Release\libyuv_unittest.exe --gtest_catch_exceptions=0 --gtest_filter="*
" |
320 | 246 |
321 ### OSX | 247 ### OSX |
322 | 248 |
323 out/Release/libyuv_unittest --gtest_filter="*" | 249 out/Release/libyuv_unittest --gtest_filter="*" |
324 | 250 |
325 ### Linux | 251 ### Linux |
326 | 252 |
327 out/Release/libyuv_unittest --gtest_filter="*" | 253 out/Release/libyuv_unittest --gtest_filter="*" |
328 | 254 |
329 Replace --gtest_filter="*" with specific unittest to run. May include wildcards
. e.g. | 255 Replace --gtest_filter="*" with specific unittest to run. May include wildcards
. e.g. |
330 | 256 |
331 out/Release/libyuv_unittest --gtest_filter=libyuvTest.I420ToARGB_Opt | 257 out/Release/libyuv_unittest --gtest_filter=*I420ToARGB_Opt |
332 | 258 |
333 ## CPU Emulator tools | 259 ## CPU Emulator tools |
334 | 260 |
335 ### Intel SDE (Software Development Emulator) | 261 ### Intel SDE (Software Development Emulator) |
336 | 262 |
337 Pre-requisite: Install IntelSDE for Windows: http://software.intel.com/en-us/art
icles/intel-software-development-emulator | 263 Pre-requisite: Install IntelSDE: http://software.intel.com/en-us/articles/intel-
software-development-emulator |
338 | 264 |
339 Then run: | 265 Then run: |
340 | 266 |
341 c:\intelsde\sde -hsw -- out\release\libyuv_unittest.exe --gtest_filter=* | 267 c:\intelsde\sde -hsw -- out\Release\libyuv_unittest.exe --gtest_filter=* |
342 | 268 |
| 269 ~/intelsde/sde -skx -- out/Release/libyuv_unittest --gtest_filter=**I420ToAR
GB_Opt |
343 | 270 |
344 ## Memory tools | 271 ## Sanitizers |
| 272 |
| 273 gn gen out/Debug "--args=is_debug=true is_asan=true" |
| 274 ninja -j7 -v -C out/Debug |
| 275 |
| 276 Sanitizers available: tsan, msan, asan, ubsan, lsan |
345 | 277 |
346 ### Running Dr Memory memcheck for Windows | 278 ### Running Dr Memory memcheck for Windows |
347 | 279 |
348 Pre-requisite: Install Dr Memory for Windows and add it to your path: http://www
.drmemory.org/docs/page_install_windows.html | 280 Pre-requisite: Install Dr Memory for Windows and add it to your path: http://www
.drmemory.org/docs/page_install_windows.html |
349 | 281 |
350 set GYP_DEFINES=build_for_tool=drmemory target_arch=ia32 | |
351 call python gyp_libyuv -fninja -G msvs_version=2013 | |
352 ninja -C out\Debug | |
353 drmemory out\Debug\libyuv_unittest.exe --gtest_catch_exceptions=0 --gtest_fi
lter=* | 282 drmemory out\Debug\libyuv_unittest.exe --gtest_catch_exceptions=0 --gtest_fi
lter=* |
354 | |
355 ### Running UBSan | |
356 | |
357 See Chromium instructions for sanitizers: https://www.chromium.org/developers/te
sting/undefinedbehaviorsanitizer | |
358 | |
359 Sanitizers available: TSan, MSan, ASan, UBSan, LSan | |
360 | |
361 GYP_DEFINES='ubsan=1' gclient runhooks | |
362 ninja -C out/Release | |
363 | |
364 ### Running Valgrind memcheck | |
365 | |
366 Memory errors and race conditions can be found by running tests under special me
mory tools. [Valgrind] [1] is an instrumentation framework for building dynamic
analysis tools. Various tests and profilers are built upon it to find memory han
dling errors and memory leaks, for instance. | |
367 | |
368 [1]: http://valgrind.org | |
369 | |
370 solutions = [ | |
371 { "name" : "libyuv", | |
372 "url" : "https://chromium.googlesource.com/libyuv/libyuv", | |
373 "deps_file" : "DEPS", | |
374 "managed" : True, | |
375 "custom_deps" : { | |
376 "libyuv/chromium/src/third_party/valgrind": "https://chromium.googles
ource.com/chromium/deps/valgrind/binaries", | |
377 }, | |
378 "safesync_url": "", | |
379 }, | |
380 ] | |
381 | |
382 Then run: | |
383 | |
384 GYP_DEFINES="clang=0 target_arch=x64 build_for_tool=memcheck" python gyp_lib
yuv | |
385 ninja -C out/Debug | |
386 valgrind out/Debug/libyuv_unittest | |
387 | |
388 | |
389 For more information, see http://www.chromium.org/developers/how-tos/using-valgr
ind | |
390 | |
391 ### Running Thread Sanitizer (TSan) | |
392 | |
393 GYP_DEFINES="clang=0 target_arch=x64 build_for_tool=tsan" python gyp_libyuv | |
394 ninja -C out/Debug | |
395 valgrind out/Debug/libyuv_unittest | |
396 | |
397 For more info, see http://www.chromium.org/developers/how-tos/using-valgrind/thr
eadsanitizer | |
398 | |
399 ### Running Address Sanitizer (ASan) | |
400 | |
401 GYP_DEFINES="clang=0 target_arch=x64 build_for_tool=asan" python gyp_libyuv | |
402 ninja -C out/Debug | |
403 valgrind out/Debug/libyuv_unittest | |
404 | |
405 For more info, see http://dev.chromium.org/developers/testing/addresssanitizer | |
406 | |
407 ## Benchmarking | |
408 | |
409 The unittests can be used to benchmark. | |
410 | |
411 ### Windows | |
412 | |
413 set LIBYUV_WIDTH=1280 | |
414 set LIBYUV_HEIGHT=720 | |
415 set LIBYUV_REPEAT=999 | |
416 set LIBYUV_FLAGS=-1 | |
417 out\Release\libyuv_unittest.exe --gtest_filter=*I420ToARGB_Opt | |
418 | |
419 | |
420 ### Linux and Mac | |
421 | |
422 LIBYUV_WIDTH=1280 LIBYUV_HEIGHT=720 LIBYUV_REPEAT=1000 out/Release/libyuv_un
ittest --gtest_filter=*I420ToARGB_Opt | |
423 | |
424 libyuvTest.I420ToARGB_Opt (547 ms) | |
425 | |
426 Indicates 0.547 ms/frame for 1280 x 720. | |
427 | |
428 ## Making a change | |
429 | |
430 gclient sync | |
431 git checkout -b mycl -t origin/master | |
432 git pull | |
433 <edit files> | |
434 git add -u | |
435 git commit -m "my change" | |
436 git cl lint | |
437 git cl try | |
438 git cl upload -r a-reviewer@chomium.org -s | |
439 <once approved..> | |
440 git cl land | |
OLD | NEW |