History

aacenc: move the generation of ff_aac_pow34sf_tab[]

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.

Rostislav Pehlivanov committed 11 years ago

Commit 331c1e71 parent cee7acf6 files · +9 −7Browse files

Unified · Split

6 files
  1. libavcodec/aac_tablegen.c +2 −0
  2. libavcodec/aac_tablegen.h +4 −1
  3. libavcodec/aac_tablegen_decl.h +2 −0
  4. libavcodec/aaccoder.c +1 −0
  5. libavcodec/aacenc.c +0 −4
  6. libavcodec/aacenc.h +0 −2
libavcodec/aac_tablegen.c+2−0
@@ -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}
libavcodec/aac_tablegen.h+4−1
@@ -30,12 +30,15 @@ · 29 unmodified lines
30#else30#else
31#include "libavutil/mathematics.h"31#include "libavutil/mathematics.h"
32float ff_aac_pow2sf_tab[428];32float ff_aac_pow2sf_tab[428];
33float ff_aac_pow34sf_tab[428];
33 34
34av_cold void ff_aac_tableinit(void)35av_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
libavcodec/aac_tablegen_decl.h+2−0
@@ -28,9 +28,11 @@ · 27 unmodified lines
28#if CONFIG_HARDCODED_TABLES28#if CONFIG_HARDCODED_TABLES
29#define ff_aac_tableinit()29#define ff_aac_tableinit()
30extern const float ff_aac_pow2sf_tab[428];30extern const float ff_aac_pow2sf_tab[428];
31extern const float ff_aac_pow34sf_tab[428];
31#else32#else
32void ff_aac_tableinit(void);33void ff_aac_tableinit(void);
33extern float ff_aac_pow2sf_tab[428];34extern float ff_aac_pow2sf_tab[428];
35extern 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 */
libavcodec/aaccoder.c+1−0
@@ -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 450045#define NOISE_LOW_LIMIT 4500
libavcodec/aacenc.c+0−4
@@ -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
61float ff_aac_pow34sf_tab[428];
62 61
63static const uint8_t swb_size_1024_96[] = {62static 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
libavcodec/aacenc.h+0−2
@@ -95,8 +95,6 @@ typedef struct AACEncContext { · 94 unmodified lines
95 } buffer;95 } buffer;
96} AACEncContext;96} AACEncContext;
97 97
98extern float ff_aac_pow34sf_tab[428];
99
100void ff_aac_coder_init_mips(AACEncContext *c);98void ff_aac_coder_init_mips(AACEncContext *c);
101 99
102#endif /* AVCODEC_AACENC_H */100#endif /* AVCODEC_AACENC_H */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t