Justin Ruggles <[email protected]> writes: > This is about 75% faster on Athlon64. > --- > libavcodec/ac3dsp.c | 8 ++++++++ > 1 files changed, 8 insertions(+), 0 deletions(-) > > diff --git a/libavcodec/ac3dsp.c b/libavcodec/ac3dsp.c > index 98c7357..883a723 100644 > --- a/libavcodec/ac3dsp.c > +++ b/libavcodec/ac3dsp.c > @@ -20,6 +20,7 @@ > */ > > #include "libavutil/avassert.h" > +#include "libavutil/intreadwrite.h" > #include "avcodec.h" > #include "ac3.h" > #include "ac3dsp.h" > @@ -164,8 +165,15 @@ static void ac3_extract_exponents_c(uint8_t *exp, > int32_t *coef, int nb_coefs) > int i; > > for (i = 0; i < nb_coefs; i++) { > +#if HAVE_FAST_CLZ > int v = abs(coef[i]); > exp[i] = v ? 23 - av_log2(v) : 24; > +#else > + /* av_log2() is slow without fast clz, so get exponent from float > instead */ > + av_alias32 c; > + c.f32 = (abs(coef[i]) << 1) | 0x1; > + exp[i] = 151 - (c.u32 >> 23); > +#endif > } > } > > --
This is only good if floating-point is faster than the table-based av_log(). In a soft-float implementation, that is almost certainly not the case. -- Måns Rullgård [email protected] _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
