Commit 88d80cb975 (avcodec/put_bits: Make bit buffers 64-bit, 2020-07-18)
introduced a 64-bit bit buffer, reducing the number of times it must be
flushed. However, it is only enabled for x86-64, even though AArch64
also supports efficient 64-bit operations. Enable it on AArch64 as well
to improve performance.

Benchmarking on various formats shows consistently positive results
comparable to the x86-64 improvements:

   dnxhd          84.13 fps ->   85.04 fps (+1.1%)
   ffv1           88.77 fps ->   91.36 fps (+2.9%)
   huffyuv       286.93 fps ->  310.34 fps (+8.2%)
   jpegls         28.99 fps ->   29.86 fps (+3.0%)
   magicyuv      118.76 fps ->  124.18 fps (+4.6%)
   mjpeg         213.71 fps ->  217.53 fps (+1.8%)
   mpeg1video    311.31 fps ->  315.19 fps (+1.2%)
   mpeg2video    310.19 fps ->  313.93 fps (+1.2%)
   mpeg4         286.53 fps ->  290.95 fps (+1.5%)
   prores         82.57 fps ->   85.53 fps (+3.6%)
   prores_ks     106.31 fps ->  109.24 fps (+2.8%)
   rv20          223.64 fps ->  226.45 fps (+1.3%)
   utvideo       119.47 fps ->  123.72 fps (+3.6%)

Benchmark details: Transcoding the first 720 frames of Big Buck Bunny
at 1080p on an M3 MacBook Air running macOS 15.7.9, compiled with
(Homebrew) clang 22.1.8. The benchmarks were single-threaded, with ten
runs per format, the two highest and lowest results were discarded.

Signed-off-by: Dominik Loidolt <[email protected]>
---
I have only benchmarked this on my MacBook. I do not have access to
other AArch64 hardware, so performance on other AArch64 implementations
remains untested. Naively I would guess they benefit from the wider bit
buffer too.

It may also make sense to benchmark other 64-bit platforms with the
wider bit buffer (as well as 32-bit platforms?).

 Dominik

P.S. This is my first FFmpeg patch, so please let me know if I missed
anything.

 libavcodec/put_bits.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/put_bits.h b/libavcodec/put_bits.h
index 98c0d7e51f..eea249a01f 100644
--- a/libavcodec/put_bits.h
+++ b/libavcodec/put_bits.h
@@ -34,7 +34,7 @@
 #include "libavutil/avassert.h"
 #include "libavutil/common.h"

-#if ARCH_X86_64
+#if ARCH_X86_64 || ARCH_AARCH64
 // TODO: Benchmark and optionally enable on other 64-bit architectures.
 typedef uint64_t BitBuf;
 #define AV_WBBUF AV_WB64

base-commit: 44095007d00f908dbdeaadaccc50d7bdeff36a37
--
2.55.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to