1 #include "TransformF32.h" 2 #include "Error.h" 3 test_cfft_f32()4 void TransformF32::test_cfft_f32() 5 { 6 arm_cfft_f32(&(this->cfftInstance), this->pDst, this->ifft,this->bitRev); 7 } 8 test_rfft_f32()9 void TransformF32::test_rfft_f32() 10 { 11 arm_rfft_fast_f32(&this->rfftFastInstance, this->pTmp, this->pDst, this->ifft); 12 } 13 test_dct4_f32()14 void TransformF32::test_dct4_f32() 15 { 16 arm_dct4_f32( 17 &this->dct4Instance, 18 this->pState, 19 this->pDst); 20 } 21 test_cfft_radix4_f32()22 void TransformF32::test_cfft_radix4_f32() 23 { 24 arm_cfft_radix4_f32(&this->cfftRadix4Instance,this->pDst); 25 } 26 test_cfft_radix2_f32()27 void TransformF32::test_cfft_radix2_f32() 28 { 29 arm_cfft_radix2_f32(&this->cfftRadix2Instance,this->pDst); 30 } 31 32 setUp(Testing::testID_t id,std::vector<Testing::param_t> & params,Client::PatternMgr * mgr)33 void TransformF32::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_F32_1: 46 samples.reload(TransformF32::INPUTC_F32_ID,mgr,2*this->nbSamples); 47 output.create(2*this->nbSamples,TransformF32::OUT_F32_ID,mgr); 48 49 this->pSrc=samples.ptr(); 50 this->pDst=output.ptr(); 51 52 status=arm_cfft_init_f32(&cfftInstance,this->nbSamples); 53 memcpy(this->pDst,this->pSrc,2*sizeof(float32_t)*this->nbSamples); 54 break; 55 56 case TEST_RFFT_F32_2: 57 // Factor 2 for rifft 58 samples.reload(TransformF32::INPUTR_F32_ID,mgr,2*this->nbSamples); 59 output.create(this->nbSamples,TransformF32::OUT_F32_ID,mgr); 60 tmp.create(this->nbSamples,TransformF32::TMP_F32_ID,mgr); 61 62 this->pSrc=samples.ptr(); 63 this->pDst=output.ptr(); 64 this->pTmp=tmp.ptr(); 65 66 memcpy(this->pTmp,this->pSrc,sizeof(float32_t)*this->nbSamples); 67 68 arm_rfft_fast_init_f32(&this->rfftFastInstance, this->nbSamples); 69 break; 70 71 case TEST_DCT4_F32_3: 72 samples.reload(TransformF32::INPUTR_F32_ID,mgr,this->nbSamples); 73 output.create(this->nbSamples,TransformF32::OUT_F32_ID,mgr); 74 state.create(2*this->nbSamples,TransformF32::STATE_F32_ID,mgr); 75 76 this->pSrc=samples.ptr(); 77 this->pDst=output.ptr(); 78 this->pState=state.ptr(); 79 80 normalize = sqrt((2.0f/(float32_t)this->nbSamples)); 81 82 memcpy(this->pDst,this->pSrc,sizeof(float32_t)*this->nbSamples); 83 84 arm_dct4_init_f32( 85 &this->dct4Instance, 86 &this->rfftInstance, 87 &this->cfftRadix4Instance, 88 this->nbSamples, 89 this->nbSamples/2, 90 normalize); 91 break; 92 93 case TEST_CFFT_RADIX4_F32_4: 94 samples.reload(TransformF32::INPUTC_F32_ID,mgr,2*this->nbSamples); 95 output.create(2*this->nbSamples,TransformF32::OUT_F32_ID,mgr); 96 97 this->pSrc=samples.ptr(); 98 this->pDst=output.ptr(); 99 100 101 memcpy(this->pDst,this->pSrc,2*sizeof(float32_t)*this->nbSamples); 102 103 arm_cfft_radix4_init_f32(&this->cfftRadix4Instance, 104 this->nbSamples, 105 this->ifft, 106 this->bitRev); 107 108 break; 109 110 case TEST_CFFT_RADIX2_F32_5: 111 samples.reload(TransformF32::INPUTC_F32_ID,mgr,2*this->nbSamples); 112 output.create(2*this->nbSamples,TransformF32::OUT_F32_ID,mgr); 113 114 this->pSrc=samples.ptr(); 115 this->pDst=output.ptr(); 116 117 118 memcpy(this->pDst,this->pSrc,2*sizeof(float32_t)*this->nbSamples); 119 120 arm_cfft_radix2_init_f32(&this->cfftRadix2Instance, 121 this->nbSamples, 122 this->ifft, 123 this->bitRev); 124 break; 125 126 } 127 128 129 130 131 } 132 tearDown(Testing::testID_t id,Client::PatternMgr * mgr)133 void TransformF32::tearDown(Testing::testID_t id,Client::PatternMgr *mgr) 134 { 135 } 136