Browse code

Merge remote-tracking branch 'newdev/master'

Merged-by: Michael Niedermayer <michaelni@gmx.at>

Michael Niedermayer authored on 2011/03/21 11:09:46
Showing 46 changed files
... ...
@@ -960,6 +960,7 @@ CONFIG_LIST="
960 960
     rtpdec
961 961
     runtime_cpudetect
962 962
     shared
963
+    sinewin
963 964
     small
964 965
     sram
965 966
     static
... ...
@@ -1238,8 +1239,8 @@ mdct_select="fft"
1238 1238
 rdft_select="fft"
1239 1239
 
1240 1240
 # decoders / encoders / hardware accelerators
1241
-aac_decoder_select="mdct rdft"
1242
-aac_encoder_select="mdct"
1241
+aac_decoder_select="mdct rdft sinewin"
1242
+aac_encoder_select="mdct sinewin"
1243 1243
 aac_latm_decoder_select="aac_decoder aac_latm_parser"
1244 1244
 ac3_decoder_select="mdct ac3_parser"
1245 1245
 ac3_encoder_select="mdct ac3dsp"
... ...
@@ -1247,12 +1248,12 @@ ac3_fixed_encoder_select="ac3dsp"
1247 1247
 alac_encoder_select="lpc"
1248 1248
 amrnb_decoder_select="lsp"
1249 1249
 amrwb_decoder_select="lsp"
1250
-atrac1_decoder_select="mdct"
1250
+atrac1_decoder_select="mdct sinewin"
1251 1251
 atrac3_decoder_select="mdct"
1252 1252
 binkaudio_dct_decoder_select="mdct rdft dct"
1253 1253
 binkaudio_rdft_decoder_select="mdct rdft"
1254 1254
 cavs_decoder_select="golomb"
1255
-cook_decoder_select="mdct"
1255
+cook_decoder_select="mdct sinewin"
1256 1256
 cscd_decoder_suggest="zlib"
1257 1257
 dca_decoder_select="mdct"
1258 1258
 dnxhd_encoder_select="aandct"
... ...
@@ -1315,8 +1316,8 @@ msmpeg4v2_decoder_select="h263_decoder"
1315 1315
 msmpeg4v2_encoder_select="h263_encoder"
1316 1316
 msmpeg4v3_decoder_select="h263_decoder"
1317 1317
 msmpeg4v3_encoder_select="h263_encoder"
1318
-nellymoser_decoder_select="mdct"
1319
-nellymoser_encoder_select="mdct"
1318
+nellymoser_decoder_select="mdct sinewin"
1319
+nellymoser_encoder_select="mdct sinewin"
1320 1320
 png_decoder_select="zlib"
1321 1321
 png_encoder_select="zlib"
1322 1322
 qcelp_decoder_select="lsp"
... ...
@@ -1343,7 +1344,7 @@ tiff_decoder_suggest="zlib"
1343 1343
 tiff_encoder_suggest="zlib"
1344 1344
 truehd_decoder_select="mlp_decoder"
1345 1345
 tscc_decoder_select="zlib"
1346
-twinvq_decoder_select="mdct lsp"
1346
+twinvq_decoder_select="mdct lsp sinewin"
1347 1347
 vc1_decoder_select="h263_decoder"
1348 1348
 vc1_crystalhd_decoder_select="crystalhd"
1349 1349
 vc1_dxva2_hwaccel_deps="dxva2api_h DXVA_PictureParameters_wDecodedPictureIndex"
... ...
@@ -1356,12 +1357,12 @@ vp6_decoder_select="huffman"
1356 1356
 vp6a_decoder_select="vp6_decoder"
1357 1357
 vp6f_decoder_select="vp6_decoder"
1358 1358
 vp8_decoder_select="h264pred"
1359
-wmapro_decoder_select="mdct"
1360
-wmav1_decoder_select="mdct"
1361
-wmav1_encoder_select="mdct"
1362
-wmav2_decoder_select="mdct"
1363
-wmav2_encoder_select="mdct"
1364
-wmavoice_decoder_select="lsp rdft dct mdct"
1359
+wmapro_decoder_select="mdct sinewin"
1360
+wmav1_decoder_select="mdct sinewin"
1361
+wmav1_encoder_select="mdct sinewin"
1362
+wmav2_decoder_select="mdct sinewin"
1363
+wmav2_encoder_select="mdct sinewin"
1364
+wmavoice_decoder_select="lsp rdft dct mdct sinewin"
1365 1365
 wmv1_decoder_select="h263_decoder"
1366 1366
 wmv1_encoder_select="h263_encoder"
1367 1367
 wmv2_decoder_select="h263_decoder"
... ...
@@ -622,11 +622,43 @@ Synchronize read on input.
622 622
 @section Advanced options
623 623
 
624 624
 @table @option
625
-@item -map @var{input_stream_id}[:@var{sync_stream_id}]
626
-Set stream mapping from input streams to output streams.
627
-Just enumerate the input streams in the order you want them in the output.
628
-@var{sync_stream_id} if specified sets the input stream to sync
629
-against.
625
+@item -map @var{input_file_id}.@var{input_stream_id}[:@var{sync_file_id}.@var{sync_stream_id}]
626
+
627
+Designate an input stream as a source for the output file. Each input
628
+stream is identified by the input file index @var{input_file_id} and
629
+the input stream index @var{input_stream_id} within the input
630
+file. Both indexes start at 0. If specified,
631
+@var{sync_file_id}.@var{sync_stream_id} sets which input stream
632
+is used as a presentation sync reference.
633
+
634
+The @code{-map} options must be specified just after the output file.
635
+If any @code{-map} options are used, the number of @code{-map} options
636
+on the command line must match the number of streams in the output
637
+file. The first @code{-map} option on the command line specifies the
638
+source for output stream 0, the second @code{-map} option specifies
639
+the source for output stream 1, etc.
640
+
641
+For example, if you have two audio streams in the first input file,
642
+these streams are identified by "0.0" and "0.1". You can use
643
+@code{-map} to select which stream to place in an output file. For
644
+example:
645
+@example
646
+ffmpeg -i INPUT out.wav -map 0.1
647
+@end example
648
+will map the input stream in @file{INPUT} identified by "0.1" to
649
+the (single) output stream in @file{out.wav}.
650
+
651
+For example, to select the stream with index 2 from input file
652
+@file{a.mov} (specified by the identifier "0.2"), and stream with
653
+index 6 from input @file{b.mov} (specified by the identifier "1.6"),
654
+and copy them to the output file @file{out.mov}:
655
+@example
656
+ffmpeg -i a.mov -i b.mov -vcodec copy -acodec copy out.mov -map 0.2 -map 1.6
657
+@end example
658
+
659
+To add more streams to the output file, you can use the
660
+@code{-newaudio}, @code{-newvideo}, @code{-newsubtitle} options.
661
+
630 662
 @item -map_meta_data @var{outfile}[,@var{metadata}]:@var{infile}[,@var{metadata}]
631 663
 Deprecated, use @var{-map_metadata} instead.
632 664
 
... ...
@@ -4214,7 +4214,7 @@ static const OptionDef options[] = {
4214 4214
     { "f", HAS_ARG, {(void*)opt_format}, "force format", "fmt" },
4215 4215
     { "i", HAS_ARG, {(void*)opt_input_file}, "input file name", "filename" },
4216 4216
     { "y", OPT_BOOL, {(void*)&file_overwrite}, "overwrite output files" },
4217
-    { "map", HAS_ARG | OPT_EXPERT, {(void*)opt_map}, "set input stream mapping", "file:stream[:syncfile:syncstream]" },
4217
+    { "map", HAS_ARG | OPT_EXPERT, {(void*)opt_map}, "set input stream mapping", "file.stream[:syncfile.syncstream]" },
4218 4218
     { "map_meta_data", HAS_ARG | OPT_EXPERT, {(void*)opt_map_meta_data}, "DEPRECATED set meta data information of outfile from infile",
4219 4219
       "outfile[,metadata]:infile[,metadata]" },
4220 4220
     { "map_metadata", HAS_ARG | OPT_EXPERT, {(void*)opt_map_metadata}, "set metadata information of outfile from infile",
... ...
@@ -43,6 +43,7 @@ OBJS-$(CONFIG_LSP)                     += lsp.o
43 43
 OBJS-$(CONFIG_MDCT)                    += mdct.o
44 44
 RDFT-OBJS-$(CONFIG_HARDCODED_TABLES)   += sin_tables.o
45 45
 OBJS-$(CONFIG_RDFT)                    += rdft.o $(RDFT-OBJS-yes)
46
+OBJS-$(CONFIG_SINEWIN)                 += sinewin.o
46 47
 OBJS-$(CONFIG_VAAPI)                   += vaapi.o
47 48
 OBJS-$(CONFIG_VDPAU)                   += vdpau.o
48 49
 
... ...
@@ -50,14 +51,14 @@ OBJS-$(CONFIG_VDPAU)                   += vdpau.o
50 50
 OBJS-$(CONFIG_A64MULTI_ENCODER)        += a64multienc.o elbg.o
51 51
 OBJS-$(CONFIG_A64MULTI5_ENCODER)       += a64multienc.o elbg.o
52 52
 OBJS-$(CONFIG_AAC_DECODER)             += aacdec.o aactab.o aacsbr.o aacps.o \
53
-                                          aacadtsdec.o mpeg4audio.o
53
+                                          aacadtsdec.o mpeg4audio.o kbdwin.o
54 54
 OBJS-$(CONFIG_AAC_ENCODER)             += aacenc.o aaccoder.o    \
55 55
                                           aacpsy.o aactab.o      \
56 56
                                           psymodel.o iirfilter.o \
57
-                                          mpeg4audio.o
57
+                                          mpeg4audio.o kbdwin.o
58 58
 OBJS-$(CONFIG_AASC_DECODER)            += aasc.o msrledec.o
59 59
 OBJS-$(CONFIG_AC3_DECODER)             += ac3dec.o ac3dec_data.o ac3.o
60
-OBJS-$(CONFIG_AC3_ENCODER)             += ac3enc_float.o ac3tab.o ac3.o
60
+OBJS-$(CONFIG_AC3_ENCODER)             += ac3enc_float.o ac3tab.o ac3.o kbdwin.o
61 61
 OBJS-$(CONFIG_AC3_FIXED_ENCODER)       += ac3enc_fixed.o ac3tab.o ac3.o
62 62
 OBJS-$(CONFIG_ALAC_DECODER)            += alac.o
63 63
 OBJS-$(CONFIG_ALAC_ENCODER)            += alacenc.o
... ...
@@ -694,7 +695,7 @@ $(SUBDIR)%_tablegen$(HOSTEXESUF): $(SUBDIR)%_tablegen.c $(SUBDIR)%_tablegen.h $(
694 694
 	$(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $(filter %.c,$^) $(HOSTLIBS)
695 695
 
696 696
 GEN_HEADERS = cbrt_tables.h aacps_tables.h aac_tables.h dv_tables.h     \
697
-              mdct_tables.h mpegaudio_tables.h motionpixels_tables.h    \
697
+              sinewin_tables.h mpegaudio_tables.h motionpixels_tables.h \
698 698
               pcm_tables.h qdm2_tables.h
699 699
 GEN_HEADERS := $(addprefix $(SUBDIR), $(GEN_HEADERS))
700 700
 
... ...
@@ -706,7 +707,7 @@ $(SUBDIR)aacdec.o: $(SUBDIR)cbrt_tables.h
706 706
 $(SUBDIR)aacps.o: $(SUBDIR)aacps_tables.h
707 707
 $(SUBDIR)aactab.o: $(SUBDIR)aac_tables.h
708 708
 $(SUBDIR)dv.o: $(SUBDIR)dv_tables.h
709
-$(SUBDIR)mdct.o: $(SUBDIR)mdct_tables.h
709
+$(SUBDIR)sinewin.o: $(SUBDIR)sinewin_tables.h
710 710
 $(SUBDIR)mpegaudiodec.o: $(SUBDIR)mpegaudio_tables.h
711 711
 $(SUBDIR)mpegaudiodec_float.o: $(SUBDIR)mpegaudio_tables.h
712 712
 $(SUBDIR)motionpixels.o: $(SUBDIR)motionpixels_tables.h
... ...
@@ -87,6 +87,8 @@
87 87
 #include "fft.h"
88 88
 #include "fmtconvert.h"
89 89
 #include "lpc.h"
90
+#include "kbdwin.h"
91
+#include "sinewin.h"
90 92
 
91 93
 #include "aac.h"
92 94
 #include "aactab.h"
... ...
@@ -1750,7 +1752,7 @@ static void windowing_and_mdct_ltp(AACContext *ac, float *out,
1750 1750
         ac->dsp.vector_fmul_reverse(in + 1024 + 448, in + 1024 + 448, swindow, 128);
1751 1751
         memset(in + 1024 + 576, 0, 448 * sizeof(float));
1752 1752
     }
1753
-    ff_mdct_calc(&ac->mdct_ltp, out, in);
1753
+    ac->mdct_ltp.mdct_calc(&ac->mdct_ltp, out, in);
1754 1754
 }
1755 1755
 
1756 1756
 /**
... ...
@@ -1839,9 +1841,9 @@ static void imdct_and_windowing(AACContext *ac, SingleChannelElement *sce)
1839 1839
     // imdct
1840 1840
     if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) {
1841 1841
         for (i = 0; i < 1024; i += 128)
1842
-            ff_imdct_half(&ac->mdct_small, buf + i, in + i);
1842
+            ac->mdct_small.imdct_half(&ac->mdct_small, buf + i, in + i);
1843 1843
     } else
1844
-        ff_imdct_half(&ac->mdct, buf, in);
1844
+        ac->mdct.imdct_half(&ac->mdct, buf, in);
1845 1845
 
1846 1846
     /* window overlapping
1847 1847
      * NOTE: To simplify the overlapping code, all 'meaningless' short to long
... ...
@@ -34,6 +34,8 @@
34 34
 #include "put_bits.h"
35 35
 #include "dsputil.h"
36 36
 #include "mpeg4audio.h"
37
+#include "kbdwin.h"
38
+#include "sinewin.h"
37 39
 
38 40
 #include "aac.h"
39 41
 #include "aactab.h"
... ...
@@ -250,7 +252,7 @@ static void apply_window_and_mdct(AVCodecContext *avctx, AACEncContext *s,
250 250
             for (i = 0; i < 1024; i++)
251 251
                 sce->saved[i] = audio[i * chans];
252 252
         }
253
-        ff_mdct_calc(&s->mdct1024, sce->coeffs, output);
253
+        s->mdct1024.mdct_calc(&s->mdct1024, sce->coeffs, output);
254 254
     } else {
255 255
         for (k = 0; k < 1024; k += 128) {
256 256
             for (i = 448 + k; i < 448 + k + 256; i++)
... ...
@@ -259,7 +261,7 @@ static void apply_window_and_mdct(AVCodecContext *avctx, AACEncContext *s,
259 259
                                          : audio[(i-1024)*chans];
260 260
             s->dsp.vector_fmul        (output,     output, k ?  swindow : pwindow, 128);
261 261
             s->dsp.vector_fmul_reverse(output+128, output+128, swindow, 128);
262
-            ff_mdct_calc(&s->mdct128, sce->coeffs + k, output);
262
+            s->mdct128.mdct_calc(&s->mdct128, sce->coeffs + k, output);
263 263
         }
264 264
         for (i = 0; i < 1024; i++)
265 265
             sce->saved[i] = audio[i * chans];
... ...
@@ -1155,7 +1155,7 @@ static void sbr_qmf_analysis(DSPContext *dsp, FFTContext *mdct, const float *in,
1155 1155
         }
1156 1156
         z[64+63] = z[32];
1157 1157
 
1158
-        ff_imdct_half(mdct, z, z+64);
1158
+        mdct->imdct_half(mdct, z, z+64);
1159 1159
         for (k = 0; k < 32; k++) {
1160 1160
             W[1][i][k][0] = -z[63-k];
1161 1161
             W[1][i][k][1] = z[k];
... ...
@@ -1190,7 +1190,7 @@ static void sbr_qmf_synthesis(DSPContext *dsp, FFTContext *mdct,
1190 1190
                 X[0][i][   n] = -X[0][i][n];
1191 1191
                 X[0][i][32+n] =  X[1][i][31-n];
1192 1192
             }
1193
-            ff_imdct_half(mdct, mdct_buf[0], X[0][i]);
1193
+            mdct->imdct_half(mdct, mdct_buf[0], X[0][i]);
1194 1194
             for (n = 0; n < 32; n++) {
1195 1195
                 v[     n] =  mdct_buf[0][63 - 2*n];
1196 1196
                 v[63 - n] = -mdct_buf[0][62 - 2*n];
... ...
@@ -1199,8 +1199,8 @@ static void sbr_qmf_synthesis(DSPContext *dsp, FFTContext *mdct,
1199 1199
             for (n = 1; n < 64; n+=2) {
1200 1200
                 X[1][i][n] = -X[1][i][n];
1201 1201
             }
1202
-            ff_imdct_half(mdct, mdct_buf[0], X[0][i]);
1203
-            ff_imdct_half(mdct, mdct_buf[1], X[1][i]);
1202
+            mdct->imdct_half(mdct, mdct_buf[0], X[0][i]);
1203
+            mdct->imdct_half(mdct, mdct_buf[1], X[1][i]);
1204 1204
             for (n = 0; n < 64; n++) {
1205 1205
                 v[      n] = -mdct_buf[0][63 -   n] + mdct_buf[1][  n    ];
1206 1206
                 v[127 - n] =  mdct_buf[0][63 -   n] + mdct_buf[1][  n    ];
... ...
@@ -35,6 +35,7 @@
35 35
 #include "ac3_parser.h"
36 36
 #include "ac3dec.h"
37 37
 #include "ac3dec_data.h"
38
+#include "kbdwin.h"
38 39
 
39 40
 /** Large enough for maximum possible frame size when the specification limit is ignored */
40 41
 #define AC3_FRAME_BUFFER_SIZE 32768
... ...
@@ -621,13 +622,13 @@ static inline void do_imdct(AC3DecodeContext *s, int channels)
621 621
             float *x = s->tmp_output+128;
622 622
             for(i=0; i<128; i++)
623 623
                 x[i] = s->transform_coeffs[ch][2*i];
624
-            ff_imdct_half(&s->imdct_256, s->tmp_output, x);
624
+            s->imdct_256.imdct_half(&s->imdct_256, s->tmp_output, x);
625 625
             s->dsp.vector_fmul_window(s->output[ch-1], s->delay[ch-1], s->tmp_output, s->window, 128);
626 626
             for(i=0; i<128; i++)
627 627
                 x[i] = s->transform_coeffs[ch][2*i+1];
628
-            ff_imdct_half(&s->imdct_256, s->delay[ch-1], x);
628
+            s->imdct_256.imdct_half(&s->imdct_256, s->delay[ch-1], x);
629 629
         } else {
630
-            ff_imdct_half(&s->imdct_512, s->tmp_output, s->transform_coeffs[ch]);
630
+            s->imdct_512.imdct_half(&s->imdct_512, s->tmp_output, s->transform_coeffs[ch]);
631 631
             s->dsp.vector_fmul_window(s->output[ch-1], s->delay[ch-1], s->tmp_output, s->window, 128);
632 632
             memcpy(s->delay[ch-1], s->tmp_output+128, 128*sizeof(float));
633 633
         }
... ...
@@ -28,6 +28,7 @@
28 28
 
29 29
 #define CONFIG_AC3ENC_FLOAT 1
30 30
 #include "ac3enc.c"
31
+#include "kbdwin.h"
31 32
 
32 33
 
33 34
 /**
... ...
@@ -74,7 +75,7 @@ static av_cold int mdct_init(AVCodecContext *avctx, AC3MDCTContext *mdct,
74 74
  */
75 75
 static void mdct512(AC3MDCTContext *mdct, float *out, float *in)
76 76
 {
77
-    ff_mdct_calc(&mdct->fft, out, in);
77
+    mdct->fft.mdct_calc(&mdct->fft, out, in);
78 78
 }
79 79
 
80 80
 
... ...
@@ -19,6 +19,7 @@
19 19
  */
20 20
 
21 21
 #include "libavcodec/fft.h"
22
+#include "libavcodec/rdft.h"
22 23
 #include "libavcodec/synth_filter.h"
23 24
 
24 25
 void ff_fft_permute_neon(FFTContext *s, FFTComplex *z);
... ...
@@ -36,6 +36,7 @@
36 36
 #include "get_bits.h"
37 37
 #include "dsputil.h"
38 38
 #include "fft.h"
39
+#include "sinewin.h"
39 40
 
40 41
 #include "atrac.h"
41 42
 #include "atrac1data.h"
... ...
@@ -99,7 +100,7 @@ static void at1_imdct(AT1Ctx *q, float *spec, float *out, int nbits,
99 99
         for (i = 0; i < transf_size / 2; i++)
100 100
             FFSWAP(float, spec[i], spec[transf_size - 1 - i]);
101 101
     }
102
-    ff_imdct_half(mdct_context, out, spec);
102
+    mdct_context->imdct_half(mdct_context, out, spec);
103 103
 }
104 104
 
105 105
 
... ...
@@ -146,7 +146,7 @@ static void IMLT(ATRAC3Context *q, float *pInput, float *pOutput, int odd_band)
146 146
         /**
147 147
         * Reverse the odd bands before IMDCT, this is an effect of the QMF transform
148 148
         * or it gives better compression to do it this way.
149
-        * FIXME: It should be possible to handle this in ff_imdct_calc
149
+        * FIXME: It should be possible to handle this in imdct_calc
150 150
         * for that to happen a modification of the prerotation step of
151 151
         * all SIMD code and C code is needed.
152 152
         * Or fix the functions before so they generate a pre reversed spectrum.
... ...
@@ -156,7 +156,7 @@ static void IMLT(ATRAC3Context *q, float *pInput, float *pOutput, int odd_band)
156 156
             FFSWAP(float, pInput[i], pInput[255-i]);
157 157
     }
158 158
 
159
-    ff_imdct_calc(&q->mdct_ctx,pOutput,pInput);
159
+    q->mdct_ctx.imdct_calc(&q->mdct_ctx,pOutput,pInput);
160 160
 
161 161
     /* Perform windowing on the output. */
162 162
     dsp.vector_fmul(pOutput, pOutput, mdct_window, 512);
... ...
@@ -19,6 +19,8 @@
19 19
 #include "libavutil/mem.h"
20 20
 #include "avfft.h"
21 21
 #include "fft.h"
22
+#include "rdft.h"
23
+#include "dct.h"
22 24
 
23 25
 /* FFT */
24 26
 
... ...
@@ -101,7 +103,7 @@ RDFTContext *av_rdft_init(int nbits, enum RDFTransformType trans)
101 101
 
102 102
 void av_rdft_calc(RDFTContext *s, FFTSample *data)
103 103
 {
104
-    ff_rdft_calc(s, data);
104
+    s->rdft_calc(s, data);
105 105
 }
106 106
 
107 107
 void av_rdft_end(RDFTContext *s)
... ...
@@ -128,7 +130,7 @@ DCTContext *av_dct_init(int nbits, enum DCTTransformType inverse)
128 128
 
129 129
 void av_dct_calc(DCTContext *s, FFTSample *data)
130 130
 {
131
-    ff_dct_calc(s, data);
131
+    s->dct_calc(s, data);
132 132
 }
133 133
 
134 134
 void av_dct_end(DCTContext *s)
... ...
@@ -32,7 +32,8 @@
32 32
 #define ALT_BITSTREAM_READER_LE
33 33
 #include "get_bits.h"
34 34
 #include "dsputil.h"
35
-#include "fft.h"
35
+#include "dct.h"
36
+#include "rdft.h"
36 37
 #include "fmtconvert.h"
37 38
 #include "libavutil/intfloat_readwrite.h"
38 39
 
... ...
@@ -223,11 +224,11 @@ static void decode_block(BinkAudioContext *s, short *out, int use_dct)
223 223
 
224 224
         if (CONFIG_BINKAUDIO_DCT_DECODER && use_dct) {
225 225
             coeffs[0] /= 0.5;
226
-            ff_dct_calc (&s->trans.dct,  coeffs);
226
+            s->trans.dct.dct_calc(&s->trans.dct,  coeffs);
227 227
             s->dsp.vector_fmul_scalar(coeffs, coeffs, s->frame_len / 2, s->frame_len);
228 228
         }
229 229
         else if (CONFIG_BINKAUDIO_RDFT_DECODER)
230
-            ff_rdft_calc(&s->trans.rdft, coeffs);
230
+            s->trans.rdft.rdft_calc(&s->trans.rdft, coeffs);
231 231
     }
232 232
 
233 233
     s->fmt_conv.float_to_int16_interleave(out, (const float **)s->coeffs_ptr,
... ...
@@ -54,6 +54,7 @@
54 54
 #include "bytestream.h"
55 55
 #include "fft.h"
56 56
 #include "libavutil/audioconvert.h"
57
+#include "sinewin.h"
57 58
 
58 59
 #include "cookdata.h"
59 60
 
... ...
@@ -753,7 +754,7 @@ static void imlt_gain(COOKContext *q, float *inbuffer,
753 753
     int i;
754 754
 
755 755
     /* Inverse modified discrete cosine transform */
756
-    ff_imdct_calc(&q->mdct_ctx, q->mono_mdct_output, inbuffer);
756
+    q->mdct_ctx.imdct_calc(&q->mdct_ctx, q->mono_mdct_output, inbuffer);
757 757
 
758 758
     q->imlt_window (q, buffer1, gains_ptr, previous_buffer);
759 759
 
... ...
@@ -37,7 +37,7 @@ int main(int argc, char *argv[])
37 37
     double (*func)(double) = do_sin ? sin : cos;
38 38
 
39 39
     printf("/* This file was generated by libavcodec/costablegen */\n");
40
-    printf("#include \"libavcodec/fft.h\"\n");
40
+    printf("#include \"libavcodec/%s\"\n", do_sin ? "rdft.h" : "fft.h");
41 41
     for (i = 4; i <= BITS; i++) {
42 42
         int m = 1 << i;
43 43
         double freq = 2*M_PI/m;
... ...
@@ -29,8 +29,7 @@
29 29
 
30 30
 #include <math.h>
31 31
 #include "libavutil/mathematics.h"
32
-#include "fft.h"
33
-#include "x86/fft.h"
32
+#include "dct.h"
34 33
 
35 34
 #define DCT32_FLOAT
36 35
 #include "dct32.c"
... ...
@@ -59,7 +58,7 @@ static void ff_dst_calc_I_c(DCTContext *ctx, FFTSample *data)
59 59
     }
60 60
 
61 61
     data[n/2] *= 2;
62
-    ff_rdft_calc(&ctx->rdft, data);
62
+    ctx->rdft.rdft_calc(&ctx->rdft, data);
63 63
 
64 64
     data[0] *= 0.5f;
65 65
 
... ...
@@ -93,7 +92,7 @@ static void ff_dct_calc_I_c(DCTContext *ctx, FFTSample *data)
93 93
         data[n - i] = tmp1 + s;
94 94
     }
95 95
 
96
-    ff_rdft_calc(&ctx->rdft, data);
96
+    ctx->rdft.rdft_calc(&ctx->rdft, data);
97 97
     data[n] = data[1];
98 98
     data[1] = next;
99 99
 
... ...
@@ -121,7 +120,7 @@ static void ff_dct_calc_III_c(DCTContext *ctx, FFTSample *data)
121 121
 
122 122
     data[1] = 2 * next;
123 123
 
124
-    ff_rdft_calc(&ctx->rdft, data);
124
+    ctx->rdft.rdft_calc(&ctx->rdft, data);
125 125
 
126 126
     for (i = 0; i < n / 2; i++) {
127 127
         float tmp1 = data[i        ] * inv_n;
... ...
@@ -152,7 +151,7 @@ static void ff_dct_calc_II_c(DCTContext *ctx, FFTSample *data)
152 152
         data[n-i-1] = tmp1 - s;
153 153
     }
154 154
 
155
-    ff_rdft_calc(&ctx->rdft, data);
155
+    ctx->rdft.rdft_calc(&ctx->rdft, data);
156 156
 
157 157
     next = data[1] * 0.5;
158 158
     data[1] *= -1;
... ...
@@ -176,11 +175,6 @@ static void dct32_func(DCTContext *ctx, FFTSample *data)
176 176
     ctx->dct32(data, data);
177 177
 }
178 178
 
179
-void ff_dct_calc(DCTContext *s, FFTSample *data)
180
-{
181
-    s->dct_calc(s, data);
182
-}
183
-
184 179
 av_cold int ff_dct_init(DCTContext *s, int nbits, enum DCTTransformType inverse)
185 180
 {
186 181
     int n = 1 << nbits;
187 182
new file mode 100644
... ...
@@ -0,0 +1,50 @@
0
+/*
1
+ * (I)DCT Transforms
2
+ * Copyright (c) 2009 Peter Ross <pross@xvid.org>
3
+ * Copyright (c) 2010 Alex Converse <alex.converse@gmail.com>
4
+ * Copyright (c) 2010 Vitor Sessak
5
+ *
6
+ * This file is part of FFmpeg.
7
+ *
8
+ * FFmpeg is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU Lesser General Public
10
+ * License as published by the Free Software Foundation; either
11
+ * version 2.1 of the License, or (at your option) any later version.
12
+ *
13
+ * FFmpeg is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
+ * Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public
19
+ * License along with FFmpeg; if not, write to the Free Software
20
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
21
+ */
22
+
23
+#ifndef AVCODEC_DCT_H
24
+#define AVCODEC_DCT_H
25
+
26
+#include "rdft.h"
27
+
28
+struct DCTContext {
29
+    int nbits;
30
+    int inverse;
31
+    RDFTContext rdft;
32
+    const float *costab;
33
+    FFTSample *csc2;
34
+    void (*dct_calc)(struct DCTContext *s, FFTSample *data);
35
+    void (*dct32)(FFTSample *out, const FFTSample *in);
36
+};
37
+
38
+/**
39
+ * Set up DCT.
40
+ * @param nbits           size of the input array:
41
+ *                        (1 << nbits)     for DCT-II, DCT-III and DST-I
42
+ *                        (1 << nbits) + 1 for DCT-I
43
+ *
44
+ * @note the first element of the input of DST-I is ignored
45
+ */
46
+int  ff_dct_init(DCTContext *s, int nbits, enum DCTTransformType type);
47
+void ff_dct_end (DCTContext *s);
48
+
49
+#endif
... ...
@@ -27,6 +27,8 @@
27 27
 #include "libavutil/lfg.h"
28 28
 #include "libavutil/log.h"
29 29
 #include "fft.h"
30
+#include "dct.h"
31
+#include "rdft.h"
30 32
 #include <math.h>
31 33
 #include <unistd.h>
32 34
 #include <sys/time.h>
... ...
@@ -327,20 +329,20 @@ int main(int argc, char **argv)
327 327
     case TRANSFORM_MDCT:
328 328
         if (do_inverse) {
329 329
             imdct_ref((float *)tab_ref, (float *)tab1, fft_nbits);
330
-            ff_imdct_calc(m, tab2, (float *)tab1);
330
+            m->imdct_calc(m, tab2, (float *)tab1);
331 331
             err = check_diff((float *)tab_ref, tab2, fft_size, scale);
332 332
         } else {
333 333
             mdct_ref((float *)tab_ref, (float *)tab1, fft_nbits);
334 334
 
335
-            ff_mdct_calc(m, tab2, (float *)tab1);
335
+            m->mdct_calc(m, tab2, (float *)tab1);
336 336
 
337 337
             err = check_diff((float *)tab_ref, tab2, fft_size / 2, scale);
338 338
         }
339 339
         break;
340 340
     case TRANSFORM_FFT:
341 341
         memcpy(tab, tab1, fft_size * sizeof(FFTComplex));
342
-        ff_fft_permute(s, tab);
343
-        ff_fft_calc(s, tab);
342
+        s->fft_permute(s, tab);
343
+        s->fft_calc(s, tab);
344 344
 
345 345
         fft_ref(tab_ref, tab1, fft_nbits);
346 346
         err = check_diff((float *)tab_ref, (float *)tab, fft_size * 2, 1.0);
... ...
@@ -357,7 +359,7 @@ int main(int argc, char **argv)
357 357
             memcpy(tab2, tab1, fft_size * sizeof(FFTSample));
358 358
             tab2[1] = tab1[fft_size_2].re;
359 359
 
360
-            ff_rdft_calc(r, tab2);
360
+            r->rdft_calc(r, tab2);
361 361
             fft_ref(tab_ref, tab1, fft_nbits);
362 362
             for (i = 0; i < fft_size; i++) {
363 363
                 tab[i].re = tab2[i];
... ...
@@ -369,7 +371,7 @@ int main(int argc, char **argv)
369 369
                 tab2[i]    = tab1[i].re;
370 370
                 tab1[i].im = 0;
371 371
             }
372
-            ff_rdft_calc(r, tab2);
372
+            r->rdft_calc(r, tab2);
373 373
             fft_ref(tab_ref, tab1, fft_nbits);
374 374
             tab_ref[0].im = tab_ref[fft_size_2].re;
375 375
             err = check_diff((float *)tab_ref, (float *)tab2, fft_size, 1.0);
... ...
@@ -377,7 +379,7 @@ int main(int argc, char **argv)
377 377
         break;
378 378
     case TRANSFORM_DCT:
379 379
         memcpy(tab, tab1, fft_size * sizeof(FFTComplex));
380
-        ff_dct_calc(d, tab);
380
+        d->dct_calc(d, tab);
381 381
         if (do_inverse) {
382 382
             idct_ref(tab_ref, tab1, fft_nbits);
383 383
         } else {
... ...
@@ -402,22 +404,22 @@ int main(int argc, char **argv)
402 402
                 switch (transform) {
403 403
                 case TRANSFORM_MDCT:
404 404
                     if (do_inverse) {
405
-                        ff_imdct_calc(m, (float *)tab, (float *)tab1);
405
+                        m->imdct_calc(m, (float *)tab, (float *)tab1);
406 406
                     } else {
407
-                        ff_mdct_calc(m, (float *)tab, (float *)tab1);
407
+                        m->mdct_calc(m, (float *)tab, (float *)tab1);
408 408
                     }
409 409
                     break;
410 410
                 case TRANSFORM_FFT:
411 411
                     memcpy(tab, tab1, fft_size * sizeof(FFTComplex));
412
-                    ff_fft_calc(s, tab);
412
+                    s->fft_calc(s, tab);
413 413
                     break;
414 414
                 case TRANSFORM_RDFT:
415 415
                     memcpy(tab2, tab1, fft_size * sizeof(FFTSample));
416
-                    ff_rdft_calc(r, tab2);
416
+                    r->rdft_calc(r, tab2);
417 417
                     break;
418 418
                 case TRANSFORM_DCT:
419 419
                     memcpy(tab2, tab1, fft_size * sizeof(FFTSample));
420
-                    ff_dct_calc(d, tab2);
420
+                    d->dct_calc(d, tab2);
421 421
                     break;
422 422
                 }
423 423
             }
... ...
@@ -39,7 +39,14 @@ struct FFTContext {
39 39
     /* pre/post rotation tables */
40 40
     FFTSample *tcos;
41 41
     FFTSample *tsin;
42
+    /**
43
+     * Do the permutation needed BEFORE calling fft_calc().
44
+     */
42 45
     void (*fft_permute)(struct FFTContext *s, FFTComplex *z);
46
+    /**
47
+     * Do a complex FFT with the parameters defined in ff_fft_init(). The
48
+     * input data must be permuted before. No 1.0/sqrt(n) normalization is done.
49
+     */
43 50
     void (*fft_calc)(struct FFTContext *s, FFTComplex *z);
44 51
     void (*imdct_calc)(struct FFTContext *s, FFTSample *output, const FFTSample *input);
45 52
     void (*imdct_half)(struct FFTContext *s, FFTSample *output, const FFTSample *input);
... ...
@@ -54,20 +61,13 @@ struct FFTContext {
54 54
 
55 55
 #if CONFIG_HARDCODED_TABLES
56 56
 #define COSTABLE_CONST const
57
-#define SINTABLE_CONST const
58
-#define SINETABLE_CONST const
59 57
 #else
60 58
 #define COSTABLE_CONST
61
-#define SINTABLE_CONST
62
-#define SINETABLE_CONST
63 59
 #endif
64 60
 
65 61
 #define COSTABLE(size) \
66 62
     COSTABLE_CONST DECLARE_ALIGNED(16, FFTSample, ff_cos_##size)[size/2]
67
-#define SINTABLE(size) \
68
-    SINTABLE_CONST DECLARE_ALIGNED(16, FFTSample, ff_sin_##size)[size/2]
69
-#define SINETABLE(size) \
70
-    SINETABLE_CONST DECLARE_ALIGNED(16, float, ff_sine_##size)[size]
63
+
71 64
 extern COSTABLE(16);
72 65
 extern COSTABLE(32);
73 66
 extern COSTABLE(64);
... ...
@@ -89,20 +89,6 @@ extern COSTABLE_CONST FFTSample* const ff_cos_tabs[17];
89 89
  */
90 90
 void ff_init_ff_cos_tabs(int index);
91 91
 
92
-extern SINTABLE(16);
93
-extern SINTABLE(32);
94
-extern SINTABLE(64);
95
-extern SINTABLE(128);
96
-extern SINTABLE(256);
97
-extern SINTABLE(512);
98
-extern SINTABLE(1024);
99
-extern SINTABLE(2048);
100
-extern SINTABLE(4096);
101
-extern SINTABLE(8192);
102
-extern SINTABLE(16384);
103
-extern SINTABLE(32768);
104
-extern SINTABLE(65536);
105
-
106 92
 /**
107 93
  * Set up a complex FFT.
108 94
  * @param nbits           log2 of the length of the input array
... ...
@@ -115,131 +101,12 @@ void ff_fft_init_mmx(FFTContext *s);
115 115
 void ff_fft_init_arm(FFTContext *s);
116 116
 void ff_dct_init_mmx(DCTContext *s);
117 117
 
118
-/**
119
- * Do the permutation needed BEFORE calling ff_fft_calc().
120
- */
121
-static inline void ff_fft_permute(FFTContext *s, FFTComplex *z)
122
-{
123
-    s->fft_permute(s, z);
124
-}
125
-/**
126
- * Do a complex FFT with the parameters defined in ff_fft_init(). The
127
- * input data must be permuted before. No 1.0/sqrt(n) normalization is done.
128
- */
129
-static inline void ff_fft_calc(FFTContext *s, FFTComplex *z)
130
-{
131
-    s->fft_calc(s, z);
132
-}
133 118
 void ff_fft_end(FFTContext *s);
134 119
 
135
-/* MDCT computation */
136
-
137
-static inline void ff_imdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input)
138
-{
139
-    s->imdct_calc(s, output, input);
140
-}
141
-static inline void ff_imdct_half(FFTContext *s, FFTSample *output, const FFTSample *input)
142
-{
143
-    s->imdct_half(s, output, input);
144
-}
145
-
146
-static inline void ff_mdct_calc(FFTContext *s, FFTSample *output,
147
-                                const FFTSample *input)
148
-{
149
-    s->mdct_calc(s, output, input);
150
-}
151
-
152
-/**
153
- * Maximum window size for ff_kbd_window_init.
154
- */
155
-#define FF_KBD_WINDOW_MAX 1024
156
-
157
-/**
158
- * Generate a Kaiser-Bessel Derived Window.
159
- * @param   window  pointer to half window
160
- * @param   alpha   determines window shape
161
- * @param   n       size of half window, max FF_KBD_WINDOW_MAX
162
- */
163
-void ff_kbd_window_init(float *window, float alpha, int n);
164
-
165
-/**
166
- * Generate a sine window.
167
- * @param   window  pointer to half window
168
- * @param   n       size of half window
169
- */
170
-void ff_sine_window_init(float *window, int n);
171
-
172
-/**
173
- * initialize the specified entry of ff_sine_windows
174
- */
175
-void ff_init_ff_sine_windows(int index);
176
-extern SINETABLE(  32);
177
-extern SINETABLE(  64);
178
-extern SINETABLE( 128);
179
-extern SINETABLE( 256);
180
-extern SINETABLE( 512);
181
-extern SINETABLE(1024);
182
-extern SINETABLE(2048);
183
-extern SINETABLE(4096);
184
-extern SINETABLE_CONST float * const ff_sine_windows[13];
185
-
186 120
 int ff_mdct_init(FFTContext *s, int nbits, int inverse, double scale);
187 121
 void ff_imdct_calc_c(FFTContext *s, FFTSample *output, const FFTSample *input);
188 122
 void ff_imdct_half_c(FFTContext *s, FFTSample *output, const FFTSample *input);
189 123
 void ff_mdct_calc_c(FFTContext *s, FFTSample *output, const FFTSample *input);
190 124
 void ff_mdct_end(FFTContext *s);
191 125
 
192
-/* Real Discrete Fourier Transform */
193
-
194
-struct RDFTContext {
195
-    int nbits;
196
-    int inverse;
197
-    int sign_convention;
198
-
199
-    /* pre/post rotation tables */
200
-    const FFTSample *tcos;
201
-    SINTABLE_CONST FFTSample *tsin;
202
-    FFTContext fft;
203
-    void (*rdft_calc)(struct RDFTContext *s, FFTSample *z);
204
-};
205
-
206
-/**
207
- * Set up a real FFT.
208
- * @param nbits           log2 of the length of the input array
209
- * @param trans           the type of transform
210
- */
211
-int ff_rdft_init(RDFTContext *s, int nbits, enum RDFTransformType trans);
212
-void ff_rdft_end(RDFTContext *s);
213
-
214
-void ff_rdft_init_arm(RDFTContext *s);
215
-
216
-static av_always_inline void ff_rdft_calc(RDFTContext *s, FFTSample *data)
217
-{
218
-    s->rdft_calc(s, data);
219
-}
220
-
221
-/* Discrete Cosine Transform */
222
-
223
-struct DCTContext {
224
-    int nbits;
225
-    int inverse;
226
-    RDFTContext rdft;
227
-    const float *costab;
228
-    FFTSample *csc2;
229
-    void (*dct_calc)(struct DCTContext *s, FFTSample *data);
230
-    void (*dct32)(FFTSample *out, const FFTSample *in);
231
-};
232
-
233
-/**
234
- * Set up DCT.
235
- * @param nbits           size of the input array:
236
- *                        (1 << nbits)     for DCT-II, DCT-III and DST-I
237
- *                        (1 << nbits) + 1 for DCT-I
238
- *
239
- * @note the first element of the input of DST-I is ignored
240
- */
241
-int  ff_dct_init(DCTContext *s, int nbits, enum DCTTransformType type);
242
-void ff_dct_calc(DCTContext *s, FFTSample *data);
243
-void ff_dct_end (DCTContext *s);
244
-
245 126
 #endif /* AVCODEC_FFT_H */
... ...
@@ -41,6 +41,7 @@
41 41
 #include "dsputil.h"
42 42
 #include "fft.h"
43 43
 #include "libavutil/audioconvert.h"
44
+#include "sinewin.h"
44 45
 
45 46
 #include "imcdata.h"
46 47
 
... ...
@@ -564,8 +565,8 @@ static void imc_imdct256(IMCContext *q) {
564 564
     }
565 565
 
566 566
     /* FFT */
567
-    ff_fft_permute(&q->fft, q->samples);
568
-    ff_fft_calc (&q->fft, q->samples);
567
+    q->fft.fft_permute(&q->fft, q->samples);
568
+    q->fft.fft_calc   (&q->fft, q->samples);
569 569
 
570 570
     /* postrotation, window and reorder */
571 571
     for(i = 0; i < COEFFS/2; i++){
572 572
new file mode 100644
... ...
@@ -0,0 +1,48 @@
0
+/*
1
+ * This file is part of FFmpeg.
2
+ *
3
+ * FFmpeg is free software; you can redistribute it and/or
4
+ * modify it under the terms of the GNU Lesser General Public
5
+ * License as published by the Free Software Foundation; either
6
+ * version 2.1 of the License, or (at your option) any later version.
7
+ *
8
+ * FFmpeg is distributed in the hope that it will be useful,
9
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11
+ * Lesser General Public License for more details.
12
+ *
13
+ * You should have received a copy of the GNU Lesser General Public
14
+ * License along with FFmpeg; if not, write to the Free Software
15
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+ */
17
+
18
+#include <assert.h>
19
+#include <libavutil/mathematics.h>
20
+#include "libavutil/attributes.h"
21
+#include "kbdwin.h"
22
+
23
+#define BESSEL_I0_ITER 50 // default: 50 iterations of Bessel I0 approximation
24
+
25
+av_cold void ff_kbd_window_init(float *window, float alpha, int n)
26
+{
27
+   int i, j;
28
+   double sum = 0.0, bessel, tmp;
29
+   double local_window[FF_KBD_WINDOW_MAX];
30
+   double alpha2 = (alpha * M_PI / n) * (alpha * M_PI / n);
31
+
32
+   assert(n <= FF_KBD_WINDOW_MAX);
33
+
34
+   for (i = 0; i < n; i++) {
35
+       tmp = i * (n - i) * alpha2;
36
+       bessel = 1.0;
37
+       for (j = BESSEL_I0_ITER; j > 0; j--)
38
+           bessel = bessel * tmp / (j * j) + 1;
39
+       sum += bessel;
40
+       local_window[i] = sum;
41
+   }
42
+
43
+   sum++;
44
+   for (i = 0; i < n; i++)
45
+       window[i] = sqrt(local_window[i] / sum);
46
+}
47
+
0 48
new file mode 100644
... ...
@@ -0,0 +1,35 @@
0
+/*
1
+ * This file is part of FFmpeg.
2
+ *
3
+ * FFmpeg is free software; you can redistribute it and/or
4
+ * modify it under the terms of the GNU Lesser General Public
5
+ * License as published by the Free Software Foundation; either
6
+ * version 2.1 of the License, or (at your option) any later version.
7
+ *
8
+ * FFmpeg is distributed in the hope that it will be useful,
9
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11
+ * Lesser General Public License for more details.
12
+ *
13
+ * You should have received a copy of the GNU Lesser General Public
14
+ * License along with FFmpeg; if not, write to the Free Software
15
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+ */
17
+
18
+#ifndef AVCODEC_KBDWIN_H
19
+#define AVCODEC_KBDWIN_H
20
+
21
+/**
22
+ * Maximum window size for ff_kbd_window_init.
23
+ */
24
+#define FF_KBD_WINDOW_MAX 1024
25
+
26
+/**
27
+ * Generate a Kaiser-Bessel Derived Window.
28
+ * @param   window  pointer to half window
29
+ * @param   alpha   determines window shape
30
+ * @param   n       size of half window, max FF_KBD_WINDOW_MAX
31
+ */
32
+void ff_kbd_window_init(float *window, float alpha, int n);
33
+
34
+#endif
... ...
@@ -30,33 +30,6 @@
30 30
  * MDCT/IMDCT transforms.
31 31
  */
32 32
 
33
-// Generate a Kaiser-Bessel Derived Window.
34
-#define BESSEL_I0_ITER 50 // default: 50 iterations of Bessel I0 approximation
35
-av_cold void ff_kbd_window_init(float *window, float alpha, int n)
36
-{
37
-   int i, j;
38
-   double sum = 0.0, bessel, tmp;
39
-   double local_window[FF_KBD_WINDOW_MAX];
40
-   double alpha2 = (alpha * M_PI / n) * (alpha * M_PI / n);
41
-
42
-   assert(n <= FF_KBD_WINDOW_MAX);
43
-
44
-   for (i = 0; i < n; i++) {
45
-       tmp = i * (n - i) * alpha2;
46
-       bessel = 1.0;
47
-       for (j = BESSEL_I0_ITER; j > 0; j--)
48
-           bessel = bessel * tmp / (j * j) + 1;
49
-       sum += bessel;
50
-       local_window[i] = sum;
51
-   }
52
-
53
-   sum++;
54
-   for (i = 0; i < n; i++)
55
-       window[i] = sqrt(local_window[i] / sum);
56
-}
57
-
58
-#include "mdct_tablegen.h"
59
-
60 33
 /**
61 34
  * init MDCT or IMDCT computation.
62 35
  */
... ...
@@ -146,7 +119,7 @@ void ff_imdct_half_c(FFTContext *s, FFTSample *output, const FFTSample *input)
146 146
         in1 += 2;
147 147
         in2 -= 2;
148 148
     }
149
-    ff_fft_calc(s, z);
149
+    s->fft_calc(s, z);
150 150
 
151 151
     /* post rotation + reordering */
152 152
     for(k = 0; k < n8; k++) {
... ...
@@ -213,7 +186,7 @@ void ff_mdct_calc_c(FFTContext *s, FFTSample *out, const FFTSample *input)
213 213
         CMUL(x[j].re, x[j].im, re, im, -tcos[n8 + i], tsin[n8 + i]);
214 214
     }
215 215
 
216
-    ff_fft_calc(s, x);
216
+    s->fft_calc(s, x);
217 217
 
218 218
     /* post rotation */
219 219
     for(i=0;i<n8;i++) {
220 220
deleted file mode 100644
... ...
@@ -1,49 +0,0 @@
1
-/*
2
- * Generate a header file for hardcoded MDCT tables
3
- *
4
- * Copyright (c) 2009 Reimar Döffinger <Reimar.Doeffinger@gmx.de>
5
- *
6
- * This file is part of FFmpeg.
7
- *
8
- * FFmpeg is free software; you can redistribute it and/or
9
- * modify it under the terms of the GNU Lesser General Public
10
- * License as published by the Free Software Foundation; either
11
- * version 2.1 of the License, or (at your option) any later version.
12
- *
13
- * FFmpeg is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
- * Lesser General Public License for more details.
17
- *
18
- * You should have received a copy of the GNU Lesser General Public
19
- * License along with FFmpeg; if not, write to the Free Software
20
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21
- */
22
-
23
-#include <stdlib.h>
24
-#define CONFIG_HARDCODED_TABLES 0
25
-#define SINETABLE_CONST
26
-#define SINETABLE(size) \
27
-    float ff_sine_##size[size]
28
-#define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0]))
29
-#ifndef M_PI
30
-#define M_PI 3.14159265358979323846
31
-#endif
32
-#include "mdct_tablegen.h"
33
-#include "tableprint.h"
34
-
35
-int main(void)
36
-{
37
-    int i;
38
-
39
-    write_fileheader();
40
-
41
-    for (i = 5; i <= 12; i++) {
42
-        ff_init_ff_sine_windows(i);
43
-        printf("SINETABLE(%4i) = {\n", 1 << i);
44
-        write_float_array(ff_sine_windows[i], 1 << i);
45
-        printf("};\n");
46
-    }
47
-
48
-    return 0;
49
-}
50 1
deleted file mode 100644
... ...
@@ -1,60 +0,0 @@
1
-/*
2
- * Header file for hardcoded MDCT tables
3
- *
4
- * Copyright (c) 2009 Reimar Döffinger <Reimar.Doeffinger@gmx.de>
5
- *
6
- * This file is part of FFmpeg.
7
- *
8
- * FFmpeg is free software; you can redistribute it and/or
9
- * modify it under the terms of the GNU Lesser General Public
10
- * License as published by the Free Software Foundation; either
11
- * version 2.1 of the License, or (at your option) any later version.
12
- *
13
- * FFmpeg is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
- * Lesser General Public License for more details.
17
- *
18
- * You should have received a copy of the GNU Lesser General Public
19
- * License along with FFmpeg; if not, write to the Free Software
20
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21
- */
22
-
23
-#include <assert.h>
24
-// do not use libavutil/libm.h since this is compiled both
25
-// for the host and the target and config.h is only valid for the target
26
-#include <math.h>
27
-#include "libavutil/attributes.h"
28
-
29
-#if !CONFIG_HARDCODED_TABLES
30
-SINETABLE(  32);
31
-SINETABLE(  64);
32
-SINETABLE( 128);
33
-SINETABLE( 256);
34
-SINETABLE( 512);
35
-SINETABLE(1024);
36
-SINETABLE(2048);
37
-SINETABLE(4096);
38
-#else
39
-#include "libavcodec/mdct_tables.h"
40
-#endif
41
-
42
-SINETABLE_CONST float * const ff_sine_windows[] = {
43
-    NULL, NULL, NULL, NULL, NULL, // unused
44
-    ff_sine_32 , ff_sine_64 ,
45
-    ff_sine_128, ff_sine_256, ff_sine_512, ff_sine_1024, ff_sine_2048, ff_sine_4096
46
-};
47
-
48
-// Generate a sine window.
49
-av_cold void ff_sine_window_init(float *window, int n) {
50
-    int i;
51
-    for(i = 0; i < n; i++)
52
-        window[i] = sinf((i + 0.5) * (M_PI / (2.0 * n)));
53
-}
54
-
55
-av_cold void ff_init_ff_sine_windows(int index) {
56
-    assert(index >= 0 && index < FF_ARRAY_ELEMS(ff_sine_windows));
57
-#if !CONFIG_HARDCODED_TABLES
58
-    ff_sine_window_init(ff_sine_windows[index], 1 << index);
59
-#endif
60
-}
... ...
@@ -33,7 +33,7 @@
33 33
 #include "avcodec.h"
34 34
 #include "get_bits.h"
35 35
 #include "dsputil.h"
36
-#include "fft.h"
36
+#include "dct.h"
37 37
 
38 38
 #define CONFIG_AUDIO_NONSHORT 0
39 39
 
... ...
@@ -39,6 +39,7 @@
39 39
 #include "dsputil.h"
40 40
 #include "fft.h"
41 41
 #include "fmtconvert.h"
42
+#include "sinewin.h"
42 43
 
43 44
 #define ALT_BITSTREAM_READER_LE
44 45
 #include "get_bits.h"
... ...
@@ -121,7 +122,7 @@ static void nelly_decode_block(NellyMoserDecodeContext *s,
121 121
         memset(&aptr[NELLY_FILL_LEN], 0,
122 122
                (NELLY_BUF_LEN - NELLY_FILL_LEN) * sizeof(float));
123 123
 
124
-        ff_imdct_calc(&s->imdct_ctx, s->imdct_out, aptr);
124
+        s->imdct_ctx.imdct_calc(&s->imdct_ctx, s->imdct_out, aptr);
125 125
         /* XXX: overlapping and windowing should be part of a more
126 126
            generic imdct function */
127 127
         overlap_and_window(s, s->state, aptr, s->imdct_out);
... ...
@@ -39,6 +39,7 @@
39 39
 #include "avcodec.h"
40 40
 #include "dsputil.h"
41 41
 #include "fft.h"
42
+#include "sinewin.h"
42 43
 
43 44
 #define BITSTREAM_WRITER_LE
44 45
 #include "put_bits.h"
... ...
@@ -116,13 +117,13 @@ static void apply_mdct(NellyMoserEncodeContext *s)
116 116
     s->dsp.vector_fmul(s->in_buff, s->buf[s->bufsel], ff_sine_128, NELLY_BUF_LEN);
117 117
     s->dsp.vector_fmul_reverse(s->in_buff + NELLY_BUF_LEN, s->buf[s->bufsel] + NELLY_BUF_LEN, ff_sine_128,
118 118
                                NELLY_BUF_LEN);
119
-    ff_mdct_calc(&s->mdct_ctx, s->mdct_out, s->in_buff);
119
+    s->mdct_ctx.mdct_calc(&s->mdct_ctx, s->mdct_out, s->in_buff);
120 120
 
121 121
     s->dsp.vector_fmul(s->buf[s->bufsel] + NELLY_BUF_LEN, s->buf[s->bufsel] + NELLY_BUF_LEN,
122 122
                        ff_sine_128, NELLY_BUF_LEN);
123 123
     s->dsp.vector_fmul_reverse(s->buf[s->bufsel] + 2 * NELLY_BUF_LEN, s->buf[1 - s->bufsel], ff_sine_128,
124 124
                                NELLY_BUF_LEN);
125
-    ff_mdct_calc(&s->mdct_ctx, s->mdct_out + NELLY_BUF_LEN, s->buf[s->bufsel] + NELLY_BUF_LEN);
125
+    s->mdct_ctx.mdct_calc(&s->mdct_ctx, s->mdct_out + NELLY_BUF_LEN, s->buf[s->bufsel] + NELLY_BUF_LEN);
126 126
 }
127 127
 
128 128
 static av_cold int encode_init(AVCodecContext *avctx)
... ...
@@ -1588,7 +1588,7 @@ static void qdm2_calculate_fft (QDM2Context *q, int channel, int sub_packet)
1588 1588
     int i;
1589 1589
     q->fft.complex[channel][0].re *= 2.0f;
1590 1590
     q->fft.complex[channel][0].im = 0.0f;
1591
-    ff_rdft_calc(&q->rdft_ctx, (FFTSample *)q->fft.complex[channel]);
1591
+    q->rdft_ctx.rdft_calc(&q->rdft_ctx, (FFTSample *)q->fft.complex[channel]);
1592 1592
     /* add samples to output buffer */
1593 1593
     for (i = 0; i < ((q->fft_frame_size + 15) & ~15); i++)
1594 1594
         q->output_buffer[q->channels * i + channel] += ((float *) q->fft.complex[channel])[i] * gain;
... ...
@@ -21,7 +21,7 @@
21 21
 #include <stdlib.h>
22 22
 #include <math.h>
23 23
 #include "libavutil/mathematics.h"
24
-#include "fft.h"
24
+#include "rdft.h"
25 25
 
26 26
 /**
27 27
  * @file
... ...
@@ -65,8 +65,8 @@ static void ff_rdft_calc_c(RDFTContext* s, FFTSample* data)
65 65
     const FFTSample *tsin = s->tsin;
66 66
 
67 67
     if (!s->inverse) {
68
-        ff_fft_permute(&s->fft, (FFTComplex*)data);
69
-        ff_fft_calc(&s->fft, (FFTComplex*)data);
68
+        s->fft.fft_permute(&s->fft, (FFTComplex*)data);
69
+        s->fft.fft_calc(&s->fft, (FFTComplex*)data);
70 70
     }
71 71
     /* i=0 is a special case because of packing, the DC term is real, so we
72 72
        are going to throw the N/2 term (also real) in with it. */
... ...
@@ -91,8 +91,8 @@ static void ff_rdft_calc_c(RDFTContext* s, FFTSample* data)
91 91
     if (s->inverse) {
92 92
         data[0] *= k1;
93 93
         data[1] *= k1;
94
-        ff_fft_permute(&s->fft, (FFTComplex*)data);
95
-        ff_fft_calc(&s->fft, (FFTComplex*)data);
94
+        s->fft.fft_permute(&s->fft, (FFTComplex*)data);
95
+        s->fft.fft_calc(&s->fft, (FFTComplex*)data);
96 96
     }
97 97
 }
98 98
 
99 99
new file mode 100644
... ...
@@ -0,0 +1,74 @@
0
+/*
1
+ * (I)RDFT transforms
2
+ * Copyright (c) 2009 Alex Converse <alex dot converse at gmail dot com>
3
+ *
4
+ * This file is part of FFmpeg.
5
+ *
6
+ * FFmpeg is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * FFmpeg is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with FFmpeg; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
+ */
20
+
21
+#ifndef AVCODEC_RDFT_H
22
+#define AVCODEC_RDFT_H
23
+
24
+#include "config.h"
25
+#include "fft.h"
26
+
27
+#if CONFIG_HARDCODED_TABLES
28
+#   define SINTABLE_CONST const
29
+#else
30
+#   define SINTABLE_CONST
31
+#endif
32
+
33
+#define SINTABLE(size) \
34
+    SINTABLE_CONST DECLARE_ALIGNED(16, FFTSample, ff_sin_##size)[size/2]
35
+
36
+extern SINTABLE(16);
37
+extern SINTABLE(32);
38
+extern SINTABLE(64);
39
+extern SINTABLE(128);
40
+extern SINTABLE(256);
41
+extern SINTABLE(512);
42
+extern SINTABLE(1024);
43
+extern SINTABLE(2048);
44
+extern SINTABLE(4096);
45
+extern SINTABLE(8192);
46
+extern SINTABLE(16384);
47
+extern SINTABLE(32768);
48
+extern SINTABLE(65536);
49
+
50
+struct RDFTContext {
51
+    int nbits;
52
+    int inverse;
53
+    int sign_convention;
54
+
55
+    /* pre/post rotation tables */
56
+    const FFTSample *tcos;
57
+    SINTABLE_CONST FFTSample *tsin;
58
+    FFTContext fft;
59
+    void (*rdft_calc)(struct RDFTContext *s, FFTSample *z);
60
+};
61
+
62
+/**
63
+ * Set up a real FFT.
64
+ * @param nbits           log2 of the length of the input array
65
+ * @param trans           the type of transform
66
+ */
67
+int ff_rdft_init(RDFTContext *s, int nbits, enum RDFTransformType trans);
68
+void ff_rdft_end(RDFTContext *s);
69
+
70
+void ff_rdft_init_arm(RDFTContext *s);
71
+
72
+
73
+#endif
0 74
new file mode 100644
... ...
@@ -0,0 +1,20 @@
0
+/*
1
+ * This file is part of FFmpeg.
2
+ *
3
+ * FFmpeg is free software; you can redistribute it and/or
4
+ * modify it under the terms of the GNU Lesser General Public
5
+ * License as published by the Free Software Foundation; either
6
+ * version 2.1 of the License, or (at your option) any later version.
7
+ *
8
+ * FFmpeg is distributed in the hope that it will be useful,
9
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11
+ * Lesser General Public License for more details.
12
+ *
13
+ * You should have received a copy of the GNU Lesser General Public
14
+ * License along with FFmpeg; if not, write to the Free Software
15
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+ */
17
+
18
+#include "sinewin.h"
19
+#include "sinewin_tablegen.h"
0 20
new file mode 100644
... ...
@@ -0,0 +1,59 @@
0
+/*
1
+ * Copyright (c) 2008 Robert Swain
2
+ *
3
+ * This file is part of FFmpeg.
4
+ *
5
+ * FFmpeg is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU Lesser General Public
7
+ * License as published by the Free Software Foundation; either
8
+ * version 2.1 of the License, or (at your option) any later version.
9
+ *
10
+ * FFmpeg is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
+ * Lesser General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Lesser General Public
16
+ * License along with FFmpeg; if not, write to the Free Software
17
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
+ */
19
+
20
+#ifndef AVCODEC_SINEWIN_H
21
+#define AVCODEC_SINEWIN_H
22
+
23
+#include "config.h"
24
+#include "libavutil/mem.h"
25
+
26
+#if CONFIG_HARDCODED_TABLES
27
+#   define SINETABLE_CONST const
28
+#else
29
+#   define SINETABLE_CONST
30
+#endif
31
+
32
+#define SINETABLE(size) \
33
+    SINETABLE_CONST DECLARE_ALIGNED(16, float, ff_sine_##size)[size]
34
+
35
+/**
36
+ * Generate a sine window.
37
+ * @param   window  pointer to half window
38
+ * @param   n       size of half window
39
+ */
40
+void ff_sine_window_init(float *window, int n);
41
+
42
+/**
43
+ * initialize the specified entry of ff_sine_windows
44
+ */
45
+void ff_init_ff_sine_windows(int index);
46
+
47
+extern SINETABLE(  32);
48
+extern SINETABLE(  64);
49
+extern SINETABLE( 128);
50
+extern SINETABLE( 256);
51
+extern SINETABLE( 512);
52
+extern SINETABLE(1024);
53
+extern SINETABLE(2048);
54
+extern SINETABLE(4096);
55
+
56
+extern SINETABLE_CONST float * const ff_sine_windows[13];
57
+
58
+#endif
0 59
new file mode 100644
... ...
@@ -0,0 +1,49 @@
0
+/*
1
+ * Generate a header file for hardcoded sine windows
2
+ *
3
+ * Copyright (c) 2009 Reimar Döffinger <Reimar.Doeffinger@gmx.de>
4
+ *
5
+ * This file is part of FFmpeg.
6
+ *
7
+ * FFmpeg is free software; you can redistribute it and/or
8
+ * modify it under the terms of the GNU Lesser General Public
9
+ * License as published by the Free Software Foundation; either
10
+ * version 2.1 of the License, or (at your option) any later version.
11
+ *
12
+ * FFmpeg is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
+ * Lesser General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public
18
+ * License along with FFmpeg; if not, write to the Free Software
19
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
+ */
21
+
22
+#include <stdlib.h>
23
+#define CONFIG_HARDCODED_TABLES 0
24
+#define SINETABLE_CONST
25
+#define SINETABLE(size) \
26
+    float ff_sine_##size[size]
27
+#define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0]))
28
+#ifndef M_PI
29
+#define M_PI 3.14159265358979323846
30
+#endif
31
+#include "sinewin_tablegen.h"
32
+#include "tableprint.h"
33
+
34
+int main(void)
35
+{
36
+    int i;
37
+
38
+    write_fileheader();
39
+
40
+    for (i = 5; i <= 12; i++) {
41
+        ff_init_ff_sine_windows(i);
42
+        printf("SINETABLE(%4i) = {\n", 1 << i);
43
+        write_float_array(ff_sine_windows[i], 1 << i);
44
+        printf("};\n");
45
+    }
46
+
47
+    return 0;
48
+}
0 49
new file mode 100644
... ...
@@ -0,0 +1,60 @@
0
+/*
1
+ * Header file for hardcoded sine windows
2
+ *
3
+ * Copyright (c) 2009 Reimar Döffinger <Reimar.Doeffinger@gmx.de>
4
+ *
5
+ * This file is part of FFmpeg.
6
+ *
7
+ * FFmpeg is free software; you can redistribute it and/or
8
+ * modify it under the terms of the GNU Lesser General Public
9
+ * License as published by the Free Software Foundation; either
10
+ * version 2.1 of the License, or (at your option) any later version.
11
+ *
12
+ * FFmpeg is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
+ * Lesser General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public
18
+ * License along with FFmpeg; if not, write to the Free Software
19
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
+ */
21
+
22
+#include <assert.h>
23
+// do not use libavutil/libm.h since this is compiled both
24
+// for the host and the target and config.h is only valid for the target
25
+#include <math.h>
26
+#include "libavutil/attributes.h"
27
+
28
+#if !CONFIG_HARDCODED_TABLES
29
+SINETABLE(  32);
30
+SINETABLE(  64);
31
+SINETABLE( 128);
32
+SINETABLE( 256);
33
+SINETABLE( 512);
34
+SINETABLE(1024);
35
+SINETABLE(2048);
36
+SINETABLE(4096);
37
+#else
38
+#include "libavcodec/sinewin_tables.h"
39
+#endif
40
+
41
+SINETABLE_CONST float * const ff_sine_windows[] = {
42
+    NULL, NULL, NULL, NULL, NULL, // unused
43
+    ff_sine_32 , ff_sine_64 ,
44
+    ff_sine_128, ff_sine_256, ff_sine_512, ff_sine_1024, ff_sine_2048, ff_sine_4096
45
+};
46
+
47
+// Generate a sine window.
48
+av_cold void ff_sine_window_init(float *window, int n) {
49
+    int i;
50
+    for(i = 0; i < n; i++)
51
+        window[i] = sinf((i + 0.5) * (M_PI / (2.0 * n)));
52
+}
53
+
54
+av_cold void ff_init_ff_sine_windows(int index) {
55
+    assert(index >= 0 && index < FF_ARRAY_ELEMS(ff_sine_windows));
56
+#if !CONFIG_HARDCODED_TABLES
57
+    ff_sine_window_init(ff_sine_windows[index], 1 << index);
58
+#endif
59
+}
... ...
@@ -29,7 +29,7 @@ static void synth_filter_float(FFTContext *imdct,
29 29
     float *synth_buf= synth_buf_ptr + *synth_buf_offset;
30 30
     int i, j;
31 31
 
32
-    ff_imdct_half(imdct, synth_buf, in);
32
+    imdct->imdct_half(imdct, synth_buf, in);
33 33
 
34 34
     for (i = 0; i < 16; i++){
35 35
         float a= synth_buf2[i     ];
... ...
@@ -24,6 +24,7 @@
24 24
 #include "dsputil.h"
25 25
 #include "fft.h"
26 26
 #include "lsp.h"
27
+#include "sinewin.h"
27 28
 
28 29
 #include <math.h>
29 30
 #include <stdint.h>
... ...
@@ -608,6 +609,7 @@ static void dec_lpc_spectrum_inv(TwinContext *tctx, float *lsp,
608 608
 static void imdct_and_window(TwinContext *tctx, enum FrameType ftype, int wtype,
609 609
                             float *in, float *prev, int ch)
610 610
 {
611
+    FFTContext *mdct = &tctx->mdct_ctx[ftype];
611 612
     const ModeTab *mtab = tctx->mtab;
612 613
     int bsize = mtab->size / mtab->fmode[ftype].sub;
613 614
     int size  = mtab->size;
... ...
@@ -640,7 +642,7 @@ static void imdct_and_window(TwinContext *tctx, enum FrameType ftype, int wtype,
640 640
 
641 641
         wsize = types_sizes[wtype_to_wsize[sub_wtype]];
642 642
 
643
-        ff_imdct_half(&tctx->mdct_ctx[ftype], buf1 + bsize*j, in + bsize*j);
643
+        mdct->imdct_half(mdct, buf1 + bsize*j, in + bsize*j);
644 644
 
645 645
         tctx->dsp.vector_fmul_window(out2,
646 646
                                      prev_buf + (bsize-wsize)/2,
... ...
@@ -1448,7 +1448,7 @@ void vorbis_inverse_coupling(float *mag, float *ang, int blocksize)
1448 1448
 static int vorbis_parse_audio_packet(vorbis_context *vc)
1449 1449
 {
1450 1450
     GetBitContext *gb = &vc->gb;
1451
-
1451
+    FFTContext *mdct;
1452 1452
     uint_fast8_t previous_window = vc->previous_window;
1453 1453
     uint_fast8_t mode_number;
1454 1454
     uint_fast8_t blockflag;
... ...
@@ -1552,11 +1552,13 @@ static int vorbis_parse_audio_packet(vorbis_context *vc)
1552 1552
 
1553 1553
 // Dotproduct, MDCT
1554 1554
 
1555
+    mdct = &vc->mdct[blockflag];
1556
+
1555 1557
     for (j = vc->audio_channels-1;j >= 0; j--) {
1556 1558
         ch_floor_ptr = vc->channel_floors   + j           * blocksize / 2;
1557 1559
         ch_res_ptr   = vc->channel_residues + res_chan[j] * blocksize / 2;
1558 1560
         vc->dsp.vector_fmul(ch_floor_ptr, ch_floor_ptr, ch_res_ptr, blocksize / 2);
1559
-        ff_imdct_half(&vc->mdct[blockflag], ch_res_ptr, ch_floor_ptr);
1561
+        mdct->imdct_half(mdct, ch_res_ptr, ch_floor_ptr);
1560 1562
     }
1561 1563
 
1562 1564
 // Overlap/add, save data for next overlapping  FPMATH
... ...
@@ -935,7 +935,7 @@ static int apply_window_and_mdct(vorbis_enc_context *venc, const signed short *a
935 935
     }
936 936
 
937 937
     for (channel = 0; channel < venc->channels; channel++)
938
-        ff_mdct_calc(&venc->mdct[0], venc->coeffs + channel * window_len,
938
+        venc->mdct[0].mdct_calc(&venc->mdct[0], venc->coeffs + channel * window_len,
939 939
                      venc->samples + channel * window_len * 2);
940 940
 
941 941
     if (samples) {
... ...
@@ -20,6 +20,7 @@
20 20
  */
21 21
 
22 22
 #include "avcodec.h"
23
+#include "sinewin.h"
23 24
 #include "wma.h"
24 25
 #include "wmadata.h"
25 26
 
... ...
@@ -447,6 +447,7 @@ static int wma_decode_block(WMACodecContext *s)
447 447
     int coef_nb_bits, total_gain;
448 448
     int nb_coefs[MAX_CHANNELS];
449 449
     float mdct_norm;
450
+    FFTContext *mdct;
450 451
 
451 452
 #ifdef TRACE
452 453
     tprintf(s->avctx, "***decode_block: %d:%d\n", s->frame_count - 1, s->block_num);
... ...
@@ -742,12 +743,14 @@ static int wma_decode_block(WMACodecContext *s)
742 742
     }
743 743
 
744 744
 next:
745
+    mdct = &s->mdct_ctx[bsize];
746
+
745 747
     for(ch = 0; ch < s->nb_channels; ch++) {
746 748
         int n4, index;
747 749
 
748 750
         n4 = s->block_len / 2;
749 751
         if(s->channel_coded[ch]){
750
-            ff_imdct_calc(&s->mdct_ctx[bsize], s->output, s->coefs[ch]);
752
+            mdct->imdct_calc(mdct, s->output, s->coefs[ch]);
751 753
         }else if(!(s->ms_stereo && ch==1))
752 754
             memset(s->output, 0, sizeof(s->output));
753 755
 
... ...
@@ -77,6 +77,7 @@ static int encode_init(AVCodecContext * avctx){
77 77
 static void apply_window_and_mdct(AVCodecContext * avctx, const signed short * audio, int len) {
78 78
     WMACodecContext *s = avctx->priv_data;
79 79
     int window_index= s->frame_len_bits - s->block_len_bits;
80
+    FFTContext *mdct = &s->mdct_ctx[window_index];
80 81
     int i, j, channel;
81 82
     const float * win = s->windows[window_index];
82 83
     int window_len = 1 << s->block_len_bits;
... ...
@@ -89,7 +90,7 @@ static void apply_window_and_mdct(AVCodecContext * avctx, const signed short * a
89 89
             s->output[i+window_len]  = audio[j] / n * win[window_len - i - 1];
90 90
             s->frame_out[channel][i] = audio[j] / n * win[i];
91 91
         }
92
-        ff_mdct_calc(&s->mdct_ctx[window_index], s->coefs[channel], s->output);
92
+        mdct->mdct_calc(mdct, s->coefs[channel], s->output);
93 93
     }
94 94
 }
95 95
 
... ...
@@ -92,6 +92,7 @@
92 92
 #include "put_bits.h"
93 93
 #include "wmaprodata.h"
94 94
 #include "dsputil.h"
95
+#include "sinewin.h"
95 96
 #include "wma.h"
96 97
 
97 98
 /** current decoder limitations */
... ...
@@ -1222,6 +1223,7 @@ static int decode_subframe(WMAProDecodeCtx *s)
1222 1222
             get_bits_count(&s->gb) - s->subframe_offset);
1223 1223
 
1224 1224
     if (transmit_coeffs) {
1225
+        FFTContext *mdct = &s->mdct_ctx[av_log2(subframe_len) - WMAPRO_BLOCK_MIN_BITS];
1225 1226
         /** reconstruct the per channel data */
1226 1227
         inverse_channel_transform(s);
1227 1228
         for (i = 0; i < s->channels_for_cur_subframe; i++) {
... ...
@@ -1246,9 +1248,8 @@ static int decode_subframe(WMAProDecodeCtx *s)
1246 1246
                                           quant, end - start);
1247 1247
             }
1248 1248
 
1249
-            /** apply imdct (ff_imdct_half == DCTIV with reverse) */
1250
-            ff_imdct_half(&s->mdct_ctx[av_log2(subframe_len) - WMAPRO_BLOCK_MIN_BITS],
1251
-                          s->channel[c].coeffs, s->tmp);
1249
+            /** apply imdct (imdct_half == DCTIV with reverse) */
1250
+            mdct->imdct_half(mdct, s->channel[c].coeffs, s->tmp);
1252 1251
         }
1253 1252
     }
1254 1253
 
... ...
@@ -36,8 +36,9 @@
36 36
 #include "acelp_filters.h"
37 37
 #include "lsp.h"
38 38
 #include "libavutil/lzo.h"
39
-#include "avfft.h"
40
-#include "fft.h"
39
+#include "dct.h"
40
+#include "rdft.h"
41
+#include "sinewin.h"
41 42
 
42 43
 #define MAX_BLOCKS           8   ///< maximum number of blocks per frame
43 44
 #define MAX_LSPS             16  ///< maximum filter order
... ...
@@ -558,7 +559,7 @@ static void calc_input_response(WMAVoiceContext *s, float *lpcs,
558 558
     int n, idx;
559 559
 
560 560
     /* Create frequency power spectrum of speech input (i.e. RDFT of LPCs) */
561
-    ff_rdft_calc(&s->rdft, lpcs);
561
+    s->rdft.rdft_calc(&s->rdft, lpcs);
562 562
 #define log_range(var, assign) do { \
563 563
         float tmp = log10f(assign);  var = tmp; \
564 564
         max       = FFMAX(max, tmp); min = FFMIN(min, tmp); \
... ...
@@ -601,8 +602,8 @@ static void calc_input_response(WMAVoiceContext *s, float *lpcs,
601 601
      * is a sinus input) by doing a phase shift (in theory, H(sin())=cos()).
602 602
      * Hilbert_Transform(RDFT(x)) = Laplace_Transform(x), which calculates the
603 603
      * "moment" of the LPCs in this filter. */
604
-    ff_dct_calc(&s->dct, lpcs);
605
-    ff_dct_calc(&s->dst, lpcs);
604
+    s->dct.dct_calc(&s->dct, lpcs);
605
+    s->dst.dct_calc(&s->dst, lpcs);
606 606
 
607 607
     /* Split out the coefficient indexes into phase/magnitude pairs */
608 608
     idx = 255 + av_clip(lpcs[64],               -255, 255);
... ...
@@ -623,7 +624,7 @@ static void calc_input_response(WMAVoiceContext *s, float *lpcs,
623 623
     coeffs[1] = last_coeff;
624 624
 
625 625
     /* move into real domain */
626
-    ff_rdft_calc(&s->irdft, coeffs);
626
+    s->irdft.rdft_calc(&s->irdft, coeffs);
627 627
 
628 628
     /* tilt correction and normalize scale */
629 629
     memset(&coeffs[remainder], 0, sizeof(coeffs[0]) * (128 - remainder));
... ...
@@ -693,8 +694,8 @@ static void wiener_denoise(WMAVoiceContext *s, int fcb_type,
693 693
         /* apply coefficients (in frequency spectrum domain), i.e. complex
694 694
          * number multiplication */
695 695
         memset(&synth_pf[size], 0, sizeof(synth_pf[0]) * (128 - size));
696
-        ff_rdft_calc(&s->rdft, synth_pf);
697
-        ff_rdft_calc(&s->rdft, coeffs);
696
+        s->rdft.rdft_calc(&s->rdft, synth_pf);
697
+        s->rdft.rdft_calc(&s->rdft, coeffs);
698 698
         synth_pf[0] *= coeffs[0];
699 699
         synth_pf[1] *= coeffs[1];
700 700
         for (n = 1; n < 64; n++) {
... ...
@@ -702,7 +703,7 @@ static void wiener_denoise(WMAVoiceContext *s, int fcb_type,
702 702
             synth_pf[n * 2]     = v1 * coeffs[n * 2] - v2 * coeffs[n * 2 + 1];
703 703
             synth_pf[n * 2 + 1] = v2 * coeffs[n * 2] + v1 * coeffs[n * 2 + 1];
704 704
         }
705
-        ff_rdft_calc(&s->irdft, synth_pf);
705
+        s->irdft.rdft_calc(&s->irdft, synth_pf);
706 706
     }
707 707
 
708 708
     /* merge filter output with the history of previous runs */
... ...
@@ -18,6 +18,7 @@
18 18
 
19 19
 #include "libavutil/cpu.h"
20 20
 #include "libavcodec/dsputil.h"
21
+#include "libavcodec/dct.h"
21 22
 #include "fft.h"
22 23
 
23 24
 av_cold void ff_fft_init_mmx(FFTContext *s)