[FFmpeg-devel] [PATCH v2] SH4 mpegaudio decoder optimizations

Reimar Döffinger Reimar.Doeffinger
Tue Dec 14 20:43:17 CET 2010


On Tue, Dec 14, 2010 at 05:24:22PM +0100, Guennadi Liakhovetski wrote:
> +#ifndef SUM8_MACS
> +#define SUM8_MACS(sum, w, p) SUM8(MACS, sum, w, p)
> +#endif
> +
> +#ifndef SUM8_MLSS
> +#define SUM8_MLSS(sum, w, p) SUM8(MLSS, sum, w, p)
> +#endif
> +
> +#ifndef SUM8P2_MACS_MLSS
> +#define SUM8P2_MACS_MLSS(sum, sum2, w, w2, p) SUM8P2(sum, MACS, sum2, MLSS, w, w2, p)
> +#endif
> +
> +#ifndef SUM8P2_MLSS_MLSS
> +#define SUM8P2_MLSS_MLSS(sum, sum2, w, w2, p) SUM8P2(sum, MLSS, sum2, MLSS, w, w2, p)
> +#endif

Can't you instead do something like (note I usually get the syntax
wrong, plus I don't know if there are issues if the generated
name is a macro as well):
#define SUM8(op, sum, w, p) SUM8_#op(sum, w, p)

> +    union {int64_t x; int32_t u32[2];} u =           \
> +                    {.x = (sum),};                   \

Does using a union create faster code that doing it "properly"
with shifts/ors/...?
To might knowledge that this works is just something that
gcc "currently" promises, but is not part of the C standard.

> +    : [hi] "+r" (u.u32[1]),                          \
> +      [lo] "+r" (u.u32[0]),                          \
> +      [wp] "+r" (wp),                                \
> +      [pp] "+r" (pp)                                 \

Do all compilers/compiler versions that are in use support
named asm arguments?
I also think as a paranoia measure these should be +&r
(but I admit I never understood that so 100%).

> +#if (!defined(CONFIG_FLOAT) || !CONFIG_FLOAT) && (!defined(FRAC_BITS) || FRAC_BITS > 15)

I don't think it's valid for those not to be defined?



More information about the ffmpeg-devel mailing list