comparison rdft.c @ 10492:63910f7ba293 libavcodec

Pad ff_cos_tabs and ff_sin_tabs so that index n points to the table for n bits. While this "wastes" up to 2x32 bytes it makes the code slightly simpler and less confusing.
author reimar
date Wed, 04 Nov 2009 17:30:23 +0000
parents 8fd8f6c1cdcc
children 74b0c1a0851e
comparison
equal deleted inserted replaced
10491:74e51b86b934 10492:63910f7ba293
41 SINTABLE(16384); 41 SINTABLE(16384);
42 SINTABLE(32768); 42 SINTABLE(32768);
43 SINTABLE(65536); 43 SINTABLE(65536);
44 #endif 44 #endif
45 SINTABLE_CONST FFTSample * const ff_sin_tabs[] = { 45 SINTABLE_CONST FFTSample * const ff_sin_tabs[] = {
46 NULL, NULL, NULL, NULL,
46 ff_sin_16, ff_sin_32, ff_sin_64, ff_sin_128, ff_sin_256, ff_sin_512, ff_sin_1024, 47 ff_sin_16, ff_sin_32, ff_sin_64, ff_sin_128, ff_sin_256, ff_sin_512, ff_sin_1024,
47 ff_sin_2048, ff_sin_4096, ff_sin_8192, ff_sin_16384, ff_sin_32768, ff_sin_65536, 48 ff_sin_2048, ff_sin_4096, ff_sin_8192, ff_sin_16384, ff_sin_32768, ff_sin_65536,
48 }; 49 };
49 50
50 av_cold int ff_rdft_init(RDFTContext *s, int nbits, enum RDFTransformType trans) 51 av_cold int ff_rdft_init(RDFTContext *s, int nbits, enum RDFTransformType trans)
61 return -1; 62 return -1;
62 63
63 if (ff_fft_init(&s->fft, nbits-1, trans == IRDFT || trans == RIDFT) < 0) 64 if (ff_fft_init(&s->fft, nbits-1, trans == IRDFT || trans == RIDFT) < 0)
64 return -1; 65 return -1;
65 66
66 s->tcos = ff_cos_tabs[nbits-4]; 67 s->tcos = ff_cos_tabs[nbits];
67 s->tsin = ff_sin_tabs[nbits-4]+(trans == RDFT || trans == IRIDFT)*(n>>2); 68 s->tsin = ff_sin_tabs[nbits]+(trans == RDFT || trans == IRIDFT)*(n>>2);
68 #if !CONFIG_HARDCODED_TABLES 69 #if !CONFIG_HARDCODED_TABLES
69 for (i = 0; i < (n>>2); i++) { 70 for (i = 0; i < (n>>2); i++) {
70 s->tsin[i] = sin(i*theta); 71 s->tsin[i] = sin(i*theta);
71 } 72 }
72 #endif 73 #endif