File avidemux3.patch of Package avidemux3 (Revision 60)
Currently displaying revision 60 , Show latest
78
1
--- a/avidemux_core/ffmpeg_package/patches/libavcodec_mathops.h.patch
2
+++ b/avidemux_core/ffmpeg_package/patches/libavcodec_mathops.h.patch
3
4
5
#define MAX_NEG_CROP 1024
6
7
+From effadce6c756247ea8bae32dc13bb3e6f464f0eb Mon Sep 17 00:00:00 2001
8
+From: =?UTF-8?q?R=C3=A9mi=20Denis-Courmont?= <remi@remlab.net>
9
+Date: Sun, 16 Jul 2023 18:18:02 +0300
10
+Subject: avcodec/x86/mathops: clip constants used with shift instructions
11
+ within inline assembly
12
+
13
+Fixes assembling with binutil as >= 2.41
14
+
15
+Signed-off-by: James Almer <jamrial@gmail.com>
16
+---
17
+ libavcodec/x86/mathops.h | 26 +++++++++++++++++++++++---
18
+ 1 file changed, 23 insertions(+), 3 deletions(-)
19
+
20
+--- libavcodec/x86/mathops.h
21
++++ libavcodec/x86/mathops.h
22
+@@ -35,12 +35,20 @@
23
+ static av_always_inline av_const int MULL(int a, int b, unsigned shift)
24
+ {
25
+ int rt, dummy;
26
++ if (__builtin_constant_p(shift))
27
+ __asm__ (
28
+ "imull %3 \n\t"
29
+ "shrdl %4, %%edx, %%eax \n\t"
30
+ :"=a"(rt), "=d"(dummy)
31
+- :"a"(a), "rm"(b), "ci"((uint8_t)shift)
32
++ :"a"(a), "rm"(b), "i"(shift & 0x1F)
33
+ );
34
++ else
35
++ __asm__ (
36
++ "imull %3 \n\t"
37
++ "shrdl %4, %%edx, %%eax \n\t"
38
++ :"=a"(rt), "=d"(dummy)
39
++ :"a"(a), "rm"(b), "c"((uint8_t)shift)
40
++ );
41
+ return rt;
42
+ }
43
+
44
+@@ -113,19 +121,31 @@ __asm__ volatile(\
45
+ // avoid +32 for shift optimization (gcc should do that ...)
46
+ #define NEG_SSR32 NEG_SSR32
47
+ static inline int32_t NEG_SSR32( int32_t a, int8_t s){
48
++ if (__builtin_constant_p(s))
49
+ __asm__ ("sarl %1, %0\n\t"
50
+ : "+r" (a)
51
+- : "ic" ((uint8_t)(-s))
52
++ : "i" (-s & 0x1F)
53
+ );
54
++ else
55
++ __asm__ ("sarl %1, %0\n\t"
56
++ : "+r" (a)
57
++ : "c" ((uint8_t)(-s))
58
++ );
59
+ return a;
60
+ }
61
+
62
+ #define NEG_USR32 NEG_USR32
63
+ static inline uint32_t NEG_USR32(uint32_t a, int8_t s){
64
++ if (__builtin_constant_p(s))
65
+ __asm__ ("shrl %1, %0\n\t"
66
+ : "+r" (a)
67
+- : "ic" ((uint8_t)(-s))
68
++ : "i" (-s & 0x1F)
69
+ );
70
++ else
71
++ __asm__ ("shrl %1, %0\n\t"
72
++ : "+r" (a)
73
++ : "c" ((uint8_t)(-s))
74
++ );
75
+ return a;
76
+ }
77
+
78