[FFmpeg-cvslog] lavc/dcaenc: avoid wasteful cos calls
Ganesh Ajjanagadde
git at videolan.org
Fri Dec 11 16:37:09 CET 2015
ffmpeg | branch: master | Ganesh Ajjanagadde <gajjanagadde at gmail.com> | Wed Dec 9 18:19:33 2015 -0500| [df679f12649d4184eebe02fe4cdd80c2952d0022] | committer: Ganesh Ajjanagadde
lavc/dcaenc: avoid wasteful cos calls
cos has symmetry; use this.
Reviewed-by: Paul B Mahol <onemda at gmail.com>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=df679f12649d4184eebe02fe4cdd80c2952d0022
---
libavcodec/dcaenc.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/libavcodec/dcaenc.c b/libavcodec/dcaenc.c
index 5a6bdac..6fcfb1a 100644
--- a/libavcodec/dcaenc.c
+++ b/libavcodec/dcaenc.c
@@ -169,8 +169,16 @@ static int encode_init(AVCodecContext *avctx)
if (!cos_table[0]) {
int j, k;
- for (i = 0; i < 2048; i++) {
+ cos_table[0] = 0x7fffffff;
+ cos_table[512] = 0;
+ cos_table[1024] = -cos_table[0];
+ for (i = 1; i < 512; i++) {
cos_table[i] = (int32_t)(0x7fffffff * cos(M_PI * i / 1024));
+ cos_table[1024-i] = -cos_table[i];
+ cos_table[1024+i] = -cos_table[i];
+ cos_table[2048-i] = cos_table[i];
+ }
+ for (i = 0; i < 2048; i++) {
cb_to_level[i] = (int32_t)(0x7fffffff * pow(10, -0.005 * i));
}
More information about the ffmpeg-cvslog
mailing list