[FFmpeg-cvslog] aacenc_utils: Use temporary variable.

Reimar Döffinger git at videolan.org
Mon Mar 28 17:58:51 CEST 2016


ffmpeg | branch: release/3.0 | Reimar Döffinger <Reimar.Doeffinger at gmx.de> | Sun Mar  6 21:25:11 2016 +0100| [b176ab0556914a734932e934a5e904dad091ad71] | committer: Rostislav Pehlivanov

aacenc_utils: Use temporary variable.

This ensures gcc does not create unnecessary
loads or stores and possibly even does not vectorize
the negation.
Speeds up mp3 to aac transcoding with default settings
by 10% when using "gcc (Debian 5.3.1-10) 5.3.1 20160224".

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger at gmx.de>
(cherry picked from commit b60dfae7af65c4c7d255ef599352f2c54964303d)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b176ab0556914a734932e934a5e904dad091ad71
---

 libavcodec/aacenc_utils.h |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavcodec/aacenc_utils.h b/libavcodec/aacenc_utils.h
index b9bd6bf..41a6296 100644
--- a/libavcodec/aacenc_utils.h
+++ b/libavcodec/aacenc_utils.h
@@ -68,10 +68,11 @@ static inline void quantize_bands(int *out, const float *in, const float *scaled
     int i;
     for (i = 0; i < size; i++) {
         float qc = scaled[i] * Q34;
-        out[i] = (int)FFMIN(qc + rounding, (float)maxval);
+        int tmp = (int)FFMIN(qc + rounding, (float)maxval);
         if (is_signed && in[i] < 0.0f) {
-            out[i] = -out[i];
+            tmp = -tmp;
         }
+        out[i] = tmp;
     }
 }
 



More information about the ffmpeg-cvslog mailing list