From b2e5bfdf7ebdccca73e81cc1ef34524b5408edb6 Mon Sep 17 00:00:00 2001
From: Andrew Randrianasulu <randrianasulu@gmail.com>
Date: Wed, 19 May 2021 13:00:24 +0300
Subject: [PATCH 10/22] libaom 3.1.0 and libwebp 1.1.0 patches for thirdparty

---
 .../thirdparty/src/libaom-v3.1.0.patch1       | 21 +++++++++++++++++
 .../thirdparty/src/libwebp-1.1.0.patch1       | 23 +++++++++++++++++++
 .../thirdparty/src/libwebp-1.1.0.patch2       | 18 +++++++++++++++
 3 files changed, 62 insertions(+)
 create mode 100644 cinelerra-5.1/thirdparty/src/libaom-v3.1.0.patch1
 create mode 100644 cinelerra-5.1/thirdparty/src/libwebp-1.1.0.patch1
 create mode 100644 cinelerra-5.1/thirdparty/src/libwebp-1.1.0.patch2

diff --git a/cinelerra-5.1/thirdparty/src/libaom-v3.1.0.patch1 b/cinelerra-5.1/thirdparty/src/libaom-v3.1.0.patch1
new file mode 100644
index 00000000..befe1c14
--- /dev/null
+++ b/cinelerra-5.1/thirdparty/src/libaom-v3.1.0.patch1
@@ -0,0 +1,21 @@
+--- libaom-v3.0.0/aom_ports/arm_cpudetect.c	2020-07-10 02:32:42.000000000 +0300
++++ libaom-v3.0.0_1/aom_ports/arm_cpudetect.c	2021-05-08 05:18:23.404156362 +0300
+@@ -87,7 +87,7 @@
+   return flags & mask;
+ }
+ 
+-#elif defined(__ANDROID__) /* end _MSC_VER */
++#elif (defined(__ANDROID__) && !defined(__TERMUX__))/* end _MSC_VER */
+ #include <cpu-features.h>
+ 
+ int aom_arm_cpu_caps(void) {
+@@ -106,8 +106,7 @@
+   return flags & mask;
+ }
+ 
+-#elif defined(__linux__) /* end __ANDROID__ */
+-
++#elif defined(__LINUX__) || defined(__TERMUX__)/* end __ANDROID__ */
+ #include <stdio.h>
+ 
+ int aom_arm_cpu_caps(void) {
diff --git a/cinelerra-5.1/thirdparty/src/libwebp-1.1.0.patch1 b/cinelerra-5.1/thirdparty/src/libwebp-1.1.0.patch1
new file mode 100644
index 00000000..9cab9ed5
--- /dev/null
+++ b/cinelerra-5.1/thirdparty/src/libwebp-1.1.0.patch1
@@ -0,0 +1,23 @@
+--- libwebp-1.1.0/CMakeLists.txt	2019-12-21 16:37:43.000000000 +0300
++++ libwebp-1.1.0/CMakeLists.txt	2021-05-08 09:02:20.884388273 +0300
+@@ -75,20 +75,6 @@
+ 
+ # ##############################################################################
+ # Android only.
+-if(ANDROID)
+-  include_directories(${ANDROID_NDK}/sources/android/cpufeatures)
+-  add_library(cpufeatures STATIC
+-              ${ANDROID_NDK}/sources/android/cpufeatures/cpu-features.c)
+-  list(APPEND INSTALLED_LIBRARIES cpufeatures)
+-  target_link_libraries(cpufeatures dl)
+-  set(WEBP_DEP_LIBRARIES ${WEBP_DEP_LIBRARIES} cpufeatures)
+-  set(WEBP_DEP_INCLUDE_DIRS ${WEBP_DEP_INCLUDE_DIRS}
+-      ${ANDROID_NDK}/sources/android/cpufeatures)
+-  add_definitions(-DHAVE_CPU_FEATURES_H=1)
+-  set(HAVE_CPU_FEATURES_H 1)
+-else()
+-  set(HAVE_CPU_FEATURES_H 0)
+-endif()
+ 
+ function(configure_pkg_config FILE)
+   configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${FILE}.in"
diff --git a/cinelerra-5.1/thirdparty/src/libwebp-1.1.0.patch2 b/cinelerra-5.1/thirdparty/src/libwebp-1.1.0.patch2
new file mode 100644
index 00000000..47bb0f18
--- /dev/null
+++ b/cinelerra-5.1/thirdparty/src/libwebp-1.1.0.patch2
@@ -0,0 +1,18 @@
+--- libwebp-1.1.0/cmake/cpu.cmake	2019-12-21 16:37:43.000000000 +0300
++++ _libwebp-1.1.0/cmake/cpu.cmake	2021-05-08 10:55:09.056074195 +0300
+@@ -46,14 +46,7 @@
+ set(WEBP_SIMD_FILES_TO_INCLUDE)
+ set(WEBP_SIMD_FLAGS_TO_INCLUDE)
+ 
+-if(${ANDROID})
+-  if(${ANDROID_ABI} STREQUAL "armeabi-v7a")
+-    # This is because Android studio uses the configuration "-march=armv7-a
+-    # -mfloat-abi=softfp -mfpu=vfpv3-d16" that does not trigger neon
+-    # optimizations but should (as this configuration does not exist anymore).
+-    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpu=neon ")
+-  endif()
+-endif()
++
+ 
+ list(LENGTH WEBP_SIMD_FLAGS WEBP_SIMD_FLAGS_LENGTH)
+ math(EXPR WEBP_SIMD_FLAGS_RANGE "${WEBP_SIMD_FLAGS_LENGTH} - 1")
-- 
2.31.1

