These windows do not really belong in fft/mdct files and were
easily confused with the similarly named tables used by rdft.
Signed-off-by: Mans Rullgard <mans@mansr.com>
| ... | ... |
@@ -957,6 +957,7 @@ CONFIG_LIST=" |
| 957 | 957 |
rtpdec |
| 958 | 958 |
runtime_cpudetect |
| 959 | 959 |
shared |
| 960 |
+ sinewin |
|
| 960 | 961 |
small |
| 961 | 962 |
sram |
| 962 | 963 |
static |
| ... | ... |
@@ -1234,8 +1235,8 @@ mdct_select="fft" |
| 1234 | 1234 |
rdft_select="fft" |
| 1235 | 1235 |
|
| 1236 | 1236 |
# decoders / encoders / hardware accelerators |
| 1237 |
-aac_decoder_select="mdct rdft" |
|
| 1238 |
-aac_encoder_select="mdct" |
|
| 1237 |
+aac_decoder_select="mdct rdft sinewin" |
|
| 1238 |
+aac_encoder_select="mdct sinewin" |
|
| 1239 | 1239 |
aac_latm_decoder_select="aac_decoder aac_latm_parser" |
| 1240 | 1240 |
ac3_decoder_select="mdct ac3_parser" |
| 1241 | 1241 |
ac3_encoder_select="mdct ac3dsp" |
| ... | ... |
@@ -1243,12 +1244,12 @@ ac3_fixed_encoder_select="ac3dsp" |
| 1243 | 1243 |
alac_encoder_select="lpc" |
| 1244 | 1244 |
amrnb_decoder_select="lsp" |
| 1245 | 1245 |
amrwb_decoder_select="lsp" |
| 1246 |
-atrac1_decoder_select="mdct" |
|
| 1246 |
+atrac1_decoder_select="mdct sinewin" |
|
| 1247 | 1247 |
atrac3_decoder_select="mdct" |
| 1248 | 1248 |
binkaudio_dct_decoder_select="mdct rdft dct" |
| 1249 | 1249 |
binkaudio_rdft_decoder_select="mdct rdft" |
| 1250 | 1250 |
cavs_decoder_select="golomb" |
| 1251 |
-cook_decoder_select="mdct" |
|
| 1251 |
+cook_decoder_select="mdct sinewin" |
|
| 1252 | 1252 |
cscd_decoder_suggest="zlib" |
| 1253 | 1253 |
dca_decoder_select="mdct" |
| 1254 | 1254 |
dnxhd_encoder_select="aandct" |
| ... | ... |
@@ -1307,8 +1308,8 @@ msmpeg4v2_decoder_select="h263_decoder" |
| 1307 | 1307 |
msmpeg4v2_encoder_select="h263_encoder" |
| 1308 | 1308 |
msmpeg4v3_decoder_select="h263_decoder" |
| 1309 | 1309 |
msmpeg4v3_encoder_select="h263_encoder" |
| 1310 |
-nellymoser_decoder_select="mdct" |
|
| 1311 |
-nellymoser_encoder_select="mdct" |
|
| 1310 |
+nellymoser_decoder_select="mdct sinewin" |
|
| 1311 |
+nellymoser_encoder_select="mdct sinewin" |
|
| 1312 | 1312 |
png_decoder_select="zlib" |
| 1313 | 1313 |
png_encoder_select="zlib" |
| 1314 | 1314 |
qcelp_decoder_select="lsp" |
| ... | ... |
@@ -1332,7 +1333,7 @@ tiff_decoder_suggest="zlib" |
| 1332 | 1332 |
tiff_encoder_suggest="zlib" |
| 1333 | 1333 |
truehd_decoder_select="mlp_decoder" |
| 1334 | 1334 |
tscc_decoder_select="zlib" |
| 1335 |
-twinvq_decoder_select="mdct lsp" |
|
| 1335 |
+twinvq_decoder_select="mdct lsp sinewin" |
|
| 1336 | 1336 |
vc1_decoder_select="h263_decoder" |
| 1337 | 1337 |
vc1_dxva2_hwaccel_deps="dxva2api_h DXVA_PictureParameters_wDecodedPictureIndex" |
| 1338 | 1338 |
vc1_dxva2_hwaccel_select="dxva2 vc1_decoder" |
| ... | ... |
@@ -1344,12 +1345,12 @@ vp6_decoder_select="huffman" |
| 1344 | 1344 |
vp6a_decoder_select="vp6_decoder" |
| 1345 | 1345 |
vp6f_decoder_select="vp6_decoder" |
| 1346 | 1346 |
vp8_decoder_select="h264pred" |
| 1347 |
-wmapro_decoder_select="mdct" |
|
| 1348 |
-wmav1_decoder_select="mdct" |
|
| 1349 |
-wmav1_encoder_select="mdct" |
|
| 1350 |
-wmav2_decoder_select="mdct" |
|
| 1351 |
-wmav2_encoder_select="mdct" |
|
| 1352 |
-wmavoice_decoder_select="lsp rdft dct mdct" |
|
| 1347 |
+wmapro_decoder_select="mdct sinewin" |
|
| 1348 |
+wmav1_decoder_select="mdct sinewin" |
|
| 1349 |
+wmav1_encoder_select="mdct sinewin" |
|
| 1350 |
+wmav2_decoder_select="mdct sinewin" |
|
| 1351 |
+wmav2_encoder_select="mdct sinewin" |
|
| 1352 |
+wmavoice_decoder_select="lsp rdft dct mdct sinewin" |
|
| 1353 | 1353 |
wmv1_decoder_select="h263_decoder" |
| 1354 | 1354 |
wmv1_encoder_select="h263_encoder" |
| 1355 | 1355 |
wmv2_decoder_select="h263_decoder" |
| ... | ... |
@@ -42,6 +42,7 @@ OBJS-$(CONFIG_LSP) += lsp.o |
| 42 | 42 |
OBJS-$(CONFIG_MDCT) += mdct.o |
| 43 | 43 |
RDFT-OBJS-$(CONFIG_HARDCODED_TABLES) += sin_tables.o |
| 44 | 44 |
OBJS-$(CONFIG_RDFT) += rdft.o $(RDFT-OBJS-yes) |
| 45 |
+OBJS-$(CONFIG_SINEWIN) += sinewin.o |
|
| 45 | 46 |
OBJS-$(CONFIG_VAAPI) += vaapi.o |
| 46 | 47 |
OBJS-$(CONFIG_VDPAU) += vdpau.o |
| 47 | 48 |
|
| ... | ... |
@@ -690,7 +691,7 @@ $(SUBDIR)%_tablegen$(HOSTEXESUF): $(SUBDIR)%_tablegen.c $(SUBDIR)%_tablegen.h $( |
| 690 | 690 |
$(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $(filter %.c,$^) $(HOSTLIBS) |
| 691 | 691 |
|
| 692 | 692 |
GEN_HEADERS = cbrt_tables.h aacps_tables.h aac_tables.h dv_tables.h \ |
| 693 |
- mdct_tables.h mpegaudio_tables.h motionpixels_tables.h \ |
|
| 693 |
+ sinewin_tables.h mpegaudio_tables.h motionpixels_tables.h \ |
|
| 694 | 694 |
pcm_tables.h qdm2_tables.h |
| 695 | 695 |
GEN_HEADERS := $(addprefix $(SUBDIR), $(GEN_HEADERS)) |
| 696 | 696 |
|
| ... | ... |
@@ -702,7 +703,7 @@ $(SUBDIR)aacdec.o: $(SUBDIR)cbrt_tables.h |
| 702 | 702 |
$(SUBDIR)aacps.o: $(SUBDIR)aacps_tables.h |
| 703 | 703 |
$(SUBDIR)aactab.o: $(SUBDIR)aac_tables.h |
| 704 | 704 |
$(SUBDIR)dv.o: $(SUBDIR)dv_tables.h |
| 705 |
-$(SUBDIR)mdct.o: $(SUBDIR)mdct_tables.h |
|
| 705 |
+$(SUBDIR)sinewin.o: $(SUBDIR)sinewin_tables.h |
|
| 706 | 706 |
$(SUBDIR)mpegaudiodec.o: $(SUBDIR)mpegaudio_tables.h |
| 707 | 707 |
$(SUBDIR)mpegaudiodec_float.o: $(SUBDIR)mpegaudio_tables.h |
| 708 | 708 |
$(SUBDIR)motionpixels.o: $(SUBDIR)motionpixels_tables.h |
| ... | ... |
@@ -62,19 +62,16 @@ struct FFTContext {
|
| 62 | 62 |
#if CONFIG_HARDCODED_TABLES |
| 63 | 63 |
#define COSTABLE_CONST const |
| 64 | 64 |
#define SINTABLE_CONST const |
| 65 |
-#define SINETABLE_CONST const |
|
| 66 | 65 |
#else |
| 67 | 66 |
#define COSTABLE_CONST |
| 68 | 67 |
#define SINTABLE_CONST |
| 69 |
-#define SINETABLE_CONST |
|
| 70 | 68 |
#endif |
| 71 | 69 |
|
| 72 | 70 |
#define COSTABLE(size) \ |
| 73 | 71 |
COSTABLE_CONST DECLARE_ALIGNED(16, FFTSample, ff_cos_##size)[size/2] |
| 74 | 72 |
#define SINTABLE(size) \ |
| 75 | 73 |
SINTABLE_CONST DECLARE_ALIGNED(16, FFTSample, ff_sin_##size)[size/2] |
| 76 |
-#define SINETABLE(size) \ |
|
| 77 |
- SINETABLE_CONST DECLARE_ALIGNED(16, float, ff_sine_##size)[size] |
|
| 74 |
+ |
|
| 78 | 75 |
extern COSTABLE(16); |
| 79 | 76 |
extern COSTABLE(32); |
| 80 | 77 |
extern COSTABLE(64); |
| ... | ... |
@@ -124,27 +121,6 @@ void ff_dct_init_mmx(DCTContext *s); |
| 124 | 124 |
|
| 125 | 125 |
void ff_fft_end(FFTContext *s); |
| 126 | 126 |
|
| 127 |
-/** |
|
| 128 |
- * Generate a sine window. |
|
| 129 |
- * @param window pointer to half window |
|
| 130 |
- * @param n size of half window |
|
| 131 |
- */ |
|
| 132 |
-void ff_sine_window_init(float *window, int n); |
|
| 133 |
- |
|
| 134 |
-/** |
|
| 135 |
- * initialize the specified entry of ff_sine_windows |
|
| 136 |
- */ |
|
| 137 |
-void ff_init_ff_sine_windows(int index); |
|
| 138 |
-extern SINETABLE( 32); |
|
| 139 |
-extern SINETABLE( 64); |
|
| 140 |
-extern SINETABLE( 128); |
|
| 141 |
-extern SINETABLE( 256); |
|
| 142 |
-extern SINETABLE( 512); |
|
| 143 |
-extern SINETABLE(1024); |
|
| 144 |
-extern SINETABLE(2048); |
|
| 145 |
-extern SINETABLE(4096); |
|
| 146 |
-extern SINETABLE_CONST float * const ff_sine_windows[13]; |
|
| 147 |
- |
|
| 148 | 127 |
int ff_mdct_init(FFTContext *s, int nbits, int inverse, double scale); |
| 149 | 128 |
void ff_imdct_calc_c(FFTContext *s, FFTSample *output, const FFTSample *input); |
| 150 | 129 |
void ff_imdct_half_c(FFTContext *s, FFTSample *output, const FFTSample *input); |
| 38 | 36 |
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 Libav. |
|
| 7 |
- * |
|
| 8 |
- * Libav 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 |
- * Libav 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 Libav; 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 Libav. |
|
| 7 |
- * |
|
| 8 |
- * Libav 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 |
- * Libav 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 Libav; 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 |
-} |
| 45 | 46 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,20 @@ |
| 0 |
+/* |
|
| 1 |
+ * This file is part of Libav. |
|
| 2 |
+ * |
|
| 3 |
+ * Libav 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 |
+ * Libav 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 Libav; 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 Libav. |
|
| 4 |
+ * |
|
| 5 |
+ * Libav 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 |
+ * Libav 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 Libav; 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 Libav. |
|
| 6 |
+ * |
|
| 7 |
+ * Libav 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 |
+ * Libav 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 Libav; 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 Libav. |
|
| 6 |
+ * |
|
| 7 |
+ * Libav 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 |
+ * Libav 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 Libav; 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 |
+} |