File avidemux3.patch of Package avidemux3 (Revision 63)

Currently displaying revision 63 , Show latest

106
 
1
---
2
 avidemux_core/ffmpeg_package/patches/upstream/avcodec-x86-mathops-clip-constants-used-with-shift-i.patch |   73 ++++++++++
3
 avidemux_plugins/ADM_videoEncoder/x265/ADM_x265Setup.cpp                                                 |    8 +
4
 2 files changed, 81 insertions(+)
5
6
--- /dev/null
7
+++ b/avidemux_core/ffmpeg_package/patches/upstream/avcodec-x86-mathops-clip-constants-used-with-shift-i.patch
8
@@ -0,0 +1,73 @@
9
+From effadce6c756247ea8bae32dc13bb3e6f464f0eb Mon Sep 17 00:00:00 2001
10
+From: =?UTF-8?q?R=C3=A9mi=20Denis-Courmont?= <remi@remlab.net>
11
+Date: Sun, 16 Jul 2023 18:18:02 +0300
12
+Subject: avcodec/x86/mathops: clip constants used with shift instructions
13
+ within inline assembly
14
+
15
+Fixes assembling with binutil as >= 2.41
16
+
17
+Signed-off-by: James Almer <jamrial@gmail.com>
18
+---
19
+ libavcodec/x86/mathops.h | 26 +++++++++++++++++++++++---
20
+ 1 file changed, 23 insertions(+), 3 deletions(-)
21
+
22
+diff --git a/libavcodec/x86/mathops.h b/libavcodec/x86/mathops.h
23
+index 6298f5ed19..ca7e2dffc1 100644
24
+--- a/libavcodec/x86/mathops.h
25
++++ b/libavcodec/x86/mathops.h
26
+@@ -35,12 +35,20 @@
27
+ static av_always_inline av_const int MULL(int a, int b, unsigned shift)
28
+ {
29
+     int rt, dummy;
30
++    if (__builtin_constant_p(shift))
31
+     __asm__ (
32
+         "imull %3               \n\t"
33
+         "shrdl %4, %%edx, %%eax \n\t"
34
+         :"=a"(rt), "=d"(dummy)
35
+-        :"a"(a), "rm"(b), "ci"((uint8_t)shift)
36
++        :"a"(a), "rm"(b), "i"(shift & 0x1F)
37
+     );
38
++    else
39
++        __asm__ (
40
++            "imull %3               \n\t"
41
++            "shrdl %4, %%edx, %%eax \n\t"
42
++            :"=a"(rt), "=d"(dummy)
43
++            :"a"(a), "rm"(b), "c"((uint8_t)shift)
44
++        );
45
+     return rt;
46
+ }
47
+ 
48
+@@ -113,19 +121,31 @@ __asm__ volatile(\
49
+ // avoid +32 for shift optimization (gcc should do that ...)
50
+ #define NEG_SSR32 NEG_SSR32
51
+ static inline  int32_t NEG_SSR32( int32_t a, int8_t s){
52
++    if (__builtin_constant_p(s))
53
+     __asm__ ("sarl %1, %0\n\t"
54
+          : "+r" (a)
55
+-         : "ic" ((uint8_t)(-s))
56
++         : "i" (-s & 0x1F)
57
+     );
58
++    else
59
++        __asm__ ("sarl %1, %0\n\t"
60
++               : "+r" (a)
61
++               : "c" ((uint8_t)(-s))
62
++        );
63
+     return a;
64
+ }
65
+ 
66
+ #define NEG_USR32 NEG_USR32
67
+ static inline uint32_t NEG_USR32(uint32_t a, int8_t s){
68
++    if (__builtin_constant_p(s))
69
+     __asm__ ("shrl %1, %0\n\t"
70
+          : "+r" (a)
71
+-         : "ic" ((uint8_t)(-s))
72
++         : "i" (-s & 0x1F)
73
+     );
74
++    else
75
++        __asm__ ("shrl %1, %0\n\t"
76
++               : "+r" (a)
77
++               : "c" ((uint8_t)(-s))
78
++        );
79
+     return a;
80
+ }
81
+ 
82
--- a/avidemux_plugins/ADM_videoEncoder/x265/ADM_x265Setup.cpp
83
+++ b/avidemux_plugins/ADM_videoEncoder/x265/ADM_x265Setup.cpp
84
@@ -207,13 +207,21 @@
85
                         {
86
                              param.rc.bStatWrite=1;
87
                              param.rc.bStatRead=0;
88
+#if X265_BUILD >= 213
89
+                             snprintf(param.rc.statFileName, sizeof(param.rc.statFileName), "%s", logFile);
90
+#else
91
                              param.rc.statFileName=strdup(logFile);
92
+#endif
93
  
94
                         }else
95
                         {
96
                              param.rc.bStatWrite=0;
97
                              param.rc.bStatRead=1;
98
+#if X265_BUILD >= 213
99
+                             snprintf(param.rc.statFileName, sizeof(param.rc.statFileName), "%s", logFile);
100
+#else
101
                              param.rc.statFileName=strdup(logFile);
102
+#endif
103
                              if(!ADM_fileExist(logFile))
104
                              {
105
                                    ADM_error("Logfile %s does not exist \n",logFile);
106