This commit moves the generation of ff_aac_pow34sf_tab[] out of the encoder and into the table generator. The original commit log for this table in 2011 actually mentions that it should be moved outside but this never happened. This is the first commit which cleans up the encoder a little.
Unified · Split
| @@ -33,5 +33,7 @@ int main(void) · 32 unmodified lines | |||
| 33 | 33 | ||
| 34 | WRITE_ARRAY("const", float, ff_aac_pow2sf_tab); | 34 | WRITE_ARRAY("const", float, ff_aac_pow2sf_tab); |
| 35 | 35 | ||
| 36 | WRITE_ARRAY("const", float, ff_aac_pow34sf_tab); | ||
| 37 | |||
| 36 | return 0; | 38 | return 0; |
| 37 | } | 39 | } |
| @@ -30,12 +30,15 @@ · 29 unmodified lines | |||
| 30 | #else | 30 | #else |
| 31 | #include "libavutil/mathematics.h" | 31 | #include "libavutil/mathematics.h" |
| 32 | float ff_aac_pow2sf_tab[428]; | 32 | float ff_aac_pow2sf_tab[428]; |
| 33 | float ff_aac_pow34sf_tab[428]; | ||
| 33 | 34 | ||
| 34 | av_cold void ff_aac_tableinit(void) | 35 | av_cold void ff_aac_tableinit(void) |
| 35 | { | 36 | { |
| 36 | int i; | 37 | int i; |
| 37 | for (i = 0; i < 428; i++) | 38 | for (i = 0; i < 428; i++) { |
| 38 | ff_aac_pow2sf_tab[i] = pow(2, (i - POW_SF2_ZERO) / 4.0); | 39 | ff_aac_pow2sf_tab[i] = pow(2, (i - POW_SF2_ZERO) / 4.0); |
| 40 | ff_aac_pow34sf_tab[i] = pow(ff_aac_pow2sf_tab[i], 3.0/4.0); | ||
| 41 | } | ||
| 39 | } | 42 | } |
| 40 | #endif /* CONFIG_HARDCODED_TABLES */ | 43 | #endif /* CONFIG_HARDCODED_TABLES */ |
| 41 | 44 | ||
| @@ -28,9 +28,11 @@ · 27 unmodified lines | |||
| 28 | #if CONFIG_HARDCODED_TABLES | 28 | #if CONFIG_HARDCODED_TABLES |
| 29 | #define ff_aac_tableinit() | 29 | #define ff_aac_tableinit() |
| 30 | extern const float ff_aac_pow2sf_tab[428]; | 30 | extern const float ff_aac_pow2sf_tab[428]; |
| 31 | extern const float ff_aac_pow34sf_tab[428]; | ||
| 31 | #else | 32 | #else |
| 32 | void ff_aac_tableinit(void); | 33 | void ff_aac_tableinit(void); |
| 33 | extern float ff_aac_pow2sf_tab[428]; | 34 | extern float ff_aac_pow2sf_tab[428]; |
| 35 | extern float ff_aac_pow34sf_tab[428]; | ||
| 34 | #endif /* CONFIG_HARDCODED_TABLES */ | 36 | #endif /* CONFIG_HARDCODED_TABLES */ |
| 35 | 37 | ||
| 36 | #endif /* AVCODEC_AAC_TABLEGEN_DECL_H */ | 38 | #endif /* AVCODEC_AAC_TABLEGEN_DECL_H */ |
| @@ -39,6 +39,7 @@ · 38 unmodified lines | |||
| 39 | #include "aac.h" | 39 | #include "aac.h" |
| 40 | #include "aacenc.h" | 40 | #include "aacenc.h" |
| 41 | #include "aactab.h" | 41 | #include "aactab.h" |
| 42 | #include "aac_tablegen_decl.h" | ||
| 42 | 43 | ||
| 43 | /** Frequency in Hz for lower limit of noise substitution **/ | 44 | /** Frequency in Hz for lower limit of noise substitution **/ |
| 44 | #define NOISE_LOW_LIMIT 4500 | 45 | #define NOISE_LOW_LIMIT 4500 |
| @@ -58,7 +58,6 @@ · 57 unmodified lines | |||
| 58 | av_log(avctx, AV_LOG_WARNING, __VA_ARGS__); \ | 58 | av_log(avctx, AV_LOG_WARNING, __VA_ARGS__); \ |
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | float ff_aac_pow34sf_tab[428]; | ||
| 62 | 61 | ||
| 63 | static const uint8_t swb_size_1024_96[] = { | 62 | static const uint8_t swb_size_1024_96[] = { |
| 64 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 8, | 63 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 8, |
| @@ -855,9 +854,6 @@ static av_cold int aac_encode_init(AVCodecContext *avctx) · 790 unmodified lines | |||
| 855 | 854 | ||
| 856 | ff_aac_tableinit(); | 855 | ff_aac_tableinit(); |
| 857 | 856 | ||
| 858 | for (i = 0; i < 428; i++) | ||
| 859 | ff_aac_pow34sf_tab[i] = sqrt(ff_aac_pow2sf_tab[i] * sqrt(ff_aac_pow2sf_tab[i])); | ||
| 860 | |||
| 861 | avctx->initial_padding = 1024; | 857 | avctx->initial_padding = 1024; |
| 862 | ff_af_queue_init(avctx, &s->afq); | 858 | ff_af_queue_init(avctx, &s->afq); |
| 863 | 859 | ||
| @@ -95,8 +95,6 @@ typedef struct AACEncContext { · 94 unmodified lines | |||
| 95 | } buffer; | 95 | } buffer; |
| 96 | } AACEncContext; | 96 | } AACEncContext; |
| 97 | 97 | ||
| 98 | extern float ff_aac_pow34sf_tab[428]; | ||
| 99 | |||
| 100 | void ff_aac_coder_init_mips(AACEncContext *c); | 98 | void ff_aac_coder_init_mips(AACEncContext *c); |
| 101 | 99 | ||
| 102 | #endif /* AVCODEC_AACENC_H */ | 100 | #endif /* AVCODEC_AACENC_H */ |