AV1-codec-support.patch 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. From: csagan5 <32685696+csagan5@users.noreply.github.com>
  2. Date: Sun, 16 Dec 2018 15:24:19 +0100
  3. Subject: AV1 codec support
  4. libaom build fixes (requires -fPIC)
  5. Report AV1 as playable on Android
  6. ---
  7. media/base/mime_util_internal.cc | 6 +++++-
  8. third_party/libaom/BUILD.gn | 6 ++++--
  9. third_party/libaom/libaom_srcs.gni | 5 +++++
  10. .../config/linux/arm-neon-cpu-detect/config/aom_config.asm | 2 +-
  11. .../config/linux/arm-neon-cpu-detect/config/aom_config.h | 2 +-
  12. .../source/config/linux/arm-neon/config/aom_config.asm | 2 +-
  13. .../libaom/source/config/linux/arm-neon/config/aom_config.h | 2 +-
  14. .../libaom/source/config/linux/arm/config/aom_config.asm | 2 +-
  15. .../libaom/source/config/linux/arm/config/aom_config.h | 2 +-
  16. .../libaom/source/config/linux/arm64/config/aom_config.asm | 2 +-
  17. .../libaom/source/config/linux/arm64/config/aom_config.h | 2 +-
  18. .../source/config/linux/generic/config/aom_config.asm | 2 +-
  19. .../libaom/source/config/linux/generic/config/aom_config.h | 2 +-
  20. .../libaom/source/config/linux/x64/config/aom_config.asm | 2 +-
  21. .../libaom/source/config/linux/x64/config/aom_config.h | 2 +-
  22. 15 files changed, 26 insertions(+), 15 deletions(-)
  23. diff --git a/media/base/mime_util_internal.cc b/media/base/mime_util_internal.cc
  24. --- a/media/base/mime_util_internal.cc
  25. +++ b/media/base/mime_util_internal.cc
  26. @@ -560,9 +560,13 @@ bool MimeUtil::IsCodecSupportedOnAndroid(
  27. case THEORA:
  28. return false;
  29. - // AV1 is not supported on Android yet.
  30. + // AV1 is supported on Android.
  31. case AV1:
  32. +#if BUILDFLAG(ENABLE_AV1_DECODER)
  33. + return true;
  34. +#else
  35. return false;
  36. +#endif
  37. // ----------------------------------------------------------------------
  38. // The remaining codecs may be supported depending on platform abilities.
  39. diff --git a/third_party/libaom/BUILD.gn b/third_party/libaom/BUILD.gn
  40. --- a/third_party/libaom/BUILD.gn
  41. +++ b/third_party/libaom/BUILD.gn
  42. @@ -74,7 +74,7 @@ if (enable_libaom_decoder) {
  43. sources = aom_dsp_common_asm_sse2
  44. sources += aom_dsp_common_asm_ssse3
  45. sources += aom_ports_asm_x86
  46. - defines = [ "CHROMIUM" ]
  47. + defines = [ "CHROMIUM", "PIC" ]
  48. include_dirs = libaom_include_dirs
  49. }
  50. @@ -158,7 +158,7 @@ if (enable_libaom_decoder) {
  51. configs += [ "//build/config/compiler:no_chromium_code" ]
  52. if (current_cpu == "arm") {
  53. configs -= [ "//build/config/compiler:compiler_arm_fpu" ]
  54. - cflags = [ "-mfpu=neon" ]
  55. + cflags = [ "-mfpu=neon", "-fPIC" ]
  56. }
  57. configs += [ ":libaom_config" ]
  58. @@ -203,6 +203,8 @@ if (enable_libaom_decoder) {
  59. if (current_cpu == "arm64" || cpu_arch_full == "arm-neon" ||
  60. cpu_arch_full == "arm-neon-cpu-detect") {
  61. deps += [ ":libaom_intrinsics_neon" ]
  62. + # will detect CPU
  63. + sources += aom_ports_arm_sources
  64. }
  65. if (is_android) {
  66. deps += [ "//third_party/android_ndk:cpu_features" ]
  67. diff --git a/third_party/libaom/libaom_srcs.gni b/third_party/libaom/libaom_srcs.gni
  68. --- a/third_party/libaom/libaom_srcs.gni
  69. +++ b/third_party/libaom/libaom_srcs.gni
  70. @@ -488,6 +488,11 @@ aom_mem_sources = [
  71. aom_ports_asm_x86 = [ "//third_party/libaom/source/libaom/aom_ports/emms.asm" ]
  72. +aom_ports_arm_sources = [
  73. + "//third_party/libaom/source/libaom/aom_ports/arm_cpudetect.c",
  74. + "//third_party/libaom/source/libaom/aom_ports/arm.h",
  75. + ]
  76. +
  77. aom_rtcd_sources = [
  78. "//third_party/libaom/source/libaom/aom_dsp/aom_dsp_rtcd_defs.pl",
  79. "//third_party/libaom/source/libaom/aom_dsp/aom_dsp_rtcd.c",
  80. diff --git a/third_party/libaom/source/config/linux/arm-neon-cpu-detect/config/aom_config.asm b/third_party/libaom/source/config/linux/arm-neon-cpu-detect/config/aom_config.asm
  81. --- a/third_party/libaom/source/config/linux/arm-neon-cpu-detect/config/aom_config.asm
  82. +++ b/third_party/libaom/source/config/linux/arm-neon-cpu-detect/config/aom_config.asm
  83. @@ -45,7 +45,7 @@ CONFIG_MULTITHREAD equ 1
  84. CONFIG_NORMAL_TILE_MODE equ 1
  85. CONFIG_ONE_PASS_SVM equ 0
  86. CONFIG_OS_SUPPORT equ 1
  87. -CONFIG_PIC equ 0
  88. +CONFIG_PIC equ 1
  89. CONFIG_RD_DEBUG equ 0
  90. CONFIG_RUNTIME_CPU_DETECT equ 1
  91. CONFIG_SHARED equ 0
  92. diff --git a/third_party/libaom/source/config/linux/arm-neon-cpu-detect/config/aom_config.h b/third_party/libaom/source/config/linux/arm-neon-cpu-detect/config/aom_config.h
  93. --- a/third_party/libaom/source/config/linux/arm-neon-cpu-detect/config/aom_config.h
  94. +++ b/third_party/libaom/source/config/linux/arm-neon-cpu-detect/config/aom_config.h
  95. @@ -47,7 +47,7 @@
  96. #define CONFIG_NORMAL_TILE_MODE 1
  97. #define CONFIG_ONE_PASS_SVM 0
  98. #define CONFIG_OS_SUPPORT 1
  99. -#define CONFIG_PIC 0
  100. +#define CONFIG_PIC 1
  101. #define CONFIG_RD_DEBUG 0
  102. #define CONFIG_RUNTIME_CPU_DETECT 1
  103. #define CONFIG_SHARED 0
  104. diff --git a/third_party/libaom/source/config/linux/arm-neon/config/aom_config.asm b/third_party/libaom/source/config/linux/arm-neon/config/aom_config.asm
  105. --- a/third_party/libaom/source/config/linux/arm-neon/config/aom_config.asm
  106. +++ b/third_party/libaom/source/config/linux/arm-neon/config/aom_config.asm
  107. @@ -45,7 +45,7 @@ CONFIG_MULTITHREAD equ 1
  108. CONFIG_NORMAL_TILE_MODE equ 1
  109. CONFIG_ONE_PASS_SVM equ 0
  110. CONFIG_OS_SUPPORT equ 1
  111. -CONFIG_PIC equ 0
  112. +CONFIG_PIC equ 1
  113. CONFIG_RD_DEBUG equ 0
  114. CONFIG_RUNTIME_CPU_DETECT equ 0
  115. CONFIG_SHARED equ 0
  116. diff --git a/third_party/libaom/source/config/linux/arm-neon/config/aom_config.h b/third_party/libaom/source/config/linux/arm-neon/config/aom_config.h
  117. --- a/third_party/libaom/source/config/linux/arm-neon/config/aom_config.h
  118. +++ b/third_party/libaom/source/config/linux/arm-neon/config/aom_config.h
  119. @@ -47,7 +47,7 @@
  120. #define CONFIG_NORMAL_TILE_MODE 1
  121. #define CONFIG_ONE_PASS_SVM 0
  122. #define CONFIG_OS_SUPPORT 1
  123. -#define CONFIG_PIC 0
  124. +#define CONFIG_PIC 1
  125. #define CONFIG_RD_DEBUG 0
  126. #define CONFIG_RUNTIME_CPU_DETECT 0
  127. #define CONFIG_SHARED 0
  128. diff --git a/third_party/libaom/source/config/linux/arm/config/aom_config.asm b/third_party/libaom/source/config/linux/arm/config/aom_config.asm
  129. --- a/third_party/libaom/source/config/linux/arm/config/aom_config.asm
  130. +++ b/third_party/libaom/source/config/linux/arm/config/aom_config.asm
  131. @@ -45,7 +45,7 @@ CONFIG_MULTITHREAD equ 1
  132. CONFIG_NORMAL_TILE_MODE equ 1
  133. CONFIG_ONE_PASS_SVM equ 0
  134. CONFIG_OS_SUPPORT equ 1
  135. -CONFIG_PIC equ 0
  136. +CONFIG_PIC equ 1
  137. CONFIG_RD_DEBUG equ 0
  138. CONFIG_RUNTIME_CPU_DETECT equ 0
  139. CONFIG_SHARED equ 0
  140. diff --git a/third_party/libaom/source/config/linux/arm/config/aom_config.h b/third_party/libaom/source/config/linux/arm/config/aom_config.h
  141. --- a/third_party/libaom/source/config/linux/arm/config/aom_config.h
  142. +++ b/third_party/libaom/source/config/linux/arm/config/aom_config.h
  143. @@ -47,7 +47,7 @@
  144. #define CONFIG_NORMAL_TILE_MODE 1
  145. #define CONFIG_ONE_PASS_SVM 0
  146. #define CONFIG_OS_SUPPORT 1
  147. -#define CONFIG_PIC 0
  148. +#define CONFIG_PIC 1
  149. #define CONFIG_RD_DEBUG 0
  150. #define CONFIG_RUNTIME_CPU_DETECT 0
  151. #define CONFIG_SHARED 0
  152. diff --git a/third_party/libaom/source/config/linux/arm64/config/aom_config.asm b/third_party/libaom/source/config/linux/arm64/config/aom_config.asm
  153. --- a/third_party/libaom/source/config/linux/arm64/config/aom_config.asm
  154. +++ b/third_party/libaom/source/config/linux/arm64/config/aom_config.asm
  155. @@ -45,7 +45,7 @@ CONFIG_MULTITHREAD equ 1
  156. CONFIG_NORMAL_TILE_MODE equ 1
  157. CONFIG_ONE_PASS_SVM equ 0
  158. CONFIG_OS_SUPPORT equ 1
  159. -CONFIG_PIC equ 0
  160. +CONFIG_PIC equ 1
  161. CONFIG_RD_DEBUG equ 0
  162. CONFIG_RUNTIME_CPU_DETECT equ 0
  163. CONFIG_SHARED equ 0
  164. diff --git a/third_party/libaom/source/config/linux/arm64/config/aom_config.h b/third_party/libaom/source/config/linux/arm64/config/aom_config.h
  165. --- a/third_party/libaom/source/config/linux/arm64/config/aom_config.h
  166. +++ b/third_party/libaom/source/config/linux/arm64/config/aom_config.h
  167. @@ -47,7 +47,7 @@
  168. #define CONFIG_NORMAL_TILE_MODE 1
  169. #define CONFIG_ONE_PASS_SVM 0
  170. #define CONFIG_OS_SUPPORT 1
  171. -#define CONFIG_PIC 0
  172. +#define CONFIG_PIC 1
  173. #define CONFIG_RD_DEBUG 0
  174. #define CONFIG_RUNTIME_CPU_DETECT 0
  175. #define CONFIG_SHARED 0
  176. diff --git a/third_party/libaom/source/config/linux/generic/config/aom_config.asm b/third_party/libaom/source/config/linux/generic/config/aom_config.asm
  177. --- a/third_party/libaom/source/config/linux/generic/config/aom_config.asm
  178. +++ b/third_party/libaom/source/config/linux/generic/config/aom_config.asm
  179. @@ -45,7 +45,7 @@ CONFIG_MULTITHREAD equ 1
  180. CONFIG_NORMAL_TILE_MODE equ 1
  181. CONFIG_ONE_PASS_SVM equ 0
  182. CONFIG_OS_SUPPORT equ 1
  183. -CONFIG_PIC equ 0
  184. +CONFIG_PIC equ 1
  185. CONFIG_RD_DEBUG equ 0
  186. CONFIG_RUNTIME_CPU_DETECT equ 1
  187. CONFIG_SHARED equ 0
  188. diff --git a/third_party/libaom/source/config/linux/generic/config/aom_config.h b/third_party/libaom/source/config/linux/generic/config/aom_config.h
  189. --- a/third_party/libaom/source/config/linux/generic/config/aom_config.h
  190. +++ b/third_party/libaom/source/config/linux/generic/config/aom_config.h
  191. @@ -47,7 +47,7 @@
  192. #define CONFIG_NORMAL_TILE_MODE 1
  193. #define CONFIG_ONE_PASS_SVM 0
  194. #define CONFIG_OS_SUPPORT 1
  195. -#define CONFIG_PIC 0
  196. +#define CONFIG_PIC 1
  197. #define CONFIG_RD_DEBUG 0
  198. #define CONFIG_RUNTIME_CPU_DETECT 1
  199. #define CONFIG_SHARED 0
  200. diff --git a/third_party/libaom/source/config/linux/x64/config/aom_config.asm b/third_party/libaom/source/config/linux/x64/config/aom_config.asm
  201. --- a/third_party/libaom/source/config/linux/x64/config/aom_config.asm
  202. +++ b/third_party/libaom/source/config/linux/x64/config/aom_config.asm
  203. @@ -35,7 +35,7 @@
  204. %define CONFIG_NORMAL_TILE_MODE 1
  205. %define CONFIG_ONE_PASS_SVM 0
  206. %define CONFIG_OS_SUPPORT 1
  207. -%define CONFIG_PIC 0
  208. +%define CONFIG_PIC 1
  209. %define CONFIG_RD_DEBUG 0
  210. %define CONFIG_RUNTIME_CPU_DETECT 1
  211. %define CONFIG_SHARED 0
  212. diff --git a/third_party/libaom/source/config/linux/x64/config/aom_config.h b/third_party/libaom/source/config/linux/x64/config/aom_config.h
  213. --- a/third_party/libaom/source/config/linux/x64/config/aom_config.h
  214. +++ b/third_party/libaom/source/config/linux/x64/config/aom_config.h
  215. @@ -47,7 +47,7 @@
  216. #define CONFIG_NORMAL_TILE_MODE 1
  217. #define CONFIG_ONE_PASS_SVM 0
  218. #define CONFIG_OS_SUPPORT 1
  219. -#define CONFIG_PIC 0
  220. +#define CONFIG_PIC 1
  221. #define CONFIG_RD_DEBUG 0
  222. #define CONFIG_RUNTIME_CPU_DETECT 1
  223. #define CONFIG_SHARED 0
  224. --
  225. 2.17.1