diff options
author | Ganesh Ajjanagadde <gajjanagadde@gmail.com> | 2015-12-09 18:19:33 -0500 |
---|---|---|
committer | Ganesh Ajjanagadde <gajjanagadde@gmail.com> | 2015-12-11 10:22:09 -0500 |
commit | df679f12649d4184eebe02fe4cdd80c2952d0022 (patch) | |
tree | 243974eb757bddbced8e4a671ffa57690ad6ffbd | |
parent | a0ddebfedf469282e2ea5e42c28e6a991afaf088 (diff) | |
download | ffmpeg-df679f12649d4184eebe02fe4cdd80c2952d0022.tar.gz |
lavc/dcaenc: avoid wasteful cos calls
cos has symmetry; use this.
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
-rw-r--r-- | libavcodec/dcaenc.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/libavcodec/dcaenc.c b/libavcodec/dcaenc.c index 5a6bdac010..6fcfb1addc 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)); } |