From: Henrik Gramner <gramner@twoorioles.com>
Date: Thu, 9 Jul 2020 14:47:35 +0000 (-0300)
Subject: avutil/x86inc: fix warnings when assembling with Nasm 2.15
X-Git-Tag: n4.4~3321
X-Git-Url: http://git.videolan.org/?p=ffmpeg.git;a=commitdiff_plain;h=0b2b03568f22fdb361d9a44c262bfb9269335f80

avutil/x86inc: fix warnings when assembling with Nasm 2.15

Some new warnings regarding use of empty macro parameters has
been added, so adjust some x86inc code to silence those.

Fixes part of ticket #8771

Signed-off-by: James Almer <jamrial@gmail.com>
---

diff --git a/libavutil/x86/x86inc.asm b/libavutil/x86/x86inc.asm
index 5044ee86f0..01c35e3a4b 100644
--- a/libavutil/x86/x86inc.asm
+++ b/libavutil/x86/x86inc.asm
@@ -411,16 +411,6 @@ DECLARE_REG_TMP_SIZE 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14
     %endif
 %endmacro
 
-%macro DEFINE_ARGS_INTERNAL 3+
-    %ifnum %2
-        DEFINE_ARGS %3
-    %elif %1 == 4
-        DEFINE_ARGS %2
-    %elif %1 > 4
-        DEFINE_ARGS %2, %3
-    %endif
-%endmacro
-
 %if WIN64 ; Windows x64 ;=================================================
 
 DECLARE_REG 0,  rcx
@@ -439,7 +429,7 @@ DECLARE_REG 12, R15, 104
 DECLARE_REG 13, R12, 112
 DECLARE_REG 14, R13, 120
 
-%macro PROLOGUE 2-5+ 0 ; #args, #regs, #xmm_regs, [stack_size,] arg_names...
+%macro PROLOGUE 2-5+ 0, 0 ; #args, #regs, #xmm_regs, [stack_size,] arg_names...
     %assign num_args %1
     %assign regs_used %2
     ASSERT regs_used >= num_args
@@ -451,7 +441,15 @@ DECLARE_REG 14, R13, 120
         WIN64_SPILL_XMM %3
     %endif
     LOAD_IF_USED 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
-    DEFINE_ARGS_INTERNAL %0, %4, %5
+    %if %0 > 4
+        %ifnum %4
+            DEFINE_ARGS %5
+        %else
+            DEFINE_ARGS %4, %5
+        %endif
+    %elifnnum %4
+        DEFINE_ARGS %4
+    %endif
 %endmacro
 
 %macro WIN64_PUSH_XMM 0
@@ -547,7 +545,7 @@ DECLARE_REG 12, R15, 56
 DECLARE_REG 13, R12, 64
 DECLARE_REG 14, R13, 72
 
-%macro PROLOGUE 2-5+ 0 ; #args, #regs, #xmm_regs, [stack_size,] arg_names...
+%macro PROLOGUE 2-5+ 0, 0 ; #args, #regs, #xmm_regs, [stack_size,] arg_names...
     %assign num_args %1
     %assign regs_used %2
     %assign xmm_regs_used %3
@@ -557,7 +555,15 @@ DECLARE_REG 14, R13, 72
     PUSH_IF_USED 9, 10, 11, 12, 13, 14
     ALLOC_STACK %4
     LOAD_IF_USED 6, 7, 8, 9, 10, 11, 12, 13, 14
-    DEFINE_ARGS_INTERNAL %0, %4, %5
+    %if %0 > 4
+        %ifnum %4
+            DEFINE_ARGS %5
+        %else
+            DEFINE_ARGS %4, %5
+        %endif
+    %elifnnum %4
+        DEFINE_ARGS %4
+    %endif
 %endmacro
 
 %define has_epilogue regs_used > 9 || stack_size > 0 || vzeroupper_required
@@ -598,7 +604,7 @@ DECLARE_REG 6, ebp, 28
 
 DECLARE_ARG 7, 8, 9, 10, 11, 12, 13, 14
 
-%macro PROLOGUE 2-5+ ; #args, #regs, #xmm_regs, [stack_size,] arg_names...
+%macro PROLOGUE 2-5+ 0, 0 ; #args, #regs, #xmm_regs, [stack_size,] arg_names...
     %assign num_args %1
     %assign regs_used %2
     ASSERT regs_used >= num_args
@@ -613,7 +619,15 @@ DECLARE_ARG 7, 8, 9, 10, 11, 12, 13, 14
     PUSH_IF_USED 3, 4, 5, 6
     ALLOC_STACK %4
     LOAD_IF_USED 0, 1, 2, 3, 4, 5, 6
-    DEFINE_ARGS_INTERNAL %0, %4, %5
+    %if %0 > 4
+        %ifnum %4
+            DEFINE_ARGS %5
+        %else
+            DEFINE_ARGS %4, %5
+        %endif
+    %elifnnum %4
+        DEFINE_ARGS %4
+    %endif
 %endmacro
 
 %define has_epilogue regs_used > 3 || stack_size > 0 || vzeroupper_required
From: James Almer <jamrial@gmail.com>
Date: Thu, 9 Jul 2020 14:48:12 +0000 (-0300)
Subject: x86/h264_deblock: fix warning about trailing empty parameter
X-Git-Tag: n4.4~3320
X-Git-Url: http://git.videolan.org/?p=ffmpeg.git;a=commitdiff_plain;h=2c844c98285ca03d9cc44db920da645cf0376c40

x86/h264_deblock: fix warning about trailing empty parameter

Fixes part of ticket #8771

Signed-off-by: James Almer <jamrial@gmail.com>
---

diff --git a/libavcodec/x86/h264_deblock.asm b/libavcodec/x86/h264_deblock.asm
index 6702ae98d4..a2e745cd8e 100644
--- a/libavcodec/x86/h264_deblock.asm
+++ b/libavcodec/x86/h264_deblock.asm
@@ -1185,7 +1185,7 @@ cglobal deblock_h_chroma_8, 5, 7, 8, 0-16, pix_, stride_, alpha_, beta_, tc0_
     STORE_8_ROWS PASS8ROWS(pix_q - 2, r5 - 2, stride_q, r6)
 RET
 
-cglobal deblock_h_chroma422_8, 5, 7, 8, 0-16, pix_, stride_, alpha_, beta_, tc0_,
+cglobal deblock_h_chroma422_8, 5, 7, 8, 0-16, pix_, stride_, alpha_, beta_, tc0_
     CHROMA_H_START_XMM r5, r6
     LOAD_8_ROWS PASS8ROWS(pix_q - 2, r5 - 2, stride_q, r6)
     TRANSPOSE_8x4B_XMM
From: James Almer <jamrial@gmail.com>
Date: Sat, 11 Jul 2020 13:04:23 +0000 (-0300)
Subject: x86/vf_blend: fix warnings about trailing empty parameters
X-Git-Tag: n4.4~3319
X-Git-Url: http://git.videolan.org/?p=ffmpeg.git;a=commitdiff_plain;h=320694ff84a609c5b0438c1f10da355cb48a0be3

x86/vf_blend: fix warnings about trailing empty parameters

Finishes fixing ticket #8771

Signed-off-by: James Almer <jamrial@gmail.com>
---

diff --git a/libavfilter/x86/vf_blend.asm b/libavfilter/x86/vf_blend.asm
index 251bbb5a12..766e5b7bc1 100644
--- a/libavfilter/x86/vf_blend.asm
+++ b/libavfilter/x86/vf_blend.asm
@@ -38,11 +38,11 @@ pb_255: times 16 db 255
 
 SECTION .text
 
-%macro BLEND_INIT 2-3
+%macro BLEND_INIT 2-3 0
 %if ARCH_X86_64
 cglobal blend_%1, 6, 9, %2, top, top_linesize, bottom, bottom_linesize, dst, dst_linesize, width, end, x
     mov    widthd, dword widthm
-    %if %0 == 3; is 16 bit
+    %if %3; is 16 bit
         add    widthq, widthq ; doesn't compile on x86_32
     %endif
 %else
@@ -66,7 +66,7 @@ cglobal blend_%1, 5, 7, %2, top, top_linesize, bottom, bottom_linesize, dst, end
 REP_RET
 %endmacro
 
-%macro BLEND_SIMPLE 2-3
+%macro BLEND_SIMPLE 2-3 0
 BLEND_INIT %1, 2, %3
 .nextrow:
     mov        xq, widthq
@@ -82,10 +82,10 @@ BLEND_END
 %endmacro
 
 ; %1 name , %2 src (b or w), %3 inter (w or d), %4 (1 if 16bit, not set if 8 bit)
-%macro GRAINEXTRACT 3-4
+%macro GRAINEXTRACT 3-4 0
 BLEND_INIT %1, 6, %4
     pxor           m4, m4
-%if %0 == 4 ; 16 bit
+%if %4 ; 16 bit
     VBROADCASTI128 m5, [pd_32768]
 %else
     VBROADCASTI128 m5, [pw_128]
@@ -182,7 +182,7 @@ BLEND_END
 %endmacro
 
 ;%1 name, %2 (b or w), %3 (set if 16 bit)
-%macro AVERAGE 2-3
+%macro AVERAGE 2-3 0
 BLEND_INIT %1, 3, %3
     pcmpeqb        m2, m2
 
@@ -203,10 +203,10 @@ BLEND_END
 %endmacro
 
 ; %1 name , %2 src (b or w), %3 inter (w or d), %4 (1 if 16bit, not set if 8 bit)
-%macro GRAINMERGE 3-4
+%macro GRAINMERGE 3-4 0
 BLEND_INIT %1, 6, %4
     pxor       m4, m4
-%if %0 == 4 ; 16 bit
+%if %4 ; 16 bit
     VBROADCASTI128       m5, [pd_32768]
 %else
     VBROADCASTI128       m5, [pw_128]
@@ -288,7 +288,7 @@ BLEND_INIT divide, 4
 BLEND_END
 %endmacro
 
-%macro PHOENIX 2-3
+%macro PHOENIX 2-3 0
 ; %1 name, %2 b or w, %3 (opt) 1 if 16 bit
 BLEND_INIT %1, 4, %3
     VBROADCASTI128       m3, [pb_255]
@@ -311,7 +311,7 @@ BLEND_END
 %endmacro
 
 ; %1 name , %2 src (b or w), %3 inter (w or d), %4 (1 if 16bit, not set if 8 bit)
-%macro DIFFERENCE 3-4
+%macro DIFFERENCE 3-4 0
 BLEND_INIT %1, 5, %4
     pxor       m2, m2
 .nextrow:
@@ -326,7 +326,7 @@ BLEND_INIT %1, 5, %4
         punpckl%2%3     m1, m2
         psub%3          m0, m1
         psub%3          m3, m4
-%if %0 == 4; 16 bit
+%if %4; 16 bit
         pabsd           m0, m0
         pabsd           m3, m3
 %else
@@ -340,10 +340,10 @@ BLEND_END
 %endmacro
 
 ; %1 name , %2 src (b or w), %3 inter (w or d), %4 (1 if 16bit, not set if 8 bit)
-%macro EXTREMITY 3-4
+%macro EXTREMITY 3-4 0
 BLEND_INIT %1, 8, %4
     pxor       m2, m2
-%if %0 == 4; 16 bit
+%if %4; 16 bit
     VBROADCASTI128       m4, [pd_65535]
 %else
     VBROADCASTI128       m4, [pw_255]
@@ -362,7 +362,7 @@ BLEND_INIT %1, 8, %4
         psub%3          m7, m4, m5
         psub%3          m3, m1
         psub%3          m7, m6
-%if %0 == 4; 16 bit
+%if %4; 16 bit
         pabsd           m3, m3
         pabsd           m7, m7
 %else
@@ -375,10 +375,10 @@ BLEND_INIT %1, 8, %4
 BLEND_END
 %endmacro
 
-%macro NEGATION 3-4
+%macro NEGATION 3-4 0
 BLEND_INIT %1, 8, %4
     pxor       m2, m2
-%if %0 == 4; 16 bit
+%if %4; 16 bit
     VBROADCASTI128       m4, [pd_65535]
 %else
     VBROADCASTI128       m4, [pw_255]
@@ -397,7 +397,7 @@ BLEND_INIT %1, 8, %4
         psub%3          m7, m4, m5
         psub%3          m3, m1
         psub%3          m7, m6
-%if %0 == 4; 16 bit
+%if %4; 16 bit
         pabsd           m3, m3
         pabsd           m7, m7
 %else
