aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>2016-03-06 21:25:11 +0100
committerRostislav Pehlivanov <atomnuker@gmail.com>2016-03-28 16:56:27 +0100
commitb176ab0556914a734932e934a5e904dad091ad71 (patch)
tree6279274be9cdba204bc1e82b188234f3c4b63082
parent1cbe4ff2acdd1f166ac7ac912c1b00da9fbf0dd1 (diff)
downloadffmpeg-b176ab0556914a734932e934a5e904dad091ad71.tar.gz
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@gmx.de> (cherry picked from commit b60dfae7af65c4c7d255ef599352f2c54964303d)
-rw-r--r--libavcodec/aacenc_utils.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/libavcodec/aacenc_utils.h b/libavcodec/aacenc_utils.h
index b9bd6bf449..41a62961e1 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;
}
}