comparison rdft.c @ 11391:4c7afa50df6f libavcodec

Give RDFT types more meaningful names
author mru
date Sun, 07 Mar 2010 21:47:44 +0000
parents 1cd8731bbe7f
children 6f1697664bf2
comparison
equal deleted inserted replaced
11390:4a8900c06c67 11391:4c7afa50df6f
51 51
52 av_cold int ff_rdft_init(RDFTContext *s, int nbits, enum RDFTransformType trans) 52 av_cold int ff_rdft_init(RDFTContext *s, int nbits, enum RDFTransformType trans)
53 { 53 {
54 int n = 1 << nbits; 54 int n = 1 << nbits;
55 int i; 55 int i;
56 const double theta = (trans == RDFT || trans == IRIDFT ? -1 : 1)*2*M_PI/n; 56 const double theta = (trans == DFT_R2C || trans == DFT_C2R ? -1 : 1)*2*M_PI/n;
57 57
58 s->nbits = nbits; 58 s->nbits = nbits;
59 s->inverse = trans == IRDFT || trans == IRIDFT; 59 s->inverse = trans == IDFT_C2R || trans == DFT_C2R;
60 s->sign_convention = trans == RIDFT || trans == IRIDFT ? 1 : -1; 60 s->sign_convention = trans == IDFT_R2C || trans == DFT_C2R ? 1 : -1;
61 61
62 if (nbits < 4 || nbits > 16) 62 if (nbits < 4 || nbits > 16)
63 return -1; 63 return -1;
64 64
65 if (ff_fft_init(&s->fft, nbits-1, trans == IRDFT || trans == RIDFT) < 0) 65 if (ff_fft_init(&s->fft, nbits-1, trans == IDFT_C2R || trans == IDFT_R2C) < 0)
66 return -1; 66 return -1;
67 67
68 ff_init_ff_cos_tabs(nbits); 68 ff_init_ff_cos_tabs(nbits);
69 s->tcos = ff_cos_tabs[nbits]; 69 s->tcos = ff_cos_tabs[nbits];
70 s->tsin = ff_sin_tabs[nbits]+(trans == RDFT || trans == IRIDFT)*(n>>2); 70 s->tsin = ff_sin_tabs[nbits]+(trans == DFT_R2C || trans == DFT_C2R)*(n>>2);
71 #if !CONFIG_HARDCODED_TABLES 71 #if !CONFIG_HARDCODED_TABLES
72 for (i = 0; i < (n>>2); i++) { 72 for (i = 0; i < (n>>2); i++) {
73 s->tsin[i] = sin(i*theta); 73 s->tsin[i] = sin(i*theta);
74 } 74 }
75 #endif 75 #endif