source_set("libyuv") {
sources = [
+ # Headers
"include/libyuv.h",
"include/libyuv/basic_types.h",
"include/libyuv/compare.h",
"include/libyuv/version.h",
"include/libyuv/video_common.h",
- # sources.
+ # Source Files
"source/compare.cc",
"source/compare_common.cc",
"source/compare_gcc.cc",
if (use_neon) {
static_library("libyuv_neon") {
sources = [
+ # ARM Source Files
"source/compare_neon.cc",
"source/compare_neon64.cc",
"source/rotate_neon.cc",
if (JPEG_FOUND)
target_link_libraries(libyuv_unittest ${JPEG_LIBRARY})
endif()
-endif()
+
+ if(NACL AND NACL_LIBC STREQUAL "newlib")
+ target_link_libraries(libyuv_unittest glibc-compat)
+ endif()
-if(NACL AND NACL_LIBC STREQUAL "newlib")
- target_link_libraries(libyuv_unittest glibc-compat)
+ target_link_libraries(libyuv_unittest gflags)
+
endif()
-target_link_libraries(libyuv_unittest gflags)
-
install(TARGETS ${ly_lib_name} DESTINATION lib)
install(FILES ${ly_header_files} DESTINATION include/libyuv)
install(FILES ${ly_inc_dir}/libyuv.h DESTINATION include/)
# Roll the Chromium Git hash to pick up newer versions of all the
# dependencies and tools linked to in setup_links.py.
- 'chromium_revision': '3c455872750c9d0f74266b04f97701a516ac9075',
+ 'chromium_revision': '1d144ca7f86e0c684c67d6c1b6d5414ca9074615',
}
# NOTE: Prefer revision numbers to tags for svn deps. Use http rather than
'win',
'win_rel',
'win_x64_rel',
+ 'win_x64_gn',
+ 'win_x64_gn_rel',
'mac',
'mac_rel',
+ 'mac_gn',
+ 'mac_gn_rel',
+ 'mac_asan',
'ios',
'ios_rel',
'ios_arm64',
'ios_arm64_rel',
- 'mac_asan',
'linux',
'linux_rel',
+ 'linux_gn',
+ 'linux_gn_rel',
'linux_memcheck',
'linux_tsan2',
'linux_asan',
'android_rel',
'android_clang',
'android_arm64',
+ 'android_gn',
+ 'android_gn_rel',
]
if not files or all(re.search(r'[\\/]OWNERS$', f) for f in files):
return {}
Name: libyuv
URL: http://code.google.com/p/libyuv/
-Version: 1577
+Version: 1586
License: BSD
License File: LICENSE
You can also browse the [docs directory] [2] for more documentation.
-[1]: docs/getting_started.md
-[2]: docs/
+[1]: https://chromium.googlesource.com/libyuv/libyuv/+/master/docs/getting_started.md
+[2]: https://chromium.googlesource.com/libyuv/libyuv/+/master/docs/
--- /dev/null
+# Copyright 2016 The LibYuv Project Authors. All rights reserved.
+#
+# Use of this source code is governed by a BSD-style license
+# that can be found in the LICENSE file in the root of the source
+# tree. An additional intellectual property rights grant can be found
+# in the file PATENTS. All contributing project authors may
+# be found in the AUTHORS file in the root of the source tree.
+
+# Using same overrides as WebRTC
+# See https://bugs.chromium.org/p/webrtc/issues/detail?id=5453.
+# Some WebRTC targets require the 10.7 deployment version of the Mac SDK and a
+# 10.11 min SDK but those targets are only used in non-Chromium builds. We can
+# remove this when Chromium drops 10.6 support and also requires 10.7.
+mac_sdk_min_build_override = "10.11"
+mac_deployment_target_build_override = "10.7"
'managed': False,
'custom_deps': {
# Skip syncing some large dependencies Libyuv will never need.
- 'src/chrome/tools/test/reference_build/chrome_linux': None,
- 'src/chrome/tools/test/reference_build/chrome_mac': None,
- 'src/chrome/tools/test/reference_build/chrome_win': None,
- 'src/native_client': None,
'src/third_party/cld_2/src': None,
'src/third_party/ffmpeg': None,
'src/third_party/hunspell_dictionaries': None,
ninja -j7 -C out/Debug libyuv_unittest_apk
ninja -j7 -C out/Release libyuv_unittest_apk
+arm32 disassembly:
+
+ 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
+
arm64 disassembly:
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
#### Building with GN
- call gn gen out/Release "--args=is_debug=false target_cpu=\"x86\""
- call gn gen out/Debug "--args=is_debug=true target_cpu=\"x86\""
+ 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
if __name__ == '__main__':
args = sys.argv[1:]
+ if int(os.environ.get('GYP_CHROMIUM_NO_ACTION', 0)):
+ print 'Skipping gyp_libyuv due to GYP_CHROMIUM_NO_ACTION env var.'
+ sys.exit(0)
+
# This could give false positives since it doesn't actually do real option
# parsing. Oh well.
gyp_file_specified = False
(defined(__i386__) && !defined(__SSE2__))
#define LIBYUV_DISABLE_X86
#endif
+// MemorySanitizer does not support assembly code yet. http://crbug.com/344505
+#if defined(__has_feature)
+#if __has_feature(memory_sanitizer)
+#define LIBYUV_DISABLE_X86
+#endif
+#endif
// Visual C 2012 required for AVX2.
#if defined(_M_IX86) && !defined(__clang__) && \
(defined(__i386__) && !defined(__SSE2__))
#define LIBYUV_DISABLE_X86
#endif
+// MemorySanitizer does not support assembly code yet. http://crbug.com/344505
+#if defined(__has_feature)
+#if __has_feature(memory_sanitizer)
+#define LIBYUV_DISABLE_X86
+#endif
+#endif
// The following are available on all x86 platforms:
#if !defined(LIBYUV_DISABLE_X86) && \
(defined(_M_IX86) || defined(__x86_64__) || defined(__i386__))
(defined(__i386__) && !defined(__SSE2__))
#define LIBYUV_DISABLE_X86
#endif
-
+// MemorySanitizer does not support assembly code yet. http://crbug.com/344505
+#if defined(__has_feature)
+#if __has_feature(memory_sanitizer)
+#define LIBYUV_DISABLE_X86
+#endif
+#endif
// The following are available for Visual C and clangcl 32 bit:
#if !defined(LIBYUV_DISABLE_X86) && defined(_M_IX86)
#define HAS_TRANSPOSEWX8_SSSE3
(defined(__i386__) && !defined(__SSE2__))
#define LIBYUV_DISABLE_X86
#endif
+// MemorySanitizer does not support assembly code yet. http://crbug.com/344505
+#if defined(__has_feature)
+#if __has_feature(memory_sanitizer)
+#define LIBYUV_DISABLE_X86
+#endif
+#endif
// True if compiling for SSSE3 as a requirement.
#if defined(__SSSE3__) || (defined(_M_IX86_FP) && (_M_IX86_FP >= 3))
#define LIBYUV_SSSE3_ONLY
(defined(__i386__) && !defined(__SSE2__))
#define LIBYUV_DISABLE_X86
#endif
+// MemorySanitizer does not support assembly code yet. http://crbug.com/344505
+#if defined(__has_feature)
+#if __has_feature(memory_sanitizer)
+#define LIBYUV_DISABLE_X86
+#endif
+#endif
// GCC >= 4.7.0 required for AVX2.
#if defined(__GNUC__) && (defined(__x86_64__) || defined(__i386__))
#ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT
#define INCLUDE_LIBYUV_VERSION_H_
-#define LIBYUV_VERSION 1577
+#define LIBYUV_VERSION 1586
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
# Allows libyuv.a redistributable library without external dependencies.
'standalone_static_library': 1,
'conditions': [
+ # Disable -Wunused-parameter
+ ['clang == 1', {
+ 'cflags': [
+ '-Wno-unused-parameter',
+ ],
+ }],
['build_neon != 0', {
'defines': [
'LIBYUV_NEON',
}],
],
}],
- # MemorySanitizer does not support assembly code yet.
- # http://crbug.com/344505
- [ 'msan == 1', {
- 'defines': [
- 'LIBYUV_DISABLE_X86',
- ],
- }],
], #conditions
'defines': [
# Enable the following 3 macros to turn off assembly for specified CPU.
'LIBYUV_NEON'
],
}],
- # MemorySanitizer does not support assembly code yet.
- # http://crbug.com/344505
- [ 'msan == 1', {
- 'defines': [
- 'LIBYUV_DISABLE_X86',
- ],
- }],
], # conditions
'defines': [
# Enable the following 3 macros to turn off assembly for specified CPU.
# This is a generic makefile for libyuv for gcc.
# make -f linux.mk CXX=clang++
+CC?=gcc
+CFLAGS?=-O2 -fomit-frame-pointer
+CFLAGS+=-Iinclude/
+
CXX?=g++
CXXFLAGS?=-O2 -fomit-frame-pointer
CXXFLAGS+=-Iinclude/
LOCAL_OBJ_FILES := \
- source/compare.o \
- source/compare_common.o \
- source/compare_gcc.o \
- source/convert.o \
- source/convert_argb.o \
- source/convert_from.o \
- source/convert_from_argb.o \
- source/convert_to_argb.o \
- source/convert_to_i420.o \
- source/cpu_id.o \
- source/planar_functions.o \
- source/rotate.o \
- source/rotate_any.o \
- source/rotate_argb.o \
- source/rotate_common.o \
- source/rotate_gcc.o \
- source/rotate_mips.o \
- source/row_any.o \
- source/row_common.o \
- source/row_mips.o \
- source/row_gcc.o \
- source/scale.o \
- source/scale_any.o \
- source/scale_argb.o \
- source/scale_common.o \
- source/scale_gcc.o \
- source/scale_mips.o \
- source/video_common.o
+ source/compare.o \
+ source/compare_common.o \
+ source/compare_gcc.o \
+ source/compare_neon64.o \
+ source/compare_neon.o \
+ source/compare_win.o \
+ source/convert_argb.o \
+ source/convert.o \
+ source/convert_from_argb.o \
+ source/convert_from.o \
+ source/convert_jpeg.o \
+ source/convert_to_argb.o \
+ source/convert_to_i420.o \
+ source/cpu_id.o \
+ source/mjpeg_decoder.o \
+ source/mjpeg_validate.o \
+ source/planar_functions.o \
+ source/rotate_any.o \
+ source/rotate_argb.o \
+ source/rotate.o \
+ source/rotate_common.o \
+ source/rotate_gcc.o \
+ source/rotate_mips.o \
+ source/rotate_neon64.o \
+ source/rotate_neon.o \
+ source/rotate_win.o \
+ source/row_any.o \
+ source/row_common.o \
+ source/row_gcc.o \
+ source/row_mips.o \
+ source/row_neon64.o \
+ source/row_neon.o \
+ source/row_win.o \
+ source/scale_any.o \
+ source/scale_argb.o \
+ source/scale.o \
+ source/scale_common.o \
+ source/scale_gcc.o \
+ source/scale_mips.o \
+ source/scale_neon64.o \
+ source/scale_neon.o \
+ source/scale_win.o \
+ source/video_common.o
.cc.o:
$(CXX) -c $(CXXFLAGS) $*.cc -o $*.o
-all: libyuv.a convert
+.c.o:
+ $(CC) -c $(CFLAGS) $*.c -o $*.o
+
+all: libyuv.a convert cpuid psnr
libyuv.a: $(LOCAL_OBJ_FILES)
$(AR) $(ARFLAGS) $@ $(LOCAL_OBJ_FILES)
-# A test utility that uses libyuv conversion.
+# A C++ test utility that uses libyuv conversion.
convert: util/convert.cc libyuv.a
$(CXX) $(CXXFLAGS) -Iutil/ -o $@ util/convert.cc libyuv.a
-clean:
- /bin/rm -f source/*.o *.ii *.s libyuv.a convert
+# A standalone test utility
+psnr: util/psnr.cc
+ $(CXX) $(CXXFLAGS) -Iutil/ -o $@ util/psnr.cc util/psnr_main.cc util/ssim.cc
+# A C test utility that uses libyuv conversion from C.
+cpuid: util/cpuid.c libyuv.a
+ $(CC) $(CFLAGS) -o $@ util/cpuid.c libyuv.a
+
+clean:
+ /bin/rm -f source/*.o *.ii *.s libyuv.a convert cpuid psnr
'build',
'buildtools',
'google_apis', # Needed by build/common.gypi.
+ 'native_client',
'net',
'testing',
'third_party/binutils',
'third_party/libjpeg_turbo',
'third_party/libsrtp',
'third_party/libudev',
- 'third_party/libvpx_new',
+ 'third_party/libvpx',
'third_party/libyuv',
'third_party/llvm-build',
'third_party/lss',
extern "C" {
#endif
-// Convert camera sample to I420 with cropping, rotation and vertical flip.
+// Convert camera sample to ARGB with cropping, rotation and vertical flip.
// src_width is used for source stride computation
// src_height is used to compute location of planes, and indicate inversion
// sample_size is measured in bytes and is the size of the frame.
// also enable temporary buffer.
LIBYUV_BOOL need_buf = (rotation && format != FOURCC_ARGB) ||
crop_argb == sample;
- uint8* tmp_argb = crop_argb;
- int tmp_argb_stride = argb_stride;
+ uint8* dest_argb = crop_argb;
+ int dest_argb_stride = argb_stride;
uint8* rotate_buffer = NULL;
int abs_crop_height = (crop_height < 0) ? -crop_height : crop_height;
}
if (need_buf) {
- int argb_size = crop_width * abs_crop_height * 4;
+ int argb_size = crop_width * 4 * abs_crop_height;
rotate_buffer = (uint8*)malloc(argb_size);
if (!rotate_buffer) {
return 1; // Out of memory runtime error.
}
crop_argb = rotate_buffer;
- argb_stride = crop_width;
+ argb_stride = crop_width * 4;
}
switch (format) {
if (need_buf) {
if (!r) {
r = ARGBRotate(crop_argb, argb_stride,
- tmp_argb, tmp_argb_stride,
+ dest_argb, dest_argb_stride,
crop_width, abs_crop_height, rotation);
}
free(rotate_buffer);
#include "libyuv/cpu_id.h"
-#if defined(_MSC_VER) && !defined(__clang__)
+#if defined(_MSC_VER)
#include <intrin.h> // For __cpuidex()
#endif
#if !defined(__pnacl__) && !defined(__CLR_VER) && \
!defined(__native_client__) && (defined(_M_IX86) || defined(_M_X64)) && \
- defined(_MSC_VER) && !defined(__clang__) && (_MSC_FULL_VER >= 160040219)
+ defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 160040219)
#include <immintrin.h> // For _xgetbv()
#endif
// For functions that use the stack and have runtime checks for overflow,
// use SAFEBUFFERS to avoid additional check.
-#if (defined(_MSC_VER) && !defined(__clang__)) && (_MSC_FULL_VER >= 160040219)
+#if defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 160040219) && \
+ !defined(__clang__)
#define SAFEBUFFERS __declspec(safebuffers)
#else
#define SAFEBUFFERS
!defined(__pnacl__) && !defined(__CLR_VER)
LIBYUV_API
void CpuId(uint32 info_eax, uint32 info_ecx, uint32* cpu_info) {
-#if defined(_MSC_VER) && !defined(__clang__)
+#if defined(_MSC_VER)
// Visual C version uses intrinsic or inline x86 assembly.
-#if (_MSC_FULL_VER >= 160040219)
+#if defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 160040219)
__cpuidex((int*)(cpu_info), info_eax, info_ecx);
#elif defined(_M_IX86)
__asm {
}
#endif
// GCC version uses inline x86 assembly.
-#else // defined(_MSC_VER) && !defined(__clang__)
+#else // defined(_MSC_VER)
uint32 info_ebx, info_edx;
asm volatile (
#if defined( __i386__) && defined(__PIC__)
cpu_info[1] = info_ebx;
cpu_info[2] = info_ecx;
cpu_info[3] = info_edx;
-#endif // defined(_MSC_VER) && !defined(__clang__)
+#endif // defined(_MSC_VER)
}
#else // (defined(_M_IX86) || defined(_M_X64) ...
LIBYUV_API
// X86 CPUs have xgetbv to detect OS saves high parts of ymm registers.
int GetXCR0() {
uint32 xcr0 = 0u;
-#if (_MSC_FULL_VER >= 160040219)
+#if defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 160040219)
xcr0 = (uint32)(_xgetbv(0)); // VS2010 SP1 required.
#elif defined(__i386__) || defined(__x86_64__)
asm(".byte 0x0f, 0x01, 0xd0" : "=a" (xcr0) : "c" (0) : "%edx");
#endif
for (y = 0; y < height; ++y) {
- InterpolateRow(dst, src0, src1 - src0,
- width, interpolation);
+ InterpolateRow(dst, src0, src1 - src0, width, interpolation);
src0 += src_stride0;
src1 += src_stride1;
dst += dst_stride;
void TransposeWx8_NEON(const uint8* src, int src_stride,
uint8* dst, int dst_stride,
int width) {
- const uint8* src_temp = NULL;
+ const uint8* src_temp;
asm volatile (
// loops are on blocks of 8. loop will stop when
// counter gets to or below 0. starting the counter
"4: \n"
- : "+r"(src_temp), // %0
+ : "=&r"(src_temp), // %0
"+r"(src), // %1
"+r"(src_stride), // %2
"+r"(dst), // %3
uint8* dst_a, int dst_stride_a,
uint8* dst_b, int dst_stride_b,
int width) {
- const uint8* src_temp = NULL;
+ const uint8* src_temp;
asm volatile (
// loops are on blocks of 8. loop will stop when
// counter gets to or below 0. starting the counter
"4: \n"
- : "+r"(src_temp), // %0
+ : "=&r"(src_temp), // %0
"+r"(src), // %1
"+r"(src_stride), // %2
"+r"(dst_a), // %3
void TransposeWx8_NEON(const uint8* src, int src_stride,
uint8* dst, int dst_stride, int width) {
- const uint8* src_temp = NULL;
+ const uint8* src_temp;
int64 width64 = (int64) width; // Work around clang 3.4 warning.
asm volatile (
// loops are on blocks of 8. loop will stop when
"4: \n"
- : "+r"(src_temp), // %0
+ : "=&r"(src_temp), // %0
"+r"(src), // %1
"+r"(dst), // %2
"+r"(width64) // %3
uint8* dst_a, int dst_stride_a,
uint8* dst_b, int dst_stride_b,
int width) {
- const uint8* src_temp = NULL;
+ const uint8* src_temp;
int64 width64 = (int64) width; // Work around clang 3.4 warning.
asm volatile (
// loops are on blocks of 8. loop will stop when
"4: \n"
- : "+r"(src_temp), // %0
+ : "=&r"(src_temp), // %0
"+r"(src), // %1
"+r"(dst_a), // %2
"+r"(dst_b), // %3
}
// Blend 2 rows into 1.
-static void HalfRow_C(const uint8* src_uv, int src_uv_stride,
+static void HalfRow_C(const uint8* src_uv, ptrdiff_t src_uv_stride,
uint8* dst_uv, int width) {
int x;
for (x = 0; x < width; ++x) {
}
}
-static void HalfRow_16_C(const uint16* src_uv, int src_uv_stride,
+static void HalfRow_16_C(const uint16* src_uv, ptrdiff_t src_uv_stride,
uint16* dst_uv, int width) {
int x;
for (x = 0; x < width; ++x) {
return;
}
if (y1_fraction == 128) {
- HalfRow_C(src_ptr, (int)(src_stride), dst_ptr, width);
+ HalfRow_C(src_ptr, src_stride, dst_ptr, width);
return;
}
for (x = 0; x < width - 1; x += 2) {
return;
}
if (source_y_fraction == 128) {
- HalfRow_16_C(src_ptr, (int)(src_stride), dst_ptr, width);
+ HalfRow_16_C(src_ptr, src_stride, dst_ptr, width);
return;
}
for (x = 0; x < width - 1; x += 2) {
uint8* dst_argb,
const struct YuvConstants* yuvconstants,
int width) {
- int temp = 0;
+ int temp;
asm volatile (
YUVTORGB_SETUP(yuvconstants)
"sub %[u_buf],%[v_buf] \n"
STOREARGB
"subl $0x8,%[width] \n"
"jg 1b \n"
- : [y_buf]"+r"(y_buf), // %[y_buf]
- [u_buf]"+r"(u_buf), // %[u_buf]
- [v_buf]"+r"(v_buf), // %[v_buf]
+ : [y_buf]"+r"(y_buf), // %[y_buf]
+ [u_buf]"+r"(u_buf), // %[u_buf]
+ [v_buf]"+r"(v_buf), // %[v_buf]
[dst_argb]"+r"(dst_argb), // %[dst_argb]
- [temp]"+r"(temp), // %[temp]
+ [temp]"=&r"(temp), // %[temp]
#if defined(__i386__) && defined(__pic__)
- [width]"+m"(width) // %[width]
+ [width]"+m"(width) // %[width]
#else
- [width]"+rm"(width) // %[width]
+ [width]"+rm"(width) // %[width]
#endif
: [yuvconstants]"r"(yuvconstants) // %[yuvconstants]
: "memory", "cc", NACL_R14 YUVTORGB_REGS
// Unattenuate 4 pixels at a time.
void ARGBUnattenuateRow_SSE2(const uint8* src_argb, uint8* dst_argb,
int width) {
- uintptr_t alpha = 0;
+ uintptr_t alpha;
asm volatile (
// 4 pixel loop.
LABELALIGN
"lea " MEMLEA(0x10,1) ",%1 \n"
"sub $0x4,%2 \n"
"jg 1b \n"
- : "+r"(src_argb), // %0
- "+r"(dst_argb), // %1
- "+r"(width), // %2
- "+r"(alpha) // %3
+ : "+r"(src_argb), // %0
+ "+r"(dst_argb), // %1
+ "+r"(width), // %2
+ "=&r"(alpha) // %3
: "r"(fixed_invtbl8) // %4
: "memory", "cc", NACL_R14
"xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5"
// Unattenuate 8 pixels at a time.
void ARGBUnattenuateRow_AVX2(const uint8* src_argb, uint8* dst_argb,
int width) {
- uintptr_t alpha = 0;
+ uintptr_t alpha;
asm volatile (
"sub %0,%1 \n"
"vbroadcastf128 %5,%%ymm5 \n"
"sub $0x8,%2 \n"
"jg 1b \n"
"vzeroupper \n"
- : "+r"(src_argb), // %0
- "+r"(dst_argb), // %1
- "+r"(width), // %2
- "+r"(alpha) // %3
+ : "+r"(src_argb), // %0
+ "+r"(dst_argb), // %1
+ "+r"(width), // %2
+ "=&r"(alpha) // %3
: "r"(fixed_invtbl8), // %4
"m"(kUnattenShuffleAlpha_AVX2) // %5
: "memory", "cc", NACL_R14
void ARGBAffineRow_SSE2(const uint8* src_argb, int src_argb_stride,
uint8* dst_argb, const float* src_dudv, int width) {
intptr_t src_argb_stride_temp = src_argb_stride;
- intptr_t temp = 0;
+ intptr_t temp;
asm volatile (
"movq " MEMACCESS(3) ",%%xmm2 \n"
"movq " MEMACCESS2(0x08,3) ",%%xmm7 \n"
"+r"(dst_argb), // %2
"+r"(src_dudv), // %3
"+rm"(width), // %4
- "+r"(temp) // %5
+ "=&r"(temp) // %5
:
: "memory", "cc", NACL_R14
"xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7"
// For BGRAToARGB, ABGRToARGB, RGBAToARGB, and ARGBToRGBA.
void ARGBShuffleRow_SSE2(const uint8* src_argb, uint8* dst_argb,
const uint8* shuffler, int width) {
- uintptr_t pixel_temp = 0u;
+ uintptr_t pixel_temp;
asm volatile (
"pxor %%xmm5,%%xmm5 \n"
"mov " MEMACCESS(4) ",%k2 \n"
"jg 3012b \n"
"99: \n"
- : "+r"(src_argb), // %0
- "+r"(dst_argb), // %1
- "+d"(pixel_temp), // %2
+ : "+r"(src_argb), // %0
+ "+r"(dst_argb), // %1
+ "=&d"(pixel_temp), // %2
"+r"(width) // %3
- : "r"(shuffler) // %4
+ : "r"(shuffler) // %4
: "memory", "cc", NACL_R14
"xmm0", "xmm1", "xmm5"
);
// Tranform ARGB pixels with color table.
void ARGBColorTableRow_X86(uint8* dst_argb, const uint8* table_argb,
int width) {
- uintptr_t pixel_temp = 0u;
+ uintptr_t pixel_temp;
asm volatile (
// 1 pixel loop.
LABELALIGN
"mov %b1," MEMACCESS2(-0x1,0) " \n"
"dec %2 \n"
"jg 1b \n"
- : "+r"(dst_argb), // %0
- "+d"(pixel_temp), // %1
- "+r"(width) // %2
- : "r"(table_argb) // %3
+ : "+r"(dst_argb), // %0
+ "=&d"(pixel_temp), // %1
+ "+r"(width) // %2
+ : "r"(table_argb) // %3
: "memory", "cc");
}
#endif // HAS_ARGBCOLORTABLEROW_X86
#ifdef HAS_RGBCOLORTABLEROW_X86
// Tranform RGB pixels with color table.
void RGBColorTableRow_X86(uint8* dst_argb, const uint8* table_argb, int width) {
- uintptr_t pixel_temp = 0u;
+ uintptr_t pixel_temp;
asm volatile (
// 1 pixel loop.
LABELALIGN
"mov %b1," MEMACCESS2(-0x2,0) " \n"
"dec %2 \n"
"jg 1b \n"
- : "+r"(dst_argb), // %0
- "+d"(pixel_temp), // %1
- "+r"(width) // %2
- : "r"(table_argb) // %3
+ : "+r"(dst_argb), // %0
+ "=&d"(pixel_temp), // %1
+ "+r"(width) // %2
+ : "r"(table_argb) // %3
: "memory", "cc");
}
#endif // HAS_RGBCOLORTABLEROW_X86
void ARGBLumaColorTableRow_SSSE3(const uint8* src_argb, uint8* dst_argb,
int width,
const uint8* luma, uint32 lumacoeff) {
- uintptr_t pixel_temp = 0u;
- uintptr_t table_temp = 0u;
+ uintptr_t pixel_temp;
+ uintptr_t table_temp;
asm volatile (
"movd %6,%%xmm3 \n"
"pshufd $0x0,%%xmm3,%%xmm3 \n"
"lea " MEMLEA(0x10,3) ",%3 \n"
"sub $0x4,%4 \n"
"jg 1b \n"
- : "+d"(pixel_temp), // %0
- "+a"(table_temp), // %1
- "+r"(src_argb), // %2
- "+r"(dst_argb), // %3
- "+rm"(width) // %4
- : "r"(luma), // %5
- "rm"(lumacoeff) // %6
+ : "=&d"(pixel_temp), // %0
+ "=&a"(table_temp), // %1
+ "+r"(src_argb), // %2
+ "+r"(dst_argb), // %3
+ "+rm"(width) // %4
+ : "r"(luma), // %5
+ "rm"(lumacoeff) // %6
: "memory", "cc", "xmm0", "xmm3", "xmm4", "xmm5"
);
}
void MirrorUVRow_DSPR2(const uint8* src_uv, uint8* dst_u, uint8* dst_v,
int width) {
- int x = 0;
- int y = 0;
+ int x;
+ int y;
__asm__ __volatile__ (
".set push \n"
".set noreorder \n"
[dst_u] "+r" (dst_u),
[dst_v] "+r" (dst_v),
[x] "=&r" (x),
- [y] "+r" (y)
+ [y] "=&r" (y)
: [width] "r" (width)
: "t0", "t1", "t2", "t3", "t4",
"t5", "t7", "t8", "t9"
}
#define ARGBTORGB565 \
- "vshr.u8 d20, d20, #3 \n" /* B */ \
- "vshr.u8 d21, d21, #2 \n" /* G */ \
- "vshr.u8 d22, d22, #3 \n" /* R */ \
- "vmovl.u8 q8, d20 \n" /* B */ \
- "vmovl.u8 q9, d21 \n" /* G */ \
- "vmovl.u8 q10, d22 \n" /* R */ \
- "vshl.u16 q9, q9, #5 \n" /* G */ \
- "vshl.u16 q10, q10, #11 \n" /* R */ \
- "vorr q0, q8, q9 \n" /* BG */ \
- "vorr q0, q0, q10 \n" /* BGR */
+ "vshll.u8 q0, d22, #8 \n" /* R */ \
+ "vshll.u8 q8, d21, #8 \n" /* G */ \
+ "vshll.u8 q9, d20, #8 \n" /* B */ \
+ "vsri.16 q0, q8, #5 \n" /* RG */ \
+ "vsri.16 q0, q9, #11 \n" /* RGB */
void I422ToRGB565Row_NEON(const uint8* src_y,
const uint8* src_u,
}
#define ARGBTOARGB1555 \
- "vshr.u8 q10, q10, #3 \n" /* B */ \
- "vshr.u8 d22, d22, #3 \n" /* R */ \
- "vshr.u8 d23, d23, #7 \n" /* A */ \
- "vmovl.u8 q8, d20 \n" /* B */ \
- "vmovl.u8 q9, d21 \n" /* G */ \
- "vmovl.u8 q10, d22 \n" /* R */ \
- "vmovl.u8 q11, d23 \n" /* A */ \
- "vshl.u16 q9, q9, #5 \n" /* G */ \
- "vshl.u16 q10, q10, #10 \n" /* R */ \
- "vshl.u16 q11, q11, #15 \n" /* A */ \
- "vorr q0, q8, q9 \n" /* BG */ \
- "vorr q1, q10, q11 \n" /* RA */ \
- "vorr q0, q0, q1 \n" /* BGRA */
+ "vshll.u8 q0, d23, #8 \n" /* A */ \
+ "vshll.u8 q8, d22, #8 \n" /* R */ \
+ "vshll.u8 q9, d21, #8 \n" /* G */ \
+ "vshll.u8 q10, d20, #8 \n" /* B */ \
+ "vsri.16 q0, q8, #1 \n" /* AR */ \
+ "vsri.16 q0, q9, #6 \n" /* ARG */ \
+ "vsri.16 q0, q10, #11 \n" /* ARGB */
void I422ToARGB1555Row_NEON(const uint8* src_y,
const uint8* src_u,
#define ARGBTORGB565 \
"shll v0.8h, v22.8b, #8 \n" /* R */ \
- "shll v20.8h, v20.8b, #8 \n" /* B */ \
"shll v21.8h, v21.8b, #8 \n" /* G */ \
+ "shll v20.8h, v20.8b, #8 \n" /* B */ \
"sri v0.8h, v21.8h, #5 \n" /* RG */ \
"sri v0.8h, v20.8h, #11 \n" /* RGB */
#define ARGBTOARGB1555 \
"shll v0.8h, v23.8b, #8 \n" /* A */ \
"shll v22.8h, v22.8b, #8 \n" /* R */ \
- "shll v20.8h, v20.8b, #8 \n" /* B */ \
"shll v21.8h, v21.8b, #8 \n" /* G */ \
+ "shll v20.8h, v20.8b, #8 \n" /* B */ \
"sri v0.8h, v22.8h, #1 \n" /* AR */ \
"sri v0.8h, v21.8h, #6 \n" /* ARG */ \
"sri v0.8h, v20.8h, #11 \n" /* ARGB */
void ScaleRowDown4Box_SSSE3(const uint8* src_ptr, ptrdiff_t src_stride,
uint8* dst_ptr, int dst_width) {
- intptr_t stridex3 = 0;
+ intptr_t stridex3;
asm volatile (
"pcmpeqb %%xmm4,%%xmm4 \n"
"psrlw $0xf,%%xmm4 \n"
: "+r"(src_ptr), // %0
"+r"(dst_ptr), // %1
"+r"(dst_width), // %2
- "+r"(stridex3) // %3
+ "=&r"(stridex3) // %3
: "r"((intptr_t)(src_stride)) // %4
: "memory", "cc", NACL_R14
"xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5"
// Bilinear column filtering. SSSE3 version.
void ScaleFilterCols_SSSE3(uint8* dst_ptr, const uint8* src_ptr,
int dst_width, int x, int dx) {
- intptr_t x0 = 0, x1 = 0, temp_pixel = 0;
+ intptr_t x0, x1, temp_pixel;
asm volatile (
"movd %6,%%xmm2 \n"
"movd %7,%%xmm3 \n"
"movd %%xmm0,%k2 \n"
"mov %b2," MEMACCESS(0) " \n"
"99: \n"
- : "+r"(dst_ptr), // %0
- "+r"(src_ptr), // %1
- "+a"(temp_pixel), // %2
- "+r"(x0), // %3
- "+r"(x1), // %4
- "+rm"(dst_width) // %5
- : "rm"(x), // %6
- "rm"(dx) // %7
+ : "+r"(dst_ptr), // %0
+ "+r"(src_ptr), // %1
+ "=&a"(temp_pixel), // %2
+ "=&r"(x0), // %3
+ "=&r"(x1), // %4
+ "+rm"(dst_width) // %5
+ : "rm"(x), // %6
+ "rm"(dx) // %7
: "memory", "cc", NACL_R14
"xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6"
);
void ScaleARGBRowDownEven_SSE2(const uint8* src_argb, ptrdiff_t src_stride,
int src_stepx, uint8* dst_argb, int dst_width) {
intptr_t src_stepx_x4 = (intptr_t)(src_stepx);
- intptr_t src_stepx_x12 = 0;
+ intptr_t src_stepx_x12;
asm volatile (
"lea " MEMLEA3(0x00,1,4) ",%1 \n"
"lea " MEMLEA4(0x00,1,1,2) ",%4 \n"
"lea " MEMLEA(0x10,2) ",%2 \n"
"sub $0x4,%3 \n"
"jg 1b \n"
- : "+r"(src_argb), // %0
- "+r"(src_stepx_x4), // %1
- "+r"(dst_argb), // %2
- "+r"(dst_width), // %3
- "+r"(src_stepx_x12) // %4
+ : "+r"(src_argb), // %0
+ "+r"(src_stepx_x4), // %1
+ "+r"(dst_argb), // %2
+ "+r"(dst_width), // %3
+ "=&r"(src_stepx_x12) // %4
:: "memory", "cc", NACL_R14
"xmm0", "xmm1", "xmm2", "xmm3"
);
ptrdiff_t src_stride, int src_stepx,
uint8* dst_argb, int dst_width) {
intptr_t src_stepx_x4 = (intptr_t)(src_stepx);
- intptr_t src_stepx_x12 = 0;
+ intptr_t src_stepx_x12;
intptr_t row1 = (intptr_t)(src_stride);
asm volatile (
"lea " MEMLEA3(0x00,1,4) ",%1 \n"
"lea " MEMLEA(0x10,2) ",%2 \n"
"sub $0x4,%3 \n"
"jg 1b \n"
- : "+r"(src_argb), // %0
- "+r"(src_stepx_x4), // %1
- "+r"(dst_argb), // %2
- "+rm"(dst_width), // %3
- "+r"(src_stepx_x12), // %4
- "+r"(row1) // %5
+ : "+r"(src_argb), // %0
+ "+r"(src_stepx_x4), // %1
+ "+r"(dst_argb), // %2
+ "+rm"(dst_width), // %3
+ "=&r"(src_stepx_x12), // %4
+ "+r"(row1) // %5
:: "memory", "cc", NACL_R14
"xmm0", "xmm1", "xmm2", "xmm3"
);
void ScaleARGBCols_SSE2(uint8* dst_argb, const uint8* src_argb,
int dst_width, int x, int dx) {
- intptr_t x0 = 0, x1 = 0;
+ intptr_t x0, x1;
asm volatile (
"movd %5,%%xmm2 \n"
"movd %6,%%xmm3 \n"
MEMOPREG(movd,0x00,3,0,4,xmm0) // movd (%3,%0,4),%%xmm0
"movd %%xmm0," MEMACCESS(2) " \n"
"99: \n"
- : "+a"(x0), // %0
- "+d"(x1), // %1
+ : "=&a"(x0), // %0
+ "=&d"(x1), // %1
"+r"(dst_argb), // %2
"+r"(src_argb), // %3
"+r"(dst_width) // %4
// Bilinear row filtering combines 4x2 -> 4x1. SSSE3 version
void ScaleARGBFilterCols_SSSE3(uint8* dst_argb, const uint8* src_argb,
int dst_width, int x, int dx) {
- intptr_t x0 = 0, x1 = 0;
+ intptr_t x0, x1;
asm volatile (
"movdqa %0,%%xmm4 \n"
"movdqa %1,%%xmm5 \n"
: "+r"(dst_argb), // %0
"+r"(src_argb), // %1
"+rm"(dst_width), // %2
- "+r"(x0), // %3
- "+r"(x1) // %4
+ "=&r"(x0), // %3
+ "=&r"(x1) // %4
: "rm"(x), // %5
"rm"(dx) // %6
: "memory", "cc", NACL_R14
void ScaleAddRows_NEON(const uint8* src_ptr, ptrdiff_t src_stride,
uint16* dst_ptr, int src_width, int src_height) {
- const uint8* src_tmp = NULL;
+ const uint8* src_tmp;
asm volatile (
"1: \n"
"mov %0, %1 \n"
"add %1, %1, #16 \n"
"subs %4, %4, #16 \n" // 16 processed per loop
"bgt 1b \n"
- : "+r"(src_tmp), // %0
- "+r"(src_ptr), // %1
- "+r"(dst_ptr), // %2
- "+r"(src_stride), // %3
- "+r"(src_width), // %4
- "+r"(src_height) // %5
+ : "=&r"(src_tmp), // %0
+ "+r"(src_ptr), // %1
+ "+r"(dst_ptr), // %2
+ "+r"(src_stride), // %3
+ "+r"(src_width), // %4
+ "+r"(src_height) // %5
:
: "memory", "cc", "r12", "q0", "q1", "q2", "q3" // Clobber List
);
void ScaleARGBCols_NEON(uint8* dst_argb, const uint8* src_argb,
int dst_width, int x, int dx) {
- int tmp = 0;
+ int tmp;
const uint8* src_tmp = src_argb;
asm volatile (
"1: \n"
"vst1.32 {q0, q1}, [%0]! \n" // store pixels
"subs %2, %2, #8 \n" // 8 processed per loop
"bgt 1b \n"
- : "+r"(dst_argb), // %0
- "+r"(src_argb), // %1
- "+r"(dst_width), // %2
- "+r"(x), // %3
- "+r"(dx), // %4
- "+r"(tmp), // %5
- "+r"(src_tmp) // %6
+ : "+r"(dst_argb), // %0
+ "+r"(src_argb), // %1
+ "+r"(dst_width), // %2
+ "+r"(x), // %3
+ "+r"(dx), // %4
+ "=&r"(tmp), // %5
+ "+r"(src_tmp) // %6
:
: "memory", "cc", "q0", "q1"
);
void ScaleAddRows_NEON(const uint8* src_ptr, ptrdiff_t src_stride,
uint16* dst_ptr, int src_width, int src_height) {
- const uint8* src_tmp = NULL;
+ const uint8* src_tmp;
asm volatile (
"1: \n"
"mov %0, %1 \n"
"add %1, %1, #16 \n"
"subs %w4, %w4, #16 \n" // 16 processed per loop
"b.gt 1b \n"
- : "+r"(src_tmp), // %0
- "+r"(src_ptr), // %1
- "+r"(dst_ptr), // %2
- "+r"(src_stride), // %3
- "+r"(src_width), // %4
- "+r"(src_height) // %5
+ : "=&r"(src_tmp), // %0
+ "+r"(src_ptr), // %1
+ "+r"(dst_ptr), // %2
+ "+r"(src_stride), // %3
+ "+r"(src_width), // %4
+ "+r"(src_height) // %5
:
: "memory", "cc", "w12", "v0", "v1", "v2", "v3" // Clobber List
);
int64 dst_width64 = (int64) dst_width; // Work around ios 64 bit warning.
int64 x64 = (int64) x;
int64 dx64 = (int64) dx;
- int64 tmp64 = 0;
+ int64 tmp64;
asm volatile (
"1: \n"
LOAD1_DATA32_LANE(v0, 0)
"st1 {v0.4s, v1.4s}, [%0], #32 \n" // store pixels
"subs %w2, %w2, #8 \n" // 8 processed per loop
"b.gt 1b \n"
- : "+r"(dst_argb), // %0
- "+r"(src_argb), // %1
- "+r"(dst_width64), // %2
- "+r"(x64), // %3
- "+r"(dx64), // %4
- "+r"(tmp64), // %5
- "+r"(src_tmp) // %6
+ : "+r"(dst_argb), // %0
+ "+r"(src_argb), // %1
+ "+r"(dst_width64), // %2
+ "+r"(x64), // %3
+ "+r"(dx64), // %4
+ "=&r"(tmp64), // %5
+ "+r"(src_tmp) // %6
:
: "memory", "cc", "v0", "v1"
);
env = os.environ.copy()
# Avoid downloading NaCl toolchain as part of the Chromium hooks.
- env.setdefault('GYP_DEFINES', '')
- env['GYP_DEFINES'] += ' disable_nacl=1'
env['GYP_CHROMIUM_NO_ACTION'] = '1'
gclient_cmd = 'gclient.bat' if sys.platform.startswith('win') else 'gclient'
args = [