aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMans Rullgard <mans@mansr.com>2012-08-05 22:22:10 +0100
committerMans Rullgard <mans@mansr.com>2012-08-13 17:59:21 +0100
commitd752509b7437beefac079021fc5ecbd4e27df6b5 (patch)
treeeaec4c04ead1e7d2faf083c31f0055f627e979ac /libavcodec
parent90540c2d5ace46a1e9789c75fde0b1f7dbb12a9b (diff)
downloadffmpeg-d752509b7437beefac079021fc5ecbd4e27df6b5.tar.gz
Use log2(x) instead of log(x) / log(2)
Signed-off-by: Mans Rullgard <mans@mansr.com>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/imc.c4
-rw-r--r--libavcodec/snowenc.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/libavcodec/imc.c b/libavcodec/imc.c
index 95495bff96..e452baf39b 100644
--- a/libavcodec/imc.c
+++ b/libavcodec/imc.c
@@ -342,7 +342,7 @@ static void imc_decode_level_coefficients(IMCContext *q, int *levlCoeffBuf,
// maybe some frequency division thingy
flcoeffs1[0] = 20000.0 / pow (2, levlCoeffBuf[0] * 0.18945); // 0.18945 = log2(10) * 0.05703125
- flcoeffs2[0] = log(flcoeffs1[0]) / log(2);
+ flcoeffs2[0] = log2f(flcoeffs1[0]);
tmp = flcoeffs1[0];
tmp2 = flcoeffs2[0];
@@ -414,7 +414,7 @@ static int bit_allocation(IMCContext *q, IMCChannel *chctx,
highest = FFMAX(highest, chctx->flcoeffs1[i]);
for (i = 0; i < BANDS - 1; i++)
- chctx->flcoeffs4[i] = chctx->flcoeffs3[i] - log(chctx->flcoeffs5[i]) / log(2);
+ chctx->flcoeffs4[i] = chctx->flcoeffs3[i] - log2f(chctx->flcoeffs5[i]);
chctx->flcoeffs4[BANDS - 1] = limit;
highest = highest * 0.25;
diff --git a/libavcodec/snowenc.c b/libavcodec/snowenc.c
index 2eaf923540..481dc1a503 100644
--- a/libavcodec/snowenc.c
+++ b/libavcodec/snowenc.c
@@ -1529,7 +1529,7 @@ static void update_last_header_values(SnowContext *s){
}
static int qscale2qlog(int qscale){
- return rint(QROOT*log(qscale / (float)FF_QP2LAMBDA)/log(2))
+ return rint(QROOT*log2(qscale / (float)FF_QP2LAMBDA))
+ 61*QROOT/8; ///< 64 > 60
}