Commit a37e7bfe authored by Johann's avatar Johann Committed by Commit Bot

use unix line endings

Consistently use one style of line endings for the repository

Change-Id: Idd70e3d7f3a7a6641b268a81e51eebf9c705b67d
Reviewed-on: https://chromium-review.googlesource.com/1107877Reviewed-by: 's avatarFrank Barchard <fbarchard@chromium.org>
Commit-Queue: Frank Barchard <fbarchard@chromium.org>
parent bf25313b
# Copyright 2013 The LibYuv Project Authors. All rights reserved. # Copyright 2013 The LibYuv Project Authors. All rights reserved.
# #
# Use of this source code is governed by a BSD-style license # 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 # that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found # tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All contributing project authors may # in the file PATENTS. All contributing project authors may
# be found in the AUTHORS file in the root of the source tree. # be found in the AUTHORS file in the root of the source tree.
# all.gyp and All target are for benefit of android gyp build. # all.gyp and All target are for benefit of android gyp build.
{ {
'targets': [ 'targets': [
{ {
'target_name': 'All', 'target_name': 'All',
'type': 'none', 'type': 'none',
'dependencies': [ 'dependencies': [
'libyuv.gyp:*', 'libyuv.gyp:*',
'libyuv_test.gyp:*', 'libyuv_test.gyp:*',
], ],
}, },
], ],
} }
# This file contains all the common make variables which are useful for # This file contains all the common make variables which are useful for
# anyone depending on this library. # anyone depending on this library.
# Note that dependencies on NDK are not directly listed since NDK auto adds # Note that dependencies on NDK are not directly listed since NDK auto adds
# them. # them.
LIBYUV_INCLUDES := $(LIBYUV_PATH)/include LIBYUV_INCLUDES := $(LIBYUV_PATH)/include
LIBYUV_C_FLAGS := LIBYUV_C_FLAGS :=
LIBYUV_CPP_FLAGS := LIBYUV_CPP_FLAGS :=
LIBYUV_LDLIBS := LIBYUV_LDLIBS :=
LIBYUV_DEP_MODULES := LIBYUV_DEP_MODULES :=
/* /*
* Copyright 2017 The LibYuv Project Authors. All rights reserved. * Copyright 2017 The LibYuv Project Authors. All rights reserved.
* *
* Use of this source code is governed by a BSD-style license * 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 * that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found * tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may * in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree. * be found in the AUTHORS file in the root of the source tree.
*/ */
#include "libyuv/basic_types.h" #include "libyuv/basic_types.h"
#include "libyuv/compare_row.h" #include "libyuv/compare_row.h"
#include "libyuv/row.h" #include "libyuv/row.h"
// This module is for GCC MSA // This module is for GCC MSA
#if !defined(LIBYUV_DISABLE_MSA) && defined(__mips_msa) #if !defined(LIBYUV_DISABLE_MSA) && defined(__mips_msa)
#include "libyuv/macros_msa.h" #include "libyuv/macros_msa.h"
#ifdef __cplusplus #ifdef __cplusplus
namespace libyuv { namespace libyuv {
extern "C" { extern "C" {
#endif #endif
uint32_t HammingDistance_MSA(const uint8_t* src_a, uint32_t HammingDistance_MSA(const uint8_t* src_a,
const uint8_t* src_b, const uint8_t* src_b,
int count) { int count) {
uint32_t diff = 0u; uint32_t diff = 0u;
int i; int i;
v16u8 src0, src1, src2, src3; v16u8 src0, src1, src2, src3;
v2i64 vec0 = {0}, vec1 = {0}; v2i64 vec0 = {0}, vec1 = {0};
for (i = 0; i < count; i += 32) { for (i = 0; i < count; i += 32) {
src0 = (v16u8)__msa_ld_b((v16i8*)src_a, 0); src0 = (v16u8)__msa_ld_b((v16i8*)src_a, 0);
src1 = (v16u8)__msa_ld_b((v16i8*)src_a, 16); src1 = (v16u8)__msa_ld_b((v16i8*)src_a, 16);
src2 = (v16u8)__msa_ld_b((v16i8*)src_b, 0); src2 = (v16u8)__msa_ld_b((v16i8*)src_b, 0);
src3 = (v16u8)__msa_ld_b((v16i8*)src_b, 16); src3 = (v16u8)__msa_ld_b((v16i8*)src_b, 16);
src0 ^= src2; src0 ^= src2;
src1 ^= src3; src1 ^= src3;
vec0 += __msa_pcnt_d((v2i64)src0); vec0 += __msa_pcnt_d((v2i64)src0);
vec1 += __msa_pcnt_d((v2i64)src1); vec1 += __msa_pcnt_d((v2i64)src1);
src_a += 32; src_a += 32;
src_b += 32; src_b += 32;
} }
vec0 += vec1; vec0 += vec1;
diff = (uint32_t)__msa_copy_u_w((v4i32)vec0, 0); diff = (uint32_t)__msa_copy_u_w((v4i32)vec0, 0);
diff += (uint32_t)__msa_copy_u_w((v4i32)vec0, 2); diff += (uint32_t)__msa_copy_u_w((v4i32)vec0, 2);
return diff; return diff;
} }
uint32_t SumSquareError_MSA(const uint8_t* src_a, uint32_t SumSquareError_MSA(const uint8_t* src_a,
const uint8_t* src_b, const uint8_t* src_b,
int count) { int count) {
uint32_t sse = 0u; uint32_t sse = 0u;
int i; int i;
v16u8 src0, src1, src2, src3; v16u8 src0, src1, src2, src3;
v8i16 vec0, vec1, vec2, vec3; v8i16 vec0, vec1, vec2, vec3;
v4i32 reg0 = {0}, reg1 = {0}, reg2 = {0}, reg3 = {0}; v4i32 reg0 = {0}, reg1 = {0}, reg2 = {0}, reg3 = {0};
v2i64 tmp0; v2i64 tmp0;
for (i = 0; i < count; i += 32) { for (i = 0; i < count; i += 32) {
src0 = (v16u8)__msa_ld_b((v16i8*)src_a, 0); src0 = (v16u8)__msa_ld_b((v16i8*)src_a, 0);
src1 = (v16u8)__msa_ld_b((v16i8*)src_a, 16); src1 = (v16u8)__msa_ld_b((v16i8*)src_a, 16);
src2 = (v16u8)__msa_ld_b((v16i8*)src_b, 0); src2 = (v16u8)__msa_ld_b((v16i8*)src_b, 0);
src3 = (v16u8)__msa_ld_b((v16i8*)src_b, 16); src3 = (v16u8)__msa_ld_b((v16i8*)src_b, 16);
vec0 = (v8i16)__msa_ilvr_b((v16i8)src2, (v16i8)src0); vec0 = (v8i16)__msa_ilvr_b((v16i8)src2, (v16i8)src0);
vec1 = (v8i16)__msa_ilvl_b((v16i8)src2, (v16i8)src0); vec1 = (v8i16)__msa_ilvl_b((v16i8)src2, (v16i8)src0);
vec2 = (v8i16)__msa_ilvr_b((v16i8)src3, (v16i8)src1); vec2 = (v8i16)__msa_ilvr_b((v16i8)src3, (v16i8)src1);
vec3 = (v8i16)__msa_ilvl_b((v16i8)src3, (v16i8)src1); vec3 = (v8i16)__msa_ilvl_b((v16i8)src3, (v16i8)src1);
vec0 = __msa_hsub_u_h((v16u8)vec0, (v16u8)vec0); vec0 = __msa_hsub_u_h((v16u8)vec0, (v16u8)vec0);
vec1 = __msa_hsub_u_h((v16u8)vec1, (v16u8)vec1); vec1 = __msa_hsub_u_h((v16u8)vec1, (v16u8)vec1);
vec2 = __msa_hsub_u_h((v16u8)vec2, (v16u8)vec2); vec2 = __msa_hsub_u_h((v16u8)vec2, (v16u8)vec2);
vec3 = __msa_hsub_u_h((v16u8)vec3, (v16u8)vec3); vec3 = __msa_hsub_u_h((v16u8)vec3, (v16u8)vec3);
reg0 = __msa_dpadd_s_w(reg0, vec0, vec0); reg0 = __msa_dpadd_s_w(reg0, vec0, vec0);
reg1 = __msa_dpadd_s_w(reg1, vec1, vec1); reg1 = __msa_dpadd_s_w(reg1, vec1, vec1);
reg2 = __msa_dpadd_s_w(reg2, vec2, vec2); reg2 = __msa_dpadd_s_w(reg2, vec2, vec2);
reg3 = __msa_dpadd_s_w(reg3, vec3, vec3); reg3 = __msa_dpadd_s_w(reg3, vec3, vec3);
src_a += 32; src_a += 32;
src_b += 32; src_b += 32;
} }
reg0 += reg1; reg0 += reg1;
reg2 += reg3; reg2 += reg3;
reg0 += reg2; reg0 += reg2;
tmp0 = __msa_hadd_s_d(reg0, reg0); tmp0 = __msa_hadd_s_d(reg0, reg0);
sse = (uint32_t)__msa_copy_u_w((v4i32)tmp0, 0); sse = (uint32_t)__msa_copy_u_w((v4i32)tmp0, 0);
sse += (uint32_t)__msa_copy_u_w((v4i32)tmp0, 2); sse += (uint32_t)__msa_copy_u_w((v4i32)tmp0, 2);
return sse; return sse;
} }
#ifdef __cplusplus #ifdef __cplusplus
} // extern "C" } // extern "C"
} // namespace libyuv } // namespace libyuv
#endif #endif
#endif // !defined(LIBYUV_DISABLE_MSA) && defined(__mips_msa) #endif // !defined(LIBYUV_DISABLE_MSA) && defined(__mips_msa)
@echo off @echo off
:: Copyright (c) 2012 The LibYuv Project Authors. All rights reserved. :: Copyright (c) 2012 The LibYuv Project Authors. All rights reserved.
:: ::
:: Use of this source code is governed by a BSD-style license :: 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 :: that can be found in the LICENSE file in the root of the source
:: tree. An additional intellectual property rights grant can be found :: tree. An additional intellectual property rights grant can be found
:: in the file PATENTS. All contributing project authors may :: in the file PATENTS. All contributing project authors may
:: be found in the AUTHORS file in the root of the source tree. :: be found in the AUTHORS file in the root of the source tree.
:: This script is a copy of chrome_tests.bat with the following changes: :: This script is a copy of chrome_tests.bat with the following changes:
:: - Invokes libyuv_tests.py instead of chrome_tests.py :: - Invokes libyuv_tests.py instead of chrome_tests.py
:: - Chromium's Valgrind scripts directory is added to the PYTHONPATH to make :: - Chromium's Valgrind scripts directory is added to the PYTHONPATH to make
:: it possible to execute the Python scripts properly. :: it possible to execute the Python scripts properly.
:: TODO(timurrrr): batch files 'export' all the variables to the parent shell :: TODO(timurrrr): batch files 'export' all the variables to the parent shell
set THISDIR=%~dp0 set THISDIR=%~dp0
set TOOL_NAME="unknown" set TOOL_NAME="unknown"
:: Get the tool name and put it into TOOL_NAME {{{1 :: Get the tool name and put it into TOOL_NAME {{{1
:: NB: SHIFT command doesn't modify %* :: NB: SHIFT command doesn't modify %*
:PARSE_ARGS_LOOP :PARSE_ARGS_LOOP
if %1 == () GOTO:TOOLNAME_NOT_FOUND if %1 == () GOTO:TOOLNAME_NOT_FOUND
if %1 == --tool GOTO:TOOLNAME_FOUND if %1 == --tool GOTO:TOOLNAME_FOUND
SHIFT SHIFT
goto :PARSE_ARGS_LOOP goto :PARSE_ARGS_LOOP
:TOOLNAME_NOT_FOUND :TOOLNAME_NOT_FOUND
echo "Please specify a tool (tsan or drmemory) by using --tool flag" echo "Please specify a tool (tsan or drmemory) by using --tool flag"
exit /B 1 exit /B 1
:TOOLNAME_FOUND :TOOLNAME_FOUND
SHIFT SHIFT
set TOOL_NAME=%1 set TOOL_NAME=%1
:: }}} :: }}}
if "%TOOL_NAME%" == "drmemory" GOTO :SETUP_DRMEMORY if "%TOOL_NAME%" == "drmemory" GOTO :SETUP_DRMEMORY
if "%TOOL_NAME%" == "drmemory_light" GOTO :SETUP_DRMEMORY if "%TOOL_NAME%" == "drmemory_light" GOTO :SETUP_DRMEMORY
if "%TOOL_NAME%" == "drmemory_full" GOTO :SETUP_DRMEMORY if "%TOOL_NAME%" == "drmemory_full" GOTO :SETUP_DRMEMORY
if "%TOOL_NAME%" == "drmemory_pattern" GOTO :SETUP_DRMEMORY if "%TOOL_NAME%" == "drmemory_pattern" GOTO :SETUP_DRMEMORY
if "%TOOL_NAME%" == "tsan" GOTO :SETUP_TSAN if "%TOOL_NAME%" == "tsan" GOTO :SETUP_TSAN
echo "Unknown tool: `%TOOL_NAME%`! Only tsan and drmemory are supported." echo "Unknown tool: `%TOOL_NAME%`! Only tsan and drmemory are supported."
exit /B 1 exit /B 1
:SETUP_DRMEMORY :SETUP_DRMEMORY
if NOT "%DRMEMORY_COMMAND%"=="" GOTO :RUN_TESTS if NOT "%DRMEMORY_COMMAND%"=="" GOTO :RUN_TESTS
:: Set up DRMEMORY_COMMAND to invoke Dr. Memory {{{1 :: Set up DRMEMORY_COMMAND to invoke Dr. Memory {{{1
set DRMEMORY_PATH=%THISDIR%..\..\third_party\drmemory set DRMEMORY_PATH=%THISDIR%..\..\third_party\drmemory
set DRMEMORY_SFX=%DRMEMORY_PATH%\drmemory-windows-sfx.exe set DRMEMORY_SFX=%DRMEMORY_PATH%\drmemory-windows-sfx.exe
if EXIST %DRMEMORY_SFX% GOTO DRMEMORY_BINARY_OK if EXIST %DRMEMORY_SFX% GOTO DRMEMORY_BINARY_OK
echo "Can't find Dr. Memory executables." echo "Can't find Dr. Memory executables."
echo "See http://www.chromium.org/developers/how-tos/using-valgrind/dr-memory" echo "See http://www.chromium.org/developers/how-tos/using-valgrind/dr-memory"
echo "for the instructions on how to get them." echo "for the instructions on how to get them."
exit /B 1 exit /B 1
:DRMEMORY_BINARY_OK :DRMEMORY_BINARY_OK
%DRMEMORY_SFX% -o%DRMEMORY_PATH%\unpacked -y %DRMEMORY_SFX% -o%DRMEMORY_PATH%\unpacked -y
set DRMEMORY_COMMAND=%DRMEMORY_PATH%\unpacked\bin\drmemory.exe set DRMEMORY_COMMAND=%DRMEMORY_PATH%\unpacked\bin\drmemory.exe
:: }}} :: }}}
goto :RUN_TESTS goto :RUN_TESTS
:SETUP_TSAN :SETUP_TSAN
:: Set up PIN_COMMAND to invoke TSan {{{1 :: Set up PIN_COMMAND to invoke TSan {{{1
set TSAN_PATH=%THISDIR%..\..\third_party\tsan set TSAN_PATH=%THISDIR%..\..\third_party\tsan
set TSAN_SFX=%TSAN_PATH%\tsan-x86-windows-sfx.exe set TSAN_SFX=%TSAN_PATH%\tsan-x86-windows-sfx.exe
if EXIST %TSAN_SFX% GOTO TSAN_BINARY_OK if EXIST %TSAN_SFX% GOTO TSAN_BINARY_OK
echo "Can't find ThreadSanitizer executables." echo "Can't find ThreadSanitizer executables."
echo "See http://www.chromium.org/developers/how-tos/using-valgrind/threadsanitizer/threadsanitizer-on-windows" echo "See http://www.chromium.org/developers/how-tos/using-valgrind/threadsanitizer/threadsanitizer-on-windows"
echo "for the instructions on how to get them." echo "for the instructions on how to get them."
exit /B 1 exit /B 1
:TSAN_BINARY_OK :TSAN_BINARY_OK
%TSAN_SFX% -o%TSAN_PATH%\unpacked -y %TSAN_SFX% -o%TSAN_PATH%\unpacked -y
set PIN_COMMAND=%TSAN_PATH%\unpacked\tsan-x86-windows\tsan.bat set PIN_COMMAND=%TSAN_PATH%\unpacked\tsan-x86-windows\tsan.bat
:: }}} :: }}}
goto :RUN_TESTS goto :RUN_TESTS
:RUN_TESTS :RUN_TESTS
set PYTHONPATH=%THISDIR%..\python\google;%THISDIR%..\valgrind set PYTHONPATH=%THISDIR%..\python\google;%THISDIR%..\valgrind
set RUNNING_ON_VALGRIND=yes set RUNNING_ON_VALGRIND=yes
python %THISDIR%libyuv_tests.py %* python %THISDIR%libyuv_tests.py %*
Processor : AArch64 Processor rev 0 (aarch64) Processor : AArch64 Processor rev 0 (aarch64)
processor : 0 processor : 0
processor : 1 processor : 1
processor : 2 processor : 2
processor : 3 processor : 3
processor : 4 processor : 4
processor : 5 processor : 5
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 Features : fp asimd evtstrm aes pmull sha1 sha2 crc32
CPU implementer : 0x41 CPU implementer : 0x41
CPU architecture: AArch64 CPU architecture: AArch64
CPU variant : 0x0 CPU variant : 0x0
CPU part : 0xd07 CPU part : 0xd07
CPU revision : 0 CPU revision : 0
Hardware : Juno Hardware : Juno
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment