# HG changeset patch # User Dnyaneshwar G <dnyanesh...@multicorewareinc.com> # Date 1452321658 -19800 # Sat Jan 09 12:10:58 2016 +0530 # Node ID cd9318b1671bb24212321fcd005381e50642af4c # Parent d94f6c2b45f87f5b4b10b4fa70f8a9bd03d3d1c2 testbench: setup testbench for ARM assembly
X86 intrinsics has been commented from the ARM testbench. This ARM testbench is for Linux and ARMv6 arch and above diff -r d94f6c2b45f8 -r cd9318b1671b source/CMakeLists.txt --- a/source/CMakeLists.txt Sat Jan 09 11:32:33 2016 +0530 +++ b/source/CMakeLists.txt Sat Jan 09 12:10:58 2016 +0530 @@ -275,7 +275,9 @@ endif(GCC) find_package(Yasm) -if(YASM_FOUND AND X86) +if(ARM OR CROSS_COMPILE_ARM) + option(ENABLE_ASSEMBLY "Enable use of assembly coded primitives" OFF) +elseif(YASM_FOUND AND X86) if (YASM_VERSION_STRING VERSION_LESS "1.2.0") message(STATUS "Yasm version ${YASM_VERSION_STRING} is too old. 1.2.0 or later required") option(ENABLE_ASSEMBLY "Enable use of assembly coded primitives" OFF) @@ -423,15 +425,22 @@ else() set(SUFFIX o) endif() - foreach(ASM ${MSVC_ASMS}) - set(YASM_SRC ${CMAKE_CURRENT_SOURCE_DIR}/common/x86/${ASM}) - list(APPEND YASM_SRCS ${YASM_SRC}) - list(APPEND YASM_OBJS ${ASM}.${SUFFIX}) - add_custom_command( - OUTPUT ${ASM}.${SUFFIX} - COMMAND ${YASM_EXECUTABLE} ARGS ${YASM_FLAGS} ${YASM_SRC} -o ${ASM}.${SUFFIX} - DEPENDS ${YASM_SRC}) - endforeach() + + if(ARM OR CROSS_COMPILE_ARM) + # compile ARM arch asm files here + + elseif(X86) + # compile X86 arch asm files here + foreach(ASM ${MSVC_ASMS}) + set(YASM_SRC ${CMAKE_CURRENT_SOURCE_DIR}/common/x86/${ASM}) + list(APPEND YASM_SRCS ${YASM_SRC}) + list(APPEND YASM_OBJS ${ASM}.${SUFFIX}) + add_custom_command( + OUTPUT ${ASM}.${SUFFIX} + COMMAND ${YASM_EXECUTABLE} ARGS ${YASM_FLAGS} ${YASM_SRC} -o ${ASM}.${SUFFIX} + DEPENDS ${YASM_SRC}) + endforeach() + endif() endif() source_group(ASM FILES ${YASM_SRCS}) diff -r d94f6c2b45f8 -r cd9318b1671b source/common/CMakeLists.txt --- a/source/common/CMakeLists.txt Sat Jan 09 11:32:33 2016 +0530 +++ b/source/common/CMakeLists.txt Sat Jan 09 12:10:58 2016 +0530 @@ -16,12 +16,14 @@ if(ENABLE_ASSEMBLY) set_source_files_properties(threading.cpp primitives.cpp PROPERTIES COMPILE_FLAGS -DENABLE_ASSEMBLY=1) list(APPEND VFLAGS "-DENABLE_ASSEMBLY=1") +endif(ENABLE_ASSEMBLY) +if(ENABLE_ASSEMBLY AND X86) set(SSE3 vec/dct-sse3.cpp) set(SSSE3 vec/dct-ssse3.cpp) set(SSE41 vec/dct-sse41.cpp) - if(MSVC AND X86) + if(MSVC) set(PRIMITIVES ${SSE3} ${SSSE3} ${SSE41}) set(WARNDISABLE "/wd4100") # unreferenced formal parameter if(INTEL_CXX) @@ -38,7 +40,7 @@ set_source_files_properties(${SSE3} ${SSSE3} ${SSE41} PROPERTIES COMPILE_FLAGS "${WARNDISABLE} /arch:SSE2") endif() endif() - if(GCC AND X86) + if(GCC) if(CLANG) # llvm intrinsic headers cause shadow warnings set(WARNDISABLE "-Wno-shadow -Wno-unused-parameter") @@ -81,7 +83,20 @@ set(ASM_PRIMITIVES ${ASM_PRIMITIVES} x86/${SRC}) endforeach() source_group(Assembly FILES ${ASM_PRIMITIVES}) -endif(ENABLE_ASSEMBLY) +endif(ENABLE_ASSEMBLY AND X86) + +if(ENABLE_ASSEMBLY AND (ARM OR CROSS_COMPILE_ARM)) + set(C_SRCS asm-primitives.cpp pixel.h mc.h ipfilter8.h blockcopy8.h dct8.h loopfilter.h) + + # add ARM assembly/intrinsic files here + set(A_SRCS) + set(VEC_PRIMITIVES) + + foreach(SRC ${C_SRCS}) + set(ASM_PRIMITIVES ${ASM_PRIMITIVES} arm/${SRC}) + endforeach() + source_group(Assembly FILES ${ASM_PRIMITIVES}) +endif(ENABLE_ASSEMBLY AND (ARM OR CROSS_COMPILE_ARM)) # set_target_properties can't do list expansion string(REPLACE ";" " " VERSION_FLAGS "${VFLAGS}") diff -r d94f6c2b45f8 -r cd9318b1671b source/common/arm/asm-primitives.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/source/common/arm/asm-primitives.cpp Sat Jan 09 12:10:58 2016 +0530 @@ -0,0 +1,40 @@ +/***************************************************************************** + * Copyright (C) 2016 x265 project + * + * Authors: Steve Borho <st...@borho.org> + * Praveen Kumar Tiwari <prav...@multicorewareinc.com> + * Min Chen <chenm...@163.com> <min.c...@multicorewareinc.com> + * Dnyaneshwar Gorade <dnyanesh...@multicorewareinc.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at license @ x265.com. + *****************************************************************************/ + +#include "common.h" +#include "primitives.h" +#include "x265.h" +#include "cpu.h" + + +namespace X265_NS { +// private x265 namespace + +void setupAssemblyPrimitives(EncoderPrimitives &p, int cpuMask) +{ + +} +} // namespace X265_NS diff -r d94f6c2b45f8 -r cd9318b1671b source/common/arm/blockcopy8.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/source/common/arm/blockcopy8.h Sat Jan 09 12:10:58 2016 +0530 @@ -0,0 +1,29 @@ +/***************************************************************************** + * Copyright (C) 2016 x265 project + * + * Authors: Steve Borho <st...@borho.org> + * Min Chen <chenm...@163.com> + * Dnyaneshwar Gorade <dnyanesh...@multicorewareinc.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at license @ x265.com. + *****************************************************************************/ + +#ifndef X265_BLOCKCOPY8_H +#define X265_BLOCKCOPY8_H + +#endif // ifndef X265_I386_PIXEL_H diff -r d94f6c2b45f8 -r cd9318b1671b source/common/arm/dct8.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/source/common/arm/dct8.h Sat Jan 09 12:10:58 2016 +0530 @@ -0,0 +1,28 @@ +/***************************************************************************** + * Copyright (C) 2016 x265 project + * + * Authors: Min Chen <chenm...@163.com> + * Dnyaneshwar Gorade <dnyanesh...@multicorewareinc.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at license @ x265.com. + *****************************************************************************/ + +#ifndef X265_DCT8_H +#define X265_DCT8_H + +#endif // ifndef X265_DCT8_H diff -r d94f6c2b45f8 -r cd9318b1671b source/common/arm/intrapred.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/source/common/arm/intrapred.h Sat Jan 09 12:10:58 2016 +0530 @@ -0,0 +1,31 @@ +/***************************************************************************** + * intrapred.h: Intra Prediction metrics + ***************************************************************************** + * Copyright (C) 2003-2013 x264 project + * + * Authors: Min Chen <chenm...@163.com> <min.c...@multicorewareinc.com> + * Praveen Kumar Tiwari <prav...@multicorewareinc.com> + * Dnyaneshwar Gorade <dnyanesh...@multicorewareinc.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at license @ x265.com. + *****************************************************************************/ + +#ifndef X265_INTRAPRED_H +#define X265_INTRAPRED_H + +#endif // ifndef X265_INTRAPRED_H diff -r d94f6c2b45f8 -r cd9318b1671b source/common/arm/ipfilter8.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/source/common/arm/ipfilter8.h Sat Jan 09 12:10:58 2016 +0530 @@ -0,0 +1,28 @@ +/***************************************************************************** + * Copyright (C) 2016 x265 project + * + * Authors: Steve Borho <st...@borho.org> + * Dnyaneshwar Gorade <dnyanesh...@multicorewareinc.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at license @ x265.com. + *****************************************************************************/ + +#ifndef X265_IPFILTER8_H +#define X265_IPFILTER8_H + +#endif // ifndef X265_IPFILTER8_H diff -r d94f6c2b45f8 -r cd9318b1671b source/common/arm/loopfilter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/source/common/arm/loopfilter.h Sat Jan 09 12:10:58 2016 +0530 @@ -0,0 +1,29 @@ +/***************************************************************************** + * Copyright (C) 2016 x265 project + * + * Authors: Dnyaneshwar Gorade <dnyanesh...@multicorewareinc.com> + * Praveen Kumar Tiwari <prav...@multicorewareinc.com> +;* Min Chen <chenm...@163.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at license @ x265.com. + *****************************************************************************/ + +#ifndef X265_LOOPFILTER_H +#define X265_LOOPFILTER_H + +#endif // ifndef X265_LOOPFILTER_H diff -r d94f6c2b45f8 -r cd9318b1671b source/common/arm/mc.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/source/common/arm/mc.h Sat Jan 09 12:10:58 2016 +0530 @@ -0,0 +1,27 @@ +/***************************************************************************** + * Copyright (C) 2016 x265 project + * + * Authors: Steve Borho <st...@borho.org> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at license @ x265.com. + *****************************************************************************/ + +#ifndef X265_MC_H +#define X265_MC_H + +#endif // ifndef X265_MC_H diff -r d94f6c2b45f8 -r cd9318b1671b source/common/arm/pixel-util.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/source/common/arm/pixel-util.h Sat Jan 09 12:10:58 2016 +0530 @@ -0,0 +1,28 @@ +/***************************************************************************** + * Copyright (C) 2016 x265 project + * + * Authors: Steve Borho <st...@borho.org> +;* Min Chen <chenm...@163.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at license @ x265.com. + *****************************************************************************/ + +#ifndef X265_PIXEL_UTIL_H +#define X265_PIXEL_UTIL_H + +#endif // ifndef X265_PIXEL_UTIL_H diff -r d94f6c2b45f8 -r cd9318b1671b source/common/arm/pixel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/source/common/arm/pixel.h Sat Jan 09 12:10:58 2016 +0530 @@ -0,0 +1,33 @@ +/***************************************************************************** + * pixel.h: x86 pixel metrics + ***************************************************************************** + * Copyright (C) 2003-2013 x264 project + * Copyright (C) 2013-2016 x265 project + * + * Authors: Laurent Aimar <fen...@via.ecp.fr> + * Loren Merritt <lor...@u.washington.edu> + * Fiona Glaser <fi...@x264.com> +;* Min Chen <chenm...@163.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at license @ x265.com. + *****************************************************************************/ + +#ifndef X265_I386_PIXEL_H +#define X265_I386_PIXEL_H + +#endif // ifndef X265_I386_PIXEL_H diff -r d94f6c2b45f8 -r cd9318b1671b source/common/primitives.cpp --- a/source/common/primitives.cpp Sat Jan 09 11:32:33 2016 +0530 +++ b/source/common/primitives.cpp Sat Jan 09 12:10:58 2016 +0530 @@ -238,7 +238,9 @@ primitives.cu[i].intra_pred_allangs = NULL; #if ENABLE_ASSEMBLY +#if X265_ARCH_X86 setupInstrinsicPrimitives(primitives, param->cpuid); +#endif setupAssemblyPrimitives(primitives, param->cpuid); #endif @@ -249,7 +251,7 @@ } } -#if ENABLE_ASSEMBLY +#if ENABLE_ASSEMBLY && X265_ARCH_X86 /* these functions are implemented in assembly. When assembly is not being * compiled, they are unnecessary and can be NOPs */ #else diff -r d94f6c2b45f8 -r cd9318b1671b source/test/CMakeLists.txt --- a/source/test/CMakeLists.txt Sat Jan 09 11:32:33 2016 +0530 +++ b/source/test/CMakeLists.txt Sat Jan 09 12:10:58 2016 +0530 @@ -1,4 +1,12 @@ # vim: syntax=cmake + +check_symbol_exists(__rdtsc "intrin.h" HAVE_RDTSC) +if(HAVE_RDTSC) + add_definitions(-DHAVE_RDTSC=1) +endif() + +# add X86 assembly files +if(X86) enable_language(ASM_YASM) if(MSVC_IDE) @@ -11,11 +19,17 @@ else() set(YASM_SRC checkasm-a.asm) endif() +endif(X86) -check_symbol_exists(__rdtsc "intrin.h" HAVE_RDTSC) -if(HAVE_RDTSC) - add_definitions(-DHAVE_RDTSC=1) -endif() +# add ARM assembly files +if(ARM OR CROSS_COMPILE_ARM) + set(YASM_SRC) +endif(ARM OR CROSS_COMPILE_ARM) + +# add PowerPC assembly files +if(POWER) + set(YASM_SRC) +endif(POWER) add_executable(TestBench ${YASM_SRC} testbench.cpp testharness.h @@ -23,6 +37,7 @@ mbdstharness.cpp mbdstharness.h ipfilterharness.cpp ipfilterharness.h intrapredharness.cpp intrapredharness.h) + target_link_libraries(TestBench x265-static ${PLATFORM_LIBS}) if(LINKER_OPTIONS) if(EXTRA_LIB) diff -r d94f6c2b45f8 -r cd9318b1671b source/test/testbench.cpp --- a/source/test/testbench.cpp Sat Jan 09 11:32:33 2016 +0530 +++ b/source/test/testbench.cpp Sat Jan 09 12:10:58 2016 +0530 @@ -169,6 +169,9 @@ { "XOP", X265_CPU_XOP }, { "AVX2", X265_CPU_AVX2 }, { "BMI2", X265_CPU_AVX2 | X265_CPU_BMI1 | X265_CPU_BMI2 }, + { "ARMv6", X265_CPU_ARMV6 }, + { "NEON", X265_CPU_NEON }, + { "FastNeonMRC", X265_CPU_FAST_NEON_MRC }, { "", 0 }, }; @@ -182,6 +185,7 @@ else continue; +#if X265_ARCH_X86 EncoderPrimitives vecprim; memset(&vecprim, 0, sizeof(vecprim)); setupInstrinsicPrimitives(vecprim, test_arch[i].flag); @@ -197,6 +201,7 @@ return -1; } } +#endif EncoderPrimitives asmprim; memset(&asmprim, 0, sizeof(asmprim)); @@ -220,7 +225,9 @@ EncoderPrimitives optprim; memset(&optprim, 0, sizeof(optprim)); +#if X265_ARCH_X86 setupInstrinsicPrimitives(optprim, cpuid); +#endif setupAssemblyPrimitives(optprim, cpuid); /* Note that we do not setup aliases for performance tests, that would be diff -r d94f6c2b45f8 -r cd9318b1671b source/test/testharness.h --- a/source/test/testharness.h Sat Jan 09 11:32:33 2016 +0530 +++ b/source/test/testharness.h Sat Jan 09 12:10:58 2016 +0530 @@ -75,10 +75,14 @@ { uint32_t a = 0; +#if X265_ARCH_X86 asm volatile("rdtsc" : "=a" (a) ::"edx"); +#elseif X265_ARCH_ARM + // TOD-DO: verify following inline asm to get cpu Timestamp Counter for ARM arch + // asm volatile("mrc p15, 0, %0, c9, c13, 0" : "=r"(a)); +#endif return a; } - #endif // ifdef _MSC_VER #define BENCH_RUNS 1000 @@ -125,7 +129,7 @@ * needs an explicit asm check because it only sometimes crashes in normal use. */ intptr_t PFX(checkasm_call)(intptr_t (*func)(), int *ok, ...); float PFX(checkasm_call_float)(float (*func)(), int *ok, ...); -#else +#elseif X265_ARCH_ARM == 0 #define PFX(stack_pagealign)(func, align) func() #endif _______________________________________________ x265-devel mailing list x265-devel@videolan.org https://mailman.videolan.org/listinfo/x265-devel