1 #include "TransformQ15.h" 2 #include "Error.h" 3 4 test_cfft_q15()5 void TransformQ15::test_cfft_q15() 6 { 7 arm_cfft_q15(&this->cfftInstance, this->pDst, this->ifft,this->bitRev); 8 } 9 test_rfft_q15()10 void TransformQ15::test_rfft_q15() 11 { 12 arm_rfft_q15(&this->rfftInstance, this->pSrc, this->pDst); 13 } 14 test_dct4_q15()15 void TransformQ15::test_dct4_q15() 16 { 17 arm_dct4_q15( 18 &this->dct4Instance, 19 this->pState, 20 this->pDst); 21 } 22 test_cfft_radix4_q15()23 void TransformQ15::test_cfft_radix4_q15() 24 { 25 arm_cfft_radix4_q15(&this->cfftRadix4Instance,this->pDst); 26 } 27 test_cfft_radix2_q15()28 void TransformQ15::test_cfft_radix2_q15() 29 { 30 arm_cfft_radix2_q15(&this->cfftRadix2Instance,this->pDst); 31 } 32 33 setUp(Testing::testID_t id,std::vector<Testing::param_t> & params,Client::PatternMgr * mgr)34 void TransformQ15::setUp(Testing::testID_t id,std::vector<Testing::param_t>& params,Client::PatternMgr *mgr) 35 { 36 37 float32_t normalize; 38 39 std::vector<Testing::param_t>::iterator it = params.begin(); 40 this->nbSamples = *it++; 41 this->ifft = *it++; 42 this->bitRev = *it; 43 44 switch(id) 45 { 46 case TEST_CFFT_Q15_1: 47 samples.reload(TransformQ15::INPUTC_Q15_ID,mgr,2*this->nbSamples); 48 output.create(2*this->nbSamples,TransformQ15::OUT_Q15_ID,mgr); 49 50 this->pSrc=samples.ptr(); 51 this->pDst=output.ptr(); 52 53 arm_cfft_init_q15(&this->cfftInstance,this->nbSamples); 54 memcpy(this->pDst,this->pSrc,2*sizeof(q15_t)*this->nbSamples); 55 break; 56 57 case TEST_RFFT_Q15_2: 58 samples.reload(TransformQ15::INPUTR_Q15_ID,mgr,this->nbSamples); 59 output.create(this->nbSamples,TransformQ15::OUT_Q15_ID,mgr); 60 61 this->pSrc=samples.ptr(); 62 this->pDst=output.ptr(); 63 64 arm_rfft_init_q15(&this->rfftInstance, this->nbSamples, this->ifft, this->bitRev); 65 break; 66 67 case TEST_DCT4_Q15_3: 68 samples.reload(TransformQ15::INPUTR_Q15_ID,mgr,this->nbSamples); 69 output.create(this->nbSamples,TransformQ15::OUT_Q15_ID,mgr); 70 state.create(2*this->nbSamples,TransformQ15::STATE_Q15_ID,mgr); 71 72 73 this->pSrc=samples.ptr(); 74 this->pDst=output.ptr(); 75 this->pState=state.ptr(); 76 77 normalize = sqrt((2.0f/(float32_t)this->nbSamples)); 78 79 memcpy(this->pDst,this->pSrc,sizeof(q15_t)*this->nbSamples); 80 81 arm_dct4_init_q15( 82 &this->dct4Instance, 83 &this->rfftInstance, 84 &this->cfftRadix4Instance, 85 this->nbSamples, 86 this->nbSamples/2, 87 normalize); 88 break; 89 90 case TEST_CFFT_RADIX4_Q15_4: 91 samples.reload(TransformQ15::INPUTC_Q15_ID,mgr,2*this->nbSamples); 92 output.create(2*this->nbSamples,TransformQ15::OUT_Q15_ID,mgr); 93 94 this->pSrc=samples.ptr(); 95 this->pDst=output.ptr(); 96 97 98 memcpy(this->pDst,this->pSrc,2*sizeof(q15_t)*this->nbSamples); 99 100 arm_cfft_radix4_init_q15(&this->cfftRadix4Instance, 101 this->nbSamples, 102 this->ifft, 103 this->bitRev); 104 105 break; 106 107 case TEST_CFFT_RADIX2_Q15_5: 108 samples.reload(TransformQ15::INPUTC_Q15_ID,mgr,2*this->nbSamples); 109 output.create(2*this->nbSamples,TransformQ15::OUT_Q15_ID,mgr); 110 111 this->pSrc=samples.ptr(); 112 this->pDst=output.ptr(); 113 114 115 memcpy(this->pDst,this->pSrc,2*sizeof(q15_t)*this->nbSamples); 116 117 arm_cfft_radix2_init_q15(&this->cfftRadix2Instance, 118 this->nbSamples, 119 this->ifft, 120 this->bitRev); 121 break; 122 123 } 124 125 126 127 128 } 129 tearDown(Testing::testID_t id,Client::PatternMgr * mgr)130 void TransformQ15::tearDown(Testing::testID_t id,Client::PatternMgr *mgr) 131 { 132 } 133