[FFmpeg-devel] [PATCH] Avoid using empty macro arguments.
Reimar Döffinger
Reimar.Doeffinger at gmx.de
Mon Dec 30 16:19:13 CET 2013
On Mon, Dec 30, 2013 at 02:36:03PM +0100, Michael Niedermayer wrote:
> On Mon, Dec 30, 2013 at 12:13:00PM +0100, Reimar Döffinger wrote:
> > 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)
>
> i think these also could be fixed by passing arith and arith2
> that would avoid having to rename functions
Not to mention that I think it would look nicer.
> [...]
> > --- 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)
>
> below would avoid adding the "def"
> PROTO4(_)
> PROTO4(_pack_2ch_)
> PROTO4(_pack_6ch_)
> PROTO4(_unpack_2ch_)
Hm, will check, but sounds like a good idea, too.
Thanks, will send a new patch if these work out.
More information about the ffmpeg-devel
mailing list