summaryrefslogtreecommitdiff
path: root/media/libyuv/docs
diff options
context:
space:
mode:
Diffstat (limited to 'media/libyuv/docs')
-rw-r--r--media/libyuv/docs/deprecated_builds.md441
-rw-r--r--media/libyuv/docs/environment_variables.md24
-rw-r--r--media/libyuv/docs/formats.md113
-rw-r--r--media/libyuv/docs/getting_started.md386
-rw-r--r--media/libyuv/docs/rotation.md4
5 files changed, 682 insertions, 286 deletions
diff --git a/media/libyuv/docs/deprecated_builds.md b/media/libyuv/docs/deprecated_builds.md
new file mode 100644
index 0000000000..ba42966cc2
--- /dev/null
+++ b/media/libyuv/docs/deprecated_builds.md
@@ -0,0 +1,441 @@
+# Deprecated Builds
+
+Older documentation on build configs which are no longer supported.
+
+## Pre-requisites
+
+You'll need to have depot tools installed: https://www.chromium.org/developers/how-tos/install-depot-tools
+Refer to chromium instructions for each platform for other prerequisites.
+
+## Getting the Code
+
+Create a working directory, enter it, and run:
+
+ gclient config https://chromium.googlesource.com/libyuv/libyuv
+ gclient sync
+
+
+Then you'll get a .gclient file like:
+
+ solutions = [
+ { "name" : "libyuv",
+ "url" : "https://chromium.googlesource.com/libyuv/libyuv",
+ "deps_file" : "DEPS",
+ "managed" : True,
+ "custom_deps" : {
+ },
+ "safesync_url": "",
+ },
+ ];
+
+
+For iOS add `;target_os=['ios'];` to your OSX .gclient and run `GYP_DEFINES="OS=ios" gclient sync.`
+
+Browse the Git reprository: https://chromium.googlesource.com/libyuv/libyuv/+/master
+
+### Android
+For Android add `;target_os=['android'];` to your Linux .gclient
+
+
+ solutions = [
+ { "name" : "libyuv",
+ "url" : "https://chromium.googlesource.com/libyuv/libyuv",
+ "deps_file" : "DEPS",
+ "managed" : True,
+ "custom_deps" : {
+ },
+ "safesync_url": "",
+ },
+ ];
+ target_os = ["android", "unix"];
+
+Then run:
+
+ export GYP_DEFINES="OS=android"
+ gclient sync
+
+Caveat: Theres an error with Google Play services updates. If you get the error "Your version of the Google Play services library is not up to date", run the following:
+
+ cd chromium/src
+ ./build/android/play_services/update.py download
+ cd ../..
+
+For Windows the gclient sync must be done from an Administrator command prompt.
+
+The sync will generate native build files for your environment using gyp (Windows: Visual Studio, OSX: XCode, Linux: make). This generation can also be forced manually: `gclient runhooks`
+
+To get just the source (not buildable):
+
+ git clone https://chromium.googlesource.com/libyuv/libyuv
+
+
+## Building the Library and Unittests
+
+### Windows
+
+ set GYP_DEFINES=target_arch=ia32
+ call python gyp_libyuv -fninja -G msvs_version=2013
+ ninja -j7 -C out\Release
+ ninja -j7 -C out\Debug
+
+ set GYP_DEFINES=target_arch=x64
+ call python gyp_libyuv -fninja -G msvs_version=2013
+ ninja -C out\Debug_x64
+ ninja -C out\Release_x64
+
+#### Building with clangcl
+ set GYP_DEFINES=clang=1 target_arch=ia32
+ call python tools\clang\scripts\update.py
+ call python gyp_libyuv -fninja libyuv_test.gyp
+ ninja -C out\Debug
+ ninja -C out\Release
+
+### OSX
+
+Clang 64 bit shown. Remove `clang=1` for GCC and change x64 to ia32 for 32 bit.
+
+ GYP_DEFINES="clang=1 target_arch=x64" ./gyp_libyuv
+ ninja -j7 -C out/Debug
+ ninja -j7 -C out/Release
+
+ GYP_DEFINES="clang=1 target_arch=ia32" ./gyp_libyuv
+ ninja -j7 -C out/Debug
+ ninja -j7 -C out/Release
+
+### iOS
+http://www.chromium.org/developers/how-tos/build-instructions-ios
+
+Add to .gclient last line: `target_os=['ios'];`
+
+armv7
+
+ GYP_DEFINES="OS=ios target_arch=armv7 target_subarch=arm32" GYP_CROSSCOMPILE=1 GYP_GENERATOR_FLAGS="output_dir=out_ios" ./gyp_libyuv
+ ninja -j7 -C out_ios/Debug-iphoneos libyuv_unittest
+ ninja -j7 -C out_ios/Release-iphoneos libyuv_unittest
+
+arm64
+
+ GYP_DEFINES="OS=ios target_arch=arm64 target_subarch=arm64" GYP_CROSSCOMPILE=1 GYP_GENERATOR_FLAGS="output_dir=out_ios" ./gyp_libyuv
+ ninja -j7 -C out_ios/Debug-iphoneos libyuv_unittest
+ ninja -j7 -C out_ios/Release-iphoneos libyuv_unittest
+
+both armv7 and arm64 (fat)
+
+ GYP_DEFINES="OS=ios target_arch=armv7 target_subarch=both" GYP_CROSSCOMPILE=1 GYP_GENERATOR_FLAGS="output_dir=out_ios" ./gyp_libyuv
+ ninja -j7 -C out_ios/Debug-iphoneos libyuv_unittest
+ ninja -j7 -C out_ios/Release-iphoneos libyuv_unittest
+
+simulator
+
+ GYP_DEFINES="OS=ios target_arch=ia32 target_subarch=arm32" GYP_CROSSCOMPILE=1 GYP_GENERATOR_FLAGS="output_dir=out_sim" ./gyp_libyuv
+ ninja -j7 -C out_sim/Debug-iphonesimulator libyuv_unittest
+ ninja -j7 -C out_sim/Release-iphonesimulator libyuv_unittest
+
+### Android
+https://code.google.com/p/chromium/wiki/AndroidBuildInstructions
+
+Add to .gclient last line: `target_os=['android'];`
+
+armv7
+
+ GYP_DEFINES="OS=android" GYP_CROSSCOMPILE=1 ./gyp_libyuv
+ ninja -j7 -C out/Debug yuv_unittest_apk
+ ninja -j7 -C out/Release yuv_unittest_apk
+
+arm64
+
+ GYP_DEFINES="OS=android target_arch=arm64 target_subarch=arm64" GYP_CROSSCOMPILE=1 ./gyp_libyuv
+ ninja -j7 -C out/Debug yuv_unittest_apk
+ ninja -j7 -C out/Release yuv_unittest_apk
+
+ia32
+
+ GYP_DEFINES="OS=android target_arch=ia32" GYP_CROSSCOMPILE=1 ./gyp_libyuv
+ ninja -j7 -C out/Debug yuv_unittest_apk
+ ninja -j7 -C out/Release yuv_unittest_apk
+
+ GYP_DEFINES="OS=android target_arch=ia32 android_full_debug=1" GYP_CROSSCOMPILE=1 ./gyp_libyuv
+ ninja -j7 -C out/Debug yuv_unittest_apk
+
+mipsel
+
+ GYP_DEFINES="OS=android target_arch=mipsel" GYP_CROSSCOMPILE=1 ./gyp_libyuv
+ ninja -j7 -C out/Debug yuv_unittest_apk
+ ninja -j7 -C out/Release yuv_unittest_apk
+
+arm32 disassembly:
+
+ third_party/android_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
+
+arm64 disassembly:
+
+ third_party/android_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
+
+Running tests:
+
+ build/android/test_runner.py gtest -s libyuv_unittest -t 7200 --verbose --release --gtest_filter=*
+
+Running test as benchmark:
+
+ build/android/test_runner.py gtest -s libyuv_unittest -t 7200 --verbose --release --gtest_filter=* -a "--libyuv_width=1280 --libyuv_height=720 --libyuv_repeat=999 --libyuv_flags=-1"
+
+Running test with C code:
+
+ build/android/test_runner.py gtest -s libyuv_unittest -t 7200 --verbose --release --gtest_filter=* -a "--libyuv_width=1280 --libyuv_height=720 --libyuv_repeat=999 --libyuv_flags=1 --libyuv_cpu_info=1"
+
+#### Building with GN
+
+ gn gen out/Release "--args=is_debug=false target_cpu=\"x86\""
+ gn gen out/Debug "--args=is_debug=true target_cpu=\"x86\""
+ ninja -C out/Release
+ ninja -C out/Debug
+
+### Building Offical with GN
+
+ gn gen out/Official "--args=is_debug=false is_official_build=true is_chrome_branded=true"
+ ninja -C out/Official
+
+#### Building mips with GN
+
+mipsel
+ 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"
+ ninja -C out/Default
+
+mips64el
+ 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"
+ ninja -C out/Default
+
+### Linux
+
+ GYP_DEFINES="target_arch=x64" ./gyp_libyuv
+ ninja -j7 -C out/Debug
+ ninja -j7 -C out/Release
+
+ GYP_DEFINES="target_arch=ia32" ./gyp_libyuv
+ ninja -j7 -C out/Debug
+ ninja -j7 -C out/Release
+
+#### CentOS
+
+On CentOS 32 bit the following work around allows a sync:
+
+ export GYP_DEFINES="host_arch=ia32"
+ gclient sync
+
+### Windows Shared Library
+
+Modify libyuv.gyp from 'static_library' to 'shared_library', and add 'LIBYUV_BUILDING_SHARED_LIBRARY' to 'defines'.
+
+ gclient runhooks
+
+After this command follow the building the library instructions above.
+
+If you get a compile error for atlthunk.lib on Windows, read http://www.chromium.org/developers/how-tos/build-instructions-windows
+
+
+### Build targets
+
+ ninja -C out/Debug libyuv
+ ninja -C out/Debug libyuv_unittest
+ ninja -C out/Debug compare
+ ninja -C out/Debug yuvconvert
+ ninja -C out/Debug yuvconstants
+ ninja -C out/Debug psnr
+ ninja -C out/Debug cpuid
+
+
+## Building the Library with make
+
+### Linux
+
+ make -j7 V=1 -f linux.mk
+ make -j7 V=1 -f linux.mk clean
+ make -j7 V=1 -f linux.mk CXX=clang++
+
+## Building the Library with cmake
+
+Install cmake: http://www.cmake.org/
+
+Default debug build:
+
+ mkdir out
+ cd out
+ cmake ..
+ cmake --build .
+
+Release build/install
+
+ mkdir out
+ cd out
+ cmake -DCMAKE_INSTALL_PREFIX="/usr/lib" -DCMAKE_BUILD_TYPE="Release" ..
+ cmake --build . --config Release
+ sudo cmake --build . --target install --config Release
+
+### Windows 8 Phone
+
+Pre-requisite:
+
+* Install Visual Studio 2012 and Arm to your environment.<br>
+
+Then:
+
+ call "c:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\x86_arm\vcvarsx86_arm.bat"
+
+or with Visual Studio 2013:
+
+ call "c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\x86_arm\vcvarsx86_arm.bat"
+ nmake /f winarm.mk clean
+ nmake /f winarm.mk
+
+### Windows Shared Library
+
+Modify libyuv.gyp from 'static_library' to 'shared_library', and add 'LIBYUV_BUILDING_SHARED_LIBRARY' to 'defines'. Then run this.
+
+ gclient runhooks
+
+After this command follow the building the library instructions above.
+
+If you get a compile error for atlthunk.lib on Windows, read http://www.chromium.org/developers/how-tos/build-instructions-windows
+
+### 64 bit Windows
+
+ set GYP_DEFINES=target_arch=x64
+ gclient runhooks V=1
+
+### ARM Linux
+
+ export GYP_DEFINES="target_arch=arm"
+ export CROSSTOOL=`<path>`/arm-none-linux-gnueabi
+ export CXX=$CROSSTOOL-g++
+ export CC=$CROSSTOOL-gcc
+ export AR=$CROSSTOOL-ar
+ export AS=$CROSSTOOL-as
+ export RANLIB=$CROSSTOOL-ranlib
+ gclient runhooks
+
+## Running Unittests
+
+### Windows
+
+ out\Release\libyuv_unittest.exe --gtest_catch_exceptions=0 --gtest_filter="*"
+
+### OSX
+
+ out/Release/libyuv_unittest --gtest_filter="*"
+
+### Linux
+
+ out/Release/libyuv_unittest --gtest_filter="*"
+
+Replace --gtest_filter="*" with specific unittest to run. May include wildcards. e.g.
+
+ out/Release/libyuv_unittest --gtest_filter=libyuvTest.I420ToARGB_Opt
+
+## CPU Emulator tools
+
+### Intel SDE (Software Development Emulator)
+
+Pre-requisite: Install IntelSDE for Windows: http://software.intel.com/en-us/articles/intel-software-development-emulator
+
+Then run:
+
+ c:\intelsde\sde -hsw -- out\release\libyuv_unittest.exe --gtest_filter=*
+
+
+## Memory tools
+
+### Running Dr Memory memcheck for Windows
+
+Pre-requisite: Install Dr Memory for Windows and add it to your path: http://www.drmemory.org/docs/page_install_windows.html
+
+ set GYP_DEFINES=build_for_tool=drmemory target_arch=ia32
+ call python gyp_libyuv -fninja -G msvs_version=2013
+ ninja -C out\Debug
+ drmemory out\Debug\libyuv_unittest.exe --gtest_catch_exceptions=0 --gtest_filter=*
+
+### Running UBSan
+
+See Chromium instructions for sanitizers: https://www.chromium.org/developers/testing/undefinedbehaviorsanitizer
+
+Sanitizers available: TSan, MSan, ASan, UBSan, LSan
+
+ GYP_DEFINES='ubsan=1' gclient runhooks
+ ninja -C out/Release
+
+### Running Valgrind memcheck
+
+Memory errors and race conditions can be found by running tests under special memory tools. [Valgrind] [1] is an instrumentation framework for building dynamic analysis tools. Various tests and profilers are built upon it to find memory handling errors and memory leaks, for instance.
+
+[1]: http://valgrind.org
+
+ solutions = [
+ { "name" : "libyuv",
+ "url" : "https://chromium.googlesource.com/libyuv/libyuv",
+ "deps_file" : "DEPS",
+ "managed" : True,
+ "custom_deps" : {
+ "libyuv/chromium/src/third_party/valgrind": "https://chromium.googlesource.com/chromium/deps/valgrind/binaries",
+ },
+ "safesync_url": "",
+ },
+ ]
+
+Then run:
+
+ GYP_DEFINES="clang=0 target_arch=x64 build_for_tool=memcheck" python gyp_libyuv
+ ninja -C out/Debug
+ valgrind out/Debug/libyuv_unittest
+
+
+For more information, see http://www.chromium.org/developers/how-tos/using-valgrind
+
+### Running Thread Sanitizer (TSan)
+
+ GYP_DEFINES="clang=0 target_arch=x64 build_for_tool=tsan" python gyp_libyuv
+ ninja -C out/Debug
+ valgrind out/Debug/libyuv_unittest
+
+For more info, see http://www.chromium.org/developers/how-tos/using-valgrind/threadsanitizer
+
+### Running Address Sanitizer (ASan)
+
+ GYP_DEFINES="clang=0 target_arch=x64 build_for_tool=asan" python gyp_libyuv
+ ninja -C out/Debug
+ valgrind out/Debug/libyuv_unittest
+
+For more info, see http://dev.chromium.org/developers/testing/addresssanitizer
+
+## Benchmarking
+
+The unittests can be used to benchmark.
+
+### Windows
+
+ set LIBYUV_WIDTH=1280
+ set LIBYUV_HEIGHT=720
+ set LIBYUV_REPEAT=999
+ set LIBYUV_FLAGS=-1
+ out\Release\libyuv_unittest.exe --gtest_filter=*I420ToARGB_Opt
+
+
+### Linux and Mac
+
+ LIBYUV_WIDTH=1280 LIBYUV_HEIGHT=720 LIBYUV_REPEAT=1000 out/Release/libyuv_unittest --gtest_filter=*I420ToARGB_Opt
+
+ libyuvTest.I420ToARGB_Opt (547 ms)
+
+Indicates 0.547 ms/frame for 1280 x 720.
+
+## Making a change
+
+ gclient sync
+ git checkout -b mycl -t origin/master
+ git pull
+ <edit files>
+ git add -u
+ git commit -m "my change"
+ git cl lint
+ git cl try
+ git cl upload -r a-reviewer@chomium.org -s
+ <once approved..>
+ git cl land
diff --git a/media/libyuv/docs/environment_variables.md b/media/libyuv/docs/environment_variables.md
index 5802599e9d..dd5d59fbef 100644
--- a/media/libyuv/docs/environment_variables.md
+++ b/media/libyuv/docs/environment_variables.md
@@ -6,7 +6,10 @@ For test purposes, environment variables can be set to control libyuv behavior.
By default the cpu is detected and the most advanced form of SIMD is used. But you can disable instruction sets selectively, or completely, falling back on C code. Set the variable to 1 to disable the specified instruction set.
+## All CPUs
LIBYUV_DISABLE_ASM
+
+## Intel CPUs
LIBYUV_DISABLE_X86
LIBYUV_DISABLE_SSE2
LIBYUV_DISABLE_SSSE3
@@ -14,12 +17,29 @@ By default the cpu is detected and the most advanced form of SIMD is used. But
LIBYUV_DISABLE_SSE42
LIBYUV_DISABLE_AVX
LIBYUV_DISABLE_AVX2
- LIBYUV_DISABLE_AVX3
LIBYUV_DISABLE_ERMS
LIBYUV_DISABLE_FMA3
- LIBYUV_DISABLE_DSPR2
+ LIBYUV_DISABLE_F16C
+ LIBYUV_DISABLE_AVX512BW
+ LIBYUV_DISABLE_AVX512VL
+ LIBYUV_DISABLE_AVX512VNNI
+ LIBYUV_DISABLE_AVX512VBMI
+ LIBYUV_DISABLE_AVX512VBMI2
+ LIBYUV_DISABLE_AVX512VBITALG
+ LIBYUV_DISABLE_AVX512VPOPCNTDQ
+ LIBYUV_DISABLE_GFNI
+
+## ARM CPUs
+
LIBYUV_DISABLE_NEON
+## MIPS CPUs
+ LIBYUV_DISABLE_MSA
+
+## LOONGARCH CPUs
+ LIBYUV_DISABLE_LSX
+ LIBYUV_DISABLE_LASX
+
# Test Width/Height/Repeat
The unittests default to a small image (128x72) to run fast. This can be set by environment variable to test a specific resolutions.
diff --git a/media/libyuv/docs/formats.md b/media/libyuv/docs/formats.md
index a7cfed8218..12ea9465e4 100644
--- a/media/libyuv/docs/formats.md
+++ b/media/libyuv/docs/formats.md
@@ -4,7 +4,9 @@ Formats (FOURCC) supported by libyuv are detailed here.
# Core Formats
-There are 2 core formats supported by libyuv - I420 and ARGB. All YUV formats can be converted to/from I420. All RGB formats can be converted to/from ARGB.
+There are 2 core formats supported by libyuv - I420 and ARGB.
+ All YUV formats can be converted to/from I420.
+ All RGB formats can be converted to/from ARGB.
Filtering functions such as scaling and planar functions work on I420 and/or ARGB.
@@ -35,50 +37,53 @@ This is how OSX formats map to libyuv
# FOURCC (Four Charactacter Code) List
The following is extracted from video_common.h as a complete list of formats supported by libyuv.
-
enum FourCC {
- // 9 Primary YUV formats: 5 planar, 2 biplanar, 2 packed.
+ // 10 Primary YUV formats: 5 planar, 2 biplanar, 2 packed.
FOURCC_I420 = FOURCC('I', '4', '2', '0'),
FOURCC_I422 = FOURCC('I', '4', '2', '2'),
FOURCC_I444 = FOURCC('I', '4', '4', '4'),
- FOURCC_I411 = FOURCC('I', '4', '1', '1'),
FOURCC_I400 = FOURCC('I', '4', '0', '0'),
FOURCC_NV21 = FOURCC('N', 'V', '2', '1'),
FOURCC_NV12 = FOURCC('N', 'V', '1', '2'),
FOURCC_YUY2 = FOURCC('Y', 'U', 'Y', '2'),
FOURCC_UYVY = FOURCC('U', 'Y', 'V', 'Y'),
+ FOURCC_H010 = FOURCC('H', '0', '1', '0'), // unofficial fourcc. 10 bit lsb
+ FOURCC_U010 = FOURCC('U', '0', '1', '0'), // bt.2020, unofficial fourcc.
+ // 10 bit lsb
- // 2 Secondary YUV formats: row biplanar.
- FOURCC_M420 = FOURCC('M', '4', '2', '0'),
- FOURCC_Q420 = FOURCC('Q', '4', '2', '0'),
+ // 1 Secondary YUV format: row biplanar.
+ FOURCC_M420 = FOURCC('M', '4', '2', '0'), // deprecated.
- // 9 Primary RGB formats: 4 32 bpp, 2 24 bpp, 3 16 bpp.
+ // 13 Primary RGB formats: 4 32 bpp, 2 24 bpp, 3 16 bpp, 1 10 bpc, 2 64 bpp
FOURCC_ARGB = FOURCC('A', 'R', 'G', 'B'),
FOURCC_BGRA = FOURCC('B', 'G', 'R', 'A'),
FOURCC_ABGR = FOURCC('A', 'B', 'G', 'R'),
+ FOURCC_AR30 = FOURCC('A', 'R', '3', '0'), // 10 bit per channel. 2101010.
+ FOURCC_AB30 = FOURCC('A', 'B', '3', '0'), // ABGR version of 10 bit
+ FOURCC_AR64 = FOURCC('A', 'R', '6', '4'), // 16 bit per channel.
+ FOURCC_AB64 = FOURCC('A', 'B', '6', '4'), // ABGR version of 16 bit
FOURCC_24BG = FOURCC('2', '4', 'B', 'G'),
- FOURCC_RAW = FOURCC('r', 'a', 'w', ' '),
+ FOURCC_RAW = FOURCC('r', 'a', 'w', ' '),
FOURCC_RGBA = FOURCC('R', 'G', 'B', 'A'),
FOURCC_RGBP = FOURCC('R', 'G', 'B', 'P'), // rgb565 LE.
FOURCC_RGBO = FOURCC('R', 'G', 'B', 'O'), // argb1555 LE.
FOURCC_R444 = FOURCC('R', '4', '4', '4'), // argb4444 LE.
- // 4 Secondary RGB formats: 4 Bayer Patterns.
- FOURCC_RGGB = FOURCC('R', 'G', 'G', 'B'),
- FOURCC_BGGR = FOURCC('B', 'G', 'G', 'R'),
- FOURCC_GRBG = FOURCC('G', 'R', 'B', 'G'),
- FOURCC_GBRG = FOURCC('G', 'B', 'R', 'G'),
-
// 1 Primary Compressed YUV format.
FOURCC_MJPG = FOURCC('M', 'J', 'P', 'G'),
- // 5 Auxiliary YUV variations: 3 with U and V planes are swapped, 1 Alias.
+ // 11 Auxiliary YUV variations: 3 with U and V planes are swapped, 1 Alias.
FOURCC_YV12 = FOURCC('Y', 'V', '1', '2'),
FOURCC_YV16 = FOURCC('Y', 'V', '1', '6'),
FOURCC_YV24 = FOURCC('Y', 'V', '2', '4'),
FOURCC_YU12 = FOURCC('Y', 'U', '1', '2'), // Linux version of I420.
FOURCC_J420 = FOURCC('J', '4', '2', '0'),
- FOURCC_J400 = FOURCC('J', '4', '0', '0'),
+ FOURCC_J400 = FOURCC('J', '4', '0', '0'), // unofficial fourcc
+ FOURCC_H420 = FOURCC('H', '4', '2', '0'), // unofficial fourcc
+ FOURCC_H422 = FOURCC('H', '4', '2', '2'), // unofficial fourcc
+ FOURCC_U420 = FOURCC('U', '4', '2', '0'), // bt.2020, unofficial fourcc
+ FOURCC_U422 = FOURCC('U', '4', '2', '2'), // bt.2020, unofficial fourcc
+ FOURCC_U444 = FOURCC('U', '4', '4', '4'), // bt.2020, unofficial fourcc
// 14 Auxiliary aliases. CanonicalFourCC() maps these to canonical fourcc.
FOURCC_IYUV = FOURCC('I', 'Y', 'U', 'V'), // Alias for I420.
@@ -99,8 +104,35 @@ The following is extracted from video_common.h as a complete list of formats sup
FOURCC_L565 = FOURCC('L', '5', '6', '5'), // Alias for RGBP.
FOURCC_5551 = FOURCC('5', '5', '5', '1'), // Alias for RGBO.
- // 1 Auxiliary compressed YUV format set aside for capturer.
- FOURCC_H264 = FOURCC('H', '2', '6', '4'),
+# Planar YUV
+ The following formats contains a full size Y plane followed by 1 or 2
+ planes for UV: I420, I422, I444, I400, NV21, NV12, I400
+ The size (subsampling) of the UV varies.
+ I420, NV12 and NV21 are half width, half height
+ I422, NV16 and NV61 are half width, full height
+ I444, NV24 and NV42 are full width, full height
+ I400 and J400 have no chroma channel.
+
+# Color space
+ The YUV formats start with a letter to specify the color space. e.g. I420
+ I = BT.601 limited range
+ J = BT.601 full range (J = JPEG that uses this)
+ H = BT.709 limited range (H for HD)
+ F = BT.709 full range (F for Full range)
+ U = BT.2020 limited range (U for UHD)
+ V = BT.2020 full range
+ For YUV to RGB conversions, a matrix can be passed. See also convert_argh.h
+
+# HDR formats
+ Planar formats with 10 or 12 bits use the following fourcc:
+ I010, I012, P010, P012 are half width, half height
+ I210, I212, P210, P212 are half width, full height
+ I410, I412, P410, P412 are full width, full height
+ where
+ I is the color space (see above) and 3 planes: Y, U and V.
+ P is a biplanar format, similar to NV12 but 16 bits, with the valid bits in the high bits. There is a Y plane and a UV plane.
+ 0, 2 or 4 is the last digit of subsampling: 4:2:0, 4:2:2, or 4:4:4
+ 10 or 12 is the bits per channel. The bits are in the low bits of a 16 bit channel.
# The ARGB FOURCC
@@ -131,3 +163,46 @@ Some are channel order agnostic (e.g. ARGBScale).
Some functions are symmetric (e.g. ARGBToBGRA is the same as BGRAToARGB, so its a macro).
ARGBBlend expects preattenuated ARGB. The R,G,B are premultiplied by alpha. Other functions don't care.
+
+# RGB24 and RAW
+
+There are 2 RGB layouts - RGB24 (aka 24BG) and RAW
+
+RGB24 is B,G,R in memory
+RAW is R,G,B in memory
+
+# AR30 and XR30
+
+AR30 is 2 10 10 10 ARGB stored in little endian order.
+The 2 bit alpha has 4 values. Here are the comparable 8 bit alpha values.
+0 - 0. 00000000b = 0x00 = 0
+1 - 33%. 01010101b = 0x55 = 85
+2 - 66%. 10101010b = 0xaa = 170
+3 - 100%. 11111111b = 0xff = 255
+The 10 bit RGB values range from 0 to 1023.
+XR30 is the same as AR30 but with no alpha channel.
+
+# AB64 and AR64
+
+AB64 is similar to ABGR, with 16 bit (2 bytes) per channel. Each channel stores an unsigned short.
+In memory R is the lowest and A is the highest.
+Each channel has value ranges from 0 to 65535.
+AR64 is similar to ARGB.
+
+# NV12 and NV21
+
+NV12 is a biplanar format with a full sized Y plane followed by a single
+chroma plane with weaved U and V values.
+NV21 is the same but with weaved V and U values.
+The 12 in NV12 refers to 12 bits per pixel. NV12 has a half width and half
+height chroma channel, and therefore is a 420 subsampling.
+NV16 is 16 bits per pixel, with half width and full height. aka 422.
+NV24 is 24 bits per pixel with full sized chroma channel. aka 444.
+Most NV12 functions allow the destination Y pointer to be NULL.
+
+# YUY2 and UYVY
+
+YUY2 is a packed YUV format with half width, full height.
+
+YUY2 is YUYV in memory
+UYVY is UYVY in memory
diff --git a/media/libyuv/docs/getting_started.md b/media/libyuv/docs/getting_started.md
index 7cd56167f1..15b19ab210 100644
--- a/media/libyuv/docs/getting_started.md
+++ b/media/libyuv/docs/getting_started.md
@@ -11,14 +11,13 @@ Refer to chromium instructions for each platform for other prerequisites.
Create a working directory, enter it, and run:
- gclient config https://chromium.googlesource.com/libyuv/libyuv
+ gclient config --name src https://chromium.googlesource.com/libyuv/libyuv
gclient sync
-
Then you'll get a .gclient file like:
solutions = [
- { "name" : "libyuv",
+ { "name" : "src",
"url" : "https://chromium.googlesource.com/libyuv/libyuv",
"deps_file" : "DEPS",
"managed" : True,
@@ -28,17 +27,15 @@ Then you'll get a .gclient file like:
},
];
-
-For iOS add `;target_os=['ios'];` to your OSX .gclient and run `GYP_DEFINES="OS=ios" gclient sync.`
+For iOS add `;target_os=['ios'];` to your OSX .gclient and run `gclient sync.`
Browse the Git reprository: https://chromium.googlesource.com/libyuv/libyuv/+/master
### Android
For Android add `;target_os=['android'];` to your Linux .gclient
-
solutions = [
- { "name" : "libyuv",
+ { "name" : "src",
"url" : "https://chromium.googlesource.com/libyuv/libyuv",
"deps_file" : "DEPS",
"managed" : True,
@@ -47,23 +44,14 @@ For Android add `;target_os=['android'];` to your Linux .gclient
"safesync_url": "",
},
];
- target_os = ["android", "unix"];
+ target_os = ["android", "linux"];
Then run:
- export GYP_DEFINES="OS=android"
gclient sync
-Caveat: Theres an error with Google Play services updates. If you get the error "Your version of the Google Play services library is not up to date", run the following:
- cd chromium/src
- ./build/android/play_services/update.py download
- cd ../..
-
-For Windows the gclient sync must be done from an Administrator command prompt.
-
-The sync will generate native build files for your environment using gyp (Windows: Visual Studio, OSX: XCode, Linux: make). This generation can also be forced manually: `gclient runhooks`
-
To get just the source (not buildable):
+
git clone https://chromium.googlesource.com/libyuv/libyuv
@@ -71,187 +59,152 @@ To get just the source (not buildable):
### Windows
- set GYP_DEFINES=target_arch=ia32
- call python gyp_libyuv -fninja -G msvs_version=2013
- ninja -j7 -C out\Release
- ninja -j7 -C out\Debug
+ call gn gen out\Release "--args=is_debug=false target_cpu=\"x64\""
+ call gn gen out\Debug "--args=is_debug=true target_cpu=\"x64\""
+ ninja -v -C out\Release
+ ninja -v -C out\Debug
- set GYP_DEFINES=target_arch=x64
- call python gyp_libyuv -fninja -G msvs_version=2013
- ninja -C out\Debug_x64
- ninja -C out\Release_x64
+ call gn gen out\Release "--args=is_debug=false target_cpu=\"x86\""
+ call gn gen out\Debug "--args=is_debug=true target_cpu=\"x86\""
+ ninja -v -C out\Release
+ ninja -v -C out\Debug
-#### Building with clangcl
- set GYP_DEFINES=clang=1 target_arch=ia32 libyuv_enable_svn=1
- set LLVM_REPO_URL=svn://svn.chromium.org/llvm-project
- call python tools\clang\scripts\update.py
- call python gyp_libyuv -fninja libyuv_test.gyp
- ninja -C out\Debug
- ninja -C out\Release
+### macOS and Linux
-### OSX
+ gn gen out/Release "--args=is_debug=false"
+ gn gen out/Debug "--args=is_debug=true"
+ ninja -v -C out/Release
+ ninja -v -C out/Debug
-Clang 64 bit shown. Remove `clang=1` for GCC and change x64 to ia32 for 32 bit.
-
- GYP_DEFINES="clang=1 target_arch=x64" ./gyp_libyuv
- ninja -j7 -C out/Debug
- ninja -j7 -C out/Release
+### Building Offical with GN
- GYP_DEFINES="clang=1 target_arch=ia32" ./gyp_libyuv
- ninja -j7 -C out/Debug
- ninja -j7 -C out/Release
+ gn gen out/Official "--args=is_debug=false is_official_build=true is_chrome_branded=true"
+ ninja -C out/Official
### iOS
http://www.chromium.org/developers/how-tos/build-instructions-ios
Add to .gclient last line: `target_os=['ios'];`
-armv7
-
- GYP_DEFINES="OS=ios target_arch=armv7 target_subarch=arm32" GYP_CROSSCOMPILE=1 GYP_GENERATOR_FLAGS="output_dir=out_ios" ./gyp_libyuv
- ninja -j7 -C out_ios/Debug-iphoneos libyuv_unittest
- ninja -j7 -C out_ios/Release-iphoneos libyuv_unittest
-
arm64
- GYP_DEFINES="OS=ios target_arch=arm64 target_subarch=arm64" GYP_CROSSCOMPILE=1 GYP_GENERATOR_FLAGS="output_dir=out_ios" ./gyp_libyuv
- ninja -j7 -C out_ios/Debug-iphoneos libyuv_unittest
- ninja -j7 -C out_ios/Release-iphoneos libyuv_unittest
+ gn gen out/Release "--args=is_debug=false target_os=\"ios\" ios_enable_code_signing=false target_cpu=\"arm64\""
+ gn gen out/Debug "--args=is_debug=true target_os=\"ios\" ios_enable_code_signing=false target_cpu=\"arm64\""
+ ninja -v -C out/Debug libyuv_unittest
+ ninja -v -C out/Release libyuv_unittest
-both armv7 and arm64 (fat)
+ios simulator
- GYP_DEFINES="OS=ios target_arch=armv7 target_subarch=both" GYP_CROSSCOMPILE=1 GYP_GENERATOR_FLAGS="output_dir=out_ios" ./gyp_libyuv
- ninja -j7 -C out_ios/Debug-iphoneos libyuv_unittest
- ninja -j7 -C out_ios/Release-iphoneos libyuv_unittest
+ gn gen out/Release "--args=is_debug=false target_os=\"ios\" ios_enable_code_signing=false use_xcode_clang=true target_cpu=\"x86\""
+ gn gen out/Debug "--args=is_debug=true target_os=\"ios\" ios_enable_code_signing=false use_xcode_clang=true target_cpu=\"x86\""
+ ninja -v -C out/Debug libyuv_unittest
+ ninja -v -C out/Release libyuv_unittest
-simulator
+ios disassembly
- GYP_DEFINES="OS=ios target_arch=ia32 target_subarch=arm32" GYP_CROSSCOMPILE=1 GYP_GENERATOR_FLAGS="output_dir=out_sim" ./gyp_libyuv
- ninja -j7 -C out_sim/Debug-iphonesimulator libyuv_unittest
- ninja -j7 -C out_sim/Release-iphonesimulator libyuv_unittest
+ otool -tV ./out/Release/obj/libyuv_neon/row_neon64.o >row_neon64.txt
### Android
https://code.google.com/p/chromium/wiki/AndroidBuildInstructions
Add to .gclient last line: `target_os=['android'];`
-armv7
+arm64
- GYP_DEFINES="OS=android" GYP_CROSSCOMPILE=1 ./gyp_libyuv
- ninja -j7 -C out/Debug libyuv_unittest_apk
- ninja -j7 -C out/Release libyuv_unittest_apk
+ gn gen out/Release "--args=is_debug=false target_os=\"android\" target_cpu=\"arm64\""
+ gn gen out/Debug "--args=is_debug=true target_os=\"android\" target_cpu=\"arm64\""
+ ninja -v -C out/Debug libyuv_unittest
+ ninja -v -C out/Release libyuv_unittest
-arm64
+armv7
- GYP_DEFINES="OS=android target_arch=arm64 target_subarch=arm64" GYP_CROSSCOMPILE=1 ./gyp_libyuv
- ninja -j7 -C out/Debug libyuv_unittest_apk
- ninja -j7 -C out/Release libyuv_unittest_apk
+ gn gen out/Release "--args=is_debug=false target_os=\"android\" target_cpu=\"arm\""
+ gn gen out/Debug "--args=is_debug=true target_os=\"android\" target_cpu=\"arm\""
+ ninja -v -C out/Debug libyuv_unittest
+ ninja -v -C out/Release libyuv_unittest
ia32
- GYP_DEFINES="OS=android target_arch=ia32" GYP_CROSSCOMPILE=1 ./gyp_libyuv
- ninja -j7 -C out/Debug libyuv_unittest_apk
- ninja -j7 -C out/Release libyuv_unittest_apk
+ gn gen out/Release "--args=is_debug=false target_os=\"android\" target_cpu=\"x86\""
+ gn gen out/Debug "--args=is_debug=true target_os=\"android\" target_cpu=\"x86\""
+ ninja -v -C out/Debug libyuv_unittest
+ ninja -v -C out/Release libyuv_unittest
- GYP_DEFINES="OS=android target_arch=ia32 android_full_debug=1" GYP_CROSSCOMPILE=1 ./gyp_libyuv
- ninja -j7 -C out/Debug libyuv_unittest_apk
+mips
-mipsel
+ 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"
+ gn gen out/Debug "--args=is_debug=true target_os=\"android\" target_cpu=\"mips64el\" mips_arch_variant=\"r6\" mips_use_msa=true is_component_build=true"
+ ninja -v -C out/Debug libyuv_unittest
+ ninja -v -C out/Release libyuv_unittest
- GYP_DEFINES="OS=android target_arch=mipsel" GYP_CROSSCOMPILE=1 ./gyp_libyuv
- ninja -j7 -C out/Debug libyuv_unittest_apk
- ninja -j7 -C out/Release libyuv_unittest_apk
+arm disassembly:
-arm32 disassembly:
+ third_party/android_ndk/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/aarch64-linux-android-objdump -d ./out/Release/obj/libyuv/row_common.o >row_common.txt
- 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
+ third_party/android_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
-arm64 disassembly:
+ third_party/android_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
- 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
+ Caveat: Disassembly may require optimize_max be disabled in BUILD.gn
Running tests:
- util/android/test_runner.py gtest -s libyuv_unittest -t 7200 --verbose --release --gtest_filter=*
+ out/Release/bin/run_libyuv_unittest -vv --gtest_filter=*
Running test as benchmark:
- util/android/test_runner.py gtest -s libyuv_unittest -t 7200 --verbose --release --gtest_filter=* -a "--libyuv_width=1280 --libyuv_height=720 --libyuv_repeat=999 --libyuv_flags=-1"
+ out/Release/bin/run_libyuv_unittest -vv --gtest_filter=* --libyuv_width=1280 --libyuv_height=720 --libyuv_repeat=999 --libyuv_flags=-1 --libyuv_cpu_info=-1
Running test with C code:
- util/android/test_runner.py gtest -s libyuv_unittest -t 7200 --verbose --release --gtest_filter=* -a "--libyuv_width=1280 --libyuv_height=720 --libyuv_repeat=999 --libyuv_flags=1 --libyuv_cpu_info=1"
-
-#### Building with GN
-
- gn gen out/Release "--args=is_debug=false target_cpu=\"x86\""
- gn gen out/Debug "--args=is_debug=true target_cpu=\"x86\""
- ninja -C out/Release
- ninja -C out/Debug
-
-### Building Offical with GN
-
- gn gen out/Official "--args=is_debug=false is_official_build=true is_chrome_branded=true"
- ninja -C out/Official
-
-### Linux
-
- GYP_DEFINES="target_arch=x64" ./gyp_libyuv
- ninja -j7 -C out/Debug
- ninja -j7 -C out/Release
-
- GYP_DEFINES="target_arch=ia32" ./gyp_libyuv
- ninja -j7 -C out/Debug
- ninja -j7 -C out/Release
-
-#### CentOS
-
-On CentOS 32 bit the following work around allows a sync:
-
- export GYP_DEFINES="host_arch=ia32"
- gclient sync
-
-### Windows Shared Library
-
-Modify libyuv.gyp from 'static_library' to 'shared_library', and add 'LIBYUV_BUILDING_SHARED_LIBRARY' to 'defines'.
-
- gclient runhooks
-
-After this command follow the building the library instructions above.
-
-If you get a compile error for atlthunk.lib on Windows, read http://www.chromium.org/developers/how-tos/build-instructions-windows
-
+ out/Release/bin/run_libyuv_unittest -vv --gtest_filter=* --libyuv_width=1280 --libyuv_height=720 --libyuv_repeat=999 --libyuv_flags=1 --libyuv_cpu_info=1
### Build targets
ninja -C out/Debug libyuv
ninja -C out/Debug libyuv_unittest
ninja -C out/Debug compare
- ninja -C out/Debug convert
+ ninja -C out/Debug yuvconvert
+ ninja -C out/Debug yuvconstants
ninja -C out/Debug psnr
ninja -C out/Debug cpuid
+### ARM Linux
+
+ gn gen out/Release "--args=is_debug=false target_cpu=\"arm64\""
+ gn gen out/Debug "--args=is_debug=true target_cpu=\"arm64\""
+ ninja -v -C out/Debug libyuv_unittest
+ ninja -v -C out/Release libyuv_unittest
+
+### MIPS Linux
+
+mips
+
+ gn gen out/Release "--args=is_debug=false target_os=\"linux\" target_cpu=\"mips64el\" mips_arch_variant=\"loongson3\" is_component_build=false use_sysroot=false use_gold=false"
+ gn gen out/Debug "--args=is_debug=true target_os=\"linux\" target_cpu=\"mips64el\" mips_arch_variant=\"loongson3\" is_component_build=false use_sysroot=false use_gold=false"
+ ninja -v -C out/Debug libyuv_unittest
+ ninja -v -C out/Release libyuv_unittest
## Building the Library with make
### Linux
- make -j7 V=1 -f linux.mk
- make -j7 V=1 -f linux.mk clean
- make -j7 V=1 -f linux.mk CXX=clang++
+ make V=1 -f linux.mk
+ make V=1 -f linux.mk clean
+ make V=1 -f linux.mk CXX=clang++ CC=clang
-## Building the Library with cmake
+## Building the library with cmake
Install cmake: http://www.cmake.org/
-Default debug build:
+### Default debug build:
mkdir out
cd out
cmake ..
cmake --build .
-Release build/install
+### Release build/install
mkdir out
cd out
@@ -259,47 +212,31 @@ Release build/install
cmake --build . --config Release
sudo cmake --build . --target install --config Release
-### Windows 8 Phone
-
-Pre-requisite:
-
-* Install Visual Studio 2012 and Arm to your environment.<br>
-
-Then:
-
- call "c:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\x86_arm\vcvarsx86_arm.bat"
-
-or with Visual Studio 2013:
-
- call "c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\x86_arm\vcvarsx86_arm.bat"
- nmake /f winarm.mk clean
- nmake /f winarm.mk
-
-### Windows Shared Library
-
-Modify libyuv.gyp from 'static_library' to 'shared_library', and add 'LIBYUV_BUILDING_SHARED_LIBRARY' to 'defines'. Then run this.
+### Build RPM/DEB packages
- gclient runhooks
-
-After this command follow the building the library instructions above.
+ mkdir out
+ cd out
+ cmake -DCMAKE_BUILD_TYPE=Release ..
+ make -j4
+ make package
-If you get a compile error for atlthunk.lib on Windows, read http://www.chromium.org/developers/how-tos/build-instructions-windows
+## Setup for Arm Cross compile
-### 64 bit Windows
+See also https://www.ccoderun.ca/programming/2015-12-20_CrossCompiling/index.html
- set GYP_DEFINES=target_arch=x64
- gclient runhooks V=1
+ sudo apt-get install ssh dkms build-essential linux-headers-generic
+ sudo apt-get install kdevelop cmake git subversion
+ sudo apt-get install graphviz doxygen doxygen-gui
+ sudo apt-get install manpages manpages-dev manpages-posix manpages-posix-dev
+ sudo apt-get install libboost-all-dev libboost-dev libssl-dev
+ sudo apt-get install rpm terminator fish
+ sudo apt-get install g++-arm-linux-gnueabihf gcc-arm-linux-gnueabihf
-### ARM Linux
+### Build psnr tool
- export GYP_DEFINES="target_arch=arm"
- export CROSSTOOL=`<path>`/arm-none-linux-gnueabi
- export CXX=$CROSSTOOL-g++
- export CC=$CROSSTOOL-gcc
- export AR=$CROSSTOOL-ar
- export AS=$CROSSTOOL-as
- export RANLIB=$CROSSTOOL-ranlib
- gclient runhooks
+ cd util
+ arm-linux-gnueabihf-g++ psnr_main.cc psnr.cc ssim.cc -o psnr
+ arm-linux-gnueabihf-objdump -d psnr
## Running Unittests
@@ -307,123 +244,42 @@ If you get a compile error for atlthunk.lib on Windows, read http://www.chromium
out\Release\libyuv_unittest.exe --gtest_catch_exceptions=0 --gtest_filter="*"
-### OSX
+### macOS and Linux
out/Release/libyuv_unittest --gtest_filter="*"
-### Linux
-
- out/Release/libyuv_unittest --gtest_filter="*"
-
-Replace --gtest_filter="*" with specific unittest to run. May include wildcards. e.g.
-
- out/Release/libyuv_unittest --gtest_filter=libyuvTest.I420ToARGB_Opt
+Replace --gtest_filter="*" with specific unittest to run. May include wildcards.
+ out/Release/libyuv_unittest --gtest_filter=*I420ToARGB_Opt
## CPU Emulator tools
### Intel SDE (Software Development Emulator)
-Pre-requisite: Install IntelSDE for Windows: http://software.intel.com/en-us/articles/intel-software-development-emulator
+Pre-requisite: Install IntelSDE: http://software.intel.com/en-us/articles/intel-software-development-emulator
Then run:
- c:\intelsde\sde -hsw -- out\release\libyuv_unittest.exe --gtest_filter=*
-
-
-## Memory tools
-
-### Running Dr Memory memcheck for Windows
-
-Pre-requisite: Install Dr Memory for Windows and add it to your path: http://www.drmemory.org/docs/page_install_windows.html
-
- set GYP_DEFINES=build_for_tool=drmemory target_arch=ia32
- call python gyp_libyuv -fninja -G msvs_version=2013
- ninja -C out\Debug
- drmemory out\Debug\libyuv_unittest.exe --gtest_catch_exceptions=0 --gtest_filter=*
+ c:\intelsde\sde -hsw -- out\Release\libyuv_unittest.exe --gtest_filter=*
-### Running UBSan
+ ~/intelsde/sde -skx -- out/Release/libyuv_unittest --gtest_filter=**I420ToARGB_Opt
-See Chromium instructions for sanitizers: https://www.chromium.org/developers/testing/undefinedbehaviorsanitizer
+### Intel Architecture Code Analyzer
-Sanitizers available: TSan, MSan, ASan, UBSan, LSan
+Inset these 2 macros into assembly code to be analyzed:
+ IACA_ASM_START
+ IACA_ASM_END
+Build the code as usual, then run iaca on the object file.
+ ~/iaca-lin64/bin/iaca.sh -reduceout -arch HSW out/Release/obj/libyuv_internal/compare_gcc.o
- GYP_DEFINES='ubsan=1' gclient runhooks
- ninja -C out/Release
+## Sanitizers
-### Running Valgrind memcheck
+ gn gen out/Release "--args=is_debug=false is_msan=true"
+ ninja -v -C out/Release
-Memory errors and race conditions can be found by running tests under special memory tools. [Valgrind] [1] is an instrumentation framework for building dynamic analysis tools. Various tests and profilers are built upon it to find memory handling errors and memory leaks, for instance.
+Sanitizers available: asan, msan, tsan, ubsan, lsan, ubsan_vptr
-[1]: http://valgrind.org
-
- solutions = [
- { "name" : "libyuv",
- "url" : "https://chromium.googlesource.com/libyuv/libyuv",
- "deps_file" : "DEPS",
- "managed" : True,
- "custom_deps" : {
- "libyuv/chromium/src/third_party/valgrind": "https://chromium.googlesource.com/chromium/deps/valgrind/binaries",
- },
- "safesync_url": "",
- },
- ]
-
-Then run:
-
- GYP_DEFINES="clang=0 target_arch=x64 build_for_tool=memcheck" python gyp_libyuv
- ninja -C out/Debug
- valgrind out/Debug/libyuv_unittest
-
-
-For more information, see http://www.chromium.org/developers/how-tos/using-valgrind
-
-### Running Thread Sanitizer (TSan)
-
- GYP_DEFINES="clang=0 target_arch=x64 build_for_tool=tsan" python gyp_libyuv
- ninja -C out/Debug
- valgrind out/Debug/libyuv_unittest
-
-For more info, see http://www.chromium.org/developers/how-tos/using-valgrind/threadsanitizer
-
-### Running Address Sanitizer (ASan)
-
- GYP_DEFINES="clang=0 target_arch=x64 build_for_tool=asan" python gyp_libyuv
- ninja -C out/Debug
- valgrind out/Debug/libyuv_unittest
-
-For more info, see http://dev.chromium.org/developers/testing/addresssanitizer
-
-## Benchmarking
-
-The unittests can be used to benchmark.
-
-### Windows
-
- set LIBYUV_WIDTH=1280
- set LIBYUV_HEIGHT=720
- set LIBYUV_REPEAT=999
- set LIBYUV_FLAGS=-1
- out\Release\libyuv_unittest.exe --gtest_filter=*I420ToARGB_Opt
-
-
-### Linux and Mac
-
- LIBYUV_WIDTH=1280 LIBYUV_HEIGHT=720 LIBYUV_REPEAT=1000 out/Release/libyuv_unittest --gtest_filter=*I420ToARGB_Opt
-
- libyuvTest.I420ToARGB_Opt (547 ms)
-
-Indicates 0.547 ms/frame for 1280 x 720.
+### Running Dr Memory memcheck for Windows
-## Making a change
+Pre-requisite: Install Dr Memory for Windows and add it to your path: http://www.drmemory.org/docs/page_install_windows.html
- gclient sync
- git checkout -b mycl -t origin/master
- git pull
- <edit files>
- git add -u
- git commit -m "my change"
- git cl lint
- git cl try
- git cl upload -r a-reviewer@chomium.org -s
- <once approved..>
- git cl land
+ drmemory out\Debug\libyuv_unittest.exe --gtest_catch_exceptions=0 --gtest_filter=*
diff --git a/media/libyuv/docs/rotation.md b/media/libyuv/docs/rotation.md
index fb84fce5a9..a08430fded 100644
--- a/media/libyuv/docs/rotation.md
+++ b/media/libyuv/docs/rotation.md
@@ -100,4 +100,8 @@ Inverting can be achieved with almost any libyuv function by passing a negative
I420Mirror and ARGBMirror can also be used to rotate by 180 degrees by passing a negative height.
+# Cropping - Vertical Flip
+When cropping from a subsampled format like NV21, the method of setting the start pointers wont work for odd crop start y on the UV plane.
+If the height after cropping will be odd, invert the source - point to the last row, negate the strides, and pass negative height, which
+will re-invert the image as the conversion outputs.