[FFmpeg-devel] [PATCH] lavc/aacenc_utils: unroll quantize_bands loop
Michael Niedermayer
michael at niedermayer.cc
Sat Mar 19 12:36:16 CET 2016
On Fri, Mar 18, 2016 at 07:27:46PM -0700, Ganesh Ajjanagadde wrote:
> Yields speedup in quantize_bands, and non-negligible speedup in aac encoding overall.
>
> Sample benchmark (Haswell, -march=native + GCC):
> new:
> [...]
> 553 decicycles in quantize_bands, 2097136 runs, 16 skips9x
> 554 decicycles in quantize_bands, 4194266 runs, 38 skips8x
> 559 decicycles in quantize_bands, 8388534 runs, 74 skips7x
>
> old:
> [...]
> 711 decicycles in quantize_bands, 2097140 runs, 12 skips7x
> 713 decicycles in quantize_bands, 4194277 runs, 27 skips4x
> 715 decicycles in quantize_bands, 8388538 runs, 70 skips3x
>
> old:
> ffmpeg -f lavfi -i anoisesrc -t 300 -y sin_new.aac 4.58s user 0.01s system 99% cpu 4.590 total
>
> new:
> ffmpeg -f lavfi -i anoisesrc -t 300 -y sin_new.aac 4.54s user 0.02s system 99% cpu 4.566 total
>
> Signed-off-by: Ganesh Ajjanagadde <gajjanag at gmail.com>
> ---
> libavcodec/aacenc_utils.h | 33 +++++++++++++++++++++++++--------
> 1 file changed, 25 insertions(+), 8 deletions(-)
>
> diff --git a/libavcodec/aacenc_utils.h b/libavcodec/aacenc_utils.h
> index 38636e5..0203b6e 100644
> --- a/libavcodec/aacenc_utils.h
> +++ b/libavcodec/aacenc_utils.h
> @@ -62,18 +62,35 @@ static inline int quant(float coef, const float Q, const float rounding)
> return sqrtf(a * sqrtf(a)) + rounding;
> }
>
> +static inline float minf(float x, float y) {
> + return x < y ? x : y;
> +}
> +
> static inline void quantize_bands(int *out, const float *in, const float *scaled,
> int size, float Q34, int is_signed, int maxval,
> const float rounding)
> {
> - int i;
> - for (i = 0; i < size; i++) {
[...]
> + for (int i = 0; i < size; i+=4) {
iam not sure we still support a compiler that has a problem with
that int placement but its not done anywhere else
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
In fact, the RIAA has been known to suggest that students drop out
of college or go to community college in order to be able to afford
settlements. -- The RIAA
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160319/c84846b8/attachment.sig>
More information about the ffmpeg-devel
mailing list