Skip to content

Commit

Permalink
update patches, fix android arm64 slow in av_ts_make_time_string2
Browse files Browse the repository at this point in the history
miscompiled? takes about 1s
  • Loading branch information
wang-bin committed Aug 18, 2024
1 parent 0249769 commit 90e8330
Show file tree
Hide file tree
Showing 30 changed files with 197 additions and 162 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
From d57bab7e7dd96061e17fecf2ad601418c2a6d31c Mon Sep 17 00:00:00 2001
From 9132ffb16ca0e36ff744772a254a4a3e6cddc34e Mon Sep 17 00:00:00 2001
From: wang-bin <[email protected]>
Date: Sat, 28 Oct 2017 20:26:50 +0800
Subject: [PATCH 01/28] use CreateMutexEx instead of CreateMutex to fix win8
Subject: [PATCH 01/29] use CreateMutexEx instead of CreateMutex to fix win8
store app link error

---
libavutil/hwcontext_d3d11va.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavutil/hwcontext_d3d11va.c b/libavutil/hwcontext_d3d11va.c
index 8963c9fc85..19c0ad06b5 100644
index 9b3c5f389f..69d5eff49e 100644
--- a/libavutil/hwcontext_d3d11va.c
+++ b/libavutil/hwcontext_d3d11va.c
@@ -42,6 +42,10 @@
Expand All @@ -23,7 +23,7 @@ index 8963c9fc85..19c0ad06b5 100644
typedef HRESULT(WINAPI *PFN_CREATE_DXGI_FACTORY)(REFIID riid, void **ppFactory);

static AVOnce functions_loaded = AV_ONCE_INIT;
@@ -498,7 +502,7 @@ static int d3d11va_device_init(AVHWDeviceContext *hwdev)
@@ -499,7 +503,7 @@ static int d3d11va_device_init(AVHWDeviceContext *hwdev)
HRESULT hr;

if (!device_hwctx->lock) {
Expand Down
4 changes: 2 additions & 2 deletions patches-master/0002-mmal-enable-0-copy-for-egl-interop.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From c888e8bf83f5295b5970b0045bc652de09fc57b5 Mon Sep 17 00:00:00 2001
From 49019c9853698bac801bfcea7b376336d64122b0 Mon Sep 17 00:00:00 2001
From: wang-bin <[email protected]>
Date: Sun, 29 Oct 2017 23:19:07 +0800
Subject: [PATCH 02/28] mmal: enable 0-copy for egl interop
Subject: [PATCH 02/29] mmal: enable 0-copy for egl interop

---
libavcodec/mmaldec.c | 5 ++++-
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
From 983fa900c05298f6e94a64a9923b4316caa62874 Mon Sep 17 00:00:00 2001
From ebd9d0f347dc77066d77424af037e00d244c4592 Mon Sep 17 00:00:00 2001
From: wang-bin <[email protected]>
Date: Sun, 29 Oct 2017 23:22:25 +0800
Subject: [PATCH 03/28] configure: fix mmal probing in cross build
Subject: [PATCH 03/29] configure: fix mmal probing in cross build

---
configure | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index b16722d83d..2a01242593 100755
index 37178d7d81..18b84f9103 100755
--- a/configure
+++ b/configure
@@ -7057,11 +7057,11 @@ enabled mbedtls && { check_pkg_config mbedtls mbedtls mbedtls/x509_crt
@@ -7040,11 +7040,11 @@ enabled mbedtls && { check_pkg_config mbedtls mbedtls mbedtls/x509_crt
check_lib mbedtls mbedtls/ssl.h mbedtls_ssl_init -lmbedtls -lmbedx509 -lmbedcrypto ||
die "ERROR: mbedTLS not found"; }
enabled mediacodec && { enabled jni || die "ERROR: mediacodec requires --enable-jni"; }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From b21f7443ce0bbf73bb8c2ffd3b692b2cfb55d391 Mon Sep 17 00:00:00 2001
From 4eb952da7f438c974459b70c7b909b971644daea Mon Sep 17 00:00:00 2001
From: wang-bin <[email protected]>
Date: Sun, 29 Oct 2017 23:35:28 +0800
Subject: [PATCH 04/28] videotoolbox: check runtime availability
Subject: [PATCH 04/29] videotoolbox: check runtime availability

fix warnings/errors for new compiler (since xcode9) if targeting
macOS<10.8
Expand All @@ -10,7 +10,7 @@ macOS<10.8
1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
index d6990a39c0..34fd89f8dc 100644
index 3dd804bb0c..b2a14a11b2 100644
--- a/libavcodec/videotoolbox.c
+++ b/libavcodec/videotoolbox.c
@@ -41,6 +41,10 @@
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 15a14e8daba64591d2585f9de12df84ccaaeb5ad Mon Sep 17 00:00:00 2001
From 005f2fe2790aff2a1d70df8fce1cd3fb9a3ddc20 Mon Sep 17 00:00:00 2001
From: wang-bin <[email protected]>
Date: Sun, 29 Oct 2017 23:52:35 +0800
Subject: [PATCH 05/28] mediacodec: check whether cropping is set before use
Subject: [PATCH 05/29] mediacodec: check whether cropping is set before use

---
libavcodec/mediacodecdec_common.c | 13 +++++++++----
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 78be20c7f25d9703ac53bbcae6d0bce6f9415f8f Mon Sep 17 00:00:00 2001
From 7f3c995023e7062f28b9c2083f413698d48d34dc Mon Sep 17 00:00:00 2001
From: wang-bin <[email protected]>
Date: Thu, 9 Nov 2017 14:56:53 +0800
Subject: [PATCH 06/28] avcodec: add AV_HWACCEL_FLAG_ALLOW_SOFTWARE
Subject: [PATCH 06/29] avcodec: add AV_HWACCEL_FLAG_ALLOW_SOFTWARE

a hw decoder may have software or hybrid implementation, for example videotoolbox hevc.
the performance may be better than ffmpeg sw decoder.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 7419b22f8dc30f0c836dd80211d5ab7c9b7d9394 Mon Sep 17 00:00:00 2001
From 2da938f65f91243fdcc79374f4ea12102f4fb7df Mon Sep 17 00:00:00 2001
From: wang-bin <[email protected]>
Date: Thu, 9 Nov 2017 15:05:26 +0800
Subject: [PATCH 07/28] videotoolbox: allow software implementation
Subject: [PATCH 07/29] videotoolbox: allow software implementation

hevc is supported on macOS 10.12+ and iOS11+. sw implementaion is
provided for old devices. vt sw decoder is more energy effecient than
Expand All @@ -13,7 +13,7 @@ compatiblility attribute is disabled)
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
index 34fd89f8dc..9107408917 100644
index b2a14a11b2..69de24436d 100644
--- a/libavcodec/videotoolbox.c
+++ b/libavcodec/videotoolbox.c
@@ -819,9 +819,9 @@ static CFDictionaryRef videotoolbox_decoder_config_create(CMVideoCodecType codec
Expand Down
6 changes: 3 additions & 3 deletions patches-master/0008-h264-increase-MAX_SLICES-to-64.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From d3300ae3848d0496f5899aca39ea76a944f55ae5 Mon Sep 17 00:00:00 2001
From f487cee5f265cf0c19a8452de9a7e2bafea24981 Mon Sep 17 00:00:00 2001
From: wang-bin <[email protected]>
Date: Mon, 13 Nov 2017 12:23:10 +0800
Subject: [PATCH 08/28] h264: increase MAX_SLICES to 64
Subject: [PATCH 08/29] h264: increase MAX_SLICES to 64

lavfilters is 256. 64 can fix corrupt decoded frames
https://github.com/wang-bin/QtAV/issues/923
Expand All @@ -10,7 +10,7 @@ https://github.com/wang-bin/QtAV/issues/923
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/h264dec.h b/libavcodec/h264dec.h
index fc50df90f2..7a3e2a2278 100644
index ccd7583bf4..a68f3fe151 100644
--- a/libavcodec/h264dec.h
+++ b/libavcodec/h264dec.h
@@ -58,7 +58,7 @@
Expand Down
30 changes: 15 additions & 15 deletions patches-master/0009-mmal-add-vp8-mjpeg-wmv3.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From dd530a783cc05301af2f5b8ae334e026c51f5ffe Mon Sep 17 00:00:00 2001
From db13a9df735a6a339480dc1b986138a8adec6c44 Mon Sep 17 00:00:00 2001
From: wang-bin <[email protected]>
Date: Mon, 13 Nov 2017 15:14:26 +0800
Subject: [PATCH 09/28] mmal: add vp8, mjpeg, wmv3
Subject: [PATCH 09/29] mmal: add vp8, mjpeg, wmv3

---
configure | 3 +++
Expand All @@ -10,57 +10,57 @@ Subject: [PATCH 09/28] mmal: add vp8, mjpeg, wmv3
3 files changed, 32 insertions(+)

diff --git a/configure b/configure
index 2a01242593..43cf176d6e 100755
index 1c13f51db2..a2c1aff490 100755
--- a/configure
+++ b/configure
@@ -3370,6 +3370,7 @@ hevc_vaapi_encoder_select="atsc_a53 cbs_h265 vaapi_encode"
@@ -3380,6 +3380,7 @@ hevc_vaapi_encoder_select="atsc_a53 cbs_h265 vaapi_encode"
hevc_v4l2m2m_decoder_deps="v4l2_m2m hevc_v4l2_m2m"
hevc_v4l2m2m_decoder_select="hevc_mp4toannexb_bsf"
hevc_v4l2m2m_encoder_deps="v4l2_m2m hevc_v4l2_m2m"
+mjpeg_mmal_decoder_deps="mmal"
mjpeg_cuvid_decoder_deps="cuvid"
mjpeg_qsv_decoder_select="qsvdec"
mjpeg_qsv_encoder_deps="libmfx"
@@ -3398,6 +3399,7 @@ vc1_cuvid_decoder_deps="cuvid"
@@ -3408,6 +3409,7 @@ vc1_cuvid_decoder_deps="cuvid"
vc1_mmal_decoder_deps="mmal"
vc1_qsv_decoder_select="qsvdec"
vc1_v4l2m2m_decoder_deps="v4l2_m2m vc1_v4l2_m2m"
+vp8_mmal_decoder_deps="mmal"
vp8_cuvid_decoder_deps="cuvid"
vp8_mediacodec_decoder_deps="mediacodec"
vp8_mediacodec_encoder_deps="mediacodec"
@@ -3417,6 +3419,7 @@ vp9_vaapi_encoder_select="vaapi_encode"
vp9_qsv_encoder_deps="libmfx MFX_CODEC_VP9"
@@ -3428,6 +3430,7 @@ vp9_qsv_encoder_deps="libmfx MFX_CODEC_VP9"
vp9_qsv_encoder_select="qsvenc"
vp9_v4l2m2m_decoder_deps="v4l2_m2m vp9_v4l2_m2m"
vvc_qsv_decoder_select="vvc_mp4toannexb_bsf qsvdec"
+wmv3_mmal_decoder_deps="mmal"
av1_qsv_decoder_select="qsvdec"
av1_qsv_encoder_select="qsvenc"
av1_qsv_encoder_deps="libvpl"

# parsers
aac_parser_select="adts_header mpeg4audio"
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index b102a8069e..3db6d9b9f8 100644
index 09385be4ee..567e8e824b 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -858,6 +858,7 @@ extern const FFCodec ff_hevc_vaapi_encoder;
@@ -860,6 +860,7 @@ extern const FFCodec ff_hevc_vaapi_encoder;
extern const FFCodec ff_hevc_videotoolbox_encoder;
extern const FFCodec ff_libkvazaar_encoder;
extern const FFCodec ff_mjpeg_cuvid_decoder;
+extern const FFCodec ff_mjpeg_mmal_decoder;
extern const FFCodec ff_mjpeg_qsv_encoder;
extern const FFCodec ff_mjpeg_qsv_decoder;
extern const FFCodec ff_mjpeg_vaapi_encoder;
@@ -876,6 +877,7 @@ extern const FFCodec ff_vc1_cuvid_decoder;
@@ -878,6 +879,7 @@ extern const FFCodec ff_vc1_cuvid_decoder;
extern const FFCodec ff_vp8_cuvid_decoder;
extern const FFCodec ff_vp8_mediacodec_decoder;
extern const FFCodec ff_vp8_mediacodec_encoder;
+extern const FFCodec ff_vp8_mmal_decoder;
extern const FFCodec ff_vp8_qsv_decoder;
extern const FFCodec ff_vp8_v4l2m2m_encoder;
extern const FFCodec ff_vp8_vaapi_encoder;
@@ -885,6 +887,7 @@ extern const FFCodec ff_vp9_mediacodec_encoder;
extern const FFCodec ff_vp9_qsv_decoder;
@@ -888,6 +890,7 @@ extern const FFCodec ff_vp9_qsv_decoder;
extern const FFCodec ff_vp9_vaapi_encoder;
extern const FFCodec ff_vp9_qsv_encoder;
extern const FFCodec ff_vvc_qsv_decoder;
+extern const FFCodec ff_wmv3_mmal_decoder;

// null codecs
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 58e324af93c6341716e237d41dc64d9494df64f9 Mon Sep 17 00:00:00 2001
From 2804d21a8ac09f4f2b1967c6a38e6c5fed29a21f Mon Sep 17 00:00:00 2001
From: wang-bin <[email protected]>
Date: Fri, 17 Nov 2017 14:54:23 +0800
Subject: [PATCH 10/28] mmal: add option copy_frame to support retrieving sw
Subject: [PATCH 10/29] mmal: add option copy_frame to support retrieving sw
frames w/o copy

mmal buffer->data is already in host memory. AFAIK decoders implemented in omx must
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 3b198a578ac20b3686c251266f2ae227aa397b60 Mon Sep 17 00:00:00 2001
From 90ec04079e71ad2a8bc3358c6ecf566c5f54b6fa Mon Sep 17 00:00:00 2001
From: wang-bin <[email protected]>
Date: Fri, 15 Dec 2017 11:34:06 +0800
Subject: [PATCH 11/28] videotoolbox: remove opengl compatibility attribute
Subject: [PATCH 11/29] videotoolbox: remove opengl compatibility attribute

1. a cvpixelbuffer backed by iosurface can always be converted to an opengl texture, using CGLTexImageIOSurface2D for macOS, and undocumented api texImageIOSurface(which is internally used by public api CVOpenGLESTextureCacheCreateTextureFromImage) for iOS4.0+.
2. enabling the attribute can slow down decoding speed a lot. I tested many video clips on my macbook air. for example: ffmpeg -ss 00:00:00 -t 00:03:00 -hwaccel videotoolbox -an -i big_buck_bunny_1080p_h264.mov -f null ->/dev/null, result with the attribute
Expand All @@ -12,7 +12,7 @@ disabled: frame= 2031 fps=104 q=-0.0 Lsize=N/A time=00:03:00.00 bitrate=N/A spee
1 file changed, 5 deletions(-)

diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
index 9107408917..abd93f2daa 100644
index 69de24436d..059ed66554 100644
--- a/libavcodec/videotoolbox.c
+++ b/libavcodec/videotoolbox.c
@@ -793,11 +793,6 @@ static CFDictionaryRef videotoolbox_buffer_attributes_create(int width,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
From 395892c6f2be23db8be434a144e8c4c23883ab50 Mon Sep 17 00:00:00 2001
From 843961015a7996eb1595a82f3e6be8f774dff37b Mon Sep 17 00:00:00 2001
From: wang-bin <[email protected]>
Date: Fri, 30 Mar 2018 10:46:43 +0800
Subject: [PATCH 12/28] configure: do not filter -libpath for msvc
Subject: [PATCH 12/29] configure: do not filter -libpath for msvc

---
configure | 1 +
1 file changed, 1 insertion(+)

diff --git a/configure b/configure
index 43cf176d6e..b1b1c4327b 100755
index 197bc46971..c33d93a7d1 100755
--- a/configure
+++ b/configure
@@ -4817,6 +4817,7 @@ msvc_common_flags(){
@@ -4823,6 +4823,7 @@ msvc_common_flags(){
-lz) echo zlib.lib ;;
-lx264) echo libx264.lib ;;
-lstdc++) ;;
Expand Down
8 changes: 4 additions & 4 deletions patches-master/0013-configure-enable-icf.patch
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
From d112f9b2f4c43bdf4197ceb0577d79b64e2489d3 Mon Sep 17 00:00:00 2001
From 4746cfc06082dbd6a2ba9379e7416799a9ae3ff9 Mon Sep 17 00:00:00 2001
From: wang-bin <[email protected]>
Date: Tue, 11 Sep 2018 23:16:49 +0800
Subject: [PATCH 13/28] configure: enable icf
Subject: [PATCH 13/29] configure: enable icf

---
configure | 3 +++
1 file changed, 3 insertions(+)

diff --git a/configure b/configure
index b1b1c4327b..9aa97ce51e 100755
index c33d93a7d1..240b8b438e 100755
--- a/configure
+++ b/configure
@@ -7547,6 +7547,9 @@ test_cc -mno-red-zone <<EOF && noredzone_flags="-mno-red-zone"
@@ -7531,6 +7531,9 @@ test_cc -mno-red-zone <<EOF && noredzone_flags="-mno-red-zone"
int x;
EOF

Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
From b615353bc4100f49d834d5c6e9660b19b849f138 Mon Sep 17 00:00:00 2001
From 2110aaff0b91e1e7b2eca9e758d2e599dc5e6a35 Mon Sep 17 00:00:00 2001
From: wang-bin <[email protected]>
Date: Sun, 14 Apr 2019 11:42:42 +0800
Subject: [PATCH 14/28] configure: suppor static build via clang-cl
Subject: [PATCH 14/29] configure: suppor static build via clang-cl

---
configure | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index 9aa97ce51e..8b45b888f2 100755
index 240b8b438e..efd2e3b2ae 100755
--- a/configure
+++ b/configure
@@ -5890,7 +5890,15 @@ case $target_os in
@@ -5870,7 +5870,15 @@ case $target_os in
SLIB_INSTALL_EXTRA_LIB='$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
SHFLAGS='-dll -def:$$(@:$(SLIBSUF)=.def) -implib:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)'
enabled x86_64 && objformat="win64" || objformat="win32"
Expand Down
Loading

0 comments on commit 90e8330

Please sign in to comment.