comparison mdct.c @ 10827:3d011a01a6a0 libavcodec

Add support for hard-coded MDCT-related ff_sine_windows tables.
author reimar
date Sat, 09 Jan 2010 13:28:04 +0000
parents db033d1fbf44
children 4b3da727d832
comparison
equal deleted inserted replaced
10826:59c35482189e 10827:3d011a01a6a0
46 sum++; 46 sum++;
47 for (i = 0; i < n; i++) 47 for (i = 0; i < n; i++)
48 window[i] = sqrt(local_window[i] / sum); 48 window[i] = sqrt(local_window[i] / sum);
49 } 49 }
50 50
51 DECLARE_ALIGNED(16, float, ff_sine_32 [ 32]); 51 #include "mdct_tablegen.h"
52 DECLARE_ALIGNED(16, float, ff_sine_64 [ 64]);
53 DECLARE_ALIGNED(16, float, ff_sine_128 [ 128]);
54 DECLARE_ALIGNED(16, float, ff_sine_256 [ 256]);
55 DECLARE_ALIGNED(16, float, ff_sine_512 [ 512]);
56 DECLARE_ALIGNED(16, float, ff_sine_1024[1024]);
57 DECLARE_ALIGNED(16, float, ff_sine_2048[2048]);
58 DECLARE_ALIGNED(16, float, ff_sine_4096[4096]);
59 float * const ff_sine_windows[] = {
60 NULL, NULL, NULL, NULL, NULL, // unused
61 ff_sine_32 , ff_sine_64 ,
62 ff_sine_128, ff_sine_256, ff_sine_512, ff_sine_1024, ff_sine_2048, ff_sine_4096
63 };
64
65 // Generate a sine window.
66 av_cold void ff_sine_window_init(float *window, int n) {
67 int i;
68 for(i = 0; i < n; i++)
69 window[i] = sinf((i + 0.5) * (M_PI / (2.0 * n)));
70 }
71 52
72 /** 53 /**
73 * init MDCT or IMDCT computation. 54 * init MDCT or IMDCT computation.
74 */ 55 */
75 av_cold int ff_mdct_init(FFTContext *s, int nbits, int inverse, double scale) 56 av_cold int ff_mdct_init(FFTContext *s, int nbits, int inverse, double scale)