From 077f0c393e9784aabc40eef15b252a5b1173cb46 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Mon, 31 Aug 2020 11:40:37 +0400 Subject: [PATCH] No need to rebuild ffmpeg without NEON optimizations anymore --- .github/workflows/linux.yml | 1 - .github/workflows/snap.yml | 2 - Telegram/Patches/ffmpeg.diff | 225 ----------------------------------- docs/building-cmake.md | 1 - snap/snapcraft.yaml | 160 ++----------------------- 5 files changed, 11 insertions(+), 378 deletions(-) delete mode 100644 Telegram/Patches/ffmpeg.diff diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index cdff5fc4a..62f4ec411 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -222,7 +222,6 @@ jobs: --disable-network \ --disable-autodetect \ --disable-everything \ - --disable-neon \ --disable-alsa \ --disable-iconv \ --enable-libopus \ diff --git a/.github/workflows/snap.yml b/.github/workflows/snap.yml index cd2e8d48d..aeb7c33c3 100644 --- a/.github/workflows/snap.yml +++ b/.github/workflows/snap.yml @@ -12,7 +12,6 @@ on: - '!.github/workflows/snap.yml' - 'Telegram/build/**' - 'Telegram/Patches/**' - - '!Telegram/Patches/ffmpeg.diff' - 'Telegram/Resources/uwp/**' - 'Telegram/Resources/winrc/**' - 'Telegram/SourceFiles/platform/win/**' @@ -31,7 +30,6 @@ on: - '!.github/workflows/snap.yml' - 'Telegram/build/**' - 'Telegram/Patches/**' - - '!Telegram/Patches/ffmpeg.diff' - 'Telegram/Resources/uwp/**' - 'Telegram/Resources/winrc/**' - 'Telegram/SourceFiles/platform/win/**' diff --git a/Telegram/Patches/ffmpeg.diff b/Telegram/Patches/ffmpeg.diff deleted file mode 100644 index b5ab619fe..000000000 --- a/Telegram/Patches/ffmpeg.diff +++ /dev/null @@ -1,225 +0,0 @@ -diff --git a/libavcodec/aarch64/Makefile b/libavcodec/aarch64/Makefile -index 00f93bf59f..52da7036f3 100644 ---- a/libavcodec/aarch64/Makefile -+++ b/libavcodec/aarch64/Makefile -@@ -6,6 +6,7 @@ OBJS-$(CONFIG_H264DSP) += aarch64/h264dsp_init_aarch64.o - OBJS-$(CONFIG_H264PRED) += aarch64/h264pred_init.o - OBJS-$(CONFIG_H264QPEL) += aarch64/h264qpel_init_aarch64.o - OBJS-$(CONFIG_HPELDSP) += aarch64/hpeldsp_init_aarch64.o -+OBJS-$(CONFIG_IDCTDSP) += aarch64/idctdsp_init_aarch64.o - OBJS-$(CONFIG_MPEGAUDIODSP) += aarch64/mpegaudiodsp_init.o - OBJS-$(CONFIG_NEON_CLOBBER_TEST) += aarch64/neontest.o - OBJS-$(CONFIG_VIDEODSP) += aarch64/videodsp_init.o -@@ -21,6 +22,7 @@ OBJS-$(CONFIG_VC1DSP) += aarch64/vc1dsp_init_aarch64.o - OBJS-$(CONFIG_VORBIS_DECODER) += aarch64/vorbisdsp_init.o - OBJS-$(CONFIG_VP9_DECODER) += aarch64/vp9dsp_init_10bpp_aarch64.o \ - aarch64/vp9dsp_init_12bpp_aarch64.o \ -+ aarch64/vp9mc_aarch64.o \ - aarch64/vp9dsp_init_aarch64.o - - # ARMv8 optimizations -@@ -41,8 +43,7 @@ NEON-OBJS-$(CONFIG_H264PRED) += aarch64/h264pred_neon.o - NEON-OBJS-$(CONFIG_H264QPEL) += aarch64/h264qpel_neon.o \ - aarch64/hpeldsp_neon.o - NEON-OBJS-$(CONFIG_HPELDSP) += aarch64/hpeldsp_neon.o --NEON-OBJS-$(CONFIG_IDCTDSP) += aarch64/idctdsp_init_aarch64.o \ -- aarch64/simple_idct_neon.o -+NEON-OBJS-$(CONFIG_IDCTDSP) += aarch64/simple_idct_neon.o - NEON-OBJS-$(CONFIG_MDCT) += aarch64/mdct_neon.o - NEON-OBJS-$(CONFIG_MPEGAUDIODSP) += aarch64/mpegaudiodsp_neon.o - NEON-OBJS-$(CONFIG_VP8DSP) += aarch64/vp8dsp_neon.o -diff --git a/libavcodec/aarch64/idctdsp_init_aarch64.c b/libavcodec/aarch64/idctdsp_init_aarch64.c -index 0406e60830..742a3372e3 100644 ---- a/libavcodec/aarch64/idctdsp_init_aarch64.c -+++ b/libavcodec/aarch64/idctdsp_init_aarch64.c -@@ -21,6 +21,8 @@ - */ - - #include "libavutil/attributes.h" -+#include "libavutil/cpu.h" -+#include "libavutil/arm/cpu.h" - #include "libavcodec/avcodec.h" - #include "libavcodec/idctdsp.h" - #include "idct.h" -@@ -28,7 +30,9 @@ - av_cold void ff_idctdsp_init_aarch64(IDCTDSPContext *c, AVCodecContext *avctx, - unsigned high_bit_depth) - { -- if (!avctx->lowres && !high_bit_depth) { -+ int cpu_flags = av_get_cpu_flags(); -+ -+ if (have_neon(cpu_flags) && !avctx->lowres && !high_bit_depth) { - if (avctx->idct_algo == FF_IDCT_AUTO || - avctx->idct_algo == FF_IDCT_SIMPLEAUTO || - avctx->idct_algo == FF_IDCT_SIMPLENEON) { -diff --git a/libavcodec/aarch64/vp9mc_16bpp_neon.S b/libavcodec/aarch64/vp9mc_16bpp_neon.S -index cac6428709..53b372c262 100644 ---- a/libavcodec/aarch64/vp9mc_16bpp_neon.S -+++ b/libavcodec/aarch64/vp9mc_16bpp_neon.S -@@ -25,31 +25,6 @@ - // const uint8_t *ref, ptrdiff_t ref_stride, - // int h, int mx, int my); - --function ff_vp9_copy128_aarch64, export=1 --1: -- ldp x5, x6, [x2] -- ldp x7, x8, [x2, #16] -- stp x5, x6, [x0] -- ldp x9, x10, [x2, #32] -- stp x7, x8, [x0, #16] -- subs w4, w4, #1 -- ldp x11, x12, [x2, #48] -- stp x9, x10, [x0, #32] -- stp x11, x12, [x0, #48] -- ldp x5, x6, [x2, #64] -- ldp x7, x8, [x2, #80] -- stp x5, x6, [x0, #64] -- ldp x9, x10, [x2, #96] -- stp x7, x8, [x0, #80] -- ldp x11, x12, [x2, #112] -- stp x9, x10, [x0, #96] -- stp x11, x12, [x0, #112] -- add x2, x2, x3 -- add x0, x0, x1 -- b.ne 1b -- ret --endfunc -- - function ff_vp9_avg64_16_neon, export=1 - mov x5, x0 - sub x1, x1, #64 -diff --git a/libavcodec/aarch64/vp9mc_aarch64.S b/libavcodec/aarch64/vp9mc_aarch64.S -new file mode 100644 -index 0000000000..f17a8cf04a ---- /dev/null -+++ b/libavcodec/aarch64/vp9mc_aarch64.S -@@ -0,0 +1,81 @@ -+/* -+ * Copyright (c) 2016 Google Inc. -+ * -+ * This file is part of FFmpeg. -+ * -+ * FFmpeg is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * FFmpeg 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 -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with FFmpeg; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ */ -+ -+#include "libavutil/aarch64/asm.S" -+ -+// All public functions in this file have the following signature: -+// typedef void (*vp9_mc_func)(uint8_t *dst, ptrdiff_t dst_stride, -+// const uint8_t *ref, ptrdiff_t ref_stride, -+// int h, int mx, int my); -+ -+function ff_vp9_copy128_aarch64, export=1 -+1: -+ ldp x5, x6, [x2] -+ ldp x7, x8, [x2, #16] -+ stp x5, x6, [x0] -+ ldp x9, x10, [x2, #32] -+ stp x7, x8, [x0, #16] -+ subs w4, w4, #1 -+ ldp x11, x12, [x2, #48] -+ stp x9, x10, [x0, #32] -+ stp x11, x12, [x0, #48] -+ ldp x5, x6, [x2, #64] -+ ldp x7, x8, [x2, #80] -+ stp x5, x6, [x0, #64] -+ ldp x9, x10, [x2, #96] -+ stp x7, x8, [x0, #80] -+ ldp x11, x12, [x2, #112] -+ stp x9, x10, [x0, #96] -+ stp x11, x12, [x0, #112] -+ add x2, x2, x3 -+ add x0, x0, x1 -+ b.ne 1b -+ ret -+endfunc -+ -+function ff_vp9_copy64_aarch64, export=1 -+1: -+ ldp x5, x6, [x2] -+ ldp x7, x8, [x2, #16] -+ stp x5, x6, [x0] -+ ldp x9, x10, [x2, #32] -+ stp x7, x8, [x0, #16] -+ subs w4, w4, #1 -+ ldp x11, x12, [x2, #48] -+ stp x9, x10, [x0, #32] -+ stp x11, x12, [x0, #48] -+ add x2, x2, x3 -+ add x0, x0, x1 -+ b.ne 1b -+ ret -+endfunc -+ -+function ff_vp9_copy32_aarch64, export=1 -+1: -+ ldp x5, x6, [x2] -+ ldp x7, x8, [x2, #16] -+ stp x5, x6, [x0] -+ subs w4, w4, #1 -+ stp x7, x8, [x0, #16] -+ add x2, x2, x3 -+ add x0, x0, x1 -+ b.ne 1b -+ ret -+endfunc -diff --git a/libavcodec/aarch64/vp9mc_neon.S b/libavcodec/aarch64/vp9mc_neon.S -index f67624ca04..abf2bae9db 100644 ---- a/libavcodec/aarch64/vp9mc_neon.S -+++ b/libavcodec/aarch64/vp9mc_neon.S -@@ -25,23 +25,6 @@ - // const uint8_t *ref, ptrdiff_t ref_stride, - // int h, int mx, int my); - --function ff_vp9_copy64_aarch64, export=1 --1: -- ldp x5, x6, [x2] -- ldp x7, x8, [x2, #16] -- stp x5, x6, [x0] -- ldp x9, x10, [x2, #32] -- stp x7, x8, [x0, #16] -- subs w4, w4, #1 -- ldp x11, x12, [x2, #48] -- stp x9, x10, [x0, #32] -- stp x11, x12, [x0, #48] -- add x2, x2, x3 -- add x0, x0, x1 -- b.ne 1b -- ret --endfunc -- - function ff_vp9_avg64_neon, export=1 - mov x5, x0 - 1: -@@ -64,19 +47,6 @@ function ff_vp9_avg64_neon, export=1 - ret - endfunc - --function ff_vp9_copy32_aarch64, export=1 --1: -- ldp x5, x6, [x2] -- ldp x7, x8, [x2, #16] -- stp x5, x6, [x0] -- subs w4, w4, #1 -- stp x7, x8, [x0, #16] -- add x2, x2, x3 -- add x0, x0, x1 -- b.ne 1b -- ret --endfunc -- - function ff_vp9_avg32_neon, export=1 - 1: - ld1 {v2.16b, v3.16b}, [x2], x3 diff --git a/docs/building-cmake.md b/docs/building-cmake.md index c23e49f80..b17dba2eb 100644 --- a/docs/building-cmake.md +++ b/docs/building-cmake.md @@ -94,7 +94,6 @@ Go to ***BuildPath*** and run --disable-network \ --disable-autodetect \ --disable-everything \ - --disable-neon \ --disable-alsa \ --disable-iconv \ --enable-libopus \ diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index c0229fea2..eebabbc48 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -128,13 +128,6 @@ parts: - qtwayland - webrtc - telegram-patches: - source: Telegram/Patches - plugin: dump - organize: - "*": telegram_patches/ - prime: [-./*] - desktop-qt5: source: https://github.com/ubuntu/snapcraft-desktop-helpers.git source-subdir: qt @@ -171,151 +164,20 @@ parts: stage-packages: - ibus - dav1d: - source: https://github.com/videolan/dav1d.git - source-depth: 1 - source-tag: 0.6.0 - plugin: meson - build-packages: - - nasm - meson-parameters: - - --prefix=/usr - - --libdir=lib - - -Denable_tools=false - - -Denable_tests=false - prime: - - -./usr/include - - -./usr/lib/pkgconfig - ffmpeg: - source: https://github.com/FFmpeg/FFmpeg.git - source-depth: 1 - source-branch: release/4.2 - plugin: autotools + plugin: nil build-packages: - - nasm - - libopus-dev - - libva-dev - - libvdpau-dev + - libavcodec-dev + - libavformat-dev + - libavutil-dev + - libswresample-dev + - libswscale-dev stage-packages: - - libopus0 - - libva2 - - libva-drm2 - - libvdpau1 - autotools-configure-parameters: - - --prefix=/usr - - --disable-static - - --disable-debug - - --disable-programs - - --disable-doc - - --disable-network - - --disable-autodetect - - --disable-everything - - --disable-neon - - --disable-alsa - - --disable-iconv - - --enable-shared - - --enable-libdav1d - - --enable-libopus - - --enable-vaapi - - --enable-vdpau - - --enable-protocol=file - - --enable-hwaccel=h264_vaapi - - --enable-hwaccel=h264_vdpau - - --enable-hwaccel=mpeg4_vaapi - - --enable-hwaccel=mpeg4_vdpau - - --enable-decoder=aac - - --enable-decoder=aac_fixed - - --enable-decoder=aac_latm - - --enable-decoder=aasc - - --enable-decoder=alac - - --enable-decoder=flac - - --enable-decoder=gif - - --enable-decoder=h264 - - --enable-decoder=hevc - - --enable-decoder=libdav1d - - --enable-decoder=mp1 - - --enable-decoder=mp1float - - --enable-decoder=mp2 - - --enable-decoder=mp2float - - --enable-decoder=mp3 - - --enable-decoder=mp3adu - - --enable-decoder=mp3adufloat - - --enable-decoder=mp3float - - --enable-decoder=mp3on4 - - --enable-decoder=mp3on4float - - --enable-decoder=mpeg4 - - --enable-decoder=msmpeg4v2 - - --enable-decoder=msmpeg4v3 - - --enable-decoder=opus - - --enable-decoder=pcm_alaw - - --enable-decoder=pcm_f32be - - --enable-decoder=pcm_f32le - - --enable-decoder=pcm_f64be - - --enable-decoder=pcm_f64le - - --enable-decoder=pcm_lxf - - --enable-decoder=pcm_mulaw - - --enable-decoder=pcm_s16be - - --enable-decoder=pcm_s16be_planar - - --enable-decoder=pcm_s16le - - --enable-decoder=pcm_s16le_planar - - --enable-decoder=pcm_s24be - - --enable-decoder=pcm_s24daud - - --enable-decoder=pcm_s24le - - --enable-decoder=pcm_s24le_planar - - --enable-decoder=pcm_s32be - - --enable-decoder=pcm_s32le - - --enable-decoder=pcm_s32le_planar - - --enable-decoder=pcm_s64be - - --enable-decoder=pcm_s64le - - --enable-decoder=pcm_s8 - - --enable-decoder=pcm_s8_planar - - --enable-decoder=pcm_u16be - - --enable-decoder=pcm_u16le - - --enable-decoder=pcm_u24be - - --enable-decoder=pcm_u24le - - --enable-decoder=pcm_u32be - - --enable-decoder=pcm_u32le - - --enable-decoder=pcm_u8 - - --enable-decoder=pcm_zork - - --enable-decoder=vorbis - - --enable-decoder=wavpack - - --enable-decoder=wmalossless - - --enable-decoder=wmapro - - --enable-decoder=wmav1 - - --enable-decoder=wmav2 - - --enable-decoder=wmavoice - - --enable-encoder=libopus - - --enable-parser=aac - - --enable-parser=aac_latm - - --enable-parser=flac - - --enable-parser=h264 - - --enable-parser=hevc - - --enable-parser=mpeg4video - - --enable-parser=mpegaudio - - --enable-parser=opus - - --enable-parser=vorbis - - --enable-demuxer=aac - - --enable-demuxer=flac - - --enable-demuxer=gif - - --enable-demuxer=h264 - - --enable-demuxer=hevc - - --enable-demuxer=m4v - - --enable-demuxer=mov - - --enable-demuxer=mp3 - - --enable-demuxer=ogg - - --enable-demuxer=wav - - --enable-muxer=ogg - - --enable-muxer=opus - override-pull: | - snapcraftctl pull - patch -p1 < "$SNAPCRAFT_STAGE/telegram_patches/ffmpeg.diff" - prime: - - -./usr/include - - -./usr/lib/pkgconfig - after: - - telegram-patches - - dav1d + - libavcodec58 + - libavformat58 + - libavutil56 + - libswresample3 + - libswscale5 openal: source: https://github.com/kcat/openal-soft.git