1 #include "TransformQ31.h"
2 #include "Error.h"
3 
test_cfft_q31()4     void TransformQ31::test_cfft_q31()
5     {
6        arm_cfft_q31(&this->cfftInstance, this->pDst, this->ifft,this->bitRev);
7     }
8 
test_rfft_q31()9     void TransformQ31::test_rfft_q31()
10     {
11        arm_rfft_q31(&this->rfftInstance, this->pSrc, this->pDst);
12     }
13 
test_dct4_q31()14     void TransformQ31::test_dct4_q31()
15     {
16         arm_dct4_q31(
17           &this->dct4Instance,
18           this->pState,
19           this->pDst);
20     }
21 
test_cfft_radix4_q31()22     void TransformQ31::test_cfft_radix4_q31()
23     {
24        arm_cfft_radix4_q31(&this->cfftRadix4Instance,this->pDst);
25     }
26 
test_cfft_radix2_q31()27     void TransformQ31::test_cfft_radix2_q31()
28     {
29        arm_cfft_radix2_q31(&this->cfftRadix2Instance,this->pDst);
30     }
31 
32 
setUp(Testing::testID_t id,std::vector<Testing::param_t> & params,Client::PatternMgr * mgr)33     void TransformQ31::setUp(Testing::testID_t id,std::vector<Testing::param_t>& params,Client::PatternMgr *mgr)
34     {
35 
36        float32_t normalize;
37 
38        std::vector<Testing::param_t>::iterator it = params.begin();
39        this->nbSamples = *it++;
40        this->ifft = *it++;
41        this->bitRev = *it;
42 
43        switch(id)
44        {
45           case TEST_CFFT_Q31_1:
46             samples.reload(TransformQ31::INPUTC_Q31_ID,mgr,2*this->nbSamples);
47             output.create(2*this->nbSamples,TransformQ31::OUT_Q31_ID,mgr);
48 
49             this->pSrc=samples.ptr();
50             this->pDst=output.ptr();
51 
52             arm_cfft_init_q31(&this->cfftInstance,this->nbSamples);
53             memcpy(this->pDst,this->pSrc,2*sizeof(q31_t)*this->nbSamples);
54           break;
55 
56           case TEST_RFFT_Q31_2:
57             samples.reload(TransformQ31::INPUTR_Q31_ID,mgr,this->nbSamples);
58             output.create(this->nbSamples,TransformQ31::OUT_Q31_ID,mgr);
59 
60             this->pSrc=samples.ptr();
61             this->pDst=output.ptr();
62 
63             arm_rfft_init_q31(&this->rfftInstance, this->nbSamples,this->ifft,this->bitRev);
64           break;
65 
66           case TEST_DCT4_Q31_3:
67             samples.reload(TransformQ31::INPUTR_Q31_ID,mgr,this->nbSamples);
68             output.create(this->nbSamples,TransformQ31::OUT_Q31_ID,mgr);
69             state.create(2*this->nbSamples,TransformQ31::STATE_Q31_ID,mgr);
70 
71 
72             this->pSrc=samples.ptr();
73             this->pDst=output.ptr();
74             this->pState=state.ptr();
75 
76             normalize = sqrt((2.0f/(float32_t)this->nbSamples));
77 
78             memcpy(this->pDst,this->pSrc,sizeof(q31_t)*this->nbSamples);
79 
80             arm_dct4_init_q31(
81                &this->dct4Instance,
82                &this->rfftInstance,
83                &this->cfftRadix4Instance,
84                this->nbSamples,
85                this->nbSamples/2,
86                normalize);
87           break;
88 
89           case TEST_CFFT_RADIX4_Q31_4:
90             samples.reload(TransformQ31::INPUTC_Q31_ID,mgr,2*this->nbSamples);
91             output.create(2*this->nbSamples,TransformQ31::OUT_Q31_ID,mgr);
92 
93             this->pSrc=samples.ptr();
94             this->pDst=output.ptr();
95 
96 
97             memcpy(this->pDst,this->pSrc,2*sizeof(q31_t)*this->nbSamples);
98 
99             arm_cfft_radix4_init_q31(&this->cfftRadix4Instance,
100                 this->nbSamples,
101                 this->ifft,
102                 this->bitRev);
103 
104           break;
105 
106           case TEST_CFFT_RADIX2_Q31_5:
107             samples.reload(TransformQ31::INPUTC_Q31_ID,mgr,2*this->nbSamples);
108             output.create(2*this->nbSamples,TransformQ31::OUT_Q31_ID,mgr);
109 
110             this->pSrc=samples.ptr();
111             this->pDst=output.ptr();
112 
113 
114             memcpy(this->pDst,this->pSrc,2*sizeof(q31_t)*this->nbSamples);
115 
116             arm_cfft_radix2_init_q31(&this->cfftRadix2Instance,
117                 this->nbSamples,
118                 this->ifft,
119                 this->bitRev);
120           break;
121 
122        }
123 
124 
125 
126 
127     }
128 
tearDown(Testing::testID_t id,Client::PatternMgr * mgr)129     void TransformQ31::tearDown(Testing::testID_t id,Client::PatternMgr *mgr)
130     {
131     }
132