Mercurial > libavcodec.hg
comparison aac.c @ 10849:e8f4b9e41b7a libavcodec
AAC: use table for cbrtf(n)*n
The maximum length of escape_sequence is 21 bits, so adjust limit in
code to match this.
Up to 10% faster on Cortex-A8.
author | mru |
---|---|
date | Mon, 11 Jan 2010 20:21:26 +0000 |
parents | b4aca3bfff0f |
children | bcfe2acbf190 |
comparison
equal
deleted
inserted
replaced
10848:b4aca3bfff0f | 10849:e8f4b9e41b7a |
---|---|
99 }; | 99 }; |
100 | 100 |
101 static VLC vlc_scalefactors; | 101 static VLC vlc_scalefactors; |
102 static VLC vlc_spectral[11]; | 102 static VLC vlc_spectral[11]; |
103 | 103 |
104 static float cbrt_tab[1<<13]; | |
104 | 105 |
105 static ChannelElement *get_che(AACContext *ac, int type, int elem_id) | 106 static ChannelElement *get_che(AACContext *ac, int type, int elem_id) |
106 { | 107 { |
107 if (ac->tag_che_map[type][elem_id]) { | 108 if (ac->tag_che_map[type][elem_id]) { |
108 return ac->tag_che_map[type][elem_id]; | 109 return ac->tag_che_map[type][elem_id]; |
552 // window initialization | 553 // window initialization |
553 ff_kbd_window_init(ff_aac_kbd_long_1024, 4.0, 1024); | 554 ff_kbd_window_init(ff_aac_kbd_long_1024, 4.0, 1024); |
554 ff_kbd_window_init(ff_aac_kbd_short_128, 6.0, 128); | 555 ff_kbd_window_init(ff_aac_kbd_short_128, 6.0, 128); |
555 ff_init_ff_sine_windows(10); | 556 ff_init_ff_sine_windows(10); |
556 ff_init_ff_sine_windows( 7); | 557 ff_init_ff_sine_windows( 7); |
558 | |
559 if (!cbrt_tab[(1<<13) - 1]) | |
560 for (i = 0; i < 1<<13; i++) | |
561 cbrt_tab[i] = cbrtf(i) * i; | |
557 | 562 |
558 return 0; | 563 return 0; |
559 } | 564 } |
560 | 565 |
561 /** | 566 /** |
947 if (n == 13) { | 952 if (n == 13) { |
948 av_log(ac->avccontext, AV_LOG_ERROR, "error in spectral data, ESC overflow\n"); | 953 av_log(ac->avccontext, AV_LOG_ERROR, "error in spectral data, ESC overflow\n"); |
949 return -1; | 954 return -1; |
950 } | 955 } |
951 n = (1 << n) + get_bits(gb, n); | 956 n = (1 << n) + get_bits(gb, n); |
952 coef[coef_tmp_idx + j] *= cbrtf(n) * n; | 957 coef[coef_tmp_idx + j] *= cbrt_tab[n]; |
953 } else | 958 } else |
954 coef[coef_tmp_idx + j] *= vq_ptr[j]; | 959 coef[coef_tmp_idx + j] *= vq_ptr[j]; |
955 } | 960 } |
956 } | 961 } |
957 } | 962 } |