[FFmpeg-devel] [PATCH] Avoid using empty macro arguments.

Reimar Döffinger Reimar.Doeffinger at gmx.de
Mon Dec 30 12:13:00 CET 2013


These are not supported by all compilers (gcc 2.95 for example), and there is
no real need for them.
One use of this feature remains in libavdevice/v4l2.c which can't be
replaced quite as easily.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger at gmx.de>
---
 libavcodec/mss1.c                   | 16 ++++++++--------
 libswresample/x86/audio_convert.asm |  2 +-
 libswresample/x86/swresample_x86.c  | 16 ++++++++--------
 3 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/libavcodec/mss1.c b/libavcodec/mss1.c
index fc88eb0..78a6583 100644
--- a/libavcodec/mss1.c
+++ b/libavcodec/mss1.c
@@ -34,7 +34,7 @@ typedef struct MSS1Context {
     SliceContext   sc;
 } MSS1Context;
 
-static void arith_normalise(ArithCoder *c)
+static void arith1_normalise(ArithCoder *c)
 {
     for (;;) {
         if (c->high >= 0x8000) {
@@ -60,7 +60,7 @@ static void arith_normalise(ArithCoder *c)
     }
 }
 
-ARITH_GET_BIT()
+ARITH_GET_BIT(1)
 
 static int arith_get_bits(ArithCoder *c, int bits)
 {
@@ -71,7 +71,7 @@ static int arith_get_bits(ArithCoder *c, int bits)
     c->high   = ((prob + range) >> bits) + c->low - 1;
     c->low   += prob >> bits;
 
-    arith_normalise(c);
+    arith1_normalise(c);
 
     return val;
 }
@@ -85,12 +85,12 @@ static int arith_get_number(ArithCoder *c, int mod_val)
     c->high   = (prob + range) / mod_val + c->low - 1;
     c->low   += prob / mod_val;
 
-    arith_normalise(c);
+    arith1_normalise(c);
 
     return val;
 }
 
-static int arith_get_prob(ArithCoder *c, int16_t *probs)
+static int arith1_get_prob(ArithCoder *c, int16_t *probs)
 {
     int range = c->high - c->low + 1;
     int val   = ((c->value - c->low + 1) * probs[0] - 1) / range;
@@ -105,7 +105,7 @@ static int arith_get_prob(ArithCoder *c, int16_t *probs)
     return sym;
 }
 
-ARITH_GET_MODEL_SYM()
+ARITH_GET_MODEL_SYM(1)
 
 static void arith_init(ArithCoder *c, GetBitContext *gb)
 {
@@ -113,7 +113,7 @@ static void arith_init(ArithCoder *c, GetBitContext *gb)
     c->high          = 0xFFFF;
     c->value         = get_bits(gb, 16);
     c->gbc.gb        = gb;
-    c->get_model_sym = arith_get_model_sym;
+    c->get_model_sym = arith1_get_model_sym;
     c->get_number    = arith_get_number;
 }
 
@@ -156,7 +156,7 @@ static int mss1_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
 
     c->pal_pic    =  ctx->pic->data[0] + ctx->pic->linesize[0] * (avctx->height - 1);
     c->pal_stride = -ctx->pic->linesize[0];
-    c->keyframe   = !arith_get_bit(&acoder);
+    c->keyframe   = !arith1_get_bit(&acoder);
     if (c->keyframe) {
         c->corrupted = 0;
         ff_mss12_slicecontext_reset(&ctx->sc);
diff --git a/libswresample/x86/audio_convert.asm b/libswresample/x86/audio_convert.asm
index b6e9e5d..ff74503 100644
--- a/libswresample/x86/audio_convert.asm
+++ b/libswresample/x86/audio_convert.asm
@@ -161,7 +161,7 @@ unpack_2ch_%2_to_%1_u_int %+ SUFFIX
 %endmacro
 
 %macro CONV 5-7
-cglobal %2_to_%1_%3, 3, 3, 6, dst, src, len
+cglobal def_%2_to_%1_%3, 3, 3, 6, dst, src, len
     mov srcq    , [srcq]
     mov dstq    , [dstq]
 %ifidn %3, a
diff --git a/libswresample/x86/swresample_x86.c b/libswresample/x86/swresample_x86.c
index 581dc17..f7fefd9 100644
--- a/libswresample/x86/swresample_x86.c
+++ b/libswresample/x86/swresample_x86.c
@@ -25,7 +25,7 @@
 #define PROTO2(pre, out, cap) PROTO(pre, int16, out, cap) PROTO(pre, int32, out, cap) PROTO(pre, float, out, cap)
 #define PROTO3(pre, cap) PROTO2(pre, int16, cap) PROTO2(pre, int32, cap) PROTO2(pre, float, cap)
 #define PROTO4(pre) PROTO3(pre, mmx) PROTO3(pre, sse) PROTO3(pre, sse2) PROTO3(pre, ssse3) PROTO3(pre, sse4) PROTO3(pre, avx)
-PROTO4()
+PROTO4(_def)
 PROTO4(_pack_2ch)
 PROTO4(_pack_6ch)
 PROTO4(_unpack_2ch)
@@ -43,9 +43,9 @@ av_cold void swri_audio_convert_init_x86(struct AudioConvert *ac,
 #define MULTI_CAPS_FUNC(flag, cap) \
     if (mm_flags & flag) {\
         if(   out_fmt == AV_SAMPLE_FMT_S32  && in_fmt == AV_SAMPLE_FMT_S16 || out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_S16P)\
-            ac->simd_f =  ff_int16_to_int32_a_ ## cap;\
+            ac->simd_f =  ff_def_int16_to_int32_a_ ## cap;\
         if(   out_fmt == AV_SAMPLE_FMT_S16  && in_fmt == AV_SAMPLE_FMT_S32 || out_fmt == AV_SAMPLE_FMT_S16P && in_fmt == AV_SAMPLE_FMT_S32P)\
-            ac->simd_f =  ff_int32_to_int16_a_ ## cap;\
+            ac->simd_f =  ff_def_int32_to_int16_a_ ## cap;\
     }
 
 MULTI_CAPS_FUNC(AV_CPU_FLAG_MMX, mmx)
@@ -60,13 +60,13 @@ MULTI_CAPS_FUNC(AV_CPU_FLAG_SSE2, sse2)
 
     if(mm_flags & AV_CPU_FLAG_SSE2) {
         if(   out_fmt == AV_SAMPLE_FMT_FLT  && in_fmt == AV_SAMPLE_FMT_S32 || out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_S32P)
-            ac->simd_f =  ff_int32_to_float_a_sse2;
+            ac->simd_f =  ff_def_int32_to_float_a_sse2;
         if(   out_fmt == AV_SAMPLE_FMT_FLT  && in_fmt == AV_SAMPLE_FMT_S16 || out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_S16P)
-            ac->simd_f =  ff_int16_to_float_a_sse2;
+            ac->simd_f =  ff_def_int16_to_float_a_sse2;
         if(   out_fmt == AV_SAMPLE_FMT_S32  && in_fmt == AV_SAMPLE_FMT_FLT || out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_FLTP)
-            ac->simd_f =  ff_float_to_int32_a_sse2;
+            ac->simd_f =  ff_def_float_to_int32_a_sse2;
         if(   out_fmt == AV_SAMPLE_FMT_S16  && in_fmt == AV_SAMPLE_FMT_FLT || out_fmt == AV_SAMPLE_FMT_S16P && in_fmt == AV_SAMPLE_FMT_FLTP)
-            ac->simd_f =  ff_float_to_int16_a_sse2;
+            ac->simd_f =  ff_def_float_to_int16_a_sse2;
 
         if(channels == 2) {
             if(   out_fmt == AV_SAMPLE_FMT_FLT  && in_fmt == AV_SAMPLE_FMT_FLTP || out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_S32P)
@@ -127,7 +127,7 @@ MULTI_CAPS_FUNC(AV_CPU_FLAG_SSE2, sse2)
     }
     if(HAVE_AVX_EXTERNAL && mm_flags & AV_CPU_FLAG_AVX) {
         if(   out_fmt == AV_SAMPLE_FMT_FLT  && in_fmt == AV_SAMPLE_FMT_S32 || out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_S32P)
-            ac->simd_f =  ff_int32_to_float_a_avx;
+            ac->simd_f =  ff_def_int32_to_float_a_avx;
         if(channels == 6) {
             if(   out_fmt == AV_SAMPLE_FMT_FLT  && in_fmt == AV_SAMPLE_FMT_FLTP || out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_S32P)
                 ac->simd_f =  ff_pack_6ch_float_to_float_a_avx;
-- 
1.8.5.2



More information about the ffmpeg-devel mailing list