| OLD | NEW |
| 1 /* Copyright (c) 2008-2011 Xiph.Org Foundation | 1 /* Copyright (c) 2008-2011 Xiph.Org Foundation |
| 2 Written by Jean-Marc Valin */ | 2 Written by Jean-Marc Valin */ |
| 3 /* | 3 /* |
| 4 Redistribution and use in source and binary forms, with or without | 4 Redistribution and use in source and binary forms, with or without |
| 5 modification, are permitted provided that the following conditions | 5 modification, are permitted provided that the following conditions |
| 6 are met: | 6 are met: |
| 7 | 7 |
| 8 - Redistributions of source code must retain the above copyright | 8 - Redistributions of source code must retain the above copyright |
| 9 notice, this list of conditions and the following disclaimer. | 9 notice, this list of conditions and the following disclaimer. |
| 10 | 10 |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 | 144 |
| 145 for (k=0;k<nfft;++k) | 145 for (k=0;k<nfft;++k) |
| 146 in_copy[k] = in[k]; | 146 in_copy[k] = in[k]; |
| 147 /*for (k=0;k<nfft;++k) printf("%d %d ", in[k].r, in[k].i);printf("\n");*/ | 147 /*for (k=0;k<nfft;++k) printf("%d %d ", in[k].r, in[k].i);printf("\n");*/ |
| 148 | 148 |
| 149 if (isinverse) | 149 if (isinverse) |
| 150 { | 150 { |
| 151 for (k=0;k<nfft;++k) | 151 for (k=0;k<nfft;++k) |
| 152 out[k] = 0; | 152 out[k] = 0; |
| 153 clt_mdct_backward(&cfg,in,out, window, nfft/2, 0, 1); | 153 clt_mdct_backward(&cfg,in,out, window, nfft/2, 0, 1); |
| 154 /* apply TDAC because clt_mdct_backward() no longer does that */ |
| 155 for (k=0;k<nfft/4;++k) |
| 156 out[nfft-k-1] = out[nfft/2+k]; |
| 154 check_inv(in,out,nfft,isinverse); | 157 check_inv(in,out,nfft,isinverse); |
| 155 } else { | 158 } else { |
| 156 clt_mdct_forward(&cfg,in,out,window, nfft/2, 0, 1); | 159 clt_mdct_forward(&cfg,in,out,window, nfft/2, 0, 1); |
| 157 check(in_copy,out,nfft,isinverse); | 160 check(in_copy,out,nfft,isinverse); |
| 158 } | 161 } |
| 159 /*for (k=0;k<nfft;++k) printf("%d %d ", out[k].r, out[k].i);printf("\n");*/ | 162 /*for (k=0;k<nfft;++k) printf("%d %d ", out[k].r, out[k].i);printf("\n");*/ |
| 160 | 163 |
| 161 | 164 |
| 162 free(in); | 165 free(in); |
| 163 free(out); | 166 free(out); |
| 164 clt_mdct_clear(&cfg); | 167 clt_mdct_clear(&cfg); |
| 165 } | 168 } |
| 166 | 169 |
| 167 int main(int argc,char ** argv) | 170 int main(int argc,char ** argv) |
| 168 { | 171 { |
| 169 ALLOC_STACK; | 172 ALLOC_STACK; |
| 170 if (argc>1) { | 173 if (argc>1) { |
| 171 int k; | 174 int k; |
| 172 for (k=1;k<argc;++k) { | 175 for (k=1;k<argc;++k) { |
| 173 test1d(atoi(argv[k]),0); | 176 test1d(atoi(argv[k]),0); |
| 174 test1d(atoi(argv[k]),1); | 177 test1d(atoi(argv[k]),1); |
| 175 } | 178 } |
| 176 }else{ | 179 }else{ |
| 177 test1d(32,0); | 180 test1d(32,0); |
| 178 test1d(32,1); | 181 test1d(32,1); |
| 179 test1d(256,0); | 182 test1d(256,0); |
| 180 test1d(256,1); | 183 test1d(256,1); |
| 181 test1d(512,0); | 184 test1d(512,0); |
| 182 test1d(512,1); | 185 test1d(512,1); |
| 186 test1d(1024,0); |
| 187 test1d(1024,1); |
| 188 test1d(2048,0); |
| 189 test1d(2048,1); |
| 183 #ifndef RADIX_TWO_ONLY | 190 #ifndef RADIX_TWO_ONLY |
| 191 test1d(36,0); |
| 192 test1d(36,1); |
| 184 test1d(40,0); | 193 test1d(40,0); |
| 185 test1d(40,1); | 194 test1d(40,1); |
| 195 test1d(60,0); |
| 196 test1d(60,1); |
| 186 test1d(120,0); | 197 test1d(120,0); |
| 187 test1d(120,1); | 198 test1d(120,1); |
| 188 test1d(240,0); | 199 test1d(240,0); |
| 189 test1d(240,1); | 200 test1d(240,1); |
| 190 test1d(480,0); | 201 test1d(480,0); |
| 191 test1d(480,1); | 202 test1d(480,1); |
| 203 test1d(960,0); |
| 204 test1d(960,1); |
| 205 test1d(1920,0); |
| 206 test1d(1920,1); |
| 192 #endif | 207 #endif |
| 193 } | 208 } |
| 194 return ret; | 209 return ret; |
| 195 } | 210 } |
| OLD | NEW |