ref: 2444327a6c11d9e89bdd972a4a0764d1c8666b95
parent: 3f2ea77908b70e382b967b7af4d49658b12e0bb2
author: dongzhang <[email protected]>
date: Tue Apr 22 06:49:20 EDT 2014
Add expand picture support for ARM64 NEON Remove duplicate MACROS
--- a/codec/build/iOS/common/common.xcodeproj/project.pbxproj
+++ b/codec/build/iOS/common/common.xcodeproj/project.pbxproj
@@ -25,6 +25,8 @@
4CE443F318B722CD0017DF25 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 4CE443F118B722CD0017DF25 /* InfoPlist.strings */; };
4CE443F518B722CD0017DF25 /* commonTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CE443F418B722CD0017DF25 /* commonTests.m */; };
F0B204F918FD23BF005DA23F /* copy_mb.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F0B204F818FD23BF005DA23F /* copy_mb.cpp */; };
+ F556A8241906673900E156A8 /* arm_arch64_common_macro.S in Sources */ = {isa = PBXBuildFile; fileRef = F556A8221906673900E156A8 /* arm_arch64_common_macro.S */; };
+ F556A8251906673900E156A8 /* expand_picture_aarch64_neon.S in Sources */ = {isa = PBXBuildFile; fileRef = F556A8231906673900E156A8 /* expand_picture_aarch64_neon.S */; };
FAABAA1818E9354A00D4186F /* sad_common.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAABAA1718E9354A00D4186F /* sad_common.cpp */; };
/* End PBXBuildFile section */
@@ -83,6 +85,8 @@
4CE443F418B722CD0017DF25 /* commonTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = commonTests.m; sourceTree = "<group>"; };
F0B204F718FD23B6005DA23F /* copy_mb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = copy_mb.h; sourceTree = "<group>"; };
F0B204F818FD23BF005DA23F /* copy_mb.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = copy_mb.cpp; sourceTree = "<group>"; };
+ F556A8221906673900E156A8 /* arm_arch64_common_macro.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; name = arm_arch64_common_macro.S; path = arm64/arm_arch64_common_macro.S; sourceTree = "<group>"; };
+ F556A8231906673900E156A8 /* expand_picture_aarch64_neon.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; name = expand_picture_aarch64_neon.S; path = arm64/expand_picture_aarch64_neon.S; sourceTree = "<group>"; };
FAABAA1618E9353F00D4186F /* sad_common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sad_common.h; sourceTree = "<group>"; };
FAABAA1718E9354A00D4186F /* sad_common.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = sad_common.cpp; sourceTree = "<group>"; };
/* End PBXFileReference section */
@@ -207,6 +211,7 @@
4CE4472F18BC61650017DF25 /* common */ = {
isa = PBXGroup;
children = (
+ F556A81D1906669F00E156A8 /* arm64 */,
4C3406B118D96EA600DFA14A /* arm */,
4C3406B618D96EA600DFA14A /* inc */,
4C3406C318D96EA600DFA14A /* src */,
@@ -215,6 +220,15 @@
path = ../../../common;
sourceTree = "<group>";
};
+ F556A81D1906669F00E156A8 /* arm64 */ = {
+ isa = PBXGroup;
+ children = (
+ F556A8221906673900E156A8 /* arm_arch64_common_macro.S */,
+ F556A8231906673900E156A8 /* expand_picture_aarch64_neon.S */,
+ );
+ name = arm64;
+ sourceTree = "<group>";
+ };
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@@ -297,6 +311,7 @@
buildActionMask = 2147483647;
files = (
4C3406C918D96EA600DFA14A /* arm_arch_common_macro.S in Sources */,
+ F556A8241906673900E156A8 /* arm_arch64_common_macro.S in Sources */,
4C3406CE18D96EA600DFA14A /* crt_util_safe_x.cpp in Sources */,
4C3406CF18D96EA600DFA14A /* deblocking_common.cpp in Sources */,
4C3406D018D96EA600DFA14A /* logging.cpp in Sources */,
@@ -305,6 +320,7 @@
4C3406CB18D96EA600DFA14A /* expand_picture_neon.S in Sources */,
4CC61F0918FF6B4B00E56EAB /* copy_mb_neon.S in Sources */,
4C3406CD18D96EA600DFA14A /* cpu.cpp in Sources */,
+ F556A8251906673900E156A8 /* expand_picture_aarch64_neon.S in Sources */,
4C3406CA18D96EA600DFA14A /* deblocking_neon.S in Sources */,
F0B204F918FD23BF005DA23F /* copy_mb.cpp in Sources */,
FAABAA1818E9354A00D4186F /* sad_common.cpp in Sources */,
@@ -422,7 +438,10 @@
GCC_C_LANGUAGE_STANDARD = "compiler-default";
GCC_OPTIMIZATION_LEVEL = 3;
GCC_PREPROCESSOR_DEFINITIONS = "";
- "GCC_PREPROCESSOR_DEFINITIONS[sdk=iphoneos*][arch=arm64]" = APPLE_IOS;
+ "GCC_PREPROCESSOR_DEFINITIONS[sdk=iphoneos*][arch=arm64]" = (
+ APPLE_IOS,
+ HAVE_NEON_AARCH64,
+ );
"GCC_PREPROCESSOR_DEFINITIONS[sdk=iphoneos*][arch=armv7]" = (
APPLE_IOS,
HAVE_NEON,
@@ -449,7 +468,10 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
DSTROOT = /tmp/common.dst;
GCC_C_LANGUAGE_STANDARD = "compiler-default";
- "GCC_PREPROCESSOR_DEFINITIONS[sdk=iphoneos*][arch=arm64]" = APPLE_IOS;
+ "GCC_PREPROCESSOR_DEFINITIONS[sdk=iphoneos*][arch=arm64]" = (
+ APPLE_IOS,
+ HAVE_NEON_AARCH64,
+ );
"GCC_PREPROCESSOR_DEFINITIONS[sdk=iphoneos*][arch=armv7]" = (
APPLE_IOS,
HAVE_NEON,
--- a/codec/build/iOS/dec/welsdec/welsdec.xcodeproj/project.pbxproj
+++ b/codec/build/iOS/dec/welsdec/welsdec.xcodeproj/project.pbxproj
@@ -551,7 +551,10 @@
DSTROOT = /tmp/welsdec.dst;
GCC_OPTIMIZATION_LEVEL = 3;
GCC_PREPROCESSOR_DEFINITIONS = "";
- "GCC_PREPROCESSOR_DEFINITIONS[sdk=iphoneos*][arch=arm64]" = APPLE_IOS;
+ "GCC_PREPROCESSOR_DEFINITIONS[sdk=iphoneos*][arch=arm64]" = (
+ APPLE_IOS,
+ HAVE_NEON_AARCH64,
+ );
"GCC_PREPROCESSOR_DEFINITIONS[sdk=iphoneos*][arch=armv7]" = (
APPLE_IOS,
HAVE_NEON,
@@ -582,7 +585,10 @@
CLANG_CXX_LIBRARY = "compiler-default";
CODE_SIGN_IDENTITY = "iPhone Developer";
DSTROOT = /tmp/welsdec.dst;
- "GCC_PREPROCESSOR_DEFINITIONS[sdk=iphoneos*][arch=arm64]" = APPLE_IOS;
+ "GCC_PREPROCESSOR_DEFINITIONS[sdk=iphoneos*][arch=arm64]" = (
+ APPLE_IOS,
+ HAVE_NEON_AARCH64,
+ );
"GCC_PREPROCESSOR_DEFINITIONS[sdk=iphoneos*][arch=armv7]" = (
APPLE_IOS,
HAVE_NEON,
--- a/codec/build/iOS/enc/welsenc/welsenc.xcodeproj/project.pbxproj
+++ b/codec/build/iOS/enc/welsenc/welsenc.xcodeproj/project.pbxproj
@@ -632,7 +632,10 @@
GCC_C_LANGUAGE_STANDARD = "compiler-default";
GCC_OPTIMIZATION_LEVEL = 3;
GCC_PREPROCESSOR_DEFINITIONS = "";
- "GCC_PREPROCESSOR_DEFINITIONS[sdk=iphoneos*][arch=arm64]" = APPLE_IOS;
+ "GCC_PREPROCESSOR_DEFINITIONS[sdk=iphoneos*][arch=arm64]" = (
+ APPLE_IOS,
+ HAVE_NEON_AARCH64,
+ );
"GCC_PREPROCESSOR_DEFINITIONS[sdk=iphoneos*][arch=armv7]" = (
APPLE_IOS,
HAVE_NEON,
@@ -667,7 +670,10 @@
DSTROOT = /tmp/welsenc.dst;
GCC_C_LANGUAGE_STANDARD = "compiler-default";
GCC_PREPROCESSOR_DEFINITIONS = "";
- "GCC_PREPROCESSOR_DEFINITIONS[sdk=iphoneos*][arch=arm64]" = APPLE_IOS;
+ "GCC_PREPROCESSOR_DEFINITIONS[sdk=iphoneos*][arch=arm64]" = (
+ APPLE_IOS,
+ HAVE_NEON_AARCH64,
+ );
"GCC_PREPROCESSOR_DEFINITIONS[sdk=iphoneos*][arch=armv7]" = (
APPLE_IOS,
HAVE_NEON,
--- /dev/null
+++ b/codec/common/arm64/arm_arch64_common_macro.S
@@ -1,0 +1,62 @@
+/*!
+ * \copy
+ * Copyright (c) 2013, Cisco Systems
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifdef __APPLE__
+
+.macro WELS_ASM_ARCH64_FUNC_BEGIN
+.align 2
+.globl _$0
+_$0:
+.endm
+
+.macro WELS_ASM_ARCH64_FUNC_END
+ret lr
+.endm
+#else
+
+.syntax unified
+.section .note.GNU-stack,"",%progbits // Mark stack as non-executable
+.text
+
+.macro WELS_ASM_ARCH64_FUNC_BEGIN funcName
+.align 2
+.global \funcName
+.type \funcName, %function
+.func \funcName
+\funcName:
+.endm
+
+.macro WELS_ASM_ARCH64_FUNC_END
+ret lr
+.endfunc
+.endm
+#endif
--- /dev/null
+++ b/codec/common/arm64/expand_picture_aarch64_neon.S
@@ -1,0 +1,143 @@
+/*!
+ * \copy
+ * Copyright (c) 2013, Cisco Systems
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifdef HAVE_NEON_AARCH64
+.text
+#include "arm_arch64_common_macro.S"
+
+WELS_ASM_ARCH64_FUNC_BEGIN ExpandPictureLuma_AArch64_neon
+ mov x7, x0
+ mov x8, x3
+ add x4, x7, x2
+ sub x4, x4, #1
+ mov x10, #16
+ //For the left and right expand
+_expand_picture_luma_loop2:
+ sub x5, x7, #32
+ add x6, x4, #1
+ ld1r {v0.16b}, [x7], x1
+ ld1r {v2.16b}, [x4], x1
+ mov.16b v1, v0
+ mov.16b v3, v2
+ st2 {v0.16b, v1.16b}, [x5]
+ st2 {v2.16b, v3.16b}, [x6]
+ sub x8, x8, #1
+ cbnz x8, _expand_picture_luma_loop2
+ //for the top and bottom expand
+ add x2, x2, #64
+ sub x0, x0, #32
+ madd x4, x1, x3, x0
+ sub x4, x4, x1
+_expand_picture_luma_loop0:
+ mov x5, #32
+ msub x5, x5, x1, x0
+ add x6, x4, x1
+ ld1 {v0.16b}, [x0], x10
+ ld1 {v1.16b}, [x4], x10
+ mov x8, #32
+_expand_picture_luma_loop1:
+ st1 {v0.16b}, [x5], x1
+ st1 {v1.16b}, [x6], x1
+ sub x8, x8, #1
+ cbnz x8, _expand_picture_luma_loop1
+
+ sub x2, x2, #16
+ cbnz x2, _expand_picture_luma_loop0
+WELS_ASM_ARCH64_FUNC_END
+
+WELS_ASM_ARCH64_FUNC_BEGIN ExpandPictureChroma_AArch64_neon
+ //Save the dst
+ mov x7, x0
+ mov x8, x3
+ mov x10, #16
+ add x4, x7, x2
+ sub x4, x4, #1
+ //For the left and right expand
+_expand_picture_chroma_loop2:
+ sub x5, x7, #16
+ add x6, x4, #1
+
+ ld1r {v0.16b}, [x7], x1
+ ld1r {v1.16b}, [x4], x1
+
+ st1 {v0.16b}, [x5]
+ st1 {v1.16b}, [x6]
+ sub x8, x8, #1
+ cbnz x8, _expand_picture_chroma_loop2
+
+ //for the top and bottom expand
+ add x2, x2, #32
+ //
+ mov x9, x2
+ mov x11, #15
+ bic x2, x2, x11
+ //
+ sub x0, x0, #16
+ madd x4, x1, x3, x0
+ sub x4, x4, x1
+_expand_picture_chroma_loop0:
+ mov x5, #16
+ msub x5, x5, x1, x0
+ add x6, x4, x1
+ ld1 {v0.16b}, [x0], x10
+ ld1 {v1.16b}, [x4], x10
+
+ mov x8, #16
+_expand_picture_chroma_loop1:
+ st1 {v0.16b}, [x5], x1
+ st1 {v1.16b}, [x6], x1
+ sub x8, x8, #1
+ cbnz x8, _expand_picture_chroma_loop1
+
+ sub x2, x2, #16
+ cbnz x2, _expand_picture_chroma_loop0
+
+ and x9, x9, #15
+ sub x9, x9, #8
+ cbnz x9, _expand_picture_chroma_end
+ mov x5, #16
+ msub x5, x5, x1, x0
+ add x6, x4, x1
+ ld1 {v0.8b}, [x0]
+ ld1 {v1.8b}, [x4]
+
+ mov x8, #16
+_expand_picture_chroma_loop3:
+ st1 {v0.8b}, [x5], x1
+ st1 {v1.8b}, [x6], x1
+ sub x8, x8, #1
+ cbnz x8, _expand_picture_chroma_loop3
+_expand_picture_chroma_end:
+
+WELS_ASM_ARCH64_FUNC_END
+#endif
+
--- a/codec/common/inc/expand_picture_common.h
+++ b/codec/common/inc/expand_picture_common.h
@@ -65,6 +65,10 @@
void ExpandPictureLuma_neon(uint8_t *pDst, const int32_t kiStride, const int32_t kiPicW, const int32_t kiPicH);
void ExpandPictureChroma_neon(uint8_t *pDst, const int32_t kiStride, const int32_t kiPicW, const int32_t kiPicH);
#endif
+#if defined(HAVE_NEON_AARCH64)
+ void ExpandPictureLuma_AArch64_neon(uint8_t *pDst, const int32_t kiStride, const int32_t kiPicW, const int32_t kiPicH);
+ void ExpandPictureChroma_AArch64_neon(uint8_t *pDst, const int32_t kiStride, const int32_t kiPicW, const int32_t kiPicH);
+#endif
#if defined(__cplusplus)
}
#endif//__cplusplus
--- a/codec/decoder/core/src/expand_pic.cpp
+++ b/codec/decoder/core/src/expand_pic.cpp
@@ -129,6 +129,20 @@
pExpandPicFunc->pExpandChromaPicture[1] = ExpandPictureChromaAlign_sse2;
}
#endif//X86_ASM
+#if defined(HAVE_NEON)
+ if ((kuiCpuFlags & WELS_CPU_NEON) == WELS_CPU_NEON) {
+ pExpandPicFunc->pExpandLumaPicture = ExpandPictureLuma_neon;
+ pExpandPicFunc->pExpandChromaPicture[0] = ExpandPictureChroma_neon;
+ pExpandPicFunc->pExpandChromaPicture[1] = ExpandPictureChroma_neon;
+ }
+#endif//HAVE_NEON
+#if defined(HAVE_NEON_AARCH64)
+ if ((kuiCpuFlags & WELS_CPU_NEON) == WELS_CPU_NEON) {
+ pExpandPicFunc->pExpandLumaPicture = ExpandPictureLuma_AArch64_neon;
+ pExpandPicFunc->pExpandChromaPicture[0] = ExpandPictureChroma_AArch64_neon;
+ pExpandPicFunc->pExpandChromaPicture[1] = ExpandPictureChroma_AArch64_neon;
+ }
+#endif//HAVE_NEON_AARCH64
}
void ExpandReferencingPicture (PPicture pPic, PExpandPictureFunc pExpLuma, PExpandPictureFunc pExpChroma[2]) {
--- a/codec/encoder/core/src/expand_pic.cpp
+++ b/codec/encoder/core/src/expand_pic.cpp
@@ -136,6 +136,13 @@
pFuncList->pfExpandChromaPicture[1] = ExpandPictureChroma_neon;
}
#endif//HAVE_NEON
+#if defined(HAVE_NEON_AARCH64)
+ if (kuiCPUFlag & WELS_CPU_NEON) {
+ pFuncList->pfExpandLumaPicture = ExpandPictureLuma_AArch64_neon;
+ pFuncList->pfExpandChromaPicture[0] = ExpandPictureChroma_AArch64_neon;
+ pFuncList->pfExpandChromaPicture[1] = ExpandPictureChroma_AArch64_neon;
+ }
+#endif//HAVE_NEON_AARCH64
}