1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00

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>
This commit is contained in:
Ganesh Ajjanagadde 2015-12-09 18:19:33 -05:00
parent a0ddebfedf
commit df679f1264

View File

@ -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));
}