summaryrefslogtreecommitdiffstats
path: root/libavcodec/aacenc_utils.h
diff options
context:
space:
mode:
authorClaudio Freire <klaussfreire@gmail.com>2016-01-14 00:38:22 -0300
committerClaudio Freire <klaussfreire@gmail.com>2016-01-14 00:38:22 -0300
commit62dfe1d40d87f8f67cd77d4b769b7c6163083c5e (patch)
tree1b127ce3b9f6e58d2ef943d4070d8642b7029b9f /libavcodec/aacenc_utils.h
parenta0a47a09b0e204216072c1f77643de3f6f869732 (diff)
downloadffmpeg-streaming-62dfe1d40d87f8f67cd77d4b769b7c6163083c5e.zip
ffmpeg-streaming-62dfe1d40d87f8f67cd77d4b769b7c6163083c5e.tar.gz
avcodec/aacenc_is: replace pow(x, 0.75) by x/sqrtf(sqrtf(x))
This is quite an accurate approximation; testing shows ~ 2ulp error in the floating point result. Tested with FATE. Alternatively, if one wants "full accuracy", one can use powf, or sqrt instead of sqrtf. With powf, one gets 1 ulp error (theoretically should be 0, as 0.75 is exactly representable) on GNU libm, with sqrt, 0 ulp error. Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com> Abstracted into pos_pow34 utility function Signed-off-by: Claudio Freire <klaussfreire@gmail.com>
Diffstat (limited to 'libavcodec/aacenc_utils.h')
-rw-r--r--libavcodec/aacenc_utils.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/aacenc_utils.h b/libavcodec/aacenc_utils.h
index 736e4a0..cb5bc8d 100644
--- a/libavcodec/aacenc_utils.h
+++ b/libavcodec/aacenc_utils.h
@@ -45,6 +45,11 @@ static inline void abs_pow34_v(float *out, const float *in, const int size)
}
}
+static inline float pos_pow34(float a)
+{
+ return sqrtf(a * sqrtf(a));
+}
+
/**
* Quantize one coefficient.
* @return absolute value of the quantized coefficient
OpenPOWER on IntegriCloud